From fdeea341ed1bae670382e45eb731db1b5838ad21 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 11 Mar 1998 21:11:04 +0000 Subject: "For I have laboured mightily on Luke's code, and hath broken all I saw" - the book of Jeremy, chapter 1 :-). So here is the mega-merge of the NTDOM branch server code. It doesn't include the new client side pieces, we'll look at that later. This should give the same functionality, server wise, as the NTDOM branch does, only merged into the main branch. Any fixes to domain controler functionality should be added to the main branch, not the NTDOM branch. This code compiles without warnings on gcc2.8, but will need further testing before we are sure all the working functionality of the NTDOM server branch has been correctly carried over. I hereby declare the server side of the NTDOM branch dead (and all who sail in her :-). Jeremy. (This used to be commit 118ba4d77a33248e762a2cf843fb7cbc906ee6e7) --- source3/rpc_parse/parse_lsa.c | 567 ++++++++ source3/rpc_parse/parse_misc.c | 981 ++++++++++++++ source3/rpc_parse/parse_net.c | 1147 ++++++++++++++++ source3/rpc_parse/parse_prs.c | 290 +++++ source3/rpc_parse/parse_reg.c | 335 +++++ source3/rpc_parse/parse_rpc.c | 528 ++++++++ source3/rpc_parse/parse_samr.c | 2796 ++++++++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_srv.c | 1528 ++++++++++++++++++++++ source3/rpc_parse/parse_wks.c | 146 +++ 9 files changed, 8318 insertions(+) create mode 100644 source3/rpc_parse/parse_lsa.c create mode 100644 source3/rpc_parse/parse_misc.c create mode 100644 source3/rpc_parse/parse_net.c create mode 100644 source3/rpc_parse/parse_prs.c create mode 100644 source3/rpc_parse/parse_reg.c create mode 100644 source3/rpc_parse/parse_rpc.c create mode 100644 source3/rpc_parse/parse_samr.c create mode 100644 source3/rpc_parse/parse_srv.c create mode 100644 source3/rpc_parse/parse_wks.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c new file mode 100644 index 0000000000..6eb42fc749 --- /dev/null +++ b/source3/rpc_parse/parse_lsa.c @@ -0,0 +1,567 @@ +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "includes.h" +#include "nterr.h" + +extern int DEBUGLEVEL; + + +/******************************************************************* +creates a LSA_TRANS_NAME structure. +********************************************************************/ +void make_lsa_trans_name(LSA_TRANS_NAME *trn, uint32 sid_name_use, char *name, uint32 idx) +{ + int len_name = strlen(name); + + trn->sid_name_use = sid_name_use; + make_uni_hdr(&(trn->hdr_name), len_name, len_name, len_name != 0); + make_unistr2(&(trn->uni_name), name, len_name); + trn->domain_idx = idx; +} + +/******************************************************************* +reads or writes a LSA_TRANS_NAME structure. +********************************************************************/ +void lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, int depth) +{ + if (trn == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_trans_name"); + depth++; + + prs_align(ps); + + prs_uint32("sid_name_use", ps, depth, &(trn->sid_name_use)); + + smb_io_unihdr ("hdr_name", &(trn->hdr_name), ps, depth); + smb_io_unistr2("uni_name", &(trn->uni_name), trn->hdr_name.buffer, ps, depth); + + prs_uint32("domain_idx ", ps, depth, &(trn->domain_idx )); +} + +/******************************************************************* +reads or writes a DOM_R_REF structure. +********************************************************************/ +void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) +{ + int i; + + prs_debug(ps, depth, desc, "smb_io_dom_r_ref"); + depth++; + + if (r_r == NULL) return; + + prs_align(ps); + + prs_uint32("undoc_buffer ", ps, depth, &(r_r->undoc_buffer)); /* undocumented buffer pointer. */ + prs_uint32("num_ref_doms_1 ", ps, depth, &(r_r->num_ref_doms_1)); /* num referenced domains? */ + prs_uint32("buffer_dom_name", ps, depth, &(r_r->buffer_dom_name)); /* undocumented domain name buffer pointer. */ + prs_uint32("max_entries ", ps, depth, &(r_r->max_entries)); /* 32 - max number of entries */ + prs_uint32("num_ref_doms_2 ", ps, depth, &(r_r->num_ref_doms_2)); /* 4 - num referenced domains? */ + + smb_io_unihdr2("", &(r_r->hdr_dom_name), ps, depth); /* domain name unicode string header */ + + for (i = 0; i < r_r->num_ref_doms_1-1; i++) + { + smb_io_unihdr2("", &(r_r->hdr_ref_dom[i]), ps, depth); + } + + smb_io_unistr("", &(r_r->uni_dom_name), ps, depth); /* domain name unicode string */ + + for (i = 0; i < r_r->num_ref_doms_2; i++) + { + smb_io_dom_sid2("", &(r_r->ref_dom[i]), ps, depth); /* referenced domain SIDs */ + } +} + +/******************************************************************* +makes an LSA_OBJ_ATTR structure. +********************************************************************/ +void make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, uint32 sec_qos) +{ + if (attr == NULL) return; + + DEBUG(5,("make_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; + attr->sec_qos = sec_qos; +} + +/******************************************************************* +reads or writes an LSA_OBJ_ATTR structure. +********************************************************************/ +void lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int depth) +{ + int start; + + if (attr == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_obj_attr"); + depth++; + + prs_align(ps); + + start = ps->offset; + + /* these pointers had _better_ be zero, because we don't know + what they point to! + */ + prs_uint32("len" , ps, depth, &(attr->len )); /* 0x18 - length (in bytes) inc. the length field. */ + prs_uint32("ptr_root_dir", ps, depth, &(attr->ptr_root_dir)); /* 0 - root directory (pointer) */ + prs_uint32("ptr_obj_name", ps, depth, &(attr->ptr_obj_name)); /* 0 - object name (pointer) */ + prs_uint32("attributes" , ps, depth, &(attr->attributes )); /* 0 - attributes (undocumented) */ + prs_uint32("ptr_sec_desc", ps, depth, &(attr->ptr_sec_desc)); /* 0 - security descriptior (pointer) */ + prs_uint32("sec_qos" , ps, depth, &(attr->sec_qos )); /* 0 - security quality of service */ + + if (attr->len != ps->offset - start) + { + DEBUG(3,("lsa_io_obj_attr: length %lx does not match size %lx\n", + attr->len, ps->offset - start)); + } +} +/******************************************************************* +makes an LSA_Q_OPEN_POL structure. +********************************************************************/ +void make_q_open_pol(LSA_Q_OPEN_POL *r_q, char *server_name, + uint32 attributes, uint32 sec_qos, + uint32 desired_access) +{ + if (r_q == NULL) return; + + DEBUG(5,("make_open_pol\n")); + + r_q->ptr = 1; /* undocumented pointer */ + + make_unistr2 (&(r_q->uni_server_name), server_name, strlen(server_name)); + make_lsa_obj_attr(&(r_q->attr ), attributes, sec_qos); + + r_q->des_access = desired_access; +} + +/******************************************************************* +reads or writes an LSA_Q_OPEN_POL structure. +********************************************************************/ +void lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_q_open_pol"); + depth++; + + prs_uint32("ptr ", ps, depth, &(r_q->ptr )); + + smb_io_unistr2 ("", &(r_q->uni_server_name), r_q->ptr, ps, depth); + lsa_io_obj_attr("", &(r_q->attr ), ps, depth); + + prs_uint32("des_access", ps, depth, &(r_q->des_access)); +} + +/******************************************************************* +reads or writes an LSA_R_OPEN_POL structure. +********************************************************************/ +void lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int depth) +{ + if (r_p == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_r_open_pol"); + depth++; + + + smb_io_pol_hnd("", &(r_p->pol), ps, depth); + + prs_uint32("status", ps, depth, &(r_p->status)); +} + +/******************************************************************* +makes an LSA_Q_QUERY_INFO structure. +********************************************************************/ +void make_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class) +{ + if (q_q == NULL || hnd == NULL) return; + + DEBUG(5,("make_q_query\n")); + + memcpy(&(q_q->pol), hnd, sizeof(q_q->pol)); + + q_q->info_class = info_class; +} + +/******************************************************************* +reads or writes an LSA_Q_QUERY_INFO structure. +********************************************************************/ +void lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int depth) +{ + if (q_q == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_q_query"); + depth++; + + smb_io_pol_hnd("", &(q_q->pol), ps, depth); + + prs_uint16("info_class", ps, depth, &(q_q->info_class)); +} + +/******************************************************************* +reads or writes an LSA_Q_ENUM_TRUST_DOM structure. +********************************************************************/ +void lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct *ps, int depth) +{ + if (q_e == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_q_enum_trust_dom"); + depth++; + + + smb_io_pol_hnd("", &(q_e->pol), ps, depth); + + prs_uint32("enum_context ", ps, depth, &(q_e->enum_context )); + prs_uint32("preferred_len", ps, depth, &(q_e->preferred_len)); +} + +/******************************************************************* +makes an LSA_R_ENUM_TRUST_DOM structure. +********************************************************************/ +void make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, + uint32 enum_context, char *domain_name, char *domain_sid, + uint32 status) +{ + if (r_e == NULL) return; + + DEBUG(5,("make_r_enum_trust_dom\n")); + + r_e->enum_context = enum_context; + + if (status == 0) + { + int len_domain_name = strlen(domain_name); + + r_e->num_domains = 1; + r_e->ptr_enum_domains = 1; + r_e->num_domains2 = 1; + + make_uni_hdr2(&(r_e->hdr_domain_name ), len_domain_name, len_domain_name, 4); + make_unistr2 (&(r_e->uni_domain_name ), domain_name, len_domain_name); + make_dom_sid2(&(r_e->other_domain_sid), domain_sid); + } + else + { + r_e->num_domains = 0; + r_e->ptr_enum_domains = 0; + } + + r_e->status = status; +} + +/******************************************************************* +reads or writes an LSA_R_ENUM_TRUST_DOM structure. +********************************************************************/ +void lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth) +{ + if (r_e == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_r_enum_trust_dom"); + depth++; + + prs_uint32("enum_context ", ps, depth, &(r_e->enum_context )); + prs_uint32("num_domains ", ps, depth, &(r_e->num_domains )); + prs_uint32("ptr_enum_domains", ps, depth, &(r_e->ptr_enum_domains)); + + if (r_e->ptr_enum_domains != 0) + { + prs_uint32("num_domains2", ps, depth, &(r_e->num_domains2)); + smb_io_unihdr2 ("", &(r_e->hdr_domain_name ), ps, depth); + smb_io_unistr2 ("", &(r_e->uni_domain_name ), r_e->hdr_domain_name.buffer, ps, depth); + smb_io_dom_sid2("", &(r_e->other_domain_sid), ps, depth); + } + + prs_uint32("status", ps, depth, &(r_e->status)); +} + +/******************************************************************* +makes an LSA_Q_CLOSE structure. +********************************************************************/ +void make_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_lsa_q_close\n")); + + memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); +} + + +/******************************************************************* +reads or writes an LSA_Q_CLOSE structure. +********************************************************************/ +void lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth) +{ + if (q_c == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_q_close"); + depth++; + + smb_io_pol_hnd("", &(q_c->pol), ps, depth); +} + +/******************************************************************* +makes an LSA_R_CLOSE structure. +********************************************************************/ +void make_lsa_r_close(LSA_R_CLOSE *q_r, POLICY_HND *hnd) +{ + if (q_r == NULL || hnd == NULL) return; + + DEBUG(5,("make_lsa_r_close\n")); + + memcpy(&(q_r->pol), hnd, sizeof(q_r->pol)); +} + + +/******************************************************************* +reads or writes an LSA_R_CLOSE structure. +********************************************************************/ +void lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth) +{ + if (r_c == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_r_close"); + depth++; + + smb_io_pol_hnd("", &(r_c->pol), ps, depth); + + prs_uint32("status", ps, depth, &(r_c->status)); +} + +/******************************************************************* +reads or writes an LSA_Q_QUERY_INFO structure. +********************************************************************/ +void lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_r_query"); + depth++; + + prs_uint32("undoc_buffer", ps, depth, &(r_q->undoc_buffer)); + + if (r_q->undoc_buffer != 0) + { + prs_uint16("info_class", ps, depth, &(r_q->info_class)); + + switch (r_q->info_class) + { + case 3: + { + smb_io_dom_query_3("", &(r_q->dom.id3), ps, depth); + break; + } + case 5: + { + smb_io_dom_query_5("", &(r_q->dom.id3), ps, depth); + break; + } + default: + { + /* PANIC! */ + break; + } + } + } + + prs_uint32("status", ps, depth, &(r_q->status)); +} + +/******************************************************************* +reads or writes a LSA_SID_ENUM structure. +********************************************************************/ +void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) +{ + int i; + + if (sen == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_sid_enum"); + depth++; + + prs_align(ps); + + prs_uint32("num_entries ", ps, depth, &(sen->num_entries)); + prs_uint32("ptr_sid_enum", ps, depth, &(sen->ptr_sid_enum)); + prs_uint32("num_entries2", ps, depth, &(sen->num_entries2)); + + for (i = 0; i < sen->num_entries; i++) + { + fstring temp; + sprintf(temp, "ptr_sid[%d]", i); + prs_uint32(temp, ps, depth, &(sen->ptr_sid[i])); /* domain SID pointers to be looked up. */ + } + + for (i = 0; i < sen->num_entries; i++) + { + fstring temp; + sprintf(temp, "sid[%d]", i); + smb_io_dom_sid2(temp, &(sen->sid[i]), ps, depth); /* domain SIDs to be looked up. */ + } +} + +/******************************************************************* +reads or writes a LSA_Q_LOOKUP_SIDS structure. +********************************************************************/ +void lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, int depth) +{ + if (q_s == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd ("pol_hnd", &(q_s->pol_hnd), ps, depth); /* policy handle */ + lsa_io_sid_enum ("sids ", &(q_s->sids ), ps, depth); /* sids to be looked up */ + lsa_io_trans_names ("names ", &(q_s->names ), ps, depth); /* translated names */ + smb_io_lookup_level("switch ", &(q_s->level ), ps, depth); /* lookup level */ + + prs_uint32("mapped_count", ps, depth, &(q_s->mapped_count)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth) +{ + int i; + int i2; + + if (trn == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_trans_names"); + depth++; + + prs_align(ps); + + prs_uint32("num_entries ", ps, depth, &(trn->num_entries)); + prs_uint32("ptr_trans_names", ps, depth, &(trn->ptr_trans_names)); + prs_uint32("num_entries2 ", ps, depth, &(trn->num_entries2)); + + for (i = 0; i < trn->num_entries; i++) + { + fstring temp; + sprintf(temp, "ptr_name[%d] ", i); + prs_uint32(temp, ps, depth, &(trn->ptr_name[i])); /* pointer to translated name */ + } + + for (i = 0; i < trn->num_entries2; i++) + { + if (trn->ptr_name[i] != 0) + { + fstring temp; + sprintf(temp, "name[%d] ", i); + lsa_io_trans_name(temp, &(trn->name[i2]), ps, depth); /* translated name */ + i2++; + } + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, int depth) +{ + if (r_s == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_r_lookup_sids"); + depth++; + + prs_align(ps); + + lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth); /* domain reference info */ + lsa_io_trans_names("names ", r_s->names , ps, depth); /* translated names */ + + prs_uint32("mapped_count", ps, depth, &(r_s->mapped_count)); + + prs_uint32("status ", ps, depth, &(r_s->status)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void lsa_io_q_lookup_rids(char *desc, LSA_Q_LOOKUP_RIDS *q_r, prs_struct *ps, int depth) +{ + int i; + + if (q_r == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_q_lookup_rids"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(q_r->pol_hnd), ps, depth); /* policy handle */ + + prs_uint32("num_entries ", ps, depth, &(q_r->num_entries)); + prs_uint32("num_entries2 ", ps, depth, &(q_r->num_entries2)); + prs_uint32("buffer_dom_sid ", ps, depth, &(q_r->buffer_dom_sid)); /* undocumented domain SID buffer pointer */ + prs_uint32("buffer_dom_name", ps, depth, &(q_r->buffer_dom_name)); /* undocumented domain name buffer pointer */ + + for (i = 0; i < q_r->num_entries; i++) + { + smb_io_dom_name("", &(q_r->lookup_name[i]), ps, depth); /* names to be looked up */ + } + + prs_uint8s (False, "undoc ", ps, depth, q_r->undoc, UNKNOWN_LEN); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void lsa_io_r_lookup_rids(char *desc, LSA_R_LOOKUP_RIDS *r_r, prs_struct *ps, int depth) +{ + int i; + + if (r_r == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_r_lookup_rids"); + depth++; + + prs_align(ps); + + lsa_io_dom_r_ref("", &(r_r->dom_ref), ps, depth); /* domain reference info */ + + prs_uint32("num_entries ", ps, depth, &(r_r->num_entries)); + prs_uint32("undoc_buffer", ps, depth, &(r_r->undoc_buffer)); + prs_uint32("num_entries2", ps, depth, &(r_r->num_entries2)); + + for (i = 0; i < r_r->num_entries2; i++) + { + smb_io_dom_rid2("", &(r_r->dom_rid[i]), ps, depth); /* domain RIDs being looked up */ + } + + prs_uint32("num_entries3", ps, depth, &(r_r->num_entries3)); + + prs_uint32("status ", ps, depth, &(r_r->status)); +} + diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c new file mode 100644 index 0000000000..225754903f --- /dev/null +++ b/source3/rpc_parse/parse_misc.c @@ -0,0 +1,981 @@ + +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include "includes.h" + +extern int DEBUGLEVEL; + + + +/******************************************************************* +reads or writes a UTIME type. +********************************************************************/ +void smb_io_utime(char *desc, UTIME *t, prs_struct *ps, int depth) +{ + if (t == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_utime"); + depth++; + + prs_align(ps); + + prs_uint32 ("time", ps, depth, &(t->time)); +} + +/******************************************************************* +reads or writes an NTTIME structure. +********************************************************************/ +void smb_io_time(char *desc, NTTIME *nttime, prs_struct *ps, int depth) +{ + if (nttime == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_time"); + depth++; + + prs_align(ps); + + prs_uint32("low ", ps, depth, &(nttime->low )); /* low part */ + prs_uint32("high", ps, depth, &(nttime->high)); /* high part */ +} + +/******************************************************************* +reads or writes a LOOKUP_LEVEL structure. +********************************************************************/ +void smb_io_lookup_level(char *desc, LOOKUP_LEVEL *level, prs_struct *ps, int depth) +{ + if (level == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_lookup_level"); + depth++; + + prs_align(ps); + prs_uint16("value", ps, depth, &(level->value)); + prs_align(ps); +} + +/******************************************************************* +gets an enumeration handle from an ENUM_HND structure. +********************************************************************/ +uint32 get_enum_hnd(ENUM_HND *enh) +{ + return (enh && enh->ptr_hnd != 0) ? enh->handle : 0; +} + +/******************************************************************* +makes an ENUM_HND structure. +********************************************************************/ +void make_enum_hnd(ENUM_HND *enh, uint32 hnd) +{ + if (enh == NULL) return; + + DEBUG(5,("smb_io_enum_hnd\n")); + + enh->ptr_hnd = (hnd != 0) ? 1 : 0; + enh->handle = hnd; +} + +/******************************************************************* +reads or writes an ENUM_HND structure. +********************************************************************/ +void smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) +{ + if (hnd == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_enum_hnd"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_hnd", ps, depth, &(hnd->ptr_hnd)); /* pointer */ + if (hnd->ptr_hnd != 0) + { + prs_uint32("handle ", ps, depth, &(hnd->handle )); /* enum handle */ + } +} + +/******************************************************************* +creates a DOM_SID structure. + +BIG NOTE: this function only does SIDS where the identauth is not >= 2^32 +identauth >= 2^32 can be detected because it will be specified in hex + +********************************************************************/ +void make_dom_sid(DOM_SID *sid, char *str_sid) +{ + pstring domsid; + int identauth; + char *p; + + if (sid == NULL) return; + + if (domsid == NULL) + { + DEBUG(4,("netlogon domain SID: none\n")); + sid->sid_rev_num = 0; + sid->num_auths = 0; + return; + } + + pstrcpy(domsid, str_sid); + + DEBUG(4,("make_dom_sid %d SID: %s\n", __LINE__, domsid)); + + /* assume, but should check, that domsid starts "S-" */ + p = strtok(domsid+2,"-"); + sid->sid_rev_num = atoi(p); + + /* identauth in decimal should be < 2^32 */ + /* identauth in hex should be >= 2^32 */ + identauth = atoi(strtok(0,"-")); + + DEBUG(4,("netlogon rev %d\n", sid->sid_rev_num)); + DEBUG(4,("netlogon %s ia %d\n", p, identauth)); + + sid->id_auth[0] = 0; + sid->id_auth[1] = 0; + sid->id_auth[2] = (identauth & 0xff000000) >> 24; + sid->id_auth[3] = (identauth & 0x00ff0000) >> 16; + sid->id_auth[4] = (identauth & 0x0000ff00) >> 8; + sid->id_auth[5] = (identauth & 0x000000ff); + + sid->num_auths = 0; + + while ((p = strtok(0, "-")) != NULL && sid->num_auths < MAXSUBAUTHS) + { + sid->sub_auths[sid->num_auths++] = atoi(p); + } + + DEBUG(4,("make_dom_sid: %d SID: %s\n", __LINE__, domsid)); +} + +/******************************************************************* +reads or writes a DOM_SID structure. +********************************************************************/ +void smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) +{ + int i; + + if (sid == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_dom_sid"); + depth++; + + prs_align(ps); + + prs_uint8 ("sid_rev_num", ps, depth, &(sid->sid_rev_num)); + prs_uint8 ("num_auths ", ps, depth, &(sid->num_auths)); + + for (i = 0; i < 6; i++) + { + fstring tmp; + sprintf(tmp, "id_auth[%d] ", i); + prs_uint8 (tmp, ps, depth, &(sid->id_auth[i])); + } + + /* oops! XXXX should really issue a warning here... */ + if (sid->num_auths > MAXSUBAUTHS) sid->num_auths = MAXSUBAUTHS; + + prs_uint32s(False, "sub_auths ", ps, depth, sid->sub_auths, sid->num_auths); +} + +/******************************************************************* +creates a DOM_SID2 structure. +********************************************************************/ +void make_dom_sid2(DOM_SID2 *sid, char *str_sid) +{ + make_dom_sid(&(sid->sid), str_sid); + sid->num_auths = sid->sid.num_auths; +} + +/******************************************************************* +reads or writes a DOM_SID2 structure. +********************************************************************/ +void smb_io_dom_sid2(char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) +{ + if (sid == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_dom_sid2"); + depth++; + + prs_align(ps); + + prs_uint32("num_auths", ps, depth, &(sid->num_auths)); + + smb_io_dom_sid("sid", &(sid->sid), ps, depth); +} + +/******************************************************************* +creates a STRHDR structure. +********************************************************************/ +void make_str_hdr(STRHDR *hdr, int max_len, int len, uint32 buffer) +{ + hdr->str_max_len = max_len; + hdr->str_str_len = len; + hdr->buffer = buffer; +} + +/******************************************************************* +reads or writes a STRHDR structure. +********************************************************************/ +void smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth) +{ + if (hdr == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_strhdr"); + depth++; + + prs_align(ps); + + prs_uint16("str_str_len", ps, depth, &(hdr->str_str_len)); + prs_uint16("str_max_len", ps, depth, &(hdr->str_max_len)); + prs_uint32("buffer ", ps, depth, &(hdr->buffer )); + + /* oops! XXXX maybe issue a warning that this is happening... */ + if (hdr->str_max_len > MAX_STRINGLEN) hdr->str_max_len = MAX_STRINGLEN; + if (hdr->str_str_len > MAX_STRINGLEN) hdr->str_str_len = MAX_STRINGLEN; +} + +/******************************************************************* +creates a UNIHDR structure. +********************************************************************/ +void make_uni_hdr(UNIHDR *hdr, int max_len, int len, uint32 buffer) +{ + hdr->uni_max_len = 2 * max_len; + hdr->uni_str_len = 2 * len; + hdr->buffer = buffer; +} + +/******************************************************************* +reads or writes a UNIHDR structure. +********************************************************************/ +void smb_io_unihdr(char *desc, UNIHDR *hdr, prs_struct *ps, int depth) +{ + if (hdr == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_unihdr"); + depth++; + + prs_align(ps); + + prs_uint16("uni_str_len", ps, depth, &(hdr->uni_str_len)); + prs_uint16("uni_max_len", ps, depth, &(hdr->uni_max_len)); + prs_uint32("buffer ", ps, depth, &(hdr->buffer )); + + /* oops! XXXX maybe issue a warning that this is happening... */ + if (hdr->uni_max_len > MAX_UNISTRLEN) hdr->uni_max_len = MAX_UNISTRLEN; + if (hdr->uni_str_len > MAX_UNISTRLEN) hdr->uni_str_len = MAX_UNISTRLEN; +} + +/******************************************************************* +creates a UNIHDR2 structure. +********************************************************************/ +void make_uni_hdr2(UNIHDR2 *hdr, int max_len, int len, uint16 terminate) +{ + make_uni_hdr(&(hdr->unihdr), max_len, len, terminate); + hdr->buffer = len > 0 ? 1 : 0; +} + +/******************************************************************* +reads or writes a UNIHDR2 structure. +********************************************************************/ +void smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) +{ + if (hdr2 == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_unihdr2"); + depth++; + + prs_align(ps); + + smb_io_unihdr("hdr", &(hdr2->unihdr), ps, depth); + prs_uint32("buffer", ps, depth, &(hdr2->buffer)); +} + +/******************************************************************* +creates a UNISTR structure. +********************************************************************/ +void make_unistr(UNISTR *str, char *buf) +{ + /* store the string (null-terminated copy) */ + struni2(str->buffer, buf); +} + +/******************************************************************* +reads or writes a UNISTR structure. +XXXX NOTE: UNISTR structures NEED to be null-terminated. +********************************************************************/ +void smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) +{ + if (uni == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_unistr"); + depth++; + + prs_align(ps); + prs_unistr("unistr", ps, depth, uni); +} + +/******************************************************************* +creates a UNINOTSTR2 structure. +********************************************************************/ +void make_uninotstr2(UNINOTSTR2 *str, char *buf, int len) +{ + /* set up string lengths. add one if string is not null-terminated */ + str->uni_max_len = (len+1)*2; + str->undoc = 0; + str->uni_buf_len = (len+1)*2; + + /* store the string (null-terminated copy) */ + struni2(str->buffer, buf); +} + +/******************************************************************* +reads or writes a UNINOTSTR2 structure. +XXXX NOTE: UNISTR2 structures need NOT be null-terminated. + the uni_str_len member tells you how long the string is; + the uni_max_len member tells you how large the buffer is. +********************************************************************/ +void smb_io_uninotstr2(char *desc, UNINOTSTR2 *uni2, uint32 buffer, prs_struct *ps, int depth) +{ + if (uni2 == NULL) return; + + if (buffer) + { + prs_debug(ps, depth, desc, "smb_io_uninotstr2"); + depth++; + + prs_align(ps); + + prs_uint32("uni_max_len", ps, depth, &(uni2->uni_max_len)); + prs_uint32("undoc ", ps, depth, &(uni2->undoc )); + prs_uint32("uni_buf_len", ps, depth, &(uni2->uni_buf_len)); + + /* oops! XXXX maybe issue a warning that this is happening... */ + if (uni2->uni_max_len > MAX_UNISTRLEN) uni2->uni_max_len = MAX_UNISTRLEN; + if (uni2->uni_buf_len > MAX_UNISTRLEN) uni2->uni_buf_len = MAX_UNISTRLEN; + + /* buffer advanced by indicated length of string + NOT by searching for null-termination */ + prs_uninotstr2(True, "buffer ", ps, depth, uni2); + } + else + { + prs_debug(ps, depth, desc, "smb_io_uninotstr2 - NULL"); + depth++; + bzero(uni2, sizeof(*uni2)); + } +} + +/******************************************************************* +creates a UNISTR2 structure: sets up the buffer, too +********************************************************************/ +void make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf) +{ + if (buf != NULL) + { + *ptr = 1; + make_unistr2(str, buf, strlen(buf)); + } + else + { + *ptr = 0; + make_unistr2(str, "", 0); + } +} + +/******************************************************************* +copies a UNISTR2 structure. +********************************************************************/ +void copy_unistr2(UNISTR2 *str, UNISTR2 *from) +{ + /* set up string lengths. add one if string is not null-terminated */ + str->uni_max_len = from->uni_max_len; + str->undoc = from->undoc; + str->uni_str_len = from->uni_str_len; + + /* copy the string */ + memcpy(str->buffer, from->buffer, sizeof(from->buffer)); +} + +/******************************************************************* +creates a STRING2 structure. +********************************************************************/ +void make_string2(STRING2 *str, char *buf, int len) +{ + /* set up string lengths. add one if string is not null-terminated */ + str->str_max_len = len+1; + str->undoc = 0; + str->str_str_len = len+1; + + /* store the string */ + memcpy(str->buffer, buf, len); +} + +/******************************************************************* +reads or writes a STRING2 structure. +XXXX NOTE: STRING2 structures need NOT be null-terminated. + the str_str_len member tells you how long the string is; + the str_max_len member tells you how large the buffer is. +********************************************************************/ +void smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth) +{ + if (str2 == NULL) return; + + if (buffer) + { + prs_debug(ps, depth, desc, "smb_io_string2"); + depth++; + + prs_align(ps); + + prs_uint32("str_max_len", ps, depth, &(str2->str_max_len)); + prs_uint32("undoc ", ps, depth, &(str2->undoc )); + prs_uint32("str_str_len", ps, depth, &(str2->str_str_len)); + + /* oops! XXXX maybe issue a warning that this is happening... */ + if (str2->str_max_len > MAX_STRINGLEN) str2->str_max_len = MAX_STRINGLEN; + if (str2->str_str_len > MAX_STRINGLEN) str2->str_str_len = MAX_STRINGLEN; + + /* buffer advanced by indicated length of string + NOT by searching for null-termination */ + prs_string2(True, "buffer ", ps, depth, str2); + } + else + { + prs_debug(ps, depth, desc, "smb_io_string2 - NULL"); + depth++; + bzero(str2, sizeof(*str2)); + } +} + +/******************************************************************* +creates a UNISTR2 structure. +********************************************************************/ +void make_unistr2(UNISTR2 *str, char *buf, int len) +{ + /* set up string lengths. add one if string is not null-terminated */ + str->uni_max_len = len+1; + str->undoc = 0; + str->uni_str_len = len+1; + + /* store the string (null-terminated 8 bit chars into 16 bit chars) */ + struni2(str->buffer, buf); +} + +/******************************************************************* +reads or writes a UNISTR2 structure. +XXXX NOTE: UNISTR2 structures need NOT be null-terminated. + the uni_str_len member tells you how long the string is; + the uni_max_len member tells you how large the buffer is. +********************************************************************/ +void smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth) +{ + if (uni2 == NULL) return; + + if (buffer) + { + prs_debug(ps, depth, desc, "smb_io_unistr2"); + depth++; + + prs_align(ps); + + prs_uint32("uni_max_len", ps, depth, &(uni2->uni_max_len)); + prs_uint32("undoc ", ps, depth, &(uni2->undoc )); + prs_uint32("uni_str_len", ps, depth, &(uni2->uni_str_len)); + + /* oops! XXXX maybe issue a warning that this is happening... */ + if (uni2->uni_max_len > MAX_UNISTRLEN) uni2->uni_max_len = MAX_UNISTRLEN; + if (uni2->uni_str_len > MAX_UNISTRLEN) uni2->uni_str_len = MAX_UNISTRLEN; + + /* buffer advanced by indicated length of string + NOT by searching for null-termination */ + prs_unistr2(True, "buffer ", ps, depth, uni2); + } + else + { + prs_debug(ps, depth, desc, "smb_io_unistr2 - NULL"); + depth++; + bzero(uni2, sizeof(*uni2)); + } +} + +/******************************************************************* +creates a DOM_RID2 structure. +********************************************************************/ +void make_dom_rid2(DOM_RID2 *rid2, uint32 rid) +{ + rid2->type = 0x5; + rid2->undoc = 0x5; + rid2->rid = rid; + rid2->rid_idx = 0; +} + +/******************************************************************* +reads or writes a DOM_RID2 structure. +********************************************************************/ +void smb_io_dom_rid2(char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth) +{ + if (rid2 == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_dom_rid2"); + depth++; + + prs_align(ps); + + /* should be value 5, so enforce it */ + rid2->type = 5; + + /* should be value 5, so enforce it */ + rid2->undoc = 5; + + prs_uint32("type ", ps, depth, &(rid2->type)); + prs_uint32("undoc ", ps, depth, &(rid2->undoc )); + prs_uint32("rid ", ps, depth, &(rid2->rid )); + prs_uint32("rid_idx", ps, depth, &(rid2->rid_idx )); +} + +/******************************************************************* +creates a DOM_RID3 structure. +********************************************************************/ +void make_dom_rid3(DOM_RID3 *rid3, uint32 rid) +{ + rid3->rid = rid; + rid3->type1 = 0x1; + rid3->ptr_type = 0x1; /* non-zero, basically. */ + rid3->type2 = 0x1; +} + +/******************************************************************* +reads or writes a DOM_RID3 structure. +********************************************************************/ +void smb_io_dom_rid3(char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) +{ + if (rid3 == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_dom_rid3"); + depth++; + + prs_align(ps); + + prs_uint32("rid ", ps, depth, &(rid3->rid )); + prs_uint32("type1 ", ps, depth, &(rid3->type1 )); + prs_uint32("ptr_type", ps, depth, &(rid3->ptr_type)); + prs_uint32("type2 ", ps, depth, &(rid3->type2 )); +} + +/******************************************************************* +creates a DOM_RID4 structure. +********************************************************************/ +void make_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid) +{ + rid4->unknown = unknown; + rid4->attr = attr; + rid4->rid = rid; +} + +/******************************************************************* +reads or writes a DOM_RID4 structure. +********************************************************************/ +void smb_io_dom_rid4(char *desc, DOM_RID4 *rid4, prs_struct *ps, int depth) +{ + if (rid4 == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_dom_rid4. XXXX !check size of unknown! XXXX"); + depth++; + + prs_align(ps); + + prs_uint32("unknown", ps, depth, &(rid4->unknown)); + prs_uint16("attr ", ps, depth, &(rid4->attr )); + prs_uint32("rid ", ps, depth, &(rid4->rid )); +} + +/******************************************************************* +makes a DOM_CLNT_SRV structure. +********************************************************************/ +void make_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) +{ + if (log == NULL) return; + + DEBUG(5,("make_clnt_srv: %d\n", __LINE__)); + + if (logon_srv != NULL) + { + log->undoc_buffer = 1; + make_unistr2(&(log->uni_logon_srv), logon_srv, strlen(logon_srv)); + } + else + { + log->undoc_buffer = 0; + } + + if (comp_name != NULL) + { + log->undoc_buffer2 = 1; + make_unistr2(&(log->uni_comp_name), comp_name, strlen(comp_name)); + } + else + { + log->undoc_buffer2 = 0; + } +} + +/******************************************************************* +reads or writes a DOM_CLNT_SRV structure. +********************************************************************/ +void smb_io_clnt_srv(char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth) +{ + if (log == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_clnt_srv"); + depth++; + + prs_align(ps); + + prs_uint32("undoc_buffer ", ps, depth, &(log->undoc_buffer )); + if (log->undoc_buffer != 0) + { + smb_io_unistr2("unistr2", &(log->uni_logon_srv), log->undoc_buffer, ps, depth); + } + + prs_align(ps); + + prs_uint32("undoc_buffer2", ps, depth, &(log->undoc_buffer2)); + if (log->undoc_buffer2 != 0) + { + smb_io_unistr2("unistr2", &(log->uni_comp_name), log->undoc_buffer2, ps, depth); + } +} + +/******************************************************************* +makes a DOM_LOG_INFO structure. +********************************************************************/ +void make_log_info(DOM_LOG_INFO *log, char *logon_srv, char *acct_name, + uint16 sec_chan, char *comp_name) +{ + if (log == NULL) return; + + DEBUG(5,("make_log_info %d\n", __LINE__)); + + log->undoc_buffer = 1; + + make_unistr2(&(log->uni_logon_srv), logon_srv, strlen(logon_srv)); + make_unistr2(&(log->uni_acct_name), acct_name, strlen(acct_name)); + + log->sec_chan = sec_chan; + + make_unistr2(&(log->uni_comp_name), comp_name, strlen(comp_name)); +} + +/******************************************************************* +reads or writes a DOM_LOG_INFO structure. +********************************************************************/ +void smb_io_log_info(char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth) +{ + if (log == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_log_info"); + depth++; + + prs_align(ps); + + prs_uint32("undoc_buffer", ps, depth, &(log->undoc_buffer)); + + smb_io_unistr2("unistr2", &(log->uni_logon_srv), True, ps, depth); + smb_io_unistr2("unistr2", &(log->uni_acct_name), True, ps, depth); + + prs_uint16("sec_chan", ps, depth, &(log->sec_chan)); + + smb_io_unistr2("unistr2", &(log->uni_comp_name), True, ps, depth); +} + +/******************************************************************* +reads or writes a DOM_CHAL structure. +********************************************************************/ +void smb_io_chal(char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) +{ + if (chal == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_chal"); + depth++; + + prs_align(ps); + + prs_uint8s (False, "data", ps, depth, chal->data, 8); +} + +/******************************************************************* +reads or writes a DOM_CRED structure. +********************************************************************/ +void smb_io_cred(char *desc, DOM_CRED *cred, prs_struct *ps, int depth) +{ + if (cred == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_cred"); + depth++; + + prs_align(ps); + + smb_io_chal ("", &(cred->challenge), ps, depth); + smb_io_utime("", &(cred->timestamp), ps, depth); +} + +/******************************************************************* +makes a DOM_CLNT_INFO2 structure. +********************************************************************/ +void make_clnt_info2(DOM_CLNT_INFO2 *clnt, + char *logon_srv, char *comp_name, + DOM_CRED *clnt_cred) +{ + if (clnt == NULL) return; + + DEBUG(5,("make_clnt_info: %d\n", __LINE__)); + + make_clnt_srv(&(clnt->login), logon_srv, comp_name); + + if (clnt_cred != NULL) + { + clnt->ptr_cred = 1; + memcpy(&(clnt->cred), clnt_cred, sizeof(clnt->cred)); + } + else + { + clnt->ptr_cred = 0; + } +} + +/******************************************************************* +reads or writes a DOM_CLNT_INFO2 structure. +********************************************************************/ +void smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth) +{ + if (clnt == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_clnt_info2"); + depth++; + + prs_align(ps); + + smb_io_clnt_srv("", &(clnt->login), ps, depth); + + prs_align(ps); + + prs_uint32("ptr_cred", ps, depth, &(clnt->ptr_cred)); + smb_io_cred ("", &(clnt->cred ), ps, depth); +} + +/******************************************************************* +makes a DOM_CLNT_INFO structure. +********************************************************************/ +void make_clnt_info(DOM_CLNT_INFO *clnt, + char *logon_srv, char *acct_name, + uint16 sec_chan, char *comp_name, + DOM_CRED *cred) +{ + if (clnt == NULL || cred == NULL) return; + + DEBUG(5,("make_clnt_info\n")); + + make_log_info(&(clnt->login), logon_srv, acct_name, sec_chan, comp_name); + memcpy(&(clnt->cred), cred, sizeof(clnt->cred)); +} + +/******************************************************************* +reads or writes a DOM_CLNT_INFO structure. +********************************************************************/ +void smb_io_clnt_info(char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int depth) +{ + if (clnt == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_clnt_info"); + depth++; + + prs_align(ps); + + smb_io_log_info("", &(clnt->login), ps, depth); + smb_io_cred ("", &(clnt->cred ), ps, depth); +} + +/******************************************************************* +makes a DOM_LOGON_ID structure. +********************************************************************/ +void make_logon_id(DOM_LOGON_ID *log, uint32 log_id_low, uint32 log_id_high) +{ + if (log == NULL) return; + + DEBUG(5,("make_logon_id: %d\n", __LINE__)); + + log->low = log_id_low; + log->high = log_id_high; +} + +/******************************************************************* +reads or writes a DOM_LOGON_ID structure. +********************************************************************/ +void smb_io_logon_id(char *desc, DOM_LOGON_ID *log, prs_struct *ps, int depth) +{ + if (log == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_logon_id"); + depth++; + + prs_align(ps); + + prs_uint32("low ", ps, depth, &(log->low )); + prs_uint32("high", ps, depth, &(log->high)); +} + +/******************************************************************* +makes an ARC4_OWF structure. +********************************************************************/ +void make_arc4_owf(ARC4_OWF *hash, uint8 data[16]) +{ + if (hash == NULL) return; + + DEBUG(5,("make_arc4_owf: %d\n", __LINE__)); + + if (data != NULL) + { + memcpy(hash->data, data, sizeof(hash->data)); + } + else + { + bzero(hash->data, sizeof(hash->data)); + } +} + +/******************************************************************* +reads or writes an ARC4_OWF structure. +********************************************************************/ +void smb_io_arc4_owf(char *desc, ARC4_OWF *hash, prs_struct *ps, int depth) +{ + if (hash == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_arc4_owf"); + depth++; + + prs_align(ps); + + prs_uint8s (False, "data", ps, depth, hash->data, 16); +} + +/******************************************************************* +reads or writes a DOM_GID structure. +********************************************************************/ +void smb_io_gid(char *desc, DOM_GID *gid, prs_struct *ps, int depth) +{ + if (gid == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_gid"); + depth++; + + prs_align(ps); + + prs_uint32("g_rid", ps, depth, &(gid->g_rid)); + prs_uint32("attr ", ps, depth, &(gid->attr )); +} + +/******************************************************************* +reads or writes an POLICY_HND structure. +********************************************************************/ +void smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth) +{ + if (pol == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_pol_hnd"); + depth++; + + prs_align(ps); + + prs_uint8s (False, "data", ps, depth, pol->data, POL_HND_SIZE); +} + +/******************************************************************* +reads or writes a dom query structure. +********************************************************************/ +void smb_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) +{ + smb_io_dom_query("", d_q, ps, depth); +} + +/******************************************************************* +reads or writes a dom query structure. +********************************************************************/ +void smb_io_dom_query_5(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) +{ + smb_io_dom_query("", d_q, ps, depth); +} + +/******************************************************************* +reads or writes a dom query structure. +********************************************************************/ +void smb_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth) +{ + if (d_q == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_dom_query"); + depth++; + + prs_align(ps); + + prs_uint16("uni_dom_max_len", ps, depth, &(d_q->uni_dom_max_len)); /* domain name string length * 2 */ + prs_uint16("uni_dom_str_len", ps, depth, &(d_q->uni_dom_str_len)); /* domain name string length * 2 */ + + prs_uint32("buffer_dom_name", ps, depth, &(d_q->buffer_dom_name)); /* undocumented domain name string buffer pointer */ + prs_uint32("buffer_dom_sid ", ps, depth, &(d_q->buffer_dom_sid )); /* undocumented domain SID string buffer pointer */ + + smb_io_unistr2("unistr2", &(d_q->uni_domain_name), d_q->buffer_dom_name, ps, depth); /* domain name (unicode string) */ + + if (d_q->buffer_dom_sid != 0) + { + smb_io_dom_sid2("", &(d_q->dom_sid), ps, depth); /* domain SID */ + } + else + { + bzero(&(d_q->dom_sid), sizeof(d_q->dom_sid)); + } +} + +/******************************************************************* +reads or writes a DOM_NAME structure. +********************************************************************/ +void smb_io_dom_name(char *desc, DOM_NAME *name, prs_struct *ps, int depth) +{ + if (name == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_dom_name"); + depth++; + + prs_align(ps); + + prs_uint32("uni_str_len", ps, depth, &(name->uni_str_len)); + + /* don't know if len is specified by uni_str_len member... */ + /* assume unicode string is unicode-null-terminated, instead */ + + smb_io_unistr("", &(name->str), ps, depth); +} + + diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c new file mode 100644 index 0000000000..69d6ac08ed --- /dev/null +++ b/source3/rpc_parse/parse_net.c @@ -0,0 +1,1147 @@ +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "includes.h" +#include "nterr.h" + +extern int DEBUGLEVEL; + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void net_io_neg_flags(char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth) +{ + if (neg == NULL) return; + + prs_debug(ps, depth, desc, "net_io_neg_flags"); + depth++; + + prs_align(ps); + + prs_uint32("neg_flags", ps, depth, &(neg->neg_flags)); +} + +/******************************************************************* +creates a NETLOGON_INFO_3 structure. +********************************************************************/ +void make_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. +********************************************************************/ +void net_io_netinfo_3(char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int depth) +{ + if (info == NULL) return; + + prs_debug(ps, depth, desc, "net_io_netinfo_3"); + depth++; + + prs_align(ps); + + prs_uint32("flags ", ps, depth, &(info->flags )); + prs_uint32("logon_attempts", ps, depth, &(info->logon_attempts)); + prs_uint32("reserved_1 ", ps, depth, &(info->reserved_1 )); + prs_uint32("reserved_2 ", ps, depth, &(info->reserved_2 )); + prs_uint32("reserved_3 ", ps, depth, &(info->reserved_3 )); + prs_uint32("reserved_4 ", ps, depth, &(info->reserved_4 )); + prs_uint32("reserved_5 ", ps, depth, &(info->reserved_5 )); +} + + +/******************************************************************* +creates a NETLOGON_INFO_1 structure. +********************************************************************/ +void make_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. +********************************************************************/ +void net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth) +{ + if (info == NULL) return; + + prs_debug(ps, depth, desc, "net_io_netinfo_1"); + depth++; + + prs_align(ps); + + prs_uint32("flags ", ps, depth, &(info->flags )); + prs_uint32("pdc_status", ps, depth, &(info->pdc_status)); +} + +/******************************************************************* +creates a NETLOGON_INFO_2 structure. +********************************************************************/ +void make_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, + uint32 tc_status, char *trusted_dc_name) +{ + int len_dc_name = strlen(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) + { + make_unistr2(&(info->uni_trusted_dc_name), trusted_dc_name, len_dc_name); + } + else + { + make_unistr2(&(info->uni_trusted_dc_name), "", 1); + } +} + +/******************************************************************* +reads or writes a NETLOGON_INFO_2 structure. +********************************************************************/ +void net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth) +{ + if (info == NULL) return; + + prs_debug(ps, depth, desc, "net_io_netinfo_2"); + depth++; + + prs_align(ps); + + prs_uint32("flags ", ps, depth, &(info->flags )); + prs_uint32("pdc_status ", ps, depth, &(info->pdc_status )); + prs_uint32("ptr_trusted_dc_name", ps, depth, &(info->ptr_trusted_dc_name)); + prs_uint32("tc_status ", ps, depth, &(info->tc_status )); + + if (info->ptr_trusted_dc_name != 0) + { + smb_io_unistr2("unistr2", &(info->uni_trusted_dc_name), info->ptr_trusted_dc_name, ps, depth); + } + + prs_align(ps); +} + +/******************************************************************* +makes an NET_Q_LOGON_CTRL2 structure. +********************************************************************/ +void make_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, char *server_name, + uint32 function_code) +{ + if (q_l == NULL) return; + + DEBUG(5,("make_q_logon_ctrl2\n")); + + q_l->ptr = 1; /* undocumented pointer */ + make_unistr2 (&(q_l->uni_server_name), server_name, strlen(server_name)); + + q_l->function_code = function_code; /* should only be 0x1 */ + q_l->query_level = function_code; /* should only be 0x1 */ + q_l->switch_value = function_code; /* should only be 0x1 */ +} + +/******************************************************************* +reads or writes an NET_Q_LOGON_CTRL2 structure. +********************************************************************/ +void net_io_q_logon_ctrl2(char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, int depth) +{ + if (q_l == NULL) return; + + prs_debug(ps, depth, desc, "net_io_q_logon_ctrl2"); + depth++; + + prs_align(ps); + + prs_uint32("ptr ", ps, depth, &(q_l->ptr )); + + smb_io_unistr2 ("", &(q_l->uni_server_name), q_l->ptr, ps, depth); + + prs_align(ps); + + prs_uint32("function_code", ps, depth, &(q_l->function_code)); + prs_uint32("query_level ", ps, depth, &(q_l->query_level )); + prs_uint32("switch_value ", ps, depth, &(q_l->switch_value )); +} + +/******************************************************************* +makes an NET_R_LOGON_CTRL2 structure. +********************************************************************/ +void make_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level, + uint32 flags, uint32 pdc_status, uint32 logon_attempts, + uint32 tc_status, char *trusted_domain_name) +{ + if (r_l == NULL) return; + + DEBUG(5,("make_r_logon_ctrl2\n")); + + r_l->switch_value = query_level; /* should only be 0x1 */ + + switch (query_level) + { + case 1: + { + r_l->ptr = 1; /* undocumented pointer */ + make_netinfo_1(&(r_l->logon.info1), flags, pdc_status); + r_l->status = 0; + + break; + } + case 2: + { + r_l->ptr = 1; /* undocumented pointer */ + make_netinfo_2(&(r_l->logon.info2), flags, pdc_status, + tc_status, trusted_domain_name); + r_l->status = 0; + + break; + } + case 3: + { + r_l->ptr = 1; /* undocumented pointer */ + make_netinfo_3(&(r_l->logon.info3), flags, logon_attempts); + r_l->status = 0; + + break; + } + default: + { + DEBUG(2,("make_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. +********************************************************************/ +void net_io_r_logon_ctrl2(char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, int depth) +{ + if (r_l == NULL) return; + + prs_debug(ps, depth, desc, "net_io_r_logon_ctrl2"); + depth++; + + prs_uint32("switch_value ", ps, depth, &(r_l->switch_value )); + prs_uint32("ptr ", ps, depth, &(r_l->ptr )); + + if (r_l->ptr != 0) + { + switch (r_l->switch_value) + { + case 1: + { + net_io_netinfo_1("", &(r_l->logon.info1), ps, depth); + break; + } + case 2: + { + net_io_netinfo_2("", &(r_l->logon.info2), ps, depth); + break; + } + case 3: + { + net_io_netinfo_3("", &(r_l->logon.info3), ps, depth); + break; + } + default: + { + DEBUG(2,("net_io_r_logon_ctrl2: unsupported switch value %d\n", + r_l->switch_value)); + break; + } + } + } + + prs_uint32("status ", ps, depth, &(r_l->status )); +} + +/******************************************************************* +makes an NET_R_TRUST_DOM_LIST structure. +********************************************************************/ +void make_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, + uint32 num_doms, char *dom_name) +{ + int i = 0; + + if (r_t == NULL) return; + + DEBUG(5,("make_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(domain_name); + make_unistr2(&(r_t->uni_trust_dom_name[i]), domain_name, strlen(domain_name)); + /* the use of UNISTR2 here is non-standard. */ + r_t->uni_trust_dom_name[i].undoc = 0x1; + } + + r_t->status = 0; +} + +/******************************************************************* +reads or writes an NET_R_TRUST_DOM_LIST structure. +********************************************************************/ +void net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth) +{ + int i; + if (r_t == NULL) return; + + prs_debug(ps, depth, desc, "net_io_r_trust_dom"); + depth++; + + for (i = 0; i < MAX_TRUST_DOMS; i++) + { + if (r_t->uni_trust_dom_name[i].uni_str_len == 0) break; + smb_io_unistr2("", &(r_t->uni_trust_dom_name[i]), True, ps, depth); + } + + prs_uint32("status", ps, depth, &(r_t->status)); +} + +/******************************************************************* +makes an NET_Q_TRUST_DOM_LIST structure. +********************************************************************/ +void make_q_trust_dom(NET_Q_TRUST_DOM_LIST *q_l, char *server_name, + uint32 function_code) +{ + if (q_l == NULL) return; + + DEBUG(5,("make_q_trust_dom\n")); + + make_unistr2 (&(q_l->uni_server_name), server_name, strlen(server_name)); + + q_l->function_code = function_code; /* should only be 0x31 */ +} + +/******************************************************************* +reads or writes an NET_Q_TRUST_DOM_LIST structure. +********************************************************************/ +void net_io_q_trust_dom(char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, int depth) +{ + if (q_l == NULL) return; + + prs_debug(ps, depth, desc, "net_io_q_trust_dom"); + depth++; + + prs_uint32("ptr ", ps, depth, &(q_l->ptr )); + smb_io_unistr2 ("", &(q_l->uni_server_name), q_l->ptr, ps, depth); + + prs_align(ps); + + prs_uint32("function_code", ps, depth, &(q_l->function_code)); +} + +/******************************************************************* +makes an NET_Q_REQ_CHAL structure. +********************************************************************/ +void make_q_req_chal(NET_Q_REQ_CHAL *q_c, + char *logon_srv, char *logon_clnt, + DOM_CHAL *clnt_chal) +{ + if (q_c == NULL) return; + + DEBUG(5,("make_q_req_chal: %d\n", __LINE__)); + + q_c->undoc_buffer = 1; /* don't know what this buffer is */ + + make_unistr2(&(q_c->uni_logon_srv ), logon_srv , strlen(logon_srv )); + make_unistr2(&(q_c->uni_logon_clnt), logon_clnt, strlen(logon_clnt)); + + memcpy(q_c->clnt_chal.data, clnt_chal->data, sizeof(clnt_chal->data)); + + DEBUG(5,("make_q_req_chal: %d\n", __LINE__)); +} + +/******************************************************************* +reads or writes an NET_Q_REQ_CHAL structure. +********************************************************************/ +void net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int depth) +{ + int old_align; + if (q_c == NULL) return; + + prs_debug(ps, depth, desc, "net_io_q_req_chal"); + depth++; + + prs_align(ps); + + prs_uint32("undoc_buffer", ps, depth, &(q_c->undoc_buffer)); + + smb_io_unistr2("", &(q_c->uni_logon_srv), True, ps, depth); /* logon server unicode string */ + smb_io_unistr2("", &(q_c->uni_logon_clnt), True, ps, depth); /* logon client unicode string */ + + old_align = ps->align; + ps->align = 0; + /* client challenge is _not_ aligned after the unicode strings */ + smb_io_chal("", &(q_c->clnt_chal), ps, depth); /* client challenge */ + ps->align = old_align; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int depth) +{ + if (r_c == NULL) return; + + prs_debug(ps, depth, desc, "net_io_r_req_chal"); + depth++; + + prs_align(ps); + + smb_io_chal("", &(r_c->srv_chal), ps, depth); /* server challenge */ + + prs_uint32("status", ps, depth, &(r_c->status)); +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_q_auth_2(NET_Q_AUTH_2 *q_a, + char *logon_srv, char *acct_name, uint16 sec_chan, char *comp_name, + DOM_CHAL *clnt_chal, uint32 clnt_flgs) +{ + if (q_a == NULL) return; + + DEBUG(5,("make_q_auth_2: %d\n", __LINE__)); + + make_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,("make_q_auth_2: %d\n", __LINE__)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void net_io_q_auth_2(char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth) +{ + int old_align; + if (q_a == NULL) return; + + prs_debug(ps, depth, desc, "net_io_q_auth_2"); + depth++; + + prs_align(ps); + + smb_io_log_info ("", &(q_a->clnt_id), ps, depth); /* client identification info */ + /* client challenge is _not_ aligned */ + old_align = ps->align; + ps->align = 0; + smb_io_chal ("", &(q_a->clnt_chal), ps, depth); /* client-calculated credentials */ + ps->align = old_align; + net_io_neg_flags("", &(q_a->clnt_flgs), ps, depth); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth) +{ + if (r_a == NULL) return; + + prs_debug(ps, depth, desc, "net_io_r_auth_2"); + depth++; + + prs_align(ps); + + smb_io_chal ("", &(r_a->srv_chal), ps, depth); /* server challenge */ + net_io_neg_flags("", &(r_a->srv_flgs), ps, depth); + + prs_uint32("status", ps, depth, &(r_a->status)); +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char sess_key[16], + char *logon_srv, char *acct_name, uint16 sec_chan, char *comp_name, + DOM_CRED *cred, char nt_cypher[16]) +{ + if (q_s == NULL || cred == NULL) return; + + DEBUG(5,("make_q_srv_pwset\n")); + + make_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. +********************************************************************/ +void net_io_q_srv_pwset(char *desc, NET_Q_SRV_PWSET *q_s, prs_struct *ps, int depth) +{ + if (q_s == NULL) return; + + prs_debug(ps, depth, desc, "net_io_q_srv_pwset"); + depth++; + + prs_align(ps); + + smb_io_clnt_info("", &(q_s->clnt_id), ps, depth); /* client identification/authentication info */ + prs_uint8s (False, "pwd", ps, depth, q_s->pwd, 16); /* new password - undocumented */ +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int depth) +{ + if (r_s == NULL) return; + + prs_debug(ps, depth, desc, "net_io_r_srv_pwset"); + depth++; + + prs_align(ps); + + smb_io_cred("", &(r_s->srv_cred), ps, depth); /* server challenge */ + + prs_uint32("status", ps, depth, &(r_s->status)); +} + + +/************************************************************************* + make DOM_SID2 array from a string containing multiple sids + *************************************************************************/ +static int make_dom_sid2s(char *sids_str, DOM_SID2 *sids, int max_sids) +{ + char *ptr; + pstring s2; + int count; + + DEBUG(4,("make_dom_sid2s: %s\n", sids_str)); + + if (sids_str == NULL || *sids_str == 0) return 0; + + for (count = 0, ptr = sids_str; next_token(&ptr, s2, NULL) && count < max_sids; count++) + { + make_dom_sid2(&sids[count], s2); + } + + return count; +} + +/******************************************************************* +makes a NET_ID_INFO_1 structure. +********************************************************************/ +void make_id_info1(NET_ID_INFO_1 *id, char *domain_name, + uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, + char *user_name, char *wksta_name, + char sess_key[16], + unsigned char lm_cypher[16], unsigned char nt_cypher[16]) +{ + int len_domain_name = strlen(domain_name); + int len_user_name = strlen(user_name ); + int len_wksta_name = strlen(wksta_name ); + + unsigned char arc4_lm_owf[16]; + unsigned char arc4_nt_owf[16]; + + if (id == NULL) return; + + DEBUG(5,("make_id_info1: %d\n", __LINE__)); + + id->ptr_id_info1 = 1; + + make_uni_hdr(&(id->hdr_domain_name), len_domain_name, len_domain_name, 4); + + id->param_ctrl = param_ctrl; + make_logon_id(&(id->logon_id), log_id_low, log_id_high); + + make_uni_hdr(&(id->hdr_user_name ), len_user_name , len_user_name , 4); + make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name , len_wksta_name , 4); + +#ifdef USE_ARCFOUR + + if (lm_cypher && nt_cypher) + { + void arcfour(uint8 key[16], uint8 out[16], uint8 in[16]); + unsigned char arc4_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(arc4_key, 0, 16); + memcpy(arc4_key, sess_key, 16); + + arcfour(arc4_key, arc4_lm_owf, lm_cypher); + arcfour(arc4_key, arc4_nt_owf, nt_cypher); + +#ifdef DEBUG_PASSWORD + DEBUG(100,("arcfour encrypt of lm owf password:")); + dump_data(100, arc4_lm_owf, 16); + + DEBUG(100,("arcfour encrypt of nt owf password:")); + dump_data(100, arc4_nt_owf, 16); +#endif + /* set up pointers to cypher blocks */ + lm_cypher = arc4_lm_owf; + nt_cypher = arc4_nt_owf; + } + +#else + + if (lm_cypher) + { + /* oops. can only send what-ever-it-is direct */ + memcpy(arc4_lm_owf, lm_cypher, 16); + lm_cypher = arc4_lm_owf; + } + if (nt_cypher) + { + /* oops. can only send what-ever-it-is direct */ + memcpy(arc4_nt_owf, nt_cypher, 16); + nt_cypher = arc4_nt_owf; + } + +#endif + + make_arc4_owf(&(id->arc4_lm_owf), lm_cypher); + make_arc4_owf(&(id->arc4_nt_owf), nt_cypher); + + make_unistr2(&(id->uni_domain_name), domain_name, len_domain_name); + make_unistr2(&(id->uni_user_name ), user_name , len_user_name ); + make_unistr2(&(id->uni_wksta_name ), wksta_name , len_wksta_name ); +} + +/******************************************************************* +reads or writes an NET_ID_INFO_1 structure. +********************************************************************/ +void net_io_id_info1(char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth) +{ + if (id == NULL) return; + + prs_debug(ps, depth, desc, "net_io_id_info1"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_id_info1", ps, depth, &(id->ptr_id_info1)); + + if (id->ptr_id_info1 != 0) + { + smb_io_unihdr("unihdr", &(id->hdr_domain_name), ps, depth); + + prs_uint32("param_ctrl", ps, depth, &(id->param_ctrl)); + smb_io_logon_id("", &(id->logon_id), ps, depth); + + smb_io_unihdr("unihdr", &(id->hdr_user_name ), ps, depth); + smb_io_unihdr("unihdr", &(id->hdr_wksta_name ), ps, depth); + + smb_io_arc4_owf("", &(id->arc4_lm_owf), ps, depth); + smb_io_arc4_owf("", &(id->arc4_nt_owf), ps, depth); + + smb_io_unistr2("unistr2", &(id->uni_domain_name), id->hdr_domain_name.buffer, ps, depth); + smb_io_unistr2("unistr2", &(id->uni_user_name ), id->hdr_user_name.buffer, ps, depth); + smb_io_unistr2("unistr2", &(id->uni_wksta_name ), id->hdr_wksta_name.buffer, ps, depth); + } +} + +/******************************************************************* +makes a NET_ID_INFO_2 structure. +********************************************************************/ +void make_id_info2(NET_ID_INFO_2 *id, char *domain_name, + uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, + char *user_name, char *wksta_name, + unsigned char lm_challenge[8], + unsigned char lm_chal_resp[24], + unsigned char nt_chal_resp[24]) +{ + int len_domain_name = strlen(domain_name); + int len_user_name = strlen(user_name ); + int len_wksta_name = strlen(wksta_name ); + + unsigned char arc4_lm_owf[24]; + unsigned char arc4_nt_owf[24]; + + if (id == NULL) return; + + DEBUG(5,("make_id_info2: %d\n", __LINE__)); + + id->ptr_id_info2 = 1; + + make_uni_hdr(&(id->hdr_domain_name), len_domain_name, len_domain_name, 4); + + id->param_ctrl = param_ctrl; + make_logon_id(&(id->logon_id), log_id_low, log_id_high); + + make_uni_hdr(&(id->hdr_user_name ), len_user_name , len_user_name , 4); + make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name , len_wksta_name , 4); + + if (nt_chal_resp) + { + /* oops. can only send what-ever-it-is direct */ + memcpy(arc4_nt_owf, nt_chal_resp, 24); + nt_chal_resp = arc4_nt_owf; + } + if (lm_chal_resp) + { + /* oops. can only send what-ever-it-is direct */ + memcpy(arc4_lm_owf, lm_chal_resp, 24); + lm_chal_resp = arc4_lm_owf; + } + + memcpy(&(id->lm_chal), lm_challenge, sizeof(id->lm_chal)); + make_str_hdr(&(id->hdr_nt_chal_resp), 24, 24, nt_chal_resp != NULL ? 1 : 0); + make_str_hdr(&(id->hdr_lm_chal_resp), 24, 24, lm_chal_resp != NULL ? 1 : 0); + + make_unistr2(&(id->uni_domain_name), domain_name, len_domain_name); + make_unistr2(&(id->uni_user_name ), user_name , len_user_name ); + make_unistr2(&(id->uni_wksta_name ), wksta_name , len_wksta_name ); + + make_string2(&(id->nt_chal_resp ), nt_chal_resp , nt_chal_resp != NULL ? 24 : 0); + make_string2(&(id->lm_chal_resp ), lm_chal_resp , lm_chal_resp != NULL ? 24 : 0); +} + +/******************************************************************* +reads or writes an NET_ID_INFO_1 structure. +********************************************************************/ +void net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int depth) +{ + if (id == NULL) return; + + prs_debug(ps, depth, desc, "net_io_id_info2"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_id_info2", ps, depth, &(id->ptr_id_info2)); + + if (id->ptr_id_info2 != 0) + { + smb_io_unihdr("unihdr", &(id->hdr_domain_name), ps, depth); + + prs_uint32("param_ctrl", ps, depth, &(id->param_ctrl)); + smb_io_logon_id("", &(id->logon_id), ps, depth); + + smb_io_unihdr("unihdr", &(id->hdr_user_name ), ps, depth); + smb_io_unihdr("unihdr", &(id->hdr_wksta_name ), ps, depth); + + prs_uint8s (False, "lm_chal", ps, depth, id->lm_chal, 8); /* lm 8 byte challenge */ + + smb_io_strhdr("hdr_nt_chal_resp", &(id->hdr_nt_chal_resp ), ps, depth); + smb_io_strhdr("hdr_lm_chal_resp", &(id->hdr_lm_chal_resp ), ps, depth); + + smb_io_unistr2("uni_domain_name", &(id->uni_domain_name), id->hdr_domain_name .buffer, ps, depth); + smb_io_unistr2("uni_user_name ", &(id->uni_user_name ), id->hdr_user_name .buffer, ps, depth); + smb_io_unistr2("uni_wksta_name ", &(id->uni_wksta_name ), id->hdr_wksta_name .buffer, ps, depth); + smb_io_string2("nt_chal_resp" , &(id->nt_chal_resp) , id->hdr_nt_chal_resp.buffer, ps, depth); + smb_io_string2("lm_chal_resp" , &(id->lm_chal_resp) , id->hdr_lm_chal_resp.buffer, ps, depth); + } +} + + +/******************************************************************* +makes a DOM_SAM_INFO structure. +********************************************************************/ +void make_sam_info(DOM_SAM_INFO *sam, + char *logon_srv, char *comp_name, DOM_CRED *clnt_cred, + DOM_CRED *rtn_cred, uint16 logon_level, + NET_ID_INFO_CTR *ctr, uint16 validation_level) +{ + if (sam == NULL) return; + + DEBUG(5,("make_sam_info: %d\n", __LINE__)); + + make_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; + sam->validation_level = validation_level; +} + +/******************************************************************* +reads or writes a DOM_SAM_INFO structure. +********************************************************************/ +void net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR *ctr, prs_struct *ps, int depth) +{ + if (ctr == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_sam_info"); + depth++; + + /* don't 4-byte align here! */ + + prs_uint16("switch_value ", ps, depth, &(ctr->switch_value)); + + switch (ctr->switch_value) + { + case 1: + { + net_io_id_info1("", &(ctr->auth.id1), ps, depth); + break; + } + case 2: + { + net_io_id_info2("", &(ctr->auth.id2), ps, depth); + break; + } + default: + { + /* PANIC! */ + DEBUG(4,("smb_io_sam_info: unknown switch_value!\n")); + break; + } + } +} + +/******************************************************************* +reads or writes a DOM_SAM_INFO structure. +********************************************************************/ +void smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int depth) +{ + if (sam == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_sam_info"); + depth++; + + prs_align(ps); + + smb_io_clnt_info2("", &(sam->client ), ps, depth); + + prs_uint32("ptr_rtn_cred ", ps, depth, &(sam->ptr_rtn_cred)); + smb_io_cred ("", &(sam->rtn_cred), ps, depth); + + prs_uint16("logon_level ", ps, depth, &(sam->logon_level )); + + if (sam->logon_level != 0 && sam->ctr != NULL) + { + net_io_id_info_ctr("logon_info", sam->ctr, ps, depth); + } + + prs_uint16("validation_level", ps, depth, &(sam->validation_level)); +} + +/************************************************************************* + make_net_user_info3 + *************************************************************************/ +void make_net_user_info3(NET_USER_INFO_3 *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, + + char *user_name, + char *full_name, + char *logon_script, + char *profile_path, + char *home_dir, + char *dir_drive, + + uint16 logon_count, + uint16 bad_pw_count, + + uint32 user_id, + uint32 group_id, + uint32 num_groups, + DOM_GID *gids, + uint32 user_flgs, + + char sess_key[16], + + char *logon_srv, + char *logon_dom, + + char *dom_sid, + char *other_sids) +{ + /* only cope with one "other" sid, right now. */ + /* need to count the number of space-delimited sids */ + int i; + int num_other_sids = 0; + + int len_user_name = strlen(user_name ); + int len_full_name = strlen(full_name ); + int len_logon_script = strlen(logon_script); + int len_profile_path = strlen(profile_path); + int len_home_dir = strlen(home_dir ); + int len_dir_drive = strlen(dir_drive ); + + int len_logon_srv = strlen(logon_srv); + int len_logon_dom = strlen(logon_dom); + + usr->ptr_user_info = 1; /* yes, we're bothering to put USER_INFO data here */ + + 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; + + make_uni_hdr(&(usr->hdr_user_name ), len_user_name , len_user_name , 4); + make_uni_hdr(&(usr->hdr_full_name ), len_full_name , len_full_name , 4); + make_uni_hdr(&(usr->hdr_logon_script), len_logon_script, len_logon_script, 4); + make_uni_hdr(&(usr->hdr_profile_path), len_profile_path, len_profile_path, 4); + make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir , len_home_dir , 4); + make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive , len_dir_drive , 4); + + usr->logon_count = logon_count; + usr->bad_pw_count = bad_pw_count; + + usr->user_id = user_id; + usr->group_id = group_id; + usr->num_groups = num_groups; + usr->buffer_groups = 1; /* indicates fill in groups, below, even if there are none */ + usr->user_flgs = user_flgs; + + if (sess_key != NULL) + { + memcpy(usr->user_sess_key, sess_key, sizeof(usr->user_sess_key)); + } + else + { + bzero(usr->user_sess_key, sizeof(usr->user_sess_key)); + } + + make_uni_hdr(&(usr->hdr_logon_srv), len_logon_srv, len_logon_srv, 4); + make_uni_hdr(&(usr->hdr_logon_dom), len_logon_dom, len_logon_dom, 4); + + usr->buffer_dom_id = dom_sid ? 1 : 0; /* yes, we're bothering to put a domain SID in */ + + bzero(usr->padding, sizeof(usr->padding)); + + num_other_sids = make_dom_sid2s(other_sids, usr->other_sids, LSA_MAX_SIDS); + + usr->num_other_sids = num_other_sids; + usr->buffer_other_sids = num_other_sids != 0 ? 1 : 0; + + make_unistr2(&(usr->uni_user_name ), user_name , len_user_name ); + make_unistr2(&(usr->uni_full_name ), full_name , len_full_name ); + make_unistr2(&(usr->uni_logon_script), logon_script, len_logon_script); + make_unistr2(&(usr->uni_profile_path), profile_path, len_profile_path); + make_unistr2(&(usr->uni_home_dir ), home_dir , len_home_dir ); + make_unistr2(&(usr->uni_dir_drive ), dir_drive , len_dir_drive ); + + usr->num_groups2 = num_groups; + for (i = 0; i < num_groups; i++) + { + usr->gids[i] = gids[i]; + } + + make_unistr2(&(usr->uni_logon_srv), logon_srv, len_logon_srv); + make_unistr2(&(usr->uni_logon_dom), logon_dom, len_logon_dom); + + make_dom_sid2(&(usr->dom_sid), dom_sid); + /* "other" sids are set up above */ +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth) +{ + int i; + + if (usr == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_lsa_user_info"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_user_info ", ps, depth, &(usr->ptr_user_info)); + + if (usr->ptr_user_info != 0) + { + smb_io_time("time", &(usr->logon_time) , ps, depth); /* logon time */ + smb_io_time("time", &(usr->logoff_time) , ps, depth); /* logoff time */ + smb_io_time("time", &(usr->kickoff_time) , ps, depth); /* kickoff time */ + smb_io_time("time", &(usr->pass_last_set_time) , ps, depth); /* password last set time */ + smb_io_time("time", &(usr->pass_can_change_time) , ps, depth); /* password can change time */ + smb_io_time("time", &(usr->pass_must_change_time), ps, depth); /* password must change time */ + + smb_io_unihdr("unihdr", &(usr->hdr_user_name) , ps, depth); /* username unicode string header */ + smb_io_unihdr("unihdr", &(usr->hdr_full_name) , ps, depth); /* user's full name unicode string header */ + smb_io_unihdr("unihdr", &(usr->hdr_logon_script), ps, depth); /* logon script unicode string header */ + smb_io_unihdr("unihdr", &(usr->hdr_profile_path), ps, depth); /* profile path unicode string header */ + smb_io_unihdr("unihdr", &(usr->hdr_home_dir) , ps, depth); /* home directory unicode string header */ + smb_io_unihdr("unihdr", &(usr->hdr_dir_drive) , ps, depth); /* home directory drive unicode string header */ + + prs_uint16("logon_count ", ps, depth, &(usr->logon_count )); /* logon count */ + prs_uint16("bad_pw_count ", ps, depth, &(usr->bad_pw_count)); /* bad password count */ + + prs_uint32("user_id ", ps, depth, &(usr->user_id )); /* User ID */ + prs_uint32("group_id ", ps, depth, &(usr->group_id )); /* Group ID */ + prs_uint32("num_groups ", ps, depth, &(usr->num_groups )); /* num groups */ + prs_uint32("buffer_groups ", ps, depth, &(usr->buffer_groups)); /* undocumented buffer pointer to groups. */ + prs_uint32("user_flgs ", ps, depth, &(usr->user_flgs )); /* user flags */ + + prs_uint8s (False, "user_sess_key", ps, depth, usr->user_sess_key, 16); /* unused user session key */ + + smb_io_unihdr("unihdr", &(usr->hdr_logon_srv), ps, depth); /* logon server unicode string header */ + smb_io_unihdr("unihdr", &(usr->hdr_logon_dom), ps, depth); /* logon domain unicode string header */ + + prs_uint32("buffer_dom_id ", ps, depth, &(usr->buffer_dom_id)); /* undocumented logon domain id pointer */ + prs_uint8s (False, "padding ", ps, depth, usr->padding, 40); /* unused padding bytes? */ + + prs_uint32("num_other_sids", ps, depth, &(usr->num_other_sids)); /* 0 - num_sids */ + prs_uint32("buffer_other_sids", ps, depth, &(usr->buffer_other_sids)); /* NULL - undocumented pointer to SIDs. */ + + smb_io_unistr2("unistr2", &(usr->uni_user_name) , usr->hdr_user_name .buffer, ps, depth); /* username unicode string */ + smb_io_unistr2("unistr2", &(usr->uni_full_name) , usr->hdr_full_name .buffer, ps, depth); /* user's full name unicode string */ + smb_io_unistr2("unistr2", &(usr->uni_logon_script), usr->hdr_logon_script.buffer, ps, depth); /* logon script unicode string */ + smb_io_unistr2("unistr2", &(usr->uni_profile_path), usr->hdr_profile_path.buffer, ps, depth); /* profile path unicode string */ + smb_io_unistr2("unistr2", &(usr->uni_home_dir) , usr->hdr_home_dir .buffer, ps, depth); /* home directory unicode string */ + smb_io_unistr2("unistr2", &(usr->uni_dir_drive) , usr->hdr_dir_drive .buffer, ps, depth); /* home directory drive unicode string */ + + prs_align(ps); + prs_uint32("num_groups2 ", ps, depth, &(usr->num_groups2)); /* num groups */ + for (i = 0; i < usr->num_groups2; i++) + { + smb_io_gid("", &(usr->gids[i]), ps, depth); /* group info */ + } + + smb_io_unistr2("unistr2", &( usr->uni_logon_srv), usr->hdr_logon_srv.buffer, ps, depth); /* logon server unicode string */ + smb_io_unistr2("unistr2", &( usr->uni_logon_dom), usr->hdr_logon_srv.buffer, ps, depth); /* logon domain unicode string */ + + smb_io_dom_sid2("", &(usr->dom_sid), ps, depth); /* domain SID */ + + for (i = 0; i < usr->num_other_sids; i++) + { + smb_io_dom_sid2("", &(usr->other_sids[i]), ps, depth); /* other domain SIDs */ + } + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void net_io_q_sam_logon(char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, int depth) +{ + if (q_l == NULL) return; + + prs_debug(ps, depth, desc, "net_io_q_sam_logon"); + depth++; + + prs_align(ps); + + smb_io_sam_info("", &(q_l->sam_id), ps, depth); /* domain SID */ +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void net_io_r_sam_logon(char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, int depth) +{ + if (r_l == NULL) return; + + prs_debug(ps, depth, desc, "net_io_r_sam_logon"); + depth++; + + prs_uint32("buffer_creds", ps, depth, &(r_l->buffer_creds)); /* undocumented buffer pointer */ + smb_io_cred("", &(r_l->srv_creds), ps, depth); /* server credentials. server time stamp appears to be ignored. */ + + prs_uint16("switch_value", ps, depth, &(r_l->switch_value)); + prs_align(ps); + + if (r_l->switch_value != 0) + { + net_io_user_info3("", r_l->user, ps, depth); + } + + prs_uint32("auth_resp ", ps, depth, &(r_l->auth_resp)); /* 1 - Authoritative response; 0 - Non-Auth? */ + + prs_uint32("status ", ps, depth, &(r_l->status)); + + prs_align(ps); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void net_io_q_sam_logoff(char *desc, NET_Q_SAM_LOGOFF *q_l, prs_struct *ps, int depth) +{ + if (q_l == NULL) return; + + prs_debug(ps, depth, desc, "net_io_q_sam_logoff"); + depth++; + + prs_align(ps); + + smb_io_sam_info("", &(q_l->sam_id), ps, depth); /* domain SID */ +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int depth) +{ + if (r_l == NULL) return; + + prs_debug(ps, depth, desc, "net_io_r_sam_logoff"); + depth++; + + prs_align(ps); + + prs_uint32("buffer_creds", ps, depth, &(r_l->buffer_creds)); /* undocumented buffer pointer */ + smb_io_cred("", &(r_l->srv_creds), ps, depth); /* server credentials. server time stamp appears to be ignored. */ + + prs_uint32("status ", ps, depth, &(r_l->status)); +} + + diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c new file mode 100644 index 0000000000..799bd1cc94 --- /dev/null +++ b/source3/rpc_parse/parse_prs.c @@ -0,0 +1,290 @@ +/* + Unix SMB/Netbios implementation. + Version 1.9. + Samba memory buffer functions + Copyright (C) Andrew Tridgell 1992-1997 + Copyright (C) Luke Kenneth Casson Leighton 1996-1997 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +extern int DEBUGLEVEL; + +#include "includes.h" + + +/******************************************************************* + debug output for parsing info. + + XXXX side-effect of this function is to increase the debug depth XXXX + + ********************************************************************/ +void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name) +{ + DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(depth), ps->offset, fn_name, desc)); +} + +/******************************************************************* + initialise a parse structure + ********************************************************************/ +void prs_init(prs_struct *ps, uint32 size, + uint8 align, uint32 margin, + BOOL io) +{ + ps->io = io; + ps->align = align; + ps->offset = 0; + + ps->data = NULL; + mem_buf_init(&(ps->data), margin); + + if (size != 0) + { + mem_alloc_data(ps->data, size); + ps->data->offset.start = 0; + ps->data->offset.end = 0xffffffff; + } +} + +/******************************************************************* + initialise a parse structure + ********************************************************************/ +void prs_mem_free(prs_struct *ps) +{ + mem_buf_free(&(ps->data)); +} + +/******************************************************************* + align a pointer to a multiple of align_offset bytes. looks like it + will work for offsets of 0, 2 and 4... + ********************************************************************/ +void prs_align(prs_struct *ps) +{ + int mod = ps->offset & (ps->align-1); + if (ps->align != 0 && mod != 0) + { + ps->offset += ps->align - mod; + } +} + +/******************************************************************* + attempt, if appropriate, to grow a data buffer. + + depends on the data stream mode (io) + ********************************************************************/ +BOOL prs_grow(prs_struct *ps) +{ + return mem_grow_data(&(ps->data), ps->io, ps->offset); +} + + +/******************************************************************* + stream a uint8 + ********************************************************************/ +BOOL prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8) +{ + char *q = mem_data(&(ps->data), ps->offset); + if (q == NULL) return False; + + DBG_RW_CVAL(name, depth, ps->offset, ps->io, q, *data8) + ps->offset += 1; + + return True; +} + +/******************************************************************* + stream a uint16 + ********************************************************************/ +BOOL prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16) +{ + char *q = mem_data(&(ps->data), ps->offset); + if (q == NULL) return False; + + DBG_RW_SVAL(name, depth, ps->offset, ps->io, q, *data16) + ps->offset += 2; + + return True; +} + +/******************************************************************* + stream a uint32 + ********************************************************************/ +BOOL prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) +{ + char *q = mem_data(&(ps->data), ps->offset); + if (q == NULL) return False; + + DBG_RW_IVAL(name, depth, ps->offset, ps->io, q, *data32) + ps->offset += 4; + + return True; +} + + +/****************************************************************** + stream an array of uint8s. length is number of uint8s + ********************************************************************/ +BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *data8s, int len) +{ + char *q = mem_data(&(ps->data), ps->offset); + if (q == NULL) return False; + + DBG_RW_PCVAL(charmode, name, depth, ps->offset, ps->io, q, data8s, len) + ps->offset += len; + + return True; +} + +/****************************************************************** + stream an array of uint16s. length is number of uint16s + ********************************************************************/ +BOOL prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len) +{ + char *q = mem_data(&(ps->data), ps->offset); + if (q == NULL) return False; + + DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, data16s, len) + ps->offset += len * sizeof(uint16); + + return True; +} + +/****************************************************************** + stream an array of uint32s. length is number of uint32s + ********************************************************************/ +BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *data32s, int len) +{ + char *q = mem_data(&(ps->data), ps->offset); + if (q == NULL) return False; + + DBG_RW_PIVAL(charmode, name, depth, ps->offset, ps->io, q, data32s, len) + ps->offset += len * sizeof(uint32); + + return True; +} + +/****************************************************************** + stream a "not" unicode string, length/buffer specified separately, + in byte chars + ********************************************************************/ +BOOL prs_uninotstr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNINOTSTR2 *str) +{ + char *q = mem_data(&(ps->data), ps->offset); + if (q == NULL) return False; + + DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->uni_max_len) + ps->offset += str->uni_buf_len; + + return True; +} + +/****************************************************************** + stream a string, length/buffer specified separately, + in uint8 chars. + ********************************************************************/ +BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 *str) +{ + char *q = mem_data(&(ps->data), ps->offset); + if (q == NULL) return False; + + DBG_RW_PCVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->str_max_len) + ps->offset += str->str_str_len * sizeof(uint8); + + return True; +} + +/****************************************************************** + stream a unicode string, length/buffer specified separately, + in uint16 chars. + ********************************************************************/ +BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *str) +{ + char *q = mem_data(&(ps->data), ps->offset); + if (q == NULL) return False; + + DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->uni_max_len) + ps->offset += str->uni_str_len * sizeof(uint16); + + return True; +} + +/******************************************************************* + stream a unicode null-terminated string + ********************************************************************/ +BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) +{ + char *q = mem_data(&(ps->data), ps->offset); + int i = 0; + uint8 *start = (uint8*)q; + + if (q == NULL) return False; + + do + { + RW_SVAL(ps->io, q, str->buffer[i],0); + q += 2; + i++; + + } while ((i < sizeof(str->buffer) / sizeof(str->buffer[0])) && + (str->buffer[i] != 0)); + + ps->offset += i*2; + + dump_data(5+depth, start, ps->offset); + + return True; +} + +/******************************************************************* + stream a null-terminated string. len is strlen, and therefore does + not include the null-termination character. + + len == 0 indicates variable length string + (up to max size of pstring - 1024 chars). + + ********************************************************************/ +BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len) +{ + char *q = mem_data(&(ps->data), ps->offset); + uint8 *start = (uint8*)q; + int i = -1; /* start off at zero after 1st i++ */ + + if (q == NULL) return False; + + do + { + i++; + + if (i < len || len == 0) + { + RW_CVAL(ps->io, q, str[i],0); + } + else + { + uint8 dummy = 0; + RW_CVAL(ps->io, q, dummy,0); + } + + q++; + + } while (i < sizeof(pstring) && (len == 0 ? str[i] != 0 : i < len) ); + + ps->offset += i+1; + + dump_data(5+depth, start, ps->offset); + + return True; +} + diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c new file mode 100644 index 0000000000..d278b75f5d --- /dev/null +++ b/source3/rpc_parse/parse_reg.c @@ -0,0 +1,335 @@ +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include "includes.h" + +extern int DEBUGLEVEL; + + +/******************************************************************* +creates a structure. +********************************************************************/ +void make_reg_q_open_policy(REG_Q_OPEN_POLICY *r_q, + uint16 unknown_0, uint32 level, uint16 unknown_1) +{ + r_q->ptr = 1; + r_q->unknown_0 = unknown_0; + r_q->level = level; + r_q->unknown_1 = unknown_1; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_open_policy(char *desc, REG_Q_OPEN_POLICY *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_open_policy"); + depth++; + + prs_align(ps); + + prs_uint32("ptr ", ps, depth, &(r_q->ptr )); + if (r_q->ptr != 0) + { + prs_uint16("unknown_0", ps, depth, &(r_q->unknown_0)); + prs_uint32("level ", ps, depth, &(r_q->level )); + prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1)); + } +} + + +/******************************************************************* +creates a structure. +********************************************************************/ +void make_reg_r_open_policy(REG_R_OPEN_POLICY *r_r, + POLICY_HND *pol, uint32 status) +{ + if (r_r == NULL) return; + + memcpy(&(r_r->pol), pol, sizeof(r_r->pol)); + r_r->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_open_policy(char *desc, REG_R_OPEN_POLICY *r_r, prs_struct *ps, int depth) +{ + if (r_r == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_open_policy"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_r->pol), ps, depth); + + prs_uint32("status", ps, depth, &(r_r->status)); +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_close(char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_unknown_1"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(q_u->pol), ps, depth); + prs_align(ps); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_unknown_1"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_u->pol), ps, depth); + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} +/******************************************************************* +creates a structure. +********************************************************************/ +void make_reg_q_info(REG_Q_INFO *r_q, + POLICY_HND *pol, char *product_type, + NTTIME *prod_time, uint8 major_version, uint8 minor_version, + uint32 unknown) +{ + int type_len = strlen(product_type); + + memcpy(&(r_q->pol), pol, sizeof(r_q->pol)); + make_uni_hdr(&(r_q->hdr_type), type_len, type_len, 1); + make_unistr2(&(r_q->uni_type), product_type, type_len); + + r_q->ptr1 = 1; + memcpy(&(r_q->time), prod_time, sizeof(r_q->time)); + r_q->major_version1 = major_version; + r_q->minor_version1 = minor_version; + bzero(&(r_q->pad1), sizeof(r_q->pad1)); + + r_q->ptr2 = 1; + r_q->major_version2 = major_version; + r_q->minor_version2 = minor_version; + bzero(&(r_q->pad2), sizeof(r_q->pad2)); + + r_q->ptr3 = 1; + r_q->unknown = unknown; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_info"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_q->pol), ps, depth); + smb_io_unihdr ("", &(r_q->hdr_type), ps, depth); + smb_io_unistr2("", &(r_q->uni_type), r_q->hdr_type.buffer, ps, depth); + + prs_uint32("ptr1", ps, depth, &(r_q->ptr1)); + + if (r_q->ptr1 != 0) + { + smb_io_time("", &(r_q->time), ps, depth); + prs_uint8 ("major_version1", ps, depth, &(r_q->major_version1)); + prs_uint8 ("minor_version1", ps, depth, &(r_q->minor_version1)); + prs_uint8s(False, "pad1", ps, depth, r_q->pad1, sizeof(r_q->pad1)); + } + + prs_uint32("ptr2", ps, depth, &(r_q->ptr2)); + + if (r_q->ptr2 != 0) + { + prs_uint8 ("major_version2", ps, depth, &(r_q->major_version2)); + prs_uint8 ("minor_version2", ps, depth, &(r_q->minor_version2)); + prs_uint8s(False, "pad2", ps, depth, r_q->pad2, sizeof(r_q->pad2)); + } + + prs_uint32("ptr3", ps, depth, &(r_q->ptr3)); + + if (r_q->ptr3 != 0) + { + prs_uint32("unknown", ps, depth, &(r_q->unknown)); + } +} + + +/******************************************************************* +creates a structure. +********************************************************************/ +void make_reg_r_info(REG_R_INFO *r_r, + uint32 level, char *os_type, + uint32 unknown_0, uint32 unknown_1, + uint32 status) +{ + int type_len = strlen(os_type); + + r_r->ptr1 = 1; + r_r->level = level; + + r_r->ptr_type = 1; + make_uninotstr2(&(r_r->uni_type), os_type, type_len); + + r_r->ptr2 = 1; + r_r->unknown_0 = unknown_0; + + r_r->ptr3 = 1; + r_r->unknown_1 = unknown_1; + + r_r->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) +{ + if (r_r == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_info"); + depth++; + + prs_align(ps); + + prs_uint32("ptr1", ps, depth, &(r_r->ptr1)); + + if (r_r->ptr1 != 0) + { + prs_uint32("level", ps, depth, &(r_r->level)); + + prs_uint32("ptr_type", ps, depth, &(r_r->ptr_type)); + smb_io_uninotstr2("", &(r_r->uni_type), r_r->ptr_type, ps, depth); + prs_align(ps); + + prs_uint32("ptr2", ps, depth, &(r_r->ptr2)); + + if (r_r->ptr2 != 0) + { + prs_uint32("unknown_0", ps, depth, &(r_r->unknown_0)); + } + + prs_uint32("ptr3", ps, depth, &(r_r->ptr3)); + + if (r_r->ptr3 != 0) + { + prs_uint32("unknown_1", ps, depth, &(r_r->unknown_1)); + } + } + + prs_uint32("status", ps, depth, &(r_r->status)); +} + + +/******************************************************************* +creates a structure. +********************************************************************/ +void make_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, + POLICY_HND *pol, char *name, + uint32 unknown_0, uint32 unknown_1, uint16 unknown_2) +{ + int len_name = strlen(name); + + memcpy(&(r_q->pol), pol, sizeof(r_q->pol)); + + make_uni_hdr(&(r_q->hdr_name), len_name, len_name, 1); + make_unistr2(&(r_q->uni_name), name, len_name); + + r_q->unknown_0 = unknown_0; + r_q->unknown_1 = unknown_1; + r_q->unknown_2 = unknown_2; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_entry"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_q->pol), ps, depth); + smb_io_unihdr ("", &(r_q->hdr_name), ps, depth); + smb_io_unistr2("", &(r_q->uni_name), r_q->hdr_name.buffer, ps, depth); + + prs_uint32("unknown_0", ps, depth, &(r_q->unknown_0)); + prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1)); + prs_uint16("unknown_2", ps, depth, &(r_q->unknown_2)); +} + + +/******************************************************************* +creates a structure. +********************************************************************/ +void make_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r, + POLICY_HND *pol, uint32 status) +{ + if (r_r == NULL) return; + + memcpy(&(r_r->pol), pol, sizeof(r_r->pol)); + r_r->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_open_entry(char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int depth) +{ + if (r_r == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_open_entry"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_r->pol), ps, depth); + + prs_uint32("status", ps, depth, &(r_r->status)); +} + diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c new file mode 100644 index 0000000000..b025d3f1c8 --- /dev/null +++ b/source3/rpc_parse/parse_rpc.c @@ -0,0 +1,528 @@ + +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include "includes.h" + +extern int DEBUGLEVEL; + + +/******************************************************************* +interface/version dce/rpc pipe identification +********************************************************************/ + +#define TRANS_SYNT_V2 \ +{ \ + { \ + 0x04, 0x5d, 0x88, 0x8a, \ + 0xeb, 0x1c, 0xc9, 0x11, \ + 0x9f, 0xe8, 0x08, 0x00, \ + 0x2b, 0x10, 0x48, 0x60 \ + }, 0x02 \ +} \ + +#define SYNT_NETLOGON_V2 \ +{ \ + { \ + 0x04, 0x5d, 0x88, 0x8a, \ + 0xeb, 0x1c, 0xc9, 0x11, \ + 0x9f, 0xe8, 0x08, 0x00, \ + 0x2b, 0x10, 0x48, 0x60 \ + }, 0x02 \ +} \ + +#define SYNT_WKSSVC_V1 \ +{ \ + { \ + 0x98, 0xd0, 0xff, 0x6b, \ + 0x12, 0xa1, 0x10, 0x36, \ + 0x98, 0x33, 0x46, 0xc3, \ + 0xf8, 0x7e, 0x34, 0x5a \ + }, 0x01 \ +} \ + +#define SYNT_SRVSVC_V3 \ +{ \ + { \ + 0xc8, 0x4f, 0x32, 0x4b, \ + 0x70, 0x16, 0xd3, 0x01, \ + 0x12, 0x78, 0x5a, 0x47, \ + 0xbf, 0x6e, 0xe1, 0x88 \ + }, 0x03 \ +} \ + +#define SYNT_LSARPC_V0 \ +{ \ + { \ + 0x78, 0x57, 0x34, 0x12, \ + 0x34, 0x12, 0xcd, 0xab, \ + 0xef, 0x00, 0x01, 0x23, \ + 0x45, 0x67, 0x89, 0xab \ + }, 0x00 \ +} \ + +#define SYNT_SAMR_V1 \ +{ \ + { \ + 0x78, 0x57, 0x34, 0x12, \ + 0x34, 0x12, 0xcd, 0xab, \ + 0xef, 0x00, 0x01, 0x23, \ + 0x45, 0x67, 0x89, 0xac \ + }, 0x01 \ +} \ + +#define SYNT_NETLOGON_V1 \ +{ \ + { \ + 0x78, 0x56, 0x34, 0x12, \ + 0x34, 0x12, 0xcd, 0xab, \ + 0xef, 0x00, 0x01, 0x23, \ + 0x45, 0x67, 0xcf, 0xfb \ + }, 0x01 \ +} \ + +#define SYNT_WINREG_V1 \ +{ \ + { \ + 0x01, 0xd0, 0x8c, 0x33, \ + 0x44, 0x22, 0xf1, 0x31, \ + 0xaa, 0xaa, 0x90, 0x00, \ + 0x38, 0x00, 0x10, 0x03 \ + }, 0x01 \ +} \ + +#define SYNT_NONE_V0 \ +{ \ + { \ + 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00 \ + }, 0x00 \ +} \ + +/* pipe string names */ +#define PIPE_SRVSVC "\\PIPE\\srvsvc" +#define PIPE_SAMR "\\PIPE\\samr" +#define PIPE_WINREG "\\PIPE\\winreg" +#define PIPE_WKSSVC "\\PIPE\\wkssvc" +#define PIPE_NETLOGON "\\PIPE\\NETLOGON" +#define PIPE_NTLSA "\\PIPE\\ntlsa" +#define PIPE_NTSVCS "\\PIPE\\ntsvcs" +#define PIPE_LSASS "\\PIPE\\lsass" +#define PIPE_LSARPC "\\PIPE\\lsarpc" + +struct pipe_id_info pipe_names [] = +{ + /* client pipe , abstract syntax , server pipe , transfer syntax */ + { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_NETLOGON, SYNT_NETLOGON_V1, PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, + { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, + { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, + { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } +}; + +/******************************************************************* +creates an RPC_HDR structure. +********************************************************************/ +void make_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, + uint32 call_id, int data_len, int auth_len) +{ + if (hdr == NULL) return; + + hdr->major = 5; /* RPC version 5 */ + hdr->minor = 0; /* minor version 0 */ + hdr->pkt_type = pkt_type; /* RPC packet type */ + hdr->flags = flags; /* dce/rpc flags */ + hdr->pack_type = 0x10; /* packed data representation */ + hdr->frag_len = data_len; /* fragment length, fill in later */ + hdr->auth_len = auth_len; /* authentication length */ + hdr->call_id = call_id; /* call identifier - match incoming RPC */ +} + +/******************************************************************* +reads or writes an RPC_HDR structure. +********************************************************************/ +void smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) +{ + if (rpc == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr"); + depth++; + + prs_uint8 ("major ", ps, depth, &(rpc->major)); + prs_uint8 ("minor ", ps, depth, &(rpc->minor)); + prs_uint8 ("pkt_type ", ps, depth, &(rpc->pkt_type)); + prs_uint8 ("flags ", ps, depth, &(rpc->flags)); + prs_uint32("pack_type ", ps, depth, &(rpc->pack_type)); + prs_uint16("frag_len ", ps, depth, &(rpc->frag_len)); + prs_uint16("auth_len ", ps, depth, &(rpc->auth_len)); + prs_uint32("call_id ", ps, depth, &(rpc->call_id)); +} + +/******************************************************************* +creates an RPC_IFACE structure. +********************************************************************/ +void make_rpc_iface(RPC_IFACE *ifc, char data[16], uint32 version) +{ + if (ifc == NULL || data == NULL) return; + + memcpy(ifc->data, data, sizeof(ifc->data)); /* 16 bytes of number */ + ifc->version = version; /* the interface number */ +} + +/******************************************************************* +reads or writes an RPC_IFACE structure. +********************************************************************/ +void smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) +{ + if (ifc == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_iface"); + depth++; + + prs_align(ps); + + prs_uint8s (False, "data ", ps, depth, ifc->data, sizeof(ifc->data)); + prs_uint32 ( "version", ps, depth, &(ifc->version)); +} + +/******************************************************************* +creates an RPC_ADDR_STR structure. +********************************************************************/ +void make_rpc_addr_str(RPC_ADDR_STR *str, char *name) +{ + if (str == NULL || name == NULL) return; + + str->len = strlen(name) + 1; + fstrcpy(str->str, name); +} + +/******************************************************************* +reads or writes an RPC_ADDR_STR structure. +********************************************************************/ +void smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) +{ + if (str == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_addr_str"); + depth++; + prs_align(ps); + + prs_uint16 ( "len", ps, depth, &(str->len)); + prs_uint8s (True, "str", ps, depth, (uchar*)str->str, str->len); +} + +/******************************************************************* +creates an RPC_HDR_BBA structure. +********************************************************************/ +void make_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid) +{ + if (bba == NULL) return; + + bba->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ + bba->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ + bba->assoc_gid = assoc_gid; /* associated group id (0x0) */ +} + +/******************************************************************* +reads or writes an RPC_HDR_BBA structure. +********************************************************************/ +void smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) +{ + if (rpc == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_bba"); + depth++; + + prs_uint16("max_tsize", ps, depth, &(rpc->max_tsize)); + prs_uint16("max_rsize", ps, depth, &(rpc->max_rsize)); + prs_uint32("assoc_gid", ps, depth, &(rpc->assoc_gid)); +} + +/******************************************************************* +creates an RPC_HDR_RB structure. +********************************************************************/ +void make_rpc_hdr_rb(RPC_HDR_RB *rpc, + uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, + uint32 num_elements, uint16 context_id, uint8 num_syntaxes, + RPC_IFACE *abstract, RPC_IFACE *transfer) +{ + if (rpc == NULL) return; + + make_rpc_hdr_bba(&(rpc->bba), max_tsize, max_rsize, assoc_gid); + + rpc->num_elements = num_elements ; /* the number of elements (0x1) */ + rpc->context_id = context_id ; /* presentation context identifier (0x0) */ + rpc->num_syntaxes = num_syntaxes ; /* the number of syntaxes (has always been 1?)(0x1) */ + + /* num and vers. of interface client is using */ + memcpy(&(rpc->abstract), abstract, sizeof(rpc->abstract)); + + /* num and vers. of interface to use for replies */ + memcpy(&(rpc->transfer), transfer, sizeof(rpc->transfer)); +} + +/******************************************************************* +reads or writes an RPC_HDR_RB structure. +********************************************************************/ +void smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) +{ + if (rpc == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_rb"); + depth++; + + smb_io_rpc_hdr_bba("", &(rpc->bba), ps, depth); + + prs_uint32("num_elements", ps, depth, &(rpc->num_elements)); + prs_uint16("context_id ", ps, depth, &(rpc->context_id )); + prs_uint8 ("num_syntaxes", ps, depth, &(rpc->num_syntaxes)); + + smb_io_rpc_iface("", &(rpc->abstract), ps, depth); + smb_io_rpc_iface("", &(rpc->transfer), ps, depth); +} + +/******************************************************************* +creates an RPC_RESULTS structure. + +lkclXXXX only one reason at the moment! + +********************************************************************/ +void make_rpc_results(RPC_RESULTS *res, + uint8 num_results, uint16 result, uint16 reason) +{ + if (res == NULL) return; + + res->num_results = num_results; /* the number of results (0x01) */ + res->result = result ; /* result (0x00 = accept) */ + res->reason = reason ; /* reason (0x00 = no reason specified) */ +} + +/******************************************************************* +reads or writes an RPC_RESULTS structure. + +lkclXXXX only one reason at the moment! + +********************************************************************/ +void smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) +{ + if (res == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_results"); + depth++; + + prs_align(ps); + + prs_uint8 ("num_results", ps, depth, &(res->num_results)); + + prs_align(ps); + + prs_uint16("result ", ps, depth, &(res->result )); + prs_uint16("reason ", ps, depth, &(res->reason )); +} + +/******************************************************************* +creates an RPC_HDR_BA structure. + +lkclXXXX only one reason at the moment! + +********************************************************************/ +void make_rpc_hdr_ba(RPC_HDR_BA *rpc, + uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, + char *pipe_addr, + uint8 num_results, uint16 result, uint16 reason, + RPC_IFACE *transfer) +{ + if (rpc == NULL || transfer == NULL || pipe_addr == NULL) return; + + make_rpc_hdr_bba (&(rpc->bba ), max_tsize, max_rsize, assoc_gid); + make_rpc_addr_str(&(rpc->addr), pipe_addr); + make_rpc_results (&(rpc->res ), num_results, result, reason); + + /* the transfer syntax from the request */ + memcpy(&(rpc->transfer), transfer, sizeof(rpc->transfer)); +} + +/******************************************************************* +reads or writes an RPC_HDR_BA structure. +********************************************************************/ +void smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) +{ + if (rpc == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_ba"); + depth++; + + smb_io_rpc_hdr_bba ("", &(rpc->bba) , ps, depth); + smb_io_rpc_addr_str("", &(rpc->addr) , ps, depth); + smb_io_rpc_results ("", &(rpc->res) , ps, depth); + smb_io_rpc_iface ("", &(rpc->transfer), ps, depth); +} + +/******************************************************************* +creates an RPC_HDR_RR structure. +********************************************************************/ +void make_rpc_hdr_rr(RPC_HDR_RR *hdr, uint32 data_len, uint8 opnum) +{ + if (hdr == NULL) return; + + hdr->alloc_hint = data_len - 0x18; /* allocation hint */ + hdr->context_id = 0; /* presentation context identifier */ + hdr->cancel_count = 0; /* cancel count */ + hdr->opnum = opnum; /* opnum */ + hdr->reserved = 0; /* 0 - reserved */ +} + +/******************************************************************* +reads or writes an RPC_HDR_RR structure. +********************************************************************/ +void smb_io_rpc_hdr_rr(char *desc, RPC_HDR_RR *rpc, prs_struct *ps, int depth) +{ + if (rpc == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_rr"); + depth++; + + prs_uint32("alloc_hint", ps, depth, &(rpc->alloc_hint)); + prs_uint8 ("context_id", ps, depth, &(rpc->context_id)); + prs_uint8 ("cancel_ct ", ps, depth, &(rpc->cancel_count)); + prs_uint8 ("opnum ", ps, depth, &(rpc->opnum)); + prs_uint8 ("reserved ", ps, depth, &(rpc->reserved)); +} + +/******************************************************************* +creates an RPC_AUTH_NTLMSSP_REQ structure. +********************************************************************/ +void make_rpc_auth_ntlmssp_req(RPC_AUTH_NTLMSSP_REQ *req, + fstring ntlmssp_str, uint32 ntlmssp_ver, + uint32 unknown_0, fstring myname, fstring domain) +{ + int len_myname = strlen(myname); + int len_domain = strlen(domain); + + if (req == NULL) return; + + fstrcpy(req->ntlmssp_str, ntlmssp_str); /* "NTLMSSP" */ + req->ntlmssp_ver = ntlmssp_ver; /* 0x0000 0001 */ + + req->unknown_0 = unknown_0 ; /* 0x00b2b3 */ + make_str_hdr(&req->hdr_myname, len_myname, len_myname, 1); + make_str_hdr(&req->hdr_domain, len_domain, len_domain, 1); + + fstrcpy(req->myname, myname); + fstrcpy(req->domain, domain); +} + +/******************************************************************* +reads or writes an RPC_AUTH_NTLMSSP_REQ structure. +********************************************************************/ +void smb_io_rpc_auth_ntlmssp_req(char *desc, RPC_AUTH_NTLMSSP_REQ *req, prs_struct *ps, int depth) +{ + if (req == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_req"); + depth++; + + prs_string("ntlmssp_str", ps, depth, req->ntlmssp_str, 0); /* "NTLMSSP" */ + prs_uint32("ntlmssp_ver", ps, depth, &(req->ntlmssp_ver )); + + prs_uint32("unknown_0 ", ps, depth, &(req->unknown_0 )); + smb_io_strhdr("hdr_myname", &(req->hdr_myname), ps, depth); + smb_io_strhdr("hdr_domain", &(req->hdr_domain), ps, depth); + + prs_string("myname", ps, depth, req->myname, req->hdr_myname.str_str_len); + prs_string("domain", ps, depth, req->domain, req->hdr_domain.str_str_len); +} + +/******************************************************************* +creates an RPC_AUTH_NTLMSSP_RESP structure. +********************************************************************/ +void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, + uint8 auth_type, uint8 auth_level, uint8 stub_type_len, + fstring ntlmssp_str, uint32 ntlmssp_ver, + uint32 unknown_1, uint32 unknown_2, uint32 unknown_3, + uint8 data[16]) +{ + if (rsp == NULL) return; + + rsp->auth_type = auth_type; /* nt lm ssp 0x0a */ + rsp->auth_level = auth_level; /* 0x06 */ + rsp->stub_type_len = stub_type_len; /* dunno. */ + rsp->padding = 0; /* padding */ + + rsp->ptr_0 = 1; /* non-zero pointer to something */ + + fstrcpy(rsp->ntlmssp_str, ntlmssp_str); /* "NTLMSSP" */ + rsp->ntlmssp_ver = ntlmssp_ver; /* 0x0000 0002 */ + + rsp->unknown_1 = unknown_1; /* 0x0000 0000 */ + rsp->unknown_2 = unknown_2; /* 0x00b2b3 */ + rsp->unknown_3 = unknown_3; /* 0x0082b1 */ + + memcpy(rsp->data, data, sizeof(rsp->data)); /* 0x10 bytes of something, 8 of which are zeros */ +} + +/******************************************************************* +reads or writes an RPC_AUTH_NTLMSSP_RESP structure. +********************************************************************/ +void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) +{ + if (rsp == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_resp"); + depth++; + + prs_uint8("auth_type", ps, depth, &(rsp->auth_type)); /* nt lm ssp 0x0a */ + prs_uint8("auth_level", ps, depth, &(rsp->auth_level));/* 0x06 */ + prs_uint8("stub_type_len", ps, depth, &(rsp->stub_type_len)); + prs_uint8("padding", ps, depth, &(rsp->padding)); + + prs_uint32("ptr_0", ps, depth, &(rsp->ptr_0 )); /* non-zero pointer to something */ + + prs_string("ntlmssp_str", ps, depth, rsp->ntlmssp_str, 0); /* "NTLMSSP" */ + prs_uint32("ntlmssp_ver", ps, depth, &(rsp->ntlmssp_ver )); /* 0x0000 0002 */ + + prs_uint32("unknown_1", ps, depth, &(rsp->unknown_1)); /* 0x0000 0000 */ + prs_uint32("unknown_2", ps, depth, &(rsp->unknown_2)); /* 0x00b2b3 */ + prs_uint32("unknown_3", ps, depth, &(rsp->unknown_3)); /* 0x0082b1 */ + + prs_uint8s (False, "data", ps, depth, rsp->data, sizeof(rsp->data)); +} + +#if 0 + +/* attached to the end of encrypted rpc requests and responses */ +/* RPC_AUTH_NTLMSSP_CHK */ +typedef struct rpc_auth_ntlmssp_chk_info +{ + uint32 ver; /* 0x1 */ + uint8 data[12]; + +} RPC_AUTH_NTLMSSP_CHK; + +#endif /* 0 */ + diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c new file mode 100644 index 0000000000..a72769d9c0 --- /dev/null +++ b/source3/rpc_parse/parse_samr.c @@ -0,0 +1,2796 @@ +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include "includes.h" + +extern int DEBUGLEVEL; + + +/******************************************************************* +makes a SAMR_Q_CLOSE_HND structure. +********************************************************************/ +void make_samr_q_close_hnd(SAMR_Q_CLOSE_HND *q_c, POLICY_HND *hnd) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_close_hnd\n")); + + memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_close_hnd(char *desc, SAMR_Q_CLOSE_HND *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_close_hnd"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); + prs_align(ps); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_close_hnd"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(r_u->pol), ps, depth); + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, + POLICY_HND *connect_pol, uint32 rid, char *sid) +{ + if (q_u == NULL) return; + + DEBUG(5,("samr_make_q_open_domain\n")); + + memcpy(&q_u->connect_pol, connect_pol, sizeof(q_u->connect_pol)); + q_u->rid = rid; + make_dom_sid2(&(q_u->dom_sid), sid); +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_open_domain"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("connect_pol", &(q_u->connect_pol), ps, depth); + prs_align(ps); + + prs_uint32("rid", ps, depth, &(q_u->rid)); + + smb_io_dom_sid2("sid", &(q_u->dom_sid), ps, depth); + prs_align(ps); +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_open_domain"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("domain_pol", &(r_u->domain_pol), ps, depth); + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_samr_q_unknown_8(SAMR_Q_UNKNOWN_8 *q_u, + POLICY_HND *domain_pol, uint16 switch_value) +{ + if (q_u == NULL) return; + + DEBUG(5,("samr_make_q_unknown_8\n")); + + memcpy(&q_u->domain_pol, domain_pol, sizeof(q_u->domain_pol)); + q_u->switch_value = switch_value; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_unknown_8(char *desc, SAMR_Q_UNKNOWN_8 *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_unknown_8"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth); + prs_align(ps); + + prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); + prs_align(ps); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_samr_q_unknown_3(SAMR_Q_UNKNOWN_3 *q_u, + POLICY_HND *user_pol, uint16 switch_value) +{ + if (q_u == NULL) return; + + DEBUG(5,("samr_make_q_unknown_3\n")); + + memcpy(&q_u->user_pol, user_pol, sizeof(q_u->user_pol)); + q_u->switch_value = switch_value; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_unknown_3(char *desc, SAMR_Q_UNKNOWN_3 *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_unknown_3"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("user_pol", &(q_u->user_pol), ps, depth); + prs_align(ps); + + prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); + prs_align(ps); +} + +/******************************************************************* + makes a DOM_SID3 structure. + + calculate length by adding up the size of the components. + ********************************************************************/ +void make_dom_sid3(DOM_SID3 *sid3, uint16 unk_0, uint16 unk_1, char *sid) +{ + if (sid3 == NULL) return; + + make_dom_sid(&(sid3->sid), sid); + sid3->len = 2 + 8 + sid3->sid.num_auths * 4; +} + +/******************************************************************* +reads or writes a SAM_SID3 structure. + +this one's odd, because the length (in bytes) is specified at the beginning. +the length _includes_ the length of the length, too :-) + +********************************************************************/ +void sam_io_dom_sid3(char *desc, DOM_SID3 *sid3, prs_struct *ps, int depth) +{ + if (sid3 == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_dom_sid3"); + depth++; + + prs_uint16("len", ps, depth, &(sid3->len)); + prs_align(ps); + smb_io_dom_sid("", &(sid3->sid), ps, depth); +} + +/******************************************************************* +makes a SAMR_R_UNKNOWN3 structure. + +unknown_2 : 0x0001 +unknown_3 : 0x8004 + +unknown_4,5 : 0x0000 0014 + +unknown_6 : 0x0002 +unknown_7 : 0x5800 or 0x0070 + +********************************************************************/ +void make_sam_sid_stuff(SAM_SID_STUFF *stf, + uint16 unknown_2, uint16 unknown_3, + uint32 unknown_4, uint16 unknown_6, uint16 unknown_7, + int num_sid3s, DOM_SID3 sid3[MAX_SAM_SIDS]) +{ + stf->unknown_2 = unknown_2; + stf->unknown_3 = unknown_3; + + bzero(stf->padding1, sizeof(stf->padding1)); + + stf->unknown_4 = unknown_4; + stf->unknown_5 = unknown_4; + + stf->unknown_6 = unknown_6; + stf->unknown_7 = unknown_7; + + stf->num_sids = num_sid3s; + + stf->padding2 = 0x0000; + + memcpy(stf->sid, sid3, sizeof(DOM_SID3) * num_sid3s); +} + +/******************************************************************* +reads or writes a SAM_SID_STUFF structure. +********************************************************************/ +void sam_io_sid_stuff(char *desc, SAM_SID_STUFF *stf, prs_struct *ps, int depth) +{ + int i; + + if (stf == NULL) return; + + DEBUG(5,("make_sam_sid_stuff\n")); + + prs_uint16("unknown_2", ps, depth, &(stf->unknown_2)); + prs_uint16("unknown_3", ps, depth, &(stf->unknown_3)); + + prs_uint8s(False, "padding1", ps, depth, stf->padding1, sizeof(stf->padding1)); + + prs_uint32("unknown_4", ps, depth, &(stf->unknown_4)); + prs_uint32("unknown_5", ps, depth, &(stf->unknown_5)); + prs_uint16("unknown_6", ps, depth, &(stf->unknown_6)); + prs_uint16("unknown_7", ps, depth, &(stf->unknown_7)); + + prs_uint32("num_sids ", ps, depth, &(stf->num_sids )); + prs_uint16("padding2 ", ps, depth, &(stf->padding2 )); + + for (i = 0; i < stf->num_sids; i++) + { + sam_io_dom_sid3("", &(stf->sid[i]), ps, depth); + } +} + +/******************************************************************* +reads or writes a SAMR_R_UNKNOWN3 structure. +********************************************************************/ +void make_samr_r_unknown_3(SAMR_R_UNKNOWN_3 *r_u, + uint16 unknown_2, uint16 unknown_3, + uint32 unknown_4, uint16 unknown_6, uint16 unknown_7, + int num_sid3s, DOM_SID3 sid3[MAX_SAM_SIDS], + uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("samr_make_r_unknown_3\n")); + + r_u->ptr_0 = 0; + r_u->ptr_1 = 0; + + if (status == 0x0) + { + r_u->ptr_0 = 1; + r_u->ptr_1 = 1; + make_sam_sid_stuff(&(r_u->sid_stuff), unknown_2, unknown_3, + unknown_4, unknown_6, unknown_7, + num_sid3s, sid3); + } + + r_u->status = status; +} + + +/******************************************************************* +reads or writes a SAMR_R_UNKNOWN_3 structure. + +this one's odd, because the daft buggers use a different mechanism +for writing out the array of sids. they put the number of sids in +only one place: they've calculated the length of each sid and jumped +by that amount. then, retrospectively, the length of the whole buffer +is put at the beginning of the data stream. + +wierd. + +********************************************************************/ +void samr_io_r_unknown_3(char *desc, SAMR_R_UNKNOWN_3 *r_u, prs_struct *ps, int depth) +{ + int ptr_len0; + int ptr_len1; + int ptr_sid_stuff = 0; + + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_unknown_3"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0 )); + + if (ps->io) + { + /* reading. do the length later */ + prs_uint32("sid_stuff_len0", ps, depth, &(r_u->sid_stuff_len0)); + } + else + { + /* storing */ + ptr_len0 = ps->offset; ps->offset += 4; + } + + if (r_u->ptr_0 != 0) + { + prs_uint32("ptr_1 ", ps, depth, &(r_u->ptr_1 )); + if (ps->io) + { + /* reading. do the length later */ + prs_uint32("sid_stuff_len1", ps, depth, &(r_u->sid_stuff_len1)); + } + else + { + /* storing */ + ptr_len1 = ps->offset; ps->offset += 4; + } + + if (r_u->ptr_1 != 0) + { + ptr_sid_stuff = ps->offset; + sam_io_sid_stuff("", &(r_u->sid_stuff), ps, depth); + } + } + + if (!(ps->io)) /* storing not reading. do the length, now. */ + { + if (ptr_sid_stuff != 0) + { + uint32 sid_stuff_len = ps->offset - ptr_sid_stuff; + int old_len = ps->offset; + + ps->offset = ptr_len0; + prs_uint32("sid_stuff_len0", ps, depth, &sid_stuff_len); + + ps->offset = ptr_len1; + prs_uint32("sid_stuff_len1", ps, depth, &sid_stuff_len); + + ps->offset = old_len; + } + } + + prs_uint32("status", ps, depth, &(r_u->status)); +} + + +/******************************************************************* +makes a SAM_STR1 structure. +********************************************************************/ +void make_sam_str1(SAM_STR1 *sam, char *sam_acct, char *sam_name, char *sam_desc) +{ + int len_sam_acct = sam_acct != NULL ? strlen(sam_acct) : 0; + int len_sam_name = sam_name != NULL ? strlen(sam_name) : 0; + int len_sam_desc = sam_desc != NULL ? strlen(sam_desc) : 0; + + if (sam == NULL) return; + + DEBUG(5,("make_sam_str1: %d\n", __LINE__)); + + make_unistr2(&(sam->uni_acct_name), sam_acct, len_sam_acct); + make_unistr2(&(sam->uni_full_name), sam_name, len_sam_name); + make_unistr2(&(sam->uni_acct_desc), sam_desc, len_sam_desc); +} + +/******************************************************************* +reads or writes a SAM_STR1 structure. +********************************************************************/ +void sam_io_sam_str1(char *desc, SAM_STR1 *sam, uint32 acct_buf, uint32 name_buf, uint32 desc_buf, prs_struct *ps, int depth) +{ + if (sam == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_sam_str1"); + depth++; + + prs_align(ps); + + smb_io_unistr2("unistr2", &(sam->uni_acct_name), acct_buf, ps, depth); /* account name unicode string */ + smb_io_unistr2("unistr2", &(sam->uni_full_name), name_buf, ps, depth); /* full name unicode string */ + smb_io_unistr2("unistr2", &(sam->uni_acct_desc), desc_buf, ps, depth); /* account description unicode string */ +} + +/******************************************************************* +makes a SAM_ENTRY1 structure. +********************************************************************/ +void make_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, + uint32 len_sam_name, uint32 len_sam_full, uint32 len_sam_desc, + uint32 rid_user, uint16 acb_info) +{ + if (sam == NULL) return; + + DEBUG(5,("make_sam_entry2: %d\n", __LINE__)); + + sam->user_idx = user_idx; + sam->rid_user = rid_user; + sam->acb_info = acb_info; + sam->pad = 0; + + make_uni_hdr(&(sam->hdr_acct_name), len_sam_name, len_sam_name, len_sam_name != 0); + make_uni_hdr(&(sam->hdr_user_name), len_sam_full, len_sam_full, len_sam_full != 0); + make_uni_hdr(&(sam->hdr_user_desc), len_sam_desc, len_sam_desc, len_sam_desc != 0); +} + +/******************************************************************* +reads or writes a SAM_ENTRY1 structure. +********************************************************************/ +void sam_io_sam_entry1(char *desc, SAM_ENTRY1 *sam, prs_struct *ps, int depth) +{ + if (sam == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_sam_entry2"); + depth++; + + prs_align(ps); + + prs_uint32("user_idx ", ps, depth, &(sam->user_idx )); + + prs_uint32("rid_user ", ps, depth, &(sam->rid_user )); + prs_uint16("acb_info ", ps, depth, &(sam->acb_info )); + prs_uint16("pad ", ps, depth, &(sam->pad )); + + smb_io_unihdr("unihdr", &(sam->hdr_acct_name), ps, depth); /* account name unicode string header */ + smb_io_unihdr("unihdr", &(sam->hdr_user_name), ps, depth); /* account name unicode string header */ + smb_io_unihdr("unihdr", &(sam->hdr_user_desc), ps, depth); /* account name unicode string header */ +} + +/******************************************************************* +makes a SAM_STR2 structure. +********************************************************************/ +void make_sam_str2(SAM_STR2 *sam, char *sam_acct, char *sam_desc) +{ + int len_sam_acct = sam_acct != NULL ? strlen(sam_acct) : 0; + int len_sam_desc = sam_desc != NULL ? strlen(sam_desc) : 0; + + if (sam == NULL) return; + + DEBUG(5,("make_sam_str2: %d\n", __LINE__)); + + make_unistr2(&(sam->uni_srv_name), sam_acct, len_sam_acct); + make_unistr2(&(sam->uni_srv_desc), sam_desc, len_sam_desc); +} + +/******************************************************************* +reads or writes a SAM_STR2 structure. +********************************************************************/ +void sam_io_sam_str2(char *desc, SAM_STR2 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth) +{ + if (sam == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_sam_str2"); + depth++; + + prs_align(ps); + + smb_io_unistr2("unistr2", &(sam->uni_srv_name), acct_buf, ps, depth); /* account name unicode string */ + smb_io_unistr2("unistr2", &(sam->uni_srv_desc), desc_buf, ps, depth); /* account description unicode string */ +} + +/******************************************************************* +makes a SAM_ENTRY2 structure. +********************************************************************/ +void make_sam_entry2(SAM_ENTRY2 *sam, uint32 user_idx, + uint32 len_sam_name, uint32 len_sam_desc, + uint32 rid_user, uint16 acb_info) +{ + if (sam == NULL) return; + + DEBUG(5,("make_sam_entry2: %d\n", __LINE__)); + + sam->user_idx = user_idx; + sam->rid_user = rid_user; + sam->acb_info = acb_info; + sam->pad = 0; + + make_uni_hdr(&(sam->hdr_srv_name), len_sam_name, len_sam_name, len_sam_name != 0); + make_uni_hdr(&(sam->hdr_srv_desc), len_sam_desc, len_sam_desc, len_sam_desc != 0); +} + +/******************************************************************* +reads or writes a SAM_ENTRY2 structure. +********************************************************************/ +void sam_io_sam_entry2(char *desc, SAM_ENTRY2 *sam, prs_struct *ps, int depth) +{ + if (sam == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_sam_entry2"); + depth++; + + prs_align(ps); + + prs_uint32("user_idx ", ps, depth, &(sam->user_idx )); + + prs_uint32("rid_user ", ps, depth, &(sam->rid_user )); + prs_uint16("acb_info ", ps, depth, &(sam->acb_info )); + prs_uint16("pad ", ps, depth, &(sam->pad )); + + smb_io_unihdr("unihdr", &(sam->hdr_srv_name), ps, depth); /* account name unicode string header */ + smb_io_unihdr("unihdr", &(sam->hdr_srv_desc), ps, depth); /* account name unicode string header */ +} + +/******************************************************************* +makes a SAM_STR3 structure. +********************************************************************/ +void make_sam_str3(SAM_STR3 *sam, char *grp_acct, char *grp_desc) +{ + int len_grp_acct = strlen(grp_acct); + int len_grp_desc = strlen(grp_desc); + + if (sam == NULL) return; + + DEBUG(5,("make_sam_str3: %d\n", __LINE__)); + + make_unistr2(&(sam->uni_grp_name), grp_acct, len_grp_acct); + make_unistr2(&(sam->uni_grp_desc), grp_desc, len_grp_desc); +} + +/******************************************************************* +reads or writes a SAM_STR3 structure. +********************************************************************/ +void sam_io_sam_str3(char *desc, SAM_STR3 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth) +{ + if (sam == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_sam_str3"); + depth++; + + prs_align(ps); + + smb_io_unistr2("unistr2", &(sam->uni_grp_name), acct_buf, ps, depth); /* account name unicode string */ + smb_io_unistr2("unistr2", &(sam->uni_grp_desc), desc_buf, ps, depth); /* account description unicode string */ +} + +/******************************************************************* +makes a SAM_ENTRY3 structure. +********************************************************************/ +void make_sam_entry3(SAM_ENTRY3 *sam, uint32 grp_idx, + uint32 len_grp_name, uint32 len_grp_desc, uint32 rid_grp) +{ + if (sam == NULL) return; + + DEBUG(5,("make_sam_entry3: %d\n", __LINE__)); + + sam->grp_idx = grp_idx; + sam->rid_grp = rid_grp; + sam->attr = 0x07; /* group rid attributes - gets ignored by nt 4.0 */ + + make_uni_hdr(&(sam->hdr_grp_name), len_grp_name, len_grp_name, len_grp_name != 0); + make_uni_hdr(&(sam->hdr_grp_desc), len_grp_desc, len_grp_desc, len_grp_desc != 0); +} + +/******************************************************************* +reads or writes a SAM_ENTRY3 structure. +********************************************************************/ +void sam_io_sam_entry3(char *desc, SAM_ENTRY3 *sam, prs_struct *ps, int depth) +{ + if (sam == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_sam_entry3"); + depth++; + + prs_align(ps); + + prs_uint32("grp_idx", ps, depth, &(sam->grp_idx)); + + prs_uint32("rid_grp", ps, depth, &(sam->rid_grp)); + prs_uint32("attr ", ps, depth, &(sam->attr )); + + smb_io_unihdr("unihdr", &(sam->hdr_grp_name), ps, depth); /* account name unicode string header */ + smb_io_unihdr("unihdr", &(sam->hdr_grp_desc), ps, depth); /* account name unicode string header */ +} + +/******************************************************************* +makes a SAM_ENTRY structure. +********************************************************************/ +void make_sam_entry(SAM_ENTRY *sam, uint32 len_sam_name, uint32 rid) +{ + if (sam == NULL) return; + + DEBUG(5,("make_sam_entry: %d\n", __LINE__)); + + sam->rid = rid; + make_uni_hdr(&(sam->hdr_name), len_sam_name, len_sam_name, len_sam_name != 0); +} + +/******************************************************************* +reads or writes a SAM_ENTRY structure. +********************************************************************/ +void sam_io_sam_entry(char *desc, SAM_ENTRY *sam, prs_struct *ps, int depth) +{ + if (sam == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_sam_entry"); + depth++; + + prs_align(ps); + prs_uint32("rid", ps, depth, &(sam->rid )); + smb_io_unihdr("unihdr", &(sam->hdr_name), ps, depth); /* account name unicode string header */ +} + +/******************************************************************* +makes a SAMR_Q_ENUM_DOM_USERS structure. +********************************************************************/ +void make_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_e, POLICY_HND *pol, + uint16 req_num_entries, uint16 unk_0, + uint16 acb_mask, uint16 unk_1, uint32 size) +{ + if (q_e == NULL || pol == NULL) return; + + DEBUG(5,("make_q_enum_dom_users\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + q_e->req_num_entries = req_num_entries; /* zero indicates lots */ + q_e->unknown_0 = unk_0; /* this gets returned in the response */ + q_e->acb_mask = acb_mask; + q_e->unknown_1 = unk_1; + q_e->max_size = size; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_enum_dom_users(char *desc, SAMR_Q_ENUM_DOM_USERS *q_e, prs_struct *ps, int depth) +{ + if (q_e == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_enum_dom_users"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + prs_align(ps); + + prs_uint16("req_num_entries", ps, depth, &(q_e->req_num_entries)); + prs_uint16("unknown_0 ", ps, depth, &(q_e->unknown_0 )); + + prs_uint16("acb_mask ", ps, depth, &(q_e->acb_mask )); + prs_uint16("unknown_1 ", ps, depth, &(q_e->unknown_1 )); + + prs_uint32("max_size ", ps, depth, &(q_e->max_size )); + + prs_align(ps); +} + + +/******************************************************************* +makes a SAMR_R_ENUM_DOM_USERS structure. +********************************************************************/ +void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, + uint16 total_num_entries, uint16 unk_0, + uint32 num_sam_entries, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES], uint32 status) +{ + int i; + + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_enum_dom_users\n")); + + if (num_sam_entries >= MAX_SAM_ENTRIES) + { + num_sam_entries = MAX_SAM_ENTRIES; + DEBUG(5,("limiting number of entries to %d %s\n", num_sam_entries)); + } + + r_u->total_num_entries = total_num_entries; + r_u->unknown_0 = unk_0; + + if (total_num_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; + + for (i = 0; i < num_sam_entries; i++) + { + make_sam_entry(&(r_u->sam[i]), + pass[i].uni_user_name.uni_str_len, + pass[i].user_rid); + + copy_unistr2(&(r_u->uni_acct_name[i]), &(pass[i].uni_user_name)); + } + + 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; + } + + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct *ps, int depth) +{ + int i; + + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_enum_dom_users"); + depth++; + + prs_align(ps); + + prs_uint16("total_num_entries", ps, depth, &(r_u->total_num_entries)); + prs_uint16("unknown_0 ", ps, depth, &(r_u->unknown_0 )); + prs_uint32("ptr_entries1", ps, depth, &(r_u->ptr_entries1)); + + if (r_u->total_num_entries != 0 && r_u->ptr_entries1 != 0) + { + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); + prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); + + for (i = 0; i < r_u->num_entries2; i++) + { + prs_grow(ps); + sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); + } + + for (i = 0; i < r_u->num_entries2; i++) + { + prs_grow(ps); + smb_io_unistr2("", &(r_u->uni_acct_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); + } + + prs_align(ps); + + prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); + } + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +makes a SAMR_Q_ENUM_DOM_ALIASES structure. +********************************************************************/ +void make_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_e, POLICY_HND *pol, uint32 size) +{ + if (q_e == NULL || pol == NULL) return; + + DEBUG(5,("make_q_enum_dom_aliases\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + q_e->unknown_0 = 0; + q_e->max_size = size; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_enum_dom_aliases(char *desc, SAMR_Q_ENUM_DOM_ALIASES *q_e, prs_struct *ps, int depth) +{ + if (q_e == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_enum_dom_aliases"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + prs_align(ps); + + prs_uint32("unknown_0", ps, depth, &(q_e->unknown_0)); + prs_uint32("max_size ", ps, depth, &(q_e->max_size )); + + prs_align(ps); +} + + +/******************************************************************* +makes a SAMR_R_ENUM_DOM_ALIASES structure. +********************************************************************/ +void make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, + uint32 num_sam_entries, SAM_USER_INFO_21 grps[MAX_SAM_ENTRIES], + uint32 status) +{ + int i; + + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_enum_dom_aliases\n")); + + if (num_sam_entries >= MAX_SAM_ENTRIES) + { + num_sam_entries = MAX_SAM_ENTRIES; + DEBUG(5,("limiting number of entries to %d %s\n", num_sam_entries)); + } + + r_u->num_entries = num_sam_entries; + + if (num_sam_entries > 0) + { + r_u->ptr_entries = 1; + r_u->num_entries2 = num_sam_entries; + r_u->ptr_entries2 = 1; + r_u->num_entries3 = num_sam_entries; + + for (i = 0; i < num_sam_entries; i++) + { + make_sam_entry(&(r_u->sam[i]), + grps[i].uni_user_name.uni_str_len, + grps[i].user_rid); + + copy_unistr2(&(r_u->uni_grp_name[i]), &(grps[i].uni_user_name)); + } + + r_u->num_entries4 = num_sam_entries; + } + else + { + r_u->ptr_entries = 0; + } + + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_struct *ps, int depth) +{ + int i; + + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_enum_dom_aliases"); + depth++; + + prs_align(ps); + + prs_uint32("num_entries", ps, depth, &(r_u->num_entries)); + prs_uint32("ptr_entries", ps, depth, &(r_u->ptr_entries)); + + if (r_u->num_entries != 0 && r_u->ptr_entries != 0) + { + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); + prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); + + for (i = 0; i < r_u->num_entries; i++) + { + sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); + } + + for (i = 0; i < r_u->num_entries; i++) + { + smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); + } + + prs_align(ps); + + prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); + } + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +makes a SAMR_Q_QUERY_DISPINFO structure. +********************************************************************/ +void make_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_e, POLICY_HND *pol, + uint16 switch_level, uint32 start_idx, uint32 size) +{ + if (q_e == NULL || pol == NULL) return; + + DEBUG(5,("make_q_query_dispinfo\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + q_e->switch_level = switch_level; + + q_e->unknown_0 = 0; + q_e->start_idx = start_idx; + q_e->unknown_1 = 0x000007d0; + q_e->max_size = size; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO *q_e, prs_struct *ps, int depth) +{ + if (q_e == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_query_dispinfo"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + prs_align(ps); + + prs_uint16("switch_level", ps, depth, &(q_e->switch_level)); + prs_uint16("unknown_0 ", ps, depth, &(q_e->unknown_0 )); + prs_uint32("start_idx ", ps, depth, &(q_e->start_idx )); + prs_uint32("unknown_1 ", ps, depth, &(q_e->unknown_1 )); + prs_uint32("max_size ", ps, depth, &(q_e->max_size )); + + prs_align(ps); +} + + +/******************************************************************* +makes a SAM_INFO_2 structure. +********************************************************************/ +void make_sam_info_2(SAM_INFO_2 *sam, uint32 acb_mask, + uint32 start_idx, uint32 num_sam_entries, + SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) +{ + int i; + int entries_added; + + if (sam == NULL) return; + + DEBUG(5,("make_sam_info_2\n")); + + if (num_sam_entries >= MAX_SAM_ENTRIES) + { + num_sam_entries = MAX_SAM_ENTRIES; + DEBUG(5,("limiting number of entries to %d %s\n", num_sam_entries)); + } + + for (i = start_idx, entries_added = 0; i < num_sam_entries; i++) + { + if (IS_BITS_SET_ALL(pass[i].acb_info, acb_mask)) + { + make_sam_entry2(&(sam->sam[entries_added]), + start_idx + entries_added + 1, + pass[i].uni_user_name.uni_str_len, + pass[i].uni_acct_desc.uni_str_len, + pass[i].user_rid, + pass[i].acb_info); + + copy_unistr2(&(sam->str[entries_added].uni_srv_name), &(pass[i].uni_user_name)); + copy_unistr2(&(sam->str[entries_added].uni_srv_desc), &(pass[i].uni_acct_desc)); + + entries_added++; + } + + sam->num_entries = entries_added; + sam->ptr_entries = 1; + sam->num_entries2 = entries_added; + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void sam_io_sam_info_2(char *desc, SAM_INFO_2 *sam, prs_struct *ps, int depth) +{ + int i; + + if (sam == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_sam_info_2"); + depth++; + + prs_align(ps); + + prs_uint32("num_entries ", ps, depth, &(sam->num_entries )); + prs_uint32("ptr_entries ", ps, depth, &(sam->ptr_entries )); + + prs_uint32("num_entries2 ", ps, depth, &(sam->num_entries2 )); + + for (i = 0; i < sam->num_entries; i++) + { + sam_io_sam_entry2("", &(sam->sam[i]), ps, depth); + } + + for (i = 0; i < sam->num_entries; i++) + { + sam_io_sam_str2 ("", &(sam->str[i]), + sam->sam[i].hdr_srv_name.buffer, + sam->sam[i].hdr_srv_desc.buffer, + ps, depth); + } +} + + +/******************************************************************* +makes a SAM_INFO_1 structure. +********************************************************************/ +void make_sam_info_1(SAM_INFO_1 *sam, uint32 acb_mask, + uint32 start_idx, uint32 num_sam_entries, + SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) +{ + int i; + int entries_added; + + if (sam == NULL) return; + + DEBUG(5,("make_sam_info_1\n")); + + if (num_sam_entries >= MAX_SAM_ENTRIES) + { + num_sam_entries = MAX_SAM_ENTRIES; + DEBUG(5,("limiting number of entries to %d %s\n", num_sam_entries)); + } + + for (i = start_idx, entries_added = 0; i < num_sam_entries; i++) + { + if (IS_BITS_SET_ALL(pass[i].acb_info, acb_mask)) + { + make_sam_entry1(&(sam->sam[entries_added]), + start_idx + entries_added + 1, + pass[i].uni_user_name.uni_str_len, + pass[i].uni_full_name.uni_str_len, + pass[i].uni_acct_desc.uni_str_len, + pass[i].user_rid, + pass[i].acb_info); + + copy_unistr2(&(sam->str[entries_added].uni_acct_name), &(pass[i].uni_user_name)); + copy_unistr2(&(sam->str[entries_added].uni_full_name), &(pass[i].uni_full_name)); + copy_unistr2(&(sam->str[entries_added].uni_acct_desc), &(pass[i].uni_acct_desc)); + + entries_added++; + } + } + + sam->num_entries = entries_added; + sam->ptr_entries = 1; + sam->num_entries2 = entries_added; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void sam_io_sam_info_1(char *desc, SAM_INFO_1 *sam, prs_struct *ps, int depth) +{ + int i; + + if (sam == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_sam_info_1"); + depth++; + + prs_align(ps); + + prs_uint32("num_entries ", ps, depth, &(sam->num_entries )); + prs_uint32("ptr_entries ", ps, depth, &(sam->ptr_entries )); + + prs_uint32("num_entries2 ", ps, depth, &(sam->num_entries2 )); + + for (i = 0; i < sam->num_entries; i++) + { + sam_io_sam_entry1("", &(sam->sam[i]), ps, depth); + } + + for (i = 0; i < sam->num_entries; i++) + { + 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); + } +} + + +/******************************************************************* +makes a SAMR_R_QUERY_DISPINFO structure. +********************************************************************/ +void make_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO *r_u, + uint16 switch_level, SAM_INFO_CTR *ctr, uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_query_dispinfo\n")); + + if (status == 0x0) + { + r_u->unknown_0 = 0x0000001; + r_u->unknown_1 = 0x0000001; + } + else + { + r_u->unknown_0 = 0x0; + r_u->unknown_1 = 0x0; + } + + r_u->switch_level = switch_level; + r_u->ctr = ctr; + r_u->status = status; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_query_dispinfo"); + depth++; + + prs_align(ps); + + prs_uint32("unknown_0 ", ps, depth, &(r_u->unknown_0 )); + prs_uint32("unknown_1 ", ps, depth, &(r_u->unknown_1 )); + prs_uint16("switch_level ", ps, depth, &(r_u->switch_level )); + + prs_align(ps); + + switch (r_u->switch_level) + { + case 0x1: + { + sam_io_sam_info_1("users", r_u->ctr->sam.info1, ps, depth); + break; + } + case 0x2: + { + sam_io_sam_info_2("servers", r_u->ctr->sam.info2, ps, depth); + break; + } + default: + { + DEBUG(5,("samr_io_r_query_dispinfo: unknown switch value\n")); + break; + } + } + + prs_uint32("status", ps, depth, &(r_u->status)); +} + + +/******************************************************************* +makes a SAMR_Q_ENUM_DOM_GROUPS structure. +********************************************************************/ +void make_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol, + uint16 switch_level, uint32 start_idx, uint32 size) +{ + if (q_e == NULL || pol == NULL) return; + + DEBUG(5,("make_q_enum_dom_groups\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + q_e->switch_level = switch_level; + + q_e->unknown_0 = 0; + q_e->start_idx = start_idx; + q_e->unknown_1 = 0x000007d0; + q_e->max_size = size; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_enum_dom_groups(char *desc, SAMR_Q_ENUM_DOM_GROUPS *q_e, prs_struct *ps, int depth) +{ + if (q_e == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_enum_dom_groups"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + prs_align(ps); + + prs_uint16("switch_level", ps, depth, &(q_e->switch_level)); + prs_uint16("unknown_0 ", ps, depth, &(q_e->unknown_0 )); + prs_uint32("start_idx ", ps, depth, &(q_e->start_idx )); + prs_uint32("unknown_1 ", ps, depth, &(q_e->unknown_1 )); + prs_uint32("max_size ", ps, depth, &(q_e->max_size )); + + prs_align(ps); +} + + +/******************************************************************* +makes a SAMR_R_ENUM_DOM_GROUPS structure. +********************************************************************/ +void make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, + uint32 start_idx, uint32 num_sam_entries, + SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES], + uint32 status) +{ + int i; + int entries_added; + + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_enum_dom_groups\n")); + + if (num_sam_entries >= MAX_SAM_ENTRIES) + { + num_sam_entries = MAX_SAM_ENTRIES; + DEBUG(5,("limiting number of entries to %d %s\n", num_sam_entries)); + } + + if (status == 0x0) + { + for (i = start_idx, entries_added = 0; i < num_sam_entries; i++) + { + make_sam_entry3(&(r_u->sam[entries_added]), + start_idx + entries_added + 1, + pass[i].uni_user_name.uni_str_len, + pass[i].uni_acct_desc.uni_str_len, + pass[i].user_rid); + + copy_unistr2(&(r_u->str[entries_added].uni_grp_name), &(pass[i].uni_user_name)); + copy_unistr2(&(r_u->str[entries_added].uni_grp_desc), &(pass[i].uni_acct_desc)); + + entries_added++; + } + + if (entries_added > 0) + { + r_u->unknown_0 = 0x0000492; + r_u->unknown_1 = 0x000049a; + } + else + { + r_u->unknown_0 = 0x0; + r_u->unknown_1 = 0x0; + } + r_u->switch_level = 3; + r_u->num_entries = entries_added; + r_u->ptr_entries = 1; + r_u->num_entries2 = entries_added; + } + else + { + r_u->switch_level = 0; + } + + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_struct *ps, int depth) +{ + int i; + + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_enum_dom_groups"); + depth++; + + prs_align(ps); + + prs_uint32("unknown_0 ", ps, depth, &(r_u->unknown_0 )); + prs_uint32("unknown_1 ", ps, depth, &(r_u->unknown_1 )); + prs_uint32("switch_level ", ps, depth, &(r_u->switch_level )); + + if (r_u->switch_level != 0) + { + prs_uint32("num_entries ", ps, depth, &(r_u->num_entries )); + prs_uint32("ptr_entries ", ps, depth, &(r_u->ptr_entries )); + + prs_uint32("num_entries2 ", ps, depth, &(r_u->num_entries2 )); + + for (i = 0; i < r_u->num_entries; i++) + { + sam_io_sam_entry3("", &(r_u->sam[i]), ps, depth); + } + + for (i = 0; i < r_u->num_entries; i++) + { + sam_io_sam_str3 ("", &(r_u->str[i]), + r_u->sam[i].hdr_grp_name.buffer, + r_u->sam[i].hdr_grp_desc.buffer, + ps, depth); + } + } + + prs_uint32("status", ps, depth, &(r_u->status)); +} + + +/******************************************************************* +makes a SAMR_Q_QUERY_ALIASINFO structure. +********************************************************************/ +void make_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO *q_e, + POLICY_HND *pol, + uint16 switch_level) +{ + if (q_e == NULL || pol == NULL) return; + + DEBUG(5,("make_q_query_aliasinfo\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + q_e->switch_level = switch_level; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_query_aliasinfo(char *desc, SAMR_Q_QUERY_ALIASINFO *q_e, prs_struct *ps, int depth) +{ + if (q_e == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_query_aliasinfo"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + prs_align(ps); + + prs_uint16("switch_level", ps, depth, &(q_e->switch_level)); +} + + +/******************************************************************* +makes a SAMR_R_QUERY_ALIASINFO structure. +********************************************************************/ +void make_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *r_u, + uint16 switch_value, char *acct_desc, + uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_query_aliasinfo\n")); + + r_u->ptr = 0; + + if (status == 0) + { + r_u->switch_value = switch_value; + + switch (switch_value) + { + case 3: + { + int acct_len = acct_desc ? strlen(acct_desc) : 0; + + r_u->ptr = 1; + + make_uni_hdr(&(r_u->alias.info3.hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0); + make_unistr2(&(r_u->alias.info3.uni_acct_desc), acct_desc, acct_len); + + break; + } + + default: + { + DEBUG(4,("make_samr_r_query_aliasinfo: unsupported switch level\n")); + break; + } + } + } + + r_u->status = status; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo"); + depth++; + + prs_align(ps); + + prs_uint32("ptr ", ps, depth, &(r_u->ptr )); + + if (r_u->ptr != 0) + { + prs_uint16("switch_value", ps, depth, &(r_u->switch_value)); + prs_align(ps); + + if (r_u->switch_value != 0) + { + switch (r_u->switch_value) + { + case 3: + { + smb_io_unihdr ("", &(r_u->alias.info3.hdr_acct_desc), ps, depth); + smb_io_unistr2("", &(r_u->alias.info3.uni_acct_desc), r_u->alias.info3.hdr_acct_desc.buffer, ps, depth); + break; + } + default: + { + DEBUG(4,("samr_io_r_query_aliasinfo: unsupported switch level\n")); + break; + } + } + } + } + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +reads or writes a SAMR_Q_LOOKUP_IDS structure. +********************************************************************/ +void samr_io_q_lookup_ids(char *desc, SAMR_Q_LOOKUP_IDS *q_u, prs_struct *ps, int depth) +{ + fstring tmp; + int i; + + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_lookup_ids"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); + prs_align(ps); + + prs_uint32("num_sids1", ps, depth, &(q_u->num_sids1)); + prs_uint32("ptr ", ps, depth, &(q_u->ptr )); + prs_uint32("num_sids2", ps, depth, &(q_u->num_sids2)); + + for (i = 0; i < q_u->num_sids2; i++) + { + sprintf(tmp, "ptr[%02d]", i); + prs_uint32(tmp, ps, depth, &(q_u->ptr_sid[i])); + } + + for (i = 0; i < q_u->num_sids2; i++) + { + if (q_u->ptr_sid[i] != 0) + { + sprintf(tmp, "sid[%02d]", i); + smb_io_dom_sid2(tmp, &(q_u->sid[i]), ps, depth); + } + } + + prs_align(ps); +} + + +/******************************************************************* +makes a SAMR_R_LOOKUP_IDS structure. +********************************************************************/ +void make_samr_r_lookup_ids(SAMR_R_LOOKUP_IDS *r_u, + uint32 num_rids, uint32 *rid, uint32 status) +{ + int i; + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_lookup_ids\n")); + + if (status == 0x0) + { + r_u->num_entries = num_rids; + r_u->ptr = 1; + r_u->num_entries2 = num_rids; + + for (i = 0; i < num_rids; i++) + { + r_u->rid[i] = rid[i]; + } + } + else + { + r_u->num_entries = 0; + r_u->ptr = 0; + r_u->num_entries2 = 0; + } + + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_lookup_ids(char *desc, SAMR_R_LOOKUP_IDS *r_u, prs_struct *ps, int depth) +{ + fstring tmp; + int i; + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_lookup_ids"); + depth++; + + prs_align(ps); + + prs_uint32("num_entries", ps, depth, &(r_u->num_entries)); + prs_uint32("ptr ", ps, depth, &(r_u->ptr )); + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + + if (r_u->num_entries != 0) + { + + for (i = 0; i < r_u->num_entries2; i++) + { + sprintf(tmp, "rid[%02d]", i); + prs_uint32(tmp, ps, depth, &(r_u->rid[i])); + } + } + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *ps, int depth) +{ + int i; + + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_lookup_names"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); + prs_align(ps); + + prs_uint32("num_rids1", ps, depth, &(q_u->num_rids1)); + prs_uint32("rid ", ps, depth, &(q_u->rid )); + prs_uint32("ptr ", ps, depth, &(q_u->ptr )); + prs_uint32("num_rids2", ps, depth, &(q_u->num_rids2)); + + for (i = 0; i < q_u->num_rids2; i++) + { + smb_io_unihdr ("", &(q_u->hdr_user_name[i]), ps, depth); + } + for (i = 0; i < q_u->num_rids2; i++) + { + smb_io_unistr2("", &(q_u->uni_user_name[i]), q_u->hdr_user_name[i].buffer, ps, depth); + } + + prs_align(ps); +} + + +/******************************************************************* +makes a SAMR_R_LOOKUP_NAMES structure. +********************************************************************/ +void make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, + uint32 num_rids, uint32 *rid, uint32 status) +{ + int i; + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_lookup_names\n")); + + if (status == 0x0) + { + r_u->num_entries = num_rids; + r_u->undoc_buffer = 1; + r_u->num_entries2 = num_rids; + + for (i = 0; i < num_rids; i++) + { + make_dom_rid3(&(r_u->dom_rid[i]), rid[i]); + } + + r_u->num_entries3 = num_rids; + } + else + { + r_u->num_entries = 0; + r_u->undoc_buffer = 0; + r_u->num_entries2 = 0; + r_u->num_entries3 = 0; + } + + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *ps, int depth) +{ + int i; + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_lookup_names"); + depth++; + + prs_align(ps); + + prs_uint32("num_entries ", ps, depth, &(r_u->num_entries )); + prs_uint32("undoc_buffer", ps, depth, &(r_u->undoc_buffer)); + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + + if (r_u->num_entries != 0) + { + for (i = 0; i < r_u->num_entries2; i++) + { + smb_io_dom_rid3("", &(r_u->dom_rid[i]), ps, depth); + } + + } + + prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +makes a SAMR_Q_UNKNOWN_12 structure. +********************************************************************/ +void make_samr_q_unknown_12(SAMR_Q_UNKNOWN_12 *q_u, + POLICY_HND *pol, uint32 rid, + uint32 num_gids, uint32 *gid) +{ + int i; + if (q_u == NULL) return; + + DEBUG(5,("make_samr_r_unknwon_12\n")); + + memcpy(&(q_u->pol), pol, sizeof(*pol)); + + q_u->num_gids1 = num_gids; + q_u->rid = rid; + q_u->ptr = 0; + q_u->num_gids2 = num_gids; + + for (i = 0; i < num_gids; i++) + { + q_u->gid[i] = gid[i]; + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, int depth) +{ + int i; + fstring tmp; + + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_unknown_12"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); + prs_align(ps); + + prs_uint32("num_gids1", ps, depth, &(q_u->num_gids1)); + prs_uint32("rid ", ps, depth, &(q_u->rid )); + prs_uint32("ptr ", ps, depth, &(q_u->ptr )); + prs_uint32("num_gids2", ps, depth, &(q_u->num_gids2)); + + for (i = 0; i < q_u->num_gids2; i++) + { + sprintf(tmp, "gid[%02d] ", i); + prs_uint32(tmp, ps, depth, &(q_u->gid[i])); + } + + prs_align(ps); +} + + +/******************************************************************* +makes a SAMR_R_UNKNOWN_12 structure. +********************************************************************/ +void make_samr_r_unknown_12(SAMR_R_UNKNOWN_12 *r_u, + uint32 num_aliases, fstring *als_name, uint32 *num_als_usrs, + uint32 status) +{ + int i; + if (r_u == NULL || als_name == NULL || num_als_usrs == NULL) return; + + DEBUG(5,("make_samr_r_unknown_12\n")); + + if (status == 0x0) + { + r_u->num_aliases1 = num_aliases; + r_u->ptr_aliases = 1; + r_u->num_aliases2 = num_aliases; + + r_u->num_als_usrs1 = num_aliases; + r_u->ptr_als_usrs = 1; + r_u->num_als_usrs2 = num_aliases; + + for (i = 0; i < num_aliases; i++) + { + int als_len = als_name[i] != NULL ? strlen(als_name[i]) : 0; + make_uni_hdr(&(r_u->hdr_als_name[i]), als_len , als_len, als_name[i] ? 1 : 0); + make_unistr2(&(r_u->uni_als_name[i]), als_name[i], als_len); + r_u->num_als_usrs[i] = num_als_usrs[i]; + } + } + else + { + r_u->num_aliases1 = num_aliases; + r_u->ptr_aliases = 0; + r_u->num_aliases2 = num_aliases; + + r_u->num_als_usrs1 = num_aliases; + r_u->ptr_als_usrs = 0; + r_u->num_als_usrs2 = num_aliases; + } + + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, int depth) +{ + int i; + fstring tmp; + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_unknown_12"); + depth++; + + prs_align(ps); + + prs_uint32("num_aliases1", ps, depth, &(r_u->num_aliases1)); + prs_uint32("ptr_aliases ", ps, depth, &(r_u->ptr_aliases )); + prs_uint32("num_aliases2", ps, depth, &(r_u->num_aliases2)); + + if (r_u->ptr_aliases != 0 && r_u->num_aliases1 != 0) + { + for (i = 0; i < r_u->num_aliases2; i++) + { + sprintf(tmp, "als_hdr[%02d] ", i); + smb_io_unihdr ("", &(r_u->hdr_als_name[i]), ps, depth); + } + for (i = 0; i < r_u->num_aliases2; i++) + { + sprintf(tmp, "als_str[%02d] ", i); + smb_io_unistr2("", &(r_u->uni_als_name[i]), r_u->hdr_als_name[i].buffer, ps, depth); + } + } + + prs_align(ps); + + prs_uint32("num_als_usrs1", ps, depth, &(r_u->num_als_usrs1)); + prs_uint32("ptr_als_usrs ", ps, depth, &(r_u->ptr_als_usrs )); + prs_uint32("num_als_usrs2", ps, depth, &(r_u->num_als_usrs2)); + + if (r_u->ptr_als_usrs != 0 && r_u->num_als_usrs1 != 0) + { + for (i = 0; i < r_u->num_als_usrs2; i++) + { + sprintf(tmp, "als_usrs[%02d] ", i); + prs_uint32(tmp, ps, depth, &(r_u->num_als_usrs[i])); + } + } + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_samr_q_open_user(SAMR_Q_OPEN_USER *q_u, + POLICY_HND *pol, + uint32 unk_0, uint32 rid) +{ + if (q_u == NULL) return; + + DEBUG(5,("samr_make_q_open_user\n")); + + memcpy(&q_u->domain_pol, pol, sizeof(q_u->domain_pol)); + + q_u->unknown_0 = unk_0; + q_u->user_rid = rid; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_open_user"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth); + prs_align(ps); + + prs_uint32("unknown_0", ps, depth, &(q_u->unknown_0)); + prs_uint32("user_rid ", ps, depth, &(q_u->user_rid )); + + prs_align(ps); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_open_user"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("user_pol", &(r_u->user_pol), ps, depth); + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + + +/******************************************************************* +makes a SAMR_Q_QUERY_USERGROUPS structure. +********************************************************************/ +void make_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u, + POLICY_HND *hnd) +{ + if (q_u == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_query_usergroups\n")); + + memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_query_usergroups"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); + prs_align(ps); +} + +/******************************************************************* +makes a SAMR_R_QUERY_USERGROUPS structure. +********************************************************************/ +void make_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u, + uint32 num_gids, DOM_GID *gid, uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_query_usergroups\n")); + + if (status == 0x0) + { + r_u->ptr_0 = 1; + r_u->num_entries = num_gids; + r_u->ptr_1 = 1; + r_u->num_entries2 = num_gids; + + r_u->gid = gid; + +#if 0 + int i; + for (i = 0; i < num_gids && i < LSA_MAX_GROUPS; i++) + { + r_u->gid[i].g_rid = gid[i].g_rid; + r_u->gid[i].attr = gid[i].attr ; + } +#endif + + } + else + { + r_u->ptr_0 = 0; + r_u->num_entries = 0; + r_u->ptr_1 = 0; + } + + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_struct *ps, int depth) +{ + int i; + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_query_usergroups"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0 )); + + if (r_u->ptr_0 != 0) + { + prs_uint32("num_entries ", ps, depth, &(r_u->num_entries)); + prs_uint32("ptr_1 ", ps, depth, &(r_u->ptr_1 )); + + if (r_u->num_entries != 0) + { + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + + for (i = 0; i < r_u->num_entries2; i++) + { + smb_io_gid("", &(r_u->gid[i]), ps, depth); + } + } + } + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +makes a SAMR_Q_QUERY_USERINFO structure. +********************************************************************/ +void make_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO *q_u, + POLICY_HND *hnd, uint16 switch_value) +{ + if (q_u == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_query_userinfo\n")); + + memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); + q_u->switch_value = switch_value; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_query_userinfo(char *desc, SAMR_Q_QUERY_USERINFO *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_query_userinfo"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); + prs_align(ps); + + prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); /* 0x0015 or 0x0011 */ + + prs_align(ps); +} + +/******************************************************************* +reads or writes a LOGON_HRS structure. +********************************************************************/ +void sam_io_logon_hrs(char *desc, LOGON_HRS *hrs, prs_struct *ps, int depth) +{ + if (hrs == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_logon_hrs"); + depth++; + + prs_align(ps); + + prs_uint32 ( "len ", ps, depth, &(hrs->len )); + + if (hrs->len > 64) + { + DEBUG(5,("sam_io_logon_hrs: truncating length\n")); + hrs->len = 64; + } + + prs_uint8s (False, "hours", ps, depth, hrs->hours, hrs->len); +} + +/******************************************************************* +makes a SAM_USER_INFO_11 structure. +********************************************************************/ +void make_sam_user_info11(SAM_USER_INFO_11 *usr, + NTTIME *expiry, + char *mach_acct, + uint32 rid_user, + uint32 rid_group, + uint16 acct_ctrl) + +{ + int len_mach_acct; + if (usr == NULL || expiry == NULL || mach_acct == NULL) return; + + DEBUG(5,("make_samr_r_unknown_24\n")); + + len_mach_acct = strlen(mach_acct); + + memcpy(&(usr->expiry),expiry, sizeof(usr->expiry)); /* expiry time or something? */ + bzero(usr->padding_1, sizeof(usr->padding_1)); /* 0 - padding 24 bytes */ + + make_uni_hdr(&(usr->hdr_mach_acct), len_mach_acct, len_mach_acct, 4); /* unicode header for machine account */ + usr->padding_2 = 0; /* 0 - padding 4 bytes */ + + usr->ptr_1 = 1; /* pointer */ + bzero(usr->padding_3, sizeof(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 */ + bzero(usr->padding_6, sizeof(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 */ + + bzero(usr->padding_7, sizeof(usr->padding_7)); /* 0 - padding 16 bytes */ + usr->padding_8 = 0; /* 0 - padding 4 bytes */ + + make_unistr2(&(usr->uni_mach_acct), mach_acct, len_mach_acct); /* unicode string for machine account */ + + bzero(usr->padding_9, sizeof(usr->padding_9)); /* 0 - padding 48 bytes */ +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int depth) +{ + if (usr == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_unknown_24"); + depth++; + + prs_align(ps); + + prs_uint8s (False, "padding_0", ps, depth, usr->padding_0, sizeof(usr->padding_0)); + + smb_io_time("time", &(usr->expiry), ps, depth); + + prs_uint8s (False, "padding_1", ps, depth, usr->padding_1, sizeof(usr->padding_1)); + + smb_io_unihdr ("unihdr", &(usr->hdr_mach_acct), ps, depth); + prs_uint32( "padding_2", ps, depth, &(usr->padding_2)); + + prs_uint32( "ptr_1 ", ps, depth, &(usr->ptr_1 )); + prs_uint8s (False, "padding_3", ps, depth, usr->padding_3, sizeof(usr->padding_3)); + prs_uint32( "padding_4", ps, depth, &(usr->padding_4)); + + prs_uint32( "ptr_2 ", ps, depth, &(usr->ptr_2 )); + prs_uint32( "padding_5", ps, depth, &(usr->padding_5)); + + prs_uint32( "ptr_3 ", ps, depth, &(usr->ptr_3 )); + prs_uint8s (False, "padding_6", ps, depth, usr->padding_6, sizeof(usr->padding_6)); + + prs_uint32( "rid_user ", ps, depth, &(usr->rid_user )); + prs_uint32( "rid_group", ps, depth, &(usr->rid_group)); + prs_uint16( "acct_ctrl", ps, depth, &(usr->acct_ctrl)); + prs_uint16( "unknown_3", ps, depth, &(usr->unknown_3)); + prs_uint16( "unknown_4", ps, depth, &(usr->unknown_4)); + prs_uint16( "unknown_5", ps, depth, &(usr->unknown_5)); + + prs_uint8s (False, "padding_7", ps, depth, usr->padding_7, sizeof(usr->padding_7)); + prs_uint32( "padding_8", ps, depth, &(usr->padding_8)); + + smb_io_unistr2("unistr2", &(usr->uni_mach_acct), True, ps, depth); + prs_align(ps); + + prs_uint8s (False, "padding_9", ps, depth, usr->padding_9, sizeof(usr->padding_9)); +} + +/************************************************************************* + make_sam_user_info21 + + unknown_3 = 0x00ff ffff + unknown_5 = 0x0002 0000 + unknown_6 = 0x0000 04ec + + *************************************************************************/ +void make_sam_user_info21(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, + + char *user_name, + char *full_name, + char *home_dir, + char *dir_drive, + char *logon_script, + char *profile_path, + char *description, + char *workstations, + char *unknown_str, + char *munged_dial, + + uint32 user_rid, + uint32 group_rid, + uint16 acb_info, + + uint32 unknown_3, + uint16 logon_divs, + LOGON_HRS *hrs, + uint32 unknown_5, + uint32 unknown_6) +{ + int len_user_name = user_name != NULL ? strlen(user_name ) : 0; + int len_full_name = full_name != NULL ? strlen(full_name ) : 0; + int len_home_dir = home_dir != NULL ? strlen(home_dir ) : 0; + int len_dir_drive = dir_drive != NULL ? strlen(dir_drive ) : 0; + int len_logon_script = logon_script != NULL ? strlen(logon_script) : 0; + int len_profile_path = profile_path != NULL ? strlen(profile_path) : 0; + int len_description = description != NULL ? strlen(description ) : 0; + int len_workstations = workstations != NULL ? strlen(workstations) : 0; + int len_unknown_str = unknown_str != NULL ? strlen(unknown_str ) : 0; + int len_munged_dial = munged_dial != NULL ? strlen(munged_dial ) : 0; + + 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; + + make_uni_hdr(&(usr->hdr_user_name ), len_user_name , len_user_name , len_user_name != 0); + make_uni_hdr(&(usr->hdr_full_name ), len_full_name , len_full_name , len_full_name != 0); + make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir , len_home_dir , len_home_dir != 0); + make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive , len_dir_drive , len_dir_drive != 0); + make_uni_hdr(&(usr->hdr_logon_script), len_logon_script, len_logon_script, len_logon_script != 0); + make_uni_hdr(&(usr->hdr_profile_path), len_profile_path, len_profile_path, len_profile_path != 0); + make_uni_hdr(&(usr->hdr_acct_desc ), len_description , len_description , len_description != 0); + make_uni_hdr(&(usr->hdr_workstations), len_workstations, len_workstations, len_workstations != 0); + make_uni_hdr(&(usr->hdr_unknown_str ), len_unknown_str , len_unknown_str , len_workstations != 0); + make_uni_hdr(&(usr->hdr_munged_dial ), len_munged_dial , len_munged_dial , len_workstations != 0); + + bzero(usr->nt_pwd, sizeof(usr->nt_pwd)); + bzero(usr->lm_pwd, sizeof(usr->lm_pwd)); + + usr->user_rid = user_rid; + usr->group_rid = group_rid; + usr->acb_info = acb_info; + usr->unknown_3 = unknown_3; /* 0x00ff ffff */ + + usr->logon_divs = logon_divs; /* should be 168 (hours/week) */ + usr->ptr_logon_hrs = hrs ? 1 : 0; + usr->unknown_5 = unknown_5; /* 0x0002 0000 */ + + bzero(usr->padding1, sizeof(usr->padding1)); + + make_unistr2(&(usr->uni_user_name ), user_name , len_user_name ); + make_unistr2(&(usr->uni_full_name ), full_name , len_full_name ); + make_unistr2(&(usr->uni_home_dir ), home_dir , len_home_dir ); + make_unistr2(&(usr->uni_dir_drive ), dir_drive , len_dir_drive ); + make_unistr2(&(usr->uni_logon_script), logon_script, len_logon_script); + make_unistr2(&(usr->uni_profile_path), profile_path, len_profile_path); + make_unistr2(&(usr->uni_acct_desc ), description , len_description ); + make_unistr2(&(usr->uni_workstations), workstations, len_workstations); + make_unistr2(&(usr->uni_unknown_str ), unknown_str , len_unknown_str ); + make_unistr2(&(usr->uni_munged_dial ), munged_dial , len_munged_dial ); + + usr->unknown_6 = unknown_6; /* 0x0000 04ec */ + usr->padding4 = 0; + + if (hrs) + { + memcpy(&(usr->logon_hrs), hrs, sizeof(usr->logon_hrs)); + } + else + { + memset(&(usr->logon_hrs), 0xff, sizeof(usr->logon_hrs)); + } +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *ps, int depth) +{ + if (usr == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_user_info"); + depth++; + + prs_align(ps); + + smb_io_time("logon_time ", &(usr->logon_time) , ps, depth); + smb_io_time("logoff_time ", &(usr->logoff_time) , ps, depth); + smb_io_time("kickoff_time ", &(usr->kickoff_time) , ps, depth); + smb_io_time("pass_last_set_time ", &(usr->pass_last_set_time) , ps, depth); + smb_io_time("pass_can_change_time ", &(usr->pass_can_change_time) , ps, depth); + smb_io_time("pass_must_change_time", &(usr->pass_must_change_time), ps, depth); + + smb_io_unihdr("hdr_user_name ", &(usr->hdr_user_name) , ps, depth); /* username unicode string header */ + smb_io_unihdr("hdr_full_name ", &(usr->hdr_full_name) , ps, depth); /* user's full name unicode string header */ + smb_io_unihdr("hdr_home_dir ", &(usr->hdr_home_dir) , ps, depth); /* home directory unicode string header */ + smb_io_unihdr("hdr_dir_drive ", &(usr->hdr_dir_drive) , ps, depth); /* home directory drive */ + smb_io_unihdr("hdr_logon_script", &(usr->hdr_logon_script), ps, depth); /* logon script unicode string header */ + smb_io_unihdr("hdr_profile_path", &(usr->hdr_profile_path), ps, depth); /* profile path unicode string header */ + smb_io_unihdr("hdr_acct_desc ", &(usr->hdr_acct_desc ) , ps, depth); /* account description */ + smb_io_unihdr("hdr_workstations", &(usr->hdr_workstations), ps, depth); /* workstations user can log on from */ + smb_io_unihdr("hdr_unknown_str ", &(usr->hdr_unknown_str ), ps, depth); /* unknown string */ + smb_io_unihdr("hdr_munged_dial ", &(usr->hdr_munged_dial ), ps, depth); /* workstations user can log on from */ + + prs_uint8s (False, "lm_pwd ", ps, depth, usr->lm_pwd , sizeof(usr->lm_pwd )); + prs_uint8s (False, "nt_pwd ", ps, depth, usr->nt_pwd , sizeof(usr->nt_pwd )); + + prs_uint32("user_rid ", ps, depth, &(usr->user_rid )); /* User ID */ + prs_uint32("group_rid ", ps, depth, &(usr->group_rid )); /* Group ID */ + prs_uint16("acb_info ", ps, depth, &(usr->acb_info )); /* Group ID */ + prs_align(ps); + + prs_uint32("unknown_3 ", ps, depth, &(usr->unknown_3 )); + prs_uint16("logon_divs ", ps, depth, &(usr->logon_divs )); /* logon divisions per week */ + prs_align(ps); + prs_uint32("ptr_logon_hrs ", ps, depth, &(usr->ptr_logon_hrs)); + prs_uint32("unknown_5 ", ps, depth, &(usr->unknown_5 )); + + prs_uint8s (False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1)); + + /* here begins pointed-to data */ + + smb_io_unistr2("uni_user_name ", &(usr->uni_user_name) , usr->hdr_user_name .buffer, ps, depth); /* username unicode string */ + smb_io_unistr2("uni_full_name ", &(usr->uni_full_name) , usr->hdr_full_name .buffer, ps, depth); /* user's full name unicode string */ + smb_io_unistr2("uni_home_dir ", &(usr->uni_home_dir) , usr->hdr_home_dir .buffer, ps, depth); /* home directory unicode string */ + smb_io_unistr2("uni_dir_drive ", &(usr->uni_dir_drive) , usr->hdr_dir_drive .buffer, ps, depth); /* home directory drive unicode string */ + smb_io_unistr2("uni_logon_script", &(usr->uni_logon_script), usr->hdr_logon_script.buffer, ps, depth); /* logon script unicode string */ + smb_io_unistr2("uni_profile_path", &(usr->uni_profile_path), usr->hdr_profile_path.buffer, ps, depth); /* profile path unicode string */ + smb_io_unistr2("uni_acct_desc ", &(usr->uni_acct_desc ), usr->hdr_acct_desc .buffer, ps, depth); /* user description unicode string */ + smb_io_unistr2("uni_workstations", &(usr->uni_workstations), usr->hdr_workstations.buffer, ps, depth); /* worksations user can log on from */ + smb_io_unistr2("uni_unknown_str ", &(usr->uni_unknown_str ), usr->hdr_unknown_str .buffer, ps, depth); /* unknown string */ + smb_io_unistr2("uni_munged_dial ", &(usr->uni_munged_dial ), usr->hdr_munged_dial .buffer, ps, depth); /* worksations user can log on from */ + + prs_uint32("unknown_6 ", ps, depth, &(usr->unknown_6 )); + prs_uint32("padding4 ", ps, depth, &(usr->padding4 )); + + if (usr->ptr_logon_hrs) + { + sam_io_logon_hrs("logon_hrs", &(usr->logon_hrs) , ps, depth); + } +} + + +/******************************************************************* +makes a SAMR_R_QUERY_USERINFO structure. +********************************************************************/ +void make_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO *r_u, + uint16 switch_value, void *info, uint32 status) + +{ + if (r_u == NULL || info == NULL) return; + + DEBUG(5,("make_samr_r_query_userinfo\n")); + + r_u->ptr = 0; + r_u->switch_value = 0; + + if (status == 0) + { + r_u->switch_value = switch_value; + + switch (switch_value) + { + case 0x10: + { + r_u->ptr = 1; + r_u->info.id10 = (SAM_USER_INFO_10*)info; + + break; + } + + case 0x11: + { + r_u->ptr = 1; + r_u->info.id11 = (SAM_USER_INFO_11*)info; + + break; + } + + case 21: + { + r_u->ptr = 1; + r_u->info.id21 = (SAM_USER_INFO_21*)info; + + break; + } + + default: + { + DEBUG(4,("make_samr_r_query_aliasinfo: unsupported switch level\n")); + break; + } + } + } + + r_u->status = status; /* return status */ +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_query_userinfo"); + depth++; + + prs_align(ps); + + prs_uint32("ptr ", ps, depth, &(r_u->ptr )); + prs_uint16("switch_value", ps, depth, &(r_u->switch_value)); + prs_align(ps); + + if (r_u->ptr != 0 && r_u->switch_value != 0) + { + switch (r_u->switch_value) + { +/* + case 0x10: + { + if (r_u->info.id10 != NULL) + { + sam_io_user_info10("", r_u->info.id10, ps, depth); + } + else + { + DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); + return NULL; + } + break; + } + case 0x11: + { + if (r_u->info.id11 != NULL) + { + sam_io_user_info11("", r_u->info.id11, ps, depth); + } + else + { + DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); + return NULL; + } + break; + } +*/ + case 21: + { + if (r_u->info.id21 != NULL) + { + sam_io_user_info21("", r_u->info.id21, ps, depth); + } + else + { + DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); + return; + } + break; + } + default: + { + DEBUG(2,("samr_io_r_query_userinfo: unknown switch level\n")); + break; + } + + } + } + + prs_uint32("status", ps, depth, &(r_u->status)); +} + + +/******************************************************************* +makes a SAMR_Q_UNKNOWN_21 structure. +********************************************************************/ +void make_samr_q_unknown_21(SAMR_Q_UNKNOWN_21 *q_c, + POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_unknown_21\n")); + + memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol)); + q_c->unknown_1 = unk_1; + q_c->unknown_2 = unk_2; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_unknown_21(char *desc, SAMR_Q_UNKNOWN_21 *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_unknown_21"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("group_pol", &(q_u->group_pol), ps, depth); + prs_align(ps); + + prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1)); + prs_uint16("unknown_2", ps, depth, &(q_u->unknown_2)); +} + +/******************************************************************* +makes a SAMR_Q_UNKNOWN_13 structure. +********************************************************************/ +void make_samr_q_unknown_13(SAMR_Q_UNKNOWN_13 *q_c, + POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_unknown_13\n")); + + memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol)); + q_c->unknown_1 = unk_1; + q_c->unknown_2 = unk_2; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_unknown_13(char *desc, SAMR_Q_UNKNOWN_13 *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_unknown_13"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); + prs_align(ps); + + prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1)); + prs_uint16("unknown_2", ps, depth, &(q_u->unknown_2)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_unknown_32(char *desc, SAMR_Q_UNKNOWN_32 *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_unknown_32"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); + prs_align(ps); + + smb_io_unihdr ("", &(q_u->hdr_mach_acct), ps, depth); + smb_io_unistr2("", &(q_u->uni_mach_acct), q_u->hdr_mach_acct.buffer, ps, depth); + + prs_align(ps); + + prs_uint32("acct_ctrl", ps, depth, &(q_u->acct_ctrl)); + prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1)); + prs_uint16("unknown_2", ps, depth, &(q_u->unknown_2)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_unknown_32(char *desc, SAMR_R_UNKNOWN_32 *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_unknown_32"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(r_u->pol), ps, depth); + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + + +/******************************************************************* +makes a SAMR_Q_CONNECT structure. +********************************************************************/ +void make_samr_q_connect(SAMR_Q_CONNECT *q_u, + char *srv_name, uint32 unknown_0) +{ + int len_srv_name = strlen(srv_name); + + if (q_u == NULL) return; + + DEBUG(5,("make_q_connect\n")); + + /* make PDC server name \\server */ + make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name); + + /* example values: 0x0000 0002 */ + q_u->unknown_0 = unknown_0; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_connect(char *desc, SAMR_Q_CONNECT *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_connect"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_srv_name", ps, depth, &(q_u->ptr_srv_name)); + smb_io_unistr2("", &(q_u->uni_srv_name), q_u->ptr_srv_name, ps, depth); + + prs_align(ps); + + prs_uint32("unknown_0 ", ps, depth, &(q_u->unknown_0 )); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_connect(char *desc, SAMR_R_CONNECT *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_connect"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("connect_pol", &(r_u->connect_pol), ps, depth); + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +makes a SAMR_Q_OPEN_ALIAS structure. +********************************************************************/ +void make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, + uint32 unknown_0, uint32 rid) +{ + if (q_u == NULL) return; + + DEBUG(5,("make_q_open_alias\n")); + + /* example values: 0x0000 0008 */ + q_u->unknown_0 = unknown_0; + + q_u->rid_alias = rid; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_open_alias"); + depth++; + + prs_align(ps); + + prs_uint32("unknown_0", ps, depth, &(q_u->unknown_0)); + prs_uint32("rid_alias", ps, depth, &(q_u->rid_alias)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_open_alias"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(r_u->pol), ps, depth); + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +makes a SAMR_Q_UNKNOWN_38 structure. +********************************************************************/ +void make_samr_q_unknown_38(SAMR_Q_UNKNOWN_38 *q_u, char *srv_name) +{ + int len_srv_name = strlen(srv_name); + + if (q_u == NULL) return; + + DEBUG(5,("make_q_unknown_38\n")); + + q_u->ptr = 1; + make_uni_hdr(&(q_u->hdr_srv_name), len_srv_name, len_srv_name, len_srv_name != 0); + make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name); + +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_unknown_38(char *desc, SAMR_Q_UNKNOWN_38 *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_unknown_38"); + depth++; + + prs_align(ps); + + prs_uint32("ptr", ps, depth, &(q_u->ptr)); + if (q_u->ptr != 0) + { + smb_io_unihdr ("", &(q_u->hdr_srv_name), ps, depth); + smb_io_unistr2("", &(q_u->uni_srv_name), q_u->hdr_srv_name.buffer, ps, depth); + } +} + +/******************************************************************* +makes a SAMR_R_UNKNOWN_38 structure. +********************************************************************/ +void make_samr_r_unknown_38(SAMR_R_UNKNOWN_38 *r_u, + uint16 level, uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_r_unknown_38\n")); + + r_u->level.value = level; + r_u->ptr_0 = 0; + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_unknown_38(char *desc, SAMR_R_UNKNOWN_38 *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_unknown_38"); + depth++; + + prs_align(ps); + + smb_io_lookup_level("level ", &(r_u->level), ps, depth); + prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0 )); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +reads or writes a SAMR_ENC_PASSWD structure. +********************************************************************/ +void samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD *pwd, prs_struct *ps, int depth) +{ + if (pwd == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_enc_passwd"); + depth++; + + prs_align(ps); + + prs_uint32("ptr", ps, depth, &(pwd->ptr)); + prs_uint8s(False, "pwd", ps, depth, pwd->pass, sizeof(pwd->pass)); +} + +/******************************************************************* +reads or writes a SAMR_ENC_HASH structure. +********************************************************************/ +void samr_io_enc_hash(char *desc, SAMR_ENC_HASH *hsh, prs_struct *ps, int depth) +{ + if (hsh == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_enc_hash"); + depth++; + + prs_align(ps); + + prs_uint32("ptr ", ps, depth, &(hsh->ptr)); + prs_uint8s(False, "hash", ps, depth, hsh->hash, sizeof(hsh->hash)); +} + +#if 0 +/* SAMR_Q_CHGPASSWD_USER */ +typedef struct q_samr_chgpasswd_user_info +{ + uint32 ptr_0; + + UNIHDR hdr_server; /* server name unicode header */ + UNISTR2 uni_server; /* server name unicode string */ + + UNIHDR hdr_user_name; /* username unicode string header */ + UNISTR2 uni_user_name; /* username unicode string */ + + SAMR_ENC_PASSWD nt_newpass; + SAMR_ENC_HASH nt_oldhash; + + uint32 unknown_1; /* seems to always contain 0001 */ + + SAMR_ENC_PASSWD lm_newpass; + SAMR_ENC_HASH lm_oldhash; + +} SAMR_Q_CHGPASSWD_USER; + +/* SAMR_R_CHGPASSWD_USER */ +typedef struct r_samr_chgpasswd_user_info +{ + uint32 result; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */ + +} SAMR_R_CHGPASSWD_USER; + +#endif /* 0 */ + diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c new file mode 100644 index 0000000000..959a6096aa --- /dev/null +++ b/source3/rpc_parse/parse_srv.c @@ -0,0 +1,1528 @@ + +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include "includes.h" + +extern int DEBUGLEVEL; + + +/******************************************************************* + makes a SH_INFO_1_STR structure +********************************************************************/ +void make_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark) +{ + if (sh1 == NULL) return; + + DEBUG(5,("make_srv_share_info1_str\n")); + + make_unistr2(&(sh1->uni_netname), net_name, strlen(net_name)+1); + make_unistr2(&(sh1->uni_remark ), remark , strlen(remark )+1); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth) +{ + if (sh1 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_share_info1_str"); + depth++; + + prs_align(ps); + + smb_io_unistr2("", &(sh1->uni_netname), True, ps, depth); + smb_io_unistr2("", &(sh1->uni_remark ), True, ps, depth); +} + +/******************************************************************* + makes a SH_INFO_1 structure +********************************************************************/ +void make_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark) +{ + if (sh1 == NULL) return; + + DEBUG(5,("make_srv_share_info1: %s %8x %s\n", net_name, type, remark)); + + sh1->ptr_netname = net_name != NULL ? 1 : 0; + sh1->type = type; + sh1->ptr_remark = remark != NULL ? 1 : 0; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) +{ + if (sh1 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_share_info1"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_netname", ps, depth, &(sh1->ptr_netname)); + prs_uint32("type ", ps, depth, &(sh1->type )); + prs_uint32("ptr_remark ", ps, depth, &(sh1->ptr_remark)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_srv_share_info_1(char *desc, SRV_SHARE_INFO_1 *ctr, prs_struct *ps, int depth) +{ + if (ctr == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_share_1_ctr"); + depth++; + + prs_align(ps); + + prs_uint32("num_entries_read", ps, depth, &(ctr->num_entries_read)); + prs_uint32("ptr_share_info", ps, depth, &(ctr->ptr_share_info)); + + if (ctr->ptr_share_info != 0) + { + int i; + int num_entries = ctr->num_entries_read; + if (num_entries > MAX_SHARE_ENTRIES) + { + num_entries = MAX_SHARE_ENTRIES; /* report this! */ + } + + prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2)); + + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + srv_io_share_info1("", &(ctr->info_1[i]), ps, depth); + } + + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + srv_io_share_info1_str("", &(ctr->info_1_str[i]), ps, depth); + } + + prs_align(ps); + } +} + +/******************************************************************* + makes a SH_INFO_2_STR structure +********************************************************************/ +void make_srv_share_info2_str(SH_INFO_2_STR *sh2, + char *net_name, char *remark, + char *path, char *passwd) +{ + if (sh2 == NULL) return; + + DEBUG(5,("make_srv_share_info2_str\n")); + + make_unistr2(&(sh2->uni_netname), net_name, strlen(net_name)+1); + make_unistr2(&(sh2->uni_remark ), remark , strlen(remark )+1); + make_unistr2(&(sh2->uni_path ), path , strlen(path )+1); + make_unistr2(&(sh2->uni_passwd ), passwd , strlen(passwd )+1); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_share_info2_str(char *desc, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) +{ + if (sh2 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_share_info2_str"); + depth++; + + prs_align(ps); + + smb_io_unistr2("", &(sh2->uni_netname), True, ps, depth); + smb_io_unistr2("", &(sh2->uni_remark ), True, ps, depth); + smb_io_unistr2("", &(sh2->uni_path ), True, ps, depth); + smb_io_unistr2("", &(sh2->uni_passwd ), True, ps, depth); +} + +/******************************************************************* + makes a SH_INFO_2 structure +********************************************************************/ +void make_srv_share_info2(SH_INFO_2 *sh2, + char *net_name, uint32 type, char *remark, + uint32 perms, uint32 max_uses, uint32 num_uses, + char *path, char *passwd) +{ + if (sh2 == NULL) return; + + DEBUG(5,("make_srv_share_info2: %s %8x %s\n", net_name, type, remark)); + + sh2->ptr_netname = net_name != NULL ? 1 : 0; + sh2->type = type; + sh2->ptr_remark = remark != NULL ? 1 : 0; + sh2->perms = perms; + sh2->max_uses = max_uses; + sh2->num_uses = num_uses; + sh2->type = type; + sh2->ptr_path = path != NULL ? 1 : 0; + sh2->ptr_passwd = passwd != NULL ? 1 : 0; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) +{ + if (sh2 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_share_info2"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_netname", ps, depth, &(sh2->ptr_netname)); + prs_uint32("type ", ps, depth, &(sh2->type )); + prs_uint32("ptr_remark ", ps, depth, &(sh2->ptr_remark )); + prs_uint32("perms ", ps, depth, &(sh2->perms )); + prs_uint32("max_uses ", ps, depth, &(sh2->max_uses )); + prs_uint32("num_uses ", ps, depth, &(sh2->num_uses )); + prs_uint32("ptr_path ", ps, depth, &(sh2->ptr_path )); + prs_uint32("ptr_passwd ", ps, depth, &(sh2->ptr_passwd )); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_struct *ps, int depth) +{ + if (ctr == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_share_2_ctr"); + depth++; + + prs_align(ps); + + prs_uint32("num_entries_read", ps, depth, &(ctr->num_entries_read)); + prs_uint32("ptr_share_info", ps, depth, &(ctr->ptr_share_info)); + + if (ctr->ptr_share_info != 0) + { + int i; + int num_entries = ctr->num_entries_read; + if (num_entries > MAX_SHARE_ENTRIES) + { + num_entries = MAX_SHARE_ENTRIES; /* report this! */ + } + + prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2)); + + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + srv_io_share_info2("", &(ctr->info_2[i]), ps, depth); + } + + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + srv_io_share_info2_str("", &(ctr->info_2_str[i]), ps, depth); + } + + prs_align(ps); + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth) +{ + if (ctr == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_srv_share_ctr"); + depth++; + + prs_align(ps); + + prs_uint32("switch_value", ps, depth, &(ctr->switch_value)); + prs_uint32("ptr_share_ctr", ps, depth, &(ctr->ptr_share_ctr)); + + if (ctr->ptr_share_ctr != 0) + { + switch (ctr->switch_value) + { + case 2: + { + srv_io_srv_share_info_2("", &(ctr->share.info2), ps, depth); + break; + } + case 1: + { + srv_io_srv_share_info_1("", &(ctr->share.info1), ps, depth); + break; + } + default: + { + DEBUG(5,("%s no share info at switch_value %d\n", + tab_depth(depth), ctr->switch_value)); + break; + } + } + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, + char *srv_name, + uint32 share_level, SRV_SHARE_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd) +{ + if (q_n == NULL || ctr == NULL || hnd == NULL) return; + + q_n->ctr = ctr; + + DEBUG(5,("make_q_net_share_enum\n")); + + make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name); + + q_n->share_level = share_level; + q_n->preferred_len = preferred_len; + + memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_q_net_share_enum"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name)); + smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); + + prs_align(ps); + + prs_uint32("share_level", ps, depth, &(q_n->share_level )); + + if (q_n->share_level != -1) + { + srv_io_srv_share_ctr("share_ctr", q_n->ctr, ps, depth); + } + + prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len)); + + smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_r_net_share_enum"); + depth++; + + prs_align(ps); + + prs_uint32("share_level", ps, depth, &(r_n->share_level)); + + if (r_n->share_level != 0) + { + srv_io_srv_share_ctr("share_ctr", r_n->ctr, ps, depth); + } + + prs_uint32("total_entries", ps, depth, &(r_n->total_entries)); + smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); + prs_uint32("status ", ps, depth, &(r_n->status)); +} + +/******************************************************************* + makes a SESS_INFO_0_STR structure +********************************************************************/ +void make_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name) +{ + if (ss0 == NULL) return; + + DEBUG(5,("make_srv_sess_info0_str\n")); + + make_unistr2(&(ss0->uni_name), name, strlen(name)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth) +{ + if (ss0 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_sess_info0_str"); + depth++; + + prs_align(ps); + + smb_io_unistr2("", &(ss0->uni_name), True, ps, depth); +} + +/******************************************************************* + makes a SESS_INFO_0 structure +********************************************************************/ +void make_srv_sess_info0(SESS_INFO_0 *ss0, char *name) +{ + if (ss0 == NULL) return; + + DEBUG(5,("make_srv_sess_info0: %s\n", name)); + + ss0->ptr_name = name != NULL ? 1 : 0; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth) +{ + if (ss0 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_sess_info0"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_name", ps, depth, &(ss0->ptr_name)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth) +{ + if (ss0 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0"); + depth++; + + prs_align(ps); + + prs_uint32("num_entries_read", ps, depth, &(ss0->num_entries_read)); + prs_uint32("ptr_sess_info", ps, depth, &(ss0->ptr_sess_info)); + + if (ss0->ptr_sess_info != 0) + { + int i; + int num_entries = ss0->num_entries_read; + if (num_entries > MAX_SESS_ENTRIES) + { + num_entries = MAX_SESS_ENTRIES; /* report this! */ + } + + prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2)); + + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + srv_io_sess_info0("", &(ss0->info_0[i]), ps, depth); + } + + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + srv_io_sess_info0_str("", &(ss0->info_0_str[i]), ps, depth); + } + + prs_align(ps); + } +} + +/******************************************************************* + makes a SESS_INFO_1_STR structure +********************************************************************/ +void make_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user) +{ + if (ss1 == NULL) return; + + DEBUG(5,("make_srv_sess_info1_str\n")); + + make_unistr2(&(ss1->uni_name), name, strlen(name)); + make_unistr2(&(ss1->uni_user), name, strlen(user)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth) +{ + if (ss1 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_sess_info1_str"); + depth++; + + prs_align(ps); + + smb_io_unistr2("", &(ss1->uni_name), True, ps, depth); + smb_io_unistr2("", &(ss1->uni_user), True, ps, depth); +} + +/******************************************************************* + makes a SESS_INFO_1 structure +********************************************************************/ +void make_srv_sess_info1(SESS_INFO_1 *ss1, + char *name, char *user, + uint32 num_opens, uint32 open_time, uint32 idle_time, + uint32 user_flags) +{ + if (ss1 == NULL) return; + + DEBUG(5,("make_srv_sess_info1: %s\n", name)); + + ss1->ptr_name = name != NULL ? 1 : 0; + ss1->ptr_user = user != NULL ? 1 : 0; + + ss1->num_opens = num_opens; + ss1->open_time = open_time; + ss1->idle_time = idle_time; + ss1->user_flags = user_flags; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth) +{ + if (ss1 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_sess_info1"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_name ", ps, depth, &(ss1->ptr_name )); + prs_uint32("ptr_user ", ps, depth, &(ss1->ptr_user )); + + prs_uint32("num_opens ", ps, depth, &(ss1->num_opens )); + prs_uint32("open_time ", ps, depth, &(ss1->open_time )); + prs_uint32("idle_time ", ps, depth, &(ss1->idle_time )); + prs_uint32("user_flags", ps, depth, &(ss1->user_flags)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth) +{ + if (ss1 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1"); + depth++; + + prs_align(ps); + + prs_uint32("num_entries_read", ps, depth, &(ss1->num_entries_read)); + prs_uint32("ptr_sess_info", ps, depth, &(ss1->ptr_sess_info)); + + if (ss1->ptr_sess_info != 0) + { + int i; + int num_entries = ss1->num_entries_read; + if (num_entries > MAX_SESS_ENTRIES) + { + num_entries = MAX_SESS_ENTRIES; /* report this! */ + } + + prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2)); + + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + srv_io_sess_info1("", &(ss1->info_1[i]), ps, depth); + } + + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + srv_io_sess_info1_str("", &(ss1->info_1_str[i]), ps, depth); + } + + prs_align(ps); + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct *ps, int depth) +{ + if (ctr == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr"); + depth++; + + prs_align(ps); + + prs_uint32("switch_value", ps, depth, &(ctr->switch_value)); + prs_uint32("ptr_sess_ctr", ps, depth, &(ctr->ptr_sess_ctr)); + + if (ctr->ptr_sess_ctr != 0) + { + switch (ctr->switch_value) + { + case 0: + { + srv_io_srv_sess_info_0("", &(ctr->sess.info0), ps, depth); + break; + } + case 1: + { + srv_io_srv_sess_info_1("", &(ctr->sess.info1), ps, depth); + break; + } + default: + { + DEBUG(5,("%s no session info at switch_value %d\n", + tab_depth(depth), ctr->switch_value)); + break; + } + } + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, + char *srv_name, char *qual_name, + uint32 sess_level, SRV_SESS_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd) +{ + if (q_n == NULL || ctr == NULL || hnd == NULL) return; + + q_n->ctr = ctr; + + DEBUG(5,("make_q_net_sess_enum\n")); + + make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name); + make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name); + + q_n->sess_level = sess_level; + q_n->preferred_len = preferred_len; + + memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name)); + smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); + + prs_align(ps); + + prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name)); + smb_io_unistr2("", &(q_n->uni_qual_name), True, ps, depth); + + prs_align(ps); + + prs_uint32("sess_level", ps, depth, &(q_n->sess_level )); + + if (q_n->sess_level != -1) + { + srv_io_srv_sess_ctr("sess_ctr", q_n->ctr, ps, depth); + } + + prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len)); + + smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum"); + depth++; + + prs_align(ps); + + prs_uint32("sess_level", ps, depth, &(r_n->sess_level)); + + if (r_n->sess_level != -1) + { + srv_io_srv_sess_ctr("sess_ctr", r_n->ctr, ps, depth); + } + + prs_uint32("total_entries", ps, depth, &(r_n->total_entries)); + smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); + prs_uint32("status ", ps, depth, &(r_n->status)); +} + +/******************************************************************* + makes a CONN_INFO_0 structure +********************************************************************/ +void make_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id) +{ + if (ss0 == NULL) return; + + DEBUG(5,("make_srv_conn_info0\n")); + + ss0->id = id; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth) +{ + if (ss0 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_conn_info0"); + depth++; + + prs_align(ps); + + prs_uint32("id", ps, depth, &(ss0->id)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth) +{ + if (ss0 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0"); + depth++; + + prs_align(ps); + + prs_uint32("num_entries_read", ps, depth, &(ss0->num_entries_read)); + prs_uint32("ptr_conn_info", ps, depth, &(ss0->ptr_conn_info)); + + if (ss0->ptr_conn_info != 0) + { + int i; + int num_entries = ss0->num_entries_read; + if (num_entries > MAX_CONN_ENTRIES) + { + num_entries = MAX_CONN_ENTRIES; /* report this! */ + } + + prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2)); + + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + srv_io_conn_info0("", &(ss0->info_0[i]), ps, depth); + } + + prs_align(ps); + } +} + +/******************************************************************* + makes a CONN_INFO_1_STR structure +********************************************************************/ +void make_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name) +{ + if (ss1 == NULL) return; + + DEBUG(5,("make_srv_conn_info1_str\n")); + + make_unistr2(&(ss1->uni_usr_name), usr_name, strlen(usr_name)); + make_unistr2(&(ss1->uni_net_name), net_name, strlen(net_name)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth) +{ + if (ss1 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_conn_info1_str"); + depth++; + + prs_align(ps); + + smb_io_unistr2("", &(ss1->uni_usr_name), True, ps, depth); + smb_io_unistr2("", &(ss1->uni_net_name), True, ps, depth); +} + +/******************************************************************* + makes a CONN_INFO_1 structure +********************************************************************/ +void make_srv_conn_info1(CONN_INFO_1 *ss1, + uint32 id, uint32 type, + uint32 num_opens, uint32 num_users, uint32 open_time, + char *usr_name, char *net_name) +{ + if (ss1 == NULL) return; + + DEBUG(5,("make_srv_conn_info1: %s %s\n", usr_name, net_name)); + + ss1->id = id ; + ss1->type = type ; + ss1->num_opens = num_opens ; + ss1->num_users = num_users; + ss1->open_time = open_time; + + ss1->ptr_usr_name = usr_name != NULL ? 1 : 0; + ss1->ptr_net_name = net_name != NULL ? 1 : 0; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth) +{ + if (ss1 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_conn_info1"); + depth++; + + prs_align(ps); + + prs_uint32("id ", ps, depth, &(ss1->id )); + prs_uint32("type ", ps, depth, &(ss1->type )); + prs_uint32("num_opens ", ps, depth, &(ss1->num_opens )); + prs_uint32("num_users ", ps, depth, &(ss1->num_users )); + prs_uint32("open_time ", ps, depth, &(ss1->open_time )); + + prs_uint32("ptr_usr_name", ps, depth, &(ss1->ptr_usr_name)); + prs_uint32("ptr_net_name", ps, depth, &(ss1->ptr_net_name)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth) +{ + if (ss1 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1"); + depth++; + + prs_align(ps); + + prs_uint32("num_entries_read", ps, depth, &(ss1->num_entries_read)); + prs_uint32("ptr_conn_info", ps, depth, &(ss1->ptr_conn_info)); + + if (ss1->ptr_conn_info != 0) + { + int i; + int num_entries = ss1->num_entries_read; + if (num_entries > MAX_CONN_ENTRIES) + { + num_entries = MAX_CONN_ENTRIES; /* report this! */ + } + + prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2)); + + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + srv_io_conn_info1("", &(ss1->info_1[i]), ps, depth); + } + + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + srv_io_conn_info1_str("", &(ss1->info_1_str[i]), ps, depth); + } + + prs_align(ps); + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct *ps, int depth) +{ + if (ctr == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr"); + depth++; + + prs_align(ps); + + prs_uint32("switch_value", ps, depth, &(ctr->switch_value)); + prs_uint32("ptr_conn_ctr", ps, depth, &(ctr->ptr_conn_ctr)); + + if (ctr->ptr_conn_ctr != 0) + { + switch (ctr->switch_value) + { + case 0: + { + srv_io_srv_conn_info_0("", &(ctr->conn.info0), ps, depth); + break; + } + case 1: + { + srv_io_srv_conn_info_1("", &(ctr->conn.info1), ps, depth); + break; + } + default: + { + DEBUG(5,("%s no connection info at switch_value %d\n", + tab_depth(depth), ctr->switch_value)); + break; + } + } + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, + char *srv_name, char *qual_name, + uint32 conn_level, SRV_CONN_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd) +{ + if (q_n == NULL || ctr == NULL || hnd == NULL) return; + + q_n->ctr = ctr; + + DEBUG(5,("make_q_net_conn_enum\n")); + + make_buf_unistr2(&(q_n->uni_srv_name ), &(q_n->ptr_srv_name ), srv_name ); + make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name); + + q_n->conn_level = conn_level; + q_n->preferred_len = preferred_len; + + memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name)); + smb_io_unistr2("", &(q_n->uni_srv_name), q_n->ptr_srv_name, ps, depth); + + prs_align(ps); + + prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name)); + smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth); + + prs_align(ps); + + prs_uint32("conn_level", ps, depth, &(q_n->conn_level )); + + if (q_n->conn_level != -1) + { + srv_io_srv_conn_ctr("conn_ctr", q_n->ctr, ps, depth); + } + + prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len)); + + smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum"); + depth++; + + prs_align(ps); + + prs_uint32("conn_level", ps, depth, &(r_n->conn_level)); + + if (r_n->conn_level != -1) + { + srv_io_srv_conn_ctr("conn_ctr", r_n->ctr, ps, depth); + } + + prs_uint32("total_entries", ps, depth, &(r_n->total_entries)); + smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); + prs_uint32("status ", ps, depth, &(r_n->status)); +} + +/******************************************************************* + makes a FILE_INFO_3_STR structure +********************************************************************/ +void make_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name) +{ + if (fi3 == NULL) return; + + DEBUG(5,("make_srv_file_info3_str\n")); + + make_unistr2(&(fi3->uni_path_name), path_name, strlen(path_name)+1); + make_unistr2(&(fi3->uni_user_name), user_name, strlen(user_name)+1); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth) +{ + if (sh1 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_file_info3_str"); + depth++; + + prs_align(ps); + + smb_io_unistr2("", &(sh1->uni_path_name), True, ps, depth); + smb_io_unistr2("", &(sh1->uni_user_name), True, ps, depth); +} + +/******************************************************************* + makes a FILE_INFO_3 structure +********************************************************************/ +void make_srv_file_info3(FILE_INFO_3 *fl3, + uint32 id, uint32 perms, uint32 num_locks, + char *path_name, char *user_name) +{ + if (fl3 == NULL) return; + + DEBUG(5,("make_srv_file_info3: %s %s\n", path_name, user_name)); + + fl3->id = id; + fl3->perms = perms; + fl3->num_locks = num_locks; + + fl3->ptr_path_name = path_name != NULL ? 1 : 0; + fl3->ptr_user_name = user_name != NULL ? 1 : 0; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) +{ + if (fl3 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_file_info3"); + depth++; + + prs_align(ps); + + prs_uint32("id ", ps, depth, &(fl3->id )); + prs_uint32("perms ", ps, depth, &(fl3->perms )); + prs_uint32("num_locks ", ps, depth, &(fl3->num_locks )); + prs_uint32("ptr_path_name", ps, depth, &(fl3->ptr_path_name)); + prs_uint32("ptr_user_name", ps, depth, &(fl3->ptr_user_name)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth) +{ + if (fl3 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_file_3_fl3"); + depth++; + + prs_align(ps); + + prs_uint32("num_entries_read", ps, depth, &(fl3->num_entries_read)); + prs_uint32("ptr_file_fl3", ps, depth, &(fl3->ptr_file_info)); + if (fl3->ptr_file_info != 0) + { + int i; + int num_entries = fl3->num_entries_read; + if (num_entries > MAX_FILE_ENTRIES) + { + num_entries = MAX_FILE_ENTRIES; /* report this! */ + } + + prs_uint32("num_entries_read2", ps, depth, &(fl3->num_entries_read2)); + + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + srv_io_file_info3("", &(fl3->info_3[i]), ps, depth); + } + + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + srv_io_file_info3_str("", &(fl3->info_3_str[i]), ps, depth); + } + + prs_align(ps); + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) +{ + if (ctr == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_srv_file_ctr"); + depth++; + + prs_align(ps); + + prs_uint32("switch_value", ps, depth, &(ctr->switch_value)); + prs_uint32("ptr_file_ctr", ps, depth, &(ctr->ptr_file_ctr)); + + if (ctr->ptr_file_ctr != 0) + { + switch (ctr->switch_value) + { + case 3: + { + srv_io_srv_file_info_3("", &(ctr->file.info3), ps, depth); + break; + } + default: + { + DEBUG(5,("%s no file info at switch_value %d\n", + tab_depth(depth), ctr->switch_value)); + break; + } + } + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, + char *srv_name, char *qual_name, + uint32 file_level, SRV_FILE_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd) +{ + if (q_n == NULL || ctr == NULL || hnd == NULL) return; + + q_n->ctr = ctr; + + DEBUG(5,("make_q_net_file_enum\n")); + + make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name); + make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name); + + q_n->file_level = file_level; + q_n->preferred_len = preferred_len; + + memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_q_net_file_enum"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name)); + smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); + + prs_align(ps); + + prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name)); + smb_io_unistr2("", &(q_n->uni_qual_name), True, ps, depth); + + prs_align(ps); + + prs_uint32("file_level", ps, depth, &(q_n->file_level )); + + if (q_n->file_level != -1) + { + srv_io_srv_file_ctr("file_ctr", q_n->ctr, ps, depth); + } + + prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len)); + + smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_r_net_file_enum"); + depth++; + + prs_align(ps); + + prs_uint32("file_level", ps, depth, &(r_n->file_level)); + + if (r_n->file_level != 0) + { + srv_io_srv_file_ctr("file_ctr", r_n->ctr, ps, depth); + } + + prs_uint32("total_entries", ps, depth, &(r_n->total_entries)); + smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); + prs_uint32("status ", ps, depth, &(r_n->status)); +} + +/******************************************************************* + makes a SRV_INFO_101 structure. + ********************************************************************/ +void make_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name, + uint32 ver_major, uint32 ver_minor, + uint32 srv_type, char *comment) +{ + if (sv101 == NULL) return; + + DEBUG(5,("make_srv_info_101\n")); + + sv101->platform_id = platform_id; + make_buf_unistr2(&(sv101->uni_name ), &(sv101->ptr_name ) , name ); + sv101->ver_major = ver_major; + sv101->ver_minor = ver_minor; + sv101->srv_type = srv_type; + make_buf_unistr2(&(sv101->uni_comment ), &(sv101->ptr_comment) , comment ); +} + + +/******************************************************************* + reads or writes a SRV_INFO_101 structure. + ********************************************************************/ +void srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth) +{ + if (sv101 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_info_101"); + depth++; + + prs_align(ps); + + prs_uint32("platform_id ", ps, depth, &(sv101->platform_id )); + prs_uint32("ptr_name ", ps, depth, &(sv101->ptr_name )); + prs_uint32("ver_major ", ps, depth, &(sv101->ver_major )); + prs_uint32("ver_minor ", ps, depth, &(sv101->ver_minor )); + prs_uint32("srv_type ", ps, depth, &(sv101->srv_type )); + prs_uint32("ptr_comment ", ps, depth, &(sv101->ptr_comment )); + + prs_align(ps); + + smb_io_unistr2("uni_name ", &(sv101->uni_name ), True, ps, depth); + smb_io_unistr2("uni_comment ", &(sv101->uni_comment ), True, ps, depth); +} + +/******************************************************************* + makes a SRV_INFO_102 structure. + ********************************************************************/ +void make_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name, + char *comment, uint32 ver_major, uint32 ver_minor, + uint32 srv_type, uint32 users, uint32 disc, uint32 hidden, + uint32 announce, uint32 ann_delta, uint32 licenses, + char *usr_path) +{ + if (sv102 == NULL) return; + + DEBUG(5,("make_srv_info_102\n")); + + sv102->platform_id = platform_id; + make_buf_unistr2(&(sv102->uni_name ), &(sv102->ptr_name ), name ); + sv102->ver_major = ver_major; + sv102->ver_minor = ver_minor; + sv102->srv_type = srv_type; + make_buf_unistr2(&(sv102->uni_comment ), &(sv102->ptr_comment ), comment ); + + /* same as 101 up to here */ + + sv102->users = users; + sv102->disc = disc; + sv102->hidden = hidden; + sv102->announce = announce; + sv102->ann_delta =ann_delta; + sv102->licenses = licenses; + make_buf_unistr2(&(sv102->uni_usr_path), &(sv102->ptr_usr_path), usr_path); +} + + +/******************************************************************* + reads or writes a SRV_INFO_102 structure. + ********************************************************************/ +void srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth) +{ + if (sv102 == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_info102"); + depth++; + + prs_align(ps); + + prs_uint32("platform_id ", ps, depth, &(sv102->platform_id )); + prs_uint32("ptr_name ", ps, depth, &(sv102->ptr_name )); + prs_uint32("ver_major ", ps, depth, &(sv102->ver_major )); + prs_uint32("ver_minor ", ps, depth, &(sv102->ver_minor )); + prs_uint32("srv_type ", ps, depth, &(sv102->srv_type )); + prs_uint32("ptr_comment ", ps, depth, &(sv102->ptr_comment )); + + /* same as 101 up to here */ + + prs_uint32("users ", ps, depth, &(sv102->users )); + prs_uint32("disc ", ps, depth, &(sv102->disc )); + prs_uint32("hidden ", ps, depth, &(sv102->hidden )); + prs_uint32("announce ", ps, depth, &(sv102->announce )); + prs_uint32("ann_delta ", ps, depth, &(sv102->ann_delta )); + prs_uint32("licenses ", ps, depth, &(sv102->licenses )); + prs_uint32("ptr_usr_path", ps, depth, &(sv102->ptr_usr_path)); + + smb_io_unistr2("uni_name ", &(sv102->uni_name ), True, ps, depth); + prs_align(ps); + smb_io_unistr2("uni_comment ", &(sv102->uni_comment ), True, ps, depth); + prs_align(ps); + smb_io_unistr2("uni_usr_path", &(sv102->uni_usr_path), True, ps, depth); +} + +/******************************************************************* + reads or writes a SRV_INFO_102 structure. + ********************************************************************/ +void srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) +{ + if (ctr == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_info_ctr"); + depth++; + + prs_align(ps); + + prs_uint32("switch_value", ps, depth, &(ctr->switch_value)); + prs_uint32("ptr_srv_ctr ", ps, depth, &(ctr->ptr_srv_ctr )); + + if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL) + { + switch (ctr->switch_value) + { + case 101: + { + srv_io_info_101("sv101", &(ctr->srv.sv101), ps, depth); + break; + } + case 102: + { + srv_io_info_102("sv102", &(ctr->srv.sv102), ps, depth); + break; + } + default: + { + DEBUG(5,("%s% no server info at switch_value %d\n", + tab_depth(depth), ctr->switch_value)); + break; + } + } + } +} + +/******************************************************************* + makes a SRV_Q_NET_SRV_GET_INFO structure. + ********************************************************************/ +void make_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv, + char *server_name, uint32 switch_value) +{ + if (srv == NULL) return; + + DEBUG(5,("make_srv_q_net_srv_get_info\n")); + + make_buf_unistr2(&(srv->uni_srv_name), &(srv->ptr_srv_name), server_name); + + srv->switch_value = switch_value; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name)); + smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); + + prs_align(ps); + + prs_uint32("switch_value ", ps, depth, &(q_n->switch_value)); +} + +/******************************************************************* + makes a SRV_R_NET_SRV_GET_INFO structure. + ********************************************************************/ +void make_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv, + uint32 switch_value, SRV_INFO_CTR *ctr, uint32 status) +{ + if (srv == NULL) return; + + DEBUG(5,("make_srv_r_net_srv_get_info\n")); + + srv->ctr = ctr; + + if (status == 0x0) + { + srv->ctr->switch_value = switch_value; + srv->ctr->ptr_srv_ctr = 1; + } + else + { + srv->ctr->switch_value = 0; + srv->ctr->ptr_srv_ctr = 0; + } + + srv->status = status; +} + +/******************************************************************* + reads or writes a structure. + ********************************************************************/ +void srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info"); + depth++; + + prs_align(ps); + + srv_io_info_ctr("ctr", r_n->ctr, ps, depth); + + prs_uint32("status ", ps, depth, &(r_n->status )); +} + + +/******************************************************************* + makes a SRV_Q_NET_SRV_SET_INFO structure. + ********************************************************************/ +void make_srv_q_net_srv_set_info(SRV_Q_NET_SRV_SET_INFO *srv, + uint32 switch_value, SRV_INFO_CTR *ctr) +{ + if (srv == NULL) return; + + DEBUG(5,("make_srv_r_net_srv_set_info\n")); + + srv->ctr = ctr; + + srv->ctr->switch_value = switch_value; + srv->ctr->ptr_srv_ctr = 1; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void srv_io_q_net_srv_set_info(char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name)); + smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); + + prs_align(ps); + + srv_io_info_ctr("ctr", q_n->ctr, ps, depth); +} + +/******************************************************************* + makes a SRV_R_NET_SRV_SET_INFO structure. + ********************************************************************/ +void make_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv, + uint32 switch_value, SRV_INFO_CTR *ctr, uint32 status) +{ + if (srv == NULL) return; + + DEBUG(5,("make_srv_r_net_srv_set_info\n")); + + if (status == 0x0) + { + srv->switch_value = switch_value; + } + else + { + srv->switch_value = 0; + } + + srv->status = status; +} + +/******************************************************************* + reads or writes a structure. + ********************************************************************/ +void srv_io_r_net_srv_set_info(char *desc, SRV_R_NET_SRV_SET_INFO *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info"); + depth++; + + prs_align(ps); + + prs_uint32("switch_value", ps, depth, &(r_n->switch_value)); + prs_uint32("status ", ps, depth, &(r_n->status )); +} + + diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c new file mode 100644 index 0000000000..694acb5eec --- /dev/null +++ b/source3/rpc_parse/parse_wks.c @@ -0,0 +1,146 @@ + +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include "includes.h" + +extern int DEBUGLEVEL; + + +/******************************************************************* + make_wks_q_query_info + ********************************************************************/ +void make_wks_q_query_info(WKS_Q_QUERY_INFO *q_u, + char *server, uint16 switch_value) +{ + DEBUG(5,("make_wks_q_query_info: %d\n", __LINE__)); + + make_buf_unistr2(&(q_u->uni_srv_name), &(q_u->ptr_srv_name), server); + q_u->switch_value = switch_value; + +} + +/******************************************************************* +reads or writes a WKS_Q_QUERY_INFO structure. +********************************************************************/ +void wks_io_q_query_info(char *desc, WKS_Q_QUERY_INFO *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "wks_io_q_query_info"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_srv_name", ps, depth, &(q_u->ptr_srv_name)); + smb_io_unistr2("", &(q_u->uni_srv_name), q_u->ptr_srv_name, ps, depth); + prs_align(ps); + + prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); + prs_align(ps); +} + +/******************************************************************* + wks_info_100 + ********************************************************************/ +void make_wks_info_100(WKS_INFO_100 *inf, + uint32 platform_id, uint32 ver_major, uint32 ver_minor, + char *my_name, char *domain_name) +{ + DEBUG(5,("WKS_INFO_100: %d\n", __LINE__)); + + inf->platform_id = platform_id; /* 0x0000 01f4 - unknown */ + inf->ver_major = ver_major; /* os major version */ + inf->ver_minor = ver_minor; /* os minor version */ + + make_buf_unistr2(&(inf->uni_compname), &(inf->ptr_compname), my_name ); + make_buf_unistr2(&(inf->uni_lan_grp ), &(inf->ptr_lan_grp ), domain_name); +} + +/******************************************************************* +reads or writes a WKS_INFO_100 structure. +********************************************************************/ +void wks_io_wks_info_100(char *desc, WKS_INFO_100 *inf, prs_struct *ps, int depth) +{ + if (inf == NULL) return; + + prs_debug(ps, depth, desc, "wks_io_wks_info_100"); + depth++; + + prs_align(ps); + + prs_uint32("platform_id ", ps, depth, &(inf->platform_id )); /* 0x0000 01f4 - unknown */ + prs_uint32("ptr_compname", ps, depth, &(inf->ptr_compname)); /* pointer to computer name */ + prs_uint32("ptr_lan_grp ", ps, depth, &(inf->ptr_lan_grp )); /* pointer to LAN group name */ + prs_uint32("ver_major ", ps, depth, &(inf->ver_major )); /* 4 - major os version */ + prs_uint32("ver_minor ", ps, depth, &(inf->ver_minor )); /* 0 - minor os version */ + + smb_io_unistr2("", &(inf->uni_compname), inf->ptr_compname, ps, depth); + prs_align(ps); + + smb_io_unistr2("", &(inf->uni_lan_grp ), inf->ptr_lan_grp , ps, depth); + prs_align(ps); +} + +/******************************************************************* + make_wks_r_query_info + + only supports info level 100 at the moment. + + ********************************************************************/ +void make_wks_r_query_info(WKS_R_QUERY_INFO *r_u, + uint32 switch_value, WKS_INFO_100 *wks100, + int status) +{ + DEBUG(5,("make_wks_r_unknown_0: %d\n", __LINE__)); + + r_u->switch_value = switch_value; /* same as in request */ + + r_u->ptr_1 = 1; /* pointer 1 */ + r_u->wks100 = wks100; + + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void wks_io_r_query_info(char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "wks_io_r_query_info"); + depth++; + + prs_align(ps); + + prs_uint16("switch_value", ps, depth, &(r_u->switch_value)); /* level 100 (0x64) */ + prs_align(ps); + + prs_uint32("ptr_1 ", ps, depth, &(r_u->ptr_1 )); /* pointer 1 */ + wks_io_wks_info_100("inf", r_u->wks100, ps, depth); + + prs_uint32("status ", ps, depth, &(r_u->status)); +} + -- cgit From 5d7c8375e4ffb017ef0f9eed7e619e533b3e8d12 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 24 Mar 1998 00:37:53 +0000 Subject: clientgen.c ipc.c smbpasswd.c: Fixes for warnings (from Herb). quotas.c: Linux quota fix. util.c: Ensure smb_read_error is zero in all calls that can set it. lib/rpc/include/rpc_misc.h lib/rpc/include/rpc_netlogon.h lib/rpc/parse/parse_misc.c lib/rpc/parse/parse_net.c lib/rpc/server/srv_netlog.c : Modify Luke's code to call SamOEMhash(). Jeremy. (This used to be commit 7f749708383b8b36c3f23a5fbc5cbdf39bc8e555) --- source3/rpc_parse/parse_misc.c | 12 ++++---- source3/rpc_parse/parse_net.c | 68 ++++++++++++++++-------------------------- 2 files changed, 31 insertions(+), 49 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 225754903f..78524201ff 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -848,13 +848,13 @@ void smb_io_logon_id(char *desc, DOM_LOGON_ID *log, prs_struct *ps, int depth) } /******************************************************************* -makes an ARC4_OWF structure. +makes an OWF_INFO structure. ********************************************************************/ -void make_arc4_owf(ARC4_OWF *hash, uint8 data[16]) +void make_owf_info(OWF_INFO *hash, uint8 data[16]) { if (hash == NULL) return; - DEBUG(5,("make_arc4_owf: %d\n", __LINE__)); + DEBUG(5,("make_owf_info: %d\n", __LINE__)); if (data != NULL) { @@ -867,13 +867,13 @@ void make_arc4_owf(ARC4_OWF *hash, uint8 data[16]) } /******************************************************************* -reads or writes an ARC4_OWF structure. +reads or writes an OWF_INFO structure. ********************************************************************/ -void smb_io_arc4_owf(char *desc, ARC4_OWF *hash, prs_struct *ps, int depth) +void smb_io_owf_info(char *desc, OWF_INFO *hash, prs_struct *ps, int depth) { if (hash == NULL) return; - prs_debug(ps, depth, desc, "smb_io_arc4_owf"); + prs_debug(ps, depth, desc, "smb_io_owf_info"); depth++; prs_align(ps); diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 69d6ac08ed..529cd37105 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -580,8 +580,8 @@ void make_id_info1(NET_ID_INFO_1 *id, char *domain_name, int len_user_name = strlen(user_name ); int len_wksta_name = strlen(wksta_name ); - unsigned char arc4_lm_owf[16]; - unsigned char arc4_nt_owf[16]; + unsigned char lm_owf[16]; + unsigned char nt_owf[16]; if (id == NULL) return; @@ -597,12 +597,10 @@ void make_id_info1(NET_ID_INFO_1 *id, char *domain_name, make_uni_hdr(&(id->hdr_user_name ), len_user_name , len_user_name , 4); make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name , len_wksta_name , 4); -#ifdef USE_ARCFOUR - if (lm_cypher && nt_cypher) { void arcfour(uint8 key[16], uint8 out[16], uint8 in[16]); - unsigned char arc4_key[16]; + unsigned char owf_key[16]; #ifdef DEBUG_PASSWORD DEBUG(100,("lm cypher:")); dump_data(100, lm_cypher, 16); @@ -611,43 +609,27 @@ void make_id_info1(NET_ID_INFO_1 *id, char *domain_name, dump_data(100, nt_cypher, 16); #endif - memset(arc4_key, 0, 16); - memcpy(arc4_key, sess_key, 16); + memcpy(owf_key, sess_key, 16); - arcfour(arc4_key, arc4_lm_owf, lm_cypher); - arcfour(arc4_key, arc4_nt_owf, nt_cypher); + memcpy(lm_owf, lm_cypher, 16); + memcpy(nt_owf, nt_cypher, 16); + SamOEMhash(lm_owf, owf_key, False); + SamOEMhash(nt_owf, owf_key, False); #ifdef DEBUG_PASSWORD - DEBUG(100,("arcfour encrypt of lm owf password:")); - dump_data(100, arc4_lm_owf, 16); + DEBUG(100,("hash of lm owf password:")); + dump_data(100, lm_owf, 16); - DEBUG(100,("arcfour encrypt of nt owf password:")); - dump_data(100, arc4_nt_owf, 16); + DEBUG(100,("hash of nt owf password:")); + dump_data(100, nt_owf, 16); #endif - /* set up pointers to cypher blocks */ - lm_cypher = arc4_lm_owf; - nt_cypher = arc4_nt_owf; - } - -#else - - if (lm_cypher) - { - /* oops. can only send what-ever-it-is direct */ - memcpy(arc4_lm_owf, lm_cypher, 16); - lm_cypher = arc4_lm_owf; + /* set up pointers to blocks */ + lm_cypher = lm_owf; + nt_cypher = nt_owf; } - if (nt_cypher) - { - /* oops. can only send what-ever-it-is direct */ - memcpy(arc4_nt_owf, nt_cypher, 16); - nt_cypher = arc4_nt_owf; - } - -#endif - make_arc4_owf(&(id->arc4_lm_owf), lm_cypher); - make_arc4_owf(&(id->arc4_nt_owf), nt_cypher); + make_owf_info(&(id->lm_owf), lm_cypher); + make_owf_info(&(id->nt_owf), nt_cypher); make_unistr2(&(id->uni_domain_name), domain_name, len_domain_name); make_unistr2(&(id->uni_user_name ), user_name , len_user_name ); @@ -678,8 +660,8 @@ void net_io_id_info1(char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth) smb_io_unihdr("unihdr", &(id->hdr_user_name ), ps, depth); smb_io_unihdr("unihdr", &(id->hdr_wksta_name ), ps, depth); - smb_io_arc4_owf("", &(id->arc4_lm_owf), ps, depth); - smb_io_arc4_owf("", &(id->arc4_nt_owf), ps, depth); + smb_io_owf_info("", &(id->lm_owf), ps, depth); + smb_io_owf_info("", &(id->nt_owf), ps, depth); smb_io_unistr2("unistr2", &(id->uni_domain_name), id->hdr_domain_name.buffer, ps, depth); smb_io_unistr2("unistr2", &(id->uni_user_name ), id->hdr_user_name.buffer, ps, depth); @@ -701,8 +683,8 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name, int len_user_name = strlen(user_name ); int len_wksta_name = strlen(wksta_name ); - unsigned char arc4_lm_owf[24]; - unsigned char arc4_nt_owf[24]; + unsigned char lm_owf[24]; + unsigned char nt_owf[24]; if (id == NULL) return; @@ -721,14 +703,14 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name, if (nt_chal_resp) { /* oops. can only send what-ever-it-is direct */ - memcpy(arc4_nt_owf, nt_chal_resp, 24); - nt_chal_resp = arc4_nt_owf; + memcpy(nt_owf, nt_chal_resp, 24); + nt_chal_resp = nt_owf; } if (lm_chal_resp) { /* oops. can only send what-ever-it-is direct */ - memcpy(arc4_lm_owf, lm_chal_resp, 24); - lm_chal_resp = arc4_lm_owf; + memcpy(lm_owf, lm_chal_resp, 24); + lm_chal_resp = lm_owf; } memcpy(&(id->lm_chal), lm_challenge, sizeof(id->lm_chal)); -- cgit From e300c0346ff92035ff9568b55b34469193e29769 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 10 Apr 1998 18:21:16 +0000 Subject: includes.h: Moved HPUX undefine of SEMMSL to where it actually does something. ipc.c: Added Luke's debug statement. locking_slow.c: Added FTRUNCATE_NEEDS_ROOT code for broken systems that need it (not sure what these are yet). membuffer.c ntdomain.h proto.h lib/rpc/include/rpc_dce.h lib/rpc/include/rpc_srvsvc.h lib/rpc/parse/parse_prs.c lib/rpc/parse/parse_rpc.c lib/rpc/server/srv_pipe_hnd.c lib/rpc/server/srv_util.c: Re-merge of Luke's NTDOM changes 'cos he's a lazy git with carpel tunnel syndrome :-). Jeremy. (This used to be commit 52e3966fbcf7b5fbdbc7cbe9ac0b453ab5bf3217) --- source3/rpc_parse/parse_prs.c | 2 +- source3/rpc_parse/parse_rpc.c | 41 +++++++++++++++++++++++++++++++++-------- 2 files changed, 34 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 799bd1cc94..0baf05597c 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -86,7 +86,7 @@ void prs_align(prs_struct *ps) ********************************************************************/ BOOL prs_grow(prs_struct *ps) { - return mem_grow_data(&(ps->data), ps->io, ps->offset); + return mem_grow_data(&(ps->data), ps->io, ps->offset, False); } diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index b025d3f1c8..8a5b6c172e 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -384,33 +384,58 @@ void smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) } /******************************************************************* -creates an RPC_HDR_RR structure. +creates an RPC_HDR_REQ structure. ********************************************************************/ -void make_rpc_hdr_rr(RPC_HDR_RR *hdr, uint32 data_len, uint8 opnum) +void make_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 data_len, uint16 opnum) { if (hdr == NULL) return; hdr->alloc_hint = data_len - 0x18; /* allocation hint */ hdr->context_id = 0; /* presentation context identifier */ - hdr->cancel_count = 0; /* cancel count */ hdr->opnum = opnum; /* opnum */ +} + +/******************************************************************* +reads or writes an RPC_HDR_REQ structure. +********************************************************************/ +void smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) +{ + if (rpc == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_req"); + depth++; + + prs_uint32("alloc_hint", ps, depth, &(rpc->alloc_hint)); + prs_uint16("context_id", ps, depth, &(rpc->context_id)); + prs_uint16("opnum ", ps, depth, &(rpc->opnum)); +} + +/******************************************************************* +creates an RPC_HDR_RESP structure. +********************************************************************/ +void make_rpc_hdr_resp(RPC_HDR_RESP *hdr, uint32 data_len) +{ + if (hdr == NULL) return; + + hdr->alloc_hint = data_len - 0x18; /* allocation hint */ + hdr->context_id = 0; /* presentation context identifier */ + hdr->cancel_count = 0; /* cancel count */ hdr->reserved = 0; /* 0 - reserved */ } /******************************************************************* -reads or writes an RPC_HDR_RR structure. +reads or writes an RPC_HDR_RESP structure. ********************************************************************/ -void smb_io_rpc_hdr_rr(char *desc, RPC_HDR_RR *rpc, prs_struct *ps, int depth) +void smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return; - prs_debug(ps, depth, desc, "smb_io_rpc_hdr_rr"); + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_resp"); depth++; prs_uint32("alloc_hint", ps, depth, &(rpc->alloc_hint)); - prs_uint8 ("context_id", ps, depth, &(rpc->context_id)); + prs_uint16("context_id", ps, depth, &(rpc->context_id)); prs_uint8 ("cancel_ct ", ps, depth, &(rpc->cancel_count)); - prs_uint8 ("opnum ", ps, depth, &(rpc->opnum)); prs_uint8 ("reserved ", ps, depth, &(rpc->reserved)); } -- cgit From 30675f81f60bab24f47758baab8316d4467709ef Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 23 Apr 1998 22:59:19 +0000 Subject: Makefile: Added nterr.c into the mix. clientgen.c: Added nt_error as an entry in the struct client_state. password.c: Open the netlogon pipe. smb.h: Added nt_error as an entry in the struct client_state. lib/rpc/parse/parse_net.c: Added comments on net logon. lib/rpc/server/srv_netlog.c: Added comments on net logon. Jeremy. (This used to be commit 899a9f0dce50c73e03c8da2ebe920957491c8ad7) --- source3/rpc_parse/parse_net.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 529cd37105..c5dd23a00e 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -569,7 +569,17 @@ static int make_dom_sid2s(char *sids_str, DOM_SID2 *sids, int max_sids) /******************************************************************* makes a NET_ID_INFO_1 structure. + +This is an interactive 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 passes the actual NT and LM hashed passwords +over the secure channel. This is not the preferred logon +method from a Samba domain client as it exposes the password +hashes to anyone who has compromised the secure channel. JRA. ********************************************************************/ + void make_id_info1(NET_ID_INFO_1 *id, char *domain_name, uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, char *user_name, char *wksta_name, @@ -671,7 +681,19 @@ void net_io_id_info1(char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth) /******************************************************************* makes 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 make_id_info2(NET_ID_INFO_2 *id, char *domain_name, uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, char *user_name, char *wksta_name, -- cgit From d3832506b2583130c4f4ba4b3edeabca987b7cbb Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 29 Apr 1998 00:02:57 +0000 Subject: This is the checkin that adds the security=domain functionality. WARNING - so far this has only been tested against a Samba PDC (still waiting for IS to add me the machine accounts :-). Still missing is the code in smbpasswd that will add a machine account password and change it on the domain controller, but this is not hard, and I will check it in soon. Jeremy. (This used to be commit 17b94a7084621b3f0106dd4d3386f05cdfc56d19) --- source3/rpc_parse/parse_net.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index c5dd23a00e..84a88e4b92 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -499,9 +499,8 @@ void net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth) /******************************************************************* reads or writes a structure. ********************************************************************/ -void make_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char sess_key[16], - char *logon_srv, char *acct_name, uint16 sec_chan, char *comp_name, - DOM_CRED *cred, char nt_cypher[16]) +void make_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char *logon_srv, char *acct_name, + uint16 sec_chan, char *comp_name, DOM_CRED *cred, char nt_cypher[16]) { if (q_s == NULL || cred == NULL) return; @@ -748,7 +747,7 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name, } /******************************************************************* -reads or writes an NET_ID_INFO_1 structure. +reads or writes an NET_ID_INFO_2 structure. ********************************************************************/ void net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int depth) { -- cgit From e305c2c9e2e657974d34d1d58a8f9372921fdae2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 29 Apr 1998 19:22:01 +0000 Subject: clientgen.c: Fixed null session setup bug. password.c: Stopped cli_nt_logout call (we don't have it correct yet). Added Luke object-orientation fix :-). smb.h: Added clnt_name_slash to cli_state. lib/rpc/client/cli_login.c: Changed global_myname to clnt_name_slash where needed. lib/rpc/client/cli_netlogon.c: Fixed debug messages, don't check creds on error. lib/rpc/client/cli_pipe.c: Fixed debug messages, Added Luke object-orientation fix. lib/rpc/parse/parse_misc.c: Fixed STRING2 linearization bug that was adding 1. Jeremy. (This used to be commit c6c22df20196cb7f0ae84b1a1dd202a87adb8d4e) --- source3/rpc_parse/parse_misc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 78524201ff..0343dea484 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -424,10 +424,10 @@ creates a STRING2 structure. ********************************************************************/ void make_string2(STRING2 *str, char *buf, int len) { - /* set up string lengths. add one if string is not null-terminated */ - str->str_max_len = len+1; + /* set up string lengths. */ + str->str_max_len = len; str->undoc = 0; - str->str_str_len = len+1; + str->str_str_len = len; /* store the string */ memcpy(str->buffer, buf, len); -- cgit From f601e6e0484d77d2c43eab05f80bccf28c9055aa Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 5 May 1998 09:04:49 +0000 Subject: patches from jean francois: couple of minor bugs (This used to be commit 532b3956c66eda1b7e787b1c6906bcf574f66216) --- source3/rpc_parse/parse_lsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 6eb42fc749..0a49fb7b4d 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -474,7 +474,7 @@ void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, in prs_uint32(temp, ps, depth, &(trn->ptr_name[i])); /* pointer to translated name */ } - for (i = 0; i < trn->num_entries2; i++) + for (i = 0, i2 = 0; i < trn->num_entries2; i++) { if (trn->ptr_name[i] != 0) { -- cgit From 3dfc0c847240ac7e12c39f4ed9c31a888949ade1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 11 May 1998 06:38:36 +0000 Subject: changed to use slprintf() instead of sprintf() just about everywhere. I've implemented slprintf() as a bounds checked sprintf() using mprotect() and a non-writeable page. This should prevent any sprintf based security holes. (This used to be commit ee09e9dadb69aaba5a751dd20ccc6d587d841bd6) --- source3/rpc_parse/parse_net.c | 4 ++-- source3/rpc_parse/parse_prs.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 84a88e4b92..c74ace8d63 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -742,8 +742,8 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name, make_unistr2(&(id->uni_user_name ), user_name , len_user_name ); make_unistr2(&(id->uni_wksta_name ), wksta_name , len_wksta_name ); - make_string2(&(id->nt_chal_resp ), nt_chal_resp , nt_chal_resp != NULL ? 24 : 0); - make_string2(&(id->lm_chal_resp ), lm_chal_resp , lm_chal_resp != NULL ? 24 : 0); + make_string2(&(id->nt_chal_resp ), (char *)nt_chal_resp , nt_chal_resp != NULL ? 24 : 0); + make_string2(&(id->lm_chal_resp ), (char *)lm_chal_resp , lm_chal_resp != NULL ? 24 : 0); } /******************************************************************* diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 0baf05597c..ad05831229 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -242,7 +242,7 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) ps->offset += i*2; - dump_data(5+depth, start, ps->offset); + dump_data(5+depth, (char *)start, ps->offset); return True; } @@ -283,7 +283,7 @@ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len) ps->offset += i+1; - dump_data(5+depth, start, ps->offset); + dump_data(5+depth, (char *)start, ps->offset); return True; } -- cgit From f888868f46a5418bac9ab528497136c152895305 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 12 May 1998 00:55:32 +0000 Subject: This is a security audit change of the main source. It removed all ocurrences of the following functions : sprintf strcpy strcat The replacements are slprintf, safe_strcpy and safe_strcat. It should not be possible to use code in Samba that uses sprintf, strcpy or strcat, only the safe_equivalents. Once Andrew has fixed the slprintf implementation then this code will be moved back to the 1.9.18 code stream. Jeremy. (This used to be commit 2d774454005f0b54e5684cf618da7060594dfcbb) --- source3/rpc_parse/parse_lsa.c | 8 ++++---- source3/rpc_parse/parse_misc.c | 2 +- source3/rpc_parse/parse_samr.c | 14 +++++++------- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 0a49fb7b4d..202c3b6da3 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -416,14 +416,14 @@ void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) for (i = 0; i < sen->num_entries; i++) { fstring temp; - sprintf(temp, "ptr_sid[%d]", i); + slprintf(temp, sizeof(temp) - 1, "ptr_sid[%d]", i); prs_uint32(temp, ps, depth, &(sen->ptr_sid[i])); /* domain SID pointers to be looked up. */ } for (i = 0; i < sen->num_entries; i++) { fstring temp; - sprintf(temp, "sid[%d]", i); + slprintf(temp, sizeof(temp) - 1, "sid[%d]", i); smb_io_dom_sid2(temp, &(sen->sid[i]), ps, depth); /* domain SIDs to be looked up. */ } } @@ -470,7 +470,7 @@ void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, in for (i = 0; i < trn->num_entries; i++) { fstring temp; - sprintf(temp, "ptr_name[%d] ", i); + slprintf(temp, sizeof(temp) - 1, "ptr_name[%d] ", i); prs_uint32(temp, ps, depth, &(trn->ptr_name[i])); /* pointer to translated name */ } @@ -479,7 +479,7 @@ void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, in if (trn->ptr_name[i] != 0) { fstring temp; - sprintf(temp, "name[%d] ", i); + slprintf(temp, sizeof(temp) - 1, "name[%d] ", i); lsa_io_trans_name(temp, &(trn->name[i2]), ps, depth); /* translated name */ i2++; } diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 0343dea484..b46bcd9f89 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -190,7 +190,7 @@ void smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) for (i = 0; i < 6; i++) { fstring tmp; - sprintf(tmp, "id_auth[%d] ", i); + slprintf(tmp, sizeof(tmp) - 1, "id_auth[%d] ", i); prs_uint8 (tmp, ps, depth, &(sid->id_auth[i])); } diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a72769d9c0..b0138ac97d 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1492,7 +1492,7 @@ void samr_io_q_lookup_ids(char *desc, SAMR_Q_LOOKUP_IDS *q_u, prs_struct *ps, i for (i = 0; i < q_u->num_sids2; i++) { - sprintf(tmp, "ptr[%02d]", i); + slprintf(tmp, sizeof(tmp) - 1, "ptr[%02d]", i); prs_uint32(tmp, ps, depth, &(q_u->ptr_sid[i])); } @@ -1500,7 +1500,7 @@ void samr_io_q_lookup_ids(char *desc, SAMR_Q_LOOKUP_IDS *q_u, prs_struct *ps, i { if (q_u->ptr_sid[i] != 0) { - sprintf(tmp, "sid[%02d]", i); + slprintf(tmp, sizeof(tmp)-1, "sid[%02d]", i); smb_io_dom_sid2(tmp, &(q_u->sid[i]), ps, depth); } } @@ -1564,7 +1564,7 @@ void samr_io_r_lookup_ids(char *desc, SAMR_R_LOOKUP_IDS *r_u, prs_struct *ps, i for (i = 0; i < r_u->num_entries2; i++) { - sprintf(tmp, "rid[%02d]", i); + slprintf(tmp, sizeof(tmp)-1, "rid[%02d]", i); prs_uint32(tmp, ps, depth, &(r_u->rid[i])); } } @@ -1723,7 +1723,7 @@ void samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, i for (i = 0; i < q_u->num_gids2; i++) { - sprintf(tmp, "gid[%02d] ", i); + slprintf(tmp, sizeof(tmp) - 1, "gid[%02d] ", i); prs_uint32(tmp, ps, depth, &(q_u->gid[i])); } @@ -1797,12 +1797,12 @@ void samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, i { for (i = 0; i < r_u->num_aliases2; i++) { - sprintf(tmp, "als_hdr[%02d] ", i); + slprintf(tmp, sizeof(tmp) - 1, "als_hdr[%02d] ", i); smb_io_unihdr ("", &(r_u->hdr_als_name[i]), ps, depth); } for (i = 0; i < r_u->num_aliases2; i++) { - sprintf(tmp, "als_str[%02d] ", i); + slprintf(tmp, sizeof(tmp) - 1, "als_str[%02d] ", i); smb_io_unistr2("", &(r_u->uni_als_name[i]), r_u->hdr_als_name[i].buffer, ps, depth); } } @@ -1817,7 +1817,7 @@ void samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, i { for (i = 0; i < r_u->num_als_usrs2; i++) { - sprintf(tmp, "als_usrs[%02d] ", i); + slprintf(tmp, sizeof(tmp) - 1, "als_usrs[%02d] ", i); prs_uint32(tmp, ps, depth, &(r_u->num_als_usrs[i])); } } -- cgit From 00d8e6626f38ecb262c76c9a07f3211fa441cc0a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 12 May 1998 16:43:52 +0000 Subject: function comments wrong (This used to be commit da11063cbd23c376c4e1afaad647adcb989934eb) --- source3/rpc_parse/parse_samr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index b0138ac97d..29fe8cf1df 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -449,7 +449,7 @@ void make_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, { if (sam == NULL) return; - DEBUG(5,("make_sam_entry2: %d\n", __LINE__)); + DEBUG(5,("make_sam_entry1: %d\n", __LINE__)); sam->user_idx = user_idx; sam->rid_user = rid_user; @@ -468,7 +468,7 @@ void sam_io_sam_entry1(char *desc, SAM_ENTRY1 *sam, prs_struct *ps, int depth) { if (sam == NULL) return; - prs_debug(ps, depth, desc, "sam_io_sam_entry2"); + prs_debug(ps, depth, desc, "sam_io_sam_entry1"); depth++; prs_align(ps); -- cgit From 5b619d95145ed5b12d456f2d230d0a84aabac93b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 13 May 1998 05:07:55 +0000 Subject: initialise some variables (stops warning) (This used to be commit 6074d09dbf7c9ae03a56773e6ff0a52a60cc75da) --- source3/rpc_parse/parse_samr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 29fe8cf1df..44248bfc64 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -339,8 +339,8 @@ wierd. ********************************************************************/ void samr_io_r_unknown_3(char *desc, SAMR_R_UNKNOWN_3 *r_u, prs_struct *ps, int depth) { - int ptr_len0; - int ptr_len1; + int ptr_len0=0; + int ptr_len1=0; int ptr_sid_stuff = 0; if (r_u == NULL) return; -- cgit From a4276507e43487f47445eab11d4ac1b080b3270e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 14 May 1998 01:30:40 +0000 Subject: chgpasswd.c: Added comments to #ifdefs ipc.c: Caused samba password changing not to be done if UNIX password changing requested and not successful. util.c: Added string_to_sid() and sid_to_string() functions. lib/rpc/client/cli_samr.c: lib/rpc/include/rpc_misc.h: lib/rpc/parse/parse_lsa.c: lib/rpc/parse/parse_misc.c: lib/rpc/parse/parse_net.c: lib/rpc/parse/parse_samr.c: lib/rpc/server/srv_lsa.c: lib/rpc/server/srv_lsa_hnd.c: lib/rpc/server/srv_netlog.c: lib/rpc/server/srv_samr.c: lib/rpc/server/srv_util.c: Changes so that instead of passing SIDs around as char *, they are converted to DOM_SID at the earliest opportunity, and passed around as that. Also added dynamic memory allocation of group sids. Preparing to auto-generate machine sid. Jeremy. (This used to be commit 134d6fa79c1b6b9505a2c84ba9bfb91dd3be76e5) --- source3/rpc_parse/parse_lsa.c | 4 +-- source3/rpc_parse/parse_misc.c | 61 +++--------------------------------------- source3/rpc_parse/parse_net.c | 6 +++-- source3/rpc_parse/parse_samr.c | 6 ++--- 4 files changed, 12 insertions(+), 65 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 202c3b6da3..6bd916ed32 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -247,8 +247,8 @@ void lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct makes an LSA_R_ENUM_TRUST_DOM structure. ********************************************************************/ void make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, - uint32 enum_context, char *domain_name, char *domain_sid, - uint32 status) + uint32 enum_context, char *domain_name, DOM_SID *domain_sid, + uint32 status) { if (r_e == NULL) return; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index b46bcd9f89..35ca6c9553 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -115,61 +115,6 @@ void smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) } } -/******************************************************************* -creates a DOM_SID structure. - -BIG NOTE: this function only does SIDS where the identauth is not >= 2^32 -identauth >= 2^32 can be detected because it will be specified in hex - -********************************************************************/ -void make_dom_sid(DOM_SID *sid, char *str_sid) -{ - pstring domsid; - int identauth; - char *p; - - if (sid == NULL) return; - - if (domsid == NULL) - { - DEBUG(4,("netlogon domain SID: none\n")); - sid->sid_rev_num = 0; - sid->num_auths = 0; - return; - } - - pstrcpy(domsid, str_sid); - - DEBUG(4,("make_dom_sid %d SID: %s\n", __LINE__, domsid)); - - /* assume, but should check, that domsid starts "S-" */ - p = strtok(domsid+2,"-"); - sid->sid_rev_num = atoi(p); - - /* identauth in decimal should be < 2^32 */ - /* identauth in hex should be >= 2^32 */ - identauth = atoi(strtok(0,"-")); - - DEBUG(4,("netlogon rev %d\n", sid->sid_rev_num)); - DEBUG(4,("netlogon %s ia %d\n", p, identauth)); - - sid->id_auth[0] = 0; - sid->id_auth[1] = 0; - sid->id_auth[2] = (identauth & 0xff000000) >> 24; - sid->id_auth[3] = (identauth & 0x00ff0000) >> 16; - sid->id_auth[4] = (identauth & 0x0000ff00) >> 8; - sid->id_auth[5] = (identauth & 0x000000ff); - - sid->num_auths = 0; - - while ((p = strtok(0, "-")) != NULL && sid->num_auths < MAXSUBAUTHS) - { - sid->sub_auths[sid->num_auths++] = atoi(p); - } - - DEBUG(4,("make_dom_sid: %d SID: %s\n", __LINE__, domsid)); -} - /******************************************************************* reads or writes a DOM_SID structure. ********************************************************************/ @@ -203,10 +148,10 @@ void smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) /******************************************************************* creates a DOM_SID2 structure. ********************************************************************/ -void make_dom_sid2(DOM_SID2 *sid, char *str_sid) +void make_dom_sid2(DOM_SID2 *sid2, DOM_SID *sid) { - make_dom_sid(&(sid->sid), str_sid); - sid->num_auths = sid->sid.num_auths; + sid2->sid = *sid; + sid2->num_auths = sid2->sid.num_auths; } /******************************************************************* diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index c74ace8d63..fd9f7255de 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -560,7 +560,9 @@ static int make_dom_sid2s(char *sids_str, DOM_SID2 *sids, int max_sids) for (count = 0, ptr = sids_str; next_token(&ptr, s2, NULL) && count < max_sids; count++) { - make_dom_sid2(&sids[count], s2); + DOM_SID tmpsid; + string_to_sid(&tmpsid, s2); + make_dom_sid2(&sids[count], &tmpsid); } return count; @@ -908,7 +910,7 @@ void make_net_user_info3(NET_USER_INFO_3 *usr, char *logon_srv, char *logon_dom, - char *dom_sid, + DOM_SID *dom_sid, char *other_sids) { /* only cope with one "other" sid, right now. */ diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 44248bfc64..09c47ab25a 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -78,7 +78,7 @@ void samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND *r_u, prs_struct *ps, int reads or writes a structure. ********************************************************************/ void make_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, - POLICY_HND *connect_pol, uint32 rid, char *sid) + POLICY_HND *connect_pol, uint32 rid, DOM_SID *sid) { if (q_u == NULL) return; @@ -204,11 +204,11 @@ void samr_io_q_unknown_3(char *desc, SAMR_Q_UNKNOWN_3 *q_u, prs_struct *ps, int calculate length by adding up the size of the components. ********************************************************************/ -void make_dom_sid3(DOM_SID3 *sid3, uint16 unk_0, uint16 unk_1, char *sid) +void make_dom_sid3(DOM_SID3 *sid3, uint16 unk_0, uint16 unk_1, char *sidstr) { if (sid3 == NULL) return; - make_dom_sid(&(sid3->sid), sid); + string_to_sid(&(sid3->sid), sidstr); sid3->len = 2 + 8 + sid3->sid.num_auths * 4; } -- cgit From f8a4273407f2983bb05a76e914d4f532bbd5004e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 14 May 1998 21:10:49 +0000 Subject: passdb.c server.c: Moved generate_machine_sid() into passdb.c for Jean-Francois (who might want an LDAP version). Changed locking to free exclusive lock as soon as possible to prevent contention. lib/rpc/parse/parse_samr.c lib/rpc/server/srv_samr.c: Changed last SID-as-string manipulation function to use DOM_SID structure. Jeremy. (This used to be commit 3b8f5aef57b4f37265c0403385053085f0df6f18) --- source3/rpc_parse/parse_samr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 09c47ab25a..a85b6a692d 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -204,11 +204,11 @@ void samr_io_q_unknown_3(char *desc, SAMR_Q_UNKNOWN_3 *q_u, prs_struct *ps, int calculate length by adding up the size of the components. ********************************************************************/ -void make_dom_sid3(DOM_SID3 *sid3, uint16 unk_0, uint16 unk_1, char *sidstr) +void make_dom_sid3(DOM_SID3 *sid3, uint16 unk_0, uint16 unk_1, DOM_SID *sid) { if (sid3 == NULL) return; - string_to_sid(&(sid3->sid), sidstr); + sid3->sid = *sid; sid3->len = 2 + 8 + sid3->sid.num_auths * 4; } -- cgit From 9c99863642d295e8b674c9c8b5eeda95bfc4d094 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 20 May 1998 13:17:26 +0000 Subject: dce/rpc net time command from jean-francois. does not support timezones (This used to be commit 8e11d542eebe076d74ab264e22b87f7aed9bbe8f) --- source3/rpc_parse/parse_srv.c | 87 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 959a6096aa..592aece439 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1525,4 +1525,91 @@ void srv_io_r_net_srv_set_info(char *desc, SRV_R_NET_SRV_SET_INFO *r_n, prs_str prs_uint32("status ", ps, depth, &(r_n->status )); } +/******************************************************************* + reads or writes a structure. + ********************************************************************/ +void srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name)); + smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); +} + +/******************************************************************* + reads or writes a TIME_OF_DAY_INFO structure. + ********************************************************************/ +void srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth) +{ + if (tod == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_time_of_day_info"); + depth++; + + prs_align(ps); + + prs_uint32("elapsedt ", ps, depth, &(tod->elapsedt )); + prs_uint32("msecs ", ps, depth, &(tod->msecs )); + prs_uint32("hours ", ps, depth, &(tod->hours )); + prs_uint32("mins ", ps, depth, &(tod->mins )); + prs_uint32("secs ", ps, depth, &(tod->secs )); + prs_uint32("hunds ", ps, depth, &(tod->hunds )); + prs_uint32("timezone ", ps, depth, &(tod->zone )); + prs_uint32("tintervals ", ps, depth, &(tod->tintervals)); + prs_uint32("day ", ps, depth, &(tod->day )); + prs_uint32("month ", ps, depth, &(tod->month )); + prs_uint32("year ", ps, depth, &(tod->year )); + prs_uint32("weekday ", ps, depth, &(tod->weekday )); +} + +/******************************************************************* + makes a TIME_OF_DAY_INFO structure. + ********************************************************************/ +void make_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs, + uint32 hours, uint32 mins, uint32 secs, uint32 hunds, + uint32 zone, uint32 tintervals, uint32 day, + uint32 month, uint32 year, uint32 weekday) +{ + if (tod == NULL) return; + + DEBUG(5,("make_time_of_day_info\n")); + + tod->elapsedt = elapsedt; + tod->msecs = msecs; + tod->hours = hours; + tod->mins = mins; + tod->secs = secs; + tod->hunds = hunds; + tod->zone = zone; + tod->tintervals = tintervals; + tod->day = day; + tod->month = month; + tod->year = year; + tod->weekday = weekday; +} + + +/******************************************************************* + reads or writes a structure. + ********************************************************************/ +void srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) return; + + prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_srv_tod ", ps, depth, &(r_n->ptr_srv_tod)); + + srv_io_time_of_day_info("tod", r_n->tod, ps, depth); + + prs_uint32("status ", ps, depth, &(r_n->status)); +} -- cgit From 684edc9fcd73d9c2059d018c4b5eb599888cfd8b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 24 May 1998 13:36:43 +0000 Subject: - created pdb_sethexpwd(), to be called from all pwd apis that need to store passwords in ascii format - dealt with lots of signed/unsigned char thingies spotted by Tim Winders. (This used to be commit bd825f1ef15c4bf12aeba945f8bfdc7fd0e14d25) --- source3/rpc_parse/parse_net.c | 2 +- source3/rpc_parse/parse_reg.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index fd9f7255de..9b12668184 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -736,7 +736,7 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name, lm_chal_resp = lm_owf; } - memcpy(&(id->lm_chal), lm_challenge, sizeof(id->lm_chal)); + memcpy(id->lm_chal, lm_challenge, sizeof(id->lm_chal)); make_str_hdr(&(id->hdr_nt_chal_resp), 24, 24, nt_chal_resp != NULL ? 1 : 0); make_str_hdr(&(id->hdr_lm_chal_resp), 24, 24, lm_chal_resp != NULL ? 1 : 0); diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index d278b75f5d..dec5110b41 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -142,12 +142,12 @@ void make_reg_q_info(REG_Q_INFO *r_q, memcpy(&(r_q->time), prod_time, sizeof(r_q->time)); r_q->major_version1 = major_version; r_q->minor_version1 = minor_version; - bzero(&(r_q->pad1), sizeof(r_q->pad1)); + bzero(r_q->pad1, sizeof(r_q->pad1)); r_q->ptr2 = 1; r_q->major_version2 = major_version; r_q->minor_version2 = minor_version; - bzero(&(r_q->pad2), sizeof(r_q->pad2)); + bzero(r_q->pad2, sizeof(r_q->pad2)); r_q->ptr3 = 1; r_q->unknown = unknown; -- cgit From e85295d9241bcdad3723898ab8ad88d8f11d5f28 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 9 Jun 1998 02:26:26 +0000 Subject: loadparm.c: Removed 'domain other sids' parameter. lib/rpc/include/rpc_lsa.h: Changed #defines for RPC calls - moved some, made LSA_LOOKUPNAMES correct. lib/rpc/include/rpc_misc.h: Changed DOMAIN_ALIAS_xxx to BUILTIN_ALIAS_xxx. Changed bitmasks for uid to rid to be 1 bit. lib/rpc/parse/parse_misc.c: Changed make_unistr2 to put length as given, max length as one more. lib/rpc/server/srv_netlog.c: Removed 'domain other sids' parameter. lib/rpc/server/srv_samr.c: Changed DOMAIN_ALIAS_xxx to BUILTIN_ALIAS_xxx. lib/rpc/server/srv_util.c: Changed DOMAIN_ALIAS_xxx to BUILTIN_ALIAS_xxx. Jeremy. (This used to be commit 34c91840a3d8c252715dc2f749b7a3b171a5b74f) --- source3/rpc_parse/parse_misc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 35ca6c9553..4937751b89 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -423,7 +423,9 @@ void make_unistr2(UNISTR2 *str, char *buf, int len) /* set up string lengths. add one if string is not null-terminated */ str->uni_max_len = len+1; str->undoc = 0; - str->uni_str_len = len+1; + +/* JRATEST - I believe this should be len, not len-1. JRA.*/ + str->uni_str_len = len; /* store the string (null-terminated 8 bit chars into 16 bit chars) */ struni2(str->buffer, buf); -- cgit From 1b86bead993051f93ea1570ad404e270b06045d3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 9 Jun 1998 02:33:56 +0000 Subject: I was wrong about the length and max_length values in make_unistr2. Jeremy. (This used to be commit 1d77728bbba49699a05eb70b685a4a97d7598122) --- source3/rpc_parse/parse_misc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 4937751b89..35ca6c9553 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -423,9 +423,7 @@ void make_unistr2(UNISTR2 *str, char *buf, int len) /* set up string lengths. add one if string is not null-terminated */ str->uni_max_len = len+1; str->undoc = 0; - -/* JRATEST - I believe this should be len, not len-1. JRA.*/ - str->uni_str_len = len; + str->uni_str_len = len+1; /* store the string (null-terminated 8 bit chars into 16 bit chars) */ struni2(str->buffer, buf); -- cgit From bbd7ca65e706457f5dbc046e83b4bd8cdde5be8f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 16 Jun 1998 18:25:36 +0000 Subject: clientgen: Added USE_SSL for client shutdown. clitar.c: Added 'Samba style' comments before string_create_s(). loadparm.c: Fixed missing comma in SSL code. util.c: Removed string_create_s(). Currently it's only called from clitar.c and having it here as well as a static in clitar causes the compile to break (Richard, please decide where you want this function). lib/rpc/parse/parse_net.c: Fix from to stop coredump on missing parameter. Jeremy. (This used to be commit d23b44322570cb9a7aa2b86407bf4f91010a237b) --- source3/rpc_parse/parse_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 9b12668184..a5dfad9b7f 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -554,7 +554,7 @@ static int make_dom_sid2s(char *sids_str, DOM_SID2 *sids, int max_sids) pstring s2; int count; - DEBUG(4,("make_dom_sid2s: %s\n", sids_str)); + DEBUG(4,("make_dom_sid2s: %s\n", sids_str ? sids_str:"")); if (sids_str == NULL || *sids_str == 0) return 0; -- cgit From 7a2b695bcbf80f192eea8db09a3f30c2cf75412d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 6 Jul 1998 22:48:21 +0000 Subject: password.c: Fixes to allow Win95 clients to have lm encrypted passwords recognised. lib/rpc/client/cli_login.c: Fix debug comment. lib/rpc/parse/parse_misc.c: Fix for passing null pointers. lib/rpc/parse/parse_net.c: Send correct password lengths when called from Win95. Jeremy. (This used to be commit ad1848b35521b3d478ea3226db818a1edef78254) --- source3/rpc_parse/parse_misc.c | 15 ++++++++------- source3/rpc_parse/parse_net.c | 11 ++++++----- 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 35ca6c9553..3c83382f0c 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -369,13 +369,14 @@ creates a STRING2 structure. ********************************************************************/ void make_string2(STRING2 *str, char *buf, int len) { - /* set up string lengths. */ - str->str_max_len = len; - str->undoc = 0; - str->str_str_len = len; - - /* store the string */ - memcpy(str->buffer, buf, len); + /* set up string lengths. */ + str->str_max_len = len; + str->undoc = 0; + str->str_str_len = len; + + /* store the string */ + if(len != 0) + memcpy(str->buffer, buf, len); } /******************************************************************* diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index a5dfad9b7f..1b253beeb9 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -705,7 +705,8 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name, int len_domain_name = strlen(domain_name); int len_user_name = strlen(user_name ); int len_wksta_name = strlen(wksta_name ); - + int nt_chal_resp_len = ((nt_chal_resp != NULL) ? 24 : 0); + int lm_chal_resp_len = ((lm_chal_resp != NULL) ? 24 : 0); unsigned char lm_owf[24]; unsigned char nt_owf[24]; @@ -737,15 +738,15 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name, } memcpy(id->lm_chal, lm_challenge, sizeof(id->lm_chal)); - make_str_hdr(&(id->hdr_nt_chal_resp), 24, 24, nt_chal_resp != NULL ? 1 : 0); - make_str_hdr(&(id->hdr_lm_chal_resp), 24, 24, lm_chal_resp != NULL ? 1 : 0); + make_str_hdr(&(id->hdr_nt_chal_resp), 24, nt_chal_resp_len, nt_chal_resp != NULL ? 1 : 0); + make_str_hdr(&(id->hdr_lm_chal_resp), 24, lm_chal_resp_len, lm_chal_resp != NULL ? 1 : 0); make_unistr2(&(id->uni_domain_name), domain_name, len_domain_name); make_unistr2(&(id->uni_user_name ), user_name , len_user_name ); make_unistr2(&(id->uni_wksta_name ), wksta_name , len_wksta_name ); - make_string2(&(id->nt_chal_resp ), (char *)nt_chal_resp , nt_chal_resp != NULL ? 24 : 0); - make_string2(&(id->lm_chal_resp ), (char *)lm_chal_resp , lm_chal_resp != NULL ? 24 : 0); + make_string2(&(id->nt_chal_resp ), (char *)nt_chal_resp , nt_chal_resp_len); + make_string2(&(id->lm_chal_resp ), (char *)lm_chal_resp , lm_chal_resp_len); } /******************************************************************* -- cgit From 8d42ee0f2c8cdd8d9f41e5e245999a9a6d44523f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 29 Jul 1998 03:15:02 +0000 Subject: some merge cleanups (This used to be commit 1d655b7c64231b0aec0548bb90fc3dcc3f37791c) --- source3/rpc_parse/dummy.in | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 source3/rpc_parse/dummy.in (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/dummy.in b/source3/rpc_parse/dummy.in new file mode 100644 index 0000000000..e69de29bb2 -- cgit From 87bcd5502c105921b48f9654d1c4f6d14ed9e9f6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 9 Aug 1998 11:25:49 +0000 Subject: added ignore rules for the dummy files (This used to be commit 687f76a17d6d3ebd33b4d9a848deef56f3c1f56a) --- source3/rpc_parse/.cvsignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 source3/rpc_parse/.cvsignore (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/.cvsignore b/source3/rpc_parse/.cvsignore new file mode 100644 index 0000000000..421376db9e --- /dev/null +++ b/source3/rpc_parse/.cvsignore @@ -0,0 +1 @@ +dummy -- cgit From b9623ab59e813131b1ed3f51616a46e719d59c21 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 14 Aug 1998 17:38:29 +0000 Subject: this is the bug change to using connection_struct* instead of cnum. Connections[] is now a local array in server.c I might have broken something with this change. In particular the oplock code is suspect and some .dll files aren't being oplocked when I expected them to be. I'll look at it after I've got some sleep. (This used to be commit c7ee025ead4a85b6fa44a832047b878451845fb6) --- source3/rpc_parse/parse_lsa.c | 2 +- source3/rpc_parse/parse_samr.c | 15 ++++++++++----- source3/rpc_parse/parse_srv.c | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 6bd916ed32..f32ff58efb 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -140,7 +140,7 @@ void lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int depth) if (attr->len != ps->offset - start) { - DEBUG(3,("lsa_io_obj_attr: length %lx does not match size %lx\n", + DEBUG(3,("lsa_io_obj_attr: length %x does not match size %x\n", attr->len, ps->offset - start)); } } diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a85b6a692d..44503ee8c9 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -721,7 +721,8 @@ void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, if (num_sam_entries >= MAX_SAM_ENTRIES) { num_sam_entries = MAX_SAM_ENTRIES; - DEBUG(5,("limiting number of entries to %d %s\n", num_sam_entries)); + DEBUG(5,("limiting number of entries to %d\n", + num_sam_entries)); } r_u->total_num_entries = total_num_entries; @@ -853,7 +854,8 @@ void make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, if (num_sam_entries >= MAX_SAM_ENTRIES) { num_sam_entries = MAX_SAM_ENTRIES; - DEBUG(5,("limiting number of entries to %d %s\n", num_sam_entries)); + DEBUG(5,("limiting number of entries to %d\n", + num_sam_entries)); } r_u->num_entries = num_sam_entries; @@ -988,7 +990,8 @@ void make_sam_info_2(SAM_INFO_2 *sam, uint32 acb_mask, if (num_sam_entries >= MAX_SAM_ENTRIES) { num_sam_entries = MAX_SAM_ENTRIES; - DEBUG(5,("limiting number of entries to %d %s\n", num_sam_entries)); + DEBUG(5,("limiting number of entries to %d\n", + num_sam_entries)); } for (i = start_idx, entries_added = 0; i < num_sam_entries; i++) @@ -1065,7 +1068,8 @@ void make_sam_info_1(SAM_INFO_1 *sam, uint32 acb_mask, if (num_sam_entries >= MAX_SAM_ENTRIES) { num_sam_entries = MAX_SAM_ENTRIES; - DEBUG(5,("limiting number of entries to %d %s\n", num_sam_entries)); + DEBUG(5,("limiting number of entries to %d\n", + num_sam_entries)); } for (i = start_idx, entries_added = 0; i < num_sam_entries; i++) @@ -1261,7 +1265,8 @@ void make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, if (num_sam_entries >= MAX_SAM_ENTRIES) { num_sam_entries = MAX_SAM_ENTRIES; - DEBUG(5,("limiting number of entries to %d %s\n", num_sam_entries)); + DEBUG(5,("limiting number of entries to %d\n", + num_sam_entries)); } if (status == 0x0) diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 592aece439..72cc34da9e 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1364,7 +1364,7 @@ void srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) } default: { - DEBUG(5,("%s% no server info at switch_value %d\n", + DEBUG(5,("%s no server info at switch_value %d\n", tab_depth(depth), ctr->switch_value)); break; } -- cgit From 3f3f47b0bd8d089120d267cfad1976db95cd8ebe Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 22 Aug 1998 02:54:21 +0000 Subject: added ASSERT() and ASSERT_ARRAY() macros and sprinkled them liberally in the rpc code. (This used to be commit e6ce1c5b5a9f29d8fcbbd23019186ff5c600e795) --- source3/rpc_parse/parse_lsa.c | 14 ++++++++++++++ source3/rpc_parse/parse_net.c | 6 ++++++ source3/rpc_parse/parse_samr.c | 42 ++++++++++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_srv.c | 8 ++++++++ 4 files changed, 70 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index f32ff58efb..272e76eefe 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -82,6 +82,8 @@ void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) smb_io_unihdr2("", &(r_r->hdr_dom_name), ps, depth); /* domain name unicode string header */ + ASSERT_ARRAY(r_r->hdr_ref_dom, r_r->num_ref_doms_1-1); + for (i = 0; i < r_r->num_ref_doms_1-1; i++) { smb_io_unihdr2("", &(r_r->hdr_ref_dom[i]), ps, depth); @@ -89,6 +91,8 @@ void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) smb_io_unistr("", &(r_r->uni_dom_name), ps, depth); /* domain name unicode string */ + ASSERT_ARRAY(r_r->ref_dom, r_r->num_ref_doms_2); + for (i = 0; i < r_r->num_ref_doms_2; i++) { smb_io_dom_sid2("", &(r_r->ref_dom[i]), ps, depth); /* referenced domain SIDs */ @@ -413,6 +417,8 @@ void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) prs_uint32("ptr_sid_enum", ps, depth, &(sen->ptr_sid_enum)); prs_uint32("num_entries2", ps, depth, &(sen->num_entries2)); + ASSERT_ARRAY(sen->ptr_sid, sen->num_entries); + for (i = 0; i < sen->num_entries; i++) { fstring temp; @@ -420,6 +426,8 @@ void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) prs_uint32(temp, ps, depth, &(sen->ptr_sid[i])); /* domain SID pointers to be looked up. */ } + ASSERT_ARRAY(sen->sid, sen->num_entries); + for (i = 0; i < sen->num_entries; i++) { fstring temp; @@ -467,6 +475,8 @@ void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, in prs_uint32("ptr_trans_names", ps, depth, &(trn->ptr_trans_names)); prs_uint32("num_entries2 ", ps, depth, &(trn->num_entries2)); + ASSERT_ARRAY(trn->ptr_name, trn->num_entries); + for (i = 0; i < trn->num_entries; i++) { fstring temp; @@ -527,6 +537,8 @@ void lsa_io_q_lookup_rids(char *desc, LSA_Q_LOOKUP_RIDS *q_r, prs_struct *ps, i prs_uint32("buffer_dom_sid ", ps, depth, &(q_r->buffer_dom_sid)); /* undocumented domain SID buffer pointer */ prs_uint32("buffer_dom_name", ps, depth, &(q_r->buffer_dom_name)); /* undocumented domain name buffer pointer */ + ASSERT_ARRAY(q_r->lookup_name, q_r->num_entries); + for (i = 0; i < q_r->num_entries; i++) { smb_io_dom_name("", &(q_r->lookup_name[i]), ps, depth); /* names to be looked up */ @@ -555,6 +567,8 @@ void lsa_io_r_lookup_rids(char *desc, LSA_R_LOOKUP_RIDS *r_r, prs_struct *ps, i prs_uint32("undoc_buffer", ps, depth, &(r_r->undoc_buffer)); prs_uint32("num_entries2", ps, depth, &(r_r->num_entries2)); + ASSERT_ARRAY(r_r->dom_rid, r_r->num_entries2); + for (i = 0; i < r_r->num_entries2; i++) { smb_io_dom_rid2("", &(r_r->dom_rid[i]), ps, depth); /* domain RIDs being looked up */ diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 1b253beeb9..8a15ae6bb4 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -983,6 +983,9 @@ void make_net_user_info3(NET_USER_INFO_3 *usr, make_unistr2(&(usr->uni_dir_drive ), dir_drive , len_dir_drive ); usr->num_groups2 = num_groups; + + ASSERT_ARRAY(usr->gids, num_groups); + for (i = 0; i < num_groups; i++) { usr->gids[i] = gids[i]; @@ -1057,6 +1060,7 @@ void net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int de prs_align(ps); prs_uint32("num_groups2 ", ps, depth, &(usr->num_groups2)); /* num groups */ + ASSERT_ARRAY(usr->gids, usr->num_groups2); for (i = 0; i < usr->num_groups2; i++) { smb_io_gid("", &(usr->gids[i]), ps, depth); /* group info */ @@ -1067,6 +1071,8 @@ void net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int de smb_io_dom_sid2("", &(usr->dom_sid), ps, depth); /* domain SID */ + ASSERT_ARRAY(usr->other_sids, usr->num_other_sids); + for (i = 0; i < usr->num_other_sids; i++) { smb_io_dom_sid2("", &(usr->other_sids[i]), ps, depth); /* other domain SIDs */ diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 44503ee8c9..b325ed7f18 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -290,6 +290,8 @@ void sam_io_sid_stuff(char *desc, SAM_SID_STUFF *stf, prs_struct *ps, int depth prs_uint32("num_sids ", ps, depth, &(stf->num_sids )); prs_uint16("padding2 ", ps, depth, &(stf->padding2 )); + ASSERT_ARRAY(stf->sid, stf->num_sids); + for (i = 0; i < stf->num_sids; i++) { sam_io_dom_sid3("", &(stf->sid[i]), ps, depth); @@ -735,6 +737,9 @@ void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, r_u->num_entries2 = num_sam_entries; r_u->num_entries3 = num_sam_entries; + ASSERT_ARRAY(r_u->sam, num_sam_entries); + ASSERT_ARRAY(r_u->uni_acct_name, num_sam_entries); + for (i = 0; i < num_sam_entries; i++) { make_sam_entry(&(r_u->sam[i]), @@ -780,12 +785,16 @@ void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struc prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); + ASSERT_ARRAY(r_u->sam, r_u->num_entries2); + for (i = 0; i < r_u->num_entries2; i++) { prs_grow(ps); sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); } + ASSERT_ARRAY(r_u->uni_acct_name, r_u->num_entries2); + for (i = 0; i < r_u->num_entries2; i++) { prs_grow(ps); @@ -867,6 +876,8 @@ void make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, r_u->ptr_entries2 = 1; r_u->num_entries3 = num_sam_entries; + ASSERT_ARRAY(r_u->sam, num_sam_entries); + for (i = 0; i < num_sam_entries; i++) { make_sam_entry(&(r_u->sam[i]), @@ -909,6 +920,8 @@ void samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_s prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); + ASSERT_ARRAY(r_u->sam, r_u->num_entries); + for (i = 0; i < r_u->num_entries; i++) { sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); @@ -1036,6 +1049,8 @@ void sam_io_sam_info_2(char *desc, SAM_INFO_2 *sam, prs_struct *ps, int depth) prs_uint32("num_entries2 ", ps, depth, &(sam->num_entries2 )); + ASSERT_ARRAY(sam->sam, sam->num_entries); + for (i = 0; i < sam->num_entries; i++) { sam_io_sam_entry2("", &(sam->sam[i]), ps, depth); @@ -1117,6 +1132,8 @@ void sam_io_sam_info_1(char *desc, SAM_INFO_1 *sam, prs_struct *ps, int depth) prs_uint32("num_entries2 ", ps, depth, &(sam->num_entries2 )); + ASSERT_ARRAY(sam->sam, sam->num_entries); + for (i = 0; i < sam->num_entries; i++) { sam_io_sam_entry1("", &(sam->sam[i]), ps, depth); @@ -1333,6 +1350,8 @@ void samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_str prs_uint32("num_entries2 ", ps, depth, &(r_u->num_entries2 )); + ASSERT_ARRAY(r_u->sam, r_u->num_entries); + for (i = 0; i < r_u->num_entries; i++) { sam_io_sam_entry3("", &(r_u->sam[i]), ps, depth); @@ -1495,6 +1514,8 @@ void samr_io_q_lookup_ids(char *desc, SAMR_Q_LOOKUP_IDS *q_u, prs_struct *ps, i prs_uint32("ptr ", ps, depth, &(q_u->ptr )); prs_uint32("num_sids2", ps, depth, &(q_u->num_sids2)); + ASSERT_ARRAY(q_u->ptr_sid, q_u->num_sids2); + for (i = 0; i < q_u->num_sids2; i++) { slprintf(tmp, sizeof(tmp) - 1, "ptr[%02d]", i); @@ -1531,6 +1552,8 @@ void make_samr_r_lookup_ids(SAMR_R_LOOKUP_IDS *r_u, r_u->ptr = 1; r_u->num_entries2 = num_rids; + ASSERT_ARRAY(r_u->rid, num_rids); + for (i = 0; i < num_rids; i++) { r_u->rid[i] = rid[i]; @@ -1566,6 +1589,7 @@ void samr_io_r_lookup_ids(char *desc, SAMR_R_LOOKUP_IDS *r_u, prs_struct *ps, i if (r_u->num_entries != 0) { + ASSERT_ARRAY(r_u->rid, r_u->num_entries2); for (i = 0; i < r_u->num_entries2; i++) { @@ -1599,6 +1623,8 @@ void samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *p prs_uint32("ptr ", ps, depth, &(q_u->ptr )); prs_uint32("num_rids2", ps, depth, &(q_u->num_rids2)); + ASSERT_ARRAY(q_u->hdr_user_name, q_u->num_rids2); + for (i = 0; i < q_u->num_rids2; i++) { smb_io_unihdr ("", &(q_u->hdr_user_name[i]), ps, depth); @@ -1629,6 +1655,8 @@ void make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, r_u->undoc_buffer = 1; r_u->num_entries2 = num_rids; + ASSERT_ARRAY(r_u->dom_rid, num_rids); + for (i = 0; i < num_rids; i++) { make_dom_rid3(&(r_u->dom_rid[i]), rid[i]); @@ -1666,6 +1694,8 @@ void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p if (r_u->num_entries != 0) { + ASSERT_ARRAY(r_u->dom_rid, r_u->num_entries2); + for (i = 0; i < r_u->num_entries2; i++) { smb_io_dom_rid3("", &(r_u->dom_rid[i]), ps, depth); @@ -1697,6 +1727,8 @@ void make_samr_q_unknown_12(SAMR_Q_UNKNOWN_12 *q_u, q_u->ptr = 0; q_u->num_gids2 = num_gids; + ASSERT_ARRAY(q_u->gid, num_gids); + for (i = 0; i < num_gids; i++) { q_u->gid[i] = gid[i]; @@ -1726,6 +1758,8 @@ void samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, i prs_uint32("ptr ", ps, depth, &(q_u->ptr )); prs_uint32("num_gids2", ps, depth, &(q_u->num_gids2)); + ASSERT_ARRAY(q_u->gid, q_u->num_gids2); + for (i = 0; i < q_u->num_gids2; i++) { slprintf(tmp, sizeof(tmp) - 1, "gid[%02d] ", i); @@ -1758,6 +1792,8 @@ void make_samr_r_unknown_12(SAMR_R_UNKNOWN_12 *r_u, r_u->ptr_als_usrs = 1; r_u->num_als_usrs2 = num_aliases; + ASSERT_ARRAY(r_u->hdr_als_name, num_aliases); + for (i = 0; i < num_aliases; i++) { int als_len = als_name[i] != NULL ? strlen(als_name[i]) : 0; @@ -1800,6 +1836,8 @@ void samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, i if (r_u->ptr_aliases != 0 && r_u->num_aliases1 != 0) { + ASSERT_ARRAY(r_u->hdr_als_name, r_u->num_aliases2); + for (i = 0; i < r_u->num_aliases2; i++) { slprintf(tmp, sizeof(tmp) - 1, "als_hdr[%02d] ", i); @@ -1820,6 +1858,8 @@ void samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, i if (r_u->ptr_als_usrs != 0 && r_u->num_als_usrs1 != 0) { + ASSERT_ARRAY(r_u->num_als_usrs, r_u->num_als_usrs2); + for (i = 0; i < r_u->num_als_usrs2; i++) { slprintf(tmp, sizeof(tmp) - 1, "als_usrs[%02d] ", i); @@ -1980,6 +2020,8 @@ void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_s { prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + ASSERT_ARRAY(r_u->gid, r_u->num_entries2); + for (i = 0; i < r_u->num_entries2; i++) { smb_io_gid("", &(r_u->gid[i]), ps, depth); diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 72cc34da9e..44e3ef827b 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -114,6 +114,8 @@ void srv_io_srv_share_info_1(char *desc, SRV_SHARE_INFO_1 *ctr, prs_struct *ps, prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2)); + ASSERT_ARRAY(ctr->info_1, num_entries); + for (i = 0; i < num_entries; i++) { prs_grow(ps); @@ -236,6 +238,8 @@ void srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_struct *ps, prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2)); + ASSERT_ARRAY(ctr->info_2, num_entries); + for (i = 0; i < num_entries; i++) { prs_grow(ps); @@ -447,6 +451,8 @@ void srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, i prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2)); + ASSERT_ARRAY(ss0->info_0, num_entries); + for (i = 0; i < num_entries; i++) { prs_grow(ps); @@ -560,6 +566,8 @@ void srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, i prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2)); + ASSERT_ARRAY(ss1->info_1, num_entries); + for (i = 0; i < num_entries; i++) { prs_grow(ps); -- cgit From 8afc9c80ac11649f06e5517d819dbf201c941acb Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 24 Aug 1998 21:49:10 +0000 Subject: Changed ASSERT macros to SMB_ASSERT macros as some systems already have an ASSERT macro defined. Jeremy. (This used to be commit dbe6ad014a8b5dcbf17d7cd9865650c2e040d666) --- source3/rpc_parse/parse_lsa.c | 14 +++++++------- source3/rpc_parse/parse_net.c | 6 +++--- source3/rpc_parse/parse_samr.c | 44 +++++++++++++++++++++--------------------- source3/rpc_parse/parse_srv.c | 8 ++++---- 4 files changed, 36 insertions(+), 36 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 272e76eefe..638222590d 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -82,7 +82,7 @@ void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) smb_io_unihdr2("", &(r_r->hdr_dom_name), ps, depth); /* domain name unicode string header */ - ASSERT_ARRAY(r_r->hdr_ref_dom, r_r->num_ref_doms_1-1); + SMB_ASSERT_ARRAY(r_r->hdr_ref_dom, r_r->num_ref_doms_1-1); for (i = 0; i < r_r->num_ref_doms_1-1; i++) { @@ -91,7 +91,7 @@ void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) smb_io_unistr("", &(r_r->uni_dom_name), ps, depth); /* domain name unicode string */ - ASSERT_ARRAY(r_r->ref_dom, r_r->num_ref_doms_2); + SMB_ASSERT_ARRAY(r_r->ref_dom, r_r->num_ref_doms_2); for (i = 0; i < r_r->num_ref_doms_2; i++) { @@ -417,7 +417,7 @@ void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) prs_uint32("ptr_sid_enum", ps, depth, &(sen->ptr_sid_enum)); prs_uint32("num_entries2", ps, depth, &(sen->num_entries2)); - ASSERT_ARRAY(sen->ptr_sid, sen->num_entries); + SMB_ASSERT_ARRAY(sen->ptr_sid, sen->num_entries); for (i = 0; i < sen->num_entries; i++) { @@ -426,7 +426,7 @@ void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) prs_uint32(temp, ps, depth, &(sen->ptr_sid[i])); /* domain SID pointers to be looked up. */ } - ASSERT_ARRAY(sen->sid, sen->num_entries); + SMB_ASSERT_ARRAY(sen->sid, sen->num_entries); for (i = 0; i < sen->num_entries; i++) { @@ -475,7 +475,7 @@ void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, in prs_uint32("ptr_trans_names", ps, depth, &(trn->ptr_trans_names)); prs_uint32("num_entries2 ", ps, depth, &(trn->num_entries2)); - ASSERT_ARRAY(trn->ptr_name, trn->num_entries); + SMB_ASSERT_ARRAY(trn->ptr_name, trn->num_entries); for (i = 0; i < trn->num_entries; i++) { @@ -537,7 +537,7 @@ void lsa_io_q_lookup_rids(char *desc, LSA_Q_LOOKUP_RIDS *q_r, prs_struct *ps, i prs_uint32("buffer_dom_sid ", ps, depth, &(q_r->buffer_dom_sid)); /* undocumented domain SID buffer pointer */ prs_uint32("buffer_dom_name", ps, depth, &(q_r->buffer_dom_name)); /* undocumented domain name buffer pointer */ - ASSERT_ARRAY(q_r->lookup_name, q_r->num_entries); + SMB_ASSERT_ARRAY(q_r->lookup_name, q_r->num_entries); for (i = 0; i < q_r->num_entries; i++) { @@ -567,7 +567,7 @@ void lsa_io_r_lookup_rids(char *desc, LSA_R_LOOKUP_RIDS *r_r, prs_struct *ps, i prs_uint32("undoc_buffer", ps, depth, &(r_r->undoc_buffer)); prs_uint32("num_entries2", ps, depth, &(r_r->num_entries2)); - ASSERT_ARRAY(r_r->dom_rid, r_r->num_entries2); + SMB_ASSERT_ARRAY(r_r->dom_rid, r_r->num_entries2); for (i = 0; i < r_r->num_entries2; i++) { diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 8a15ae6bb4..744bd455c9 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -984,7 +984,7 @@ void make_net_user_info3(NET_USER_INFO_3 *usr, usr->num_groups2 = num_groups; - ASSERT_ARRAY(usr->gids, num_groups); + SMB_ASSERT_ARRAY(usr->gids, num_groups); for (i = 0; i < num_groups; i++) { @@ -1060,7 +1060,7 @@ void net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int de prs_align(ps); prs_uint32("num_groups2 ", ps, depth, &(usr->num_groups2)); /* num groups */ - ASSERT_ARRAY(usr->gids, usr->num_groups2); + SMB_ASSERT_ARRAY(usr->gids, usr->num_groups2); for (i = 0; i < usr->num_groups2; i++) { smb_io_gid("", &(usr->gids[i]), ps, depth); /* group info */ @@ -1071,7 +1071,7 @@ void net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int de smb_io_dom_sid2("", &(usr->dom_sid), ps, depth); /* domain SID */ - ASSERT_ARRAY(usr->other_sids, usr->num_other_sids); + SMB_ASSERT_ARRAY(usr->other_sids, usr->num_other_sids); for (i = 0; i < usr->num_other_sids; i++) { diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index b325ed7f18..8f20a257ce 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -290,7 +290,7 @@ void sam_io_sid_stuff(char *desc, SAM_SID_STUFF *stf, prs_struct *ps, int depth prs_uint32("num_sids ", ps, depth, &(stf->num_sids )); prs_uint16("padding2 ", ps, depth, &(stf->padding2 )); - ASSERT_ARRAY(stf->sid, stf->num_sids); + SMB_ASSERT_ARRAY(stf->sid, stf->num_sids); for (i = 0; i < stf->num_sids; i++) { @@ -737,8 +737,8 @@ void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, r_u->num_entries2 = num_sam_entries; r_u->num_entries3 = num_sam_entries; - ASSERT_ARRAY(r_u->sam, num_sam_entries); - ASSERT_ARRAY(r_u->uni_acct_name, num_sam_entries); + SMB_ASSERT_ARRAY(r_u->sam, num_sam_entries); + SMB_ASSERT_ARRAY(r_u->uni_acct_name, num_sam_entries); for (i = 0; i < num_sam_entries; i++) { @@ -785,7 +785,7 @@ void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struc prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); - ASSERT_ARRAY(r_u->sam, r_u->num_entries2); + SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries2); for (i = 0; i < r_u->num_entries2; i++) { @@ -793,7 +793,7 @@ void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struc sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); } - ASSERT_ARRAY(r_u->uni_acct_name, r_u->num_entries2); + SMB_ASSERT_ARRAY(r_u->uni_acct_name, r_u->num_entries2); for (i = 0; i < r_u->num_entries2; i++) { @@ -876,7 +876,7 @@ void make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, r_u->ptr_entries2 = 1; r_u->num_entries3 = num_sam_entries; - ASSERT_ARRAY(r_u->sam, num_sam_entries); + SMB_ASSERT_ARRAY(r_u->sam, num_sam_entries); for (i = 0; i < num_sam_entries; i++) { @@ -920,7 +920,7 @@ void samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_s prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); - ASSERT_ARRAY(r_u->sam, r_u->num_entries); + SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries); for (i = 0; i < r_u->num_entries; i++) { @@ -1049,7 +1049,7 @@ void sam_io_sam_info_2(char *desc, SAM_INFO_2 *sam, prs_struct *ps, int depth) prs_uint32("num_entries2 ", ps, depth, &(sam->num_entries2 )); - ASSERT_ARRAY(sam->sam, sam->num_entries); + SMB_ASSERT_ARRAY(sam->sam, sam->num_entries); for (i = 0; i < sam->num_entries; i++) { @@ -1132,7 +1132,7 @@ void sam_io_sam_info_1(char *desc, SAM_INFO_1 *sam, prs_struct *ps, int depth) prs_uint32("num_entries2 ", ps, depth, &(sam->num_entries2 )); - ASSERT_ARRAY(sam->sam, sam->num_entries); + SMB_ASSERT_ARRAY(sam->sam, sam->num_entries); for (i = 0; i < sam->num_entries; i++) { @@ -1350,7 +1350,7 @@ void samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_str prs_uint32("num_entries2 ", ps, depth, &(r_u->num_entries2 )); - ASSERT_ARRAY(r_u->sam, r_u->num_entries); + SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries); for (i = 0; i < r_u->num_entries; i++) { @@ -1514,7 +1514,7 @@ void samr_io_q_lookup_ids(char *desc, SAMR_Q_LOOKUP_IDS *q_u, prs_struct *ps, i prs_uint32("ptr ", ps, depth, &(q_u->ptr )); prs_uint32("num_sids2", ps, depth, &(q_u->num_sids2)); - ASSERT_ARRAY(q_u->ptr_sid, q_u->num_sids2); + SMB_ASSERT_ARRAY(q_u->ptr_sid, q_u->num_sids2); for (i = 0; i < q_u->num_sids2; i++) { @@ -1552,7 +1552,7 @@ void make_samr_r_lookup_ids(SAMR_R_LOOKUP_IDS *r_u, r_u->ptr = 1; r_u->num_entries2 = num_rids; - ASSERT_ARRAY(r_u->rid, num_rids); + SMB_ASSERT_ARRAY(r_u->rid, num_rids); for (i = 0; i < num_rids; i++) { @@ -1589,7 +1589,7 @@ void samr_io_r_lookup_ids(char *desc, SAMR_R_LOOKUP_IDS *r_u, prs_struct *ps, i if (r_u->num_entries != 0) { - ASSERT_ARRAY(r_u->rid, r_u->num_entries2); + SMB_ASSERT_ARRAY(r_u->rid, r_u->num_entries2); for (i = 0; i < r_u->num_entries2; i++) { @@ -1623,7 +1623,7 @@ void samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *p prs_uint32("ptr ", ps, depth, &(q_u->ptr )); prs_uint32("num_rids2", ps, depth, &(q_u->num_rids2)); - ASSERT_ARRAY(q_u->hdr_user_name, q_u->num_rids2); + SMB_ASSERT_ARRAY(q_u->hdr_user_name, q_u->num_rids2); for (i = 0; i < q_u->num_rids2; i++) { @@ -1655,7 +1655,7 @@ void make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, r_u->undoc_buffer = 1; r_u->num_entries2 = num_rids; - ASSERT_ARRAY(r_u->dom_rid, num_rids); + SMB_ASSERT_ARRAY(r_u->dom_rid, num_rids); for (i = 0; i < num_rids; i++) { @@ -1694,7 +1694,7 @@ void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p if (r_u->num_entries != 0) { - ASSERT_ARRAY(r_u->dom_rid, r_u->num_entries2); + SMB_ASSERT_ARRAY(r_u->dom_rid, r_u->num_entries2); for (i = 0; i < r_u->num_entries2; i++) { @@ -1727,7 +1727,7 @@ void make_samr_q_unknown_12(SAMR_Q_UNKNOWN_12 *q_u, q_u->ptr = 0; q_u->num_gids2 = num_gids; - ASSERT_ARRAY(q_u->gid, num_gids); + SMB_ASSERT_ARRAY(q_u->gid, num_gids); for (i = 0; i < num_gids; i++) { @@ -1758,7 +1758,7 @@ void samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, i prs_uint32("ptr ", ps, depth, &(q_u->ptr )); prs_uint32("num_gids2", ps, depth, &(q_u->num_gids2)); - ASSERT_ARRAY(q_u->gid, q_u->num_gids2); + SMB_ASSERT_ARRAY(q_u->gid, q_u->num_gids2); for (i = 0; i < q_u->num_gids2; i++) { @@ -1792,7 +1792,7 @@ void make_samr_r_unknown_12(SAMR_R_UNKNOWN_12 *r_u, r_u->ptr_als_usrs = 1; r_u->num_als_usrs2 = num_aliases; - ASSERT_ARRAY(r_u->hdr_als_name, num_aliases); + SMB_ASSERT_ARRAY(r_u->hdr_als_name, num_aliases); for (i = 0; i < num_aliases; i++) { @@ -1836,7 +1836,7 @@ void samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, i if (r_u->ptr_aliases != 0 && r_u->num_aliases1 != 0) { - ASSERT_ARRAY(r_u->hdr_als_name, r_u->num_aliases2); + SMB_ASSERT_ARRAY(r_u->hdr_als_name, r_u->num_aliases2); for (i = 0; i < r_u->num_aliases2; i++) { @@ -1858,7 +1858,7 @@ void samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, i if (r_u->ptr_als_usrs != 0 && r_u->num_als_usrs1 != 0) { - ASSERT_ARRAY(r_u->num_als_usrs, r_u->num_als_usrs2); + SMB_ASSERT_ARRAY(r_u->num_als_usrs, r_u->num_als_usrs2); for (i = 0; i < r_u->num_als_usrs2; i++) { @@ -2020,7 +2020,7 @@ void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_s { prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); - ASSERT_ARRAY(r_u->gid, r_u->num_entries2); + SMB_ASSERT_ARRAY(r_u->gid, r_u->num_entries2); for (i = 0; i < r_u->num_entries2; i++) { diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 44e3ef827b..a66699b95c 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -114,7 +114,7 @@ void srv_io_srv_share_info_1(char *desc, SRV_SHARE_INFO_1 *ctr, prs_struct *ps, prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2)); - ASSERT_ARRAY(ctr->info_1, num_entries); + SMB_ASSERT_ARRAY(ctr->info_1, num_entries); for (i = 0; i < num_entries; i++) { @@ -238,7 +238,7 @@ void srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_struct *ps, prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2)); - ASSERT_ARRAY(ctr->info_2, num_entries); + SMB_ASSERT_ARRAY(ctr->info_2, num_entries); for (i = 0; i < num_entries; i++) { @@ -451,7 +451,7 @@ void srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, i prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2)); - ASSERT_ARRAY(ss0->info_0, num_entries); + SMB_ASSERT_ARRAY(ss0->info_0, num_entries); for (i = 0; i < num_entries; i++) { @@ -566,7 +566,7 @@ void srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, i prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2)); - ASSERT_ARRAY(ss1->info_1, num_entries); + SMB_ASSERT_ARRAY(ss1->info_1, num_entries); for (i = 0; i < num_entries; i++) { -- cgit From 61b5fd6f32e9ccb612df1354a3e3b3bed5f2b808 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 31 Aug 1998 03:11:42 +0000 Subject: bounds check next_token() to prevent possible buffer overflows (This used to be commit 3eade55dc7c842bdc50205c330802d211fae54d3) --- source3/rpc_parse/parse_net.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 744bd455c9..182b3495db 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -558,7 +558,9 @@ static int make_dom_sid2s(char *sids_str, DOM_SID2 *sids, int max_sids) if (sids_str == NULL || *sids_str == 0) return 0; - for (count = 0, ptr = sids_str; next_token(&ptr, s2, NULL) && count < max_sids; count++) + for (count = 0, ptr = sids_str; + next_token(&ptr, s2, NULL, sizeof(s2)) && count < max_sids; + count++) { DOM_SID tmpsid; string_to_sid(&tmpsid, s2); -- cgit From ea1cd3fbd727c338aae9c98e8a383e0d81142f60 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 3 Sep 1998 05:35:13 +0000 Subject: we were setting the strings 1 too long in make_srv_share_info1_str() (This used to be commit 29e1e59db8035e0fd2c088a969fa17549ce1b897) --- source3/rpc_parse/parse_srv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index a66699b95c..356b515f19 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -37,8 +37,8 @@ void make_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark) DEBUG(5,("make_srv_share_info1_str\n")); - make_unistr2(&(sh1->uni_netname), net_name, strlen(net_name)+1); - make_unistr2(&(sh1->uni_remark ), remark , strlen(remark )+1); + make_unistr2(&(sh1->uni_netname), net_name, strlen(net_name)); + make_unistr2(&(sh1->uni_remark ), remark , strlen(remark )); } /******************************************************************* -- cgit From e9ea36e4d2270bd7d32da12ef6d6e2299641582d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 5 Sep 1998 05:07:05 +0000 Subject: tridge the destroyer returns! prompted by the interpret_security() dead code that Jean-Francois pointed out I added a make target "finddead" that finds potentially dead (ie. unused) code. It spat out 304 function names ... I went through these are deleted many of them, making others static (finddead also reports functions that are used only in the local file). in doing this I have almost certainly deleted some useful code. I may have even prevented compilation with some compile options. I apologise. I decided it was better to get rid of this code now and add back the one or two functions that are needed than to keep all this baggage. So, if I have done a bit too much "destroying" then let me know. Keep the swearing to a minimum :) One bit I didn't do is the ubibt code. Chris, can you look at that? Heaps of unused functions there. Can they be made static? (This used to be commit 2204475c87f3024ea8fd1fbd7385b2def617a46f) --- source3/rpc_parse/parse_lsa.c | 113 +------- source3/rpc_parse/parse_misc.c | 57 ++-- source3/rpc_parse/parse_net.c | 135 +-------- source3/rpc_parse/parse_prs.c | 14 - source3/rpc_parse/parse_reg.c | 71 ----- source3/rpc_parse/parse_rpc.c | 38 +-- source3/rpc_parse/parse_samr.c | 628 ++--------------------------------------- source3/rpc_parse/parse_srv.c | 239 ++-------------- source3/rpc_parse/parse_wks.c | 16 +- 9 files changed, 93 insertions(+), 1218 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 638222590d..0818057d48 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -26,6 +26,7 @@ extern int DEBUGLEVEL; +static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth); /******************************************************************* creates a LSA_TRANS_NAME structure. @@ -43,7 +44,7 @@ void make_lsa_trans_name(LSA_TRANS_NAME *trn, uint32 sid_name_use, char *name, u /******************************************************************* reads or writes a LSA_TRANS_NAME structure. ********************************************************************/ -void lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, int depth) +static void lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, int depth) { if (trn == NULL) return; @@ -63,7 +64,7 @@ void lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, int dept /******************************************************************* reads or writes a DOM_R_REF structure. ********************************************************************/ -void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) +static void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) { int i; @@ -99,27 +100,11 @@ void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) } } -/******************************************************************* -makes an LSA_OBJ_ATTR structure. -********************************************************************/ -void make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, uint32 sec_qos) -{ - if (attr == NULL) return; - - DEBUG(5,("make_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; - attr->sec_qos = sec_qos; -} /******************************************************************* reads or writes an LSA_OBJ_ATTR structure. ********************************************************************/ -void lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int depth) +static void lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int depth) { int start; @@ -148,24 +133,6 @@ void lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int depth) attr->len, ps->offset - start)); } } -/******************************************************************* -makes an LSA_Q_OPEN_POL structure. -********************************************************************/ -void make_q_open_pol(LSA_Q_OPEN_POL *r_q, char *server_name, - uint32 attributes, uint32 sec_qos, - uint32 desired_access) -{ - if (r_q == NULL) return; - - DEBUG(5,("make_open_pol\n")); - - r_q->ptr = 1; /* undocumented pointer */ - - make_unistr2 (&(r_q->uni_server_name), server_name, strlen(server_name)); - make_lsa_obj_attr(&(r_q->attr ), attributes, sec_qos); - - r_q->des_access = desired_access; -} /******************************************************************* reads or writes an LSA_Q_OPEN_POL structure. @@ -201,20 +168,6 @@ void lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int dep prs_uint32("status", ps, depth, &(r_p->status)); } -/******************************************************************* -makes an LSA_Q_QUERY_INFO structure. -********************************************************************/ -void make_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class) -{ - if (q_q == NULL || hnd == NULL) return; - - DEBUG(5,("make_q_query\n")); - - memcpy(&(q_q->pol), hnd, sizeof(q_q->pol)); - - q_q->info_class = info_class; -} - /******************************************************************* reads or writes an LSA_Q_QUERY_INFO structure. ********************************************************************/ @@ -306,60 +259,6 @@ void lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct prs_uint32("status", ps, depth, &(r_e->status)); } -/******************************************************************* -makes an LSA_Q_CLOSE structure. -********************************************************************/ -void make_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd) -{ - if (q_c == NULL || hnd == NULL) return; - - DEBUG(5,("make_lsa_q_close\n")); - - memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); -} - - -/******************************************************************* -reads or writes an LSA_Q_CLOSE structure. -********************************************************************/ -void lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth) -{ - if (q_c == NULL) return; - - prs_debug(ps, depth, desc, "lsa_io_q_close"); - depth++; - - smb_io_pol_hnd("", &(q_c->pol), ps, depth); -} - -/******************************************************************* -makes an LSA_R_CLOSE structure. -********************************************************************/ -void make_lsa_r_close(LSA_R_CLOSE *q_r, POLICY_HND *hnd) -{ - if (q_r == NULL || hnd == NULL) return; - - DEBUG(5,("make_lsa_r_close\n")); - - memcpy(&(q_r->pol), hnd, sizeof(q_r->pol)); -} - - -/******************************************************************* -reads or writes an LSA_R_CLOSE structure. -********************************************************************/ -void lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth) -{ - if (r_c == NULL) return; - - prs_debug(ps, depth, desc, "lsa_io_r_close"); - depth++; - - smb_io_pol_hnd("", &(r_c->pol), ps, depth); - - prs_uint32("status", ps, depth, &(r_c->status)); -} - /******************************************************************* reads or writes an LSA_Q_QUERY_INFO structure. ********************************************************************/ @@ -402,7 +301,7 @@ void lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int dept /******************************************************************* reads or writes a LSA_SID_ENUM structure. ********************************************************************/ -void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) +static void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) { int i; @@ -459,7 +358,7 @@ void lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, in /******************************************************************* reads or writes a structure. ********************************************************************/ -void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth) +static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth) { int i; int i2; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 3c83382f0c..3749827860 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -32,7 +32,7 @@ extern int DEBUGLEVEL; /******************************************************************* reads or writes a UTIME type. ********************************************************************/ -void smb_io_utime(char *desc, UTIME *t, prs_struct *ps, int depth) +static void smb_io_utime(char *desc, UTIME *t, prs_struct *ps, int depth) { if (t == NULL) return; @@ -541,27 +541,11 @@ void make_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid) rid4->rid = rid; } -/******************************************************************* -reads or writes a DOM_RID4 structure. -********************************************************************/ -void smb_io_dom_rid4(char *desc, DOM_RID4 *rid4, prs_struct *ps, int depth) -{ - if (rid4 == NULL) return; - - prs_debug(ps, depth, desc, "smb_io_dom_rid4. XXXX !check size of unknown! XXXX"); - depth++; - - prs_align(ps); - - prs_uint32("unknown", ps, depth, &(rid4->unknown)); - prs_uint16("attr ", ps, depth, &(rid4->attr )); - prs_uint32("rid ", ps, depth, &(rid4->rid )); -} /******************************************************************* makes a DOM_CLNT_SRV structure. ********************************************************************/ -void make_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) +static void make_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) { if (log == NULL) return; @@ -591,7 +575,7 @@ void make_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) /******************************************************************* reads or writes a DOM_CLNT_SRV structure. ********************************************************************/ -void smb_io_clnt_srv(char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth) +static void smb_io_clnt_srv(char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth) { if (log == NULL) return; @@ -861,23 +845,7 @@ void smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth) /******************************************************************* reads or writes a dom query structure. ********************************************************************/ -void smb_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) -{ - smb_io_dom_query("", d_q, ps, depth); -} - -/******************************************************************* -reads or writes a dom query structure. -********************************************************************/ -void smb_io_dom_query_5(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) -{ - smb_io_dom_query("", d_q, ps, depth); -} - -/******************************************************************* -reads or writes a dom query structure. -********************************************************************/ -void smb_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth) +static void smb_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth) { if (d_q == NULL) return; @@ -904,6 +872,23 @@ void smb_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth) } } +/******************************************************************* +reads or writes a dom query structure. +********************************************************************/ +void smb_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) +{ + smb_io_dom_query("", d_q, ps, depth); +} + +/******************************************************************* +reads or writes a dom query structure. +********************************************************************/ +void smb_io_dom_query_5(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) +{ + smb_io_dom_query("", d_q, ps, depth); +} + + /******************************************************************* reads or writes a DOM_NAME structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 182b3495db..12d6aca264 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -29,7 +29,7 @@ extern int DEBUGLEVEL; /******************************************************************* reads or writes a structure. ********************************************************************/ -void net_io_neg_flags(char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth) +static void net_io_neg_flags(char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth) { if (neg == NULL) return; @@ -44,7 +44,7 @@ void net_io_neg_flags(char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth) /******************************************************************* creates a NETLOGON_INFO_3 structure. ********************************************************************/ -void make_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_attempts) +static void make_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_attempts) { info->flags = flags; info->logon_attempts = logon_attempts; @@ -58,7 +58,7 @@ void make_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_attempts) /******************************************************************* reads or writes a NETLOGON_INFO_3 structure. ********************************************************************/ -void net_io_netinfo_3(char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int depth) +static void net_io_netinfo_3(char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int depth) { if (info == NULL) return; @@ -80,7 +80,7 @@ void net_io_netinfo_3(char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int de /******************************************************************* creates a NETLOGON_INFO_1 structure. ********************************************************************/ -void make_netinfo_1(NETLOGON_INFO_1 *info, uint32 flags, uint32 pdc_status) +static void make_netinfo_1(NETLOGON_INFO_1 *info, uint32 flags, uint32 pdc_status) { info->flags = flags; info->pdc_status = pdc_status; @@ -89,7 +89,7 @@ void make_netinfo_1(NETLOGON_INFO_1 *info, uint32 flags, uint32 pdc_status) /******************************************************************* reads or writes a NETLOGON_INFO_1 structure. ********************************************************************/ -void net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth) +static void net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth) { if (info == NULL) return; @@ -105,7 +105,7 @@ void net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int de /******************************************************************* creates a NETLOGON_INFO_2 structure. ********************************************************************/ -void make_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, +static void make_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, uint32 tc_status, char *trusted_dc_name) { int len_dc_name = strlen(trusted_dc_name); @@ -127,7 +127,7 @@ void make_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, /******************************************************************* reads or writes a NETLOGON_INFO_2 structure. ********************************************************************/ -void net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth) +static void net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth) { if (info == NULL) return; @@ -149,24 +149,6 @@ void net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int de prs_align(ps); } -/******************************************************************* -makes an NET_Q_LOGON_CTRL2 structure. -********************************************************************/ -void make_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, char *server_name, - uint32 function_code) -{ - if (q_l == NULL) return; - - DEBUG(5,("make_q_logon_ctrl2\n")); - - q_l->ptr = 1; /* undocumented pointer */ - make_unistr2 (&(q_l->uni_server_name), server_name, strlen(server_name)); - - q_l->function_code = function_code; /* should only be 0x1 */ - q_l->query_level = function_code; /* should only be 0x1 */ - q_l->switch_value = function_code; /* should only be 0x1 */ -} - /******************************************************************* reads or writes an NET_Q_LOGON_CTRL2 structure. ********************************************************************/ @@ -340,20 +322,6 @@ void net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, prs_uint32("status", ps, depth, &(r_t->status)); } -/******************************************************************* -makes an NET_Q_TRUST_DOM_LIST structure. -********************************************************************/ -void make_q_trust_dom(NET_Q_TRUST_DOM_LIST *q_l, char *server_name, - uint32 function_code) -{ - if (q_l == NULL) return; - - DEBUG(5,("make_q_trust_dom\n")); - - make_unistr2 (&(q_l->uni_server_name), server_name, strlen(server_name)); - - q_l->function_code = function_code; /* should only be 0x31 */ -} /******************************************************************* reads or writes an NET_Q_TRUST_DOM_LIST structure. @@ -570,89 +538,10 @@ static int make_dom_sid2s(char *sids_str, DOM_SID2 *sids, int max_sids) return count; } -/******************************************************************* -makes a NET_ID_INFO_1 structure. - -This is an interactive 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 passes the actual NT and LM hashed passwords -over the secure channel. This is not the preferred logon -method from a Samba domain client as it exposes the password -hashes to anyone who has compromised the secure channel. JRA. -********************************************************************/ - -void make_id_info1(NET_ID_INFO_1 *id, char *domain_name, - uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, - char *user_name, char *wksta_name, - char sess_key[16], - unsigned char lm_cypher[16], unsigned char nt_cypher[16]) -{ - int len_domain_name = strlen(domain_name); - int len_user_name = strlen(user_name ); - int len_wksta_name = strlen(wksta_name ); - - unsigned char lm_owf[16]; - unsigned char nt_owf[16]; - - if (id == NULL) return; - - DEBUG(5,("make_id_info1: %d\n", __LINE__)); - - id->ptr_id_info1 = 1; - - make_uni_hdr(&(id->hdr_domain_name), len_domain_name, len_domain_name, 4); - - id->param_ctrl = param_ctrl; - make_logon_id(&(id->logon_id), log_id_low, log_id_high); - - make_uni_hdr(&(id->hdr_user_name ), len_user_name , len_user_name , 4); - make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name , len_wksta_name , 4); - - if (lm_cypher && nt_cypher) - { - void arcfour(uint8 key[16], uint8 out[16], uint8 in[16]); - unsigned char owf_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 - - memcpy(owf_key, sess_key, 16); - - memcpy(lm_owf, lm_cypher, 16); - memcpy(nt_owf, nt_cypher, 16); - SamOEMhash(lm_owf, owf_key, False); - SamOEMhash(nt_owf, owf_key, False); - -#ifdef DEBUG_PASSWORD - DEBUG(100,("hash of lm owf password:")); - dump_data(100, lm_owf, 16); - - DEBUG(100,("hash of nt owf password:")); - dump_data(100, nt_owf, 16); -#endif - /* set up pointers to blocks */ - lm_cypher = lm_owf; - nt_cypher = nt_owf; - } - - make_owf_info(&(id->lm_owf), lm_cypher); - make_owf_info(&(id->nt_owf), nt_cypher); - - make_unistr2(&(id->uni_domain_name), domain_name, len_domain_name); - make_unistr2(&(id->uni_user_name ), user_name , len_user_name ); - make_unistr2(&(id->uni_wksta_name ), wksta_name , len_wksta_name ); -} - /******************************************************************* reads or writes an NET_ID_INFO_1 structure. ********************************************************************/ -void net_io_id_info1(char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth) +static void net_io_id_info1(char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth) { if (id == NULL) return; @@ -754,7 +643,7 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name, /******************************************************************* reads or writes an NET_ID_INFO_2 structure. ********************************************************************/ -void net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int depth) +static void net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int depth) { if (id == NULL) return; @@ -821,7 +710,7 @@ void make_sam_info(DOM_SAM_INFO *sam, /******************************************************************* reads or writes a DOM_SAM_INFO structure. ********************************************************************/ -void net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR *ctr, prs_struct *ps, int depth) +static void net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return; @@ -856,7 +745,7 @@ void net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR *ctr, prs_struct *ps, int d /******************************************************************* reads or writes a DOM_SAM_INFO structure. ********************************************************************/ -void smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int depth) +static void smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int depth) { if (sam == NULL) return; @@ -1004,7 +893,7 @@ void make_net_user_info3(NET_USER_INFO_3 *usr, /******************************************************************* reads or writes a structure. ********************************************************************/ -void net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth) +static void net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth) { int i; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index ad05831229..024ac88b18 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -147,20 +147,6 @@ BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *dat return True; } -/****************************************************************** - stream an array of uint16s. length is number of uint16s - ********************************************************************/ -BOOL prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len) -{ - char *q = mem_data(&(ps->data), ps->offset); - if (q == NULL) return False; - - DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, data16s, len) - ps->offset += len * sizeof(uint16); - - return True; -} - /****************************************************************** stream an array of uint32s. length is number of uint32s ********************************************************************/ diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index dec5110b41..6b464645e5 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -27,18 +27,6 @@ extern int DEBUGLEVEL; -/******************************************************************* -creates a structure. -********************************************************************/ -void make_reg_q_open_policy(REG_Q_OPEN_POLICY *r_q, - uint16 unknown_0, uint32 level, uint16 unknown_1) -{ - r_q->ptr = 1; - r_q->unknown_0 = unknown_0; - r_q->level = level; - r_q->unknown_1 = unknown_1; -} - /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -61,18 +49,6 @@ void reg_io_q_open_policy(char *desc, REG_Q_OPEN_POLICY *r_q, prs_struct *ps, i } -/******************************************************************* -creates a structure. -********************************************************************/ -void make_reg_r_open_policy(REG_R_OPEN_POLICY *r_r, - POLICY_HND *pol, uint32 status) -{ - if (r_r == NULL) return; - - memcpy(&(r_r->pol), pol, sizeof(r_r->pol)); - r_r->status = status; -} - /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -124,34 +100,6 @@ void reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) prs_uint32("status", ps, depth, &(r_u->status)); } -/******************************************************************* -creates a structure. -********************************************************************/ -void make_reg_q_info(REG_Q_INFO *r_q, - POLICY_HND *pol, char *product_type, - NTTIME *prod_time, uint8 major_version, uint8 minor_version, - uint32 unknown) -{ - int type_len = strlen(product_type); - - memcpy(&(r_q->pol), pol, sizeof(r_q->pol)); - make_uni_hdr(&(r_q->hdr_type), type_len, type_len, 1); - make_unistr2(&(r_q->uni_type), product_type, type_len); - - r_q->ptr1 = 1; - memcpy(&(r_q->time), prod_time, sizeof(r_q->time)); - r_q->major_version1 = major_version; - r_q->minor_version1 = minor_version; - bzero(r_q->pad1, sizeof(r_q->pad1)); - - r_q->ptr2 = 1; - r_q->major_version2 = major_version; - r_q->minor_version2 = minor_version; - bzero(r_q->pad2, sizeof(r_q->pad2)); - - r_q->ptr3 = 1; - r_q->unknown = unknown; -} /******************************************************************* reads or writes a structure. @@ -263,25 +211,6 @@ void reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) } -/******************************************************************* -creates a structure. -********************************************************************/ -void make_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, - POLICY_HND *pol, char *name, - uint32 unknown_0, uint32 unknown_1, uint16 unknown_2) -{ - int len_name = strlen(name); - - memcpy(&(r_q->pol), pol, sizeof(r_q->pol)); - - make_uni_hdr(&(r_q->hdr_name), len_name, len_name, 1); - make_unistr2(&(r_q->uni_name), name, len_name); - - r_q->unknown_0 = unknown_0; - r_q->unknown_1 = unknown_1; - r_q->unknown_2 = unknown_2; -} - /******************************************************************* reads or writes a structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 8a5b6c172e..ac01e7f0b1 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -183,21 +183,10 @@ void smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) prs_uint32("call_id ", ps, depth, &(rpc->call_id)); } -/******************************************************************* -creates an RPC_IFACE structure. -********************************************************************/ -void make_rpc_iface(RPC_IFACE *ifc, char data[16], uint32 version) -{ - if (ifc == NULL || data == NULL) return; - - memcpy(ifc->data, data, sizeof(ifc->data)); /* 16 bytes of number */ - ifc->version = version; /* the interface number */ -} - /******************************************************************* reads or writes an RPC_IFACE structure. ********************************************************************/ -void smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) +static void smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) { if (ifc == NULL) return; @@ -213,7 +202,7 @@ void smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) /******************************************************************* creates an RPC_ADDR_STR structure. ********************************************************************/ -void make_rpc_addr_str(RPC_ADDR_STR *str, char *name) +static void make_rpc_addr_str(RPC_ADDR_STR *str, char *name) { if (str == NULL || name == NULL) return; @@ -224,7 +213,7 @@ void make_rpc_addr_str(RPC_ADDR_STR *str, char *name) /******************************************************************* reads or writes an RPC_ADDR_STR structure. ********************************************************************/ -void smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) +static void smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) { if (str == NULL) return; @@ -239,7 +228,7 @@ void smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int dep /******************************************************************* creates an RPC_HDR_BBA structure. ********************************************************************/ -void make_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid) +static void make_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid) { if (bba == NULL) return; @@ -251,7 +240,7 @@ void make_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint /******************************************************************* reads or writes an RPC_HDR_BBA structure. ********************************************************************/ -void smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) +static void smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return; @@ -312,7 +301,7 @@ creates an RPC_RESULTS structure. lkclXXXX only one reason at the moment! ********************************************************************/ -void make_rpc_results(RPC_RESULTS *res, +static void make_rpc_results(RPC_RESULTS *res, uint8 num_results, uint16 result, uint16 reason) { if (res == NULL) return; @@ -328,7 +317,7 @@ reads or writes an RPC_RESULTS structure. lkclXXXX only one reason at the moment! ********************************************************************/ -void smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) +static void smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) { if (res == NULL) return; @@ -410,19 +399,6 @@ void smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth prs_uint16("opnum ", ps, depth, &(rpc->opnum)); } -/******************************************************************* -creates an RPC_HDR_RESP structure. -********************************************************************/ -void make_rpc_hdr_resp(RPC_HDR_RESP *hdr, uint32 data_len) -{ - if (hdr == NULL) return; - - hdr->alloc_hint = data_len - 0x18; /* allocation hint */ - hdr->context_id = 0; /* presentation context identifier */ - hdr->cancel_count = 0; /* cancel count */ - hdr->reserved = 0; /* 0 - reserved */ -} - /******************************************************************* reads or writes an RPC_HDR_RESP structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 8f20a257ce..71eb8a37dd 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -27,18 +27,6 @@ extern int DEBUGLEVEL; -/******************************************************************* -makes a SAMR_Q_CLOSE_HND structure. -********************************************************************/ -void make_samr_q_close_hnd(SAMR_Q_CLOSE_HND *q_c, POLICY_HND *hnd) -{ - if (q_c == NULL || hnd == NULL) return; - - DEBUG(5,("make_samr_q_close_hnd\n")); - - memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); -} - /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -74,22 +62,6 @@ void samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND *r_u, prs_struct *ps, int } -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void make_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, - POLICY_HND *connect_pol, uint32 rid, DOM_SID *sid) -{ - if (q_u == NULL) return; - - DEBUG(5,("samr_make_q_open_domain\n")); - - memcpy(&q_u->connect_pol, connect_pol, sizeof(q_u->connect_pol)); - q_u->rid = rid; - make_dom_sid2(&(q_u->dom_sid), sid); -} - - /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -131,55 +103,6 @@ void samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN *r_u, prs_struct *ps, } -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void make_samr_q_unknown_8(SAMR_Q_UNKNOWN_8 *q_u, - POLICY_HND *domain_pol, uint16 switch_value) -{ - if (q_u == NULL) return; - - DEBUG(5,("samr_make_q_unknown_8\n")); - - memcpy(&q_u->domain_pol, domain_pol, sizeof(q_u->domain_pol)); - q_u->switch_value = switch_value; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void samr_io_q_unknown_8(char *desc, SAMR_Q_UNKNOWN_8 *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return; - - prs_debug(ps, depth, desc, "samr_io_q_unknown_8"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth); - prs_align(ps); - - prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); - prs_align(ps); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void make_samr_q_unknown_3(SAMR_Q_UNKNOWN_3 *q_u, - POLICY_HND *user_pol, uint16 switch_value) -{ - if (q_u == NULL) return; - - DEBUG(5,("samr_make_q_unknown_3\n")); - - memcpy(&q_u->user_pol, user_pol, sizeof(q_u->user_pol)); - q_u->switch_value = switch_value; -} - - /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -219,7 +142,7 @@ this one's odd, because the length (in bytes) is specified at the beginning. the length _includes_ the length of the length, too :-) ********************************************************************/ -void sam_io_dom_sid3(char *desc, DOM_SID3 *sid3, prs_struct *ps, int depth) +static void sam_io_dom_sid3(char *desc, DOM_SID3 *sid3, prs_struct *ps, int depth) { if (sid3 == NULL) return; @@ -243,7 +166,7 @@ unknown_6 : 0x0002 unknown_7 : 0x5800 or 0x0070 ********************************************************************/ -void make_sam_sid_stuff(SAM_SID_STUFF *stf, +static void make_sam_sid_stuff(SAM_SID_STUFF *stf, uint16 unknown_2, uint16 unknown_3, uint32 unknown_4, uint16 unknown_6, uint16 unknown_7, int num_sid3s, DOM_SID3 sid3[MAX_SAM_SIDS]) @@ -269,7 +192,7 @@ void make_sam_sid_stuff(SAM_SID_STUFF *stf, /******************************************************************* reads or writes a SAM_SID_STUFF structure. ********************************************************************/ -void sam_io_sid_stuff(char *desc, SAM_SID_STUFF *stf, prs_struct *ps, int depth) +static void sam_io_sid_stuff(char *desc, SAM_SID_STUFF *stf, prs_struct *ps, int depth) { int i; @@ -406,29 +329,10 @@ void samr_io_r_unknown_3(char *desc, SAMR_R_UNKNOWN_3 *r_u, prs_struct *ps, int prs_uint32("status", ps, depth, &(r_u->status)); } - -/******************************************************************* -makes a SAM_STR1 structure. -********************************************************************/ -void make_sam_str1(SAM_STR1 *sam, char *sam_acct, char *sam_name, char *sam_desc) -{ - int len_sam_acct = sam_acct != NULL ? strlen(sam_acct) : 0; - int len_sam_name = sam_name != NULL ? strlen(sam_name) : 0; - int len_sam_desc = sam_desc != NULL ? strlen(sam_desc) : 0; - - if (sam == NULL) return; - - DEBUG(5,("make_sam_str1: %d\n", __LINE__)); - - make_unistr2(&(sam->uni_acct_name), sam_acct, len_sam_acct); - make_unistr2(&(sam->uni_full_name), sam_name, len_sam_name); - make_unistr2(&(sam->uni_acct_desc), sam_desc, len_sam_desc); -} - /******************************************************************* reads or writes a SAM_STR1 structure. ********************************************************************/ -void sam_io_sam_str1(char *desc, SAM_STR1 *sam, uint32 acct_buf, uint32 name_buf, uint32 desc_buf, prs_struct *ps, int depth) +static void sam_io_sam_str1(char *desc, SAM_STR1 *sam, uint32 acct_buf, uint32 name_buf, uint32 desc_buf, prs_struct *ps, int depth) { if (sam == NULL) return; @@ -445,7 +349,7 @@ void sam_io_sam_str1(char *desc, SAM_STR1 *sam, uint32 acct_buf, uint32 name_bu /******************************************************************* makes a SAM_ENTRY1 structure. ********************************************************************/ -void make_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, +static void make_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, uint32 len_sam_name, uint32 len_sam_full, uint32 len_sam_desc, uint32 rid_user, uint16 acb_info) { @@ -466,7 +370,7 @@ void make_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, /******************************************************************* reads or writes a SAM_ENTRY1 structure. ********************************************************************/ -void sam_io_sam_entry1(char *desc, SAM_ENTRY1 *sam, prs_struct *ps, int depth) +static void sam_io_sam_entry1(char *desc, SAM_ENTRY1 *sam, prs_struct *ps, int depth) { if (sam == NULL) return; @@ -486,26 +390,10 @@ void sam_io_sam_entry1(char *desc, SAM_ENTRY1 *sam, prs_struct *ps, int depth) smb_io_unihdr("unihdr", &(sam->hdr_user_desc), ps, depth); /* account name unicode string header */ } -/******************************************************************* -makes a SAM_STR2 structure. -********************************************************************/ -void make_sam_str2(SAM_STR2 *sam, char *sam_acct, char *sam_desc) -{ - int len_sam_acct = sam_acct != NULL ? strlen(sam_acct) : 0; - int len_sam_desc = sam_desc != NULL ? strlen(sam_desc) : 0; - - if (sam == NULL) return; - - DEBUG(5,("make_sam_str2: %d\n", __LINE__)); - - make_unistr2(&(sam->uni_srv_name), sam_acct, len_sam_acct); - make_unistr2(&(sam->uni_srv_desc), sam_desc, len_sam_desc); -} - /******************************************************************* reads or writes a SAM_STR2 structure. ********************************************************************/ -void sam_io_sam_str2(char *desc, SAM_STR2 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth) +static void sam_io_sam_str2(char *desc, SAM_STR2 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth) { if (sam == NULL) return; @@ -521,7 +409,7 @@ void sam_io_sam_str2(char *desc, SAM_STR2 *sam, uint32 acct_buf, uint32 desc_bu /******************************************************************* makes a SAM_ENTRY2 structure. ********************************************************************/ -void make_sam_entry2(SAM_ENTRY2 *sam, uint32 user_idx, +static void make_sam_entry2(SAM_ENTRY2 *sam, uint32 user_idx, uint32 len_sam_name, uint32 len_sam_desc, uint32 rid_user, uint16 acb_info) { @@ -541,7 +429,7 @@ void make_sam_entry2(SAM_ENTRY2 *sam, uint32 user_idx, /******************************************************************* reads or writes a SAM_ENTRY2 structure. ********************************************************************/ -void sam_io_sam_entry2(char *desc, SAM_ENTRY2 *sam, prs_struct *ps, int depth) +static void sam_io_sam_entry2(char *desc, SAM_ENTRY2 *sam, prs_struct *ps, int depth) { if (sam == NULL) return; @@ -560,26 +448,10 @@ void sam_io_sam_entry2(char *desc, SAM_ENTRY2 *sam, prs_struct *ps, int depth) smb_io_unihdr("unihdr", &(sam->hdr_srv_desc), ps, depth); /* account name unicode string header */ } -/******************************************************************* -makes a SAM_STR3 structure. -********************************************************************/ -void make_sam_str3(SAM_STR3 *sam, char *grp_acct, char *grp_desc) -{ - int len_grp_acct = strlen(grp_acct); - int len_grp_desc = strlen(grp_desc); - - if (sam == NULL) return; - - DEBUG(5,("make_sam_str3: %d\n", __LINE__)); - - make_unistr2(&(sam->uni_grp_name), grp_acct, len_grp_acct); - make_unistr2(&(sam->uni_grp_desc), grp_desc, len_grp_desc); -} - /******************************************************************* reads or writes a SAM_STR3 structure. ********************************************************************/ -void sam_io_sam_str3(char *desc, SAM_STR3 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth) +static void sam_io_sam_str3(char *desc, SAM_STR3 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth) { if (sam == NULL) return; @@ -595,7 +467,7 @@ void sam_io_sam_str3(char *desc, SAM_STR3 *sam, uint32 acct_buf, uint32 desc_bu /******************************************************************* makes a SAM_ENTRY3 structure. ********************************************************************/ -void make_sam_entry3(SAM_ENTRY3 *sam, uint32 grp_idx, +static void make_sam_entry3(SAM_ENTRY3 *sam, uint32 grp_idx, uint32 len_grp_name, uint32 len_grp_desc, uint32 rid_grp) { if (sam == NULL) return; @@ -613,7 +485,7 @@ void make_sam_entry3(SAM_ENTRY3 *sam, uint32 grp_idx, /******************************************************************* reads or writes a SAM_ENTRY3 structure. ********************************************************************/ -void sam_io_sam_entry3(char *desc, SAM_ENTRY3 *sam, prs_struct *ps, int depth) +static void sam_io_sam_entry3(char *desc, SAM_ENTRY3 *sam, prs_struct *ps, int depth) { if (sam == NULL) return; @@ -634,7 +506,7 @@ void sam_io_sam_entry3(char *desc, SAM_ENTRY3 *sam, prs_struct *ps, int depth) /******************************************************************* makes a SAM_ENTRY structure. ********************************************************************/ -void make_sam_entry(SAM_ENTRY *sam, uint32 len_sam_name, uint32 rid) +static void make_sam_entry(SAM_ENTRY *sam, uint32 len_sam_name, uint32 rid) { if (sam == NULL) return; @@ -647,7 +519,7 @@ void make_sam_entry(SAM_ENTRY *sam, uint32 len_sam_name, uint32 rid) /******************************************************************* reads or writes a SAM_ENTRY structure. ********************************************************************/ -void sam_io_sam_entry(char *desc, SAM_ENTRY *sam, prs_struct *ps, int depth) +static void sam_io_sam_entry(char *desc, SAM_ENTRY *sam, prs_struct *ps, int depth) { if (sam == NULL) return; @@ -659,26 +531,6 @@ void sam_io_sam_entry(char *desc, SAM_ENTRY *sam, prs_struct *ps, int depth) smb_io_unihdr("unihdr", &(sam->hdr_name), ps, depth); /* account name unicode string header */ } -/******************************************************************* -makes a SAMR_Q_ENUM_DOM_USERS structure. -********************************************************************/ -void make_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_e, POLICY_HND *pol, - uint16 req_num_entries, uint16 unk_0, - uint16 acb_mask, uint16 unk_1, uint32 size) -{ - if (q_e == NULL || pol == NULL) return; - - DEBUG(5,("make_q_enum_dom_users\n")); - - memcpy(&(q_e->pol), pol, sizeof(*pol)); - - q_e->req_num_entries = req_num_entries; /* zero indicates lots */ - q_e->unknown_0 = unk_0; /* this gets returned in the response */ - q_e->acb_mask = acb_mask; - q_e->unknown_1 = unk_1; - q_e->max_size = size; -} - /******************************************************************* reads or writes a structure. @@ -809,21 +661,6 @@ void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struc prs_uint32("status", ps, depth, &(r_u->status)); } -/******************************************************************* -makes a SAMR_Q_ENUM_DOM_ALIASES structure. -********************************************************************/ -void make_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_e, POLICY_HND *pol, uint32 size) -{ - if (q_e == NULL || pol == NULL) return; - - DEBUG(5,("make_q_enum_dom_aliases\n")); - - memcpy(&(q_e->pol), pol, sizeof(*pol)); - - q_e->unknown_0 = 0; - q_e->max_size = size; -} - /******************************************************************* reads or writes a structure. @@ -940,26 +777,6 @@ void samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_s prs_uint32("status", ps, depth, &(r_u->status)); } -/******************************************************************* -makes a SAMR_Q_QUERY_DISPINFO structure. -********************************************************************/ -void make_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_e, POLICY_HND *pol, - uint16 switch_level, uint32 start_idx, uint32 size) -{ - if (q_e == NULL || pol == NULL) return; - - DEBUG(5,("make_q_query_dispinfo\n")); - - memcpy(&(q_e->pol), pol, sizeof(*pol)); - - q_e->switch_level = switch_level; - - q_e->unknown_0 = 0; - q_e->start_idx = start_idx; - q_e->unknown_1 = 0x000007d0; - q_e->max_size = size; -} - /******************************************************************* reads or writes a structure. @@ -1033,7 +850,7 @@ void make_sam_info_2(SAM_INFO_2 *sam, uint32 acb_mask, /******************************************************************* reads or writes a structure. ********************************************************************/ -void sam_io_sam_info_2(char *desc, SAM_INFO_2 *sam, prs_struct *ps, int depth) +static void sam_io_sam_info_2(char *desc, SAM_INFO_2 *sam, prs_struct *ps, int depth) { int i; @@ -1116,7 +933,7 @@ void make_sam_info_1(SAM_INFO_1 *sam, uint32 acb_mask, /******************************************************************* reads or writes a structure. ********************************************************************/ -void sam_io_sam_info_1(char *desc, SAM_INFO_1 *sam, prs_struct *ps, int depth) +static void sam_io_sam_info_1(char *desc, SAM_INFO_1 *sam, prs_struct *ps, int depth) { int i; @@ -1218,26 +1035,6 @@ void samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struc } -/******************************************************************* -makes a SAMR_Q_ENUM_DOM_GROUPS structure. -********************************************************************/ -void make_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol, - uint16 switch_level, uint32 start_idx, uint32 size) -{ - if (q_e == NULL || pol == NULL) return; - - DEBUG(5,("make_q_enum_dom_groups\n")); - - memcpy(&(q_e->pol), pol, sizeof(*pol)); - - q_e->switch_level = switch_level; - - q_e->unknown_0 = 0; - q_e->start_idx = start_idx; - q_e->unknown_1 = 0x000007d0; - q_e->max_size = size; -} - /******************************************************************* reads or writes a structure. @@ -1370,22 +1167,6 @@ void samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_str } -/******************************************************************* -makes a SAMR_Q_QUERY_ALIASINFO structure. -********************************************************************/ -void make_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO *q_e, - POLICY_HND *pol, - uint16 switch_level) -{ - if (q_e == NULL || pol == NULL) return; - - DEBUG(5,("make_q_query_aliasinfo\n")); - - memcpy(&(q_e->pol), pol, sizeof(*pol)); - - q_e->switch_level = switch_level; -} - /******************************************************************* reads or writes a structure. @@ -1708,33 +1489,6 @@ void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p prs_uint32("status", ps, depth, &(r_u->status)); } -/******************************************************************* -makes a SAMR_Q_UNKNOWN_12 structure. -********************************************************************/ -void make_samr_q_unknown_12(SAMR_Q_UNKNOWN_12 *q_u, - POLICY_HND *pol, uint32 rid, - uint32 num_gids, uint32 *gid) -{ - int i; - if (q_u == NULL) return; - - DEBUG(5,("make_samr_r_unknwon_12\n")); - - memcpy(&(q_u->pol), pol, sizeof(*pol)); - - q_u->num_gids1 = num_gids; - q_u->rid = rid; - q_u->ptr = 0; - q_u->num_gids2 = num_gids; - - SMB_ASSERT_ARRAY(q_u->gid, num_gids); - - for (i = 0; i < num_gids; i++) - { - q_u->gid[i] = gid[i]; - } -} - /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -1870,23 +1624,6 @@ void samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, i prs_uint32("status", ps, depth, &(r_u->status)); } -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void make_samr_q_open_user(SAMR_Q_OPEN_USER *q_u, - POLICY_HND *pol, - uint32 unk_0, uint32 rid) -{ - if (q_u == NULL) return; - - DEBUG(5,("samr_make_q_open_user\n")); - - memcpy(&q_u->domain_pol, pol, sizeof(q_u->domain_pol)); - - q_u->unknown_0 = unk_0; - q_u->user_rid = rid; -} - /******************************************************************* reads or writes a structure. @@ -1928,19 +1665,6 @@ void samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER *r_u, prs_struct *ps, int } -/******************************************************************* -makes a SAMR_Q_QUERY_USERGROUPS structure. -********************************************************************/ -void make_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u, - POLICY_HND *hnd) -{ - if (q_u == NULL || hnd == NULL) return; - - DEBUG(5,("make_samr_q_query_usergroups\n")); - - memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); -} - /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -2031,20 +1755,6 @@ void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_s prs_uint32("status", ps, depth, &(r_u->status)); } -/******************************************************************* -makes a SAMR_Q_QUERY_USERINFO structure. -********************************************************************/ -void make_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO *q_u, - POLICY_HND *hnd, uint16 switch_value) -{ - if (q_u == NULL || hnd == NULL) return; - - DEBUG(5,("make_samr_q_query_userinfo\n")); - - memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); - q_u->switch_value = switch_value; -} - /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -2068,7 +1778,7 @@ void samr_io_q_query_userinfo(char *desc, SAMR_Q_QUERY_USERINFO *q_u, prs_struc /******************************************************************* reads or writes a LOGON_HRS structure. ********************************************************************/ -void sam_io_logon_hrs(char *desc, LOGON_HRS *hrs, prs_struct *ps, int depth) +static void sam_io_logon_hrs(char *desc, LOGON_HRS *hrs, prs_struct *ps, int depth) { if (hrs == NULL) return; @@ -2088,104 +1798,6 @@ void sam_io_logon_hrs(char *desc, LOGON_HRS *hrs, prs_struct *ps, int depth) prs_uint8s (False, "hours", ps, depth, hrs->hours, hrs->len); } -/******************************************************************* -makes a SAM_USER_INFO_11 structure. -********************************************************************/ -void make_sam_user_info11(SAM_USER_INFO_11 *usr, - NTTIME *expiry, - char *mach_acct, - uint32 rid_user, - uint32 rid_group, - uint16 acct_ctrl) - -{ - int len_mach_acct; - if (usr == NULL || expiry == NULL || mach_acct == NULL) return; - - DEBUG(5,("make_samr_r_unknown_24\n")); - - len_mach_acct = strlen(mach_acct); - - memcpy(&(usr->expiry),expiry, sizeof(usr->expiry)); /* expiry time or something? */ - bzero(usr->padding_1, sizeof(usr->padding_1)); /* 0 - padding 24 bytes */ - - make_uni_hdr(&(usr->hdr_mach_acct), len_mach_acct, len_mach_acct, 4); /* unicode header for machine account */ - usr->padding_2 = 0; /* 0 - padding 4 bytes */ - - usr->ptr_1 = 1; /* pointer */ - bzero(usr->padding_3, sizeof(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 */ - bzero(usr->padding_6, sizeof(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 */ - - bzero(usr->padding_7, sizeof(usr->padding_7)); /* 0 - padding 16 bytes */ - usr->padding_8 = 0; /* 0 - padding 4 bytes */ - - make_unistr2(&(usr->uni_mach_acct), mach_acct, len_mach_acct); /* unicode string for machine account */ - - bzero(usr->padding_9, sizeof(usr->padding_9)); /* 0 - padding 48 bytes */ -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int depth) -{ - if (usr == NULL) return; - - prs_debug(ps, depth, desc, "samr_io_r_unknown_24"); - depth++; - - prs_align(ps); - - prs_uint8s (False, "padding_0", ps, depth, usr->padding_0, sizeof(usr->padding_0)); - - smb_io_time("time", &(usr->expiry), ps, depth); - - prs_uint8s (False, "padding_1", ps, depth, usr->padding_1, sizeof(usr->padding_1)); - - smb_io_unihdr ("unihdr", &(usr->hdr_mach_acct), ps, depth); - prs_uint32( "padding_2", ps, depth, &(usr->padding_2)); - - prs_uint32( "ptr_1 ", ps, depth, &(usr->ptr_1 )); - prs_uint8s (False, "padding_3", ps, depth, usr->padding_3, sizeof(usr->padding_3)); - prs_uint32( "padding_4", ps, depth, &(usr->padding_4)); - - prs_uint32( "ptr_2 ", ps, depth, &(usr->ptr_2 )); - prs_uint32( "padding_5", ps, depth, &(usr->padding_5)); - - prs_uint32( "ptr_3 ", ps, depth, &(usr->ptr_3 )); - prs_uint8s (False, "padding_6", ps, depth, usr->padding_6, sizeof(usr->padding_6)); - - prs_uint32( "rid_user ", ps, depth, &(usr->rid_user )); - prs_uint32( "rid_group", ps, depth, &(usr->rid_group)); - prs_uint16( "acct_ctrl", ps, depth, &(usr->acct_ctrl)); - prs_uint16( "unknown_3", ps, depth, &(usr->unknown_3)); - prs_uint16( "unknown_4", ps, depth, &(usr->unknown_4)); - prs_uint16( "unknown_5", ps, depth, &(usr->unknown_5)); - - prs_uint8s (False, "padding_7", ps, depth, usr->padding_7, sizeof(usr->padding_7)); - prs_uint32( "padding_8", ps, depth, &(usr->padding_8)); - - smb_io_unistr2("unistr2", &(usr->uni_mach_acct), True, ps, depth); - prs_align(ps); - - prs_uint8s (False, "padding_9", ps, depth, usr->padding_9, sizeof(usr->padding_9)); -} - /************************************************************************* make_sam_user_info21 @@ -2295,7 +1907,7 @@ void make_sam_user_info21(SAM_USER_INFO_21 *usr, /******************************************************************* reads or writes a structure. ********************************************************************/ -void sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *ps, int depth) +static void sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *ps, int depth) { if (usr == NULL) return; @@ -2489,75 +2101,6 @@ void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc prs_uint32("status", ps, depth, &(r_u->status)); } - -/******************************************************************* -makes a SAMR_Q_UNKNOWN_21 structure. -********************************************************************/ -void make_samr_q_unknown_21(SAMR_Q_UNKNOWN_21 *q_c, - POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) -{ - if (q_c == NULL || hnd == NULL) return; - - DEBUG(5,("make_samr_q_unknown_21\n")); - - memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol)); - q_c->unknown_1 = unk_1; - q_c->unknown_2 = unk_2; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void samr_io_q_unknown_21(char *desc, SAMR_Q_UNKNOWN_21 *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return; - - prs_debug(ps, depth, desc, "samr_io_q_unknown_21"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("group_pol", &(q_u->group_pol), ps, depth); - prs_align(ps); - - prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1)); - prs_uint16("unknown_2", ps, depth, &(q_u->unknown_2)); -} - -/******************************************************************* -makes a SAMR_Q_UNKNOWN_13 structure. -********************************************************************/ -void make_samr_q_unknown_13(SAMR_Q_UNKNOWN_13 *q_c, - POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) -{ - if (q_c == NULL || hnd == NULL) return; - - DEBUG(5,("make_samr_q_unknown_13\n")); - - memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol)); - q_c->unknown_1 = unk_1; - q_c->unknown_2 = unk_2; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void samr_io_q_unknown_13(char *desc, SAMR_Q_UNKNOWN_13 *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return; - - prs_debug(ps, depth, desc, "samr_io_q_unknown_13"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); - prs_align(ps); - - prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1)); - prs_uint16("unknown_2", ps, depth, &(q_u->unknown_2)); -} - /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -2602,25 +2145,6 @@ void samr_io_r_unknown_32(char *desc, SAMR_R_UNKNOWN_32 *r_u, prs_struct *ps, i } -/******************************************************************* -makes a SAMR_Q_CONNECT structure. -********************************************************************/ -void make_samr_q_connect(SAMR_Q_CONNECT *q_u, - char *srv_name, uint32 unknown_0) -{ - int len_srv_name = strlen(srv_name); - - if (q_u == NULL) return; - - DEBUG(5,("make_q_connect\n")); - - /* make PDC server name \\server */ - make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name); - - /* example values: 0x0000 0002 */ - q_u->unknown_0 = unknown_0; -} - /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -2659,22 +2183,6 @@ void samr_io_r_connect(char *desc, SAMR_R_CONNECT *r_u, prs_struct *ps, int dep prs_uint32("status", ps, depth, &(r_u->status)); } -/******************************************************************* -makes a SAMR_Q_OPEN_ALIAS structure. -********************************************************************/ -void make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, - uint32 unknown_0, uint32 rid) -{ - if (q_u == NULL) return; - - DEBUG(5,("make_q_open_alias\n")); - - /* example values: 0x0000 0008 */ - q_u->unknown_0 = unknown_0; - - q_u->rid_alias = rid; -} - /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -2709,106 +2217,6 @@ void samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, i prs_uint32("status", ps, depth, &(r_u->status)); } -/******************************************************************* -makes a SAMR_Q_UNKNOWN_38 structure. -********************************************************************/ -void make_samr_q_unknown_38(SAMR_Q_UNKNOWN_38 *q_u, char *srv_name) -{ - int len_srv_name = strlen(srv_name); - - if (q_u == NULL) return; - - DEBUG(5,("make_q_unknown_38\n")); - - q_u->ptr = 1; - make_uni_hdr(&(q_u->hdr_srv_name), len_srv_name, len_srv_name, len_srv_name != 0); - make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name); - -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void samr_io_q_unknown_38(char *desc, SAMR_Q_UNKNOWN_38 *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return; - - prs_debug(ps, depth, desc, "samr_io_q_unknown_38"); - depth++; - - prs_align(ps); - - prs_uint32("ptr", ps, depth, &(q_u->ptr)); - if (q_u->ptr != 0) - { - smb_io_unihdr ("", &(q_u->hdr_srv_name), ps, depth); - smb_io_unistr2("", &(q_u->uni_srv_name), q_u->hdr_srv_name.buffer, ps, depth); - } -} - -/******************************************************************* -makes a SAMR_R_UNKNOWN_38 structure. -********************************************************************/ -void make_samr_r_unknown_38(SAMR_R_UNKNOWN_38 *r_u, - uint16 level, uint32 status) -{ - if (r_u == NULL) return; - - DEBUG(5,("make_r_unknown_38\n")); - - r_u->level.value = level; - r_u->ptr_0 = 0; - r_u->status = status; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void samr_io_r_unknown_38(char *desc, SAMR_R_UNKNOWN_38 *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return; - - prs_debug(ps, depth, desc, "samr_io_r_unknown_38"); - depth++; - - prs_align(ps); - - smb_io_lookup_level("level ", &(r_u->level), ps, depth); - prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0 )); - prs_uint32("status", ps, depth, &(r_u->status)); -} - -/******************************************************************* -reads or writes a SAMR_ENC_PASSWD structure. -********************************************************************/ -void samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD *pwd, prs_struct *ps, int depth) -{ - if (pwd == NULL) return; - - prs_debug(ps, depth, desc, "samr_io_enc_passwd"); - depth++; - - prs_align(ps); - - prs_uint32("ptr", ps, depth, &(pwd->ptr)); - prs_uint8s(False, "pwd", ps, depth, pwd->pass, sizeof(pwd->pass)); -} - -/******************************************************************* -reads or writes a SAMR_ENC_HASH structure. -********************************************************************/ -void samr_io_enc_hash(char *desc, SAMR_ENC_HASH *hsh, prs_struct *ps, int depth) -{ - if (hsh == NULL) return; - - prs_debug(ps, depth, desc, "samr_io_enc_hash"); - depth++; - - prs_align(ps); - - prs_uint32("ptr ", ps, depth, &(hsh->ptr)); - prs_uint8s(False, "hash", ps, depth, hsh->hash, sizeof(hsh->hash)); -} #if 0 /* SAMR_Q_CHGPASSWD_USER */ diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 356b515f19..db557028a5 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -44,7 +44,7 @@ void make_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark) /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth) +static void srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth) { if (sh1 == NULL) return; @@ -74,7 +74,7 @@ void make_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *rem /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) +static void srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) { if (sh1 == NULL) return; @@ -91,7 +91,7 @@ void srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_srv_share_info_1(char *desc, SRV_SHARE_INFO_1 *ctr, prs_struct *ps, int depth) +static void srv_io_srv_share_info_1(char *desc, SRV_SHARE_INFO_1 *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return; @@ -152,7 +152,7 @@ void make_srv_share_info2_str(SH_INFO_2_STR *sh2, /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_share_info2_str(char *desc, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) +static void srv_io_share_info2_str(char *desc, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) { if (sh2 == NULL) return; @@ -193,7 +193,7 @@ void make_srv_share_info2(SH_INFO_2 *sh2, /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) +static void srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) { if (sh2 == NULL) return; @@ -215,7 +215,7 @@ void srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_struct *ps, int depth) +static void srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return; @@ -259,7 +259,7 @@ void srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_struct *ps, /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth) +static void srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return; @@ -295,29 +295,6 @@ void srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, } } -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void make_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, - char *srv_name, - uint32 share_level, SRV_SHARE_INFO_CTR *ctr, - uint32 preferred_len, - ENUM_HND *hnd) -{ - if (q_n == NULL || ctr == NULL || hnd == NULL) return; - - q_n->ctr = ctr; - - DEBUG(5,("make_q_net_share_enum\n")); - - make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name); - - q_n->share_level = share_level; - q_n->preferred_len = preferred_len; - - memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); -} - /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -386,7 +363,7 @@ void make_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name) /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth) +static void srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return; @@ -413,7 +390,7 @@ void make_srv_sess_info0(SESS_INFO_0 *ss0, char *name) /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth) +static void srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return; @@ -428,7 +405,7 @@ void srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth) /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth) +static void srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return; @@ -485,7 +462,7 @@ void make_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user) /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth) +static void srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return; @@ -522,7 +499,7 @@ void make_srv_sess_info1(SESS_INFO_1 *ss1, /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth) +static void srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return; @@ -543,7 +520,7 @@ void srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth) /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth) +static void srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return; @@ -587,7 +564,7 @@ void srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, i /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct *ps, int depth) +static void srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return; @@ -623,30 +600,6 @@ void srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct *ps, in } } -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, - char *srv_name, char *qual_name, - uint32 sess_level, SRV_SESS_INFO_CTR *ctr, - uint32 preferred_len, - ENUM_HND *hnd) -{ - if (q_n == NULL || ctr == NULL || hnd == NULL) return; - - q_n->ctr = ctr; - - DEBUG(5,("make_q_net_sess_enum\n")); - - make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name); - make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name); - - q_n->sess_level = sess_level; - q_n->preferred_len = preferred_len; - - memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); -} - /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -720,7 +673,7 @@ void make_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id) /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth) +static void srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return; @@ -735,7 +688,7 @@ void srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth) /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth) +static void srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return; @@ -784,7 +737,7 @@ void make_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_nam /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth) +static void srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return; @@ -822,7 +775,7 @@ void make_srv_conn_info1(CONN_INFO_1 *ss1, /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth) +static void srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return; @@ -844,7 +797,7 @@ void srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth) /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth) +static void srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return; @@ -886,7 +839,7 @@ void srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, i /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct *ps, int depth) +static void srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return; @@ -922,30 +875,6 @@ void srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct *ps, in } } -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void make_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, - char *srv_name, char *qual_name, - uint32 conn_level, SRV_CONN_INFO_CTR *ctr, - uint32 preferred_len, - ENUM_HND *hnd) -{ - if (q_n == NULL || ctr == NULL || hnd == NULL) return; - - q_n->ctr = ctr; - - DEBUG(5,("make_q_net_conn_enum\n")); - - make_buf_unistr2(&(q_n->uni_srv_name ), &(q_n->ptr_srv_name ), srv_name ); - make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name); - - q_n->conn_level = conn_level; - q_n->preferred_len = preferred_len; - - memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); -} - /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -1020,7 +949,7 @@ void make_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_n /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth) +static void srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth) { if (sh1 == NULL) return; @@ -1055,7 +984,7 @@ void make_srv_file_info3(FILE_INFO_3 *fl3, /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) +static void srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) { if (fl3 == NULL) return; @@ -1074,7 +1003,7 @@ void srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth) +static void srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth) { if (fl3 == NULL) return; @@ -1115,7 +1044,7 @@ void srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, i /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) +static void srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return; @@ -1146,30 +1075,6 @@ void srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, in } } -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, - char *srv_name, char *qual_name, - uint32 file_level, SRV_FILE_INFO_CTR *ctr, - uint32 preferred_len, - ENUM_HND *hnd) -{ - if (q_n == NULL || ctr == NULL || hnd == NULL) return; - - q_n->ctr = ctr; - - DEBUG(5,("make_q_net_file_enum\n")); - - make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name); - make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name); - - q_n->file_level = file_level; - q_n->preferred_len = preferred_len; - - memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); -} - /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -1251,7 +1156,7 @@ void make_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name, /******************************************************************* reads or writes a SRV_INFO_101 structure. ********************************************************************/ -void srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth) +static void srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth) { if (sv101 == NULL) return; @@ -1308,7 +1213,7 @@ void make_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name, /******************************************************************* reads or writes a SRV_INFO_102 structure. ********************************************************************/ -void srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth) +static void srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth) { if (sv102 == NULL) return; @@ -1344,7 +1249,7 @@ void srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth /******************************************************************* reads or writes a SRV_INFO_102 structure. ********************************************************************/ -void srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) +static void srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return; @@ -1380,20 +1285,6 @@ void srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) } } -/******************************************************************* - makes a SRV_Q_NET_SRV_GET_INFO structure. - ********************************************************************/ -void make_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv, - char *server_name, uint32 switch_value) -{ - if (srv == NULL) return; - - DEBUG(5,("make_srv_q_net_srv_get_info\n")); - - make_buf_unistr2(&(srv->uni_srv_name), &(srv->ptr_srv_name), server_name); - - srv->switch_value = switch_value; -} /******************************************************************* reads or writes a structure. @@ -1459,80 +1350,6 @@ void srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_str } -/******************************************************************* - makes a SRV_Q_NET_SRV_SET_INFO structure. - ********************************************************************/ -void make_srv_q_net_srv_set_info(SRV_Q_NET_SRV_SET_INFO *srv, - uint32 switch_value, SRV_INFO_CTR *ctr) -{ - if (srv == NULL) return; - - DEBUG(5,("make_srv_r_net_srv_set_info\n")); - - srv->ctr = ctr; - - srv->ctr->switch_value = switch_value; - srv->ctr->ptr_srv_ctr = 1; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void srv_io_q_net_srv_set_info(char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) return; - - prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info"); - depth++; - - prs_align(ps); - - prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name)); - smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); - - prs_align(ps); - - srv_io_info_ctr("ctr", q_n->ctr, ps, depth); -} - -/******************************************************************* - makes a SRV_R_NET_SRV_SET_INFO structure. - ********************************************************************/ -void make_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv, - uint32 switch_value, SRV_INFO_CTR *ctr, uint32 status) -{ - if (srv == NULL) return; - - DEBUG(5,("make_srv_r_net_srv_set_info\n")); - - if (status == 0x0) - { - srv->switch_value = switch_value; - } - else - { - srv->switch_value = 0; - } - - srv->status = status; -} - -/******************************************************************* - reads or writes a structure. - ********************************************************************/ -void srv_io_r_net_srv_set_info(char *desc, SRV_R_NET_SRV_SET_INFO *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) return; - - prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info"); - depth++; - - prs_align(ps); - - prs_uint32("switch_value", ps, depth, &(r_n->switch_value)); - prs_uint32("status ", ps, depth, &(r_n->status )); -} - /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -1552,7 +1369,7 @@ void srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct /******************************************************************* reads or writes a TIME_OF_DAY_INFO structure. ********************************************************************/ -void srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth) +static void srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth) { if (tod == NULL) return; diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c index 694acb5eec..a5e4d2318f 100644 --- a/source3/rpc_parse/parse_wks.c +++ b/source3/rpc_parse/parse_wks.c @@ -27,20 +27,6 @@ extern int DEBUGLEVEL; - -/******************************************************************* - make_wks_q_query_info - ********************************************************************/ -void make_wks_q_query_info(WKS_Q_QUERY_INFO *q_u, - char *server, uint16 switch_value) -{ - DEBUG(5,("make_wks_q_query_info: %d\n", __LINE__)); - - make_buf_unistr2(&(q_u->uni_srv_name), &(q_u->ptr_srv_name), server); - q_u->switch_value = switch_value; - -} - /******************************************************************* reads or writes a WKS_Q_QUERY_INFO structure. ********************************************************************/ @@ -81,7 +67,7 @@ void make_wks_info_100(WKS_INFO_100 *inf, /******************************************************************* reads or writes a WKS_INFO_100 structure. ********************************************************************/ -void wks_io_wks_info_100(char *desc, WKS_INFO_100 *inf, prs_struct *ps, int depth) +static void wks_io_wks_info_100(char *desc, WKS_INFO_100 *inf, prs_struct *ps, int depth) { if (inf == NULL) return; -- cgit From e649750cb4d2d2577f0577b1d7a87ae4daf8fb6f Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Mon, 21 Sep 1998 09:07:08 +0000 Subject: major autoconf clean-up fix problems in builds with srcdir!=builddir (This used to be commit 1ffc3b807a3f80644c974b454ff5e6f68e89b546) --- source3/rpc_parse/dummy.in | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/dummy.in b/source3/rpc_parse/dummy.in index e69de29bb2..8b13789179 100644 --- a/source3/rpc_parse/dummy.in +++ b/source3/rpc_parse/dummy.in @@ -0,0 +1 @@ + -- cgit From f650b65800c6d6c09cc2d59d7afe728fcb819a5f Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 24 Sep 1998 20:02:56 +0000 Subject: this fixes the last of the issues where USRMGR.EXE and SRVMGR.EXE were failing. running these two programs on a samba pdc now work. parse_samr.c: - removed __LINE__ from debug macros. - removed call to SMB_ASSERT_ARRAY() in samr_r_query_usergroups. the DOM_GID array is a malloc'd array (by make_dom_gids) not a static array. srv_samr.c: - replaced all "struct smb_passwd"s with sam_passwds instead. there were uid to rid confusion issues (assumptions that uids were equal to rids). - #if 0'd the pdb_rid_is_user() call which, given the above corrections, would probably work now. srv_util.c: - replaced "struct smb_passwd" with sam_passwd in lookup_user_rid, as assumptions were being made that uids were equal to rids. (This used to be commit 3f98697cd5203fba07518d7c777ba19644e35b45) --- source3/rpc_parse/parse_samr.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 71eb8a37dd..e35bdd19d1 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -355,7 +355,7 @@ static void make_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, { if (sam == NULL) return; - DEBUG(5,("make_sam_entry1: %d\n", __LINE__)); + DEBUG(5,("make_sam_entry1\n")); sam->user_idx = user_idx; sam->rid_user = rid_user; @@ -415,7 +415,7 @@ static void make_sam_entry2(SAM_ENTRY2 *sam, uint32 user_idx, { if (sam == NULL) return; - DEBUG(5,("make_sam_entry2: %d\n", __LINE__)); + DEBUG(5,("make_sam_entry2\n")); sam->user_idx = user_idx; sam->rid_user = rid_user; @@ -472,7 +472,7 @@ static void make_sam_entry3(SAM_ENTRY3 *sam, uint32 grp_idx, { if (sam == NULL) return; - DEBUG(5,("make_sam_entry3: %d\n", __LINE__)); + DEBUG(5,("make_sam_entry3\n")); sam->grp_idx = grp_idx; sam->rid_grp = rid_grp; @@ -510,7 +510,7 @@ static void make_sam_entry(SAM_ENTRY *sam, uint32 len_sam_name, uint32 rid) { if (sam == NULL) return; - DEBUG(5,("make_sam_entry: %d\n", __LINE__)); + DEBUG(5,("make_sam_entry\n")); sam->rid = rid; make_uni_hdr(&(sam->hdr_name), len_sam_name, len_sam_name, len_sam_name != 0); @@ -1744,8 +1744,6 @@ void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_s { prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); - SMB_ASSERT_ARRAY(r_u->gid, r_u->num_entries2); - for (i = 0; i < r_u->num_entries2; i++) { smb_io_gid("", &(r_u->gid[i]), ps, depth); -- cgit From 0c5dcf52b0934ad68805e74be732905b392391c4 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 24 Sep 1998 20:17:19 +0000 Subject: took out #ifdef'd code in make_samr_r_query_usergroups that copied DOM_GID static-size array, because it's malloc'd now. (This used to be commit 7776002218232c3ea0140d91c6033b7f9c6d3050) --- source3/rpc_parse/parse_samr.c | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index e35bdd19d1..615a716eea 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1699,16 +1699,6 @@ void make_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u, r_u->num_entries2 = num_gids; r_u->gid = gid; - -#if 0 - int i; - for (i = 0; i < num_gids && i < LSA_MAX_GROUPS; i++) - { - r_u->gid[i].g_rid = gid[i].g_rid; - r_u->gid[i].attr = gid[i].attr ; - } -#endif - } else { -- cgit From d8f66be1415c5e205e9255499911b84a5227638d Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 24 Sep 1998 20:19:31 +0000 Subject: qualifier name in session_enum was being assumed to exist. if NULL, the name should not be read. file_enum and connection_enum didn't do this: wonder why only session_enum had this bug? (This used to be commit 203a97e39e7ae7e5511f74dffea0778e7fa6db07) --- source3/rpc_parse/parse_srv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index db557028a5..882ad9e59d 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -618,7 +618,7 @@ void srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *p prs_align(ps); prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name)); - smb_io_unistr2("", &(q_n->uni_qual_name), True, ps, depth); + smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth); prs_align(ps); @@ -1093,7 +1093,7 @@ void srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *p prs_align(ps); prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name)); - smb_io_unistr2("", &(q_n->uni_qual_name), True, ps, depth); + smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth); prs_align(ps); -- cgit From 66d5d73a5d75e88a77970f7b27687b8354ab2e80 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 25 Sep 1998 21:01:52 +0000 Subject: added rpcclient program (This used to be commit aa38f39d67fade4dfd7badb7a9b39c833a1dd1ca) --- source3/rpc_parse/parse_lsa.c | 91 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 0818057d48..9db41b58b6 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -101,6 +101,23 @@ static void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int de } +/******************************************************************* +makes an LSA_OBJ_ATTR structure. +********************************************************************/ +void make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, uint32 sec_qos) +{ + if (attr == NULL) return; + + DEBUG(5,("make_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; + attr->sec_qos = sec_qos; +} + /******************************************************************* reads or writes an LSA_OBJ_ATTR structure. ********************************************************************/ @@ -134,6 +151,25 @@ static void lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int } } +/******************************************************************* +makes an LSA_Q_OPEN_POL structure. +********************************************************************/ +void make_q_open_pol(LSA_Q_OPEN_POL *r_q, char *server_name, + uint32 attributes, uint32 sec_qos, + uint32 desired_access) +{ + if (r_q == NULL) return; + + DEBUG(5,("make_open_pol\n")); + + r_q->ptr = 1; /* undocumented pointer */ + + make_unistr2 (&(r_q->uni_server_name), server_name, strlen(server_name)); + make_lsa_obj_attr(&(r_q->attr ), attributes, sec_qos); + + r_q->des_access = desired_access; +} + /******************************************************************* reads or writes an LSA_Q_OPEN_POL structure. ********************************************************************/ @@ -168,6 +204,20 @@ void lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int dep prs_uint32("status", ps, depth, &(r_p->status)); } +/******************************************************************* +makes an LSA_Q_QUERY_INFO structure. +********************************************************************/ +void make_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class) +{ + if (q_q == NULL || hnd == NULL) return; + + DEBUG(5,("make_q_query\n")); + + memcpy(&(q_q->pol), hnd, sizeof(q_q->pol)); + + q_q->info_class = info_class; +} + /******************************************************************* reads or writes an LSA_Q_QUERY_INFO structure. ********************************************************************/ @@ -478,3 +528,44 @@ void lsa_io_r_lookup_rids(char *desc, LSA_R_LOOKUP_RIDS *r_r, prs_struct *ps, i prs_uint32("status ", ps, depth, &(r_r->status)); } + +/******************************************************************* +makes an LSA_Q_CLOSE structure. +********************************************************************/ +void make_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_lsa_q_close\n")); + + memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); +} + +/******************************************************************* +reads or writes an LSA_Q_CLOSE structure. +********************************************************************/ +void lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth) +{ + if (q_c == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_q_close"); + depth++; + + smb_io_pol_hnd("", &(q_c->pol), ps, depth); +} + +/******************************************************************* +reads or writes an LSA_R_CLOSE structure. +********************************************************************/ +void lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth) +{ + if (r_c == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_r_close"); + depth++; + + smb_io_pol_hnd("", &(r_c->pol), ps, depth); + + prs_uint32("status", ps, depth, &(r_c->status)); +} + -- cgit From ff07b2e4a37f23af90a27456a116b773ae3bbf97 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 25 Sep 1998 21:20:37 +0000 Subject: added wksinfo command to rpcclient, which don't work too good. (This used to be commit 8d23da91cbd74a45a5b030688fd89d88a25738dc) --- source3/rpc_parse/parse_wks.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c index a5e4d2318f..2386fa6636 100644 --- a/source3/rpc_parse/parse_wks.c +++ b/source3/rpc_parse/parse_wks.c @@ -27,6 +27,19 @@ extern int DEBUGLEVEL; +/******************************************************************* + make_wks_q_query_info + ********************************************************************/ +void make_wks_q_query_info(WKS_Q_QUERY_INFO *q_u, + char *server, uint16 switch_value) +{ + DEBUG(5,("make_wks_q_query_info\n")); + + make_buf_unistr2(&(q_u->uni_srv_name), &(q_u->ptr_srv_name), server); + q_u->switch_value = switch_value; + +} + /******************************************************************* reads or writes a WKS_Q_QUERY_INFO structure. ********************************************************************/ -- cgit From 6fb5804b28adffbbcb45b84e485e09d9d2ddddea Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 25 Sep 1998 22:20:05 +0000 Subject: added in samr commands. assistance in returning the missing functions, automatically removed because they were "unused", would be appreciated. (This used to be commit d0f7b0d915973ccb85409af3d6d951a716cd66d2) --- source3/rpc_parse/parse_misc.c | 54 +++++ source3/rpc_parse/parse_samr.c | 440 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 494 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 3749827860..5144ef8c31 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -145,6 +145,60 @@ void smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) prs_uint32s(False, "sub_auths ", ps, depth, sid->sub_auths, sid->num_auths); } +/******************************************************************* +creates a DOM_SID structure. + +BIG NOTE: this function only does SIDS where the identauth is not >= 2^32 +identauth >= 2^32 can be detected because it will be specified in hex + +********************************************************************/ +void make_dom_sid(DOM_SID *sid, char *str_sid) +{ + pstring domsid; + int identauth; + char *p; + + if (sid == NULL) return; + + if (domsid == NULL) + { + DEBUG(4,("netlogon domain SID: none\n")); + sid->sid_rev_num = 0; + sid->num_auths = 0; + return; + } + + pstrcpy(domsid, str_sid); + + DEBUG(4,("make_dom_sid %d SID: %s\n", __LINE__, domsid)); + + /* assume, but should check, that domsid starts "S-" */ + p = strtok(domsid+2,"-"); + sid->sid_rev_num = atoi(p); + + /* identauth in decimal should be < 2^32 */ + /* identauth in hex should be >= 2^32 */ + identauth = atoi(strtok(0,"-")); + + DEBUG(4,("netlogon rev %d\n", sid->sid_rev_num)); + DEBUG(4,("netlogon %s ia %d\n", p, identauth)); + + sid->id_auth[0] = 0; + sid->id_auth[1] = 0; + sid->id_auth[2] = (identauth & 0xff000000) >> 24; + sid->id_auth[3] = (identauth & 0x00ff0000) >> 16; + sid->id_auth[4] = (identauth & 0x0000ff00) >> 8; + sid->id_auth[5] = (identauth & 0x000000ff); + + sid->num_auths = 0; + + while ((p = strtok(0, "-")) != NULL && sid->num_auths < MAXSUBAUTHS) + { + sid->sub_auths[sid->num_auths++] = atoi(p); + } + + DEBUG(4,("make_dom_sid: %d SID: %s\n", __LINE__, domsid)); +} /******************************************************************* creates a DOM_SID2 structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 615a716eea..4454d74fe8 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -27,6 +27,18 @@ extern int DEBUGLEVEL; +/******************************************************************* +makes a SAMR_Q_CLOSE_HND structure. +********************************************************************/ +void make_samr_q_close_hnd(SAMR_Q_CLOSE_HND *q_c, POLICY_HND *hnd) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_close_hnd\n")); + + memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -62,6 +74,22 @@ void samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND *r_u, prs_struct *ps, int } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, + POLICY_HND *connect_pol, uint32 rid, + DOM_SID *sid) +{ + if (q_u == NULL) return; + + DEBUG(5,("samr_make_q_open_domain\n")); + + memcpy(&q_u->connect_pol, connect_pol, sizeof(q_u->connect_pol)); + q_u->rid = rid; + make_dom_sid2(&(q_u->dom_sid), sid); +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -102,6 +130,20 @@ void samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN *r_u, prs_struct *ps, prs_uint32("status", ps, depth, &(r_u->status)); } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_samr_q_unknown_3(SAMR_Q_UNKNOWN_3 *q_u, + POLICY_HND *user_pol, uint16 switch_value) +{ + if (q_u == NULL) return; + + DEBUG(5,("samr_make_q_unknown_3\n")); + + memcpy(&q_u->user_pol, user_pol, sizeof(q_u->user_pol)); + q_u->switch_value = switch_value; +} + /******************************************************************* reads or writes a structure. @@ -122,6 +164,38 @@ void samr_io_q_unknown_3(char *desc, SAMR_Q_UNKNOWN_3 *q_u, prs_struct *ps, int prs_align(ps); } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_samr_q_unknown_8(SAMR_Q_UNKNOWN_8 *q_u, + POLICY_HND *domain_pol, uint16 switch_value) +{ + if (q_u == NULL) return; + + DEBUG(5,("samr_make_q_unknown_8\n")); + + memcpy(&q_u->domain_pol, domain_pol, sizeof(q_u->domain_pol)); + q_u->switch_value = switch_value; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_unknown_8(char *desc, SAMR_Q_UNKNOWN_8 *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_unknown_8"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth); + prs_align(ps); + + prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); + prs_align(ps); +} /******************************************************************* makes a DOM_SID3 structure. @@ -532,6 +606,26 @@ static void sam_io_sam_entry(char *desc, SAM_ENTRY *sam, prs_struct *ps, int de } +/******************************************************************* +makes a SAMR_Q_ENUM_DOM_USERS structure. +********************************************************************/ +void make_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_e, POLICY_HND *pol, + uint16 req_num_entries, uint16 unk_0, + uint16 acb_mask, uint16 unk_1, uint32 size) +{ + if (q_e == NULL || pol == NULL) return; + + DEBUG(5,("make_q_enum_dom_users\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + q_e->req_num_entries = req_num_entries; /* zero indicates lots */ + q_e->unknown_0 = unk_0; /* this gets returned in the response */ + q_e->acb_mask = acb_mask; + q_e->unknown_1 = unk_1; + q_e->max_size = size; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -661,6 +755,21 @@ void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struc prs_uint32("status", ps, depth, &(r_u->status)); } +/******************************************************************* +makes a SAMR_Q_ENUM_DOM_ALIASES structure. +********************************************************************/ +void make_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_e, POLICY_HND *pol, uint32 size) +{ + if (q_e == NULL || pol == NULL) return; + + DEBUG(5,("make_q_enum_dom_aliases\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + q_e->unknown_0 = 0; + q_e->max_size = size; +} + /******************************************************************* reads or writes a structure. @@ -778,6 +887,26 @@ void samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_s } +/******************************************************************* +makes a SAMR_Q_QUERY_DISPINFO structure. +********************************************************************/ +void make_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_e, POLICY_HND *pol, + uint16 switch_level, uint32 start_idx, uint32 size) +{ + if (q_e == NULL || pol == NULL) return; + + DEBUG(5,("make_q_query_dispinfo\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + q_e->switch_level = switch_level; + + q_e->unknown_0 = 0; + q_e->start_idx = start_idx; + q_e->unknown_1 = 0x000007d0; + q_e->max_size = size; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -1035,6 +1164,26 @@ void samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struc } +/******************************************************************* +makes a SAMR_Q_ENUM_DOM_GROUPS structure. +********************************************************************/ +void make_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol, + uint16 switch_level, uint32 start_idx, uint32 size) +{ + if (q_e == NULL || pol == NULL) return; + + DEBUG(5,("make_q_enum_dom_groups\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + q_e->switch_level = switch_level; + + q_e->unknown_0 = 0; + q_e->start_idx = start_idx; + q_e->unknown_1 = 0x000007d0; + q_e->max_size = size; +} + /******************************************************************* reads or writes a structure. @@ -1167,6 +1316,22 @@ void samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_str } +/******************************************************************* +makes a SAMR_Q_QUERY_ALIASINFO structure. +********************************************************************/ +void make_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO *q_e, + POLICY_HND *pol, + uint16 switch_level) +{ + if (q_e == NULL || pol == NULL) return; + + DEBUG(5,("make_q_query_aliasinfo\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + q_e->switch_level = switch_level; +} + /******************************************************************* reads or writes a structure. @@ -1625,6 +1790,23 @@ void samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, i } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_samr_q_open_user(SAMR_Q_OPEN_USER *q_u, + POLICY_HND *pol, + uint32 unk_0, uint32 rid) +{ + if (q_u == NULL) return; + + DEBUG(5,("samr_make_q_open_user\n")); + + memcpy(&q_u->domain_pol, pol, sizeof(q_u->domain_pol)); + + q_u->unknown_0 = unk_0; + q_u->user_rid = rid; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -1664,6 +1846,19 @@ void samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER *r_u, prs_struct *ps, int prs_uint32("status", ps, depth, &(r_u->status)); } +/******************************************************************* +makes a SAMR_Q_QUERY_USERGROUPS structure. +********************************************************************/ +void make_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u, + POLICY_HND *hnd) +{ + if (q_u == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_query_usergroups\n")); + + memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); +} + /******************************************************************* reads or writes a structure. @@ -1743,6 +1938,21 @@ void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_s prs_uint32("status", ps, depth, &(r_u->status)); } +/******************************************************************* +makes a SAMR_Q_QUERY_USERINFO structure. +********************************************************************/ +void make_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO *q_u, + POLICY_HND *hnd, uint16 switch_value) +{ + if (q_u == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_query_userinfo\n")); + + memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); + q_u->switch_value = switch_value; +} + + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -2133,6 +2343,26 @@ void samr_io_r_unknown_32(char *desc, SAMR_R_UNKNOWN_32 *r_u, prs_struct *ps, i } +/******************************************************************* +makes a SAMR_Q_CONNECT structure. +********************************************************************/ +void make_samr_q_connect(SAMR_Q_CONNECT *q_u, + char *srv_name, uint32 unknown_0) +{ + int len_srv_name = strlen(srv_name); + + if (q_u == NULL) return; + + DEBUG(5,("make_q_connect\n")); + + /* make PDC server name \\server */ + make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name); + + /* example values: 0x0000 0002 */ + q_u->unknown_0 = unknown_0; +} + + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -2171,6 +2401,22 @@ void samr_io_r_connect(char *desc, SAMR_R_CONNECT *r_u, prs_struct *ps, int dep prs_uint32("status", ps, depth, &(r_u->status)); } +/******************************************************************* +makes a SAMR_Q_OPEN_ALIAS structure. +********************************************************************/ +void make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, + uint32 unknown_0, uint32 rid) +{ + if (q_u == NULL) return; + + DEBUG(5,("make_q_open_alias\n")); + + /* example values: 0x0000 0008 */ + q_u->unknown_0 = unknown_0; + + q_u->rid_alias = rid; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -2237,3 +2483,197 @@ typedef struct r_samr_chgpasswd_user_info #endif /* 0 */ + +/******************************************************************* +makes a SAMR_Q_UNKNOWN_38 structure. +********************************************************************/ +void make_samr_q_unknown_38(SAMR_Q_UNKNOWN_38 *q_u, char *srv_name) +{ + int len_srv_name = strlen(srv_name); + + if (q_u == NULL) return; + + DEBUG(5,("make_q_unknown_38\n")); + + q_u->ptr = 1; + make_uni_hdr(&(q_u->hdr_srv_name), len_srv_name, len_srv_name, len_srv_name != 0); + make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name); + +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_unknown_38(char *desc, SAMR_Q_UNKNOWN_38 *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_unknown_38"); + depth++; + + prs_align(ps); + + prs_uint32("ptr", ps, depth, &(q_u->ptr)); + if (q_u->ptr != 0) + { + smb_io_unihdr ("", &(q_u->hdr_srv_name), ps, depth); + smb_io_unistr2("", &(q_u->uni_srv_name), q_u->hdr_srv_name.buffer, ps, depth); + } +} + +/******************************************************************* +makes a SAMR_R_UNKNOWN_38 structure. +********************************************************************/ +void make_samr_r_unknown_38(SAMR_R_UNKNOWN_38 *r_u, + uint16 level, uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_r_unknown_38\n")); + + r_u->level.value = level; + r_u->ptr_0 = 0; + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_unknown_38(char *desc, SAMR_R_UNKNOWN_38 *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_unknown_38"); + depth++; + + prs_align(ps); + + smb_io_lookup_level("level ", &(r_u->level), ps, depth); + prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0 )); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +reads or writes a SAMR_ENC_PASSWD structure. +********************************************************************/ +void samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD *pwd, prs_struct *ps, int depth) +{ + if (pwd == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_enc_passwd"); + depth++; + + prs_align(ps); + + prs_uint32("ptr", ps, depth, &(pwd->ptr)); + prs_uint8s(False, "pwd", ps, depth, pwd->pass, sizeof(pwd->pass)); +} + +/******************************************************************* +reads or writes a SAMR_ENC_HASH structure. +********************************************************************/ +void samr_io_enc_hash(char *desc, SAMR_ENC_HASH *hsh, prs_struct *ps, int depth) +{ + if (hsh == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_enc_hash"); + depth++; + + prs_align(ps); + + prs_uint32("ptr ", ps, depth, &(hsh->ptr)); + prs_uint8s(False, "hash", ps, depth, hsh->hash, sizeof(hsh->hash)); +} + +#if 0 +/* SAMR_Q_CHGPASSWD_USER */ +typedef struct q_samr_chgpasswd_user_info +{ + uint32 ptr_0; + + UNIHDR hdr_server; /* server name unicode header */ + UNISTR2 uni_server; /* server name unicode string */ + + UNIHDR hdr_user_name; /* username unicode string header */ + UNISTR2 uni_user_name; /* username unicode string */ + + SAMR_ENC_PASSWD nt_newpass; + SAMR_ENC_HASH nt_oldhash; + + uint32 unknown_1; /* seems to always contain 0001 */ + + SAMR_ENC_PASSWD lm_newpass; + SAMR_ENC_HASH lm_oldhash; + +} SAMR_Q_CHGPASSWD_USER; + +/* SAMR_R_CHGPASSWD_USER */ +typedef struct r_samr_chgpasswd_user_info +{ + uint32 result; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */ + +} SAMR_R_CHGPASSWD_USER; + +#endif /* 0 */ + + +/******************************************************************* +makes a SAMR_Q_UNKNOWN_12 structure. +********************************************************************/ +void make_samr_q_unknown_12(SAMR_Q_UNKNOWN_12 *q_u, + POLICY_HND *pol, uint32 rid, + uint32 num_gids, uint32 *gid) +{ + int i; + if (q_u == NULL) return; + + DEBUG(5,("make_samr_r_unknwon_12\n")); + + memcpy(&(q_u->pol), pol, sizeof(*pol)); + + q_u->num_gids1 = num_gids; + q_u->rid = rid; + q_u->ptr = 0; + q_u->num_gids2 = num_gids; + + for (i = 0; i < num_gids; i++) + { + q_u->gid[i] = gid[i]; + } +} + + + + +/******************************************************************* +makes a SAMR_Q_UNKNOWN_21 structure. +********************************************************************/ +void make_samr_q_unknown_21(SAMR_Q_UNKNOWN_21 *q_c, + POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_unknown_21\n")); + + memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol)); + q_c->unknown_1 = unk_1; + q_c->unknown_2 = unk_2; +} + + +/******************************************************************* +makes a SAMR_Q_UNKNOWN_13 structure. +********************************************************************/ +void make_samr_q_unknown_13(SAMR_Q_UNKNOWN_13 *q_c, + POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_unknown_13\n")); + + memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol)); + q_c->unknown_1 = unk_1; + q_c->unknown_2 = unk_2; +} + + -- cgit From 4b9e0941b9440d25d253dab62633858c2a5117c2 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 25 Sep 1998 23:14:20 +0000 Subject: rpcclient: got samr command "enumusers -g -u" working (This used to be commit 3a00023efedb34684bd45bd8a562f07a9880f1ad) --- source3/rpc_parse/parse_samr.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 4454d74fe8..ab07e375f5 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2167,6 +2167,7 @@ static void sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *p if (usr->ptr_logon_hrs) { sam_io_logon_hrs("logon_hrs", &(usr->logon_hrs) , ps, depth); + prs_align(ps); } } -- cgit From cf971f88ac188eec353a7fb021744b8076cc4eb7 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Mon, 28 Sep 1998 00:14:36 +0000 Subject: automated generation of .dummy files for each subdirectory; dummy.in files are no longer needed, and new directories will be taken care of automatically, at configure (or config.status --recheck) time (This used to be commit 237a8e5fe62d757c04b8207cbbee4df1470cfe4e) --- source3/rpc_parse/dummy.in | 1 - 1 file changed, 1 deletion(-) delete mode 100644 source3/rpc_parse/dummy.in (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/dummy.in b/source3/rpc_parse/dummy.in deleted file mode 100644 index 8b13789179..0000000000 --- a/source3/rpc_parse/dummy.in +++ /dev/null @@ -1 +0,0 @@ - -- cgit From a2d7f765e8500f23c126c7b7cb6bb346adc11641 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Tue, 29 Sep 1998 04:52:17 +0000 Subject: get away with dummy and .dummy files (This used to be commit 90a8a02484a0897b053fd6531b7fec5d23098b6f) --- source3/rpc_parse/.cvsignore | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/.cvsignore b/source3/rpc_parse/.cvsignore index 421376db9e..e69de29bb2 100644 --- a/source3/rpc_parse/.cvsignore +++ b/source3/rpc_parse/.cvsignore @@ -1 +0,0 @@ -dummy -- cgit From d8f609aeeb9ce70a97193d9e6709b82b78b39c39 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 30 Sep 1998 19:09:57 +0000 Subject: lsa_lookup_sids command added. severe debugging needed on lookup_sids code. added "quality of service" capability to lsa_open_policy code. different lsa_open_policy queries are *not* dealt with in the server code. answers like "0xC000 0022" - access denied - will have to be made to lsa_lookup_sids calls when a "quality of service" request is *not* specified in the lsa_open_policy call. (This used to be commit 299a723d4e55712beb12362dfff3846d82b8516b) --- source3/rpc_parse/parse_lsa.c | 245 +++++++++++++++++++++++++++++++++--------- 1 file changed, 192 insertions(+), 53 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 9db41b58b6..40f05e0c3a 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -37,7 +37,6 @@ void make_lsa_trans_name(LSA_TRANS_NAME *trn, uint32 sid_name_use, char *name, u trn->sid_name_use = sid_name_use; make_uni_hdr(&(trn->hdr_name), len_name, len_name, len_name != 0); - make_unistr2(&(trn->uni_name), name, len_name); trn->domain_idx = idx; } @@ -54,10 +53,7 @@ static void lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, i prs_align(ps); prs_uint32("sid_name_use", ps, depth, &(trn->sid_name_use)); - smb_io_unihdr ("hdr_name", &(trn->hdr_name), ps, depth); - smb_io_unistr2("uni_name", &(trn->uni_name), trn->hdr_name.buffer, ps, depth); - prs_uint32("domain_idx ", ps, depth, &(trn->domain_idx )); } @@ -66,7 +62,7 @@ reads or writes a DOM_R_REF structure. ********************************************************************/ static void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) { - int i; + int i, s, n; prs_debug(ps, depth, desc, "smb_io_dom_r_ref"); depth++; @@ -75,28 +71,93 @@ static void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int de prs_align(ps); - prs_uint32("undoc_buffer ", ps, depth, &(r_r->undoc_buffer)); /* undocumented buffer pointer. */ - prs_uint32("num_ref_doms_1 ", ps, depth, &(r_r->num_ref_doms_1)); /* num referenced domains? */ - prs_uint32("buffer_dom_name", ps, depth, &(r_r->buffer_dom_name)); /* undocumented domain name buffer pointer. */ - prs_uint32("max_entries ", ps, depth, &(r_r->max_entries)); /* 32 - max number of entries */ - prs_uint32("num_ref_doms_2 ", ps, depth, &(r_r->num_ref_doms_2)); /* 4 - num referenced domains? */ - - smb_io_unihdr2("", &(r_r->hdr_dom_name), ps, depth); /* domain name unicode string header */ + prs_uint32("undoc_buffer ", ps, depth, &(r_r->undoc_buffer )); /* undocumented buffer pointer. */ + prs_uint32("num_ref_doms_1", ps, depth, &(r_r->num_ref_doms_1)); /* num referenced domains? */ + prs_uint32("undoc_buffer2 ", ps, depth, &(r_r->undoc_buffer2 )); /* undocumented buffer pointer. */ + prs_uint32("max_entries ", ps, depth, &(r_r->max_entries )); /* 32 - max number of entries */ + prs_uint32("num_ref_doms_2", ps, depth, &(r_r->num_ref_doms_2)); /* 4 - num referenced domains? */ SMB_ASSERT_ARRAY(r_r->hdr_ref_dom, r_r->num_ref_doms_1-1); + SMB_ASSERT_ARRAY(r_r->ref_dom, r_r->num_ref_doms_2); - for (i = 0; i < r_r->num_ref_doms_1-1; i++) + for (i = 0; i < r_r->num_ref_doms_1; i++) { - smb_io_unihdr2("", &(r_r->hdr_ref_dom[i]), ps, depth); + fstring t; + + slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i); + smb_io_unihdr(t, &(r_r->hdr_ref_dom[i].hdr_dom_name), ps, depth); + + slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i); + prs_uint32(t, ps, depth, &(r_r->hdr_ref_dom[i].ptr_dom_sid)); } - smb_io_unistr("", &(r_r->uni_dom_name), ps, depth); /* domain name unicode string */ + for (i = 0, n = 0, s = 0; i < r_r->num_ref_doms_2; i++) + { + fstring t; - SMB_ASSERT_ARRAY(r_r->ref_dom, r_r->num_ref_doms_2); + if (r_r->hdr_ref_dom[i].hdr_dom_name.buffer != 0) + { + slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i); + smb_io_unistr2(t, &(r_r->ref_dom[n].uni_dom_name), True, ps, depth); /* domain name unicode string */ + n++; + } + + if (r_r->hdr_ref_dom[i].ptr_dom_sid != 0) + { + slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i); + smb_io_dom_sid2("", &(r_r->ref_dom[s].ref_dom), ps, depth); /* referenced domain SIDs */ + s++; + } + } +} + + +/******************************************************************* +makes an LSA_SEC_QOS structure. +********************************************************************/ +void make_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff, + uint32 unknown) +{ + if (qos == NULL) return; + + DEBUG(5,("make_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; + qos->unknown = unknown; +} - for (i = 0; i < r_r->num_ref_doms_2; i++) +/******************************************************************* +reads or writes an LSA_SEC_QOS structure. +********************************************************************/ +static void lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int depth) +{ + int start; + + if (qos == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_obj_qos"); + depth++; + + prs_align(ps); + + start = ps->offset; + + /* these pointers had _better_ be zero, because we don't know + what they point to! + */ + prs_uint32("len ", ps, depth, &(qos->len )); /* 0x18 - length (in bytes) inc. the length field. */ + prs_uint16("sec_imp_level ", ps, depth, &(qos->sec_imp_level )); + prs_uint8 ("sec_ctxt_mode ", ps, depth, &(qos->sec_ctxt_mode )); + prs_uint8 ("effective_only", ps, depth, &(qos->effective_only)); + prs_uint32("unknown ", ps, depth, &(qos->unknown )); + + if (qos->len != ps->offset - start) { - smb_io_dom_sid2("", &(r_r->ref_dom[i]), ps, depth); /* referenced domain SIDs */ + DEBUG(3,("lsa_io_sec_qos: length %x does not match size %x\n", + qos->len, ps->offset - start)); } } @@ -104,7 +165,7 @@ static void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int de /******************************************************************* makes an LSA_OBJ_ATTR structure. ********************************************************************/ -void make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, uint32 sec_qos) +void make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos) { if (attr == NULL) return; @@ -115,7 +176,17 @@ void make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, uint32 sec_qos) attr->ptr_obj_name = 0; attr->attributes = attributes; attr->ptr_sec_desc = 0; - attr->sec_qos = sec_qos; + + if (qos != NULL) + { + attr->ptr_sec_qos = 1; + attr->sec_qos = qos; + } + else + { + attr->ptr_sec_qos = 0; + attr->sec_qos = NULL; + } } /******************************************************************* @@ -137,37 +208,46 @@ static void lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int /* these pointers had _better_ be zero, because we don't know what they point to! */ - prs_uint32("len" , ps, depth, &(attr->len )); /* 0x18 - length (in bytes) inc. the length field. */ + prs_uint32("len ", ps, depth, &(attr->len )); /* 0x18 - length (in bytes) inc. the length field. */ prs_uint32("ptr_root_dir", ps, depth, &(attr->ptr_root_dir)); /* 0 - root directory (pointer) */ prs_uint32("ptr_obj_name", ps, depth, &(attr->ptr_obj_name)); /* 0 - object name (pointer) */ - prs_uint32("attributes" , ps, depth, &(attr->attributes )); /* 0 - attributes (undocumented) */ + prs_uint32("attributes ", ps, depth, &(attr->attributes )); /* 0 - attributes (undocumented) */ prs_uint32("ptr_sec_desc", ps, depth, &(attr->ptr_sec_desc)); /* 0 - security descriptior (pointer) */ - prs_uint32("sec_qos" , ps, depth, &(attr->sec_qos )); /* 0 - security quality of service */ + prs_uint32("ptr_sec_qos ", ps, depth, &(attr->ptr_sec_qos )); /* security quality of service (pointer) */ if (attr->len != ps->offset - start) { DEBUG(3,("lsa_io_obj_attr: length %x does not match size %x\n", attr->len, ps->offset - start)); } + + if (attr->ptr_sec_qos != 0 && attr->sec_qos != NULL) + { + lsa_io_sec_qos("sec_qos", attr->sec_qos, ps, depth); + } } /******************************************************************* makes an LSA_Q_OPEN_POL structure. ********************************************************************/ void make_q_open_pol(LSA_Q_OPEN_POL *r_q, char *server_name, - uint32 attributes, uint32 sec_qos, - uint32 desired_access) + uint32 attributes, + uint32 desired_access, + LSA_SEC_QOS *qos) { if (r_q == NULL) return; - DEBUG(5,("make_open_pol\n")); + DEBUG(5,("make_open_pol: attr:%d da:%d\n", attributes, desired_access)); r_q->ptr = 1; /* undocumented pointer */ - make_unistr2 (&(r_q->uni_server_name), server_name, strlen(server_name)); - make_lsa_obj_attr(&(r_q->attr ), attributes, sec_qos); + if (qos == NULL) + { + r_q->des_access = desired_access; + } - r_q->des_access = desired_access; + make_unistr2 (&(r_q->uni_server_name), server_name, strlen(server_name)); + make_lsa_obj_attr(&(r_q->attr ), attributes, qos); } /******************************************************************* @@ -185,7 +265,10 @@ void lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int dep smb_io_unistr2 ("", &(r_q->uni_server_name), r_q->ptr, ps, depth); lsa_io_obj_attr("", &(r_q->attr ), ps, depth); - prs_uint32("des_access", ps, depth, &(r_q->des_access)); + if (r_q->attr.ptr_sec_qos == 0) + { + prs_uint32("des_access", ps, depth, &(r_q->des_access)); + } } /******************************************************************* @@ -198,7 +281,6 @@ void lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int dep prs_debug(ps, depth, desc, "lsa_io_r_open_pol"); depth++; - smb_io_pol_hnd("", &(r_p->pol), ps, depth); prs_uint32("status", ps, depth, &(r_p->status)); @@ -348,10 +430,42 @@ void lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int dept prs_uint32("status", ps, depth, &(r_q->status)); } +/******************************************************************* +makes a LSA_SID_ENUM structure. +********************************************************************/ +void make_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID **sids) +{ + int i, i2; + if (sen == NULL || sids == NULL) return; + + DEBUG(5,("make_lsa_sid_enum\n")); + + sen->num_entries = num_entries; + sen->ptr_sid_enum = num_entries != 0 ? 1 : 0; + sen->num_entries2 = num_entries; + + SMB_ASSERT_ARRAY(sen->sid, sen->num_entries); + + for (i = 0, i2 = 0; i < num_entries; i++) + { + if (sids[i] != NULL) + { + sen->ptr_sid[i] = 1; + make_dom_sid2(&(sen->sid[i2]), sids[i]); + i2++; + } + else + { + sen->ptr_sid[i] = 0; + } + } +} + /******************************************************************* reads or writes a LSA_SID_ENUM structure. ********************************************************************/ -static void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) +static void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, + prs_struct *ps, int depth) { int i; @@ -385,6 +499,27 @@ static void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int d } } +/******************************************************************* +makes an LSA_R_ENUM_TRUST_DOM structure. +********************************************************************/ +void make_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd, + int num_sids, DOM_SID **sids, + uint16 level) +{ + if (q_l == NULL) return; + + DEBUG(5,("make_r_enum_trust_dom\n")); + + memcpy(&(q_l->pol), hnd, sizeof(q_l->pol)); + make_lsa_sid_enum(&(q_l->sids), num_sids, sids); + + q_l->names.num_entries = 0; + q_l->names.ptr_trans_names = 0; + q_l->names.num_entries2 = 0; + + q_l->level.value = level; +} + /******************************************************************* reads or writes a LSA_Q_LOOKUP_SIDS structure. ********************************************************************/ @@ -397,10 +532,10 @@ void lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, in prs_align(ps); - smb_io_pol_hnd ("pol_hnd", &(q_s->pol_hnd), ps, depth); /* policy handle */ - lsa_io_sid_enum ("sids ", &(q_s->sids ), ps, depth); /* sids to be looked up */ - lsa_io_trans_names ("names ", &(q_s->names ), ps, depth); /* translated names */ - smb_io_lookup_level("switch ", &(q_s->level ), ps, depth); /* lookup level */ + smb_io_pol_hnd ("pol_hnd", &(q_s->pol), ps, depth); /* policy handle */ + lsa_io_sid_enum ("sids ", &(q_s->sids ), ps, depth); /* sids to be looked up */ + lsa_io_trans_names ("names ", &(q_s->names ), ps, depth); /* translated names */ + smb_io_lookup_level("switch ", &(q_s->level ), ps, depth); /* lookup level */ prs_uint32("mapped_count", ps, depth, &(q_s->mapped_count)); } @@ -408,7 +543,8 @@ void lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, in /******************************************************************* reads or writes a structure. ********************************************************************/ -static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth) +static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, + prs_struct *ps, int depth) { int i; int i2; @@ -422,25 +558,26 @@ static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct prs_uint32("num_entries ", ps, depth, &(trn->num_entries)); prs_uint32("ptr_trans_names", ps, depth, &(trn->ptr_trans_names)); - prs_uint32("num_entries2 ", ps, depth, &(trn->num_entries2)); - SMB_ASSERT_ARRAY(trn->ptr_name, trn->num_entries); + if (trn->ptr_trans_names != 0) + { + prs_uint32("num_entries2 ", ps, depth, &(trn->num_entries2)); - for (i = 0; i < trn->num_entries; i++) - { - fstring temp; - slprintf(temp, sizeof(temp) - 1, "ptr_name[%d] ", i); - prs_uint32(temp, ps, depth, &(trn->ptr_name[i])); /* pointer to translated name */ - } + SMB_ASSERT_ARRAY(trn->name, trn->num_entries); - for (i = 0, i2 = 0; i < trn->num_entries2; i++) - { - if (trn->ptr_name[i] != 0) + for (i = 0, i2 = 0; i < trn->num_entries2; i++) { - fstring temp; - slprintf(temp, sizeof(temp) - 1, "name[%d] ", i); - lsa_io_trans_name(temp, &(trn->name[i2]), ps, depth); /* translated name */ - i2++; + fstring t; + slprintf(t, sizeof(t) - 1, "name[%d] ", i); + + lsa_io_trans_name(t, &(trn->name[i]), ps, depth); /* translated name */ + + if (trn->name[i].hdr_name.buffer != 0) + { + smb_io_unistr2(t, &(trn->uni_name[i2]), 1, ps, depth); + prs_align(ps); + i2++; + } } } } @@ -460,6 +597,8 @@ void lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, i lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth); /* domain reference info */ lsa_io_trans_names("names ", r_s->names , ps, depth); /* translated names */ + prs_align(ps); + prs_uint32("mapped_count", ps, depth, &(r_s->mapped_count)); prs_uint32("status ", ps, depth, &(r_s->status)); @@ -479,7 +618,7 @@ void lsa_io_q_lookup_rids(char *desc, LSA_Q_LOOKUP_RIDS *q_r, prs_struct *ps, i prs_align(ps); - smb_io_pol_hnd("", &(q_r->pol_hnd), ps, depth); /* policy handle */ + smb_io_pol_hnd("", &(q_r->pol), ps, depth); /* policy handle */ prs_uint32("num_entries ", ps, depth, &(q_r->num_entries)); prs_uint32("num_entries2 ", ps, depth, &(q_r->num_entries2)); -- cgit From 732d4ff7dacce985fb209ee99569cef907e2cbf4 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 2 Oct 1998 21:09:23 +0000 Subject: Makefile.in : - added srvsvc client files clientgen.c : - replaced cli_error(cli, int *cls, int *err) with cli_error(cli, uint8 cls, uint32 *err). this version detects 32 bit status messages. the DOS error "MORE_DATA", the equivalent of the 32 bit *warning* 0x8000 0005 (STATUS_BUFFER_OVERFLOW), was being processed as an error, terminating the cli_receive_trans() call. cli_pipe.c : - replaced calls that had been incorrectly modified from 32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW) to 8 bit DOS errors (0x01 0xEA - MORE_DATA). the use of the old version of cli_error (DOS only) instead of the new one (DOS and 32 bit) caused the dce/rpc client code to fail. - replaced 2 space indentation with tab indentation in all functions. cli_srvsvc.c : cmd_srvsvc.c : - added these files back in, fixing them up to use jeremy's modified versions of the dce/rpc client functions. parse_srv.c : - added back in some "unused" functions required by dce/rpc client-side code. it would be helpful if all such "unused" functions could be added back in. rpcclient.c : - added "session", "file", "share", "connection" enumeration functions back in. these are equivalent to nt's "NetXXXXXEnum" Win32 (MSDN) functions. - added "srvinfo" function back in. this is equivalent to nt's NetServerGetInfo Win32 (MSDN) function. (This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d) --- source3/rpc_parse/parse_srv.c | 109 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 882ad9e59d..27b1ec2257 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -295,6 +295,29 @@ static void srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struc } } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, + char *srv_name, + uint32 share_level, SRV_SHARE_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd) +{ + if (q_n == NULL || ctr == NULL || hnd == NULL) return; + + q_n->ctr = ctr; + + DEBUG(5,("make_q_net_share_enum\n")); + + make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name); + + q_n->share_level = share_level; + q_n->preferred_len = preferred_len; + + memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -600,6 +623,30 @@ static void srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct } } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, + char *srv_name, char *qual_name, + uint32 sess_level, SRV_SESS_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd) +{ + if (q_n == NULL || ctr == NULL || hnd == NULL) return; + + q_n->ctr = ctr; + + DEBUG(5,("make_q_net_sess_enum\n")); + + make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name); + make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name); + + q_n->sess_level = sess_level; + q_n->preferred_len = preferred_len; + + memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -875,6 +922,30 @@ static void srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct } } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, + char *srv_name, char *qual_name, + uint32 conn_level, SRV_CONN_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd) +{ + if (q_n == NULL || ctr == NULL || hnd == NULL) return; + + q_n->ctr = ctr; + + DEBUG(5,("make_q_net_conn_enum\n")); + + make_buf_unistr2(&(q_n->uni_srv_name ), &(q_n->ptr_srv_name ), srv_name ); + make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name); + + q_n->conn_level = conn_level; + q_n->preferred_len = preferred_len; + + memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -1075,6 +1146,30 @@ static void srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct } } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, + char *srv_name, char *qual_name, + uint32 file_level, SRV_FILE_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd) +{ + if (q_n == NULL || ctr == NULL || hnd == NULL) return; + + q_n->ctr = ctr; + + DEBUG(5,("make_q_net_file_enum\n")); + + make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name); + make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name); + + q_n->file_level = file_level; + q_n->preferred_len = preferred_len; + + memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -1285,6 +1380,20 @@ static void srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int } } +/******************************************************************* + makes a SRV_Q_NET_SRV_GET_INFO structure. + ********************************************************************/ +void make_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv, + char *server_name, uint32 switch_value) +{ + if (srv == NULL) return; + + DEBUG(5,("make_srv_q_net_srv_get_info\n")); + + make_buf_unistr2(&(srv->uni_srv_name), &(srv->ptr_srv_name), server_name); + + srv->switch_value = switch_value; +} /******************************************************************* reads or writes a structure. -- cgit From c07b2bdf9032c870f7f50a9671e8d9fb0a56739a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 6 Oct 1998 22:03:04 +0000 Subject: dce/rpc (This used to be commit eb279cabd059603b6c8d9b74e4fd31c4ffe87593) --- source3/rpc_parse/parse_prs.c | 4 +- source3/rpc_parse/parse_rpc.c | 188 ++++++++++++++++++++++++++++++------------ 2 files changed, 136 insertions(+), 56 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 024ac88b18..f166bbd704 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -241,7 +241,7 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) (up to max size of pstring - 1024 chars). ********************************************************************/ -BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len) +BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, uint16 max_buf_size) { char *q = mem_data(&(ps->data), ps->offset); uint8 *start = (uint8*)q; @@ -265,7 +265,7 @@ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len) q++; - } while (i < sizeof(pstring) && (len == 0 ? str[i] != 0 : i < len) ); + } while (i < max_buf_size && (len == 0 ? str[i] != 0 : i < len) ); ps->offset += i+1; diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index ac01e7f0b1..2e7b950810 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -416,75 +416,155 @@ void smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int dep } /******************************************************************* -creates an RPC_AUTH_NTLMSSP_REQ structure. +creates an RPC_AUTH_NTLMSSP_NEG structure. ********************************************************************/ -void make_rpc_auth_ntlmssp_req(RPC_AUTH_NTLMSSP_REQ *req, - fstring ntlmssp_str, uint32 ntlmssp_ver, - uint32 unknown_0, fstring myname, fstring domain) +void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, + uint32 neg_flgs, + fstring myname, fstring domain) { int len_myname = strlen(myname); int len_domain = strlen(domain); - if (req == NULL) return; + if (neg == NULL) return; - fstrcpy(req->ntlmssp_str, ntlmssp_str); /* "NTLMSSP" */ - req->ntlmssp_ver = ntlmssp_ver; /* 0x0000 0001 */ + neg->neg_flgs = neg_flgs ; /* 0x00b2b3 */ - req->unknown_0 = unknown_0 ; /* 0x00b2b3 */ - make_str_hdr(&req->hdr_myname, len_myname, len_myname, 1); - make_str_hdr(&req->hdr_domain, len_domain, len_domain, 1); + make_str_hdr(&neg->hdr_myname, len_myname, len_myname, 1); + make_str_hdr(&neg->hdr_domain, len_domain, len_domain, 1); - fstrcpy(req->myname, myname); - fstrcpy(req->domain, domain); + fstrcpy(neg->myname, myname); + fstrcpy(neg->domain, domain); } /******************************************************************* -reads or writes an RPC_AUTH_NTLMSSP_REQ structure. +reads or writes an RPC_AUTH_NTLMSSP_NEG structure. ********************************************************************/ -void smb_io_rpc_auth_ntlmssp_req(char *desc, RPC_AUTH_NTLMSSP_REQ *req, prs_struct *ps, int depth) +void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) { - if (req == NULL) return; + if (neg == NULL) return; - prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_req"); + prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_neg"); depth++; - prs_string("ntlmssp_str", ps, depth, req->ntlmssp_str, 0); /* "NTLMSSP" */ - prs_uint32("ntlmssp_ver", ps, depth, &(req->ntlmssp_ver )); + prs_uint32("neg_flgs ", ps, depth, &(neg->neg_flgs)); - prs_uint32("unknown_0 ", ps, depth, &(req->unknown_0 )); - smb_io_strhdr("hdr_myname", &(req->hdr_myname), ps, depth); - smb_io_strhdr("hdr_domain", &(req->hdr_domain), ps, depth); + smb_io_strhdr("hdr_myname", &(neg->hdr_myname), ps, depth); + smb_io_strhdr("hdr_domain", &(neg->hdr_domain), ps, depth); - prs_string("myname", ps, depth, req->myname, req->hdr_myname.str_str_len); - prs_string("domain", ps, depth, req->domain, req->hdr_domain.str_str_len); + prs_string("myname", ps, depth, neg->myname, neg->hdr_myname.str_str_len, sizeof(neg->myname)); + prs_string("domain", ps, depth, neg->domain, neg->hdr_domain.str_str_len, sizeof(neg->domain)); +} + +/******************************************************************* +creates an RPC_AUTH_VERIFIER structure. +********************************************************************/ +void make_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, + uint8 auth_type, uint8 auth_level, + uint8 stub_type_len, + char *signature, uint32 msg_type) +{ + if (rav == NULL) return; + + rav->auth_type = auth_type; /* nt lm ssp 0x0a */ + rav->auth_level = auth_level; /* 0x06 */ + rav->stub_type_len = stub_type_len; /* 0x00 */ + rav->padding = 0; /* padding 0x00 */ + + rav->ptr_0 = 1; /* non-zero pointer to something */ + + fstrcpy(rav->signature, signature); /* "NTLMSSP" */ + rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */ +} + +/******************************************************************* +reads or writes an RPC_AUTH_VERIFIER structure. +********************************************************************/ +void smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +{ + if (rav == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); + depth++; + + prs_uint8("auth_type ", ps, depth, &(rav->auth_type)); /* nt lm ssp 0x0a */ + prs_uint8("auth_level ", ps, depth, &(rav->auth_level));/* 0x06 */ + prs_uint8("stub_type_len", ps, depth, &(rav->stub_type_len)); + prs_uint8("padding ", ps, depth, &(rav->padding)); + + prs_uint32("ptr_0", ps, depth, &(rav->ptr_0 )); /* non-zero pointer to something */ + + prs_string("signature", ps, depth, rav->signature, 0, sizeof(rav->signature)); /* "NTLMSSP" */ + prs_uint32("msg_type ", ps, depth, &(rav->msg_type )); /* NTLMSSP_MESSAGE_TYPE */ +} + +/******************************************************************* +creates an RPC_AUTH_NTLMSSP_CHAL structure. +********************************************************************/ +void make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, + uint32 neg_flags, + uint8 challenge[8]) +{ + if (chl == NULL) return; + + chl->unknown_1 = 0x0; + chl->unknown_2 = 0x00000028; + chl->neg_flags = neg_flags; /* 0x0082b1 */ + + memcpy(chl->challenge, challenge, sizeof(chl->challenge)); + bzero (chl->reserved , sizeof(chl->reserved)); +} + +/******************************************************************* +reads or writes an RPC_AUTH_NTLMSSP_CHAL structure. +********************************************************************/ +void smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth) +{ + if (chl == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chal"); + depth++; + + prs_uint32("unknown_1", ps, depth, &(chl->unknown_1)); /* 0x0000 0000 */ + prs_uint32("unknown_2", ps, depth, &(chl->unknown_2)); /* 0x0000 b2b3 */ + prs_uint32("neg_flags", ps, depth, &(chl->neg_flags)); /* 0x0000 82b1 */ + + prs_uint8s (False, "challenge", ps, depth, chl->challenge, sizeof(chl->challenge)); + prs_uint8s (False, "reserved ", ps, depth, chl->reserved , sizeof(chl->reserved )); } /******************************************************************* creates an RPC_AUTH_NTLMSSP_RESP structure. ********************************************************************/ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, - uint8 auth_type, uint8 auth_level, uint8 stub_type_len, - fstring ntlmssp_str, uint32 ntlmssp_ver, - uint32 unknown_1, uint32 unknown_2, uint32 unknown_3, - uint8 data[16]) + uchar lm_resp[24], uchar nt_resp[24], + char *domain, char *user, char *wks, + uint32 neg_flags) { - if (rsp == NULL) return; + int dom_len = strlen(domain) * 2; + int wks_len = strlen(wks ) * 2; + int usr_len = strlen(user ) * 2; + int lm_len = lm_resp != NULL ? 24 : 0; + int nt_len = nt_resp != NULL ? 24 : 0; - rsp->auth_type = auth_type; /* nt lm ssp 0x0a */ - rsp->auth_level = auth_level; /* 0x06 */ - rsp->stub_type_len = stub_type_len; /* dunno. */ - rsp->padding = 0; /* padding */ + if (rsp == NULL) return; - rsp->ptr_0 = 1; /* non-zero pointer to something */ + make_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, 1); + make_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, 1); + make_str_hdr(&rsp->hdr_domain , dom_len, dom_len, 1); + make_str_hdr(&rsp->hdr_usr , usr_len, usr_len, 1); + make_str_hdr(&rsp->hdr_wks , wks_len, wks_len, 1); + make_str_hdr(&rsp->hdr_sess_key, 0, 0, 1); - fstrcpy(rsp->ntlmssp_str, ntlmssp_str); /* "NTLMSSP" */ - rsp->ntlmssp_ver = ntlmssp_ver; /* 0x0000 0002 */ + rsp->neg_flags = neg_flags; - rsp->unknown_1 = unknown_1; /* 0x0000 0000 */ - rsp->unknown_2 = unknown_2; /* 0x00b2b3 */ - rsp->unknown_3 = unknown_3; /* 0x0082b1 */ + memcpy(&rsp->lm_resp, lm_resp, 24); + memcpy(&rsp->nt_resp, nt_resp, 24); + fstrcpy(rsp->domain, domain); + fstrcpy(rsp->user , user ); + fstrcpy(rsp->wks , wks ); + rsp->sess_key[0] = 0; - memcpy(rsp->data, data, sizeof(rsp->data)); /* 0x10 bytes of something, 8 of which are zeros */ + } /******************************************************************* @@ -497,21 +577,21 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_resp"); depth++; - prs_uint8("auth_type", ps, depth, &(rsp->auth_type)); /* nt lm ssp 0x0a */ - prs_uint8("auth_level", ps, depth, &(rsp->auth_level));/* 0x06 */ - prs_uint8("stub_type_len", ps, depth, &(rsp->stub_type_len)); - prs_uint8("padding", ps, depth, &(rsp->padding)); - - prs_uint32("ptr_0", ps, depth, &(rsp->ptr_0 )); /* non-zero pointer to something */ - - prs_string("ntlmssp_str", ps, depth, rsp->ntlmssp_str, 0); /* "NTLMSSP" */ - prs_uint32("ntlmssp_ver", ps, depth, &(rsp->ntlmssp_ver )); /* 0x0000 0002 */ - - prs_uint32("unknown_1", ps, depth, &(rsp->unknown_1)); /* 0x0000 0000 */ - prs_uint32("unknown_2", ps, depth, &(rsp->unknown_2)); /* 0x00b2b3 */ - prs_uint32("unknown_3", ps, depth, &(rsp->unknown_3)); /* 0x0082b1 */ - - prs_uint8s (False, "data", ps, depth, rsp->data, sizeof(rsp->data)); + smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); + smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); + smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); + smb_io_strhdr("hdr_user ", &rsp->hdr_usr , ps, depth); + smb_io_strhdr("hdr_wks ", &rsp->hdr_wks , ps, depth); + smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth); + + prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ + + prs_string("sess_key", ps, depth, rsp->sess_key, rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key)); + prs_string("wks ", ps, depth, rsp->wks , rsp->hdr_wks .str_str_len, sizeof(rsp->wks )); + prs_string("user ", ps, depth, rsp->user , rsp->hdr_usr .str_str_len, sizeof(rsp->user )); + prs_string("domain ", ps, depth, rsp->domain , rsp->hdr_domain .str_str_len, sizeof(rsp->domain )); + prs_string("nt_resp ", ps, depth, rsp->nt_resp , rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp )); + prs_string("lm_resp ", ps, depth, rsp->lm_resp , rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp )); } #if 0 -- cgit From f931d7181c944102f0d00311a5b8a7ae315f7bba Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 7 Oct 1998 01:01:26 +0000 Subject: put #if BROKEN_CODE around all the bits of code in rpc_parse.c that don't compile. Luke, you'll need to remove these when you've fixed the code. (This used to be commit 4f411d62640615ce94667ddb9946082e72e23bb6) --- source3/rpc_parse/parse_rpc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 2e7b950810..6a1d2f5713 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -551,19 +551,22 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, make_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, 1); make_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, 1); make_str_hdr(&rsp->hdr_domain , dom_len, dom_len, 1); +#if BROKEN_CODE make_str_hdr(&rsp->hdr_usr , usr_len, usr_len, 1); make_str_hdr(&rsp->hdr_wks , wks_len, wks_len, 1); make_str_hdr(&rsp->hdr_sess_key, 0, 0, 1); +#endif rsp->neg_flags = neg_flags; +#if BROKEN_CODE memcpy(&rsp->lm_resp, lm_resp, 24); memcpy(&rsp->nt_resp, nt_resp, 24); fstrcpy(rsp->domain, domain); fstrcpy(rsp->user , user ); fstrcpy(rsp->wks , wks ); rsp->sess_key[0] = 0; - +#endif } @@ -580,18 +583,22 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); +#if BROKEN_CODE smb_io_strhdr("hdr_user ", &rsp->hdr_usr , ps, depth); smb_io_strhdr("hdr_wks ", &rsp->hdr_wks , ps, depth); smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth); +#endif prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ +#if BROKEN_CODE prs_string("sess_key", ps, depth, rsp->sess_key, rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key)); prs_string("wks ", ps, depth, rsp->wks , rsp->hdr_wks .str_str_len, sizeof(rsp->wks )); prs_string("user ", ps, depth, rsp->user , rsp->hdr_usr .str_str_len, sizeof(rsp->user )); prs_string("domain ", ps, depth, rsp->domain , rsp->hdr_domain .str_str_len, sizeof(rsp->domain )); prs_string("nt_resp ", ps, depth, rsp->nt_resp , rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp )); prs_string("lm_resp ", ps, depth, rsp->lm_resp , rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp )); +#endif } #if 0 -- cgit From 2fef8f2e87f61043e3f1a2cf7d1f2a4ff9f119ff Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 7 Oct 1998 15:22:49 +0000 Subject: dce/rpc (This used to be commit 34afa638f6f7bb145ec094510ac58f7a22dfc3aa) --- source3/rpc_parse/parse_prs.c | 8 ++++++++ source3/rpc_parse/parse_rpc.c | 15 ++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index f166bbd704..34f72596ce 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -66,6 +66,14 @@ void prs_mem_free(prs_struct *ps) mem_buf_free(&(ps->data)); } +/******************************************************************* + link one parsing structure to another + ********************************************************************/ +void prs_link(prs_struct *ps, prs_struct const *const to) +{ + DEBUG(0,("NOT IMPLEMENTED\n")); +} + /******************************************************************* align a pointer to a multiple of align_offset bytes. looks like it will work for offsets of 0, 2 and 4... diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 6a1d2f5713..90a013dc12 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -470,7 +470,7 @@ void make_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, rav->stub_type_len = stub_type_len; /* 0x00 */ rav->padding = 0; /* padding 0x00 */ - rav->ptr_0 = 1; /* non-zero pointer to something */ + rav->ptr_0 = 0x0014a0c0; /* non-zero pointer to something */ fstrcpy(rav->signature, signature); /* "NTLMSSP" */ rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */ @@ -511,7 +511,9 @@ void make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, chl->neg_flags = neg_flags; /* 0x0082b1 */ memcpy(chl->challenge, challenge, sizeof(chl->challenge)); +/* bzero (chl->reserved , sizeof(chl->reserved)); + */ } /******************************************************************* @@ -529,7 +531,9 @@ void smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_st prs_uint32("neg_flags", ps, depth, &(chl->neg_flags)); /* 0x0000 82b1 */ prs_uint8s (False, "challenge", ps, depth, chl->challenge, sizeof(chl->challenge)); +/* prs_uint8s (False, "reserved ", ps, depth, chl->reserved , sizeof(chl->reserved )); + */ } /******************************************************************* @@ -551,22 +555,19 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, make_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, 1); make_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, 1); make_str_hdr(&rsp->hdr_domain , dom_len, dom_len, 1); -#if BROKEN_CODE make_str_hdr(&rsp->hdr_usr , usr_len, usr_len, 1); make_str_hdr(&rsp->hdr_wks , wks_len, wks_len, 1); make_str_hdr(&rsp->hdr_sess_key, 0, 0, 1); -#endif rsp->neg_flags = neg_flags; -#if BROKEN_CODE memcpy(&rsp->lm_resp, lm_resp, 24); memcpy(&rsp->nt_resp, nt_resp, 24); fstrcpy(rsp->domain, domain); fstrcpy(rsp->user , user ); fstrcpy(rsp->wks , wks ); rsp->sess_key[0] = 0; -#endif + } @@ -583,22 +584,18 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); -#if BROKEN_CODE smb_io_strhdr("hdr_user ", &rsp->hdr_usr , ps, depth); smb_io_strhdr("hdr_wks ", &rsp->hdr_wks , ps, depth); smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth); -#endif prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ -#if BROKEN_CODE prs_string("sess_key", ps, depth, rsp->sess_key, rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key)); prs_string("wks ", ps, depth, rsp->wks , rsp->hdr_wks .str_str_len, sizeof(rsp->wks )); prs_string("user ", ps, depth, rsp->user , rsp->hdr_usr .str_str_len, sizeof(rsp->user )); prs_string("domain ", ps, depth, rsp->domain , rsp->hdr_domain .str_str_len, sizeof(rsp->domain )); prs_string("nt_resp ", ps, depth, rsp->nt_resp , rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp )); prs_string("lm_resp ", ps, depth, rsp->lm_resp , rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp )); -#endif } #if 0 -- cgit From 48b31ae44fb2a1961bd738b0b3e7a986259168a2 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 7 Oct 1998 21:42:24 +0000 Subject: dce/rpc (This used to be commit 6677b888bdb45df00646eb7cc13005b9465ff971) --- source3/rpc_parse/parse_prs.c | 10 +- source3/rpc_parse/parse_rpc.c | 210 +++++++++++++++++++++++++++++++++--------- 2 files changed, 175 insertions(+), 45 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 34f72596ce..d031a828f1 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -69,9 +69,11 @@ void prs_mem_free(prs_struct *ps) /******************************************************************* link one parsing structure to another ********************************************************************/ -void prs_link(prs_struct *ps, prs_struct const *const to) +void prs_link(prs_struct *prev, prs_struct *ps, prs_struct *next) { - DEBUG(0,("NOT IMPLEMENTED\n")); + ps->data->offset.start = prev != NULL ? prev->data->offset.end : 0; + ps->data->offset.end = ps->data->offset.start + ps->offset; + ps->data->next = next != NULL ? next->data : NULL; } /******************************************************************* @@ -236,7 +238,7 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) ps->offset += i*2; - dump_data(5+depth, (char *)start, ps->offset); + dump_data(5+depth, (char *)start, i * 2); return True; } @@ -277,7 +279,7 @@ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, ui ps->offset += i+1; - dump_data(5+depth, (char *)start, ps->offset); + dump_data(5+depth, (char *)start, i); return True; } diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 90a013dc12..a1773bb827 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -415,6 +415,83 @@ void smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int dep prs_uint8 ("reserved ", ps, depth, &(rpc->reserved)); } +/******************************************************************* +creates an RPC_HDR_AUTHA structure. +********************************************************************/ +void make_rpc_hdr_autha(RPC_HDR_AUTHA *rai, + uint16 max_tsize, uint16 max_rsize, + uint8 auth_type, uint8 auth_level, + uint8 stub_type_len) +{ + if (rai == NULL) return; + + rai->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ + rai->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ + + rai->auth_type = auth_type; /* nt lm ssp 0x0a */ + rai->auth_level = auth_level; /* 0x06 */ + rai->stub_type_len = stub_type_len; /* 0x00 */ + rai->padding = 0; /* padding 0x00 */ + + rai->unknown = 0x0014a0c0; /* non-zero pointer to something */ +} + +/******************************************************************* +reads or writes an RPC_HDR_AUTHA structure. +********************************************************************/ +void smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) +{ + if (rai == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_autha"); + depth++; + + prs_uint16("max_tsize ", ps, depth, &(rai->max_tsize)); + prs_uint16("max_rsize ", ps, depth, &(rai->max_rsize)); + + prs_uint8 ("auth_type ", ps, depth, &(rai->auth_type )); /* 0x0a nt lm ssp */ + prs_uint8 ("auth_level ", ps, depth, &(rai->auth_level ));/* 0x06 */ + prs_uint8 ("stub_type_len", ps, depth, &(rai->stub_type_len)); + prs_uint8 ("padding ", ps, depth, &(rai->padding )); + + prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ +} + +/******************************************************************* +creates an RPC_HDR_AUTH structure. +********************************************************************/ +void make_rpc_hdr_auth(RPC_HDR_AUTH *rai, + uint8 auth_type, uint8 auth_level, + uint8 stub_type_len) +{ + if (rai == NULL) return; + + rai->auth_type = auth_type; /* nt lm ssp 0x0a */ + rai->auth_level = auth_level; /* 0x06 */ + rai->stub_type_len = stub_type_len; /* 0x00 */ + rai->padding = 0; /* padding 0x00 */ + + rai->unknown = 0x0014a0c0; /* non-zero pointer to something */ +} + +/******************************************************************* +reads or writes an RPC_HDR_AUTH structure. +********************************************************************/ +void smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) +{ + if (rai == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_auth"); + depth++; + + prs_uint8 ("auth_type ", ps, depth, &(rai->auth_type )); /* 0x0a nt lm ssp */ + prs_uint8 ("auth_level ", ps, depth, &(rai->auth_level ));/* 0x06 */ + prs_uint8 ("stub_type_len", ps, depth, &(rai->stub_type_len)); + prs_uint8 ("padding ", ps, depth, &(rai->padding )); + + prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ +} + /******************************************************************* creates an RPC_AUTH_NTLMSSP_NEG structure. ********************************************************************/ @@ -459,19 +536,10 @@ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru creates an RPC_AUTH_VERIFIER structure. ********************************************************************/ void make_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, - uint8 auth_type, uint8 auth_level, - uint8 stub_type_len, char *signature, uint32 msg_type) { if (rav == NULL) return; - rav->auth_type = auth_type; /* nt lm ssp 0x0a */ - rav->auth_level = auth_level; /* 0x06 */ - rav->stub_type_len = stub_type_len; /* 0x00 */ - rav->padding = 0; /* padding 0x00 */ - - rav->ptr_0 = 0x0014a0c0; /* non-zero pointer to something */ - fstrcpy(rav->signature, signature); /* "NTLMSSP" */ rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */ } @@ -486,13 +554,6 @@ void smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); depth++; - prs_uint8("auth_type ", ps, depth, &(rav->auth_type)); /* nt lm ssp 0x0a */ - prs_uint8("auth_level ", ps, depth, &(rav->auth_level));/* 0x06 */ - prs_uint8("stub_type_len", ps, depth, &(rav->stub_type_len)); - prs_uint8("padding ", ps, depth, &(rav->padding)); - - prs_uint32("ptr_0", ps, depth, &(rav->ptr_0 )); /* non-zero pointer to something */ - prs_string("signature", ps, depth, rav->signature, 0, sizeof(rav->signature)); /* "NTLMSSP" */ prs_uint32("msg_type ", ps, depth, &(rav->msg_type )); /* NTLMSSP_MESSAGE_TYPE */ } @@ -511,9 +572,7 @@ void make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, chl->neg_flags = neg_flags; /* 0x0082b1 */ memcpy(chl->challenge, challenge, sizeof(chl->challenge)); -/* bzero (chl->reserved , sizeof(chl->reserved)); - */ } /******************************************************************* @@ -531,19 +590,22 @@ void smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_st prs_uint32("neg_flags", ps, depth, &(chl->neg_flags)); /* 0x0000 82b1 */ prs_uint8s (False, "challenge", ps, depth, chl->challenge, sizeof(chl->challenge)); -/* prs_uint8s (False, "reserved ", ps, depth, chl->reserved , sizeof(chl->reserved )); - */ } /******************************************************************* creates an RPC_AUTH_NTLMSSP_RESP structure. + +*** lkclXXXX FUDGE! HAVE TO MANUALLY SPECIFY OFFSET HERE (0x1c bytes) *** +*** lkclXXXX the actual offset is at the start of the auth verifier *** + ********************************************************************/ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, uchar lm_resp[24], uchar nt_resp[24], char *domain, char *user, char *wks, uint32 neg_flags) { + uint32 offset; int dom_len = strlen(domain) * 2; int wks_len = strlen(wks ) * 2; int usr_len = strlen(user ) * 2; @@ -552,12 +614,24 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, if (rsp == NULL) return; - make_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, 1); - make_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, 1); - make_str_hdr(&rsp->hdr_domain , dom_len, dom_len, 1); - make_str_hdr(&rsp->hdr_usr , usr_len, usr_len, 1); - make_str_hdr(&rsp->hdr_wks , wks_len, wks_len, 1); - make_str_hdr(&rsp->hdr_sess_key, 0, 0, 1); + offset = 0x40; + + make_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, offset); + offset += lm_len * 2; + + make_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, offset); + offset += nt_len * 2; + + make_str_hdr(&rsp->hdr_domain , dom_len, dom_len, offset); + offset += dom_len * 2; + + make_str_hdr(&rsp->hdr_usr , usr_len, usr_len, offset); + offset += usr_len * 2; + + make_str_hdr(&rsp->hdr_wks , wks_len, wks_len, offset); + offset += wks_len * 2; + + make_str_hdr(&rsp->hdr_sess_key, 0, 0, offset); rsp->neg_flags = neg_flags; @@ -573,6 +647,10 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, /******************************************************************* reads or writes an RPC_AUTH_NTLMSSP_RESP structure. + +*** lkclXXXX FUDGE! HAVE TO MANUALLY SPECIFY OFFSET HERE (0x1c bytes) *** +*** lkclXXXX the actual offset is at the start of the auth verifier *** + ********************************************************************/ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) { @@ -581,21 +659,71 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_resp"); depth++; - smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); - smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); - smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); - smb_io_strhdr("hdr_user ", &rsp->hdr_usr , ps, depth); - smb_io_strhdr("hdr_wks ", &rsp->hdr_wks , ps, depth); - smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth); - - prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ - - prs_string("sess_key", ps, depth, rsp->sess_key, rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key)); - prs_string("wks ", ps, depth, rsp->wks , rsp->hdr_wks .str_str_len, sizeof(rsp->wks )); - prs_string("user ", ps, depth, rsp->user , rsp->hdr_usr .str_str_len, sizeof(rsp->user )); - prs_string("domain ", ps, depth, rsp->domain , rsp->hdr_domain .str_str_len, sizeof(rsp->domain )); - prs_string("nt_resp ", ps, depth, rsp->nt_resp , rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp )); - prs_string("lm_resp ", ps, depth, rsp->lm_resp , rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp )); + ZERO_STRUCTP(rsp); + + if (ps->io) + { + uint32 old_offset; + /* reading */ + smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); + smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); + smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); + smb_io_strhdr("hdr_user ", &rsp->hdr_usr , ps, depth); + smb_io_strhdr("hdr_wks ", &rsp->hdr_wks , ps, depth); + smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth); + + prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ + + old_offset = ps->offset; + + ps->offset = rsp->hdr_lm_resp .buffer + 0x1c; + prs_uint8s(False, "lm_resp ", ps, depth, rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); + old_offset += rsp->hdr_lm_resp .str_str_len; + + ps->offset = rsp->hdr_nt_resp .buffer + 0x1c; + prs_uint8s(False, "nt_resp ", ps, depth, rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); + old_offset += rsp->hdr_nt_resp .str_str_len; + + ps->offset = rsp->hdr_domain .buffer + 0x1c; + prs_uint8s(True , "domain ", ps, depth, rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); + old_offset += rsp->hdr_domain .str_str_len; + + ps->offset = rsp->hdr_usr .buffer + 0x1c; + prs_uint8s(True , "user ", ps, depth, rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); + old_offset += rsp->hdr_usr .str_str_len; + + ps->offset = rsp->hdr_wks .buffer + 0x1c; + prs_uint8s(True , "wks ", ps, depth, rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); + old_offset += rsp->hdr_wks .str_str_len; + + if (rsp->hdr_sess_key.str_str_len != 0) + { + ps->offset = rsp->hdr_sess_key.buffer + 0x1c; + old_offset += rsp->hdr_sess_key.str_str_len; + prs_uint8s(False, "sess_key", ps, depth, rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); + } + + ps->offset = old_offset; + } + else + { + /* writing */ + smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); + smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); + smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); + smb_io_strhdr("hdr_user ", &rsp->hdr_usr , ps, depth); + smb_io_strhdr("hdr_wks ", &rsp->hdr_wks , ps, depth); + smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth); + + prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ + + prs_uint8s(False, "sess_key", ps, depth, rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); + prs_uint8s(True , "wks ", ps, depth, rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); + prs_uint8s(True , "user ", ps, depth, rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); + prs_uint8s(True , "domain ", ps, depth, rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); + prs_uint8s(False, "nt_resp ", ps, depth, rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); + prs_uint8s(False, "lm_resp ", ps, depth, rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); + } } #if 0 -- cgit From 6909350ed9b87875ee40191b2e636c6049749195 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 8 Oct 1998 23:57:46 +0000 Subject: dce/rpc (This used to be commit 62fdeef1b79c5c4c9bf0e860881651711bb80b9a) --- source3/rpc_parse/parse_rpc.c | 178 ++++++++++++++++++++++++++---------------- 1 file changed, 112 insertions(+), 66 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index a1773bb827..2204207440 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -375,13 +375,13 @@ void smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) /******************************************************************* creates an RPC_HDR_REQ structure. ********************************************************************/ -void make_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 data_len, uint16 opnum) +void make_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum) { if (hdr == NULL) return; - hdr->alloc_hint = data_len - 0x18; /* allocation hint */ - hdr->context_id = 0; /* presentation context identifier */ - hdr->opnum = opnum; /* opnum */ + hdr->alloc_hint = alloc_hint; /* allocation hint */ + hdr->context_id = 0; /* presentation context identifier */ + hdr->opnum = opnum; /* opnum */ } /******************************************************************* @@ -492,6 +492,32 @@ void smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int dept prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ } +/******************************************************************* +creates an RPC_AUTH_VERIFIER structure. +********************************************************************/ +void make_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, + char *signature, uint32 msg_type) +{ + if (rav == NULL) return; + + fstrcpy(rav->signature, signature); /* "NTLMSSP" */ + rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */ +} + +/******************************************************************* +reads or writes an RPC_AUTH_VERIFIER structure. +********************************************************************/ +void smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +{ + if (rav == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); + depth++; + + prs_string("signature", ps, depth, rav->signature, 0, sizeof(rav->signature)); /* "NTLMSSP" */ + prs_uint32("msg_type ", ps, depth, &(rav->msg_type )); /* NTLMSSP_MESSAGE_TYPE */ +} + /******************************************************************* creates an RPC_AUTH_NTLMSSP_NEG structure. ********************************************************************/ @@ -506,8 +532,8 @@ void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, neg->neg_flgs = neg_flgs ; /* 0x00b2b3 */ - make_str_hdr(&neg->hdr_myname, len_myname, len_myname, 1); - make_str_hdr(&neg->hdr_domain, len_domain, len_domain, 1); + make_str_hdr(&neg->hdr_myname, len_myname, len_myname, 0x20); + make_str_hdr(&neg->hdr_domain, len_domain, len_domain, 0x20 + len_myname+1); fstrcpy(neg->myname, myname); fstrcpy(neg->domain, domain); @@ -532,32 +558,6 @@ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru prs_string("domain", ps, depth, neg->domain, neg->hdr_domain.str_str_len, sizeof(neg->domain)); } -/******************************************************************* -creates an RPC_AUTH_VERIFIER structure. -********************************************************************/ -void make_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, - char *signature, uint32 msg_type) -{ - if (rav == NULL) return; - - fstrcpy(rav->signature, signature); /* "NTLMSSP" */ - rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */ -} - -/******************************************************************* -reads or writes an RPC_AUTH_VERIFIER structure. -********************************************************************/ -void smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) -{ - if (rav == NULL) return; - - prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); - depth++; - - prs_string("signature", ps, depth, rav->signature, 0, sizeof(rav->signature)); /* "NTLMSSP" */ - prs_uint32("msg_type ", ps, depth, &(rav->msg_type )); /* NTLMSSP_MESSAGE_TYPE */ -} - /******************************************************************* creates an RPC_AUTH_NTLMSSP_CHAL structure. ********************************************************************/ @@ -606,30 +606,49 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, uint32 neg_flags) { uint32 offset; - int dom_len = strlen(domain) * 2; - int wks_len = strlen(wks ) * 2; - int usr_len = strlen(user ) * 2; + int dom_len = strlen(domain); + int wks_len = strlen(wks ); + int usr_len = strlen(user ); int lm_len = lm_resp != NULL ? 24 : 0; int nt_len = nt_resp != NULL ? 24 : 0; + DEBUG(5,("make_rpc_auth_ntlmssp_resp\n")); + if (rsp == NULL) return; +#ifdef DEBUG_PASSWORD + DEBUG(100,("lm_resp\n")); + dump_data(100, lm_resp, 24); + DEBUG(100,("nt_resp\n")); + dump_data(100, nt_resp, 24); +#endif + + DEBUG(6,("dom: %s user: %s wks: %s neg_flgs: 0x%x\n", + domain, user, wks, neg_flags)); + offset = 0x40; + if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) + { + dom_len *= 2; + wks_len *= 2; + usr_len *= 2; + } + make_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, offset); - offset += lm_len * 2; + offset += lm_len; make_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, offset); - offset += nt_len * 2; + offset += nt_len; make_str_hdr(&rsp->hdr_domain , dom_len, dom_len, offset); - offset += dom_len * 2; + offset += dom_len; make_str_hdr(&rsp->hdr_usr , usr_len, usr_len, offset); - offset += usr_len * 2; + offset += usr_len; make_str_hdr(&rsp->hdr_wks , wks_len, wks_len, offset); - offset += wks_len * 2; + offset += wks_len; make_str_hdr(&rsp->hdr_sess_key, 0, 0, offset); @@ -637,12 +656,20 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, memcpy(&rsp->lm_resp, lm_resp, 24); memcpy(&rsp->nt_resp, nt_resp, 24); - fstrcpy(rsp->domain, domain); - fstrcpy(rsp->user , user ); - fstrcpy(rsp->wks , wks ); - rsp->sess_key[0] = 0; - + if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) + { + struni2((uint16*)rsp->domain, domain); + struni2((uint16*)rsp->user , user ); + struni2((uint16*)rsp->wks , wks ); + } + else + { + fstrcpy(rsp->domain, domain); + fstrcpy(rsp->user , user ); + fstrcpy(rsp->wks , wks ); + } + rsp->sess_key[0] = 0; } /******************************************************************* @@ -659,12 +686,14 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_resp"); depth++; - ZERO_STRUCTP(rsp); - if (ps->io) { uint32 old_offset; + /* reading */ + + ZERO_STRUCTP(rsp); + smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); @@ -677,30 +706,30 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st old_offset = ps->offset; ps->offset = rsp->hdr_lm_resp .buffer + 0x1c; - prs_uint8s(False, "lm_resp ", ps, depth, rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); + prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); old_offset += rsp->hdr_lm_resp .str_str_len; ps->offset = rsp->hdr_nt_resp .buffer + 0x1c; - prs_uint8s(False, "nt_resp ", ps, depth, rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); + prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); old_offset += rsp->hdr_nt_resp .str_str_len; ps->offset = rsp->hdr_domain .buffer + 0x1c; - prs_uint8s(True , "domain ", ps, depth, rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); + prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); old_offset += rsp->hdr_domain .str_str_len; ps->offset = rsp->hdr_usr .buffer + 0x1c; - prs_uint8s(True , "user ", ps, depth, rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); + prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); old_offset += rsp->hdr_usr .str_str_len; ps->offset = rsp->hdr_wks .buffer + 0x1c; - prs_uint8s(True , "wks ", ps, depth, rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); + prs_uint8s(True , "wks ", ps, depth, (uint8*)rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); old_offset += rsp->hdr_wks .str_str_len; if (rsp->hdr_sess_key.str_str_len != 0) { ps->offset = rsp->hdr_sess_key.buffer + 0x1c; old_offset += rsp->hdr_sess_key.str_str_len; - prs_uint8s(False, "sess_key", ps, depth, rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); + prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); } ps->offset = old_offset; @@ -717,25 +746,42 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ - prs_uint8s(False, "sess_key", ps, depth, rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); - prs_uint8s(True , "wks ", ps, depth, rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); - prs_uint8s(True , "user ", ps, depth, rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); - prs_uint8s(True , "domain ", ps, depth, rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); - prs_uint8s(False, "nt_resp ", ps, depth, rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); prs_uint8s(False, "lm_resp ", ps, depth, rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); + prs_uint8s(False, "nt_resp ", ps, depth, rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); + prs_uint8s(True , "domain ", ps, depth, rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); + prs_uint8s(True , "user ", ps, depth, rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); + prs_uint8s(True , "wks ", ps, depth, rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); + prs_uint8s(False, "sess_key", ps, depth, rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); } } -#if 0 +/******************************************************************* +creates an RPC_AUTH_NTLMSSP_CHK structure. +********************************************************************/ +void make_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, + uint32 ver, uint32 crc32, uint32 seq_num) +{ + if (chk == NULL) return; -/* attached to the end of encrypted rpc requests and responses */ -/* RPC_AUTH_NTLMSSP_CHK */ -typedef struct rpc_auth_ntlmssp_chk_info + chk->ver = ver ; + chk->reserved = 0x0; + chk->crc32 = crc32 ; + chk->seq_num = seq_num ; +} + +/******************************************************************* +reads or writes an RPC_AUTH_NTLMSSP_CHK structure. +********************************************************************/ +void smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth) { - uint32 ver; /* 0x1 */ - uint8 data[12]; + if (chk == NULL) return; -} RPC_AUTH_NTLMSSP_CHK; + prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chk"); + depth++; -#endif /* 0 */ + prs_uint32("ver ", ps, depth, &(chk->ver )); + prs_uint32("reserved", ps, depth, &(chk->reserved)); + prs_uint32("crc32 ", ps, depth, &(chk->crc32 )); + prs_uint32("seq_num ", ps, depth, &(chk->seq_num )); +} -- cgit From 755986764f5a6b0ec25c7f20fde0a80eb4d121ba Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 9 Oct 1998 19:05:19 +0000 Subject: dce/rpc (This used to be commit 32d0f5e4a564686ad6b270dd24423ee49a81f223) --- source3/rpc_parse/parse_rpc.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 2204207440..43cb204681 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -554,8 +554,8 @@ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru smb_io_strhdr("hdr_myname", &(neg->hdr_myname), ps, depth); smb_io_strhdr("hdr_domain", &(neg->hdr_domain), ps, depth); - prs_string("myname", ps, depth, neg->myname, neg->hdr_myname.str_str_len, sizeof(neg->myname)); prs_string("domain", ps, depth, neg->domain, neg->hdr_domain.str_str_len, sizeof(neg->domain)); + prs_string("myname", ps, depth, neg->myname, neg->hdr_myname.str_str_len, sizeof(neg->myname)); } /******************************************************************* @@ -635,12 +635,6 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, usr_len *= 2; } - make_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, offset); - offset += lm_len; - - make_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, offset); - offset += nt_len; - make_str_hdr(&rsp->hdr_domain , dom_len, dom_len, offset); offset += dom_len; @@ -650,6 +644,12 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, make_str_hdr(&rsp->hdr_wks , wks_len, wks_len, offset); offset += wks_len; + make_str_hdr(&rsp->hdr_lm_resp, lm_len , lm_len , offset); + offset += lm_len; + + make_str_hdr(&rsp->hdr_nt_resp, nt_len , nt_len , offset); + offset += nt_len; + make_str_hdr(&rsp->hdr_sess_key, 0, 0, offset); rsp->neg_flags = neg_flags; @@ -705,14 +705,6 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st old_offset = ps->offset; - ps->offset = rsp->hdr_lm_resp .buffer + 0x1c; - prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); - old_offset += rsp->hdr_lm_resp .str_str_len; - - ps->offset = rsp->hdr_nt_resp .buffer + 0x1c; - prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); - old_offset += rsp->hdr_nt_resp .str_str_len; - ps->offset = rsp->hdr_domain .buffer + 0x1c; prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); old_offset += rsp->hdr_domain .str_str_len; @@ -725,6 +717,14 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st prs_uint8s(True , "wks ", ps, depth, (uint8*)rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); old_offset += rsp->hdr_wks .str_str_len; + ps->offset = rsp->hdr_lm_resp .buffer + 0x1c; + prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); + old_offset += rsp->hdr_lm_resp .str_str_len; + + ps->offset = rsp->hdr_nt_resp .buffer + 0x1c; + prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); + old_offset += rsp->hdr_nt_resp .str_str_len; + if (rsp->hdr_sess_key.str_str_len != 0) { ps->offset = rsp->hdr_sess_key.buffer + 0x1c; @@ -746,11 +746,11 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ - prs_uint8s(False, "lm_resp ", ps, depth, rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); - prs_uint8s(False, "nt_resp ", ps, depth, rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); prs_uint8s(True , "domain ", ps, depth, rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); prs_uint8s(True , "user ", ps, depth, rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); prs_uint8s(True , "wks ", ps, depth, rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); + prs_uint8s(False, "lm_resp ", ps, depth, rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); + prs_uint8s(False, "nt_resp ", ps, depth, rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); prs_uint8s(False, "sess_key", ps, depth, rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); } } -- cgit From 8158620124504a1ece1f1191cb8f273709039bd2 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 9 Oct 1998 20:17:11 +0000 Subject: dce/rpc. (This used to be commit e0445419b2d50ae6efef36f4f295ebcfdbf1ad82) --- source3/rpc_parse/parse_rpc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 43cb204681..213d694509 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -532,8 +532,8 @@ void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, neg->neg_flgs = neg_flgs ; /* 0x00b2b3 */ - make_str_hdr(&neg->hdr_myname, len_myname, len_myname, 0x20); - make_str_hdr(&neg->hdr_domain, len_domain, len_domain, 0x20 + len_myname+1); + make_str_hdr(&neg->hdr_myname, len_myname+1, len_myname+1, 0x20); + make_str_hdr(&neg->hdr_domain, len_domain+1, len_domain+1, 0x20 + len_myname+1); fstrcpy(neg->myname, myname); fstrcpy(neg->domain, domain); @@ -554,8 +554,8 @@ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru smb_io_strhdr("hdr_myname", &(neg->hdr_myname), ps, depth); smb_io_strhdr("hdr_domain", &(neg->hdr_domain), ps, depth); - prs_string("domain", ps, depth, neg->domain, neg->hdr_domain.str_str_len, sizeof(neg->domain)); - prs_string("myname", ps, depth, neg->myname, neg->hdr_myname.str_str_len, sizeof(neg->myname)); + prs_string("domain", ps, depth, neg->domain, neg->hdr_domain.str_str_len-1, sizeof(neg->domain)); + prs_string("myname", ps, depth, neg->myname, neg->hdr_myname.str_str_len-1, sizeof(neg->myname)); } /******************************************************************* -- cgit From abb67ee6deac030c4bc38e166cd3e3ab086ae285 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 9 Oct 1998 20:31:52 +0000 Subject: signed / unsigned issues spotted by herb (This used to be commit 0b90442021aa3adb5ae7f09c53c9e54c7655d8c5) --- source3/rpc_parse/parse_rpc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 213d694509..6b4deb00cf 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -746,12 +746,12 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ - prs_uint8s(True , "domain ", ps, depth, rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); - prs_uint8s(True , "user ", ps, depth, rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); - prs_uint8s(True , "wks ", ps, depth, rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); - prs_uint8s(False, "lm_resp ", ps, depth, rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); - prs_uint8s(False, "nt_resp ", ps, depth, rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); - prs_uint8s(False, "sess_key", ps, depth, rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); + prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); + prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); + prs_uint8s(True , "wks ", ps, depth, (uint8*)rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); + prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); + prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); + prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); } } -- cgit From 78c1fd054f25ae2d0fa57669a0db102bc916577c Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 9 Oct 1998 23:31:50 +0000 Subject: dce/rpc (This used to be commit 8a7ac4a25d177235a98c0f84f97ee50432fb6359) --- source3/rpc_parse/parse_samr.c | 197 ++++++++++++++++++++++++----------------- 1 file changed, 114 insertions(+), 83 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ab07e375f5..b71c209845 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2452,37 +2452,64 @@ void samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, i prs_uint32("status", ps, depth, &(r_u->status)); } - -#if 0 -/* SAMR_Q_CHGPASSWD_USER */ -typedef struct q_samr_chgpasswd_user_info +/******************************************************************* +makes a SAMR_Q_UNKNOWN_12 structure. +********************************************************************/ +void make_samr_q_unknown_12(SAMR_Q_UNKNOWN_12 *q_u, + POLICY_HND *pol, uint32 rid, + uint32 num_gids, uint32 *gid) { - uint32 ptr_0; + int i; + if (q_u == NULL) return; + + DEBUG(5,("make_samr_r_unknwon_12\n")); + + memcpy(&(q_u->pol), pol, sizeof(*pol)); + + q_u->num_gids1 = num_gids; + q_u->rid = rid; + q_u->ptr = 0; + q_u->num_gids2 = num_gids; - UNIHDR hdr_server; /* server name unicode header */ - UNISTR2 uni_server; /* server name unicode string */ + for (i = 0; i < num_gids; i++) + { + q_u->gid[i] = gid[i]; + } +} - UNIHDR hdr_user_name; /* username unicode string header */ - UNISTR2 uni_user_name; /* username unicode string */ - SAMR_ENC_PASSWD nt_newpass; - SAMR_ENC_HASH nt_oldhash; - uint32 unknown_1; /* seems to always contain 0001 */ - SAMR_ENC_PASSWD lm_newpass; - SAMR_ENC_HASH lm_oldhash; +/******************************************************************* +makes a SAMR_Q_UNKNOWN_21 structure. +********************************************************************/ +void make_samr_q_unknown_21(SAMR_Q_UNKNOWN_21 *q_c, + POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_unknown_21\n")); + + memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol)); + q_c->unknown_1 = unk_1; + q_c->unknown_2 = unk_2; +} -} SAMR_Q_CHGPASSWD_USER; -/* SAMR_R_CHGPASSWD_USER */ -typedef struct r_samr_chgpasswd_user_info +/******************************************************************* +makes a SAMR_Q_UNKNOWN_13 structure. +********************************************************************/ +void make_samr_q_unknown_13(SAMR_Q_UNKNOWN_13 *q_c, + POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) { - uint32 result; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */ + if (q_c == NULL || hnd == NULL) return; -} SAMR_R_CHGPASSWD_USER; + DEBUG(5,("make_samr_q_unknown_13\n")); -#endif /* 0 */ + memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol)); + q_c->unknown_1 = unk_1; + q_c->unknown_2 = unk_2; +} /******************************************************************* @@ -2554,6 +2581,17 @@ void samr_io_r_unknown_38(char *desc, SAMR_R_UNKNOWN_38 *r_u, prs_struct *ps, i prs_uint32("status", ps, depth, &(r_u->status)); } +/******************************************************************* +make a SAMR_ENC_PASSWD structure. +********************************************************************/ +void make_enc_passwd(SAMR_ENC_PASSWD *pwd, char pass[512]) +{ + if (pwd == NULL) return; + + pwd->ptr = 1; + memcpy(&(pwd->pass), pass, sizeof(pwd->pass)); +} + /******************************************************************* reads or writes a SAMR_ENC_PASSWD structure. ********************************************************************/ @@ -2570,6 +2608,17 @@ void samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD *pwd, prs_struct *ps, int de prs_uint8s(False, "pwd", ps, depth, pwd->pass, sizeof(pwd->pass)); } +/******************************************************************* +makes a SAMR_ENC_HASH structure. +********************************************************************/ +void make_enc_hash(SAMR_ENC_HASH *hsh, char hash[16]) +{ + if (hsh == NULL) return; + + hsh->ptr = 1; + memcpy(&(hsh->hash), hash, sizeof(hsh->hash)); +} + /******************************************************************* reads or writes a SAMR_ENC_HASH structure. ********************************************************************/ @@ -2586,95 +2635,77 @@ void samr_io_enc_hash(char *desc, SAMR_ENC_HASH *hsh, prs_struct *ps, int depth) prs_uint8s(False, "hash", ps, depth, hsh->hash, sizeof(hsh->hash)); } -#if 0 -/* SAMR_Q_CHGPASSWD_USER */ -typedef struct q_samr_chgpasswd_user_info +/******************************************************************* +makes a SAMR_R_UNKNOWN_38 structure. +********************************************************************/ +void make_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, + char *dest_host, char *user_name, + char nt_newpass[516], char nt_oldhash[16], + char lm_newpass[516], char lm_oldhash[16]) { - uint32 ptr_0; - - UNIHDR hdr_server; /* server name unicode header */ - UNISTR2 uni_server; /* server name unicode string */ - - UNIHDR hdr_user_name; /* username unicode string header */ - UNISTR2 uni_user_name; /* username unicode string */ - - SAMR_ENC_PASSWD nt_newpass; - SAMR_ENC_HASH nt_oldhash; + int len_dest_host = strlen(dest_host); + int len_user_name = strlen(user_name); - uint32 unknown_1; /* seems to always contain 0001 */ - - SAMR_ENC_PASSWD lm_newpass; - SAMR_ENC_HASH lm_oldhash; + if (q_u == NULL) return; -} SAMR_Q_CHGPASSWD_USER; + DEBUG(5,("make_samr_q_chgpasswd_user\n")); -/* SAMR_R_CHGPASSWD_USER */ -typedef struct r_samr_chgpasswd_user_info -{ - uint32 result; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */ + q_u->ptr_0 = 1; + make_uni_hdr(&(q_u->hdr_dest_host), len_dest_host, len_dest_host, len_dest_host != 0); + make_unistr2(&(q_u->uni_dest_host), dest_host, len_dest_host); + make_uni_hdr(&(q_u->hdr_user_name), len_user_name, len_user_name, len_user_name != 0); + make_unistr2(&(q_u->uni_user_name), user_name, len_user_name); -} SAMR_R_CHGPASSWD_USER; + make_enc_passwd(&(q_u->nt_newpass), nt_newpass); + make_enc_hash (&(q_u->nt_oldhash), nt_oldhash); -#endif /* 0 */ + q_u->unknown = 0x01; + make_enc_passwd(&(q_u->lm_newpass), lm_newpass); + make_enc_hash (&(q_u->lm_oldhash), lm_oldhash); +}; /******************************************************************* -makes a SAMR_Q_UNKNOWN_12 structure. +reads or writes a structure. ********************************************************************/ -void make_samr_q_unknown_12(SAMR_Q_UNKNOWN_12 *q_u, - POLICY_HND *pol, uint32 rid, - uint32 num_gids, uint32 *gid) +void samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER *q_u, prs_struct *ps, int depth) { - int i; if (q_u == NULL) return; - DEBUG(5,("make_samr_r_unknwon_12\n")); - - memcpy(&(q_u->pol), pol, sizeof(*pol)); - - q_u->num_gids1 = num_gids; - q_u->rid = rid; - q_u->ptr = 0; - q_u->num_gids2 = num_gids; - - for (i = 0; i < num_gids; i++) - { - q_u->gid[i] = gid[i]; - } -} + prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user"); + depth++; + prs_align(ps); + prs_uint32("ptr_0", ps, depth, &(q_u->ptr_0)); + smb_io_unihdr ("", &(q_u->hdr_dest_host), ps, depth); + smb_io_unistr2("", &(q_u->uni_dest_host), q_u->hdr_dest_host.buffer, ps, depth); + smb_io_unihdr ("", &(q_u->hdr_user_name), ps, depth); + smb_io_unistr2("", &(q_u->uni_user_name), q_u->hdr_user_name.buffer, ps, depth); -/******************************************************************* -makes a SAMR_Q_UNKNOWN_21 structure. -********************************************************************/ -void make_samr_q_unknown_21(SAMR_Q_UNKNOWN_21 *q_c, - POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) -{ - if (q_c == NULL || hnd == NULL) return; + samr_io_enc_passwd("nt_newpass", &(q_u->nt_newpass), ps, depth); + samr_io_enc_hash ("nt_oldhash", &(q_u->nt_oldhash), ps, depth); - DEBUG(5,("make_samr_q_unknown_21\n")); + prs_uint32("unknown", ps, depth, &(q_u->unknown)); - memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol)); - q_c->unknown_1 = unk_1; - q_c->unknown_2 = unk_2; + samr_io_enc_passwd("lm_newpass", &(q_u->lm_newpass), ps, depth); + samr_io_enc_hash ("lm_oldhash", &(q_u->lm_oldhash), ps, depth); } - /******************************************************************* -makes a SAMR_Q_UNKNOWN_13 structure. +reads or writes a structure. ********************************************************************/ -void make_samr_q_unknown_13(SAMR_Q_UNKNOWN_13 *q_c, - POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) +void samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER *r_u, prs_struct *ps, int depth) { - if (q_c == NULL || hnd == NULL) return; + if (r_u == NULL) return; - DEBUG(5,("make_samr_q_unknown_13\n")); + prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user"); + depth++; - memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol)); - q_c->unknown_1 = unk_1; - q_c->unknown_2 = unk_2; + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); } -- cgit From 935dc98f6670ba630bd2086ef9eddcc94a0562e2 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 14 Oct 1998 06:29:20 +0000 Subject: dce/rpc (This used to be commit 69f5f9f88935de1f63ffc9aa19c0629b395e66e6) --- source3/rpc_parse/parse_rpc.c | 44 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 6b4deb00cf..f9745da4b4 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -462,7 +462,8 @@ creates an RPC_HDR_AUTH structure. ********************************************************************/ void make_rpc_hdr_auth(RPC_HDR_AUTH *rai, uint8 auth_type, uint8 auth_level, - uint8 stub_type_len) + uint8 stub_type_len, + uint32 ptr) { if (rai == NULL) return; @@ -471,7 +472,7 @@ void make_rpc_hdr_auth(RPC_HDR_AUTH *rai, rai->stub_type_len = stub_type_len; /* 0x00 */ rai->padding = 0; /* padding 0x00 */ - rai->unknown = 0x0014a0c0; /* non-zero pointer to something */ + rai->unknown = ptr; /* non-zero pointer to something */ } /******************************************************************* @@ -532,8 +533,8 @@ void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, neg->neg_flgs = neg_flgs ; /* 0x00b2b3 */ - make_str_hdr(&neg->hdr_myname, len_myname+1, len_myname+1, 0x20); - make_str_hdr(&neg->hdr_domain, len_domain+1, len_domain+1, 0x20 + len_myname+1); + make_str_hdr(&neg->hdr_domain, len_domain, len_domain, 0x20 + len_myname); + make_str_hdr(&neg->hdr_myname, len_myname, len_myname, 0x20); fstrcpy(neg->myname, myname); fstrcpy(neg->domain, domain); @@ -551,11 +552,38 @@ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru prs_uint32("neg_flgs ", ps, depth, &(neg->neg_flgs)); - smb_io_strhdr("hdr_myname", &(neg->hdr_myname), ps, depth); - smb_io_strhdr("hdr_domain", &(neg->hdr_domain), ps, depth); + if (ps->io) + { + uint32 old_offset; + + /* reading */ + + ZERO_STRUCTP(neg); + + smb_io_strhdr("hdr_domain", &(neg->hdr_domain), ps, depth); + smb_io_strhdr("hdr_myname", &(neg->hdr_myname), ps, depth); + + old_offset = ps->offset; + + ps->offset = neg->hdr_myname .buffer + 0x1c; + prs_uint8s(True , "myname", ps, depth, (uint8*)neg->myname , MIN(neg->hdr_myname .str_str_len, sizeof(neg->myname ))); + old_offset += neg->hdr_myname .str_str_len; + + ps->offset = neg->hdr_domain .buffer + 0x1c; + prs_uint8s(True , "domain", ps, depth, (uint8*)neg->domain , MIN(neg->hdr_domain .str_str_len, sizeof(neg->domain ))); + old_offset += neg->hdr_domain .str_str_len; + + ps->offset = old_offset; + } + else + { + /* writing */ + smb_io_strhdr("hdr_domain", &(neg->hdr_domain), ps, depth); + smb_io_strhdr("hdr_myname", &(neg->hdr_myname), ps, depth); - prs_string("domain", ps, depth, neg->domain, neg->hdr_domain.str_str_len-1, sizeof(neg->domain)); - prs_string("myname", ps, depth, neg->myname, neg->hdr_myname.str_str_len-1, sizeof(neg->myname)); + prs_uint8s(True , "myname", ps, depth, (uint8*)neg->myname , MIN(neg->hdr_myname .str_str_len, sizeof(neg->myname ))); + prs_uint8s(True , "domain", ps, depth, (uint8*)neg->domain , MIN(neg->hdr_domain .str_str_len, sizeof(neg->domain ))); + } } /******************************************************************* -- cgit From a42afcdcc7ab9aa9ed193ae36d3dbb10843447f0 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 15 Oct 1998 05:47:29 +0000 Subject: bug-fixing against: AS/U: it returns dce/rpc "first" and "last" bits _clear_ in a bind/ack response, when they should be set in a (small) packet. they also, in the bind/ack do not set a secondary address string at all, so we can't check against that... Win95: client-side dce/rpc code is a bit odd. it does a "WaitNamedPipeState" and has slightly different pipe-naming (\PIPE\LANMAN is joined by \PIPE\SRVSVC, \PIPE\WINREG etc whereas nt just has \PIPE\LANMAN and \PIPE\). Win95-USRMGR.EXE: added LsaOpenPolicy (renamed existing to LsaOpenPolicy2). added SamrConnect (renamed existing to SamrConnect2). (This used to be commit a7fccd807b938cbb51002ebae8c7a48b40dbb655) --- source3/rpc_parse/parse_lsa.c | 67 ++++++++++++++++++++++++++++++++++++-- source3/rpc_parse/parse_samr.c | 73 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 129 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 40f05e0c3a..49a0951554 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -227,10 +227,11 @@ static void lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int } } + /******************************************************************* makes an LSA_Q_OPEN_POL structure. ********************************************************************/ -void make_q_open_pol(LSA_Q_OPEN_POL *r_q, char *server_name, +void make_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name, uint32 attributes, uint32 desired_access, LSA_SEC_QOS *qos) @@ -246,7 +247,7 @@ void make_q_open_pol(LSA_Q_OPEN_POL *r_q, char *server_name, r_q->des_access = desired_access; } - make_unistr2 (&(r_q->uni_server_name), server_name, strlen(server_name)); + r_q->system_name = system_name; make_lsa_obj_attr(&(r_q->attr ), attributes, qos); } @@ -261,8 +262,9 @@ void lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int dep depth++; prs_uint32("ptr ", ps, depth, &(r_q->ptr )); + prs_uint16("system_name", ps, depth, &(r_q->system_name )); + prs_align ( ps ); - smb_io_unistr2 ("", &(r_q->uni_server_name), r_q->ptr, ps, depth); lsa_io_obj_attr("", &(r_q->attr ), ps, depth); if (r_q->attr.ptr_sec_qos == 0) @@ -286,6 +288,65 @@ void lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int dep prs_uint32("status", ps, depth, &(r_p->status)); } +/******************************************************************* +makes an LSA_Q_OPEN_POL2 structure. +********************************************************************/ +void make_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, + uint32 attributes, + uint32 desired_access, + LSA_SEC_QOS *qos) +{ + if (r_q == NULL) return; + + DEBUG(5,("make_open_pol2: attr:%d da:%d\n", attributes, desired_access)); + + r_q->ptr = 1; /* undocumented pointer */ + + if (qos == NULL) + { + r_q->des_access = desired_access; + } + + make_unistr2 (&(r_q->uni_server_name), server_name, strlen(server_name)); + make_lsa_obj_attr(&(r_q->attr ), attributes, qos); +} + +/******************************************************************* +reads or writes an LSA_Q_OPEN_POL2 structure. +********************************************************************/ +void lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_q_open_pol2"); + depth++; + + prs_uint32("ptr ", ps, depth, &(r_q->ptr )); + + smb_io_unistr2 ("", &(r_q->uni_server_name), r_q->ptr, ps, depth); + lsa_io_obj_attr("", &(r_q->attr ), ps, depth); + + if (r_q->attr.ptr_sec_qos == 0) + { + prs_uint32("des_access", ps, depth, &(r_q->des_access)); + } +} + +/******************************************************************* +reads or writes an LSA_R_OPEN_POL2 structure. +********************************************************************/ +void lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int depth) +{ + if (r_p == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_r_open_pol2"); + depth++; + + smb_io_pol_hnd("", &(r_p->pol), ps, depth); + + prs_uint32("status", ps, depth, &(r_p->status)); +} + /******************************************************************* makes an LSA_Q_QUERY_INFO structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index b71c209845..eb882a7564 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2402,6 +2402,58 @@ void samr_io_r_connect(char *desc, SAMR_R_CONNECT *r_u, prs_struct *ps, int dep prs_uint32("status", ps, depth, &(r_u->status)); } +/******************************************************************* +makes a SAMR_Q_CONNECT_ANON structure. +********************************************************************/ +void make_samr_q_connect_anon(SAMR_Q_CONNECT_ANON *q_u) +{ + if (q_u == NULL) return; + + DEBUG(5,("make_q_connect_anon\n")); + + q_u->ptr = 1; + q_u->unknown_0 = 0x5c; + q_u->unknown_1 = 0x01; + q_u->unknown_2 = 0x20; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_connect_anon(char *desc, SAMR_Q_CONNECT_ANON *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_connect_anon"); + depth++; + + prs_align(ps); + + prs_uint32("ptr ", ps, depth, &(q_u->ptr )); + prs_uint16("unknown_0", ps, depth, &(q_u->unknown_0)); + prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1)); + prs_uint32("unknown_2", ps, depth, &(q_u->unknown_2)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_connect_anon(char *desc, SAMR_R_CONNECT_ANON *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_connect_anon"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("connect_pol", &(r_u->connect_pol), ps, depth); + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + /******************************************************************* makes a SAMR_Q_OPEN_ALIAS structure. ********************************************************************/ @@ -2552,16 +2604,16 @@ void samr_io_q_unknown_38(char *desc, SAMR_Q_UNKNOWN_38 *q_u, prs_struct *ps, i /******************************************************************* makes a SAMR_R_UNKNOWN_38 structure. ********************************************************************/ -void make_samr_r_unknown_38(SAMR_R_UNKNOWN_38 *r_u, - uint16 level, uint32 status) +void make_samr_r_unknown_38(SAMR_R_UNKNOWN_38 *r_u) { if (r_u == NULL) return; DEBUG(5,("make_r_unknown_38\n")); - r_u->level.value = level; - r_u->ptr_0 = 0; - r_u->status = status; + r_u->unk_0 = 0; + r_u->unk_1 = 0; + r_u->unk_2 = 0; + r_u->unk_3 = 0; } /******************************************************************* @@ -2576,9 +2628,14 @@ void samr_io_r_unknown_38(char *desc, SAMR_R_UNKNOWN_38 *r_u, prs_struct *ps, i prs_align(ps); - smb_io_lookup_level("level ", &(r_u->level), ps, depth); - prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0 )); - prs_uint32("status", ps, depth, &(r_u->status)); + prs_uint16("unk_0", ps, depth, &(r_u->unk_0)); + prs_align(ps); + prs_uint16("unk_1", ps, depth, &(r_u->unk_1)); + prs_align(ps); + prs_uint16("unk_2", ps, depth, &(r_u->unk_2)); + prs_align(ps); + prs_uint16("unk_3", ps, depth, &(r_u->unk_3)); + prs_align(ps); } /******************************************************************* -- cgit From c404bb775414139a4b07a73f79cf069a083acb26 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 15 Oct 1998 23:51:07 +0000 Subject: rpcclient interactive login (with trust account changing if you are root) cli_session_setup handles null sessions correctly (This used to be commit 60c0f22a4e84703467006dfe1971384a6294a9aa) --- source3/rpc_parse/parse_net.c | 69 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 12d6aca264..2fc0d12446 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -538,6 +538,75 @@ static int make_dom_sid2s(char *sids_str, DOM_SID2 *sids, int max_sids) return count; } +/******************************************************************* +makes a NET_ID_INFO_1 structure. +********************************************************************/ +void make_id_info1(NET_ID_INFO_1 *id, char *domain_name, + uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, + char *user_name, char *wksta_name, + char sess_key[16], + unsigned char lm_cypher[16], unsigned char nt_cypher[16]) +{ + int len_domain_name = strlen(domain_name); + int len_user_name = strlen(user_name ); + int len_wksta_name = strlen(wksta_name ); + + unsigned char lm_owf[16]; + unsigned char nt_owf[16]; + + if (id == NULL) return; + + DEBUG(5,("make_id_info1: %d\n", __LINE__)); + + id->ptr_id_info1 = 1; + + make_uni_hdr(&(id->hdr_domain_name), len_domain_name, len_domain_name, 4); + + id->param_ctrl = param_ctrl; + make_logon_id(&(id->logon_id), log_id_low, log_id_high); + + make_uni_hdr(&(id->hdr_user_name ), len_user_name , len_user_name , 4); + make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name , len_wksta_name , 4); + + 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, 16); + + memcpy(lm_cypher, lm_owf, 16); + SamOEMhash(lm_owf, key, False); + memcpy(lm_cypher, lm_owf, 16); + SamOEMhash(nt_owf, key, False); + +#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; + } + + make_owf_info(&(id->lm_owf), lm_cypher); + make_owf_info(&(id->nt_owf), nt_cypher); + + make_unistr2(&(id->uni_domain_name), domain_name, len_domain_name); + make_unistr2(&(id->uni_user_name ), user_name , len_user_name ); + make_unistr2(&(id->uni_wksta_name ), wksta_name , len_wksta_name ); +} + /******************************************************************* reads or writes an NET_ID_INFO_1 structure. ********************************************************************/ -- cgit From c9ab92ffe523a7061e97668becf08705db1d744f Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 16 Oct 1998 00:59:22 +0000 Subject: rpcclient ntlogin test (This used to be commit f69cf05ff56dffb313304964d5bf5e5aee2f40a7) --- source3/rpc_parse/parse_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 2fc0d12446..d99c4baac6 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -580,11 +580,11 @@ void make_id_info1(NET_ID_INFO_1 *id, char *domain_name, #endif memset(key, 0, 16); - memcpy(key, sess_key, 16); + memcpy(key, sess_key, 8); - memcpy(lm_cypher, lm_owf, 16); + memcpy(lm_owf, lm_cypher, 16); SamOEMhash(lm_owf, key, False); - memcpy(lm_cypher, lm_owf, 16); + memcpy(nt_owf, nt_cypher, 16); SamOEMhash(nt_owf, key, False); #ifdef DEBUG_PASSWORD -- cgit From a785f8d2c90f3db579c781ca5f722cb5b695fcb4 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 16 Oct 1998 23:40:59 +0000 Subject: dce/rpc (This used to be commit 29434f496c18e816d864060d68f357aea6ef5de8) --- source3/rpc_parse/parse_samr.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index eb882a7564..a443191a7a 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2357,6 +2357,7 @@ void make_samr_q_connect(SAMR_Q_CONNECT *q_u, DEBUG(5,("make_q_connect\n")); /* make PDC server name \\server */ + q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0; make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name); /* example values: 0x0000 0002 */ @@ -2750,6 +2751,18 @@ void samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER *q_u, prs_struct samr_io_enc_hash ("lm_oldhash", &(q_u->lm_oldhash), ps, depth); } +/******************************************************************* +makes a SAMR_R_CHGPASSWD_USER structure. +********************************************************************/ +void make_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER *r_u, uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_r_chgpasswd_user\n")); + + r_u->status = status; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ -- cgit From 01de6030843f5f402dee8bf72f564a91ae8437ca Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 19 Oct 1998 17:32:10 +0000 Subject: - dce/rpc code - removed debug info in struni2 and unistr2 (security risk) - rpc_pipe function was getting pointer to data then calling realloc *dur* - password check function, the start of "credential checking", user, wks, domain, pass as the credentials (not just user,pass which is incorrect in a domain context) - cli_write needs to return ssize_t not size_t, because total can be -1 if the write fails. - fixed signed / unsigned warnings (how come i don't get those any more when i compile with gcc???) - nt password change added in smbd. yes, jeremy, i verified that the SMBtrans2 version still works. (This used to be commit fcfb40d2b0fc565ee4f66b3a3761c246366a2ef3) --- source3/rpc_parse/parse_rpc.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index f9745da4b4..44f95c7e0c 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -457,6 +457,14 @@ void smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int de prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ } +/******************************************************************* +checks an RPC_HDR_AUTH structure. +********************************************************************/ +BOOL rpc_hdr_auth_chk(RPC_HDR_AUTH *rai) +{ + return (rai->auth_type == 0x0a && rai->auth_level == 0x06); +} + /******************************************************************* creates an RPC_HDR_AUTH structure. ********************************************************************/ @@ -493,6 +501,15 @@ void smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int dept prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ } +/******************************************************************* +checks an RPC_AUTH_VERIFIER structure. +********************************************************************/ +BOOL rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav, + char *signature, uint32 msg_type) +{ + return (strequal(rav->signature, signature) && rav->msg_type == msg_type); +} + /******************************************************************* creates an RPC_AUTH_VERIFIER structure. ********************************************************************/ @@ -783,6 +800,30 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st } } +/******************************************************************* +checks an RPC_AUTH_NTLMSSP_CHK structure. +********************************************************************/ +BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 *seq_num) +{ + if (chk == NULL || seq_num == NULL) + { + return False; + } + + if (chk->crc32 != crc32 || + chk->ver != NTLMSSP_SIGN_VERSION || + chk->seq_num != (*seq_num)) + { + DEBUG(5,("verify failed - crc %x ver %x seq %d\n", + crc32, NTLMSSP_SIGN_VERSION, (*seq_num)-1)); + DEBUG(5,("verify expect - crc %x ver %x seq %d\n", + chk->crc32, chk->ver, chk->seq_num)); + return False; + } + (*seq_num)++; + return True; +} + /******************************************************************* creates an RPC_AUTH_NTLMSSP_CHK structure. ********************************************************************/ -- cgit From 476d0fd23682452d0d9f56ff2e166243d74cfdbc Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 20 Oct 1998 16:24:57 +0000 Subject: calls to prs_grow() on array structures so that data construction doesn't over-run buffers (This used to be commit 06cc6eaa50fa4b673d527e91740f9d2d2b16d367) --- source3/rpc_parse/parse_samr.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a443191a7a..5797fab31f 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -999,11 +999,13 @@ static void sam_io_sam_info_2(char *desc, SAM_INFO_2 *sam, prs_struct *ps, int for (i = 0; i < sam->num_entries; i++) { + prs_grow(ps); sam_io_sam_entry2("", &(sam->sam[i]), ps, depth); } for (i = 0; i < sam->num_entries; i++) { + prs_grow(ps); sam_io_sam_str2 ("", &(sam->str[i]), sam->sam[i].hdr_srv_name.buffer, sam->sam[i].hdr_srv_desc.buffer, @@ -1082,11 +1084,13 @@ static void sam_io_sam_info_1(char *desc, SAM_INFO_1 *sam, prs_struct *ps, int for (i = 0; i < sam->num_entries; i++) { + prs_grow(ps); sam_io_sam_entry1("", &(sam->sam[i]), ps, depth); } for (i = 0; i < sam->num_entries; i++) { + prs_grow(ps); sam_io_sam_str1 ("", &(sam->str[i]), sam->sam[i].hdr_acct_name.buffer, sam->sam[i].hdr_user_name.buffer, @@ -1300,11 +1304,13 @@ void samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_str for (i = 0; i < r_u->num_entries; i++) { + prs_grow(ps); sam_io_sam_entry3("", &(r_u->sam[i]), ps, depth); } for (i = 0; i < r_u->num_entries; i++) { + prs_grow(ps); sam_io_sam_str3 ("", &(r_u->str[i]), r_u->sam[i].hdr_grp_name.buffer, r_u->sam[i].hdr_grp_desc.buffer, @@ -1472,6 +1478,7 @@ void samr_io_q_lookup_ids(char *desc, SAMR_Q_LOOKUP_IDS *q_u, prs_struct *ps, i { if (q_u->ptr_sid[i] != 0) { + prs_grow(ps); slprintf(tmp, sizeof(tmp)-1, "sid[%02d]", i); smb_io_dom_sid2(tmp, &(q_u->sid[i]), ps, depth); } @@ -1573,10 +1580,12 @@ void samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *p for (i = 0; i < q_u->num_rids2; i++) { + prs_grow(ps); smb_io_unihdr ("", &(q_u->hdr_user_name[i]), ps, depth); } for (i = 0; i < q_u->num_rids2; i++) { + prs_grow(ps); smb_io_unistr2("", &(q_u->uni_user_name[i]), q_u->hdr_user_name[i].buffer, ps, depth); } @@ -1644,6 +1653,7 @@ void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p for (i = 0; i < r_u->num_entries2; i++) { + prs_grow(ps); smb_io_dom_rid3("", &(r_u->dom_rid[i]), ps, depth); } @@ -1681,6 +1691,7 @@ void samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, i for (i = 0; i < q_u->num_gids2; i++) { + prs_grow(ps); slprintf(tmp, sizeof(tmp) - 1, "gid[%02d] ", i); prs_uint32(tmp, ps, depth, &(q_u->gid[i])); } @@ -1759,11 +1770,13 @@ void samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, i for (i = 0; i < r_u->num_aliases2; i++) { + prs_grow(ps); slprintf(tmp, sizeof(tmp) - 1, "als_hdr[%02d] ", i); smb_io_unihdr ("", &(r_u->hdr_als_name[i]), ps, depth); } for (i = 0; i < r_u->num_aliases2; i++) { + prs_grow(ps); slprintf(tmp, sizeof(tmp) - 1, "als_str[%02d] ", i); smb_io_unistr2("", &(r_u->uni_als_name[i]), r_u->hdr_als_name[i].buffer, ps, depth); } @@ -1781,6 +1794,7 @@ void samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, i for (i = 0; i < r_u->num_als_usrs2; i++) { + prs_grow(ps); slprintf(tmp, sizeof(tmp) - 1, "als_usrs[%02d] ", i); prs_uint32(tmp, ps, depth, &(r_u->num_als_usrs[i])); } @@ -1931,6 +1945,7 @@ void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_s for (i = 0; i < r_u->num_entries2; i++) { + prs_grow(ps); smb_io_gid("", &(r_u->gid[i]), ps, depth); } } @@ -2413,7 +2428,7 @@ void make_samr_q_connect_anon(SAMR_Q_CONNECT_ANON *q_u) DEBUG(5,("make_q_connect_anon\n")); q_u->ptr = 1; - q_u->unknown_0 = 0x5c; + q_u->unknown_0 = 0x5c; /* server name (?!!) */ q_u->unknown_1 = 0x01; q_u->unknown_2 = 0x20; } @@ -2531,8 +2546,6 @@ void make_samr_q_unknown_12(SAMR_Q_UNKNOWN_12 *q_u, } - - /******************************************************************* makes a SAMR_Q_UNKNOWN_21 structure. ********************************************************************/ @@ -2743,11 +2756,13 @@ void samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER *q_u, prs_struct smb_io_unistr2("", &(q_u->uni_user_name), q_u->hdr_user_name.buffer, ps, depth); samr_io_enc_passwd("nt_newpass", &(q_u->nt_newpass), ps, depth); + prs_grow(ps); samr_io_enc_hash ("nt_oldhash", &(q_u->nt_oldhash), ps, depth); prs_uint32("unknown", ps, depth, &(q_u->unknown)); samr_io_enc_passwd("lm_newpass", &(q_u->lm_newpass), ps, depth); + prs_grow(ps); samr_io_enc_hash ("lm_oldhash", &(q_u->lm_oldhash), ps, depth); } -- cgit From 9307940876a6c226969e9169d55c0408cd7ab032 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 21 Oct 1998 01:35:01 +0000 Subject: fixing smbd encrypted rpcs (data lens, alloc hints, sequence nums argh). put unicode strings after SAMLOGON query regardless of whether it's an NT mailslot or a non-NT mailslot, after having observed this behaviour out of NT machines. (This used to be commit c101113ec20ed0ba633e78e4ee45596cdccaf1b5) --- source3/rpc_parse/parse_rpc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 44f95c7e0c..6b5da0ef56 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -559,6 +559,9 @@ void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, /******************************************************************* reads or writes an RPC_AUTH_NTLMSSP_NEG structure. + +*** lkclXXXX HACK ALERT! *** + ********************************************************************/ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) { @@ -582,11 +585,11 @@ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru old_offset = ps->offset; - ps->offset = neg->hdr_myname .buffer + 0x1c; + ps->offset = neg->hdr_myname .buffer + 0x50; /* lkclXXXX HACK! */ prs_uint8s(True , "myname", ps, depth, (uint8*)neg->myname , MIN(neg->hdr_myname .str_str_len, sizeof(neg->myname ))); old_offset += neg->hdr_myname .str_str_len; - ps->offset = neg->hdr_domain .buffer + 0x1c; + ps->offset = neg->hdr_domain .buffer + 0x50; /* lkclXXXX HACK! */ prs_uint8s(True , "domain", ps, depth, (uint8*)neg->domain , MIN(neg->hdr_domain .str_str_len, sizeof(neg->domain ))); old_offset += neg->hdr_domain .str_str_len; @@ -803,24 +806,23 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st /******************************************************************* checks an RPC_AUTH_NTLMSSP_CHK structure. ********************************************************************/ -BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 *seq_num) +BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 seq_num) { - if (chk == NULL || seq_num == NULL) + if (chk == NULL) { return False; } if (chk->crc32 != crc32 || chk->ver != NTLMSSP_SIGN_VERSION || - chk->seq_num != (*seq_num)) + chk->seq_num != seq_num) { DEBUG(5,("verify failed - crc %x ver %x seq %d\n", - crc32, NTLMSSP_SIGN_VERSION, (*seq_num)-1)); + crc32, NTLMSSP_SIGN_VERSION, seq_num)); DEBUG(5,("verify expect - crc %x ver %x seq %d\n", chk->crc32, chk->ver, chk->seq_num)); return False; } - (*seq_num)++; return True; } -- cgit From 477350638399b8ff264100c7832c14df719055f3 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 21 Oct 1998 16:28:44 +0000 Subject: signed / unsigned issues (This used to be commit bd2fc6bb85739cb8e7ed2254e2a553486daed054) --- source3/rpc_parse/parse_samr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 5797fab31f..3fab30bf8b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2734,7 +2734,7 @@ void make_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, make_enc_passwd(&(q_u->lm_newpass), lm_newpass); make_enc_hash (&(q_u->lm_oldhash), lm_oldhash); -}; +} /******************************************************************* reads or writes a structure. -- cgit From ac9be4ddca99c5efae518a985b97fb1fb6374289 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 21 Oct 1998 16:54:23 +0000 Subject: oops! (This used to be commit 500e5536bee8ea8e58d5991bfab2cff923068926) --- source3/rpc_parse/parse_samr.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 3fab30bf8b..58f726b6e4 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2067,16 +2067,16 @@ void make_sam_user_info21(SAM_USER_INFO_21 *usr, usr->pass_can_change_time = *pass_can_change_time; usr->pass_must_change_time = *pass_must_change_time; - make_uni_hdr(&(usr->hdr_user_name ), len_user_name , len_user_name , len_user_name != 0); - make_uni_hdr(&(usr->hdr_full_name ), len_full_name , len_full_name , len_full_name != 0); - make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir , len_home_dir , len_home_dir != 0); - make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive , len_dir_drive , len_dir_drive != 0); - make_uni_hdr(&(usr->hdr_logon_script), len_logon_script, len_logon_script, len_logon_script != 0); - make_uni_hdr(&(usr->hdr_profile_path), len_profile_path, len_profile_path, len_profile_path != 0); - make_uni_hdr(&(usr->hdr_acct_desc ), len_description , len_description , len_description != 0); - make_uni_hdr(&(usr->hdr_workstations), len_workstations, len_workstations, len_workstations != 0); - make_uni_hdr(&(usr->hdr_unknown_str ), len_unknown_str , len_unknown_str , len_workstations != 0); - make_uni_hdr(&(usr->hdr_munged_dial ), len_munged_dial , len_munged_dial , len_workstations != 0); + make_uni_hdr(&(usr->hdr_user_name ), len_user_name , len_user_name , 1); + make_uni_hdr(&(usr->hdr_full_name ), len_full_name , len_full_name , 1); + make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir , len_home_dir , 1); + make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive , len_dir_drive , 1); + make_uni_hdr(&(usr->hdr_logon_script), len_logon_script, len_logon_script, 1); + make_uni_hdr(&(usr->hdr_profile_path), len_profile_path, len_profile_path, 1); + make_uni_hdr(&(usr->hdr_acct_desc ), len_description , len_description , 1); + make_uni_hdr(&(usr->hdr_workstations), len_workstations, len_workstations, 1); + make_uni_hdr(&(usr->hdr_unknown_str ), len_unknown_str , len_unknown_str , 1); + make_uni_hdr(&(usr->hdr_munged_dial ), len_munged_dial , len_munged_dial , 1); bzero(usr->nt_pwd, sizeof(usr->nt_pwd)); bzero(usr->lm_pwd, sizeof(usr->lm_pwd)); -- cgit From 6e3af45afe237790f1d7cd94ab2b22e1ca772157 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 21 Oct 1998 16:58:34 +0000 Subject: Fixed mainly signed/unsigned issues found by SGI cc in -fullwarn mode. smbd/chgpasswd.c: Fixed (my) stupid bug where I was returning stack based variables. Doh ! smbd/trans2.c: Allows SETFILEINFO as well as QFILEINFO on directory handles. Jeremy. (This used to be commit 0b44d27d0b5cc3948a6c2d78370ccddf1a84cd80) --- source3/rpc_parse/parse_samr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 58f726b6e4..40041e67c5 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2682,7 +2682,7 @@ void samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD *pwd, prs_struct *ps, int de /******************************************************************* makes a SAMR_ENC_HASH structure. ********************************************************************/ -void make_enc_hash(SAMR_ENC_HASH *hsh, char hash[16]) +void make_enc_hash(SAMR_ENC_HASH *hsh, uchar hash[16]) { if (hsh == NULL) return; @@ -2711,8 +2711,8 @@ makes a SAMR_R_UNKNOWN_38 structure. ********************************************************************/ void make_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, char *dest_host, char *user_name, - char nt_newpass[516], char nt_oldhash[16], - char lm_newpass[516], char lm_oldhash[16]) + char nt_newpass[516], uchar nt_oldhash[16], + char lm_newpass[516], uchar lm_oldhash[16]) { int len_dest_host = strlen(dest_host); int len_user_name = strlen(user_name); -- cgit From 21e107fd42eb953affac28239588458c6c0ee323 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 21 Oct 1998 21:11:16 +0000 Subject: the next dialog: user-groups. it's not very sensible what appears, but hey: it appears! (This used to be commit 399035098f212e976cc0000a215e0705ebe78c05) --- source3/rpc_parse/parse_samr.c | 325 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 322 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 40041e67c5..416498a186 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -130,6 +130,67 @@ void samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN *r_u, prs_struct *ps, prs_uint32("status", ps, depth, &(r_u->status)); } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_samr_q_unknown_2c(SAMR_Q_UNKNOWN_2C *q_u, POLICY_HND *user_pol) +{ + if (q_u == NULL) return; + + DEBUG(5,("samr_make_q_unknown_2c\n")); + + memcpy(&q_u->user_pol, user_pol, sizeof(q_u->user_pol)); +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_unknown_2c(char *desc, SAMR_Q_UNKNOWN_2C *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_unknown_2c"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("user_pol", &(q_u->user_pol), ps, depth); + prs_align(ps); +} + +/******************************************************************* +makes a structure. +********************************************************************/ +void make_samr_r_unknown_2c(SAMR_R_UNKNOWN_2C *q_u, uint32 status) +{ + if (q_u == NULL) return; + + DEBUG(5,("samr_make_r_unknown_2c\n")); + + q_u->unknown_0 = 0x00160000; + q_u->unknown_1 = 0x00000000; + q_u->status = status; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_unknown_2c(char *desc, SAMR_R_UNKNOWN_2C *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_unknown_2c"); + depth++; + + prs_align(ps); + + prs_uint32("unknown_0", ps, depth, &(r_u->unknown_0)); + prs_uint32("unknown_1", ps, depth, &(r_u->unknown_1)); + prs_uint32("status ", ps, depth, &(r_u->status )); +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -196,6 +257,139 @@ void samr_io_q_unknown_8(char *desc, SAMR_Q_UNKNOWN_8 *q_u, prs_struct *ps, int prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); prs_align(ps); } + +/******************************************************************* +makes a structure. +********************************************************************/ +void make_unk_info2(SAM_UNK_INFO_2 *u_2, char *domain, char *server) +{ + int len_domain = strlen(domain); + int len_server = strlen(server); + + if (u_2 == NULL) return; + + u_2->unknown_0 = 0x00000000; + u_2->unknown_1 = 0x80000000; + u_2->unknown_2 = 0x00000000; + + u_2->ptr_0 = 1; + make_uni_hdr(&(u_2->hdr_domain), len_domain, len_domain, 1); + make_uni_hdr(&(u_2->hdr_server), len_server, len_server, 1); + + u_2->unknown_4 = 0x10000000; + u_2->unknown_5 = 0x00000000; + + u_2->unknown_6 = 0x00000001; + u_2->unknown_7 = 0x00000003; + u_2->unknown_8 = 0x00000001; + u_2->unknown_9 = 0x00000008; + u_2->unknown_10 = 0x00000003; + + memset(u_2->padding, 0, sizeof(u_2->padding)); /* 16 bytes zeros */ + + make_unistr2(&u_2->uni_domain, domain, len_domain); + make_unistr2(&u_2->uni_server, server, len_server); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 *u_2, prs_struct *ps, int depth) +{ + if (u_2 == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_unk_info2"); + depth++; + + prs_uint32("unknown_0", ps, depth, &u_2->unknown_0); /* 0x0000 0000 */ + prs_uint32("unknown_1", ps, depth, &u_2->unknown_1); /* 0x8000 0000 */ + prs_uint32("unknown_2", ps, depth, &u_2->unknown_2); /* 0x0000 0000 */ + + prs_uint32("ptr_0", ps, depth, &u_2->ptr_0); /* pointer to unknown structure */ + smb_io_unihdr("hdr_domain", &u_2->hdr_domain, ps, depth); /* domain name unicode header */ + smb_io_unihdr("hdr_server", &u_2->hdr_server, ps, depth); /* server name unicode header */ + + /* put all the data in here, at the moment, including what the above + pointer is referring to + */ + + prs_uint32("unknown_4 ", ps, depth, &u_2->unknown_4 ); /* 0x0000 0099 or 0x1000 0000 */ + prs_uint32("unknown_5 ", ps, depth, &u_2->unknown_5 ); /* 0x0000 0000 */ + + prs_uint32("unknown_6 ", ps, depth, &u_2->unknown_6 ); /* 0x0000 0001 */ + prs_uint32("unknown_7 ", ps, depth, &u_2->unknown_7 ); /* 0x0000 0003 */ + prs_uint32("unknown_8 ", ps, depth, &u_2->unknown_8 ); /* 0x0000 0001 */ + prs_uint32("unknown_9 ", ps, depth, &u_2->unknown_9 ); /* 0x0000 0008 */ + prs_uint32("unknown_10", ps, depth, &u_2->unknown_10); /* 0x0000 0003 */ + + prs_uint8s(False, "padding", ps, depth, u_2->padding, sizeof(u_2->padding)); /* 16 bytes zeros */ + + smb_io_unistr2( "uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth); /* domain name unicode string */ + smb_io_unistr2( "uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth); /* server name unicode string */ + + prs_align(ps); + +} + +/******************************************************************* +makes a SAMR_R_UNKNOWN_8 structure. +********************************************************************/ +void make_samr_r_unknown_8(SAMR_R_UNKNOWN_8 *r_u, + uint16 switch_value, SAM_UNK_CTR *ctr, + uint32 status) +{ + if (r_u == NULL || ctr == NULL) return; + + DEBUG(5,("make_samr_r_unknown_8\n")); + + r_u->ptr_0 = 0; + r_u->switch_value = 0; + r_u->status = status; /* return status */ + + if (status == 0) + { + r_u->switch_value = switch_value; + r_u->ptr_0 = 1; + r_u->ctr = ctr; + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_unknown_8(char *desc, SAMR_R_UNKNOWN_8 *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_unknown_8"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0)); + prs_uint16("switch_value", ps, depth, &(r_u->switch_value)); + prs_align(ps); + + if (r_u->ptr_0 != 0 && r_u->ctr != NULL) + { + switch (r_u->switch_value) + { + case 0x02: + { + sam_io_unk_info2("unk_inf2", &r_u->ctr->info.inf2, ps, depth); + break; + } + default: + { + DEBUG(3,("samr_io_r_unknown_8: unknown switch level 0x%x\n", + r_u->switch_value)); + return; + } + } + } +} + + /******************************************************************* makes a DOM_SID3 structure. @@ -2011,6 +2205,131 @@ static void sam_io_logon_hrs(char *desc, LOGON_HRS *hrs, prs_struct *ps, int de prs_uint8s (False, "hours", ps, depth, hrs->hours, hrs->len); } +/******************************************************************* +makes a SAM_USER_INFO_10 structure. +********************************************************************/ +void make_sam_user_info10(SAM_USER_INFO_10 *usr, + uint32 acb_info) +{ + if (usr == NULL) return; + + DEBUG(5,("make_sam_user_info10\n")); + + usr->acb_info = acb_info; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void sam_io_user_info10(char *desc, SAM_USER_INFO_10 *usr, prs_struct *ps, int depth) +{ + if (usr == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_user_info10"); + depth++; + + prs_align(ps); + + prs_uint32("acb_info", ps, depth, &(usr->acb_info)); +} + +/******************************************************************* +makes a SAM_USER_INFO_11 structure. +********************************************************************/ +void make_sam_user_info11(SAM_USER_INFO_11 *usr, + NTTIME *expiry, + char *mach_acct, + uint32 rid_user, + uint32 rid_group, + uint16 acct_ctrl) + +{ + int len_mach_acct; + if (usr == NULL || expiry == NULL || mach_acct == NULL) return; + + DEBUG(5,("make_sam_user_info11\n")); + + len_mach_acct = strlen(mach_acct); + + memcpy(&(usr->expiry),expiry, sizeof(usr->expiry)); /* expiry time or something? */ + bzero(usr->padding_1, sizeof(usr->padding_1)); /* 0 - padding 24 bytes */ + + make_uni_hdr(&(usr->hdr_mach_acct), len_mach_acct, len_mach_acct, 4); /* unicode header for machine account */ + usr->padding_2 = 0; /* 0 - padding 4 bytes */ + + usr->ptr_1 = 1; /* pointer */ + bzero(usr->padding_3, sizeof(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 */ + bzero(usr->padding_6, sizeof(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 */ + + bzero(usr->padding_7, sizeof(usr->padding_7)); /* 0 - padding 16 bytes */ + usr->padding_8 = 0; /* 0 - padding 4 bytes */ + + make_unistr2(&(usr->uni_mach_acct), mach_acct, len_mach_acct); /* unicode string for machine account */ + + bzero(usr->padding_9, sizeof(usr->padding_9)); /* 0 - padding 48 bytes */ +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int depth) +{ + if (usr == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_unknown_24"); + depth++; + + prs_align(ps); + + prs_uint8s (False, "padding_0", ps, depth, usr->padding_0, sizeof(usr->padding_0)); + + smb_io_time("time", &(usr->expiry), ps, depth); + + prs_uint8s (False, "padding_1", ps, depth, usr->padding_1, sizeof(usr->padding_1)); + + smb_io_unihdr ("unihdr", &(usr->hdr_mach_acct), ps, depth); + prs_uint32( "padding_2", ps, depth, &(usr->padding_2)); + + prs_uint32( "ptr_1 ", ps, depth, &(usr->ptr_1 )); + prs_uint8s (False, "padding_3", ps, depth, usr->padding_3, sizeof(usr->padding_3)); + prs_uint32( "padding_4", ps, depth, &(usr->padding_4)); + + prs_uint32( "ptr_2 ", ps, depth, &(usr->ptr_2 )); + prs_uint32( "padding_5", ps, depth, &(usr->padding_5)); + + prs_uint32( "ptr_3 ", ps, depth, &(usr->ptr_3 )); + prs_uint8s (False, "padding_6", ps, depth, usr->padding_6, sizeof(usr->padding_6)); + + prs_uint32( "rid_user ", ps, depth, &(usr->rid_user )); + prs_uint32( "rid_group", ps, depth, &(usr->rid_group)); + prs_uint16( "acct_ctrl", ps, depth, &(usr->acct_ctrl)); + prs_uint16( "unknown_3", ps, depth, &(usr->unknown_3)); + prs_uint16( "unknown_4", ps, depth, &(usr->unknown_4)); + prs_uint16( "unknown_5", ps, depth, &(usr->unknown_5)); + + prs_uint8s (False, "padding_7", ps, depth, usr->padding_7, sizeof(usr->padding_7)); + prs_uint32( "padding_8", ps, depth, &(usr->padding_8)); + + smb_io_unistr2("unistr2", &(usr->uni_mach_acct), True, ps, depth); + prs_align(ps); + + prs_uint8s (False, "padding_9", ps, depth, usr->padding_9, sizeof(usr->padding_9)); +} /************************************************************************* make_sam_user_info21 @@ -2262,7 +2581,6 @@ void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc { switch (r_u->switch_value) { -/* case 0x10: { if (r_u->info.id10 != NULL) @@ -2272,10 +2590,11 @@ void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc else { DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); - return NULL; + return; } break; } +/* case 0x11: { if (r_u->info.id11 != NULL) @@ -2285,7 +2604,7 @@ void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc else { DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); - return NULL; + return; } break; } -- cgit From eadc5b8c6ecdd6892647d391e1976b2c708d1ea0 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 21 Oct 1998 22:36:26 +0000 Subject: domain aliases added a bit better: does local aliases if you query for sid S-1-5-20 and does (nothing at the moment) if you query for your own sid. (This used to be commit da40f26f4b2f7ce286076b4e39dffd76aa2ef8e6) --- source3/rpc_parse/parse_samr.c | 50 ++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 24 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 416498a186..f09af387e4 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -228,12 +228,12 @@ void samr_io_q_unknown_3(char *desc, SAMR_Q_UNKNOWN_3 *q_u, prs_struct *ps, int /******************************************************************* reads or writes a structure. ********************************************************************/ -void make_samr_q_unknown_8(SAMR_Q_UNKNOWN_8 *q_u, +void make_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO *q_u, POLICY_HND *domain_pol, uint16 switch_value) { if (q_u == NULL) return; - DEBUG(5,("samr_make_q_unknown_8\n")); + DEBUG(5,("samr_make_q_query_dom_info\n")); memcpy(&q_u->domain_pol, domain_pol, sizeof(q_u->domain_pol)); q_u->switch_value = switch_value; @@ -242,11 +242,11 @@ void make_samr_q_unknown_8(SAMR_Q_UNKNOWN_8 *q_u, /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_unknown_8(char *desc, SAMR_Q_UNKNOWN_8 *q_u, prs_struct *ps, int depth) +void samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_q_unknown_8"); + prs_debug(ps, depth, desc, "samr_io_q_query_dom_info"); depth++; prs_align(ps); @@ -276,16 +276,17 @@ void make_unk_info2(SAM_UNK_INFO_2 *u_2, char *domain, char *server) make_uni_hdr(&(u_2->hdr_domain), len_domain, len_domain, 1); make_uni_hdr(&(u_2->hdr_server), len_server, len_server, 1); - u_2->unknown_4 = 0x10000000; - u_2->unknown_5 = 0x00000000; + u_2->seq_num = 0x10000000; + u_2->unknown_3 = 0x00000000; + u_2->unknown_4 = 0x00000001; + u_2->unknown_5 = 0x00000003; u_2->unknown_6 = 0x00000001; - u_2->unknown_7 = 0x00000003; - u_2->unknown_8 = 0x00000001; - u_2->unknown_9 = 0x00000008; - u_2->unknown_10 = 0x00000003; + u_2->num_domain_usrs = 0x00000008; + u_2->num_domain_grps = 0x00000003; + u_2->num_local_grps = 0x00000003; - memset(u_2->padding, 0, sizeof(u_2->padding)); /* 16 bytes zeros */ + memset(u_2->padding, 0, sizeof(u_2->padding)); /* 12 bytes zeros */ make_unistr2(&u_2->uni_domain, domain, len_domain); make_unistr2(&u_2->uni_server, server, len_server); @@ -313,16 +314,17 @@ void sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 *u_2, prs_struct *ps, int depth pointer is referring to */ - prs_uint32("unknown_4 ", ps, depth, &u_2->unknown_4 ); /* 0x0000 0099 or 0x1000 0000 */ - prs_uint32("unknown_5 ", ps, depth, &u_2->unknown_5 ); /* 0x0000 0000 */ + prs_uint32("seq_num ", ps, depth, &u_2->seq_num ); /* 0x0000 0099 or 0x1000 0000 */ + prs_uint32("unknown_3 ", ps, depth, &u_2->unknown_3 ); /* 0x0000 0000 */ + prs_uint32("unknown_4 ", ps, depth, &u_2->unknown_4 ); /* 0x0000 0001 */ + prs_uint32("unknown_5 ", ps, depth, &u_2->unknown_5 ); /* 0x0000 0003 */ prs_uint32("unknown_6 ", ps, depth, &u_2->unknown_6 ); /* 0x0000 0001 */ - prs_uint32("unknown_7 ", ps, depth, &u_2->unknown_7 ); /* 0x0000 0003 */ - prs_uint32("unknown_8 ", ps, depth, &u_2->unknown_8 ); /* 0x0000 0001 */ - prs_uint32("unknown_9 ", ps, depth, &u_2->unknown_9 ); /* 0x0000 0008 */ - prs_uint32("unknown_10", ps, depth, &u_2->unknown_10); /* 0x0000 0003 */ + prs_uint32("num_domain_usrs ", ps, depth, &u_2->num_domain_usrs ); /* 0x0000 0008 */ + prs_uint32("num_domain_grps", ps, depth, &u_2->num_domain_grps); /* 0x0000 0003 */ + prs_uint32("num_local_grps", ps, depth, &u_2->num_local_grps); /* 0x0000 0003 */ - prs_uint8s(False, "padding", ps, depth, u_2->padding, sizeof(u_2->padding)); /* 16 bytes zeros */ + prs_uint8s(False, "padding", ps, depth, u_2->padding, sizeof(u_2->padding)); /* 12 bytes zeros */ smb_io_unistr2( "uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth); /* domain name unicode string */ smb_io_unistr2( "uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth); /* server name unicode string */ @@ -332,15 +334,15 @@ void sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 *u_2, prs_struct *ps, int depth } /******************************************************************* -makes a SAMR_R_UNKNOWN_8 structure. +makes a SAMR_R_QUERY_DOMAIN_INFO structure. ********************************************************************/ -void make_samr_r_unknown_8(SAMR_R_UNKNOWN_8 *r_u, +void make_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO *r_u, uint16 switch_value, SAM_UNK_CTR *ctr, uint32 status) { if (r_u == NULL || ctr == NULL) return; - DEBUG(5,("make_samr_r_unknown_8\n")); + DEBUG(5,("make_samr_r_query_dom_info\n")); r_u->ptr_0 = 0; r_u->switch_value = 0; @@ -357,11 +359,11 @@ void make_samr_r_unknown_8(SAMR_R_UNKNOWN_8 *r_u, /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_unknown_8(char *desc, SAMR_R_UNKNOWN_8 *r_u, prs_struct *ps, int depth) +void samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_r_unknown_8"); + prs_debug(ps, depth, desc, "samr_io_r_query_dom_info"); depth++; prs_align(ps); @@ -381,7 +383,7 @@ void samr_io_r_unknown_8(char *desc, SAMR_R_UNKNOWN_8 *r_u, prs_struct *ps, int } default: { - DEBUG(3,("samr_io_r_unknown_8: unknown switch level 0x%x\n", + DEBUG(3,("samr_io_r_query_dom_info: unknown switch level 0x%x\n", r_u->switch_value)); return; } -- cgit From cbd0b2ccf9519bcada58567b88987e134563058d Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 22 Oct 1998 18:15:23 +0000 Subject: bug fix in lsa_trans_names. well-known aliases S-1-5-20 is actually S-1-5-0x20 but sid_to_string does decimal not hexadecimal oops. (This used to be commit 4d830e243650729344a2d1b238075e787802ff8b) --- source3/rpc_parse/parse_lsa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 49a0951554..cc60ace9fc 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -31,12 +31,14 @@ static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct /******************************************************************* creates a LSA_TRANS_NAME structure. ********************************************************************/ -void make_lsa_trans_name(LSA_TRANS_NAME *trn, uint32 sid_name_use, char *name, uint32 idx) +void make_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, + uint32 sid_name_use, char *name, uint32 idx) { int len_name = strlen(name); trn->sid_name_use = sid_name_use; make_uni_hdr(&(trn->hdr_name), len_name, len_name, len_name != 0); + make_unistr2(uni_name, name, len_name); trn->domain_idx = idx; } -- cgit From 528c3d3e682ce85d8b041a1396e59f5229716e71 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 27 Oct 1998 15:03:47 +0000 Subject: amazing. the improvements to NT continue, evidence for which shows up now as "RPC fault" if the UNIHDR structure lengths do not exactly match up to the length of the data stream. so, all versions of samba prior to this one have an off-by-one bug in unicode string lengths. all versions of NT prior to NT 5 beta 2 could possibly have buffer problems when receiving badly formatted UNICODE strings. (This used to be commit 161eb6f511e161b63c1fa90a08c562fcf208344a) --- source3/rpc_parse/parse_misc.c | 18 +++++++++--------- source3/rpc_parse/parse_net.c | 10 +++++----- source3/rpc_parse/parse_samr.c | 2 +- source3/rpc_parse/parse_srv.c | 1 + 4 files changed, 16 insertions(+), 15 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 5144ef8c31..4cb606688d 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -395,7 +395,7 @@ void make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf) if (buf != NULL) { *ptr = 1; - make_unistr2(str, buf, strlen(buf)); + make_unistr2(str, buf, strlen(buf)+1); } else { @@ -475,10 +475,10 @@ creates a UNISTR2 structure. ********************************************************************/ void make_unistr2(UNISTR2 *str, char *buf, int len) { - /* set up string lengths. add one if string is not null-terminated */ - str->uni_max_len = len+1; + /* set up string lengths. */ + str->uni_max_len = len; str->undoc = 0; - str->uni_str_len = len+1; + str->uni_str_len = len; /* store the string (null-terminated 8 bit chars into 16 bit chars) */ struni2(str->buffer, buf); @@ -608,7 +608,7 @@ static void make_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) if (logon_srv != NULL) { log->undoc_buffer = 1; - make_unistr2(&(log->uni_logon_srv), logon_srv, strlen(logon_srv)); + make_unistr2(&(log->uni_logon_srv), logon_srv, strlen(logon_srv)+1); } else { @@ -618,7 +618,7 @@ static void make_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) if (comp_name != NULL) { log->undoc_buffer2 = 1; - make_unistr2(&(log->uni_comp_name), comp_name, strlen(comp_name)); + make_unistr2(&(log->uni_comp_name), comp_name, strlen(comp_name)+1); } else { @@ -665,12 +665,12 @@ void make_log_info(DOM_LOG_INFO *log, char *logon_srv, char *acct_name, log->undoc_buffer = 1; - make_unistr2(&(log->uni_logon_srv), logon_srv, strlen(logon_srv)); - make_unistr2(&(log->uni_acct_name), acct_name, strlen(acct_name)); + make_unistr2(&(log->uni_logon_srv), logon_srv, strlen(logon_srv)+1); + make_unistr2(&(log->uni_acct_name), acct_name, strlen(acct_name)+1); log->sec_chan = sec_chan; - make_unistr2(&(log->uni_comp_name), comp_name, strlen(comp_name)); + make_unistr2(&(log->uni_comp_name), comp_name, strlen(comp_name)+1); } /******************************************************************* diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index d99c4baac6..57fc73e516 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -116,7 +116,7 @@ static void make_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_statu if (trusted_dc_name != NULL) { - make_unistr2(&(info->uni_trusted_dc_name), trusted_dc_name, len_dc_name); + make_unistr2(&(info->uni_trusted_dc_name), trusted_dc_name, len_dc_name+1); } else { @@ -294,7 +294,7 @@ void make_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, fstring domain_name; fstrcpy(domain_name, dom_name); strupper(domain_name); - make_unistr2(&(r_t->uni_trust_dom_name[i]), domain_name, strlen(domain_name)); + make_unistr2(&(r_t->uni_trust_dom_name[i]), domain_name, strlen(domain_name)+1); /* the use of UNISTR2 here is non-standard. */ r_t->uni_trust_dom_name[i].undoc = 0x1; } @@ -354,8 +354,8 @@ void make_q_req_chal(NET_Q_REQ_CHAL *q_c, q_c->undoc_buffer = 1; /* don't know what this buffer is */ - make_unistr2(&(q_c->uni_logon_srv ), logon_srv , strlen(logon_srv )); - make_unistr2(&(q_c->uni_logon_clnt), logon_clnt, strlen(logon_clnt)); + make_unistr2(&(q_c->uni_logon_srv ), logon_srv , strlen(logon_srv )+1); + make_unistr2(&(q_c->uni_logon_clnt), logon_clnt, strlen(logon_clnt)+1); memcpy(q_c->clnt_chal.data, clnt_chal->data, sizeof(clnt_chal->data)); @@ -377,7 +377,7 @@ void net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int dep prs_uint32("undoc_buffer", ps, depth, &(q_c->undoc_buffer)); - smb_io_unistr2("", &(q_c->uni_logon_srv), True, ps, depth); /* logon server unicode string */ + smb_io_unistr2("", &(q_c->uni_logon_srv ), True, ps, depth); /* logon server unicode string */ smb_io_unistr2("", &(q_c->uni_logon_clnt), True, ps, depth); /* logon client unicode string */ old_align = ps->align; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index f09af387e4..ba6a8d3556 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2694,7 +2694,7 @@ void make_samr_q_connect(SAMR_Q_CONNECT *q_u, /* make PDC server name \\server */ q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0; - make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name); + make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name+1); /* example values: 0x0000 0002 */ q_u->unknown_0 = unknown_0; diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 27b1ec2257..adc4249072 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1377,6 +1377,7 @@ static void srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int break; } } + prs_align(ps); } } -- cgit From e600debafb7dd4320c254d504347827eb6745406 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 28 Oct 1998 18:32:34 +0000 Subject: Added clear-out-structure fix for make_unistr2. Jeremy. (This used to be commit 2bce2cf6d83d9889d8b116f9d2ee254b7ceb4828) --- source3/rpc_parse/parse_misc.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 4cb606688d..0f242c4738 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -475,6 +475,8 @@ creates a UNISTR2 structure. ********************************************************************/ void make_unistr2(UNISTR2 *str, char *buf, int len) { + ZERO_STRUCTP(str); + /* set up string lengths. */ str->uni_max_len = len; str->undoc = 0; -- cgit From ba4135aaf87a34ececb30c1de93f955bc8daa40d Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 3 Nov 1998 18:37:05 +0000 Subject: fix to some of the unicode string handling. there are others pending in non-critical areas. (This used to be commit 6da2e15272e4a6a9994c36fc465b6115f95ac5bd) --- source3/rpc_parse/parse_srv.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index adc4249072..56b8be2acb 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -37,8 +37,8 @@ void make_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark) DEBUG(5,("make_srv_share_info1_str\n")); - make_unistr2(&(sh1->uni_netname), net_name, strlen(net_name)); - make_unistr2(&(sh1->uni_remark ), remark , strlen(remark )); + make_unistr2(&(sh1->uni_netname), net_name, strlen(net_name)+1); + make_unistr2(&(sh1->uni_remark ), remark , strlen(remark )+1); } /******************************************************************* @@ -380,7 +380,7 @@ void make_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name) DEBUG(5,("make_srv_sess_info0_str\n")); - make_unistr2(&(ss0->uni_name), name, strlen(name)); + make_unistr2(&(ss0->uni_name), name, strlen(name)+1); } /******************************************************************* @@ -478,8 +478,8 @@ void make_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user) DEBUG(5,("make_srv_sess_info1_str\n")); - make_unistr2(&(ss1->uni_name), name, strlen(name)); - make_unistr2(&(ss1->uni_user), name, strlen(user)); + make_unistr2(&(ss1->uni_name), name, strlen(name)+1); + make_unistr2(&(ss1->uni_user), name, strlen(user)+1); } /******************************************************************* @@ -777,8 +777,8 @@ void make_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_nam DEBUG(5,("make_srv_conn_info1_str\n")); - make_unistr2(&(ss1->uni_usr_name), usr_name, strlen(usr_name)); - make_unistr2(&(ss1->uni_net_name), net_name, strlen(net_name)); + make_unistr2(&(ss1->uni_usr_name), usr_name, strlen(usr_name)+1); + make_unistr2(&(ss1->uni_net_name), net_name, strlen(net_name)+1); } /******************************************************************* -- cgit From 748fe7a383e50079493648839cf0ab69aa2223a0 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 9 Nov 1998 16:40:38 +0000 Subject: split socket util functions into util_sock.c. util.c NOT committed and util_sock.c NOT included in Makefile.in. registry commands added to rpcclient. waiting for 2_0_0 split before committing modified files. these files are new modules, and are not referenced in the Makefile.in (This used to be commit 373f60256fc6dc800f73d88ea9a302933a4a3246) --- source3/rpc_parse/parse_sec.c | 176 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 source3/rpc_parse/parse_sec.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c new file mode 100644 index 0000000000..bedf042b7f --- /dev/null +++ b/source3/rpc_parse/parse_sec.c @@ -0,0 +1,176 @@ + +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include "includes.h" + +extern int DEBUGLEVEL; + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void sec_io_info(char *desc, SEC_INFO *t, prs_struct *ps, int depth) +{ + if (t == NULL) return; + + prs_debug(ps, depth, desc, "sec_io_info"); + depth++; + + prs_align(ps); + + prs_uint32("perms", ps, depth, &(t->perms)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void sec_io_ace(char *desc, SEC_ACE *t, prs_struct *ps, int depth) +{ + uint32 old_offset; + uint32 offset_ace_size; + if (t == NULL) return; + + prs_debug(ps, depth, desc, "sec_io_ace"); + depth++; + + prs_align(ps); + + old_offset = ps->offset; + + prs_uint16("unknown_1", ps, depth, &(t->unknown_1)); + prs_uint16_pre("ace_size ", ps, depth, &(t->ace_size ), &offset_ace_size); + + sec_io_info ("info", &t->info, ps, depth); + prs_align(ps); + smb_io_dom_sid("sid ", &t->sid , ps, depth); + + prs_uint16_post("ace_size ", ps, depth, offset_ace_size, old_offset); + if (ps->io) + { + ps->offset = old_offset + t->ace_size; + } +} + +/******************************************************************* +reads or writes a structure. this is one of those retrospective jobs, +which i hate. why do we have to do this? what's it all about? +********************************************************************/ +void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) +{ + int i; + uint32 old_offset; + uint32 offset_acl_size; + + if (t == NULL) return; + + prs_debug(ps, depth, desc, "sec_io_acl"); + depth++; + + prs_align(ps); + + old_offset = ps->offset; + + prs_uint16("unknown_1", ps, depth, &(t->unknown_1)); + prs_uint16_pre("acl_size ", ps, depth, &(t->acl_size ), &offset_acl_size); + prs_uint32("num_aces ", ps, depth, &(t->num_aces )); + + for (i = 0; i < MIN(t->num_aces, MAX_SEC_ACES); i++) + { + fstring tmp; + snprintf(tmp, sizeof(tmp), "ace[%02d]: ", i); + sec_io_ace(tmp, &t->ace[i], ps, depth); + } + + prs_align(ps); + + prs_uint16_post("acl_size ", ps, depth, offset_acl_size, old_offset); + if (ps->io) + { + ps->offset = old_offset + t->acl_size; + } +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) +{ + if (t == NULL) return; + + prs_debug(ps, depth, desc, "sec_io_desc"); + depth++; + + prs_align(ps); + + prs_uint16("unknown_1", ps, depth, &(t->unknown_1)); + prs_uint16("unknown_2", ps, depth, &(t->unknown_2)); + + prs_uint32("off_owner_sid", ps, depth, &(t->off_owner_sid)); + prs_uint32("off_pnt_sid ", ps, depth, &(t->off_pnt_sid )); + prs_uint32("off_unknown ", ps, depth, &(t->off_unknown )); + prs_uint32("off_acl ", ps, depth, &(t->off_acl )); + + sec_io_acl ("acl" , &t->acl , ps, depth); + smb_io_dom_sid("owner_sid ", &t->owner_sid , ps, depth); + prs_align(ps); + smb_io_dom_sid("parent_sid", &t->parent_sid, ps, depth); + prs_align(ps); +} + +/******************************************************************* +creates a SEC_DESC_BUF structure. +********************************************************************/ +void make_sec_desc_buf(SEC_DESC_BUF *buf, int len, uint32 buf_ptr) +{ + ZERO_STRUCTP(buf); + + /* max buffer size (allocated size) */ + buf->max_len = len; + buf->undoc = 0; + buf->len = buf_ptr != 0 ? len : 0; +} + +/******************************************************************* +reads or writes a SEC_DESC_BUF structure. +********************************************************************/ +void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) +{ + if (sec == NULL) return; + + prs_debug(ps, depth, desc, "sec_io_desc_buf"); + depth++; + + prs_align(ps); + + prs_uint32("max_len", ps, depth, &(sec->max_len)); + prs_uint32("undoc ", ps, depth, &(sec->undoc )); + prs_uint32("len ", ps, depth, &(sec->len )); + + if (sec->len != 0) + { + sec_io_desc("sec ", &sec->sec, ps, depth); + } +} -- cgit From 1e1c2ec93c204e6fd3ebba6dfb11e4fbc136e10c Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 10 Nov 1998 19:05:00 +0000 Subject: rpcclient registry commands. (This used to be commit 36fcb4a6e643a05d06a2a273d74318fee7f2c647) --- source3/rpc_parse/parse_lsa.c | 2 +- source3/rpc_parse/parse_misc.c | 171 ++++++++-- source3/rpc_parse/parse_prs.c | 58 +++- source3/rpc_parse/parse_reg.c | 732 ++++++++++++++++++++++++++++++++++++++++- source3/rpc_parse/parse_samr.c | 2 +- 5 files changed, 918 insertions(+), 47 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index cc60ace9fc..a5c523fdb6 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -692,7 +692,7 @@ void lsa_io_q_lookup_rids(char *desc, LSA_Q_LOOKUP_RIDS *q_r, prs_struct *ps, i for (i = 0; i < q_r->num_entries; i++) { - smb_io_dom_name("", &(q_r->lookup_name[i]), ps, depth); /* names to be looked up */ + smb_io_unistr3("", &(q_r->lookup_name[i]), ps, depth); /* names to be looked up */ } prs_uint8s (False, "undoc ", ps, depth, q_r->undoc, UNKNOWN_LEN); diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 0f242c4738..3a74d11e52 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -261,8 +261,8 @@ creates a UNIHDR structure. ********************************************************************/ void make_uni_hdr(UNIHDR *hdr, int max_len, int len, uint32 buffer) { - hdr->uni_max_len = 2 * max_len; hdr->uni_str_len = 2 * len; + hdr->uni_max_len = 2 * max_len; hdr->buffer = buffer; } @@ -287,6 +287,35 @@ void smb_io_unihdr(char *desc, UNIHDR *hdr, prs_struct *ps, int depth) if (hdr->uni_str_len > MAX_UNISTRLEN) hdr->uni_str_len = MAX_UNISTRLEN; } +/******************************************************************* +creates a BUFHDR structure. +********************************************************************/ +void make_buf_hdr(BUFHDR *hdr, int max_len, int len) +{ + hdr->buf_max_len = max_len; + hdr->buf_len = len; +} + +/******************************************************************* +reads or writes a BUFHDR structure. +********************************************************************/ +void smb_io_hdrbuf(char *desc, BUFHDR *hdr, prs_struct *ps, int depth) +{ + if (hdr == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_hdrbuf"); + depth++; + + prs_align(ps); + + prs_uint32("buf_max_len", ps, depth, &(hdr->buf_max_len)); + prs_uint32("buf_len ", ps, depth, &(hdr->buf_len )); + + /* oops! XXXX maybe issue a warning that this is happening... */ + if (hdr->buf_max_len > MAX_BUFFERLEN) hdr->buf_max_len = MAX_BUFFERLEN; + if (hdr->buf_len > MAX_BUFFERLEN) hdr->buf_len = MAX_BUFFERLEN; +} + /******************************************************************* creates a UNIHDR2 structure. ********************************************************************/ @@ -337,53 +366,133 @@ void smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) } /******************************************************************* -creates a UNINOTSTR2 structure. +creates a BUFFER3 structure from a uint32 ********************************************************************/ -void make_uninotstr2(UNINOTSTR2 *str, char *buf, int len) +void make_buffer3_uint32(BUFFER3 *str, uint32 val) { - /* set up string lengths. add one if string is not null-terminated */ - str->uni_max_len = (len+1)*2; + ZERO_STRUCTP(str); + + /* set up string lengths. */ + str->buf_max_len = sizeof(uint32); + str->buf_len = sizeof(uint32); + + SIVAL(str->buffer, 0, val); +} + +/******************************************************************* +creates a BUFFER3 structure. +********************************************************************/ +void make_buffer3_str(BUFFER3 *str, char *buf, int len) +{ + ZERO_STRUCTP(str); + + /* set up string lengths. */ + str->buf_max_len = len * 2; + str->buf_len = len * 2; + + /* store the string (null-terminated 8 bit chars into 16 bit chars) */ + struni2((uint16*)str->buffer, buf); +} + +/******************************************************************* +creates a BUFFER3 structure from a hex string. +********************************************************************/ +void make_buffer3_hex(BUFFER3 *str, char *buf) +{ + ZERO_STRUCTP(str); + str->buf_max_len = str->buf_len = strhex_to_str(str->buffer, sizeof(str->buffer), buf); +} + +/******************************************************************* +creates a BUFFER3 structure. +********************************************************************/ +void make_buffer3_bytes(BUFFER3 *str, uint8 *buf, int len) +{ + ZERO_STRUCTP(str); + + /* max buffer size (allocated size) */ + str->buf_max_len = len; + if (buf != NULL) + { + memcpy(str->buffer, buf, MIN(str->buf_len, sizeof(str->buffer))); + } + str->buf_len = buf != NULL ? len : 0; +} + +/******************************************************************* +reads or writes a BUFFER3 structure. + the uni_max_len member tells you how large the buffer is. + the uni_str_len member tells you how much of the buffer is really used. +********************************************************************/ +void smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) +{ + if (buf3 == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_buffer3"); + depth++; + + prs_align(ps); + + prs_uint32("uni_max_len", ps, depth, &(buf3->buf_max_len)); + if (buf3->buf_max_len > MAX_UNISTRLEN) buf3->buf_max_len = MAX_UNISTRLEN; + + prs_uint8s(True, "buffer ", ps, depth, buf3->buffer, buf3->buf_max_len); + + prs_uint32("buf_len ", ps, depth, &(buf3->buf_len)); + if (buf3->buf_len > MAX_UNISTRLEN) buf3->buf_len = MAX_UNISTRLEN; +} + +/******************************************************************* +creates a BUFFER2 structure. +********************************************************************/ +void make_buffer2(BUFFER2 *str, uint8 *buf, int len) +{ + ZERO_STRUCTP(str); + + /* max buffer size (allocated size) */ + str->buf_max_len = len; str->undoc = 0; - str->uni_buf_len = (len+1)*2; + str->buf_len = buf != NULL ? len : 0; - /* store the string (null-terminated copy) */ - struni2(str->buffer, buf); + if (buf != NULL) + { + memcpy(str->buffer, buf, MIN(str->buf_len, sizeof(str->buffer))); + } } /******************************************************************* -reads or writes a UNINOTSTR2 structure. -XXXX NOTE: UNISTR2 structures need NOT be null-terminated. - the uni_str_len member tells you how long the string is; +reads or writes a BUFFER2 structure. the uni_max_len member tells you how large the buffer is. + the uni_str_len member tells you how much of the buffer is really used. ********************************************************************/ -void smb_io_uninotstr2(char *desc, UNINOTSTR2 *uni2, uint32 buffer, prs_struct *ps, int depth) +void smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth) { - if (uni2 == NULL) return; + if (buf2 == NULL) return; if (buffer) { - prs_debug(ps, depth, desc, "smb_io_uninotstr2"); + prs_debug(ps, depth, desc, "smb_io_buffer2"); depth++; prs_align(ps); - prs_uint32("uni_max_len", ps, depth, &(uni2->uni_max_len)); - prs_uint32("undoc ", ps, depth, &(uni2->undoc )); - prs_uint32("uni_buf_len", ps, depth, &(uni2->uni_buf_len)); + prs_uint32("uni_max_len", ps, depth, &(buf2->buf_max_len)); + prs_uint32("undoc ", ps, depth, &(buf2->undoc )); + prs_uint32("buf_len ", ps, depth, &(buf2->buf_len)); /* oops! XXXX maybe issue a warning that this is happening... */ - if (uni2->uni_max_len > MAX_UNISTRLEN) uni2->uni_max_len = MAX_UNISTRLEN; - if (uni2->uni_buf_len > MAX_UNISTRLEN) uni2->uni_buf_len = MAX_UNISTRLEN; + if (buf2->buf_max_len > MAX_UNISTRLEN) buf2->buf_max_len = MAX_UNISTRLEN; + if (buf2->buf_len > MAX_UNISTRLEN) buf2->buf_len = MAX_UNISTRLEN; /* buffer advanced by indicated length of string NOT by searching for null-termination */ - prs_uninotstr2(True, "buffer ", ps, depth, uni2); + prs_buffer2(True, "buffer ", ps, depth, buf2); } else { - prs_debug(ps, depth, desc, "smb_io_uninotstr2 - NULL"); + prs_debug(ps, depth, desc, "smb_io_buffer2 - NULL"); depth++; - bzero(uni2, sizeof(*uni2)); + bzero(buf2, sizeof(*buf2)); } } @@ -475,7 +584,7 @@ creates a UNISTR2 structure. ********************************************************************/ void make_unistr2(UNISTR2 *str, char *buf, int len) { - ZERO_STRUCTP(str); + ZERO_STRUCTP(str); /* set up string lengths. */ str->uni_max_len = len; @@ -526,9 +635,9 @@ void smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, i /******************************************************************* creates a DOM_RID2 structure. ********************************************************************/ -void make_dom_rid2(DOM_RID2 *rid2, uint32 rid) +void make_dom_rid2(DOM_RID2 *rid2, uint32 rid, uint8 type) { - rid2->type = 0x5; + rid2->type = type; rid2->undoc = 0x5; rid2->rid = rid; rid2->rid_idx = 0; @@ -561,10 +670,10 @@ void smb_io_dom_rid2(char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth) /******************************************************************* creates a DOM_RID3 structure. ********************************************************************/ -void make_dom_rid3(DOM_RID3 *rid3, uint32 rid) +void make_dom_rid3(DOM_RID3 *rid3, uint32 rid, uint8 type) { rid3->rid = rid; - rid3->type1 = 0x1; + rid3->type1 = type; rid3->ptr_type = 0x1; /* non-zero, basically. */ rid3->type2 = 0x1; } @@ -946,13 +1055,13 @@ void smb_io_dom_query_5(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth /******************************************************************* -reads or writes a DOM_NAME structure. +reads or writes a UNISTR3 structure. ********************************************************************/ -void smb_io_dom_name(char *desc, DOM_NAME *name, prs_struct *ps, int depth) +void smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth) { if (name == NULL) return; - prs_debug(ps, depth, desc, "smb_io_dom_name"); + prs_debug(ps, depth, desc, "smb_io_unistr3"); depth++; prs_align(ps); @@ -962,7 +1071,7 @@ void smb_io_dom_name(char *desc, DOM_NAME *name, prs_struct *ps, int depth) /* don't know if len is specified by uni_str_len member... */ /* assume unicode string is unicode-null-terminated, instead */ - smb_io_unistr("", &(name->str), ps, depth); + prs_unistr3(True, "unistr", name, ps, depth); } diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index d031a828f1..873a689792 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -175,13 +175,13 @@ BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *d stream a "not" unicode string, length/buffer specified separately, in byte chars ********************************************************************/ -BOOL prs_uninotstr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNINOTSTR2 *str) +BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 *str) { char *q = mem_data(&(ps->data), ps->offset); if (q == NULL) return False; - DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->uni_max_len) - ps->offset += str->uni_buf_len; + DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->buf_len/2) + ps->offset += str->buf_len; return True; } @@ -210,7 +210,22 @@ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 * char *q = mem_data(&(ps->data), ps->offset); if (q == NULL) return False; - DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->uni_max_len) + DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->uni_str_len) + ps->offset += str->uni_str_len * sizeof(uint16); + + return True; +} + +/****************************************************************** + stream a unicode string, length/buffer specified separately, + in uint16 chars. + ********************************************************************/ +BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int depth) +{ + char *q = mem_data(&(ps->data), ps->offset); + if (q == NULL) return False; + + DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->str.buffer, str->uni_str_len) ps->offset += str->uni_str_len * sizeof(uint16); return True; @@ -284,3 +299,38 @@ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, ui return True; } +/******************************************************************* + prs_uint16 wrapper. call this and it sets up a pointer to where the + uint16 should be stored, or gets the size if reading + ********************************************************************/ +BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *off_ptr) +{ + (*off_ptr) = ps->offset; + if (ps->io) + { + /* reading. */ + return prs_uint16(name, ps, depth, data16); + } + return True; +} + +/******************************************************************* + prs_uint16 wrapper. call this and it retrospectively stores the size. + does nothing on reading, as that is already handled by ...._pre() + ********************************************************************/ +BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, + uint32 ptr_uint16, uint32 start_offset) +{ + if (!ps->io) + { + /* storing: go back and do a retrospective job. i hate this */ + uint16 data_size = ps->offset - start_offset; + uint32 old_offset = ps->offset; + + ps->offset = ptr_uint16; + prs_uint16(name, ps, depth, &data_size); + ps->offset = old_offset; + } + return True; +} + diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 6b464645e5..329da974fb 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -27,6 +27,18 @@ extern int DEBUGLEVEL; +/******************************************************************* +creates a structure. +********************************************************************/ +void make_reg_q_open_pol(REG_Q_OPEN_POLICY *q_o, + uint16 unknown_0, uint32 level) +{ + q_o->ptr = 1; + q_o->unknown_0 = unknown_0; + q_o->unknown_1 = 0x0; /* random - changes */ + q_o->level = level; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -43,8 +55,8 @@ void reg_io_q_open_policy(char *desc, REG_Q_OPEN_POLICY *r_q, prs_struct *ps, i if (r_q->ptr != 0) { prs_uint16("unknown_0", ps, depth, &(r_q->unknown_0)); - prs_uint32("level ", ps, depth, &(r_q->level )); prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1)); + prs_uint32("level ", ps, depth, &(r_q->level )); } } @@ -67,6 +79,286 @@ void reg_io_r_open_policy(char *desc, REG_R_OPEN_POLICY *r_r, prs_struct *ps, i } + +/******************************************************************* +creates a structure. +********************************************************************/ +void make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, + char *name, char *class, + SEC_INFO *sam_access) +{ + int len_name = name != NULL ? strlen(name ) + 1: 0; + int len_class = class != NULL ? strlen(class) + 1: 0; + + static char data[] = + { + 0x01, 0x00, 0x00, 0x80, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + }; + + ZERO_STRUCTP(q_c); + + memcpy(&(q_c->pnt_pol), hnd, sizeof(q_c->pnt_pol)); + + make_uni_hdr(&(q_c->hdr_name), len_name, len_name, 1); + make_unistr2(&(q_c->uni_name), name, len_name); + + make_uni_hdr(&(q_c->hdr_class), len_class, len_class, 1); + make_unistr2(&(q_c->uni_class), class, len_class); + + q_c->reserved = 0x00000000; + memcpy(&(q_c->sam_access), sam_access, sizeof(q_c->sam_access)); + + q_c->ptr1 = 1; + q_c->unknown_0 = 0x0000000C; + + q_c->ptr2 = 1; + q_c->unk_len1 = 0x14; + q_c->unk_len2 = 0x14; + q_c->unknown_1 = 0x00020000; + + make_buffer2(&q_c->buf_unk, data, sizeof(data)); + + q_c->unknown_2 = 0x00000000; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_create_key(char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_create_key"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_q->pnt_pol), ps, depth); + + smb_io_unihdr ("", &(r_q->hdr_name), ps, depth); + smb_io_unistr2("", &(r_q->uni_name), r_q->hdr_name.buffer, ps, depth); + prs_align(ps); + + smb_io_unihdr ("", &(r_q->hdr_class), ps, depth); + smb_io_unistr2("", &(r_q->uni_class), r_q->hdr_class.buffer, ps, depth); + prs_align(ps); + + prs_uint32("reserved", ps, depth, &(r_q->reserved)); + sec_io_info("sam_access", &r_q->sam_access, ps, depth); + + prs_uint32("ptr1", ps, depth, &(r_q->ptr1)); + if (r_q->ptr2 != 0) + { + prs_uint32("unknown_0", ps, depth, &(r_q->unknown_0)); + } + + prs_uint32("ptr2", ps, depth, &(r_q->ptr2)); + if (r_q->ptr2) + { + prs_uint32("unk_len1", ps, depth, &(r_q->unk_len1)); + prs_uint32("unk_len2", ps, depth, &(r_q->unk_len2)); + prs_uint32("unknown_1", ps, depth, &(r_q->unknown_1)); + smb_io_buffer2("buf_unk", &r_q->buf_unk, 1, ps, depth); + prs_align(ps); + + prs_uint32("unknown_2", ps, depth, &(r_q->unknown_2)); + } + + prs_align(ps); +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_create_key(char *desc, REG_R_CREATE_KEY *r_r, prs_struct *ps, int depth) +{ + if (r_r == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_create_key"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_r->key_pol), ps, depth); + prs_uint32("unknown", ps, depth, &(r_r->unknown)); + + prs_uint32("status", ps, depth, &(r_r->status)); +} + + +/******************************************************************* +creates a structure. +********************************************************************/ +void make_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, + uint32 max_class_len) +{ + ZERO_STRUCTP(q_o); + + memcpy(&(q_o->pol), hnd, sizeof(q_o->pol)); + make_uni_hdr(&q_o->hdr_class, max_class_len, 0, max_class_len > 0 ? 1 : 0); + q_o->uni_class.uni_max_len = max_class_len; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_query_key(char *desc, REG_Q_QUERY_KEY *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_query_key"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_q->pol), ps, depth); + smb_io_unihdr ("", &(r_q->hdr_class), ps, depth); + smb_io_unistr2("", &(r_q->uni_class), r_q->hdr_class.buffer, ps, depth); + + prs_align(ps); +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int depth) +{ + if (r_r == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_query_key"); + depth++; + + prs_align(ps); + + smb_io_unihdr ("", &(r_r->hdr_class), ps, depth); + smb_io_unistr2("", &(r_r->uni_class), r_r->hdr_class.buffer, ps, depth); + + prs_align(ps); + + prs_uint32("num_subkeys ", ps, depth, &(r_r->num_subkeys )); + prs_uint32("max_subkeylen ", ps, depth, &(r_r->max_subkeylen )); + prs_uint32("mak_subkeysize", ps, depth, &(r_r->max_subkeysize)); + prs_uint32("num_values ", ps, depth, &(r_r->num_values )); + prs_uint32("max_valnamelen", ps, depth, &(r_r->max_valnamelen)); + prs_uint32("max_valbufsize", ps, depth, &(r_r->max_valbufsize)); + prs_uint32("sec_desc ", ps, depth, &(r_r->sec_desc )); + smb_io_time("mod_time ", &(r_r->mod_time), ps, depth); + + prs_uint32("status", ps, depth, &(r_r->status)); +} + + +/******************************************************************* +creates a structure. +********************************************************************/ +void make_reg_q_unk_1a(REG_Q_UNK_1A *q_o, POLICY_HND *hnd) +{ + memcpy(&(q_o->pol), hnd, sizeof(q_o->pol)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_unk_1a(char *desc, REG_Q_UNK_1A *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_unk_1a"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_q->pol), ps, depth); +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_unk_1a(char *desc, REG_R_UNK_1A *r_r, prs_struct *ps, int depth) +{ + if (r_r == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_unk_1a"); + depth++; + + prs_align(ps); + + prs_uint32("unknown", ps, depth, &(r_r->unknown)); + prs_uint32("status" , ps, depth, &(r_r->status )); +} + + +/******************************************************************* +creates a structure. +********************************************************************/ +void make_reg_q_open_unk_4(REG_Q_OPEN_UNK_4 *q_o, + uint16 unknown_0, uint32 level) +{ + q_o->ptr = 1; + q_o->unknown_0 = unknown_0; + q_o->unknown_1 = 0x0; /* random - changes */ + q_o->level = level; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_open_unk_4(char *desc, REG_Q_OPEN_UNK_4 *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_open_unk_4"); + depth++; + + prs_align(ps); + + prs_uint32("ptr ", ps, depth, &(r_q->ptr )); + if (r_q->ptr != 0) + { + prs_uint16("unknown_0", ps, depth, &(r_q->unknown_0)); + prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1)); + prs_uint32("level ", ps, depth, &(r_q->level )); + } +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_open_unk_4(char *desc, REG_R_OPEN_UNK_4 *r_r, prs_struct *ps, int depth) +{ + if (r_r == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_open_unk_4"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_r->pol), ps, depth); + + prs_uint32("status", ps, depth, &(r_r->status)); +} + + +/******************************************************************* +makes an REG_Q_CLOSE structure. +********************************************************************/ +void make_reg_q_close(REG_Q_CLOSE *q_c, POLICY_HND *hnd) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_reg_q_close\n")); + + memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -101,6 +393,123 @@ void reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) prs_uint32("status", ps, depth, &(r_u->status)); } +/******************************************************************* +makes a structure. +********************************************************************/ +void make_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, + uint32 buf_len, SEC_DESC_BUF *sec_buf) +{ + if (q_i == NULL) return; + + memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); + + q_i->unknown = 0x7; + + q_i->ptr = 1; + q_i->data = sec_buf; + + make_buf_hdr(&(q_i->hdr_sec), buf_len, 0); + make_sec_desc_buf(q_i->data, buf_len, 0); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_get_key_sec(char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_get_key_sec"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_q->pol), ps, depth); + + prs_uint32("unknown", ps, depth, &(r_q->unknown)); + prs_uint32("ptr ", ps, depth, &(r_q->ptr )); + + if (r_q->ptr != 0) + { + smb_io_hdrbuf ("hdr_sec", &(r_q->hdr_sec), ps, depth); + sec_io_desc_buf("data ", r_q->data , ps, depth); + + prs_align(ps); + } +} + +/******************************************************************* +makes a structure. +********************************************************************/ +void make_reg_r_get_key_sec(REG_R_GET_KEY_SEC *r_i, POLICY_HND *pol, + uint32 buf_len, uint8 *buf, + uint32 status) +{ + if (r_i == NULL) return; + + r_i->ptr = 1; + make_buf_hdr(&(r_i->hdr_sec), buf_len, buf_len); + make_sec_desc_buf(r_i->data, buf_len, 1); + + r_i->status = status; /* 0x0000 0000 or 0x0000 007a */ +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_get_key_sec(char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_get_key_sec"); + depth++; + + prs_align(ps); + + prs_uint32("ptr ", ps, depth, &(r_q->ptr )); + + if (r_q->ptr != 0) + { + smb_io_hdrbuf("", &(r_q->hdr_sec), ps, depth); + sec_io_desc_buf("", r_q->data, ps, depth); + + prs_align(ps); + } + + prs_uint32("status", ps, depth, &(r_q->status)); +} + + +/******************************************************************* +makes a structure. +********************************************************************/ +void make_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char *product_type, + time_t unix_time, uint8 major, uint8 minor) +{ + int len_type = strlen(product_type); + + if (q_i == NULL) return; + + memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); + + make_uni_hdr(&(q_i->hdr_type), len_type, len_type, 1); + make_unistr2(&(q_i->uni_type), product_type, len_type); + + q_i->ptr1 = 1; + unix_to_nt_time(&(q_i->time), unix_time); + q_i->major_version1 = major; + q_i->minor_version1 = minor; + memset(q_i->pad1, 0, sizeof(q_i->pad1)); + + q_i->ptr2 = 1; + q_i->major_version2 = major; + q_i->minor_version2 = minor; + memset(q_i->pad2, 0, sizeof(q_i->pad2)); + + q_i->ptr3 = 1; + q_i->unknown = 0x00000000; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -117,6 +526,8 @@ void reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) smb_io_unihdr ("", &(r_q->hdr_type), ps, depth); smb_io_unistr2("", &(r_q->uni_type), r_q->hdr_type.buffer, ps, depth); + prs_align(ps); + prs_uint32("ptr1", ps, depth, &(r_q->ptr1)); if (r_q->ptr1 != 0) @@ -153,13 +564,14 @@ void make_reg_r_info(REG_R_INFO *r_r, uint32 unknown_0, uint32 unknown_1, uint32 status) { - int type_len = strlen(os_type); + uint8 buf[512]; + int len = struni2((uint16*)buf, os_type); r_r->ptr1 = 1; r_r->level = level; r_r->ptr_type = 1; - make_uninotstr2(&(r_r->uni_type), os_type, type_len); + make_buffer2(&(r_r->uni_type), buf, len*2); r_r->ptr2 = 1; r_r->unknown_0 = unknown_0; @@ -173,7 +585,7 @@ void make_reg_r_info(REG_R_INFO *r_r, /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) +void reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return; @@ -187,10 +599,9 @@ void reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) if (r_r->ptr1 != 0) { prs_uint32("level", ps, depth, &(r_r->level)); - prs_uint32("ptr_type", ps, depth, &(r_r->ptr_type)); - smb_io_uninotstr2("", &(r_r->uni_type), r_r->ptr_type, ps, depth); - prs_align(ps); + + smb_io_buffer2("uni_type", &(r_r->uni_type), r_r->ptr_type, ps, depth); prs_uint32("ptr2", ps, depth, &(r_r->ptr2)); @@ -205,11 +616,311 @@ void reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) { prs_uint32("unknown_1", ps, depth, &(r_r->unknown_1)); } - } + } prs_uint32("status", ps, depth, &(r_r->status)); } +/******************************************************************* +makes a structure. +********************************************************************/ +void make_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol, + uint32 val_idx, uint32 max_val_len, + uint32 max_buf_len) +{ + if (q_i == NULL) return; + + ZERO_STRUCTP(q_i); + + memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); + + q_i->val_index = val_idx; + make_uni_hdr(&q_i->hdr_name, max_val_len, 0, 1); + q_i->uni_name.uni_max_len = max_val_len; + + q_i->ptr_type = 1; + q_i->type = 0x0; + + q_i->ptr_value = 1; + q_i->buf_value.buf_max_len = max_buf_len; + + q_i->ptr1 = 1; + q_i->len_value1 = max_buf_len; + + q_i->ptr2 = 1; + q_i->len_value2 = 0; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_enum_val(char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int depth) +{ + if (q_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_enum_val"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(q_q->pol), ps, depth); + + prs_uint32("val_index", ps, depth, &(q_q->val_index)); + smb_io_unihdr ("hdr_name", &(q_q->hdr_name), ps, depth); + smb_io_unistr2("uni_name", &(q_q->uni_name), q_q->hdr_name.buffer, ps, depth); + prs_align(ps); + + prs_uint32("ptr_type", ps, depth, &(q_q->ptr_type)); + + if (q_q->ptr_type != 0) + { + prs_uint32("type", ps, depth, &(q_q->type)); + } + + prs_uint32("ptr_value", ps, depth, &(q_q->ptr_value)); + smb_io_buffer2("buf_value", &(q_q->buf_value), q_q->ptr_value, ps, depth); + prs_align(ps); + + prs_uint32("ptr1", ps, depth, &(q_q->ptr1)); + if (q_q->ptr1 != 0) + { + prs_uint32("len_value1", ps, depth, &(q_q->len_value1)); + } + prs_uint32("ptr2", ps, depth, &(q_q->ptr2)); + if (q_q->ptr2 != 0) + { + prs_uint32("len_value2", ps, depth, &(q_q->len_value2)); + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_enum_val(char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_enum_val"); + depth++; + + prs_align(ps); + + smb_io_unihdr ("hdr_name", &(r_q->hdr_name), ps, depth); + smb_io_unistr2("uni_name", &(r_q->uni_name), r_q->hdr_name.buffer, ps, depth); + prs_align(ps); + + prs_uint32("ptr_type", ps, depth, &(r_q->ptr_type)); + + if (r_q->ptr_type != 0) + { + prs_uint32("type", ps, depth, &(r_q->type)); + } + + prs_uint32("ptr_value", ps, depth, &(r_q->ptr_value)); + smb_io_buffer2("buf_value", r_q->buf_value, r_q->ptr_value, ps, depth); + prs_align(ps); + + prs_uint32("ptr1", ps, depth, &(r_q->ptr1)); + if (r_q->ptr1 != 0) + { + prs_uint32("len_value1", ps, depth, &(r_q->len_value1)); + } + + prs_uint32("ptr2", ps, depth, &(r_q->ptr2)); + if (r_q->ptr2 != 0) + { + prs_uint32("len_value2", ps, depth, &(r_q->len_value2)); + } + + prs_uint32("status", ps, depth, &(r_q->status)); +} + +/******************************************************************* +makes a structure. +********************************************************************/ +void make_reg_q_create_val(REG_Q_CREATE_VALUE *q_i, POLICY_HND *pol, + char *val_name, uint32 type, + BUFFER3 *val) +{ + int val_len = strlen(val_name) + 1; + + if (q_i == NULL) return; + + ZERO_STRUCTP(q_i); + + memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); + + make_uni_hdr(&q_i->hdr_name, val_len, val_len, 1); + make_unistr2(&(q_i->uni_name), val_name, val_len); + + q_i->type = type; + q_i->buf_value = val; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_create_val(char *desc, REG_Q_CREATE_VALUE *q_q, prs_struct *ps, int depth) +{ + if (q_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_create_val"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(q_q->pol), ps, depth); + + smb_io_unihdr ("hdr_name", &(q_q->hdr_name), ps, depth); + smb_io_unistr2("uni_name", &(q_q->uni_name), q_q->hdr_name.buffer, ps, depth); + prs_align(ps); + + prs_uint32("type", ps, depth, &(q_q->type)); + smb_io_buffer3("buf_value", q_q->buf_value, ps, depth); + prs_align(ps); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_create_val(char *desc, REG_R_CREATE_VALUE *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_create_val"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_q->status)); +} + +/******************************************************************* +makes a structure. +********************************************************************/ +void make_reg_q_enum_key(REG_Q_ENUM_KEY *q_i, POLICY_HND *pol, uint32 key_idx) +{ + if (q_i == NULL) return; + + memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); + + q_i->key_index = key_idx; + q_i->key_name_len = 0; + q_i->unknown_1 = 0x0414; + + q_i->ptr1 = 1; + q_i->unknown_2 = 0x0000020A; + memset(q_i->pad1, 0, sizeof(q_i->pad1)); + + q_i->ptr2 = 1; + memset(q_i->pad2, 0, sizeof(q_i->pad2)); + + q_i->ptr3 = 1; + unix_to_nt_time(&q_i->time, 0); /* current time? */ +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_enum_key(char *desc, REG_Q_ENUM_KEY *q_q, prs_struct *ps, int depth) +{ + if (q_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_enum_key"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(q_q->pol), ps, depth); + + prs_uint32("key_index", ps, depth, &(q_q->key_index)); + prs_uint16("key_name_len", ps, depth, &(q_q->key_name_len)); + prs_uint16("unknown_1", ps, depth, &(q_q->unknown_1)); + + prs_uint32("ptr1", ps, depth, &(q_q->ptr1)); + + if (q_q->ptr1 != 0) + { + prs_uint32("unknown_2", ps, depth, &(q_q->unknown_2)); + prs_uint8s(False, "pad1", ps, depth, q_q->pad1, sizeof(q_q->pad1)); + } + + prs_uint32("ptr2", ps, depth, &(q_q->ptr2)); + + if (q_q->ptr2 != 0) + { + prs_uint8s(False, "pad2", ps, depth, q_q->pad2, sizeof(q_q->pad2)); + } + + prs_uint32("ptr3", ps, depth, &(q_q->ptr3)); + + if (q_q->ptr3 != 0) + { + smb_io_time("", &(q_q->time), ps, depth); + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_enum_key(char *desc, REG_R_ENUM_KEY *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_enum_key"); + depth++; + + prs_align(ps); + + prs_uint16("key_name_len", ps, depth, &(r_q->key_name_len)); + prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1)); + + prs_uint32("ptr1", ps, depth, &(r_q->ptr1)); + + if (r_q->ptr1 != 0) + { + prs_uint32("unknown_2", ps, depth, &(r_q->unknown_2)); + prs_uint32("unknown_3", ps, depth, &(r_q->unknown_3)); + smb_io_unistr3("key_name", &(r_q->key_name), ps, depth); + prs_align(ps); + } + + prs_uint32("ptr2", ps, depth, &(r_q->ptr2)); + + if (r_q->ptr2 != 0) + { + prs_uint8s(False, "pad2", ps, depth, r_q->pad2, sizeof(r_q->pad2)); + } + + prs_uint32("ptr3", ps, depth, &(r_q->ptr3)); + + if (r_q->ptr3 != 0) + { + smb_io_time("", &(r_q->time), ps, depth); + } + + prs_uint32("status", ps, depth, &(r_q->status)); +} + + +/******************************************************************* +makes a structure. +********************************************************************/ +void make_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, + char *key_name, uint32 unk) +{ + int len_name = strlen(key_name)+1; + + if (r_q == NULL) return; + + memcpy(&(r_q->pol), pol, sizeof(r_q->pol)); + + make_uni_hdr(&(r_q->hdr_name), len_name, len_name, 1); + make_unistr2(&(r_q->uni_name), key_name, len_name); + + r_q->unknown_0 = 0x00000000; + r_q->unknown_1 = unk; +} /******************************************************************* reads or writes a structure. @@ -227,9 +938,10 @@ void reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int smb_io_unihdr ("", &(r_q->hdr_name), ps, depth); smb_io_unistr2("", &(r_q->uni_name), r_q->hdr_name.buffer, ps, depth); + prs_align(ps); + prs_uint32("unknown_0", ps, depth, &(r_q->unknown_0)); - prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1)); - prs_uint16("unknown_2", ps, depth, &(r_q->unknown_2)); + prs_uint32("unknown_1", ps, depth, &(r_q->unknown_1)); } diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ba6a8d3556..ec4411b783 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1810,7 +1810,7 @@ void make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, for (i = 0; i < num_rids; i++) { - make_dom_rid3(&(r_u->dom_rid[i]), rid[i]); + make_dom_rid3(&(r_u->dom_rid[i]), rid[i], 0x01); } r_u->num_entries3 = num_rids; -- cgit From 375e53826c59c33d52009307f757b71a1fe3d589 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 10 Nov 1998 20:51:25 +0000 Subject: include/local.h: include/smb.h: param/loadparm.c: Made GUEST_SESSSETUP run time selectable. Horror of horrors :-). printing/printing.c: Added J.F.'s latest fix. rpc_parse/parse_misc.c: parse_reg.c: rpcclient/cmd_reg.c: rpcclient/display.c: SGI compiler signed/unsigned issues. smbd/reply.c: Made GUEST_SESSSETUP run time selectable. Horror of horrors :-). utils/testparm.c: Added extra test. Jeremy. (This used to be commit 9668a5ef50be2e6b575f9989e87ee2ff8da5ac1d) --- source3/rpc_parse/parse_misc.c | 2 +- source3/rpc_parse/parse_reg.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 3a74d11e52..b21057033f 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -400,7 +400,7 @@ creates a BUFFER3 structure from a hex string. void make_buffer3_hex(BUFFER3 *str, char *buf) { ZERO_STRUCTP(str); - str->buf_max_len = str->buf_len = strhex_to_str(str->buffer, sizeof(str->buffer), buf); + str->buf_max_len = str->buf_len = strhex_to_str((char *)str->buffer, sizeof(str->buffer), buf); } /******************************************************************* diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 329da974fb..2c871ab873 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -90,7 +90,7 @@ void make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, int len_name = name != NULL ? strlen(name ) + 1: 0; int len_class = class != NULL ? strlen(class) + 1: 0; - static char data[] = + static unsigned char data[] = { 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, -- cgit From c098e44df44e3c6ace3ce00d28140329821e8f3d Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 10 Nov 1998 22:03:34 +0000 Subject: registry modification requires a "sync" or "refresh" on the parent key. opcode 0xb added to do this. a likely candidate name is "RegFlushKey". (This used to be commit 5e9567e3c7d4ee8624a448fcccfcd8003913dbbf) --- source3/rpc_parse/parse_reg.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 2c871ab873..d2f670188b 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -79,6 +79,46 @@ void reg_io_r_open_policy(char *desc, REG_R_OPEN_POLICY *r_r, prs_struct *ps, i } +/******************************************************************* +creates a structure. +********************************************************************/ +void make_reg_q_unk_b(REG_Q_UNK_B *q_u, POLICY_HND *pol) +{ + memcpy(&(q_u->pol), pol, sizeof(q_u->pol)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_unk_b(char *desc, REG_Q_UNK_B *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_unk_b"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_q->pol), ps, depth); +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_unk_b(char *desc, REG_R_UNK_B *r_r, prs_struct *ps, int depth) +{ + if (r_r == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_unk_b"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_r->status)); +} + + /******************************************************************* creates a structure. -- cgit From 75ca9df787b4fe51032bca71f228fd8526e81fdf Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 10 Nov 1998 22:14:05 +0000 Subject: rpcclient registry key delete command: "regdeletekey". (This used to be commit 20987b6105d42f3404ff009cc27e73a1823cd495) --- source3/rpc_parse/parse_reg.c | 51 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index d2f670188b..e329b7751d 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -231,6 +231,57 @@ void reg_io_r_create_key(char *desc, REG_R_CREATE_KEY *r_r, prs_struct *ps, int } +/******************************************************************* +creates a structure. +********************************************************************/ +void make_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd, + char *name) +{ + int len_name = name != NULL ? strlen(name ) + 1: 0; + ZERO_STRUCTP(q_c); + + memcpy(&(q_c->pnt_pol), hnd, sizeof(q_c->pnt_pol)); + + make_uni_hdr(&(q_c->hdr_name), len_name, len_name, 1); + make_unistr2(&(q_c->uni_name), name, len_name); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_delete_key(char *desc, REG_Q_DELETE_KEY *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_delete_key"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_q->pnt_pol), ps, depth); + + smb_io_unihdr ("", &(r_q->hdr_name), ps, depth); + smb_io_unistr2("", &(r_q->uni_name), r_q->hdr_name.buffer, ps, depth); + prs_align(ps); +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_delete_key(char *desc, REG_R_DELETE_KEY *r_r, prs_struct *ps, int depth) +{ + if (r_r == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_delete_key"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_r->status)); +} + + /******************************************************************* creates a structure. ********************************************************************/ -- cgit From 07eb9133efc76b141b963fce0e157d7fbbdd939f Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 11 Nov 1998 00:36:15 +0000 Subject: - renamed open_policy to open_hklm. - renamed open_unk_4 to open_hku - fixed createkey issue spotted by phil cox (This used to be commit 7df85b956787f02d022b34ef8cfc13fc967ae89c) --- source3/rpc_parse/parse_reg.c | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index e329b7751d..109d75731c 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -30,7 +30,7 @@ extern int DEBUGLEVEL; /******************************************************************* creates a structure. ********************************************************************/ -void make_reg_q_open_pol(REG_Q_OPEN_POLICY *q_o, +void make_reg_q_open_hklm(REG_Q_OPEN_HKLM *q_o, uint16 unknown_0, uint32 level) { q_o->ptr = 1; @@ -42,11 +42,11 @@ void make_reg_q_open_pol(REG_Q_OPEN_POLICY *q_o, /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_open_policy(char *desc, REG_Q_OPEN_POLICY *r_q, prs_struct *ps, int depth) +void reg_io_q_open_hklm(char *desc, REG_Q_OPEN_HKLM *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return; - prs_debug(ps, depth, desc, "reg_io_q_open_policy"); + prs_debug(ps, depth, desc, "reg_io_q_open_hklm"); depth++; prs_align(ps); @@ -64,11 +64,11 @@ void reg_io_q_open_policy(char *desc, REG_Q_OPEN_POLICY *r_q, prs_struct *ps, i /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_open_policy(char *desc, REG_R_OPEN_POLICY *r_r, prs_struct *ps, int depth) +void reg_io_r_open_hklm(char *desc, REG_R_OPEN_HKLM *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return; - prs_debug(ps, depth, desc, "reg_io_r_open_policy"); + prs_debug(ps, depth, desc, "reg_io_r_open_hklm"); depth++; prs_align(ps); @@ -156,11 +156,14 @@ void make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, q_c->unknown_0 = 0x0000000C; q_c->ptr2 = 1; - q_c->unk_len1 = 0x14; - q_c->unk_len2 = 0x14; - q_c->unknown_1 = 0x00020000; + q_c->sec_len1 = 0x14; + q_c->sec_len2 = 0x14; + q_c->sec_len3 = 0x0; + q_c->sec_len4 = 0x14; + q_c->sec_len5 = 0x0; + q_c->sec_len6 = 0x14; - make_buffer2(&q_c->buf_unk, data, sizeof(data)); + memcpy(&q_c->buf_unk, data, sizeof(q_c->buf_unk)); q_c->unknown_2 = 0x00000000; } @@ -199,10 +202,13 @@ void reg_io_q_create_key(char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int prs_uint32("ptr2", ps, depth, &(r_q->ptr2)); if (r_q->ptr2) { - prs_uint32("unk_len1", ps, depth, &(r_q->unk_len1)); - prs_uint32("unk_len2", ps, depth, &(r_q->unk_len2)); - prs_uint32("unknown_1", ps, depth, &(r_q->unknown_1)); - smb_io_buffer2("buf_unk", &r_q->buf_unk, 1, ps, depth); + prs_uint32("sec_len1", ps, depth, &(r_q->sec_len1)); + prs_uint32("sec_len2", ps, depth, &(r_q->sec_len2)); + prs_uint32("sec_len3", ps, depth, &(r_q->sec_len3)); + prs_uint32("sec_len4", ps, depth, &(r_q->sec_len4)); + prs_uint32("sec_len5", ps, depth, &(r_q->sec_len5)); + prs_uint32("sec_len6", ps, depth, &(r_q->sec_len6)); + prs_uint8s(False, "buf_unk", ps, depth, r_q->buf_unk, sizeof(r_q->buf_unk)); prs_align(ps); prs_uint32("unknown_2", ps, depth, &(r_q->unknown_2)); @@ -389,7 +395,7 @@ void reg_io_r_unk_1a(char *desc, REG_R_UNK_1A *r_r, prs_struct *ps, int depth) /******************************************************************* creates a structure. ********************************************************************/ -void make_reg_q_open_unk_4(REG_Q_OPEN_UNK_4 *q_o, +void make_reg_q_open_hku(REG_Q_OPEN_HKU *q_o, uint16 unknown_0, uint32 level) { q_o->ptr = 1; @@ -401,11 +407,11 @@ void make_reg_q_open_unk_4(REG_Q_OPEN_UNK_4 *q_o, /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_open_unk_4(char *desc, REG_Q_OPEN_UNK_4 *r_q, prs_struct *ps, int depth) +void reg_io_q_open_hku(char *desc, REG_Q_OPEN_HKU *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return; - prs_debug(ps, depth, desc, "reg_io_q_open_unk_4"); + prs_debug(ps, depth, desc, "reg_io_q_open_hku"); depth++; prs_align(ps); @@ -423,11 +429,11 @@ void reg_io_q_open_unk_4(char *desc, REG_Q_OPEN_UNK_4 *r_q, prs_struct *ps, int /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_open_unk_4(char *desc, REG_R_OPEN_UNK_4 *r_r, prs_struct *ps, int depth) +void reg_io_r_open_hku(char *desc, REG_R_OPEN_HKU *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return; - prs_debug(ps, depth, desc, "reg_io_r_open_unk_4"); + prs_debug(ps, depth, desc, "reg_io_r_open_hku"); depth++; prs_align(ps); -- cgit From edf630c85ea6a1d4bfa74427190e27c3a97085ea Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 11 Nov 1998 00:43:41 +0000 Subject: renamed unk_1b to flush_key (This used to be commit ddfdb6534671a0e9bbbefe555a92925d41abaddf) --- source3/rpc_parse/parse_reg.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 109d75731c..9d816d0062 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -82,7 +82,7 @@ void reg_io_r_open_hklm(char *desc, REG_R_OPEN_HKLM *r_r, prs_struct *ps, int d /******************************************************************* creates a structure. ********************************************************************/ -void make_reg_q_unk_b(REG_Q_UNK_B *q_u, POLICY_HND *pol) +void make_reg_q_flush_key(REG_Q_FLUSH_KEY *q_u, POLICY_HND *pol) { memcpy(&(q_u->pol), pol, sizeof(q_u->pol)); } @@ -90,11 +90,11 @@ void make_reg_q_unk_b(REG_Q_UNK_B *q_u, POLICY_HND *pol) /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_unk_b(char *desc, REG_Q_UNK_B *r_q, prs_struct *ps, int depth) +void reg_io_q_flush_key(char *desc, REG_Q_FLUSH_KEY *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return; - prs_debug(ps, depth, desc, "reg_io_q_unk_b"); + prs_debug(ps, depth, desc, "reg_io_q_flush_key"); depth++; prs_align(ps); @@ -106,11 +106,11 @@ void reg_io_q_unk_b(char *desc, REG_Q_UNK_B *r_q, prs_struct *ps, int depth) /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_unk_b(char *desc, REG_R_UNK_B *r_r, prs_struct *ps, int depth) +void reg_io_r_flush_key(char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return; - prs_debug(ps, depth, desc, "reg_io_r_unk_b"); + prs_debug(ps, depth, desc, "reg_io_r_flush_key"); depth++; prs_align(ps); -- cgit From 58cbefdaafcf8dc9389235928eadd17863130bd4 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 11 Nov 1998 00:57:13 +0000 Subject: registry delete value command: "regdeleteval". this is just so unbelievably simple to do... (This used to be commit c05254a15076711d382a58b85b5f08bf81cb1560) --- source3/rpc_parse/parse_reg.c | 51 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 9d816d0062..fa63717e5b 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -237,6 +237,57 @@ void reg_io_r_create_key(char *desc, REG_R_CREATE_KEY *r_r, prs_struct *ps, int } +/******************************************************************* +creates a structure. +********************************************************************/ +void make_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd, + char *name) +{ + int len_name = name != NULL ? strlen(name ) + 1: 0; + ZERO_STRUCTP(q_c); + + memcpy(&(q_c->pnt_pol), hnd, sizeof(q_c->pnt_pol)); + + make_uni_hdr(&(q_c->hdr_name), len_name, len_name, 1); + make_unistr2(&(q_c->uni_name), name, len_name); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_delete_val(char *desc, REG_Q_DELETE_VALUE *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_delete_val"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_q->pnt_pol), ps, depth); + + smb_io_unihdr ("", &(r_q->hdr_name), ps, depth); + smb_io_unistr2("", &(r_q->uni_name), r_q->hdr_name.buffer, ps, depth); + prs_align(ps); +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_delete_val(char *desc, REG_R_DELETE_VALUE *r_r, prs_struct *ps, int depth) +{ + if (r_r == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_delete_val"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_r->status)); +} + + /******************************************************************* creates a structure. ********************************************************************/ -- cgit From 60a91a1dca12e675e4498062f33ed773ddd5600a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 11 Nov 1998 19:22:08 +0000 Subject: clearing up security descriptor (This used to be commit abdc9d790b7d27b70aaf88451f5c82c99c94ca6e) --- source3/rpc_parse/parse_prs.c | 57 ++++++++++++++++++++++++++++++++-- source3/rpc_parse/parse_reg.c | 16 +++++++--- source3/rpc_parse/parse_sec.c | 72 +++++++++++++++++++++++-------------------- 3 files changed, 104 insertions(+), 41 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 873a689792..cc068778ac 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -303,14 +303,18 @@ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, ui prs_uint16 wrapper. call this and it sets up a pointer to where the uint16 should be stored, or gets the size if reading ********************************************************************/ -BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *off_ptr) +BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset) { - (*off_ptr) = ps->offset; + (*offset) = ps->io; if (ps->io) { /* reading. */ return prs_uint16(name, ps, depth, data16); } + else + { + ps->offset += sizeof(uint16); + } return True; } @@ -318,7 +322,7 @@ BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint3 prs_uint16 wrapper. call this and it retrospectively stores the size. does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ -BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, +BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 ptr_uint16, uint32 start_offset) { if (!ps->io) @@ -331,6 +335,53 @@ BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, prs_uint16(name, ps, depth, &data_size); ps->offset = old_offset; } + else + { + ps->offset = start_offset + (*data16); + } + return True; +} + +/******************************************************************* + prs_uint32 wrapper. call this and it sets up a pointer to where the + uint32 should be stored, or gets the size if reading + ********************************************************************/ +BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset) +{ + (*offset) = ps->io; + if (ps->io) + { + /* reading. */ + return prs_uint32(name, ps, depth, data32); + } + else + { + ps->offset += sizeof(uint32); + } + return True; +} + +/******************************************************************* + prs_uint32 wrapper. call this and it retrospectively stores the size. + does nothing on reading, as that is already handled by ...._pre() + ********************************************************************/ +BOOL prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32, + uint32 ptr_uint32, uint32 start_offset) +{ + if (!ps->io) + { + /* storing: go back and do a retrospective job. i hate this */ + uint32 data_size = ps->offset - start_offset; + uint32 old_offset = ps->offset; + + ps->offset = ptr_uint32; + prs_uint32(name, ps, depth, &data_size); + ps->offset = old_offset; + } + else + { + ps->offset = start_offset + (*data32); + } return True; } diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index fa63717e5b..b650847b80 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -553,11 +553,17 @@ void make_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, q_i->unknown = 0x7; - q_i->ptr = 1; + q_i->ptr = sec_buf != NULL ? 1 : 0; q_i->data = sec_buf; - make_buf_hdr(&(q_i->hdr_sec), buf_len, 0); - make_sec_desc_buf(q_i->data, buf_len, 0); + if (sec_buf != NULL) + { + make_buf_hdr(&(q_i->hdr_sec), buf_len, 0); + q_i->data->max_len = buf_len; + q_i->data->undoc = 0; + q_i->data->len = 0; + q_i->data->sec = NULL; + } } /******************************************************************* @@ -586,10 +592,11 @@ void reg_io_q_get_key_sec(char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, i } } +#if 0 /******************************************************************* makes a structure. ********************************************************************/ -void make_reg_r_get_key_sec(REG_R_GET_KEY_SEC *r_i, POLICY_HND *pol, + void make_reg_r_get_key_sec(REG_R_GET_KEY_SEC *r_i, POLICY_HND *pol, uint32 buf_len, uint8 *buf, uint32 status) { @@ -601,6 +608,7 @@ void make_reg_r_get_key_sec(REG_R_GET_KEY_SEC *r_i, POLICY_HND *pol, r_i->status = status; /* 0x0000 0000 or 0x0000 007a */ } +#endif /******************************************************************* reads or writes a structure. diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index bedf042b7f..af5da93bfb 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -66,11 +66,7 @@ void sec_io_ace(char *desc, SEC_ACE *t, prs_struct *ps, int depth) prs_align(ps); smb_io_dom_sid("sid ", &t->sid , ps, depth); - prs_uint16_post("ace_size ", ps, depth, offset_ace_size, old_offset); - if (ps->io) - { - ps->offset = old_offset + t->ace_size; - } + prs_uint16_post("ace_size ", ps, depth, &t->ace_size, offset_ace_size, old_offset); } /******************************************************************* @@ -105,11 +101,7 @@ void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) prs_align(ps); - prs_uint16_post("acl_size ", ps, depth, offset_acl_size, old_offset); - if (ps->io) - { - ps->offset = old_offset + t->acl_size; - } + prs_uint16_post("acl_size ", ps, depth, &t->acl_size, offset_acl_size, old_offset); } @@ -118,6 +110,12 @@ reads or writes a structure. ********************************************************************/ void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { + uint32 off_owner_sid; + uint32 off_pnt_sid ; + uint32 off_unknown ; + uint32 off_acl ; + uint32 old_offset; + if (t == NULL) return; prs_debug(ps, depth, desc, "sec_io_desc"); @@ -125,39 +123,39 @@ void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) prs_align(ps); - prs_uint16("unknown_1", ps, depth, &(t->unknown_1)); - prs_uint16("unknown_2", ps, depth, &(t->unknown_2)); + /* start of security descriptor stored for back-calc offset purposes */ + old_offset = ps->offset; + + prs_uint32("unknown_1", ps, depth, &(t->unknown_1)); - prs_uint32("off_owner_sid", ps, depth, &(t->off_owner_sid)); - prs_uint32("off_pnt_sid ", ps, depth, &(t->off_pnt_sid )); - prs_uint32("off_unknown ", ps, depth, &(t->off_unknown )); - prs_uint32("off_acl ", ps, depth, &(t->off_acl )); + prs_uint32_pre("off_owner_sid", ps, depth, &(t->off_owner_sid), &off_owner_sid); + prs_uint32_pre("off_pnt_sid ", ps, depth, &(t->off_pnt_sid ), &off_pnt_sid ); + prs_uint32_pre("off_unknown ", ps, depth, &(t->off_unknown ), &off_unknown ); + prs_uint32_pre("off_acl ", ps, depth, &(t->off_acl ), &off_acl ); + prs_uint32_post("off_acl ", ps, depth, &(t->off_acl ), off_acl , old_offset); sec_io_acl ("acl" , &t->acl , ps, depth); + prs_align(ps); + + prs_uint32_post("off_unknown ", ps, depth, &(t->off_unknown ), off_unknown , ps->offset); + + prs_uint32_post("off_owner_sid", ps, depth, &(t->off_owner_sid), off_owner_sid, old_offset); smb_io_dom_sid("owner_sid ", &t->owner_sid , ps, depth); prs_align(ps); + + prs_uint32_post("off_pnt_sid ", ps, depth, &(t->off_pnt_sid ), off_pnt_sid , old_offset); smb_io_dom_sid("parent_sid", &t->parent_sid, ps, depth); prs_align(ps); } -/******************************************************************* -creates a SEC_DESC_BUF structure. -********************************************************************/ -void make_sec_desc_buf(SEC_DESC_BUF *buf, int len, uint32 buf_ptr) -{ - ZERO_STRUCTP(buf); - - /* max buffer size (allocated size) */ - buf->max_len = len; - buf->undoc = 0; - buf->len = buf_ptr != 0 ? len : 0; -} - /******************************************************************* reads or writes a SEC_DESC_BUF structure. ********************************************************************/ void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) { + uint32 off_len; + uint32 old_offset; + if (sec == NULL) return; prs_debug(ps, depth, desc, "sec_io_desc_buf"); @@ -165,12 +163,18 @@ void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) prs_align(ps); - prs_uint32("max_len", ps, depth, &(sec->max_len)); - prs_uint32("undoc ", ps, depth, &(sec->undoc )); - prs_uint32("len ", ps, depth, &(sec->len )); + prs_uint32 ("max_len", ps, depth, &(sec->max_len)); + prs_uint32 ("undoc ", ps, depth, &(sec->undoc )); + prs_uint32_pre("len ", ps, depth, &(sec->len ), &off_len); + + old_offset = ps->offset; - if (sec->len != 0) + /* reading, length is non-zero; writing, descriptor is non-NULL */ + if ((sec->len != 0 || (!ps->io)) && sec->sec != NULL) { - sec_io_desc("sec ", &sec->sec, ps, depth); + sec_io_desc("sec ", sec->sec, ps, depth); } + + prs_uint32_post("len ", ps, depth, &(sec->len ), off_len , old_offset); } + -- cgit From e35207f28de89cb3da88b47f4e70224e6b7f78e9 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 11 Nov 1998 21:44:02 +0000 Subject: security descriptor info, provided by jean-francois (This used to be commit 719382a5579e8798812bbccd14a4c1ffd9003f7a) --- source3/rpc_parse/parse_reg.c | 5 +-- source3/rpc_parse/parse_sec.c | 89 +++++++++++++++++++++++++++++++------------ 2 files changed, 65 insertions(+), 29 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index b650847b80..57de5f8968 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -559,10 +559,7 @@ void make_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, if (sec_buf != NULL) { make_buf_hdr(&(q_i->hdr_sec), buf_len, 0); - q_i->data->max_len = buf_len; - q_i->data->undoc = 0; - q_i->data->len = 0; - q_i->data->sec = NULL; + make_sec_desc_buf(q_i->data, buf_len, NULL); } } diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index af5da93bfb..e94a2a32dd 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -59,14 +59,15 @@ void sec_io_ace(char *desc, SEC_ACE *t, prs_struct *ps, int depth) old_offset = ps->offset; - prs_uint16("unknown_1", ps, depth, &(t->unknown_1)); - prs_uint16_pre("ace_size ", ps, depth, &(t->ace_size ), &offset_ace_size); + prs_uint8 ("type ", ps, depth, &(t->type)); + prs_uint8 ("flags", ps, depth, &(t->flags)); + prs_uint16_pre("size ", ps, depth, &(t->size ), &offset_ace_size); - sec_io_info ("info", &t->info, ps, depth); + sec_io_info ("info ", &t->info, ps, depth); prs_align(ps); - smb_io_dom_sid("sid ", &t->sid , ps, depth); + smb_io_dom_sid("sid ", &t->sid , ps, depth); - prs_uint16_post("ace_size ", ps, depth, &t->ace_size, offset_ace_size, old_offset); + prs_uint16_post("size ", ps, depth, &t->size, offset_ace_size, old_offset); } /******************************************************************* @@ -88,8 +89,8 @@ void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) old_offset = ps->offset; - prs_uint16("unknown_1", ps, depth, &(t->unknown_1)); - prs_uint16_pre("acl_size ", ps, depth, &(t->acl_size ), &offset_acl_size); + prs_uint16("revision", ps, depth, &(t->revision)); + prs_uint16_pre("size ", ps, depth, &(t->size ), &offset_acl_size); prs_uint32("num_aces ", ps, depth, &(t->num_aces )); for (i = 0; i < MIN(t->num_aces, MAX_SEC_ACES); i++) @@ -101,19 +102,19 @@ void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) prs_align(ps); - prs_uint16_post("acl_size ", ps, depth, &t->acl_size, offset_acl_size, old_offset); + prs_uint16_post("size ", ps, depth, &t->size , offset_acl_size, old_offset); } /******************************************************************* reads or writes a structure. ********************************************************************/ -void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) +static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { uint32 off_owner_sid; - uint32 off_pnt_sid ; - uint32 off_unknown ; - uint32 off_acl ; + uint32 off_grp_sid ; + uint32 off_sacl ; + uint32 off_dacl ; uint32 old_offset; if (t == NULL) return; @@ -126,28 +127,66 @@ void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) /* start of security descriptor stored for back-calc offset purposes */ old_offset = ps->offset; - prs_uint32("unknown_1", ps, depth, &(t->unknown_1)); + prs_uint16("revision ", ps, depth, &(t->revision )); + prs_uint16("type ", ps, depth, &(t->type )); prs_uint32_pre("off_owner_sid", ps, depth, &(t->off_owner_sid), &off_owner_sid); - prs_uint32_pre("off_pnt_sid ", ps, depth, &(t->off_pnt_sid ), &off_pnt_sid ); - prs_uint32_pre("off_unknown ", ps, depth, &(t->off_unknown ), &off_unknown ); - prs_uint32_pre("off_acl ", ps, depth, &(t->off_acl ), &off_acl ); + prs_uint32_pre("off_grp_sid ", ps, depth, &(t->off_grp_sid ), &off_grp_sid ); + prs_uint32_pre("off_sacl ", ps, depth, &(t->off_sacl ), &off_sacl ); + prs_uint32_pre("off_dacl ", ps, depth, &(t->off_dacl ), &off_dacl ); - prs_uint32_post("off_acl ", ps, depth, &(t->off_acl ), off_acl , old_offset); - sec_io_acl ("acl" , &t->acl , ps, depth); - prs_align(ps); + if (IS_BITS_SET_ALL(t->type, SEC_DESC_DACL_PRESENT)) + { + prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , old_offset); + sec_io_acl ("dacl" , &t->dacl , ps, depth); + prs_align(ps); + } + else + { + prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , old_offset); + } - prs_uint32_post("off_unknown ", ps, depth, &(t->off_unknown ), off_unknown , ps->offset); + if (IS_BITS_SET_ALL(t->type, SEC_DESC_SACL_PRESENT)) + { + prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , old_offset); + sec_io_acl ("sacl" , &t->sacl , ps, depth); + prs_align(ps); + } + else + { + prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , ps->offset); + } prs_uint32_post("off_owner_sid", ps, depth, &(t->off_owner_sid), off_owner_sid, old_offset); - smb_io_dom_sid("owner_sid ", &t->owner_sid , ps, depth); - prs_align(ps); + if (t->off_owner_sid != 0) + { + smb_io_dom_sid("owner_sid ", &t->owner_sid , ps, depth); + prs_align(ps); + } - prs_uint32_post("off_pnt_sid ", ps, depth, &(t->off_pnt_sid ), off_pnt_sid , old_offset); - smb_io_dom_sid("parent_sid", &t->parent_sid, ps, depth); - prs_align(ps); + prs_uint32_post("off_grp_sid ", ps, depth, &(t->off_grp_sid ), off_grp_sid , old_offset); + if (t->off_grp_sid != 0) + { + smb_io_dom_sid("grp_sid", &t->grp_sid, ps, depth); + prs_align(ps); + } } +/******************************************************************* +creates a SEC_DESC_BUF structure. +********************************************************************/ +void make_sec_desc_buf(SEC_DESC_BUF *buf, int len, SEC_DESC *data) +{ + ZERO_STRUCTP(buf); + + /* max buffer size (allocated size) */ + buf->max_len = len; + buf->undoc = 0; + buf->len = data != NULL ? len : 0; + buf->sec = data; +} + + /******************************************************************* reads or writes a SEC_DESC_BUF structure. ********************************************************************/ -- cgit From 1ab463a79575316612097445ea40b9dd7bcb84bd Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 12 Nov 1998 16:03:35 +0000 Subject: security descriptors and registry. (This used to be commit 9814ac8a65f4d8333527976f1d227e8cd3c2c8ce) --- source3/rpc_parse/parse_misc.c | 37 +++++++++++++++++++++++++ source3/rpc_parse/parse_prs.c | 4 +-- source3/rpc_parse/parse_reg.c | 62 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index b21057033f..9d5620bbf0 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -296,6 +296,43 @@ void make_buf_hdr(BUFHDR *hdr, int max_len, int len) hdr->buf_len = len; } +/******************************************************************* + prs_uint16 wrapper. call this and it sets up a pointer to where the + uint16 should be stored, or gets the size if reading + ********************************************************************/ +void smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset) +{ + (*offset) = ps->offset; + if (ps->io) + { + /* reading. */ + smb_io_hdrbuf(desc, hdr, ps, depth); + } + else + { + ps->offset += sizeof(uint32) * 2; + } +} + +/******************************************************************* + smb_io_hdrbuf wrapper. call this and it retrospectively stores the size. + does nothing on reading, as that is already handled by ...._pre() + ********************************************************************/ +void smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, + uint32 ptr_hdrbuf, uint32 start_offset) +{ + if (!ps->io) + { + /* storing: go back and do a retrospective job. i hate this */ + int data_size = ps->offset - start_offset; + uint32 old_offset = ps->offset; + + make_buf_hdr(hdr, data_size, data_size); + ps->offset = ptr_hdrbuf; + smb_io_hdrbuf(desc, hdr, ps, depth); + ps->offset = old_offset; + } +} /******************************************************************* reads or writes a BUFHDR structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index cc068778ac..8df7d06a39 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -305,7 +305,7 @@ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, ui ********************************************************************/ BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset) { - (*offset) = ps->io; + (*offset) = ps->offset; if (ps->io) { /* reading. */ @@ -348,7 +348,7 @@ BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, ********************************************************************/ BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset) { - (*offset) = ps->io; + (*offset) = ps->offset; if (ps->io) { /* reading. */ diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 57de5f8968..7e9b12b4ec 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -541,6 +541,68 @@ void reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) prs_uint32("status", ps, depth, &(r_u->status)); } +/******************************************************************* +makes a structure. +********************************************************************/ +void make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, + uint32 buf_len, SEC_DESC *sec_desc) +{ + if (q_i == NULL) return; + + memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); + + q_i->unknown = 0x7; + + q_i->ptr = 1; + make_buf_hdr(&(q_i->hdr_sec), buf_len, buf_len); + make_sec_desc_buf(&(q_i->data), buf_len, sec_desc); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_set_key_sec"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_q->pol), ps, depth); + + prs_uint32("unknown", ps, depth, &(r_q->unknown)); + prs_uint32("ptr ", ps, depth, &(r_q->ptr )); + + if (r_q->ptr != 0) + { + uint32 hdr_offset; + uint32 old_offset; + smb_io_hdrbuf_pre("hdr_sec", &(r_q->hdr_sec), ps, depth, &hdr_offset); + old_offset = ps->offset; + sec_io_desc_buf("data ", &(r_q->data ), ps, depth); + prs_align(ps); + smb_io_hdrbuf_post("hdr_sec", &(r_q->hdr_sec), ps, depth, hdr_offset, old_offset); + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_get_key_sec"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_q->status)); +} + + /******************************************************************* makes a structure. ********************************************************************/ -- cgit From 597c5a6caa871b724ee1337f14467950b0707b34 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 12 Nov 1998 19:21:20 +0000 Subject: jean-f. sent me some S-1-3-0,1,2,3 SIDs and names. S-1-3 doesn't exist. security descriptor testing. hey wow, you can get a SD then send it back! (This used to be commit 7466c3113ef8f8a89b8496efadfeb611c9f3e069) --- source3/rpc_parse/parse_misc.c | 5 ++--- source3/rpc_parse/parse_prs.c | 8 +------- source3/rpc_parse/parse_reg.c | 19 +++++++++++++------ source3/rpc_parse/parse_sec.c | 30 ++++++++++++++++++++++-------- 4 files changed, 38 insertions(+), 24 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 9d5620bbf0..4c387e0628 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -319,15 +319,14 @@ void smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ void smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, - uint32 ptr_hdrbuf, uint32 start_offset) + uint32 ptr_hdrbuf, uint32 max_len, uint32 len) { if (!ps->io) { /* storing: go back and do a retrospective job. i hate this */ - int data_size = ps->offset - start_offset; uint32 old_offset = ps->offset; - make_buf_hdr(hdr, data_size, data_size); + make_buf_hdr(hdr, max_len, len); ps->offset = ptr_hdrbuf; smb_io_hdrbuf(desc, hdr, ps, depth); ps->offset = old_offset; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 8df7d06a39..75432627ab 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -366,22 +366,16 @@ BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint3 does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ BOOL prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32, - uint32 ptr_uint32, uint32 start_offset) + uint32 ptr_uint32, uint32 data_size) { if (!ps->io) { /* storing: go back and do a retrospective job. i hate this */ - uint32 data_size = ps->offset - start_offset; uint32 old_offset = ps->offset; - ps->offset = ptr_uint32; prs_uint32(name, ps, depth, &data_size); ps->offset = old_offset; } - else - { - ps->offset = start_offset + (*data32); - } return True; } diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 7e9b12b4ec..f22bf10ff8 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -551,7 +551,7 @@ void make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); - q_i->unknown = 0x7; + q_i->unknown = 0x4; q_i->ptr = 1; make_buf_hdr(&(q_i->hdr_sec), buf_len, buf_len); @@ -582,8 +582,10 @@ void reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, i smb_io_hdrbuf_pre("hdr_sec", &(r_q->hdr_sec), ps, depth, &hdr_offset); old_offset = ps->offset; sec_io_desc_buf("data ", &(r_q->data ), ps, depth); + smb_io_hdrbuf_post("hdr_sec", &(r_q->hdr_sec), ps, depth, hdr_offset, + r_q->data.max_len, r_q->data.len); + ps->offset = old_offset + r_q->data.len + sizeof(uint32) * 3; prs_align(ps); - smb_io_hdrbuf_post("hdr_sec", &(r_q->hdr_sec), ps, depth, hdr_offset, old_offset); } } @@ -594,7 +596,7 @@ void reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, in { if (r_q == NULL) return; - prs_debug(ps, depth, desc, "reg_io_r_get_key_sec"); + prs_debug(ps, depth, desc, "reg_io_r_set_key_sec"); depth++; prs_align(ps); @@ -644,9 +646,14 @@ void reg_io_q_get_key_sec(char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, i if (r_q->ptr != 0) { - smb_io_hdrbuf ("hdr_sec", &(r_q->hdr_sec), ps, depth); - sec_io_desc_buf("data ", r_q->data , ps, depth); - + uint32 hdr_offset; + uint32 old_offset; + smb_io_hdrbuf_pre("hdr_sec", &(r_q->hdr_sec), ps, depth, &hdr_offset); + old_offset = ps->offset; + sec_io_desc_buf("data ", r_q->data , ps, depth); + smb_io_hdrbuf_post("hdr_sec", &(r_q->hdr_sec), ps, depth, hdr_offset, + r_q->data->max_len, r_q->data->len); + ps->offset = old_offset + r_q->data->len + sizeof(uint32) * 3; prs_align(ps); } } diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index e94a2a32dd..7ef6914108 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -137,36 +137,46 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) if (IS_BITS_SET_ALL(t->type, SEC_DESC_DACL_PRESENT)) { - prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , old_offset); + prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , ps->offset - old_offset); + ps->offset = old_offset + t->off_dacl; sec_io_acl ("dacl" , &t->dacl , ps, depth); prs_align(ps); } else { - prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , old_offset); + prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , 0); } if (IS_BITS_SET_ALL(t->type, SEC_DESC_SACL_PRESENT)) { - prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , old_offset); + prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , ps->offset - old_offset); + ps->offset = old_offset + t->off_sacl; sec_io_acl ("sacl" , &t->sacl , ps, depth); prs_align(ps); } else { - prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , ps->offset); + prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , 0); } - prs_uint32_post("off_owner_sid", ps, depth, &(t->off_owner_sid), off_owner_sid, old_offset); + prs_uint32_post("off_owner_sid", ps, depth, &(t->off_owner_sid), off_owner_sid, ps->offset - old_offset); if (t->off_owner_sid != 0) { + if (ps->io) + { + ps->offset = old_offset + t->off_owner_sid; + } smb_io_dom_sid("owner_sid ", &t->owner_sid , ps, depth); prs_align(ps); } - prs_uint32_post("off_grp_sid ", ps, depth, &(t->off_grp_sid ), off_grp_sid , old_offset); + prs_uint32_post("off_grp_sid ", ps, depth, &(t->off_grp_sid ), off_grp_sid , ps->offset - old_offset); if (t->off_grp_sid != 0) { + if (ps->io) + { + ps->offset = old_offset + t->off_grp_sid; + } smb_io_dom_sid("grp_sid", &t->grp_sid, ps, depth); prs_align(ps); } @@ -193,7 +203,9 @@ reads or writes a SEC_DESC_BUF structure. void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) { uint32 off_len; + uint32 off_max_len; uint32 old_offset; + uint32 size; if (sec == NULL) return; @@ -202,7 +214,7 @@ void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) prs_align(ps); - prs_uint32 ("max_len", ps, depth, &(sec->max_len)); + prs_uint32_pre("max_len", ps, depth, &(sec->max_len), &off_max_len); prs_uint32 ("undoc ", ps, depth, &(sec->undoc )); prs_uint32_pre("len ", ps, depth, &(sec->len ), &off_len); @@ -214,6 +226,8 @@ void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) sec_io_desc("sec ", sec->sec, ps, depth); } - prs_uint32_post("len ", ps, depth, &(sec->len ), off_len , old_offset); + size = ps->offset - old_offset; + prs_uint32_post("max_len", ps, depth, &(sec->max_len), off_max_len, size == 0 ? sec->max_len : size); + prs_uint32_post("len ", ps, depth, &(sec->len ), off_len , size); } -- cgit From 2c7f6da1fa95ff77d6c60fcd109205847519434f Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 12 Nov 1998 23:35:05 +0000 Subject: security descriptors. kanji const char* warnings. (This used to be commit 06abdfd68e1d7fa8741afc3f56ec7a13b5fa4ccc) --- source3/rpc_parse/parse_reg.c | 24 ++-- source3/rpc_parse/parse_sec.c | 270 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 268 insertions(+), 26 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index f22bf10ff8..103e6b0f85 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -125,7 +125,7 @@ creates a structure. ********************************************************************/ void make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, char *name, char *class, - SEC_INFO *sam_access) + SEC_ACCESS *sam_access) { int len_name = name != NULL ? strlen(name ) + 1: 0; int len_class = class != NULL ? strlen(class) + 1: 0; @@ -191,7 +191,7 @@ void reg_io_q_create_key(char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int prs_align(ps); prs_uint32("reserved", ps, depth, &(r_q->reserved)); - sec_io_info("sam_access", &r_q->sam_access, ps, depth); + sec_io_access("sam_access", &r_q->sam_access, ps, depth); prs_uint32("ptr1", ps, depth, &(r_q->ptr1)); if (r_q->ptr2 != 0) @@ -551,11 +551,11 @@ void make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); - q_i->unknown = 0x4; + q_i->sec_info = DACL_SECURITY_INFORMATION; q_i->ptr = 1; make_buf_hdr(&(q_i->hdr_sec), buf_len, buf_len); - make_sec_desc_buf(&(q_i->data), buf_len, sec_desc); + make_sec_desc_buf(q_i->data, buf_len, sec_desc); } /******************************************************************* @@ -572,7 +572,7 @@ void reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, i smb_io_pol_hnd("", &(r_q->pol), ps, depth); - prs_uint32("unknown", ps, depth, &(r_q->unknown)); + prs_uint32("sec_info", ps, depth, &(r_q->sec_info)); prs_uint32("ptr ", ps, depth, &(r_q->ptr )); if (r_q->ptr != 0) @@ -581,10 +581,10 @@ void reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, i uint32 old_offset; smb_io_hdrbuf_pre("hdr_sec", &(r_q->hdr_sec), ps, depth, &hdr_offset); old_offset = ps->offset; - sec_io_desc_buf("data ", &(r_q->data ), ps, depth); + sec_io_desc_buf("data ", r_q->data , ps, depth); smb_io_hdrbuf_post("hdr_sec", &(r_q->hdr_sec), ps, depth, hdr_offset, - r_q->data.max_len, r_q->data.len); - ps->offset = old_offset + r_q->data.len + sizeof(uint32) * 3; + r_q->data->max_len, r_q->data->len); + ps->offset = old_offset + r_q->data->len + sizeof(uint32) * 3; prs_align(ps); } } @@ -615,7 +615,9 @@ void make_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); - q_i->unknown = 0x7; + q_i->sec_info = OWNER_SECURITY_INFORMATION | + GROUP_SECURITY_INFORMATION | + DACL_SECURITY_INFORMATION; q_i->ptr = sec_buf != NULL ? 1 : 0; q_i->data = sec_buf; @@ -641,8 +643,8 @@ void reg_io_q_get_key_sec(char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, i smb_io_pol_hnd("", &(r_q->pol), ps, depth); - prs_uint32("unknown", ps, depth, &(r_q->unknown)); - prs_uint32("ptr ", ps, depth, &(r_q->ptr )); + prs_uint32("sec_info", ps, depth, &(r_q->sec_info)); + prs_uint32("ptr ", ps, depth, &(r_q->ptr )); if (r_q->ptr != 0) { diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 7ef6914108..b3c75fb0dc 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -1,11 +1,11 @@ - /* * Unix SMB/Netbios implementation. * Version 1.9. * 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 Tridgell 1992-1998, + * Copyright (C) Jeremy R. Allison 1995-1998 + * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, + * Copyright (C) Paul Ashton 1997-1998. * * 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 @@ -28,19 +28,41 @@ extern int DEBUGLEVEL; +/******************************************************************* +makes a structure. +********************************************************************/ +void make_sec_access(SEC_ACCESS *t, uint32 mask) +{ + t->mask = mask; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ -void sec_io_info(char *desc, SEC_INFO *t, prs_struct *ps, int depth) +void sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) { if (t == NULL) return; - prs_debug(ps, depth, desc, "sec_io_info"); + prs_debug(ps, depth, desc, "sec_io_access"); depth++; prs_align(ps); - prs_uint32("perms", ps, depth, &(t->perms)); + prs_uint32("mask", ps, depth, &(t->mask)); +} + + +/******************************************************************* +makes a structure. +********************************************************************/ +void make_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 flag) +{ + t->type = type; + t->flags = flag; + t->size = sid_size(sid) + 8; + t->info = mask; + + sid_copy(&t->sid, sid); } /******************************************************************* @@ -63,7 +85,7 @@ void sec_io_ace(char *desc, SEC_ACE *t, prs_struct *ps, int depth) prs_uint8 ("flags", ps, depth, &(t->flags)); prs_uint16_pre("size ", ps, depth, &(t->size ), &offset_ace_size); - sec_io_info ("info ", &t->info, ps, depth); + sec_io_access ("info ", &t->info, ps, depth); prs_align(ps); smb_io_dom_sid("sid ", &t->sid , ps, depth); @@ -71,8 +93,38 @@ void sec_io_ace(char *desc, SEC_ACE *t, prs_struct *ps, int depth) } /******************************************************************* -reads or writes a structure. this is one of those retrospective jobs, -which i hate. why do we have to do this? what's it all about? +makes a structure. +********************************************************************/ +void make_sec_acl(SEC_ACL *t, uint16 revision, int num_aces, SEC_ACE *ace) +{ + int i; + t->revision = revision; + t->num_aces = num_aces; + t->size = 4; + t->ace = ace; + + for (i = 0; i < num_aces; i++) + { + t->size += ace[i].size; + } +} + +/******************************************************************* +frees a structure. +********************************************************************/ +void free_sec_acl(SEC_ACL *t) +{ + if (t->ace != NULL) + { + free(t->ace); + } +} + +/******************************************************************* +reads or writes a structure. + +first of the xx_io_xx functions that allocates its data structures +for you as it reads them. ********************************************************************/ void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) { @@ -93,6 +145,20 @@ void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) prs_uint16_pre("size ", ps, depth, &(t->size ), &offset_acl_size); prs_uint32("num_aces ", ps, depth, &(t->num_aces )); + if (ps->io && t->num_aces != 0) + { + /* reading */ + t->ace = malloc(sizeof(t->ace[0]) * t->num_aces); + ZERO_STRUCTPN(t->ace); + } + + if (t->ace == NULL && t->num_aces != 0) + { + DEBUG(0,("INVALID ACL\n")); + ps->offset = 0xfffffffe; + return; + } + for (i = 0; i < MIN(t->num_aces, MAX_SEC_ACES); i++) { fstring tmp; @@ -106,6 +172,85 @@ void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) } +/******************************************************************* +makes a structure +********************************************************************/ +int make_sec_desc(SEC_DESC *t, uint16 revision, uint16 type, + DOM_SID *owner_sid, DOM_SID *grp_sid, + SEC_ACL *sacl, SEC_ACL *dacl) +{ + uint32 offset; + + t->revision = revision; + t->type = type; + + t->off_owner_sid = 0; + t->off_grp_sid = 0; + t->off_sacl = 0; + t->off_dacl = 0; + + t->dacl = dacl; + t->sacl = sacl; + t->owner_sid = owner_sid; + t->grp_sid = grp_sid; + + offset = 0x14; + + if (dacl != NULL) + { + t->off_dacl = offset; + offset += dacl->size; + } + + if (sacl != NULL) + { + t->off_dacl = offset; + offset += dacl->size; + } + + if (owner_sid != NULL) + { + t->off_owner_sid = offset; + offset += sid_size(owner_sid); + } + + if (grp_sid != NULL) + { + t->off_grp_sid = offset; + offset += sid_size(grp_sid); + } + + return offset; +} + + +/******************************************************************* +frees a structure +********************************************************************/ +void free_sec_desc(SEC_DESC *t) +{ + if (t->dacl != NULL) + { + free_sec_acl(t->dacl); + } + + if (t->sacl != NULL) + { + free_sec_acl(t->dacl); + } + + if (t->owner_sid != NULL) + { + free(t->owner_sid); + } + + if (t->grp_sid != NULL) + { + free(t->grp_sid); + } +} + + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -114,8 +259,9 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) uint32 off_owner_sid; uint32 off_grp_sid ; uint32 off_sacl ; - uint32 off_dacl ; + uint32 off_dacl ; uint32 old_offset; + uint32 max_offset = 0; /* after we're done, move offset to end */ if (t == NULL) return; @@ -135,11 +281,27 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) prs_uint32_pre("off_sacl ", ps, depth, &(t->off_sacl ), &off_sacl ); prs_uint32_pre("off_dacl ", ps, depth, &(t->off_dacl ), &off_dacl ); + max_offset = MAX(max_offset, ps->offset); + if (IS_BITS_SET_ALL(t->type, SEC_DESC_DACL_PRESENT)) { prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , ps->offset - old_offset); ps->offset = old_offset + t->off_dacl; - sec_io_acl ("dacl" , &t->dacl , ps, depth); + if (ps->io) + { + /* reading */ + t->dacl = malloc(sizeof(*t->dacl)); + ZERO_STRUCTPN(t->dacl); + } + + if (t->dacl == NULL) + { + DEBUG(0,("INVALID DACL\n")); + ps->offset = 0xfffffffe; + return; + } + + sec_io_acl ("dacl" , t->dacl , ps, depth); prs_align(ps); } else @@ -147,11 +309,27 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , 0); } + max_offset = MAX(max_offset, ps->offset); + if (IS_BITS_SET_ALL(t->type, SEC_DESC_SACL_PRESENT)) { prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , ps->offset - old_offset); ps->offset = old_offset + t->off_sacl; - sec_io_acl ("sacl" , &t->sacl , ps, depth); + if (ps->io) + { + /* reading */ + t->sacl = malloc(sizeof(*t->sacl)); + ZERO_STRUCTPN(t->sacl); + } + + if (t->sacl == NULL) + { + DEBUG(0,("INVALID SACL\n")); + ps->offset = 0xfffffffe; + return; + } + + sec_io_acl ("sacl" , t->sacl , ps, depth); prs_align(ps); } else @@ -159,6 +337,8 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , 0); } + max_offset = MAX(max_offset, ps->offset); + prs_uint32_post("off_owner_sid", ps, depth, &(t->off_owner_sid), off_owner_sid, ps->offset - old_offset); if (t->off_owner_sid != 0) { @@ -166,10 +346,26 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { ps->offset = old_offset + t->off_owner_sid; } - smb_io_dom_sid("owner_sid ", &t->owner_sid , ps, depth); + if (ps->io) + { + /* reading */ + t->owner_sid = malloc(sizeof(*t->owner_sid)); + ZERO_STRUCTPN(t->owner_sid); + } + + if (t->owner_sid == NULL) + { + DEBUG(0,("INVALID OWNER SID\n")); + ps->offset = 0xfffffffe; + return; + } + + smb_io_dom_sid("owner_sid ", t->owner_sid , ps, depth); prs_align(ps); } + max_offset = MAX(max_offset, ps->offset); + prs_uint32_post("off_grp_sid ", ps, depth, &(t->off_grp_sid ), off_grp_sid , ps->offset - old_offset); if (t->off_grp_sid != 0) { @@ -177,9 +373,27 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { ps->offset = old_offset + t->off_grp_sid; } - smb_io_dom_sid("grp_sid", &t->grp_sid, ps, depth); + if (ps->io) + { + /* reading */ + t->grp_sid = malloc(sizeof(*t->grp_sid)); + ZERO_STRUCTPN(t->grp_sid); + } + + if (t->grp_sid == NULL) + { + DEBUG(0,("INVALID GROUP SID\n")); + ps->offset = 0xfffffffe; + return; + } + + smb_io_dom_sid("grp_sid", t->grp_sid, ps, depth); prs_align(ps); } + + max_offset = MAX(max_offset, ps->offset); + + ps->offset = max_offset; } /******************************************************************* @@ -196,6 +410,18 @@ void make_sec_desc_buf(SEC_DESC_BUF *buf, int len, SEC_DESC *data) buf->sec = data; } +/******************************************************************* +frees a SEC_DESC_BUF structure. +********************************************************************/ +void free_sec_desc_buf(SEC_DESC_BUF *buf) +{ + if (buf->sec != NULL) + { + free_sec_desc(buf->sec); + free(buf->sec); + } +} + /******************************************************************* reads or writes a SEC_DESC_BUF structure. @@ -220,6 +446,20 @@ void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) old_offset = ps->offset; + if (sec->len != 0 && ps->io) + { + /* reading */ + sec->sec = malloc(sizeof(*sec->sec)); + ZERO_STRUCTPN(sec->sec); + + if (sec->sec == NULL) + { + DEBUG(0,("INVALID SEC_DESC\n")); + ps->offset = 0xfffffffe; + return; + } + } + /* reading, length is non-zero; writing, descriptor is non-NULL */ if ((sec->len != 0 || (!ps->io)) && sec->sec != NULL) { -- cgit From cb265dbb8b73a177d9e7fd52e53f1eba487b94d4 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 13 Nov 1998 01:38:41 +0000 Subject: security descriptors (This used to be commit 9412edfd4c11a26e4ef290839375e3959cf70a7e) --- source3/rpc_parse/parse_reg.c | 99 +++++++++++++++++-------------------------- source3/rpc_parse/parse_sec.c | 41 ++++++++++++++++-- 2 files changed, 78 insertions(+), 62 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 103e6b0f85..ff57535caf 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -118,6 +118,32 @@ void reg_io_r_flush_key(char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, int d prs_uint32("status", ps, depth, &(r_r->status)); } +/******************************************************************* +reads or writes SEC_DESC_BUF and SEC_DATA structures. +********************************************************************/ +static void reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, SEC_DESC_BUF *data, prs_struct *ps, int depth) +{ + if (ptr != 0) + { + uint32 hdr_offset; + uint32 old_offset; + smb_io_hdrbuf_pre("hdr_sec", hdr_sec, ps, depth, &hdr_offset); + old_offset = ps->offset; + if (ptr3 != NULL) + { + prs_uint32("ptr3", ps, depth, ptr3); + } + if (ptr3 == NULL || *ptr3 != 0) + { + sec_io_desc_buf("data ", data , ps, depth); + } + smb_io_hdrbuf_post("hdr_sec", hdr_sec, ps, depth, hdr_offset, + data->max_len, data->len); + ps->offset = old_offset + data->len + sizeof(uint32) * ((ptr3 != NULL) ? 5 : 3); + prs_align(ps); + } +} + /******************************************************************* @@ -125,20 +151,13 @@ creates a structure. ********************************************************************/ void make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, char *name, char *class, - SEC_ACCESS *sam_access) + SEC_ACCESS *sam_access, + SEC_DESC_BUF *sec_buf, + int sec_len, SEC_DESC *sec) { int len_name = name != NULL ? strlen(name ) + 1: 0; int len_class = class != NULL ? strlen(class) + 1: 0; - static unsigned char data[] = - { - 0x01, 0x00, 0x00, 0x80, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 - }; - ZERO_STRUCTP(q_c); memcpy(&(q_c->pnt_pol), hnd, sizeof(q_c->pnt_pol)); @@ -153,17 +172,13 @@ void make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, memcpy(&(q_c->sam_access), sam_access, sizeof(q_c->sam_access)); q_c->ptr1 = 1; - q_c->unknown_0 = 0x0000000C; + q_c->sec_info = DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION; + q_c->data = sec_buf; q_c->ptr2 = 1; - q_c->sec_len1 = 0x14; - q_c->sec_len2 = 0x14; - q_c->sec_len3 = 0x0; - q_c->sec_len4 = 0x14; - q_c->sec_len5 = 0x0; - q_c->sec_len6 = 0x14; - - memcpy(&q_c->buf_unk, data, sizeof(q_c->buf_unk)); + make_buf_hdr(&(q_c->hdr_sec), sec_len, sec_len); + q_c->ptr3 = 1; + make_sec_desc_buf(q_c->data, sec_len, sec); q_c->unknown_2 = 0x00000000; } @@ -194,27 +209,15 @@ void reg_io_q_create_key(char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int sec_io_access("sam_access", &r_q->sam_access, ps, depth); prs_uint32("ptr1", ps, depth, &(r_q->ptr1)); - if (r_q->ptr2 != 0) + if (r_q->ptr1 != 0) { - prs_uint32("unknown_0", ps, depth, &(r_q->unknown_0)); + prs_uint32("sec_info", ps, depth, &(r_q->sec_info)); } prs_uint32("ptr2", ps, depth, &(r_q->ptr2)); - if (r_q->ptr2) - { - prs_uint32("sec_len1", ps, depth, &(r_q->sec_len1)); - prs_uint32("sec_len2", ps, depth, &(r_q->sec_len2)); - prs_uint32("sec_len3", ps, depth, &(r_q->sec_len3)); - prs_uint32("sec_len4", ps, depth, &(r_q->sec_len4)); - prs_uint32("sec_len5", ps, depth, &(r_q->sec_len5)); - prs_uint32("sec_len6", ps, depth, &(r_q->sec_len6)); - prs_uint8s(False, "buf_unk", ps, depth, r_q->buf_unk, sizeof(r_q->buf_unk)); - prs_align(ps); - - prs_uint32("unknown_2", ps, depth, &(r_q->unknown_2)); - } + reg_io_hdrbuf_sec(r_q->ptr2, &r_q->ptr3, &r_q->hdr_sec, r_q->data, ps, depth); - prs_align(ps); + prs_uint32("unknown_2", ps, depth, &(r_q->unknown_2)); } @@ -575,18 +578,7 @@ void reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, i prs_uint32("sec_info", ps, depth, &(r_q->sec_info)); prs_uint32("ptr ", ps, depth, &(r_q->ptr )); - if (r_q->ptr != 0) - { - uint32 hdr_offset; - uint32 old_offset; - smb_io_hdrbuf_pre("hdr_sec", &(r_q->hdr_sec), ps, depth, &hdr_offset); - old_offset = ps->offset; - sec_io_desc_buf("data ", r_q->data , ps, depth); - smb_io_hdrbuf_post("hdr_sec", &(r_q->hdr_sec), ps, depth, hdr_offset, - r_q->data->max_len, r_q->data->len); - ps->offset = old_offset + r_q->data->len + sizeof(uint32) * 3; - prs_align(ps); - } + reg_io_hdrbuf_sec(r_q->ptr, NULL, &r_q->hdr_sec, r_q->data, ps, depth); } /******************************************************************* @@ -646,18 +638,7 @@ void reg_io_q_get_key_sec(char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, i prs_uint32("sec_info", ps, depth, &(r_q->sec_info)); prs_uint32("ptr ", ps, depth, &(r_q->ptr )); - if (r_q->ptr != 0) - { - uint32 hdr_offset; - uint32 old_offset; - smb_io_hdrbuf_pre("hdr_sec", &(r_q->hdr_sec), ps, depth, &hdr_offset); - old_offset = ps->offset; - sec_io_desc_buf("data ", r_q->data , ps, depth); - smb_io_hdrbuf_post("hdr_sec", &(r_q->hdr_sec), ps, depth, hdr_offset, - r_q->data->max_len, r_q->data->len); - ps->offset = old_offset + r_q->data->len + sizeof(uint32) * 3; - prs_align(ps); - } + reg_io_hdrbuf_sec(r_q->ptr, NULL, &r_q->hdr_sec, r_q->data, ps, depth); } #if 0 diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index b3c75fb0dc..0b0c08fe13 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -194,33 +194,49 @@ int make_sec_desc(SEC_DESC *t, uint16 revision, uint16 type, t->owner_sid = owner_sid; t->grp_sid = grp_sid; - offset = 0x14; + offset = 0x0; if (dacl != NULL) { + if (offset == 0) + { + offset = 0x14; + } t->off_dacl = offset; offset += dacl->size; } if (sacl != NULL) { + if (offset == 0) + { + offset = 0x14; + } t->off_dacl = offset; offset += dacl->size; } if (owner_sid != NULL) { + if (offset == 0) + { + offset = 0x14; + } t->off_owner_sid = offset; offset += sid_size(owner_sid); } if (grp_sid != NULL) { + if (offset == 0) + { + offset = 0x14; + } t->off_grp_sid = offset; offset += sid_size(grp_sid); } - return offset; + return (offset == 0) ? 0x14 : offset; } @@ -256,10 +272,12 @@ reads or writes a structure. ********************************************************************/ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { +#if 0 uint32 off_owner_sid; uint32 off_grp_sid ; uint32 off_sacl ; uint32 off_dacl ; +#endif uint32 old_offset; uint32 max_offset = 0; /* after we're done, move offset to end */ @@ -276,16 +294,23 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) prs_uint16("revision ", ps, depth, &(t->revision )); prs_uint16("type ", ps, depth, &(t->type )); + prs_uint32("off_owner_sid", ps, depth, &(t->off_owner_sid)); + prs_uint32("off_grp_sid ", ps, depth, &(t->off_grp_sid )); + prs_uint32("off_sacl ", ps, depth, &(t->off_sacl )); + prs_uint32("off_dacl ", ps, depth, &(t->off_dacl )); +#if 0 prs_uint32_pre("off_owner_sid", ps, depth, &(t->off_owner_sid), &off_owner_sid); prs_uint32_pre("off_grp_sid ", ps, depth, &(t->off_grp_sid ), &off_grp_sid ); prs_uint32_pre("off_sacl ", ps, depth, &(t->off_sacl ), &off_sacl ); prs_uint32_pre("off_dacl ", ps, depth, &(t->off_dacl ), &off_dacl ); - +#endif max_offset = MAX(max_offset, ps->offset); if (IS_BITS_SET_ALL(t->type, SEC_DESC_DACL_PRESENT)) { +#if 0 prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , ps->offset - old_offset); +#endif ps->offset = old_offset + t->off_dacl; if (ps->io) { @@ -304,16 +329,20 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) sec_io_acl ("dacl" , t->dacl , ps, depth); prs_align(ps); } +#if 0 else { prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , 0); } +#endif max_offset = MAX(max_offset, ps->offset); if (IS_BITS_SET_ALL(t->type, SEC_DESC_SACL_PRESENT)) { +#if 0 prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , ps->offset - old_offset); +#endif ps->offset = old_offset + t->off_sacl; if (ps->io) { @@ -332,14 +361,18 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) sec_io_acl ("sacl" , t->sacl , ps, depth); prs_align(ps); } +#if 0 else { prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , 0); } +#endif max_offset = MAX(max_offset, ps->offset); +#if 0 prs_uint32_post("off_owner_sid", ps, depth, &(t->off_owner_sid), off_owner_sid, ps->offset - old_offset); +#endif if (t->off_owner_sid != 0) { if (ps->io) @@ -366,7 +399,9 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) max_offset = MAX(max_offset, ps->offset); +#if 0 prs_uint32_post("off_grp_sid ", ps, depth, &(t->off_grp_sid ), off_grp_sid , ps->offset - old_offset); +#endif if (t->off_grp_sid != 0) { if (ps->io) -- cgit From 2164685b9f959814af2067aa0dcac2d1b2ac0bc5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 13 Nov 1998 02:07:07 +0000 Subject: include/smb.h: Re-added zero pointer protection to ZERO_STRUCTP. lib/util_sock.c: Added strerror() calls to getpeername failures (which seem to be giving IRIX trouble at the moment). rpc_parse/parse_sec.c: Changed use of ZERO_STRUCTPN to ZERO_STRUCTP which again does zero pointer protection. smbd/quotas.c: Fixed typo. Jeremy. (This used to be commit b62f008974c96e0302d6c146cf49bc2045bef005) --- source3/rpc_parse/parse_sec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 0b0c08fe13..c802f9c2d1 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -149,7 +149,7 @@ void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) { /* reading */ t->ace = malloc(sizeof(t->ace[0]) * t->num_aces); - ZERO_STRUCTPN(t->ace); + ZERO_STRUCTP(t->ace); } if (t->ace == NULL && t->num_aces != 0) @@ -316,7 +316,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { /* reading */ t->dacl = malloc(sizeof(*t->dacl)); - ZERO_STRUCTPN(t->dacl); + ZERO_STRUCTP(t->dacl); } if (t->dacl == NULL) @@ -348,7 +348,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { /* reading */ t->sacl = malloc(sizeof(*t->sacl)); - ZERO_STRUCTPN(t->sacl); + ZERO_STRUCTP(t->sacl); } if (t->sacl == NULL) @@ -383,7 +383,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { /* reading */ t->owner_sid = malloc(sizeof(*t->owner_sid)); - ZERO_STRUCTPN(t->owner_sid); + ZERO_STRUCTP(t->owner_sid); } if (t->owner_sid == NULL) @@ -412,7 +412,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { /* reading */ t->grp_sid = malloc(sizeof(*t->grp_sid)); - ZERO_STRUCTPN(t->grp_sid); + ZERO_STRUCTP(t->grp_sid); } if (t->grp_sid == NULL) @@ -485,7 +485,7 @@ void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) { /* reading */ sec->sec = malloc(sizeof(*sec->sec)); - ZERO_STRUCTPN(sec->sec); + ZERO_STRUCTP(sec->sec); if (sec->sec == NULL) { -- cgit From 2db96e3047400be594e7c5ebf7d6fcedb77f6907 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 13 Nov 1998 03:37:01 +0000 Subject: fixes for OSF1 compilation (This used to be commit 5be3c37f50eac35cad3eadf0d24e7a4ee04c075e) --- source3/rpc_parse/parse_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 6b5da0ef56..3bf017d25e 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -702,8 +702,8 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, rsp->neg_flags = neg_flags; - memcpy(&rsp->lm_resp, lm_resp, 24); - memcpy(&rsp->nt_resp, nt_resp, 24); + memcpy(rsp->lm_resp, lm_resp, 24); + memcpy(rsp->nt_resp, nt_resp, 24); if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { -- cgit From d90063493c5e1ecd650e83797831ffe4cd83795e Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 13 Nov 1998 17:36:42 +0000 Subject: use ZERO_STRUCTPN (checks for NULL) not ZERO_STRUCTP (doesn't check for NULL) (This used to be commit 70ac9dbcecdf4be92638a24f096e4a8807997498) --- source3/rpc_parse/parse_sec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index c802f9c2d1..0b0c08fe13 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -149,7 +149,7 @@ void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) { /* reading */ t->ace = malloc(sizeof(t->ace[0]) * t->num_aces); - ZERO_STRUCTP(t->ace); + ZERO_STRUCTPN(t->ace); } if (t->ace == NULL && t->num_aces != 0) @@ -316,7 +316,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { /* reading */ t->dacl = malloc(sizeof(*t->dacl)); - ZERO_STRUCTP(t->dacl); + ZERO_STRUCTPN(t->dacl); } if (t->dacl == NULL) @@ -348,7 +348,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { /* reading */ t->sacl = malloc(sizeof(*t->sacl)); - ZERO_STRUCTP(t->sacl); + ZERO_STRUCTPN(t->sacl); } if (t->sacl == NULL) @@ -383,7 +383,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { /* reading */ t->owner_sid = malloc(sizeof(*t->owner_sid)); - ZERO_STRUCTP(t->owner_sid); + ZERO_STRUCTPN(t->owner_sid); } if (t->owner_sid == NULL) @@ -412,7 +412,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { /* reading */ t->grp_sid = malloc(sizeof(*t->grp_sid)); - ZERO_STRUCTP(t->grp_sid); + ZERO_STRUCTPN(t->grp_sid); } if (t->grp_sid == NULL) @@ -485,7 +485,7 @@ void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) { /* reading */ sec->sec = malloc(sizeof(*sec->sec)); - ZERO_STRUCTP(sec->sec); + ZERO_STRUCTPN(sec->sec); if (sec->sec == NULL) { -- cgit From d3e6aa666de239546787adc500c6633666bd8d84 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 13 Nov 1998 19:07:28 +0000 Subject: ZERO_STRUCTP not PN (This used to be commit ff8667c8801a59c80c33b43f033d23f3a0fd8313) --- source3/rpc_parse/parse_sec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 0b0c08fe13..c802f9c2d1 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -149,7 +149,7 @@ void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) { /* reading */ t->ace = malloc(sizeof(t->ace[0]) * t->num_aces); - ZERO_STRUCTPN(t->ace); + ZERO_STRUCTP(t->ace); } if (t->ace == NULL && t->num_aces != 0) @@ -316,7 +316,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { /* reading */ t->dacl = malloc(sizeof(*t->dacl)); - ZERO_STRUCTPN(t->dacl); + ZERO_STRUCTP(t->dacl); } if (t->dacl == NULL) @@ -348,7 +348,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { /* reading */ t->sacl = malloc(sizeof(*t->sacl)); - ZERO_STRUCTPN(t->sacl); + ZERO_STRUCTP(t->sacl); } if (t->sacl == NULL) @@ -383,7 +383,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { /* reading */ t->owner_sid = malloc(sizeof(*t->owner_sid)); - ZERO_STRUCTPN(t->owner_sid); + ZERO_STRUCTP(t->owner_sid); } if (t->owner_sid == NULL) @@ -412,7 +412,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { /* reading */ t->grp_sid = malloc(sizeof(*t->grp_sid)); - ZERO_STRUCTPN(t->grp_sid); + ZERO_STRUCTP(t->grp_sid); } if (t->grp_sid == NULL) @@ -485,7 +485,7 @@ void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) { /* reading */ sec->sec = malloc(sizeof(*sec->sec)); - ZERO_STRUCTPN(sec->sec); + ZERO_STRUCTP(sec->sec); if (sec->sec == NULL) { -- cgit From 8fc1504ff8204dd1ca735f31c769f6dadf0f88cb Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 13 Nov 1998 21:41:01 +0000 Subject: Makefile.in configure configure.in include/config.h.in: Changes for DGUX and UNIXWARE. groupdb/aliasdb.c groupdb/aliasfile.c groupdb/groupfile.c: Don't use snprinf, use slprintf. include/includes.h: Fix YP problem. include/smb.h: Fix ZERO_STRUCTP. lib/util_sock.c: Added strerror() in debugs. passdb/ldap.c: Don't use snprinf, use slprintf. rpc_client/cli_lsarpc.c rpc_client/cli_pipe.c rpc_parse/parse_sec.c rpc_server/srv_pipe.c: Don't use snprinf, use slprintf. script/installman.sh: DGUX changes. smbd/open.c smbd/oplock.c: Fixed gcc warnings. web/swat.c: Changes USER to SWAT_USER. (This used to be commit 4c2b5a00983501e5d4aad1456ba8b5ab0dfd9b4c) --- source3/rpc_parse/parse_sec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index c802f9c2d1..409146901d 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -162,7 +162,7 @@ void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) for (i = 0; i < MIN(t->num_aces, MAX_SEC_ACES); i++) { fstring tmp; - snprintf(tmp, sizeof(tmp), "ace[%02d]: ", i); + slprintf(tmp, sizeof(tmp)-1, "ace[%02d]: ", i); sec_io_ace(tmp, &t->ace[i], ps, depth); } -- cgit From 74d539f5573a3ed3ff1b96c54752a389da4c3e14 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 17 Nov 1998 16:19:04 +0000 Subject: - group database API. oops and oh dear, the threat has been carried out: the pre-alpha "domain group" etc parameters have disappeared. - interactive debug detection - re-added mem_man (andrew's memory management, detects memory corruption) - american spellings of "initialise" replaced with english spelling of "initialise". - started on "lookup_name()" and "lookup_sid()" functions. proper ones. - moved lots of functions around. created some modules of commonly used code. e.g the password file locking code, which is used in groupfile.c and aliasfile.c and smbpass.c - moved RID_TYPE_MASK up another bit. this is really unfortunate, but there is no other "fast" way to identify users from groups from aliases. i do not believe that this code saves us anything (the multipliers) and puts us at a disadvantage (reduces the useable rid space). the designers of NT aren't silly: if they can get away with a user- interface-speed LsaLookupNames / LsaLookupSids, then so can we. i spoke with isaac at the cifs conference, the only time for example that they do a security context check is on file create. certainly not on individual file reads / writes, which would drastically hit their performance and ours, too. - renamed myworkgroup to global_sam_name, amongst other things, when used in the rpc code. there is also a global_member_name, as we are always responsible for a SAM database, the scope of which is limited by the role of the machine (e.g if a member of a workgroup, your SAM is for _local_ logins only, and its name is the name of your server. you even still have a SID. see LsaQueryInfoPolicy, levels 3 and 5). - updated functionality of groupname.c to be able to cope with names like DOMAIN\group and SERVER\alias. used this code to be able to do aliases as well as groups. this code may actually be better off being used in username mapping, too. - created a connect to serverlist function in clientgen.c and used it in password.c - initialisation in server.c depends on the role of the server. well, it does now. - rpctorture. smbtorture. EXERCISE EXTREME CAUTION. (This used to be commit 0d21e1e6090b933f396c764af535ca3388a562db) --- source3/rpc_parse/parse_lsa.c | 4 ++-- source3/rpc_parse/parse_net.c | 4 ++-- source3/rpc_parse/parse_rpc.c | 11 ----------- source3/rpc_parse/parse_samr.c | 31 ++++++++++++++++++------------- 4 files changed, 22 insertions(+), 28 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index a5c523fdb6..818e7a0baf 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -37,7 +37,7 @@ void make_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, int len_name = strlen(name); trn->sid_name_use = sid_name_use; - make_uni_hdr(&(trn->hdr_name), len_name, len_name, len_name != 0); + make_uni_hdr(&(trn->hdr_name), len_name, len_name, 1); make_unistr2(uni_name, name, len_name); trn->domain_idx = idx; } @@ -692,7 +692,7 @@ void lsa_io_q_lookup_rids(char *desc, LSA_Q_LOOKUP_RIDS *q_r, prs_struct *ps, i for (i = 0; i < q_r->num_entries; i++) { - smb_io_unistr3("", &(q_r->lookup_name[i]), ps, depth); /* names to be looked up */ + smb_io_unistr3("dom_name", &(q_r->lookup_name[i]), ps, depth); /* names to be looked up */ } prs_uint8s (False, "undoc ", ps, depth, q_r->undoc, UNKNOWN_LEN); diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 57fc73e516..ce573c7bf2 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -665,8 +665,8 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name, int len_domain_name = strlen(domain_name); int len_user_name = strlen(user_name ); int len_wksta_name = strlen(wksta_name ); - int nt_chal_resp_len = ((nt_chal_resp != NULL) ? 24 : 0); - int lm_chal_resp_len = ((lm_chal_resp != NULL) ? 24 : 0); + int nt_chal_resp_len = ((nt_chal_resp != NULL) ? 24 : 0); + int lm_chal_resp_len = ((lm_chal_resp != NULL) ? 24 : 0); unsigned char lm_owf[24]; unsigned char nt_owf[24]; diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 3bf017d25e..5059ca222b 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -122,17 +122,6 @@ interface/version dce/rpc pipe identification }, 0x00 \ } \ -/* pipe string names */ -#define PIPE_SRVSVC "\\PIPE\\srvsvc" -#define PIPE_SAMR "\\PIPE\\samr" -#define PIPE_WINREG "\\PIPE\\winreg" -#define PIPE_WKSSVC "\\PIPE\\wkssvc" -#define PIPE_NETLOGON "\\PIPE\\NETLOGON" -#define PIPE_NTLSA "\\PIPE\\ntlsa" -#define PIPE_NTSVCS "\\PIPE\\ntsvcs" -#define PIPE_LSASS "\\PIPE\\lsass" -#define PIPE_LSARPC "\\PIPE\\lsarpc" - struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ec4411b783..e7f4f0547c 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -993,7 +993,7 @@ void samr_io_q_enum_dom_aliases(char *desc, SAMR_Q_ENUM_DOM_ALIASES *q_e, prs_s makes a SAMR_R_ENUM_DOM_ALIASES structure. ********************************************************************/ void make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, - uint32 num_sam_entries, SAM_USER_INFO_21 grps[MAX_SAM_ENTRIES], + uint32 num_sam_entries, LOCAL_GRP *alss, uint32 status) { int i; @@ -1022,11 +1022,13 @@ void make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, for (i = 0; i < num_sam_entries; i++) { + int acct_name_len = strlen(alss[i].name); + make_sam_entry(&(r_u->sam[i]), - grps[i].uni_user_name.uni_str_len, - grps[i].user_rid); + acct_name_len, + alss[i].rid); - copy_unistr2(&(r_u->uni_grp_name[i]), &(grps[i].uni_user_name)); + make_unistr2(&(r_u->uni_grp_name[i]), alss[i].name , acct_name_len); } r_u->num_entries4 = num_sam_entries; @@ -1415,7 +1417,7 @@ makes a SAMR_R_ENUM_DOM_GROUPS structure. ********************************************************************/ void make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, uint32 start_idx, uint32 num_sam_entries, - SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES], + DOMAIN_GRP *grp, uint32 status) { int i; @@ -1436,14 +1438,17 @@ void make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, { for (i = start_idx, entries_added = 0; i < num_sam_entries; i++) { + int acct_name_len = strlen(grp[i].name); + int acct_desc_len = strlen(grp[i].comment); + make_sam_entry3(&(r_u->sam[entries_added]), start_idx + entries_added + 1, - pass[i].uni_user_name.uni_str_len, - pass[i].uni_acct_desc.uni_str_len, - pass[i].user_rid); + acct_name_len, + acct_desc_len, + grp[i].rid); - copy_unistr2(&(r_u->str[entries_added].uni_grp_name), &(pass[i].uni_user_name)); - copy_unistr2(&(r_u->str[entries_added].uni_grp_desc), &(pass[i].uni_acct_desc)); + make_unistr2(&(r_u->str[entries_added].uni_grp_name), grp[i].name , acct_name_len); + make_unistr2(&(r_u->str[entries_added].uni_grp_desc), grp[i].comment, acct_desc_len); entries_added++; } @@ -1793,7 +1798,7 @@ void samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *p makes a SAMR_R_LOOKUP_NAMES structure. ********************************************************************/ void make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, - uint32 num_rids, uint32 *rid, uint32 status) + uint32 num_rids, uint32 *rid, uint8 *type, uint32 status) { int i; if (r_u == NULL) return; @@ -1810,7 +1815,7 @@ void make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, for (i = 0; i < num_rids; i++) { - make_dom_rid3(&(r_u->dom_rid[i]), rid[i], 0x01); + make_dom_rid3(&(r_u->dom_rid[i]), rid[i], type[i]); } r_u->num_entries3 = num_rids; @@ -2100,7 +2105,7 @@ void make_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u, { r_u->ptr_0 = 1; r_u->num_entries = num_gids; - r_u->ptr_1 = 1; + r_u->ptr_1 = (num_gids != 0) ? 1 : 0; r_u->num_entries2 = num_gids; r_u->gid = gid; -- cgit From f22b817d3fdac2c6a98b3297f758aea554785513 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 20 Nov 1998 20:44:21 +0000 Subject: acconfig.h configure configure.in include/config.h.in: Added -lsec and -lsecurity checks in a more sane way. rpc_client/cli_netlogon.c: Removed correct bits check to see if this works with an NT3.51 PDC. rpc_parse/parse_samr.c: Fixed compile warnings. Jeremy. (This used to be commit 34d8f4b1c4d59ab3c009360fc67eef9361dd859b) --- source3/rpc_parse/parse_samr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index e7f4f0547c..6e0eaaaa6a 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2986,7 +2986,7 @@ void make_enc_passwd(SAMR_ENC_PASSWD *pwd, char pass[512]) if (pwd == NULL) return; pwd->ptr = 1; - memcpy(&(pwd->pass), pass, sizeof(pwd->pass)); + memcpy(pwd->pass, pass, sizeof(pwd->pass)); } /******************************************************************* @@ -3013,7 +3013,7 @@ void make_enc_hash(SAMR_ENC_HASH *hsh, uchar hash[16]) if (hsh == NULL) return; hsh->ptr = 1; - memcpy(&(hsh->hash), hash, sizeof(hsh->hash)); + memcpy(hsh->hash, hash, sizeof(hsh->hash)); } /******************************************************************* -- cgit From 4cee58780cb15fe5889b9dd0dc34459512d75062 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 23 Nov 1998 21:51:05 +0000 Subject: unix instance of group database API (This used to be commit e76f593b3572ac881f1aa1fb3326d8b7169b0078) --- source3/rpc_parse/parse_misc.c | 2 +- source3/rpc_parse/parse_samr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 4c387e0628..97d4f3d563 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -204,7 +204,7 @@ creates a DOM_SID2 structure. ********************************************************************/ void make_dom_sid2(DOM_SID2 *sid2, DOM_SID *sid) { - sid2->sid = *sid; + sid_copy(&sid2->sid, sid); sid2->num_auths = sid2->sid.num_auths; } diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 6e0eaaaa6a..f4c6d75707 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1905,7 +1905,7 @@ void samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, i makes a SAMR_R_UNKNOWN_12 structure. ********************************************************************/ void make_samr_r_unknown_12(SAMR_R_UNKNOWN_12 *r_u, - uint32 num_aliases, fstring *als_name, uint32 *num_als_usrs, + uint32 num_aliases, fstring *als_name, uint8 *num_als_usrs, uint32 status) { int i; -- cgit From 59d4087160ba41aac724722dc29c4b6e4e3b69b0 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 25 Nov 1998 19:57:04 +0000 Subject: LsaLookupNames client call (first used as lookupnames command in rpcclient). (This used to be commit 68342a29a892e515cf2b22d759476d61944bcd59) --- source3/rpc_parse/parse_lsa.c | 66 ++++++++++++++++++++++++++++++++---------- source3/rpc_parse/parse_misc.c | 11 ++----- 2 files changed, 53 insertions(+), 24 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 818e7a0baf..5adff5256d 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -563,7 +563,7 @@ static void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, } /******************************************************************* -makes an LSA_R_ENUM_TRUST_DOM structure. +makes a structure. ********************************************************************/ void make_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd, int num_sids, DOM_SID **sids, @@ -571,7 +571,7 @@ void make_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd, { if (q_l == NULL) return; - DEBUG(5,("make_r_enum_trust_dom\n")); + DEBUG(5,("make_q_lookup_sids\n")); memcpy(&(q_l->pol), hnd, sizeof(q_l->pol)); make_lsa_sid_enum(&(q_l->sids), num_sids, sids); @@ -667,16 +667,47 @@ void lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, i prs_uint32("status ", ps, depth, &(r_s->status)); } +/******************************************************************* +makes a structure. +********************************************************************/ +void make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, + int num_names, char **names) +{ + int i; + if (q_l == NULL) return; + + DEBUG(5,("make_q_lookup_names\n")); + + memcpy(&(q_l->pol), hnd, sizeof(q_l->pol)); + + SMB_ASSERT_ARRAY(q_l->uni_name, q_l->num_entries); + + q_l->num_entries = num_names; + q_l->num_entries2 = num_names; + + for (i = 0; i < num_names; i++) + { + int len = strlen(names[i]); + make_uni_hdr(&q_l->hdr_name[i], len, len, len != 0); + make_unistr2(&q_l->uni_name[i], names[i], len); + } + + q_l->num_trans_entries = 0; + q_l->ptr_trans_sids = 0; + q_l->lookup_level = 1; + q_l->mapped_count = 0; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ -void lsa_io_q_lookup_rids(char *desc, LSA_Q_LOOKUP_RIDS *q_r, prs_struct *ps, int depth) +void lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth) { int i; if (q_r == NULL) return; - prs_debug(ps, depth, desc, "lsa_io_q_lookup_rids"); + prs_debug(ps, depth, desc, "lsa_io_q_lookup_names"); depth++; prs_align(ps); @@ -685,47 +716,52 @@ void lsa_io_q_lookup_rids(char *desc, LSA_Q_LOOKUP_RIDS *q_r, prs_struct *ps, i prs_uint32("num_entries ", ps, depth, &(q_r->num_entries)); prs_uint32("num_entries2 ", ps, depth, &(q_r->num_entries2)); - prs_uint32("buffer_dom_sid ", ps, depth, &(q_r->buffer_dom_sid)); /* undocumented domain SID buffer pointer */ - prs_uint32("buffer_dom_name", ps, depth, &(q_r->buffer_dom_name)); /* undocumented domain name buffer pointer */ - SMB_ASSERT_ARRAY(q_r->lookup_name, q_r->num_entries); + SMB_ASSERT_ARRAY(q_r->uni_name, q_r->num_entries); for (i = 0; i < q_r->num_entries; i++) { - smb_io_unistr3("dom_name", &(q_r->lookup_name[i]), ps, depth); /* names to be looked up */ + smb_io_unihdr("hdr_name", &(q_r->hdr_name[i]), ps, depth); /* pointer names */ } - prs_uint8s (False, "undoc ", ps, depth, q_r->undoc, UNKNOWN_LEN); + for (i = 0; i < q_r->num_entries; i++) + { + smb_io_unistr2("dom_name", &(q_r->uni_name[i]), q_r->hdr_name[i].buffer, ps, depth); /* names to be looked up */ + prs_align(ps); + } + + prs_uint32("num_trans_entries ", ps, depth, &(q_r->num_trans_entries)); + prs_uint32("ptr_trans_sids ", ps, depth, &(q_r->ptr_trans_sids)); + prs_uint32("lookup_level ", ps, depth, &(q_r->lookup_level )); + prs_uint32("mapped_count ", ps, depth, &(q_r->mapped_count )); } /******************************************************************* reads or writes a structure. ********************************************************************/ -void lsa_io_r_lookup_rids(char *desc, LSA_R_LOOKUP_RIDS *r_r, prs_struct *ps, int depth) +void lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth) { int i; if (r_r == NULL) return; - prs_debug(ps, depth, desc, "lsa_io_r_lookup_rids"); + prs_debug(ps, depth, desc, "lsa_io_r_lookup_names"); depth++; prs_align(ps); - lsa_io_dom_r_ref("", &(r_r->dom_ref), ps, depth); /* domain reference info */ + lsa_io_dom_r_ref("", r_r->dom_ref, ps, depth); /* domain reference info */ prs_uint32("num_entries ", ps, depth, &(r_r->num_entries)); prs_uint32("undoc_buffer", ps, depth, &(r_r->undoc_buffer)); prs_uint32("num_entries2", ps, depth, &(r_r->num_entries2)); - SMB_ASSERT_ARRAY(r_r->dom_rid, r_r->num_entries2); - for (i = 0; i < r_r->num_entries2; i++) { smb_io_dom_rid2("", &(r_r->dom_rid[i]), ps, depth); /* domain RIDs being looked up */ } - prs_uint32("num_entries3", ps, depth, &(r_r->num_entries3)); + prs_uint32("mapped_count", ps, depth, &(r_r->mapped_count)); prs_uint32("status ", ps, depth, &(r_r->status)); } diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 97d4f3d563..ad268f60a4 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -674,7 +674,6 @@ creates a DOM_RID2 structure. void make_dom_rid2(DOM_RID2 *rid2, uint32 rid, uint8 type) { rid2->type = type; - rid2->undoc = 0x5; rid2->rid = rid; rid2->rid_idx = 0; } @@ -691,14 +690,8 @@ void smb_io_dom_rid2(char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth) prs_align(ps); - /* should be value 5, so enforce it */ - rid2->type = 5; - - /* should be value 5, so enforce it */ - rid2->undoc = 5; - - prs_uint32("type ", ps, depth, &(rid2->type)); - prs_uint32("undoc ", ps, depth, &(rid2->undoc )); + prs_uint8("type ", ps, depth, &(rid2->type)); + prs_align(ps); prs_uint32("rid ", ps, depth, &(rid2->rid )); prs_uint32("rid_idx", ps, depth, &(rid2->rid_idx )); } -- cgit From 5ebcdbae9b0eb05570613bd939af9fc827920a29 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 25 Nov 1998 23:54:30 +0000 Subject: yeehaah got users to be included in S-1-5-xxx-yyy-zzz's local groups. now need search capability on S-1-5-20, which will need argh, a "group database API" on S-1-5-20, and the ability to add BUILTIN\Admins etc to "local group map" argh. (This used to be commit a24f6eb00ba7486479cbcf7fadf5456521c56179) --- source3/rpc_parse/parse_samr.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index f4c6d75707..da13e1033b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1646,16 +1646,16 @@ void samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO *r_u, prs_str } /******************************************************************* -reads or writes a SAMR_Q_LOOKUP_IDS structure. +reads or writes a SAMR_Q_QUERY_USERALIASES structure. ********************************************************************/ -void samr_io_q_lookup_ids(char *desc, SAMR_Q_LOOKUP_IDS *q_u, prs_struct *ps, int depth) +void samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES *q_u, prs_struct *ps, int depth) { fstring tmp; int i; if (q_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_q_lookup_ids"); + prs_debug(ps, depth, desc, "samr_io_q_query_useraliases"); depth++; prs_align(ps); @@ -1690,15 +1690,15 @@ void samr_io_q_lookup_ids(char *desc, SAMR_Q_LOOKUP_IDS *q_u, prs_struct *ps, i /******************************************************************* -makes a SAMR_R_LOOKUP_IDS structure. +makes a SAMR_R_QUERY_USERALIASES structure. ********************************************************************/ -void make_samr_r_lookup_ids(SAMR_R_LOOKUP_IDS *r_u, +void make_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u, uint32 num_rids, uint32 *rid, uint32 status) { int i; if (r_u == NULL) return; - DEBUG(5,("make_samr_r_lookup_ids\n")); + DEBUG(5,("make_samr_r_query_useraliases\n")); if (status == 0x0) { @@ -1726,13 +1726,13 @@ void make_samr_r_lookup_ids(SAMR_R_LOOKUP_IDS *r_u, /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_lookup_ids(char *desc, SAMR_R_LOOKUP_IDS *r_u, prs_struct *ps, int depth) +void samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs_struct *ps, int depth) { fstring tmp; int i; if (r_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_r_lookup_ids"); + prs_debug(ps, depth, desc, "samr_io_r_query_useraliases"); depth++; prs_align(ps); -- cgit From 30038de4623bc827ee8019c569faf00583d1fe58 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 29 Nov 1998 20:03:33 +0000 Subject: weekend work. user / group database API. - split sam_passwd and smb_passwd into separate higher-order function tables - renamed struct smb_passwd's "smb_user" to "unix_user". added "nt_user" plus user_rid, and added a "wrap" function in both sam_passwd and smb_passwd password databases to fill in the blank entries that are not obtained from whatever password database API instance is being used. NOTE: whenever a struct smb_passwd or struct sam_passwd is used, it MUST be initialised with pwdb_sam_init() or pwd_smb_init(), see chgpasswd.c for the only example outside of the password database APIs i could find. - added query_useraliases code to rpcclient. - dealt with some nasty interdependencies involving non-smbd programs and the password database API. this is still not satisfactorily resolved completelely, but it's the best i can do for now. - #ifdef'd out some password database options so that people don't mistakenly set them unless they recompile to _use_ those options. lots of debugging done, it's still not finished. the unix/NT uid/gid and user-rid/group-rid issues are better, but not perfect. the "BUILTIN" domain is still missing: users cannot be added to "BUILTIN" groups yet, as we only have an "alias" db API and a "group" db API but not "builtin-alias" db API... (This used to be commit 5d5d7e4de7d1514ab87b07ede629de8aa00519a1) --- source3/rpc_parse/parse_misc.c | 54 ------------------------------------------ source3/rpc_parse/parse_samr.c | 34 +++++++++++++++++++------- 2 files changed, 25 insertions(+), 63 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index ad268f60a4..e9423b3a51 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -145,60 +145,6 @@ void smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) prs_uint32s(False, "sub_auths ", ps, depth, sid->sub_auths, sid->num_auths); } -/******************************************************************* -creates a DOM_SID structure. - -BIG NOTE: this function only does SIDS where the identauth is not >= 2^32 -identauth >= 2^32 can be detected because it will be specified in hex - -********************************************************************/ -void make_dom_sid(DOM_SID *sid, char *str_sid) -{ - pstring domsid; - int identauth; - char *p; - - if (sid == NULL) return; - - if (domsid == NULL) - { - DEBUG(4,("netlogon domain SID: none\n")); - sid->sid_rev_num = 0; - sid->num_auths = 0; - return; - } - - pstrcpy(domsid, str_sid); - - DEBUG(4,("make_dom_sid %d SID: %s\n", __LINE__, domsid)); - - /* assume, but should check, that domsid starts "S-" */ - p = strtok(domsid+2,"-"); - sid->sid_rev_num = atoi(p); - - /* identauth in decimal should be < 2^32 */ - /* identauth in hex should be >= 2^32 */ - identauth = atoi(strtok(0,"-")); - - DEBUG(4,("netlogon rev %d\n", sid->sid_rev_num)); - DEBUG(4,("netlogon %s ia %d\n", p, identauth)); - - sid->id_auth[0] = 0; - sid->id_auth[1] = 0; - sid->id_auth[2] = (identauth & 0xff000000) >> 24; - sid->id_auth[3] = (identauth & 0x00ff0000) >> 16; - sid->id_auth[4] = (identauth & 0x0000ff00) >> 8; - sid->id_auth[5] = (identauth & 0x000000ff); - - sid->num_auths = 0; - - while ((p = strtok(0, "-")) != NULL && sid->num_auths < MAXSUBAUTHS) - { - sid->sub_auths[sid->num_auths++] = atoi(p); - } - - DEBUG(4,("make_dom_sid: %d SID: %s\n", __LINE__, domsid)); -} /******************************************************************* creates a DOM_SID2 structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index da13e1033b..af459d1fd6 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1645,6 +1645,30 @@ void samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO *r_u, prs_str prs_uint32("status", ps, depth, &(r_u->status)); } + +/******************************************************************* +makes a SAMR_Q_QUERY_USERALIASES structure. +********************************************************************/ +void make_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u, + POLICY_HND *hnd, + DOM_SID *sid) +{ + if (q_u == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_query_useraliases\n")); + + memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); + + q_u->num_sids1 = 1; + q_u->ptr = 0; + q_u->num_sids2 = 1; + + { + q_u->ptr_sid[0] = 1; + make_dom_sid2(&q_u->sid[0], sid); + } +} + /******************************************************************* reads or writes a SAMR_Q_QUERY_USERALIASES structure. ********************************************************************/ @@ -1695,7 +1719,6 @@ makes a SAMR_R_QUERY_USERALIASES structure. void make_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u, uint32 num_rids, uint32 *rid, uint32 status) { - int i; if (r_u == NULL) return; DEBUG(5,("make_samr_r_query_useraliases\n")); @@ -1706,12 +1729,7 @@ void make_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u, r_u->ptr = 1; r_u->num_entries2 = num_rids; - SMB_ASSERT_ARRAY(r_u->rid, num_rids); - - for (i = 0; i < num_rids; i++) - { - r_u->rid[i] = rid[i]; - } + r_u->rid = rid; } else { @@ -1743,8 +1761,6 @@ void samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs if (r_u->num_entries != 0) { - SMB_ASSERT_ARRAY(r_u->rid, r_u->num_entries2); - for (i = 0; i < r_u->num_entries2; i++) { slprintf(tmp, sizeof(tmp)-1, "rid[%02d]", i); -- cgit From 67638b8d2b59dc992280af934346a5a1ef5fe62d Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 1 Dec 1998 16:04:24 +0000 Subject: adding some samr parsing calls (group / alias adding / deleting) added code that moves MACHINE.SID to DOMAIN_NAME.SID if it exists. (This used to be commit 51c1c31768a92d9c57ee6c09b78419bcbc544f03) --- source3/rpc_parse/parse_samr.c | 1617 +++++++++++++++++++++++++--------------- 1 file changed, 1007 insertions(+), 610 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index af459d1fd6..f6e0fa642f 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -83,7 +83,7 @@ void make_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, { if (q_u == NULL) return; - DEBUG(5,("samr_make_q_open_domain\n")); + DEBUG(5,("samr_make_samr_q_open_domain\n")); memcpy(&q_u->connect_pol, connect_pol, sizeof(q_u->connect_pol)); q_u->rid = rid; @@ -137,7 +137,7 @@ void make_samr_q_unknown_2c(SAMR_Q_UNKNOWN_2C *q_u, POLICY_HND *user_pol) { if (q_u == NULL) return; - DEBUG(5,("samr_make_q_unknown_2c\n")); + DEBUG(5,("samr_make_samr_q_unknown_2c\n")); memcpy(&q_u->user_pol, user_pol, sizeof(q_u->user_pol)); } @@ -199,7 +199,7 @@ void make_samr_q_unknown_3(SAMR_Q_UNKNOWN_3 *q_u, { if (q_u == NULL) return; - DEBUG(5,("samr_make_q_unknown_3\n")); + DEBUG(5,("samr_make_samr_q_unknown_3\n")); memcpy(&q_u->user_pol, user_pol, sizeof(q_u->user_pol)); q_u->switch_value = switch_value; @@ -233,7 +233,7 @@ void make_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO *q_u, { if (q_u == NULL) return; - DEBUG(5,("samr_make_q_query_dom_info\n")); + DEBUG(5,("samr_make_samr_q_query_dom_info\n")); memcpy(&q_u->domain_pol, domain_pol, sizeof(q_u->domain_pol)); q_u->switch_value = switch_value; @@ -811,7 +811,7 @@ void make_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_e, POLICY_HND *pol, { if (q_e == NULL || pol == NULL) return; - DEBUG(5,("make_q_enum_dom_users\n")); + DEBUG(5,("make_samr_q_enum_dom_users\n")); memcpy(&(q_e->pol), pol, sizeof(*pol)); @@ -951,140 +951,6 @@ void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struc prs_uint32("status", ps, depth, &(r_u->status)); } -/******************************************************************* -makes a SAMR_Q_ENUM_DOM_ALIASES structure. -********************************************************************/ -void make_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_e, POLICY_HND *pol, uint32 size) -{ - if (q_e == NULL || pol == NULL) return; - - DEBUG(5,("make_q_enum_dom_aliases\n")); - - memcpy(&(q_e->pol), pol, sizeof(*pol)); - - q_e->unknown_0 = 0; - q_e->max_size = size; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void samr_io_q_enum_dom_aliases(char *desc, SAMR_Q_ENUM_DOM_ALIASES *q_e, prs_struct *ps, int depth) -{ - if (q_e == NULL) return; - - prs_debug(ps, depth, desc, "samr_io_q_enum_dom_aliases"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); - prs_align(ps); - - prs_uint32("unknown_0", ps, depth, &(q_e->unknown_0)); - prs_uint32("max_size ", ps, depth, &(q_e->max_size )); - - prs_align(ps); -} - - -/******************************************************************* -makes a SAMR_R_ENUM_DOM_ALIASES structure. -********************************************************************/ -void make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, - uint32 num_sam_entries, LOCAL_GRP *alss, - uint32 status) -{ - int i; - - if (r_u == NULL) return; - - DEBUG(5,("make_samr_r_enum_dom_aliases\n")); - - if (num_sam_entries >= MAX_SAM_ENTRIES) - { - num_sam_entries = MAX_SAM_ENTRIES; - DEBUG(5,("limiting number of entries to %d\n", - num_sam_entries)); - } - - r_u->num_entries = num_sam_entries; - - if (num_sam_entries > 0) - { - r_u->ptr_entries = 1; - r_u->num_entries2 = num_sam_entries; - r_u->ptr_entries2 = 1; - r_u->num_entries3 = num_sam_entries; - - SMB_ASSERT_ARRAY(r_u->sam, num_sam_entries); - - for (i = 0; i < num_sam_entries; i++) - { - int acct_name_len = strlen(alss[i].name); - - make_sam_entry(&(r_u->sam[i]), - acct_name_len, - alss[i].rid); - - make_unistr2(&(r_u->uni_grp_name[i]), alss[i].name , acct_name_len); - } - - r_u->num_entries4 = num_sam_entries; - } - else - { - r_u->ptr_entries = 0; - } - - r_u->status = status; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_struct *ps, int depth) -{ - int i; - - if (r_u == NULL) return; - - prs_debug(ps, depth, desc, "samr_io_r_enum_dom_aliases"); - depth++; - - prs_align(ps); - - prs_uint32("num_entries", ps, depth, &(r_u->num_entries)); - prs_uint32("ptr_entries", ps, depth, &(r_u->ptr_entries)); - - if (r_u->num_entries != 0 && r_u->ptr_entries != 0) - { - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); - prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); - prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); - - SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries); - - for (i = 0; i < r_u->num_entries; i++) - { - sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); - } - - for (i = 0; i < r_u->num_entries; i++) - { - smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); - } - - prs_align(ps); - - prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); - } - - prs_uint32("status", ps, depth, &(r_u->status)); -} - - /******************************************************************* makes a SAMR_Q_QUERY_DISPINFO structure. ********************************************************************/ @@ -1093,7 +959,7 @@ void make_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_e, POLICY_HND *pol, { if (q_e == NULL || pol == NULL) return; - DEBUG(5,("make_q_query_dispinfo\n")); + DEBUG(5,("make_samr_q_query_dispinfo\n")); memcpy(&(q_e->pol), pol, sizeof(*pol)); @@ -1366,6 +1232,156 @@ void samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struc } +/******************************************************************* +makes a SAMR_Q_OPEN_GROUP structure. +********************************************************************/ +void make_samr_q_open_group(SAMR_Q_OPEN_GROUP *q_c, + POLICY_HND *hnd, uint32 unk, uint32 rid) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_open_group\n")); + + memcpy(&(q_c->domain_pol), hnd, sizeof(q_c->domain_pol)); + q_c->unknown = unk; + q_c->rid_group = rid; +} + + +#if 0 +/* SAMR_Q_CREATE_DOM_GROUP - SAM create group */ +typedef struct q_samr_create_dom_group_info +{ + POLICY_HND pol; /* policy handle */ + + UNIHDR hdr_acct_desc; + UNISTR2 uni_acct_desc; + + uint16 unknown_1; /* 0x0002 */ + uint16 unknown_2; /* 0x0001 */ + +} SAMR_Q_CREATE_DOM_GROUP; + +/* SAMR_R_CREATE_DOM_GROUP - SAM create group */ +typedef struct r_samr_create_dom_group_info +{ + POLICY_HND pol; /* policy handle */ + + uint32 rid; + uint32 status; + +} SAMR_R_CREATE_DOM_GROUP; + +/* SAMR_Q_QUERY_GROUPINFO - SAM Group Info */ +typedef struct q_samr_query_group_info +{ + POLICY_HND pol; /* policy handle */ + + uint16 switch_level; /* 0x0001 seen */ + +} SAMR_Q_QUERY_GROUPINFO; + +typedef struct samr_group_info1 +{ + UNIHDR hdr_acct_name; + UNIHDR hdr_acct_desc; + + uint32 unknown_1; /* 0x0000 0003 - number of group members? */ + uint32 unknown_2; /* 0x0000 0001 - number of group members? */ + + UNISTR2 uni_acct_name; + UNISTR2 uni_acct_desc; + +} GROUP_INFO1; + +typedef struct samr_group_info4 +{ + UNIHDR hdr_acct_desc; + UNISTR2 uni_acct_desc; + +} GROUP_INFO4; + +/* SAMR_R_QUERY_GROUPINFO - SAM Group Info */ +typedef struct r_samr_query_groupinfo_info +{ + uint32 ptr; + uint16 switch_value; /* 0x0001 seen */ + /* uint8[2] padding */ + + union + { + GROUP_INFO1 info1; + + } group; + + uint32 status; + +} SAMR_R_QUERY_GROUPINFO; + + +/* SAMR_Q_SET_GROUPINFO - SAM Group Info */ +typedef struct q_samr_set_group_info +{ + POLICY_HND pol; /* policy handle */ + uint16 switch_value1; /* 0x0004 seen */ + uint16 switch_value2; /* 0x0004 seen */ + + union + { + GROUP_INFO4 info4; + + } group; + +} SAMR_Q_SET_GROUPINFO; + +/* SAMR_R_SET_GROUPINFO - SAM Group Info */ +typedef struct r_samr_set_group_info +{ + uint32 status; + +} SAMR_R_SET_GROUPINFO; + + +/* SAMR_Q_ADD_GROUPMEM - probably an add group member */ +typedef struct q_samr_add_group_mem_info +{ + POLICY_HND pol; /* policy handle */ + + uint32 rid; /* rid */ + uint32 unknown; /* 0x0000 0005 */ + +} SAMR_Q_ADD_GROUPMEM; + + +/* SAMR_R_ADD_GROUPMEM - probably an add group member */ +typedef struct r_samr_add_group_mem_info +{ + uint32 status; /* return status */ + +} SAMR_R_ADD_GROUPMEM; + + +/* SAMR_Q_OPEN_GROUP - probably an open */ +typedef struct q_samr_open_group_info +{ + POLICY_HND domain_pol; + uint32 unknown; /* 0x0000 0001, 0x0000 0003, 0x0000 001f */ + uint32 rid_group; /* rid */ + +} SAMR_Q_OPEN_GROUP; + + +/* SAMR_R_OPEN_GROUP - probably an open */ +typedef struct r_samr_open_group_info +{ + POLICY_HND pol; /* policy handle */ + uint32 status; /* return status */ + +} SAMR_R_OPEN_GROUP; +#endif + + + /******************************************************************* makes a SAMR_Q_ENUM_DOM_GROUPS structure. ********************************************************************/ @@ -1374,7 +1390,7 @@ void make_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol, { if (q_e == NULL || pol == NULL) return; - DEBUG(5,("make_q_enum_dom_groups\n")); + DEBUG(5,("make_samr_q_enum_dom_groups\n")); memcpy(&(q_e->pol), pol, sizeof(*pol)); @@ -1522,376 +1538,986 @@ void samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_str prs_uint32("status", ps, depth, &(r_u->status)); } - /******************************************************************* -makes a SAMR_Q_QUERY_ALIASINFO structure. +makes a SAMR_Q_QUERY_USERGROUPS structure. ********************************************************************/ -void make_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO *q_e, - POLICY_HND *pol, - uint16 switch_level) +void make_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u, + POLICY_HND *hnd) { - if (q_e == NULL || pol == NULL) return; - - DEBUG(5,("make_q_query_aliasinfo\n")); + if (q_u == NULL || hnd == NULL) return; - memcpy(&(q_e->pol), pol, sizeof(*pol)); + DEBUG(5,("make_samr_q_query_usergroups\n")); - q_e->switch_level = switch_level; + memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_query_aliasinfo(char *desc, SAMR_Q_QUERY_ALIASINFO *q_e, prs_struct *ps, int depth) +void samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS *q_u, prs_struct *ps, int depth) { - if (q_e == NULL) return; + if (q_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_q_query_aliasinfo"); + prs_debug(ps, depth, desc, "samr_io_q_query_usergroups"); depth++; prs_align(ps); - smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); prs_align(ps); - - prs_uint16("switch_level", ps, depth, &(q_e->switch_level)); } - /******************************************************************* -makes a SAMR_R_QUERY_ALIASINFO structure. +makes a SAMR_R_QUERY_USERGROUPS structure. ********************************************************************/ -void make_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *r_u, - uint16 switch_value, char *acct_desc, - uint32 status) +void make_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u, + uint32 num_gids, DOM_GID *gid, uint32 status) { if (r_u == NULL) return; - DEBUG(5,("make_samr_r_query_aliasinfo\n")); - - r_u->ptr = 0; + DEBUG(5,("make_samr_r_query_usergroups\n")); - if (status == 0) + if (status == 0x0) { - r_u->switch_value = switch_value; + 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; - switch (switch_value) - { - case 3: + r_u->gid = gid; + } + else { - int acct_len = acct_desc ? strlen(acct_desc) : 0; - - r_u->ptr = 1; - - make_uni_hdr(&(r_u->alias.info3.hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0); - make_unistr2(&(r_u->alias.info3.uni_acct_desc), acct_desc, acct_len); + r_u->ptr_0 = 0; + r_u->num_entries = 0; + r_u->ptr_1 = 0; + } - break; + r_u->status = status; } - default: - { - DEBUG(4,("make_samr_r_query_aliasinfo: unsupported switch level\n")); - break; +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_struct *ps, int depth) + { + int i; + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_query_usergroups"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0 )); + + if (r_u->ptr_0 != 0) + { + prs_uint32("num_entries ", ps, depth, &(r_u->num_entries)); + prs_uint32("ptr_1 ", ps, depth, &(r_u->ptr_1 )); + + if (r_u->num_entries != 0) + { + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + + for (i = 0; i < r_u->num_entries2; i++) + { + prs_grow(ps); + smb_io_gid("", &(r_u->gid[i]), ps, depth); + } } } + prs_uint32("status", ps, depth, &(r_u->status)); } - r_u->status = status; + +/******************************************************************* +makes a SAMR_Q_ENUM_DOM_ALIASES structure. +********************************************************************/ +void make_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_e, POLICY_HND *pol, uint32 size) +{ + if (q_e == NULL || pol == NULL) return; + + DEBUG(5,("make_samr_q_enum_dom_aliases\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + q_e->unknown_0 = 0; + q_e->max_size = size; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO *r_u, prs_struct *ps, int depth) +void samr_io_q_enum_dom_aliases(char *desc, SAMR_Q_ENUM_DOM_ALIASES *q_e, prs_struct *ps, int depth) +{ + if (q_e == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_enum_dom_aliases"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + prs_align(ps); + + prs_uint32("unknown_0", ps, depth, &(q_e->unknown_0)); + prs_uint32("max_size ", ps, depth, &(q_e->max_size )); + + prs_align(ps); +} + + +/******************************************************************* +makes a SAMR_R_ENUM_DOM_ALIASES structure. +********************************************************************/ +void make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, + uint32 num_sam_entries, LOCAL_GRP *alss, + uint32 status) { + int i; + if (r_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo"); + DEBUG(5,("make_samr_r_enum_dom_aliases\n")); + + if (num_sam_entries >= MAX_SAM_ENTRIES) + { + num_sam_entries = MAX_SAM_ENTRIES; + DEBUG(5,("limiting number of entries to %d\n", + num_sam_entries)); + } + + r_u->num_entries = num_sam_entries; + + if (num_sam_entries > 0) + { + r_u->ptr_entries = 1; + r_u->num_entries2 = num_sam_entries; + r_u->ptr_entries2 = 1; + r_u->num_entries3 = num_sam_entries; + + SMB_ASSERT_ARRAY(r_u->sam, num_sam_entries); + + for (i = 0; i < num_sam_entries; i++) + { + int acct_name_len = strlen(alss[i].name); + + make_sam_entry(&(r_u->sam[i]), + acct_name_len, + alss[i].rid); + + make_unistr2(&(r_u->uni_grp_name[i]), alss[i].name , acct_name_len); + } + + r_u->num_entries4 = num_sam_entries; + } + else + { + r_u->ptr_entries = 0; + } + + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_struct *ps, int depth) +{ + int i; + + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_enum_dom_aliases"); depth++; prs_align(ps); - prs_uint32("ptr ", ps, depth, &(r_u->ptr )); + prs_uint32("num_entries", ps, depth, &(r_u->num_entries)); + prs_uint32("ptr_entries", ps, depth, &(r_u->ptr_entries)); - if (r_u->ptr != 0) + if (r_u->num_entries != 0 && r_u->ptr_entries != 0) { - prs_uint16("switch_value", ps, depth, &(r_u->switch_value)); + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); + prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); + + SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries); + + for (i = 0; i < r_u->num_entries; i++) + { + sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); + } + + for (i = 0; i < r_u->num_entries; i++) + { + smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); + } + prs_align(ps); - if (r_u->switch_value != 0) + prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); + } + + prs_uint32("status", ps, depth, &(r_u->status)); +} + + +/******************************************************************* +makes a ALIAS_INFO3 structure. +********************************************************************/ +void make_samr_alias_info3(ALIAS_INFO3 *al3, char *acct_desc) { - switch (r_u->switch_value) + int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; + if (al3 == NULL) return; + + DEBUG(5,("make_samr_alias_info3\n")); + + make_uni_hdr(&(al3->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0); + make_unistr2(&(al3->uni_acct_desc), acct_desc, acct_len); +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_alias_info3(char *desc, ALIAS_INFO3 *al3, prs_struct *ps, int depth) +{ + if (al3 == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_alias_info3"); + depth++; + + prs_align(ps); + + smb_io_unihdr ("hdr_acct_desc", &(al3->hdr_acct_desc) , ps, depth); + smb_io_unistr2("uni_acct_desc", &(al3->uni_acct_desc), al3->hdr_acct_desc.buffer, ps, depth); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_alias_info_ctr(char *desc, ALIAS_INFO_CTR *ctr, prs_struct *ps, int depth) +{ + if (ctr == NULL) return; + + prs_debug(ps, depth, desc, "samr_alias_info_ctr"); + depth++; + + prs_uint16("switch_value", ps, depth, &(ctr->switch_value)); + prs_align(ps); + + if (ctr->switch_value != 0) + { + switch (ctr->switch_value) { case 3: { - smb_io_unihdr ("", &(r_u->alias.info3.hdr_acct_desc), ps, depth); - smb_io_unistr2("", &(r_u->alias.info3.uni_acct_desc), r_u->alias.info3.hdr_acct_desc.buffer, ps, depth); + samr_io_alias_info3("alias_info3", &(ctr->alias.info3), ps, depth); break; } default: { - DEBUG(4,("samr_io_r_query_aliasinfo: unsupported switch level\n")); + DEBUG(4,("samr_alias_info_ctr: unsupported switch level\n")); break; } } } + + prs_align(ps); +} + + +/******************************************************************* +makes a SAMR_Q_QUERY_ALIASINFO structure. +********************************************************************/ +void make_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO *q_e, + POLICY_HND *pol, + uint16 switch_level) +{ + if (q_e == NULL || pol == NULL) return; + + DEBUG(5,("make_samr_q_query_aliasinfo\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + q_e->switch_level = switch_level; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_query_aliasinfo(char *desc, SAMR_Q_QUERY_ALIASINFO *q_e, prs_struct *ps, int depth) +{ + if (q_e == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_query_aliasinfo"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + prs_align(ps); + + prs_uint16("switch_level", ps, depth, &(q_e->switch_level)); +} + + +/******************************************************************* +makes a SAMR_R_QUERY_ALIASINFO structure. +********************************************************************/ +void make_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *r_u, ALIAS_INFO_CTR *ctr, + uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_query_aliasinfo\n")); + + r_u->ptr = (status == 0x0 && ctr != NULL) ? 1 : 0; + r_u->ctr = ctr; + r_u->status = status; } + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo"); + depth++; + prs_align(ps); - prs_uint32("status", ps, depth, &(r_u->status)); + prs_uint32("ptr", ps, depth, &(r_u->ptr)); + + if (r_u->ptr != 0) + { + samr_alias_info_ctr("ctr", r_u->ctr, ps, depth); + } + + prs_uint32("status", ps, depth, &(r_u->status)); +} + + +/******************************************************************* +makes a SAMR_Q_SET_ALIASINFO structure. +********************************************************************/ +void make_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO *q_u, POLICY_HND *hnd, + ALIAS_INFO_CTR *ctr) +{ + if (q_u == NULL) return; + + DEBUG(5,("make_samr_q_set_aliasinfo\n")); + + memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol)); + q_u->ctr = ctr; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_set_aliasinfo(char *desc, SAMR_Q_SET_ALIASINFO *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_set_aliasinfo"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); + samr_alias_info_ctr("ctr", q_u->ctr, ps, depth); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_set_aliasinfo(char *desc, SAMR_R_SET_ALIASINFO *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_set_aliasinfo"); + depth++; + + prs_align(ps); + prs_uint32("status", ps, depth, &(r_u->status)); +} + + + +/******************************************************************* +makes a SAMR_Q_QUERY_USERALIASES structure. +********************************************************************/ +void make_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u, + POLICY_HND *hnd, + DOM_SID *sid) +{ + if (q_u == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_query_useraliases\n")); + + memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); + + q_u->num_sids1 = 1; + q_u->ptr = 0; + q_u->num_sids2 = 1; + + { + q_u->ptr_sid[0] = 1; + make_dom_sid2(&q_u->sid[0], sid); + } +} + +/******************************************************************* +reads or writes a SAMR_Q_QUERY_USERALIASES structure. +********************************************************************/ +void samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES *q_u, prs_struct *ps, int depth) +{ + fstring tmp; + int i; + + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_query_useraliases"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); + prs_align(ps); + + prs_uint32("num_sids1", ps, depth, &(q_u->num_sids1)); + prs_uint32("ptr ", ps, depth, &(q_u->ptr )); + prs_uint32("num_sids2", ps, depth, &(q_u->num_sids2)); + + SMB_ASSERT_ARRAY(q_u->ptr_sid, q_u->num_sids2); + + for (i = 0; i < q_u->num_sids2; i++) + { + slprintf(tmp, sizeof(tmp) - 1, "ptr[%02d]", i); + prs_uint32(tmp, ps, depth, &(q_u->ptr_sid[i])); + } + + for (i = 0; i < q_u->num_sids2; i++) + { + if (q_u->ptr_sid[i] != 0) + { + prs_grow(ps); + slprintf(tmp, sizeof(tmp)-1, "sid[%02d]", i); + smb_io_dom_sid2(tmp, &(q_u->sid[i]), ps, depth); + } + } + + prs_align(ps); +} + + +/******************************************************************* +makes a SAMR_R_QUERY_USERALIASES structure. +********************************************************************/ +void make_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u, + uint32 num_rids, uint32 *rid, uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_query_useraliases\n")); + + if (status == 0x0) + { + 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. +********************************************************************/ +void samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs_struct *ps, int depth) +{ + fstring tmp; + int i; + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_query_useraliases"); + depth++; + + prs_align(ps); + + prs_uint32("num_entries", ps, depth, &(r_u->num_entries)); + prs_uint32("ptr ", ps, depth, &(r_u->ptr )); + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + + if (r_u->num_entries != 0) + { + for (i = 0; i < r_u->num_entries2; i++) + { + slprintf(tmp, sizeof(tmp)-1, "rid[%02d]", i); + prs_uint32(tmp, ps, depth, &(r_u->rid[i])); + } + } + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +makes a SAMR_Q_OPEN_ALIAS structure. +********************************************************************/ +void make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, + uint32 unknown_0, uint32 rid) +{ + if (q_u == NULL) return; + + DEBUG(5,("make_samr_q_open_alias\n")); + + /* example values: 0x0000 0008 */ + q_u->unknown_0 = unknown_0; + + q_u->rid_alias = rid; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_open_alias"); + depth++; + + prs_align(ps); + + prs_uint32("unknown_0", ps, depth, &(q_u->unknown_0)); + prs_uint32("rid_alias", ps, depth, &(q_u->rid_alias)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_open_alias"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(r_u->pol), ps, depth); + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +makes a SAMR_Q_UNKNOWN_12 structure. +********************************************************************/ +void make_samr_q_unknown_12(SAMR_Q_UNKNOWN_12 *q_u, + POLICY_HND *pol, uint32 rid, + uint32 num_gids, uint32 *gid) +{ + int i; + if (q_u == NULL) return; + + DEBUG(5,("make_samr_r_unknwon_12\n")); + + memcpy(&(q_u->pol), pol, sizeof(*pol)); + + q_u->num_gids1 = num_gids; + q_u->rid = rid; + q_u->ptr = 0; + q_u->num_gids2 = num_gids; + + for (i = 0; i < num_gids; i++) + { + q_u->gid[i] = gid[i]; + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, int depth) +{ + int i; + fstring tmp; + + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_unknown_12"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); + prs_align(ps); + + prs_uint32("num_gids1", ps, depth, &(q_u->num_gids1)); + prs_uint32("rid ", ps, depth, &(q_u->rid )); + prs_uint32("ptr ", ps, depth, &(q_u->ptr )); + prs_uint32("num_gids2", ps, depth, &(q_u->num_gids2)); + + SMB_ASSERT_ARRAY(q_u->gid, q_u->num_gids2); + + for (i = 0; i < q_u->num_gids2; i++) + { + prs_grow(ps); + slprintf(tmp, sizeof(tmp) - 1, "gid[%02d] ", i); + prs_uint32(tmp, ps, depth, &(q_u->gid[i])); + } + + prs_align(ps); +} + + +/******************************************************************* +makes a SAMR_R_UNKNOWN_12 structure. +********************************************************************/ +void make_samr_r_unknown_12(SAMR_R_UNKNOWN_12 *r_u, + uint32 num_aliases, fstring *als_name, uint8 *num_als_usrs, + uint32 status) +{ + int i; + if (r_u == NULL || als_name == NULL || num_als_usrs == NULL) return; + + DEBUG(5,("make_samr_r_unknown_12\n")); + + if (status == 0x0) + { + r_u->num_aliases1 = num_aliases; + r_u->ptr_aliases = 1; + r_u->num_aliases2 = num_aliases; + + r_u->num_als_usrs1 = num_aliases; + r_u->ptr_als_usrs = 1; + r_u->num_als_usrs2 = num_aliases; + + SMB_ASSERT_ARRAY(r_u->hdr_als_name, num_aliases); + + for (i = 0; i < num_aliases; i++) + { + int als_len = als_name[i] != NULL ? strlen(als_name[i]) : 0; + make_uni_hdr(&(r_u->hdr_als_name[i]), als_len , als_len, als_name[i] ? 1 : 0); + make_unistr2(&(r_u->uni_als_name[i]), als_name[i], als_len); + r_u->num_als_usrs[i] = num_als_usrs[i]; + } + } + else + { + r_u->num_aliases1 = num_aliases; + r_u->ptr_aliases = 0; + r_u->num_aliases2 = num_aliases; + + r_u->num_als_usrs1 = num_aliases; + r_u->ptr_als_usrs = 0; + r_u->num_als_usrs2 = num_aliases; + } + + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, int depth) +{ + int i; + fstring tmp; + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_unknown_12"); + depth++; + + prs_align(ps); + + prs_uint32("num_aliases1", ps, depth, &(r_u->num_aliases1)); + prs_uint32("ptr_aliases ", ps, depth, &(r_u->ptr_aliases )); + prs_uint32("num_aliases2", ps, depth, &(r_u->num_aliases2)); + + if (r_u->ptr_aliases != 0 && r_u->num_aliases1 != 0) + { + SMB_ASSERT_ARRAY(r_u->hdr_als_name, r_u->num_aliases2); + + for (i = 0; i < r_u->num_aliases2; i++) + { + prs_grow(ps); + slprintf(tmp, sizeof(tmp) - 1, "als_hdr[%02d] ", i); + smb_io_unihdr ("", &(r_u->hdr_als_name[i]), ps, depth); + } + for (i = 0; i < r_u->num_aliases2; i++) + { + prs_grow(ps); + slprintf(tmp, sizeof(tmp) - 1, "als_str[%02d] ", i); + smb_io_unistr2("", &(r_u->uni_als_name[i]), r_u->hdr_als_name[i].buffer, ps, depth); + } + } + + prs_align(ps); + + prs_uint32("num_als_usrs1", ps, depth, &(r_u->num_als_usrs1)); + prs_uint32("ptr_als_usrs ", ps, depth, &(r_u->ptr_als_usrs )); + prs_uint32("num_als_usrs2", ps, depth, &(r_u->num_als_usrs2)); + + if (r_u->ptr_als_usrs != 0 && r_u->num_als_usrs1 != 0) + { + SMB_ASSERT_ARRAY(r_u->num_als_usrs, r_u->num_als_usrs2); + + for (i = 0; i < r_u->num_als_usrs2; i++) + { + prs_grow(ps); + slprintf(tmp, sizeof(tmp) - 1, "als_usrs[%02d] ", i); + prs_uint32(tmp, ps, depth, &(r_u->num_als_usrs[i])); + } + } + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +makes a SAMR_Q_OPEN_ALIAS structure. +********************************************************************/ +void make_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS *q_u, POLICY_HND *hnd) +{ + if (q_u == NULL) return; + + DEBUG(5,("make_samr_q_delete_alias\n")); + + memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol)); } /******************************************************************* -makes a SAMR_Q_QUERY_USERALIASES structure. +reads or writes a structure. ********************************************************************/ -void make_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u, - POLICY_HND *hnd, - DOM_SID *sid) +void samr_io_q_delete_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS *q_u, prs_struct *ps, int depth) { - if (q_u == NULL || hnd == NULL) return; - - DEBUG(5,("make_samr_q_query_useraliases\n")); + if (q_u == NULL) return; - memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); + prs_debug(ps, depth, desc, "samr_io_q_delete_alias"); + depth++; - q_u->num_sids1 = 1; - q_u->ptr = 0; - q_u->num_sids2 = 1; + prs_align(ps); - { - q_u->ptr_sid[0] = 1; - make_dom_sid2(&q_u->sid[0], sid); - } + smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); } /******************************************************************* -reads or writes a SAMR_Q_QUERY_USERALIASES structure. +reads or writes a structure. ********************************************************************/ -void samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES *q_u, prs_struct *ps, int depth) +void samr_io_r_delete_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS *r_u, prs_struct *ps, int depth) { - fstring tmp; - int i; - - if (q_u == NULL) return; + if (r_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_q_query_useraliases"); + prs_debug(ps, depth, desc, "samr_io_r_delete_alias"); depth++; prs_align(ps); - smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); - prs_align(ps); - - prs_uint32("num_sids1", ps, depth, &(q_u->num_sids1)); - prs_uint32("ptr ", ps, depth, &(q_u->ptr )); - prs_uint32("num_sids2", ps, depth, &(q_u->num_sids2)); + smb_io_pol_hnd("pol", &(r_u->pol), ps, depth); + prs_uint32("status", ps, depth, &(r_u->status)); +} - SMB_ASSERT_ARRAY(q_u->ptr_sid, q_u->num_sids2); - for (i = 0; i < q_u->num_sids2; i++) +/******************************************************************* +makes a SAMR_Q_CREATE_DOM_ALIAS structure. +********************************************************************/ +void make_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS *q_u, POLICY_HND *hnd, + char *acct_desc) { - slprintf(tmp, sizeof(tmp) - 1, "ptr[%02d]", i); - prs_uint32(tmp, ps, depth, &(q_u->ptr_sid[i])); - } + int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; + if (q_u == NULL) return; - for (i = 0; i < q_u->num_sids2; i++) - { - if (q_u->ptr_sid[i] != 0) - { - prs_grow(ps); - slprintf(tmp, sizeof(tmp)-1, "sid[%02d]", i); - smb_io_dom_sid2(tmp, &(q_u->sid[i]), ps, depth); - } - } + DEBUG(5,("make_samr_q_create_dom_alias\n")); - prs_align(ps); + memcpy(&(q_u->dom_pol), hnd, sizeof(q_u->dom_pol)); + + make_uni_hdr(&(q_u->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0); + make_unistr2(&(q_u->uni_acct_desc), acct_desc, acct_len); + + q_u->unknown_1 = 0x001f; + q_u->unknown_2 = 0x000f; } /******************************************************************* -makes a SAMR_R_QUERY_USERALIASES structure. +reads or writes a structure. ********************************************************************/ -void make_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u, - uint32 num_rids, uint32 *rid, uint32 status) +void samr_io_q_create_dom_alias(char *desc, SAMR_Q_CREATE_DOM_ALIAS *q_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (q_u == NULL) return; - DEBUG(5,("make_samr_r_query_useraliases\n")); + prs_debug(ps, depth, desc, "samr_io_q_create_dom_alias"); + depth++; - if (status == 0x0) - { - r_u->num_entries = num_rids; - r_u->ptr = 1; - r_u->num_entries2 = num_rids; + prs_align(ps); - r_u->rid = rid; - } - else - { - r_u->num_entries = 0; - r_u->ptr = 0; - r_u->num_entries2 = 0; - } + smb_io_pol_hnd("dom_pol", &(q_u->dom_pol), ps, depth); - r_u->status = status; + smb_io_unihdr ("hdr_acct_desc", &(q_u->hdr_acct_desc) , ps, depth); + smb_io_unistr2("uni_acct_desc", &(q_u->uni_acct_desc), q_u->hdr_acct_desc.buffer, ps, depth); + + prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1)); + prs_uint16("unknown_2", ps, depth, &(q_u->unknown_2)); } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs_struct *ps, int depth) +void samr_io_r_create_dom_alias(char *desc, SAMR_R_CREATE_DOM_ALIAS *r_u, prs_struct *ps, int depth) { - fstring tmp; - int i; if (r_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_r_query_useraliases"); + prs_debug(ps, depth, desc, "samr_io_r_create_dom_alias"); depth++; prs_align(ps); - prs_uint32("num_entries", ps, depth, &(r_u->num_entries)); - prs_uint32("ptr ", ps, depth, &(r_u->ptr )); - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + smb_io_pol_hnd("alias_pol", &(r_u->alias_pol), ps, depth); + prs_uint32("rid", ps, depth, &(r_u->rid)); - if (r_u->num_entries != 0) - { - for (i = 0; i < r_u->num_entries2; i++) - { - slprintf(tmp, sizeof(tmp)-1, "rid[%02d]", i); - prs_uint32(tmp, ps, depth, &(r_u->rid[i])); - } + prs_uint32("status", ps, depth, &(r_u->status)); } - prs_uint32("status", ps, depth, &(r_u->status)); + + +/******************************************************************* +makes a SAMR_Q_UNK_ALIASMEM structure. +********************************************************************/ +void make_samr_q_unk_aliasmem(SAMR_Q_UNK_ALIASMEM *q_u, POLICY_HND *hnd, + DOM_SID *sid) +{ + if (q_u == NULL) return; + + DEBUG(5,("make_samr_q_unk_aliasmem\n")); + + memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol)); + sid_copy(&q_u->sid, sid); } + /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *ps, int depth) +void samr_io_q_unk_aliasmem(char *desc, SAMR_Q_UNK_ALIASMEM *q_u, prs_struct *ps, int depth) { - int i; - if (q_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_q_lookup_names"); + prs_debug(ps, depth, desc, "samr_io_q_unk_aliasmem"); depth++; prs_align(ps); - smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); - prs_align(ps); - - prs_uint32("num_rids1", ps, depth, &(q_u->num_rids1)); - prs_uint32("rid ", ps, depth, &(q_u->rid )); - prs_uint32("ptr ", ps, depth, &(q_u->ptr )); - prs_uint32("num_rids2", ps, depth, &(q_u->num_rids2)); - - SMB_ASSERT_ARRAY(q_u->hdr_user_name, q_u->num_rids2); - - for (i = 0; i < q_u->num_rids2; i++) - { - prs_grow(ps); - smb_io_unihdr ("", &(q_u->hdr_user_name[i]), ps, depth); + smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); + smb_io_dom_sid("sid ", &(q_u->sid ), ps, depth); } - for (i = 0; i < q_u->num_rids2; i++) + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_unk_aliasmem(char *desc, SAMR_R_UNK_ALIASMEM *r_u, prs_struct *ps, int depth) { - prs_grow(ps); - smb_io_unistr2("", &(q_u->uni_user_name[i]), q_u->hdr_user_name[i].buffer, ps, depth); - } + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_unk_aliasmem"); + depth++; prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); } /******************************************************************* -makes a SAMR_R_LOOKUP_NAMES structure. +makes a SAMR_Q_ADD_ALIASMEM structure. ********************************************************************/ -void make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, - uint32 num_rids, uint32 *rid, uint8 *type, uint32 status) +void make_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, POLICY_HND *hnd, + DOM_SID *sid) { - int i; - if (r_u == NULL) return; + if (q_u == NULL) return; - DEBUG(5,("make_samr_r_lookup_names\n")); + DEBUG(5,("make_samr_q_add_aliasmem\n")); - if (status == 0x0) - { - r_u->num_entries = num_rids; - r_u->undoc_buffer = 1; - r_u->num_entries2 = num_rids; + memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol)); + sid_copy(&q_u->sid, sid); +} - SMB_ASSERT_ARRAY(r_u->dom_rid, num_rids); - for (i = 0; i < num_rids; i++) +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM *q_u, prs_struct *ps, int depth) { - make_dom_rid3(&(r_u->dom_rid[i]), rid[i], type[i]); - } + if (q_u == NULL) return; - r_u->num_entries3 = num_rids; - } - else - { - r_u->num_entries = 0; - r_u->undoc_buffer = 0; - r_u->num_entries2 = 0; - r_u->num_entries3 = 0; - } + prs_debug(ps, depth, desc, "samr_io_q_add_aliasmem"); + depth++; - r_u->status = status; + prs_align(ps); + + smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); + smb_io_dom_sid("sid ", &(q_u->sid ), ps, depth); } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *ps, int depth) +void samr_io_r_add_aliasmem(char *desc, SAMR_R_ADD_ALIASMEM *r_u, prs_struct *ps, int depth) { - int i; if (r_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_r_lookup_names"); + prs_debug(ps, depth, desc, "samr_io_r_add_aliasmem"); depth++; prs_align(ps); - prs_uint32("num_entries ", ps, depth, &(r_u->num_entries )); - prs_uint32("undoc_buffer", ps, depth, &(r_u->undoc_buffer)); - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + prs_uint32("status", ps, depth, &(r_u->status)); +} - if (r_u->num_entries != 0) +/******************************************************************* +makes a SAMR_Q_UNKNOWN_21 structure. +********************************************************************/ +void make_samr_q_unknown_21(SAMR_Q_UNKNOWN_21 *q_c, + POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) { - SMB_ASSERT_ARRAY(r_u->dom_rid, r_u->num_entries2); + if (q_c == NULL || hnd == NULL) return; - for (i = 0; i < r_u->num_entries2; i++) - { - prs_grow(ps); - smb_io_dom_rid3("", &(r_u->dom_rid[i]), ps, depth); - } + DEBUG(5,("make_samr_q_unknown_21\n")); + memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol)); + q_c->unknown_1 = unk_1; + q_c->unknown_2 = unk_2; } - prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); - - prs_uint32("status", ps, depth, &(r_u->status)); -} /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, int depth) +void samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *ps, int depth) { int i; - fstring tmp; if (q_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_q_unknown_12"); + prs_debug(ps, depth, desc, "samr_io_q_lookup_names"); depth++; prs_align(ps); @@ -1899,18 +2525,22 @@ void samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, i smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); prs_align(ps); - prs_uint32("num_gids1", ps, depth, &(q_u->num_gids1)); + prs_uint32("num_rids1", ps, depth, &(q_u->num_rids1)); prs_uint32("rid ", ps, depth, &(q_u->rid )); prs_uint32("ptr ", ps, depth, &(q_u->ptr )); - prs_uint32("num_gids2", ps, depth, &(q_u->num_gids2)); + prs_uint32("num_rids2", ps, depth, &(q_u->num_rids2)); - SMB_ASSERT_ARRAY(q_u->gid, q_u->num_gids2); + SMB_ASSERT_ARRAY(q_u->hdr_user_name, q_u->num_rids2); - for (i = 0; i < q_u->num_gids2; i++) + for (i = 0; i < q_u->num_rids2; i++) { prs_grow(ps); - slprintf(tmp, sizeof(tmp) - 1, "gid[%02d] ", i); - prs_uint32(tmp, ps, depth, &(q_u->gid[i])); + smb_io_unihdr ("", &(q_u->hdr_user_name[i]), ps, depth); + } + for (i = 0; i < q_u->num_rids2; i++) + { + prs_grow(ps); + smb_io_unistr2("", &(q_u->uni_user_name[i]), q_u->hdr_user_name[i].buffer, ps, depth); } prs_align(ps); @@ -1918,46 +2548,37 @@ void samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, i /******************************************************************* -makes a SAMR_R_UNKNOWN_12 structure. +makes a SAMR_R_LOOKUP_NAMES structure. ********************************************************************/ -void make_samr_r_unknown_12(SAMR_R_UNKNOWN_12 *r_u, - uint32 num_aliases, fstring *als_name, uint8 *num_als_usrs, - uint32 status) +void make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, + uint32 num_rids, uint32 *rid, uint8 *type, uint32 status) { int i; - if (r_u == NULL || als_name == NULL || num_als_usrs == NULL) return; + if (r_u == NULL) return; - DEBUG(5,("make_samr_r_unknown_12\n")); + DEBUG(5,("make_samr_r_lookup_names\n")); if (status == 0x0) { - r_u->num_aliases1 = num_aliases; - r_u->ptr_aliases = 1; - r_u->num_aliases2 = num_aliases; - - r_u->num_als_usrs1 = num_aliases; - r_u->ptr_als_usrs = 1; - r_u->num_als_usrs2 = num_aliases; + r_u->num_entries = num_rids; + r_u->undoc_buffer = 1; + r_u->num_entries2 = num_rids; - SMB_ASSERT_ARRAY(r_u->hdr_als_name, num_aliases); + SMB_ASSERT_ARRAY(r_u->dom_rid, num_rids); - for (i = 0; i < num_aliases; i++) - { - int als_len = als_name[i] != NULL ? strlen(als_name[i]) : 0; - make_uni_hdr(&(r_u->hdr_als_name[i]), als_len , als_len, als_name[i] ? 1 : 0); - make_unistr2(&(r_u->uni_als_name[i]), als_name[i], als_len); - r_u->num_als_usrs[i] = num_als_usrs[i]; + for (i = 0; i < num_rids; i++) + { + make_dom_rid3(&(r_u->dom_rid[i]), rid[i], type[i]); } + + r_u->num_entries3 = num_rids; } else { - r_u->num_aliases1 = num_aliases; - r_u->ptr_aliases = 0; - r_u->num_aliases2 = num_aliases; - - r_u->num_als_usrs1 = num_aliases; - r_u->ptr_als_usrs = 0; - r_u->num_als_usrs2 = num_aliases; + r_u->num_entries = 0; + r_u->undoc_buffer = 0; + r_u->num_entries2 = 0; + r_u->num_entries3 = 0; } r_u->status = status; @@ -1966,57 +2587,34 @@ void make_samr_r_unknown_12(SAMR_R_UNKNOWN_12 *r_u, /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, int depth) +void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *ps, int depth) { int i; - fstring tmp; if (r_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_r_unknown_12"); + prs_debug(ps, depth, desc, "samr_io_r_lookup_names"); depth++; prs_align(ps); - prs_uint32("num_aliases1", ps, depth, &(r_u->num_aliases1)); - prs_uint32("ptr_aliases ", ps, depth, &(r_u->ptr_aliases )); - prs_uint32("num_aliases2", ps, depth, &(r_u->num_aliases2)); + prs_uint32("num_entries ", ps, depth, &(r_u->num_entries )); + prs_uint32("undoc_buffer", ps, depth, &(r_u->undoc_buffer)); + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); - if (r_u->ptr_aliases != 0 && r_u->num_aliases1 != 0) + if (r_u->num_entries != 0) { - SMB_ASSERT_ARRAY(r_u->hdr_als_name, r_u->num_aliases2); + SMB_ASSERT_ARRAY(r_u->dom_rid, r_u->num_entries2); - for (i = 0; i < r_u->num_aliases2; i++) - { - prs_grow(ps); - slprintf(tmp, sizeof(tmp) - 1, "als_hdr[%02d] ", i); - smb_io_unihdr ("", &(r_u->hdr_als_name[i]), ps, depth); - } - for (i = 0; i < r_u->num_aliases2; i++) + for (i = 0; i < r_u->num_entries2; i++) { prs_grow(ps); - slprintf(tmp, sizeof(tmp) - 1, "als_str[%02d] ", i); - smb_io_unistr2("", &(r_u->uni_als_name[i]), r_u->hdr_als_name[i].buffer, ps, depth); - } + smb_io_dom_rid3("", &(r_u->dom_rid[i]), ps, depth); } - prs_align(ps); - - prs_uint32("num_als_usrs1", ps, depth, &(r_u->num_als_usrs1)); - prs_uint32("ptr_als_usrs ", ps, depth, &(r_u->ptr_als_usrs )); - prs_uint32("num_als_usrs2", ps, depth, &(r_u->num_als_usrs2)); - - if (r_u->ptr_als_usrs != 0 && r_u->num_als_usrs1 != 0) - { - SMB_ASSERT_ARRAY(r_u->num_als_usrs, r_u->num_als_usrs2); - - for (i = 0; i < r_u->num_als_usrs2; i++) - { - prs_grow(ps); - slprintf(tmp, sizeof(tmp) - 1, "als_usrs[%02d] ", i); - prs_uint32(tmp, ps, depth, &(r_u->num_als_usrs[i])); - } } + prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); + prs_uint32("status", ps, depth, &(r_u->status)); } @@ -2030,7 +2628,7 @@ void make_samr_q_open_user(SAMR_Q_OPEN_USER *q_u, { if (q_u == NULL) return; - DEBUG(5,("samr_make_q_open_user\n")); + DEBUG(5,("samr_make_samr_q_open_user\n")); memcpy(&q_u->domain_pol, pol, sizeof(q_u->domain_pol)); @@ -2077,99 +2675,6 @@ void samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER *r_u, prs_struct *ps, int prs_uint32("status", ps, depth, &(r_u->status)); } -/******************************************************************* -makes a SAMR_Q_QUERY_USERGROUPS structure. -********************************************************************/ -void make_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u, - POLICY_HND *hnd) -{ - if (q_u == NULL || hnd == NULL) return; - - DEBUG(5,("make_samr_q_query_usergroups\n")); - - memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return; - - prs_debug(ps, depth, desc, "samr_io_q_query_usergroups"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); - prs_align(ps); -} - -/******************************************************************* -makes a SAMR_R_QUERY_USERGROUPS structure. -********************************************************************/ -void make_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u, - uint32 num_gids, DOM_GID *gid, uint32 status) -{ - if (r_u == NULL) return; - - DEBUG(5,("make_samr_r_query_usergroups\n")); - - if (status == 0x0) - { - 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->status = status; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_struct *ps, int depth) -{ - int i; - if (r_u == NULL) return; - - prs_debug(ps, depth, desc, "samr_io_r_query_usergroups"); - depth++; - - prs_align(ps); - - prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0 )); - - if (r_u->ptr_0 != 0) - { - prs_uint32("num_entries ", ps, depth, &(r_u->num_entries)); - prs_uint32("ptr_1 ", ps, depth, &(r_u->ptr_1 )); - - if (r_u->num_entries != 0) - { - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); - - for (i = 0; i < r_u->num_entries2; i++) - { - prs_grow(ps); - smb_io_gid("", &(r_u->gid[i]), ps, depth); - } - } - } - prs_uint32("status", ps, depth, &(r_u->status)); -} - /******************************************************************* makes a SAMR_Q_QUERY_USERINFO structure. ********************************************************************/ @@ -2575,7 +3080,7 @@ void make_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO *r_u, default: { - DEBUG(4,("make_samr_r_query_aliasinfo: unsupported switch level\n")); + DEBUG(4,("make_samr_r_query_userinfo: unsupported switch level\n")); break; } } @@ -2711,7 +3216,7 @@ void make_samr_q_connect(SAMR_Q_CONNECT *q_u, if (q_u == NULL) return; - DEBUG(5,("make_q_connect\n")); + DEBUG(5,("make_samr_q_connect\n")); /* make PDC server name \\server */ q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0; @@ -2767,7 +3272,7 @@ void make_samr_q_connect_anon(SAMR_Q_CONNECT_ANON *q_u) { if (q_u == NULL) return; - DEBUG(5,("make_q_connect_anon\n")); + DEBUG(5,("make_samr_q_connect_anon\n")); q_u->ptr = 1; q_u->unknown_0 = 0x5c; /* server name (?!!) */ @@ -2812,114 +3317,6 @@ void samr_io_r_connect_anon(char *desc, SAMR_R_CONNECT_ANON *r_u, prs_struct *p prs_uint32("status", ps, depth, &(r_u->status)); } -/******************************************************************* -makes a SAMR_Q_OPEN_ALIAS structure. -********************************************************************/ -void make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, - uint32 unknown_0, uint32 rid) -{ - if (q_u == NULL) return; - - DEBUG(5,("make_q_open_alias\n")); - - /* example values: 0x0000 0008 */ - q_u->unknown_0 = unknown_0; - - q_u->rid_alias = rid; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return; - - prs_debug(ps, depth, desc, "samr_io_q_open_alias"); - depth++; - - prs_align(ps); - - prs_uint32("unknown_0", ps, depth, &(q_u->unknown_0)); - prs_uint32("rid_alias", ps, depth, &(q_u->rid_alias)); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -void samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return; - - prs_debug(ps, depth, desc, "samr_io_r_open_alias"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("pol", &(r_u->pol), ps, depth); - prs_align(ps); - - prs_uint32("status", ps, depth, &(r_u->status)); -} - -/******************************************************************* -makes a SAMR_Q_UNKNOWN_12 structure. -********************************************************************/ -void make_samr_q_unknown_12(SAMR_Q_UNKNOWN_12 *q_u, - POLICY_HND *pol, uint32 rid, - uint32 num_gids, uint32 *gid) -{ - int i; - if (q_u == NULL) return; - - DEBUG(5,("make_samr_r_unknwon_12\n")); - - memcpy(&(q_u->pol), pol, sizeof(*pol)); - - q_u->num_gids1 = num_gids; - q_u->rid = rid; - q_u->ptr = 0; - q_u->num_gids2 = num_gids; - - for (i = 0; i < num_gids; i++) - { - q_u->gid[i] = gid[i]; - } -} - - -/******************************************************************* -makes a SAMR_Q_UNKNOWN_21 structure. -********************************************************************/ -void make_samr_q_unknown_21(SAMR_Q_UNKNOWN_21 *q_c, - POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) -{ - if (q_c == NULL || hnd == NULL) return; - - DEBUG(5,("make_samr_q_unknown_21\n")); - - memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol)); - q_c->unknown_1 = unk_1; - q_c->unknown_2 = unk_2; -} - - -/******************************************************************* -makes a SAMR_Q_UNKNOWN_13 structure. -********************************************************************/ -void make_samr_q_unknown_13(SAMR_Q_UNKNOWN_13 *q_c, - POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) -{ - if (q_c == NULL || hnd == NULL) return; - - DEBUG(5,("make_samr_q_unknown_13\n")); - - memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol)); - q_c->unknown_1 = unk_1; - q_c->unknown_2 = unk_2; -} - - /******************************************************************* makes a SAMR_Q_UNKNOWN_38 structure. ********************************************************************/ @@ -2929,7 +3326,7 @@ void make_samr_q_unknown_38(SAMR_Q_UNKNOWN_38 *q_u, char *srv_name) if (q_u == NULL) return; - DEBUG(5,("make_q_unknown_38\n")); + DEBUG(5,("make_samr_q_unknown_38\n")); q_u->ptr = 1; make_uni_hdr(&(q_u->hdr_srv_name), len_srv_name, len_srv_name, len_srv_name != 0); -- cgit From 04e382fb166a64de193dc3c7b21187d8382eaeea Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 1 Dec 1998 19:10:44 +0000 Subject: rpc_samr.h parse_samr.c srv_samr.c : samr_query_aliasmembers (cool!) util_pwdb.c sids.c nmbd.c server.c smbpasswd.c swat.c : pwdb_initialise(BOOL is_server) now creates / reads DOMAIN_NAME.SID if is_server is True, and does LsaQueryInfoPolicy(levels 3 and 5) to obtain member and pdc sids. (This used to be commit 3e1eb4f26b67e484b05e1dde94fd4e4dae982631) --- source3/rpc_parse/parse_samr.c | 119 +++++++++++++++++++++++++++++++++++------ 1 file changed, 102 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index f6e0fa642f..4fdcf19577 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1588,20 +1588,20 @@ void make_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u, r_u->gid = gid; } else - { + { r_u->ptr_0 = 0; r_u->num_entries = 0; r_u->ptr_1 = 0; } r_u->status = status; - } +} /******************************************************************* reads or writes a structure. ********************************************************************/ void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_struct *ps, int depth) - { +{ int i; if (r_u == NULL) return; @@ -1626,10 +1626,10 @@ void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_s prs_grow(ps); smb_io_gid("", &(r_u->gid[i]), ps, depth); } - } } - prs_uint32("status", ps, depth, &(r_u->status)); } + prs_uint32("status", ps, depth, &(r_u->status)); +} /******************************************************************* @@ -2342,7 +2342,7 @@ makes a SAMR_Q_CREATE_DOM_ALIAS structure. ********************************************************************/ void make_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS *q_u, POLICY_HND *hnd, char *acct_desc) - { +{ int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; if (q_u == NULL) return; @@ -2428,13 +2428,13 @@ void samr_io_q_unk_aliasmem(char *desc, SAMR_Q_UNK_ALIASMEM *q_u, prs_struct *p smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); smb_io_dom_sid("sid ", &(q_u->sid ), ps, depth); - } +} /******************************************************************* reads or writes a structure. ********************************************************************/ void samr_io_r_unk_aliasmem(char *desc, SAMR_R_UNK_ALIASMEM *r_u, prs_struct *ps, int depth) - { +{ if (r_u == NULL) return; prs_debug(ps, depth, desc, "samr_io_r_unk_aliasmem"); @@ -2465,7 +2465,7 @@ void make_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, POLICY_HND *hnd, reads or writes a structure. ********************************************************************/ void samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM *q_u, prs_struct *ps, int depth) - { +{ if (q_u == NULL) return; prs_debug(ps, depth, desc, "samr_io_q_add_aliasmem"); @@ -2493,20 +2493,105 @@ void samr_io_r_add_aliasmem(char *desc, SAMR_R_ADD_ALIASMEM *r_u, prs_struct *p } /******************************************************************* -makes a SAMR_Q_UNKNOWN_21 structure. +makes a SAMR_Q_QUERY_ALIASMEM structure. ********************************************************************/ -void make_samr_q_unknown_21(SAMR_Q_UNKNOWN_21 *q_c, - POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) - { +void make_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_c, POLICY_HND *hnd) +{ if (q_c == NULL || hnd == NULL) return; - DEBUG(5,("make_samr_q_unknown_21\n")); + DEBUG(5,("make_samr_q_query_aliasmem\n")); + + memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_query_aliasmem(char *desc, SAMR_Q_QUERY_ALIASMEM *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_query_aliasmem"); + depth++; + + prs_align(ps); - memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol)); - q_c->unknown_1 = unk_1; - q_c->unknown_2 = unk_2; + smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); +} + +/******************************************************************* +makes a SAMR_R_QUERY_ALIASMEM structure. +********************************************************************/ +void make_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM *r_u, + uint32 num_sids, DOM_SID *sid, uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_query_aliasmem\n")); + + if (status == 0x0) + { + r_u->num_sids = num_sids; + r_u->ptr = (num_sids != 0) ? 1 : 0; + r_u->num_sids = 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. +********************************************************************/ +void samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM *r_u, prs_struct *ps, int depth) +{ + int i; + uint32 ptr_sid[MAX_LOOKUP_SIDS]; + + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_query_aliasmem"); + depth++; + + prs_align(ps); + + prs_uint32("ptr", ps, depth, &(r_u->ptr)); + + if (r_u->ptr != 0) + { + prs_uint32("num_sids ", ps, depth, &(r_u->num_sids)); + + SMB_ASSERT_ARRAY(ptr_sid, r_u->num_sids); + + if (r_u->num_sids != 0) + { + prs_uint32("num_sids1", ps, depth, &(r_u->num_sids1)); + + for (i = 0; i < r_u->num_sids1; i++) + { + prs_grow(ps); + ptr_sid[i] = 1; + prs_uint32("", ps, depth, &(ptr_sid[i])); + } + for (i = 0; i < r_u->num_sids1; i++) + { + prs_grow(ps); + if (ptr_sid[i] != 0) + { + smb_io_dom_sid("", &(r_u->sid[i]), ps, depth); + } + } + } + } + prs_uint32("status", ps, depth, &(r_u->status)); +} + /******************************************************************* reads or writes a structure. -- cgit From 5dd26daad55da89a7a0996caadd1d474f6031001 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 1 Dec 1998 22:18:48 +0000 Subject: query_aliasmem code. it works (hurrah). (This used to be commit f7f2516df46dde1671235f788f7689c93d9395ae) --- source3/rpc_parse/parse_lsa.c | 89 ++++++++++++++++++++---------------------- source3/rpc_parse/parse_samr.c | 19 +++++---- 2 files changed, 54 insertions(+), 54 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 5adff5256d..7fcdeccec8 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -26,8 +26,6 @@ extern int DEBUGLEVEL; -static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth); - /******************************************************************* creates a LSA_TRANS_NAME structure. ********************************************************************/ @@ -562,6 +560,48 @@ static void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, } } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, + prs_struct *ps, int depth) +{ + int i; + + if (trn == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_trans_names"); + depth++; + + prs_align(ps); + + prs_uint32("num_entries ", ps, depth, &(trn->num_entries)); + prs_uint32("ptr_trans_names", ps, depth, &(trn->ptr_trans_names)); + + if (trn->ptr_trans_names != 0) + { + prs_uint32("num_entries2 ", ps, depth, &(trn->num_entries2)); + SMB_ASSERT_ARRAY(trn->name, trn->num_entries); + + for (i = 0; i < trn->num_entries2; i++) + { + fstring t; + slprintf(t, sizeof(t) - 1, "name[%d] ", i); + + lsa_io_trans_name(t, &(trn->name[i]), ps, depth); /* translated name */ + + } + for (i = 0; i < trn->num_entries2; i++) + { + fstring t; + slprintf(t, sizeof(t) - 1, "name[%d] ", i); + + smb_io_unistr2(t, &(trn->uni_name[i]), trn->name[i].hdr_name.buffer, ps, depth); + prs_align(ps); + } + } +} + /******************************************************************* makes a structure. ********************************************************************/ @@ -576,9 +616,8 @@ void make_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd, memcpy(&(q_l->pol), hnd, sizeof(q_l->pol)); make_lsa_sid_enum(&(q_l->sids), num_sids, sids); - q_l->names.num_entries = 0; q_l->names.ptr_trans_names = 0; - q_l->names.num_entries2 = 0; + q_l->names.num_entries = 0; q_l->level.value = level; } @@ -603,48 +642,6 @@ void lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, in prs_uint32("mapped_count", ps, depth, &(q_s->mapped_count)); } -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, - prs_struct *ps, int depth) -{ - int i; - int i2; - - if (trn == NULL) return; - - prs_debug(ps, depth, desc, "lsa_io_trans_names"); - depth++; - - prs_align(ps); - - prs_uint32("num_entries ", ps, depth, &(trn->num_entries)); - prs_uint32("ptr_trans_names", ps, depth, &(trn->ptr_trans_names)); - - if (trn->ptr_trans_names != 0) - { - prs_uint32("num_entries2 ", ps, depth, &(trn->num_entries2)); - - SMB_ASSERT_ARRAY(trn->name, trn->num_entries); - - for (i = 0, i2 = 0; i < trn->num_entries2; i++) - { - fstring t; - slprintf(t, sizeof(t) - 1, "name[%d] ", i); - - lsa_io_trans_name(t, &(trn->name[i]), ps, depth); /* translated name */ - - if (trn->name[i].hdr_name.buffer != 0) - { - smb_io_unistr2(t, &(trn->uni_name[i2]), 1, ps, depth); - prs_align(ps); - i2++; - } - } - } -} - /******************************************************************* reads or writes a structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 4fdcf19577..d8bc97d1d3 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2081,13 +2081,15 @@ void samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs /******************************************************************* makes a SAMR_Q_OPEN_ALIAS structure. ********************************************************************/ -void make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, +void make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, POLICY_HND *pol, uint32 unknown_0, uint32 rid) { if (q_u == NULL) return; DEBUG(5,("make_samr_q_open_alias\n")); + memcpy(&(q_u->dom_pol), pol, sizeof(q_u->dom_pol)); + /* example values: 0x0000 0008 */ q_u->unknown_0 = unknown_0; @@ -2106,6 +2108,8 @@ void samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, i prs_align(ps); + smb_io_pol_hnd("dom_pol", &(q_u->dom_pol), ps, depth); + prs_uint32("unknown_0", ps, depth, &(q_u->unknown_0)); prs_uint32("rid_alias", ps, depth, &(q_u->rid_alias)); } @@ -2523,7 +2527,7 @@ void samr_io_q_query_aliasmem(char *desc, SAMR_Q_QUERY_ALIASMEM *q_u, prs_struc makes a SAMR_R_QUERY_ALIASMEM structure. ********************************************************************/ void make_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM *r_u, - uint32 num_sids, DOM_SID *sid, uint32 status) + uint32 num_sids, DOM_SID2 *sid, uint32 status) { if (r_u == NULL) return; @@ -2531,9 +2535,9 @@ void make_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM *r_u, if (status == 0x0) { - r_u->num_sids = num_sids; - r_u->ptr = (num_sids != 0) ? 1 : 0; - r_u->num_sids = num_sids; + r_u->num_sids = num_sids; + r_u->ptr = (num_sids != 0) ? 1 : 0; + r_u->num_sids1 = num_sids; r_u->sid = sid; } @@ -2561,12 +2565,11 @@ void samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM *r_u, prs_struc prs_align(ps); + prs_uint32("num_sids ", ps, depth, &(r_u->num_sids)); prs_uint32("ptr", ps, depth, &(r_u->ptr)); if (r_u->ptr != 0) { - prs_uint32("num_sids ", ps, depth, &(r_u->num_sids)); - SMB_ASSERT_ARRAY(ptr_sid, r_u->num_sids); if (r_u->num_sids != 0) @@ -2584,7 +2587,7 @@ void samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM *r_u, prs_struc prs_grow(ps); if (ptr_sid[i] != 0) { - smb_io_dom_sid("", &(r_u->sid[i]), ps, depth); + smb_io_dom_sid2("", &(r_u->sid[i]), ps, depth); } } } -- cgit From 51534a4b97f09fc0f98d00e7a2730dddde496dd8 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 2 Dec 1998 01:13:02 +0000 Subject: adding group member code, made a start. found that the group members' rid is needed not the name (see DOMAIN_GRP_MEMBER) decided to go home. (This used to be commit 9337049dfc98becfa74522d418dae64a97c7a304) --- source3/rpc_parse/parse_misc.c | 3 +- source3/rpc_parse/parse_samr.c | 403 ++++++++++++++++++++++++++++++++++------- 2 files changed, 344 insertions(+), 62 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index e9423b3a51..6c42070de4 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -651,6 +651,7 @@ void make_dom_rid3(DOM_RID3 *rid3, uint32 rid, uint8 type) rid3->type1 = type; rid3->ptr_type = 0x1; /* non-zero, basically. */ rid3->type2 = 0x1; + rid3->unk = type; } /******************************************************************* @@ -669,6 +670,7 @@ void smb_io_dom_rid3(char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) prs_uint32("type1 ", ps, depth, &(rid3->type1 )); prs_uint32("ptr_type", ps, depth, &(rid3->ptr_type)); prs_uint32("type2 ", ps, depth, &(rid3->type2 )); + prs_uint32("unk ", ps, depth, &(rid3->unk )); } /******************************************************************* @@ -681,7 +683,6 @@ void make_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid) rid4->rid = rid; } - /******************************************************************* makes a DOM_CLNT_SRV structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index d8bc97d1d3..8e0ecef3d4 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1247,6 +1247,42 @@ void make_samr_q_open_group(SAMR_Q_OPEN_GROUP *q_c, q_c->rid_group = rid; } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_open_group(char *desc, SAMR_Q_OPEN_GROUP *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_open_group"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth); + + prs_uint32("unknown ", ps, depth, &(q_u->unknown )); + prs_uint32("rid_group", ps, depth, &(q_u->rid_group)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_open_group"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(r_u->pol), ps, depth); + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + #if 0 /* SAMR_Q_CREATE_DOM_GROUP - SAM create group */ @@ -1272,52 +1308,6 @@ typedef struct r_samr_create_dom_group_info } SAMR_R_CREATE_DOM_GROUP; -/* SAMR_Q_QUERY_GROUPINFO - SAM Group Info */ -typedef struct q_samr_query_group_info -{ - POLICY_HND pol; /* policy handle */ - - uint16 switch_level; /* 0x0001 seen */ - -} SAMR_Q_QUERY_GROUPINFO; - -typedef struct samr_group_info1 -{ - UNIHDR hdr_acct_name; - UNIHDR hdr_acct_desc; - - uint32 unknown_1; /* 0x0000 0003 - number of group members? */ - uint32 unknown_2; /* 0x0000 0001 - number of group members? */ - - UNISTR2 uni_acct_name; - UNISTR2 uni_acct_desc; - -} GROUP_INFO1; - -typedef struct samr_group_info4 -{ - UNIHDR hdr_acct_desc; - UNISTR2 uni_acct_desc; - -} GROUP_INFO4; - -/* SAMR_R_QUERY_GROUPINFO - SAM Group Info */ -typedef struct r_samr_query_groupinfo_info -{ - uint32 ptr; - uint16 switch_value; /* 0x0001 seen */ - /* uint8[2] padding */ - - union - { - GROUP_INFO1 info1; - - } group; - - uint32 status; - -} SAMR_R_QUERY_GROUPINFO; - /* SAMR_Q_SET_GROUPINFO - SAM Group Info */ typedef struct q_samr_set_group_info @@ -1381,6 +1371,302 @@ typedef struct r_samr_open_group_info #endif +/******************************************************************* +makes a GROUP_INFO1 structure. +********************************************************************/ +void make_samr_group_info1(GROUP_INFO1 *gr1, + char *acct_name, char *acct_desc) +{ + int desc_len = acct_desc != NULL ? strlen(acct_desc) : 0; + int acct_len = acct_name != NULL ? strlen(acct_name) : 0; + if (gr1 == NULL) return; + + DEBUG(5,("make_samr_group_info1\n")); + + make_uni_hdr(&(gr1->hdr_acct_name), acct_len , acct_len, acct_name ? 1 : 0); + make_uni_hdr(&(gr1->hdr_acct_desc), desc_len , desc_len, acct_desc ? 1 : 0); + + gr1->unknown_1 = 0x3; + gr1->unknown_2 = 0x1; + + make_unistr2(&(gr1->uni_acct_name), acct_name, acct_len); + make_unistr2(&(gr1->uni_acct_desc), acct_desc, desc_len); +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_group_info1(char *desc, GROUP_INFO1 *gr1, prs_struct *ps, int depth) +{ + if (gr1 == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_group_info1"); + depth++; + + prs_align(ps); + + smb_io_unihdr ("hdr_acct_desc", &(gr1->hdr_acct_desc) , ps, depth); + smb_io_unihdr ("hdr_acct_desc", &(gr1->hdr_acct_desc) , ps, depth); + + prs_uint32("unknown_1", ps, depth, &(gr1->unknown_1)); + prs_uint32("unknown_2", ps, depth, &(gr1->unknown_2)); + + smb_io_unistr2("uni_acct_desc", &(gr1->uni_acct_desc), gr1->hdr_acct_desc.buffer, ps, depth); + smb_io_unistr2("uni_acct_desc", &(gr1->uni_acct_desc), gr1->hdr_acct_desc.buffer, ps, depth); +} + +/******************************************************************* +makes a GROUP_INFO4 structure. +********************************************************************/ +void make_samr_group_info4(GROUP_INFO4 *gr4, char *acct_desc) +{ + int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; + if (gr4 == NULL) return; + + DEBUG(5,("make_samr_group_info4\n")); + + make_uni_hdr(&(gr4->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0); + make_unistr2(&(gr4->uni_acct_desc), acct_desc, acct_len); +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_group_info4(char *desc, GROUP_INFO4 *gr4, prs_struct *ps, int depth) +{ + if (gr4 == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_group_info4"); + depth++; + + prs_align(ps); + + smb_io_unihdr ("hdr_acct_desc", &(gr4->hdr_acct_desc) , ps, depth); + smb_io_unistr2("uni_acct_desc", &(gr4->uni_acct_desc), gr4->hdr_acct_desc.buffer, ps, depth); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_group_info_ctr(char *desc, GROUP_INFO_CTR *ctr, prs_struct *ps, int depth) +{ + if (ctr == NULL) return; + + prs_debug(ps, depth, desc, "samr_group_info_ctr"); + depth++; + + prs_uint16("switch_value", ps, depth, &(ctr->switch_value)); + prs_align(ps); + + if (ctr->switch_value != 0) + { + switch (ctr->switch_value) + { + case 1: + { + samr_io_group_info1("group_info1", &(ctr->group.info1), ps, depth); + break; + } + case 4: + { + samr_io_group_info4("group_info4", &(ctr->group.info4), ps, depth); + break; + } + default: + { + DEBUG(4,("samr_group_info_ctr: unsupported switch level\n")); + break; + } + } + } + + prs_align(ps); +} + + +/******************************************************************* +makes a SAMR_Q_QUERY_GROUPINFO structure. +********************************************************************/ +void make_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO *q_e, + POLICY_HND *pol, + uint16 switch_level) +{ + if (q_e == NULL || pol == NULL) return; + + DEBUG(5,("make_samr_q_query_groupinfo\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + q_e->switch_level = switch_level; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_query_groupinfo(char *desc, SAMR_Q_QUERY_GROUPINFO *q_e, prs_struct *ps, int depth) +{ + if (q_e == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_query_groupinfo"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + prs_align(ps); + + prs_uint16("switch_level", ps, depth, &(q_e->switch_level)); +} + + +/******************************************************************* +makes a SAMR_R_QUERY_GROUPINFO structure. +********************************************************************/ +void make_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO *r_u, GROUP_INFO_CTR *ctr, + uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_query_groupinfo\n")); + + r_u->ptr = (status == 0x0 && ctr != NULL) ? 1 : 0; + r_u->ctr = ctr; + r_u->status = status; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_query_groupinfo(char *desc, SAMR_R_QUERY_GROUPINFO *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_query_groupinfo"); + depth++; + + prs_align(ps); + + prs_uint32("ptr", ps, depth, &(r_u->ptr)); + + if (r_u->ptr != 0) + { + samr_group_info_ctr("ctr", r_u->ctr, ps, depth); + } + + prs_uint32("status", ps, depth, &(r_u->status)); +} + + +/******************************************************************* +makes a SAMR_Q_QUERY_GROUPMEM structure. +********************************************************************/ +void make_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM *q_c, POLICY_HND *hnd) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_query_groupmem\n")); + + memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_query_groupmem(char *desc, SAMR_Q_QUERY_GROUPMEM *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_query_groupmem"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("group_pol", &(q_u->group_pol), ps, depth); +} + +/******************************************************************* +makes a SAMR_R_QUERY_GROUPMEM structure. +********************************************************************/ +void make_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM *r_u, + uint32 num_entries, uint32 *rid, uint32 *attr, uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_query_groupmem\n")); + + if (status == 0x0) + { + r_u->ptr = (num_entries != 0) ? 1 : 0; + 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. +********************************************************************/ +void samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struct *ps, int depth) +{ + int i; + + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_query_groupmem"); + depth++; + + prs_align(ps); + + prs_uint32("ptr", ps, depth, &(r_u->ptr)); + prs_uint32("num_entries ", ps, depth, &(r_u->num_entries)); + + if (r_u->ptr != 0) + { + prs_uint32("ptr_rids ", ps, depth, &(r_u->ptr_rids )); + prs_uint32("ptr_attrs", ps, depth, &(r_u->ptr_attrs)); + + if (r_u->ptr_rids != 0) + { + prs_uint32("num_rids", ps, depth, &(r_u->num_rids)); + for (i = 0; i < r_u->num_rids; i++) + { + prs_grow(ps); + prs_uint32("", ps, depth, &(r_u->rid[i])); + } + } + + if (r_u->ptr_attrs != 0) + { + prs_uint32("num_attrs", ps, depth, &(r_u->num_attrs)); + for (i = 0; i < r_u->num_attrs; i++) + { + prs_grow(ps); + prs_uint32("", ps, depth, &(r_u->attr[i])); + } + } + } + + prs_uint32("status", ps, depth, &(r_u->status)); +} + /******************************************************************* makes a SAMR_Q_ENUM_DOM_GROUPS structure. @@ -1770,7 +2056,7 @@ void samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_s makes a ALIAS_INFO3 structure. ********************************************************************/ void make_samr_alias_info3(ALIAS_INFO3 *al3, char *acct_desc) - { +{ int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; if (al3 == NULL) return; @@ -1813,19 +2099,19 @@ void samr_alias_info_ctr(char *desc, ALIAS_INFO_CTR *ctr, prs_struct *ps, int d if (ctr->switch_value != 0) { switch (ctr->switch_value) + { + case 3: { - case 3: - { samr_io_alias_info3("alias_info3", &(ctr->alias.info3), ps, depth); - break; - } - default: - { + break; + } + default: + { DEBUG(4,("samr_alias_info_ctr: unsupported switch level\n")); - break; - } + break; } } + } prs_align(ps); } @@ -1880,7 +2166,7 @@ void make_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *r_u, ALIAS_INFO_CTR *ct r_u->ptr = (status == 0x0 && ctr != NULL) ? 1 : 0; r_u->ctr = ctr; r_u->status = status; - } +} /******************************************************************* @@ -2658,15 +2944,12 @@ void make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, { make_dom_rid3(&(r_u->dom_rid[i]), rid[i], type[i]); } - - r_u->num_entries3 = num_rids; } else { r_u->num_entries = 0; r_u->undoc_buffer = 0; r_u->num_entries2 = 0; - r_u->num_entries3 = 0; } r_u->status = status; @@ -2701,8 +2984,6 @@ void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p } - prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); - prs_uint32("status", ps, depth, &(r_u->status)); } -- cgit From 78df0fb8f1ef52b629ccc2634bb0e158a80058a3 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 2 Dec 1998 22:05:56 +0000 Subject: added rid and sid_name_use to DOMAIN_GRP_MEMBER, for use in group member query. domain groups now work, hurrah! only thing is that the description is one character long, don't know why (which is wierd in itself). (This used to be commit 78a86c64960a7823b0db8b7bebfffabb4a5ba864) --- source3/rpc_parse/parse_misc.c | 2 +- source3/rpc_parse/parse_samr.c | 117 ++++++++++++++++++++--------------------- 2 files changed, 58 insertions(+), 61 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 6c42070de4..18c5f23ce3 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -458,7 +458,7 @@ void smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, i prs_align(ps); - prs_uint32("uni_max_len", ps, depth, &(buf2->buf_max_len)); + prs_uint32("buf_max_len", ps, depth, &(buf2->buf_max_len)); prs_uint32("undoc ", ps, depth, &(buf2->undoc )); prs_uint32("buf_len ", ps, depth, &(buf2->buf_len)); diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 8e0ecef3d4..5a9b7660ab 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1387,7 +1387,7 @@ void make_samr_group_info1(GROUP_INFO1 *gr1, make_uni_hdr(&(gr1->hdr_acct_desc), desc_len , desc_len, acct_desc ? 1 : 0); gr1->unknown_1 = 0x3; - gr1->unknown_2 = 0x1; + gr1->unknown_2 = 0x3; make_unistr2(&(gr1->uni_acct_name), acct_name, acct_len); make_unistr2(&(gr1->uni_acct_desc), acct_desc, desc_len); @@ -1406,13 +1406,15 @@ void samr_io_group_info1(char *desc, GROUP_INFO1 *gr1, prs_struct *ps, int dept prs_align(ps); - smb_io_unihdr ("hdr_acct_desc", &(gr1->hdr_acct_desc) , ps, depth); + smb_io_unihdr ("hdr_acct_name", &(gr1->hdr_acct_name) , ps, depth); smb_io_unihdr ("hdr_acct_desc", &(gr1->hdr_acct_desc) , ps, depth); prs_uint32("unknown_1", ps, depth, &(gr1->unknown_1)); prs_uint32("unknown_2", ps, depth, &(gr1->unknown_2)); - smb_io_unistr2("uni_acct_desc", &(gr1->uni_acct_desc), gr1->hdr_acct_desc.buffer, ps, depth); + smb_io_unistr2("uni_acct_name", &(gr1->uni_acct_name), gr1->hdr_acct_name.buffer, ps, depth); + prs_align(ps); + smb_io_unistr2("uni_acct_desc", &(gr1->uni_acct_desc), gr1->hdr_acct_desc.buffer, ps, depth); } @@ -1460,25 +1462,22 @@ void samr_group_info_ctr(char *desc, GROUP_INFO_CTR *ctr, prs_struct *ps, int d prs_uint16("switch_value", ps, depth, &(ctr->switch_value)); prs_align(ps); - if (ctr->switch_value != 0) + switch (ctr->switch_value) { - switch (ctr->switch_value) + case 1: { - case 1: - { - samr_io_group_info1("group_info1", &(ctr->group.info1), ps, depth); - break; - } - case 4: - { - samr_io_group_info4("group_info4", &(ctr->group.info4), ps, depth); - break; - } - default: - { - DEBUG(4,("samr_group_info_ctr: unsupported switch level\n")); - break; - } + samr_io_group_info1("group_info1", &(ctr->group.info1), ps, depth); + break; + } + case 4: + { + samr_io_group_info4("group_info4", &(ctr->group.info4), ps, depth); + break; + } + default: + { + DEBUG(4,("samr_group_info_ctr: unsupported switch level\n")); + break; } } @@ -2483,43 +2482,43 @@ void samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, i makes a SAMR_R_UNKNOWN_12 structure. ********************************************************************/ void make_samr_r_unknown_12(SAMR_R_UNKNOWN_12 *r_u, - uint32 num_aliases, fstring *als_name, uint8 *num_als_usrs, + uint32 num_names, fstring *name, uint8 *type, uint32 status) { int i; - if (r_u == NULL || als_name == NULL || num_als_usrs == NULL) return; + if (r_u == NULL || name == NULL || type == NULL) return; DEBUG(5,("make_samr_r_unknown_12\n")); if (status == 0x0) { - r_u->num_aliases1 = num_aliases; - r_u->ptr_aliases = 1; - r_u->num_aliases2 = num_aliases; + r_u->num_names1 = num_names; + r_u->ptr_names = 1; + r_u->num_names2 = num_names; - r_u->num_als_usrs1 = num_aliases; - r_u->ptr_als_usrs = 1; - r_u->num_als_usrs2 = num_aliases; + r_u->num_types1 = num_names; + r_u->ptr_types = 1; + r_u->num_types2 = num_names; - SMB_ASSERT_ARRAY(r_u->hdr_als_name, num_aliases); + SMB_ASSERT_ARRAY(r_u->hdr_name, num_names); - for (i = 0; i < num_aliases; i++) + for (i = 0; i < num_names; i++) { - int als_len = als_name[i] != NULL ? strlen(als_name[i]) : 0; - make_uni_hdr(&(r_u->hdr_als_name[i]), als_len , als_len, als_name[i] ? 1 : 0); - make_unistr2(&(r_u->uni_als_name[i]), als_name[i], als_len); - r_u->num_als_usrs[i] = num_als_usrs[i]; + int len = name[i] != NULL ? strlen(name[i]) : 0; + make_uni_hdr(&(r_u->hdr_name[i]), len , len, name[i] ? 1 : 0); + make_unistr2(&(r_u->uni_name[i]), name[i], len); + r_u->type[i] = type[i]; } } else { - r_u->num_aliases1 = num_aliases; - r_u->ptr_aliases = 0; - r_u->num_aliases2 = num_aliases; + r_u->num_names1 = num_names; + r_u->ptr_names = 0; + r_u->num_names2 = num_names; - r_u->num_als_usrs1 = num_aliases; - r_u->ptr_als_usrs = 0; - r_u->num_als_usrs2 = num_aliases; + r_u->num_types1 = num_names; + r_u->ptr_types = 0; + r_u->num_types2 = num_names; } r_u->status = status; @@ -2539,43 +2538,41 @@ void samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, i prs_align(ps); - prs_uint32("num_aliases1", ps, depth, &(r_u->num_aliases1)); - prs_uint32("ptr_aliases ", ps, depth, &(r_u->ptr_aliases )); - prs_uint32("num_aliases2", ps, depth, &(r_u->num_aliases2)); + prs_uint32("num_names1", ps, depth, &(r_u->num_names1)); + prs_uint32("ptr_names ", ps, depth, &(r_u->ptr_names )); + prs_uint32("num_names2", ps, depth, &(r_u->num_names2)); - if (r_u->ptr_aliases != 0 && r_u->num_aliases1 != 0) + if (r_u->ptr_names != 0 && r_u->num_names1 != 0) { - SMB_ASSERT_ARRAY(r_u->hdr_als_name, r_u->num_aliases2); + SMB_ASSERT_ARRAY(r_u->hdr_name, r_u->num_names2); - for (i = 0; i < r_u->num_aliases2; i++) + for (i = 0; i < r_u->num_names2; i++) { prs_grow(ps); - slprintf(tmp, sizeof(tmp) - 1, "als_hdr[%02d] ", i); - smb_io_unihdr ("", &(r_u->hdr_als_name[i]), ps, depth); + slprintf(tmp, sizeof(tmp) - 1, "hdr[%02d] ", i); + smb_io_unihdr ("", &(r_u->hdr_name[i]), ps, depth); } - for (i = 0; i < r_u->num_aliases2; i++) + for (i = 0; i < r_u->num_names2; i++) { prs_grow(ps); - slprintf(tmp, sizeof(tmp) - 1, "als_str[%02d] ", i); - smb_io_unistr2("", &(r_u->uni_als_name[i]), r_u->hdr_als_name[i].buffer, ps, depth); + slprintf(tmp, sizeof(tmp) - 1, "str[%02d] ", i); + smb_io_unistr2("", &(r_u->uni_name[i]), r_u->hdr_name[i].buffer, ps, depth); } } prs_align(ps); - prs_uint32("num_als_usrs1", ps, depth, &(r_u->num_als_usrs1)); - prs_uint32("ptr_als_usrs ", ps, depth, &(r_u->ptr_als_usrs )); - prs_uint32("num_als_usrs2", ps, depth, &(r_u->num_als_usrs2)); + prs_uint32("num_types1", ps, depth, &(r_u->num_types1)); + prs_uint32("ptr_types ", ps, depth, &(r_u->ptr_types )); + prs_uint32("num_types2", ps, depth, &(r_u->num_types2)); - if (r_u->ptr_als_usrs != 0 && r_u->num_als_usrs1 != 0) + if (r_u->ptr_types != 0 && r_u->num_types1 != 0) { - SMB_ASSERT_ARRAY(r_u->num_als_usrs, r_u->num_als_usrs2); - - for (i = 0; i < r_u->num_als_usrs2; i++) + for (i = 0; i < r_u->num_types2; i++) { prs_grow(ps); - slprintf(tmp, sizeof(tmp) - 1, "als_usrs[%02d] ", i); - prs_uint32(tmp, ps, depth, &(r_u->num_als_usrs[i])); + slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i); + prs_uint32(tmp, ps, depth, &(r_u->type[i])); } } -- cgit From 364025fe37acfda89f47f6dfa7b97a9b7651e060 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 2 Dec 1998 22:13:48 +0000 Subject: spotted the mistake in group_info1 parsing. (This used to be commit e39c0c76ae52bbd4539f8f254e78566a5511efc1) --- source3/rpc_parse/parse_samr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 5a9b7660ab..e1f4d01d9b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1384,11 +1384,12 @@ void make_samr_group_info1(GROUP_INFO1 *gr1, DEBUG(5,("make_samr_group_info1\n")); make_uni_hdr(&(gr1->hdr_acct_name), acct_len , acct_len, acct_name ? 1 : 0); - make_uni_hdr(&(gr1->hdr_acct_desc), desc_len , desc_len, acct_desc ? 1 : 0); gr1->unknown_1 = 0x3; gr1->unknown_2 = 0x3; + make_uni_hdr(&(gr1->hdr_acct_desc), desc_len , desc_len, acct_desc ? 1 : 0); + make_unistr2(&(gr1->uni_acct_name), acct_name, acct_len); make_unistr2(&(gr1->uni_acct_desc), acct_desc, desc_len); } @@ -1407,11 +1408,12 @@ void samr_io_group_info1(char *desc, GROUP_INFO1 *gr1, prs_struct *ps, int dept prs_align(ps); smb_io_unihdr ("hdr_acct_name", &(gr1->hdr_acct_name) , ps, depth); - smb_io_unihdr ("hdr_acct_desc", &(gr1->hdr_acct_desc) , ps, depth); prs_uint32("unknown_1", ps, depth, &(gr1->unknown_1)); prs_uint32("unknown_2", ps, depth, &(gr1->unknown_2)); + smb_io_unihdr ("hdr_acct_desc", &(gr1->hdr_acct_desc) , ps, depth); + smb_io_unistr2("uni_acct_name", &(gr1->uni_acct_name), gr1->hdr_acct_name.buffer, ps, depth); prs_align(ps); -- cgit From 404b7b49b20829fa415ffed4ba1f473e28de43fe Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 3 Dec 1998 17:29:03 +0000 Subject: adding group parsing: add/modify/delete/add members. (This used to be commit 13a656b0e5c73e157b222765fb57a1bdafc67b80) --- source3/rpc_parse/parse_samr.c | 307 +++++++++++++++++++++++++++++------------ 1 file changed, 217 insertions(+), 90 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index e1f4d01d9b..90e60a36cd 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2,9 +2,9 @@ * Unix SMB/Netbios implementation. * Version 1.9. * 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 Tridgell 1992-1998, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, + * Copyright (C) Paul Ashton 1997-1998. * * 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 @@ -1284,93 +1284,6 @@ void samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP *r_u, prs_struct *ps, i } -#if 0 -/* SAMR_Q_CREATE_DOM_GROUP - SAM create group */ -typedef struct q_samr_create_dom_group_info -{ - POLICY_HND pol; /* policy handle */ - - UNIHDR hdr_acct_desc; - UNISTR2 uni_acct_desc; - - uint16 unknown_1; /* 0x0002 */ - uint16 unknown_2; /* 0x0001 */ - -} SAMR_Q_CREATE_DOM_GROUP; - -/* SAMR_R_CREATE_DOM_GROUP - SAM create group */ -typedef struct r_samr_create_dom_group_info -{ - POLICY_HND pol; /* policy handle */ - - uint32 rid; - uint32 status; - -} SAMR_R_CREATE_DOM_GROUP; - - -/* SAMR_Q_SET_GROUPINFO - SAM Group Info */ -typedef struct q_samr_set_group_info -{ - POLICY_HND pol; /* policy handle */ - uint16 switch_value1; /* 0x0004 seen */ - uint16 switch_value2; /* 0x0004 seen */ - - union - { - GROUP_INFO4 info4; - - } group; - -} SAMR_Q_SET_GROUPINFO; - -/* SAMR_R_SET_GROUPINFO - SAM Group Info */ -typedef struct r_samr_set_group_info -{ - uint32 status; - -} SAMR_R_SET_GROUPINFO; - - -/* SAMR_Q_ADD_GROUPMEM - probably an add group member */ -typedef struct q_samr_add_group_mem_info -{ - POLICY_HND pol; /* policy handle */ - - uint32 rid; /* rid */ - uint32 unknown; /* 0x0000 0005 */ - -} SAMR_Q_ADD_GROUPMEM; - - -/* SAMR_R_ADD_GROUPMEM - probably an add group member */ -typedef struct r_samr_add_group_mem_info -{ - uint32 status; /* return status */ - -} SAMR_R_ADD_GROUPMEM; - - -/* SAMR_Q_OPEN_GROUP - probably an open */ -typedef struct q_samr_open_group_info -{ - POLICY_HND domain_pol; - uint32 unknown; /* 0x0000 0001, 0x0000 0003, 0x0000 001f */ - uint32 rid_group; /* rid */ - -} SAMR_Q_OPEN_GROUP; - - -/* SAMR_R_OPEN_GROUP - probably an open */ -typedef struct r_samr_open_group_info -{ - POLICY_HND pol; /* policy handle */ - uint32 status; /* return status */ - -} SAMR_R_OPEN_GROUP; -#endif - - /******************************************************************* makes a GROUP_INFO1 structure. ********************************************************************/ @@ -1487,6 +1400,220 @@ void samr_group_info_ctr(char *desc, GROUP_INFO_CTR *ctr, prs_struct *ps, int d } +/******************************************************************* +makes a SAMR_Q_CREATE_DOM_GROUP structure. +********************************************************************/ +void make_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP *q_e, + POLICY_HND *pol, + char *acct_desc) +{ + int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; + if (q_e == NULL || pol == NULL) return; + + DEBUG(5,("make_samr_q_create_dom_group\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + make_uni_hdr(&(q_e->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0); + make_unistr2(&(q_e->uni_acct_desc), acct_desc, acct_len); + + q_e->unknown_1 = 0x0002; + q_e->unknown_2 = 0x0001; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_create_dom_group(char *desc, SAMR_Q_CREATE_DOM_GROUP *q_e, prs_struct *ps, int depth) +{ + if (q_e == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_create_dom_group"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + prs_align(ps); + + smb_io_unihdr ("hdr_acct_desc", &(q_e->hdr_acct_desc), ps, depth); + smb_io_unistr2("uni_acct_desc", &(q_e->uni_acct_desc), q_e->hdr_acct_desc.buffer, ps, depth); + prs_align(ps); + + prs_uint16("unknown_1", ps, depth, &(q_e->unknown_1)); + prs_uint16("unknown_2", ps, depth, &(q_e->unknown_2)); +} + + +/******************************************************************* +makes a SAMR_R_CREATE_DOM_GROUP structure. +********************************************************************/ +void make_samr_r_create_dom_group(SAMR_R_CREATE_DOM_GROUP *r_u, POLICY_HND *pol, + uint32 rid, uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_create_dom_group\n")); + + memcpy(&(r_u->pol), pol, sizeof(*pol)); + + r_u->rid = rid ; + r_u->status = status; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_create_dom_group(char *desc, SAMR_R_CREATE_DOM_GROUP *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_create_dom_group"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(r_u->pol), ps, depth); + prs_align(ps); + + prs_uint32("rid ", ps, depth, &(r_u->rid )); + prs_uint32("status", ps, depth, &(r_u->status)); +} + + +/******************************************************************* +makes a SAMR_Q_ADD_GROUPMEM structure. +********************************************************************/ +void make_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM *q_e, + POLICY_HND *pol, + uint32 rid) +{ + if (q_e == NULL || pol == NULL) return; + + DEBUG(5,("make_samr_q_add_groupmem\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + q_e->rid = rid; + q_e->unknown = 0x0005; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_add_groupmem(char *desc, SAMR_Q_ADD_GROUPMEM *q_e, prs_struct *ps, int depth) +{ + if (q_e == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_add_groupmem"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + prs_align(ps); + + prs_uint32("rid ", ps, depth, &(q_e->rid)); + prs_uint32("unknown", ps, depth, &(q_e->unknown)); +} + + +/******************************************************************* +makes a SAMR_R_ADD_GROUPMEM structure. +********************************************************************/ +void make_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM *r_u, POLICY_HND *pol, + uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_add_groupmem\n")); + + r_u->status = status; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_add_groupmem(char *desc, SAMR_R_ADD_GROUPMEM *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_add_groupmem"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + + +/******************************************************************* +makes a SAMR_Q_SET_GROUPINFO structure. +********************************************************************/ +void make_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO *q_e, + POLICY_HND *pol, GROUP_INFO_CTR *ctr) +{ + if (q_e == NULL || pol == NULL) return; + + DEBUG(5,("make_samr_q_set_groupinfo\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + q_e->ctr = ctr; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_set_groupinfo(char *desc, SAMR_Q_SET_GROUPINFO *q_e, prs_struct *ps, int depth) +{ + if (q_e == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_set_groupinfo"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + prs_align(ps); + + samr_group_info_ctr("ctr", q_e->ctr, ps, depth); +} + + +/******************************************************************* +makes a SAMR_R_SET_GROUPINFO structure. +********************************************************************/ +void make_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO *r_u, + uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_set_groupinfo\n")); + + r_u->status = status; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_set_groupinfo(char *desc, SAMR_R_SET_GROUPINFO *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_set_groupinfo"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + /******************************************************************* makes a SAMR_Q_QUERY_GROUPINFO structure. ********************************************************************/ -- cgit From b99dc808df7e1a4d51145f4ce0bd89819b037dc4 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 3 Dec 1998 20:50:33 +0000 Subject: create domain group command (creategroup) added to rpcclient. renamed do_samr_xxxx to samr_xxxx. (This used to be commit 1e5d81c154740349a2cda4c1892b33a21c0683a8) --- source3/rpc_parse/parse_samr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 90e60a36cd..4a84d8c175 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1336,7 +1336,7 @@ void samr_io_group_info1(char *desc, GROUP_INFO1 *gr1, prs_struct *ps, int dept /******************************************************************* makes a GROUP_INFO4 structure. ********************************************************************/ -void make_samr_group_info4(GROUP_INFO4 *gr4, char *acct_desc) +void make_samr_group_info4(GROUP_INFO4 *gr4, const char *acct_desc) { int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; if (gr4 == NULL) return; @@ -1374,10 +1374,10 @@ void samr_group_info_ctr(char *desc, GROUP_INFO_CTR *ctr, prs_struct *ps, int d prs_debug(ps, depth, desc, "samr_group_info_ctr"); depth++; - prs_uint16("switch_value", ps, depth, &(ctr->switch_value)); - prs_align(ps); + prs_uint16("switch_value1", ps, depth, &(ctr->switch_value1)); + prs_uint16("switch_value2", ps, depth, &(ctr->switch_value2)); - switch (ctr->switch_value) + switch (ctr->switch_value1) { case 1: { @@ -1405,7 +1405,7 @@ makes a SAMR_Q_CREATE_DOM_GROUP structure. ********************************************************************/ void make_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP *q_e, POLICY_HND *pol, - char *acct_desc) + const char *acct_desc) { int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; if (q_e == NULL || pol == NULL) return; -- cgit From 32167eda0dc10bf55bd40d676ff882b3c585662b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 3 Dec 1998 22:20:30 +0000 Subject: added createalias command to rpcclient (This used to be commit 4771d5451b49375cc2fd4246d7d746b0d03cd5ba) --- source3/rpc_parse/parse_samr.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 4a84d8c175..99f0673c27 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2183,7 +2183,7 @@ void samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_s /******************************************************************* makes a ALIAS_INFO3 structure. ********************************************************************/ -void make_samr_alias_info3(ALIAS_INFO3 *al3, char *acct_desc) +void make_samr_alias_info3(ALIAS_INFO3 *al3, const char *acct_desc) { int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; if (al3 == NULL) return; @@ -2221,23 +2221,20 @@ void samr_alias_info_ctr(char *desc, ALIAS_INFO_CTR *ctr, prs_struct *ps, int d prs_debug(ps, depth, desc, "samr_alias_info_ctr"); depth++; - prs_uint16("switch_value", ps, depth, &(ctr->switch_value)); - prs_align(ps); + prs_uint16("switch_value1", ps, depth, &(ctr->switch_value1)); + prs_uint16("switch_value2", ps, depth, &(ctr->switch_value2)); - if (ctr->switch_value != 0) + switch (ctr->switch_value1) { - switch (ctr->switch_value) + case 3: { - case 3: - { - samr_io_alias_info3("alias_info3", &(ctr->alias.info3), ps, depth); - break; - } - default: - { - DEBUG(4,("samr_alias_info_ctr: unsupported switch level\n")); - break; - } + samr_io_alias_info3("alias_info3", &(ctr->alias.info3), ps, depth); + break; + } + default: + { + DEBUG(4,("samr_alias_info_ctr: unsupported switch level\n")); + break; } } @@ -2757,7 +2754,7 @@ void samr_io_r_delete_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS *r_u, prs_struc makes a SAMR_Q_CREATE_DOM_ALIAS structure. ********************************************************************/ void make_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS *q_u, POLICY_HND *hnd, - char *acct_desc) + const char *acct_desc) { int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; if (q_u == NULL) return; -- cgit From cf0ea874b1a7cb1dcaaea159d9a4a8a5deae1310 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 4 Dec 1998 16:30:00 +0000 Subject: - renamed do_samr_xxx to samr_xxx - renamed do_lsa_xxx to lsa_xxx - added "enumgroups [-m]" command, enumerates groups, shows members. - added cmd_sam_add_groupmem(), need to call these in rpcclient.c - added cmd_sam_add_aliasmem(), need to call these in rpcclient.c - modified "enumaliases [-m]" command - improved "enumgroups" and "enumaliases" to display names not just RIDS/SIDs. - renamed "samr_unknown_12" to "samr_lookup_rids". - added the following client-side functions: get_samr_query_groupmem() get_samr_query_aliasmem() get_samr_query_groupinfo() samr_enum_dom_groups() samr_enum_dom_aliases() samr_add_aliasmem() samr_add_groupmem() - improved display output (display.c) (This used to be commit eacc5e581af2b4de24186b9be3238b352c54effe) --- source3/rpc_parse/parse_samr.c | 56 +++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 99f0673c27..a344d0d4ee 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -78,7 +78,7 @@ void samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND *r_u, prs_struct *ps, int reads or writes a structure. ********************************************************************/ void make_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, - POLICY_HND *connect_pol, uint32 rid, + POLICY_HND *connect_pol, uint32 flags, DOM_SID *sid) { if (q_u == NULL) return; @@ -86,7 +86,7 @@ void make_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, DEBUG(5,("samr_make_samr_q_open_domain\n")); memcpy(&q_u->connect_pol, connect_pol, sizeof(q_u->connect_pol)); - q_u->rid = rid; + q_u->flags = flags; make_dom_sid2(&(q_u->dom_sid), sid); } @@ -105,7 +105,7 @@ void samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN *q_u, prs_struct *ps, smb_io_pol_hnd("connect_pol", &(q_u->connect_pol), ps, depth); prs_align(ps); - prs_uint32("rid", ps, depth, &(q_u->rid)); + prs_uint32("flags", ps, depth, &(q_u->flags)); smb_io_dom_sid2("sid", &(q_u->dom_sid), ps, depth); prs_align(ps); @@ -2544,11 +2544,11 @@ void samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, i } /******************************************************************* -makes a SAMR_Q_UNKNOWN_12 structure. +makes a SAMR_Q_LOOKUP_RIDS structure. ********************************************************************/ -void make_samr_q_unknown_12(SAMR_Q_UNKNOWN_12 *q_u, - POLICY_HND *pol, uint32 rid, - uint32 num_gids, uint32 *gid) +void make_samr_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u, + POLICY_HND *pol, uint32 flags, + uint32 num_rids, uint32 *rid) { int i; if (q_u == NULL) return; @@ -2557,28 +2557,28 @@ void make_samr_q_unknown_12(SAMR_Q_UNKNOWN_12 *q_u, memcpy(&(q_u->pol), pol, sizeof(*pol)); - q_u->num_gids1 = num_gids; - q_u->rid = rid; + q_u->num_rids1 = num_rids; + q_u->flags = flags; q_u->ptr = 0; - q_u->num_gids2 = num_gids; + q_u->num_rids2 = num_rids; - for (i = 0; i < num_gids; i++) + for (i = 0; i < num_rids; i++) { - q_u->gid[i] = gid[i]; + q_u->rid[i] = rid[i]; } } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, int depth) +void samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS *q_u, prs_struct *ps, int depth) { int i; fstring tmp; if (q_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_q_unknown_12"); + prs_debug(ps, depth, desc, "samr_io_q_lookup_rids"); depth++; prs_align(ps); @@ -2586,18 +2586,18 @@ void samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, i smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); prs_align(ps); - prs_uint32("num_gids1", ps, depth, &(q_u->num_gids1)); - prs_uint32("rid ", ps, depth, &(q_u->rid )); + prs_uint32("num_rids1", ps, depth, &(q_u->num_rids1)); + prs_uint32("flags ", ps, depth, &(q_u->flags )); prs_uint32("ptr ", ps, depth, &(q_u->ptr )); - prs_uint32("num_gids2", ps, depth, &(q_u->num_gids2)); + prs_uint32("num_rids2", ps, depth, &(q_u->num_rids2)); - SMB_ASSERT_ARRAY(q_u->gid, q_u->num_gids2); + SMB_ASSERT_ARRAY(q_u->rid, q_u->num_rids2); - for (i = 0; i < q_u->num_gids2; i++) + for (i = 0; i < q_u->num_rids2; i++) { prs_grow(ps); - slprintf(tmp, sizeof(tmp) - 1, "gid[%02d] ", i); - prs_uint32(tmp, ps, depth, &(q_u->gid[i])); + slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i); + prs_uint32(tmp, ps, depth, &(q_u->rid[i])); } prs_align(ps); @@ -2605,16 +2605,16 @@ void samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, i /******************************************************************* -makes a SAMR_R_UNKNOWN_12 structure. +makes a SAMR_R_LOOKUP_RIDS structure. ********************************************************************/ -void make_samr_r_unknown_12(SAMR_R_UNKNOWN_12 *r_u, +void make_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u, uint32 num_names, fstring *name, uint8 *type, uint32 status) { int i; if (r_u == NULL || name == NULL || type == NULL) return; - DEBUG(5,("make_samr_r_unknown_12\n")); + DEBUG(5,("make_samr_r_lookup_rids\n")); if (status == 0x0) { @@ -2653,13 +2653,13 @@ void make_samr_r_unknown_12(SAMR_R_UNKNOWN_12 *r_u, /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, int depth) +void samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, int depth) { int i; fstring tmp; if (r_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_r_unknown_12"); + prs_debug(ps, depth, desc, "samr_io_r_lookup_rids"); depth++; prs_align(ps); @@ -2870,7 +2870,7 @@ void make_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, POLICY_HND *hnd, DEBUG(5,("make_samr_q_add_aliasmem\n")); memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol)); - sid_copy(&q_u->sid, sid); + make_dom_sid2(&q_u->sid, sid); } @@ -2887,7 +2887,7 @@ void samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM *q_u, prs_struct *p prs_align(ps); smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); - smb_io_dom_sid("sid ", &(q_u->sid ), ps, depth); + smb_io_dom_sid2("sid ", &(q_u->sid ), ps, depth); } /******************************************************************* -- cgit From 89c56492a86fb02b2045182490b93f17a475f03d Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 4 Dec 1998 21:48:06 +0000 Subject: - oops, i got "add alias member" and "delete alias member" swapped. - samr_enum_dom_users, the first 4 bytes is some sort of garbage, nt5-beta2 clears them out to zeros whereas nt4 does not. fixed bug where we were assuming that the first 4 bytes of a response _had_ to be non-zero. - cli_lsarpc.c: forgot to append the rid on the lsa_lookup_names() client call. - added in "addaliasmem" and "addgroupmem" commands. the addaliasmem command actually turned out to be a "delaliasmem" :-) :-) - parse_lsa.c: moved assert array check to after the size of useable array space is set... (This used to be commit 165b15a8cacc4bc7cf8cc0b9aaabb6b92cef7fdb) --- source3/rpc_parse/parse_lsa.c | 4 ++-- source3/rpc_parse/parse_samr.c | 42 ++++++++++++++++++++---------------------- 2 files changed, 22 insertions(+), 24 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 7fcdeccec8..9781e3cfab 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -677,11 +677,11 @@ void make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, memcpy(&(q_l->pol), hnd, sizeof(q_l->pol)); - SMB_ASSERT_ARRAY(q_l->uni_name, q_l->num_entries); - q_l->num_entries = num_names; q_l->num_entries2 = num_names; + SMB_ASSERT_ARRAY(q_l->uni_name, q_l->num_entries); + for (i = 0; i < num_names; i++) { int len = strlen(names[i]); diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a344d0d4ee..ac849a8987 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -853,7 +853,7 @@ void samr_io_q_enum_dom_users(char *desc, SAMR_Q_ENUM_DOM_USERS *q_e, prs_struc makes a SAMR_R_ENUM_DOM_USERS structure. ********************************************************************/ void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, - uint16 total_num_entries, uint16 unk_0, + uint32 unk_0, uint32 num_sam_entries, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES], uint32 status) { int i; @@ -869,10 +869,9 @@ void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, num_sam_entries)); } - r_u->total_num_entries = total_num_entries; - r_u->unknown_0 = unk_0; + r_u->unknown_0 = unk_0; - if (total_num_entries > 0) + if (num_sam_entries != 0) { r_u->ptr_entries1 = 1; r_u->ptr_entries2 = 1; @@ -917,11 +916,10 @@ void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struc prs_align(ps); - prs_uint16("total_num_entries", ps, depth, &(r_u->total_num_entries)); - prs_uint16("unknown_0 ", ps, depth, &(r_u->unknown_0 )); + prs_uint32("unknown_0 ", ps, depth, &(r_u->unknown_0 )); prs_uint32("ptr_entries1", ps, depth, &(r_u->ptr_entries1)); - if (r_u->total_num_entries != 0 && r_u->ptr_entries1 != 0) + if (r_u->ptr_entries1 != 0) { prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); @@ -2378,7 +2376,7 @@ void make_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u, memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); q_u->num_sids1 = 1; - q_u->ptr = 0; + q_u->ptr = 1; q_u->num_sids2 = 1; { @@ -2813,14 +2811,14 @@ void samr_io_r_create_dom_alias(char *desc, SAMR_R_CREATE_DOM_ALIAS *r_u, prs_s /******************************************************************* -makes a SAMR_Q_UNK_ALIASMEM structure. +makes a SAMR_Q_ADD_ALIASMEM structure. ********************************************************************/ -void make_samr_q_unk_aliasmem(SAMR_Q_UNK_ALIASMEM *q_u, POLICY_HND *hnd, +void make_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, POLICY_HND *hnd, DOM_SID *sid) { if (q_u == NULL) return; - DEBUG(5,("make_samr_q_unk_aliasmem\n")); + DEBUG(5,("make_samr_q_add_aliasmem\n")); memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol)); sid_copy(&q_u->sid, sid); @@ -2830,11 +2828,11 @@ void make_samr_q_unk_aliasmem(SAMR_Q_UNK_ALIASMEM *q_u, POLICY_HND *hnd, /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_unk_aliasmem(char *desc, SAMR_Q_UNK_ALIASMEM *q_u, prs_struct *ps, int depth) +void samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_q_unk_aliasmem"); + prs_debug(ps, depth, desc, "samr_io_q_add_aliasmem"); depth++; prs_align(ps); @@ -2846,11 +2844,11 @@ void samr_io_q_unk_aliasmem(char *desc, SAMR_Q_UNK_ALIASMEM *q_u, prs_struct *p /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_unk_aliasmem(char *desc, SAMR_R_UNK_ALIASMEM *r_u, prs_struct *ps, int depth) +void samr_io_r_add_aliasmem(char *desc, SAMR_R_ADD_ALIASMEM *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_r_unk_aliasmem"); + prs_debug(ps, depth, desc, "samr_io_r_add_aliasmem"); depth++; prs_align(ps); @@ -2860,14 +2858,14 @@ void samr_io_r_unk_aliasmem(char *desc, SAMR_R_UNK_ALIASMEM *r_u, prs_struct *p /******************************************************************* -makes a SAMR_Q_ADD_ALIASMEM structure. +makes a SAMR_Q_DEL_ALIASMEM structure. ********************************************************************/ -void make_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, POLICY_HND *hnd, +void make_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM *q_u, POLICY_HND *hnd, DOM_SID *sid) { if (q_u == NULL) return; - DEBUG(5,("make_samr_q_add_aliasmem\n")); + DEBUG(5,("make_samr_q_del_aliasmem\n")); memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol)); make_dom_sid2(&q_u->sid, sid); @@ -2877,11 +2875,11 @@ void make_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, POLICY_HND *hnd, /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM *q_u, prs_struct *ps, int depth) +void samr_io_q_del_aliasmem(char *desc, SAMR_Q_DEL_ALIASMEM *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_q_add_aliasmem"); + prs_debug(ps, depth, desc, "samr_io_q_del_aliasmem"); depth++; prs_align(ps); @@ -2893,11 +2891,11 @@ void samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM *q_u, prs_struct *p /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_add_aliasmem(char *desc, SAMR_R_ADD_ALIASMEM *r_u, prs_struct *ps, int depth) +void samr_io_r_del_aliasmem(char *desc, SAMR_R_DEL_ALIASMEM *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_r_add_aliasmem"); + prs_debug(ps, depth, desc, "samr_io_r_del_aliasmem"); depth++; prs_align(ps); -- cgit From 7cbd3bcef57e5a15620fbe049ade13e7c7ea9e1a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 4 Dec 1998 23:06:27 +0000 Subject: added delete domain group and local group and delete domain group member. (This used to be commit bf15343def5b95ce4387ac4357674aff31431194) --- source3/rpc_parse/parse_samr.c | 180 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 179 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ac849a8987..5460d4773b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1480,6 +1480,128 @@ void samr_io_r_create_dom_group(char *desc, SAMR_R_CREATE_DOM_GROUP *r_u, prs_s prs_uint32("status", ps, depth, &(r_u->status)); } +/******************************************************************* +makes a SAMR_Q_DELETE_DOM_GROUP structure. +********************************************************************/ +void make_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP *q_c, POLICY_HND *hnd) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_delete_dom_group\n")); + + memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_delete_dom_group(char *desc, SAMR_Q_DELETE_DOM_GROUP *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_delete_dom_group"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("group_pol", &(q_u->group_pol), ps, depth); +} + +/******************************************************************* +makes a SAMR_R_DELETE_DOM_GROUP structure. +********************************************************************/ +void make_samr_r_delete_dom_group(SAMR_R_DELETE_DOM_GROUP *r_u, + uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_delete_dom_group\n")); + + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_delete_dom_group(char *desc, SAMR_R_DELETE_DOM_GROUP *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_delete_dom_group"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + + + +/******************************************************************* +makes a SAMR_Q_DEL_GROUPMEM structure. +********************************************************************/ +void make_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM *q_e, + POLICY_HND *pol, + uint32 rid) +{ + if (q_e == NULL || pol == NULL) return; + + DEBUG(5,("make_samr_q_del_groupmem\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + q_e->rid = rid; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_del_groupmem(char *desc, SAMR_Q_DEL_GROUPMEM *q_e, prs_struct *ps, int depth) +{ + if (q_e == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_del_groupmem"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + prs_align(ps); + + prs_uint32("rid ", ps, depth, &(q_e->rid)); +} + + +/******************************************************************* +makes a SAMR_R_DEL_GROUPMEM structure. +********************************************************************/ +void make_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM *r_u, POLICY_HND *pol, + uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_del_groupmem\n")); + + r_u->status = status; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_del_groupmem(char *desc, SAMR_R_DEL_GROUPMEM *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_del_groupmem"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + /******************************************************************* makes a SAMR_Q_ADD_GROUPMEM structure. @@ -2806,7 +2928,7 @@ void samr_io_r_create_dom_alias(char *desc, SAMR_R_CREATE_DOM_ALIAS *r_u, prs_s prs_uint32("rid", ps, depth, &(r_u->rid)); prs_uint32("status", ps, depth, &(r_u->status)); - } +} @@ -2903,6 +3025,62 @@ void samr_io_r_del_aliasmem(char *desc, SAMR_R_DEL_ALIASMEM *r_u, prs_struct *p prs_uint32("status", ps, depth, &(r_u->status)); } +/******************************************************************* +makes a SAMR_Q_DELETE_DOM_ALIAS structure. +********************************************************************/ +void make_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS *q_c, POLICY_HND *hnd) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_delete_dom_alias\n")); + + memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_delete_dom_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_delete_dom_alias"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); +} + +/******************************************************************* +makes a SAMR_R_DELETE_DOM_ALIAS structure. +********************************************************************/ +void make_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS *r_u, + uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_delete_dom_alias\n")); + + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_delete_dom_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_delete_dom_alias"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + + /******************************************************************* makes a SAMR_Q_QUERY_ALIASMEM structure. ********************************************************************/ -- cgit From 312f4f3960a9b1938ae133678cd8567be1331b99 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 7 Dec 1998 17:23:48 +0000 Subject: - lib/unix_sec_ctxt.c attempt at taking lib/uid.c and getting a unix security context change module that is independent of "cnums" and "snums". a security context is needed for pipes, not just IPC$ or other services. - group database API added add_group/alias_member, del_group/alias_member, del_group/alias_entry functions. del_builtin_entry() is deliberately set to NULL to cause an exception, you cannot delete builtin aliases. - parse_lsa.c srv_lsa.c fixed lookup_names code, it was a load of trash and didn't do anything. - cmd_samr.c rpcclient.c srv_samr.c added "deletegroup", "deletealias", "delaliasmem", "delgroupmem", "addgroupmem", "addaliasmem", "createalias", "creategroup", to both client and server code. server code calls into unix stubs right now, which don't actually do anything. the only instance where they are expected to do anything is in appliance mode NOT even in the ldap code or anything. client code modified to call samr_lookup_names() for group code (because we can) and lsa_lookup_names() for alias code (because we have to). - srv_lookup.c oops, lookup on unsplit name, we got lookup on DOMAIN, DOMAIN\name instead of DOMAIN, name. (This used to be commit b8175702ef61b8b37b078f38e81452c00a5e2986) --- source3/rpc_parse/parse_lsa.c | 4 +- source3/rpc_parse/parse_misc.c | 4 +- source3/rpc_parse/parse_samr.c | 117 ++++++++++++++++++++++++++++++++--------- 3 files changed, 95 insertions(+), 30 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 9781e3cfab..0b294b84f3 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -77,7 +77,7 @@ static void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int de prs_uint32("max_entries ", ps, depth, &(r_r->max_entries )); /* 32 - max number of entries */ prs_uint32("num_ref_doms_2", ps, depth, &(r_r->num_ref_doms_2)); /* 4 - num referenced domains? */ - SMB_ASSERT_ARRAY(r_r->hdr_ref_dom, r_r->num_ref_doms_1-1); + SMB_ASSERT_ARRAY(r_r->hdr_ref_dom, r_r->num_ref_doms_1); SMB_ASSERT_ARRAY(r_r->ref_dom, r_r->num_ref_doms_2); for (i = 0; i < r_r->num_ref_doms_1; i++) @@ -668,7 +668,7 @@ void lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, i makes a structure. ********************************************************************/ void make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, - int num_names, char **names) + int num_names, const char **names) { int i; if (q_l == NULL) return; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 18c5f23ce3..fdc67d0905 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -617,11 +617,11 @@ void smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, i /******************************************************************* creates a DOM_RID2 structure. ********************************************************************/ -void make_dom_rid2(DOM_RID2 *rid2, uint32 rid, uint8 type) +void make_dom_rid2(DOM_RID2 *rid2, uint32 rid, uint8 type, uint32 idx) { rid2->type = type; rid2->rid = rid; - rid2->rid_idx = 0; + rid2->rid_idx = idx; } /******************************************************************* diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 5460d4773b..bfcc811aea 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2912,6 +2912,22 @@ void samr_io_q_create_dom_alias(char *desc, SAMR_Q_CREATE_DOM_ALIAS *q_u, prs_s prs_uint16("unknown_2", ps, depth, &(q_u->unknown_2)); } +/******************************************************************* +makes a SAMR_R_CREATE_DOM_ALIAS structure. +********************************************************************/ +void make_samr_r_create_dom_alias(SAMR_R_CREATE_DOM_ALIAS *r_u, POLICY_HND *pol, + uint32 rid, uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_create_dom_alias\n")); + + memcpy(&(r_u->alias_pol), pol, sizeof(*pol)); + r_u->rid = rid ; + r_u->status = status; +} + + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -3180,6 +3196,33 @@ void samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM *r_u, prs_struc prs_uint32("status", ps, depth, &(r_u->status)); } +/******************************************************************* +makes a SAMR_Q_LOOKUP_NAMES structure. +********************************************************************/ +void make_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES *q_u, + POLICY_HND *pol, uint32 flags, + uint32 num_names, const char **name) +{ + int i; + if (q_u == NULL) return; + + DEBUG(5,("make_samr_q_lookup_names\n")); + + memcpy(&(q_u->pol), pol, sizeof(*pol)); + + q_u->num_names1 = num_names; + q_u->flags = flags; + q_u->ptr = 0; + q_u->num_names2 = num_names; + + for (i = 0; i < num_names; i++) + { + int len_name = name[i] != NULL ? strlen(name[i]) : 0; + make_uni_hdr(&(q_u->hdr_name[i]), len_name, len_name, name[i] != NULL); /* unicode header for user_name */ + make_unistr2(&(q_u->uni_name[i]), name[i], len_name); /* unicode string for machine account */ + } +} + /******************************************************************* reads or writes a structure. @@ -3198,22 +3241,22 @@ void samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *p smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); prs_align(ps); - prs_uint32("num_rids1", ps, depth, &(q_u->num_rids1)); - prs_uint32("rid ", ps, depth, &(q_u->rid )); + prs_uint32("num_names1", ps, depth, &(q_u->num_names1)); + prs_uint32("flags ", ps, depth, &(q_u->flags )); prs_uint32("ptr ", ps, depth, &(q_u->ptr )); - prs_uint32("num_rids2", ps, depth, &(q_u->num_rids2)); + prs_uint32("num_names2", ps, depth, &(q_u->num_names2)); - SMB_ASSERT_ARRAY(q_u->hdr_user_name, q_u->num_rids2); + SMB_ASSERT_ARRAY(q_u->hdr_name, q_u->num_names2); - for (i = 0; i < q_u->num_rids2; i++) + for (i = 0; i < q_u->num_names2; i++) { prs_grow(ps); - smb_io_unihdr ("", &(q_u->hdr_user_name[i]), ps, depth); + smb_io_unihdr ("", &(q_u->hdr_name[i]), ps, depth); } - for (i = 0; i < q_u->num_rids2; i++) + for (i = 0; i < q_u->num_names2; i++) { prs_grow(ps); - smb_io_unistr2("", &(q_u->uni_user_name[i]), q_u->hdr_user_name[i].buffer, ps, depth); + smb_io_unistr2("", &(q_u->uni_name[i]), q_u->hdr_name[i].buffer, ps, depth); } prs_align(ps); @@ -3233,22 +3276,31 @@ void make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, if (status == 0x0) { - r_u->num_entries = num_rids; - r_u->undoc_buffer = 1; - r_u->num_entries2 = num_rids; + r_u->num_types1 = num_rids; + r_u->ptr_types = 1; + r_u->num_types2 = num_rids; - SMB_ASSERT_ARRAY(r_u->dom_rid, num_rids); + r_u->num_rids1 = num_rids; + r_u->ptr_rids = 1; + r_u->num_rids2 = num_rids; + + SMB_ASSERT_ARRAY(r_u->rid, num_rids); for (i = 0; i < num_rids; i++) { - make_dom_rid3(&(r_u->dom_rid[i]), rid[i], type[i]); + r_u->rid [i] = rid [i]; + r_u->type[i] = type[i]; } } else { - r_u->num_entries = 0; - r_u->undoc_buffer = 0; - r_u->num_entries2 = 0; + 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->status = status; @@ -3260,6 +3312,8 @@ reads or writes a structure. void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *ps, int depth) { int i; + fstring tmp; + if (r_u == NULL) return; prs_debug(ps, depth, desc, "samr_io_r_lookup_names"); @@ -3267,20 +3321,32 @@ void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p prs_align(ps); - prs_uint32("num_entries ", ps, depth, &(r_u->num_entries )); - prs_uint32("undoc_buffer", ps, depth, &(r_u->undoc_buffer)); - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + prs_uint32("num_rids1", ps, depth, &(r_u->num_rids1)); + prs_uint32("ptr_rids ", ps, depth, &(r_u->ptr_rids )); + prs_uint32("num_rids2", ps, depth, &(r_u->num_rids2)); - if (r_u->num_entries != 0) + if (r_u->ptr_rids != 0 && r_u->num_rids1 != 0) { - SMB_ASSERT_ARRAY(r_u->dom_rid, r_u->num_entries2); - - for (i = 0; i < r_u->num_entries2; i++) + for (i = 0; i < r_u->num_rids2; i++) { prs_grow(ps); - smb_io_dom_rid3("", &(r_u->dom_rid[i]), ps, depth); + slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i); + prs_uint32(tmp, ps, depth, &(r_u->rid[i])); + } } + prs_uint32("num_types1", ps, depth, &(r_u->num_types1)); + prs_uint32("ptr_types ", ps, depth, &(r_u->ptr_types )); + prs_uint32("num_types2", ps, depth, &(r_u->num_types2)); + + if (r_u->ptr_types != 0 && r_u->num_types1 != 0) + { + for (i = 0; i < r_u->num_types2; i++) + { + prs_grow(ps); + slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i); + prs_uint32(tmp, ps, depth, &(r_u->type[i])); + } } prs_uint32("status", ps, depth, &(r_u->status)); @@ -3476,8 +3542,6 @@ void make_sam_user_info11(SAM_USER_INFO_11 *usr, usr->padding_8 = 0; /* 0 - padding 4 bytes */ make_unistr2(&(usr->uni_mach_acct), mach_acct, len_mach_acct); /* unicode string for machine account */ - - bzero(usr->padding_9, sizeof(usr->padding_9)); /* 0 - padding 48 bytes */ } /******************************************************************* @@ -3526,6 +3590,7 @@ void sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int prs_uint8s (False, "padding_9", ps, depth, usr->padding_9, sizeof(usr->padding_9)); } + /************************************************************************* make_sam_user_info21 -- cgit From 54529fbd66a1adefbc0187ca4e594ff286f5f14f Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 7 Dec 1998 21:32:02 +0000 Subject: bugs in rpcclient. add_aliasmem uses a DOM_SID2 not a DOM_SID. (This used to be commit 8a85d7abed317fd06e3e0026d4b9e088311eede4) --- source3/rpc_parse/parse_samr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index bfcc811aea..52bcb4ff77 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2959,7 +2959,7 @@ void make_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, POLICY_HND *hnd, DEBUG(5,("make_samr_q_add_aliasmem\n")); memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol)); - sid_copy(&q_u->sid, sid); + make_dom_sid2(&q_u->sid, sid); } @@ -2975,8 +2975,8 @@ void samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM *q_u, prs_struct *p prs_align(ps); - smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); - smb_io_dom_sid("sid ", &(q_u->sid ), ps, depth); + smb_io_pol_hnd ("alias_pol", &(q_u->alias_pol), ps, depth); + smb_io_dom_sid2("sid ", &(q_u->sid ), ps, depth); } /******************************************************************* -- cgit From 8308c000b2022769644ed8ea1fc772776257c99b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 8 Dec 1998 00:25:04 +0000 Subject: adding srvsvc pipe. (This used to be commit d06d6369942828ec89e90f99bd0d0d3f91d61d13) --- source3/rpc_parse/parse_rpc.c | 11 ++++ source3/rpc_parse/parse_samr.c | 65 ++++++++++++++++++++ source3/rpc_parse/parse_svc.c | 136 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 212 insertions(+) create mode 100644 source3/rpc_parse/parse_svc.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 5059ca222b..9ce83bea83 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -42,6 +42,16 @@ interface/version dce/rpc pipe identification }, 0x02 \ } \ +#define SYNT_SVCCTL_V2 \ +{ \ + { \ + 0x81, 0xbb, 0x7a, 0x36, \ + 0x44, 0x98, 0xf1, 0x35, \ + 0xad, 0x32, 0x98, 0xf0, \ + 0x38, 0x00, 0x10, 0x03 \ + }, 0x02 \ +} \ + #define SYNT_NETLOGON_V2 \ { \ { \ @@ -129,6 +139,7 @@ struct pipe_id_info pipe_names [] = { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_NETLOGON, SYNT_NETLOGON_V1, PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, + { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 52bcb4ff77..f4c1790254 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -258,6 +258,61 @@ void samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO *q_u, prs_st prs_align(ps); } +/******************************************************************* +makes a structure. +********************************************************************/ +void make_unk_info6(SAM_UNK_INFO_6 *u_6) +{ + if (u_6 == NULL) return; + + u_6->unknown_0 = 0x00000000; + u_6->ptr_0 = 1; + memset(u_6->padding, 0, sizeof(u_6->padding)); /* 12 bytes zeros */ +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void sam_io_unk_info6(char *desc, SAM_UNK_INFO_6 *u_6, prs_struct *ps, int depth) +{ + if (u_6 == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_unk_info6"); + depth++; + + prs_uint32("unknown_0", ps, depth, &u_6->unknown_0); /* 0x0000 0000 */ + prs_uint32("ptr_0", ps, depth, &u_6->ptr_0); /* pointer to unknown structure */ + prs_uint8s(False, "padding", ps, depth, u_6->padding, sizeof(u_6->padding)); /* 12 bytes zeros */ + + prs_align(ps); + +} + +/******************************************************************* +makes a structure. +********************************************************************/ +void make_unk_info7(SAM_UNK_INFO_7 *u_7) +{ + if (u_7 == NULL) return; + + u_7->unknown_0 = 0x0003; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void sam_io_unk_info7(char *desc, SAM_UNK_INFO_7 *u_7, prs_struct *ps, int depth) +{ + if (u_7 == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_unk_info7"); + depth++; + + prs_uint16("unknown_0", ps, depth, &u_7->unknown_0); /* 0x0003 */ + prs_align(ps); + +} + /******************************************************************* makes a structure. ********************************************************************/ @@ -376,6 +431,16 @@ void samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_str { switch (r_u->switch_value) { + case 0x06: + { + sam_io_unk_info6("unk_inf6", &r_u->ctr->info.inf6, ps, depth); + break; + } + case 0x07: + { + sam_io_unk_info7("unk_inf7", &r_u->ctr->info.inf7, ps, depth); + break; + } case 0x02: { sam_io_unk_info2("unk_inf2", &r_u->ctr->info.inf2, ps, depth); diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c new file mode 100644 index 0000000000..288f23f46b --- /dev/null +++ b/source3/rpc_parse/parse_svc.c @@ -0,0 +1,136 @@ + +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include "includes.h" + +extern int DEBUGLEVEL; + +/******************************************************************* + make_svc_q_open_policy + ********************************************************************/ +void make_svc_q_open_policy(SVC_Q_OPEN_POLICY *q_u, + char *server, uint16 unknown) +{ + DEBUG(5,("make_svc_q_open_policy\n")); + + make_buf_unistr2(&(q_u->uni_srv_name), &(q_u->ptr_srv_name), server); + q_u->unknown = unknown; + +} + +/******************************************************************* +reads or writes a SVC_Q_OPEN_POLICY structure. +********************************************************************/ +void svc_io_q_open_policy(char *desc, SVC_Q_OPEN_POLICY *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_q_open_policy"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_srv_name", ps, depth, &(q_u->ptr_srv_name)); + smb_io_unistr2("", &(q_u->uni_srv_name), q_u->ptr_srv_name, ps, depth); + prs_align(ps); + + prs_uint32("unknown", ps, depth, &(q_u->unknown)); + prs_align(ps); +} + +/******************************************************************* + make_svc_r_open_policy + ********************************************************************/ +void make_svc_r_open_policy(SVC_R_OPEN_POLICY *r_u, POLICY_HND *hnd, + uint32 status) +{ + DEBUG(5,("make_svc_r_unknown_0: %d\n", __LINE__)); + + memcpy(&(r_u->pol), hnd, sizeof(r_u->pol)); + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void svc_io_r_open_policy(char *desc, SVC_R_OPEN_POLICY *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_r_open_policy"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_u->pol), ps, depth); + + prs_uint32("status ", ps, depth, &(r_u->status)); +} + +/******************************************************************* +makes an SVC_Q_CLOSE structure. +********************************************************************/ +void make_svc_q_close(SVC_Q_CLOSE *q_c, POLICY_HND *hnd) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_svc_q_close\n")); + +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void svc_io_q_close(char *desc, SVC_Q_CLOSE *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_q_close"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(q_u->pol), ps, depth); + prs_align(ps); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void svc_io_r_close(char *desc, SVC_R_CLOSE *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_r_close"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_u->pol), ps, depth); + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + -- cgit From 7135fb0a2c869169996206a9c1cf5ac1112b9f0a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 8 Dec 1998 23:29:37 +0000 Subject: adding "Service Control Manager" commands to rpcclient. (This used to be commit e5ee965f8d8452ab694bc5d88e474c4b91dce5b0) --- source3/rpc_parse/parse_svc.c | 117 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 104 insertions(+), 13 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c index 288f23f46b..2134d86f47 100644 --- a/source3/rpc_parse/parse_svc.c +++ b/source3/rpc_parse/parse_svc.c @@ -28,26 +28,28 @@ extern int DEBUGLEVEL; /******************************************************************* - make_svc_q_open_policy + make_svc_q_open_sc_man ********************************************************************/ -void make_svc_q_open_policy(SVC_Q_OPEN_POLICY *q_u, - char *server, uint16 unknown) +void make_svc_q_open_sc_man(SVC_Q_OPEN_SC_MAN *q_u, + char *server, char *database, + uint32 des_access) { - DEBUG(5,("make_svc_q_open_policy\n")); + DEBUG(5,("make_svc_q_open_sc_man\n")); make_buf_unistr2(&(q_u->uni_srv_name), &(q_u->ptr_srv_name), server); - q_u->unknown = unknown; + make_buf_unistr2(&(q_u->uni_db_name ), &(q_u->ptr_db_name), database); + q_u->des_access = des_access; } /******************************************************************* -reads or writes a SVC_Q_OPEN_POLICY structure. +reads or writes a SVC_Q_OPEN_SC_MAN structure. ********************************************************************/ -void svc_io_q_open_policy(char *desc, SVC_Q_OPEN_POLICY *q_u, prs_struct *ps, int depth) +void svc_io_q_open_sc_man(char *desc, SVC_Q_OPEN_SC_MAN *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return; - prs_debug(ps, depth, desc, "svc_io_q_open_policy"); + prs_debug(ps, depth, desc, "svc_io_q_open_sc_man"); depth++; prs_align(ps); @@ -56,14 +58,18 @@ void svc_io_q_open_policy(char *desc, SVC_Q_OPEN_POLICY *q_u, prs_struct *ps, in smb_io_unistr2("", &(q_u->uni_srv_name), q_u->ptr_srv_name, ps, depth); prs_align(ps); - prs_uint32("unknown", ps, depth, &(q_u->unknown)); + prs_uint32("ptr_db_name", ps, depth, &(q_u->ptr_db_name)); + smb_io_unistr2("", &(q_u->uni_db_name), q_u->ptr_db_name, ps, depth); + prs_align(ps); + + prs_uint32("des_access", ps, depth, &(q_u->des_access)); prs_align(ps); } /******************************************************************* - make_svc_r_open_policy + make_svc_r_open_sc_man ********************************************************************/ -void make_svc_r_open_policy(SVC_R_OPEN_POLICY *r_u, POLICY_HND *hnd, +void make_svc_r_open_sc_man(SVC_R_OPEN_SC_MAN *r_u, POLICY_HND *hnd, uint32 status) { DEBUG(5,("make_svc_r_unknown_0: %d\n", __LINE__)); @@ -75,11 +81,11 @@ void make_svc_r_open_policy(SVC_R_OPEN_POLICY *r_u, POLICY_HND *hnd, /******************************************************************* reads or writes a structure. ********************************************************************/ -void svc_io_r_open_policy(char *desc, SVC_R_OPEN_POLICY *r_u, prs_struct *ps, int depth) +void svc_io_r_open_sc_man(char *desc, SVC_R_OPEN_SC_MAN *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return; - prs_debug(ps, depth, desc, "svc_io_r_open_policy"); + prs_debug(ps, depth, desc, "svc_io_r_open_sc_man"); depth++; prs_align(ps); @@ -89,6 +95,45 @@ void svc_io_r_open_policy(char *desc, SVC_R_OPEN_POLICY *r_u, prs_struct *ps, i prs_uint32("status ", ps, depth, &(r_u->status)); } +/******************************************************************* +makes an SVC_Q_ENUM_SVCS_STATUS structure. +********************************************************************/ +void make_svc_q_enum_svcs_status(SVC_Q_ENUM_SVCS_STATUS *q_c, POLICY_HND *hnd, + uint32 service_type, uint32 service_state, + uint32 buf_size, uint32 resume_hnd ) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_svc_q_enum_svcs_status\n")); + + memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); + q_c->service_type = service_type; + q_c->service_state = service_state; + q_c->buf_size = buf_size; + make_enum_hnd(&q_c->resume_hnd, resume_hnd); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void svc_io_q_enum_svcs_status(char *desc, SVC_Q_ENUM_SVCS_STATUS *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_q_enum_svcs_status"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(q_u->pol), ps, depth); + prs_align(ps); + + prs_uint32("service_type ", ps, depth, &(q_u->service_type )); + prs_uint32("service_state", ps, depth, &(q_u->service_state)); + prs_uint32("buf_size ", ps, depth, &(q_u->buf_size )); + smb_io_enum_hnd("resume_hnd", &(q_u->resume_hnd), ps, depth); +} + /******************************************************************* makes an SVC_Q_CLOSE structure. ********************************************************************/ @@ -98,6 +143,7 @@ void make_svc_q_close(SVC_Q_CLOSE *q_c, POLICY_HND *hnd) DEBUG(5,("make_svc_q_close\n")); + memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); } /******************************************************************* @@ -134,3 +180,48 @@ void svc_io_r_close(char *desc, SVC_R_CLOSE *r_u, prs_struct *ps, int depth) prs_uint32("status", ps, depth, &(r_u->status)); } +#if 0 +/******************************************************************* +reads or writes a SEC_DESC_BUF structure. +********************************************************************/ +void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) +{ + uint32 off_len; + uint32 old_offset; + uint32 size; + + if (sec == NULL) return; + + prs_debug(ps, depth, desc, "sec_io_desc_buf"); + depth++; + + prs_align(ps); + + prs_uint32_pre("max_len", ps, depth, &(sec->max_len), &off_max_len); + + old_offset = ps->offset; + + if (sec->len != 0 && ps->io) + { + /* reading */ + sec->sec = malloc(sizeof(*sec->sec)); + ZERO_STRUCTP(sec->sec); + + if (sec->sec == NULL) + { + DEBUG(0,("INVALID SEC_DESC\n")); + ps->offset = 0xfffffffe; + return; + } + } + + /* reading, length is non-zero; writing, descriptor is non-NULL */ + if ((sec->len != 0 || (!ps->io)) && sec->sec != NULL) + { + sec_io_desc("sec ", sec->sec, ps, depth); + } + + size = ps->offset - old_offset; + prs_uint32_post("max_len", ps, depth, &(sec->max_len), off_max_len, size == 0 ? sec->max_len : size); +} +#endif -- cgit From 74576a48fdf71e4264a892fda58302053f809670 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 9 Dec 1998 16:28:04 +0000 Subject: adding some enumerate services code, client and server. (This used to be commit dacf5b152bf74cc3ee9a816911384a5eb0e77afa) --- source3/rpc_parse/parse_misc.c | 1 - source3/rpc_parse/parse_prs.c | 13 ++- source3/rpc_parse/parse_svc.c | 243 +++++++++++++++++++++++++++++++++-------- 3 files changed, 205 insertions(+), 52 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index fdc67d0905..6b3fc9415e 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -343,7 +343,6 @@ void smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "smb_io_unistr"); depth++; - prs_align(ps); prs_unistr("unistr", ps, depth, uni); } diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 75432627ab..ef327f01a1 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -237,21 +237,22 @@ BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int de BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) { char *q = mem_data(&(ps->data), ps->offset); - int i = 0; + int i = -1; uint8 *start = (uint8*)q; if (q == NULL) return False; - do + do { + i++; RW_SVAL(ps->io, q, str->buffer[i],0); q += 2; - i++; - - } while ((i < sizeof(str->buffer) / sizeof(str->buffer[0])) && + } + while ((i < sizeof(str->buffer) / sizeof(str->buffer[0])) && (str->buffer[i] != 0)); - ps->offset += i*2; + + ps->offset += (i+1)*2; dump_data(5+depth, (char *)start, i * 2); diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c index 2134d86f47..2ebab5aea5 100644 --- a/source3/rpc_parse/parse_svc.c +++ b/source3/rpc_parse/parse_svc.c @@ -134,6 +134,204 @@ void svc_io_q_enum_svcs_status(char *desc, SVC_Q_ENUM_SVCS_STATUS *q_u, prs_str smb_io_enum_hnd("resume_hnd", &(q_u->resume_hnd), ps, depth); } +/******************************************************************* +makes an SVC_R_ENUM_SVCS_STATUS structure. +********************************************************************/ +void make_svc_r_enum_svcs_status(SVC_R_ENUM_SVCS_STATUS *r_c, + ENUM_SRVC_STATUS *svcs, uint32 more_buf_size, + uint32 num_svcs, uint32 resume_hnd, + uint32 dos_status) +{ + if (r_c == NULL) return; + + DEBUG(5,("make_svc_r_enum_svcs_status\n")); + + r_c->svcs = svcs; + r_c->more_buf_size = more_buf_size; + r_c->num_svcs = num_svcs; + make_enum_hnd(&r_c->resume_hnd, resume_hnd); + r_c->dos_status = dos_status; +} + +/******************************************************************* +reads or writes a SVC_R_ENUM_SVCS_STATUS structure. + +this is another wierd structure. WHY oh WHY can the microsoft teams +not COMMUNICATE and get some CONSISTENCY TO THEIR DATA STRUCTURES! +ARGH! + +********************************************************************/ +void svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_struct *ps, int depth) +{ + int i; + if (svc == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_r_enum_svcs_status"); + depth++; + + prs_align(ps); + + /* + * format is actually as laid out in SVC_R_ENUM_SVCS_STATUS. + * the reason for all the jumping about, which is horrible + * and can be avoided, is due to the use of offsets instead + * of pointers. + * + * if i ever find out that these offsets are in fact non-zero + * tokens just like pointer-tokens, i am going to go MAD. + */ + + if (ps->io) + { + /* reading */ + + uint32 buf_offset; + uint32 new_offset; + + prs_uint32("buf_size", ps, depth, &(svc->buf_size)); + + buf_offset = ps->offset; + ps->offset = buf_offset + svc->buf_size; + + prs_uint32("more_buf_size", ps, depth, &(svc->more_buf_size)); + prs_uint32("num_svcs", ps, depth, &(svc->num_svcs)); + smb_io_enum_hnd("resume_hnd", &(svc->resume_hnd), ps, depth); + prs_uint32("dos_status", ps, depth, &(svc->dos_status)); + + new_offset = ps->offset; + ps->offset = buf_offset; + + svc->svcs = Realloc(NULL, svc->num_svcs * sizeof(ENUM_SRVC_STATUS)); + + if (svc->svcs == NULL) + { + DEBUG(0,("svc_io_r_enum_svcs_status: Realloc failed\n")); + ps->offset = 0x7fffffff; + return; + } + + bzero(svc->svcs, svc->num_svcs * sizeof(ENUM_SRVC_STATUS)); + + for (i = 0; i < svc->num_svcs; i++) + { + fstring name; + uint32 old_offset; + uint32 srvc_offset; + uint32 disp_offset; + + prs_uint32("srvc_offset", ps, depth, &srvc_offset); + prs_uint32("disp_offset", ps, depth, &disp_offset); + svc_io_svc_status("status", &svc->svcs[i].status, ps, depth); + + old_offset = ps->offset; + + ps->offset = buf_offset + srvc_offset; + slprintf(name, sizeof(name)-1, "srvc[%02d]", i); + smb_io_unistr(name, &svc->svcs[i].uni_srvc_name, ps, depth); + + ps->offset = buf_offset + disp_offset; + slprintf(name, sizeof(name)-1, "disp[%02d]", i); + smb_io_unistr(name, &svc->svcs[i].uni_disp_name, ps, depth); + + ps->offset = old_offset; + } + + ps->offset = new_offset; + } + else + { + /* writing */ + + uint32 buf_offset; + uint32 old_buf_offset; + uint32 srvc_offset = 9 * sizeof(uint32) * svc->num_svcs; + + prs_uint32_pre("buf_size", ps, depth, &svc->buf_size, &buf_offset); + old_buf_offset = ps->offset; + + srvc_offset += old_buf_offset; + + if (svc->svcs == NULL) + { + return; + } + + for (i = 0; i < svc->num_svcs; i++) + { + fstring name; + uint32 old_offset; + + /* + * store unicode string offset and unicode string + */ + + srvc_offset -= old_buf_offset; + prs_uint32("srvc_offset", ps, depth, &srvc_offset); + srvc_offset += old_buf_offset; + + slprintf(name, sizeof(name)-1, "srvc[%02d]", i); + + old_offset = ps->offset; + ps->offset = srvc_offset; + smb_io_unistr(name, &svc->svcs[i].uni_srvc_name, ps, depth); + srvc_offset = ps->offset; + ps->offset = old_offset; + + /* + * store unicode string offset and unicode string + */ + + srvc_offset -= old_buf_offset; + prs_uint32("disp_offset", ps, depth, &srvc_offset); + srvc_offset += old_buf_offset; + + slprintf(name, sizeof(name)-1, "disp[%02d]", i); + + old_offset = ps->offset; + ps->offset = srvc_offset; + smb_io_unistr(name, &svc->svcs[i].uni_disp_name, ps, depth); + srvc_offset = ps->offset; + ps->offset = old_offset; + + /* + * store status info + */ + + svc_io_svc_status("status", &svc->svcs[i].status, ps, depth); + } + + prs_uint32_post("buf_size", ps, depth, &svc->buf_size, buf_offset, srvc_offset - buf_offset - sizeof(uint32)); + + ps->offset = srvc_offset; + + prs_uint32("more_buf_size", ps, depth, &(svc->more_buf_size)); + prs_uint32("num_svcs", ps, depth, &(svc->num_svcs)); + smb_io_enum_hnd("resume_hnd", &(svc->resume_hnd), ps, depth); + prs_uint32("dos_status", ps, depth, &(svc->dos_status)); + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void svc_io_svc_status(char *desc, SVC_STATUS *svc, prs_struct *ps, int depth) +{ + if (svc == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_svc_status"); + depth++; + + prs_align(ps); + + prs_uint32("svc_type", ps, depth, &(svc->svc_type)); + prs_uint32("current_state", ps, depth, &(svc->current_state)); + prs_uint32("controls_accepted", ps, depth, &(svc->controls_accepted)); + prs_uint32("win32_exit_code", ps, depth, &(svc->win32_exit_code)); + prs_uint32("svc_specific_exit_code", ps, depth, &(svc->svc_specific_exit_code)); + prs_uint32("check_point", ps, depth, &(svc->check_point)); + prs_uint32("wait_hint", ps, depth, &(svc->wait_hint)); +} + /******************************************************************* makes an SVC_Q_CLOSE structure. ********************************************************************/ @@ -180,48 +378,3 @@ void svc_io_r_close(char *desc, SVC_R_CLOSE *r_u, prs_struct *ps, int depth) prs_uint32("status", ps, depth, &(r_u->status)); } -#if 0 -/******************************************************************* -reads or writes a SEC_DESC_BUF structure. -********************************************************************/ -void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) -{ - uint32 off_len; - uint32 old_offset; - uint32 size; - - if (sec == NULL) return; - - prs_debug(ps, depth, desc, "sec_io_desc_buf"); - depth++; - - prs_align(ps); - - prs_uint32_pre("max_len", ps, depth, &(sec->max_len), &off_max_len); - - old_offset = ps->offset; - - if (sec->len != 0 && ps->io) - { - /* reading */ - sec->sec = malloc(sizeof(*sec->sec)); - ZERO_STRUCTP(sec->sec); - - if (sec->sec == NULL) - { - DEBUG(0,("INVALID SEC_DESC\n")); - ps->offset = 0xfffffffe; - return; - } - } - - /* reading, length is non-zero; writing, descriptor is non-NULL */ - if ((sec->len != 0 || (!ps->io)) && sec->sec != NULL) - { - sec_io_desc("sec ", sec->sec, ps, depth); - } - - size = ps->offset - old_offset; - prs_uint32_post("max_len", ps, depth, &(sec->max_len), off_max_len, size == 0 ? sec->max_len : size); -} -#endif -- cgit From 3cc7e2936a69ba864817e1636439722933d8475e Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 9 Dec 1998 23:16:37 +0000 Subject: adding svcctl parsing code (This used to be commit c6f2f58c74cd79d84ec4a7802882da07a9af80d4) --- source3/rpc_parse/parse_svc.c | 186 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 186 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c index 2ebab5aea5..912582f35e 100644 --- a/source3/rpc_parse/parse_svc.c +++ b/source3/rpc_parse/parse_svc.c @@ -95,6 +95,131 @@ void svc_io_r_open_sc_man(char *desc, SVC_R_OPEN_SC_MAN *r_u, prs_struct *ps, i prs_uint32("status ", ps, depth, &(r_u->status)); } +/******************************************************************* + make_svc_q_open_service + ********************************************************************/ +void make_svc_q_open_service(SVC_Q_OPEN_SERVICE *q_u, + POLICY_HND *hnd, + char *server, + uint32 des_access) +{ + DEBUG(5,("make_svc_q_open_service\n")); + + memcpy(&(q_u->scman_pol), hnd, sizeof(q_u->scman_pol)); + make_unistr2(&(q_u->uni_srv_name), server, strlen(server)+1); + q_u->des_access = des_access; + +} + +/******************************************************************* +reads or writes a SVC_Q_OPEN_SERVICE structure. +********************************************************************/ +void svc_io_q_open_service(char *desc, SVC_Q_OPEN_SERVICE *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_q_open_service"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(q_u->scman_pol), ps, depth); + prs_align(ps); + + smb_io_unistr2("", &(q_u->uni_srv_name), 1, ps, depth); + prs_align(ps); + + prs_uint32("des_access", ps, depth, &(q_u->des_access)); + prs_align(ps); +} + +/******************************************************************* + make_svc_r_open_service + ********************************************************************/ +void make_svc_r_open_service(SVC_R_OPEN_SERVICE *r_u, POLICY_HND *hnd, + uint32 status) +{ + DEBUG(5,("make_svc_r_unknown_0: %d\n", __LINE__)); + + memcpy(&(r_u->pol), hnd, sizeof(r_u->pol)); + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void svc_io_r_open_service(char *desc, SVC_R_OPEN_SERVICE *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_r_open_service"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_u->pol), ps, depth); + + prs_uint32("status ", ps, depth, &(r_u->status)); +} + +/******************************************************************* + make_svc_query_svc_cfg + ********************************************************************/ +void make_svc_query_svc_cfg(QUERY_SERVICE_CONFIG *q_u, + uint32 service_type, uint32 start_type, + uint32 error_control, + char* bin_path_name, char* load_order_grp, + uint32 tag_id, + char* dependencies, char* service_start_name, + char* disp_name) +{ + DEBUG(5,("make_svc_query_svc_cfg\n")); + + q_u->service_type = service_type; + q_u->start_type = start_type; + q_u->error_control = error_control; + make_buf_unistr2(&(q_u->uni_bin_path_name ), &(q_u->ptr_bin_path_name ), bin_path_name ); + make_buf_unistr2(&(q_u->uni_load_order_grp ), &(q_u->ptr_load_order_grp ), load_order_grp ); + q_u->tag_id = tag_id; + make_buf_unistr2(&(q_u->uni_dependencies ), &(q_u->ptr_dependencies ), dependencies ); + make_buf_unistr2(&(q_u->uni_service_start_name), &(q_u->ptr_service_start_name), service_start_name); + make_buf_unistr2(&(q_u->uni_display_name ), &(q_u->ptr_display_name ), disp_name ); +} + +/******************************************************************* +reads or writes a QUERY_SERVICE_CONFIG structure. +********************************************************************/ +void svc_io_query_svc_cfg(char *desc, QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_query_svc_cfg"); + depth++; + + prs_align(ps); + + prs_uint32("service_type ", ps, depth, &(q_u->service_type )); + prs_uint32("start_type ", ps, depth, &(q_u->start_type )); + prs_uint32("error_control ", ps, depth, &(q_u->error_control )); + prs_uint32("ptr_bin_path_name ", ps, depth, &(q_u->ptr_bin_path_name )); + prs_uint32("ptr_load_order_grp ", ps, depth, &(q_u->ptr_load_order_grp )); + prs_uint32("tag_id ", ps, depth, &(q_u->tag_id )); + prs_uint32("ptr_dependencies ", ps, depth, &(q_u->ptr_dependencies )); + prs_uint32("ptr_service_start_name", ps, depth, &(q_u->ptr_service_start_name)); + prs_uint32("ptr_display_name ", ps, depth, &(q_u->ptr_display_name )); + + smb_io_unistr2("uni_bin_path_name ", &(q_u->uni_bin_path_name ), q_u->ptr_bin_path_name , ps, depth); + prs_align(ps); + smb_io_unistr2("uni_load_order_grp ", &(q_u->uni_load_order_grp ), q_u->ptr_load_order_grp , ps, depth); + prs_align(ps); + smb_io_unistr2("uni_dependencies ", &(q_u->uni_dependencies ), q_u->ptr_dependencies , ps, depth); + prs_align(ps); + smb_io_unistr2("uni_service_start_name", &(q_u->uni_service_start_name), q_u->ptr_service_start_name, ps, depth); + prs_align(ps); + smb_io_unistr2("uni_display_name ", &(q_u->uni_display_name ), q_u->ptr_display_name , ps, depth); + prs_align(ps); +} + /******************************************************************* makes an SVC_Q_ENUM_SVCS_STATUS structure. ********************************************************************/ @@ -332,6 +457,67 @@ void svc_io_svc_status(char *desc, SVC_STATUS *svc, prs_struct *ps, int depth) prs_uint32("wait_hint", ps, depth, &(svc->wait_hint)); } +/******************************************************************* +makes an SVC_Q_QUERY_SVC_CONFIG structure. +********************************************************************/ +void make_svc_q_query_svc_config(SVC_Q_QUERY_SVC_CONFIG *q_c, POLICY_HND *hnd, + uint32 buf_size) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_svc_q_query_svc_config\n")); + + memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); + q_c->buf_size = buf_size; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void svc_io_q_query_svc_config(char *desc, SVC_Q_QUERY_SVC_CONFIG *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_q_query_svc_config"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(q_u->pol), ps, depth); + prs_align(ps); + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); +} + +/******************************************************************* +makes an SVC_R_QUERY_SVC_CONFIG structure. +********************************************************************/ +void make_svc_r_query_svc_config(SVC_R_QUERY_SVC_CONFIG *r_c, + uint32 buf_size) +{ + if (r_c == NULL) return; + + DEBUG(5,("make_svc_r_query_svc_config\n")); + + r_c->buf_size = buf_size; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void svc_io_r_query_svc_config(char *desc, SVC_R_QUERY_SVC_CONFIG *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_r_query_svc_config"); + depth++; + + prs_align(ps); + + svc_io_query_svc_cfg("cfg", r_u->cfg, ps, depth); + prs_uint32("buf_size", ps, depth, &(r_u->buf_size)); + prs_uint32("status ", ps, depth, &(r_u->status )); +} + /******************************************************************* makes an SVC_Q_CLOSE structure. ********************************************************************/ -- cgit From 0504d696f811399ba550be90d9e99be062c78327 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 20 Dec 1998 00:37:24 +0000 Subject: fix for potential lsass.exe crashing due to negative response from LsaLookupNames being incorrect. this is a bit wierd: why would the lsass.exe on the nt _client_ crash due to an LsaLookupNames response from a samba _server_? (This used to be commit a15a3f95f2a14ab164ca758e2145444a803190b2) --- source3/rpc_parse/parse_lsa.c | 50 +++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 0b294b84f3..239c0847af 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -73,40 +73,44 @@ static void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int de prs_uint32("undoc_buffer ", ps, depth, &(r_r->undoc_buffer )); /* undocumented buffer pointer. */ prs_uint32("num_ref_doms_1", ps, depth, &(r_r->num_ref_doms_1)); /* num referenced domains? */ - prs_uint32("undoc_buffer2 ", ps, depth, &(r_r->undoc_buffer2 )); /* undocumented buffer pointer. */ + prs_uint32("ptr_ref_dom ", ps, depth, &(r_r->ptr_ref_dom )); /* undocumented buffer pointer. */ prs_uint32("max_entries ", ps, depth, &(r_r->max_entries )); /* 32 - max number of entries */ - prs_uint32("num_ref_doms_2", ps, depth, &(r_r->num_ref_doms_2)); /* 4 - num referenced domains? */ SMB_ASSERT_ARRAY(r_r->hdr_ref_dom, r_r->num_ref_doms_1); - SMB_ASSERT_ARRAY(r_r->ref_dom, r_r->num_ref_doms_2); - for (i = 0; i < r_r->num_ref_doms_1; i++) + if (r_r->ptr_ref_dom != 0) { - fstring t; + prs_uint32("num_ref_doms_2", ps, depth, &(r_r->num_ref_doms_2)); /* 4 - num referenced domains? */ + SMB_ASSERT_ARRAY(r_r->ref_dom, r_r->num_ref_doms_2); - slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i); - smb_io_unihdr(t, &(r_r->hdr_ref_dom[i].hdr_dom_name), ps, depth); - - slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i); - prs_uint32(t, ps, depth, &(r_r->hdr_ref_dom[i].ptr_dom_sid)); - } - - for (i = 0, n = 0, s = 0; i < r_r->num_ref_doms_2; i++) - { - fstring t; - - if (r_r->hdr_ref_dom[i].hdr_dom_name.buffer != 0) + for (i = 0; i < r_r->num_ref_doms_1; i++) { + fstring t; + slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i); - smb_io_unistr2(t, &(r_r->ref_dom[n].uni_dom_name), True, ps, depth); /* domain name unicode string */ - n++; + smb_io_unihdr(t, &(r_r->hdr_ref_dom[i].hdr_dom_name), ps, depth); + + slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i); + prs_uint32(t, ps, depth, &(r_r->hdr_ref_dom[i].ptr_dom_sid)); } - if (r_r->hdr_ref_dom[i].ptr_dom_sid != 0) + for (i = 0, n = 0, s = 0; i < r_r->num_ref_doms_2; i++) { - slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i); - smb_io_dom_sid2("", &(r_r->ref_dom[s].ref_dom), ps, depth); /* referenced domain SIDs */ - s++; + fstring t; + + if (r_r->hdr_ref_dom[i].hdr_dom_name.buffer != 0) + { + slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i); + smb_io_unistr2(t, &(r_r->ref_dom[n].uni_dom_name), True, ps, depth); /* domain name unicode string */ + n++; + } + + if (r_r->hdr_ref_dom[i].ptr_dom_sid != 0) + { + slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i); + smb_io_dom_sid2("", &(r_r->ref_dom[s].ref_dom), ps, depth); /* referenced domain SIDs */ + s++; + } } } } -- cgit From 6b7e1ead37b8655cf3cfb52a421461cedb3d0c90 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 28 Jan 1999 21:11:15 +0000 Subject: rpcclient "Service Control Manager" svcenum [-i] command. (This used to be commit a022710f1e3996ecbe6bbe035e1df0bc4c050b34) --- source3/rpc_parse/parse_svc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c index 912582f35e..9c1f0f3335 100644 --- a/source3/rpc_parse/parse_svc.c +++ b/source3/rpc_parse/parse_svc.c @@ -106,7 +106,7 @@ void make_svc_q_open_service(SVC_Q_OPEN_SERVICE *q_u, DEBUG(5,("make_svc_q_open_service\n")); memcpy(&(q_u->scman_pol), hnd, sizeof(q_u->scman_pol)); - make_unistr2(&(q_u->uni_srv_name), server, strlen(server)+1); + make_unistr2(&(q_u->uni_svc_name), server, strlen(server)+1); q_u->des_access = des_access; } @@ -126,7 +126,7 @@ void svc_io_q_open_service(char *desc, SVC_Q_OPEN_SERVICE *q_u, prs_struct *ps, smb_io_pol_hnd("", &(q_u->scman_pol), ps, depth); prs_align(ps); - smb_io_unistr2("", &(q_u->uni_srv_name), 1, ps, depth); + smb_io_unistr2("", &(q_u->uni_svc_name), 1, ps, depth); prs_align(ps); prs_uint32("des_access", ps, depth, &(q_u->des_access)); @@ -492,12 +492,14 @@ void svc_io_q_query_svc_config(char *desc, SVC_Q_QUERY_SVC_CONFIG *q_u, prs_str makes an SVC_R_QUERY_SVC_CONFIG structure. ********************************************************************/ void make_svc_r_query_svc_config(SVC_R_QUERY_SVC_CONFIG *r_c, + QUERY_SERVICE_CONFIG *cfg, uint32 buf_size) { if (r_c == NULL) return; DEBUG(5,("make_svc_r_query_svc_config\n")); + r_c->cfg = cfg; r_c->buf_size = buf_size; } -- cgit From 9b5043cb2f125c39eda1e986cfcce3b534dc3b43 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 29 Jan 1999 21:22:08 +0000 Subject: fix for enumerate domain users (bug spotted by sean matthews). also needed to use start index properly and generate next index. both client and server code need to recognise error code 0x105 when there's not enough room to store all the users in one call. sort this out another time. (This used to be commit ad58cdfac6b85d9431216e32e532ad4d60f9c6dd) --- source3/rpc_parse/parse_samr.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index f4c1790254..1fcb57c435 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -871,7 +871,7 @@ static void sam_io_sam_entry(char *desc, SAM_ENTRY *sam, prs_struct *ps, int de makes a SAMR_Q_ENUM_DOM_USERS structure. ********************************************************************/ void make_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_e, POLICY_HND *pol, - uint16 req_num_entries, uint16 unk_0, + uint32 start_idx, uint16 acb_mask, uint16 unk_1, uint32 size) { if (q_e == NULL || pol == NULL) return; @@ -880,8 +880,7 @@ void make_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_e, POLICY_HND *pol, memcpy(&(q_e->pol), pol, sizeof(*pol)); - q_e->req_num_entries = req_num_entries; /* zero indicates lots */ - q_e->unknown_0 = unk_0; /* this gets returned in the response */ + q_e->start_idx = start_idx; /* zero indicates lots */ q_e->acb_mask = acb_mask; q_e->unknown_1 = unk_1; q_e->max_size = size; @@ -902,13 +901,11 @@ void samr_io_q_enum_dom_users(char *desc, SAMR_Q_ENUM_DOM_USERS *q_e, prs_struc smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); prs_align(ps); - prs_uint16("req_num_entries", ps, depth, &(q_e->req_num_entries)); - prs_uint16("unknown_0 ", ps, depth, &(q_e->unknown_0 )); - - prs_uint16("acb_mask ", ps, depth, &(q_e->acb_mask )); - prs_uint16("unknown_1 ", ps, depth, &(q_e->unknown_1 )); + prs_uint32("start_idx", ps, depth, &(q_e->start_idx)); + prs_uint16("acb_mask ", ps, depth, &(q_e->acb_mask )); + prs_uint16("unknown_1", ps, depth, &(q_e->unknown_1)); - prs_uint32("max_size ", ps, depth, &(q_e->max_size )); + prs_uint32("max_size ", ps, depth, &(q_e->max_size )); prs_align(ps); } @@ -918,7 +915,7 @@ void samr_io_q_enum_dom_users(char *desc, SAMR_Q_ENUM_DOM_USERS *q_e, prs_struc makes a SAMR_R_ENUM_DOM_USERS structure. ********************************************************************/ void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, - uint32 unk_0, + uint32 next_idx, uint32 num_sam_entries, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES], uint32 status) { int i; @@ -934,7 +931,7 @@ void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, num_sam_entries)); } - r_u->unknown_0 = unk_0; + r_u->next_idx = next_idx; if (num_sam_entries != 0) { @@ -981,7 +978,7 @@ void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struc prs_align(ps); - prs_uint32("unknown_0 ", ps, depth, &(r_u->unknown_0 )); + prs_uint32("next_idx ", ps, depth, &(r_u->next_idx )); prs_uint32("ptr_entries1", ps, depth, &(r_u->ptr_entries1)); if (r_u->ptr_entries1 != 0) -- cgit From c80c2e0d9efaf823448d214da448b27ea1cbb863 Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Mon, 1 Feb 1999 02:39:37 +0000 Subject: Initialise NTTIME properly in make_reg_q_enum_key instead of using unix_to_nt_time hack. Seems to me it's ignored anyway (dummy return buffer?). (This used to be commit 1e3873111faf352ef14a098eff250b505ab0b800) --- source3/rpc_parse/parse_reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index ff57535caf..3365a68b3d 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1021,7 +1021,7 @@ void make_reg_q_enum_key(REG_Q_ENUM_KEY *q_i, POLICY_HND *pol, uint32 key_idx) memset(q_i->pad2, 0, sizeof(q_i->pad2)); q_i->ptr3 = 1; - unix_to_nt_time(&q_i->time, 0); /* current time? */ + init_nt_time(&(q_i->time)); /* ignored ? */ } /******************************************************************* -- cgit From 1153f00f889e5bb310e895d319eed75bc93deef4 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 3 Feb 1999 00:49:24 +0000 Subject: cache unix groups so that two-level getgrent calls don't occur. (This used to be commit f7dfa55a2e191ae780d399026bce48f68cda4bf0) --- source3/rpc_parse/parse_reg.c | 5 ++--- source3/rpc_parse/parse_samr.c | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 3365a68b3d..b0086f402a 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -766,7 +766,6 @@ creates a structure. ********************************************************************/ void make_reg_r_info(REG_R_INFO *r_r, uint32 level, char *os_type, - uint32 unknown_0, uint32 unknown_1, uint32 status) { uint8 buf[512]; @@ -779,10 +778,10 @@ void make_reg_r_info(REG_R_INFO *r_r, make_buffer2(&(r_r->uni_type), buf, len*2); r_r->ptr2 = 1; - r_r->unknown_0 = unknown_0; + r_r->unknown_0 = len*2; r_r->ptr3 = 1; - r_r->unknown_1 = unknown_1; + r_r->unknown_1 = len*2; r_r->status = status; } diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 1fcb57c435..cadeffdfd0 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1232,7 +1232,7 @@ void make_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO *r_u, { if (r_u == NULL) return; - DEBUG(5,("make_samr_r_query_dispinfo\n")); + DEBUG(5,("make_samr_r_query_dispinfo: level %d\n", switch_level)); if (status == 0x0) { @@ -1910,7 +1910,7 @@ void make_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM *r_u, if (status == 0x0) { - r_u->ptr = (num_entries != 0) ? 1 : 0; + r_u->ptr = 1; r_u->num_entries = num_entries; r_u->ptr_attrs = attr != NULL ? 1 : 0; -- cgit From 99a9b0f7c4f85f46102457cf4707e8948b77fb3f Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 8 Feb 1999 23:40:49 +0000 Subject: UNICODE byte ordering issue: typecast to uint16* replaced with SSVAL() (This used to be commit 9084b7e33dfe717bd8d5604ee71d137e3baef0f5) --- source3/rpc_parse/parse_misc.c | 6 +++--- source3/rpc_parse/parse_reg.c | 4 ++-- source3/rpc_parse/parse_rpc.c | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 6b3fc9415e..e1a7d3c6a5 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -329,7 +329,7 @@ creates a UNISTR structure. void make_unistr(UNISTR *str, char *buf) { /* store the string (null-terminated copy) */ - struni2(str->buffer, buf); + struni2((char *)(str->buffer), buf); } /******************************************************************* @@ -372,7 +372,7 @@ void make_buffer3_str(BUFFER3 *str, char *buf, int len) str->buf_len = len * 2; /* store the string (null-terminated 8 bit chars into 16 bit chars) */ - struni2((uint16*)str->buffer, buf); + struni2(str->buffer, buf); } /******************************************************************* @@ -573,7 +573,7 @@ void make_unistr2(UNISTR2 *str, char *buf, int len) str->uni_str_len = len; /* store the string (null-terminated 8 bit chars into 16 bit chars) */ - struni2(str->buffer, buf); + struni2((char *)(str->buffer), buf); } /******************************************************************* diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index b0086f402a..a3d8ebb64a 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -768,8 +768,8 @@ void make_reg_r_info(REG_R_INFO *r_r, uint32 level, char *os_type, uint32 status) { - uint8 buf[512]; - int len = struni2((uint16*)buf, os_type); + char buf[512]; + int len = struni2(buf, os_type); r_r->ptr1 = 1; r_r->level = level; diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 9ce83bea83..12e94ace77 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -707,9 +707,9 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { - struni2((uint16*)rsp->domain, domain); - struni2((uint16*)rsp->user , user ); - struni2((uint16*)rsp->wks , wks ); + struni2(rsp->domain, domain); + struni2(rsp->user , user ); + struni2(rsp->wks , wks ); } else { -- cgit From 748f296a76a76d38525ad35df6658811cae60222 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 9 Feb 1999 19:51:44 +0000 Subject: removal of the use of unistrn2 function: replace it with unistr2_to_str which is more appropriate. (This used to be commit ac72fe1ab3d10f64a5945ccbd4ed3817e30f9f7b) --- source3/rpc_parse/parse_lsa.c | 5 +++-- source3/rpc_parse/parse_misc.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 239c0847af..cb88e71536 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -688,9 +688,10 @@ void make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, for (i = 0; i < num_names; i++) { - int len = strlen(names[i]); + const char* name = names[i]; + int len = strlen(name); make_uni_hdr(&q_l->hdr_name[i], len, len, len != 0); - make_unistr2(&q_l->uni_name[i], names[i], len); + make_unistr2(&q_l->uni_name[i], name, len); } q_l->num_trans_entries = 0; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index e1a7d3c6a5..bf3bba1249 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -563,7 +563,7 @@ void smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, i /******************************************************************* creates a UNISTR2 structure. ********************************************************************/ -void make_unistr2(UNISTR2 *str, char *buf, int len) +void make_unistr2(UNISTR2 *str, const char *buf, int len) { ZERO_STRUCTP(str); @@ -573,7 +573,7 @@ void make_unistr2(UNISTR2 *str, char *buf, int len) str->uni_str_len = len; /* store the string (null-terminated 8 bit chars into 16 bit chars) */ - struni2((char *)(str->buffer), buf); + struni2((char*)(str->buffer), buf); } /******************************************************************* -- cgit From c6d16eea4394ff1c4d12cb435eebb0686b5ee736 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 11 Feb 1999 18:50:13 +0000 Subject: the UNICODE issue... (This used to be commit 73db80f34183324845407b00f58462ff2d7b47ea) --- source3/rpc_parse/parse_misc.c | 6 +++--- source3/rpc_parse/parse_reg.c | 2 +- source3/rpc_parse/parse_rpc.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index bf3bba1249..7c3f446908 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -329,7 +329,7 @@ creates a UNISTR structure. void make_unistr(UNISTR *str, char *buf) { /* store the string (null-terminated copy) */ - struni2((char *)(str->buffer), buf); + str_to_unistr16(str->buffer, buf); } /******************************************************************* @@ -372,7 +372,7 @@ void make_buffer3_str(BUFFER3 *str, char *buf, int len) str->buf_len = len * 2; /* store the string (null-terminated 8 bit chars into 16 bit chars) */ - struni2(str->buffer, buf); + str_to_unistr8(str->buffer, buf); } /******************************************************************* @@ -573,7 +573,7 @@ void make_unistr2(UNISTR2 *str, const char *buf, int len) str->uni_str_len = len; /* store the string (null-terminated 8 bit chars into 16 bit chars) */ - struni2((char*)(str->buffer), buf); + str_to_unistr16((str->buffer), buf); } /******************************************************************* diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index a3d8ebb64a..84d9650105 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -769,7 +769,7 @@ void make_reg_r_info(REG_R_INFO *r_r, uint32 status) { char buf[512]; - int len = struni2(buf, os_type); + int len = str_to_unistr8(buf, os_type); r_r->ptr1 = 1; r_r->level = level; diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 12e94ace77..63f738466b 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -707,9 +707,9 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { - struni2(rsp->domain, domain); - struni2(rsp->user , user ); - struni2(rsp->wks , wks ); + str_to_unistr8(rsp->domain, domain); + str_to_unistr8(rsp->user , user ); + str_to_unistr8(rsp->wks , wks ); } else { -- cgit From fd96929ec1fa27e0affd4c4e9ba307c4ee30b978 Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Fri, 12 Feb 1999 00:16:09 +0000 Subject: UNICODE cleanup (see lib/util_unistr.c). No more ugly static library buffers and all functions take a destination string length (especially unistrcpy was rather dangerous; we were only saved by the fact that datagrams are limited in size). (This used to be commit a1d39af1ce1d451b811dbd7c2ba391214851b87e) --- source3/rpc_parse/parse_misc.c | 11 +++++------ source3/rpc_parse/parse_reg.c | 10 ++++++---- source3/rpc_parse/parse_rpc.c | 6 +++--- 3 files changed, 14 insertions(+), 13 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 7c3f446908..04a9ba4544 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -328,8 +328,7 @@ creates a UNISTR structure. ********************************************************************/ void make_unistr(UNISTR *str, char *buf) { - /* store the string (null-terminated copy) */ - str_to_unistr16(str->buffer, buf); + ascii_to_unistr(str->buffer, buf, sizeof(str->buffer)); } /******************************************************************* @@ -371,8 +370,8 @@ void make_buffer3_str(BUFFER3 *str, char *buf, int len) str->buf_max_len = len * 2; str->buf_len = len * 2; - /* store the string (null-terminated 8 bit chars into 16 bit chars) */ - str_to_unistr8(str->buffer, buf); + /* store the string (little endian buffer) */ + ascii_to_unibuf(str->buffer, buf, str->buf_len); } /******************************************************************* @@ -572,8 +571,8 @@ void make_unistr2(UNISTR2 *str, const char *buf, int len) str->undoc = 0; str->uni_str_len = len; - /* store the string (null-terminated 8 bit chars into 16 bit chars) */ - str_to_unistr16((str->buffer), buf); + /* store the string (wide chars) */ + ascii_to_unistr(str->buffer, buf, len); } /******************************************************************* diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 84d9650105..3aa9bbbc2a 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -769,19 +769,21 @@ void make_reg_r_info(REG_R_INFO *r_r, uint32 status) { char buf[512]; - int len = str_to_unistr8(buf, os_type); + int len; + + len = ascii_to_unibuf(buf, os_type, sizeof(buf)) - buf; r_r->ptr1 = 1; r_r->level = level; r_r->ptr_type = 1; - make_buffer2(&(r_r->uni_type), buf, len*2); + make_buffer2(&(r_r->uni_type), buf, len); r_r->ptr2 = 1; - r_r->unknown_0 = len*2; + r_r->unknown_0 = len; r_r->ptr3 = 1; - r_r->unknown_1 = len*2; + r_r->unknown_1 = len; r_r->status = status; } diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 63f738466b..c4a7e35895 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -707,9 +707,9 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { - str_to_unistr8(rsp->domain, domain); - str_to_unistr8(rsp->user , user ); - str_to_unistr8(rsp->wks , wks ); + ascii_to_unibuf(rsp->domain, domain, sizeof(rsp->domain)); + ascii_to_unibuf(rsp->user , user , sizeof(rsp->user )); + ascii_to_unibuf(rsp->wks , wks , sizeof(rsp->wks )); } else { -- cgit From 2737f26ad64ee32d6ef7365dcce0a3eb881f99db Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Mon, 15 Feb 1999 05:33:30 +0000 Subject: Always null-terminate strings. Also some string length and sizeof(pointer) corrections. (This used to be commit ce24191939b82985d09eabe945199f38b0fea486) --- source3/rpc_parse/parse_misc.c | 2 +- source3/rpc_parse/parse_reg.c | 2 +- source3/rpc_parse/parse_rpc.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 04a9ba4544..12501a5e57 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -328,7 +328,7 @@ creates a UNISTR structure. ********************************************************************/ void make_unistr(UNISTR *str, char *buf) { - ascii_to_unistr(str->buffer, buf, sizeof(str->buffer)); + ascii_to_unistr(str->buffer, buf, sizeof(str->buffer)-1); } /******************************************************************* diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 3aa9bbbc2a..8072ed2a64 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -771,7 +771,7 @@ void make_reg_r_info(REG_R_INFO *r_r, char buf[512]; int len; - len = ascii_to_unibuf(buf, os_type, sizeof(buf)) - buf; + len = ascii_to_unibuf(buf, os_type, sizeof(buf)-2) - buf; r_r->ptr1 = 1; r_r->level = level; diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index c4a7e35895..9716b35b78 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -707,9 +707,9 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { - ascii_to_unibuf(rsp->domain, domain, sizeof(rsp->domain)); - ascii_to_unibuf(rsp->user , user , sizeof(rsp->user )); - ascii_to_unibuf(rsp->wks , wks , sizeof(rsp->wks )); + ascii_to_unibuf(rsp->domain, domain, sizeof(rsp->domain)-2); + ascii_to_unibuf(rsp->user , user , sizeof(rsp->user )-2); + ascii_to_unibuf(rsp->wks , wks , sizeof(rsp->wks )-2); } else { -- cgit From 52fb07aea26cc3041e571fafdc843622f1741a19 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 16 Feb 1999 18:04:21 +0000 Subject: rpcclient shutdown command (This used to be commit 59f081069a58f6a070ed6016c06153d5e695da93) --- source3/rpc_parse/parse_reg.c | 63 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 8072ed2a64..ecec498528 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1180,3 +1180,66 @@ void reg_io_r_open_entry(char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int prs_uint32("status", ps, depth, &(r_r->status)); } +/******************************************************************* +makes a structure. +********************************************************************/ +void make_reg_q_shutdown(REG_Q_SHUTDOWN *q_i, + char *msg, uint32 timeout, uint16 flags) +{ + int len = strlen(msg) + 1; + + if (q_i == NULL) return; + + ZERO_STRUCTP(q_i); + + q_i->ptr_0 = 1; + q_i->ptr_1 = 1; + q_i->ptr_2 = 1; + + make_uni_hdr(&q_i->hdr_msg, len, len, 1); + make_unistr2(&(q_i->uni_msg), msg, len); + + q_i->timeout = timeout; + q_i->flags = flags; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_q_shutdown(char *desc, REG_Q_SHUTDOWN *q_q, prs_struct *ps, int depth) +{ + if (q_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_q_shutdown"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_0", ps, depth, &(q_q->ptr_0)); + prs_uint32("ptr_1", ps, depth, &(q_q->ptr_1)); + prs_uint32("ptr_2", ps, depth, &(q_q->ptr_2)); + + smb_io_unihdr ("hdr_msg", &(q_q->hdr_msg), ps, depth); + smb_io_unistr2("uni_msg", &(q_q->uni_msg), q_q->hdr_msg.buffer, ps, depth); + prs_align(ps); + + prs_uint32("timeout", ps, depth, &(q_q->timeout)); + prs_uint16("flags ", ps, depth, &(q_q->flags )); + prs_align(ps); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void reg_io_r_shutdown(char *desc, REG_R_SHUTDOWN *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "reg_io_r_shutdown"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_q->status)); +} + -- cgit From b52903aefe3ab0412402ee7cff319ab4737a1658 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 18 Feb 1999 18:50:44 +0000 Subject: problem been there for months: reg_r_info not aligning after string buffer. (This used to be commit 66e2787ab7db72fb654b995280b294738e77e50a) --- source3/rpc_parse/parse_reg.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index ecec498528..4f9a9350bd 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -808,6 +808,7 @@ void reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) prs_uint32("ptr_type", ps, depth, &(r_r->ptr_type)); smb_io_buffer2("uni_type", &(r_r->uni_type), r_r->ptr_type, ps, depth); + prs_align(ps); prs_uint32("ptr2", ps, depth, &(r_r->ptr2)); -- cgit From 5c5f5445384bf1c55ad28ee7c24b2cce14744a80 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 19 Feb 1999 17:41:05 +0000 Subject: samr_lookup_names "none found" error needed corrections with empty lists. (This used to be commit e164b5080ca966de4227277f7ac031bc96d056ad) --- source3/rpc_parse/parse_samr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index cadeffdfd0..fb93925011 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3385,10 +3385,10 @@ void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p prs_uint32("num_rids1", ps, depth, &(r_u->num_rids1)); prs_uint32("ptr_rids ", ps, depth, &(r_u->ptr_rids )); - prs_uint32("num_rids2", ps, depth, &(r_u->num_rids2)); if (r_u->ptr_rids != 0 && r_u->num_rids1 != 0) { + prs_uint32("num_rids2", ps, depth, &(r_u->num_rids2)); for (i = 0; i < r_u->num_rids2; i++) { prs_grow(ps); @@ -3399,10 +3399,10 @@ void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p prs_uint32("num_types1", ps, depth, &(r_u->num_types1)); prs_uint32("ptr_types ", ps, depth, &(r_u->ptr_types )); - prs_uint32("num_types2", ps, depth, &(r_u->num_types2)); if (r_u->ptr_types != 0 && r_u->num_types1 != 0) { + prs_uint32("num_types2", ps, depth, &(r_u->num_types2)); for (i = 0; i < r_u->num_types2; i++) { prs_grow(ps); -- cgit From 1e71ecdcb21f24e70ee5edbbc05de0284fa588f4 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 23 Feb 1999 22:39:54 +0000 Subject: added jeremy's new c++-like code for parsing of security descriptors. (This used to be commit ec1b7000fd88c5a08e438c7033f60e49b9ec44a8) --- source3/rpc_parse/parse_misc.c | 9 +- source3/rpc_parse/parse_reg.c | 33 +-- source3/rpc_parse/parse_sec.c | 610 +++++++++++++++++++++++++---------------- 3 files changed, 396 insertions(+), 256 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 12501a5e57..3cffde0249 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -118,11 +118,11 @@ void smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) /******************************************************************* reads or writes a DOM_SID structure. ********************************************************************/ -void smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) +BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) { int i; - if (sid == NULL) return; + if (sid == NULL) return False; prs_debug(ps, depth, desc, "smb_io_dom_sid"); depth++; @@ -143,6 +143,8 @@ void smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) if (sid->num_auths > MAXSUBAUTHS) sid->num_auths = MAXSUBAUTHS; prs_uint32s(False, "sub_auths ", ps, depth, sid->sub_auths, sid->num_auths); + + return True; } /******************************************************************* @@ -150,7 +152,7 @@ creates a DOM_SID2 structure. ********************************************************************/ void make_dom_sid2(DOM_SID2 *sid2, DOM_SID *sid) { - sid_copy(&sid2->sid, sid); + sid2->sid = *sid; sid2->num_auths = sid2->sid.num_auths; } @@ -1048,4 +1050,3 @@ void smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth) prs_unistr3(True, "unistr", name, ps, depth); } - diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 4f9a9350bd..5512f78499 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -135,7 +135,8 @@ static void reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, SEC_DES } if (ptr3 == NULL || *ptr3 != 0) { - sec_io_desc_buf("data ", data , ps, depth); + /* JRA - this line is probably wrong... */ + sec_io_desc_buf("data ", &data , ps, depth); } smb_io_hdrbuf_post("hdr_sec", hdr_sec, ps, depth, hdr_offset, data->max_len, data->len); @@ -145,15 +146,13 @@ static void reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, SEC_DES } - /******************************************************************* creates a structure. ********************************************************************/ void make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, char *name, char *class, SEC_ACCESS *sam_access, - SEC_DESC_BUF *sec_buf, - int sec_len, SEC_DESC *sec) + SEC_DESC_BUF *sec_buf) { int len_name = name != NULL ? strlen(name ) + 1: 0; int len_class = class != NULL ? strlen(class) + 1: 0; @@ -176,9 +175,8 @@ void make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, q_c->data = sec_buf; q_c->ptr2 = 1; - make_buf_hdr(&(q_c->hdr_sec), sec_len, sec_len); + make_buf_hdr(&(q_c->hdr_sec), sec_buf->len, sec_buf->len); q_c->ptr3 = 1; - make_sec_desc_buf(q_c->data, sec_len, sec); q_c->unknown_2 = 0x00000000; } @@ -547,8 +545,8 @@ void reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) /******************************************************************* makes a structure. ********************************************************************/ -void make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, - uint32 buf_len, SEC_DESC *sec_desc) +void make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, + SEC_DESC_BUF *sec_desc_buf) { if (q_i == NULL) return; @@ -557,8 +555,8 @@ void make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, q_i->sec_info = DACL_SECURITY_INFORMATION; q_i->ptr = 1; - make_buf_hdr(&(q_i->hdr_sec), buf_len, buf_len); - make_sec_desc_buf(q_i->data, buf_len, sec_desc); + make_buf_hdr(&(q_i->hdr_sec), sec_desc_buf->len, sec_desc_buf->len); + q_i->data = sec_desc_buf; } /******************************************************************* @@ -601,7 +599,7 @@ void reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, in makes a structure. ********************************************************************/ void make_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, - uint32 buf_len, SEC_DESC_BUF *sec_buf) + uint32 sec_buf_size, SEC_DESC_BUF *psdb) { if (q_i == NULL) return; @@ -611,14 +609,10 @@ void make_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION; - q_i->ptr = sec_buf != NULL ? 1 : 0; - q_i->data = sec_buf; + q_i->ptr = psdb != NULL ? 1 : 0; + q_i->data = psdb; - if (sec_buf != NULL) - { - make_buf_hdr(&(q_i->hdr_sec), buf_len, 0); - make_sec_desc_buf(q_i->data, buf_len, NULL); - } + make_buf_hdr(&(q_i->hdr_sec), sec_buf_size, 0); } /******************************************************************* @@ -675,8 +669,7 @@ void reg_io_r_get_key_sec(char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, i if (r_q->ptr != 0) { - smb_io_hdrbuf("", &(r_q->hdr_sec), ps, depth); - sec_io_desc_buf("", r_q->data, ps, depth); + sec_io_desc_buf("", &r_q->data, ps, depth); prs_align(ps); } diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 409146901d..886b3f334a 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -2,10 +2,10 @@ * Unix SMB/Netbios implementation. * Version 1.9. * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1998, - * Copyright (C) Jeremy R. Allison 1995-1998 - * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, - * Copyright (C) Paul Ashton 1997-1998. + * Copyright (C) Andrew Tridgell 1992-1999, + * Copyright (C) Jeremy R. Allison 1995-1999 + * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, + * Copyright (C) Paul Ashton 1997-1999. * * 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 @@ -29,19 +29,24 @@ extern int DEBUGLEVEL; /******************************************************************* -makes a structure. + Sets up a SEC_ACCESS structure. ********************************************************************/ -void make_sec_access(SEC_ACCESS *t, uint32 mask) + +void init_sec_access(SEC_ACCESS *t, uint32 mask) { t->mask = mask; } /******************************************************************* -reads or writes a structure. + Reads or writes a SEC_ACCESS structure. ********************************************************************/ -void sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) + +BOOL sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) { - if (t == NULL) return; + if (t == NULL) + { + return False; + } prs_debug(ps, depth, desc, "sec_io_access"); depth++; @@ -49,30 +54,39 @@ void sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) prs_align(ps); prs_uint32("mask", ps, depth, &(t->mask)); + return True; } /******************************************************************* -makes a structure. + Sets up a SEC_ACE structure. ********************************************************************/ -void make_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 flag) + +void init_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, + uint8 flag) { t->type = type; t->flags = flag; t->size = sid_size(sid) + 8; t->info = mask; + ZERO_STRUCTP(&t->sid); sid_copy(&t->sid, sid); } /******************************************************************* -reads or writes a structure. + Reads or writes a SEC_ACE structure. ********************************************************************/ -void sec_io_ace(char *desc, SEC_ACE *t, prs_struct *ps, int depth) + +BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth) { uint32 old_offset; uint32 offset_ace_size; - if (t == NULL) return; + + if (psa == NULL) + { + return False; + } prs_debug(ps, depth, desc, "sec_io_ace"); depth++; @@ -81,58 +95,132 @@ void sec_io_ace(char *desc, SEC_ACE *t, prs_struct *ps, int depth) old_offset = ps->offset; - prs_uint8 ("type ", ps, depth, &(t->type)); - prs_uint8 ("flags", ps, depth, &(t->flags)); - prs_uint16_pre("size ", ps, depth, &(t->size ), &offset_ace_size); + prs_uint8 ("type ", ps, depth, &psa->type); + prs_uint8 ("flags", ps, depth, &psa->flags); + prs_uint16_pre("size ", ps, depth, &psa->size, &offset_ace_size); + + if (!sec_io_access("info ", &psa->info, ps, depth)) + { + return False; + } - sec_io_access ("info ", &t->info, ps, depth); prs_align(ps); - smb_io_dom_sid("sid ", &t->sid , ps, depth); + if (!smb_io_dom_sid("sid ", &psa->sid , ps, depth)) + { + return False; + } - prs_uint16_post("size ", ps, depth, &t->size, offset_ace_size, old_offset); + + prs_uint16_post("size ", ps, depth, &psa->size, offset_ace_size, old_offset); + return True; } /******************************************************************* -makes a structure. + Create a SEC_ACL structure. ********************************************************************/ -void make_sec_acl(SEC_ACL *t, uint16 revision, int num_aces, SEC_ACE *ace) + +SEC_ACL *make_sec_acl(uint16 revision, int num_aces, SEC_ACE *ace_list) { + SEC_ACL *dst; int i; - t->revision = revision; - t->num_aces = num_aces; - t->size = 4; - t->ace = ace; + + dst = (SEC_ACL *)malloc(sizeof(SEC_ACL)); + if (dst == NULL) + { + return NULL; + } + + ZERO_STRUCTP(dst); + + dst->revision = revision; + dst->num_aces = num_aces; + dst->size = 4; + + if ((dst->ace_list = (SEC_ACE *)malloc( sizeof(SEC_ACE) * num_aces )) == NULL) { + free_sec_acl(&dst); + return NULL; + } for (i = 0; i < num_aces; i++) { - t->size += ace[i].size; + dst->ace_list[i] = ace_list[i]; /* Structure copy. */ + dst->size += ace_list[i].size; } + + return dst; } /******************************************************************* -frees a structure. + Duplicate a SEC_ACL structure. ********************************************************************/ -void free_sec_acl(SEC_ACL *t) + +SEC_ACL *dup_sec_acl( SEC_ACL *src) { - if (t->ace != NULL) + if (src == NULL) { - free(t->ace); + return NULL; } + + return make_sec_acl( src->revision, src->num_aces, src->ace_list); } /******************************************************************* -reads or writes a structure. + Delete a SEC_ACL structure. +********************************************************************/ -first of the xx_io_xx functions that allocates its data structures -for you as it reads them. +void free_sec_acl(SEC_ACL **ppsa) +{ + SEC_ACL *psa; + + if (ppsa == NULL || *ppsa == NULL) + { + return; + } + + psa = *ppsa; + if (psa->ace_list != NULL) + { + free(psa->ace_list); + } + + free(psa); + *ppsa = NULL; +} + +/******************************************************************* + Reads or writes a SEC_ACL structure. + + First of the xx_io_xx functions that allocates its data structures + for you as it reads them. ********************************************************************/ -void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) + +BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) { int i; uint32 old_offset; uint32 offset_acl_size; + SEC_ACL *psa; - if (t == NULL) return; + if (ppsa == NULL) + { + return False; + } + + psa = *ppsa; + + if (ps->io && psa == NULL) + { + /* + * This is a read and we must allocate the stuct to read into. + */ + psa = (SEC_ACL *)malloc(sizeof(SEC_ACL)); + if (psa == NULL) + { + return False; + } + ZERO_STRUCTP(psa); + *ppsa = psa; + } prs_debug(ps, depth, desc, "sec_io_acl"); depth++; @@ -141,147 +229,216 @@ void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) old_offset = ps->offset; - prs_uint16("revision", ps, depth, &(t->revision)); - prs_uint16_pre("size ", ps, depth, &(t->size ), &offset_acl_size); - prs_uint32("num_aces ", ps, depth, &(t->num_aces )); + prs_uint16("revision", ps, depth, &psa->revision); + prs_uint16_pre("size ", ps, depth, &psa->size, &offset_acl_size); + prs_uint32("num_aces ", ps, depth, &psa->num_aces); - if (ps->io && t->num_aces != 0) + if (ps->io && psa->num_aces != 0) { /* reading */ - t->ace = malloc(sizeof(t->ace[0]) * t->num_aces); - ZERO_STRUCTP(t->ace); - } - - if (t->ace == NULL && t->num_aces != 0) - { - DEBUG(0,("INVALID ACL\n")); - ps->offset = 0xfffffffe; - return; + psa->ace_list = malloc(sizeof(psa->ace_list[0]) * psa->num_aces); + if (psa->ace_list == NULL) + { + return False; + } + ZERO_STRUCTP(psa->ace_list); } - for (i = 0; i < MIN(t->num_aces, MAX_SEC_ACES); i++) + for (i = 0; i < MIN(psa->num_aces, MAX_SEC_ACES); i++) { fstring tmp; - slprintf(tmp, sizeof(tmp)-1, "ace[%02d]: ", i); - sec_io_ace(tmp, &t->ace[i], ps, depth); + slprintf(tmp, sizeof(tmp)-1, "ace_list[%02d]: ", i); + if (!sec_io_ace(tmp, &psa->ace_list[i], ps, depth)) + { + return False; + } } prs_align(ps); - prs_uint16_post("size ", ps, depth, &t->size , offset_acl_size, old_offset); + prs_uint16_post("size ", ps, depth, &psa->size, offset_acl_size, old_offset); + + return True; } /******************************************************************* -makes a structure + Creates a SEC_DESC structure ********************************************************************/ -int make_sec_desc(SEC_DESC *t, uint16 revision, uint16 type, - DOM_SID *owner_sid, DOM_SID *grp_sid, - SEC_ACL *sacl, SEC_ACL *dacl) + +SEC_DESC *make_sec_desc(uint16 revision, uint16 type, + DOM_SID *owner_sid, DOM_SID *grp_sid, + SEC_ACL *sacl, SEC_ACL *dacl, size_t *sec_desc_size) { + SEC_DESC *dst; uint32 offset; - t->revision = revision; - t->type = type; + *sec_desc_size = 0; + + dst = (SEC_DESC *)malloc(sizeof(SEC_DESC)); + + if (dst == NULL) + { + return NULL; + } - t->off_owner_sid = 0; - t->off_grp_sid = 0; - t->off_sacl = 0; - t->off_dacl = 0; + ZERO_STRUCTP(dst); - t->dacl = dacl; - t->sacl = sacl; - t->owner_sid = owner_sid; - t->grp_sid = grp_sid; + dst->revision = revision; + dst->type = type; + + dst->off_owner_sid = 0; + dst->off_grp_sid = 0; + dst->off_sacl = 0; + dst->off_dacl = 0; + + /* duplicate sids and acls as necessary */ + + if (dacl != NULL) dst->dacl = dup_sec_acl(dacl); + if (sacl != NULL) dst->sacl = dup_sec_acl(sacl); + if (owner_sid != NULL) dst->owner_sid = sid_dup(owner_sid); + if (grp_sid != NULL) dst->grp_sid = sid_dup(grp_sid); + + /* having duplicated sids and acls as necessary, check success */ + + if ((dacl != NULL && dst->dacl == NULL) || + (sacl != NULL && dst->sacl == NULL) || + (owner_sid != NULL && dst->owner_sid == NULL) || + (grp_sid != NULL && dst->grp_sid == NULL)) + { + *sec_desc_size = 0; + free_sec_desc(&dst); + + return NULL; + } offset = 0x0; - if (dacl != NULL) + /* + * Work out the linearization sizes. + */ + + if (dst->dacl != NULL) { if (offset == 0) { offset = 0x14; } - t->off_dacl = offset; + dst->off_dacl = offset; offset += dacl->size; } - if (sacl != NULL) + if (dst->sacl != NULL) { if (offset == 0) { offset = 0x14; } - t->off_dacl = offset; - offset += dacl->size; + dst->off_sacl = offset; + offset += sacl->size; } - if (owner_sid != NULL) + if (dst->owner_sid != NULL) { if (offset == 0) { offset = 0x14; } - t->off_owner_sid = offset; - offset += sid_size(owner_sid); + dst->off_owner_sid = offset; + offset += sid_size(dst->owner_sid); } - if (grp_sid != NULL) + if (dst->grp_sid != NULL) { if (offset == 0) { offset = 0x14; } - t->off_grp_sid = offset; - offset += sid_size(grp_sid); + dst->off_grp_sid = offset; + offset += sid_size(dst->grp_sid); } - return (offset == 0) ? 0x14 : offset; + *sec_desc_size = (size_t)((offset == 0) ? 0x14 : offset); + return dst; } +/******************************************************************* + Duplicate a SEC_DESC structure. +********************************************************************/ + +SEC_DESC *dup_sec_desc( SEC_DESC *src) +{ + size_t dummy; + + if (src == NULL) + return NULL; + + return make_sec_desc( src->revision, src->type, + src->owner_sid, src->grp_sid, src->sacl, + src->dacl, &dummy); +} /******************************************************************* -frees a structure + Deletes a SEC_DESC structure ********************************************************************/ -void free_sec_desc(SEC_DESC *t) + +void free_sec_desc(SEC_DESC **ppsd) { - if (t->dacl != NULL) - { - free_sec_acl(t->dacl); - } + SEC_DESC *psd; - if (t->sacl != NULL) + if (ppsd == NULL || *ppsd == NULL) { - free_sec_acl(t->dacl); + return; } - if (t->owner_sid != NULL) - { - free(t->owner_sid); - } + psd = *ppsd; - if (t->grp_sid != NULL) - { - free(t->grp_sid); - } + free_sec_acl(&psd->dacl); + free_sec_acl(&psd->dacl); + free(psd->owner_sid); + free(psd->grp_sid); + free(psd); + *ppsd = NULL; +} + +/******************************************************************* + Creates a SEC_DESC structure with typical defaults. +********************************************************************/ + +SEC_DESC *make_standard_sec_desc(DOM_SID *owner_sid, DOM_SID *grp_sid, + SEC_ACL *dacl, size_t *sec_desc_size) +{ + return make_sec_desc(1, SEC_DESC_SELF_RELATIVE|SEC_DESC_DACL_PRESENT, + owner_sid, grp_sid, NULL, dacl, sec_desc_size); } /******************************************************************* -reads or writes a structure. + Reads or writes a SEC_DESC structure. + If reading and the *ppsd = NULL, allocates the structure. ********************************************************************/ -static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) + +BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) { -#if 0 - uint32 off_owner_sid; - uint32 off_grp_sid ; - uint32 off_sacl ; - uint32 off_dacl ; -#endif uint32 old_offset; uint32 max_offset = 0; /* after we're done, move offset to end */ + SEC_DESC *psd; + + if (ppsd == NULL) + return False; + + psd = *ppsd; - if (t == NULL) return; + if (ps->io && psd == NULL) + { + psd = (SEC_DESC *)malloc(sizeof(SEC_DESC)); + if (psd == NULL) + { + return False; + } + ZERO_STRUCTP(psd); + *ppsd = psd; + } prs_debug(ps, depth, desc, "sec_io_desc"); depth++; @@ -291,218 +448,207 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) /* start of security descriptor stored for back-calc offset purposes */ old_offset = ps->offset; - prs_uint16("revision ", ps, depth, &(t->revision )); - prs_uint16("type ", ps, depth, &(t->type )); - - prs_uint32("off_owner_sid", ps, depth, &(t->off_owner_sid)); - prs_uint32("off_grp_sid ", ps, depth, &(t->off_grp_sid )); - prs_uint32("off_sacl ", ps, depth, &(t->off_sacl )); - prs_uint32("off_dacl ", ps, depth, &(t->off_dacl )); -#if 0 - prs_uint32_pre("off_owner_sid", ps, depth, &(t->off_owner_sid), &off_owner_sid); - prs_uint32_pre("off_grp_sid ", ps, depth, &(t->off_grp_sid ), &off_grp_sid ); - prs_uint32_pre("off_sacl ", ps, depth, &(t->off_sacl ), &off_sacl ); - prs_uint32_pre("off_dacl ", ps, depth, &(t->off_dacl ), &off_dacl ); -#endif + prs_uint16("revision ", ps, depth, &psd->revision); + prs_uint16("type ", ps, depth, &psd->type); + + prs_uint32("off_owner_sid", ps, depth, &psd->off_owner_sid); + prs_uint32("off_grp_sid ", ps, depth, &psd->off_grp_sid); + prs_uint32("off_sacl ", ps, depth, &psd->off_sacl); + prs_uint32("off_dacl ", ps, depth, &psd->off_dacl); + max_offset = MAX(max_offset, ps->offset); - if (IS_BITS_SET_ALL(t->type, SEC_DESC_DACL_PRESENT)) + if (IS_BITS_SET_ALL(psd->type, SEC_DESC_DACL_PRESENT) && psd->dacl) { -#if 0 - prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , ps->offset - old_offset); -#endif - ps->offset = old_offset + t->off_dacl; - if (ps->io) + ps->offset = old_offset + psd->off_dacl; + if (!sec_io_acl("dacl", &psd->dacl, ps, depth)) { - /* reading */ - t->dacl = malloc(sizeof(*t->dacl)); - ZERO_STRUCTP(t->dacl); - } - - if (t->dacl == NULL) - { - DEBUG(0,("INVALID DACL\n")); - ps->offset = 0xfffffffe; - return; + return False; } - - sec_io_acl ("dacl" , t->dacl , ps, depth); prs_align(ps); } -#if 0 - else - { - prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , 0); - } -#endif max_offset = MAX(max_offset, ps->offset); - if (IS_BITS_SET_ALL(t->type, SEC_DESC_SACL_PRESENT)) + if (IS_BITS_SET_ALL(psd->type, SEC_DESC_SACL_PRESENT) && psd->sacl) { -#if 0 - prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , ps->offset - old_offset); -#endif - ps->offset = old_offset + t->off_sacl; - if (ps->io) + ps->offset = old_offset + psd->off_sacl; + if (!sec_io_acl("sacl", &psd->sacl, ps, depth)) { - /* reading */ - t->sacl = malloc(sizeof(*t->sacl)); - ZERO_STRUCTP(t->sacl); + return False; } - - if (t->sacl == NULL) - { - DEBUG(0,("INVALID SACL\n")); - ps->offset = 0xfffffffe; - return; - } - - sec_io_acl ("sacl" , t->sacl , ps, depth); prs_align(ps); } -#if 0 - else - { - prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , 0); - } -#endif max_offset = MAX(max_offset, ps->offset); -#if 0 - prs_uint32_post("off_owner_sid", ps, depth, &(t->off_owner_sid), off_owner_sid, ps->offset - old_offset); -#endif - if (t->off_owner_sid != 0) + if (psd->off_owner_sid != 0) { if (ps->io) { - ps->offset = old_offset + t->off_owner_sid; - } - if (ps->io) - { + ps->offset = old_offset + psd->off_owner_sid; /* reading */ - t->owner_sid = malloc(sizeof(*t->owner_sid)); - ZERO_STRUCTP(t->owner_sid); + psd->owner_sid = malloc(sizeof(*psd->owner_sid)); + if (psd->owner_sid == NULL) + { + return False; + } + ZERO_STRUCTP(psd->owner_sid); } - if (t->owner_sid == NULL) + if (!smb_io_dom_sid("owner_sid ", psd->owner_sid , ps, depth)) { - DEBUG(0,("INVALID OWNER SID\n")); - ps->offset = 0xfffffffe; - return; + return False; } - - smb_io_dom_sid("owner_sid ", t->owner_sid , ps, depth); prs_align(ps); } max_offset = MAX(max_offset, ps->offset); -#if 0 - prs_uint32_post("off_grp_sid ", ps, depth, &(t->off_grp_sid ), off_grp_sid , ps->offset - old_offset); -#endif - if (t->off_grp_sid != 0) + if (psd->off_grp_sid != 0) { - if (ps->io) - { - ps->offset = old_offset + t->off_grp_sid; - } if (ps->io) { /* reading */ - t->grp_sid = malloc(sizeof(*t->grp_sid)); - ZERO_STRUCTP(t->grp_sid); + ps->offset = old_offset + psd->off_grp_sid; + psd->grp_sid = malloc(sizeof(*psd->grp_sid)); + if (psd->grp_sid == NULL) + { + return False; + } + ZERO_STRUCTP(psd->grp_sid); } - if (t->grp_sid == NULL) + if (!smb_io_dom_sid("grp_sid", psd->grp_sid, ps, depth)) { - DEBUG(0,("INVALID GROUP SID\n")); - ps->offset = 0xfffffffe; - return; + return False; } - - smb_io_dom_sid("grp_sid", t->grp_sid, ps, depth); prs_align(ps); } max_offset = MAX(max_offset, ps->offset); ps->offset = max_offset; + return True; } /******************************************************************* -creates a SEC_DESC_BUF structure. + Creates a SEC_DESC_BUF structure. ********************************************************************/ -void make_sec_desc_buf(SEC_DESC_BUF *buf, int len, SEC_DESC *data) + +SEC_DESC_BUF *make_sec_desc_buf(int len, SEC_DESC *sec_desc) { - ZERO_STRUCTP(buf); + SEC_DESC_BUF *dst; + + dst = (SEC_DESC_BUF *)malloc(sizeof(SEC_DESC_BUF)); + if (dst == NULL) + { + return NULL; + } + + ZERO_STRUCTP(dst); /* max buffer size (allocated size) */ - buf->max_len = len; - buf->undoc = 0; - buf->len = data != NULL ? len : 0; - buf->sec = data; + dst->max_len = len; + dst->len = len; + + if (sec_desc && ((dst->sec = dup_sec_desc(sec_desc)) == NULL)) + { + free_sec_desc_buf(&dst); + return NULL; + } + + return dst; } /******************************************************************* -frees a SEC_DESC_BUF structure. + Duplicates a SEC_DESC_BUF structure. ********************************************************************/ -void free_sec_desc_buf(SEC_DESC_BUF *buf) + +SEC_DESC_BUF *dup_sec_desc_buf(SEC_DESC_BUF *src) { - if (buf->sec != NULL) + if (src == NULL) { - free_sec_desc(buf->sec); - free(buf->sec); + return NULL; } + + return make_sec_desc_buf( src->len, src->sec); +} + +/******************************************************************* + Deletes a SEC_DESC_BUF structure. +********************************************************************/ + +void free_sec_desc_buf(SEC_DESC_BUF **ppsdb) +{ + SEC_DESC_BUF *psdb; + + if (ppsdb == NULL || *ppsdb == NULL) + { + return; + } + + psdb = *ppsdb; + free_sec_desc(&psdb->sec); + free(psdb); + *ppsdb = NULL; } /******************************************************************* -reads or writes a SEC_DESC_BUF structure. + Reads or writes a SEC_DESC_BUF structure. ********************************************************************/ -void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) + +BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth) { uint32 off_len; uint32 off_max_len; uint32 old_offset; uint32 size; + SEC_DESC_BUF *psdb; + + if (ppsdb == NULL) + { + return False; + } + + psdb = *ppsdb; - if (sec == NULL) return; + if (ps->io && psdb == NULL) + { + psdb = (SEC_DESC_BUF *)malloc(sizeof(SEC_DESC_BUF)); + if (psdb == NULL) + { + return False; + } + ZERO_STRUCTP(psdb); + *ppsdb = psdb; + } prs_debug(ps, depth, desc, "sec_io_desc_buf"); depth++; prs_align(ps); - prs_uint32_pre("max_len", ps, depth, &(sec->max_len), &off_max_len); - prs_uint32 ("undoc ", ps, depth, &(sec->undoc )); - prs_uint32_pre("len ", ps, depth, &(sec->len ), &off_len); + prs_uint32_pre("max_len", ps, depth, &psdb->max_len, &off_max_len); + prs_uint32 ("undoc ", ps, depth, &psdb->undoc); + prs_uint32_pre("len ", ps, depth, &psdb->len, &off_len); old_offset = ps->offset; - if (sec->len != 0 && ps->io) + /* reading, length is non-zero; writing, descriptor is non-NULL */ + if ((psdb->len != 0 || (!ps->io)) && psdb->sec != NULL) { - /* reading */ - sec->sec = malloc(sizeof(*sec->sec)); - ZERO_STRUCTP(sec->sec); - - if (sec->sec == NULL) + if (!sec_io_desc("sec ", &psdb->sec, ps, depth)) { - DEBUG(0,("INVALID SEC_DESC\n")); - ps->offset = 0xfffffffe; - return; + return False; } } - /* reading, length is non-zero; writing, descriptor is non-NULL */ - if ((sec->len != 0 || (!ps->io)) && sec->sec != NULL) - { - sec_io_desc("sec ", sec->sec, ps, depth); - } - size = ps->offset - old_offset; - prs_uint32_post("max_len", ps, depth, &(sec->max_len), off_max_len, size == 0 ? sec->max_len : size); - prs_uint32_post("len ", ps, depth, &(sec->len ), off_len , size); + prs_uint32_post("max_len", ps, depth, &psdb->max_len, off_max_len, size == 0 ? psdb->max_len : size); + prs_uint32_post("len ", ps, depth, &psdb->len, off_len, size); + + return True; } -- cgit From 05f772b431f9c77a2fb37736fc4f801d84cac365 Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Wed, 24 Feb 1999 01:52:30 +0000 Subject: Win9x user level security. * Added SAMR_LOOKUP_DOMAIN (-> SamrLookupDomainInSamServer) * Added real SAMR_ENUM_DOM_GROUPS (corresponding to SamrEnumerateGroupsInDomain). The existing one is just an alias for SamrQueryDisplayInformation (see below). * Added three extra info levels to SAMR_QUERY_DISPINFO. Info level 3 is what was previously SAMR_ENUM_DOM_GROUPS; info levels 4 and 5 are simple user/group list requests used by Win9x and I suspect (haven't checked) the "low speed connection" User Manager. * Added another two aliases for SAMR_QUERY_DISPINFO, opcodes 0x30 and 0x33. Usually the first is with info level 3 and the second 4 but there is some overlap so indeed these should be implemented as just aliases. * Return ERRDOS/ERRmoredata on extra data instead of STATUS_BUFFER_OVERFLOW for Win95's benefit. On a named pipe this results in an SMBreadX as usual. Still need to fix SAMR_QUERY_DOMAIN_INFO which has a hard-coded number of users and groups - which Win95 proceeds to truncate at. (This used to be commit 7d03e6e21908f3a759a4e65c5edd850622335e3e) --- source3/rpc_parse/parse_samr.c | 802 ++++++++++++++++++++++++++++------------- 1 file changed, 553 insertions(+), 249 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index fb93925011..0e7c891b79 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -73,6 +73,66 @@ void samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND *r_u, prs_struct *ps, int prs_uint32("status", ps, depth, &(r_u->status)); } +/******************************************************************* +makes a SAMR_Q_LOOKUP_DOMAIN structure. +********************************************************************/ +void make_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN *q_u, + POLICY_HND *pol, const char *dom_name) +{ + int len_name = strlen(dom_name); + + if (q_u == NULL) return; + + DEBUG(5,("make_samr_q_lookup_domain\n")); + + memcpy(&(q_u->connect_pol), pol, sizeof(*pol)); + + make_uni_hdr(&(q_u->hdr_domain), len_name, len_name, 1); + make_unistr2(&(q_u->uni_domain), dom_name, len_name); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_lookup_domain(char *desc, SAMR_Q_LOOKUP_DOMAIN *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_lookup_domain"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("connect_pol", &(q_u->connect_pol), ps, depth); + prs_align(ps); + + smb_io_unihdr("hdr_domain", &(q_u->hdr_domain), ps, depth); + smb_io_unistr2("uni_domain", &(q_u->uni_domain), + q_u->hdr_domain.buffer, ps, depth); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_lookup_domain(char *desc, SAMR_R_LOOKUP_DOMAIN *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_lookup_domain"); + depth++; + + prs_align(ps); + + prs_uint32("ptr", ps, depth, &(r_u->ptr_sid)); + + if (r_u->ptr_sid != 0) + { + smb_io_dom_sid2("sid", &(r_u->dom_sid), ps, depth); + prs_align(ps); + } + + prs_uint32("status", ps, depth, &(r_u->status)); +} /******************************************************************* reads or writes a structure. @@ -258,6 +318,7 @@ void samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO *q_u, prs_st prs_align(ps); } + /******************************************************************* makes a structure. ********************************************************************/ @@ -838,6 +899,68 @@ static void sam_io_sam_entry3(char *desc, SAM_ENTRY3 *sam, prs_struct *ps, int smb_io_unihdr("unihdr", &(sam->hdr_grp_desc), ps, depth); /* account name unicode string header */ } +/******************************************************************* +makes a SAM_ENTRY4 structure. +********************************************************************/ +static void make_sam_entry4(SAM_ENTRY4 *sam, uint32 user_idx, + uint32 len_acct_name) +{ + if (sam == NULL) return; + + DEBUG(5,("make_sam_entry4\n")); + + sam->user_idx = user_idx; + make_str_hdr(&(sam->hdr_acct_name), len_acct_name, len_acct_name, + len_acct_name != 0); +} + +/******************************************************************* +reads or writes a SAM_ENTRY4 structure. +********************************************************************/ +static void sam_io_sam_entry4(char *desc, SAM_ENTRY4 *sam, prs_struct *ps, int depth) +{ + if (sam == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_sam_entry4"); + depth++; + + prs_align(ps); + + prs_uint32("user_idx", ps, depth, &(sam->user_idx)); + smb_io_strhdr("strhdr", &(sam->hdr_acct_name), ps, depth); +} + +/******************************************************************* +makes a SAM_ENTRY5 structure. +********************************************************************/ +static void make_sam_entry5(SAM_ENTRY5 *sam, uint32 grp_idx, + uint32 len_grp_name) +{ + if (sam == NULL) return; + + DEBUG(5,("make_sam_entry5\n")); + + sam->grp_idx = grp_idx; + make_str_hdr(&(sam->hdr_grp_name), len_grp_name, len_grp_name, + len_grp_name != 0); +} + +/******************************************************************* +reads or writes a SAM_ENTRY5 structure. +********************************************************************/ +static void sam_io_sam_entry5(char *desc, SAM_ENTRY5 *sam, prs_struct *ps, int depth) +{ + if (sam == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_sam_entry5"); + depth++; + + prs_align(ps); + + prs_uint32("grp_idx", ps, depth, &(sam->grp_idx)); + smb_io_strhdr("strhdr", &(sam->hdr_grp_name), ps, depth); +} + /******************************************************************* makes a SAM_ENTRY structure. ********************************************************************/ @@ -1015,20 +1138,20 @@ void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struc makes a SAMR_Q_QUERY_DISPINFO structure. ********************************************************************/ void make_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_e, POLICY_HND *pol, - uint16 switch_level, uint32 start_idx, uint32 size) + uint16 switch_level, uint32 start_idx, + uint32 max_entries) { if (q_e == NULL || pol == NULL) return; DEBUG(5,("make_samr_q_query_dispinfo\n")); - memcpy(&(q_e->pol), pol, sizeof(*pol)); + memcpy(&(q_e->domain_pol), pol, sizeof(*pol)); q_e->switch_level = switch_level; - q_e->unknown_0 = 0; q_e->start_idx = start_idx; - q_e->unknown_1 = 0x000007d0; - q_e->max_size = size; + q_e->max_entries = max_entries; + q_e->max_size = 0xffff; /* Not especially useful */ } /******************************************************************* @@ -1043,183 +1166,370 @@ void samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO *q_e, prs_struc prs_align(ps); - smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + smb_io_pol_hnd("domain_pol", &(q_e->domain_pol), ps, depth); prs_align(ps); prs_uint16("switch_level", ps, depth, &(q_e->switch_level)); - prs_uint16("unknown_0 ", ps, depth, &(q_e->unknown_0 )); + prs_align(ps); + prs_uint32("start_idx ", ps, depth, &(q_e->start_idx )); - prs_uint32("unknown_1 ", ps, depth, &(q_e->unknown_1 )); + prs_uint32("max_entries ", ps, depth, &(q_e->max_entries )); prs_uint32("max_size ", ps, depth, &(q_e->max_size )); - - prs_align(ps); } /******************************************************************* -makes a SAM_INFO_2 structure. +makes a SAM_DISPINFO_1 structure. ********************************************************************/ -void make_sam_info_2(SAM_INFO_2 *sam, uint32 acb_mask, - uint32 start_idx, uint32 num_sam_entries, - SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) +void make_sam_dispinfo_1(SAM_DISPINFO_1 *sam, uint32 *num_entries, + uint32 *data_size, uint32 start_idx, + SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) +{ + uint32 len_sam_name, len_sam_full, len_sam_desc; + uint32 max_entries, max_data_size; + uint32 dsize = 0; + int i; + + if (sam == NULL || num_entries == NULL || data_size == NULL) return; + + DEBUG(5,("make_sam_dispinfo_1\n")); + + max_entries = *num_entries; + max_data_size = *data_size; + + for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) + { + len_sam_name = pass[i].uni_user_name.uni_str_len; + len_sam_full = pass[i].uni_full_name.uni_str_len; + len_sam_desc = pass[i].uni_acct_desc.uni_str_len; + + make_sam_entry1(&(sam->sam[i]), start_idx + i + 1, + len_sam_name, len_sam_full, len_sam_desc, + pass[i].user_rid, pass[i].acb_info); + + copy_unistr2(&(sam->str[i].uni_acct_name), &(pass[i].uni_user_name)); + copy_unistr2(&(sam->str[i].uni_full_name), &(pass[i].uni_full_name)); + copy_unistr2(&(sam->str[i].uni_acct_desc), &(pass[i].uni_acct_desc)); + + dsize += sizeof(SAM_ENTRY1); + dsize += len_sam_name + len_sam_full + len_sam_desc; + } + + *num_entries = i; + *data_size = dsize; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static void sam_io_sam_dispinfo_1(char *desc, SAM_DISPINFO_1 *sam, uint32 num_entries, prs_struct *ps, int depth) { int i; - int entries_added; if (sam == NULL) return; - DEBUG(5,("make_sam_info_2\n")); + prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_1"); + depth++; + + prs_align(ps); - if (num_sam_entries >= MAX_SAM_ENTRIES) + SMB_ASSERT_ARRAY(sam->sam, num_entries); + + for (i = 0; i < num_entries; i++) { - num_sam_entries = MAX_SAM_ENTRIES; - DEBUG(5,("limiting number of entries to %d\n", - num_sam_entries)); + prs_grow(ps); + sam_io_sam_entry1("", &(sam->sam[i]), ps, depth); } - for (i = start_idx, entries_added = 0; i < num_sam_entries; i++) + for (i = 0; i < num_entries; i++) { - if (IS_BITS_SET_ALL(pass[i].acb_info, acb_mask)) - { - make_sam_entry2(&(sam->sam[entries_added]), - start_idx + entries_added + 1, - pass[i].uni_user_name.uni_str_len, - pass[i].uni_acct_desc.uni_str_len, - pass[i].user_rid, - pass[i].acb_info); + prs_grow(ps); + 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); + } +} - copy_unistr2(&(sam->str[entries_added].uni_srv_name), &(pass[i].uni_user_name)); - copy_unistr2(&(sam->str[entries_added].uni_srv_desc), &(pass[i].uni_acct_desc)); - entries_added++; - } +/******************************************************************* +makes a SAM_DISPINFO_2 structure. +********************************************************************/ +void make_sam_dispinfo_2(SAM_DISPINFO_2 *sam, uint32 *num_entries, + uint32 *data_size, uint32 start_idx, + SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) +{ + uint32 len_sam_name, len_sam_desc; + uint32 max_entries, max_data_size; + uint32 dsize = 0; + int i; + + if (sam == NULL || num_entries == NULL || data_size == NULL) return; + + DEBUG(5,("make_sam_dispinfo_2\n")); + + max_entries = *num_entries; + max_data_size = *data_size; + + for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) + { + len_sam_name = pass[i].uni_user_name.uni_str_len; + len_sam_desc = pass[i].uni_acct_desc.uni_str_len; - sam->num_entries = entries_added; - sam->ptr_entries = 1; - sam->num_entries2 = entries_added; + make_sam_entry2(&(sam->sam[i]), start_idx + i + 1, + len_sam_name, len_sam_desc, + pass[i].user_rid, pass[i].acb_info); + + copy_unistr2(&(sam->str[i].uni_srv_name), &(pass[i].uni_user_name)); + copy_unistr2(&(sam->str[i].uni_srv_desc), &(pass[i].uni_acct_desc)); + + dsize += sizeof(SAM_ENTRY2); + dsize += len_sam_name + len_sam_desc; } + + *num_entries = i; + *data_size = dsize; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void sam_io_sam_info_2(char *desc, SAM_INFO_2 *sam, prs_struct *ps, int depth) +static void sam_io_sam_dispinfo_2(char *desc, SAM_DISPINFO_2 *sam, uint32 num_entries, prs_struct *ps, int depth) { int i; if (sam == NULL) return; - prs_debug(ps, depth, desc, "sam_io_sam_info_2"); + prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_2"); depth++; prs_align(ps); - prs_uint32("num_entries ", ps, depth, &(sam->num_entries )); - prs_uint32("ptr_entries ", ps, depth, &(sam->ptr_entries )); - - prs_uint32("num_entries2 ", ps, depth, &(sam->num_entries2 )); + SMB_ASSERT_ARRAY(sam->sam, num_entries); - SMB_ASSERT_ARRAY(sam->sam, sam->num_entries); - - for (i = 0; i < sam->num_entries; i++) + for (i = 0; i < num_entries; i++) { prs_grow(ps); sam_io_sam_entry2("", &(sam->sam[i]), ps, depth); } - for (i = 0; i < sam->num_entries; i++) + for (i = 0; i < num_entries; i++) { prs_grow(ps); sam_io_sam_str2 ("", &(sam->str[i]), - sam->sam[i].hdr_srv_name.buffer, - sam->sam[i].hdr_srv_desc.buffer, - ps, depth); + sam->sam[i].hdr_srv_name.buffer, + sam->sam[i].hdr_srv_desc.buffer, + ps, depth); } } /******************************************************************* -makes a SAM_INFO_1 structure. +makes a SAM_DISPINFO_3 structure. ********************************************************************/ -void make_sam_info_1(SAM_INFO_1 *sam, uint32 acb_mask, - uint32 start_idx, uint32 num_sam_entries, - SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) +void make_sam_dispinfo_3(SAM_DISPINFO_3 *sam, uint32 *num_entries, + uint32 *data_size, uint32 start_idx, + DOMAIN_GRP *grp) { + uint32 len_sam_name, len_sam_desc; + uint32 max_entries, max_data_size; + uint32 dsize = 0; int i; - int entries_added; - if (sam == NULL) return; + if (sam == NULL || num_entries == NULL || data_size == NULL) return; - DEBUG(5,("make_sam_info_1\n")); + DEBUG(5,("make_sam_dispinfo_3\n")); - if (num_sam_entries >= MAX_SAM_ENTRIES) + max_entries = *num_entries; + max_data_size = *data_size; + + for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) { - num_sam_entries = MAX_SAM_ENTRIES; - DEBUG(5,("limiting number of entries to %d\n", - num_sam_entries)); + len_sam_name = strlen(grp[i].name); + len_sam_desc = strlen(grp[i].comment); + + make_sam_entry3(&(sam->sam[i]), start_idx + i + 1, + len_sam_name, len_sam_desc, + grp[i].rid); + + make_unistr2(&(sam->str[i].uni_grp_name), grp[i].name , len_sam_name); + make_unistr2(&(sam->str[i].uni_grp_desc), grp[i].comment, len_sam_desc); + + dsize += sizeof(SAM_ENTRY3); + dsize += (len_sam_name + len_sam_desc) * 2; } - for (i = start_idx, entries_added = 0; i < num_sam_entries; i++) + *num_entries = i; + *data_size = dsize; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static void sam_io_sam_dispinfo_3(char *desc, SAM_DISPINFO_3 *sam, int num_entries, prs_struct *ps, int depth) +{ + int i; + + if (sam == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_3"); + depth++; + + prs_align(ps); + + SMB_ASSERT_ARRAY(sam->sam, num_entries); + + for (i = 0; i < num_entries; i++) { - if (IS_BITS_SET_ALL(pass[i].acb_info, acb_mask)) - { - make_sam_entry1(&(sam->sam[entries_added]), - start_idx + entries_added + 1, - pass[i].uni_user_name.uni_str_len, - pass[i].uni_full_name.uni_str_len, - pass[i].uni_acct_desc.uni_str_len, - pass[i].user_rid, - pass[i].acb_info); - - copy_unistr2(&(sam->str[entries_added].uni_acct_name), &(pass[i].uni_user_name)); - copy_unistr2(&(sam->str[entries_added].uni_full_name), &(pass[i].uni_full_name)); - copy_unistr2(&(sam->str[entries_added].uni_acct_desc), &(pass[i].uni_acct_desc)); - - entries_added++; - } + prs_grow(ps); + sam_io_sam_entry3("", &(sam->sam[i]), ps, depth); } - sam->num_entries = entries_added; - sam->ptr_entries = 1; - sam->num_entries2 = entries_added; + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + sam_io_sam_str3 ("", &(sam->str[i]), + sam->sam[i].hdr_grp_name.buffer, + sam->sam[i].hdr_grp_desc.buffer, + ps, depth); + } } +/******************************************************************* +makes a SAM_DISPINFO_4 structure. +********************************************************************/ +void make_sam_dispinfo_4(SAM_DISPINFO_4 *sam, uint32 *num_entries, + uint32 *data_size, uint32 start_idx, + SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) +{ + fstring sam_name; + uint32 len_sam_name; + uint32 max_entries, max_data_size; + uint32 dsize = 0; + int i; + + if (sam == NULL || num_entries == NULL || data_size == NULL) return; + + DEBUG(5,("make_sam_dispinfo_4\n")); + + max_entries = *num_entries; + max_data_size = *data_size; + + for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) + { + len_sam_name = pass[i].uni_user_name.uni_str_len; + + make_sam_entry4(&(sam->sam[i]), start_idx + i + 1, + len_sam_name); + + unistr2_to_ascii(sam_name, &(pass[i].uni_user_name), sizeof(sam_name)); + make_string2(&(sam->str[i].acct_name), sam_name, len_sam_name); + + dsize += sizeof(SAM_ENTRY4); + dsize += len_sam_name; + } + + *num_entries = i; + *data_size = dsize; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ -static void sam_io_sam_info_1(char *desc, SAM_INFO_1 *sam, prs_struct *ps, int depth) +static void sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 *sam, int num_entries, prs_struct *ps, int depth) { int i; if (sam == NULL) return; - prs_debug(ps, depth, desc, "sam_io_sam_info_1"); + prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_4"); depth++; prs_align(ps); - prs_uint32("num_entries ", ps, depth, &(sam->num_entries )); - prs_uint32("ptr_entries ", ps, depth, &(sam->ptr_entries )); + SMB_ASSERT_ARRAY(sam->sam, num_entries); + + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + sam_io_sam_entry4("", &(sam->sam[i]), ps, depth); + } - prs_uint32("num_entries2 ", ps, depth, &(sam->num_entries2 )); + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + smb_io_string2("acct_name", &(sam->str[i].acct_name), + sam->sam[i].hdr_acct_name.buffer, ps, depth); + } +} - SMB_ASSERT_ARRAY(sam->sam, sam->num_entries); - for (i = 0; i < sam->num_entries; i++) +/******************************************************************* +makes a SAM_DISPINFO_5 structure. +********************************************************************/ +void make_sam_dispinfo_5(SAM_DISPINFO_5 *sam, uint32 *num_entries, + uint32 *data_size, uint32 start_idx, + DOMAIN_GRP *grp) +{ + uint32 len_sam_name; + uint32 max_entries, max_data_size; + uint32 dsize = 0; + int i; + + if (sam == NULL || num_entries == NULL || data_size == NULL) return; + + DEBUG(5,("make_sam_dispinfo_5\n")); + + max_entries = *num_entries; + max_data_size = *data_size; + + for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) + { + len_sam_name = strlen(grp[i].name); + + make_sam_entry5(&(sam->sam[i]), start_idx + i + 1, + len_sam_name); + + make_string2(&(sam->str[i].grp_name), grp[i].name, + len_sam_name); + + dsize += sizeof(SAM_ENTRY5); + dsize += len_sam_name; + } + + *num_entries = i; + *data_size = dsize; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static void sam_io_sam_dispinfo_5(char *desc, SAM_DISPINFO_5 *sam, int num_entries, prs_struct *ps, int depth) +{ + int i; + + if (sam == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_5"); + depth++; + + prs_align(ps); + + SMB_ASSERT_ARRAY(sam->sam, num_entries); + + for (i = 0; i < num_entries; i++) { prs_grow(ps); - sam_io_sam_entry1("", &(sam->sam[i]), ps, depth); + sam_io_sam_entry5("", &(sam->sam[i]), ps, depth); } - for (i = 0; i < sam->num_entries; i++) + for (i = 0; i < num_entries; i++) { prs_grow(ps); - 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); + smb_io_string2("grp_name", &(sam->str[i].grp_name), + sam->sam[i].hdr_grp_name.buffer, ps, depth); } } @@ -1228,25 +1538,23 @@ static void sam_io_sam_info_1(char *desc, SAM_INFO_1 *sam, prs_struct *ps, int makes a SAMR_R_QUERY_DISPINFO structure. ********************************************************************/ void make_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO *r_u, - uint16 switch_level, SAM_INFO_CTR *ctr, uint32 status) + uint32 num_entries, uint32 data_size, + uint16 switch_level, SAM_DISPINFO_CTR *ctr, + uint32 status) { if (r_u == NULL) return; DEBUG(5,("make_samr_r_query_dispinfo: level %d\n", switch_level)); - if (status == 0x0) - { - r_u->unknown_0 = 0x0000001; - r_u->unknown_1 = 0x0000001; - } - else - { - r_u->unknown_0 = 0x0; - r_u->unknown_1 = 0x0; - } + r_u->total_size = 0; /* not calculated */ + r_u->data_size = data_size; r_u->switch_level = switch_level; + r_u->num_entries = num_entries; + r_u->ptr_entries = 1; + r_u->num_entries2 = num_entries; r_u->ctr = ctr; + r_u->status = status; } @@ -1254,7 +1562,7 @@ void make_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO *r_u, /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct *ps, int depth) +void samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return; @@ -1263,22 +1571,40 @@ void samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struc prs_align(ps); - prs_uint32("unknown_0 ", ps, depth, &(r_u->unknown_0 )); - prs_uint32("unknown_1 ", ps, depth, &(r_u->unknown_1 )); - prs_uint16("switch_level ", ps, depth, &(r_u->switch_level )); - + prs_uint32("total_size ", ps, depth, &(r_u->total_size )); + prs_uint32("data_size ", ps, depth, &(r_u->data_size )); + prs_uint16("switch_level", ps, depth, &(r_u->switch_level)); prs_align(ps); + prs_uint32("num_entries ", ps, depth, &(r_u->num_entries )); + prs_uint32("ptr_entries ", ps, depth, &(r_u->ptr_entries )); + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + switch (r_u->switch_level) { case 0x1: { - sam_io_sam_info_1("users", r_u->ctr->sam.info1, ps, depth); + sam_io_sam_dispinfo_1("users", r_u->ctr->sam.info1, r_u->num_entries, ps, depth); break; } case 0x2: { - sam_io_sam_info_2("servers", r_u->ctr->sam.info2, ps, depth); + sam_io_sam_dispinfo_2("servers", r_u->ctr->sam.info2, r_u->num_entries, ps, depth); + break; + } + case 0x3: + { + sam_io_sam_dispinfo_3("groups", r_u->ctr->sam.info3, r_u->num_entries, ps, depth); + break; + } + case 0x4: + { + sam_io_sam_dispinfo_4("user list", r_u->ctr->sam.info4,r_u->num_entries, ps, depth); + break; + } + case 0x5: + { + sam_io_sam_dispinfo_5("group list", r_u->ctr->sam.info5, r_u->num_entries, ps, depth); break; } default: @@ -1979,110 +2305,59 @@ void samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struc /******************************************************************* -makes a SAMR_Q_ENUM_DOM_GROUPS structure. +makes a SAMR_Q_QUERY_USERGROUPS structure. ********************************************************************/ -void make_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol, - uint16 switch_level, uint32 start_idx, uint32 size) +void make_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u, + POLICY_HND *hnd) { - if (q_e == NULL || pol == NULL) return; - - DEBUG(5,("make_samr_q_enum_dom_groups\n")); - - memcpy(&(q_e->pol), pol, sizeof(*pol)); + if (q_u == NULL || hnd == NULL) return; - q_e->switch_level = switch_level; + DEBUG(5,("make_samr_q_query_usergroups\n")); - q_e->unknown_0 = 0; - q_e->start_idx = start_idx; - q_e->unknown_1 = 0x000007d0; - q_e->max_size = size; + memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_enum_dom_groups(char *desc, SAMR_Q_ENUM_DOM_GROUPS *q_e, prs_struct *ps, int depth) +void samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS *q_u, prs_struct *ps, int depth) { - if (q_e == NULL) return; + if (q_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_q_enum_dom_groups"); + prs_debug(ps, depth, desc, "samr_io_q_query_usergroups"); depth++; prs_align(ps); - smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); - prs_align(ps); - - prs_uint16("switch_level", ps, depth, &(q_e->switch_level)); - prs_uint16("unknown_0 ", ps, depth, &(q_e->unknown_0 )); - prs_uint32("start_idx ", ps, depth, &(q_e->start_idx )); - prs_uint32("unknown_1 ", ps, depth, &(q_e->unknown_1 )); - prs_uint32("max_size ", ps, depth, &(q_e->max_size )); - + smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); prs_align(ps); } - /******************************************************************* -makes a SAMR_R_ENUM_DOM_GROUPS structure. +makes a SAMR_R_QUERY_USERGROUPS structure. ********************************************************************/ -void make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, - uint32 start_idx, uint32 num_sam_entries, - DOMAIN_GRP *grp, - uint32 status) +void make_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u, + uint32 num_gids, DOM_GID *gid, uint32 status) { - int i; - int entries_added; - if (r_u == NULL) return; - DEBUG(5,("make_samr_r_enum_dom_groups\n")); - - if (num_sam_entries >= MAX_SAM_ENTRIES) - { - num_sam_entries = MAX_SAM_ENTRIES; - DEBUG(5,("limiting number of entries to %d\n", - num_sam_entries)); - } + DEBUG(5,("make_samr_r_query_usergroups\n")); if (status == 0x0) { - for (i = start_idx, entries_added = 0; i < num_sam_entries; i++) - { - int acct_name_len = strlen(grp[i].name); - int acct_desc_len = strlen(grp[i].comment); - - make_sam_entry3(&(r_u->sam[entries_added]), - start_idx + entries_added + 1, - acct_name_len, - acct_desc_len, - grp[i].rid); - - make_unistr2(&(r_u->str[entries_added].uni_grp_name), grp[i].name , acct_name_len); - make_unistr2(&(r_u->str[entries_added].uni_grp_desc), grp[i].comment, acct_desc_len); - - entries_added++; - } + 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; - if (entries_added > 0) - { - r_u->unknown_0 = 0x0000492; - r_u->unknown_1 = 0x000049a; - } - else - { - r_u->unknown_0 = 0x0; - r_u->unknown_1 = 0x0; - } - r_u->switch_level = 3; - r_u->num_entries = entries_added; - r_u->ptr_entries = 1; - r_u->num_entries2 = entries_added; + r_u->gid = gid; } else { - r_u->switch_level = 0; + r_u->ptr_0 = 0; + r_u->num_entries = 0; + r_u->ptr_1 = 0; } r_u->status = status; @@ -2091,103 +2366,123 @@ void make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_struct *ps, int depth) +void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_struct *ps, int depth) { int i; - if (r_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_r_enum_dom_groups"); + prs_debug(ps, depth, desc, "samr_io_r_query_usergroups"); depth++; prs_align(ps); - prs_uint32("unknown_0 ", ps, depth, &(r_u->unknown_0 )); - prs_uint32("unknown_1 ", ps, depth, &(r_u->unknown_1 )); - prs_uint32("switch_level ", ps, depth, &(r_u->switch_level )); + prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0 )); - if (r_u->switch_level != 0) + if (r_u->ptr_0 != 0) { - prs_uint32("num_entries ", ps, depth, &(r_u->num_entries )); - prs_uint32("ptr_entries ", ps, depth, &(r_u->ptr_entries )); - - prs_uint32("num_entries2 ", ps, depth, &(r_u->num_entries2 )); - - SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries); + prs_uint32("num_entries ", ps, depth, &(r_u->num_entries)); + prs_uint32("ptr_1 ", ps, depth, &(r_u->ptr_1 )); - for (i = 0; i < r_u->num_entries; i++) + if (r_u->num_entries != 0) { - prs_grow(ps); - sam_io_sam_entry3("", &(r_u->sam[i]), ps, depth); - } + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); - for (i = 0; i < r_u->num_entries; i++) - { - prs_grow(ps); - sam_io_sam_str3 ("", &(r_u->str[i]), - r_u->sam[i].hdr_grp_name.buffer, - r_u->sam[i].hdr_grp_desc.buffer, - ps, depth); + for (i = 0; i < r_u->num_entries2; i++) + { + prs_grow(ps); + smb_io_gid("", &(r_u->gid[i]), ps, depth); + } } } - prs_uint32("status", ps, depth, &(r_u->status)); } + /******************************************************************* -makes a SAMR_Q_QUERY_USERGROUPS structure. +makes a SAMR_Q_ENUM_DOM_GROUPS structure. ********************************************************************/ -void make_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u, - POLICY_HND *hnd) +void make_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol, uint32 size) { - if (q_u == NULL || hnd == NULL) return; + if (q_e == NULL || pol == NULL) return; - DEBUG(5,("make_samr_q_query_usergroups\n")); + DEBUG(5,("make_samr_q_enum_dom_groups\n")); - memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + q_e->unknown_0 = 0; + q_e->max_size = size; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS *q_u, prs_struct *ps, int depth) +void samr_io_q_enum_dom_groups(char *desc, SAMR_Q_ENUM_DOM_GROUPS *q_e, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_e == NULL) return; - prs_debug(ps, depth, desc, "samr_io_q_query_usergroups"); + prs_debug(ps, depth, desc, "samr_io_q_enum_dom_groups"); depth++; prs_align(ps); - smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); + smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + prs_align(ps); + + prs_uint32("unknown_0", ps, depth, &(q_e->unknown_0)); + prs_uint32("max_size ", ps, depth, &(q_e->max_size )); + prs_align(ps); } + /******************************************************************* -makes a SAMR_R_QUERY_USERGROUPS structure. +makes a SAMR_R_ENUM_DOM_GROUPS structure. ********************************************************************/ -void make_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u, - uint32 num_gids, DOM_GID *gid, uint32 status) +void make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, + uint32 num_sam_entries, DOMAIN_GRP *grps, + uint32 status) { + int i; + if (r_u == NULL) return; - DEBUG(5,("make_samr_r_query_usergroups\n")); + DEBUG(5,("make_samr_r_enum_dom_groups\n")); - if (status == 0x0) + if (num_sam_entries >= MAX_SAM_ENTRIES) { - 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; + num_sam_entries = MAX_SAM_ENTRIES; + DEBUG(5,("limiting number of entries to %d\n", + num_sam_entries)); + } - r_u->gid = gid; + r_u->num_entries = num_sam_entries; + + if (num_sam_entries > 0) + { + r_u->ptr_entries = 1; + r_u->num_entries2 = num_sam_entries; + r_u->ptr_entries2 = 1; + r_u->num_entries3 = num_sam_entries; + + SMB_ASSERT_ARRAY(r_u->sam, num_sam_entries); + + for (i = 0; i < num_sam_entries; i++) + { + int acct_name_len = strlen(grps[i].name); + + make_sam_entry(&(r_u->sam[i]), + acct_name_len, + grps[i].rid); + + make_unistr2(&(r_u->uni_grp_name[i]), grps[i].name, acct_name_len); + } + + r_u->num_entries4 = num_sam_entries; } else { - r_u->ptr_0 = 0; - r_u->num_entries = 0; - r_u->ptr_1 = 0; + r_u->ptr_entries = 0; } r_u->status = status; @@ -2196,34 +2491,43 @@ void make_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u, /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_struct *ps, int depth) +void samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_struct *ps, int depth) { int i; + if (r_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_r_query_usergroups"); + prs_debug(ps, depth, desc, "samr_io_r_enum_dom_groups"); depth++; prs_align(ps); - prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0 )); - - if (r_u->ptr_0 != 0) + prs_uint32("num_entries", ps, depth, &(r_u->num_entries)); + prs_uint32("ptr_entries", ps, depth, &(r_u->ptr_entries)); + + if (r_u->num_entries != 0 && r_u->ptr_entries != 0) { - prs_uint32("num_entries ", ps, depth, &(r_u->num_entries)); - prs_uint32("ptr_1 ", ps, depth, &(r_u->ptr_1 )); + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); + prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); - if (r_u->num_entries != 0) + SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries); + + for (i = 0; i < r_u->num_entries; i++) { - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); + } - for (i = 0; i < r_u->num_entries2; i++) - { - prs_grow(ps); - smb_io_gid("", &(r_u->gid[i]), ps, depth); - } + for (i = 0; i < r_u->num_entries; i++) + { + smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); } + + prs_align(ps); + + prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); } + prs_uint32("status", ps, depth, &(r_u->status)); } @@ -3385,10 +3689,10 @@ void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p prs_uint32("num_rids1", ps, depth, &(r_u->num_rids1)); prs_uint32("ptr_rids ", ps, depth, &(r_u->ptr_rids )); + prs_uint32("num_rids2", ps, depth, &(r_u->num_rids2)); if (r_u->ptr_rids != 0 && r_u->num_rids1 != 0) { - prs_uint32("num_rids2", ps, depth, &(r_u->num_rids2)); for (i = 0; i < r_u->num_rids2; i++) { prs_grow(ps); @@ -3399,10 +3703,10 @@ void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p prs_uint32("num_types1", ps, depth, &(r_u->num_types1)); prs_uint32("ptr_types ", ps, depth, &(r_u->ptr_types )); + prs_uint32("num_types2", ps, depth, &(r_u->num_types2)); if (r_u->ptr_types != 0 && r_u->num_types1 != 0) { - prs_uint32("num_types2", ps, depth, &(r_u->num_types2)); for (i = 0; i < r_u->num_types2; i++) { prs_grow(ps); -- cgit From 8cf03d5a39fa4721f5fd00044bdd33a974e0410c Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 8 Mar 1999 19:19:01 +0000 Subject: - todd sabin spotted bugs in samr enum dom users / groups / aliases code: last count (probably an ENUM / resume handle) should always be returned even if there are no items being returned. - got fed up of seven intendation levels in cmd_samr.c, maximum recommended in *any* code is three! made some sub-fns instead. (This used to be commit 1c330d568225759950401cfb98fe9e99db81419c) --- source3/rpc_parse/parse_samr.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 0e7c891b79..8fc56d3d9b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1128,9 +1128,9 @@ void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struc prs_align(ps); - prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); } + prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); prs_uint32("status", ps, depth, &(r_u->status)); } @@ -2524,10 +2524,9 @@ void samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_stru } prs_align(ps); - - prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); } + prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); prs_uint32("status", ps, depth, &(r_u->status)); } @@ -2658,10 +2657,9 @@ void samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_s } prs_align(ps); - - prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); } + prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); prs_uint32("status", ps, depth, &(r_u->status)); } -- cgit From 6e88171bace32ea2f01367e86d87e1c70892084b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 12 Mar 1999 05:47:06 +0000 Subject: new "domtrust" test command. r&d into inter-domain trust accounts. (This used to be commit 65b0abe8b7594ff6c662da86dc2e35bd83a2d13d) --- source3/rpc_parse/parse_misc.c | 5 +++-- source3/rpc_parse/parse_net.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 3cffde0249..1656c39139 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -743,8 +743,9 @@ static void smb_io_clnt_srv(char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int /******************************************************************* makes a DOM_LOG_INFO structure. ********************************************************************/ -void make_log_info(DOM_LOG_INFO *log, char *logon_srv, char *acct_name, - uint16 sec_chan, char *comp_name) +void make_log_info(DOM_LOG_INFO *log, + const char *logon_srv, const char *acct_name, + uint16 sec_chan, const char *comp_name) { if (log == NULL) return; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index ce573c7bf2..6c8b304a64 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -409,7 +409,8 @@ void net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int dep reads or writes a structure. ********************************************************************/ void make_q_auth_2(NET_Q_AUTH_2 *q_a, - char *logon_srv, char *acct_name, uint16 sec_chan, char *comp_name, + const char *logon_srv, const char *acct_name, + uint16 sec_chan, const char *comp_name, DOM_CHAL *clnt_chal, uint32 clnt_flgs) { if (q_a == NULL) return; -- cgit From 517aade8bd6759124ef7c2d9bc0f7059327de36c Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Tue, 16 Mar 1999 06:24:24 +0000 Subject: Added SVC_QUERY_DISP_NAME (corresponding to the GetServiceDisplayName API). Needed during preliminary part of SAM replication. (This used to be commit 03e722cdf502491d09d4c5eb9024d837ae10ab32) --- source3/rpc_parse/parse_svc.c | 58 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c index 9c1f0f3335..e8cdd35a2c 100644 --- a/source3/rpc_parse/parse_svc.c +++ b/source3/rpc_parse/parse_svc.c @@ -520,6 +520,64 @@ void svc_io_r_query_svc_config(char *desc, SVC_R_QUERY_SVC_CONFIG *r_u, prs_str prs_uint32("status ", ps, depth, &(r_u->status )); } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void svc_io_q_query_disp_name(char *desc, SVC_Q_QUERY_DISP_NAME *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_q_query_disp_name"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(q_u->scman_pol), ps, depth); + prs_align(ps); + + smb_io_unistr2("uni_svc_name", &(q_u->uni_svc_name), 1, ps, depth); + prs_align(ps); + + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); +} + +/******************************************************************* +makes an SVC_R_QUERY_DISP_NAME structure. +********************************************************************/ +void make_svc_r_query_disp_name(SVC_R_QUERY_DISP_NAME *r_d, + char *disp_name, uint32 status) +{ + uint32 len = strlen(disp_name); + + if (r_d == NULL) return; + + DEBUG(5,("make_svc_r_query_disp_name\n")); + + make_unistr2(&(r_d->uni_disp_name), disp_name, len+1); + r_d->buf_size = len; + + r_d->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void svc_io_r_query_disp_name(char *desc, SVC_R_QUERY_DISP_NAME *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_r_query_disp_name"); + depth++; + + prs_align(ps); + + smb_io_unistr2("uni_disp_name", &(r_u->uni_disp_name), 1, ps, depth); + prs_align(ps); + + prs_uint32("buf_size", ps, depth, &(r_u->buf_size)); + prs_uint32("status ", ps, depth, &(r_u->status )); +} + /******************************************************************* makes an SVC_Q_CLOSE structure. ********************************************************************/ -- cgit From e8ac69c16877dd827719134dbce49f4aa3608c9d Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Thu, 18 Mar 1999 05:16:59 +0000 Subject: Adding LSA_OPENSECRET (-> LsarOpenSecret) and LSA_QUERYSECRET (-> LsarQuerySecret) on client side, including rpcclient command "querysecret" for others to play with. The major obstacle is working out the encryption algorithm used for the secret value. It definitely uses the NT hash as part of the key, and it seems the block size is 64 bits - probably DES based - but I can't work out what's done in between. Help required. (This used to be commit 365fa3b5fbf551670acc91f593138a7e91a5f7fa) --- source3/rpc_parse/parse_lsa.c | 165 +++++++++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_misc.c | 31 ++++++++ 2 files changed, 196 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index cb88e71536..c01664c15c 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -380,6 +380,171 @@ void lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int dept prs_uint16("info_class", ps, depth, &(q_q->info_class)); } +/******************************************************************* +makes an LSA_Q_OPEN_SECRET structure. +********************************************************************/ +void make_q_open_secret(LSA_Q_OPEN_SECRET *q_o, POLICY_HND *pol_hnd, + char *secret_name, uint32 desired_access) +{ + int len = strlen(secret_name); + + if (q_o == NULL) return; + + DEBUG(5,("make_q_open_secret")); + + memcpy(&(q_o->pol), pol_hnd, sizeof(q_o->pol)); + + make_uni_hdr(&(q_o->hdr_secret), len, len, 1); + make_unistr2(&(q_o->uni_secret), secret_name, len); + + q_o->des_access = desired_access; +} + +/******************************************************************* +reads or writes an LSA_Q_OPEN_SECRET structure. +********************************************************************/ +void lsa_io_q_open_secret(char *desc, LSA_Q_OPEN_SECRET *q_o, prs_struct *ps, int depth) +{ + if (q_o == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_q_open_secret"); + depth++; + + smb_io_pol_hnd("", &(q_o->pol), ps, depth); + + prs_align(ps); + smb_io_unihdr ("", &(q_o->hdr_secret), ps, depth); + smb_io_unistr2("", &(q_o->uni_secret), 1, ps, depth); + + prs_align(ps); + prs_uint32("des_access", ps, depth, &(q_o->des_access)); +} + +/******************************************************************* +reads or writes an LSA_R_OPEN_SECRET structure. +********************************************************************/ +void lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_o, prs_struct *ps, int depth) +{ + if (r_o == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_r_open_secret"); + depth++; + + smb_io_pol_hnd("", &(r_o->pol), ps, depth); + + prs_uint32("status", ps, depth, &(r_o->status)); +} + +/******************************************************************* +reads or writes an LSA_SECRET_VALUE structure. +********************************************************************/ +void lsa_io_secret_value(char *desc, LSA_SECRET_VALUE *value, prs_struct *ps, int depth) +{ + if (value == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_secret_value"); + depth++; + + prs_align(ps); + prs_uint32("ptr_secret", ps, depth, &(value->ptr_secret)); + + if (value->ptr_secret == 0) + { + return; + } + + smb_io_strhdr2("hdr_secret", &(value->hdr_secret), ps, depth); + smb_io_string2("secret" , &(value->secret ), + value->hdr_secret.buffer, ps, depth); +} + +/******************************************************************* +reads or writes an LSA_SECRET_INFO structure. +********************************************************************/ +void lsa_io_secret_info(char *desc, LSA_SECRET_INFO *info, prs_struct *ps, int depth) +{ + if (info == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_secret_info"); + depth++; + + prs_align(ps); + prs_uint32("ptr_value ", ps, depth, &(info->ptr_value )); + + if (info->ptr_value != 0) + { + lsa_io_secret_value("", &(info->value), ps, depth); + } + + prs_align(ps); + prs_uint32("ptr_update", ps, depth, &(info->ptr_update)); + + if (info->ptr_update != 0) + { + ps->align = 8; + prs_align(ps); + ps->align = 4; + + smb_io_time("last_update", &(info->last_update), ps, depth); + } +} + +/******************************************************************* +makes an LSA_Q_QUERY_SECRET structure. +********************************************************************/ +void make_q_query_secret(LSA_Q_QUERY_SECRET *q_q, POLICY_HND *pol) +{ + if (q_q == NULL) return; + + DEBUG(5,("make_q_query_secret")); + + memcpy(&(q_q->pol), pol, sizeof(q_q->pol)); + + /* Want secret */ + q_q->info.ptr_value = 1; + q_q->info.value.ptr_secret = 0; + + /* Want last change time */ + q_q->info.ptr_update = 1; + + /* Don't care about old info */ + q_q->oldinfo.ptr_value = 0; + q_q->oldinfo.ptr_update = 0; +} + +/******************************************************************* +reads or writes an LSA_Q_QUERY_SECRET structure. +********************************************************************/ +void lsa_io_q_query_secret(char *desc, LSA_Q_QUERY_SECRET *q_q, prs_struct *ps, int depth) +{ + if (q_q == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_q_query_secret"); + depth++; + + smb_io_pol_hnd("", &(q_q->pol), ps, depth); + + lsa_io_secret_info("", &(q_q->info ), ps, depth); + lsa_io_secret_info("", &(q_q->oldinfo), ps, depth); +} + +/******************************************************************* +reads or writes an LSA_Q_QUERY_SECRET structure. +********************************************************************/ +void lsa_io_r_query_secret(char *desc, LSA_R_QUERY_SECRET *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_r_query_secret"); + depth++; + + lsa_io_secret_info("", &(r_q->info ), ps, depth); + lsa_io_secret_info("", &(r_q->oldinfo), ps, depth); + + prs_align(ps); + prs_uint32("status", ps, depth, &(r_q->status)); +} + /******************************************************************* reads or writes an LSA_Q_ENUM_TRUST_DOM structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 1656c39139..e4b7578e67 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -204,6 +204,37 @@ void smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth) if (hdr->str_str_len > MAX_STRINGLEN) hdr->str_str_len = MAX_STRINGLEN; } +/******************************************************************* +creates a STRHDR2 structure. +********************************************************************/ +void make_strhdr2(STRHDR2 *hdr, uint32 max_len, uint32 len, uint32 buffer) +{ + hdr->str_max_len = max_len; + hdr->str_str_len = len; + hdr->buffer = buffer; +} + +/******************************************************************* +reads or writes a STRHDR2 structure. +********************************************************************/ +void smb_io_strhdr2(char *desc, STRHDR2 *hdr, prs_struct *ps, int depth) +{ + if (hdr == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_strhdr"); + depth++; + + prs_align(ps); + + prs_uint32("str_str_len", ps, depth, &(hdr->str_str_len)); + prs_uint32("str_max_len", ps, depth, &(hdr->str_max_len)); + prs_uint32("buffer ", ps, depth, &(hdr->buffer )); + + /* oops! XXXX maybe issue a warning that this is happening... */ + if (hdr->str_max_len > MAX_STRINGLEN) hdr->str_max_len = MAX_STRINGLEN; + if (hdr->str_str_len > MAX_STRINGLEN) hdr->str_str_len = MAX_STRINGLEN; +} + /******************************************************************* creates a UNIHDR structure. ********************************************************************/ -- cgit From eb82f27bd194f578ffa0557bdfb289e89a132e6b Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Thu, 18 Mar 1999 06:30:27 +0000 Subject: Changed hard-coded number of users/groups in SAMR_QUERY_DOMAIN_INFO to MAX_SAM_ENTRIES to prevent truncation of user lists. A proper implementation is not important right now. (This used to be commit 900238a66153c276d63780e3264651089291d185) --- source3/rpc_parse/parse_samr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 8fc56d3d9b..9e5c3b3495 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -398,9 +398,9 @@ void make_unk_info2(SAM_UNK_INFO_2 *u_2, char *domain, char *server) u_2->unknown_4 = 0x00000001; u_2->unknown_5 = 0x00000003; u_2->unknown_6 = 0x00000001; - u_2->num_domain_usrs = 0x00000008; - u_2->num_domain_grps = 0x00000003; - u_2->num_local_grps = 0x00000003; + u_2->num_domain_usrs = MAX_SAM_ENTRIES; + u_2->num_domain_grps = MAX_SAM_ENTRIES; + u_2->num_local_grps = MAX_SAM_ENTRIES; memset(u_2->padding, 0, sizeof(u_2->padding)); /* 12 bytes zeros */ -- cgit From f7eaf17216c91c66719b2393c7a8716fc55e4e5f Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Thu, 18 Mar 1999 09:36:43 +0000 Subject: Added SVC_START_SERVICE rpc. An NT PDC will attempt to start the NETLOGON service on its BDC's prior to initiating SAM replication. For now just return success. (This used to be commit 113d03a38a34e5c4115dab59349078093bcd4888) --- source3/rpc_parse/parse_svc.c | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c index e8cdd35a2c..f936df24b9 100644 --- a/source3/rpc_parse/parse_svc.c +++ b/source3/rpc_parse/parse_svc.c @@ -162,6 +162,54 @@ void svc_io_r_open_service(char *desc, SVC_R_OPEN_SERVICE *r_u, prs_struct *ps, prs_uint32("status ", ps, depth, &(r_u->status)); } +/******************************************************************* +reads or writes a SVC_Q_START_SERVICE structure. +********************************************************************/ +void svc_io_q_start_service(char *desc, SVC_Q_START_SERVICE *q_s, prs_struct *ps, int depth) +{ + if (q_s == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_q_start_service"); + depth++; + + prs_align(ps); + smb_io_pol_hnd("", &(q_s->pol), ps, depth); + + prs_align(ps); + prs_uint32("argc ", ps, depth, &(q_s->argc )); + prs_uint32("ptr_argv", ps, depth, &(q_s->ptr_argv)); + + if (q_s->ptr_argv != 0) + { + int i; + + prs_uint32("argc2 ", ps, depth, &(q_s->argc2)); + + if (q_s->argc2 > MAX_SVC_ARGS) + { + q_s->argc = q_s->argc2 = MAX_SVC_ARGS; + } + + for (i = 0; i < q_s->argc2; i++) + { + smb_io_unistr2("", &(q_s->argv[i]), 1, ps, depth); + } + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void svc_io_r_start_service(char *desc, SVC_R_START_SERVICE *r_s, prs_struct *ps, int depth) +{ + if (r_s == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_r_start_service"); + depth++; + + prs_uint32("status", ps, depth, &(r_s->status)); +} + /******************************************************************* make_svc_query_svc_cfg ********************************************************************/ -- cgit From 19e22bc8b6d8542567381d9bebdd9337019f7353 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 19 Mar 1999 21:15:03 +0000 Subject: value->enc_secret not value->secret (This used to be commit d6cee14f8049471b14337681cbeac115958fbac0) --- source3/rpc_parse/parse_lsa.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index c01664c15c..fc21546c61 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -448,14 +448,12 @@ void lsa_io_secret_value(char *desc, LSA_SECRET_VALUE *value, prs_struct *ps, in prs_align(ps); prs_uint32("ptr_secret", ps, depth, &(value->ptr_secret)); - if (value->ptr_secret == 0) + if (value->ptr_secret != 0) { - return; + smb_io_strhdr2("hdr_secret", &(value->hdr_secret), ps, depth); + smb_io_string2("secret" , &(value->enc_secret), + value->hdr_secret.buffer, ps, depth); } - - smb_io_strhdr2("hdr_secret", &(value->hdr_secret), ps, depth); - smb_io_string2("secret" , &(value->secret ), - value->hdr_secret.buffer, ps, depth); } /******************************************************************* -- cgit From da4cd4f5a9c8aaf9caddbc6864a6ba7ac4adf67f Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 19 Mar 1999 21:20:19 +0000 Subject: added a "createuser" command. (This used to be commit fefb4bf19181714cb73414febd6ee2ec10356cbe) --- source3/rpc_parse/parse_samr.c | 69 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 9e5c3b3495..4eaafea0fb 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3773,6 +3773,75 @@ void samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER *r_u, prs_struct *ps, int prs_uint32("status", ps, depth, &(r_u->status)); } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_samr_q_create_user(SAMR_Q_CREATE_USER *q_u, + POLICY_HND *pol, + const char *name, + uint16 acb_info, uint32 unk_1) +{ + int len_name; + if (q_u == NULL) return; + len_name = strlen(name); + + DEBUG(5,("samr_make_samr_q_create_user\n")); + + memcpy(&q_u->domain_pol, pol, sizeof(q_u->domain_pol)); + + make_uni_hdr(&(q_u->hdr_name), len_name, len_name, 1); + make_unistr2(&(q_u->uni_name), name, len_name); + + q_u->acb_info = acb_info; + q_u->unknown_1 = unk_1; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_q_create_user(char *desc, SAMR_Q_CREATE_USER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_q_create_user"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth); + prs_align(ps); + + smb_io_unihdr ("unihdr", &(q_u->hdr_name), ps, depth); + smb_io_unistr2("unistr2", &(q_u->uni_name), q_u->hdr_name.buffer, ps, depth); + prs_align(ps); + + prs_uint16("acb_info", ps, depth, &(q_u->acb_info)); + prs_align(ps); + prs_uint32("unknown_1", ps, depth, &(q_u->unknown_1)); + + prs_align(ps); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "samr_io_r_create_user"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("user_pol", &(r_u->user_pol), ps, depth); + prs_align(ps); + + prs_uint32("unknown_0", ps, depth, &(r_u->unknown_0)); + prs_uint32("user_rid ", ps, depth, &(r_u->user_rid )); + prs_uint32("status", ps, depth, &(r_u->status)); +} + /******************************************************************* makes a SAMR_Q_QUERY_USERINFO structure. ********************************************************************/ -- cgit From 2a34b224b83f72ae30ab1eb67391c331407c6335 Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Sun, 21 Mar 1999 12:55:18 +0000 Subject: Ensuring return status is aligned in SAMR_QUERY_DISPINFO response. (This used to be commit 1e17c2529c5162ea79fe2331ca2162ffb98bd6c2) --- source3/rpc_parse/parse_samr.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 4eaafea0fb..f85dd418ad 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1614,6 +1614,7 @@ void samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct } } + prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); } -- cgit From 5380636c4e29268adf214634ed8f36cef6f1a35b Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Tue, 23 Mar 1999 02:31:34 +0000 Subject: If a buffer pointer is NULL then its length_is() attribute should not be transmitted. Such a problem was crashing Server Manager. (This used to be commit 402ed18188dd058ebed2ffc2af9840c04533dc8f) --- source3/rpc_parse/parse_samr.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index f85dd418ad..f4447c7dc9 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1614,6 +1614,7 @@ void samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct } } + prs_align(ps); prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); } @@ -3688,10 +3689,17 @@ void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p prs_uint32("num_rids1", ps, depth, &(r_u->num_rids1)); prs_uint32("ptr_rids ", ps, depth, &(r_u->ptr_rids )); - prs_uint32("num_rids2", ps, depth, &(r_u->num_rids2)); - if (r_u->ptr_rids != 0 && r_u->num_rids1 != 0) + if (r_u->ptr_rids != 0) { + prs_uint32("num_rids2", ps, depth, &(r_u->num_rids2)); + + if (r_u->num_rids2 != r_u->num_rids1) + { + /* RPC fault */ + return; + } + for (i = 0; i < r_u->num_rids2; i++) { prs_grow(ps); @@ -3702,10 +3710,17 @@ void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p prs_uint32("num_types1", ps, depth, &(r_u->num_types1)); prs_uint32("ptr_types ", ps, depth, &(r_u->ptr_types )); - prs_uint32("num_types2", ps, depth, &(r_u->num_types2)); - if (r_u->ptr_types != 0 && r_u->num_types1 != 0) + if (r_u->ptr_types != 0) { + prs_uint32("num_types2", ps, depth, &(r_u->num_types2)); + + if (r_u->num_types2 != r_u->num_types1) + { + /* RPC fault */ + return; + } + for (i = 0; i < r_u->num_types2; i++) { prs_grow(ps); -- cgit From 803100197bdd9d221a5807b3ca279ac6769e2e26 Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Tue, 23 Mar 1999 13:45:42 +0000 Subject: Another UNICODE issue - this time BUFFER2 was being transmitted incorrectly. (This used to be commit 73730f6004c7eca1d852a569dede94095a396dca) --- source3/rpc_parse/parse_misc.c | 12 +++++------- source3/rpc_parse/parse_reg.c | 7 ++++--- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index e4b7578e67..da6ff2c7f6 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -458,19 +458,17 @@ void smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) /******************************************************************* creates a BUFFER2 structure. ********************************************************************/ -void make_buffer2(BUFFER2 *str, uint8 *buf, int len) +void make_buffer2(BUFFER2 *str, const char *buf, int len) { ZERO_STRUCTP(str); - /* max buffer size (allocated size) */ + /* set up string lengths. */ str->buf_max_len = len; str->undoc = 0; - str->buf_len = buf != NULL ? len : 0; + str->buf_len = len; - if (buf != NULL) - { - memcpy(str->buffer, buf, MIN(str->buf_len, sizeof(str->buffer))); - } + /* store the string (wide chars) */ + ascii_to_unistr(str->buffer, buf, len); } /******************************************************************* diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 5512f78499..ce0b7fff87 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -761,16 +761,17 @@ void make_reg_r_info(REG_R_INFO *r_r, uint32 level, char *os_type, uint32 status) { - char buf[512]; int len; - len = ascii_to_unibuf(buf, os_type, sizeof(buf)-2) - buf; + if (r_r == NULL || os_type == NULL) return; + + len = strlen(os_type) * 2; r_r->ptr1 = 1; r_r->level = level; r_r->ptr_type = 1; - make_buffer2(&(r_r->uni_type), buf, len); + make_buffer2(&(r_r->uni_type), os_type, len); r_r->ptr2 = 1; r_r->unknown_0 = len; -- cgit From 6b9cb3a2545226257d698406c1ab3b016464705e Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 23 Mar 1999 20:43:44 +0000 Subject: dynamic memory allocation in samr enum dom users. works with 849 entries now. (This used to be commit 103557e26b071bf1e65e025ef5a52ccdbf483d02) --- source3/rpc_parse/parse_samr.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index f4447c7dc9..a6069f5ff3 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1047,14 +1047,9 @@ void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, DEBUG(5,("make_samr_r_enum_dom_users\n")); - if (num_sam_entries >= MAX_SAM_ENTRIES) - { - num_sam_entries = MAX_SAM_ENTRIES; - DEBUG(5,("limiting number of entries to %d\n", - num_sam_entries)); - } - r_u->next_idx = next_idx; + r_u->sam = NULL; + r_u->uni_acct_name = NULL; if (num_sam_entries != 0) { @@ -1063,8 +1058,14 @@ void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, r_u->num_entries2 = num_sam_entries; r_u->num_entries3 = num_sam_entries; - SMB_ASSERT_ARRAY(r_u->sam, num_sam_entries); - SMB_ASSERT_ARRAY(r_u->uni_acct_name, num_sam_entries); + r_u->sam = Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); + r_u->uni_acct_name = Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_acct_name[0])); + + if (r_u->sam == NULL || r_u->uni_acct_name == NULL) + { + DEBUG(0,("NULL pointers in SAMR_R_QUERY_DISPINFO\n")); + return; + } for (i = 0; i < num_sam_entries; i++) { @@ -1110,7 +1111,17 @@ void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struc prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); - SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries2); + if (ps->io) + { + r_u->sam = Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); + r_u->uni_acct_name = Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_acct_name[0])); + } + + if ((r_u->sam == NULL || r_u->uni_acct_name == NULL) && r_u->num_entries2 != 0) + { + DEBUG(0,("NULL pointers in SAMR_R_QUERY_DISPINFO\n")); + return; + } for (i = 0; i < r_u->num_entries2; i++) { @@ -1118,8 +1129,6 @@ void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struc sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); } - SMB_ASSERT_ARRAY(r_u->uni_acct_name, r_u->num_entries2); - for (i = 0; i < r_u->num_entries2; i++) { prs_grow(ps); -- cgit From 22ab15823fde3926f4fea5538632a2215d30d435 Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Wed, 24 Mar 1999 12:18:28 +0000 Subject: Fixed LSA Lookup Names. There were a few too many NULL pointers in a negative response, which tended to crash lsass.exe. (This used to be commit 6d03f61d2536630968007958345cf44a42b03584) --- source3/rpc_parse/parse_lsa.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index fc21546c61..c5767735b0 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -71,7 +71,6 @@ static void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int de prs_align(ps); - prs_uint32("undoc_buffer ", ps, depth, &(r_r->undoc_buffer )); /* undocumented buffer pointer. */ prs_uint32("num_ref_doms_1", ps, depth, &(r_r->num_ref_doms_1)); /* num referenced domains? */ prs_uint32("ptr_ref_dom ", ps, depth, &(r_r->ptr_ref_dom )); /* undocumented buffer pointer. */ prs_uint32("max_entries ", ps, depth, &(r_r->max_entries )); /* 32 - max number of entries */ @@ -915,15 +914,29 @@ void lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, prs_align(ps); - lsa_io_dom_r_ref("", r_r->dom_ref, ps, depth); /* domain reference info */ + prs_uint32("ptr_dom_ref", ps, depth, &(r_r->ptr_dom_ref)); + if (r_r->ptr_dom_ref != 0) + { + lsa_io_dom_r_ref("", r_r->dom_ref, ps, depth); + } - prs_uint32("num_entries ", ps, depth, &(r_r->num_entries)); - prs_uint32("undoc_buffer", ps, depth, &(r_r->undoc_buffer)); - prs_uint32("num_entries2", ps, depth, &(r_r->num_entries2)); + prs_uint32("num_entries", ps, depth, &(r_r->num_entries)); + prs_uint32("ptr_entries", ps, depth, &(r_r->ptr_entries)); - for (i = 0; i < r_r->num_entries2; i++) + if (r_r->ptr_entries != 0) { - smb_io_dom_rid2("", &(r_r->dom_rid[i]), ps, depth); /* domain RIDs being looked up */ + prs_uint32("num_entries2", ps, depth, &(r_r->num_entries2)); + + if (r_r->num_entries2 != r_r->num_entries) + { + /* RPC fault */ + return; + } + + for (i = 0; i < r_r->num_entries2; i++) + { + smb_io_dom_rid2("", &(r_r->dom_rid[i]), ps, depth); /* domain RIDs being looked up */ + } } prs_uint32("mapped_count", ps, depth, &(r_r->mapped_count)); -- cgit From cd7c530f569045a47b51f357759f4cf5089992a0 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 24 Mar 1999 17:26:08 +0000 Subject: removed 2 unnecessary args from make_uni_hdr. (This used to be commit f84dede27e16a5f02ee6d02fe2d16f2661c65470) --- source3/rpc_parse/parse_lsa.c | 8 ++--- source3/rpc_parse/parse_misc.c | 10 +++---- source3/rpc_parse/parse_net.c | 28 ++++++++--------- source3/rpc_parse/parse_reg.c | 24 ++++++++------- source3/rpc_parse/parse_samr.c | 68 +++++++++++++++++++++--------------------- 5 files changed, 71 insertions(+), 67 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index c5767735b0..628b6ebe4f 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -35,7 +35,7 @@ void make_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, int len_name = strlen(name); trn->sid_name_use = sid_name_use; - make_uni_hdr(&(trn->hdr_name), len_name, len_name, 1); + make_uni_hdr(&(trn->hdr_name), len_name); make_unistr2(uni_name, name, len_name); trn->domain_idx = idx; } @@ -393,7 +393,7 @@ void make_q_open_secret(LSA_Q_OPEN_SECRET *q_o, POLICY_HND *pol_hnd, memcpy(&(q_o->pol), pol_hnd, sizeof(q_o->pol)); - make_uni_hdr(&(q_o->hdr_secret), len, len, 1); + make_uni_hdr(&(q_o->hdr_secret), len); make_unistr2(&(q_o->uni_secret), secret_name, len); q_o->des_access = desired_access; @@ -580,7 +580,7 @@ void make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, r_e->ptr_enum_domains = 1; r_e->num_domains2 = 1; - make_uni_hdr2(&(r_e->hdr_domain_name ), len_domain_name, len_domain_name, 4); + make_uni_hdr2(&(r_e->hdr_domain_name ), len_domain_name); make_unistr2 (&(r_e->uni_domain_name ), domain_name, len_domain_name); make_dom_sid2(&(r_e->other_domain_sid), domain_sid); } @@ -852,7 +852,7 @@ void make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, { const char* name = names[i]; int len = strlen(name); - make_uni_hdr(&q_l->hdr_name[i], len, len, len != 0); + make_uni_hdr(&q_l->hdr_name[i], len); make_unistr2(&q_l->uni_name[i], name, len); } diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index da6ff2c7f6..323d5f65e5 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -238,11 +238,11 @@ void smb_io_strhdr2(char *desc, STRHDR2 *hdr, prs_struct *ps, int depth) /******************************************************************* creates a UNIHDR structure. ********************************************************************/ -void make_uni_hdr(UNIHDR *hdr, int max_len, int len, uint32 buffer) +void make_uni_hdr(UNIHDR *hdr, int len) { hdr->uni_str_len = 2 * len; - hdr->uni_max_len = 2 * max_len; - hdr->buffer = buffer; + hdr->uni_max_len = 2 * len; + hdr->buffer = len != 0 ? 1 : 0; } /******************************************************************* @@ -334,9 +334,9 @@ void smb_io_hdrbuf(char *desc, BUFHDR *hdr, prs_struct *ps, int depth) /******************************************************************* creates a UNIHDR2 structure. ********************************************************************/ -void make_uni_hdr2(UNIHDR2 *hdr, int max_len, int len, uint16 terminate) +void make_uni_hdr2(UNIHDR2 *hdr, int len) { - make_uni_hdr(&(hdr->unihdr), max_len, len, terminate); + make_uni_hdr(&(hdr->unihdr), len); hdr->buffer = len > 0 ? 1 : 0; } diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 6c8b304a64..69d2b3bf57 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -561,13 +561,13 @@ void make_id_info1(NET_ID_INFO_1 *id, char *domain_name, id->ptr_id_info1 = 1; - make_uni_hdr(&(id->hdr_domain_name), len_domain_name, len_domain_name, 4); + make_uni_hdr(&(id->hdr_domain_name), len_domain_name); id->param_ctrl = param_ctrl; make_logon_id(&(id->logon_id), log_id_low, log_id_high); - make_uni_hdr(&(id->hdr_user_name ), len_user_name , len_user_name , 4); - make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name , len_wksta_name , 4); + make_uni_hdr(&(id->hdr_user_name ), len_user_name ); + make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name ); if (lm_cypher && nt_cypher) { @@ -677,13 +677,13 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name, id->ptr_id_info2 = 1; - make_uni_hdr(&(id->hdr_domain_name), len_domain_name, len_domain_name, 4); + make_uni_hdr(&(id->hdr_domain_name), len_domain_name); id->param_ctrl = param_ctrl; make_logon_id(&(id->logon_id), log_id_low, log_id_high); - make_uni_hdr(&(id->hdr_user_name ), len_user_name , len_user_name , 4); - make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name , len_wksta_name , 4); + make_uni_hdr(&(id->hdr_user_name ), len_user_name ); + make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name ); if (nt_chal_resp) { @@ -899,12 +899,12 @@ void make_net_user_info3(NET_USER_INFO_3 *usr, usr->pass_can_change_time = *pass_can_change_time; usr->pass_must_change_time = *pass_must_change_time; - make_uni_hdr(&(usr->hdr_user_name ), len_user_name , len_user_name , 4); - make_uni_hdr(&(usr->hdr_full_name ), len_full_name , len_full_name , 4); - make_uni_hdr(&(usr->hdr_logon_script), len_logon_script, len_logon_script, 4); - make_uni_hdr(&(usr->hdr_profile_path), len_profile_path, len_profile_path, 4); - make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir , len_home_dir , 4); - make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive , len_dir_drive , 4); + make_uni_hdr(&(usr->hdr_user_name ), len_user_name ); + make_uni_hdr(&(usr->hdr_full_name ), len_full_name ); + make_uni_hdr(&(usr->hdr_logon_script), len_logon_script); + make_uni_hdr(&(usr->hdr_profile_path), len_profile_path); + make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir ); + make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive ); usr->logon_count = logon_count; usr->bad_pw_count = bad_pw_count; @@ -924,8 +924,8 @@ void make_net_user_info3(NET_USER_INFO_3 *usr, bzero(usr->user_sess_key, sizeof(usr->user_sess_key)); } - make_uni_hdr(&(usr->hdr_logon_srv), len_logon_srv, len_logon_srv, 4); - make_uni_hdr(&(usr->hdr_logon_dom), len_logon_dom, len_logon_dom, 4); + make_uni_hdr(&(usr->hdr_logon_srv), len_logon_srv); + make_uni_hdr(&(usr->hdr_logon_dom), len_logon_dom); usr->buffer_dom_id = dom_sid ? 1 : 0; /* yes, we're bothering to put a domain SID in */ diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index ce0b7fff87..abb00e1572 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -161,10 +161,10 @@ void make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, memcpy(&(q_c->pnt_pol), hnd, sizeof(q_c->pnt_pol)); - make_uni_hdr(&(q_c->hdr_name), len_name, len_name, 1); + make_uni_hdr(&(q_c->hdr_name), len_name); make_unistr2(&(q_c->uni_name), name, len_name); - make_uni_hdr(&(q_c->hdr_class), len_class, len_class, 1); + make_uni_hdr(&(q_c->hdr_class), len_class); make_unistr2(&(q_c->uni_class), class, len_class); q_c->reserved = 0x00000000; @@ -249,7 +249,7 @@ void make_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd, memcpy(&(q_c->pnt_pol), hnd, sizeof(q_c->pnt_pol)); - make_uni_hdr(&(q_c->hdr_name), len_name, len_name, 1); + make_uni_hdr(&(q_c->hdr_name), len_name); make_unistr2(&(q_c->uni_name), name, len_name); } @@ -300,7 +300,7 @@ void make_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd, memcpy(&(q_c->pnt_pol), hnd, sizeof(q_c->pnt_pol)); - make_uni_hdr(&(q_c->hdr_name), len_name, len_name, 1); + make_uni_hdr(&(q_c->hdr_name), len_name); make_unistr2(&(q_c->uni_name), name, len_name); } @@ -349,7 +349,9 @@ void make_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, ZERO_STRUCTP(q_o); memcpy(&(q_o->pol), hnd, sizeof(q_o->pol)); - make_uni_hdr(&q_o->hdr_class, max_class_len, 0, max_class_len > 0 ? 1 : 0); + q_o->hdr_class.uni_str_len = 0; + q_o->hdr_class.uni_max_len = max_class_len * 2; + q_o->hdr_class.buffer = max_class_len > 0 ? 1 : 0; q_o->uni_class.uni_max_len = max_class_len; } @@ -690,7 +692,7 @@ void make_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char *product_type, memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); - make_uni_hdr(&(q_i->hdr_type), len_type, len_type, 1); + make_uni_hdr(&(q_i->hdr_type), len_type); make_unistr2(&(q_i->uni_type), product_type, len_type); q_i->ptr1 = 1; @@ -836,7 +838,9 @@ void make_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol, memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); q_i->val_index = val_idx; - make_uni_hdr(&q_i->hdr_name, max_val_len, 0, 1); + q_i->hdr_name.uni_str_len = 0; + q_i->hdr_name.uni_max_len = max_val_len * 2; + q_i->hdr_name.buffer = max_val_len > 0 ? 1 : 0; q_i->uni_name.uni_max_len = max_val_len; q_i->ptr_type = 1; @@ -951,7 +955,7 @@ void make_reg_q_create_val(REG_Q_CREATE_VALUE *q_i, POLICY_HND *pol, memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); - make_uni_hdr(&q_i->hdr_name, val_len, val_len, 1); + make_uni_hdr(&q_i->hdr_name, val_len); make_unistr2(&(q_i->uni_name), val_name, val_len); q_i->type = type; @@ -1116,7 +1120,7 @@ void make_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, memcpy(&(r_q->pol), pol, sizeof(r_q->pol)); - make_uni_hdr(&(r_q->hdr_name), len_name, len_name, 1); + make_uni_hdr(&(r_q->hdr_name), len_name); make_unistr2(&(r_q->uni_name), key_name, len_name); r_q->unknown_0 = 0x00000000; @@ -1191,7 +1195,7 @@ void make_reg_q_shutdown(REG_Q_SHUTDOWN *q_i, q_i->ptr_1 = 1; q_i->ptr_2 = 1; - make_uni_hdr(&q_i->hdr_msg, len, len, 1); + make_uni_hdr(&q_i->hdr_msg, len); make_unistr2(&(q_i->uni_msg), msg, len); q_i->timeout = timeout; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a6069f5ff3..a2fc77981e 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -87,7 +87,7 @@ void make_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN *q_u, memcpy(&(q_u->connect_pol), pol, sizeof(*pol)); - make_uni_hdr(&(q_u->hdr_domain), len_name, len_name, 1); + make_uni_hdr(&(q_u->hdr_domain), len_name); make_unistr2(&(q_u->uni_domain), dom_name, len_name); } @@ -389,8 +389,8 @@ void make_unk_info2(SAM_UNK_INFO_2 *u_2, char *domain, char *server) u_2->unknown_2 = 0x00000000; u_2->ptr_0 = 1; - make_uni_hdr(&(u_2->hdr_domain), len_domain, len_domain, 1); - make_uni_hdr(&(u_2->hdr_server), len_server, len_server, 1); + make_uni_hdr(&(u_2->hdr_domain), len_domain); + make_uni_hdr(&(u_2->hdr_server), len_server); u_2->seq_num = 0x10000000; u_2->unknown_3 = 0x00000000; @@ -758,9 +758,9 @@ static void make_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, sam->acb_info = acb_info; sam->pad = 0; - make_uni_hdr(&(sam->hdr_acct_name), len_sam_name, len_sam_name, len_sam_name != 0); - make_uni_hdr(&(sam->hdr_user_name), len_sam_full, len_sam_full, len_sam_full != 0); - make_uni_hdr(&(sam->hdr_user_desc), len_sam_desc, len_sam_desc, len_sam_desc != 0); + make_uni_hdr(&(sam->hdr_acct_name), len_sam_name); + make_uni_hdr(&(sam->hdr_user_name), len_sam_full); + make_uni_hdr(&(sam->hdr_user_desc), len_sam_desc); } /******************************************************************* @@ -818,8 +818,8 @@ static void make_sam_entry2(SAM_ENTRY2 *sam, uint32 user_idx, sam->acb_info = acb_info; sam->pad = 0; - make_uni_hdr(&(sam->hdr_srv_name), len_sam_name, len_sam_name, len_sam_name != 0); - make_uni_hdr(&(sam->hdr_srv_desc), len_sam_desc, len_sam_desc, len_sam_desc != 0); + make_uni_hdr(&(sam->hdr_srv_name), len_sam_name); + make_uni_hdr(&(sam->hdr_srv_desc), len_sam_desc); } /******************************************************************* @@ -874,8 +874,8 @@ static void make_sam_entry3(SAM_ENTRY3 *sam, uint32 grp_idx, sam->rid_grp = rid_grp; sam->attr = 0x07; /* group rid attributes - gets ignored by nt 4.0 */ - make_uni_hdr(&(sam->hdr_grp_name), len_grp_name, len_grp_name, len_grp_name != 0); - make_uni_hdr(&(sam->hdr_grp_desc), len_grp_desc, len_grp_desc, len_grp_desc != 0); + make_uni_hdr(&(sam->hdr_grp_name), len_grp_name); + make_uni_hdr(&(sam->hdr_grp_desc), len_grp_desc); } /******************************************************************* @@ -971,7 +971,7 @@ static void make_sam_entry(SAM_ENTRY *sam, uint32 len_sam_name, uint32 rid) DEBUG(5,("make_sam_entry\n")); sam->rid = rid; - make_uni_hdr(&(sam->hdr_name), len_sam_name, len_sam_name, len_sam_name != 0); + make_uni_hdr(&(sam->hdr_name), len_sam_name); } /******************************************************************* @@ -1693,12 +1693,12 @@ void make_samr_group_info1(GROUP_INFO1 *gr1, DEBUG(5,("make_samr_group_info1\n")); - make_uni_hdr(&(gr1->hdr_acct_name), acct_len , acct_len, acct_name ? 1 : 0); + make_uni_hdr(&(gr1->hdr_acct_name), acct_len); gr1->unknown_1 = 0x3; gr1->unknown_2 = 0x3; - make_uni_hdr(&(gr1->hdr_acct_desc), desc_len , desc_len, acct_desc ? 1 : 0); + make_uni_hdr(&(gr1->hdr_acct_desc), desc_len); make_unistr2(&(gr1->uni_acct_name), acct_name, acct_len); make_unistr2(&(gr1->uni_acct_desc), acct_desc, desc_len); @@ -1740,7 +1740,7 @@ void make_samr_group_info4(GROUP_INFO4 *gr4, const char *acct_desc) DEBUG(5,("make_samr_group_info4\n")); - make_uni_hdr(&(gr4->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0); + make_uni_hdr(&(gr4->hdr_acct_desc), acct_len); make_unistr2(&(gr4->uni_acct_desc), acct_desc, acct_len); } @@ -1811,7 +1811,7 @@ void make_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP *q_e, memcpy(&(q_e->pol), pol, sizeof(*pol)); - make_uni_hdr(&(q_e->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0); + make_uni_hdr(&(q_e->hdr_acct_desc), acct_len); make_unistr2(&(q_e->uni_acct_desc), acct_desc, acct_len); q_e->unknown_1 = 0x0002; @@ -2685,7 +2685,7 @@ void make_samr_alias_info3(ALIAS_INFO3 *al3, const char *acct_desc) DEBUG(5,("make_samr_alias_info3\n")); - make_uni_hdr(&(al3->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0); + make_uni_hdr(&(al3->hdr_acct_desc), acct_len); make_unistr2(&(al3->uni_acct_desc), acct_desc, acct_len); } @@ -3126,7 +3126,7 @@ void make_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u, for (i = 0; i < num_names; i++) { int len = name[i] != NULL ? strlen(name[i]) : 0; - make_uni_hdr(&(r_u->hdr_name[i]), len , len, name[i] ? 1 : 0); + make_uni_hdr(&(r_u->hdr_name[i]), len); make_unistr2(&(r_u->uni_name[i]), name[i], len); r_u->type[i] = type[i]; } @@ -3258,7 +3258,7 @@ void make_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS *q_u, POLICY_HND *hnd, memcpy(&(q_u->dom_pol), hnd, sizeof(q_u->dom_pol)); - make_uni_hdr(&(q_u->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0); + make_uni_hdr(&(q_u->hdr_acct_desc), acct_len); make_unistr2(&(q_u->uni_acct_desc), acct_desc, acct_len); q_u->unknown_1 = 0x001f; @@ -3593,7 +3593,7 @@ void make_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES *q_u, for (i = 0; i < num_names; i++) { int len_name = name[i] != NULL ? strlen(name[i]) : 0; - make_uni_hdr(&(q_u->hdr_name[i]), len_name, len_name, name[i] != NULL); /* unicode header for user_name */ + make_uni_hdr(&(q_u->hdr_name[i]), len_name); /* unicode header for user_name */ make_unistr2(&(q_u->uni_name[i]), name[i], len_name); /* unicode string for machine account */ } } @@ -3814,7 +3814,7 @@ void make_samr_q_create_user(SAMR_Q_CREATE_USER *q_u, memcpy(&q_u->domain_pol, pol, sizeof(q_u->domain_pol)); - make_uni_hdr(&(q_u->hdr_name), len_name, len_name, 1); + make_uni_hdr(&(q_u->hdr_name), len_name); make_unistr2(&(q_u->uni_name), name, len_name); q_u->acb_info = acb_info; @@ -3974,7 +3974,7 @@ void make_sam_user_info11(SAM_USER_INFO_11 *usr, memcpy(&(usr->expiry),expiry, sizeof(usr->expiry)); /* expiry time or something? */ bzero(usr->padding_1, sizeof(usr->padding_1)); /* 0 - padding 24 bytes */ - make_uni_hdr(&(usr->hdr_mach_acct), len_mach_acct, len_mach_acct, 4); /* unicode header for machine account */ + make_uni_hdr(&(usr->hdr_mach_acct), len_mach_acct); /* unicode header for machine account */ usr->padding_2 = 0; /* 0 - padding 4 bytes */ usr->ptr_1 = 1; /* pointer */ @@ -4105,16 +4105,16 @@ void make_sam_user_info21(SAM_USER_INFO_21 *usr, usr->pass_can_change_time = *pass_can_change_time; usr->pass_must_change_time = *pass_must_change_time; - make_uni_hdr(&(usr->hdr_user_name ), len_user_name , len_user_name , 1); - make_uni_hdr(&(usr->hdr_full_name ), len_full_name , len_full_name , 1); - make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir , len_home_dir , 1); - make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive , len_dir_drive , 1); - make_uni_hdr(&(usr->hdr_logon_script), len_logon_script, len_logon_script, 1); - make_uni_hdr(&(usr->hdr_profile_path), len_profile_path, len_profile_path, 1); - make_uni_hdr(&(usr->hdr_acct_desc ), len_description , len_description , 1); - make_uni_hdr(&(usr->hdr_workstations), len_workstations, len_workstations, 1); - make_uni_hdr(&(usr->hdr_unknown_str ), len_unknown_str , len_unknown_str , 1); - make_uni_hdr(&(usr->hdr_munged_dial ), len_munged_dial , len_munged_dial , 1); + make_uni_hdr(&(usr->hdr_user_name ), len_user_name ); + make_uni_hdr(&(usr->hdr_full_name ), len_full_name ); + make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir ); + make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive ); + make_uni_hdr(&(usr->hdr_logon_script), len_logon_script); + make_uni_hdr(&(usr->hdr_profile_path), len_profile_path); + make_uni_hdr(&(usr->hdr_acct_desc ), len_description ); + make_uni_hdr(&(usr->hdr_workstations), len_workstations); + make_uni_hdr(&(usr->hdr_unknown_str ), len_unknown_str ); + make_uni_hdr(&(usr->hdr_munged_dial ), len_munged_dial ); bzero(usr->nt_pwd, sizeof(usr->nt_pwd)); bzero(usr->lm_pwd, sizeof(usr->lm_pwd)); @@ -4520,7 +4520,7 @@ void make_samr_q_unknown_38(SAMR_Q_UNKNOWN_38 *q_u, char *srv_name) DEBUG(5,("make_samr_q_unknown_38\n")); q_u->ptr = 1; - make_uni_hdr(&(q_u->hdr_srv_name), len_srv_name, len_srv_name, len_srv_name != 0); + make_uni_hdr(&(q_u->hdr_srv_name), len_srv_name); make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name); } @@ -4652,9 +4652,9 @@ void make_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, DEBUG(5,("make_samr_q_chgpasswd_user\n")); q_u->ptr_0 = 1; - make_uni_hdr(&(q_u->hdr_dest_host), len_dest_host, len_dest_host, len_dest_host != 0); + make_uni_hdr(&(q_u->hdr_dest_host), len_dest_host); make_unistr2(&(q_u->uni_dest_host), dest_host, len_dest_host); - make_uni_hdr(&(q_u->hdr_user_name), len_user_name, len_user_name, len_user_name != 0); + make_uni_hdr(&(q_u->hdr_user_name), len_user_name); make_unistr2(&(q_u->uni_user_name), user_name, len_user_name); make_enc_passwd(&(q_u->nt_newpass), nt_newpass); -- cgit From d4de2b0ae342170a583126d9edf7adda97538d65 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 24 Mar 1999 21:09:34 +0000 Subject: matt, you had removed a "pointer" from DOM_R_REF structure which made it possible to fix lsa_r_lookup_names, but forgot to add that pointer in to lsa_r_lookup_sids, where DOM_R_REF was also being used. (This used to be commit 9092368af8adbf412c71af7216365e926593d54d) --- source3/rpc_parse/parse_lsa.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 628b6ebe4f..dbcc9d8bcc 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -820,7 +820,11 @@ void lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, i prs_align(ps); - lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth); /* domain reference info */ + prs_uint32("ptr_dom_ref", ps, depth, &(r_s->ptr_dom_ref)); + if (r_s->ptr_dom_ref != 0) + { + lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth); /* domain reference info */ + } lsa_io_trans_names("names ", r_s->names , ps, depth); /* translated names */ prs_align(ps); -- cgit From 43a460075a39148060d4193fcb9c62bfa4acc737 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 25 Mar 1999 13:54:31 +0000 Subject: SAM database "set user info". ---------------------------- - removed DOM_RID4 - removed SAMR_UNKNOWN_32 - added SAMR_SET_USERINFO (opcode 0x32) - added level 0x1 to SAMR_QUERY_DOM_INFO (needed for create user) - fixed pwdb_gethexpwd() it was failing on XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - added mod_sam21pwd_entry() - preparing to call mod_sam21pwd_entry() - added "user session key" to user_struct.dc. this is md4(nt#) and is needed to decode user's clear-text passwords in SAMR_SET_USERINFO. - split code out in chgpasswd.c to decode 516 byte password buffers. (This used to be commit 2e58ed742435befe419aa366c4052019fede8c23) --- source3/rpc_parse/parse_misc.c | 10 -- source3/rpc_parse/parse_samr.c | 326 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 313 insertions(+), 23 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 323d5f65e5..64cbdef716 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -702,16 +702,6 @@ void smb_io_dom_rid3(char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) prs_uint32("unk ", ps, depth, &(rid3->unk )); } -/******************************************************************* -creates a DOM_RID4 structure. -********************************************************************/ -void make_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid) -{ - rid4->unknown = unknown; - rid4->attr = attr; - rid4->rid = rid; -} - /******************************************************************* makes a DOM_CLNT_SRV structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a2fc77981e..f724535a8c 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -449,6 +449,38 @@ void sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 *u_2, prs_struct *ps, int depth } +/******************************************************************* +makes a structure. +********************************************************************/ +void make_unk_info1(SAM_UNK_INFO_1 *u_1) +{ + if (u_1 == NULL) return; + + memset(u_1->padding, 0, sizeof(u_1->padding)); /* 12 bytes zeros */ + u_1->unknown_1 = 0x80000000; + u_1->unknown_2 = 0x00000000; + u_1->unknown_3 = 0x00000000; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void sam_io_unk_info1(char *desc, SAM_UNK_INFO_1 *u_1, prs_struct *ps, int depth) +{ + if (u_1 == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_unk_info1"); + depth++; + + prs_uint8s(False, "padding", ps, depth, u_1->padding, sizeof(u_1->padding)); /* 12 bytes zeros */ + + prs_uint32("unknown_1", ps, depth, &u_1->unknown_1); /* 0x8000 0000 */ + prs_uint32("unknown_2", ps, depth, &u_1->unknown_2); /* 0x0000 0000 */ + prs_uint32("unknown_3", ps, depth, &u_1->unknown_3); /* 0x0000 0000 */ + + prs_align(ps); +} + /******************************************************************* makes a SAMR_R_QUERY_DOMAIN_INFO structure. ********************************************************************/ @@ -507,6 +539,11 @@ void samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_str sam_io_unk_info2("unk_inf2", &r_u->ctr->info.inf2, ps, depth); break; } + case 0x01: + { + sam_io_unk_info1("unk_inf1", &r_u->ctr->info.inf1, ps, depth); + break; + } default: { DEBUG(3,("samr_io_r_query_dom_info: unknown switch level 0x%x\n", @@ -3847,6 +3884,25 @@ void samr_io_q_create_user(char *desc, SAMR_Q_CREATE_USER *q_u, prs_struct *ps, prs_align(ps); } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void make_samr_r_create_user(SAMR_R_CREATE_USER *r_u, + POLICY_HND *user_pol, + uint32 unk_0, uint32 user_rid, + uint32 status) +{ + if (r_u == NULL) return; + + DEBUG(5,("samr_make_samr_r_create_user\n")); + + memcpy(&r_u->user_pol, user_pol, sizeof(r_u->user_pol)); + + r_u->unknown_0 = unk_0; + r_u->user_rid = user_rid; + r_u->status = status; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -4049,6 +4105,186 @@ void sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int prs_uint8s (False, "padding_9", ps, depth, usr->padding_9, sizeof(usr->padding_9)); } +/************************************************************************* + make_sam_user_info23 + + unknown_3 = 0x09f8 27fa + unknown_5 = 0x0001 0000 + unknown_6 = 0x0000 04ec + + *************************************************************************/ +void make_sam_user_info23(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 *logon_script, + char *profile_path, + char *description, + char *workstations, + char *unknown_str, + char *munged_dial, + + uint32 user_rid, /* 0x0000 0000 */ + uint32 group_rid, + uint16 acb_info, + + uint32 unknown_3, + uint16 logon_divs, + LOGON_HRS *hrs, + uint32 unknown_5, + char newpass[516], + uint32 unknown_6) +{ + int len_user_name = user_name != NULL ? strlen(user_name ) : 0; + int len_full_name = full_name != NULL ? strlen(full_name ) : 0; + int len_home_dir = home_dir != NULL ? strlen(home_dir ) : 0; + int len_dir_drive = dir_drive != NULL ? strlen(dir_drive ) : 0; + int len_logon_script = logon_script != NULL ? strlen(logon_script) : 0; + int len_profile_path = profile_path != NULL ? strlen(profile_path) : 0; + int len_description = description != NULL ? strlen(description ) : 0; + int len_workstations = workstations != NULL ? strlen(workstations) : 0; + int len_unknown_str = unknown_str != NULL ? strlen(unknown_str ) : 0; + int len_munged_dial = munged_dial != NULL ? strlen(munged_dial ) : 0; + + 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 */ + + make_uni_hdr(&(usr->hdr_user_name ), len_user_name ); /* NULL */ + make_uni_hdr(&(usr->hdr_full_name ), len_full_name ); + make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir ); + make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive ); + make_uni_hdr(&(usr->hdr_logon_script), len_logon_script); + make_uni_hdr(&(usr->hdr_profile_path), len_profile_path); + make_uni_hdr(&(usr->hdr_acct_desc ), len_description ); + make_uni_hdr(&(usr->hdr_workstations), len_workstations); + make_uni_hdr(&(usr->hdr_unknown_str ), len_unknown_str ); + make_uni_hdr(&(usr->hdr_munged_dial ), len_munged_dial ); + + bzero(usr->nt_pwd, sizeof(usr->nt_pwd)); + bzero(usr->lm_pwd, sizeof(usr->lm_pwd)); + + usr->user_rid = user_rid; /* 0x0000 0000 */ + usr->group_rid = group_rid; + usr->acb_info = acb_info; + usr->unknown_3 = unknown_3; /* 09f8 27fa */ + + usr->logon_divs = logon_divs; /* should be 168 (hours/week) */ + usr->ptr_logon_hrs = hrs ? 1 : 0; + + bzero(usr->padding1, sizeof(usr->padding1)); + + usr->unknown_5 = unknown_5; /* 0x0001 0000 */ + + memcpy(usr->pass, newpass, sizeof(usr->pass)); + + make_unistr2(&(usr->uni_user_name ), user_name , len_user_name ); /* NULL */ + make_unistr2(&(usr->uni_full_name ), full_name , len_full_name ); + make_unistr2(&(usr->uni_home_dir ), home_dir , len_home_dir ); + make_unistr2(&(usr->uni_dir_drive ), dir_drive , len_dir_drive ); + make_unistr2(&(usr->uni_logon_script), logon_script, len_logon_script); + make_unistr2(&(usr->uni_profile_path), profile_path, len_profile_path); + make_unistr2(&(usr->uni_acct_desc ), description , len_description ); + make_unistr2(&(usr->uni_workstations), workstations, len_workstations); + make_unistr2(&(usr->uni_unknown_str ), unknown_str , len_unknown_str ); + make_unistr2(&(usr->uni_munged_dial ), munged_dial , len_munged_dial ); + + usr->unknown_6 = unknown_6; /* 0x0000 04ec */ + usr->padding4 = 0; + + if (hrs) + { + memcpy(&(usr->logon_hrs), hrs, sizeof(usr->logon_hrs)); + } + else + { + memset(&(usr->logon_hrs), 0xff, sizeof(usr->logon_hrs)); + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static void sam_io_user_info23(char *desc, SAM_USER_INFO_23 *usr, prs_struct *ps, int depth) +{ + if (usr == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_user_info"); + depth++; + + prs_align(ps); + + smb_io_time("logon_time ", &(usr->logon_time) , ps, depth); + smb_io_time("logoff_time ", &(usr->logoff_time) , ps, depth); + smb_io_time("kickoff_time ", &(usr->kickoff_time) , ps, depth); + smb_io_time("pass_last_set_time ", &(usr->pass_last_set_time) , ps, depth); + smb_io_time("pass_can_change_time ", &(usr->pass_can_change_time) , ps, depth); + smb_io_time("pass_must_change_time", &(usr->pass_must_change_time), ps, depth); + + smb_io_unihdr("hdr_user_name ", &(usr->hdr_user_name) , ps, depth); /* username unicode string header */ + smb_io_unihdr("hdr_full_name ", &(usr->hdr_full_name) , ps, depth); /* user's full name unicode string header */ + smb_io_unihdr("hdr_home_dir ", &(usr->hdr_home_dir) , ps, depth); /* home directory unicode string header */ + smb_io_unihdr("hdr_dir_drive ", &(usr->hdr_dir_drive) , ps, depth); /* home directory drive */ + smb_io_unihdr("hdr_logon_script", &(usr->hdr_logon_script), ps, depth); /* logon script unicode string header */ + smb_io_unihdr("hdr_profile_path", &(usr->hdr_profile_path), ps, depth); /* profile path unicode string header */ + smb_io_unihdr("hdr_acct_desc ", &(usr->hdr_acct_desc ) , ps, depth); /* account description */ + smb_io_unihdr("hdr_workstations", &(usr->hdr_workstations), ps, depth); /* workstations user can log on from */ + smb_io_unihdr("hdr_unknown_str ", &(usr->hdr_unknown_str ), ps, depth); /* unknown string */ + smb_io_unihdr("hdr_munged_dial ", &(usr->hdr_munged_dial ), ps, depth); /* workstations user can log on from */ + + prs_uint8s (False, "lm_pwd ", ps, depth, usr->lm_pwd , sizeof(usr->lm_pwd )); + prs_uint8s (False, "nt_pwd ", ps, depth, usr->nt_pwd , sizeof(usr->nt_pwd )); + + prs_uint32("user_rid ", ps, depth, &(usr->user_rid )); /* User ID */ + prs_uint32("group_rid ", ps, depth, &(usr->group_rid )); /* Group ID */ + prs_uint16("acb_info ", ps, depth, &(usr->acb_info )); /* Group ID */ + prs_align(ps); + + prs_uint32("unknown_3 ", ps, depth, &(usr->unknown_3 )); + prs_uint16("logon_divs ", ps, depth, &(usr->logon_divs )); /* logon divisions per week */ + prs_align(ps); + prs_uint32("ptr_logon_hrs ", ps, depth, &(usr->ptr_logon_hrs)); + prs_uint8s (False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1)); + prs_uint32("unknown_5 ", ps, depth, &(usr->unknown_5 )); + + prs_uint8s (False, "password ", ps, depth, usr->pass, sizeof(usr->pass)); + + /* here begins pointed-to data */ + + smb_io_unistr2("uni_user_name ", &(usr->uni_user_name) , usr->hdr_user_name .buffer, ps, depth); /* username unicode string */ + smb_io_unistr2("uni_full_name ", &(usr->uni_full_name) , usr->hdr_full_name .buffer, ps, depth); /* user's full name unicode string */ + smb_io_unistr2("uni_home_dir ", &(usr->uni_home_dir) , usr->hdr_home_dir .buffer, ps, depth); /* home directory unicode string */ + smb_io_unistr2("uni_dir_drive ", &(usr->uni_dir_drive) , usr->hdr_dir_drive .buffer, ps, depth); /* home directory drive unicode string */ + smb_io_unistr2("uni_logon_script", &(usr->uni_logon_script), usr->hdr_logon_script.buffer, ps, depth); /* logon script unicode string */ + smb_io_unistr2("uni_profile_path", &(usr->uni_profile_path), usr->hdr_profile_path.buffer, ps, depth); /* profile path unicode string */ + smb_io_unistr2("uni_acct_desc ", &(usr->uni_acct_desc ), usr->hdr_acct_desc .buffer, ps, depth); /* user description unicode string */ + smb_io_unistr2("uni_workstations", &(usr->uni_workstations), usr->hdr_workstations.buffer, ps, depth); /* worksations user can log on from */ + smb_io_unistr2("uni_unknown_str ", &(usr->uni_unknown_str ), usr->hdr_unknown_str .buffer, ps, depth); /* unknown string */ + smb_io_unistr2("uni_munged_dial ", &(usr->uni_munged_dial ), usr->hdr_munged_dial .buffer, ps, depth); /* worksations user can log on from */ + + prs_uint32("unknown_6 ", ps, depth, &(usr->unknown_6 )); + prs_uint32("padding4 ", ps, depth, &(usr->padding4 )); + + if (usr->ptr_logon_hrs) + { + sam_io_logon_hrs("logon_hrs", &(usr->logon_hrs) , ps, depth); + prs_align(ps); + } +} + + /************************************************************************* make_sam_user_info21 @@ -4353,14 +4589,47 @@ void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc prs_uint32("status", ps, depth, &(r_u->status)); } +/******************************************************************* +makes a SAMR_Q_SET_USERINFO structure. +********************************************************************/ +void make_samr_q_set_userinfo(SAMR_Q_SET_USERINFO *q_u, + POLICY_HND *hnd, + uint16 switch_value, void *info) +{ + if (q_u == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_set_userinfo\n")); + + memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); + q_u->switch_value = switch_value; + q_u->switch_value2 = switch_value; + + switch (switch_value) + { + case 0x17: + { + q_u->info.id23 = (SAM_USER_INFO_23*)info; + + break; + } + + default: + { + DEBUG(4,("make_samr_q_set_userinfo: unsupported switch level\n")); + break; + } + } +} + + /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_unknown_32(char *desc, SAMR_Q_UNKNOWN_32 *q_u, prs_struct *ps, int depth) +void samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_q_unknown_32"); + prs_debug(ps, depth, desc, "samr_io_q_set_userinfo"); depth++; prs_align(ps); @@ -4368,35 +4637,66 @@ void samr_io_q_unknown_32(char *desc, SAMR_Q_UNKNOWN_32 *q_u, prs_struct *ps, i smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); prs_align(ps); - smb_io_unihdr ("", &(q_u->hdr_mach_acct), ps, depth); - smb_io_unistr2("", &(q_u->uni_mach_acct), q_u->hdr_mach_acct.buffer, ps, depth); + prs_uint16("switch_value ", ps, depth, &(q_u->switch_value )); + prs_uint16("switch_value2", ps, depth, &(q_u->switch_value2)); prs_align(ps); - prs_uint32("acct_ctrl", ps, depth, &(q_u->acct_ctrl)); - prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1)); - prs_uint16("unknown_2", ps, depth, &(q_u->unknown_2)); + switch (q_u->switch_value) + { + case 0: + { + break; + } + case 23: + { + q_u->info.id = Realloc(NULL, sizeof(*q_u->info.id23)); + if (q_u->info.id == NULL) + { + DEBUG(2,("samr_io_q_query_userinfo: info pointer not initialised\n")); + return; + } + sam_io_user_info23("", q_u->info.id23, ps, depth); + break; + } + default: + { + DEBUG(2,("samr_io_q_query_userinfo: unknown switch level\n")); + break; + } + + } + prs_align(ps); +} + +/******************************************************************* +makes a SAMR_R_SET_USERINFO structure. +********************************************************************/ +void make_samr_r_set_userinfo(SAMR_R_SET_USERINFO *r_u, uint32 status) + +{ + if (r_u == NULL) return; + + DEBUG(5,("make_samr_r_set_userinfo\n")); + + r_u->status = status; /* return status */ } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_unknown_32(char *desc, SAMR_R_UNKNOWN_32 *r_u, prs_struct *ps, int depth) +void samr_io_r_set_userinfo(char *desc, SAMR_R_SET_USERINFO *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return; - prs_debug(ps, depth, desc, "samr_io_r_unknown_32"); + prs_debug(ps, depth, desc, "samr_io_r_set_userinfo"); depth++; prs_align(ps); - smb_io_pol_hnd("pol", &(r_u->pol), ps, depth); - prs_align(ps); - prs_uint32("status", ps, depth, &(r_u->status)); } - /******************************************************************* makes a SAMR_Q_CONNECT structure. ********************************************************************/ -- cgit From fa01e8764c9da8d0e37f07dbe1a3b116a0640acc Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 25 Mar 1999 15:14:30 +0000 Subject: added SAMR_USER_INFO_24 info level to samr_set_userinfo. this is used by "Welcome to SAMBA Domain". (This used to be commit 4aed18b5e1e2309c0f6931fbfdd604b01cb9498a) --- source3/rpc_parse/parse_samr.c | 49 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index f724535a8c..09c881a812 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4105,6 +4105,37 @@ void sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int prs_uint8s (False, "padding_9", ps, depth, usr->padding_9, sizeof(usr->padding_9)); } +/************************************************************************* + make_sam_user_infoa + + unknown_3 = 0x09f8 27fa + unknown_5 = 0x0001 0000 + unknown_6 = 0x0000 04ec + + *************************************************************************/ +void make_sam_user_info_24(SAM_USER_INFO_24 *usr, + char newpass[516]) +{ + memcpy(usr->pass, newpass, sizeof(usr->pass)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static void sam_io_user_info_24(char *desc, SAM_USER_INFO_24 *usr, prs_struct *ps, int depth) +{ + if (usr == NULL) return; + + prs_debug(ps, depth, desc, "lsa_io_user_info"); + depth++; + + prs_align(ps); + + prs_uint8s (False, "password", ps, depth, usr->pass, sizeof(usr->pass)); + prs_align(ps); +} + + /************************************************************************* make_sam_user_info23 @@ -4606,6 +4637,13 @@ void make_samr_q_set_userinfo(SAMR_Q_SET_USERINFO *q_u, switch (switch_value) { + case 0x18: + { + q_u->info.id24 = (SAM_USER_INFO_24*)info; + + break; + } + case 0x17: { q_u->info.id23 = (SAM_USER_INFO_23*)info; @@ -4648,6 +4686,17 @@ void samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO *q_u, prs_struct *ps { break; } + case 24: + { + q_u->info.id = Realloc(NULL, sizeof(*q_u->info.id24)); + if (q_u->info.id == NULL) + { + DEBUG(2,("samr_io_q_query_userinfo: info pointer not initialised\n")); + return; + } + sam_io_user_info_24("", q_u->info.id24, ps, depth); + break; + } case 23: { q_u->info.id = Realloc(NULL, sizeof(*q_u->info.id23)); -- cgit From 6ce4aaad2ba38fce30c54dac4f7552b4b748e224 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 29 Mar 1999 17:24:46 +0000 Subject: added SamrQueryDomainInfo call info level 0x3 for kix32.exe support (This used to be commit ac070dfd39bfa9b60680855585155ce528ab7691) --- source3/rpc_parse/parse_samr.c | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 09c881a812..6b75136f94 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -319,6 +319,34 @@ void samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO *q_u, prs_st } +/******************************************************************* +makes a structure. +********************************************************************/ +void make_unk_info3(SAM_UNK_INFO_3 *u_3) +{ + if (u_3 == NULL) return; + + u_3->unknown_0 = 0x00000000; + u_3->unknown_1 = 0x80000000; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void sam_io_unk_info3(char *desc, SAM_UNK_INFO_3 *u_3, prs_struct *ps, int depth) +{ + if (u_3 == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_unk_info3"); + depth++; + + prs_uint32("unknown_0", ps, depth, &u_3->unknown_0); /* 0x0000 0000 */ + prs_uint32("unknown_1", ps, depth, &u_3->unknown_1); /* 0x8000 0000 */ + + prs_align(ps); + +} + /******************************************************************* makes a structure. ********************************************************************/ @@ -459,7 +487,6 @@ void make_unk_info1(SAM_UNK_INFO_1 *u_1) memset(u_1->padding, 0, sizeof(u_1->padding)); /* 12 bytes zeros */ u_1->unknown_1 = 0x80000000; u_1->unknown_2 = 0x00000000; - u_1->unknown_3 = 0x00000000; } /******************************************************************* @@ -476,7 +503,6 @@ void sam_io_unk_info1(char *desc, SAM_UNK_INFO_1 *u_1, prs_struct *ps, int depth prs_uint32("unknown_1", ps, depth, &u_1->unknown_1); /* 0x8000 0000 */ prs_uint32("unknown_2", ps, depth, &u_1->unknown_2); /* 0x0000 0000 */ - prs_uint32("unknown_3", ps, depth, &u_1->unknown_3); /* 0x0000 0000 */ prs_align(ps); } @@ -524,14 +550,19 @@ void samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_str { switch (r_u->switch_value) { + case 0x07: + { + sam_io_unk_info7("unk_inf7", &r_u->ctr->info.inf7, ps, depth); + break; + } case 0x06: { sam_io_unk_info6("unk_inf6", &r_u->ctr->info.inf6, ps, depth); break; } - case 0x07: + case 0x03: { - sam_io_unk_info7("unk_inf7", &r_u->ctr->info.inf7, ps, depth); + sam_io_unk_info3("unk_inf3", &r_u->ctr->info.inf3, ps, depth); break; } case 0x02: @@ -552,6 +583,8 @@ void samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_str } } } + + prs_uint32("status ", ps, depth, &(r_u->status)); } -- cgit From 373ea639e03e72bef8242133abbf678cf90ed0d9 Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Thu, 8 Apr 1999 05:36:15 +0000 Subject: Mainly BDC-related changes. * Added SEC_CHAN_BDC * Propagate sec_chan into the various functions which change trust account passwords, so they can be used for domain control and inter-domain trusts. * Fix for endianness problem reported by Edan Idzerda . A BUFFER2 is really a "unibuf" in my terminology and we should treat it as such. * Added some more common NT structures (BIGINT, BUFHDR2, BUFFER4). * Added NET_SAM_SYNC (-> NetDatabaseSync2) RPC for account replication. Still experimental and incomplete, with a few too many NULL security descriptors lying around (must go look at Jeremy's SD code). Haven't worked out password encryption yet either. However, the XXX_INFO structures I've added to rpc_netlogon.h are quite nice as they give some insight into how these objects are stored in the SAM. (This used to be commit 7b830350eb54dc9d357c115e12ddf9a0633527ac) --- source3/rpc_parse/parse_misc.c | 99 ++++++--- source3/rpc_parse/parse_net.c | 484 ++++++++++++++++++++++++++++++++++++++++- source3/rpc_parse/parse_prs.c | 2 +- source3/rpc_parse/parse_reg.c | 9 +- 4 files changed, 550 insertions(+), 44 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 64cbdef716..51587e6d7a 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -28,6 +28,21 @@ extern int DEBUGLEVEL; +/******************************************************************* +reads or writes a BIGINT structure. +********************************************************************/ +void smb_io_bigint(char *desc, BIGINT *bigint, prs_struct *ps, int depth) +{ + if (bigint == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_bigint"); + depth++; + + prs_align(ps); + + prs_uint32("low ", ps, depth, &(bigint->low )); + prs_uint32("high", ps, depth, &(bigint->high)); +} /******************************************************************* reads or writes a UTIME type. @@ -311,6 +326,7 @@ void smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, ps->offset = old_offset; } } + /******************************************************************* reads or writes a BUFHDR structure. ********************************************************************/ @@ -331,6 +347,32 @@ void smb_io_hdrbuf(char *desc, BUFHDR *hdr, prs_struct *ps, int depth) if (hdr->buf_len > MAX_BUFFERLEN) hdr->buf_len = MAX_BUFFERLEN; } +/******************************************************************* +creates a BUFHDR2 structure. +********************************************************************/ +void make_bufhdr2(BUFHDR2 *hdr, uint32 info_level, uint32 length, uint32 buffer) +{ + hdr->info_level = info_level; + hdr->length = length; + hdr->buffer = buffer; +} + +/******************************************************************* +reads or writes a BUFHDR2 structure. +********************************************************************/ +void smb_io_bufhdr2(char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) +{ + if (hdr == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_bufhdr2"); + depth++; + + prs_align(ps); + prs_uint32("info_level", ps, depth, &(hdr->info_level)); + prs_uint32("length ", ps, depth, &(hdr->length )); + prs_uint32("buffer ", ps, depth, &(hdr->buffer )); +} + /******************************************************************* creates a UNIHDR2 structure. ********************************************************************/ @@ -455,6 +497,27 @@ void smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) if (buf3->buf_len > MAX_UNISTRLEN) buf3->buf_len = MAX_UNISTRLEN; } +/******************************************************************* +reads or writes a BUFFER4 structure. +********************************************************************/ +void smb_io_buffer4(char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth) +{ + if ((buf4 == NULL) || (buffer == 0)) return; + + prs_debug(ps, depth, desc, "smb_io_buffer4"); + depth++; + + prs_align(ps); + prs_uint32("buf_len", ps, depth, &(buf4->buf_len)); + + if (buf4->buf_len > MAX_BUFFERLEN) + { + buf4->buf_len = MAX_BUFFERLEN; + } + + prs_uint8s(True, "buffer", ps, depth, buf4->buffer, buf4->buf_len); +} + /******************************************************************* creates a BUFFER2 structure. ********************************************************************/ @@ -463,12 +526,11 @@ void make_buffer2(BUFFER2 *str, const char *buf, int len) ZERO_STRUCTP(str); /* set up string lengths. */ - str->buf_max_len = len; + str->buf_max_len = str->buf_len = len * 2; str->undoc = 0; - str->buf_len = len; - /* store the string (wide chars) */ - ascii_to_unistr(str->buffer, buf, len); + /* store the string */ + ascii_to_unibuf(str->buffer, buf, len); } /******************************************************************* @@ -909,35 +971,6 @@ void smb_io_clnt_info(char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int dept smb_io_cred ("", &(clnt->cred ), ps, depth); } -/******************************************************************* -makes a DOM_LOGON_ID structure. -********************************************************************/ -void make_logon_id(DOM_LOGON_ID *log, uint32 log_id_low, uint32 log_id_high) -{ - if (log == NULL) return; - - DEBUG(5,("make_logon_id: %d\n", __LINE__)); - - log->low = log_id_low; - log->high = log_id_high; -} - -/******************************************************************* -reads or writes a DOM_LOGON_ID structure. -********************************************************************/ -void smb_io_logon_id(char *desc, DOM_LOGON_ID *log, prs_struct *ps, int depth) -{ - if (log == NULL) return; - - prs_debug(ps, depth, desc, "smb_io_logon_id"); - depth++; - - prs_align(ps); - - prs_uint32("low ", ps, depth, &(log->low )); - prs_uint32("high", ps, depth, &(log->high)); -} - /******************************************************************* makes an OWF_INFO structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 69d2b3bf57..083816771f 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -564,7 +564,8 @@ void make_id_info1(NET_ID_INFO_1 *id, char *domain_name, make_uni_hdr(&(id->hdr_domain_name), len_domain_name); id->param_ctrl = param_ctrl; - make_logon_id(&(id->logon_id), log_id_low, log_id_high); + id->logon_id.low = log_id_low; + id->logon_id.high = log_id_high; make_uni_hdr(&(id->hdr_user_name ), len_user_name ); make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name ); @@ -627,7 +628,7 @@ static void net_io_id_info1(char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int smb_io_unihdr("unihdr", &(id->hdr_domain_name), ps, depth); prs_uint32("param_ctrl", ps, depth, &(id->param_ctrl)); - smb_io_logon_id("", &(id->logon_id), ps, depth); + smb_io_bigint("", &(id->logon_id), ps, depth); smb_io_unihdr("unihdr", &(id->hdr_user_name ), ps, depth); smb_io_unihdr("unihdr", &(id->hdr_wksta_name ), ps, depth); @@ -680,7 +681,8 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name, make_uni_hdr(&(id->hdr_domain_name), len_domain_name); id->param_ctrl = param_ctrl; - make_logon_id(&(id->logon_id), log_id_low, log_id_high); + id->logon_id.low = log_id_low; + id->logon_id.high = log_id_high; make_uni_hdr(&(id->hdr_user_name ), len_user_name ); make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name ); @@ -729,7 +731,7 @@ static void net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int smb_io_unihdr("unihdr", &(id->hdr_domain_name), ps, depth); prs_uint32("param_ctrl", ps, depth, &(id->param_ctrl)); - smb_io_logon_id("", &(id->logon_id), ps, depth); + smb_io_bigint("", &(id->logon_id), ps, depth); smb_io_unihdr("unihdr", &(id->hdr_user_name ), ps, depth); smb_io_unihdr("unihdr", &(id->hdr_wksta_name ), ps, depth); @@ -1117,4 +1119,478 @@ void net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int prs_uint32("status ", ps, depth, &(r_l->status)); } +/******************************************************************* +makes a NET_Q_SAM_SYNC structure. +********************************************************************/ +void make_q_sam_sync(NET_Q_SAM_SYNC *q_s, char *srv_name, char *cli_name, + DOM_CRED *cli_creds, uint32 database_id) +{ + if (q_s == NULL) return; + + DEBUG(5,("make_q_sam_sync\n")); + + make_unistr2(&(q_s->uni_srv_name), srv_name, strlen(srv_name)+1); + make_unistr2(&(q_s->uni_cli_name), cli_name, strlen(cli_name)+1); + + 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->restart_state = 0; + q_s->sync_context = 0; + q_s->max_size = 0xffff; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void net_io_q_sam_sync(char *desc, NET_Q_SAM_SYNC *q_s, prs_struct *ps, int depth) +{ + if (q_s == NULL) return; + + prs_debug(ps, depth, desc, "net_io_q_sam_sync"); + depth++; + + smb_io_unistr2("", &(q_s->uni_srv_name), True, ps, depth); + smb_io_unistr2("", &(q_s->uni_cli_name), True, ps, depth); + + smb_io_cred("", &(q_s->cli_creds), ps, depth); + smb_io_cred("", &(q_s->ret_creds), ps, depth); + + prs_uint32("database_id ", ps, depth, &(q_s->database_id )); + prs_uint32("restart_state", ps, depth, &(q_s->restart_state)); + prs_uint32("sync_context ", ps, depth, &(q_s->sync_context )); + + prs_uint32("max_size", ps, depth, &(q_s->max_size)); +} + +/******************************************************************* +makes a SAM_DELTA_HDR structure. +********************************************************************/ +void make_sam_delta_hdr(SAM_DELTA_HDR *delta, uint16 type, uint32 rid) +{ + if (delta == NULL) return; + + DEBUG(5,("make_sam_delta_hdr\n")); + + delta->type2 = delta->type = type; + delta->target_rid = rid; + + delta->type3 = type; + delta->ptr_delta = 1; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static void net_io_sam_delta_hdr(char *desc, SAM_DELTA_HDR *delta, prs_struct *ps, int depth) +{ + if (delta == NULL) return; + + prs_debug(ps, depth, desc, "net_io_sam_delta_hdr"); + depth++; + + prs_uint16("type", ps, depth, &(delta->type )); + prs_uint16("type2", ps, depth, &(delta->type2 )); + prs_uint32("target_rid", ps, depth, &(delta->target_rid)); + + prs_uint32("type3", ps, depth, &(delta->type3 )); + prs_uint32("ptr_delta", ps, depth, &(delta->ptr_delta )); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static void net_io_sam_domain_info(char *desc, SAM_DOMAIN_INFO *info, prs_struct *ps, int depth) +{ + if (info == NULL) return; + + prs_debug(ps, depth, desc, "net_io_sam_domain_info"); + depth++; + + smb_io_unihdr("hdr_dom_name" , &(info->hdr_dom_name) , ps, depth); + smb_io_unihdr("hdr_oem_info" , &(info->hdr_oem_info) , ps, depth); + + smb_io_bigint("force_logoff" , &(info->force_logoff) , ps, depth); + prs_uint16("min_pwd_len" , ps, depth, &(info->min_pwd_len )); + prs_uint16("pwd_history_len" , ps, depth, &(info->pwd_history_len)); + smb_io_bigint("max_pwd_age" , &(info->max_pwd_age) , ps, depth); + smb_io_bigint("min_pwd_age" , &(info->min_pwd_age) , ps, depth); + smb_io_bigint("dom_mod_count", &(info->dom_mod_count), ps, depth); + smb_io_time("creation_time" , &(info->creation_time), ps, depth); + + smb_io_bufhdr2("hdr_sec_desc", &(info->hdr_sec_desc) , ps, depth); + smb_io_unihdr ("hdr_unknown" , &(info->hdr_unknown) , ps, depth); + + smb_io_unistr2("uni_dom_name", &(info->uni_dom_name), + info->hdr_dom_name.buffer, ps, depth); + smb_io_unistr2("buf_oem_info", &(info->buf_oem_info), + info->hdr_oem_info.buffer, ps, depth); + + smb_io_buffer4("buf_sec_desc", &(info->buf_sec_desc), + info->hdr_sec_desc.buffer, ps, depth); + smb_io_unistr2("buf_unknown" , &(info->buf_unknown ), + info->hdr_unknown .buffer, ps, depth); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static void net_io_sam_group_info(char *desc, SAM_GROUP_INFO *info, prs_struct *ps, int depth) +{ + if (info == NULL) return; + + prs_debug(ps, depth, desc, "net_io_sam_group_info"); + depth++; + + smb_io_unihdr ("hdr_grp_name", &(info->hdr_grp_name), ps, depth); + smb_io_gid ("gid", &(info->gid), ps, depth); + smb_io_unihdr ("hdr_grp_desc", &(info->hdr_grp_desc), ps, depth); + smb_io_bufhdr2("hdr_sec_desc", &(info->hdr_sec_desc), ps, depth); + ps->offset += 48; + + smb_io_unistr2("uni_grp_name", &(info->uni_grp_name), + info->hdr_grp_name.buffer, ps, depth); + smb_io_unistr2("uni_grp_desc", &(info->uni_grp_desc), + info->hdr_grp_name.buffer, ps, depth); + smb_io_buffer4("buf_sec_desc", &(info->buf_sec_desc), + info->hdr_sec_desc.buffer, ps, depth); +} + +/******************************************************************* +makes a SAM_ACCOUNT_INFO structure. +********************************************************************/ +void make_sam_account_info(SAM_ACCOUNT_INFO *info, char *user_name, + char *full_name, uint32 user_rid, uint32 group_rid, + char *home_dir, char *dir_drive, char *logon_script, + char *acct_desc, uint32 acb_info, char *profile) +{ + int len_user_name = strlen(user_name); + int len_full_name = strlen(full_name); + int len_home_dir = strlen(home_dir); + int len_dir_drive = strlen(dir_drive); + int len_logon_script = strlen(logon_script); + int len_acct_desc = strlen(acct_desc); + int len_profile = strlen(profile); + + DEBUG(5,("make_sam_account_info\n")); + + make_uni_hdr(&(info->hdr_acct_name ), len_user_name ); + make_uni_hdr(&(info->hdr_full_name ), len_full_name ); + make_uni_hdr(&(info->hdr_home_dir ), len_home_dir ); + make_uni_hdr(&(info->hdr_dir_drive ), len_dir_drive ); + make_uni_hdr(&(info->hdr_logon_script), len_logon_script); + make_uni_hdr(&(info->hdr_acct_desc ), len_acct_desc ); + make_uni_hdr(&(info->hdr_profile ), len_profile ); + + /* not present */ + make_uni_hdr(&(info->hdr_comment), 0); + make_bufhdr2(&(info->hdr_pwd_info), 0, 0, 0); + make_bufhdr2(&(info->hdr_sec_desc), 0, 0, 0); + + info->user_rid = user_rid; + info->group_rid = group_rid; + + init_nt_time(&(info->time_1)); + init_nt_time(&(info->time_2)); + init_nt_time(&(info->time_3)); + init_nt_time(&(info->time_4)); + init_nt_time(&(info->time_5)); + + info->logon_divs = 0xA8; + info->ptr_logon_hrs = 0; /* Don't care right now */ + + info->acb_info = acb_info; + info->unknown4 = 0x4EC; + info->unknown5 = 0; + + make_unistr2(&(info->uni_acct_name), user_name, len_user_name+1); + make_unistr2(&(info->uni_full_name), full_name, len_full_name+1); + make_unistr2(&(info->uni_home_dir ), home_dir , len_home_dir +1); + make_unistr2(&(info->uni_dir_drive), dir_drive, len_dir_drive+1); + make_unistr2(&(info->uni_logon_script), logon_script, len_logon_script+1); + make_unistr2(&(info->uni_acct_desc), acct_desc, len_acct_desc+1); + make_unistr2(&(info->uni_profile ), profile , len_profile +1); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static void net_io_sam_account_info(char *desc, SAM_ACCOUNT_INFO *info, prs_struct *ps, int depth) +{ + if (info == NULL) return; + + prs_debug(ps, depth, desc, "net_io_sam_account_info"); + depth++; + + smb_io_unihdr("hdr_acct_name", &(info->hdr_acct_name), ps, depth); + smb_io_unihdr("hdr_full_name", &(info->hdr_full_name), ps, depth); + + prs_uint32("user_rid ", ps, depth, &(info->user_rid )); + prs_uint32("group_rid", ps, depth, &(info->group_rid)); + + smb_io_unihdr("hdr_home_dir " , &(info->hdr_home_dir ), ps, depth); + smb_io_unihdr("hdr_dir_drive" , &(info->hdr_dir_drive), ps, depth); + smb_io_unihdr("hdr_logon_script", &(info->hdr_logon_script), ps, depth); + smb_io_unihdr("hdr_acct_desc" , &(info->hdr_acct_desc), ps, depth); + + smb_io_time("time_1", &(info->time_1), ps, depth); + smb_io_time("time_2", &(info->time_2), ps, depth); + smb_io_time("time_3", &(info->time_3), ps, depth); + + prs_uint32("logon_divs ", ps, depth, &(info->logon_divs )); + prs_uint32("ptr_logon_hrs", ps, depth, &(info->ptr_logon_hrs)); + + smb_io_time("time_4", &(info->time_4), ps, depth); + smb_io_time("time_5", &(info->time_5), ps, depth); + prs_uint32("acb_info", ps, depth, &(info->acb_info)); + ps->offset += 36; + + smb_io_unihdr("hdr_comment", &(info->hdr_comment), ps, depth); + ps->offset += 12; + + smb_io_bufhdr2("hdr_pwd_info", &(info->hdr_pwd_info), ps, depth); + smb_io_bufhdr2("hdr_sec_desc", &(info->hdr_sec_desc), ps, depth); + smb_io_unihdr ("hdr_profile ", &(info->hdr_profile) , ps, depth); + ps->offset += 36; /* includes that stupid NTTIME, ignore for now */ + + smb_io_unistr2("uni_acct_name", &(info->uni_acct_name), + info->hdr_acct_name.buffer, ps, depth); + smb_io_unistr2("uni_full_name", &(info->uni_full_name), + info->hdr_full_name.buffer, ps, depth); + smb_io_unistr2("uni_home_dir ", &(info->uni_home_dir ), + info->hdr_home_dir .buffer, ps, depth); + smb_io_unistr2("uni_dir_drive", &(info->uni_dir_drive), + info->hdr_dir_drive.buffer, ps, depth); + smb_io_unistr2("uni_logon_script", &(info->uni_logon_script), + info->hdr_logon_script.buffer, ps, depth); + smb_io_unistr2("uni_acct_desc", &(info->uni_acct_desc), + info->hdr_acct_desc.buffer, ps, depth); + + prs_uint32("unknown4", ps, depth, &(info->unknown4)); + prs_uint32("unknown5", ps, depth, &(info->unknown5)); + + smb_io_buffer4("buf_logon_hrs", &(info->buf_logon_hrs), + info->ptr_logon_hrs, ps, depth); + smb_io_unistr2("uni_comment" , &(info->uni_comment ), + info->hdr_comment.buffer, ps, depth); + smb_io_buffer4("buf_pwd_info" , &(info->buf_pwd_info ), + info->hdr_pwd_info.buffer, ps, depth); + smb_io_buffer4("buf_sec_desc" , &(info->buf_sec_desc ), + info->hdr_sec_desc.buffer, ps, depth); + smb_io_unistr2("uni_profile" , &(info->uni_profile ), + info->hdr_profile.buffer, ps, depth); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static void net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_struct *ps, int depth) +{ + int i; + fstring tmp; + + if (info == NULL) return; + + prs_debug(ps, depth, desc, "net_io_sam_group_mem_info"); + depth++; + + prs_align(ps); + prs_uint32("ptr_rids ", ps, depth, &(info->ptr_rids )); + prs_uint32("ptr_attribs", ps, depth, &(info->ptr_attribs)); + prs_uint32("num_members", ps, depth, &(info->num_members)); + ps->offset += 16; + + if (info->ptr_rids != 0) + { + prs_uint32("num_members2", ps, depth, &(info->num_members2)); + if (info->num_members2 != info->num_members) + { + /* RPC fault */ + return; + } + SMB_ASSERT_ARRAY(info->rids, info->num_members2); + + for (i = 0; i < info->num_members2; i++) + { + prs_grow(ps); + slprintf(tmp, sizeof(tmp) - 1, "rids[%02d]", i); + prs_uint32(tmp, ps, depth, &(info->rids[i])); + } + } + + if (info->ptr_attribs != 0) + { + prs_uint32("num_members3", ps, depth, &(info->num_members3)); + if (info->num_members3 != info->num_members) + { + /* RPC fault */ + return; + } + + SMB_ASSERT_ARRAY(info->attribs, info->num_members3); + + for (i = 0; i < info->num_members3; i++) + { + prs_grow(ps); + slprintf(tmp, sizeof(tmp) - 1, "attribs[%02d]", i); + prs_uint32(tmp, ps, depth, &(info->attribs[i])); + } + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static void net_io_sam_alias_info(char *desc, SAM_ALIAS_INFO *info, prs_struct *ps, int depth) +{ + if (info == NULL) return; + + prs_debug(ps, depth, desc, "net_io_sam_alias_info"); + depth++; + + smb_io_unihdr ("hdr_als_name", &(info->hdr_als_name), ps, depth); + prs_uint32("als_rid", ps, depth, &(info->als_rid)); + smb_io_bufhdr2("hdr_sec_desc", &(info->hdr_sec_desc), ps, depth); + smb_io_unihdr ("hdr_als_desc", &(info->hdr_als_desc), ps, depth); + ps->offset += 40; + + smb_io_unistr2("uni_als_name", &(info->uni_als_name), + info->hdr_als_name.buffer, ps, depth); + smb_io_buffer4("buf_sec_desc", &(info->buf_sec_desc), + info->hdr_sec_desc.buffer, ps, depth); + smb_io_unistr2("uni_als_desc", &(info->uni_als_desc), + info->hdr_als_name.buffer, ps, depth); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static void net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_struct *ps, int depth) +{ + int i; + fstring tmp; + + if (info == NULL) return; + + prs_debug(ps, depth, desc, "net_io_sam_alias_mem_info"); + depth++; + + prs_align(ps); + prs_uint32("num_members", ps, depth, &(info->num_members)); + prs_uint32("ptr_members", ps, depth, &(info->ptr_members)); + ps->offset += 16; + + if (info->ptr_members != 0) + { + prs_uint32("num_sids", ps, depth, &(info->num_sids)); + if (info->num_sids != info->num_members) + { + /* RPC fault */ + return; + } + + SMB_ASSERT_ARRAY(info->ptr_sids, info->num_sids); + + for (i = 0; i < info->num_sids; i++) + { + prs_grow(ps); + slprintf(tmp, sizeof(tmp) - 1, "ptr_sids[%02d]", i); + prs_uint32(tmp, ps, depth, &(info->ptr_sids[i])); + } + + SMB_ASSERT_ARRAY(info->sids, info->num_sids); + + for (i = 0; i < info->num_sids; i++) + { + if (info->ptr_sids[i] != 0) + { + prs_grow(ps); + slprintf(tmp, sizeof(tmp) - 1, "sids[%02d]", i); + smb_io_dom_sid2(tmp, &(info->sids[i]), ps, depth); + } + } + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static void net_io_sam_delta_ctr(char *desc, SAM_DELTA_CTR *delta, uint32 type, prs_struct *ps, int depth) +{ + if (delta == NULL) return; + + prs_debug(ps, depth, desc, "net_io_sam_delta_ctr"); + depth++; + + switch (type) + { + case 1: + net_io_sam_domain_info("", &(delta->domain_info), ps, depth); + break; + case 2: + net_io_sam_group_info("", &(delta->group_info), ps, depth); + break; + case 5: + net_io_sam_account_info("", &(delta->account_info), ps, depth); + break; + case 8: + net_io_sam_group_mem_info("", &(delta->grp_mem_info), ps, depth); + break; + case 9: + net_io_sam_alias_info("", &(delta->alias_info), ps, depth); + break; + case 0xC: + net_io_sam_alias_mem_info("", &(delta->als_mem_info), ps, depth); + break; + default: + DEBUG(0, ("Replication error: Unknown delta type %x\n", type)); + } + +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void net_io_r_sam_sync(char *desc, NET_R_SAM_SYNC *r_s, prs_struct *ps, int depth) +{ + int i; + + if (r_s == NULL) return; + + prs_debug(ps, depth, desc, "net_io_r_sam_sync"); + depth++; + + smb_io_cred("", &(r_s->srv_creds), ps, depth); + prs_uint32("sync_context", ps, depth, &(r_s->sync_context)); + + prs_uint32("ptr_deltas", ps, depth, &(r_s->ptr_deltas)); + if (r_s->ptr_deltas != 0) + { + prs_uint32("num_deltas ", ps, depth, &(r_s->num_deltas )); + prs_uint32("ptr_deltas2", ps, depth, &(r_s->ptr_deltas2)); + if (r_s->ptr_deltas2 != 0) + { + prs_uint32("num_deltas2", ps, depth, &(r_s->num_deltas2)); + if (r_s->num_deltas2 != r_s->num_deltas) + { + /* RPC fault */ + return; + } + + for (i = 0; i < r_s->num_deltas2; i++) + { + net_io_sam_delta_hdr("", &r_s->hdr_deltas[i], ps, depth); + } + + for (i = 0; i < r_s->num_deltas2; i++) + { + net_io_sam_delta_ctr("", &r_s->deltas[i], + r_s->hdr_deltas[i].type3, ps, depth); + } + } + } + + prs_uint32("status", ps, depth, &(r_s->status)); +} diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index ef327f01a1..23a9d5bfdf 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -180,7 +180,7 @@ BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 * char *q = mem_data(&(ps->data), ps->offset); if (q == NULL) return False; - DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->buf_len/2) + DBG_RW_PCVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->buf_len) ps->offset += str->buf_len; return True; diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index abb00e1572..b97fe3958b 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -767,7 +767,7 @@ void make_reg_r_info(REG_R_INFO *r_r, if (r_r == NULL || os_type == NULL) return; - len = strlen(os_type) * 2; + len = strlen(os_type); r_r->ptr1 = 1; r_r->level = level; @@ -775,11 +775,8 @@ void make_reg_r_info(REG_R_INFO *r_r, r_r->ptr_type = 1; make_buffer2(&(r_r->uni_type), os_type, len); - r_r->ptr2 = 1; - r_r->unknown_0 = len; - - r_r->ptr3 = 1; - r_r->unknown_1 = len; + r_r->ptr2 = r_r->ptr3 = 1; + r_r->unknown_0 = r_r->unknown_1 = len * 2; r_r->status = status; } -- cgit From 1c7125629142bf00353bb6f15d7e996f06cb33d0 Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Sun, 11 Apr 1999 01:39:16 +0000 Subject: Incorrect length (number of unicode characters rather than buffer size) passed to ascii_to_unibuf in make_buffer2 was breaking User Manager. (This used to be commit c518cef78d53a76451e5ea0ac93d75930306fa47) --- source3/rpc_parse/parse_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 51587e6d7a..a84469f8f9 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -530,7 +530,7 @@ void make_buffer2(BUFFER2 *str, const char *buf, int len) str->undoc = 0; /* store the string */ - ascii_to_unibuf(str->buffer, buf, len); + ascii_to_unibuf(str->buffer, buf, MIN(str->buf_len, sizeof(str->buffer)-1)); } /******************************************************************* -- cgit From 7fe5ba774b27b01b91f0d7cc25abf8383b9afca6 Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Fri, 23 Apr 1999 14:47:45 +0000 Subject: Adding scheduler control pipe (\atsvc), client-side routines, and rpcclient command "at" (compatible with NT's "at" command - see rpcclient commit) - useful for remote NT administration. (This used to be commit cf30a472f702d7b50c3a85e2cf2f55b46a2bd452) --- source3/rpc_parse/parse_at.c | 275 ++++++++++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_rpc.c | 11 ++ 2 files changed, 286 insertions(+) create mode 100644 source3/rpc_parse/parse_at.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_at.c b/source3/rpc_parse/parse_at.c new file mode 100644 index 0000000000..2eb72c8aea --- /dev/null +++ b/source3/rpc_parse/parse_at.c @@ -0,0 +1,275 @@ +/* + * Unix SMB/Netbios implementation. + * Version 2.1. + * RPC parsing routines: scheduler service + * Copyright (C) Matthew Chapman 1999, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, + * Copyright (C) Andrew Tridgell 1992-1999. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "includes.h" + +extern int DEBUGLEVEL; + +/******************************************************************* + make_at_q_add_job + ********************************************************************/ +void make_at_q_add_job(AT_Q_ADD_JOB *q_a, char *server, + AT_JOB_INFO *info, char *command) +{ + DEBUG(5,("make_at_q_add_job\n")); + + make_buf_unistr2(&(q_a->uni_srv_name), &(q_a->ptr_srv_name), server); + memcpy(&(q_a->info), info, sizeof(q_a->info)); + make_unistr2(&(q_a->command), command, strlen(command)+1); +} + +/******************************************************************* +reads or writes a AT_JOB_INFO structure. +********************************************************************/ +void at_io_job_info(char *desc, AT_JOB_INFO *info, prs_struct *ps, int depth) +{ + if (info == NULL) return; + + prs_debug(ps, depth, desc, "at_io_job_info"); + depth++; + + prs_align(ps); + + prs_uint32("time", ps, depth, &(info->time)); + prs_uint32("monthdays", ps, depth, &(info->monthdays)); + prs_uint8("weekdays", ps, depth, &(info->weekdays)); + prs_uint8("flags", ps, depth, &(info->flags)); + prs_align(ps); + + prs_uint32("ptr_command", ps, depth, &(info->ptr_command)); +} + +/******************************************************************* +reads or writes a AT_Q_ADD_JOB structure. +********************************************************************/ +void at_io_q_add_job(char *desc, AT_Q_ADD_JOB *q_a, prs_struct *ps, int depth) +{ + if (q_a == NULL) return; + + prs_debug(ps, depth, desc, "at_q_add_job"); + depth++; + + prs_align(ps); + prs_uint32("ptr_srv_name", ps, depth, &(q_a->ptr_srv_name)); + smb_io_unistr2("", &(q_a->uni_srv_name), q_a->ptr_srv_name, ps, depth); + at_io_job_info("", &(q_a->info), ps, depth); + smb_io_unistr2("", &(q_a->command), q_a->info.ptr_command, ps, depth); +} + +/******************************************************************* +reads or writes a AT_R_ADD_JOB structure. +********************************************************************/ +void at_io_r_add_job(char *desc, AT_R_ADD_JOB *r_a, prs_struct *ps, int depth) +{ + if (r_a == NULL) return; + + prs_debug(ps, depth, desc, "at_r_add_job"); + depth++; + + prs_align(ps); + prs_uint32("jobid", ps, depth, &(r_a->jobid)); + prs_uint32("status", ps, depth, &(r_a->status)); +} + +/******************************************************************* + make_at_q_del_job + ********************************************************************/ +void make_at_q_del_job(AT_Q_DEL_JOB *q_a, char *server, uint32 min_jobid, + uint32 max_jobid) +{ + DEBUG(5,("make_at_q_del_job\n")); + + make_buf_unistr2(&(q_a->uni_srv_name), &(q_a->ptr_srv_name), server); + q_a->min_jobid = min_jobid; + q_a->max_jobid = max_jobid; +} + +/******************************************************************* +reads or writes a AT_Q_DEL_JOB structure. +********************************************************************/ +void at_io_q_del_job(char *desc, AT_Q_DEL_JOB *q_d, prs_struct *ps, int depth) +{ + if (q_d == NULL) return; + + prs_debug(ps, depth, desc, "at_q_del_job"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_srv_name", ps, depth, &(q_d->ptr_srv_name)); + smb_io_unistr2("", &(q_d->uni_srv_name), q_d->ptr_srv_name, ps, depth); + prs_align(ps); + prs_uint32("min_jobid", ps, depth, &(q_d->min_jobid)); + prs_uint32("max_jobid", ps, depth, &(q_d->max_jobid)); +} + +/******************************************************************* +reads or writes a AT_R_DEL_JOB structure. +********************************************************************/ +void at_io_r_del_job(char *desc, AT_R_DEL_JOB *r_d, prs_struct *ps, int depth) +{ + if (r_d == NULL) return; + + prs_debug(ps, depth, desc, "at_r_del_job"); + depth++; + + prs_align(ps); + prs_uint32("status", ps, depth, &(r_d->status)); +} + +/******************************************************************* + make_at_q_enum_jobs + ********************************************************************/ +void make_at_q_enum_jobs(AT_Q_ENUM_JOBS *q_e, char *server) +{ + DEBUG(5,("make_at_q_enum_jobs\n")); + + make_buf_unistr2(&(q_e->uni_srv_name), &(q_e->ptr_srv_name), server); + q_e->unknown0 = 0; + q_e->unknown1 = 0; + q_e->max_len = 0xffff; + q_e->ptr_resume = 1; + q_e->hnd_resume = 0; +} + +/******************************************************************* +reads or writes a AT_Q_ENUM_JOBS structure. +********************************************************************/ +void at_io_q_enum_jobs(char *desc, AT_Q_ENUM_JOBS *q_e, prs_struct *ps, int depth) +{ + if (q_e == NULL) return; + + prs_debug(ps, depth, desc, "at_q_enum_jobs"); + depth++; + + prs_align(ps); + prs_uint32("ptr_srv_name", ps, depth, &(q_e->ptr_srv_name)); + smb_io_unistr2("", &(q_e->uni_srv_name), q_e->ptr_srv_name, ps, depth); + prs_align(ps); + prs_uint32("unknown0", ps, depth, &(q_e->unknown0)); + prs_uint32("unknown1", ps, depth, &(q_e->unknown1)); + prs_uint32("max_len" , ps, depth, &(q_e->max_len )); + + prs_uint32("ptr_resume", ps, depth, &(q_e->ptr_resume)); + prs_uint32("hnd_resume", ps, depth, &(q_e->hnd_resume)); +} + +/******************************************************************* +reads or writes a AT_R_ENUM_JOBS structure. +********************************************************************/ +void at_io_r_enum_jobs(char *desc, AT_R_ENUM_JOBS *r_e, prs_struct *ps, int depth) +{ + if (r_e == NULL) return; + + prs_debug(ps, depth, desc, "at_r_enum_jobs"); + depth++; + + prs_align(ps); + prs_uint32("num_entries", ps, depth, &(r_e->num_entries)); + prs_uint32("ptr_entries", ps, depth, &(r_e->ptr_entries)); + + if (r_e->ptr_entries != 0) + { + int i; + + prs_uint32("num_entries2", ps, depth, &(r_e->num_entries2)); + if (r_e->num_entries2 != r_e->num_entries) + { + /* RPC fault */ + return; + } + + SMB_ASSERT_ARRAY(r_e->info, r_e->num_entries2); + + for (i = 0; i < r_e->num_entries2; i++) + { + prs_grow(ps); + prs_uint32("jobid", ps, depth, &(r_e->info[i].jobid)); + at_io_job_info("", &(r_e->info[i].info), ps, depth); + } + + for (i = 0; i < r_e->num_entries2; i++) + { + prs_grow(ps); + smb_io_unistr2("", &(r_e->command[i]), + r_e->info[i].info.ptr_command, ps, depth); + } + } + + prs_align(ps); + prs_uint32("total_entries", ps, depth, &(r_e->total_entries)); + prs_uint32("ptr_resume" , ps, depth, &(r_e->ptr_resume )); + prs_uint32("hnd_resume" , ps, depth, &(r_e->hnd_resume )); + + prs_uint32("status", ps, depth, &(r_e->status)); +} + +/******************************************************************* + make_at_q_query_job + ********************************************************************/ +void make_at_q_query_job(AT_Q_QUERY_JOB *q_q, char *server, uint32 jobid) +{ + DEBUG(5,("make_at_q_query_job\n")); + + make_buf_unistr2(&(q_q->uni_srv_name), &(q_q->ptr_srv_name), server); + q_q->jobid = jobid; +} + +/******************************************************************* +reads or writes a AT_Q_QUERY_JOB structure. +********************************************************************/ +void at_io_q_query_job(char *desc, AT_Q_QUERY_JOB *q_q, prs_struct *ps, int depth) +{ + if (q_q == NULL) return; + + prs_debug(ps, depth, desc, "at_q_query_job"); + depth++; + + prs_align(ps); + prs_uint32("ptr_srv_name", ps, depth, &(q_q->ptr_srv_name)); + smb_io_unistr2("", &(q_q->uni_srv_name), q_q->ptr_srv_name, ps, depth); + prs_align(ps); + prs_uint32("jobid", ps, depth, &(q_q->jobid)); +} + +/******************************************************************* +reads or writes a AT_R_QUERY_JOB structure. +********************************************************************/ +void at_io_r_query_job(char *desc, AT_R_QUERY_JOB *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return; + + prs_debug(ps, depth, desc, "at_r_query_job"); + depth++; + + prs_align(ps); + prs_uint32("ptr_info", ps, depth, &(r_q->ptr_info)); + if (r_q->ptr_info != 0) + { + at_io_job_info("", &(r_q->info), ps, depth); + smb_io_unistr2("", &(r_q->command), r_q->info.ptr_command, ps, depth); + } + + prs_align(ps); + prs_uint32("status", ps, depth, &(r_q->status)); +} diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 9716b35b78..81e7ffa116 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -122,6 +122,16 @@ interface/version dce/rpc pipe identification }, 0x01 \ } \ +#define SYNT_ATSVC_V1 \ +{ \ + { \ + 0x82, 0x06, 0xf7, 0x1f, \ + 0x51, 0x0a, 0xe8, 0x30, \ + 0x07, 0x6d, 0x74, 0x0b, \ + 0xe8, 0xce, 0xe9, 0x8b \ + }, 0x01 \ +} \ + #define SYNT_NONE_V0 \ { \ { \ @@ -142,6 +152,7 @@ struct pipe_id_info pipe_names [] = { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, + { PIPE_ATSVC , SYNT_ATSVC_V1 , PIPE_ATSVC , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From de0c233a7ae5eab1e0f5a2c07eca3269b0bd9cdc Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Tue, 27 Apr 1999 10:13:02 +0000 Subject: Adding RPC spoolss code support and some new low-level printing functions. Jean Francois (This used to be commit 9e8192cc674db7551569d23982877dd25c488b50) --- source3/rpc_parse/parse_spoolss.c | 3389 +++++++++++++++++++++++++++++++++++++ 1 file changed, 3389 insertions(+) create mode 100644 source3/rpc_parse/parse_spoolss.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c new file mode 100644 index 0000000000..8f5c85c158 --- /dev/null +++ b/source3/rpc_parse/parse_spoolss.c @@ -0,0 +1,3389 @@ +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1998, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, + * Copyright (C) Jean Franois Micouleau 1998. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include "includes.h" +#include "nterr.h" + +extern int DEBUGLEVEL; + + +/******************************************************************* +return the length of a UNISTR string. +********************************************************************/ +static uint32 str_len_uni(UNISTR *source) +{ + uint32 i=0; + + while (source->buffer[i]!=0x0000) + { + i++; + } + return i; +} + +/******************************************************************* +This should be moved in a more generic lib. +********************************************************************/ +static void spoolss_io_system_time(char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) +{ + prs_uint16("year", ps, depth, &(systime->year)); + prs_uint16("month", ps, depth, &(systime->month)); + prs_uint16("dayofweek", ps, depth, &(systime->dayofweek)); + prs_uint16("day", ps, depth, &(systime->day)); + prs_uint16("hour", ps, depth, &(systime->hour)); + prs_uint16("minute", ps, depth, &(systime->minute)); + prs_uint16("second", ps, depth, &(systime->second)); + prs_uint16("milliseconds", ps, depth, &(systime->milliseconds)); +} + +/******************************************************************* +********************************************************************/ +void make_systemtime(SYSTEMTIME *systime, struct tm *unixtime) +{ + systime->year=unixtime->tm_year+1900; + systime->month=unixtime->tm_mon+1; + systime->dayofweek=unixtime->tm_wday; + systime->day=unixtime->tm_mday; + systime->hour=unixtime->tm_hour; + systime->minute=unixtime->tm_min; + systime->second=unixtime->tm_sec; + systime->milliseconds=0; +} + +/******************************************************************* +reads or writes an PRINTER_HND structure. +********************************************************************/ +static void smb_io_prt_hnd(char *desc, PRINTER_HND *hnd, prs_struct *ps, int depth) +{ + if (hnd == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_prt_hnd"); + depth++; + + prs_align(ps); + + prs_uint8s (False, "data", ps, depth, hnd->data, PRINTER_HND_SIZE); +} + +/******************************************************************* +reads or writes an DOC_INFO structure. +********************************************************************/ +static void smb_io_doc_info_1(char *desc, DOC_INFO_1 *info_1, prs_struct *ps, int depth) +{ + if (info_1 == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_doc_info_1"); + depth++; + + prs_align(ps); + + prs_uint32("p_docname", ps, depth, &(info_1->p_docname)); + prs_uint32("p_outputfile", ps, depth, &(info_1->p_outputfile)); + prs_uint32("p_datatype", ps, depth, &(info_1->p_datatype)); + + if (info_1->p_docname) + smb_io_unistr2("", &(info_1->docname),True,ps,depth); + if (info_1->p_outputfile) + smb_io_unistr2("", &(info_1->outputfile),True,ps,depth); + if (info_1->p_datatype) + smb_io_unistr2("", &(info_1->datatype),True,ps,depth); +} + +/******************************************************************* +reads or writes an DOC_INFO structure. +********************************************************************/ +static void smb_io_doc_info(char *desc, DOC_INFO *info, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0; + + if (info == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_doc_info"); + depth++; + + prs_align(ps); + + prs_uint32("switch_value", ps, depth, &(info->switch_value)); + + prs_uint32("doc_info_X ptr", ps, depth, &(useless_ptr)); + + switch (info->switch_value) + { + case 1: + smb_io_doc_info_1("",&(info->doc_info_1), ps, depth); + break; + case 2: + /* + this is just a placeholder + + MSDN July 1998 says doc_info_2 is only on + Windows 95, and as Win95 doesn't do RPC to print + this case is nearly impossible + + Maybe one day with Windows for dishwasher 2037 ... + + */ + /* smb_io_doc_info_2("",&(info->doc_info_2), ps, depth); */ + break; + default: + DEBUG(0,("Something is obviously wrong somewhere !\n")); + break; + } +} + +/******************************************************************* +reads or writes an DOC_INFO_CONTAINER structure. +********************************************************************/ +static void smb_io_doc_info_container(char *desc, DOC_INFO_CONTAINER *cont, prs_struct *ps, int depth) +{ + if (cont == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_doc_info_container"); + depth++; + + prs_align(ps); + + prs_uint32("level", ps, depth, &(cont->level)); + + smb_io_doc_info("",&(cont->docinfo), ps, depth); +} + +/******************************************************************* +reads or writes an NOTIFY OPTION TYPE structure. +********************************************************************/ +static void smb_io_notify_option_type(char *desc, + SPOOL_NOTIFY_OPTION_TYPE *type, + prs_struct *ps, int depth) +{ + uint32 useless_ptr; + + prs_debug(ps, depth, desc, "smb_io_notify_option_type"); + depth++; + + prs_align(ps); + + prs_uint16("type", ps, depth, &(type->type)); + prs_uint16("reserved0", ps, depth, &(type->reserved0)); + prs_uint32("reserved1", ps, depth, &(type->reserved1)); + prs_uint32("reserved2", ps, depth, &(type->reserved2)); + prs_uint32("count", ps, depth, &(type->count)); + prs_uint32("useless ptr", ps, depth, &useless_ptr); + +} + +/******************************************************************* +reads or writes an NOTIFY OPTION TYPE DATA. +********************************************************************/ +static void smb_io_notify_option_type_data(char *desc, + SPOOL_NOTIFY_OPTION_TYPE *type, + prs_struct *ps, int depth) +{ + uint32 count; + int i; + + prs_debug(ps, depth, desc, "smb_io_notify_option_type_data"); + depth++; + + prs_align(ps); + + prs_uint32("count", ps, depth, &count); + + if (count != type->count) + { + DEBUG(4,("What a mess, count was %x now is %x !\n",type->count,count)); + type->count=count; + } + for(i=0;ifields[i])); + } +} + +/******************************************************************* +reads or writes an NOTIFY OPTION structure. +********************************************************************/ +static void smb_io_notify_option(char *desc, SPOOL_NOTIFY_OPTION *option, + prs_struct *ps, int depth) +{ + uint32 useless_ptr; + int i; + + prs_debug(ps, depth, desc, "smb_io_notify_option"); + depth++; + + prs_align(ps); + + /* memory pointer to the struct */ + prs_uint32("useless ptr", ps, depth, &useless_ptr); + + prs_uint32("version", ps, depth, &(option->version)); + prs_uint32("reserved", ps, depth, &(option->reserved)); + prs_uint32("count", ps, depth, &(option->count)); + prs_uint32("useless ptr", ps, depth, &useless_ptr); + prs_uint32("count", ps, depth, &(option->count)); + + /* read the option type struct */ + for(i=0;icount;i++) + { + smb_io_notify_option_type("",&(option->type[i]) ,ps, depth); + } + + /* now read the type associated with the option type struct */ + for(i=0;icount;i++) + { + smb_io_notify_option_type_data("",&(option->type[i]) ,ps, depth); + } + +} + + +/******************************************************************* +reads or writes an NOTIFY INFO DATA structure. +********************************************************************/ +static void smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, + prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + + uint32 how_many_words; + BOOL isvalue; + uint32 x; + + prs_debug(ps, depth, desc, "smb_io_notify_info_data"); + depth++; + + how_many_words=data->size; + if (how_many_words==POINTER) + { + how_many_words=TWO_VALUE; + } + + isvalue=data->enc_type; + + prs_align(ps); + prs_uint16("type", ps, depth, &(data->type)); + prs_uint16("field", ps, depth, &(data->field)); + /*prs_align(ps);*/ + + prs_uint32("how many words", ps, depth, &how_many_words); + prs_uint32("id", ps, depth, &(data->id)); + prs_uint32("how many words", ps, depth, &how_many_words); + /*prs_align(ps);*/ + + if (isvalue==True) + { + prs_uint32("value[0]", ps, depth, &(data->notify_data.value[0])); + prs_uint32("value[1]", ps, depth, &(data->notify_data.value[1])); + /*prs_align(ps);*/ + } + else + { + /* it's a string */ + /* length in ascii including \0 */ + x=2*(data->notify_data.data.length+1); + prs_uint32("string length", ps, depth, &x ); + prs_uint32("pointer", ps, depth, &useless_ptr); + /*prs_align(ps);*/ + } +} + +/******************************************************************* +reads or writes an NOTIFY INFO DATA structure. +********************************************************************/ +void smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, + prs_struct *ps, int depth) +{ + uint32 x; + BOOL isvalue; + + prs_debug(ps, depth, desc, "smb_io_notify_info_data"); + depth++; + + prs_align(ps); + isvalue=data->enc_type; + + if (isvalue==False) + { + /* length of string in unicode include \0 */ + x=data->notify_data.data.length+1; + prs_uint32("string length", ps, depth, &x ); + prs_uint16s(True,"string",ps,depth,data->notify_data.data.string,x); + } + prs_align(ps); +} + +/******************************************************************* +reads or writes an NOTIFY INFO structure. +********************************************************************/ +static void smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, + prs_struct *ps, int depth) +{ + uint32 useless_ptr=0x0001; + int i; + + info->version=0x02; + prs_debug(ps, depth, desc, "smb_io_notify_info"); + depth++; + + prs_align(ps); + + prs_uint32("pointer", ps, depth, &useless_ptr); + prs_uint32("count", ps, depth, &(info->count)); + prs_uint32("version", ps, depth, &(info->version)); + prs_uint32("flags", ps, depth, &(info->flags)); + prs_uint32("count", ps, depth, &(info->count)); + + for (i=0;icount;i++) + { + prs_grow(ps); + smb_io_notify_info_data(desc, &(info->data[i]), ps, depth); + } + + /* now do the strings at the end of the stream */ + for (i=0;icount;i++) + { + prs_grow(ps); + smb_io_notify_info_data_strings(desc, &(info->data[i]), + ps, depth); + } +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_open_printer (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_r_open_printer(char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "spoolss_io_r_open_printer"); + depth++; + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(r_u->handle),ps,depth); + +/* prs_align(ps);*/ + + prs_uint32("status code", ps, depth, &(r_u->status)); + +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_open_printer (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_q_open_printer(char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "spoolss_io_q_open_printer"); + depth++; + + prs_align(ps); + + prs_uint32("unknown0", ps, depth, &(q_u->unknown0)); + smb_io_unistr2("", &(q_u->printername),True,ps,depth); + + prs_align(ps); + + prs_uint32("unknown1", ps, depth, &(q_u->unknown1)); + prs_uint32("cbbuf", ps, depth, &(q_u->cbbuf)); + prs_uint32("devmod", ps, depth, &(q_u->devmod)); + prs_uint32("access required", ps, depth, &(q_u->access_required)); + + /* don't care to decode end of packet by now */ + /* but when acl will be implemented, it will be useful */ + + prs_uint32("unknown2", ps, depth, &(q_u->unknown2)); + prs_uint32("unknown3", ps, depth, &(q_u->unknown3)); + prs_uint32("unknown4", ps, depth, &(q_u->unknown4)); + prs_uint32("unknown5", ps, depth, &(q_u->unknown5)); + prs_uint32("unknown6", ps, depth, &(q_u->unknown6)); + prs_uint32("unknown7", ps, depth, &(q_u->unknown7)); + prs_uint32("unknown8", ps, depth, &(q_u->unknown8)); + prs_uint32("unknown9", ps, depth, &(q_u->unknown9)); + prs_uint32("unknown10", ps, depth, &(q_u->unknown10)); + prs_uint32("unknown11", ps, depth, &(q_u->unknown11)); + + smb_io_unistr2("", &(q_u->station),True,ps,depth); + prs_align(ps); + smb_io_unistr2("", &(q_u->username),True,ps,depth); +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_getprinterdata (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_q_getprinterdata(char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdata"); + depth++; + + prs_align(ps); + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_align(ps); + smb_io_unistr2("", &(q_u->valuename),True,ps,depth); + prs_align(ps); + prs_uint32("size", ps, depth, &(q_u->size)); +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_getprinterdata (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdata"); + depth++; + + prs_align(ps); + prs_uint32("type", ps, depth, &(r_u->type)); + prs_uint32("size", ps, depth, &(r_u->size)); + + switch (r_u->type) + { + case 0x1: + case 0x3: + case 0x4: + prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size); + prs_align(ps); + break; + } + + prs_uint32("needed", ps, depth, &(r_u->needed)); + prs_uint32("status", ps, depth, &(r_u->status)); + prs_align(ps); +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_closeprinter (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_q_closeprinter(char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "spoolss_io_q_closeprinter"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_closeprinter (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_r_closeprinter(char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_closeprinter"); + depth++; + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(r_u->handle),ps,depth); + prs_uint32("status", ps, depth, &(r_u->status)); + +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_startdocprinter (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_q_startdocprinter(char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "spoolss_io_q_startdocprinter"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + + smb_io_doc_info_container("",&(q_u->doc_info_container), ps, depth); +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_startdocprinter (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_r_startdocprinter(char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_startdocprinter"); + depth++; + prs_uint32("jobid", ps, depth, &(r_u->jobid)); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_enddocprinter (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_q_enddocprinter(char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "spoolss_io_q_enddocprinter"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_enddocprinter (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_r_enddocprinter(char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_enddocprinter"); + depth++; + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_startpageprinter (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_q_startpageprinter(char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "spoolss_io_q_startpageprinter"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_startpageprinter (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_r_startpageprinter(char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_startpageprinter"); + depth++; + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_endpageprinter (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_q_endpageprinter(char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "spoolss_io_q_endpageprinter"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_endpageprinter (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_r_endpageprinter(char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_endpageprinter"); + depth++; + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_writeprinter (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "spoolss_io_q_writeprinter"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("buffer_size", ps, depth, &(q_u->buffer_size)); + + if (q_u->buffer_size!=0) + { + q_u->buffer=(uint8 *)malloc(q_u->buffer_size*sizeof(uint8)); + prs_uint8s(True, "buffer", ps, depth, q_u->buffer, q_u->buffer_size); + } + prs_align(ps); + prs_uint32("buffer_size2", ps, depth, &(q_u->buffer_size2)); +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_writeprinter (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_r_writeprinter(char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_writeprinter"); + depth++; + prs_uint32("buffer_written", ps, depth, &(r_u->buffer_written)); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_rffpcnex (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, + prs_struct *ps, int depth) +{ + uint32 useless_ptr; + + prs_debug(ps, depth, desc, "spoolss_io_q_rffpcnex"); + depth++; + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("flags", ps, depth, &(q_u->flags)); + prs_uint32("options", ps, depth, &(q_u->options)); + prs_uint32("useless ptr", ps, depth, &useless_ptr); + /*prs_align(ps);*/ + + smb_io_unistr2("", &(q_u->localmachine), True, ps, depth); + + prs_align(ps); + prs_uint32("printerlocal", ps, depth, &(q_u->printerlocal)); + + smb_io_notify_option("notify option", &(q_u->option), ps, depth); + +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_rffpcnex (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_rffpcnex"); + depth++; + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_rfnpcnex (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, + prs_struct *ps, int depth) +{ + + prs_debug(ps, depth, desc, "spoolss_io_q_rfnpcnex"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + + prs_uint32("change", ps, depth, &(q_u->change)); + + smb_io_notify_option("notify option",&(q_u->option),ps,depth); +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_rfnpcnex (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_r_rfnpcnex(char *desc, + SPOOL_R_RFNPCNEX *r_u, + prs_struct *ps, int depth) +{ + uint32 x=0x0; + + prs_debug(ps, depth, desc, "spoolss_io_r_rfnpcnex"); + depth++; + + prs_align(ps); + + smb_io_notify_info("notify info",&(r_u->info),ps,depth); + prs_align(ps); + prs_uint32("status", ps, depth, &(x)); +} + +/******************************************************************* + * return the length of a uint32 (obvious, but the code is clean) + ********************************************************************/ +static uint32 size_of_uint32(uint32 *value) +{ + return (sizeof(*value)); +} + +/******************************************************************* + * return the length of a UNICODE string in number of char, includes: + * - the leading zero + * - the relative pointer size + ********************************************************************/ +static uint32 size_of_relative_string(UNISTR *string) +{ + uint32 size=0; + + size=str_len_uni(string); /* the string length */ + size=size+1; /* add the leading zero */ + size=size*2; /* convert in char */ + size=size+4; /* add the size of the ptr */ + return (size); +} + +/******************************************************************* + * return the length of a uint32 (obvious, but the code is clean) + ********************************************************************/ +static uint32 size_of_device_mode(DEVICEMODE *devmode) +{ + if (devmode==NULL) + return (4); + else + return (0xDC+4); +} + +/******************************************************************* + * return the length of a uint32 (obvious, but the code is clean) + ********************************************************************/ +static uint32 size_of_systemtime(SYSTEMTIME *systime) +{ + if (systime==NULL) + return (4); + else + return (sizeof(SYSTEMTIME) +4); +} + +/******************************************************************* + * write a UNICODE string. + * used by all the RPC structs passing a buffer + ********************************************************************/ +static void spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) +{ + if (uni == NULL) return; + + prs_debug(ps, depth, desc, "spoolss_smb_io_unistr"); + depth++; + prs_unistr("unistr", ps, depth, uni); +} + + +/******************************************************************* + * write a UNICODE string and its relative pointer. + * used by all the RPC structs passing a buffer + ********************************************************************/ +static void smb_io_relstr(char *desc, prs_struct *ps, int depth, UNISTR *buffer, + uint32 *start_offset, uint32 *end_offset) +{ + uint32 struct_offset; + uint32 relative_offset; + + struct_offset=ps->offset; + *end_offset-= 2*(str_len_uni(buffer)+1); + ps->offset=*end_offset; + spoolss_smb_io_unistr(desc, buffer, ps, depth); + + ps->offset=struct_offset; + relative_offset=*end_offset-*start_offset; + + prs_uint32("offset", ps, depth, &(relative_offset)); +} + +/******************************************************************* + * write a DEVICEMODE struct. + * on reading allocate memory for the private member + ********************************************************************/ +static void smb_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) +{ + prs_debug(ps, depth, desc, "smb_io_devmode"); + depth++; + + prs_uint16s(True,"devicename", ps, depth, devmode->devicename.buffer, 32); + prs_uint16("specversion", ps, depth, &(devmode->specversion)); + prs_uint16("driverversion", ps, depth, &(devmode->driverversion)); + prs_uint16("size", ps, depth, &(devmode->size)); + prs_uint16("driverextra", ps, depth, &(devmode->driverextra)); + prs_uint32("fields", ps, depth, &(devmode->fields)); + prs_uint16("orientation", ps, depth, &(devmode->orientation)); + prs_uint16("papersize", ps, depth, &(devmode->papersize)); + prs_uint16("paperlength", ps, depth, &(devmode->paperlength)); + prs_uint16("paperwidth", ps, depth, &(devmode->paperwidth)); + prs_uint16("scale", ps, depth, &(devmode->scale)); + prs_uint16("copies", ps, depth, &(devmode->copies)); + prs_uint16("defaultsource", ps, depth, &(devmode->defaultsource)); + prs_uint16("printquality", ps, depth, &(devmode->printquality)); + prs_uint16("color", ps, depth, &(devmode->color)); + prs_uint16("duplex", ps, depth, &(devmode->duplex)); + prs_uint16("yresolution", ps, depth, &(devmode->yresolution)); + prs_uint16("ttoption", ps, depth, &(devmode->ttoption)); + prs_uint16("collate", ps, depth, &(devmode->collate)); + prs_uint16s(True, "formname", ps, depth, devmode->formname.buffer, 32); + prs_uint16("logpixels", ps, depth, &(devmode->logpixels)); + prs_uint32("bitsperpel", ps, depth, &(devmode->bitsperpel)); + prs_uint32("pelswidth", ps, depth, &(devmode->pelswidth)); + prs_uint32("pelsheight", ps, depth, &(devmode->pelsheight)); + prs_uint32("displayflags", ps, depth, &(devmode->displayflags)); + prs_uint32("displayfrequency", ps, depth, &(devmode->displayfrequency)); + prs_uint32("icmmethod", ps, depth, &(devmode->icmmethod)); + prs_uint32("icmintent", ps, depth, &(devmode->icmintent)); + prs_uint32("mediatype", ps, depth, &(devmode->mediatype)); + prs_uint32("dithertype", ps, depth, &(devmode->dithertype)); + prs_uint32("reserved1", ps, depth, &(devmode->reserved1)); + prs_uint32("reserved2", ps, depth, &(devmode->reserved2)); + prs_uint32("panningwidth", ps, depth, &(devmode->panningwidth)); + prs_uint32("panningheight", ps, depth, &(devmode->panningheight)); + + if (devmode->driverextra!=0) + { + if (ps->io) + { + devmode->private=(uint8 *)malloc(devmode->driverextra*sizeof(uint8)); + DEBUG(7,("smb_io_devmode: allocated memory [%d] for private\n",devmode->driverextra)); + } + DEBUG(7,("smb_io_devmode: parsing [%d] bytes of private\n",devmode->driverextra)); + + prs_uint8s(True, "private", ps, depth, devmode->private, devmode->driverextra); + DEBUG(8,("smb_io_devmode: parsed\n")); + } +} + +/******************************************************************* + * write a DEVMODE struct and its relative pointer. + * used by all the RPC structs passing a buffer + ********************************************************************/ +static void smb_io_reldevmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode, + uint32 *start_offset, uint32 *end_offset) +{ + uint32 struct_offset; + uint32 relative_offset; + + prs_debug(ps, depth, desc, "smb_io_reldevmode"); + depth++; + + struct_offset=ps->offset; + *end_offset-= (devmode->size+devmode->driverextra); + ps->offset=*end_offset; + + smb_io_devmode(desc, ps, depth, devmode); + + ps->offset=struct_offset; + relative_offset=*end_offset-*start_offset; + + prs_uint32("offset", ps, depth, &(relative_offset)); +} + +/******************************************************************* +********************************************************************/ +static void smb_io_printer_info_0(char *desc, PRINTER_INFO_0 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_printer_info_0"); + depth++; + *start_offset=ps->offset; + + smb_io_relstr("printername",ps, depth, &(info->printername), start_offset, end_offset); + smb_io_relstr("servername",ps, depth, &(info->servername), start_offset, end_offset); + prs_uint32("cjobs", ps, depth, &(info->cjobs)); + prs_uint32("attributes", ps, depth, &(info->attributes)); + + prs_uint32("unknown0", ps, depth, &(info->unknown0)); + prs_uint32("unknown1", ps, depth, &(info->unknown1)); + prs_uint32("unknown2", ps, depth, &(info->unknown2)); + prs_uint32("unknown3", ps, depth, &(info->unknown3)); + prs_uint32("unknown4", ps, depth, &(info->unknown4)); + prs_uint32("unknown5", ps, depth, &(info->unknown5)); + prs_uint32("unknown6", ps, depth, &(info->unknown6)); + prs_uint16("majorversion", ps, depth, &(info->majorversion)); + prs_uint16("buildversion", ps, depth, &(info->buildversion)); + prs_uint32("unknown7", ps, depth, &(info->unknown7)); + prs_uint32("unknown8", ps, depth, &(info->unknown8)); + prs_uint32("unknown9", ps, depth, &(info->unknown9)); + prs_uint32("unknown10", ps, depth, &(info->unknown10)); + prs_uint32("unknown11", ps, depth, &(info->unknown11)); + prs_uint32("unknown12", ps, depth, &(info->unknown12)); + prs_uint32("unknown13", ps, depth, &(info->unknown13)); + prs_uint32("unknown14", ps, depth, &(info->unknown14)); + prs_uint32("unknown15", ps, depth, &(info->unknown15)); + prs_uint32("unknown16", ps, depth, &(info->unknown16)); + prs_uint32("unknown17", ps, depth, &(info->unknown17)); + prs_uint32("unknown18", ps, depth, &(info->unknown18)); + prs_uint32("status" , ps, depth, &(info->status)); + prs_uint32("unknown20", ps, depth, &(info->unknown20)); + prs_uint32("unknown21", ps, depth, &(info->unknown21)); + prs_uint16("unknown22", ps, depth, &(info->unknown22)); + prs_uint32("unknown23", ps, depth, &(info->unknown23)); +} + +/******************************************************************* +********************************************************************/ +static void smb_io_printer_info_1(char *desc, PRINTER_INFO_1 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_printer_info_1"); + depth++; + *start_offset=ps->offset; + + prs_uint32("flags", ps, depth, &(info->flags)); + smb_io_relstr("description",ps, depth, &(info->description), start_offset, end_offset); + smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); + smb_io_relstr("comment",ps, depth, &(info->comment), start_offset, end_offset); +} + +/******************************************************************* +********************************************************************/ +static void smb_io_printer_info_2(char *desc, PRINTER_INFO_2 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + uint32 pipo=0; + + prs_debug(ps, depth, desc, "smb_io_printer_info_2"); + depth++; + *start_offset=ps->offset; + + smb_io_relstr("servername", ps, depth, &(info->servername), start_offset, end_offset); + smb_io_relstr("printername", ps, depth, &(info->printername), start_offset, end_offset); + smb_io_relstr("sharename", ps, depth, &(info->sharename), start_offset, end_offset); + smb_io_relstr("portname", ps, depth, &(info->portname), start_offset, end_offset); + smb_io_relstr("drivername", ps, depth, &(info->drivername), start_offset, end_offset); + smb_io_relstr("comment", ps, depth, &(info->comment), start_offset, end_offset); + smb_io_relstr("location", ps, depth, &(info->location), start_offset, end_offset); + + smb_io_reldevmode("devmode", ps, depth, info->devmode, start_offset, end_offset); + + smb_io_relstr("sepfile", ps, depth, &(info->sepfile), start_offset, end_offset); + smb_io_relstr("printprocessor",ps, depth, &(info->printprocessor), start_offset, end_offset); + smb_io_relstr("datatype", ps, depth, &(info->datatype), start_offset, end_offset); + smb_io_relstr("parameters", ps, depth, &(info->parameters), start_offset, end_offset); + + prs_uint32("security descriptor", ps, depth, &(pipo)); + + prs_uint32("attributes", ps, depth, &(info->attributes)); + prs_uint32("priority", ps, depth, &(info->priority)); + prs_uint32("defpriority", ps, depth, &(info->defaultpriority)); + prs_uint32("starttime", ps, depth, &(info->starttime)); + prs_uint32("untiltime", ps, depth, &(info->untiltime)); + prs_uint32("status", ps, depth, &(info->status)); + prs_uint32("jobs", ps, depth, &(info->cjobs)); + prs_uint32("averageppm", ps, depth, &(info->averageppm)); +} + +/******************************************************************* +********************************************************************/ +static void smb_io_printer_driver_info_1(char *desc, DRIVER_INFO_1 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_printer_driver_info_1"); + depth++; + *start_offset=ps->offset; + + smb_io_relstr("name", ps, depth, &(info->name), start_offset, end_offset); +} + +/******************************************************************* +********************************************************************/ +static void smb_io_printer_driver_info_2(char *desc, DRIVER_INFO_2 *info,prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_printer_xxx"); + depth++; + *start_offset=ps->offset; + + prs_uint32("version", ps, depth, &(info->version)); + smb_io_relstr("name", ps, depth, &(info->name), start_offset, end_offset); + smb_io_relstr("architecture", ps, depth, &(info->architecture), start_offset, end_offset); + smb_io_relstr("driverpath", ps, depth, &(info->driverpath), start_offset, end_offset); + smb_io_relstr("datafile", ps, depth, &(info->datafile), start_offset, end_offset); + smb_io_relstr("configfile", ps, depth, &(info->configfile), start_offset, end_offset); +} + +/******************************************************************* +********************************************************************/ +static void smb_io_printer_driver_info_3(char *desc, DRIVER_INFO_3 *info,prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_printer_driver_info_3"); + depth++; + *start_offset=ps->offset; + + prs_uint32("version", ps, depth, &(info->version)); + smb_io_relstr("name", ps, depth, &(info->name), start_offset, end_offset); + smb_io_relstr("architecture", ps, depth, &(info->architecture), start_offset, end_offset); + smb_io_relstr("driverpath", ps, depth, &(info->driverpath), start_offset, end_offset); + smb_io_relstr("datafile", ps, depth, &(info->datafile), start_offset, end_offset); + smb_io_relstr("configfile", ps, depth, &(info->configfile), start_offset, end_offset); + smb_io_relstr("helpfile", ps, depth, &(info->helpfile), start_offset, end_offset); + smb_io_relstr("dependentfiles", ps, depth, &(info->dependentfiles), start_offset, end_offset); + smb_io_relstr("monitorname", ps, depth, &(info->monitorname), start_offset, end_offset); + smb_io_relstr("defaultdatatype", ps, depth, &(info->defaultdatatype), start_offset, end_offset); +} + +/******************************************************************* +********************************************************************/ +static void smb_io_job_info_1(char *desc, JOB_INFO_1 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_job_info_1"); + depth++; + *start_offset=ps->offset; + + prs_uint32("jobid", ps, depth, &(info->jobid)); + smb_io_relstr("printername",ps, depth, &(info->printername), start_offset, end_offset); + smb_io_relstr("machinename",ps, depth, &(info->machinename), start_offset, end_offset); + smb_io_relstr("username",ps, depth, &(info->username), start_offset, end_offset); + smb_io_relstr("document",ps, depth, &(info->document), start_offset, end_offset); + smb_io_relstr("datatype",ps, depth, &(info->datatype), start_offset, end_offset); + smb_io_relstr("text_status",ps, depth, &(info->text_status), start_offset, end_offset); + prs_uint32("status", ps, depth, &(info->status)); + prs_uint32("priority", ps, depth, &(info->priority)); + prs_uint32("position", ps, depth, &(info->position)); + prs_uint32("totalpages", ps, depth, &(info->totalpages)); + prs_uint32("pagesprinted", ps, depth, &(info->pagesprinted)); + spoolss_io_system_time("submitted", ps, depth, &(info->submitted) ); +} + +/******************************************************************* +********************************************************************/ +static void smb_io_job_info_2(char *desc, JOB_INFO_2 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + int pipo=0; + prs_debug(ps, depth, desc, "smb_io_job_info_2"); + depth++; + *start_offset=ps->offset; + + prs_uint32("jobid", ps, depth, &(info->jobid)); + smb_io_relstr("printername",ps, depth, &(info->printername), start_offset, end_offset); + smb_io_relstr("machinename",ps, depth, &(info->machinename), start_offset, end_offset); + smb_io_relstr("username",ps, depth, &(info->username), start_offset, end_offset); + smb_io_relstr("document",ps, depth, &(info->document), start_offset, end_offset); + smb_io_relstr("notifyname",ps, depth, &(info->notifyname), start_offset, end_offset); + smb_io_relstr("datatype",ps, depth, &(info->datatype), start_offset, end_offset); + + smb_io_relstr("printprocessor",ps, depth, &(info->printprocessor), start_offset, end_offset); + smb_io_relstr("parameters",ps, depth, &(info->parameters), start_offset, end_offset); + smb_io_relstr("drivername",ps, depth, &(info->drivername), start_offset, end_offset); + smb_io_reldevmode("devmode", ps, depth, &(info->devmode), start_offset, end_offset); + smb_io_relstr("text_status",ps, depth, &(info->text_status), start_offset, end_offset); + +/* SEC_DESC sec_desc;*/ + prs_uint32("Hack! sec desc", ps, depth, &pipo); + + prs_uint32("status", ps, depth, &(info->status)); + prs_uint32("priority", ps, depth, &(info->priority)); + prs_uint32("position", ps, depth, &(info->position)); + prs_uint32("starttime", ps, depth, &(info->starttime)); + prs_uint32("untiltime", ps, depth, &(info->untiltime)); + prs_uint32("totalpages", ps, depth, &(info->totalpages)); + prs_uint32("size", ps, depth, &(info->size)); + spoolss_io_system_time("submitted", ps, depth, &(info->submitted) ); + prs_uint32("timeelapsed", ps, depth, &(info->timeelapsed)); + prs_uint32("pagesprinted", ps, depth, &(info->pagesprinted)); +} + +/******************************************************************* +********************************************************************/ +static void smb_io_form_1(char *desc, FORM_1 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_form_1"); + depth++; + *start_offset=ps->offset; + + prs_uint32("flag", ps, depth, &(info->flag)); + smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); + prs_uint32("width", ps, depth, &(info->width)); + prs_uint32("length", ps, depth, &(info->length)); + prs_uint32("left", ps, depth, &(info->left)); + prs_uint32("top", ps, depth, &(info->top)); + prs_uint32("right", ps, depth, &(info->right)); + prs_uint32("bottom", ps, depth, &(info->bottom)); +} + +/******************************************************************* +********************************************************************/ +static void smb_io_port_2(char *desc, PORT_INFO_2 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_form_1"); + depth++; + *start_offset=ps->offset; + + smb_io_relstr("port_name",ps, depth, &(info->port_name), start_offset, end_offset); + smb_io_relstr("monitor_name",ps, depth, &(info->monitor_name), start_offset, end_offset); + smb_io_relstr("description",ps, depth, &(info->description), start_offset, end_offset); + prs_uint32("port_type", ps, depth, &(info->port_type)); + prs_uint32("reserved", ps, depth, &(info->reserved)); +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_printer_info_0(PRINTER_INFO_0 *info) +{ + int size=0; + + size+=size_of_uint32( &(info->attributes) ); + size+=size_of_relative_string( &(info->printername) ); + size+=size_of_relative_string( &(info->servername) ); + return (size); +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_printer_info_1(PRINTER_INFO_1 *info) +{ + int size=0; + + size+=size_of_uint32( &(info->flags) ); + size+=size_of_relative_string( &(info->description) ); + size+=size_of_relative_string( &(info->name) ); + size+=size_of_relative_string( &(info->comment) ); + return (size); +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) +{ + int size=0; + + size+=4; /* the security descriptor */ + size+=0xDC+4; /* size of the devmode and the ptr */ + + size+=size_of_relative_string( &(info->servername) ); + size+=size_of_relative_string( &(info->printername) ); + size+=size_of_relative_string( &(info->sharename) ); + size+=size_of_relative_string( &(info->portname) ); + size+=size_of_relative_string( &(info->drivername) ); + size+=size_of_relative_string( &(info->comment) ); + size+=size_of_relative_string( &(info->location) ); + + size+=size_of_relative_string( &(info->sepfile) ); + size+=size_of_relative_string( &(info->printprocessor) ); + size+=size_of_relative_string( &(info->datatype) ); + size+=size_of_relative_string( &(info->parameters) ); + + size+=size_of_uint32( &(info->attributes) ); + size+=size_of_uint32( &(info->priority) ); + size+=size_of_uint32( &(info->defaultpriority) ); + size+=size_of_uint32( &(info->starttime) ); + size+=size_of_uint32( &(info->untiltime) ); + size+=size_of_uint32( &(info->status) ); + size+=size_of_uint32( &(info->cjobs) ); + size+=size_of_uint32( &(info->averageppm) ); + return (size); +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info) +{ + int size=0; + DEBUG(9,("Sizing driver info_1\n")); + size+=size_of_relative_string( &(info->name) ); + + DEBUGADD(9,("size: [%d]\n", size)); + return (size); +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info) +{ + int size=0; + DEBUG(9,("Sizing driver info_2\n")); + size+=size_of_uint32( &(info->version) ); + size+=size_of_relative_string( &(info->name) ); + size+=size_of_relative_string( &(info->architecture) ); + size+=size_of_relative_string( &(info->driverpath) ); + size+=size_of_relative_string( &(info->datafile) ); + size+=size_of_relative_string( &(info->configfile) ); + + DEBUGADD(9,("size: [%d]\n", size)); + return (size); +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) +{ + int size=0; + DEBUG(9,("Sizing driver info_3\n")); + size+=size_of_uint32( &(info->version) ); + size+=size_of_relative_string( &(info->name) ); + size+=size_of_relative_string( &(info->architecture) ); + size+=size_of_relative_string( &(info->driverpath) ); + size+=size_of_relative_string( &(info->datafile) ); + size+=size_of_relative_string( &(info->configfile) ); + size+=size_of_relative_string( &(info->helpfile) ); + size+=size_of_relative_string( &(info->dependentfiles) ); + size+=size_of_relative_string( &(info->monitorname) ); + size+=size_of_relative_string( &(info->defaultdatatype) ); + + DEBUGADD(9,("size: [%d]\n", size)); + return (size); +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_job_info_1(JOB_INFO_1 *info) +{ + int size=0; + size+=size_of_uint32( &(info->jobid) ); + size+=size_of_relative_string( &(info->printername) ); + size+=size_of_relative_string( &(info->machinename) ); + size+=size_of_relative_string( &(info->username) ); + size+=size_of_relative_string( &(info->document) ); + size+=size_of_relative_string( &(info->datatype) ); + size+=size_of_relative_string( &(info->text_status) ); + size+=size_of_uint32( &(info->status) ); + size+=size_of_uint32( &(info->priority) ); + size+=size_of_uint32( &(info->position) ); + size+=size_of_uint32( &(info->totalpages) ); + size+=size_of_uint32( &(info->pagesprinted) ); + size+=size_of_systemtime( &(info->submitted) ); + return (size); +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_job_info_2(JOB_INFO_2 *info) +{ + int size=0; + + size+=4; /* size of sec desc ptr */ + + size+=size_of_uint32( &(info->jobid) ); + size+=size_of_relative_string( &(info->printername) ); + size+=size_of_relative_string( &(info->machinename) ); + size+=size_of_relative_string( &(info->username) ); + size+=size_of_relative_string( &(info->document) ); + size+=size_of_relative_string( &(info->notifyname) ); + size+=size_of_relative_string( &(info->datatype) ); + size+=size_of_relative_string( &(info->printprocessor) ); + size+=size_of_relative_string( &(info->parameters) ); + size+=size_of_relative_string( &(info->drivername) ); + size+=size_of_device_mode( &(info->devmode) ); + size+=size_of_relative_string( &(info->text_status) ); +/* SEC_DESC sec_desc;*/ + size+=size_of_uint32( &(info->status) ); + size+=size_of_uint32( &(info->priority) ); + size+=size_of_uint32( &(info->position) ); + size+=size_of_uint32( &(info->starttime) ); + size+=size_of_uint32( &(info->untiltime) ); + size+=size_of_uint32( &(info->totalpages) ); + size+=size_of_uint32( &(info->size) ); + size+=size_of_systemtime( &(info->submitted) ); + size+=size_of_uint32( &(info->timeelapsed) ); + size+=size_of_uint32( &(info->pagesprinted) ); + return (size); +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_form_1(FORM_1 *info) +{ + int size=0; + + size+=size_of_uint32( &(info->flag) ); + size+=size_of_relative_string( &(info->name) ); + size+=size_of_uint32( &(info->width) ); + size+=size_of_uint32( &(info->length) ); + size+=size_of_uint32( &(info->left) ); + size+=size_of_uint32( &(info->top) ); + size+=size_of_uint32( &(info->right) ); + size+=size_of_uint32( &(info->bottom) ); + + return (size); +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_port_info_2(PORT_INFO_2 *info) +{ + int size=0; + + size+=size_of_relative_string( &(info->port_name) ); + size+=size_of_relative_string( &(info->monitor_name) ); + size+=size_of_relative_string( &(info->description) ); + + size+=size_of_uint32( &(info->port_type) ); + size+=size_of_uint32( &(info->reserved) ); + + return (size); +} + +/******************************************************************* + * read a uint8 buffer of size *size. + * allocate memory for it + * return a pointer to the allocated memory and the size + * return NULL and a size of 0 if the buffer is empty + * + * jfmxxxx: fix it to also write a buffer + ********************************************************************/ +static void spoolss_io_read_buffer(char *desc, prs_struct *ps, int depth, BUFFER *buffer) +{ + prs_debug(ps, depth, desc, "spoolss_io_read_buffer"); + depth++; + + prs_align(ps); + + prs_uint32("pointer", ps, depth, &(buffer->ptr)); + + if (buffer->ptr != 0x0000) + { + prs_uint32("size", ps, depth, &(buffer->size)); + buffer->data=(uint8 *)malloc( (buffer->size) * sizeof(uint8) ); + prs_uint8s(True,"buffer", ps, depth, buffer->data, buffer->size); + prs_align(ps); + + } + else + { + buffer->data=0x0000; + buffer->size=0x0000; + } +} + + +/******************************************************************* + * read a structure. + * called from spoolss_getprinterdriver2 (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_q_getprinterdriver2(char *desc, + SPOOL_Q_GETPRINTERDRIVER2 *q_u, + prs_struct *ps, int depth) +{ + uint32 useless_ptr; + prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdriver2"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("pointer", ps, depth, &useless_ptr); + smb_io_unistr2("architecture", &(q_u->architecture),True,ps,depth); + + prs_align(ps); + + prs_uint32("level", ps, depth, &(q_u->level)); + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + + prs_align(ps); + + prs_uint32("buffer size", ps, depth, &(q_u->buf_size)); + prs_uint32("status", ps, depth, &(q_u->status)); + +} + +/******************************************************************* + * read a structure. + * called from spoolss_getprinterdriver2 (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, + prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + uint32 pipo=0; + DRIVER_INFO_1 *info1; + DRIVER_INFO_2 *info2; + DRIVER_INFO_3 *info3; + + prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriver2"); + depth++; + + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + + info1 = r_u->printer.info1; + info2 = r_u->printer.info2; + info3 = r_u->printer.info3; + + switch (r_u->level) + { + case 1: + { + bufsize_required += spoolss_size_printer_driver_info_1(info1); + break; + } + case 2: + { + bufsize_required += spoolss_size_printer_driver_info_2(info2); + break; + } + case 3: + { + bufsize_required += spoolss_size_printer_driver_info_3(info3); + break; + } + } + + DEBUG(4,("spoolss_io_r_getprinterdriver2, size needed: %d\n",bufsize_required)); + DEBUG(4,("spoolss_io_r_getprinterdriver2, size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ + + DEBUG(4,("spoolss_io_r_getprinterdriver2, buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); + + DEBUG(4,("spoolss_io_r_getprinterdriver2, buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + + beginning=ps->offset; + start_offset=ps->offset; + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 1: + { + smb_io_printer_driver_info_1(desc, + info1, + ps, + depth, + &start_offset, + &end_offset); + break; + } + case 2: + { + smb_io_printer_driver_info_2(desc, + info2, + ps, + depth, + &start_offset, + &end_offset); + break; + } + case 3: + { + smb_io_printer_driver_info_3(desc, + info3, + ps, + depth, + &start_offset, + &end_offset); + break; + } + + } + + ps->offset=beginning+r_u->offered; + prs_align(ps); + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("pipo", ps, depth, &pipo); + prs_uint32("pipo", ps, depth, &pipo); + prs_uint32("status", ps, depth, &(r_u->status)); + +} + +/******************************************************************* + * read a structure. + * called from spoolss_enumprinters (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, + prs_struct *ps, int depth) +{ + uint32 useless_ptr; + prs_debug(ps, depth, desc, "spoolss_io_q_enumprinters"); + depth++; + + prs_align(ps); + + prs_uint32("flags", ps, depth, &(q_u->flags)); + + prs_uint32("useless ptr", ps, depth, &useless_ptr); + + smb_io_unistr2("", &(q_u->servername),True,ps,depth); + + prs_align(ps); + + prs_uint32("level", ps, depth, &(q_u->level)); + + spoolss_io_read_buffer("buffer", ps, depth, &(q_u->buffer)); +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_enum_printers (srv_spoolss.c) + * + ********************************************************************/ +void spoolss_io_r_enumprinters(char *desc, + SPOOL_R_ENUMPRINTERS *r_u, + prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + int i; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + + PRINTER_INFO_1 *info1; + PRINTER_INFO_2 *info2; + + prs_debug(ps, depth, desc, "spoolss_io_r_enumprinters"); + depth++; + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + + for(i=0;ireturned;i++) + { + switch (r_u->level) + { + case 1: + info1 = r_u->printer.printers_1[i]; + bufsize_required += spoolss_size_printer_info_1(info1); + break; + case 2: + info2 = r_u->printer.printers_2[i]; + bufsize_required += spoolss_size_printer_info_2(info2); + break; + } + } + + DEBUG(4,("spoolss_io_r_enumprinters, size needed: %d\n",bufsize_required)); + DEBUG(4,("spoolss_io_r_enumprinters, size offered: %d\n",r_u->offered)); + + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; + r_u->offered=0; + /*r_u->returned=0;*/ + + DEBUG(4,("spoolss_io_r_enumprinters, buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("count", ps, depth, &(r_u->returned)); + prs_uint32("status", ps, depth, &(r_u->status)); + return; + } + + mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); + + DEBUG(4,("spoolss_io_r_enumprinters, buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + + beginning=ps->offset; + start_offset=ps->offset; + end_offset=start_offset+r_u->offered; + + for(i=0;ireturned;i++) + { + switch (r_u->level) + { + case 1: + info1=r_u->printer.printers_1[i]; + smb_io_printer_info_1(desc, info1, ps, depth, + &start_offset, &end_offset); + break; + case 2: + info2=r_u->printer.printers_2[i]; + smb_io_printer_info_2(desc, info2, ps, depth, + &start_offset, &end_offset); + break; + } + } + + ps->offset=beginning+r_u->offered; + prs_align(ps); + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("count", ps, depth, &(r_u->returned)); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_enum_printers (srv_spoolss.c) + * + ********************************************************************/ +void spoolss_io_r_getprinter(char *desc, + SPOOL_R_GETPRINTER *r_u, + prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + + prs_debug(ps, depth, desc, "spoolss_io_r_getprinter"); + depth++; + + prs_align(ps); + + prs_uint32("pointer", ps, depth, &useless_ptr); + + switch (r_u->level) + { + case 0: + { + PRINTER_INFO_0 *info; + info = r_u->printer.info0; + bufsize_required += spoolss_size_printer_info_0(info); + break; + } + case 1: + { + PRINTER_INFO_1 *info; + info = r_u->printer.info1; + bufsize_required += spoolss_size_printer_info_1(info); + break; + } + case 2: + { + PRINTER_INFO_2 *info; + info = r_u->printer.info2; + bufsize_required += spoolss_size_printer_info_2(info); + break; + } + } + + DEBUG(4,("spoolss_io_r_getprinter, size needed: %d\n",bufsize_required)); + DEBUG(4,("spoolss_io_r_getprinter, size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ + + DEBUG(4,("spoolss_io_r_getprinter, buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); + + DEBUG(4,("spoolss_io_r_getprinter, buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + beginning=ps->offset; + start_offset=ps->offset; + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 0: + { + PRINTER_INFO_0 *info; + info = r_u->printer.info0; + smb_io_printer_info_0(desc, + info, + ps, + depth, + &start_offset, + &end_offset); + break; + } + case 1: + { + PRINTER_INFO_1 *info; + info = r_u->printer.info1; + smb_io_printer_info_1(desc, + info, + ps, + depth, + &start_offset, + &end_offset); + break; + } + case 2: + { + PRINTER_INFO_2 *info; + info = r_u->printer.info2; + smb_io_printer_info_2(desc, + info, + ps, + depth, + &start_offset, + &end_offset); + break; + } + + } + + ps->offset=beginning+r_u->offered; + prs_align(ps); + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("status", ps, depth, &(r_u->status)); + +} + +/******************************************************************* + * read a uint8 buffer of size *size. + * allocate memory for it + * return a pointer to the allocated memory and the size + * return NULL and a size of 0 if the buffer is empty + * + * jfmxxxx: fix it to also write a buffer + ********************************************************************/ +static void spoolss_io_read_buffer8(char *desc, prs_struct *ps, uint8 **buffer, uint32 *size,int depth) +{ + uint32 useless_ptr; + + prs_debug(ps, depth, desc, "spoolss_io_read_buffer8"); + depth++; + + prs_align(ps); + + prs_uint32("buffer pointer", ps, depth, &useless_ptr); + + if (useless_ptr != 0x0000) + { + prs_uint32("buffer size", ps, depth, size); + *buffer=(uint8 *)malloc( (*size) * sizeof(uint8) ); + prs_uint8s(True,"buffer",ps,depth,*buffer,*size); + prs_align(ps); + } + else + { + *buffer=0x0000; + *size=0x0000; + } +} + +/******************************************************************* + * read a structure. + * called from spoolss_getprinter (srv_spoolss.c) + ********************************************************************/ +void spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, + prs_struct *ps, int depth) +{ + uint32 count; + uint8 *buffer; + prs_debug(ps, depth, desc, "spoolss_io_q_getprinter"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + + prs_uint32("level", ps, depth, &(q_u->level)); + + spoolss_io_read_buffer8("",ps, &buffer, &count,depth); + if (buffer != 0x0000) + { + free(buffer); + } + + prs_uint32("buffer size", ps, depth, &(q_u->offered)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_setprinter"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +static void spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE **devmode) +{ + uint32 devmode_size=0x0; + uint32 useless_ptr=0x0; + + prs_debug(ps, depth, desc, "spoolss_io_devmode"); + depth++; + + prs_uint32("devmode_size", ps, depth, &(devmode_size)); + prs_uint32("useless_ptr", ps, depth, &(useless_ptr)); + + if (devmode_size!=0 && useless_ptr!=0) + { + /* so we have a DEVICEMODE to follow */ + if (ps->io) + { + DEBUG(9,("Allocating memory for spoolss_io_devmode\n")); + *devmode=(DEVICEMODE *)malloc(sizeof(DEVICEMODE)); + ZERO_STRUCTP(*devmode); + } + + /* this is bad code, shouldn't be there */ + prs_uint32("devmode_size", ps, depth, &(devmode_size)); + + smb_io_devmode(desc, ps, depth, *devmode); + } +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_setprinter"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle", &(q_u->handle),ps,depth); + prs_uint32("level", ps, depth, &(q_u->level)); + + /* again a designed mess */ + /* sometimes I'm wondering how all of this work ! */ + + /* To be correct it need to be split in 3 functions */ + + spool_io_printer_info_level("", &(q_u->info), ps, depth); + + spoolss_io_devmode(desc, ps, depth, &(q_u->devmode)); + + prs_uint32("security.size_of_buffer", ps, depth, &(q_u->security.size_of_buffer)); + prs_uint32("security.data", ps, depth, &(q_u->security.data)); + + prs_uint32("command", ps, depth, &(q_u->command)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_r_fcpn(char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_fcpn"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_fcpn(char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) +{ + + prs_debug(ps, depth, desc, "spoolss_io_q_fcpn"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); +} + + +/******************************************************************* +********************************************************************/ +void spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int depth) +{ + + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("level", ps, depth, &(q_u->level)); + + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + + prs_align(ps); + + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + int i; + + prs_debug(ps, depth, desc, "spoolss_io_r_enumjobs"); + depth++; + + prs_align(ps); + + prs_uint32("pointer", ps, depth, &useless_ptr); + + switch (r_u->level) + { + case 1: + { + JOB_INFO_1 *info; + info=r_u->job.job_info_1; + + for (i=0; inumofjobs; i++) + { + bufsize_required += spoolss_size_job_info_1(&(info[i])); + } + break; + } + case 2: + { + JOB_INFO_2 *info; + info=r_u->job.job_info_2; + + for (i=0; inumofjobs; i++) + { + bufsize_required += spoolss_size_job_info_2(&(info[i])); + } + break; + } + } + + DEBUG(4,("spoolss_io_r_enumjobs, size needed: %d\n",bufsize_required)); + DEBUG(4,("spoolss_io_r_enumjobs, size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ + + DEBUG(4,("spoolss_io_r_enumjobs, buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); + + DEBUG(4,("spoolss_io_r_enumjobs, buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + beginning=ps->offset; + start_offset=ps->offset; + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 1: + { + JOB_INFO_1 *info; + for (i=0; inumofjobs; i++) + { + info = &(r_u->job.job_info_1[i]); + smb_io_job_info_1(desc, + info, + ps, + depth, + &start_offset, + &end_offset); + } + break; + } + case 2: + { + JOB_INFO_2 *info; + for (i=0; inumofjobs; i++) + { + info = &(r_u->job.job_info_2[i]); + smb_io_job_info_2(desc, + info, + ps, + depth, + &start_offset, + &end_offset); + } + break; + } + + } + ps->offset=beginning+r_u->offered; + prs_align(ps); + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("numofjobs", ps, depth, &(r_u->numofjobs)); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth) +{ + + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("firstjob", ps, depth, &(q_u->firstjob)); + prs_uint32("numofjobs", ps, depth, &(q_u->numofjobs)); + prs_uint32("level", ps, depth, &(q_u->level)); + + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + + prs_align(ps); + + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_r_schedulejob(char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_schedulejob"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_schedulejob(char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_schedulejob"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("jobid", ps, depth, &(q_u->jobid)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_r_setjob(char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_setjob"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_setjob"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("jobid", ps, depth, &(q_u->jobid)); + /* + * level is usually 0. If (level!=0) then I'm in trouble ! + * I will try to generate setjob command with level!=0, one day. + */ + prs_uint32("level", ps, depth, &(q_u->level)); + prs_uint32("command", ps, depth, &(q_u->command)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_r_enumdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + int i; + + prs_debug(ps, depth, desc, "spoolss_io_r_enumdrivers"); + depth++; + + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + + DEBUG(7,("Level [%d], number [%d]\n", r_u->level, r_u->numofdrivers)); + switch (r_u->level) + { + case 1: + { + DRIVER_INFO_1 *driver_info_1; + driver_info_1=r_u->driver.driver_info_1; + + for (i=0; inumofdrivers; i++) + { + bufsize_required += spoolss_size_printer_driver_info_1(&(driver_info_1[i])); + } + break; + } + case 2: + { + DRIVER_INFO_2 *driver_info_2; + driver_info_2=r_u->driver.driver_info_2; + + for (i=0; inumofdrivers; i++) + { + bufsize_required += spoolss_size_printer_driver_info_2(&(driver_info_2[2])); + } + break; + } + case 3: + { + DRIVER_INFO_3 *driver_info_3; + driver_info_3=r_u->driver.driver_info_3; + + for (i=0; inumofdrivers; i++) + { + bufsize_required += spoolss_size_printer_driver_info_3(&(driver_info_3[i])); + } + break; + } + } + + DEBUGADD(7,("size needed: %d\n",bufsize_required)); + DEBUGADD(7,("size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ + DEBUGADD(8,("buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); + + DEBUGADD(8,("buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + beginning=ps->offset; + start_offset=ps->offset; + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 1: + { + DRIVER_INFO_1 *info; + for (i=0; inumofdrivers; i++) + { + info = &(r_u->driver.driver_info_1[i]); + smb_io_printer_driver_info_1(desc, info, ps, depth, &start_offset, &end_offset); + } + break; + } + case 2: + { + DRIVER_INFO_2 *info; + for (i=0; inumofdrivers; i++) + { + info = &(r_u->driver.driver_info_2[i]); + smb_io_printer_driver_info_2(desc, info, ps, depth, &start_offset, &end_offset); + } + break; + } + case 3: + { + DRIVER_INFO_3 *info; + for (i=0; inumofdrivers; i++) + { + info = &(r_u->driver.driver_info_3[i]); + smb_io_printer_driver_info_3(desc, info, ps, depth, &start_offset, &end_offset); + } + break; + } + } + ps->offset=beginning+r_u->offered; + prs_align(ps); + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("numofdrivers", ps, depth, &(r_u->numofdrivers)); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth) +{ + + uint32 useless_ptr=0xADDE0FF0; + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + smb_io_unistr2("", &(q_u->name),True,ps,depth); + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + smb_io_unistr2("", &(q_u->environment),True,ps,depth); + prs_align(ps); + prs_uint32("level", ps, depth, &(q_u->level)); + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + prs_align(ps); + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + int i; + + prs_debug(ps, depth, desc, "spoolss_io_r_enumforms"); + depth++; + + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + switch (r_u->level) + { + case 1: + { + FORM_1 *forms_1; + forms_1=r_u->forms_1; + + for (i=0; inumofforms; i++) + { + bufsize_required += spoolss_size_form_1(&(forms_1[i])); + } + break; + } + } + + DEBUG(4,("spoolss_io_r_enumforms, size needed: %d\n",bufsize_required)); + DEBUG(4,("spoolss_io_r_enumforms, size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ + + DEBUG(4,("spoolss_io_r_enumforms, buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); + + DEBUG(4,("spoolss_io_r_enumforms, buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + + if (r_u->offered!=0) + { + beginning=ps->offset; + start_offset=ps->offset; + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 1: + { + FORM_1 *info; + for (i=0; inumofforms; i++) + { + info = &(r_u->forms_1[i]); + smb_io_form_1(desc, info, ps, depth, &start_offset, &end_offset); + } + break; + } + } + ps->offset=beginning+r_u->offered; + prs_align(ps); + } + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("numofforms", ps, depth, &(r_u->numofforms)); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, int depth) +{ + + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("level", ps, depth, &(q_u->level)); + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + prs_align(ps); + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + int i; + + prs_debug(ps, depth, desc, "spoolss_io_r_enumports"); + depth++; + + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + switch (r_u->level) + { + case 2: + { + PORT_INFO_2 *port_2; + port_2=r_u->port.port_info_2; + + for (i=0; inumofports; i++) + { + bufsize_required += spoolss_size_port_info_2(&(port_2[i])); + } + break; + } + } + + DEBUG(4,("size needed: %d\n",bufsize_required)); + DEBUG(4,("size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ + + DEBUG(4,("buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); + + DEBUG(4,("buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + beginning=ps->offset; + start_offset=ps->offset; + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 2: + { + PORT_INFO_2 *info; + for (i=0; inumofports; i++) + { + info = &(r_u->port.port_info_2[i]); + smb_io_port_2(desc, info, ps, depth, &start_offset, &end_offset); + } + break; + } + } + ps->offset=beginning+r_u->offered; + prs_align(ps); + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("numofports", ps, depth, &(r_u->numofports)); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth) +{ + uint32 useless; + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + prs_uint32("useless", ps, depth, &useless); + smb_io_unistr2("", &(q_u->name),True,ps,depth); + prs_align(ps); + prs_uint32("level", ps, depth, &(q_u->level)); + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + prs_align(ps); + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); +} + + +/******************************************************************* +********************************************************************/ +void spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 **q_u, prs_struct *ps, int depth) +{ + SPOOL_PRINTER_INFO_LEVEL_2 *il; + + prs_debug(ps, depth, desc, ""); + depth++; + + /* reading */ + if (ps->io) + { + il=(SPOOL_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2)); + ZERO_STRUCTP(il); + *q_u=il; + DEBUG(7,("lecture: memoire ok\n")); + } + else + { + il=*q_u; + } + + prs_align(ps); + + prs_uint32("servername_ptr", ps, depth, &(il->servername_ptr)); + prs_uint32("printername_ptr", ps, depth, &(il->printername_ptr)); + prs_uint32("sharename_ptr", ps, depth, &(il->sharename_ptr)); + prs_uint32("portname_ptr", ps, depth, &(il->portname_ptr)); + prs_uint32("drivername_ptr", ps, depth, &(il->drivername_ptr)); + prs_uint32("comment_ptr", ps, depth, &(il->comment_ptr)); + prs_uint32("location_ptr", ps, depth, &(il->location_ptr)); + prs_uint32("devmode_ptr", ps, depth, &(il->devmode_ptr)); + prs_uint32("sepfile_ptr", ps, depth, &(il->sepfile_ptr)); + prs_uint32("printprocessor_ptr", ps, depth, &(il->printprocessor_ptr)); + prs_uint32("datatype_ptr", ps, depth, &(il->datatype_ptr)); + prs_uint32("parameters_ptr", ps, depth, &(il->parameters_ptr)); + prs_uint32("secdesc_ptr", ps, depth, &(il->secdesc_ptr)); + + prs_uint32("attributes", ps, depth, &(il->attributes)); + prs_uint32("priority", ps, depth, &(il->priority)); + prs_uint32("default_priority", ps, depth, &(il->default_priority)); + prs_uint32("starttime", ps, depth, &(il->starttime)); + prs_uint32("untiltime", ps, depth, &(il->untiltime)); + prs_uint32("status", ps, depth, &(il->status)); + prs_uint32("cjobs", ps, depth, &(il->cjobs)); + prs_uint32("averageppm", ps, depth, &(il->averageppm)); + + smb_io_unistr2("", &(il->servername), il->servername_ptr, ps, depth); + smb_io_unistr2("", &(il->printername), il->printername_ptr, ps, depth); + smb_io_unistr2("", &(il->sharename), il->sharename_ptr, ps, depth); + smb_io_unistr2("", &(il->portname), il->portname_ptr, ps, depth); + smb_io_unistr2("", &(il->drivername), il->drivername_ptr, ps, depth); + smb_io_unistr2("", &(il->comment), il->comment_ptr, ps, depth); + smb_io_unistr2("", &(il->location), il->location_ptr, ps, depth); + smb_io_unistr2("", &(il->sepfile), il->sepfile_ptr, ps, depth); + smb_io_unistr2("", &(il->printprocessor), il->printprocessor_ptr, ps, depth); + smb_io_unistr2("", &(il->datatype), il->datatype_ptr, ps, depth); + smb_io_unistr2("", &(il->parameters), il->parameters_ptr, ps, depth); + + prs_align(ps); + + /* this code as nothing to do here !!! + + if (il->secdesc_ptr) + { + il->secdesc=NULL; + sec_io_desc_buf("", &(il->secdesc), ps, depth); + } + + */ +} + +/******************************************************************* +********************************************************************/ +void spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth) +{ + uint32 useless; + uint32 level; + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + prs_uint32("info level", ps, depth, &level); + prs_uint32("useless", ps, depth, &useless); + + switch (level) + { + /* + * level 0 is used by setprinter when managing the queue + * (hold, stop, start a queue) + */ + case 0: + break; + /* + * level 2 is used by addprinter + * and by setprinter when updating printer's info + */ + case 2: + spool_io_printer_info_level_2("", &(il->info_2), ps, depth); + break; + } + +} + +/******************************************************************* +********************************************************************/ +void spool_io_user_level_1(char *desc, SPOOL_USER_LEVEL_1 **q_u, prs_struct *ps, int depth) +{ + SPOOL_USER_LEVEL_1 *il; + prs_debug(ps, depth, desc, ""); + depth++; + + /* reading */ + if (ps->io) + { + il=(SPOOL_USER_LEVEL_1 *)malloc(sizeof(SPOOL_USER_LEVEL_1)); + ZERO_STRUCTP(il); + *q_u=il; + } + else + { + il=*q_u; + } + + prs_align(ps); + prs_uint32("size", ps, depth, &(il->size)); + prs_uint32("client_name_ptr", ps, depth, &(il->client_name_ptr)); + prs_uint32("user_name_ptr", ps, depth, &(il->user_name_ptr)); + prs_uint32("build", ps, depth, &(il->build)); + prs_uint32("major", ps, depth, &(il->major)); + prs_uint32("minor", ps, depth, &(il->minor)); + prs_uint32("processor", ps, depth, &(il->processor)); + + smb_io_unistr2("", &(il->client_name), il->client_name_ptr, ps, depth); + prs_align(ps); + smb_io_unistr2("", &(il->user_name), il->user_name_ptr, ps, depth); +} + +/******************************************************************* +********************************************************************/ +void spool_io_user_level(char *desc, SPOOL_USER_LEVEL *q_u, prs_struct *ps, int depth) +{ + uint32 useless; + uint32 level; + prs_debug(ps, depth, desc, "spool_io_user_level"); + depth++; + + prs_align(ps); + prs_uint32("info_level", ps, depth, &level); + prs_uint32("useless", ps, depth, &useless); + + switch (level) + { + case 1: + spool_io_user_level_1("", &(q_u->user_level_1), ps, depth); + break; + + } +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth) +{ + uint32 useless; + prs_debug(ps, depth, desc, "spoolss_io_q_addprinterex"); + depth++; + + /* + * I think that's one of the few well written functions. + * the sub-structures are correctly parsed and analysed + * the info level are handled in a nice way. + */ + + prs_align(ps); + prs_uint32("useless", ps, depth, &useless); + smb_io_unistr2("", &(q_u->server_name),True,ps,depth); + prs_align(ps); + + prs_uint32("info_level", ps, depth, &(q_u->level)); + + spool_io_printer_info_level("", &(q_u->info), ps, depth); + + /* the 4 unknown are all 0 */ + + /* + * en fait ils sont pas inconnu + * par recoupement avec rpcSetPrinter + * c'est le devicemode + * et le security descriptor. + */ + + prs_uint32("unk0", ps, depth, &(q_u->unk0)); + prs_uint32("unk1", ps, depth, &(q_u->unk1)); + prs_uint32("unk2", ps, depth, &(q_u->unk2)); + prs_uint32("unk3", ps, depth, &(q_u->unk3)); + + prs_uint32("info_level", ps, depth, &(q_u->user_level)); + + spool_io_user_level("", &(q_u->user), ps, depth); +} + + +/******************************************************************* +********************************************************************/ +void spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_addprinterex"); + depth++; + + smb_io_prt_hnd("printer handle",&(r_u->handle),ps,depth); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, + prs_struct *ps, int depth) +{ + SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *il; + + prs_debug(ps, depth, desc, ""); + depth++; + + /* reading */ + if (ps->io) + { + il=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *)malloc(sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); + ZERO_STRUCTP(il); + *q_u=il; + DEBUG(1,("lecture: memoire ok\n")); + } + else + { + il=*q_u; + } + + prs_align(ps); + + prs_uint32("cversion", ps, depth, &(il->cversion)); + prs_uint32("name", ps, depth, &(il->name_ptr)); + prs_uint32("environment", ps, depth, &(il->environment_ptr)); + prs_uint32("driverpath", ps, depth, &(il->driverpath_ptr)); + prs_uint32("datafile", ps, depth, &(il->datafile_ptr)); + prs_uint32("configfile", ps, depth, &(il->configfile_ptr)); + prs_uint32("helpfile", ps, depth, &(il->helpfile_ptr)); + prs_uint32("monitorname", ps, depth, &(il->monitorname_ptr)); + prs_uint32("defaultdatatype", ps, depth, &(il->defaultdatatype_ptr)); + prs_uint32("dependentfilessize", ps, depth, &(il->dependentfilessize)); + prs_uint32("dependentfiles", ps, depth, &(il->dependentfiles_ptr)); + + prs_align(ps); + + smb_io_unistr2("", &(il->name), il->name_ptr, ps, depth); + smb_io_unistr2("", &(il->environment), il->environment_ptr, ps, depth); + smb_io_unistr2("", &(il->driverpath), il->driverpath_ptr, ps, depth); + smb_io_unistr2("", &(il->datafile), il->datafile_ptr, ps, depth); + smb_io_unistr2("", &(il->configfile), il->configfile_ptr, ps, depth); + smb_io_unistr2("", &(il->helpfile), il->helpfile_ptr, ps, depth); + smb_io_unistr2("", &(il->monitorname), il->monitorname_ptr, ps, depth); + smb_io_unistr2("", &(il->defaultdatatype), il->defaultdatatype_ptr, ps, depth); + + prs_align(ps); + if (il->dependentfiles_ptr) + smb_io_buffer5("", &(il->dependentfiles), ps, depth); + +} + + +/******************************************************************* + convert a buffer of UNICODE strings null terminated + the buffer is terminated by a NULL + + convert to an ascii array (null terminated) + + dynamically allocate memory + +********************************************************************/ +void uniarray_2_ascarray(BUFFER5 *buf5, char ***ar) +{ + char **array; + char *string; + char *destend; + char *dest; + uint32 n; + uint32 i; + + uint16 *src; + + if (buf5==NULL) return; + + array=NULL; + n=0; + i=0; + src=buf5->buffer; + + string=(char *)malloc(sizeof(char)*buf5->buf_len); + + destend = string + buf5->buf_len; + dest=string; + + while (dest < destend) + { + *(dest++) = (char)*(src++); + } + + /* that ugly for the first one but that's working */ + array=(char **)Realloc(array, sizeof(char *)*(i+1)); + array[i++]=string; + + while ( n < buf5->buf_len ) + { + if ( *(string++) == '\0' ) + { + array=(char **)Realloc(array, sizeof(char *)*(i+1)); + array[i++]=string; + } + n++; + } + *ar=array; + + DEBUG(10,("Number of dependent files: [%d]\n", i-1)); +} + +/******************************************************************* + read a UNICODE array with null terminated strings + and null terminated array + and size of array at beginning +********************************************************************/ +void smb_io_unibuffer(char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) +{ + + if (buffer==NULL) return; + + buffer->undoc=0; + buffer->uni_str_len=buffer->uni_max_len; + + prs_uint32("buffer_size", ps, depth, &(buffer->uni_max_len)); + + prs_unistr2(True, "buffer ", ps, depth, buffer); + +} + +/******************************************************************* +********************************************************************/ +void spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth) +{ + uint32 useless; + uint32 level; + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + prs_uint32("info level", ps, depth, &level); + prs_uint32("useless", ps, depth, &useless); + + switch (level) + { + case 3: + spool_io_printer_driver_info_level_3("", &(il->info_3), ps, depth); + break; + } + +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) +{ + uint32 useless; + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + prs_uint32("useless", ps, depth, &useless); + smb_io_unistr2("", &(q_u->server_name),True,ps,depth); + prs_align(ps); + prs_uint32("info_level", ps, depth, &(q_u->level)); + + spool_io_printer_driver_info_level("", &(q_u->info), ps, depth); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_r_addprinterdriver(char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, ""); + depth++; + + prs_uint32("status", ps, depth, &(q_u->status)); +} + + +/******************************************************************* +********************************************************************/ +void uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, + NT_PRINTER_DRIVER_INFO_LEVEL_3 **asc) +{ + NT_PRINTER_DRIVER_INFO_LEVEL_3 *d; + + DEBUG(7,("uni_2_asc_printer_driver_3: Converting from UNICODE to ASCII\n")); + + if (*asc==NULL) + { + *asc=(NT_PRINTER_DRIVER_INFO_LEVEL_3 *)malloc(sizeof(NT_PRINTER_DRIVER_INFO_LEVEL_3)); + ZERO_STRUCTP(*asc); + } + + d=*asc; + + d->cversion=uni->cversion; + + unistr2_to_ascii(d->name, &(uni->name), sizeof(d->name)-1); + unistr2_to_ascii(d->environment, &(uni->environment), sizeof(d->environment)-1); + unistr2_to_ascii(d->driverpath, &(uni->driverpath), sizeof(d->driverpath)-1); + unistr2_to_ascii(d->datafile, &(uni->datafile), sizeof(d->datafile)-1); + unistr2_to_ascii(d->configfile, &(uni->configfile), sizeof(d->configfile)-1); + unistr2_to_ascii(d->helpfile, &(uni->helpfile), sizeof(d->helpfile)-1); + unistr2_to_ascii(d->monitorname, &(uni->monitorname), sizeof(d->monitorname)-1); + unistr2_to_ascii(d->defaultdatatype, &(uni->defaultdatatype), sizeof(d->defaultdatatype)-1); + + DEBUGADD(8,( "version: %d\n", d->cversion)); + DEBUGADD(8,( "name: %s\n", d->name)); + DEBUGADD(8,( "environment: %s\n", d->environment)); + DEBUGADD(8,( "driverpath: %s\n", d->driverpath)); + DEBUGADD(8,( "datafile: %s\n", d->datafile)); + DEBUGADD(8,( "configfile: %s\n", d->configfile)); + DEBUGADD(8,( "helpfile: %s\n", d->helpfile)); + DEBUGADD(8,( "monitorname: %s\n", d->monitorname)); + DEBUGADD(8,( "defaultdatatype: %s\n", d->defaultdatatype)); + + uniarray_2_ascarray(&(uni->dependentfiles), &(d->dependentfiles) ); +} + +void uni_2_asc_printer_info_2(SPOOL_PRINTER_INFO_LEVEL_2 *uni, + NT_PRINTER_INFO_LEVEL_2 **asc) +{ + NT_PRINTER_INFO_LEVEL_2 *d; + + DEBUG(7,("Converting from UNICODE to ASCII\n")); + + if (*asc==NULL) + { + DEBUGADD(8,("allocating memory\n")); + + *asc=(NT_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(NT_PRINTER_INFO_LEVEL_2)); + ZERO_STRUCTP(*asc); + } + DEBUGADD(8,("start converting\n")); + + d=*asc; + + d->attributes=uni->attributes; + d->priority=uni->priority; + d->default_priority=uni->default_priority; + d->starttime=uni->starttime; + d->untiltime=uni->untiltime; + d->status=uni->status; + d->cjobs=uni->cjobs; + + unistr2_to_ascii(d->servername, &(uni->servername), sizeof(d->servername)-1); + unistr2_to_ascii(d->printername, &(uni->printername), sizeof(d->printername)-1); + unistr2_to_ascii(d->sharename, &(uni->sharename), sizeof(d->sharename)-1); + unistr2_to_ascii(d->portname, &(uni->portname), sizeof(d->portname)-1); + unistr2_to_ascii(d->drivername, &(uni->drivername), sizeof(d->drivername)-1); + unistr2_to_ascii(d->comment, &(uni->comment), sizeof(d->comment)-1); + unistr2_to_ascii(d->location, &(uni->location), sizeof(d->location)-1); + unistr2_to_ascii(d->sepfile, &(uni->sepfile), sizeof(d->sepfile)-1); + unistr2_to_ascii(d->printprocessor, &(uni->printprocessor), sizeof(d->printprocessor)-1); + unistr2_to_ascii(d->datatype, &(uni->datatype), sizeof(d->datatype)-1); + unistr2_to_ascii(d->parameters, &(uni->parameters), sizeof(d->parameters)-1); +} + +void convert_printer_info(SPOOL_PRINTER_INFO_LEVEL uni, + NT_PRINTER_INFO_LEVEL *printer, + uint32 level) +{ + switch (level) + { + case 2: + { + uni_2_asc_printer_info_2(uni.info_2, &(printer->info_2)); + break; + } + default: + break; + } + + +} + +void convert_printer_driver_info(SPOOL_PRINTER_DRIVER_INFO_LEVEL uni, + NT_PRINTER_DRIVER_INFO_LEVEL *printer, + uint32 level) +{ + switch (level) + { + case 3: + { + printer->info_3=NULL; + uni_2_asc_printer_driver_3(uni.info_3, &(printer->info_3)); + break; + } + default: + break; + } + + +} + +void convert_devicemode(DEVICEMODE devmode, NT_DEVICEMODE *nt_devmode) +{ + unistr_to_ascii(nt_devmode->devicename, + devmode.devicename.buffer, + 31); + + unistr_to_ascii(nt_devmode->formname, + devmode.formname.buffer, + 31); + + nt_devmode->specversion=devmode.specversion; + nt_devmode->driverversion=devmode.driverversion; + nt_devmode->size=devmode.size; + nt_devmode->driverextra=devmode.driverextra; + nt_devmode->fields=devmode.fields; + nt_devmode->orientation=devmode.orientation; + nt_devmode->papersize=devmode.papersize; + nt_devmode->paperlength=devmode.paperlength; + nt_devmode->paperwidth=devmode.paperwidth; + nt_devmode->scale=devmode.scale; + nt_devmode->copies=devmode.copies; + nt_devmode->defaultsource=devmode.defaultsource; + nt_devmode->printquality=devmode.printquality; + nt_devmode->color=devmode.color; + nt_devmode->duplex=devmode.duplex; + nt_devmode->yresolution=devmode.yresolution; + nt_devmode->ttoption=devmode.ttoption; + nt_devmode->collate=devmode.collate; + + nt_devmode->logpixels=devmode.logpixels; + nt_devmode->bitsperpel=devmode.bitsperpel; + nt_devmode->pelswidth=devmode.pelswidth; + nt_devmode->pelsheight=devmode.pelsheight; + nt_devmode->displayflags=devmode.displayflags; + nt_devmode->displayfrequency=devmode.displayfrequency; + nt_devmode->icmmethod=devmode.icmmethod; + nt_devmode->icmintent=devmode.icmintent; + nt_devmode->mediatype=devmode.mediatype; + nt_devmode->dithertype=devmode.dithertype; + nt_devmode->reserved1=devmode.reserved1; + nt_devmode->reserved2=devmode.reserved2; + nt_devmode->panningwidth=devmode.panningwidth; + nt_devmode->panningheight=devmode.panningheight; + + if (nt_devmode->driverextra != 0) + { + /* if we had a previous private delete it and make a new one */ + if (nt_devmode->private != NULL) + free(nt_devmode->private); + nt_devmode->private=(uint8 *)malloc(nt_devmode->driverextra * sizeof(uint8)); + memcpy(nt_devmode->private, devmode.private, nt_devmode->driverextra); + } + +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + + prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriverdir"); + depth++; + + prs_align(ps); + + prs_uint32("pointer", ps, depth, &useless_ptr); + + switch (r_u->level) + { + case 1: + { + DRIVER_DIRECTORY_1 *driver_info_1; + driver_info_1=&(r_u->driver.driver_info_1); + + bufsize_required = size_of_relative_string(&(driver_info_1->name)); + break; + } + } + + DEBUG(4,("spoolss_io_r_getprinterdriverdir, size needed: %d\n",bufsize_required)); + DEBUG(4,("spoolss_io_r_getprinterdriverdir, size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ + DEBUG(4,("spoolss_io_r_getprinterdriverdir, buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); + + DEBUG(4,("spoolss_io_r_getprinterdriverdir, buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + beginning=ps->offset; + start_offset=ps->offset; + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 1: + { + DRIVER_DIRECTORY_1 *info; + info = &(r_u->driver.driver_info_1); + prs_unistr("name", ps, depth, &(info->name)); + /*smb_io_printer_driver_dir_1(desc, info, ps, depth, &start_offset, &end_offset);*/ + break; + } + } + ps->offset=beginning+r_u->offered; + prs_align(ps); + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, prs_struct *ps, int depth) +{ + + uint32 useless_ptr=0xADDE0FF0; + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + smb_io_unistr2("", &(q_u->name),True,ps,depth); + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + smb_io_unistr2("", &(q_u->environment),True,ps,depth); + prs_align(ps); + prs_uint32("level", ps, depth, &(q_u->level)); + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + prs_align(ps); + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + + prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocessors"); + depth++; + + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + switch (r_u->level) + { + case 1: + { + PRINTPROCESSOR_1 *info_1; + info_1=r_u->info_1; +/* + for (i=0; inumofprintprocessors; i++) + { + bufsize_required += spoolss_size_port_info_2(&(info_1[i])); + } +*/ break; + } + } + + DEBUG(4,("size needed: %d\n",bufsize_required)); + DEBUG(4,("size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ + + DEBUG(4,("buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); + + DEBUG(4,("buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + beginning=ps->offset; + start_offset=ps->offset; + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 2: + { +/* PORT_INFO_2 *info; + for (i=0; inumofports; i++) + { + info = &(r_u->port.port_info_2[i]); + smb_io_port_2(desc, info, ps, depth, &start_offset, &end_offset); + }*/ + break; + } + } + ps->offset=beginning+r_u->offered; + prs_align(ps); + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("numofprintprocessors", ps, depth, &(r_u->numofprintprocessors)); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, prs_struct *ps, int depth) +{ + uint32 useless; + prs_debug(ps, depth, desc, "spoolss_io_q_enumprintprocessors"); + depth++; + + prs_align(ps); + prs_uint32("useless", ps, depth, &useless); + smb_io_unistr2("", &(q_u->name),True,ps,depth); + prs_align(ps); + prs_uint32("useless", ps, depth, &useless); + smb_io_unistr2("", &(q_u->environment),True,ps,depth); + prs_align(ps); + prs_uint32("level", ps, depth, &(q_u->level)); + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + prs_align(ps); + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocessors"); + depth++; + + prs_align(ps); + prs_uint32("valuesize", ps, depth, &(r_u->valuesize)); + prs_unistr("value", ps, depth, &(r_u->value)); + prs_uint32("realvaluesize", ps, depth, &(r_u->realvaluesize)); + + prs_uint32("type", ps, depth, &(r_u->type)); + + prs_uint32("datasize", ps, depth, &(r_u->datasize)); + prs_uint8s(False, "data", ps, depth, r_u->data, r_u->datasize); + prs_uint32("realdatasize", ps, depth, &(r_u->realdatasize)); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_enumprinterdata(char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdata"); + depth++; + + prs_align(ps); + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("index", ps, depth, &(q_u->index)); + prs_uint32("valuesize", ps, depth, &(q_u->valuesize)); + prs_uint32("datasize", ps, depth, &(q_u->datasize)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_setprinterdata"); + depth++; + + prs_align(ps); + smb_io_prt_hnd("printer handle", &(q_u->handle), ps, depth); + smb_io_unistr2("", &(q_u->value), True, ps, depth); + + prs_align(ps); + + prs_uint32("type", ps, depth, &(q_u->type)); + + prs_uint32("max_len", ps, depth, &(q_u->max_len)); + + switch (q_u->type) + { + case 0x1: + case 0x3: + case 0x4: + q_u->data=(uint8 *)malloc(q_u->max_len * sizeof(uint8)); + prs_uint8s(False,"data", ps, depth, q_u->data, q_u->max_len); + prs_align(ps); + break; + } + + prs_uint32("real_len", ps, depth, &(q_u->real_len)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_setprinterdata"); + depth++; + + prs_align(ps); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void convert_specific_param(NT_PRINTER_PARAM **param, UNISTR2 value , uint32 type, uint8 *data, uint32 len) +{ + DEBUG(5,("converting a specific param struct\n")); + + if (*param == NULL) + { + *param=(NT_PRINTER_PARAM *)malloc(sizeof(NT_PRINTER_PARAM)); + ZERO_STRUCTP(*param); + DEBUGADD(6,("Allocated a new PARAM struct\n")); + } + unistr2_to_ascii((*param)->value, &value, sizeof((*param)->value)-1); + (*param)->type = type; + + /* le champ data n'est pas NULL termine */ + /* on stocke donc la longueur */ + + (*param)->data_len=len; + + (*param)->data=(uint8 *)malloc(len * sizeof(uint8)); + + memcpy((*param)->data, data, len); + + DEBUGADD(6,("\tvalue:[%s], len:[%d]\n",(*param)->value, (*param)->data_len)); +} -- cgit From be552ca3504ebd98da37e70bac1f10b248cf860b Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Tue, 27 Apr 1999 10:43:32 +0000 Subject: rpc_parse/parse_misc.c : defined a new BUFFER5 struct include/ntdomain.h : added rpc_spoolss.h include statement include/proto.h include/rpc_dce.h : added definition of RPC_ALTER_CONTEXT request & reply param/loadparm.c : 2 new options for NT printing support and some changes to initial values in the LPRNG case. rpc_parse/parse_prs.c : added prs_uint16s() rpc_parse/parse_rpc.c : added SYNT_SPOOLSS_V1 and code for the alter-context support. rpc_server/srv_pipe.c : alter-context support smbd/nttrans.c smbd/server.c include/rpc_misc.h Makefile.in include/smb.h Jean Francois (This used to be commit 4c515804b70254248e378a3f90f47e4c32639d29) --- source3/rpc_parse/parse_misc.c | 65 ++++++++++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_prs.c | 14 +++++++++ source3/rpc_parse/parse_rpc.c | 31 ++++++++++++++++---- 3 files changed, 105 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index a84469f8f9..4927886fc8 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -518,6 +518,71 @@ void smb_io_buffer4(char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, in prs_uint8s(True, "buffer", ps, depth, buf4->buffer, buf4->buf_len); } +/******************************************************************* +initialise a BUFFER5 structure. +********************************************************************/ +void init_buffer5(BUFFER5 **str) +{ + BUFFER5 *buf5; + + buf5=(BUFFER5 *)malloc( sizeof(BUFFER5) ); + + buf5->buf_len=0; + buf5->buffer=NULL; + *str=buf5; +} + +/******************************************************************* +clear a BUFFER5 structure. +********************************************************************/ +void clear_buffer5(BUFFER5 **str) +{ + BUFFER5 *buf5; + + buf5=*str; + if (buf5->buffer != NULL ) + { + free(buf5->buffer); + } + free(buf5); + *str=NULL; +} + +/******************************************************************* +creates a BUFFER5 structure. +********************************************************************/ +void make_buffer5(BUFFER5 *str, char *buf, int len) +{ + + /* max buffer size (allocated size) */ + str->buf_len = len; + str->buffer = (uint16 *)malloc( sizeof(uint16) * len ); + ascii_to_unistr(str->buffer, buf, len); +} + +/******************************************************************* +reads or writes a BUFFER5 structure. +the buf_len member tells you how large the buffer is. +********************************************************************/ +void smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "smb_io_buffer4"); + depth++; + + if (buf5 == NULL) return; + + prs_align(ps); + prs_uint32("buf_len", ps, depth, &(buf5->buf_len)); + + /* reading: alloc the buffer first */ + if ( ps->io ) + { + buf5->buffer=(uint16 *)malloc( sizeof(uint16)*buf5->buf_len ); + } + + prs_uint16s(True, "buffer ", ps, depth, buf5->buffer, buf5->buf_len); +} + /******************************************************************* creates a BUFFER2 structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 23a9d5bfdf..a231fb57cf 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -157,6 +157,20 @@ BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *dat return True; } +/****************************************************************** + stream an array of uint16s. length is number of uint16s + ********************************************************************/ +BOOL prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len) +{ + char *q = mem_data(&(ps->data), ps->offset); + if (q == NULL) return False; + + DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, data16s, len) + ps->offset += len * sizeof(uint16); + + return True; +} + /****************************************************************** stream an array of uint32s. length is number of uint32s ********************************************************************/ diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 81e7ffa116..2f47f06e36 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -132,6 +132,16 @@ interface/version dce/rpc pipe identification }, 0x01 \ } \ +#define SYNT_SPOOLSS_V1 \ +{ \ + { \ + 0x78, 0x56, 0x34, 0x12, \ + 0x34, 0x12, 0xcd, 0xab, \ + 0xef, 0x00, 0x01, 0x23, \ + 0x45, 0x67, 0x89, 0xab \ + }, 0x01 \ +} \ + #define SYNT_NONE_V0 \ { \ { \ @@ -153,6 +163,7 @@ struct pipe_id_info pipe_names [] = { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, { PIPE_ATSVC , SYNT_ATSVC_V1 , PIPE_ATSVC , TRANS_SYNT_V2 }, + { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; @@ -212,13 +223,22 @@ static void smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int de /******************************************************************* creates an RPC_ADDR_STR structure. + +The name can be null (RPC Alter-Context) ********************************************************************/ static void make_rpc_addr_str(RPC_ADDR_STR *str, char *name) { - if (str == NULL || name == NULL) return; - - str->len = strlen(name) + 1; - fstrcpy(str->str, name); + if (str == NULL ) return; + if (name == NULL) + { + str->len = 1; + fstrcpy(str->str, ""); + } + else + { + str->len = strlen(name) + 1; + fstrcpy(str->str, name); + } } /******************************************************************* @@ -349,6 +369,7 @@ static void smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, in creates an RPC_HDR_BA structure. lkclXXXX only one reason at the moment! +jfm: nope two ! The pipe_addr can be NULL ! ********************************************************************/ void make_rpc_hdr_ba(RPC_HDR_BA *rpc, @@ -357,7 +378,7 @@ void make_rpc_hdr_ba(RPC_HDR_BA *rpc, uint8 num_results, uint16 result, uint16 reason, RPC_IFACE *transfer) { - if (rpc == NULL || transfer == NULL || pipe_addr == NULL) return; + if (rpc == NULL || transfer == NULL) return; make_rpc_hdr_bba (&(rpc->bba ), max_tsize, max_rsize, assoc_gid); make_rpc_addr_str(&(rpc->addr), pipe_addr); -- cgit From e3a888d5a935047367e531321981cbed8618c5a3 Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Sat, 1 May 1999 05:56:55 +0000 Subject: Adding "time" rpcclient command which displays the remote time. Also added special "now" time to the "at" command, e.g.: at now /i cmd ; pops up a command prompt (This used to be commit f456dcf08ec96c631f5e6f2e857115d4bbf94d1b) --- source3/rpc_parse/parse_srv.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 56b8be2acb..1bcc961853 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1459,6 +1459,17 @@ void srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_str prs_uint32("status ", ps, depth, &(r_n->status )); } +/******************************************************************* + makes a SRV_Q_NET_REMOTE_TOD structure. + ********************************************************************/ +void make_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_t, char *server_name) +{ + if (q_t == NULL) return; + + DEBUG(5,("make_srv_q_net_remote_tod\n")); + + make_buf_unistr2(&(q_t->uni_srv_name), &(q_t->ptr_srv_name), server_name); +} /******************************************************************* reads or writes a structure. -- cgit From 60c211a3abd5eadb359db5f02941f32e2d881e52 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 3 May 1999 21:52:29 +0000 Subject: Added a new command to rpcclient: eventlog where is System, Security or Application. That's a crude equivalent to the eventviewer. Jean Francois (This used to be commit 66b4b896fbcabb964a427d0c0aa2f57997e0f6bb) --- source3/rpc_parse/parse_eventlog.c | 236 +++++++++++++++++++++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 source3/rpc_parse/parse_eventlog.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c new file mode 100644 index 0000000000..5173bd2cad --- /dev/null +++ b/source3/rpc_parse/parse_eventlog.c @@ -0,0 +1,236 @@ +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1998, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, + * Copyright (C) Jean Franois Micouleau 1998-1999. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "includes.h" + +extern int DEBUGLEVEL; + +/******************************************************************* +********************************************************************/ +void make_eventlog_q_open(EVENTLOG_Q_OPEN *q_u, char *journal) +{ + q_u->ptr0=0x1; + + q_u->unk0=0x5c; + q_u->unk1=0x01; + + q_u->unk2=2*(strlen(journal)+1); + q_u->unk3=2*(strlen(journal)+1); + + q_u->ptr_source=0x01; + make_buf_unistr2(&(q_u->source), &(q_u->ptr_source), journal); + + q_u->unk4=0x00; + q_u->unk5=0x00; + q_u->unk6=0x01; + q_u->unk7=0x01; +} + +/******************************************************************* +********************************************************************/ +void eventlog_io_q_open(char *desc, EVENTLOG_Q_OPEN *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "eventlog_io_q_open"); + depth++; + + prs_align(ps); + + prs_uint32("ptr0", ps, depth, &(q_u->ptr0)); + + prs_uint16("unk0", ps, depth, &(q_u->unk0)); + prs_uint16("unk1", ps, depth, &(q_u->unk1)); + prs_uint16("unk2", ps, depth, &(q_u->unk2)); + prs_uint16("unk3", ps, depth, &(q_u->unk3)); + + prs_uint32("ptr_source", ps, depth, &(q_u->ptr_source)); + + smb_io_unistr2("", &(q_u->source), q_u->ptr_source, ps, depth); + prs_align(ps); + + prs_uint32("unk4", ps, depth, &(q_u->unk4)); + prs_uint32("unk5", ps, depth, &(q_u->unk5)); + prs_uint32("unk6", ps, depth, &(q_u->unk6)); + prs_uint32("unk7", ps, depth, &(q_u->unk7)); +} + +/******************************************************************* +********************************************************************/ +void eventlog_io_r_open(char *desc, EVENTLOG_R_OPEN *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "eventlog_io_r_open"); + depth++; + + prs_align(ps); + smb_io_pol_hnd("", &(r_u->pol), ps, depth); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void make_eventlog_q_close(EVENTLOG_Q_CLOSE *q_u, POLICY_HND *pol) +{ + memcpy(&(q_u->pol.data), pol->data, sizeof(q_u->pol.data)); + +} + +/******************************************************************* +********************************************************************/ +void eventlog_io_q_close(char *desc, EVENTLOG_Q_CLOSE *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "eventlog_io_q_close"); + depth++; + + prs_align(ps); + smb_io_pol_hnd("", &(q_u->pol), ps, depth); + +} + +/******************************************************************* +********************************************************************/ +void eventlog_io_r_close(char *desc, EVENTLOG_R_CLOSE *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "eventlog_io_r_close"); + depth++; + + prs_align(ps); + smb_io_pol_hnd("", &(r_u->pol), ps, depth); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void make_eventlog_q_numofeventlogrec(EVENTLOG_Q_NUMOFEVENTLOGREC *q_u, POLICY_HND *pol) +{ + memcpy(&(q_u->pol.data), pol->data, sizeof(q_u->pol.data)); + +} + +/******************************************************************* +********************************************************************/ +void eventlog_io_q_numofeventlogrec(char *desc,EVENTLOG_Q_NUMOFEVENTLOGREC *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "eventlog_io_q_numofeventlogrec"); + depth++; + + prs_align(ps); + smb_io_pol_hnd("", &(q_u->pol), ps, depth); + +} + +/******************************************************************* +********************************************************************/ +void eventlog_io_r_numofeventlogrec(char *desc, EVENTLOG_R_NUMOFEVENTLOGREC *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "eventlog_io_r_numofeventlogrec"); + depth++; + + prs_align(ps); + prs_uint32("number", ps, depth, &(r_u->number)); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void make_eventlog_q_readeventlog(EVENTLOG_Q_READEVENTLOG *q_u, POLICY_HND *pol, + uint32 flags, uint32 offset, uint32 number_of_bytes) +{ + memcpy(&(q_u->pol.data), pol->data, sizeof(q_u->pol.data)); + q_u->flags=flags; + q_u->offset=offset; + q_u->number_of_bytes=number_of_bytes; +} + +/******************************************************************* +********************************************************************/ +void eventlog_io_q_readeventlog(char *desc, EVENTLOG_Q_READEVENTLOG *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "eventlog_io_q_readeventlog"); + depth++; + + prs_align(ps); + smb_io_pol_hnd("", &(q_u->pol), ps, depth); + prs_uint32("flags", ps, depth, &(q_u->flags)); + prs_uint32("offset", ps, depth, &(q_u->offset)); + prs_uint32("number_of_bytes", ps, depth, &(q_u->number_of_bytes)); +} + +/******************************************************************* +********************************************************************/ +static void eventlog_io_eventlog(char *desc, EVENTLOGRECORD *ev, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "eventlog_io_eventlog"); + depth++; + + prs_align(ps); + prs_uint32("size", ps, depth, &(ev->size)); + prs_uint32("reserved", ps, depth, &(ev->reserved)); + prs_uint32("recordnumber", ps, depth, &(ev->recordnumber)); + prs_uint32("creationtime", ps, depth, &(ev->creationtime)); + prs_uint32("writetime", ps, depth, &(ev->writetime)); + prs_uint32("eventnumber", ps, depth, &(ev->eventnumber)); + + prs_uint16("eventtype", ps, depth, &(ev->eventtype)); + prs_uint16("num_of_strings", ps, depth, &(ev->num_of_strings)); + prs_uint16("category", ps, depth, &(ev->category)); + prs_uint16("reserved_flag", ps, depth, &(ev->reserved_flag)); + + prs_uint32("closingrecord", ps, depth, &(ev->closingrecord)); + prs_uint32("stringoffset", ps, depth, &(ev->stringoffset)); + prs_uint32("sid_length", ps, depth, &(ev->sid_length)); + prs_uint32("sid_offset", ps, depth, &(ev->sid_offset)); + prs_uint32("data_length", ps, depth, &(ev->data_length)); + prs_uint32("data_offset", ps, depth, &(ev->data_offset)); + + smb_io_unistr("", &(ev->sourcename), ps, depth); + smb_io_unistr("", &(ev->computername), ps, depth); + + if (ev->sid_length!=0) + smb_io_unistr("", &(ev->sid), ps, depth); + + if (ev->num_of_strings!=0) + smb_io_unistr("", &(ev->strings),ps, depth); + + if (ev->data_length) + smb_io_unistr("", &(ev->data), ps, depth); + + prs_uint32("size2", ps, depth, &(ev->size2)); +} + +/******************************************************************* +********************************************************************/ +void eventlog_io_r_readeventlog(char *desc, EVENTLOG_R_READEVENTLOG *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "eventlog_io_r_readeventlog"); + depth++; + + prs_align(ps); + prs_uint32("number_of_bytes", ps, depth, &(r_u->number_of_bytes)); + + if (r_u->number_of_bytes!= 0) + eventlog_io_eventlog("", r_u->event, ps, depth); + + prs_uint32("sent_size", ps, depth, &(r_u->sent_size)); + prs_uint32("real_size", ps, depth, &(r_u->real_size)); + prs_uint32("status", ps, depth, &(r_u->status)); +} + -- cgit From 4e5bf481fba36655e8fc8e04f6f67ba17dcb9844 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 3 May 1999 22:04:02 +0000 Subject: last part of RPC api change. and of rpcclient eventlog funtion Jean Francois (This used to be commit 7fc8659e83bf0269df297016beac6793ff0bdf32) --- source3/rpc_parse/parse_rpc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 2f47f06e36..524c4201ad 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -152,6 +152,16 @@ interface/version dce/rpc pipe identification }, 0x00 \ } \ +#define SYNT_EVENTLOG_V0 \ +{ \ + { \ + 0xdc, 0x3f, 0x27, 0x82, \ + 0x2a, 0xe3, 0xc3, 0x18, \ + 0x3f, 0x78, 0x82, 0x79, \ + 0x29, 0xdc, 0x23, 0xea \ + }, 0x00 \ +} + \ struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ @@ -164,6 +174,7 @@ struct pipe_id_info pipe_names [] = { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, { PIPE_ATSVC , SYNT_ATSVC_V1 , PIPE_ATSVC , TRANS_SYNT_V2 }, { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, + { PIPE_EVENTLOG, SYNT_EVENTLOG_V0, PIPE_EVENTLOG , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From d58b440fad3ac0e907e579205bcc00ca6b147792 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 6 May 1999 18:02:05 +0000 Subject: alignment needed after unicode string names in password change. (This used to be commit e66b6afc699593789e7a8372ddaa407c320cd15d) --- source3/rpc_parse/parse_samr.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 6b75136f94..2cd818aa0d 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5064,8 +5064,11 @@ void samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER *q_u, prs_struct smb_io_unihdr ("", &(q_u->hdr_dest_host), ps, depth); smb_io_unistr2("", &(q_u->uni_dest_host), q_u->hdr_dest_host.buffer, ps, depth); + prs_align(ps); + smb_io_unihdr ("", &(q_u->hdr_user_name), ps, depth); smb_io_unistr2("", &(q_u->uni_user_name), q_u->hdr_user_name.buffer, ps, depth); + prs_align(ps); samr_io_enc_passwd("nt_newpass", &(q_u->nt_newpass), ps, depth); prs_grow(ps); -- cgit From 99e42c0656d3e1e3b8e06437a8a9082c12df22d2 Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Wed, 2 Jun 1999 03:19:20 +0000 Subject: Some more BDC-related fixes, mainly to the NET_SAM_SYNC RPC with respect to alignment, missing fields, etc. - it should now work correctly. There is still the problem of decoding the private data field. (This used to be commit c3c25e762fbc30d5663323f23449c913f2ce4b0e) --- source3/rpc_parse/parse_net.c | 97 +++++++++++++++++++++++++++++-------------- 1 file changed, 66 insertions(+), 31 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 083816771f..271ac3afeb 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1221,6 +1221,7 @@ static void net_io_sam_domain_info(char *desc, SAM_DOMAIN_INFO *info, prs_struct smb_io_bufhdr2("hdr_sec_desc", &(info->hdr_sec_desc) , ps, depth); smb_io_unihdr ("hdr_unknown" , &(info->hdr_unknown) , ps, depth); + ps->offset += 40; smb_io_unistr2("uni_dom_name", &(info->uni_dom_name), info->hdr_dom_name.buffer, ps, depth); @@ -1252,7 +1253,7 @@ static void net_io_sam_group_info(char *desc, SAM_GROUP_INFO *info, prs_struct * smb_io_unistr2("uni_grp_name", &(info->uni_grp_name), info->hdr_grp_name.buffer, ps, depth); smb_io_unistr2("uni_grp_desc", &(info->uni_grp_desc), - info->hdr_grp_name.buffer, ps, depth); + info->hdr_grp_desc.buffer, ps, depth); smb_io_buffer4("buf_sec_desc", &(info->buf_sec_desc), info->hdr_sec_desc.buffer, ps, depth); } @@ -1284,25 +1285,34 @@ void make_sam_account_info(SAM_ACCOUNT_INFO *info, char *user_name, make_uni_hdr(&(info->hdr_profile ), len_profile ); /* not present */ + make_uni_hdr(&(info->hdr_workstations), 0); make_uni_hdr(&(info->hdr_comment), 0); - make_bufhdr2(&(info->hdr_pwd_info), 0, 0, 0); + make_uni_hdr(&(info->hdr_parameters), 0); + make_bufhdr2(&(info->hdr_priv_data), 0, 0, 0); make_bufhdr2(&(info->hdr_sec_desc), 0, 0, 0); info->user_rid = user_rid; info->group_rid = group_rid; - init_nt_time(&(info->time_1)); - init_nt_time(&(info->time_2)); - init_nt_time(&(info->time_3)); - init_nt_time(&(info->time_4)); - init_nt_time(&(info->time_5)); + init_nt_time(&(info->logon_time)); + init_nt_time(&(info->logoff_time)); + init_nt_time(&(info->pwd_last_set_time)); + init_nt_time(&(info->acct_expiry_time)); info->logon_divs = 0xA8; info->ptr_logon_hrs = 0; /* Don't care right now */ + info->bad_pwd_count = 0; + info->logon_count = 0; info->acb_info = acb_info; - info->unknown4 = 0x4EC; - info->unknown5 = 0; + info->nt_pwd_present = 0; + info->lm_pwd_present = 0; + info->pwd_expired = 0; + info->country = 0; + info->codepage = 0; + + info->unknown1 = 0x4EC; + info->unknown2 = 0; make_unistr2(&(info->uni_acct_name), user_name, len_user_name+1); make_unistr2(&(info->uni_full_name), full_name, len_full_name+1); @@ -1318,6 +1328,8 @@ reads or writes a structure. ********************************************************************/ static void net_io_sam_account_info(char *desc, SAM_ACCOUNT_INFO *info, prs_struct *ps, int depth) { + int i; + if (info == NULL) return; prs_debug(ps, depth, desc, "net_io_sam_account_info"); @@ -1333,26 +1345,44 @@ static void net_io_sam_account_info(char *desc, SAM_ACCOUNT_INFO *info, prs_stru smb_io_unihdr("hdr_dir_drive" , &(info->hdr_dir_drive), ps, depth); smb_io_unihdr("hdr_logon_script", &(info->hdr_logon_script), ps, depth); smb_io_unihdr("hdr_acct_desc" , &(info->hdr_acct_desc), ps, depth); + smb_io_unihdr("hdr_workstations", &(info->hdr_workstations), ps, depth); - smb_io_time("time_1", &(info->time_1), ps, depth); - smb_io_time("time_2", &(info->time_2), ps, depth); - smb_io_time("time_3", &(info->time_3), ps, depth); + smb_io_time("logon_time" , &(info->logon_time ), ps, depth); + smb_io_time("logoff_time", &(info->logoff_time), ps, depth); prs_uint32("logon_divs ", ps, depth, &(info->logon_divs )); prs_uint32("ptr_logon_hrs", ps, depth, &(info->ptr_logon_hrs)); - smb_io_time("time_4", &(info->time_4), ps, depth); - smb_io_time("time_5", &(info->time_5), ps, depth); - prs_uint32("acb_info", ps, depth, &(info->acb_info)); - ps->offset += 36; + prs_uint16("bad_pwd_count", ps, depth, &(info->bad_pwd_count)); + prs_uint16("logon_count" , ps, depth, &(info->logon_count )); + smb_io_time("pwd_last_set_time", &(info->pwd_last_set_time), ps, depth); + smb_io_time("acct_expiry_time" , &(info->acct_expiry_time ), ps, depth); - smb_io_unihdr("hdr_comment", &(info->hdr_comment), ps, depth); - ps->offset += 12; + prs_uint32("acb_info", ps, depth, &(info->acb_info)); + prs_uint8s(False, "nt_pwd", ps, depth, info->nt_pwd, 16); + prs_uint8s(False, "lm_pwd", ps, depth, info->lm_pwd, 16); + prs_uint8("lm_pwd_present", ps, depth, &(info->lm_pwd_present)); + prs_uint8("nt_pwd_present", ps, depth, &(info->nt_pwd_present)); + prs_uint8("pwd_expired" , ps, depth, &(info->pwd_expired )); + + smb_io_unihdr("hdr_comment" , &(info->hdr_comment ), ps, depth); + smb_io_unihdr("hdr_parameters", &(info->hdr_parameters), ps, depth); + prs_uint16("country" , ps, depth, &(info->country )); + prs_uint16("codepage", ps, depth, &(info->codepage)); + + smb_io_bufhdr2("hdr_priv_data", &(info->hdr_priv_data), ps, depth); + smb_io_bufhdr2("hdr_sec_desc" , &(info->hdr_sec_desc) , ps, depth); + smb_io_unihdr ("hdr_profile" , &(info->hdr_profile) , ps, depth); + + for (i = 0; i < 3; i++) + { + smb_io_unihdr("hdr_reserved", &(info->hdr_reserved[i]), ps, depth); + } - smb_io_bufhdr2("hdr_pwd_info", &(info->hdr_pwd_info), ps, depth); - smb_io_bufhdr2("hdr_sec_desc", &(info->hdr_sec_desc), ps, depth); - smb_io_unihdr ("hdr_profile ", &(info->hdr_profile) , ps, depth); - ps->offset += 36; /* includes that stupid NTTIME, ignore for now */ + for (i = 0; i < 4; i++) + { + prs_uint32("dw_reserved", ps, depth, &(info->dw_reserved[i])); + } smb_io_unistr2("uni_acct_name", &(info->uni_acct_name), info->hdr_acct_name.buffer, ps, depth); @@ -1366,19 +1396,23 @@ static void net_io_sam_account_info(char *desc, SAM_ACCOUNT_INFO *info, prs_stru info->hdr_logon_script.buffer, ps, depth); smb_io_unistr2("uni_acct_desc", &(info->uni_acct_desc), info->hdr_acct_desc.buffer, ps, depth); + smb_io_unistr2("uni_workstations", &(info->uni_workstations), + info->hdr_workstations.buffer, ps, depth); - prs_uint32("unknown4", ps, depth, &(info->unknown4)); - prs_uint32("unknown5", ps, depth, &(info->unknown5)); + prs_uint32("unknown1", ps, depth, &(info->unknown1)); + prs_uint32("unknown2", ps, depth, &(info->unknown2)); - smb_io_buffer4("buf_logon_hrs", &(info->buf_logon_hrs), + smb_io_buffer4("buf_logon_hrs" , &(info->buf_logon_hrs ), info->ptr_logon_hrs, ps, depth); - smb_io_unistr2("uni_comment" , &(info->uni_comment ), + smb_io_unistr2("uni_comment" , &(info->uni_comment ), info->hdr_comment.buffer, ps, depth); - smb_io_buffer4("buf_pwd_info" , &(info->buf_pwd_info ), - info->hdr_pwd_info.buffer, ps, depth); - smb_io_buffer4("buf_sec_desc" , &(info->buf_sec_desc ), + smb_io_unistr2("uni_parameters", &(info->uni_parameters), + info->hdr_parameters.buffer, ps, depth); + smb_io_buffer4("buf_priv_data" , &(info->buf_priv_data ), + info->hdr_priv_data.buffer, ps, depth); + smb_io_buffer4("buf_sec_desc" , &(info->buf_sec_desc ), info->hdr_sec_desc.buffer, ps, depth); - smb_io_unistr2("uni_profile" , &(info->uni_profile ), + smb_io_unistr2("uni_profile" , &(info->uni_profile ), info->hdr_profile.buffer, ps, depth); } @@ -1517,7 +1551,7 @@ static void net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_ /******************************************************************* reads or writes a structure. ********************************************************************/ -static void net_io_sam_delta_ctr(char *desc, SAM_DELTA_CTR *delta, uint32 type, prs_struct *ps, int depth) +static void net_io_sam_delta_ctr(char *desc, SAM_DELTA_CTR *delta, uint16 type, prs_struct *ps, int depth) { if (delta == NULL) return; @@ -1592,5 +1626,6 @@ void net_io_r_sam_sync(char *desc, NET_R_SAM_SYNC *r_s, prs_struct *ps, int dept } } + prs_align(ps); prs_uint32("status", ps, depth, &(r_s->status)); } -- cgit From 0c927f2b1b7ff547954a7a68fd44c7ce8ad65299 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Tue, 22 Jun 1999 18:42:10 +0000 Subject: Fixed most memory leak and big-endian bug in the spoolss code. Also added addform/setform rpc api calls. Now I can add/change forms from the server property dialog box. Jean Francois (This used to be commit 8d73f83b6c112327a51c0df2e96a1866deb13c3a) --- source3/rpc_parse/parse_spoolss.c | 109 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 8f5c85c158..c090239f38 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -471,6 +471,7 @@ void spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_st case 0x1: case 0x3: case 0x4: + case 0x7: prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size); prs_align(ps); break; @@ -1387,6 +1388,23 @@ static void spoolss_io_read_buffer(char *desc, prs_struct *ps, int depth, BUFFER } } +/******************************************************************* + * read a uint8 buffer of size *size. + * allocate memory for it + * return a pointer to the allocated memory and the size + * return NULL and a size of 0 if the buffer is empty + * + * jfmxxxx: fix it to also write a buffer + ********************************************************************/ +void spoolss_io_free_buffer(BUFFER *buffer) +{ + DEBUG(8,("spoolss_io_free_buffer\n")); + + if (buffer->ptr != 0x0000) + { + free(buffer->data); + } +} /******************************************************************* * read a structure. @@ -3341,6 +3359,7 @@ void spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_st case 0x1: case 0x3: case 0x4: + case 0x7: q_u->data=(uint8 *)malloc(q_u->max_len * sizeof(uint8)); prs_uint8s(False,"data", ps, depth, q_u->data, q_u->max_len); prs_align(ps); @@ -3387,3 +3406,93 @@ void convert_specific_param(NT_PRINTER_PARAM **param, UNISTR2 value , uint32 typ DEBUGADD(6,("\tvalue:[%s], len:[%d]\n",(*param)->value, (*param)->data_len)); } + +/******************************************************************* +********************************************************************/ +static void spoolss_io_addform(char *desc, FORM *f, uint32 ptr, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_addform"); + depth++; + prs_align(ps); + + if (ptr!=0) + { + prs_uint32("flags", ps, depth, &(f->flags)); + prs_uint32("name_ptr", ps, depth, &(f->name_ptr)); + prs_uint32("size_x", ps, depth, &(f->size_x)); + prs_uint32("size_y", ps, depth, &(f->size_y)); + prs_uint32("left", ps, depth, &(f->left)); + prs_uint32("top", ps, depth, &(f->top)); + prs_uint32("right", ps, depth, &(f->right)); + prs_uint32("bottom", ps, depth, &(f->bottom)); + + smb_io_unistr2("", &(f->name), f->name_ptr, ps, depth); + } +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0; + prs_debug(ps, depth, desc, "spoolss_io_q_addform"); + depth++; + + prs_align(ps); + smb_io_prt_hnd("printer handle", &(q_u->handle), ps, depth); + prs_uint32("level", ps, depth, &(q_u->level)); + prs_uint32("level2", ps, depth, &(q_u->level2)); + + if (q_u->level==1) + { + prs_uint32("useless_ptr", ps, depth, &(useless_ptr)); + spoolss_io_addform("", &(q_u->form), useless_ptr, ps, depth); + } +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_addform"); + depth++; + + prs_align(ps); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0; + prs_debug(ps, depth, desc, "spoolss_io_q_setform"); + depth++; + + prs_align(ps); + smb_io_prt_hnd("printer handle", &(q_u->handle), ps, depth); + smb_io_unistr2("", &(q_u->name), True, ps, depth); + + prs_align(ps); + + prs_uint32("level", ps, depth, &(q_u->level)); + prs_uint32("level2", ps, depth, &(q_u->level2)); + + if (q_u->level==1) + { + prs_uint32("useless_ptr", ps, depth, &(useless_ptr)); + spoolss_io_addform("", &(q_u->form), useless_ptr, ps, depth); + } +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_r_setform(char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_setform"); + depth++; + + prs_align(ps); + prs_uint32("status", ps, depth, &(r_u->status)); +} + -- cgit From 73891ca8e4f6cca6aa8bb0ae043f660a64baa056 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 29 Jun 1999 18:47:06 +0000 Subject: improving authentication code (tidyup). (This used to be commit ab1a6aa42db5217f025941fb5107436556bc23b7) --- source3/rpc_parse/parse_rpc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 524c4201ad..3066d94dec 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -692,7 +692,8 @@ creates an RPC_AUTH_NTLMSSP_RESP structure. ********************************************************************/ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, - uchar lm_resp[24], uchar nt_resp[24], + uchar lm_resp[24], + uchar *nt_resp, size_t nt_len, char *domain, char *user, char *wks, uint32 neg_flags) { @@ -701,7 +702,6 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, int wks_len = strlen(wks ); int usr_len = strlen(user ); int lm_len = lm_resp != NULL ? 24 : 0; - int nt_len = nt_resp != NULL ? 24 : 0; DEBUG(5,("make_rpc_auth_ntlmssp_resp\n")); @@ -709,9 +709,9 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, #ifdef DEBUG_PASSWORD DEBUG(100,("lm_resp\n")); - dump_data(100, lm_resp, 24); + dump_data(100, lm_resp, lm_len); DEBUG(100,("nt_resp\n")); - dump_data(100, nt_resp, 24); + dump_data(100, nt_resp, nt_len); #endif DEBUG(6,("dom: %s user: %s wks: %s neg_flgs: 0x%x\n", @@ -745,8 +745,8 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, rsp->neg_flags = neg_flags; - memcpy(rsp->lm_resp, lm_resp, 24); - memcpy(rsp->nt_resp, nt_resp, 24); + memcpy(rsp->lm_resp, lm_resp, lm_len); + memcpy(rsp->nt_resp, nt_resp, nt_len); if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { -- cgit From 89517ed4d37f230d6f10986edbf15e3315cdeb43 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Thu, 1 Jul 1999 18:02:34 +0000 Subject: many small bugs... J.F. (This used to be commit bda429eb73fa3c0a6d59cf47a8285e3fc0cdae98) --- source3/rpc_parse/parse_spoolss.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index c090239f38..08ea5f73a2 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -462,20 +462,15 @@ void spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_st prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdata"); depth++; + /* grow buffer mem enough */ + mem_grow_data(&(ps->data), ps->io, r_u->size+100, 0); + prs_align(ps); prs_uint32("type", ps, depth, &(r_u->type)); prs_uint32("size", ps, depth, &(r_u->size)); - - switch (r_u->type) - { - case 0x1: - case 0x3: - case 0x4: - case 0x7: - prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size); - prs_align(ps); - break; - } + + prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size); + prs_align(ps); prs_uint32("needed", ps, depth, &(r_u->needed)); prs_uint32("status", ps, depth, &(r_u->status)); @@ -969,6 +964,8 @@ static void smb_io_printer_info_2(char *desc, PRINTER_INFO_2 *info, prs_struct * uint32 *start_offset, uint32 *end_offset) { uint32 pipo=0; + uint32 devmode_offset; + uint32 backup_offset; prs_debug(ps, depth, desc, "smb_io_printer_info_2"); depth++; @@ -982,8 +979,9 @@ static void smb_io_printer_info_2(char *desc, PRINTER_INFO_2 *info, prs_struct * smb_io_relstr("comment", ps, depth, &(info->comment), start_offset, end_offset); smb_io_relstr("location", ps, depth, &(info->location), start_offset, end_offset); - smb_io_reldevmode("devmode", ps, depth, info->devmode, start_offset, end_offset); - + devmode_offset=ps->offset; + ps->offset=ps->offset+4; + smb_io_relstr("sepfile", ps, depth, &(info->sepfile), start_offset, end_offset); smb_io_relstr("printprocessor",ps, depth, &(info->printprocessor), start_offset, end_offset); smb_io_relstr("datatype", ps, depth, &(info->datatype), start_offset, end_offset); @@ -999,6 +997,15 @@ static void smb_io_printer_info_2(char *desc, PRINTER_INFO_2 *info, prs_struct * prs_uint32("status", ps, depth, &(info->status)); prs_uint32("jobs", ps, depth, &(info->cjobs)); prs_uint32("averageppm", ps, depth, &(info->averageppm)); + + /* + I'm not sure if putting the devmode at the end the struct is worth it + but NT does it + */ + backup_offset=ps->offset; + ps->offset=devmode_offset; + smb_io_reldevmode("devmode", ps, depth, info->devmode, start_offset, end_offset); + ps->offset=backup_offset; } /******************************************************************* @@ -1184,7 +1191,8 @@ static uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) int size=0; size+=4; /* the security descriptor */ - size+=0xDC+4; /* size of the devmode and the ptr */ + size+=info->devmode->size+4; /* size of the devmode and the ptr */ + size+=info->devmode->driverextra; /* if a devmode->private section exists, add its size */ size+=size_of_relative_string( &(info->servername) ); size+=size_of_relative_string( &(info->printername) ); @@ -3307,7 +3315,7 @@ void spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q ********************************************************************/ void spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocessors"); + prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdata"); depth++; prs_align(ps); -- cgit From 6a5a4e818684a616306d2954d1a2612113b314a6 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 21 Jul 1999 00:32:09 +0000 Subject: BDC support. (This used to be commit 2331aa32ab36c3ee5fd8cfbe972e57299939e33d) --- source3/rpc_parse/parse_net.c | 143 +++++++++++++++++++++++++++++++++--------- source3/rpc_parse/parse_prs.c | 21 +++++++ 2 files changed, 135 insertions(+), 29 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 271ac3afeb..b74fb7ab0d 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1288,7 +1288,6 @@ void make_sam_account_info(SAM_ACCOUNT_INFO *info, char *user_name, make_uni_hdr(&(info->hdr_workstations), 0); make_uni_hdr(&(info->hdr_comment), 0); make_uni_hdr(&(info->hdr_parameters), 0); - make_bufhdr2(&(info->hdr_priv_data), 0, 0, 0); make_bufhdr2(&(info->hdr_sec_desc), 0, 0, 0); info->user_rid = user_rid; @@ -1326,8 +1325,37 @@ void make_sam_account_info(SAM_ACCOUNT_INFO *info, char *user_name, /******************************************************************* reads or writes a structure. ********************************************************************/ -static void net_io_sam_account_info(char *desc, SAM_ACCOUNT_INFO *info, prs_struct *ps, int depth) +static void net_io_sam_passwd_info(char *desc, SAM_PWD *pwd, + prs_struct *ps, int depth) { + if (pwd == NULL) return; + + prs_debug(ps, depth, desc, "net_io_sam_passwd_info"); + depth++; + + prs_uint32("unk_0 ", ps, depth, &(pwd->unk_0 )); + + smb_io_unihdr ("hdr_lm_pwd", &(pwd->hdr_lm_pwd), ps, depth); + prs_uint8s(False, "buf_lm_pwd", ps, depth, pwd->buf_lm_pwd, 16); + + prs_uint32("ptr_1 ", ps, depth, &(pwd->ptr_1 )); + + smb_io_unihdr ("hdr_nt_pwd", &(pwd->hdr_nt_pwd), ps, depth); + prs_uint8s(False, "buf_nt_pwd", ps, depth, pwd->buf_nt_pwd, 16); + + prs_uint32("ptr_2 ", ps, depth, &(pwd->ptr_2 )); + prs_uint32("ptr_3 ", ps, depth, &(pwd->ptr_3 )); + prs_uint32("ptr_4 ", ps, depth, &(pwd->ptr_4 )); + prs_uint32("ptr_5 ", ps, depth, &(pwd->ptr_5 )); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static void net_io_sam_account_info(char *desc, uint8 sess_key[16], + SAM_ACCOUNT_INFO *info, prs_struct *ps, int depth) +{ + BUFHDR2 hdr_priv_data; int i; if (info == NULL) return; @@ -1370,7 +1398,7 @@ static void net_io_sam_account_info(char *desc, SAM_ACCOUNT_INFO *info, prs_stru prs_uint16("country" , ps, depth, &(info->country )); prs_uint16("codepage", ps, depth, &(info->codepage)); - smb_io_bufhdr2("hdr_priv_data", &(info->hdr_priv_data), ps, depth); + smb_io_bufhdr2("hdr_priv_data", &(hdr_priv_data), ps, depth); smb_io_bufhdr2("hdr_sec_desc" , &(info->hdr_sec_desc) , ps, depth); smb_io_unihdr ("hdr_profile" , &(info->hdr_profile) , ps, depth); @@ -1386,34 +1414,66 @@ static void net_io_sam_account_info(char *desc, SAM_ACCOUNT_INFO *info, prs_stru smb_io_unistr2("uni_acct_name", &(info->uni_acct_name), info->hdr_acct_name.buffer, ps, depth); + prs_align(ps); smb_io_unistr2("uni_full_name", &(info->uni_full_name), info->hdr_full_name.buffer, ps, depth); + prs_align(ps); smb_io_unistr2("uni_home_dir ", &(info->uni_home_dir ), info->hdr_home_dir .buffer, ps, depth); + prs_align(ps); smb_io_unistr2("uni_dir_drive", &(info->uni_dir_drive), info->hdr_dir_drive.buffer, ps, depth); + prs_align(ps); smb_io_unistr2("uni_logon_script", &(info->uni_logon_script), info->hdr_logon_script.buffer, ps, depth); + prs_align(ps); smb_io_unistr2("uni_acct_desc", &(info->uni_acct_desc), info->hdr_acct_desc.buffer, ps, depth); + prs_align(ps); smb_io_unistr2("uni_workstations", &(info->uni_workstations), info->hdr_workstations.buffer, ps, depth); + prs_align(ps); prs_uint32("unknown1", ps, depth, &(info->unknown1)); prs_uint32("unknown2", ps, depth, &(info->unknown2)); smb_io_buffer4("buf_logon_hrs" , &(info->buf_logon_hrs ), info->ptr_logon_hrs, ps, depth); + prs_align(ps); smb_io_unistr2("uni_comment" , &(info->uni_comment ), info->hdr_comment.buffer, ps, depth); + prs_align(ps); smb_io_unistr2("uni_parameters", &(info->uni_parameters), info->hdr_parameters.buffer, ps, depth); - smb_io_buffer4("buf_priv_data" , &(info->buf_priv_data ), - info->hdr_priv_data.buffer, ps, depth); + prs_align(ps); + if (hdr_priv_data.buffer != 0) + { + int old_offset; + uint32 len = 0x44; + prs_uint32("pwd_len", ps, depth, &len); + old_offset = ps->offset; + if (len == 0x44) + { + if (ps->io) + { + /* reading */ + prs_hash1(ps, ps->offset, sess_key); + } + net_io_sam_passwd_info("pass", &(info->pass), ps, depth); + if (!ps->io) + { + /* writing */ + prs_hash1(ps, old_offset, sess_key); + } + } + ps->offset = old_offset + len; + } smb_io_buffer4("buf_sec_desc" , &(info->buf_sec_desc ), info->hdr_sec_desc.buffer, ps, depth); + prs_align(ps); smb_io_unistr2("uni_profile" , &(info->uni_profile ), info->hdr_profile.buffer, ps, depth); + prs_align(ps); } /******************************************************************* @@ -1551,7 +1611,9 @@ static void net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_ /******************************************************************* reads or writes a structure. ********************************************************************/ -static void net_io_sam_delta_ctr(char *desc, SAM_DELTA_CTR *delta, uint16 type, prs_struct *ps, int depth) +static void net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], + SAM_DELTA_CTR *delta, uint16 type, + prs_struct *ps, int depth) { if (delta == NULL) return; @@ -1560,34 +1622,56 @@ static void net_io_sam_delta_ctr(char *desc, SAM_DELTA_CTR *delta, uint16 type, switch (type) { - case 1: - net_io_sam_domain_info("", &(delta->domain_info), ps, depth); - break; - case 2: - net_io_sam_group_info("", &(delta->group_info), ps, depth); - break; - case 5: - net_io_sam_account_info("", &(delta->account_info), ps, depth); - break; - case 8: - net_io_sam_group_mem_info("", &(delta->grp_mem_info), ps, depth); - break; - case 9: - net_io_sam_alias_info("", &(delta->alias_info), ps, depth); - break; - case 0xC: - net_io_sam_alias_mem_info("", &(delta->als_mem_info), ps, depth); - break; - default: - DEBUG(0, ("Replication error: Unknown delta type %x\n", type)); + case 1: + { + net_io_sam_domain_info("", &(delta->domain_info), + ps, depth); + break; + } + case 2: + { + net_io_sam_group_info("", &(delta->group_info), + ps, depth); + break; + } + case 5: + { + net_io_sam_account_info("", sess_key, + &(delta->account_info), + ps, depth); + break; + } + case 8: + { + net_io_sam_group_mem_info("", &(delta->grp_mem_info), + ps, depth); + break; + } + case 9: + { + net_io_sam_alias_info("", &(delta->alias_info), + ps, depth); + break; + } + case 0xC: + { + net_io_sam_alias_mem_info("", &(delta->als_mem_info), + ps, depth); + break; + } + default: + { + DEBUG(0, ("Replication error: Unknown delta type %x\n", type)); + break; + } } - } /******************************************************************* reads or writes a structure. ********************************************************************/ -void net_io_r_sam_sync(char *desc, NET_R_SAM_SYNC *r_s, prs_struct *ps, int depth) +void net_io_r_sam_sync(char *desc, uint8 sess_key[16], + NET_R_SAM_SYNC *r_s, prs_struct *ps, int depth) { int i; @@ -1620,7 +1704,8 @@ void net_io_r_sam_sync(char *desc, NET_R_SAM_SYNC *r_s, prs_struct *ps, int dept for (i = 0; i < r_s->num_deltas2; i++) { - net_io_sam_delta_ctr("", &r_s->deltas[i], + net_io_sam_delta_ctr("", sess_key, + &r_s->deltas[i], r_s->hdr_deltas[i].type3, ps, depth); } } diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index a231fb57cf..c55ec9c225 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -128,6 +128,27 @@ BOOL prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16) return True; } +/******************************************************************* + hash a stream. + ********************************************************************/ +BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) +{ + char *q = mem_data(&(ps->data), offset); + if (q == NULL) return False; + +#ifdef DEBUG_PASSWORD + DEBUG(100,("prs_hash1\n")); + dump_data(100, sess_key, 16); + dump_data(100, q, 68); +#endif + SamOEMhash(q, sess_key, 2); +#ifdef DEBUG_PASSWORD + dump_data(100, q, 68); +#endif + + return True; +} + /******************************************************************* stream a uint32 ********************************************************************/ -- cgit From 61b92043da228b911010c07279f98833d4ca31ef Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Thu, 22 Jul 1999 10:55:09 +0000 Subject: BDC support. Fixing and clarifying SAM_PWD structure. (This used to be commit 8e36b07a0e8e7ea8b72e1b9e3b747795b2685e85) --- source3/rpc_parse/parse_net.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index b74fb7ab0d..79b49855a9 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1338,15 +1338,11 @@ static void net_io_sam_passwd_info(char *desc, SAM_PWD *pwd, smb_io_unihdr ("hdr_lm_pwd", &(pwd->hdr_lm_pwd), ps, depth); prs_uint8s(False, "buf_lm_pwd", ps, depth, pwd->buf_lm_pwd, 16); - prs_uint32("ptr_1 ", ps, depth, &(pwd->ptr_1 )); - smb_io_unihdr ("hdr_nt_pwd", &(pwd->hdr_nt_pwd), ps, depth); prs_uint8s(False, "buf_nt_pwd", ps, depth, pwd->buf_nt_pwd, 16); - - prs_uint32("ptr_2 ", ps, depth, &(pwd->ptr_2 )); - prs_uint32("ptr_3 ", ps, depth, &(pwd->ptr_3 )); - prs_uint32("ptr_4 ", ps, depth, &(pwd->ptr_4 )); - prs_uint32("ptr_5 ", ps, depth, &(pwd->ptr_5 )); + + smb_io_unihdr("", &(pwd->hdr_empty_lm), ps, depth); + smb_io_unihdr("", &(pwd->hdr_empty_nt), ps, depth); } /******************************************************************* -- cgit From f2e0bbffb5e40df4850b6bd0eae73a8fb0edc6d7 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 26 Jul 1999 21:47:23 +0000 Subject: renaming AUTH VERIFIER to AUTH NTLMSSP VERIFIER. ready for adding another RPC authentication system. (This used to be commit 1a211bafebad8c63d98b5ef275a6272013527c65) --- source3/rpc_parse/parse_rpc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 3066d94dec..138dbd90b1 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -505,7 +505,8 @@ checks an RPC_HDR_AUTH structure. ********************************************************************/ BOOL rpc_hdr_auth_chk(RPC_HDR_AUTH *rai) { - return (rai->auth_type == 0x0a && rai->auth_level == 0x06); + return ((rai->auth_type == 0x0a || rai->auth_type == 0x44) && + rai->auth_level == 0x06); } /******************************************************************* @@ -545,18 +546,18 @@ void smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int dept } /******************************************************************* -checks an RPC_AUTH_VERIFIER structure. +checks an RPC_AUTH_NTLMSSP_VERIFIER structure. ********************************************************************/ -BOOL rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav, +BOOL rpc_auth_ntlmssp_verifier_chk(RPC_AUTH_NTLMSSP_VERIFIER *rav, char *signature, uint32 msg_type) { return (strequal(rav->signature, signature) && rav->msg_type == msg_type); } /******************************************************************* -creates an RPC_AUTH_VERIFIER structure. +creates an RPC_AUTH_NTLMSSP_VERIFIER structure. ********************************************************************/ -void make_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, +void make_rpc_auth_ntlmssp_verifier(RPC_AUTH_NTLMSSP_VERIFIER *rav, char *signature, uint32 msg_type) { if (rav == NULL) return; @@ -566,9 +567,9 @@ void make_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, } /******************************************************************* -reads or writes an RPC_AUTH_VERIFIER structure. +reads or writes an RPC_AUTH_NTLMSSP_VERIFIER structure. ********************************************************************/ -void smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +void smb_io_rpc_auth_ntlmssp_verifier(char *desc, RPC_AUTH_NTLMSSP_VERIFIER *rav, prs_struct *ps, int depth) { if (rav == NULL) return; -- cgit From 4bff2675746518af740e475e4e996247ac21d817 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Tue, 27 Jul 1999 10:46:44 +0000 Subject: - enumprintprocessors and enumprintmonitors added. - getjob (level 1 and 2) done. - better handling of getprinterdriver (level 2). - added workaround to print PCL files. Now the spoolss code should be compliant with all kind of printers :-) Jean Francois (This used to be commit bf9b639bf9162d61eb152af506dc2c1a7e8a4c85) --- source3/rpc_parse/parse_spoolss.c | 407 ++++++++++++++++++++++++++++++++------ 1 file changed, 352 insertions(+), 55 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 08ea5f73a2..a1ee058e06 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -98,16 +98,13 @@ static void smb_io_doc_info_1(char *desc, DOC_INFO_1 *info_1, prs_struct *ps, in prs_align(ps); - prs_uint32("p_docname", ps, depth, &(info_1->p_docname)); + prs_uint32("p_docname", ps, depth, &(info_1->p_docname)); prs_uint32("p_outputfile", ps, depth, &(info_1->p_outputfile)); - prs_uint32("p_datatype", ps, depth, &(info_1->p_datatype)); + prs_uint32("p_datatype", ps, depth, &(info_1->p_datatype)); - if (info_1->p_docname) - smb_io_unistr2("", &(info_1->docname),True,ps,depth); - if (info_1->p_outputfile) - smb_io_unistr2("", &(info_1->outputfile),True,ps,depth); - if (info_1->p_datatype) - smb_io_unistr2("", &(info_1->datatype),True,ps,depth); + smb_io_unistr2("", &(info_1->docname), info_1->p_docname, ps, depth); + smb_io_unistr2("", &(info_1->outputfile), info_1->p_outputfile, ps, depth); + smb_io_unistr2("", &(info_1->datatype), info_1->p_datatype, ps, depth); } /******************************************************************* @@ -818,6 +815,35 @@ static void smb_io_relstr(char *desc, prs_struct *ps, int depth, UNISTR *buffer, prs_uint32("offset", ps, depth, &(relative_offset)); } + +/******************************************************************* + * write a array UNICODE strings and its relative pointer. + * used by 2 RPC structs + ********************************************************************/ +static void smb_io_relarraystr(char *desc, prs_struct *ps, int depth, UNISTR ***buffer, + uint32 *start_offset, uint32 *end_offset) +{ + int i=0; + uint32 struct_offset; + uint32 relative_offset; + struct_offset=ps->offset; + + + while ( (*buffer)[i]!=0x0000 ) + { + *end_offset-= 2*(str_len_uni((*buffer)[i])+1); + ps->offset=*end_offset; + spoolss_smb_io_unistr(desc, (*buffer)[i], ps, depth); + + i++; + } + + ps->offset=struct_offset; + relative_offset=*end_offset-*start_offset; + + prs_uint32("offset", ps, depth, &(relative_offset)); +} + /******************************************************************* * write a DEVICEMODE struct. * on reading allocate memory for the private member @@ -1053,7 +1079,9 @@ static void smb_io_printer_driver_info_3(char *desc, DRIVER_INFO_3 *info,prs_str smb_io_relstr("datafile", ps, depth, &(info->datafile), start_offset, end_offset); smb_io_relstr("configfile", ps, depth, &(info->configfile), start_offset, end_offset); smb_io_relstr("helpfile", ps, depth, &(info->helpfile), start_offset, end_offset); - smb_io_relstr("dependentfiles", ps, depth, &(info->dependentfiles), start_offset, end_offset); + + smb_io_relarraystr("dependentfiles", ps, depth, &(info->dependentfiles), start_offset, end_offset); + smb_io_relstr("monitorname", ps, depth, &(info->monitorname), start_offset, end_offset); smb_io_relstr("defaultdatatype", ps, depth, &(info->defaultdatatype), start_offset, end_offset); } @@ -1061,64 +1089,64 @@ static void smb_io_printer_driver_info_3(char *desc, DRIVER_INFO_3 *info,prs_str /******************************************************************* ********************************************************************/ static void smb_io_job_info_1(char *desc, JOB_INFO_1 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) + uint32 *start_offset, uint32 *end_offset) { prs_debug(ps, depth, desc, "smb_io_job_info_1"); depth++; *start_offset=ps->offset; - prs_uint32("jobid", ps, depth, &(info->jobid)); - smb_io_relstr("printername",ps, depth, &(info->printername), start_offset, end_offset); - smb_io_relstr("machinename",ps, depth, &(info->machinename), start_offset, end_offset); - smb_io_relstr("username",ps, depth, &(info->username), start_offset, end_offset); - smb_io_relstr("document",ps, depth, &(info->document), start_offset, end_offset); - smb_io_relstr("datatype",ps, depth, &(info->datatype), start_offset, end_offset); - smb_io_relstr("text_status",ps, depth, &(info->text_status), start_offset, end_offset); - prs_uint32("status", ps, depth, &(info->status)); - prs_uint32("priority", ps, depth, &(info->priority)); - prs_uint32("position", ps, depth, &(info->position)); - prs_uint32("totalpages", ps, depth, &(info->totalpages)); - prs_uint32("pagesprinted", ps, depth, &(info->pagesprinted)); + prs_uint32("jobid", ps, depth, &(info->jobid)); + smb_io_relstr("printername", ps, depth, &(info->printername), start_offset, end_offset); + smb_io_relstr("machinename", ps, depth, &(info->machinename), start_offset, end_offset); + smb_io_relstr("username", ps, depth, &(info->username), start_offset, end_offset); + smb_io_relstr("document", ps, depth, &(info->document), start_offset, end_offset); + smb_io_relstr("datatype", ps, depth, &(info->datatype), start_offset, end_offset); + smb_io_relstr("text_status", ps, depth, &(info->text_status), start_offset, end_offset); + prs_uint32("status", ps, depth, &(info->status)); + prs_uint32("priority", ps, depth, &(info->priority)); + prs_uint32("position", ps, depth, &(info->position)); + prs_uint32("totalpages", ps, depth, &(info->totalpages)); + prs_uint32("pagesprinted", ps, depth, &(info->pagesprinted)); spoolss_io_system_time("submitted", ps, depth, &(info->submitted) ); } /******************************************************************* ********************************************************************/ static void smb_io_job_info_2(char *desc, JOB_INFO_2 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) + uint32 *start_offset, uint32 *end_offset) { int pipo=0; prs_debug(ps, depth, desc, "smb_io_job_info_2"); depth++; *start_offset=ps->offset; - prs_uint32("jobid", ps, depth, &(info->jobid)); - smb_io_relstr("printername",ps, depth, &(info->printername), start_offset, end_offset); - smb_io_relstr("machinename",ps, depth, &(info->machinename), start_offset, end_offset); - smb_io_relstr("username",ps, depth, &(info->username), start_offset, end_offset); - smb_io_relstr("document",ps, depth, &(info->document), start_offset, end_offset); - smb_io_relstr("notifyname",ps, depth, &(info->notifyname), start_offset, end_offset); - smb_io_relstr("datatype",ps, depth, &(info->datatype), start_offset, end_offset); + prs_uint32("jobid", ps, depth, &(info->jobid)); + smb_io_relstr("printername", ps, depth, &(info->printername), start_offset, end_offset); + smb_io_relstr("machinename", ps, depth, &(info->machinename), start_offset, end_offset); + smb_io_relstr("username", ps, depth, &(info->username), start_offset, end_offset); + smb_io_relstr("document", ps, depth, &(info->document), start_offset, end_offset); + smb_io_relstr("notifyname", ps, depth, &(info->notifyname), start_offset, end_offset); + smb_io_relstr("datatype", ps, depth, &(info->datatype), start_offset, end_offset); - smb_io_relstr("printprocessor",ps, depth, &(info->printprocessor), start_offset, end_offset); - smb_io_relstr("parameters",ps, depth, &(info->parameters), start_offset, end_offset); - smb_io_relstr("drivername",ps, depth, &(info->drivername), start_offset, end_offset); - smb_io_reldevmode("devmode", ps, depth, &(info->devmode), start_offset, end_offset); - smb_io_relstr("text_status",ps, depth, &(info->text_status), start_offset, end_offset); + smb_io_relstr("printprocessor", ps, depth, &(info->printprocessor), start_offset, end_offset); + smb_io_relstr("parameters", ps, depth, &(info->parameters), start_offset, end_offset); + smb_io_relstr("drivername", ps, depth, &(info->drivername), start_offset, end_offset); + smb_io_reldevmode("devmode", ps, depth, info->devmode, start_offset, end_offset); + smb_io_relstr("text_status", ps, depth, &(info->text_status), start_offset, end_offset); /* SEC_DESC sec_desc;*/ prs_uint32("Hack! sec desc", ps, depth, &pipo); - prs_uint32("status", ps, depth, &(info->status)); - prs_uint32("priority", ps, depth, &(info->priority)); - prs_uint32("position", ps, depth, &(info->position)); - prs_uint32("starttime", ps, depth, &(info->starttime)); - prs_uint32("untiltime", ps, depth, &(info->untiltime)); - prs_uint32("totalpages", ps, depth, &(info->totalpages)); - prs_uint32("size", ps, depth, &(info->size)); + prs_uint32("status", ps, depth, &(info->status)); + prs_uint32("priority", ps, depth, &(info->priority)); + prs_uint32("position", ps, depth, &(info->position)); + prs_uint32("starttime", ps, depth, &(info->starttime)); + prs_uint32("untiltime", ps, depth, &(info->untiltime)); + prs_uint32("totalpages", ps, depth, &(info->totalpages)); + prs_uint32("size", ps, depth, &(info->size)); spoolss_io_system_time("submitted", ps, depth, &(info->submitted) ); - prs_uint32("timeelapsed", ps, depth, &(info->timeelapsed)); - prs_uint32("pagesprinted", ps, depth, &(info->pagesprinted)); + prs_uint32("timeelapsed", ps, depth, &(info->timeelapsed)); + prs_uint32("pagesprinted", ps, depth, &(info->pagesprinted)); } /******************************************************************* @@ -1156,6 +1184,30 @@ static void smb_io_port_2(char *desc, PORT_INFO_2 *info, prs_struct *ps, int dep prs_uint32("reserved", ps, depth, &(info->reserved)); } +/******************************************************************* +********************************************************************/ +static void smb_io_processor_info_1(char *desc, PRINTPROCESSOR_1 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_processor_info_1"); + depth++; + *start_offset=ps->offset; + + smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); +} + +/******************************************************************* +********************************************************************/ +static void smb_io_monitor_info_1(char *desc, PRINTMONITOR_1 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_monitor_info_1"); + depth++; + *start_offset=ps->offset; + + smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); +} + /******************************************************************* return the size required by a struct in the stream ********************************************************************/ @@ -1255,6 +1307,9 @@ return the size required by a struct in the stream static uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) { int size=0; + UNISTR **string; + int i=0; + DEBUG(9,("Sizing driver info_3\n")); size+=size_of_uint32( &(info->version) ); size+=size_of_relative_string( &(info->name) ); @@ -1263,9 +1318,17 @@ static uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) size+=size_of_relative_string( &(info->datafile) ); size+=size_of_relative_string( &(info->configfile) ); size+=size_of_relative_string( &(info->helpfile) ); - size+=size_of_relative_string( &(info->dependentfiles) ); size+=size_of_relative_string( &(info->monitorname) ); size+=size_of_relative_string( &(info->defaultdatatype) ); + + string=info->dependentfiles; + + while ( (string)[i]!=0x0000 ) + { + size+=2*(1+ str_len_uni( string[i] ) ); + i++; + } + size+=4; DEBUGADD(9,("size: [%d]\n", size)); return (size); @@ -1312,7 +1375,7 @@ static uint32 spoolss_size_job_info_2(JOB_INFO_2 *info) size+=size_of_relative_string( &(info->printprocessor) ); size+=size_of_relative_string( &(info->parameters) ); size+=size_of_relative_string( &(info->drivername) ); - size+=size_of_device_mode( &(info->devmode) ); + size+=size_of_device_mode( info->devmode ); size+=size_of_relative_string( &(info->text_status) ); /* SEC_DESC sec_desc;*/ size+=size_of_uint32( &(info->status) ); @@ -1364,6 +1427,28 @@ static uint32 spoolss_size_port_info_2(PORT_INFO_2 *info) return (size); } +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_processor_info_1(PRINTPROCESSOR_1 *info) +{ + int size=0; + size+=size_of_relative_string( &(info->name) ); + + return (size); +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_monitor_info_1(PRINTMONITOR_1 *info) +{ + int size=0; + size+=size_of_relative_string( &(info->name) ); + + return (size); +} + /******************************************************************* * read a uint8 buffer of size *size. * allocate memory for it @@ -3216,6 +3301,7 @@ void spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r uint32 useless_ptr=0xADDE0FF0; uint32 start_offset, end_offset, beginning; uint32 bufsize_required=0; + int i; prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocessors"); depth++; @@ -3228,12 +3314,12 @@ void spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r { PRINTPROCESSOR_1 *info_1; info_1=r_u->info_1; -/* + for (i=0; inumofprintprocessors; i++) { - bufsize_required += spoolss_size_port_info_2(&(info_1[i])); + bufsize_required += spoolss_size_processor_info_1(&(info_1[i])); } -*/ break; + break; } } @@ -3265,14 +3351,14 @@ void spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r switch (r_u->level) { - case 2: + case 1: { -/* PORT_INFO_2 *info; - for (i=0; inumofports; i++) + PRINTPROCESSOR_1 *info_1; + for (i=0; inumofprintprocessors; i++) { - info = &(r_u->port.port_info_2[i]); - smb_io_port_2(desc, info, ps, depth, &start_offset, &end_offset); - }*/ + info_1 = &(r_u->info_1[i]); + smb_io_processor_info_1(desc, info_1, ps, depth, &start_offset, &end_offset); + } break; } } @@ -3311,6 +3397,106 @@ void spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); } +/******************************************************************* +********************************************************************/ +void spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + int i; + + prs_debug(ps, depth, desc, "spoolss_io_r_enumprintmonitors"); + depth++; + + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + switch (r_u->level) + { + case 1: + { + PRINTMONITOR_1 *info_1; + info_1=r_u->info_1; + + for (i=0; inumofprintmonitors; i++) + { + bufsize_required += spoolss_size_monitor_info_1(&(info_1[i])); + } + break; + } + } + + DEBUG(4,("size needed: %d\n",bufsize_required)); + DEBUG(4,("size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ + + DEBUG(4,("buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); + + DEBUG(4,("buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + beginning=ps->offset; + start_offset=ps->offset; + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 1: + { + PRINTMONITOR_1 *info_1; + for (i=0; inumofprintmonitors; i++) + { + info_1 = &(r_u->info_1[i]); + smb_io_monitor_info_1(desc, info_1, ps, depth, &start_offset, &end_offset); + } + break; + } + } + ps->offset=beginning+r_u->offered; + prs_align(ps); + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("numofprintmonitors", ps, depth, &(r_u->numofprintmonitors)); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_enumprintmonitors(char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth) +{ + uint32 useless; + prs_debug(ps, depth, desc, "spoolss_io_q_enumprintmonitors"); + depth++; + + prs_align(ps); + prs_uint32("useless", ps, depth, &useless); + smb_io_unistr2("", &(q_u->name),True,ps,depth); + prs_align(ps); + prs_uint32("level", ps, depth, &(q_u->level)); + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + prs_align(ps); + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); +} + /******************************************************************* ********************************************************************/ void spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth) @@ -3504,3 +3690,114 @@ void spoolss_io_r_setform(char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int prs_uint32("status", ps, depth, &(r_u->status)); } +/******************************************************************* +********************************************************************/ +void spoolss_io_r_getjob(char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + + prs_debug(ps, depth, desc, "spoolss_io_r_getjob"); + depth++; + + prs_align(ps); + + prs_uint32("pointer", ps, depth, &useless_ptr); + + switch (r_u->level) + { + case 1: + { + JOB_INFO_1 *info; + info=r_u->job.job_info_1; + + bufsize_required += spoolss_size_job_info_1(info); + break; + } + case 2: + { + JOB_INFO_2 *info; + info=r_u->job.job_info_2; + + bufsize_required += spoolss_size_job_info_2(info); + break; + } + } + + DEBUG(4,("spoolss_io_r_getjob, size needed: %d\n",bufsize_required)); + DEBUG(4,("spoolss_io_r_getjob, size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ + + DEBUG(4,("spoolss_io_r_getjob, buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); + + DEBUG(4,("spoolss_io_r_enumjobs, buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + beginning=ps->offset; + start_offset=ps->offset; + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 1: + { + JOB_INFO_1 *info; + info = r_u->job.job_info_1; + smb_io_job_info_1(desc, info, ps, depth, &start_offset, &end_offset); + break; + } + case 2: + { + JOB_INFO_2 *info; + info = r_u->job.job_info_2; + smb_io_job_info_2(desc, info, ps, depth, &start_offset, &end_offset); + break; + } + + } + ps->offset=beginning+r_u->offered; + prs_align(ps); + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("status", ps, depth, &(r_u->status)); +} + +/******************************************************************* +********************************************************************/ +void spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int depth) +{ + + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("jobid", ps, depth, &(q_u->jobid)); + prs_uint32("level", ps, depth, &(q_u->level)); + + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + + prs_align(ps); + + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); +} -- cgit From 8598bf2a7f0f71ae7a023aac054c4df42b969ce6 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 3 Aug 1999 20:30:25 +0000 Subject: reverted jeremy's c++-like security descriptor modifications as the simplest method to get rpcclient's reggetsec command working. the buffers passed as arguments in do_reg_get_key_sec() do need to be locally allocated not dynamically allocated, as two calls to reg_get_key_sec() are needed. on the first, the server fills in the size of the security descriptor buffer needed. on the second, the server fills in the security descriptor buffer. (This used to be commit b2d9cbef6f65bb696df8d8f49aa0c240e0bb1f50) --- source3/rpc_parse/parse_misc.c | 8 +- source3/rpc_parse/parse_reg.c | 30 ++- source3/rpc_parse/parse_sec.c | 598 ++++++++++++++++------------------------- 3 files changed, 247 insertions(+), 389 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 4927886fc8..4bc44f2038 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -133,11 +133,11 @@ void smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) /******************************************************************* reads or writes a DOM_SID structure. ********************************************************************/ -BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) +void smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) { int i; - if (sid == NULL) return False; + if (sid == NULL) return; prs_debug(ps, depth, desc, "smb_io_dom_sid"); depth++; @@ -158,8 +158,6 @@ BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) if (sid->num_auths > MAXSUBAUTHS) sid->num_auths = MAXSUBAUTHS; prs_uint32s(False, "sub_auths ", ps, depth, sid->sub_auths, sid->num_auths); - - return True; } /******************************************************************* @@ -167,7 +165,7 @@ creates a DOM_SID2 structure. ********************************************************************/ void make_dom_sid2(DOM_SID2 *sid2, DOM_SID *sid) { - sid2->sid = *sid; + sid_copy(&sid2->sid, sid); sid2->num_auths = sid2->sid.num_auths; } diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index b97fe3958b..47e1ae3af2 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -135,8 +135,7 @@ static void reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, SEC_DES } if (ptr3 == NULL || *ptr3 != 0) { - /* JRA - this line is probably wrong... */ - sec_io_desc_buf("data ", &data , ps, depth); + sec_io_desc_buf("data ", data , ps, depth); } smb_io_hdrbuf_post("hdr_sec", hdr_sec, ps, depth, hdr_offset, data->max_len, data->len); @@ -152,7 +151,8 @@ creates a structure. void make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, char *name, char *class, SEC_ACCESS *sam_access, - SEC_DESC_BUF *sec_buf) + SEC_DESC_BUF *sec_buf, + int sec_len, SEC_DESC *sec) { int len_name = name != NULL ? strlen(name ) + 1: 0; int len_class = class != NULL ? strlen(class) + 1: 0; @@ -175,8 +175,9 @@ void make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, q_c->data = sec_buf; q_c->ptr2 = 1; - make_buf_hdr(&(q_c->hdr_sec), sec_buf->len, sec_buf->len); + make_buf_hdr(&(q_c->hdr_sec), sec_len, sec_len); q_c->ptr3 = 1; + make_sec_desc_buf(q_c->data, sec_len, sec); q_c->unknown_2 = 0x00000000; } @@ -548,7 +549,7 @@ void reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) makes a structure. ********************************************************************/ void make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, - SEC_DESC_BUF *sec_desc_buf) + uint32 buf_len, SEC_DESC *sec_desc) { if (q_i == NULL) return; @@ -557,8 +558,8 @@ void make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, q_i->sec_info = DACL_SECURITY_INFORMATION; q_i->ptr = 1; - make_buf_hdr(&(q_i->hdr_sec), sec_desc_buf->len, sec_desc_buf->len); - q_i->data = sec_desc_buf; + make_buf_hdr(&(q_i->hdr_sec), buf_len, buf_len); + make_sec_desc_buf(q_i->data, buf_len, sec_desc); } /******************************************************************* @@ -601,7 +602,7 @@ void reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, in makes a structure. ********************************************************************/ void make_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, - uint32 sec_buf_size, SEC_DESC_BUF *psdb) + uint32 buf_len, SEC_DESC_BUF *sec_buf) { if (q_i == NULL) return; @@ -611,10 +612,14 @@ void make_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION; - q_i->ptr = psdb != NULL ? 1 : 0; - q_i->data = psdb; + q_i->ptr = sec_buf != NULL ? 1 : 0; + q_i->data = sec_buf; - make_buf_hdr(&(q_i->hdr_sec), sec_buf_size, 0); + if (sec_buf != NULL) + { + make_buf_hdr(&(q_i->hdr_sec), buf_len, 0); + make_sec_desc_buf(q_i->data, buf_len, NULL); + } } /******************************************************************* @@ -671,7 +676,8 @@ void reg_io_r_get_key_sec(char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, i if (r_q->ptr != 0) { - sec_io_desc_buf("", &r_q->data, ps, depth); + smb_io_hdrbuf("", &(r_q->hdr_sec), ps, depth); + sec_io_desc_buf("", r_q->data, ps, depth); prs_align(ps); } diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 886b3f334a..2840070edc 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -2,10 +2,10 @@ * Unix SMB/Netbios implementation. * Version 1.9. * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1999, - * Copyright (C) Jeremy R. Allison 1995-1999 - * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, - * Copyright (C) Paul Ashton 1997-1999. + * Copyright (C) Andrew Tridgell 1992-1998, + * Copyright (C) Jeremy R. Allison 1995-1998 + * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, + * Copyright (C) Paul Ashton 1997-1998. * * 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 @@ -29,24 +29,19 @@ extern int DEBUGLEVEL; /******************************************************************* - Sets up a SEC_ACCESS structure. +makes a structure. ********************************************************************/ - -void init_sec_access(SEC_ACCESS *t, uint32 mask) +void make_sec_access(SEC_ACCESS *t, uint32 mask) { t->mask = mask; } /******************************************************************* - Reads or writes a SEC_ACCESS structure. +reads or writes a structure. ********************************************************************/ - -BOOL sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) -{ - if (t == NULL) +void sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) { - return False; - } + if (t == NULL) return; prs_debug(ps, depth, desc, "sec_io_access"); depth++; @@ -54,39 +49,30 @@ BOOL sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) prs_align(ps); prs_uint32("mask", ps, depth, &(t->mask)); - return True; } /******************************************************************* - Sets up a SEC_ACE structure. +makes a structure. ********************************************************************/ - -void init_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, - uint8 flag) +void make_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 flag) { t->type = type; t->flags = flag; t->size = sid_size(sid) + 8; t->info = mask; - ZERO_STRUCTP(&t->sid); sid_copy(&t->sid, sid); } /******************************************************************* - Reads or writes a SEC_ACE structure. +reads or writes a structure. ********************************************************************/ - -BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth) +void sec_io_ace(char *desc, SEC_ACE *t, prs_struct *ps, int depth) { uint32 old_offset; uint32 offset_ace_size; - - if (psa == NULL) - { - return False; - } + if (t == NULL) return; prs_debug(ps, depth, desc, "sec_io_ace"); depth++; @@ -95,132 +81,58 @@ BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth) old_offset = ps->offset; - prs_uint8 ("type ", ps, depth, &psa->type); - prs_uint8 ("flags", ps, depth, &psa->flags); - prs_uint16_pre("size ", ps, depth, &psa->size, &offset_ace_size); - - if (!sec_io_access("info ", &psa->info, ps, depth)) - { - return False; - } + prs_uint8 ("type ", ps, depth, &(t->type)); + prs_uint8 ("flags", ps, depth, &(t->flags)); + prs_uint16_pre("size ", ps, depth, &(t->size ), &offset_ace_size); + sec_io_access ("info ", &t->info, ps, depth); prs_align(ps); - if (!smb_io_dom_sid("sid ", &psa->sid , ps, depth)) - { - return False; - } - + smb_io_dom_sid("sid ", &t->sid , ps, depth); - prs_uint16_post("size ", ps, depth, &psa->size, offset_ace_size, old_offset); - return True; + prs_uint16_post("size ", ps, depth, &t->size, offset_ace_size, old_offset); } /******************************************************************* - Create a SEC_ACL structure. +makes a structure. ********************************************************************/ - -SEC_ACL *make_sec_acl(uint16 revision, int num_aces, SEC_ACE *ace_list) +void make_sec_acl(SEC_ACL *t, uint16 revision, int num_aces, SEC_ACE *ace) { - SEC_ACL *dst; int i; - - dst = (SEC_ACL *)malloc(sizeof(SEC_ACL)); - if (dst == NULL) - { - return NULL; - } - - ZERO_STRUCTP(dst); - - dst->revision = revision; - dst->num_aces = num_aces; - dst->size = 4; - - if ((dst->ace_list = (SEC_ACE *)malloc( sizeof(SEC_ACE) * num_aces )) == NULL) { - free_sec_acl(&dst); - return NULL; - } + t->revision = revision; + t->num_aces = num_aces; + t->size = 4; + t->ace = ace; for (i = 0; i < num_aces; i++) { - dst->ace_list[i] = ace_list[i]; /* Structure copy. */ - dst->size += ace_list[i].size; - } - - return dst; -} - -/******************************************************************* - Duplicate a SEC_ACL structure. -********************************************************************/ - -SEC_ACL *dup_sec_acl( SEC_ACL *src) -{ - if (src == NULL) - { - return NULL; + t->size += ace[i].size; } - - return make_sec_acl( src->revision, src->num_aces, src->ace_list); } /******************************************************************* - Delete a SEC_ACL structure. +frees a structure. ********************************************************************/ - -void free_sec_acl(SEC_ACL **ppsa) +void free_sec_acl(SEC_ACL *t) { - SEC_ACL *psa; - - if (ppsa == NULL || *ppsa == NULL) + if (t->ace != NULL) { - return; + free(t->ace); } - - psa = *ppsa; - if (psa->ace_list != NULL) - { - free(psa->ace_list); - } - - free(psa); - *ppsa = NULL; } /******************************************************************* - Reads or writes a SEC_ACL structure. +reads or writes a structure. - First of the xx_io_xx functions that allocates its data structures +first of the xx_io_xx functions that allocates its data structures for you as it reads them. ********************************************************************/ - -BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) +void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) { int i; uint32 old_offset; uint32 offset_acl_size; - SEC_ACL *psa; - - if (ppsa == NULL) - { - return False; - } - - psa = *ppsa; - if (ps->io && psa == NULL) - { - /* - * This is a read and we must allocate the stuct to read into. - */ - psa = (SEC_ACL *)malloc(sizeof(SEC_ACL)); - if (psa == NULL) - { - return False; - } - ZERO_STRUCTP(psa); - *ppsa = psa; - } + if (t == NULL) return; prs_debug(ps, depth, desc, "sec_io_acl"); depth++; @@ -229,216 +141,147 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) old_offset = ps->offset; - prs_uint16("revision", ps, depth, &psa->revision); - prs_uint16_pre("size ", ps, depth, &psa->size, &offset_acl_size); - prs_uint32("num_aces ", ps, depth, &psa->num_aces); + prs_uint16("revision", ps, depth, &(t->revision)); + prs_uint16_pre("size ", ps, depth, &(t->size ), &offset_acl_size); + prs_uint32("num_aces ", ps, depth, &(t->num_aces )); - if (ps->io && psa->num_aces != 0) + if (ps->io && t->num_aces != 0) { /* reading */ - psa->ace_list = malloc(sizeof(psa->ace_list[0]) * psa->num_aces); - if (psa->ace_list == NULL) - { - return False; + t->ace = malloc(sizeof(t->ace[0]) * t->num_aces); + ZERO_STRUCTP(t->ace); } - ZERO_STRUCTP(psa->ace_list); + + if (t->ace == NULL && t->num_aces != 0) + { + DEBUG(0,("INVALID ACL\n")); + ps->offset = 0xfffffffe; + return; } - for (i = 0; i < MIN(psa->num_aces, MAX_SEC_ACES); i++) + for (i = 0; i < MIN(t->num_aces, MAX_SEC_ACES); i++) { fstring tmp; - slprintf(tmp, sizeof(tmp)-1, "ace_list[%02d]: ", i); - if (!sec_io_ace(tmp, &psa->ace_list[i], ps, depth)) - { - return False; - } + slprintf(tmp, sizeof(tmp)-1, "ace[%02d]: ", i); + sec_io_ace(tmp, &t->ace[i], ps, depth); } prs_align(ps); - prs_uint16_post("size ", ps, depth, &psa->size, offset_acl_size, old_offset); - - return True; + prs_uint16_post("size ", ps, depth, &t->size , offset_acl_size, old_offset); } /******************************************************************* - Creates a SEC_DESC structure +makes a structure ********************************************************************/ - -SEC_DESC *make_sec_desc(uint16 revision, uint16 type, +int make_sec_desc(SEC_DESC *t, uint16 revision, uint16 type, DOM_SID *owner_sid, DOM_SID *grp_sid, - SEC_ACL *sacl, SEC_ACL *dacl, size_t *sec_desc_size) + SEC_ACL *sacl, SEC_ACL *dacl) { - SEC_DESC *dst; uint32 offset; - *sec_desc_size = 0; - - dst = (SEC_DESC *)malloc(sizeof(SEC_DESC)); - - if (dst == NULL) - { - return NULL; - } - - ZERO_STRUCTP(dst); - - dst->revision = revision; - dst->type = type; - - dst->off_owner_sid = 0; - dst->off_grp_sid = 0; - dst->off_sacl = 0; - dst->off_dacl = 0; - - /* duplicate sids and acls as necessary */ + t->revision = revision; + t->type = type; - if (dacl != NULL) dst->dacl = dup_sec_acl(dacl); - if (sacl != NULL) dst->sacl = dup_sec_acl(sacl); - if (owner_sid != NULL) dst->owner_sid = sid_dup(owner_sid); - if (grp_sid != NULL) dst->grp_sid = sid_dup(grp_sid); + t->off_owner_sid = 0; + t->off_grp_sid = 0; + t->off_sacl = 0; + t->off_dacl = 0; - /* having duplicated sids and acls as necessary, check success */ - - if ((dacl != NULL && dst->dacl == NULL) || - (sacl != NULL && dst->sacl == NULL) || - (owner_sid != NULL && dst->owner_sid == NULL) || - (grp_sid != NULL && dst->grp_sid == NULL)) - { - *sec_desc_size = 0; - free_sec_desc(&dst); - - return NULL; - } + t->dacl = dacl; + t->sacl = sacl; + t->owner_sid = owner_sid; + t->grp_sid = grp_sid; offset = 0x0; - /* - * Work out the linearization sizes. - */ - - if (dst->dacl != NULL) + if (dacl != NULL) { if (offset == 0) { offset = 0x14; } - dst->off_dacl = offset; + t->off_dacl = offset; offset += dacl->size; } - if (dst->sacl != NULL) + if (sacl != NULL) { if (offset == 0) { offset = 0x14; } - dst->off_sacl = offset; - offset += sacl->size; + t->off_dacl = offset; + offset += dacl->size; } - if (dst->owner_sid != NULL) + if (owner_sid != NULL) { if (offset == 0) { offset = 0x14; } - dst->off_owner_sid = offset; - offset += sid_size(dst->owner_sid); + t->off_owner_sid = offset; + offset += sid_size(owner_sid); } - if (dst->grp_sid != NULL) + if (grp_sid != NULL) { if (offset == 0) { offset = 0x14; } - dst->off_grp_sid = offset; - offset += sid_size(dst->grp_sid); + t->off_grp_sid = offset; + offset += sid_size(grp_sid); } - *sec_desc_size = (size_t)((offset == 0) ? 0x14 : offset); - return dst; + return (offset == 0) ? 0x14 : offset; } -/******************************************************************* - Duplicate a SEC_DESC structure. -********************************************************************/ - -SEC_DESC *dup_sec_desc( SEC_DESC *src) -{ - size_t dummy; - - if (src == NULL) - return NULL; - - return make_sec_desc( src->revision, src->type, - src->owner_sid, src->grp_sid, src->sacl, - src->dacl, &dummy); -} /******************************************************************* - Deletes a SEC_DESC structure +frees a structure ********************************************************************/ - -void free_sec_desc(SEC_DESC **ppsd) +void free_sec_desc(SEC_DESC *t) { - SEC_DESC *psd; - - if (ppsd == NULL || *ppsd == NULL) + if (t->dacl != NULL) { - return; + free_sec_acl(t->dacl); } - psd = *ppsd; - - free_sec_acl(&psd->dacl); - free_sec_acl(&psd->dacl); - free(psd->owner_sid); - free(psd->grp_sid); - free(psd); - *ppsd = NULL; + if (t->sacl != NULL) + { + free_sec_acl(t->dacl); } -/******************************************************************* - Creates a SEC_DESC structure with typical defaults. -********************************************************************/ + if (t->owner_sid != NULL) + { + free(t->owner_sid); + } -SEC_DESC *make_standard_sec_desc(DOM_SID *owner_sid, DOM_SID *grp_sid, - SEC_ACL *dacl, size_t *sec_desc_size) + if (t->grp_sid != NULL) { - return make_sec_desc(1, SEC_DESC_SELF_RELATIVE|SEC_DESC_DACL_PRESENT, - owner_sid, grp_sid, NULL, dacl, sec_desc_size); + free(t->grp_sid); + } } /******************************************************************* - Reads or writes a SEC_DESC structure. - If reading and the *ppsd = NULL, allocates the structure. +reads or writes a structure. ********************************************************************/ - -BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) +static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { +#if 0 + uint32 off_owner_sid; + uint32 off_grp_sid ; + uint32 off_sacl ; + uint32 off_dacl ; +#endif uint32 old_offset; uint32 max_offset = 0; /* after we're done, move offset to end */ - SEC_DESC *psd; - - if (ppsd == NULL) - return False; - psd = *ppsd; - - if (ps->io && psd == NULL) - { - psd = (SEC_DESC *)malloc(sizeof(SEC_DESC)); - if (psd == NULL) - { - return False; - } - ZERO_STRUCTP(psd); - *ppsd = psd; - } + if (t == NULL) return; prs_debug(ps, depth, desc, "sec_io_desc"); depth++; @@ -448,207 +291,218 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) /* start of security descriptor stored for back-calc offset purposes */ old_offset = ps->offset; - prs_uint16("revision ", ps, depth, &psd->revision); - prs_uint16("type ", ps, depth, &psd->type); - - prs_uint32("off_owner_sid", ps, depth, &psd->off_owner_sid); - prs_uint32("off_grp_sid ", ps, depth, &psd->off_grp_sid); - prs_uint32("off_sacl ", ps, depth, &psd->off_sacl); - prs_uint32("off_dacl ", ps, depth, &psd->off_dacl); - + prs_uint16("revision ", ps, depth, &(t->revision )); + prs_uint16("type ", ps, depth, &(t->type )); + + prs_uint32("off_owner_sid", ps, depth, &(t->off_owner_sid)); + prs_uint32("off_grp_sid ", ps, depth, &(t->off_grp_sid )); + prs_uint32("off_sacl ", ps, depth, &(t->off_sacl )); + prs_uint32("off_dacl ", ps, depth, &(t->off_dacl )); +#if 0 + prs_uint32_pre("off_owner_sid", ps, depth, &(t->off_owner_sid), &off_owner_sid); + prs_uint32_pre("off_grp_sid ", ps, depth, &(t->off_grp_sid ), &off_grp_sid ); + prs_uint32_pre("off_sacl ", ps, depth, &(t->off_sacl ), &off_sacl ); + prs_uint32_pre("off_dacl ", ps, depth, &(t->off_dacl ), &off_dacl ); +#endif max_offset = MAX(max_offset, ps->offset); - if (IS_BITS_SET_ALL(psd->type, SEC_DESC_DACL_PRESENT) && psd->dacl) + if (IS_BITS_SET_ALL(t->type, SEC_DESC_DACL_PRESENT)) { - ps->offset = old_offset + psd->off_dacl; - if (!sec_io_acl("dacl", &psd->dacl, ps, depth)) +#if 0 + prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , ps->offset - old_offset); +#endif + ps->offset = old_offset + t->off_dacl; + if (ps->io) { - return False; - } - prs_align(ps); + /* reading */ + t->dacl = malloc(sizeof(*t->dacl)); + ZERO_STRUCTP(t->dacl); } - max_offset = MAX(max_offset, ps->offset); - - if (IS_BITS_SET_ALL(psd->type, SEC_DESC_SACL_PRESENT) && psd->sacl) - { - ps->offset = old_offset + psd->off_sacl; - if (!sec_io_acl("sacl", &psd->sacl, ps, depth)) + if (t->dacl == NULL) { - return False; + DEBUG(0,("INVALID DACL\n")); + ps->offset = 0xfffffffe; + return; } + + sec_io_acl ("dacl" , t->dacl , ps, depth); prs_align(ps); } +#if 0 + else + { + prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , 0); + } +#endif max_offset = MAX(max_offset, ps->offset); - if (psd->off_owner_sid != 0) + if (IS_BITS_SET_ALL(t->type, SEC_DESC_SACL_PRESENT)) { +#if 0 + prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , ps->offset - old_offset); +#endif + ps->offset = old_offset + t->off_sacl; if (ps->io) { - ps->offset = old_offset + psd->off_owner_sid; /* reading */ - psd->owner_sid = malloc(sizeof(*psd->owner_sid)); - if (psd->owner_sid == NULL) - { - return False; - } - ZERO_STRUCTP(psd->owner_sid); + t->sacl = malloc(sizeof(*t->sacl)); + ZERO_STRUCTP(t->sacl); } - if (!smb_io_dom_sid("owner_sid ", psd->owner_sid , ps, depth)) + if (t->sacl == NULL) { - return False; + DEBUG(0,("INVALID SACL\n")); + ps->offset = 0xfffffffe; + return; } + + sec_io_acl ("sacl" , t->sacl , ps, depth); prs_align(ps); } +#if 0 + else + { + prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , 0); + } +#endif max_offset = MAX(max_offset, ps->offset); - if (psd->off_grp_sid != 0) +#if 0 + prs_uint32_post("off_owner_sid", ps, depth, &(t->off_owner_sid), off_owner_sid, ps->offset - old_offset); +#endif + if (t->off_owner_sid != 0) { if (ps->io) { - /* reading */ - ps->offset = old_offset + psd->off_grp_sid; - psd->grp_sid = malloc(sizeof(*psd->grp_sid)); - if (psd->grp_sid == NULL) - { - return False; + ps->offset = old_offset + t->off_owner_sid; } - ZERO_STRUCTP(psd->grp_sid); + if (ps->io) + { + /* reading */ + t->owner_sid = malloc(sizeof(*t->owner_sid)); + ZERO_STRUCTP(t->owner_sid); } - if (!smb_io_dom_sid("grp_sid", psd->grp_sid, ps, depth)) + if (t->owner_sid == NULL) { - return False; + DEBUG(0,("INVALID OWNER SID\n")); + ps->offset = 0xfffffffe; + return; } + + smb_io_dom_sid("owner_sid ", t->owner_sid , ps, depth); prs_align(ps); } max_offset = MAX(max_offset, ps->offset); - ps->offset = max_offset; - return True; +#if 0 + prs_uint32_post("off_grp_sid ", ps, depth, &(t->off_grp_sid ), off_grp_sid , ps->offset - old_offset); +#endif + if (t->off_grp_sid != 0) + { + if (ps->io) + { + ps->offset = old_offset + t->off_grp_sid; } - -/******************************************************************* - Creates a SEC_DESC_BUF structure. -********************************************************************/ - -SEC_DESC_BUF *make_sec_desc_buf(int len, SEC_DESC *sec_desc) + if (ps->io) { - SEC_DESC_BUF *dst; + /* reading */ + t->grp_sid = malloc(sizeof(*t->grp_sid)); + ZERO_STRUCTP(t->grp_sid); + } - dst = (SEC_DESC_BUF *)malloc(sizeof(SEC_DESC_BUF)); - if (dst == NULL) + if (t->grp_sid == NULL) { - return NULL; + DEBUG(0,("INVALID GROUP SID\n")); + ps->offset = 0xfffffffe; + return; } - ZERO_STRUCTP(dst); - - /* max buffer size (allocated size) */ - dst->max_len = len; - dst->len = len; - - if (sec_desc && ((dst->sec = dup_sec_desc(sec_desc)) == NULL)) - { - free_sec_desc_buf(&dst); - return NULL; + smb_io_dom_sid("grp_sid", t->grp_sid, ps, depth); + prs_align(ps); } - return dst; + max_offset = MAX(max_offset, ps->offset); + + ps->offset = max_offset; } /******************************************************************* - Duplicates a SEC_DESC_BUF structure. +creates a SEC_DESC_BUF structure. ********************************************************************/ - -SEC_DESC_BUF *dup_sec_desc_buf(SEC_DESC_BUF *src) -{ - if (src == NULL) +void make_sec_desc_buf(SEC_DESC_BUF *buf, int len, SEC_DESC *data) { - return NULL; - } + ZERO_STRUCTP(buf); - return make_sec_desc_buf( src->len, src->sec); + /* max buffer size (allocated size) */ + buf->max_len = len; + buf->undoc = 0; + buf->len = data != NULL ? len : 0; + buf->sec = data; } /******************************************************************* - Deletes a SEC_DESC_BUF structure. +frees a SEC_DESC_BUF structure. ********************************************************************/ - -void free_sec_desc_buf(SEC_DESC_BUF **ppsdb) +void free_sec_desc_buf(SEC_DESC_BUF *buf) { - SEC_DESC_BUF *psdb; - - if (ppsdb == NULL || *ppsdb == NULL) + if (buf->sec != NULL) { - return; + free_sec_desc(buf->sec); + free(buf->sec); } - - psdb = *ppsdb; - free_sec_desc(&psdb->sec); - free(psdb); - *ppsdb = NULL; } /******************************************************************* - Reads or writes a SEC_DESC_BUF structure. +reads or writes a SEC_DESC_BUF structure. ********************************************************************/ - -BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth) +void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) { uint32 off_len; uint32 off_max_len; uint32 old_offset; uint32 size; - SEC_DESC_BUF *psdb; - - if (ppsdb == NULL) - { - return False; - } - - psdb = *ppsdb; - if (ps->io && psdb == NULL) - { - psdb = (SEC_DESC_BUF *)malloc(sizeof(SEC_DESC_BUF)); - if (psdb == NULL) - { - return False; - } - ZERO_STRUCTP(psdb); - *ppsdb = psdb; - } + if (sec == NULL) return; prs_debug(ps, depth, desc, "sec_io_desc_buf"); depth++; prs_align(ps); - prs_uint32_pre("max_len", ps, depth, &psdb->max_len, &off_max_len); - prs_uint32 ("undoc ", ps, depth, &psdb->undoc); - prs_uint32_pre("len ", ps, depth, &psdb->len, &off_len); + prs_uint32_pre("max_len", ps, depth, &(sec->max_len), &off_max_len); + prs_uint32 ("undoc ", ps, depth, &(sec->undoc )); + prs_uint32_pre("len ", ps, depth, &(sec->len ), &off_len); old_offset = ps->offset; - /* reading, length is non-zero; writing, descriptor is non-NULL */ - if ((psdb->len != 0 || (!ps->io)) && psdb->sec != NULL) + if (sec->len != 0 && ps->io) { - if (!sec_io_desc("sec ", &psdb->sec, ps, depth)) + /* reading */ + sec->sec = malloc(sizeof(*sec->sec)); + ZERO_STRUCTP(sec->sec); + + if (sec->sec == NULL) { - return False; + DEBUG(0,("INVALID SEC_DESC\n")); + ps->offset = 0xfffffffe; + return; } } - size = ps->offset - old_offset; - prs_uint32_post("max_len", ps, depth, &psdb->max_len, off_max_len, size == 0 ? psdb->max_len : size); - prs_uint32_post("len ", ps, depth, &psdb->len, off_len, size); + /* reading, length is non-zero; writing, descriptor is non-NULL */ + if ((sec->len != 0 || (!ps->io)) && sec->sec != NULL) + { + sec_io_desc("sec ", sec->sec, ps, depth); + } - return True; + size = ps->offset - old_offset; + prs_uint32_post("max_len", ps, depth, &(sec->max_len), off_max_len, size == 0 ? sec->max_len : size); + prs_uint32_post("len ", ps, depth, &(sec->len ), off_len , size); } -- cgit From 6bcd191a6ca02319cae427c5503d7efd520977c8 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 3 Aug 1999 20:54:22 +0000 Subject: changing debug output message reg_io_unknown_1 to reg_io_close. (This used to be commit c4901f595193f73b0c248d9315d3bbf547a5dafc) --- source3/rpc_parse/parse_reg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 47e1ae3af2..a7e3c1d8be 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -518,7 +518,7 @@ void reg_io_q_close(char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return; - prs_debug(ps, depth, desc, "reg_io_q_unknown_1"); + prs_debug(ps, depth, desc, "reg_io_q_close"); depth++; prs_align(ps); @@ -534,7 +534,7 @@ void reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return; - prs_debug(ps, depth, desc, "reg_io_r_unknown_1"); + prs_debug(ps, depth, desc, "reg_io_r_close"); depth++; prs_align(ps); -- cgit From 3d4b2c8b5e258ffba5a5c9bf49796e9750013020 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 18 Aug 1999 20:11:29 +0000 Subject: event log update (This used to be commit bcc1212b07c71256fad93d82a996fa86b27db250) --- source3/rpc_parse/parse_eventlog.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 5173bd2cad..9ebc6287d4 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -27,21 +27,21 @@ extern int DEBUGLEVEL; /******************************************************************* ********************************************************************/ -void make_eventlog_q_open(EVENTLOG_Q_OPEN *q_u, char *journal) +void make_eventlog_q_open(EVENTLOG_Q_OPEN *q_u, char *journal, char *unk) { - q_u->ptr0=0x1; + int len_journal = journal != NULL ? strlen(journal) : 0; + int len_unk = unk != NULL ? strlen(unk) : 0; + q_u->ptr0=0x1; q_u->unk0=0x5c; q_u->unk1=0x01; - q_u->unk2=2*(strlen(journal)+1); - q_u->unk3=2*(strlen(journal)+1); - - q_u->ptr_source=0x01; - make_buf_unistr2(&(q_u->source), &(q_u->ptr_source), journal); + make_uni_hdr(&(q_u->hdr_source), len_journal); + make_unistr2(&(q_u->uni_source), journal, len_journal); + + make_uni_hdr(&(q_u->hdr_unk), len_unk); + make_unistr2(&(q_u->uni_unk), unk, len_unk); - q_u->unk4=0x00; - q_u->unk5=0x00; q_u->unk6=0x01; q_u->unk7=0x01; } @@ -59,16 +59,17 @@ void eventlog_io_q_open(char *desc, EVENTLOG_Q_OPEN *q_u, prs_struct *ps, int de prs_uint16("unk0", ps, depth, &(q_u->unk0)); prs_uint16("unk1", ps, depth, &(q_u->unk1)); - prs_uint16("unk2", ps, depth, &(q_u->unk2)); - prs_uint16("unk3", ps, depth, &(q_u->unk3)); - prs_uint32("ptr_source", ps, depth, &(q_u->ptr_source)); + smb_io_unihdr("hdr_source", &(q_u->hdr_source), ps, depth); + smb_io_unistr2("uni_source", &(q_u->uni_source), + q_u->hdr_source.buffer, ps, depth); + prs_align(ps); - smb_io_unistr2("", &(q_u->source), q_u->ptr_source, ps, depth); + smb_io_unihdr("hdr_unk", &(q_u->hdr_unk), ps, depth); + smb_io_unistr2("uni_unk", &(q_u->uni_unk), + q_u->hdr_unk.buffer, ps, depth); prs_align(ps); - prs_uint32("unk4", ps, depth, &(q_u->unk4)); - prs_uint32("unk5", ps, depth, &(q_u->unk5)); prs_uint32("unk6", ps, depth, &(q_u->unk6)); prs_uint32("unk7", ps, depth, &(q_u->unk7)); } @@ -90,7 +91,6 @@ void eventlog_io_r_open(char *desc, EVENTLOG_R_OPEN *r_u, prs_struct *ps, int de void make_eventlog_q_close(EVENTLOG_Q_CLOSE *q_u, POLICY_HND *pol) { memcpy(&(q_u->pol.data), pol->data, sizeof(q_u->pol.data)); - } /******************************************************************* @@ -102,7 +102,6 @@ void eventlog_io_q_close(char *desc, EVENTLOG_Q_CLOSE *q_u, prs_struct *ps, int prs_align(ps); smb_io_pol_hnd("", &(q_u->pol), ps, depth); - } /******************************************************************* -- cgit From d2d6144253da533fb2f47cae9e0ed008a167585b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 18 Aug 1999 20:33:49 +0000 Subject: event log update, netsessenum, netconnenum update. (This used to be commit 819af560745b0bec7bfb9067dd9d9d6cfabb1555) --- source3/rpc_parse/parse_srv.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 1bcc961853..bf4f63dc4c 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -271,6 +271,8 @@ static void srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struc prs_uint32("switch_value", ps, depth, &(ctr->switch_value)); prs_uint32("ptr_share_ctr", ps, depth, &(ctr->ptr_share_ctr)); + return; + if (ctr->ptr_share_ctr != 0) { switch (ctr->switch_value) @@ -628,6 +630,7 @@ reads or writes a structure. ********************************************************************/ void make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, char *srv_name, char *qual_name, + char *user_name, uint32 sess_level, SRV_SESS_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) @@ -640,6 +643,7 @@ void make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name); make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name); + make_buf_unistr2(&(q_n->uni_user_name), &(q_n->ptr_user_name), user_name); q_n->sess_level = sess_level; q_n->preferred_len = preferred_len; @@ -666,7 +670,10 @@ void srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *p prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name)); smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth); + prs_align(ps); + prs_uint32("ptr_user_name", ps, depth, &(q_n->ptr_user_name)); + smb_io_unistr2("", &(q_n->uni_user_name), q_n->ptr_user_name, ps, depth); prs_align(ps); prs_uint32("sess_level", ps, depth, &(q_n->sess_level )); @@ -1150,7 +1157,7 @@ static void srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct reads or writes a structure. ********************************************************************/ void make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, - char *srv_name, char *qual_name, + char *srv_name, char *qual_name, uint32 file_id, uint32 file_level, SRV_FILE_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) @@ -1164,6 +1171,7 @@ void make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name); make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name); + q_n->file_id = file_id; q_n->file_level = file_level; q_n->preferred_len = preferred_len; @@ -1192,7 +1200,8 @@ void srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *p prs_align(ps); - prs_uint32("file_level", ps, depth, &(q_n->file_level )); + prs_uint32("file_id ", ps, depth, &(q_n->file_id )); + prs_uint32("file_level", ps, depth, &(q_n->file_level)); if (q_n->file_level != -1) { -- cgit From 49b7c8cac36332a1df1f5bbf0cf6a5e7097380f4 Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Mon, 23 Aug 1999 08:54:07 +0000 Subject: Removing a stray return, probably inserted during debugging, which broke NetrShareEnum. Be careful what you commit Luke... (This used to be commit cc27dba003d2f2ebcf05d01a750d3ee9350b0eb7) --- source3/rpc_parse/parse_srv.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index bf4f63dc4c..f04e5eabbc 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -271,8 +271,6 @@ static void srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struc prs_uint32("switch_value", ps, depth, &(ctr->switch_value)); prs_uint32("ptr_share_ctr", ps, depth, &(ctr->ptr_share_ctr)); - return; - if (ctr->ptr_share_ctr != 0) { switch (ctr->switch_value) -- cgit From ddf33698b517967deaa5e620dd65a2670a7779e6 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 12 Sep 1999 22:40:27 +0000 Subject: - initialising mach_passwd_file locks to zero (prev. uninit.) - cleanup - #defined report to sprintf as it's #defined to another function in other uses of cmd_lsarpc.c (This used to be commit 8fb2ff247a2fe0ec5ce0c232d8a3da9774f7e6ae) --- source3/rpc_parse/parse_lsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index dbcc9d8bcc..cff4c027e1 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -493,7 +493,7 @@ void make_q_query_secret(LSA_Q_QUERY_SECRET *q_q, POLICY_HND *pol) { if (q_q == NULL) return; - DEBUG(5,("make_q_query_secret")); + DEBUG(5,("make_q_query_secret\n")); memcpy(&(q_q->pol), pol, sizeof(q_q->pol)); -- cgit From 29ba13f6ea23d9f45bd5d73300c5e208476479db Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 14 Sep 1999 21:42:49 +0000 Subject: wow!!!! this one's been here for two years!!!! alignment issues in smb_io_dom_query() where the string name could mis-align! added a call to prs_align() after the domain string name. (This used to be commit 1d05d2c959f41fffb9a85d161b9b64c957ee90e7) --- source3/rpc_parse/parse_misc.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 4bc44f2038..e46a6e02a5 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1119,6 +1119,8 @@ static void smb_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int de smb_io_unistr2("unistr2", &(d_q->uni_domain_name), d_q->buffer_dom_name, ps, depth); /* domain name (unicode string) */ + prs_align(ps); + if (d_q->buffer_dom_sid != 0) { smb_io_dom_sid2("", &(d_q->dom_sid), ps, depth); /* domain SID */ -- cgit From 0a6eac0b79dd818ca747423c228eca876faf10af Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 21 Sep 1999 21:04:03 +0000 Subject: testing for attempts to get more info levels into samr_query_userinfo (This used to be commit cc19d5cc5c20665beb3b7c5fcf7787d54e37ea71) --- source3/rpc_parse/parse_samr.c | 50 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 2cd818aa0d..ccc9cdc183 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4146,7 +4146,7 @@ void sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int unknown_6 = 0x0000 04ec *************************************************************************/ -void make_sam_user_info_24(SAM_USER_INFO_24 *usr, +void make_sam_user_info24(SAM_USER_INFO_24 *usr, char newpass[516]) { memcpy(usr->pass, newpass, sizeof(usr->pass)); @@ -4155,7 +4155,7 @@ void make_sam_user_info_24(SAM_USER_INFO_24 *usr, /******************************************************************* reads or writes a structure. ********************************************************************/ -static void sam_io_user_info_24(char *desc, SAM_USER_INFO_24 *usr, prs_struct *ps, int depth) +static void sam_io_user_info24(char *desc, SAM_USER_INFO_24 *usr, prs_struct *ps, int depth) { if (usr == NULL) return; @@ -4569,6 +4569,22 @@ void make_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO *r_u, break; } + case 23: + { + r_u->ptr = 1; + r_u->info.id23 = (SAM_USER_INFO_23*)info; + + break; + } + + case 24: + { + r_u->ptr = 1; + r_u->info.id24 = (SAM_USER_INFO_24*)info; + + break; + } + default: { DEBUG(4,("make_samr_r_query_userinfo: unsupported switch level\n")); @@ -4596,7 +4612,7 @@ void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc prs_uint16("switch_value", ps, depth, &(r_u->switch_value)); prs_align(ps); - if (r_u->ptr != 0 && r_u->switch_value != 0) + if (r_u->ptr != 0 && r_u->switch_value != 0 && r_u->info.id != NULL) { switch (r_u->switch_value) { @@ -4641,6 +4657,32 @@ void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc } break; } + case 23: + { + if (r_u->info.id23 != NULL) + { + sam_io_user_info23("", r_u->info.id23, ps, depth); + } + else + { + DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); + return; + } + break; + } + case 24: + { + if (r_u->info.id24 != NULL) + { + sam_io_user_info24("", r_u->info.id24, ps, depth); + } + else + { + DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); + return; + } + break; + } default: { DEBUG(2,("samr_io_r_query_userinfo: unknown switch level\n")); @@ -4727,7 +4769,7 @@ void samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO *q_u, prs_struct *ps DEBUG(2,("samr_io_q_query_userinfo: info pointer not initialised\n")); return; } - sam_io_user_info_24("", q_u->info.id24, ps, depth); + sam_io_user_info24("", q_u->info.id24, ps, depth); break; } case 23: -- cgit From 13266d51155f804527206f2ad125cc28751881af Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Fri, 24 Sep 1999 10:13:38 +0000 Subject: Alan (alanh@pinacl.co.uk) found a nasty bug J.F. (This used to be commit 7dc7801c20d53caef09519231a65403e007344e6) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index a1ee058e06..7b15ba2a42 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2313,7 +2313,7 @@ void spoolss_io_r_enumdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_s for (i=0; inumofdrivers; i++) { - bufsize_required += spoolss_size_printer_driver_info_2(&(driver_info_2[2])); + bufsize_required += spoolss_size_printer_driver_info_2(&(driver_info_2[i])); } break; } -- cgit From 7b88001235e6228ed672541f4afd2b06b610b8e1 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Fri, 24 Sep 1999 14:45:21 +0000 Subject: Correctly handle the dependent files in the printer_driver_info_3 struct It means complex printer drivers should now download fine. J.F. (This used to be commit a893df5c00189d7e81efd619a4a4ee2bd8ead61f) --- source3/rpc_parse/parse_spoolss.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 7b15ba2a42..c66d176c78 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -828,15 +828,25 @@ static void smb_io_relarraystr(char *desc, prs_struct *ps, int depth, UNISTR *** uint32 relative_offset; struct_offset=ps->offset; - while ( (*buffer)[i]!=0x0000 ) + { + i++; + } + + i--; + + /* that's for the ending NULL */ + *end_offset-=2; + + do { *end_offset-= 2*(str_len_uni((*buffer)[i])+1); ps->offset=*end_offset; spoolss_smb_io_unistr(desc, (*buffer)[i], ps, depth); - i++; + i--; } + while (i>=0); ps->offset=struct_offset; relative_offset=*end_offset-*start_offset; @@ -1328,7 +1338,7 @@ static uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) size+=2*(1+ str_len_uni( string[i] ) ); i++; } - size+=4; + size+=6; DEBUGADD(9,("size: [%d]\n", size)); return (size); -- cgit From 65ce93d549d74c33f108e76da5cdd183fcf736de Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 1 Oct 1999 18:44:33 +0000 Subject: splitting dom info into sam_query_dominfo function (This used to be commit 39c367b8e9932f64fa774b807e14416f97254312) --- source3/rpc_parse/parse_samr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ccc9cdc183..e5c015a6b3 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -543,11 +543,12 @@ void samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_str prs_align(ps); prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0)); - prs_uint16("switch_value", ps, depth, &(r_u->switch_value)); - prs_align(ps); if (r_u->ptr_0 != 0 && r_u->ctr != NULL) { + prs_uint16("switch_value", ps, depth, &(r_u->switch_value)); + prs_align(ps); + switch (r_u->switch_value) { case 0x07: -- cgit From cba7662da1fd9ed8bd9f9969417adf1fe5f0d33b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 7 Oct 1999 22:10:29 +0000 Subject: - added rudimentary CAP_UNICODE support because i thought it was part of a problem i was having. - added rudimentary CAP_STATUS32 support for same reason. - added hard-coded, copy-the-same-data-from-over-the-wire version of CAP_EXTENDED_SECURITY, which is a security-blob to encapsulate GSSAPI which encodes SPNEGO which is used to negotiate Kerberos or NTLMSSP. i have implemented NTLMSSP which negotiates NTLMv1 or NTLMv2 and 40-bit or 128-bit etc. i have implemented NTLMv1 / 40-bit. *whew*. (This used to be commit e5b80bd2f76fda70e41e4a9007eb035dab92ed8e) --- source3/rpc_parse/parse_rpc.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 138dbd90b1..19cb4dfa4b 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -702,7 +702,7 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, int dom_len = strlen(domain); int wks_len = strlen(wks ); int usr_len = strlen(user ); - int lm_len = lm_resp != NULL ? 24 : 0; + int lm_len = nt_len != 0 ? (lm_resp != NULL ? 24 : 0) : 1; DEBUG(5,("make_rpc_auth_ntlmssp_resp\n")); @@ -710,9 +710,15 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, #ifdef DEBUG_PASSWORD DEBUG(100,("lm_resp\n")); - dump_data(100, lm_resp, lm_len); + if (lm_resp != NULL) + { + dump_data(100, lm_resp, lm_len); + } DEBUG(100,("nt_resp\n")); - dump_data(100, nt_resp, nt_len); + if (nt_resp != NULL) + { + dump_data(100, nt_resp, nt_len); + } #endif DEBUG(6,("dom: %s user: %s wks: %s neg_flgs: 0x%x\n", @@ -746,8 +752,22 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, rsp->neg_flags = neg_flags; - memcpy(rsp->lm_resp, lm_resp, lm_len); - memcpy(rsp->nt_resp, nt_resp, nt_len); + if (lm_resp != NULL && lm_len != 1) + { + memcpy(rsp->lm_resp, lm_resp, lm_len); + } + else + { + rsp->lm_resp[0] = 0; + } + if (nt_resp != NULL) + { + memcpy(rsp->nt_resp, nt_resp, nt_len); + } + else + { + rsp->nt_resp[0] = 0; + } if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { -- cgit From dcea4bfd0fce7bced156f859c792ac51a7c0ad0b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 14 Oct 1999 19:21:23 +0000 Subject: stop over-runs in reading / writing data stream. (This used to be commit 144fd01f37bde420234ca474014b0f378d9f8975) --- source3/rpc_parse/parse_prs.c | 69 +++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 25 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index c55ec9c225..4e007ce07c 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -170,10 +170,13 @@ BOOL prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *data8s, int len) { char *q = mem_data(&(ps->data), ps->offset); - if (q == NULL) return False; + int end_offset = ps->offset + len * sizeof(uint8); + char *e = mem_data(&(ps->data), end_offset-1); + + if (q == NULL || e == NULL) return False; DBG_RW_PCVAL(charmode, name, depth, ps->offset, ps->io, q, data8s, len) - ps->offset += len; + ps->offset = end_offset; return True; } @@ -184,10 +187,13 @@ BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *dat BOOL prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len) { char *q = mem_data(&(ps->data), ps->offset); - if (q == NULL) return False; + int end_offset = ps->offset + len * sizeof(uint16); + char *e = mem_data(&(ps->data), end_offset-1); + + if (q == NULL || e == NULL) return False; DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, data16s, len) - ps->offset += len * sizeof(uint16); + ps->offset = end_offset; return True; } @@ -198,10 +204,13 @@ BOOL prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *d BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *data32s, int len) { char *q = mem_data(&(ps->data), ps->offset); - if (q == NULL) return False; + int end_offset = ps->offset + len * sizeof(uint32); + char *e = mem_data(&(ps->data), end_offset-1); + + if (q == NULL || e == NULL) return False; DBG_RW_PIVAL(charmode, name, depth, ps->offset, ps->io, q, data32s, len) - ps->offset += len * sizeof(uint32); + ps->offset = end_offset; return True; } @@ -213,10 +222,13 @@ BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *d BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 *str) { char *q = mem_data(&(ps->data), ps->offset); - if (q == NULL) return False; + int end_offset = ps->offset + str->buf_len; + char *e = mem_data(&(ps->data), end_offset-1); + + if (q == NULL || e == NULL) return False; DBG_RW_PCVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->buf_len) - ps->offset += str->buf_len; + ps->offset = end_offset; return True; } @@ -228,10 +240,13 @@ BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 * BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 *str) { char *q = mem_data(&(ps->data), ps->offset); - if (q == NULL) return False; + int end_offset = ps->offset + str->str_str_len * sizeof(uint8); + char *e = mem_data(&(ps->data), end_offset-1); + + if (q == NULL || e == NULL) return False; DBG_RW_PCVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->str_max_len) - ps->offset += str->str_str_len * sizeof(uint8); + ps->offset = end_offset; return True; } @@ -243,10 +258,13 @@ BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 * BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *str) { char *q = mem_data(&(ps->data), ps->offset); - if (q == NULL) return False; + int end_offset = ps->offset + str->uni_str_len * sizeof(uint16); + char *e = mem_data(&(ps->data), end_offset-1); + + if (q == NULL || e == NULL) return False; DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->uni_str_len) - ps->offset += str->uni_str_len * sizeof(uint16); + ps->offset = end_offset; return True; } @@ -258,10 +276,13 @@ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 * BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int depth) { char *q = mem_data(&(ps->data), ps->offset); - if (q == NULL) return False; + int end_offset = ps->offset + str->uni_str_len * sizeof(uint16); + char *e = mem_data(&(ps->data), end_offset-1); + + if (q == NULL || e == NULL) return False; DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->str.buffer, str->uni_str_len) - ps->offset += str->uni_str_len * sizeof(uint16); + ps->offset = end_offset; return True; } @@ -271,17 +292,16 @@ BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int de ********************************************************************/ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) { - char *q = mem_data(&(ps->data), ps->offset); int i = -1; - uint8 *start = (uint8*)q; - - if (q == NULL) return False; + uint8 *start = (uint8*)mem_data(&(ps->data), ps->offset); do { + char *q; i++; + q = mem_data(&(ps->data), ps->offset + i*2); + if (q == NULL) return False; RW_SVAL(ps->io, q, str->buffer[i],0); - q += 2; } while ((i < sizeof(str->buffer) / sizeof(str->buffer[0])) && (str->buffer[i] != 0)); @@ -304,16 +324,17 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) ********************************************************************/ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, uint16 max_buf_size) { - char *q = mem_data(&(ps->data), ps->offset); - uint8 *start = (uint8*)q; + uint8 *start = (uint8*)mem_data(&(ps->data), ps->offset); int i = -1; /* start off at zero after 1st i++ */ - if (q == NULL) return False; - do { + char *q; i++; + q = mem_data(&(ps->data), ps->offset + i); + if (q == NULL) return False; + if (i < len || len == 0) { RW_CVAL(ps->io, q, str[i],0); @@ -324,8 +345,6 @@ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, ui RW_CVAL(ps->io, q, dummy,0); } - q++; - } while (i < max_buf_size && (len == 0 ? str[i] != 0 : i < len) ); ps->offset += i+1; -- cgit From 896ecb48cab1d928224387f06ec63584bc6c6e99 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 15 Oct 1999 18:46:22 +0000 Subject: return results on prs_xxxxx() and all xxx_io_xxx() routines. the whole task is not complete, yet. xxx_io_xxx() routines that _call_ xxx_io_xxx() routines not done. prs_xxxx() covered by macros. considering doing xxx_io_xxxx in the same way. (This used to be commit 3b583f7be51434af98bc52b48dfa42c4602a3094) --- source3/rpc_parse/parse_at.c | 72 +- source3/rpc_parse/parse_eventlog.c | 56 +- source3/rpc_parse/parse_lsa.c | 242 ++++--- source3/rpc_parse/parse_misc.c | 340 +++++++--- source3/rpc_parse/parse_net.c | 294 ++++++--- source3/rpc_parse/parse_prs.c | 42 +- source3/rpc_parse/parse_reg.c | 317 ++++++--- source3/rpc_parse/parse_rpc.c | 192 ++++-- source3/rpc_parse/parse_samr.c | 1261 ++++++++++++++++++++++++------------ source3/rpc_parse/parse_sec.c | 86 ++- source3/rpc_parse/parse_spoolss.c | 517 +++++++++++---- source3/rpc_parse/parse_srv.c | 384 +++++++---- source3/rpc_parse/parse_svc.c | 162 +++-- source3/rpc_parse/parse_wks.c | 36 +- 14 files changed, 2712 insertions(+), 1289 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_at.c b/source3/rpc_parse/parse_at.c index 2eb72c8aea..87507230c0 100644 --- a/source3/rpc_parse/parse_at.c +++ b/source3/rpc_parse/parse_at.c @@ -28,7 +28,7 @@ extern int DEBUGLEVEL; /******************************************************************* make_at_q_add_job ********************************************************************/ -void make_at_q_add_job(AT_Q_ADD_JOB *q_a, char *server, +BOOL make_at_q_add_job(AT_Q_ADD_JOB *q_a, char *server, AT_JOB_INFO *info, char *command) { DEBUG(5,("make_at_q_add_job\n")); @@ -36,14 +36,16 @@ void make_at_q_add_job(AT_Q_ADD_JOB *q_a, char *server, make_buf_unistr2(&(q_a->uni_srv_name), &(q_a->ptr_srv_name), server); memcpy(&(q_a->info), info, sizeof(q_a->info)); make_unistr2(&(q_a->command), command, strlen(command)+1); + + return True; } /******************************************************************* reads or writes a AT_JOB_INFO structure. ********************************************************************/ -void at_io_job_info(char *desc, AT_JOB_INFO *info, prs_struct *ps, int depth) +BOOL at_io_job_info(char *desc, AT_JOB_INFO *info, prs_struct *ps, int depth) { - if (info == NULL) return; + if (info == NULL) return False; prs_debug(ps, depth, desc, "at_io_job_info"); depth++; @@ -57,14 +59,16 @@ void at_io_job_info(char *desc, AT_JOB_INFO *info, prs_struct *ps, int depth) prs_align(ps); prs_uint32("ptr_command", ps, depth, &(info->ptr_command)); + + return True; } /******************************************************************* reads or writes a AT_Q_ADD_JOB structure. ********************************************************************/ -void at_io_q_add_job(char *desc, AT_Q_ADD_JOB *q_a, prs_struct *ps, int depth) +BOOL at_io_q_add_job(char *desc, AT_Q_ADD_JOB *q_a, prs_struct *ps, int depth) { - if (q_a == NULL) return; + if (q_a == NULL) return False; prs_debug(ps, depth, desc, "at_q_add_job"); depth++; @@ -74,14 +78,16 @@ void at_io_q_add_job(char *desc, AT_Q_ADD_JOB *q_a, prs_struct *ps, int depth) smb_io_unistr2("", &(q_a->uni_srv_name), q_a->ptr_srv_name, ps, depth); at_io_job_info("", &(q_a->info), ps, depth); smb_io_unistr2("", &(q_a->command), q_a->info.ptr_command, ps, depth); + + return True; } /******************************************************************* reads or writes a AT_R_ADD_JOB structure. ********************************************************************/ -void at_io_r_add_job(char *desc, AT_R_ADD_JOB *r_a, prs_struct *ps, int depth) +BOOL at_io_r_add_job(char *desc, AT_R_ADD_JOB *r_a, prs_struct *ps, int depth) { - if (r_a == NULL) return; + if (r_a == NULL) return False; prs_debug(ps, depth, desc, "at_r_add_job"); depth++; @@ -89,12 +95,14 @@ void at_io_r_add_job(char *desc, AT_R_ADD_JOB *r_a, prs_struct *ps, int depth) prs_align(ps); prs_uint32("jobid", ps, depth, &(r_a->jobid)); prs_uint32("status", ps, depth, &(r_a->status)); + + return True; } /******************************************************************* make_at_q_del_job ********************************************************************/ -void make_at_q_del_job(AT_Q_DEL_JOB *q_a, char *server, uint32 min_jobid, +BOOL make_at_q_del_job(AT_Q_DEL_JOB *q_a, char *server, uint32 min_jobid, uint32 max_jobid) { DEBUG(5,("make_at_q_del_job\n")); @@ -102,14 +110,16 @@ void make_at_q_del_job(AT_Q_DEL_JOB *q_a, char *server, uint32 min_jobid, make_buf_unistr2(&(q_a->uni_srv_name), &(q_a->ptr_srv_name), server); q_a->min_jobid = min_jobid; q_a->max_jobid = max_jobid; + + return True; } /******************************************************************* reads or writes a AT_Q_DEL_JOB structure. ********************************************************************/ -void at_io_q_del_job(char *desc, AT_Q_DEL_JOB *q_d, prs_struct *ps, int depth) +BOOL at_io_q_del_job(char *desc, AT_Q_DEL_JOB *q_d, prs_struct *ps, int depth) { - if (q_d == NULL) return; + if (q_d == NULL) return False; prs_debug(ps, depth, desc, "at_q_del_job"); depth++; @@ -121,26 +131,30 @@ void at_io_q_del_job(char *desc, AT_Q_DEL_JOB *q_d, prs_struct *ps, int depth) prs_align(ps); prs_uint32("min_jobid", ps, depth, &(q_d->min_jobid)); prs_uint32("max_jobid", ps, depth, &(q_d->max_jobid)); + + return True; } /******************************************************************* reads or writes a AT_R_DEL_JOB structure. ********************************************************************/ -void at_io_r_del_job(char *desc, AT_R_DEL_JOB *r_d, prs_struct *ps, int depth) +BOOL at_io_r_del_job(char *desc, AT_R_DEL_JOB *r_d, prs_struct *ps, int depth) { - if (r_d == NULL) return; + if (r_d == NULL) return False; prs_debug(ps, depth, desc, "at_r_del_job"); depth++; prs_align(ps); prs_uint32("status", ps, depth, &(r_d->status)); + + return True; } /******************************************************************* make_at_q_enum_jobs ********************************************************************/ -void make_at_q_enum_jobs(AT_Q_ENUM_JOBS *q_e, char *server) +BOOL make_at_q_enum_jobs(AT_Q_ENUM_JOBS *q_e, char *server) { DEBUG(5,("make_at_q_enum_jobs\n")); @@ -150,14 +164,16 @@ void make_at_q_enum_jobs(AT_Q_ENUM_JOBS *q_e, char *server) q_e->max_len = 0xffff; q_e->ptr_resume = 1; q_e->hnd_resume = 0; + + return True; } /******************************************************************* reads or writes a AT_Q_ENUM_JOBS structure. ********************************************************************/ -void at_io_q_enum_jobs(char *desc, AT_Q_ENUM_JOBS *q_e, prs_struct *ps, int depth) +BOOL at_io_q_enum_jobs(char *desc, AT_Q_ENUM_JOBS *q_e, prs_struct *ps, int depth) { - if (q_e == NULL) return; + if (q_e == NULL) return False; prs_debug(ps, depth, desc, "at_q_enum_jobs"); depth++; @@ -172,14 +188,16 @@ void at_io_q_enum_jobs(char *desc, AT_Q_ENUM_JOBS *q_e, prs_struct *ps, int dept prs_uint32("ptr_resume", ps, depth, &(q_e->ptr_resume)); prs_uint32("hnd_resume", ps, depth, &(q_e->hnd_resume)); + + return True; } /******************************************************************* reads or writes a AT_R_ENUM_JOBS structure. ********************************************************************/ -void at_io_r_enum_jobs(char *desc, AT_R_ENUM_JOBS *r_e, prs_struct *ps, int depth) +BOOL at_io_r_enum_jobs(char *desc, AT_R_ENUM_JOBS *r_e, prs_struct *ps, int depth) { - if (r_e == NULL) return; + if (r_e == NULL) return False; prs_debug(ps, depth, desc, "at_r_enum_jobs"); depth++; @@ -196,7 +214,7 @@ void at_io_r_enum_jobs(char *desc, AT_R_ENUM_JOBS *r_e, prs_struct *ps, int dept if (r_e->num_entries2 != r_e->num_entries) { /* RPC fault */ - return; + return False; } SMB_ASSERT_ARRAY(r_e->info, r_e->num_entries2); @@ -222,25 +240,29 @@ void at_io_r_enum_jobs(char *desc, AT_R_ENUM_JOBS *r_e, prs_struct *ps, int dept prs_uint32("hnd_resume" , ps, depth, &(r_e->hnd_resume )); prs_uint32("status", ps, depth, &(r_e->status)); + + return True; } /******************************************************************* make_at_q_query_job ********************************************************************/ -void make_at_q_query_job(AT_Q_QUERY_JOB *q_q, char *server, uint32 jobid) +BOOL make_at_q_query_job(AT_Q_QUERY_JOB *q_q, char *server, uint32 jobid) { DEBUG(5,("make_at_q_query_job\n")); make_buf_unistr2(&(q_q->uni_srv_name), &(q_q->ptr_srv_name), server); q_q->jobid = jobid; + + return True; } /******************************************************************* reads or writes a AT_Q_QUERY_JOB structure. ********************************************************************/ -void at_io_q_query_job(char *desc, AT_Q_QUERY_JOB *q_q, prs_struct *ps, int depth) +BOOL at_io_q_query_job(char *desc, AT_Q_QUERY_JOB *q_q, prs_struct *ps, int depth) { - if (q_q == NULL) return; + if (q_q == NULL) return False; prs_debug(ps, depth, desc, "at_q_query_job"); depth++; @@ -250,14 +272,16 @@ void at_io_q_query_job(char *desc, AT_Q_QUERY_JOB *q_q, prs_struct *ps, int dept smb_io_unistr2("", &(q_q->uni_srv_name), q_q->ptr_srv_name, ps, depth); prs_align(ps); prs_uint32("jobid", ps, depth, &(q_q->jobid)); + + return True; } /******************************************************************* reads or writes a AT_R_QUERY_JOB structure. ********************************************************************/ -void at_io_r_query_job(char *desc, AT_R_QUERY_JOB *r_q, prs_struct *ps, int depth) +BOOL at_io_r_query_job(char *desc, AT_R_QUERY_JOB *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "at_r_query_job"); depth++; @@ -272,4 +296,6 @@ void at_io_r_query_job(char *desc, AT_R_QUERY_JOB *r_q, prs_struct *ps, int dept prs_align(ps); prs_uint32("status", ps, depth, &(r_q->status)); + + return True; } diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 9ebc6287d4..6cf476711d 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -2,8 +2,8 @@ * Unix SMB/Netbios implementation. * Version 1.9. * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1998, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, + * Copyright (C) Andrew Tridgell 1992-1999, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, * Copyright (C) Jean Franois Micouleau 1998-1999. * * This program is free software; you can redistribute it and/or modify @@ -27,7 +27,7 @@ extern int DEBUGLEVEL; /******************************************************************* ********************************************************************/ -void make_eventlog_q_open(EVENTLOG_Q_OPEN *q_u, char *journal, char *unk) +BOOL make_eventlog_q_open(EVENTLOG_Q_OPEN *q_u, char *journal, char *unk) { int len_journal = journal != NULL ? strlen(journal) : 0; int len_unk = unk != NULL ? strlen(unk) : 0; @@ -44,11 +44,13 @@ void make_eventlog_q_open(EVENTLOG_Q_OPEN *q_u, char *journal, char *unk) q_u->unk6=0x01; q_u->unk7=0x01; + + return True; } /******************************************************************* ********************************************************************/ -void eventlog_io_q_open(char *desc, EVENTLOG_Q_OPEN *q_u, prs_struct *ps, int depth) +BOOL eventlog_io_q_open(char *desc, EVENTLOG_Q_OPEN *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "eventlog_io_q_open"); depth++; @@ -72,11 +74,13 @@ void eventlog_io_q_open(char *desc, EVENTLOG_Q_OPEN *q_u, prs_struct *ps, int de prs_uint32("unk6", ps, depth, &(q_u->unk6)); prs_uint32("unk7", ps, depth, &(q_u->unk7)); + + return True; } /******************************************************************* ********************************************************************/ -void eventlog_io_r_open(char *desc, EVENTLOG_R_OPEN *r_u, prs_struct *ps, int depth) +BOOL eventlog_io_r_open(char *desc, EVENTLOG_R_OPEN *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "eventlog_io_r_open"); depth++; @@ -84,29 +88,35 @@ void eventlog_io_r_open(char *desc, EVENTLOG_R_OPEN *r_u, prs_struct *ps, int de prs_align(ps); smb_io_pol_hnd("", &(r_u->pol), ps, depth); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void make_eventlog_q_close(EVENTLOG_Q_CLOSE *q_u, POLICY_HND *pol) +BOOL make_eventlog_q_close(EVENTLOG_Q_CLOSE *q_u, POLICY_HND *pol) { memcpy(&(q_u->pol.data), pol->data, sizeof(q_u->pol.data)); + + return True; } /******************************************************************* ********************************************************************/ -void eventlog_io_q_close(char *desc, EVENTLOG_Q_CLOSE *q_u, prs_struct *ps, int depth) +BOOL eventlog_io_q_close(char *desc, EVENTLOG_Q_CLOSE *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "eventlog_io_q_close"); depth++; prs_align(ps); smb_io_pol_hnd("", &(q_u->pol), ps, depth); + + return True; } /******************************************************************* ********************************************************************/ -void eventlog_io_r_close(char *desc, EVENTLOG_R_CLOSE *r_u, prs_struct *ps, int depth) +BOOL eventlog_io_r_close(char *desc, EVENTLOG_R_CLOSE *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "eventlog_io_r_close"); depth++; @@ -114,19 +124,23 @@ void eventlog_io_r_close(char *desc, EVENTLOG_R_CLOSE *r_u, prs_struct *ps, int prs_align(ps); smb_io_pol_hnd("", &(r_u->pol), ps, depth); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void make_eventlog_q_numofeventlogrec(EVENTLOG_Q_NUMOFEVENTLOGREC *q_u, POLICY_HND *pol) +BOOL make_eventlog_q_numofeventlogrec(EVENTLOG_Q_NUMOFEVENTLOGREC *q_u, POLICY_HND *pol) { memcpy(&(q_u->pol.data), pol->data, sizeof(q_u->pol.data)); + + return True; } /******************************************************************* ********************************************************************/ -void eventlog_io_q_numofeventlogrec(char *desc,EVENTLOG_Q_NUMOFEVENTLOGREC *q_u, prs_struct *ps, int depth) +BOOL eventlog_io_q_numofeventlogrec(char *desc,EVENTLOG_Q_NUMOFEVENTLOGREC *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "eventlog_io_q_numofeventlogrec"); depth++; @@ -134,11 +148,13 @@ void eventlog_io_q_numofeventlogrec(char *desc,EVENTLOG_Q_NUMOFEVENTLOGREC *q_u prs_align(ps); smb_io_pol_hnd("", &(q_u->pol), ps, depth); + + return True; } /******************************************************************* ********************************************************************/ -void eventlog_io_r_numofeventlogrec(char *desc, EVENTLOG_R_NUMOFEVENTLOGREC *r_u, prs_struct *ps, int depth) +BOOL eventlog_io_r_numofeventlogrec(char *desc, EVENTLOG_R_NUMOFEVENTLOGREC *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "eventlog_io_r_numofeventlogrec"); depth++; @@ -146,22 +162,26 @@ void eventlog_io_r_numofeventlogrec(char *desc, EVENTLOG_R_NUMOFEVENTLOGREC *r_u prs_align(ps); prs_uint32("number", ps, depth, &(r_u->number)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void make_eventlog_q_readeventlog(EVENTLOG_Q_READEVENTLOG *q_u, POLICY_HND *pol, +BOOL make_eventlog_q_readeventlog(EVENTLOG_Q_READEVENTLOG *q_u, POLICY_HND *pol, uint32 flags, uint32 offset, uint32 number_of_bytes) { memcpy(&(q_u->pol.data), pol->data, sizeof(q_u->pol.data)); q_u->flags=flags; q_u->offset=offset; q_u->number_of_bytes=number_of_bytes; + + return True; } /******************************************************************* ********************************************************************/ -void eventlog_io_q_readeventlog(char *desc, EVENTLOG_Q_READEVENTLOG *q_u, prs_struct *ps, int depth) +BOOL eventlog_io_q_readeventlog(char *desc, EVENTLOG_Q_READEVENTLOG *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "eventlog_io_q_readeventlog"); depth++; @@ -171,11 +191,13 @@ void eventlog_io_q_readeventlog(char *desc, EVENTLOG_Q_READEVENTLOG *q_u, prs_st prs_uint32("flags", ps, depth, &(q_u->flags)); prs_uint32("offset", ps, depth, &(q_u->offset)); prs_uint32("number_of_bytes", ps, depth, &(q_u->number_of_bytes)); + + return True; } /******************************************************************* ********************************************************************/ -static void eventlog_io_eventlog(char *desc, EVENTLOGRECORD *ev, prs_struct *ps, int depth) +static BOOL eventlog_io_eventlog(char *desc, EVENTLOGRECORD *ev, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "eventlog_io_eventlog"); depth++; @@ -213,11 +235,13 @@ static void eventlog_io_eventlog(char *desc, EVENTLOGRECORD *ev, prs_struct *ps, smb_io_unistr("", &(ev->data), ps, depth); prs_uint32("size2", ps, depth, &(ev->size2)); + + return True; } /******************************************************************* ********************************************************************/ -void eventlog_io_r_readeventlog(char *desc, EVENTLOG_R_READEVENTLOG *r_u, prs_struct *ps, int depth) +BOOL eventlog_io_r_readeventlog(char *desc, EVENTLOG_R_READEVENTLOG *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "eventlog_io_r_readeventlog"); depth++; @@ -231,5 +255,7 @@ void eventlog_io_r_readeventlog(char *desc, EVENTLOG_R_READEVENTLOG *r_u, prs_st prs_uint32("sent_size", ps, depth, &(r_u->sent_size)); prs_uint32("real_size", ps, depth, &(r_u->real_size)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index cff4c027e1..1f194aa874 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2,9 +2,9 @@ * Unix SMB/Netbios implementation. * Version 1.9. * 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 Tridgell 1992-1999, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, + * Copyright (C) Paul Ashton 1997-1999. * * 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 @@ -29,7 +29,7 @@ extern int DEBUGLEVEL; /******************************************************************* creates a LSA_TRANS_NAME structure. ********************************************************************/ -void make_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, +BOOL make_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, uint32 sid_name_use, char *name, uint32 idx) { int len_name = strlen(name); @@ -38,14 +38,16 @@ void make_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, make_uni_hdr(&(trn->hdr_name), len_name); make_unistr2(uni_name, name, len_name); trn->domain_idx = idx; + + return True; } /******************************************************************* reads or writes a LSA_TRANS_NAME structure. ********************************************************************/ -static void lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, int depth) +static BOOL lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, int depth) { - if (trn == NULL) return; + if (trn == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_trans_name"); depth++; @@ -55,19 +57,21 @@ static void lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, i prs_uint32("sid_name_use", ps, depth, &(trn->sid_name_use)); smb_io_unihdr ("hdr_name", &(trn->hdr_name), ps, depth); prs_uint32("domain_idx ", ps, depth, &(trn->domain_idx )); + + return True; } /******************************************************************* reads or writes a DOM_R_REF structure. ********************************************************************/ -static void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) +static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) { int i, s, n; prs_debug(ps, depth, desc, "smb_io_dom_r_ref"); depth++; - if (r_r == NULL) return; + if (r_r == NULL) return False; prs_align(ps); @@ -112,16 +116,18 @@ static void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int de } } } + + return True; } /******************************************************************* makes an LSA_SEC_QOS structure. ********************************************************************/ -void make_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff, +BOOL make_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff, uint32 unknown) { - if (qos == NULL) return; + if (qos == NULL) return False; DEBUG(5,("make_lsa_sec_qos\n")); @@ -130,16 +136,18 @@ void make_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff, qos->sec_ctxt_mode = ctxt; qos->effective_only = eff; qos->unknown = unknown; + + return True; } /******************************************************************* reads or writes an LSA_SEC_QOS structure. ********************************************************************/ -static void lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int depth) +static BOOL lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int depth) { int start; - if (qos == NULL) return; + if (qos == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_obj_qos"); depth++; @@ -162,15 +170,17 @@ static void lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int de DEBUG(3,("lsa_io_sec_qos: length %x does not match size %x\n", qos->len, ps->offset - start)); } + + return True; } /******************************************************************* makes an LSA_OBJ_ATTR structure. ********************************************************************/ -void make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos) +BOOL make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos) { - if (attr == NULL) return; + if (attr == NULL) return False; DEBUG(5,("make_lsa_obj_attr\n")); @@ -190,16 +200,18 @@ void make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos) attr->ptr_sec_qos = 0; attr->sec_qos = NULL; } + + return True; } /******************************************************************* reads or writes an LSA_OBJ_ATTR structure. ********************************************************************/ -static void lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int depth) +static BOOL lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int depth) { int start; - if (attr == NULL) return; + if (attr == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_obj_attr"); depth++; @@ -228,18 +240,20 @@ static void lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int { lsa_io_sec_qos("sec_qos", attr->sec_qos, ps, depth); } + + return True; } /******************************************************************* makes an LSA_Q_OPEN_POL structure. ********************************************************************/ -void make_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name, +BOOL make_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name, uint32 attributes, uint32 desired_access, LSA_SEC_QOS *qos) { - if (r_q == NULL) return; + if (r_q == NULL) return False; DEBUG(5,("make_open_pol: attr:%d da:%d\n", attributes, desired_access)); @@ -252,14 +266,16 @@ void make_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name, r_q->system_name = system_name; make_lsa_obj_attr(&(r_q->attr ), attributes, qos); + + return True; } /******************************************************************* reads or writes an LSA_Q_OPEN_POL structure. ********************************************************************/ -void lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int depth) +BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_q_open_pol"); depth++; @@ -274,14 +290,16 @@ void lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int dep { prs_uint32("des_access", ps, depth, &(r_q->des_access)); } + + return True; } /******************************************************************* reads or writes an LSA_R_OPEN_POL structure. ********************************************************************/ -void lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int depth) +BOOL lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int depth) { - if (r_p == NULL) return; + if (r_p == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_r_open_pol"); depth++; @@ -289,17 +307,19 @@ void lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int dep smb_io_pol_hnd("", &(r_p->pol), ps, depth); prs_uint32("status", ps, depth, &(r_p->status)); + + return True; } /******************************************************************* makes an LSA_Q_OPEN_POL2 structure. ********************************************************************/ -void make_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, +BOOL make_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, uint32 attributes, uint32 desired_access, LSA_SEC_QOS *qos) { - if (r_q == NULL) return; + if (r_q == NULL) return False; DEBUG(5,("make_open_pol2: attr:%d da:%d\n", attributes, desired_access)); @@ -312,14 +332,16 @@ void make_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, make_unistr2 (&(r_q->uni_server_name), server_name, strlen(server_name)); make_lsa_obj_attr(&(r_q->attr ), attributes, qos); + + return True; } /******************************************************************* reads or writes an LSA_Q_OPEN_POL2 structure. ********************************************************************/ -void lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, int depth) +BOOL lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_q_open_pol2"); depth++; @@ -333,14 +355,16 @@ void lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, int d { prs_uint32("des_access", ps, depth, &(r_q->des_access)); } + + return True; } /******************************************************************* reads or writes an LSA_R_OPEN_POL2 structure. ********************************************************************/ -void lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int depth) +BOOL lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int depth) { - if (r_p == NULL) return; + if (r_p == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_r_open_pol2"); depth++; @@ -348,28 +372,34 @@ void lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int d smb_io_pol_hnd("", &(r_p->pol), ps, depth); prs_uint32("status", ps, depth, &(r_p->status)); + + return True; + + return True; } /******************************************************************* makes an LSA_Q_QUERY_INFO structure. ********************************************************************/ -void make_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class) +BOOL make_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class) { - if (q_q == NULL || hnd == NULL) return; + if (q_q == NULL || hnd == NULL) return False; DEBUG(5,("make_q_query\n")); memcpy(&(q_q->pol), hnd, sizeof(q_q->pol)); q_q->info_class = info_class; + + return True; } /******************************************************************* reads or writes an LSA_Q_QUERY_INFO structure. ********************************************************************/ -void lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int depth) +BOOL lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int depth) { - if (q_q == NULL) return; + if (q_q == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_q_query"); depth++; @@ -377,17 +407,19 @@ void lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int dept smb_io_pol_hnd("", &(q_q->pol), ps, depth); prs_uint16("info_class", ps, depth, &(q_q->info_class)); + + return True; } /******************************************************************* makes an LSA_Q_OPEN_SECRET structure. ********************************************************************/ -void make_q_open_secret(LSA_Q_OPEN_SECRET *q_o, POLICY_HND *pol_hnd, +BOOL make_q_open_secret(LSA_Q_OPEN_SECRET *q_o, POLICY_HND *pol_hnd, char *secret_name, uint32 desired_access) { int len = strlen(secret_name); - if (q_o == NULL) return; + if (q_o == NULL) return False; DEBUG(5,("make_q_open_secret")); @@ -397,14 +429,16 @@ void make_q_open_secret(LSA_Q_OPEN_SECRET *q_o, POLICY_HND *pol_hnd, make_unistr2(&(q_o->uni_secret), secret_name, len); q_o->des_access = desired_access; + + return True; } /******************************************************************* reads or writes an LSA_Q_OPEN_SECRET structure. ********************************************************************/ -void lsa_io_q_open_secret(char *desc, LSA_Q_OPEN_SECRET *q_o, prs_struct *ps, int depth) +BOOL lsa_io_q_open_secret(char *desc, LSA_Q_OPEN_SECRET *q_o, prs_struct *ps, int depth) { - if (q_o == NULL) return; + if (q_o == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_q_open_secret"); depth++; @@ -417,14 +451,16 @@ void lsa_io_q_open_secret(char *desc, LSA_Q_OPEN_SECRET *q_o, prs_struct *ps, in prs_align(ps); prs_uint32("des_access", ps, depth, &(q_o->des_access)); + + return True; } /******************************************************************* reads or writes an LSA_R_OPEN_SECRET structure. ********************************************************************/ -void lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_o, prs_struct *ps, int depth) +BOOL lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_o, prs_struct *ps, int depth) { - if (r_o == NULL) return; + if (r_o == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_r_open_secret"); depth++; @@ -432,14 +468,16 @@ void lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_o, prs_struct *ps, in smb_io_pol_hnd("", &(r_o->pol), ps, depth); prs_uint32("status", ps, depth, &(r_o->status)); + + return True; } /******************************************************************* reads or writes an LSA_SECRET_VALUE structure. ********************************************************************/ -void lsa_io_secret_value(char *desc, LSA_SECRET_VALUE *value, prs_struct *ps, int depth) +BOOL lsa_io_secret_value(char *desc, LSA_SECRET_VALUE *value, prs_struct *ps, int depth) { - if (value == NULL) return; + if (value == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_secret_value"); depth++; @@ -453,14 +491,16 @@ void lsa_io_secret_value(char *desc, LSA_SECRET_VALUE *value, prs_struct *ps, in smb_io_string2("secret" , &(value->enc_secret), value->hdr_secret.buffer, ps, depth); } + + return True; } /******************************************************************* reads or writes an LSA_SECRET_INFO structure. ********************************************************************/ -void lsa_io_secret_info(char *desc, LSA_SECRET_INFO *info, prs_struct *ps, int depth) +BOOL lsa_io_secret_info(char *desc, LSA_SECRET_INFO *info, prs_struct *ps, int depth) { - if (info == NULL) return; + if (info == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_secret_info"); depth++; @@ -484,14 +524,16 @@ void lsa_io_secret_info(char *desc, LSA_SECRET_INFO *info, prs_struct *ps, int d smb_io_time("last_update", &(info->last_update), ps, depth); } + + return True; } /******************************************************************* makes an LSA_Q_QUERY_SECRET structure. ********************************************************************/ -void make_q_query_secret(LSA_Q_QUERY_SECRET *q_q, POLICY_HND *pol) +BOOL make_q_query_secret(LSA_Q_QUERY_SECRET *q_q, POLICY_HND *pol) { - if (q_q == NULL) return; + if (q_q == NULL) return False; DEBUG(5,("make_q_query_secret\n")); @@ -507,14 +549,16 @@ void make_q_query_secret(LSA_Q_QUERY_SECRET *q_q, POLICY_HND *pol) /* Don't care about old info */ q_q->oldinfo.ptr_value = 0; q_q->oldinfo.ptr_update = 0; + + return True; } /******************************************************************* reads or writes an LSA_Q_QUERY_SECRET structure. ********************************************************************/ -void lsa_io_q_query_secret(char *desc, LSA_Q_QUERY_SECRET *q_q, prs_struct *ps, int depth) +BOOL lsa_io_q_query_secret(char *desc, LSA_Q_QUERY_SECRET *q_q, prs_struct *ps, int depth) { - if (q_q == NULL) return; + if (q_q == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_q_query_secret"); depth++; @@ -523,14 +567,16 @@ void lsa_io_q_query_secret(char *desc, LSA_Q_QUERY_SECRET *q_q, prs_struct *ps, lsa_io_secret_info("", &(q_q->info ), ps, depth); lsa_io_secret_info("", &(q_q->oldinfo), ps, depth); + + return True; } /******************************************************************* reads or writes an LSA_Q_QUERY_SECRET structure. ********************************************************************/ -void lsa_io_r_query_secret(char *desc, LSA_R_QUERY_SECRET *r_q, prs_struct *ps, int depth) +BOOL lsa_io_r_query_secret(char *desc, LSA_R_QUERY_SECRET *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_r_query_secret"); depth++; @@ -540,14 +586,16 @@ void lsa_io_r_query_secret(char *desc, LSA_R_QUERY_SECRET *r_q, prs_struct *ps, prs_align(ps); prs_uint32("status", ps, depth, &(r_q->status)); + + return True; } /******************************************************************* reads or writes an LSA_Q_ENUM_TRUST_DOM structure. ********************************************************************/ -void lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct *ps, int depth) +BOOL lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct *ps, int depth) { - if (q_e == NULL) return; + if (q_e == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_q_enum_trust_dom"); depth++; @@ -557,16 +605,18 @@ void lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct prs_uint32("enum_context ", ps, depth, &(q_e->enum_context )); prs_uint32("preferred_len", ps, depth, &(q_e->preferred_len)); + + return True; } /******************************************************************* makes an LSA_R_ENUM_TRUST_DOM structure. ********************************************************************/ -void make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, +BOOL make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context, char *domain_name, DOM_SID *domain_sid, uint32 status) { - if (r_e == NULL) return; + if (r_e == NULL) return False; DEBUG(5,("make_r_enum_trust_dom\n")); @@ -591,14 +641,16 @@ void make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, } r_e->status = status; + + return True; } /******************************************************************* reads or writes an LSA_R_ENUM_TRUST_DOM structure. ********************************************************************/ -void lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth) +BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth) { - if (r_e == NULL) return; + if (r_e == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_r_enum_trust_dom"); depth++; @@ -616,14 +668,16 @@ void lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct } prs_uint32("status", ps, depth, &(r_e->status)); + + return True; } /******************************************************************* reads or writes an LSA_Q_QUERY_INFO structure. ********************************************************************/ -void lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth) +BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_r_query"); depth++; @@ -655,15 +709,17 @@ void lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int dept } prs_uint32("status", ps, depth, &(r_q->status)); + + return True; } /******************************************************************* makes a LSA_SID_ENUM structure. ********************************************************************/ -void make_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID **sids) +BOOL make_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID **sids) { int i, i2; - if (sen == NULL || sids == NULL) return; + if (sen == NULL || sids == NULL) return False; DEBUG(5,("make_lsa_sid_enum\n")); @@ -686,17 +742,19 @@ void make_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID **sids) sen->ptr_sid[i] = 0; } } + + return True; } /******************************************************************* reads or writes a LSA_SID_ENUM structure. ********************************************************************/ -static void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, +static BOOL lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) { int i; - if (sen == NULL) return; + if (sen == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_sid_enum"); depth++; @@ -724,17 +782,19 @@ static void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, slprintf(temp, sizeof(temp) - 1, "sid[%d]", i); smb_io_dom_sid2(temp, &(sen->sid[i]), ps, depth); /* domain SIDs to be looked up. */ } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, +static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth) { int i; - if (trn == NULL) return; + if (trn == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_trans_names"); depth++; @@ -766,16 +826,18 @@ static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_align(ps); } } + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd, +BOOL make_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd, int num_sids, DOM_SID **sids, uint16 level) { - if (q_l == NULL) return; + if (q_l == NULL) return False; DEBUG(5,("make_q_lookup_sids\n")); @@ -786,14 +848,16 @@ void make_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd, q_l->names.num_entries = 0; q_l->level.value = level; + + return True; } /******************************************************************* reads or writes a LSA_Q_LOOKUP_SIDS structure. ********************************************************************/ -void lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, int depth) +BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, int depth) { - if (q_s == NULL) return; + if (q_s == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids"); depth++; @@ -806,14 +870,16 @@ void lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, in smb_io_lookup_level("switch ", &(q_s->level ), ps, depth); /* lookup level */ prs_uint32("mapped_count", ps, depth, &(q_s->mapped_count)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, int depth) +BOOL lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, int depth) { - if (r_s == NULL) return; + if (r_s == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_r_lookup_sids"); depth++; @@ -832,16 +898,18 @@ void lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, i prs_uint32("mapped_count", ps, depth, &(r_s->mapped_count)); prs_uint32("status ", ps, depth, &(r_s->status)); + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, +BOOL make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, int num_names, const char **names) { int i; - if (q_l == NULL) return; + if (q_l == NULL) return False; DEBUG(5,("make_q_lookup_names\n")); @@ -864,16 +932,18 @@ void make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, q_l->ptr_trans_sids = 0; q_l->lookup_level = 1; q_l->mapped_count = 0; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth) +BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth) { int i; - if (q_r == NULL) return; + if (q_r == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_q_lookup_names"); depth++; @@ -902,16 +972,18 @@ void lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, prs_uint32("ptr_trans_sids ", ps, depth, &(q_r->ptr_trans_sids)); prs_uint32("lookup_level ", ps, depth, &(q_r->lookup_level )); prs_uint32("mapped_count ", ps, depth, &(q_r->mapped_count )); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth) +BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth) { int i; - if (r_r == NULL) return; + if (r_r == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_r_lookup_names"); depth++; @@ -934,7 +1006,7 @@ void lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, if (r_r->num_entries2 != r_r->num_entries) { /* RPC fault */ - return; + return False; } for (i = 0; i < r_r->num_entries2; i++) @@ -946,40 +1018,46 @@ void lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, prs_uint32("mapped_count", ps, depth, &(r_r->mapped_count)); prs_uint32("status ", ps, depth, &(r_r->status)); + + return True; } /******************************************************************* makes an LSA_Q_CLOSE structure. ********************************************************************/ -void make_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd) +BOOL make_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd) { - if (q_c == NULL || hnd == NULL) return; + if (q_c == NULL || hnd == NULL) return False; DEBUG(5,("make_lsa_q_close\n")); memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); + + return True; } /******************************************************************* reads or writes an LSA_Q_CLOSE structure. ********************************************************************/ -void lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth) +BOOL lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth) { - if (q_c == NULL) return; + if (q_c == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_q_close"); depth++; smb_io_pol_hnd("", &(q_c->pol), ps, depth); + + return True; } /******************************************************************* reads or writes an LSA_R_CLOSE structure. ********************************************************************/ -void lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth) { - if (r_c == NULL) return; + if (r_c == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_r_close"); depth++; @@ -987,5 +1065,7 @@ void lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth) smb_io_pol_hnd("", &(r_c->pol), ps, depth); prs_uint32("status", ps, depth, &(r_c->status)); + + return True; } diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index e46a6e02a5..31dc252187 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -31,9 +31,9 @@ extern int DEBUGLEVEL; /******************************************************************* reads or writes a BIGINT structure. ********************************************************************/ -void smb_io_bigint(char *desc, BIGINT *bigint, prs_struct *ps, int depth) +BOOL smb_io_bigint(char *desc, BIGINT *bigint, prs_struct *ps, int depth) { - if (bigint == NULL) return; + if (bigint == NULL) return False; prs_debug(ps, depth, desc, "smb_io_bigint"); depth++; @@ -42,14 +42,16 @@ void smb_io_bigint(char *desc, BIGINT *bigint, prs_struct *ps, int depth) prs_uint32("low ", ps, depth, &(bigint->low )); prs_uint32("high", ps, depth, &(bigint->high)); + + return True; } /******************************************************************* reads or writes a UTIME type. ********************************************************************/ -static void smb_io_utime(char *desc, UTIME *t, prs_struct *ps, int depth) +static BOOL smb_io_utime(char *desc, UTIME *t, prs_struct *ps, int depth) { - if (t == NULL) return; + if (t == NULL) return False; prs_debug(ps, depth, desc, "smb_io_utime"); depth++; @@ -57,14 +59,16 @@ static void smb_io_utime(char *desc, UTIME *t, prs_struct *ps, int depth) prs_align(ps); prs_uint32 ("time", ps, depth, &(t->time)); + + return True; } /******************************************************************* reads or writes an NTTIME structure. ********************************************************************/ -void smb_io_time(char *desc, NTTIME *nttime, prs_struct *ps, int depth) +BOOL smb_io_time(char *desc, NTTIME *nttime, prs_struct *ps, int depth) { - if (nttime == NULL) return; + if (nttime == NULL) return False; prs_debug(ps, depth, desc, "smb_io_time"); depth++; @@ -73,14 +77,16 @@ void smb_io_time(char *desc, NTTIME *nttime, prs_struct *ps, int depth) prs_uint32("low ", ps, depth, &(nttime->low )); /* low part */ prs_uint32("high", ps, depth, &(nttime->high)); /* high part */ + + return True; } /******************************************************************* reads or writes a LOOKUP_LEVEL structure. ********************************************************************/ -void smb_io_lookup_level(char *desc, LOOKUP_LEVEL *level, prs_struct *ps, int depth) +BOOL smb_io_lookup_level(char *desc, LOOKUP_LEVEL *level, prs_struct *ps, int depth) { - if (level == NULL) return; + if (level == NULL) return False; prs_debug(ps, depth, desc, "smb_io_lookup_level"); depth++; @@ -88,6 +94,8 @@ void smb_io_lookup_level(char *desc, LOOKUP_LEVEL *level, prs_struct *ps, int de prs_align(ps); prs_uint16("value", ps, depth, &(level->value)); prs_align(ps); + + return True; } /******************************************************************* @@ -96,27 +104,31 @@ gets an enumeration handle from an ENUM_HND structure. uint32 get_enum_hnd(ENUM_HND *enh) { return (enh && enh->ptr_hnd != 0) ? enh->handle : 0; + + return True; } /******************************************************************* makes an ENUM_HND structure. ********************************************************************/ -void make_enum_hnd(ENUM_HND *enh, uint32 hnd) +BOOL make_enum_hnd(ENUM_HND *enh, uint32 hnd) { - if (enh == NULL) return; + if (enh == NULL) return False; DEBUG(5,("smb_io_enum_hnd\n")); enh->ptr_hnd = (hnd != 0) ? 1 : 0; enh->handle = hnd; + + return True; } /******************************************************************* reads or writes an ENUM_HND structure. ********************************************************************/ -void smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) +BOOL smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) { - if (hnd == NULL) return; + if (hnd == NULL) return False; prs_debug(ps, depth, desc, "smb_io_enum_hnd"); depth++; @@ -128,16 +140,18 @@ void smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) { prs_uint32("handle ", ps, depth, &(hnd->handle )); /* enum handle */ } + + return True; } /******************************************************************* reads or writes a DOM_SID structure. ********************************************************************/ -void smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) +BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) { int i; - if (sid == NULL) return; + if (sid == NULL) return False; prs_debug(ps, depth, desc, "smb_io_dom_sid"); depth++; @@ -158,23 +172,27 @@ void smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) if (sid->num_auths > MAXSUBAUTHS) sid->num_auths = MAXSUBAUTHS; prs_uint32s(False, "sub_auths ", ps, depth, sid->sub_auths, sid->num_auths); + + return True; } /******************************************************************* creates a DOM_SID2 structure. ********************************************************************/ -void make_dom_sid2(DOM_SID2 *sid2, DOM_SID *sid) +BOOL make_dom_sid2(DOM_SID2 *sid2, DOM_SID *sid) { sid_copy(&sid2->sid, sid); sid2->num_auths = sid2->sid.num_auths; + + return True; } /******************************************************************* reads or writes a DOM_SID2 structure. ********************************************************************/ -void smb_io_dom_sid2(char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) +BOOL smb_io_dom_sid2(char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) { - if (sid == NULL) return; + if (sid == NULL) return False; prs_debug(ps, depth, desc, "smb_io_dom_sid2"); depth++; @@ -184,24 +202,28 @@ void smb_io_dom_sid2(char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) prs_uint32("num_auths", ps, depth, &(sid->num_auths)); smb_io_dom_sid("sid", &(sid->sid), ps, depth); + + return True; } /******************************************************************* creates a STRHDR structure. ********************************************************************/ -void make_str_hdr(STRHDR *hdr, int max_len, int len, uint32 buffer) +BOOL make_str_hdr(STRHDR *hdr, int max_len, int len, uint32 buffer) { hdr->str_max_len = max_len; hdr->str_str_len = len; hdr->buffer = buffer; + + return True; } /******************************************************************* reads or writes a STRHDR structure. ********************************************************************/ -void smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth) +BOOL smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth) { - if (hdr == NULL) return; + if (hdr == NULL) return False; prs_debug(ps, depth, desc, "smb_io_strhdr"); depth++; @@ -215,24 +237,28 @@ void smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth) /* oops! XXXX maybe issue a warning that this is happening... */ if (hdr->str_max_len > MAX_STRINGLEN) hdr->str_max_len = MAX_STRINGLEN; if (hdr->str_str_len > MAX_STRINGLEN) hdr->str_str_len = MAX_STRINGLEN; + + return True; } /******************************************************************* creates a STRHDR2 structure. ********************************************************************/ -void make_strhdr2(STRHDR2 *hdr, uint32 max_len, uint32 len, uint32 buffer) +BOOL make_strhdr2(STRHDR2 *hdr, uint32 max_len, uint32 len, uint32 buffer) { hdr->str_max_len = max_len; hdr->str_str_len = len; hdr->buffer = buffer; + + return True; } /******************************************************************* reads or writes a STRHDR2 structure. ********************************************************************/ -void smb_io_strhdr2(char *desc, STRHDR2 *hdr, prs_struct *ps, int depth) +BOOL smb_io_strhdr2(char *desc, STRHDR2 *hdr, prs_struct *ps, int depth) { - if (hdr == NULL) return; + if (hdr == NULL) return False; prs_debug(ps, depth, desc, "smb_io_strhdr"); depth++; @@ -246,24 +272,28 @@ void smb_io_strhdr2(char *desc, STRHDR2 *hdr, prs_struct *ps, int depth) /* oops! XXXX maybe issue a warning that this is happening... */ if (hdr->str_max_len > MAX_STRINGLEN) hdr->str_max_len = MAX_STRINGLEN; if (hdr->str_str_len > MAX_STRINGLEN) hdr->str_str_len = MAX_STRINGLEN; + + return True; } /******************************************************************* creates a UNIHDR structure. ********************************************************************/ -void make_uni_hdr(UNIHDR *hdr, int len) +BOOL make_uni_hdr(UNIHDR *hdr, int len) { hdr->uni_str_len = 2 * len; hdr->uni_max_len = 2 * len; hdr->buffer = len != 0 ? 1 : 0; + + return True; } /******************************************************************* reads or writes a UNIHDR structure. ********************************************************************/ -void smb_io_unihdr(char *desc, UNIHDR *hdr, prs_struct *ps, int depth) +BOOL smb_io_unihdr(char *desc, UNIHDR *hdr, prs_struct *ps, int depth) { - if (hdr == NULL) return; + if (hdr == NULL) return False; prs_debug(ps, depth, desc, "smb_io_unihdr"); depth++; @@ -277,22 +307,26 @@ void smb_io_unihdr(char *desc, UNIHDR *hdr, prs_struct *ps, int depth) /* oops! XXXX maybe issue a warning that this is happening... */ if (hdr->uni_max_len > MAX_UNISTRLEN) hdr->uni_max_len = MAX_UNISTRLEN; if (hdr->uni_str_len > MAX_UNISTRLEN) hdr->uni_str_len = MAX_UNISTRLEN; + + return True; } /******************************************************************* creates a BUFHDR structure. ********************************************************************/ -void make_buf_hdr(BUFHDR *hdr, int max_len, int len) +BOOL make_buf_hdr(BUFHDR *hdr, int max_len, int len) { hdr->buf_max_len = max_len; hdr->buf_len = len; + + return True; } /******************************************************************* prs_uint16 wrapper. call this and it sets up a pointer to where the uint16 should be stored, or gets the size if reading ********************************************************************/ -void smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset) +BOOL smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset) { (*offset) = ps->offset; if (ps->io) @@ -304,13 +338,15 @@ void smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint { ps->offset += sizeof(uint32) * 2; } + + return True; } /******************************************************************* smb_io_hdrbuf wrapper. call this and it retrospectively stores the size. does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ -void smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, +BOOL smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 ptr_hdrbuf, uint32 max_len, uint32 len) { if (!ps->io) @@ -323,14 +359,16 @@ void smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, smb_io_hdrbuf(desc, hdr, ps, depth); ps->offset = old_offset; } + + return True; } /******************************************************************* reads or writes a BUFHDR structure. ********************************************************************/ -void smb_io_hdrbuf(char *desc, BUFHDR *hdr, prs_struct *ps, int depth) +BOOL smb_io_hdrbuf(char *desc, BUFHDR *hdr, prs_struct *ps, int depth) { - if (hdr == NULL) return; + if (hdr == NULL) return False; prs_debug(ps, depth, desc, "smb_io_hdrbuf"); depth++; @@ -343,24 +381,28 @@ void smb_io_hdrbuf(char *desc, BUFHDR *hdr, prs_struct *ps, int depth) /* oops! XXXX maybe issue a warning that this is happening... */ if (hdr->buf_max_len > MAX_BUFFERLEN) hdr->buf_max_len = MAX_BUFFERLEN; if (hdr->buf_len > MAX_BUFFERLEN) hdr->buf_len = MAX_BUFFERLEN; + + return True; } /******************************************************************* creates a BUFHDR2 structure. ********************************************************************/ -void make_bufhdr2(BUFHDR2 *hdr, uint32 info_level, uint32 length, uint32 buffer) +BOOL make_bufhdr2(BUFHDR2 *hdr, uint32 info_level, uint32 length, uint32 buffer) { hdr->info_level = info_level; hdr->length = length; hdr->buffer = buffer; + + return True; } /******************************************************************* reads or writes a BUFHDR2 structure. ********************************************************************/ -void smb_io_bufhdr2(char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) +BOOL smb_io_bufhdr2(char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) { - if (hdr == NULL) return; + if (hdr == NULL) return False; prs_debug(ps, depth, desc, "smb_io_bufhdr2"); depth++; @@ -369,23 +411,27 @@ void smb_io_bufhdr2(char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) prs_uint32("info_level", ps, depth, &(hdr->info_level)); prs_uint32("length ", ps, depth, &(hdr->length )); prs_uint32("buffer ", ps, depth, &(hdr->buffer )); + + return True; } /******************************************************************* creates a UNIHDR2 structure. ********************************************************************/ -void make_uni_hdr2(UNIHDR2 *hdr, int len) +BOOL make_uni_hdr2(UNIHDR2 *hdr, int len) { make_uni_hdr(&(hdr->unihdr), len); hdr->buffer = len > 0 ? 1 : 0; + + return True; } /******************************************************************* reads or writes a UNIHDR2 structure. ********************************************************************/ -void smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) +BOOL smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) { - if (hdr2 == NULL) return; + if (hdr2 == NULL) return False; prs_debug(ps, depth, desc, "smb_io_unihdr2"); depth++; @@ -394,34 +440,40 @@ void smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) smb_io_unihdr("hdr", &(hdr2->unihdr), ps, depth); prs_uint32("buffer", ps, depth, &(hdr2->buffer)); + + return True; } /******************************************************************* creates a UNISTR structure. ********************************************************************/ -void make_unistr(UNISTR *str, char *buf) +BOOL make_unistr(UNISTR *str, char *buf) { ascii_to_unistr(str->buffer, buf, sizeof(str->buffer)-1); + + return True; } /******************************************************************* reads or writes a UNISTR structure. XXXX NOTE: UNISTR structures NEED to be null-terminated. ********************************************************************/ -void smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) +BOOL smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) { - if (uni == NULL) return; + if (uni == NULL) return False; prs_debug(ps, depth, desc, "smb_io_unistr"); depth++; prs_unistr("unistr", ps, depth, uni); + + return True; } /******************************************************************* creates a BUFFER3 structure from a uint32 ********************************************************************/ -void make_buffer3_uint32(BUFFER3 *str, uint32 val) +BOOL make_buffer3_uint32(BUFFER3 *str, uint32 val) { ZERO_STRUCTP(str); @@ -430,12 +482,14 @@ void make_buffer3_uint32(BUFFER3 *str, uint32 val) str->buf_len = sizeof(uint32); SIVAL(str->buffer, 0, val); + + return True; } /******************************************************************* creates a BUFFER3 structure. ********************************************************************/ -void make_buffer3_str(BUFFER3 *str, char *buf, int len) +BOOL make_buffer3_str(BUFFER3 *str, char *buf, int len) { ZERO_STRUCTP(str); @@ -445,21 +499,25 @@ void make_buffer3_str(BUFFER3 *str, char *buf, int len) /* store the string (little endian buffer) */ ascii_to_unibuf(str->buffer, buf, str->buf_len); + + return True; } /******************************************************************* creates a BUFFER3 structure from a hex string. ********************************************************************/ -void make_buffer3_hex(BUFFER3 *str, char *buf) +BOOL make_buffer3_hex(BUFFER3 *str, char *buf) { ZERO_STRUCTP(str); str->buf_max_len = str->buf_len = strhex_to_str((char *)str->buffer, sizeof(str->buffer), buf); + + return True; } /******************************************************************* creates a BUFFER3 structure. ********************************************************************/ -void make_buffer3_bytes(BUFFER3 *str, uint8 *buf, int len) +BOOL make_buffer3_bytes(BUFFER3 *str, uint8 *buf, int len) { ZERO_STRUCTP(str); @@ -470,6 +528,8 @@ void make_buffer3_bytes(BUFFER3 *str, uint8 *buf, int len) memcpy(str->buffer, buf, MIN(str->buf_len, sizeof(str->buffer))); } str->buf_len = buf != NULL ? len : 0; + + return True; } /******************************************************************* @@ -477,9 +537,9 @@ reads or writes a BUFFER3 structure. the uni_max_len member tells you how large the buffer is. the uni_str_len member tells you how much of the buffer is really used. ********************************************************************/ -void smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) +BOOL smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) { - if (buf3 == NULL) return; + if (buf3 == NULL) return False; prs_debug(ps, depth, desc, "smb_io_buffer3"); depth++; @@ -493,14 +553,16 @@ void smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) prs_uint32("buf_len ", ps, depth, &(buf3->buf_len)); if (buf3->buf_len > MAX_UNISTRLEN) buf3->buf_len = MAX_UNISTRLEN; + + return True; } /******************************************************************* reads or writes a BUFFER4 structure. ********************************************************************/ -void smb_io_buffer4(char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_buffer4(char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth) { - if ((buf4 == NULL) || (buffer == 0)) return; + if ((buf4 == NULL) || (buffer == 0)) return False; prs_debug(ps, depth, desc, "smb_io_buffer4"); depth++; @@ -514,12 +576,14 @@ void smb_io_buffer4(char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, in } prs_uint8s(True, "buffer", ps, depth, buf4->buffer, buf4->buf_len); + + return True; } /******************************************************************* initialise a BUFFER5 structure. ********************************************************************/ -void init_buffer5(BUFFER5 **str) +BOOL init_buffer5(BUFFER5 **str) { BUFFER5 *buf5; @@ -528,12 +592,14 @@ void init_buffer5(BUFFER5 **str) buf5->buf_len=0; buf5->buffer=NULL; *str=buf5; + + return True; } /******************************************************************* clear a BUFFER5 structure. ********************************************************************/ -void clear_buffer5(BUFFER5 **str) +BOOL clear_buffer5(BUFFER5 **str) { BUFFER5 *buf5; @@ -544,30 +610,34 @@ void clear_buffer5(BUFFER5 **str) } free(buf5); *str=NULL; + + return True; } /******************************************************************* creates a BUFFER5 structure. ********************************************************************/ -void make_buffer5(BUFFER5 *str, char *buf, int len) +BOOL make_buffer5(BUFFER5 *str, char *buf, int len) { /* max buffer size (allocated size) */ str->buf_len = len; str->buffer = (uint16 *)malloc( sizeof(uint16) * len ); ascii_to_unistr(str->buffer, buf, len); + + return True; } /******************************************************************* reads or writes a BUFFER5 structure. the buf_len member tells you how large the buffer is. ********************************************************************/ -void smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) +BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_buffer4"); depth++; - if (buf5 == NULL) return; + if (buf5 == NULL) return False; prs_align(ps); prs_uint32("buf_len", ps, depth, &(buf5->buf_len)); @@ -579,12 +649,14 @@ void smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) } prs_uint16s(True, "buffer ", ps, depth, buf5->buffer, buf5->buf_len); + + return True; } /******************************************************************* creates a BUFFER2 structure. ********************************************************************/ -void make_buffer2(BUFFER2 *str, const char *buf, int len) +BOOL make_buffer2(BUFFER2 *str, const char *buf, int len) { ZERO_STRUCTP(str); @@ -594,6 +666,8 @@ void make_buffer2(BUFFER2 *str, const char *buf, int len) /* store the string */ ascii_to_unibuf(str->buffer, buf, MIN(str->buf_len, sizeof(str->buffer)-1)); + + return True; } /******************************************************************* @@ -601,9 +675,9 @@ reads or writes a BUFFER2 structure. the uni_max_len member tells you how large the buffer is. the uni_str_len member tells you how much of the buffer is really used. ********************************************************************/ -void smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth) { - if (buf2 == NULL) return; + if (buf2 == NULL) return False; if (buffer) { @@ -630,12 +704,14 @@ void smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, i depth++; bzero(buf2, sizeof(*buf2)); } + + return True; } /******************************************************************* creates a UNISTR2 structure: sets up the buffer, too ********************************************************************/ -void make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf) +BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf) { if (buf != NULL) { @@ -647,12 +723,14 @@ void make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf) *ptr = 0; make_unistr2(str, "", 0); } + + return True; } /******************************************************************* copies a UNISTR2 structure. ********************************************************************/ -void copy_unistr2(UNISTR2 *str, UNISTR2 *from) +BOOL copy_unistr2(UNISTR2 *str, UNISTR2 *from) { /* set up string lengths. add one if string is not null-terminated */ str->uni_max_len = from->uni_max_len; @@ -661,12 +739,14 @@ void copy_unistr2(UNISTR2 *str, UNISTR2 *from) /* copy the string */ memcpy(str->buffer, from->buffer, sizeof(from->buffer)); + + return True; } /******************************************************************* creates a STRING2 structure. ********************************************************************/ -void make_string2(STRING2 *str, char *buf, int len) +BOOL make_string2(STRING2 *str, char *buf, int len) { /* set up string lengths. */ str->str_max_len = len; @@ -676,6 +756,8 @@ void make_string2(STRING2 *str, char *buf, int len) /* store the string */ if(len != 0) memcpy(str->buffer, buf, len); + + return True; } /******************************************************************* @@ -684,9 +766,9 @@ XXXX NOTE: STRING2 structures need NOT be null-terminated. the str_str_len member tells you how long the string is; the str_max_len member tells you how large the buffer is. ********************************************************************/ -void smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth) { - if (str2 == NULL) return; + if (str2 == NULL) return False; if (buffer) { @@ -713,12 +795,14 @@ void smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, i depth++; bzero(str2, sizeof(*str2)); } + + return True; } /******************************************************************* creates a UNISTR2 structure. ********************************************************************/ -void make_unistr2(UNISTR2 *str, const char *buf, int len) +BOOL make_unistr2(UNISTR2 *str, const char *buf, int len) { ZERO_STRUCTP(str); @@ -729,6 +813,8 @@ void make_unistr2(UNISTR2 *str, const char *buf, int len) /* store the string (wide chars) */ ascii_to_unistr(str->buffer, buf, len); + + return True; } /******************************************************************* @@ -737,9 +823,9 @@ XXXX NOTE: UNISTR2 structures need NOT be null-terminated. the uni_str_len member tells you how long the string is; the uni_max_len member tells you how large the buffer is. ********************************************************************/ -void smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth) { - if (uni2 == NULL) return; + if (uni2 == NULL) return False; if (buffer) { @@ -766,24 +852,28 @@ void smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, i depth++; bzero(uni2, sizeof(*uni2)); } + + return True; } /******************************************************************* creates a DOM_RID2 structure. ********************************************************************/ -void make_dom_rid2(DOM_RID2 *rid2, uint32 rid, uint8 type, uint32 idx) +BOOL make_dom_rid2(DOM_RID2 *rid2, uint32 rid, uint8 type, uint32 idx) { rid2->type = type; rid2->rid = rid; rid2->rid_idx = idx; + + return True; } /******************************************************************* reads or writes a DOM_RID2 structure. ********************************************************************/ -void smb_io_dom_rid2(char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth) +BOOL smb_io_dom_rid2(char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth) { - if (rid2 == NULL) return; + if (rid2 == NULL) return False; prs_debug(ps, depth, desc, "smb_io_dom_rid2"); depth++; @@ -794,26 +884,30 @@ void smb_io_dom_rid2(char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth) prs_align(ps); prs_uint32("rid ", ps, depth, &(rid2->rid )); prs_uint32("rid_idx", ps, depth, &(rid2->rid_idx )); + + return True; } /******************************************************************* creates a DOM_RID3 structure. ********************************************************************/ -void make_dom_rid3(DOM_RID3 *rid3, uint32 rid, uint8 type) +BOOL make_dom_rid3(DOM_RID3 *rid3, uint32 rid, uint8 type) { rid3->rid = rid; rid3->type1 = type; rid3->ptr_type = 0x1; /* non-zero, basically. */ rid3->type2 = 0x1; rid3->unk = type; + + return True; } /******************************************************************* reads or writes a DOM_RID3 structure. ********************************************************************/ -void smb_io_dom_rid3(char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) +BOOL smb_io_dom_rid3(char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) { - if (rid3 == NULL) return; + if (rid3 == NULL) return False; prs_debug(ps, depth, desc, "smb_io_dom_rid3"); depth++; @@ -825,14 +919,16 @@ void smb_io_dom_rid3(char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) prs_uint32("ptr_type", ps, depth, &(rid3->ptr_type)); prs_uint32("type2 ", ps, depth, &(rid3->type2 )); prs_uint32("unk ", ps, depth, &(rid3->unk )); + + return True; } /******************************************************************* makes a DOM_CLNT_SRV structure. ********************************************************************/ -static void make_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) +static BOOL make_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) { - if (log == NULL) return; + if (log == NULL) return False; DEBUG(5,("make_clnt_srv: %d\n", __LINE__)); @@ -855,14 +951,16 @@ static void make_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) { log->undoc_buffer2 = 0; } + + return True; } /******************************************************************* reads or writes a DOM_CLNT_SRV structure. ********************************************************************/ -static void smb_io_clnt_srv(char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth) +static BOOL smb_io_clnt_srv(char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth) { - if (log == NULL) return; + if (log == NULL) return False; prs_debug(ps, depth, desc, "smb_io_clnt_srv"); depth++; @@ -882,16 +980,18 @@ static void smb_io_clnt_srv(char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int { smb_io_unistr2("unistr2", &(log->uni_comp_name), log->undoc_buffer2, ps, depth); } + + return True; } /******************************************************************* makes a DOM_LOG_INFO structure. ********************************************************************/ -void make_log_info(DOM_LOG_INFO *log, +BOOL make_log_info(DOM_LOG_INFO *log, const char *logon_srv, const char *acct_name, uint16 sec_chan, const char *comp_name) { - if (log == NULL) return; + if (log == NULL) return False; DEBUG(5,("make_log_info %d\n", __LINE__)); @@ -903,14 +1003,16 @@ void make_log_info(DOM_LOG_INFO *log, log->sec_chan = sec_chan; make_unistr2(&(log->uni_comp_name), comp_name, strlen(comp_name)+1); + + return True; } /******************************************************************* reads or writes a DOM_LOG_INFO structure. ********************************************************************/ -void smb_io_log_info(char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth) +BOOL smb_io_log_info(char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth) { - if (log == NULL) return; + if (log == NULL) return False; prs_debug(ps, depth, desc, "smb_io_log_info"); depth++; @@ -925,14 +1027,16 @@ void smb_io_log_info(char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth) prs_uint16("sec_chan", ps, depth, &(log->sec_chan)); smb_io_unistr2("unistr2", &(log->uni_comp_name), True, ps, depth); + + return True; } /******************************************************************* reads or writes a DOM_CHAL structure. ********************************************************************/ -void smb_io_chal(char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) +BOOL smb_io_chal(char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) { - if (chal == NULL) return; + if (chal == NULL) return False; prs_debug(ps, depth, desc, "smb_io_chal"); depth++; @@ -940,14 +1044,16 @@ void smb_io_chal(char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) prs_align(ps); prs_uint8s (False, "data", ps, depth, chal->data, 8); + + return True; } /******************************************************************* reads or writes a DOM_CRED structure. ********************************************************************/ -void smb_io_cred(char *desc, DOM_CRED *cred, prs_struct *ps, int depth) +BOOL smb_io_cred(char *desc, DOM_CRED *cred, prs_struct *ps, int depth) { - if (cred == NULL) return; + if (cred == NULL) return False; prs_debug(ps, depth, desc, "smb_io_cred"); depth++; @@ -956,16 +1062,18 @@ void smb_io_cred(char *desc, DOM_CRED *cred, prs_struct *ps, int depth) smb_io_chal ("", &(cred->challenge), ps, depth); smb_io_utime("", &(cred->timestamp), ps, depth); + + return True; } /******************************************************************* makes a DOM_CLNT_INFO2 structure. ********************************************************************/ -void make_clnt_info2(DOM_CLNT_INFO2 *clnt, +BOOL make_clnt_info2(DOM_CLNT_INFO2 *clnt, char *logon_srv, char *comp_name, DOM_CRED *clnt_cred) { - if (clnt == NULL) return; + if (clnt == NULL) return False; DEBUG(5,("make_clnt_info: %d\n", __LINE__)); @@ -980,14 +1088,16 @@ void make_clnt_info2(DOM_CLNT_INFO2 *clnt, { clnt->ptr_cred = 0; } + + return True; } /******************************************************************* reads or writes a DOM_CLNT_INFO2 structure. ********************************************************************/ -void smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth) +BOOL smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth) { - if (clnt == NULL) return; + if (clnt == NULL) return False; prs_debug(ps, depth, desc, "smb_io_clnt_info2"); depth++; @@ -1000,30 +1110,34 @@ void smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int de prs_uint32("ptr_cred", ps, depth, &(clnt->ptr_cred)); smb_io_cred ("", &(clnt->cred ), ps, depth); + + return True; } /******************************************************************* makes a DOM_CLNT_INFO structure. ********************************************************************/ -void make_clnt_info(DOM_CLNT_INFO *clnt, +BOOL make_clnt_info(DOM_CLNT_INFO *clnt, char *logon_srv, char *acct_name, uint16 sec_chan, char *comp_name, DOM_CRED *cred) { - if (clnt == NULL || cred == NULL) return; + if (clnt == NULL || cred == NULL) return False; DEBUG(5,("make_clnt_info\n")); make_log_info(&(clnt->login), logon_srv, acct_name, sec_chan, comp_name); memcpy(&(clnt->cred), cred, sizeof(clnt->cred)); + + return True; } /******************************************************************* reads or writes a DOM_CLNT_INFO structure. ********************************************************************/ -void smb_io_clnt_info(char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int depth) +BOOL smb_io_clnt_info(char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int depth) { - if (clnt == NULL) return; + if (clnt == NULL) return False; prs_debug(ps, depth, desc, "smb_io_clnt_info"); depth++; @@ -1032,14 +1146,16 @@ void smb_io_clnt_info(char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int dept smb_io_log_info("", &(clnt->login), ps, depth); smb_io_cred ("", &(clnt->cred ), ps, depth); + + return True; } /******************************************************************* makes an OWF_INFO structure. ********************************************************************/ -void make_owf_info(OWF_INFO *hash, uint8 data[16]) +BOOL make_owf_info(OWF_INFO *hash, uint8 data[16]) { - if (hash == NULL) return; + if (hash == NULL) return False; DEBUG(5,("make_owf_info: %d\n", __LINE__)); @@ -1051,14 +1167,16 @@ void make_owf_info(OWF_INFO *hash, uint8 data[16]) { bzero(hash->data, sizeof(hash->data)); } + + return True; } /******************************************************************* reads or writes an OWF_INFO structure. ********************************************************************/ -void smb_io_owf_info(char *desc, OWF_INFO *hash, prs_struct *ps, int depth) +BOOL smb_io_owf_info(char *desc, OWF_INFO *hash, prs_struct *ps, int depth) { - if (hash == NULL) return; + if (hash == NULL) return False; prs_debug(ps, depth, desc, "smb_io_owf_info"); depth++; @@ -1066,14 +1184,16 @@ void smb_io_owf_info(char *desc, OWF_INFO *hash, prs_struct *ps, int depth) prs_align(ps); prs_uint8s (False, "data", ps, depth, hash->data, 16); + + return True; } /******************************************************************* reads or writes a DOM_GID structure. ********************************************************************/ -void smb_io_gid(char *desc, DOM_GID *gid, prs_struct *ps, int depth) +BOOL smb_io_gid(char *desc, DOM_GID *gid, prs_struct *ps, int depth) { - if (gid == NULL) return; + if (gid == NULL) return False; prs_debug(ps, depth, desc, "smb_io_gid"); depth++; @@ -1082,14 +1202,16 @@ void smb_io_gid(char *desc, DOM_GID *gid, prs_struct *ps, int depth) prs_uint32("g_rid", ps, depth, &(gid->g_rid)); prs_uint32("attr ", ps, depth, &(gid->attr )); + + return True; } /******************************************************************* reads or writes an POLICY_HND structure. ********************************************************************/ -void smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth) +BOOL smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth) { - if (pol == NULL) return; + if (pol == NULL) return False; prs_debug(ps, depth, desc, "smb_io_pol_hnd"); depth++; @@ -1097,14 +1219,16 @@ void smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth) prs_align(ps); prs_uint8s (False, "data", ps, depth, pol->data, POL_HND_SIZE); + + return True; } /******************************************************************* reads or writes a dom query structure. ********************************************************************/ -static void smb_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth) +static BOOL smb_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth) { - if (d_q == NULL) return; + if (d_q == NULL) return False; prs_debug(ps, depth, desc, "smb_io_dom_query"); depth++; @@ -1129,31 +1253,37 @@ static void smb_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int de { bzero(&(d_q->dom_sid), sizeof(d_q->dom_sid)); } + + return True; } /******************************************************************* reads or writes a dom query structure. ********************************************************************/ -void smb_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) +BOOL smb_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) { smb_io_dom_query("", d_q, ps, depth); + + return True; } /******************************************************************* reads or writes a dom query structure. ********************************************************************/ -void smb_io_dom_query_5(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) +BOOL smb_io_dom_query_5(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) { smb_io_dom_query("", d_q, ps, depth); + + return True; } /******************************************************************* reads or writes a UNISTR3 structure. ********************************************************************/ -void smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth) +BOOL smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth) { - if (name == NULL) return; + if (name == NULL) return False; prs_debug(ps, depth, desc, "smb_io_unistr3"); depth++; @@ -1166,5 +1296,7 @@ void smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth) /* assume unicode string is unicode-null-terminated, instead */ prs_unistr3(True, "unistr", name, ps, depth); + + return True; } diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 79b49855a9..e2073d00f1 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -29,9 +29,9 @@ extern int DEBUGLEVEL; /******************************************************************* reads or writes a structure. ********************************************************************/ -static void net_io_neg_flags(char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth) +static BOOL net_io_neg_flags(char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth) { - if (neg == NULL) return; + if (neg == NULL) return False; prs_debug(ps, depth, desc, "net_io_neg_flags"); depth++; @@ -39,12 +39,14 @@ static void net_io_neg_flags(char *desc, NEG_FLAGS *neg, prs_struct *ps, int de prs_align(ps); prs_uint32("neg_flags", ps, depth, &(neg->neg_flags)); + + return True; } /******************************************************************* creates a NETLOGON_INFO_3 structure. ********************************************************************/ -static void make_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_attempts) +static BOOL make_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_attempts) { info->flags = flags; info->logon_attempts = logon_attempts; @@ -53,14 +55,16 @@ static void make_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_att info->reserved_3 = 0x0; info->reserved_4 = 0x0; info->reserved_5 = 0x0; + + return True; } /******************************************************************* reads or writes a NETLOGON_INFO_3 structure. ********************************************************************/ -static void net_io_netinfo_3(char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int depth) +static BOOL net_io_netinfo_3(char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int depth) { - if (info == NULL) return; + if (info == NULL) return False; prs_debug(ps, depth, desc, "net_io_netinfo_3"); depth++; @@ -74,24 +78,28 @@ static void net_io_netinfo_3(char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, prs_uint32("reserved_3 ", ps, depth, &(info->reserved_3 )); prs_uint32("reserved_4 ", ps, depth, &(info->reserved_4 )); prs_uint32("reserved_5 ", ps, depth, &(info->reserved_5 )); + + return True; } /******************************************************************* creates a NETLOGON_INFO_1 structure. ********************************************************************/ -static void make_netinfo_1(NETLOGON_INFO_1 *info, uint32 flags, uint32 pdc_status) +static BOOL make_netinfo_1(NETLOGON_INFO_1 *info, uint32 flags, uint32 pdc_status) { info->flags = flags; info->pdc_status = pdc_status; + + return True; } /******************************************************************* reads or writes a NETLOGON_INFO_1 structure. ********************************************************************/ -static void net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth) +static BOOL net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth) { - if (info == NULL) return; + if (info == NULL) return False; prs_debug(ps, depth, desc, "net_io_netinfo_1"); depth++; @@ -100,12 +108,14 @@ static void net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, prs_uint32("flags ", ps, depth, &(info->flags )); prs_uint32("pdc_status", ps, depth, &(info->pdc_status)); + + return True; } /******************************************************************* creates a NETLOGON_INFO_2 structure. ********************************************************************/ -static void make_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, +static BOOL make_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, uint32 tc_status, char *trusted_dc_name) { int len_dc_name = strlen(trusted_dc_name); @@ -122,14 +132,16 @@ static void make_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_statu { make_unistr2(&(info->uni_trusted_dc_name), "", 1); } + + return True; } /******************************************************************* reads or writes a NETLOGON_INFO_2 structure. ********************************************************************/ -static void net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth) +static BOOL net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth) { - if (info == NULL) return; + if (info == NULL) return False; prs_debug(ps, depth, desc, "net_io_netinfo_2"); depth++; @@ -147,14 +159,16 @@ static void net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, } prs_align(ps); + + return True; } /******************************************************************* reads or writes an NET_Q_LOGON_CTRL2 structure. ********************************************************************/ -void net_io_q_logon_ctrl2(char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, int depth) +BOOL net_io_q_logon_ctrl2(char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, int depth) { - if (q_l == NULL) return; + if (q_l == NULL) return False; prs_debug(ps, depth, desc, "net_io_q_logon_ctrl2"); depth++; @@ -170,16 +184,18 @@ void net_io_q_logon_ctrl2(char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, i prs_uint32("function_code", ps, depth, &(q_l->function_code)); prs_uint32("query_level ", ps, depth, &(q_l->query_level )); prs_uint32("switch_value ", ps, depth, &(q_l->switch_value )); + + return True; } /******************************************************************* makes an NET_R_LOGON_CTRL2 structure. ********************************************************************/ -void make_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level, +BOOL make_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level, uint32 flags, uint32 pdc_status, uint32 logon_attempts, uint32 tc_status, char *trusted_domain_name) { - if (r_l == NULL) return; + if (r_l == NULL) return False; DEBUG(5,("make_r_logon_ctrl2\n")); @@ -224,14 +240,16 @@ void make_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level, break; } } + + return True; } /******************************************************************* reads or writes an NET_R_LOGON_CTRL2 structure. ********************************************************************/ -void net_io_r_logon_ctrl2(char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, int depth) +BOOL net_io_r_logon_ctrl2(char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, int depth) { - if (r_l == NULL) return; + if (r_l == NULL) return False; prs_debug(ps, depth, desc, "net_io_r_logon_ctrl2"); depth++; @@ -268,17 +286,19 @@ void net_io_r_logon_ctrl2(char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, i } prs_uint32("status ", ps, depth, &(r_l->status )); + + return True; } /******************************************************************* makes an NET_R_TRUST_DOM_LIST structure. ********************************************************************/ -void make_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, +BOOL make_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, uint32 num_doms, char *dom_name) { int i = 0; - if (r_t == NULL) return; + if (r_t == NULL) return False; DEBUG(5,("make_r_trust_dom\n")); @@ -300,15 +320,17 @@ void make_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, } r_t->status = 0; + + return True; } /******************************************************************* reads or writes an NET_R_TRUST_DOM_LIST structure. ********************************************************************/ -void net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth) +BOOL net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth) { int i; - if (r_t == NULL) return; + if (r_t == NULL) return False; prs_debug(ps, depth, desc, "net_io_r_trust_dom"); depth++; @@ -320,15 +342,17 @@ void net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, } prs_uint32("status", ps, depth, &(r_t->status)); + + return True; } /******************************************************************* reads or writes an NET_Q_TRUST_DOM_LIST structure. ********************************************************************/ -void net_io_q_trust_dom(char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, int depth) +BOOL net_io_q_trust_dom(char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, int depth) { - if (q_l == NULL) return; + if (q_l == NULL) return False; prs_debug(ps, depth, desc, "net_io_q_trust_dom"); depth++; @@ -339,16 +363,18 @@ void net_io_q_trust_dom(char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, prs_align(ps); prs_uint32("function_code", ps, depth, &(q_l->function_code)); + + return True; } /******************************************************************* makes an NET_Q_REQ_CHAL structure. ********************************************************************/ -void make_q_req_chal(NET_Q_REQ_CHAL *q_c, +BOOL make_q_req_chal(NET_Q_REQ_CHAL *q_c, char *logon_srv, char *logon_clnt, DOM_CHAL *clnt_chal) { - if (q_c == NULL) return; + if (q_c == NULL) return False; DEBUG(5,("make_q_req_chal: %d\n", __LINE__)); @@ -360,15 +386,17 @@ void make_q_req_chal(NET_Q_REQ_CHAL *q_c, memcpy(q_c->clnt_chal.data, clnt_chal->data, sizeof(clnt_chal->data)); DEBUG(5,("make_q_req_chal: %d\n", __LINE__)); + + return True; } /******************************************************************* reads or writes an NET_Q_REQ_CHAL structure. ********************************************************************/ -void net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int depth) +BOOL net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int depth) { int old_align; - if (q_c == NULL) return; + if (q_c == NULL) return False; prs_debug(ps, depth, desc, "net_io_q_req_chal"); depth++; @@ -385,14 +413,16 @@ void net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int dep /* client challenge is _not_ aligned after the unicode strings */ smb_io_chal("", &(q_c->clnt_chal), ps, depth); /* client challenge */ ps->align = old_align; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int depth) +BOOL net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int depth) { - if (r_c == NULL) return; + if (r_c == NULL) return False; prs_debug(ps, depth, desc, "net_io_r_req_chal"); depth++; @@ -402,18 +432,20 @@ void net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int dep smb_io_chal("", &(r_c->srv_chal), ps, depth); /* server challenge */ prs_uint32("status", ps, depth, &(r_c->status)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void make_q_auth_2(NET_Q_AUTH_2 *q_a, +BOOL make_q_auth_2(NET_Q_AUTH_2 *q_a, const char *logon_srv, const char *acct_name, uint16 sec_chan, const char *comp_name, DOM_CHAL *clnt_chal, uint32 clnt_flgs) { - if (q_a == NULL) return; + if (q_a == NULL) return False; DEBUG(5,("make_q_auth_2: %d\n", __LINE__)); @@ -422,15 +454,17 @@ void make_q_auth_2(NET_Q_AUTH_2 *q_a, q_a->clnt_flgs.neg_flags = clnt_flgs; DEBUG(5,("make_q_auth_2: %d\n", __LINE__)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void net_io_q_auth_2(char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth) +BOOL net_io_q_auth_2(char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth) { int old_align; - if (q_a == NULL) return; + if (q_a == NULL) return False; prs_debug(ps, depth, desc, "net_io_q_auth_2"); depth++; @@ -444,14 +478,16 @@ void net_io_q_auth_2(char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth) smb_io_chal ("", &(q_a->clnt_chal), ps, depth); /* client-calculated credentials */ ps->align = old_align; net_io_neg_flags("", &(q_a->clnt_flgs), ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth) +BOOL net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth) { - if (r_a == NULL) return; + if (r_a == NULL) return False; prs_debug(ps, depth, desc, "net_io_r_auth_2"); depth++; @@ -462,30 +498,34 @@ void net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth) net_io_neg_flags("", &(r_a->srv_flgs), ps, depth); prs_uint32("status", ps, depth, &(r_a->status)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void make_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char *logon_srv, char *acct_name, +BOOL make_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char *logon_srv, char *acct_name, uint16 sec_chan, char *comp_name, DOM_CRED *cred, char nt_cypher[16]) { - if (q_s == NULL || cred == NULL) return; + if (q_s == NULL || cred == NULL) return False; DEBUG(5,("make_q_srv_pwset\n")); make_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)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void net_io_q_srv_pwset(char *desc, NET_Q_SRV_PWSET *q_s, prs_struct *ps, int depth) +BOOL net_io_q_srv_pwset(char *desc, NET_Q_SRV_PWSET *q_s, prs_struct *ps, int depth) { - if (q_s == NULL) return; + if (q_s == NULL) return False; prs_debug(ps, depth, desc, "net_io_q_srv_pwset"); depth++; @@ -494,14 +534,16 @@ void net_io_q_srv_pwset(char *desc, NET_Q_SRV_PWSET *q_s, prs_struct *ps, int d smb_io_clnt_info("", &(q_s->clnt_id), ps, depth); /* client identification/authentication info */ prs_uint8s (False, "pwd", ps, depth, q_s->pwd, 16); /* new password - undocumented */ + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int depth) +BOOL net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int depth) { - if (r_s == NULL) return; + if (r_s == NULL) return False; prs_debug(ps, depth, desc, "net_io_r_srv_pwset"); depth++; @@ -511,6 +553,8 @@ void net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int d smb_io_cred("", &(r_s->srv_cred), ps, depth); /* server challenge */ prs_uint32("status", ps, depth, &(r_s->status)); + + return True; } @@ -537,12 +581,14 @@ static int make_dom_sid2s(char *sids_str, DOM_SID2 *sids, int max_sids) } return count; + + return True; } /******************************************************************* makes a NET_ID_INFO_1 structure. ********************************************************************/ -void make_id_info1(NET_ID_INFO_1 *id, char *domain_name, +BOOL make_id_info1(NET_ID_INFO_1 *id, char *domain_name, uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, char *user_name, char *wksta_name, char sess_key[16], @@ -555,7 +601,7 @@ void make_id_info1(NET_ID_INFO_1 *id, char *domain_name, unsigned char lm_owf[16]; unsigned char nt_owf[16]; - if (id == NULL) return; + if (id == NULL) return False; DEBUG(5,("make_id_info1: %d\n", __LINE__)); @@ -607,14 +653,16 @@ void make_id_info1(NET_ID_INFO_1 *id, char *domain_name, make_unistr2(&(id->uni_domain_name), domain_name, len_domain_name); make_unistr2(&(id->uni_user_name ), user_name , len_user_name ); make_unistr2(&(id->uni_wksta_name ), wksta_name , len_wksta_name ); + + return True; } /******************************************************************* reads or writes an NET_ID_INFO_1 structure. ********************************************************************/ -static void net_io_id_info1(char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth) +static BOOL net_io_id_info1(char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth) { - if (id == NULL) return; + if (id == NULL) return False; prs_debug(ps, depth, desc, "net_io_id_info1"); depth++; @@ -640,6 +688,8 @@ static void net_io_id_info1(char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int smb_io_unistr2("unistr2", &(id->uni_user_name ), id->hdr_user_name.buffer, ps, depth); smb_io_unistr2("unistr2", &(id->uni_wksta_name ), id->hdr_wksta_name.buffer, ps, depth); } + + return True; } /******************************************************************* @@ -657,7 +707,7 @@ checking for a logon as it doesn't export the password hashes to anyone who has compromised the secure channel. JRA. ********************************************************************/ -void make_id_info2(NET_ID_INFO_2 *id, char *domain_name, +BOOL make_id_info2(NET_ID_INFO_2 *id, char *domain_name, uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, char *user_name, char *wksta_name, unsigned char lm_challenge[8], @@ -672,7 +722,7 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name, unsigned char lm_owf[24]; unsigned char nt_owf[24]; - if (id == NULL) return; + if (id == NULL) return False; DEBUG(5,("make_id_info2: %d\n", __LINE__)); @@ -710,14 +760,16 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name, make_string2(&(id->nt_chal_resp ), (char *)nt_chal_resp , nt_chal_resp_len); make_string2(&(id->lm_chal_resp ), (char *)lm_chal_resp , lm_chal_resp_len); + + return True; } /******************************************************************* reads or writes an NET_ID_INFO_2 structure. ********************************************************************/ -static void net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int depth) +static BOOL net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int depth) { - if (id == NULL) return; + if (id == NULL) return False; prs_debug(ps, depth, desc, "net_io_id_info2"); depth++; @@ -747,18 +799,20 @@ static void net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int smb_io_string2("nt_chal_resp" , &(id->nt_chal_resp) , id->hdr_nt_chal_resp.buffer, ps, depth); smb_io_string2("lm_chal_resp" , &(id->lm_chal_resp) , id->hdr_lm_chal_resp.buffer, ps, depth); } + + return True; } /******************************************************************* makes a DOM_SAM_INFO structure. ********************************************************************/ -void make_sam_info(DOM_SAM_INFO *sam, +BOOL make_sam_info(DOM_SAM_INFO *sam, char *logon_srv, char *comp_name, DOM_CRED *clnt_cred, DOM_CRED *rtn_cred, uint16 logon_level, NET_ID_INFO_CTR *ctr, uint16 validation_level) { - if (sam == NULL) return; + if (sam == NULL) return False; DEBUG(5,("make_sam_info: %d\n", __LINE__)); @@ -777,14 +831,16 @@ void make_sam_info(DOM_SAM_INFO *sam, sam->logon_level = logon_level; sam->ctr = ctr; sam->validation_level = validation_level; + + return True; } /******************************************************************* reads or writes a DOM_SAM_INFO structure. ********************************************************************/ -static void net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR *ctr, prs_struct *ps, int depth) { - if (ctr == NULL) return; + if (ctr == NULL) return False; prs_debug(ps, depth, desc, "smb_io_sam_info"); depth++; @@ -812,14 +868,16 @@ static void net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR *ctr, prs_struct *ps break; } } + + return True; } /******************************************************************* reads or writes a DOM_SAM_INFO structure. ********************************************************************/ -static void smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int depth) +static BOOL smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int depth) { - if (sam == NULL) return; + if (sam == NULL) return False; prs_debug(ps, depth, desc, "smb_io_sam_info"); depth++; @@ -839,12 +897,14 @@ static void smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int } prs_uint16("validation_level", ps, depth, &(sam->validation_level)); + + return True; } /************************************************************************* make_net_user_info3 *************************************************************************/ -void make_net_user_info3(NET_USER_INFO_3 *usr, +BOOL make_net_user_info3(NET_USER_INFO_3 *usr, NTTIME *logon_time, NTTIME *logoff_time, @@ -959,17 +1019,19 @@ void make_net_user_info3(NET_USER_INFO_3 *usr, make_dom_sid2(&(usr->dom_sid), dom_sid); /* "other" sids are set up above */ + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth) +static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth) { int i; - if (usr == NULL) return; + if (usr == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_lsa_user_info"); depth++; @@ -1041,14 +1103,16 @@ static void net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, smb_io_dom_sid2("", &(usr->other_sids[i]), ps, depth); /* other domain SIDs */ } } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void net_io_q_sam_logon(char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, int depth) +BOOL net_io_q_sam_logon(char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, int depth) { - if (q_l == NULL) return; + if (q_l == NULL) return False; prs_debug(ps, depth, desc, "net_io_q_sam_logon"); depth++; @@ -1056,14 +1120,16 @@ void net_io_q_sam_logon(char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, int d prs_align(ps); smb_io_sam_info("", &(q_l->sam_id), ps, depth); /* domain SID */ + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void net_io_r_sam_logon(char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, int depth) +BOOL net_io_r_sam_logon(char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, int depth) { - if (r_l == NULL) return; + if (r_l == NULL) return False; prs_debug(ps, depth, desc, "net_io_r_sam_logon"); depth++; @@ -1084,14 +1150,16 @@ void net_io_r_sam_logon(char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, int d prs_uint32("status ", ps, depth, &(r_l->status)); prs_align(ps); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void net_io_q_sam_logoff(char *desc, NET_Q_SAM_LOGOFF *q_l, prs_struct *ps, int depth) +BOOL net_io_q_sam_logoff(char *desc, NET_Q_SAM_LOGOFF *q_l, prs_struct *ps, int depth) { - if (q_l == NULL) return; + if (q_l == NULL) return False; prs_debug(ps, depth, desc, "net_io_q_sam_logoff"); depth++; @@ -1099,14 +1167,16 @@ void net_io_q_sam_logoff(char *desc, NET_Q_SAM_LOGOFF *q_l, prs_struct *ps, int prs_align(ps); smb_io_sam_info("", &(q_l->sam_id), ps, depth); /* domain SID */ + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int depth) +BOOL net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int depth) { - if (r_l == NULL) return; + if (r_l == NULL) return False; prs_debug(ps, depth, desc, "net_io_r_sam_logoff"); depth++; @@ -1117,15 +1187,17 @@ void net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int smb_io_cred("", &(r_l->srv_creds), ps, depth); /* server credentials. server time stamp appears to be ignored. */ prs_uint32("status ", ps, depth, &(r_l->status)); + + return True; } /******************************************************************* makes a NET_Q_SAM_SYNC structure. ********************************************************************/ -void make_q_sam_sync(NET_Q_SAM_SYNC *q_s, char *srv_name, char *cli_name, +BOOL make_q_sam_sync(NET_Q_SAM_SYNC *q_s, char *srv_name, char *cli_name, DOM_CRED *cli_creds, uint32 database_id) { - if (q_s == NULL) return; + if (q_s == NULL) return False; DEBUG(5,("make_q_sam_sync\n")); @@ -1139,14 +1211,16 @@ void make_q_sam_sync(NET_Q_SAM_SYNC *q_s, char *srv_name, char *cli_name, q_s->restart_state = 0; q_s->sync_context = 0; q_s->max_size = 0xffff; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void net_io_q_sam_sync(char *desc, NET_Q_SAM_SYNC *q_s, prs_struct *ps, int depth) +BOOL net_io_q_sam_sync(char *desc, NET_Q_SAM_SYNC *q_s, prs_struct *ps, int depth) { - if (q_s == NULL) return; + if (q_s == NULL) return False; prs_debug(ps, depth, desc, "net_io_q_sam_sync"); depth++; @@ -1162,14 +1236,16 @@ void net_io_q_sam_sync(char *desc, NET_Q_SAM_SYNC *q_s, prs_struct *ps, int dept prs_uint32("sync_context ", ps, depth, &(q_s->sync_context )); prs_uint32("max_size", ps, depth, &(q_s->max_size)); + + return True; } /******************************************************************* makes a SAM_DELTA_HDR structure. ********************************************************************/ -void make_sam_delta_hdr(SAM_DELTA_HDR *delta, uint16 type, uint32 rid) +BOOL make_sam_delta_hdr(SAM_DELTA_HDR *delta, uint16 type, uint32 rid) { - if (delta == NULL) return; + if (delta == NULL) return False; DEBUG(5,("make_sam_delta_hdr\n")); @@ -1178,14 +1254,16 @@ void make_sam_delta_hdr(SAM_DELTA_HDR *delta, uint16 type, uint32 rid) delta->type3 = type; delta->ptr_delta = 1; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void net_io_sam_delta_hdr(char *desc, SAM_DELTA_HDR *delta, prs_struct *ps, int depth) +static BOOL net_io_sam_delta_hdr(char *desc, SAM_DELTA_HDR *delta, prs_struct *ps, int depth) { - if (delta == NULL) return; + if (delta == NULL) return False; prs_debug(ps, depth, desc, "net_io_sam_delta_hdr"); depth++; @@ -1196,14 +1274,16 @@ static void net_io_sam_delta_hdr(char *desc, SAM_DELTA_HDR *delta, prs_struct *p prs_uint32("type3", ps, depth, &(delta->type3 )); prs_uint32("ptr_delta", ps, depth, &(delta->ptr_delta )); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void net_io_sam_domain_info(char *desc, SAM_DOMAIN_INFO *info, prs_struct *ps, int depth) +static BOOL net_io_sam_domain_info(char *desc, SAM_DOMAIN_INFO *info, prs_struct *ps, int depth) { - if (info == NULL) return; + if (info == NULL) return False; prs_debug(ps, depth, desc, "net_io_sam_domain_info"); depth++; @@ -1232,14 +1312,16 @@ static void net_io_sam_domain_info(char *desc, SAM_DOMAIN_INFO *info, prs_struct info->hdr_sec_desc.buffer, ps, depth); smb_io_unistr2("buf_unknown" , &(info->buf_unknown ), info->hdr_unknown .buffer, ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void net_io_sam_group_info(char *desc, SAM_GROUP_INFO *info, prs_struct *ps, int depth) +static BOOL net_io_sam_group_info(char *desc, SAM_GROUP_INFO *info, prs_struct *ps, int depth) { - if (info == NULL) return; + if (info == NULL) return False; prs_debug(ps, depth, desc, "net_io_sam_group_info"); depth++; @@ -1256,12 +1338,14 @@ static void net_io_sam_group_info(char *desc, SAM_GROUP_INFO *info, prs_struct * info->hdr_grp_desc.buffer, ps, depth); smb_io_buffer4("buf_sec_desc", &(info->buf_sec_desc), info->hdr_sec_desc.buffer, ps, depth); + + return True; } /******************************************************************* makes a SAM_ACCOUNT_INFO structure. ********************************************************************/ -void make_sam_account_info(SAM_ACCOUNT_INFO *info, char *user_name, +BOOL make_sam_account_info(SAM_ACCOUNT_INFO *info, char *user_name, char *full_name, uint32 user_rid, uint32 group_rid, char *home_dir, char *dir_drive, char *logon_script, char *acct_desc, uint32 acb_info, char *profile) @@ -1320,15 +1404,17 @@ void make_sam_account_info(SAM_ACCOUNT_INFO *info, char *user_name, make_unistr2(&(info->uni_logon_script), logon_script, len_logon_script+1); make_unistr2(&(info->uni_acct_desc), acct_desc, len_acct_desc+1); make_unistr2(&(info->uni_profile ), profile , len_profile +1); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void net_io_sam_passwd_info(char *desc, SAM_PWD *pwd, +static BOOL net_io_sam_passwd_info(char *desc, SAM_PWD *pwd, prs_struct *ps, int depth) { - if (pwd == NULL) return; + if (pwd == NULL) return False; prs_debug(ps, depth, desc, "net_io_sam_passwd_info"); depth++; @@ -1343,18 +1429,20 @@ static void net_io_sam_passwd_info(char *desc, SAM_PWD *pwd, smb_io_unihdr("", &(pwd->hdr_empty_lm), ps, depth); smb_io_unihdr("", &(pwd->hdr_empty_nt), ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void net_io_sam_account_info(char *desc, uint8 sess_key[16], +static BOOL net_io_sam_account_info(char *desc, uint8 sess_key[16], SAM_ACCOUNT_INFO *info, prs_struct *ps, int depth) { BUFHDR2 hdr_priv_data; int i; - if (info == NULL) return; + if (info == NULL) return False; prs_debug(ps, depth, desc, "net_io_sam_account_info"); depth++; @@ -1470,17 +1558,19 @@ static void net_io_sam_account_info(char *desc, uint8 sess_key[16], smb_io_unistr2("uni_profile" , &(info->uni_profile ), info->hdr_profile.buffer, ps, depth); prs_align(ps); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_struct *ps, int depth) +static BOOL net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_struct *ps, int depth) { int i; fstring tmp; - if (info == NULL) return; + if (info == NULL) return False; prs_debug(ps, depth, desc, "net_io_sam_group_mem_info"); depth++; @@ -1497,7 +1587,7 @@ static void net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_ if (info->num_members2 != info->num_members) { /* RPC fault */ - return; + return False; } SMB_ASSERT_ARRAY(info->rids, info->num_members2); @@ -1516,7 +1606,7 @@ static void net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_ if (info->num_members3 != info->num_members) { /* RPC fault */ - return; + return False; } SMB_ASSERT_ARRAY(info->attribs, info->num_members3); @@ -1528,14 +1618,16 @@ static void net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_ prs_uint32(tmp, ps, depth, &(info->attribs[i])); } } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void net_io_sam_alias_info(char *desc, SAM_ALIAS_INFO *info, prs_struct *ps, int depth) +static BOOL net_io_sam_alias_info(char *desc, SAM_ALIAS_INFO *info, prs_struct *ps, int depth) { - if (info == NULL) return; + if (info == NULL) return False; prs_debug(ps, depth, desc, "net_io_sam_alias_info"); depth++; @@ -1552,17 +1644,19 @@ static void net_io_sam_alias_info(char *desc, SAM_ALIAS_INFO *info, prs_struct * info->hdr_sec_desc.buffer, ps, depth); smb_io_unistr2("uni_als_desc", &(info->uni_als_desc), info->hdr_als_name.buffer, ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_struct *ps, int depth) +static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_struct *ps, int depth) { int i; fstring tmp; - if (info == NULL) return; + if (info == NULL) return False; prs_debug(ps, depth, desc, "net_io_sam_alias_mem_info"); depth++; @@ -1578,7 +1672,7 @@ static void net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_ if (info->num_sids != info->num_members) { /* RPC fault */ - return; + return False; } SMB_ASSERT_ARRAY(info->ptr_sids, info->num_sids); @@ -1602,16 +1696,18 @@ static void net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_ } } } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], +static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], SAM_DELTA_CTR *delta, uint16 type, prs_struct *ps, int depth) { - if (delta == NULL) return; + if (delta == NULL) return False; prs_debug(ps, depth, desc, "net_io_sam_delta_ctr"); depth++; @@ -1661,17 +1757,19 @@ static void net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], break; } } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void net_io_r_sam_sync(char *desc, uint8 sess_key[16], +BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16], NET_R_SAM_SYNC *r_s, prs_struct *ps, int depth) { int i; - if (r_s == NULL) return; + if (r_s == NULL) return False; prs_debug(ps, depth, desc, "net_io_r_sam_sync"); depth++; @@ -1690,7 +1788,7 @@ void net_io_r_sam_sync(char *desc, uint8 sess_key[16], if (r_s->num_deltas2 != r_s->num_deltas) { /* RPC fault */ - return; + return False; } for (i = 0; i < r_s->num_deltas2; i++) @@ -1709,4 +1807,6 @@ void net_io_r_sam_sync(char *desc, uint8 sess_key[16], prs_align(ps); prs_uint32("status", ps, depth, &(r_s->status)); + + return True; } diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 4e007ce07c..f30a05e346 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -2,8 +2,8 @@ Unix SMB/Netbios implementation. Version 1.9. Samba memory buffer functions - Copyright (C) Andrew Tridgell 1992-1997 - Copyright (C) Luke Kenneth Casson Leighton 1996-1997 + Copyright (C) Andrew Tridgell 1992-1999 + Copyright (C) Luke Kenneth Casson Leighton 1996-1999 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 @@ -103,7 +103,7 @@ BOOL prs_grow(prs_struct *ps) /******************************************************************* stream a uint8 ********************************************************************/ -BOOL prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8) +BOOL _prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8) { char *q = mem_data(&(ps->data), ps->offset); if (q == NULL) return False; @@ -117,7 +117,7 @@ BOOL prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8) /******************************************************************* stream a uint16 ********************************************************************/ -BOOL prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16) +BOOL _prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16) { char *q = mem_data(&(ps->data), ps->offset); if (q == NULL) return False; @@ -131,7 +131,7 @@ BOOL prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16) /******************************************************************* hash a stream. ********************************************************************/ -BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) +BOOL _prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) { char *q = mem_data(&(ps->data), offset); if (q == NULL) return False; @@ -152,7 +152,7 @@ BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) /******************************************************************* stream a uint32 ********************************************************************/ -BOOL prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) +BOOL _prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) { char *q = mem_data(&(ps->data), ps->offset); if (q == NULL) return False; @@ -167,7 +167,7 @@ BOOL prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) /****************************************************************** stream an array of uint8s. length is number of uint8s ********************************************************************/ -BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *data8s, int len) +BOOL _prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *data8s, int len) { char *q = mem_data(&(ps->data), ps->offset); int end_offset = ps->offset + len * sizeof(uint8); @@ -184,7 +184,7 @@ BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *dat /****************************************************************** stream an array of uint16s. length is number of uint16s ********************************************************************/ -BOOL prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len) +BOOL _prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len) { char *q = mem_data(&(ps->data), ps->offset); int end_offset = ps->offset + len * sizeof(uint16); @@ -201,7 +201,7 @@ BOOL prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *d /****************************************************************** stream an array of uint32s. length is number of uint32s ********************************************************************/ -BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *data32s, int len) +BOOL _prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *data32s, int len) { char *q = mem_data(&(ps->data), ps->offset); int end_offset = ps->offset + len * sizeof(uint32); @@ -219,7 +219,7 @@ BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *d stream a "not" unicode string, length/buffer specified separately, in byte chars ********************************************************************/ -BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 *str) +BOOL _prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 *str) { char *q = mem_data(&(ps->data), ps->offset); int end_offset = ps->offset + str->buf_len; @@ -237,7 +237,7 @@ BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 * stream a string, length/buffer specified separately, in uint8 chars. ********************************************************************/ -BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 *str) +BOOL _prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 *str) { char *q = mem_data(&(ps->data), ps->offset); int end_offset = ps->offset + str->str_str_len * sizeof(uint8); @@ -255,7 +255,7 @@ BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 * stream a unicode string, length/buffer specified separately, in uint16 chars. ********************************************************************/ -BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *str) +BOOL _prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *str) { char *q = mem_data(&(ps->data), ps->offset); int end_offset = ps->offset + str->uni_str_len * sizeof(uint16); @@ -273,7 +273,7 @@ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 * stream a unicode string, length/buffer specified separately, in uint16 chars. ********************************************************************/ -BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int depth) +BOOL _prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int depth) { char *q = mem_data(&(ps->data), ps->offset); int end_offset = ps->offset + str->uni_str_len * sizeof(uint16); @@ -290,7 +290,7 @@ BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int de /******************************************************************* stream a unicode null-terminated string ********************************************************************/ -BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) +BOOL _prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) { int i = -1; uint8 *start = (uint8*)mem_data(&(ps->data), ps->offset); @@ -322,7 +322,7 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) (up to max size of pstring - 1024 chars). ********************************************************************/ -BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, uint16 max_buf_size) +BOOL _prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, uint16 max_buf_size) { uint8 *start = (uint8*)mem_data(&(ps->data), ps->offset); int i = -1; /* start off at zero after 1st i++ */ @@ -358,13 +358,13 @@ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, ui prs_uint16 wrapper. call this and it sets up a pointer to where the uint16 should be stored, or gets the size if reading ********************************************************************/ -BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset) +BOOL _prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset) { (*offset) = ps->offset; if (ps->io) { /* reading. */ - return prs_uint16(name, ps, depth, data16); + return _prs_uint16(name, ps, depth, data16); } else { @@ -377,7 +377,7 @@ BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint3 prs_uint16 wrapper. call this and it retrospectively stores the size. does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ -BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, +BOOL _prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 ptr_uint16, uint32 start_offset) { if (!ps->io) @@ -401,13 +401,13 @@ BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, prs_uint32 wrapper. call this and it sets up a pointer to where the uint32 should be stored, or gets the size if reading ********************************************************************/ -BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset) +BOOL _prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset) { (*offset) = ps->offset; if (ps->io) { /* reading. */ - return prs_uint32(name, ps, depth, data32); + return _prs_uint32(name, ps, depth, data32); } else { @@ -420,7 +420,7 @@ BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint3 prs_uint32 wrapper. call this and it retrospectively stores the size. does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ -BOOL prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32, +BOOL _prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 ptr_uint32, uint32 data_size) { if (!ps->io) diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index a7e3c1d8be..e37fac16e9 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -2,9 +2,9 @@ * Unix SMB/Netbios implementation. * Version 1.9. * 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 Tridgell 1992-1999, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, + * Copyright (C) Paul Ashton 1997-1999. * * 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 @@ -30,21 +30,23 @@ extern int DEBUGLEVEL; /******************************************************************* creates a structure. ********************************************************************/ -void make_reg_q_open_hklm(REG_Q_OPEN_HKLM *q_o, +BOOL make_reg_q_open_hklm(REG_Q_OPEN_HKLM *q_o, uint16 unknown_0, uint32 level) { q_o->ptr = 1; q_o->unknown_0 = unknown_0; q_o->unknown_1 = 0x0; /* random - changes */ q_o->level = level; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_open_hklm(char *desc, REG_Q_OPEN_HKLM *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_open_hklm(char *desc, REG_Q_OPEN_HKLM *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_open_hklm"); depth++; @@ -58,15 +60,17 @@ void reg_io_q_open_hklm(char *desc, REG_Q_OPEN_HKLM *r_q, prs_struct *ps, int d prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1)); prs_uint32("level ", ps, depth, &(r_q->level )); } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_open_hklm(char *desc, REG_R_OPEN_HKLM *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_open_hklm(char *desc, REG_R_OPEN_HKLM *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return; + if (r_r == NULL) return False; prs_debug(ps, depth, desc, "reg_io_r_open_hklm"); depth++; @@ -76,23 +80,27 @@ void reg_io_r_open_hklm(char *desc, REG_R_OPEN_HKLM *r_r, prs_struct *ps, int d smb_io_pol_hnd("", &(r_r->pol), ps, depth); prs_uint32("status", ps, depth, &(r_r->status)); + + return True; } /******************************************************************* creates a structure. ********************************************************************/ -void make_reg_q_flush_key(REG_Q_FLUSH_KEY *q_u, POLICY_HND *pol) +BOOL make_reg_q_flush_key(REG_Q_FLUSH_KEY *q_u, POLICY_HND *pol) { memcpy(&(q_u->pol), pol, sizeof(q_u->pol)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_flush_key(char *desc, REG_Q_FLUSH_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_flush_key(char *desc, REG_Q_FLUSH_KEY *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_flush_key"); depth++; @@ -100,15 +108,17 @@ void reg_io_q_flush_key(char *desc, REG_Q_FLUSH_KEY *r_q, prs_struct *ps, int d prs_align(ps); smb_io_pol_hnd("", &(r_q->pol), ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_flush_key(char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_flush_key(char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return; + if (r_r == NULL) return False; prs_debug(ps, depth, desc, "reg_io_r_flush_key"); depth++; @@ -116,12 +126,15 @@ void reg_io_r_flush_key(char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, int d prs_align(ps); prs_uint32("status", ps, depth, &(r_r->status)); + + return True; } /******************************************************************* reads or writes SEC_DESC_BUF and SEC_DATA structures. ********************************************************************/ -static void reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, SEC_DESC_BUF *data, prs_struct *ps, int depth) +static BOOL reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, + SEC_DESC_BUF *data, prs_struct *ps, int depth) { if (ptr != 0) { @@ -142,13 +155,15 @@ static void reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, SEC_DES ps->offset = old_offset + data->len + sizeof(uint32) * ((ptr3 != NULL) ? 5 : 3); prs_align(ps); } + + return True; } /******************************************************************* creates a structure. ********************************************************************/ -void make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, +BOOL make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, char *name, char *class, SEC_ACCESS *sam_access, SEC_DESC_BUF *sec_buf, @@ -180,14 +195,16 @@ void make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, make_sec_desc_buf(q_c->data, sec_len, sec); q_c->unknown_2 = 0x00000000; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_create_key(char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_create_key(char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_create_key"); depth++; @@ -217,15 +234,17 @@ void reg_io_q_create_key(char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int reg_io_hdrbuf_sec(r_q->ptr2, &r_q->ptr3, &r_q->hdr_sec, r_q->data, ps, depth); prs_uint32("unknown_2", ps, depth, &(r_q->unknown_2)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_create_key(char *desc, REG_R_CREATE_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_create_key(char *desc, REG_R_CREATE_KEY *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return; + if (r_r == NULL) return False; prs_debug(ps, depth, desc, "reg_io_r_create_key"); depth++; @@ -236,13 +255,15 @@ void reg_io_r_create_key(char *desc, REG_R_CREATE_KEY *r_r, prs_struct *ps, int prs_uint32("unknown", ps, depth, &(r_r->unknown)); prs_uint32("status", ps, depth, &(r_r->status)); + + return True; } /******************************************************************* creates a structure. ********************************************************************/ -void make_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd, +BOOL make_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd, char *name) { int len_name = name != NULL ? strlen(name ) + 1: 0; @@ -252,14 +273,16 @@ void make_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd, make_uni_hdr(&(q_c->hdr_name), len_name); make_unistr2(&(q_c->uni_name), name, len_name); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_delete_val(char *desc, REG_Q_DELETE_VALUE *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_delete_val(char *desc, REG_Q_DELETE_VALUE *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_delete_val"); depth++; @@ -271,15 +294,17 @@ void reg_io_q_delete_val(char *desc, REG_Q_DELETE_VALUE *r_q, prs_struct *ps, i smb_io_unihdr ("", &(r_q->hdr_name), ps, depth); smb_io_unistr2("", &(r_q->uni_name), r_q->hdr_name.buffer, ps, depth); prs_align(ps); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_delete_val(char *desc, REG_R_DELETE_VALUE *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_delete_val(char *desc, REG_R_DELETE_VALUE *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return; + if (r_r == NULL) return False; prs_debug(ps, depth, desc, "reg_io_r_delete_val"); depth++; @@ -287,13 +312,15 @@ void reg_io_r_delete_val(char *desc, REG_R_DELETE_VALUE *r_r, prs_struct *ps, i prs_align(ps); prs_uint32("status", ps, depth, &(r_r->status)); + + return True; } /******************************************************************* creates a structure. ********************************************************************/ -void make_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd, +BOOL make_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd, char *name) { int len_name = name != NULL ? strlen(name ) + 1: 0; @@ -303,14 +330,16 @@ void make_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd, make_uni_hdr(&(q_c->hdr_name), len_name); make_unistr2(&(q_c->uni_name), name, len_name); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_delete_key(char *desc, REG_Q_DELETE_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_delete_key(char *desc, REG_Q_DELETE_KEY *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_delete_key"); depth++; @@ -322,15 +351,17 @@ void reg_io_q_delete_key(char *desc, REG_Q_DELETE_KEY *r_q, prs_struct *ps, int smb_io_unihdr ("", &(r_q->hdr_name), ps, depth); smb_io_unistr2("", &(r_q->uni_name), r_q->hdr_name.buffer, ps, depth); prs_align(ps); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_delete_key(char *desc, REG_R_DELETE_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_delete_key(char *desc, REG_R_DELETE_KEY *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return; + if (r_r == NULL) return False; prs_debug(ps, depth, desc, "reg_io_r_delete_key"); depth++; @@ -338,13 +369,15 @@ void reg_io_r_delete_key(char *desc, REG_R_DELETE_KEY *r_r, prs_struct *ps, int prs_align(ps); prs_uint32("status", ps, depth, &(r_r->status)); + + return True; } /******************************************************************* creates a structure. ********************************************************************/ -void make_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, +BOOL make_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, uint32 max_class_len) { ZERO_STRUCTP(q_o); @@ -354,14 +387,16 @@ void make_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, q_o->hdr_class.uni_max_len = max_class_len * 2; q_o->hdr_class.buffer = max_class_len > 0 ? 1 : 0; q_o->uni_class.uni_max_len = max_class_len; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_query_key(char *desc, REG_Q_QUERY_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_query_key(char *desc, REG_Q_QUERY_KEY *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_query_key"); depth++; @@ -373,15 +408,17 @@ void reg_io_q_query_key(char *desc, REG_Q_QUERY_KEY *r_q, prs_struct *ps, int d smb_io_unistr2("", &(r_q->uni_class), r_q->hdr_class.buffer, ps, depth); prs_align(ps); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return; + if (r_r == NULL) return False; prs_debug(ps, depth, desc, "reg_io_r_query_key"); depth++; @@ -403,23 +440,27 @@ void reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int d smb_io_time("mod_time ", &(r_r->mod_time), ps, depth); prs_uint32("status", ps, depth, &(r_r->status)); + + return True; } /******************************************************************* creates a structure. ********************************************************************/ -void make_reg_q_unk_1a(REG_Q_UNK_1A *q_o, POLICY_HND *hnd) +BOOL make_reg_q_unk_1a(REG_Q_UNK_1A *q_o, POLICY_HND *hnd) { memcpy(&(q_o->pol), hnd, sizeof(q_o->pol)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_unk_1a(char *desc, REG_Q_UNK_1A *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_unk_1a(char *desc, REG_Q_UNK_1A *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_unk_1a"); depth++; @@ -427,15 +468,17 @@ void reg_io_q_unk_1a(char *desc, REG_Q_UNK_1A *r_q, prs_struct *ps, int depth) prs_align(ps); smb_io_pol_hnd("", &(r_q->pol), ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_unk_1a(char *desc, REG_R_UNK_1A *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_unk_1a(char *desc, REG_R_UNK_1A *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return; + if (r_r == NULL) return False; prs_debug(ps, depth, desc, "reg_io_r_unk_1a"); depth++; @@ -444,27 +487,31 @@ void reg_io_r_unk_1a(char *desc, REG_R_UNK_1A *r_r, prs_struct *ps, int depth) prs_uint32("unknown", ps, depth, &(r_r->unknown)); prs_uint32("status" , ps, depth, &(r_r->status )); + + return True; } /******************************************************************* creates a structure. ********************************************************************/ -void make_reg_q_open_hku(REG_Q_OPEN_HKU *q_o, +BOOL make_reg_q_open_hku(REG_Q_OPEN_HKU *q_o, uint16 unknown_0, uint32 level) { q_o->ptr = 1; q_o->unknown_0 = unknown_0; q_o->unknown_1 = 0x0; /* random - changes */ q_o->level = level; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_open_hku(char *desc, REG_Q_OPEN_HKU *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_open_hku(char *desc, REG_Q_OPEN_HKU *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_open_hku"); depth++; @@ -478,15 +525,17 @@ void reg_io_q_open_hku(char *desc, REG_Q_OPEN_HKU *r_q, prs_struct *ps, int dep prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1)); prs_uint32("level ", ps, depth, &(r_q->level )); } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_open_hku(char *desc, REG_R_OPEN_HKU *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_open_hku(char *desc, REG_R_OPEN_HKU *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return; + if (r_r == NULL) return False; prs_debug(ps, depth, desc, "reg_io_r_open_hku"); depth++; @@ -496,27 +545,31 @@ void reg_io_r_open_hku(char *desc, REG_R_OPEN_HKU *r_r, prs_struct *ps, int dep smb_io_pol_hnd("", &(r_r->pol), ps, depth); prs_uint32("status", ps, depth, &(r_r->status)); + + return True; } /******************************************************************* makes an REG_Q_CLOSE structure. ********************************************************************/ -void make_reg_q_close(REG_Q_CLOSE *q_c, POLICY_HND *hnd) +BOOL make_reg_q_close(REG_Q_CLOSE *q_c, POLICY_HND *hnd) { - if (q_c == NULL || hnd == NULL) return; + if (q_c == NULL || hnd == NULL) return False; DEBUG(5,("make_reg_q_close\n")); memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_close(char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth) +BOOL reg_io_q_close(char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_close"); depth++; @@ -525,14 +578,16 @@ void reg_io_q_close(char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth) smb_io_pol_hnd("", &(q_u->pol), ps, depth); prs_align(ps); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) +BOOL reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "reg_io_r_close"); depth++; @@ -543,15 +598,17 @@ void reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, +BOOL make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, uint32 buf_len, SEC_DESC *sec_desc) { - if (q_i == NULL) return; + if (q_i == NULL) return False; memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); @@ -560,14 +617,16 @@ void make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, q_i->ptr = 1; make_buf_hdr(&(q_i->hdr_sec), buf_len, buf_len); make_sec_desc_buf(q_i->data, buf_len, sec_desc); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_set_key_sec"); depth++; @@ -580,14 +639,16 @@ void reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, i prs_uint32("ptr ", ps, depth, &(r_q->ptr )); reg_io_hdrbuf_sec(r_q->ptr, NULL, &r_q->hdr_sec, r_q->data, ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_r_set_key_sec"); depth++; @@ -595,16 +656,18 @@ void reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, in prs_align(ps); prs_uint32("status", ps, depth, &(r_q->status)); + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, +BOOL make_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, uint32 buf_len, SEC_DESC_BUF *sec_buf) { - if (q_i == NULL) return; + if (q_i == NULL) return False; memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); @@ -620,14 +683,16 @@ void make_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, make_buf_hdr(&(q_i->hdr_sec), buf_len, 0); make_sec_desc_buf(q_i->data, buf_len, NULL); } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_get_key_sec(char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_get_key_sec(char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_get_key_sec"); depth++; @@ -640,6 +705,8 @@ void reg_io_q_get_key_sec(char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, i prs_uint32("ptr ", ps, depth, &(r_q->ptr )); reg_io_hdrbuf_sec(r_q->ptr, NULL, &r_q->hdr_sec, r_q->data, ps, depth); + + return True; } #if 0 @@ -650,22 +717,24 @@ makes a structure. uint32 buf_len, uint8 *buf, uint32 status) { - if (r_i == NULL) return; + if (r_i == NULL) return False; r_i->ptr = 1; make_buf_hdr(&(r_i->hdr_sec), buf_len, buf_len); make_sec_desc_buf(r_i->data, buf_len, 1); r_i->status = status; /* 0x0000 0000 or 0x0000 007a */ + + return True; } #endif /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_get_key_sec(char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_get_key_sec(char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_r_get_key_sec"); depth++; @@ -683,18 +752,20 @@ void reg_io_r_get_key_sec(char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, i } prs_uint32("status", ps, depth, &(r_q->status)); + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char *product_type, +BOOL make_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char *product_type, time_t unix_time, uint8 major, uint8 minor) { int len_type = strlen(product_type); - if (q_i == NULL) return; + if (q_i == NULL) return False; memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); @@ -714,14 +785,16 @@ void make_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char *product_type, q_i->ptr3 = 1; q_i->unknown = 0x00000000; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_info"); depth++; @@ -759,19 +832,21 @@ void reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) { prs_uint32("unknown", ps, depth, &(r_q->unknown)); } + + return True; } /******************************************************************* creates a structure. ********************************************************************/ -void make_reg_r_info(REG_R_INFO *r_r, +BOOL make_reg_r_info(REG_R_INFO *r_r, uint32 level, char *os_type, uint32 status) { int len; - if (r_r == NULL || os_type == NULL) return; + if (r_r == NULL || os_type == NULL) return False; len = strlen(os_type); @@ -785,14 +860,16 @@ void make_reg_r_info(REG_R_INFO *r_r, r_r->unknown_0 = r_r->unknown_1 = len * 2; r_r->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return; + if (r_r == NULL) return False; prs_debug(ps, depth, desc, "reg_io_r_info"); depth++; @@ -825,16 +902,18 @@ void reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) } prs_uint32("status", ps, depth, &(r_r->status)); + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol, +BOOL make_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol, uint32 val_idx, uint32 max_val_len, uint32 max_buf_len) { - if (q_i == NULL) return; + if (q_i == NULL) return False; ZERO_STRUCTP(q_i); @@ -857,14 +936,16 @@ void make_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol, q_i->ptr2 = 1; q_i->len_value2 = 0; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_enum_val(char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int depth) +BOOL reg_io_q_enum_val(char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int depth) { - if (q_q == NULL) return; + if (q_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_enum_val"); depth++; @@ -899,14 +980,16 @@ void reg_io_q_enum_val(char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int d { prs_uint32("len_value2", ps, depth, &(q_q->len_value2)); } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_enum_val(char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_enum_val(char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_r_enum_val"); depth++; @@ -941,18 +1024,20 @@ void reg_io_r_enum_val(char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, int d } prs_uint32("status", ps, depth, &(r_q->status)); + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_reg_q_create_val(REG_Q_CREATE_VALUE *q_i, POLICY_HND *pol, +BOOL make_reg_q_create_val(REG_Q_CREATE_VALUE *q_i, POLICY_HND *pol, char *val_name, uint32 type, BUFFER3 *val) { int val_len = strlen(val_name) + 1; - if (q_i == NULL) return; + if (q_i == NULL) return False; ZERO_STRUCTP(q_i); @@ -963,14 +1048,16 @@ void make_reg_q_create_val(REG_Q_CREATE_VALUE *q_i, POLICY_HND *pol, q_i->type = type; q_i->buf_value = val; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_create_val(char *desc, REG_Q_CREATE_VALUE *q_q, prs_struct *ps, int depth) +BOOL reg_io_q_create_val(char *desc, REG_Q_CREATE_VALUE *q_q, prs_struct *ps, int depth) { - if (q_q == NULL) return; + if (q_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_create_val"); depth++; @@ -986,14 +1073,16 @@ void reg_io_q_create_val(char *desc, REG_Q_CREATE_VALUE *q_q, prs_struct *ps, i prs_uint32("type", ps, depth, &(q_q->type)); smb_io_buffer3("buf_value", q_q->buf_value, ps, depth); prs_align(ps); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_create_val(char *desc, REG_R_CREATE_VALUE *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_create_val(char *desc, REG_R_CREATE_VALUE *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_r_create_val"); depth++; @@ -1001,14 +1090,16 @@ void reg_io_r_create_val(char *desc, REG_R_CREATE_VALUE *r_q, prs_struct *ps, i prs_align(ps); prs_uint32("status", ps, depth, &(r_q->status)); + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_reg_q_enum_key(REG_Q_ENUM_KEY *q_i, POLICY_HND *pol, uint32 key_idx) +BOOL make_reg_q_enum_key(REG_Q_ENUM_KEY *q_i, POLICY_HND *pol, uint32 key_idx) { - if (q_i == NULL) return; + if (q_i == NULL) return False; memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); @@ -1025,14 +1116,16 @@ void make_reg_q_enum_key(REG_Q_ENUM_KEY *q_i, POLICY_HND *pol, uint32 key_idx) q_i->ptr3 = 1; init_nt_time(&(q_i->time)); /* ignored ? */ + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_enum_key(char *desc, REG_Q_ENUM_KEY *q_q, prs_struct *ps, int depth) +BOOL reg_io_q_enum_key(char *desc, REG_Q_ENUM_KEY *q_q, prs_struct *ps, int depth) { - if (q_q == NULL) return; + if (q_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_enum_key"); depth++; @@ -1066,14 +1159,16 @@ void reg_io_q_enum_key(char *desc, REG_Q_ENUM_KEY *q_q, prs_struct *ps, int dep { smb_io_time("", &(q_q->time), ps, depth); } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_enum_key(char *desc, REG_R_ENUM_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_enum_key(char *desc, REG_R_ENUM_KEY *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_r_enum_key"); depth++; @@ -1108,18 +1203,20 @@ void reg_io_r_enum_key(char *desc, REG_R_ENUM_KEY *r_q, prs_struct *ps, int dep } prs_uint32("status", ps, depth, &(r_q->status)); + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, +BOOL make_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, char *key_name, uint32 unk) { int len_name = strlen(key_name)+1; - if (r_q == NULL) return; + if (r_q == NULL) return False; memcpy(&(r_q->pol), pol, sizeof(r_q->pol)); @@ -1128,14 +1225,16 @@ void make_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, r_q->unknown_0 = 0x00000000; r_q->unknown_1 = unk; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_entry"); depth++; @@ -1150,27 +1249,31 @@ void reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int prs_uint32("unknown_0", ps, depth, &(r_q->unknown_0)); prs_uint32("unknown_1", ps, depth, &(r_q->unknown_1)); + + return True; } /******************************************************************* creates a structure. ********************************************************************/ -void make_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r, +BOOL make_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r, POLICY_HND *pol, uint32 status) { - if (r_r == NULL) return; + if (r_r == NULL) return False; memcpy(&(r_r->pol), pol, sizeof(r_r->pol)); r_r->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_open_entry(char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_open_entry(char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return; + if (r_r == NULL) return False; prs_debug(ps, depth, desc, "reg_io_r_open_entry"); depth++; @@ -1180,17 +1283,19 @@ void reg_io_r_open_entry(char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int smb_io_pol_hnd("", &(r_r->pol), ps, depth); prs_uint32("status", ps, depth, &(r_r->status)); + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_reg_q_shutdown(REG_Q_SHUTDOWN *q_i, +BOOL make_reg_q_shutdown(REG_Q_SHUTDOWN *q_i, char *msg, uint32 timeout, uint16 flags) { int len = strlen(msg) + 1; - if (q_i == NULL) return; + if (q_i == NULL) return False; ZERO_STRUCTP(q_i); @@ -1203,14 +1308,16 @@ void make_reg_q_shutdown(REG_Q_SHUTDOWN *q_i, q_i->timeout = timeout; q_i->flags = flags; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_q_shutdown(char *desc, REG_Q_SHUTDOWN *q_q, prs_struct *ps, int depth) +BOOL reg_io_q_shutdown(char *desc, REG_Q_SHUTDOWN *q_q, prs_struct *ps, int depth) { - if (q_q == NULL) return; + if (q_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_shutdown"); depth++; @@ -1228,14 +1335,16 @@ void reg_io_q_shutdown(char *desc, REG_Q_SHUTDOWN *q_q, prs_struct *ps, int dep prs_uint32("timeout", ps, depth, &(q_q->timeout)); prs_uint16("flags ", ps, depth, &(q_q->flags )); prs_align(ps); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void reg_io_r_shutdown(char *desc, REG_R_SHUTDOWN *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_shutdown(char *desc, REG_R_SHUTDOWN *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "reg_io_r_shutdown"); depth++; @@ -1243,5 +1352,7 @@ void reg_io_r_shutdown(char *desc, REG_R_SHUTDOWN *r_q, prs_struct *ps, int dep prs_align(ps); prs_uint32("status", ps, depth, &(r_q->status)); + + return True; } diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 19cb4dfa4b..b902ee1414 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -3,9 +3,9 @@ * Unix SMB/Netbios implementation. * Version 1.9. * 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 Tridgell 1992-1999, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, + * Copyright (C) Paul Ashton 1997-1999. * * 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 @@ -181,10 +181,10 @@ struct pipe_id_info pipe_names [] = /******************************************************************* creates an RPC_HDR structure. ********************************************************************/ -void make_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, +BOOL make_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, uint32 call_id, int data_len, int auth_len) { - if (hdr == NULL) return; + if (hdr == NULL) return False; hdr->major = 5; /* RPC version 5 */ hdr->minor = 0; /* minor version 0 */ @@ -194,14 +194,16 @@ void make_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, hdr->frag_len = data_len; /* fragment length, fill in later */ hdr->auth_len = auth_len; /* authentication length */ hdr->call_id = call_id; /* call identifier - match incoming RPC */ + + return True; } /******************************************************************* reads or writes an RPC_HDR structure. ********************************************************************/ -void smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return; + if (rpc == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr"); depth++; @@ -214,14 +216,16 @@ void smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) prs_uint16("frag_len ", ps, depth, &(rpc->frag_len)); prs_uint16("auth_len ", ps, depth, &(rpc->auth_len)); prs_uint32("call_id ", ps, depth, &(rpc->call_id)); + + return True; } /******************************************************************* reads or writes an RPC_IFACE structure. ********************************************************************/ -static void smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) +static BOOL smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) { - if (ifc == NULL) return; + if (ifc == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_iface"); depth++; @@ -230,6 +234,8 @@ static void smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int de prs_uint8s (False, "data ", ps, depth, ifc->data, sizeof(ifc->data)); prs_uint32 ( "version", ps, depth, &(ifc->version)); + + return True; } /******************************************************************* @@ -237,9 +243,9 @@ creates an RPC_ADDR_STR structure. The name can be null (RPC Alter-Context) ********************************************************************/ -static void make_rpc_addr_str(RPC_ADDR_STR *str, char *name) +static BOOL make_rpc_addr_str(RPC_ADDR_STR *str, char *name) { - if (str == NULL ) return; + if (str == NULL ) return False; if (name == NULL) { str->len = 1; @@ -250,14 +256,16 @@ static void make_rpc_addr_str(RPC_ADDR_STR *str, char *name) str->len = strlen(name) + 1; fstrcpy(str->str, name); } + + return True; } /******************************************************************* reads or writes an RPC_ADDR_STR structure. ********************************************************************/ -static void smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) +static BOOL smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) { - if (str == NULL) return; + if (str == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_addr_str"); depth++; @@ -265,26 +273,30 @@ static void smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, prs_uint16 ( "len", ps, depth, &(str->len)); prs_uint8s (True, "str", ps, depth, (uchar*)str->str, str->len); + + return True; } /******************************************************************* creates an RPC_HDR_BBA structure. ********************************************************************/ -static void make_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid) +static BOOL make_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid) { - if (bba == NULL) return; + if (bba == NULL) return False; bba->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ bba->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ bba->assoc_gid = assoc_gid; /* associated group id (0x0) */ + + return True; } /******************************************************************* reads or writes an RPC_HDR_BBA structure. ********************************************************************/ -static void smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) +static BOOL smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return; + if (rpc == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_bba"); depth++; @@ -292,17 +304,19 @@ static void smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, in prs_uint16("max_tsize", ps, depth, &(rpc->max_tsize)); prs_uint16("max_rsize", ps, depth, &(rpc->max_rsize)); prs_uint32("assoc_gid", ps, depth, &(rpc->assoc_gid)); + + return True; } /******************************************************************* creates an RPC_HDR_RB structure. ********************************************************************/ -void make_rpc_hdr_rb(RPC_HDR_RB *rpc, +BOOL make_rpc_hdr_rb(RPC_HDR_RB *rpc, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, uint32 num_elements, uint16 context_id, uint8 num_syntaxes, RPC_IFACE *abstract, RPC_IFACE *transfer) { - if (rpc == NULL) return; + if (rpc == NULL) return False; make_rpc_hdr_bba(&(rpc->bba), max_tsize, max_rsize, assoc_gid); @@ -315,14 +329,16 @@ void make_rpc_hdr_rb(RPC_HDR_RB *rpc, /* num and vers. of interface to use for replies */ memcpy(&(rpc->transfer), transfer, sizeof(rpc->transfer)); + + return True; } /******************************************************************* reads or writes an RPC_HDR_RB structure. ********************************************************************/ -void smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return; + if (rpc == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_rb"); depth++; @@ -335,6 +351,8 @@ void smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) smb_io_rpc_iface("", &(rpc->abstract), ps, depth); smb_io_rpc_iface("", &(rpc->transfer), ps, depth); + + return True; } /******************************************************************* @@ -343,14 +361,16 @@ creates an RPC_RESULTS structure. lkclXXXX only one reason at the moment! ********************************************************************/ -static void make_rpc_results(RPC_RESULTS *res, +static BOOL make_rpc_results(RPC_RESULTS *res, uint8 num_results, uint16 result, uint16 reason) { - if (res == NULL) return; + if (res == NULL) return False; res->num_results = num_results; /* the number of results (0x01) */ res->result = result ; /* result (0x00 = accept) */ res->reason = reason ; /* reason (0x00 = no reason specified) */ + + return True; } /******************************************************************* @@ -359,9 +379,9 @@ reads or writes an RPC_RESULTS structure. lkclXXXX only one reason at the moment! ********************************************************************/ -static void smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) +static BOOL smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) { - if (res == NULL) return; + if (res == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_results"); depth++; @@ -374,6 +394,8 @@ static void smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, in prs_uint16("result ", ps, depth, &(res->result )); prs_uint16("reason ", ps, depth, &(res->reason )); + + return True; } /******************************************************************* @@ -383,13 +405,13 @@ lkclXXXX only one reason at the moment! jfm: nope two ! The pipe_addr can be NULL ! ********************************************************************/ -void make_rpc_hdr_ba(RPC_HDR_BA *rpc, +BOOL make_rpc_hdr_ba(RPC_HDR_BA *rpc, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, char *pipe_addr, uint8 num_results, uint16 result, uint16 reason, RPC_IFACE *transfer) { - if (rpc == NULL || transfer == NULL) return; + if (rpc == NULL || transfer == NULL) return False; make_rpc_hdr_bba (&(rpc->bba ), max_tsize, max_rsize, assoc_gid); make_rpc_addr_str(&(rpc->addr), pipe_addr); @@ -397,14 +419,16 @@ void make_rpc_hdr_ba(RPC_HDR_BA *rpc, /* the transfer syntax from the request */ memcpy(&(rpc->transfer), transfer, sizeof(rpc->transfer)); + + return True; } /******************************************************************* reads or writes an RPC_HDR_BA structure. ********************************************************************/ -void smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return; + if (rpc == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_ba"); depth++; @@ -413,26 +437,30 @@ void smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) smb_io_rpc_addr_str("", &(rpc->addr) , ps, depth); smb_io_rpc_results ("", &(rpc->res) , ps, depth); smb_io_rpc_iface ("", &(rpc->transfer), ps, depth); + + return True; } /******************************************************************* creates an RPC_HDR_REQ structure. ********************************************************************/ -void make_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum) +BOOL make_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum) { - if (hdr == NULL) return; + if (hdr == NULL) return False; hdr->alloc_hint = alloc_hint; /* allocation hint */ hdr->context_id = 0; /* presentation context identifier */ hdr->opnum = opnum; /* opnum */ + + return True; } /******************************************************************* reads or writes an RPC_HDR_REQ structure. ********************************************************************/ -void smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return; + if (rpc == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_req"); depth++; @@ -440,14 +468,16 @@ void smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth prs_uint32("alloc_hint", ps, depth, &(rpc->alloc_hint)); prs_uint16("context_id", ps, depth, &(rpc->context_id)); prs_uint16("opnum ", ps, depth, &(rpc->opnum)); + + return True; } /******************************************************************* reads or writes an RPC_HDR_RESP structure. ********************************************************************/ -void smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return; + if (rpc == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_resp"); depth++; @@ -456,17 +486,19 @@ void smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int dep prs_uint16("context_id", ps, depth, &(rpc->context_id)); prs_uint8 ("cancel_ct ", ps, depth, &(rpc->cancel_count)); prs_uint8 ("reserved ", ps, depth, &(rpc->reserved)); + + return True; } /******************************************************************* creates an RPC_HDR_AUTHA structure. ********************************************************************/ -void make_rpc_hdr_autha(RPC_HDR_AUTHA *rai, +BOOL make_rpc_hdr_autha(RPC_HDR_AUTHA *rai, uint16 max_tsize, uint16 max_rsize, uint8 auth_type, uint8 auth_level, uint8 stub_type_len) { - if (rai == NULL) return; + if (rai == NULL) return False; rai->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ rai->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ @@ -477,14 +509,16 @@ void make_rpc_hdr_autha(RPC_HDR_AUTHA *rai, rai->padding = 0; /* padding 0x00 */ rai->unknown = 0x0014a0c0; /* non-zero pointer to something */ + + return True; } /******************************************************************* reads or writes an RPC_HDR_AUTHA structure. ********************************************************************/ -void smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) { - if (rai == NULL) return; + if (rai == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_autha"); depth++; @@ -498,6 +532,8 @@ void smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int de prs_uint8 ("padding ", ps, depth, &(rai->padding )); prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ + + return True; } /******************************************************************* @@ -507,17 +543,19 @@ BOOL rpc_hdr_auth_chk(RPC_HDR_AUTH *rai) { return ((rai->auth_type == 0x0a || rai->auth_type == 0x44) && rai->auth_level == 0x06); + + return True; } /******************************************************************* creates an RPC_HDR_AUTH structure. ********************************************************************/ -void make_rpc_hdr_auth(RPC_HDR_AUTH *rai, +BOOL make_rpc_hdr_auth(RPC_HDR_AUTH *rai, uint8 auth_type, uint8 auth_level, uint8 stub_type_len, uint32 ptr) { - if (rai == NULL) return; + if (rai == NULL) return False; rai->auth_type = auth_type; /* nt lm ssp 0x0a */ rai->auth_level = auth_level; /* 0x06 */ @@ -525,14 +563,16 @@ void make_rpc_hdr_auth(RPC_HDR_AUTH *rai, rai->padding = 0; /* padding 0x00 */ rai->unknown = ptr; /* non-zero pointer to something */ + + return True; } /******************************************************************* reads or writes an RPC_HDR_AUTH structure. ********************************************************************/ -void smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) { - if (rai == NULL) return; + if (rai == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_auth"); depth++; @@ -543,6 +583,8 @@ void smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int dept prs_uint8 ("padding ", ps, depth, &(rai->padding )); prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ + + return True; } /******************************************************************* @@ -552,45 +594,51 @@ BOOL rpc_auth_ntlmssp_verifier_chk(RPC_AUTH_NTLMSSP_VERIFIER *rav, char *signature, uint32 msg_type) { return (strequal(rav->signature, signature) && rav->msg_type == msg_type); + + return True; } /******************************************************************* creates an RPC_AUTH_NTLMSSP_VERIFIER structure. ********************************************************************/ -void make_rpc_auth_ntlmssp_verifier(RPC_AUTH_NTLMSSP_VERIFIER *rav, +BOOL make_rpc_auth_ntlmssp_verifier(RPC_AUTH_NTLMSSP_VERIFIER *rav, char *signature, uint32 msg_type) { - if (rav == NULL) return; + if (rav == NULL) return False; fstrcpy(rav->signature, signature); /* "NTLMSSP" */ rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */ + + return True; } /******************************************************************* reads or writes an RPC_AUTH_NTLMSSP_VERIFIER structure. ********************************************************************/ -void smb_io_rpc_auth_ntlmssp_verifier(char *desc, RPC_AUTH_NTLMSSP_VERIFIER *rav, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_verifier(char *desc, RPC_AUTH_NTLMSSP_VERIFIER *rav, prs_struct *ps, int depth) { - if (rav == NULL) return; + if (rav == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); depth++; prs_string("signature", ps, depth, rav->signature, 0, sizeof(rav->signature)); /* "NTLMSSP" */ prs_uint32("msg_type ", ps, depth, &(rav->msg_type )); /* NTLMSSP_MESSAGE_TYPE */ + + return True; } /******************************************************************* creates an RPC_AUTH_NTLMSSP_NEG structure. ********************************************************************/ -void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, +BOOL make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, uint32 neg_flgs, fstring myname, fstring domain) { int len_myname = strlen(myname); int len_domain = strlen(domain); - if (neg == NULL) return; + if (neg == NULL) return False; neg->neg_flgs = neg_flgs ; /* 0x00b2b3 */ @@ -599,6 +647,8 @@ void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, fstrcpy(neg->myname, myname); fstrcpy(neg->domain, domain); + + return True; } /******************************************************************* @@ -607,9 +657,9 @@ reads or writes an RPC_AUTH_NTLMSSP_NEG structure. *** lkclXXXX HACK ALERT! *** ********************************************************************/ -void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) { - if (neg == NULL) return; + if (neg == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_neg"); depth++; @@ -648,16 +698,18 @@ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru prs_uint8s(True , "myname", ps, depth, (uint8*)neg->myname , MIN(neg->hdr_myname .str_str_len, sizeof(neg->myname ))); prs_uint8s(True , "domain", ps, depth, (uint8*)neg->domain , MIN(neg->hdr_domain .str_str_len, sizeof(neg->domain ))); } + + return True; } /******************************************************************* creates an RPC_AUTH_NTLMSSP_CHAL structure. ********************************************************************/ -void make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, +BOOL make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, uint32 neg_flags, uint8 challenge[8]) { - if (chl == NULL) return; + if (chl == NULL) return False; chl->unknown_1 = 0x0; chl->unknown_2 = 0x00000028; @@ -665,14 +717,16 @@ void make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, memcpy(chl->challenge, challenge, sizeof(chl->challenge)); bzero (chl->reserved , sizeof(chl->reserved)); + + return True; } /******************************************************************* reads or writes an RPC_AUTH_NTLMSSP_CHAL structure. ********************************************************************/ -void smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth) { - if (chl == NULL) return; + if (chl == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chal"); depth++; @@ -683,6 +737,8 @@ void smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_st prs_uint8s (False, "challenge", ps, depth, chl->challenge, sizeof(chl->challenge)); prs_uint8s (False, "reserved ", ps, depth, chl->reserved , sizeof(chl->reserved )); + + return True; } /******************************************************************* @@ -692,7 +748,7 @@ creates an RPC_AUTH_NTLMSSP_RESP structure. *** lkclXXXX the actual offset is at the start of the auth verifier *** ********************************************************************/ -void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, +BOOL make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, uchar lm_resp[24], uchar *nt_resp, size_t nt_len, char *domain, char *user, char *wks, @@ -706,7 +762,7 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, DEBUG(5,("make_rpc_auth_ntlmssp_resp\n")); - if (rsp == NULL) return; + if (rsp == NULL) return False; #ifdef DEBUG_PASSWORD DEBUG(100,("lm_resp\n")); @@ -782,6 +838,8 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, fstrcpy(rsp->wks , wks ); } rsp->sess_key[0] = 0; + + return True; } /******************************************************************* @@ -791,9 +849,9 @@ reads or writes an RPC_AUTH_NTLMSSP_RESP structure. *** lkclXXXX the actual offset is at the start of the auth verifier *** ********************************************************************/ -void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) { - if (rsp == NULL) return; + if (rsp == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_resp"); depth++; @@ -865,6 +923,8 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); } + + return True; } /******************************************************************* @@ -888,28 +948,32 @@ BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 seq_nu return False; } return True; + + return True; } /******************************************************************* creates an RPC_AUTH_NTLMSSP_CHK structure. ********************************************************************/ -void make_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, +BOOL make_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 ver, uint32 crc32, uint32 seq_num) { - if (chk == NULL) return; + if (chk == NULL) return False; chk->ver = ver ; chk->reserved = 0x0; chk->crc32 = crc32 ; chk->seq_num = seq_num ; + + return True; } /******************************************************************* reads or writes an RPC_AUTH_NTLMSSP_CHK structure. ********************************************************************/ -void smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth) { - if (chk == NULL) return; + if (chk == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chk"); depth++; @@ -918,5 +982,7 @@ void smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_stru prs_uint32("reserved", ps, depth, &(chk->reserved)); prs_uint32("crc32 ", ps, depth, &(chk->crc32 )); prs_uint32("seq_num ", ps, depth, &(chk->seq_num )); + + return True; } diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index e5c015a6b3..7dae0702cd 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2,9 +2,9 @@ * Unix SMB/Netbios implementation. * Version 1.9. * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1998, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, - * Copyright (C) Paul Ashton 1997-1998. + * Copyright (C) Andrew Tridgell 1992-1999, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, + * Copyright (C) Paul Ashton 1997-1999. * * 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 @@ -30,21 +30,23 @@ extern int DEBUGLEVEL; /******************************************************************* makes a SAMR_Q_CLOSE_HND structure. ********************************************************************/ -void make_samr_q_close_hnd(SAMR_Q_CLOSE_HND *q_c, POLICY_HND *hnd) +BOOL make_samr_q_close_hnd(SAMR_Q_CLOSE_HND *q_c, POLICY_HND *hnd) { - if (q_c == NULL || hnd == NULL) return; + if (q_c == NULL || hnd == NULL) return False; DEBUG(5,("make_samr_q_close_hnd\n")); memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_close_hnd(char *desc, SAMR_Q_CLOSE_HND *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_close_hnd(char *desc, SAMR_Q_CLOSE_HND *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_close_hnd"); depth++; @@ -53,14 +55,16 @@ void samr_io_q_close_hnd(char *desc, SAMR_Q_CLOSE_HND *q_u, prs_struct *ps, int smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); prs_align(ps); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_close_hnd"); depth++; @@ -71,17 +75,19 @@ void samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND *r_u, prs_struct *ps, int prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_LOOKUP_DOMAIN structure. ********************************************************************/ -void make_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN *q_u, +BOOL make_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN *q_u, POLICY_HND *pol, const char *dom_name) { int len_name = strlen(dom_name); - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("make_samr_q_lookup_domain\n")); @@ -89,14 +95,16 @@ void make_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN *q_u, make_uni_hdr(&(q_u->hdr_domain), len_name); make_unistr2(&(q_u->uni_domain), dom_name, len_name); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_lookup_domain(char *desc, SAMR_Q_LOOKUP_DOMAIN *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_lookup_domain(char *desc, SAMR_Q_LOOKUP_DOMAIN *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_lookup_domain"); depth++; @@ -109,14 +117,16 @@ void samr_io_q_lookup_domain(char *desc, SAMR_Q_LOOKUP_DOMAIN *q_u, prs_struct * smb_io_unihdr("hdr_domain", &(q_u->hdr_domain), ps, depth); smb_io_unistr2("uni_domain", &(q_u->uni_domain), q_u->hdr_domain.buffer, ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_lookup_domain(char *desc, SAMR_R_LOOKUP_DOMAIN *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_lookup_domain(char *desc, SAMR_R_LOOKUP_DOMAIN *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_lookup_domain"); depth++; @@ -132,30 +142,34 @@ void samr_io_r_lookup_domain(char *desc, SAMR_R_LOOKUP_DOMAIN *r_u, prs_struct * } prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void make_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, +BOOL make_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, POLICY_HND *connect_pol, uint32 flags, DOM_SID *sid) { - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("samr_make_samr_q_open_domain\n")); memcpy(&q_u->connect_pol, connect_pol, sizeof(q_u->connect_pol)); q_u->flags = flags; make_dom_sid2(&(q_u->dom_sid), sid); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_open_domain"); depth++; @@ -169,15 +183,17 @@ void samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN *q_u, prs_struct *ps, smb_io_dom_sid2("sid", &(q_u->dom_sid), ps, depth); prs_align(ps); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_open_domain"); depth++; @@ -188,27 +204,31 @@ void samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN *r_u, prs_struct *ps, prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void make_samr_q_unknown_2c(SAMR_Q_UNKNOWN_2C *q_u, POLICY_HND *user_pol) +BOOL make_samr_q_unknown_2c(SAMR_Q_UNKNOWN_2C *q_u, POLICY_HND *user_pol) { - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("samr_make_samr_q_unknown_2c\n")); memcpy(&q_u->user_pol, user_pol, sizeof(q_u->user_pol)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_unknown_2c(char *desc, SAMR_Q_UNKNOWN_2C *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_unknown_2c(char *desc, SAMR_Q_UNKNOWN_2C *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_unknown_2c"); depth++; @@ -217,29 +237,33 @@ void samr_io_q_unknown_2c(char *desc, SAMR_Q_UNKNOWN_2C *q_u, prs_struct *ps, i smb_io_pol_hnd("user_pol", &(q_u->user_pol), ps, depth); prs_align(ps); + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_samr_r_unknown_2c(SAMR_R_UNKNOWN_2C *q_u, uint32 status) +BOOL make_samr_r_unknown_2c(SAMR_R_UNKNOWN_2C *q_u, uint32 status) { - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("samr_make_r_unknown_2c\n")); q_u->unknown_0 = 0x00160000; q_u->unknown_1 = 0x00000000; q_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_unknown_2c(char *desc, SAMR_R_UNKNOWN_2C *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_unknown_2c(char *desc, SAMR_R_UNKNOWN_2C *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_unknown_2c"); depth++; @@ -249,29 +273,33 @@ void samr_io_r_unknown_2c(char *desc, SAMR_R_UNKNOWN_2C *r_u, prs_struct *ps, i prs_uint32("unknown_0", ps, depth, &(r_u->unknown_0)); prs_uint32("unknown_1", ps, depth, &(r_u->unknown_1)); prs_uint32("status ", ps, depth, &(r_u->status )); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void make_samr_q_unknown_3(SAMR_Q_UNKNOWN_3 *q_u, +BOOL make_samr_q_unknown_3(SAMR_Q_UNKNOWN_3 *q_u, POLICY_HND *user_pol, uint16 switch_value) { - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("samr_make_samr_q_unknown_3\n")); memcpy(&q_u->user_pol, user_pol, sizeof(q_u->user_pol)); q_u->switch_value = switch_value; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_unknown_3(char *desc, SAMR_Q_UNKNOWN_3 *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_unknown_3(char *desc, SAMR_Q_UNKNOWN_3 *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_unknown_3"); depth++; @@ -283,28 +311,32 @@ void samr_io_q_unknown_3(char *desc, SAMR_Q_UNKNOWN_3 *q_u, prs_struct *ps, int prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); prs_align(ps); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void make_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO *q_u, +BOOL make_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO *q_u, POLICY_HND *domain_pol, uint16 switch_value) { - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("samr_make_samr_q_query_dom_info\n")); memcpy(&q_u->domain_pol, domain_pol, sizeof(q_u->domain_pol)); q_u->switch_value = switch_value; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_query_dom_info"); depth++; @@ -316,26 +348,30 @@ void samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO *q_u, prs_st prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); prs_align(ps); + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_unk_info3(SAM_UNK_INFO_3 *u_3) +BOOL make_unk_info3(SAM_UNK_INFO_3 *u_3) { - if (u_3 == NULL) return; + if (u_3 == NULL) return False; u_3->unknown_0 = 0x00000000; u_3->unknown_1 = 0x80000000; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void sam_io_unk_info3(char *desc, SAM_UNK_INFO_3 *u_3, prs_struct *ps, int depth) +BOOL sam_io_unk_info3(char *desc, SAM_UNK_INFO_3 *u_3, prs_struct *ps, int depth) { - if (u_3 == NULL) return; + if (u_3 == NULL) return False; prs_debug(ps, depth, desc, "sam_io_unk_info3"); depth++; @@ -345,26 +381,30 @@ void sam_io_unk_info3(char *desc, SAM_UNK_INFO_3 *u_3, prs_struct *ps, int depth prs_align(ps); + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_unk_info6(SAM_UNK_INFO_6 *u_6) +BOOL make_unk_info6(SAM_UNK_INFO_6 *u_6) { - if (u_6 == NULL) return; + if (u_6 == NULL) return False; u_6->unknown_0 = 0x00000000; u_6->ptr_0 = 1; memset(u_6->padding, 0, sizeof(u_6->padding)); /* 12 bytes zeros */ + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void sam_io_unk_info6(char *desc, SAM_UNK_INFO_6 *u_6, prs_struct *ps, int depth) +BOOL sam_io_unk_info6(char *desc, SAM_UNK_INFO_6 *u_6, prs_struct *ps, int depth) { - if (u_6 == NULL) return; + if (u_6 == NULL) return False; prs_debug(ps, depth, desc, "sam_io_unk_info6"); depth++; @@ -375,24 +415,28 @@ void sam_io_unk_info6(char *desc, SAM_UNK_INFO_6 *u_6, prs_struct *ps, int depth prs_align(ps); + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_unk_info7(SAM_UNK_INFO_7 *u_7) +BOOL make_unk_info7(SAM_UNK_INFO_7 *u_7) { - if (u_7 == NULL) return; + if (u_7 == NULL) return False; u_7->unknown_0 = 0x0003; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void sam_io_unk_info7(char *desc, SAM_UNK_INFO_7 *u_7, prs_struct *ps, int depth) +BOOL sam_io_unk_info7(char *desc, SAM_UNK_INFO_7 *u_7, prs_struct *ps, int depth) { - if (u_7 == NULL) return; + if (u_7 == NULL) return False; prs_debug(ps, depth, desc, "sam_io_unk_info7"); depth++; @@ -400,17 +444,19 @@ void sam_io_unk_info7(char *desc, SAM_UNK_INFO_7 *u_7, prs_struct *ps, int depth prs_uint16("unknown_0", ps, depth, &u_7->unknown_0); /* 0x0003 */ prs_align(ps); + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_unk_info2(SAM_UNK_INFO_2 *u_2, char *domain, char *server) +BOOL make_unk_info2(SAM_UNK_INFO_2 *u_2, char *domain, char *server) { int len_domain = strlen(domain); int len_server = strlen(server); - if (u_2 == NULL) return; + if (u_2 == NULL) return False; u_2->unknown_0 = 0x00000000; u_2->unknown_1 = 0x80000000; @@ -434,14 +480,16 @@ void make_unk_info2(SAM_UNK_INFO_2 *u_2, char *domain, char *server) make_unistr2(&u_2->uni_domain, domain, len_domain); make_unistr2(&u_2->uni_server, server, len_server); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 *u_2, prs_struct *ps, int depth) +BOOL sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 *u_2, prs_struct *ps, int depth) { - if (u_2 == NULL) return; + if (u_2 == NULL) return False; prs_debug(ps, depth, desc, "sam_io_unk_info2"); depth++; @@ -475,26 +523,30 @@ void sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 *u_2, prs_struct *ps, int depth prs_align(ps); + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_unk_info1(SAM_UNK_INFO_1 *u_1) +BOOL make_unk_info1(SAM_UNK_INFO_1 *u_1) { - if (u_1 == NULL) return; + if (u_1 == NULL) return False; memset(u_1->padding, 0, sizeof(u_1->padding)); /* 12 bytes zeros */ u_1->unknown_1 = 0x80000000; u_1->unknown_2 = 0x00000000; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void sam_io_unk_info1(char *desc, SAM_UNK_INFO_1 *u_1, prs_struct *ps, int depth) +BOOL sam_io_unk_info1(char *desc, SAM_UNK_INFO_1 *u_1, prs_struct *ps, int depth) { - if (u_1 == NULL) return; + if (u_1 == NULL) return False; prs_debug(ps, depth, desc, "sam_io_unk_info1"); depth++; @@ -505,16 +557,18 @@ void sam_io_unk_info1(char *desc, SAM_UNK_INFO_1 *u_1, prs_struct *ps, int depth prs_uint32("unknown_2", ps, depth, &u_1->unknown_2); /* 0x0000 0000 */ prs_align(ps); + + return True; } /******************************************************************* makes a SAMR_R_QUERY_DOMAIN_INFO structure. ********************************************************************/ -void make_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO *r_u, +BOOL make_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO *r_u, uint16 switch_value, SAM_UNK_CTR *ctr, uint32 status) { - if (r_u == NULL || ctr == NULL) return; + if (r_u == NULL || ctr == NULL) return False; DEBUG(5,("make_samr_r_query_dom_info\n")); @@ -528,14 +582,16 @@ void make_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO *r_u, r_u->ptr_0 = 1; r_u->ctr = ctr; } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_query_dom_info"); depth++; @@ -580,12 +636,15 @@ void samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_str { DEBUG(3,("samr_io_r_query_dom_info: unknown switch level 0x%x\n", r_u->switch_value)); - return; + r_u->status = 0xC0000000|NT_STATUS_INVALID_INFO_CLASS; + return False; } } } prs_uint32("status ", ps, depth, &(r_u->status)); + + return True; } @@ -594,12 +653,14 @@ void samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_str calculate length by adding up the size of the components. ********************************************************************/ -void make_dom_sid3(DOM_SID3 *sid3, uint16 unk_0, uint16 unk_1, DOM_SID *sid) +BOOL make_dom_sid3(DOM_SID3 *sid3, uint16 unk_0, uint16 unk_1, DOM_SID *sid) { - if (sid3 == NULL) return; + if (sid3 == NULL) return False; sid3->sid = *sid; sid3->len = 2 + 8 + sid3->sid.num_auths * 4; + + return True; } /******************************************************************* @@ -609,9 +670,9 @@ this one's odd, because the length (in bytes) is specified at the beginning. the length _includes_ the length of the length, too :-) ********************************************************************/ -static void sam_io_dom_sid3(char *desc, DOM_SID3 *sid3, prs_struct *ps, int depth) +static BOOL sam_io_dom_sid3(char *desc, DOM_SID3 *sid3, prs_struct *ps, int depth) { - if (sid3 == NULL) return; + if (sid3 == NULL) return False; prs_debug(ps, depth, desc, "sam_io_dom_sid3"); depth++; @@ -619,6 +680,8 @@ static void sam_io_dom_sid3(char *desc, DOM_SID3 *sid3, prs_struct *ps, int dep prs_uint16("len", ps, depth, &(sid3->len)); prs_align(ps); smb_io_dom_sid("", &(sid3->sid), ps, depth); + + return True; } /******************************************************************* @@ -633,7 +696,7 @@ unknown_6 : 0x0002 unknown_7 : 0x5800 or 0x0070 ********************************************************************/ -static void make_sam_sid_stuff(SAM_SID_STUFF *stf, +static BOOL make_sam_sid_stuff(SAM_SID_STUFF *stf, uint16 unknown_2, uint16 unknown_3, uint32 unknown_4, uint16 unknown_6, uint16 unknown_7, int num_sid3s, DOM_SID3 sid3[MAX_SAM_SIDS]) @@ -654,16 +717,18 @@ static void make_sam_sid_stuff(SAM_SID_STUFF *stf, stf->padding2 = 0x0000; memcpy(stf->sid, sid3, sizeof(DOM_SID3) * num_sid3s); + + return True; } /******************************************************************* reads or writes a SAM_SID_STUFF structure. ********************************************************************/ -static void sam_io_sid_stuff(char *desc, SAM_SID_STUFF *stf, prs_struct *ps, int depth) +static BOOL sam_io_sid_stuff(char *desc, SAM_SID_STUFF *stf, prs_struct *ps, int depth) { int i; - if (stf == NULL) return; + if (stf == NULL) return False; DEBUG(5,("make_sam_sid_stuff\n")); @@ -686,18 +751,20 @@ static void sam_io_sid_stuff(char *desc, SAM_SID_STUFF *stf, prs_struct *ps, in { sam_io_dom_sid3("", &(stf->sid[i]), ps, depth); } + + return True; } /******************************************************************* reads or writes a SAMR_R_UNKNOWN3 structure. ********************************************************************/ -void make_samr_r_unknown_3(SAMR_R_UNKNOWN_3 *r_u, +BOOL make_samr_r_unknown_3(SAMR_R_UNKNOWN_3 *r_u, uint16 unknown_2, uint16 unknown_3, uint32 unknown_4, uint16 unknown_6, uint16 unknown_7, int num_sid3s, DOM_SID3 sid3[MAX_SAM_SIDS], uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("samr_make_r_unknown_3\n")); @@ -714,6 +781,8 @@ void make_samr_r_unknown_3(SAMR_R_UNKNOWN_3 *r_u, } r_u->status = status; + + return True; } @@ -729,13 +798,13 @@ is put at the beginning of the data stream. wierd. ********************************************************************/ -void samr_io_r_unknown_3(char *desc, SAMR_R_UNKNOWN_3 *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_unknown_3(char *desc, SAMR_R_UNKNOWN_3 *r_u, prs_struct *ps, int depth) { int ptr_len0=0; int ptr_len1=0; int ptr_sid_stuff = 0; - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_unknown_3"); depth++; @@ -794,14 +863,16 @@ void samr_io_r_unknown_3(char *desc, SAMR_R_UNKNOWN_3 *r_u, prs_struct *ps, int } prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* reads or writes a SAM_STR1 structure. ********************************************************************/ -static void sam_io_sam_str1(char *desc, SAM_STR1 *sam, uint32 acct_buf, uint32 name_buf, uint32 desc_buf, prs_struct *ps, int depth) +static BOOL sam_io_sam_str1(char *desc, SAM_STR1 *sam, uint32 acct_buf, uint32 name_buf, uint32 desc_buf, prs_struct *ps, int depth) { - if (sam == NULL) return; + if (sam == NULL) return False; prs_debug(ps, depth, desc, "sam_io_sam_str1"); depth++; @@ -811,16 +882,18 @@ static void sam_io_sam_str1(char *desc, SAM_STR1 *sam, uint32 acct_buf, uint32 smb_io_unistr2("unistr2", &(sam->uni_acct_name), acct_buf, ps, depth); /* account name unicode string */ smb_io_unistr2("unistr2", &(sam->uni_full_name), name_buf, ps, depth); /* full name unicode string */ smb_io_unistr2("unistr2", &(sam->uni_acct_desc), desc_buf, ps, depth); /* account description unicode string */ + + return True; } /******************************************************************* makes a SAM_ENTRY1 structure. ********************************************************************/ -static void make_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, +static BOOL make_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, uint32 len_sam_name, uint32 len_sam_full, uint32 len_sam_desc, uint32 rid_user, uint16 acb_info) { - if (sam == NULL) return; + if (sam == NULL) return False; DEBUG(5,("make_sam_entry1\n")); @@ -832,14 +905,16 @@ static void make_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, make_uni_hdr(&(sam->hdr_acct_name), len_sam_name); make_uni_hdr(&(sam->hdr_user_name), len_sam_full); make_uni_hdr(&(sam->hdr_user_desc), len_sam_desc); + + return True; } /******************************************************************* reads or writes a SAM_ENTRY1 structure. ********************************************************************/ -static void sam_io_sam_entry1(char *desc, SAM_ENTRY1 *sam, prs_struct *ps, int depth) +static BOOL sam_io_sam_entry1(char *desc, SAM_ENTRY1 *sam, prs_struct *ps, int depth) { - if (sam == NULL) return; + if (sam == NULL) return False; prs_debug(ps, depth, desc, "sam_io_sam_entry1"); depth++; @@ -855,14 +930,16 @@ static void sam_io_sam_entry1(char *desc, SAM_ENTRY1 *sam, prs_struct *ps, int smb_io_unihdr("unihdr", &(sam->hdr_acct_name), ps, depth); /* account name unicode string header */ smb_io_unihdr("unihdr", &(sam->hdr_user_name), ps, depth); /* account name unicode string header */ smb_io_unihdr("unihdr", &(sam->hdr_user_desc), ps, depth); /* account name unicode string header */ + + return True; } /******************************************************************* reads or writes a SAM_STR2 structure. ********************************************************************/ -static void sam_io_sam_str2(char *desc, SAM_STR2 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth) +static BOOL sam_io_sam_str2(char *desc, SAM_STR2 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth) { - if (sam == NULL) return; + if (sam == NULL) return False; prs_debug(ps, depth, desc, "sam_io_sam_str2"); depth++; @@ -871,16 +948,18 @@ static void sam_io_sam_str2(char *desc, SAM_STR2 *sam, uint32 acct_buf, uint32 smb_io_unistr2("unistr2", &(sam->uni_srv_name), acct_buf, ps, depth); /* account name unicode string */ smb_io_unistr2("unistr2", &(sam->uni_srv_desc), desc_buf, ps, depth); /* account description unicode string */ + + return True; } /******************************************************************* makes a SAM_ENTRY2 structure. ********************************************************************/ -static void make_sam_entry2(SAM_ENTRY2 *sam, uint32 user_idx, +static BOOL make_sam_entry2(SAM_ENTRY2 *sam, uint32 user_idx, uint32 len_sam_name, uint32 len_sam_desc, uint32 rid_user, uint16 acb_info) { - if (sam == NULL) return; + if (sam == NULL) return False; DEBUG(5,("make_sam_entry2\n")); @@ -891,14 +970,16 @@ static void make_sam_entry2(SAM_ENTRY2 *sam, uint32 user_idx, make_uni_hdr(&(sam->hdr_srv_name), len_sam_name); make_uni_hdr(&(sam->hdr_srv_desc), len_sam_desc); + + return True; } /******************************************************************* reads or writes a SAM_ENTRY2 structure. ********************************************************************/ -static void sam_io_sam_entry2(char *desc, SAM_ENTRY2 *sam, prs_struct *ps, int depth) +static BOOL sam_io_sam_entry2(char *desc, SAM_ENTRY2 *sam, prs_struct *ps, int depth) { - if (sam == NULL) return; + if (sam == NULL) return False; prs_debug(ps, depth, desc, "sam_io_sam_entry2"); depth++; @@ -913,14 +994,16 @@ static void sam_io_sam_entry2(char *desc, SAM_ENTRY2 *sam, prs_struct *ps, int smb_io_unihdr("unihdr", &(sam->hdr_srv_name), ps, depth); /* account name unicode string header */ smb_io_unihdr("unihdr", &(sam->hdr_srv_desc), ps, depth); /* account name unicode string header */ + + return True; } /******************************************************************* reads or writes a SAM_STR3 structure. ********************************************************************/ -static void sam_io_sam_str3(char *desc, SAM_STR3 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth) +static BOOL sam_io_sam_str3(char *desc, SAM_STR3 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth) { - if (sam == NULL) return; + if (sam == NULL) return False; prs_debug(ps, depth, desc, "sam_io_sam_str3"); depth++; @@ -929,15 +1012,17 @@ static void sam_io_sam_str3(char *desc, SAM_STR3 *sam, uint32 acct_buf, uint32 smb_io_unistr2("unistr2", &(sam->uni_grp_name), acct_buf, ps, depth); /* account name unicode string */ smb_io_unistr2("unistr2", &(sam->uni_grp_desc), desc_buf, ps, depth); /* account description unicode string */ + + return True; } /******************************************************************* makes a SAM_ENTRY3 structure. ********************************************************************/ -static void make_sam_entry3(SAM_ENTRY3 *sam, uint32 grp_idx, +static BOOL make_sam_entry3(SAM_ENTRY3 *sam, uint32 grp_idx, uint32 len_grp_name, uint32 len_grp_desc, uint32 rid_grp) { - if (sam == NULL) return; + if (sam == NULL) return False; DEBUG(5,("make_sam_entry3\n")); @@ -947,14 +1032,16 @@ static void make_sam_entry3(SAM_ENTRY3 *sam, uint32 grp_idx, make_uni_hdr(&(sam->hdr_grp_name), len_grp_name); make_uni_hdr(&(sam->hdr_grp_desc), len_grp_desc); + + return True; } /******************************************************************* reads or writes a SAM_ENTRY3 structure. ********************************************************************/ -static void sam_io_sam_entry3(char *desc, SAM_ENTRY3 *sam, prs_struct *ps, int depth) +static BOOL sam_io_sam_entry3(char *desc, SAM_ENTRY3 *sam, prs_struct *ps, int depth) { - if (sam == NULL) return; + if (sam == NULL) return False; prs_debug(ps, depth, desc, "sam_io_sam_entry3"); depth++; @@ -968,29 +1055,33 @@ static void sam_io_sam_entry3(char *desc, SAM_ENTRY3 *sam, prs_struct *ps, int smb_io_unihdr("unihdr", &(sam->hdr_grp_name), ps, depth); /* account name unicode string header */ smb_io_unihdr("unihdr", &(sam->hdr_grp_desc), ps, depth); /* account name unicode string header */ + + return True; } /******************************************************************* makes a SAM_ENTRY4 structure. ********************************************************************/ -static void make_sam_entry4(SAM_ENTRY4 *sam, uint32 user_idx, +static BOOL make_sam_entry4(SAM_ENTRY4 *sam, uint32 user_idx, uint32 len_acct_name) { - if (sam == NULL) return; + if (sam == NULL) return False; DEBUG(5,("make_sam_entry4\n")); sam->user_idx = user_idx; make_str_hdr(&(sam->hdr_acct_name), len_acct_name, len_acct_name, len_acct_name != 0); + + return True; } /******************************************************************* reads or writes a SAM_ENTRY4 structure. ********************************************************************/ -static void sam_io_sam_entry4(char *desc, SAM_ENTRY4 *sam, prs_struct *ps, int depth) +static BOOL sam_io_sam_entry4(char *desc, SAM_ENTRY4 *sam, prs_struct *ps, int depth) { - if (sam == NULL) return; + if (sam == NULL) return False; prs_debug(ps, depth, desc, "sam_io_sam_entry4"); depth++; @@ -999,29 +1090,33 @@ static void sam_io_sam_entry4(char *desc, SAM_ENTRY4 *sam, prs_struct *ps, int d prs_uint32("user_idx", ps, depth, &(sam->user_idx)); smb_io_strhdr("strhdr", &(sam->hdr_acct_name), ps, depth); + + return True; } /******************************************************************* makes a SAM_ENTRY5 structure. ********************************************************************/ -static void make_sam_entry5(SAM_ENTRY5 *sam, uint32 grp_idx, +static BOOL make_sam_entry5(SAM_ENTRY5 *sam, uint32 grp_idx, uint32 len_grp_name) { - if (sam == NULL) return; + if (sam == NULL) return False; DEBUG(5,("make_sam_entry5\n")); sam->grp_idx = grp_idx; make_str_hdr(&(sam->hdr_grp_name), len_grp_name, len_grp_name, len_grp_name != 0); + + return True; } /******************************************************************* reads or writes a SAM_ENTRY5 structure. ********************************************************************/ -static void sam_io_sam_entry5(char *desc, SAM_ENTRY5 *sam, prs_struct *ps, int depth) +static BOOL sam_io_sam_entry5(char *desc, SAM_ENTRY5 *sam, prs_struct *ps, int depth) { - if (sam == NULL) return; + if (sam == NULL) return False; prs_debug(ps, depth, desc, "sam_io_sam_entry5"); depth++; @@ -1030,27 +1125,31 @@ static void sam_io_sam_entry5(char *desc, SAM_ENTRY5 *sam, prs_struct *ps, int d prs_uint32("grp_idx", ps, depth, &(sam->grp_idx)); smb_io_strhdr("strhdr", &(sam->hdr_grp_name), ps, depth); + + return True; } /******************************************************************* makes a SAM_ENTRY structure. ********************************************************************/ -static void make_sam_entry(SAM_ENTRY *sam, uint32 len_sam_name, uint32 rid) +static BOOL make_sam_entry(SAM_ENTRY *sam, uint32 len_sam_name, uint32 rid) { - if (sam == NULL) return; + if (sam == NULL) return False; DEBUG(5,("make_sam_entry\n")); sam->rid = rid; make_uni_hdr(&(sam->hdr_name), len_sam_name); + + return True; } /******************************************************************* reads or writes a SAM_ENTRY structure. ********************************************************************/ -static void sam_io_sam_entry(char *desc, SAM_ENTRY *sam, prs_struct *ps, int depth) +static BOOL sam_io_sam_entry(char *desc, SAM_ENTRY *sam, prs_struct *ps, int depth) { - if (sam == NULL) return; + if (sam == NULL) return False; prs_debug(ps, depth, desc, "sam_io_sam_entry"); depth++; @@ -1058,17 +1157,19 @@ static void sam_io_sam_entry(char *desc, SAM_ENTRY *sam, prs_struct *ps, int de prs_align(ps); prs_uint32("rid", ps, depth, &(sam->rid )); smb_io_unihdr("unihdr", &(sam->hdr_name), ps, depth); /* account name unicode string header */ + + return True; } /******************************************************************* makes a SAMR_Q_ENUM_DOM_USERS structure. ********************************************************************/ -void make_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_e, POLICY_HND *pol, +BOOL make_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_e, POLICY_HND *pol, uint32 start_idx, uint16 acb_mask, uint16 unk_1, uint32 size) { - if (q_e == NULL || pol == NULL) return; + if (q_e == NULL || pol == NULL) return False; DEBUG(5,("make_samr_q_enum_dom_users\n")); @@ -1078,14 +1179,16 @@ void make_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_e, POLICY_HND *pol, q_e->acb_mask = acb_mask; q_e->unknown_1 = unk_1; q_e->max_size = size; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_enum_dom_users(char *desc, SAMR_Q_ENUM_DOM_USERS *q_e, prs_struct *ps, int depth) +BOOL samr_io_q_enum_dom_users(char *desc, SAMR_Q_ENUM_DOM_USERS *q_e, prs_struct *ps, int depth) { - if (q_e == NULL) return; + if (q_e == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_enum_dom_users"); depth++; @@ -1102,19 +1205,21 @@ void samr_io_q_enum_dom_users(char *desc, SAMR_Q_ENUM_DOM_USERS *q_e, prs_struc prs_uint32("max_size ", ps, depth, &(q_e->max_size )); prs_align(ps); + + return True; } /******************************************************************* makes a SAMR_R_ENUM_DOM_USERS structure. ********************************************************************/ -void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, +BOOL make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, uint32 next_idx, uint32 num_sam_entries, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES], uint32 status) { int i; - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_enum_dom_users\n")); @@ -1135,7 +1240,7 @@ void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, if (r_u->sam == NULL || r_u->uni_acct_name == NULL) { DEBUG(0,("NULL pointers in SAMR_R_QUERY_DISPINFO\n")); - return; + return False; } for (i = 0; i < num_sam_entries; i++) @@ -1157,16 +1262,18 @@ void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, } r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct *ps, int depth) { int i; - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_enum_dom_users"); depth++; @@ -1191,7 +1298,9 @@ void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struc if ((r_u->sam == NULL || r_u->uni_acct_name == NULL) && r_u->num_entries2 != 0) { DEBUG(0,("NULL pointers in SAMR_R_QUERY_DISPINFO\n")); - return; + r_u->num_entries4 = 0; + r_u->status = 0xC0000000|NT_STATUS_MEMORY_NOT_ALLOCATED; + return False; } for (i = 0; i < r_u->num_entries2; i++) @@ -1212,16 +1321,18 @@ void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struc prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_QUERY_DISPINFO structure. ********************************************************************/ -void make_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_e, POLICY_HND *pol, +BOOL make_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_e, POLICY_HND *pol, uint16 switch_level, uint32 start_idx, uint32 max_entries) { - if (q_e == NULL || pol == NULL) return; + if (q_e == NULL || pol == NULL) return False; DEBUG(5,("make_samr_q_query_dispinfo\n")); @@ -1232,14 +1343,16 @@ void make_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_e, POLICY_HND *pol, q_e->start_idx = start_idx; q_e->max_entries = max_entries; q_e->max_size = 0xffff; /* Not especially useful */ + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO *q_e, prs_struct *ps, int depth) +BOOL samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO *q_e, prs_struct *ps, int depth) { - if (q_e == NULL) return; + if (q_e == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_query_dispinfo"); depth++; @@ -1255,13 +1368,15 @@ void samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO *q_e, prs_struc prs_uint32("start_idx ", ps, depth, &(q_e->start_idx )); prs_uint32("max_entries ", ps, depth, &(q_e->max_entries )); prs_uint32("max_size ", ps, depth, &(q_e->max_size )); + + return True; } /******************************************************************* makes a SAM_DISPINFO_1 structure. ********************************************************************/ -void make_sam_dispinfo_1(SAM_DISPINFO_1 *sam, uint32 *num_entries, +BOOL make_sam_dispinfo_1(SAM_DISPINFO_1 *sam, uint32 *num_entries, uint32 *data_size, uint32 start_idx, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) { @@ -1270,7 +1385,7 @@ void make_sam_dispinfo_1(SAM_DISPINFO_1 *sam, uint32 *num_entries, uint32 dsize = 0; int i; - if (sam == NULL || num_entries == NULL || data_size == NULL) return; + if (sam == NULL || num_entries == NULL || data_size == NULL) return False; DEBUG(5,("make_sam_dispinfo_1\n")); @@ -1297,16 +1412,18 @@ void make_sam_dispinfo_1(SAM_DISPINFO_1 *sam, uint32 *num_entries, *num_entries = i; *data_size = dsize; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void sam_io_sam_dispinfo_1(char *desc, SAM_DISPINFO_1 *sam, uint32 num_entries, prs_struct *ps, int depth) +static BOOL sam_io_sam_dispinfo_1(char *desc, SAM_DISPINFO_1 *sam, uint32 num_entries, prs_struct *ps, int depth) { int i; - if (sam == NULL) return; + if (sam == NULL) return False; prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_1"); depth++; @@ -1330,13 +1447,15 @@ static void sam_io_sam_dispinfo_1(char *desc, SAM_DISPINFO_1 *sam, uint32 num_en sam->sam[i].hdr_user_desc.buffer, ps, depth); } + + return True; } /******************************************************************* makes a SAM_DISPINFO_2 structure. ********************************************************************/ -void make_sam_dispinfo_2(SAM_DISPINFO_2 *sam, uint32 *num_entries, +BOOL make_sam_dispinfo_2(SAM_DISPINFO_2 *sam, uint32 *num_entries, uint32 *data_size, uint32 start_idx, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) { @@ -1345,7 +1464,7 @@ void make_sam_dispinfo_2(SAM_DISPINFO_2 *sam, uint32 *num_entries, uint32 dsize = 0; int i; - if (sam == NULL || num_entries == NULL || data_size == NULL) return; + if (sam == NULL || num_entries == NULL || data_size == NULL) return False; DEBUG(5,("make_sam_dispinfo_2\n")); @@ -1370,16 +1489,18 @@ void make_sam_dispinfo_2(SAM_DISPINFO_2 *sam, uint32 *num_entries, *num_entries = i; *data_size = dsize; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void sam_io_sam_dispinfo_2(char *desc, SAM_DISPINFO_2 *sam, uint32 num_entries, prs_struct *ps, int depth) +static BOOL sam_io_sam_dispinfo_2(char *desc, SAM_DISPINFO_2 *sam, uint32 num_entries, prs_struct *ps, int depth) { int i; - if (sam == NULL) return; + if (sam == NULL) return False; prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_2"); depth++; @@ -1402,13 +1523,15 @@ static void sam_io_sam_dispinfo_2(char *desc, SAM_DISPINFO_2 *sam, uint32 num_en sam->sam[i].hdr_srv_desc.buffer, ps, depth); } + + return True; } /******************************************************************* makes a SAM_DISPINFO_3 structure. ********************************************************************/ -void make_sam_dispinfo_3(SAM_DISPINFO_3 *sam, uint32 *num_entries, +BOOL make_sam_dispinfo_3(SAM_DISPINFO_3 *sam, uint32 *num_entries, uint32 *data_size, uint32 start_idx, DOMAIN_GRP *grp) { @@ -1417,7 +1540,7 @@ void make_sam_dispinfo_3(SAM_DISPINFO_3 *sam, uint32 *num_entries, uint32 dsize = 0; int i; - if (sam == NULL || num_entries == NULL || data_size == NULL) return; + if (sam == NULL || num_entries == NULL || data_size == NULL) return False; DEBUG(5,("make_sam_dispinfo_3\n")); @@ -1442,16 +1565,18 @@ void make_sam_dispinfo_3(SAM_DISPINFO_3 *sam, uint32 *num_entries, *num_entries = i; *data_size = dsize; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void sam_io_sam_dispinfo_3(char *desc, SAM_DISPINFO_3 *sam, int num_entries, prs_struct *ps, int depth) +static BOOL sam_io_sam_dispinfo_3(char *desc, SAM_DISPINFO_3 *sam, int num_entries, prs_struct *ps, int depth) { int i; - if (sam == NULL) return; + if (sam == NULL) return False; prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_3"); depth++; @@ -1474,13 +1599,15 @@ static void sam_io_sam_dispinfo_3(char *desc, SAM_DISPINFO_3 *sam, int num_entri sam->sam[i].hdr_grp_desc.buffer, ps, depth); } + + return True; } /******************************************************************* makes a SAM_DISPINFO_4 structure. ********************************************************************/ -void make_sam_dispinfo_4(SAM_DISPINFO_4 *sam, uint32 *num_entries, +BOOL make_sam_dispinfo_4(SAM_DISPINFO_4 *sam, uint32 *num_entries, uint32 *data_size, uint32 start_idx, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) { @@ -1490,7 +1617,7 @@ void make_sam_dispinfo_4(SAM_DISPINFO_4 *sam, uint32 *num_entries, uint32 dsize = 0; int i; - if (sam == NULL || num_entries == NULL || data_size == NULL) return; + if (sam == NULL || num_entries == NULL || data_size == NULL) return False; DEBUG(5,("make_sam_dispinfo_4\n")); @@ -1513,16 +1640,18 @@ void make_sam_dispinfo_4(SAM_DISPINFO_4 *sam, uint32 *num_entries, *num_entries = i; *data_size = dsize; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 *sam, int num_entries, prs_struct *ps, int depth) +static BOOL sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 *sam, int num_entries, prs_struct *ps, int depth) { int i; - if (sam == NULL) return; + if (sam == NULL) return False; prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_4"); depth++; @@ -1543,13 +1672,15 @@ static void sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 *sam, int num_entri smb_io_string2("acct_name", &(sam->str[i].acct_name), sam->sam[i].hdr_acct_name.buffer, ps, depth); } + + return True; } /******************************************************************* makes a SAM_DISPINFO_5 structure. ********************************************************************/ -void make_sam_dispinfo_5(SAM_DISPINFO_5 *sam, uint32 *num_entries, +BOOL make_sam_dispinfo_5(SAM_DISPINFO_5 *sam, uint32 *num_entries, uint32 *data_size, uint32 start_idx, DOMAIN_GRP *grp) { @@ -1558,7 +1689,7 @@ void make_sam_dispinfo_5(SAM_DISPINFO_5 *sam, uint32 *num_entries, uint32 dsize = 0; int i; - if (sam == NULL || num_entries == NULL || data_size == NULL) return; + if (sam == NULL || num_entries == NULL || data_size == NULL) return False; DEBUG(5,("make_sam_dispinfo_5\n")); @@ -1581,16 +1712,18 @@ void make_sam_dispinfo_5(SAM_DISPINFO_5 *sam, uint32 *num_entries, *num_entries = i; *data_size = dsize; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void sam_io_sam_dispinfo_5(char *desc, SAM_DISPINFO_5 *sam, int num_entries, prs_struct *ps, int depth) +static BOOL sam_io_sam_dispinfo_5(char *desc, SAM_DISPINFO_5 *sam, int num_entries, prs_struct *ps, int depth) { int i; - if (sam == NULL) return; + if (sam == NULL) return False; prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_5"); depth++; @@ -1611,18 +1744,20 @@ static void sam_io_sam_dispinfo_5(char *desc, SAM_DISPINFO_5 *sam, int num_entri smb_io_string2("grp_name", &(sam->str[i].grp_name), sam->sam[i].hdr_grp_name.buffer, ps, depth); } + + return True; } /******************************************************************* makes a SAMR_R_QUERY_DISPINFO structure. ********************************************************************/ -void make_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO *r_u, +BOOL make_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO *r_u, uint32 num_entries, uint32 data_size, uint16 switch_level, SAM_DISPINFO_CTR *ctr, uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_query_dispinfo: level %d\n", switch_level)); @@ -1636,15 +1771,17 @@ void make_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO *r_u, r_u->ctr = ctr; r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_query_dispinfo"); depth++; @@ -1697,30 +1834,34 @@ void samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct prs_align(ps); prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_OPEN_GROUP structure. ********************************************************************/ -void make_samr_q_open_group(SAMR_Q_OPEN_GROUP *q_c, +BOOL make_samr_q_open_group(SAMR_Q_OPEN_GROUP *q_c, POLICY_HND *hnd, uint32 unk, uint32 rid) { - if (q_c == NULL || hnd == NULL) return; + if (q_c == NULL || hnd == NULL) return False; DEBUG(5,("make_samr_q_open_group\n")); memcpy(&(q_c->domain_pol), hnd, sizeof(q_c->domain_pol)); q_c->unknown = unk; q_c->rid_group = rid; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_open_group(char *desc, SAMR_Q_OPEN_GROUP *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_open_group(char *desc, SAMR_Q_OPEN_GROUP *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_open_group"); depth++; @@ -1731,14 +1872,16 @@ void samr_io_q_open_group(char *desc, SAMR_Q_OPEN_GROUP *q_u, prs_struct *ps, i prs_uint32("unknown ", ps, depth, &(q_u->unknown )); prs_uint32("rid_group", ps, depth, &(q_u->rid_group)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_open_group"); depth++; @@ -1749,18 +1892,20 @@ void samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP *r_u, prs_struct *ps, i prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a GROUP_INFO1 structure. ********************************************************************/ -void make_samr_group_info1(GROUP_INFO1 *gr1, +BOOL make_samr_group_info1(GROUP_INFO1 *gr1, char *acct_name, char *acct_desc) { int desc_len = acct_desc != NULL ? strlen(acct_desc) : 0; int acct_len = acct_name != NULL ? strlen(acct_name) : 0; - if (gr1 == NULL) return; + if (gr1 == NULL) return False; DEBUG(5,("make_samr_group_info1\n")); @@ -1773,15 +1918,17 @@ void make_samr_group_info1(GROUP_INFO1 *gr1, make_unistr2(&(gr1->uni_acct_name), acct_name, acct_len); make_unistr2(&(gr1->uni_acct_desc), acct_desc, desc_len); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_group_info1(char *desc, GROUP_INFO1 *gr1, prs_struct *ps, int depth) +BOOL samr_io_group_info1(char *desc, GROUP_INFO1 *gr1, prs_struct *ps, int depth) { - if (gr1 == NULL) return; + if (gr1 == NULL) return False; prs_debug(ps, depth, desc, "samr_io_group_info1"); depth++; @@ -1799,29 +1946,33 @@ void samr_io_group_info1(char *desc, GROUP_INFO1 *gr1, prs_struct *ps, int dept prs_align(ps); smb_io_unistr2("uni_acct_desc", &(gr1->uni_acct_desc), gr1->hdr_acct_desc.buffer, ps, depth); + + return True; } /******************************************************************* makes a GROUP_INFO4 structure. ********************************************************************/ -void make_samr_group_info4(GROUP_INFO4 *gr4, const char *acct_desc) +BOOL make_samr_group_info4(GROUP_INFO4 *gr4, const char *acct_desc) { int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - if (gr4 == NULL) return; + if (gr4 == NULL) return False; DEBUG(5,("make_samr_group_info4\n")); make_uni_hdr(&(gr4->hdr_acct_desc), acct_len); make_unistr2(&(gr4->uni_acct_desc), acct_desc, acct_len); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_group_info4(char *desc, GROUP_INFO4 *gr4, prs_struct *ps, int depth) +BOOL samr_io_group_info4(char *desc, GROUP_INFO4 *gr4, prs_struct *ps, int depth) { - if (gr4 == NULL) return; + if (gr4 == NULL) return False; prs_debug(ps, depth, desc, "samr_io_group_info4"); depth++; @@ -1830,14 +1981,16 @@ void samr_io_group_info4(char *desc, GROUP_INFO4 *gr4, prs_struct *ps, int dept smb_io_unihdr ("hdr_acct_desc", &(gr4->hdr_acct_desc) , ps, depth); smb_io_unistr2("uni_acct_desc", &(gr4->uni_acct_desc), gr4->hdr_acct_desc.buffer, ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_group_info_ctr(char *desc, GROUP_INFO_CTR *ctr, prs_struct *ps, int depth) +BOOL samr_group_info_ctr(char *desc, GROUP_INFO_CTR *ctr, prs_struct *ps, int depth) { - if (ctr == NULL) return; + if (ctr == NULL) return False; prs_debug(ps, depth, desc, "samr_group_info_ctr"); depth++; @@ -1865,18 +2018,20 @@ void samr_group_info_ctr(char *desc, GROUP_INFO_CTR *ctr, prs_struct *ps, int d } prs_align(ps); + + return True; } /******************************************************************* makes a SAMR_Q_CREATE_DOM_GROUP structure. ********************************************************************/ -void make_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP *q_e, +BOOL make_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP *q_e, POLICY_HND *pol, const char *acct_desc) { int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - if (q_e == NULL || pol == NULL) return; + if (q_e == NULL || pol == NULL) return False; DEBUG(5,("make_samr_q_create_dom_group\n")); @@ -1887,15 +2042,17 @@ void make_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP *q_e, q_e->unknown_1 = 0x0002; q_e->unknown_2 = 0x0001; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_create_dom_group(char *desc, SAMR_Q_CREATE_DOM_GROUP *q_e, prs_struct *ps, int depth) +BOOL samr_io_q_create_dom_group(char *desc, SAMR_Q_CREATE_DOM_GROUP *q_e, prs_struct *ps, int depth) { - if (q_e == NULL) return; + if (q_e == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_create_dom_group"); depth++; @@ -1911,16 +2068,18 @@ void samr_io_q_create_dom_group(char *desc, SAMR_Q_CREATE_DOM_GROUP *q_e, prs_s prs_uint16("unknown_1", ps, depth, &(q_e->unknown_1)); prs_uint16("unknown_2", ps, depth, &(q_e->unknown_2)); + + return True; } /******************************************************************* makes a SAMR_R_CREATE_DOM_GROUP structure. ********************************************************************/ -void make_samr_r_create_dom_group(SAMR_R_CREATE_DOM_GROUP *r_u, POLICY_HND *pol, +BOOL make_samr_r_create_dom_group(SAMR_R_CREATE_DOM_GROUP *r_u, POLICY_HND *pol, uint32 rid, uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_create_dom_group\n")); @@ -1928,15 +2087,17 @@ void make_samr_r_create_dom_group(SAMR_R_CREATE_DOM_GROUP *r_u, POLICY_HND *pol, r_u->rid = rid ; r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_create_dom_group(char *desc, SAMR_R_CREATE_DOM_GROUP *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_create_dom_group(char *desc, SAMR_R_CREATE_DOM_GROUP *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_create_dom_group"); depth++; @@ -1948,26 +2109,30 @@ void samr_io_r_create_dom_group(char *desc, SAMR_R_CREATE_DOM_GROUP *r_u, prs_s prs_uint32("rid ", ps, depth, &(r_u->rid )); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_DELETE_DOM_GROUP structure. ********************************************************************/ -void make_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP *q_c, POLICY_HND *hnd) +BOOL make_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP *q_c, POLICY_HND *hnd) { - if (q_c == NULL || hnd == NULL) return; + if (q_c == NULL || hnd == NULL) return False; DEBUG(5,("make_samr_q_delete_dom_group\n")); memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_delete_dom_group(char *desc, SAMR_Q_DELETE_DOM_GROUP *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_delete_dom_group(char *desc, SAMR_Q_DELETE_DOM_GROUP *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_delete_dom_group"); depth++; @@ -1975,27 +2140,31 @@ void samr_io_q_delete_dom_group(char *desc, SAMR_Q_DELETE_DOM_GROUP *q_u, prs_s prs_align(ps); smb_io_pol_hnd("group_pol", &(q_u->group_pol), ps, depth); + + return True; } /******************************************************************* makes a SAMR_R_DELETE_DOM_GROUP structure. ********************************************************************/ -void make_samr_r_delete_dom_group(SAMR_R_DELETE_DOM_GROUP *r_u, +BOOL make_samr_r_delete_dom_group(SAMR_R_DELETE_DOM_GROUP *r_u, uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_delete_dom_group\n")); r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_delete_dom_group(char *desc, SAMR_R_DELETE_DOM_GROUP *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_delete_dom_group(char *desc, SAMR_R_DELETE_DOM_GROUP *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_delete_dom_group"); depth++; @@ -2003,6 +2172,8 @@ void samr_io_r_delete_dom_group(char *desc, SAMR_R_DELETE_DOM_GROUP *r_u, prs_s prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } @@ -2010,26 +2181,28 @@ void samr_io_r_delete_dom_group(char *desc, SAMR_R_DELETE_DOM_GROUP *r_u, prs_s /******************************************************************* makes a SAMR_Q_DEL_GROUPMEM structure. ********************************************************************/ -void make_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM *q_e, +BOOL make_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM *q_e, POLICY_HND *pol, uint32 rid) { - if (q_e == NULL || pol == NULL) return; + if (q_e == NULL || pol == NULL) return False; DEBUG(5,("make_samr_q_del_groupmem\n")); memcpy(&(q_e->pol), pol, sizeof(*pol)); q_e->rid = rid; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_del_groupmem(char *desc, SAMR_Q_DEL_GROUPMEM *q_e, prs_struct *ps, int depth) +BOOL samr_io_q_del_groupmem(char *desc, SAMR_Q_DEL_GROUPMEM *q_e, prs_struct *ps, int depth) { - if (q_e == NULL) return; + if (q_e == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_del_groupmem"); depth++; @@ -2040,29 +2213,33 @@ void samr_io_q_del_groupmem(char *desc, SAMR_Q_DEL_GROUPMEM *q_e, prs_struct *p prs_align(ps); prs_uint32("rid ", ps, depth, &(q_e->rid)); + + return True; } /******************************************************************* makes a SAMR_R_DEL_GROUPMEM structure. ********************************************************************/ -void make_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM *r_u, POLICY_HND *pol, +BOOL make_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM *r_u, POLICY_HND *pol, uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_del_groupmem\n")); r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_del_groupmem(char *desc, SAMR_R_DEL_GROUPMEM *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_del_groupmem(char *desc, SAMR_R_DEL_GROUPMEM *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_del_groupmem"); depth++; @@ -2070,17 +2247,19 @@ void samr_io_r_del_groupmem(char *desc, SAMR_R_DEL_GROUPMEM *r_u, prs_struct *p prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_ADD_GROUPMEM structure. ********************************************************************/ -void make_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM *q_e, +BOOL make_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM *q_e, POLICY_HND *pol, uint32 rid) { - if (q_e == NULL || pol == NULL) return; + if (q_e == NULL || pol == NULL) return False; DEBUG(5,("make_samr_q_add_groupmem\n")); @@ -2088,15 +2267,17 @@ void make_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM *q_e, q_e->rid = rid; q_e->unknown = 0x0005; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_add_groupmem(char *desc, SAMR_Q_ADD_GROUPMEM *q_e, prs_struct *ps, int depth) +BOOL samr_io_q_add_groupmem(char *desc, SAMR_Q_ADD_GROUPMEM *q_e, prs_struct *ps, int depth) { - if (q_e == NULL) return; + if (q_e == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_add_groupmem"); depth++; @@ -2108,29 +2289,33 @@ void samr_io_q_add_groupmem(char *desc, SAMR_Q_ADD_GROUPMEM *q_e, prs_struct *p prs_uint32("rid ", ps, depth, &(q_e->rid)); prs_uint32("unknown", ps, depth, &(q_e->unknown)); + + return True; } /******************************************************************* makes a SAMR_R_ADD_GROUPMEM structure. ********************************************************************/ -void make_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM *r_u, POLICY_HND *pol, +BOOL make_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM *r_u, POLICY_HND *pol, uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_add_groupmem\n")); r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_add_groupmem(char *desc, SAMR_R_ADD_GROUPMEM *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_add_groupmem(char *desc, SAMR_R_ADD_GROUPMEM *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_add_groupmem"); depth++; @@ -2138,30 +2323,34 @@ void samr_io_r_add_groupmem(char *desc, SAMR_R_ADD_GROUPMEM *r_u, prs_struct *p prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_SET_GROUPINFO structure. ********************************************************************/ -void make_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO *q_e, +BOOL make_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO *q_e, POLICY_HND *pol, GROUP_INFO_CTR *ctr) { - if (q_e == NULL || pol == NULL) return; + if (q_e == NULL || pol == NULL) return False; DEBUG(5,("make_samr_q_set_groupinfo\n")); memcpy(&(q_e->pol), pol, sizeof(*pol)); q_e->ctr = ctr; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_set_groupinfo(char *desc, SAMR_Q_SET_GROUPINFO *q_e, prs_struct *ps, int depth) +BOOL samr_io_q_set_groupinfo(char *desc, SAMR_Q_SET_GROUPINFO *q_e, prs_struct *ps, int depth) { - if (q_e == NULL) return; + if (q_e == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_set_groupinfo"); depth++; @@ -2172,29 +2361,33 @@ void samr_io_q_set_groupinfo(char *desc, SAMR_Q_SET_GROUPINFO *q_e, prs_struct prs_align(ps); samr_group_info_ctr("ctr", q_e->ctr, ps, depth); + + return True; } /******************************************************************* makes a SAMR_R_SET_GROUPINFO structure. ********************************************************************/ -void make_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO *r_u, +BOOL make_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO *r_u, uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_set_groupinfo\n")); r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_set_groupinfo(char *desc, SAMR_R_SET_GROUPINFO *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_set_groupinfo(char *desc, SAMR_R_SET_GROUPINFO *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_set_groupinfo"); depth++; @@ -2202,31 +2395,35 @@ void samr_io_r_set_groupinfo(char *desc, SAMR_R_SET_GROUPINFO *r_u, prs_struct prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_QUERY_GROUPINFO structure. ********************************************************************/ -void make_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO *q_e, +BOOL make_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO *q_e, POLICY_HND *pol, uint16 switch_level) { - if (q_e == NULL || pol == NULL) return; + if (q_e == NULL || pol == NULL) return False; DEBUG(5,("make_samr_q_query_groupinfo\n")); memcpy(&(q_e->pol), pol, sizeof(*pol)); q_e->switch_level = switch_level; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_query_groupinfo(char *desc, SAMR_Q_QUERY_GROUPINFO *q_e, prs_struct *ps, int depth) +BOOL samr_io_q_query_groupinfo(char *desc, SAMR_Q_QUERY_GROUPINFO *q_e, prs_struct *ps, int depth) { - if (q_e == NULL) return; + if (q_e == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_query_groupinfo"); depth++; @@ -2237,31 +2434,35 @@ void samr_io_q_query_groupinfo(char *desc, SAMR_Q_QUERY_GROUPINFO *q_e, prs_str prs_align(ps); prs_uint16("switch_level", ps, depth, &(q_e->switch_level)); + + return True; } /******************************************************************* makes a SAMR_R_QUERY_GROUPINFO structure. ********************************************************************/ -void make_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO *r_u, GROUP_INFO_CTR *ctr, +BOOL make_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO *r_u, GROUP_INFO_CTR *ctr, uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_query_groupinfo\n")); r_u->ptr = (status == 0x0 && ctr != NULL) ? 1 : 0; r_u->ctr = ctr; r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_query_groupinfo(char *desc, SAMR_R_QUERY_GROUPINFO *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_query_groupinfo(char *desc, SAMR_R_QUERY_GROUPINFO *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_query_groupinfo"); depth++; @@ -2276,27 +2477,31 @@ void samr_io_r_query_groupinfo(char *desc, SAMR_R_QUERY_GROUPINFO *r_u, prs_str } prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_QUERY_GROUPMEM structure. ********************************************************************/ -void make_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM *q_c, POLICY_HND *hnd) +BOOL make_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM *q_c, POLICY_HND *hnd) { - if (q_c == NULL || hnd == NULL) return; + if (q_c == NULL || hnd == NULL) return False; DEBUG(5,("make_samr_q_query_groupmem\n")); memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_query_groupmem(char *desc, SAMR_Q_QUERY_GROUPMEM *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_query_groupmem(char *desc, SAMR_Q_QUERY_GROUPMEM *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_query_groupmem"); depth++; @@ -2304,15 +2509,17 @@ void samr_io_q_query_groupmem(char *desc, SAMR_Q_QUERY_GROUPMEM *q_u, prs_struc prs_align(ps); smb_io_pol_hnd("group_pol", &(q_u->group_pol), ps, depth); + + return True; } /******************************************************************* makes a SAMR_R_QUERY_GROUPMEM structure. ********************************************************************/ -void make_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM *r_u, +BOOL make_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM *r_u, uint32 num_entries, uint32 *rid, uint32 *attr, uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_query_groupmem\n")); @@ -2337,16 +2544,18 @@ void make_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM *r_u, } r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struct *ps, int depth) { int i; - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_query_groupmem"); depth++; @@ -2383,29 +2592,33 @@ void samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struc } prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_QUERY_USERGROUPS structure. ********************************************************************/ -void make_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u, +BOOL make_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u, POLICY_HND *hnd) { - if (q_u == NULL || hnd == NULL) return; + if (q_u == NULL || hnd == NULL) return False; DEBUG(5,("make_samr_q_query_usergroups\n")); memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_query_usergroups"); depth++; @@ -2414,15 +2627,17 @@ void samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS *q_u, prs_s smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); prs_align(ps); + + return True; } /******************************************************************* makes a SAMR_R_QUERY_USERGROUPS structure. ********************************************************************/ -void make_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u, +BOOL make_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u, uint32 num_gids, DOM_GID *gid, uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_query_usergroups\n")); @@ -2443,15 +2658,17 @@ void make_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u, } r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_struct *ps, int depth) { int i; - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_query_usergroups"); depth++; @@ -2477,15 +2694,17 @@ void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_s } } prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_ENUM_DOM_GROUPS structure. ********************************************************************/ -void make_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol, uint32 size) +BOOL make_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol, uint32 size) { - if (q_e == NULL || pol == NULL) return; + if (q_e == NULL || pol == NULL) return False; DEBUG(5,("make_samr_q_enum_dom_groups\n")); @@ -2493,15 +2712,17 @@ void make_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol, u q_e->unknown_0 = 0; q_e->max_size = size; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_enum_dom_groups(char *desc, SAMR_Q_ENUM_DOM_GROUPS *q_e, prs_struct *ps, int depth) +BOOL samr_io_q_enum_dom_groups(char *desc, SAMR_Q_ENUM_DOM_GROUPS *q_e, prs_struct *ps, int depth) { - if (q_e == NULL) return; + if (q_e == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_enum_dom_groups"); depth++; @@ -2515,19 +2736,21 @@ void samr_io_q_enum_dom_groups(char *desc, SAMR_Q_ENUM_DOM_GROUPS *q_e, prs_stru prs_uint32("max_size ", ps, depth, &(q_e->max_size )); prs_align(ps); + + return True; } /******************************************************************* makes a SAMR_R_ENUM_DOM_GROUPS structure. ********************************************************************/ -void make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, +BOOL make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, uint32 num_sam_entries, DOMAIN_GRP *grps, uint32 status) { int i; - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_enum_dom_groups\n")); @@ -2568,16 +2791,18 @@ void make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, } r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_struct *ps, int depth) { int i; - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_enum_dom_groups"); depth++; @@ -2610,15 +2835,17 @@ void samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_stru prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_ENUM_DOM_ALIASES structure. ********************************************************************/ -void make_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_e, POLICY_HND *pol, uint32 size) +BOOL make_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_e, POLICY_HND *pol, uint32 size) { - if (q_e == NULL || pol == NULL) return; + if (q_e == NULL || pol == NULL) return False; DEBUG(5,("make_samr_q_enum_dom_aliases\n")); @@ -2626,15 +2853,17 @@ void make_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_e, POLICY_HND *pol, q_e->unknown_0 = 0; q_e->max_size = size; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_enum_dom_aliases(char *desc, SAMR_Q_ENUM_DOM_ALIASES *q_e, prs_struct *ps, int depth) +BOOL samr_io_q_enum_dom_aliases(char *desc, SAMR_Q_ENUM_DOM_ALIASES *q_e, prs_struct *ps, int depth) { - if (q_e == NULL) return; + if (q_e == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_enum_dom_aliases"); depth++; @@ -2648,19 +2877,21 @@ void samr_io_q_enum_dom_aliases(char *desc, SAMR_Q_ENUM_DOM_ALIASES *q_e, prs_s prs_uint32("max_size ", ps, depth, &(q_e->max_size )); prs_align(ps); + + return True; } /******************************************************************* makes a SAMR_R_ENUM_DOM_ALIASES structure. ********************************************************************/ -void make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, +BOOL make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, uint32 num_sam_entries, LOCAL_GRP *alss, uint32 status) { int i; - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_enum_dom_aliases\n")); @@ -2701,16 +2932,18 @@ void make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, } r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_struct *ps, int depth) { int i; - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_enum_dom_aliases"); depth++; @@ -2743,30 +2976,34 @@ void samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_s prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a ALIAS_INFO3 structure. ********************************************************************/ -void make_samr_alias_info3(ALIAS_INFO3 *al3, const char *acct_desc) +BOOL make_samr_alias_info3(ALIAS_INFO3 *al3, const char *acct_desc) { int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - if (al3 == NULL) return; + if (al3 == NULL) return False; DEBUG(5,("make_samr_alias_info3\n")); make_uni_hdr(&(al3->hdr_acct_desc), acct_len); make_unistr2(&(al3->uni_acct_desc), acct_desc, acct_len); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_alias_info3(char *desc, ALIAS_INFO3 *al3, prs_struct *ps, int depth) +BOOL samr_io_alias_info3(char *desc, ALIAS_INFO3 *al3, prs_struct *ps, int depth) { - if (al3 == NULL) return; + if (al3 == NULL) return False; prs_debug(ps, depth, desc, "samr_io_alias_info3"); depth++; @@ -2775,14 +3012,16 @@ void samr_io_alias_info3(char *desc, ALIAS_INFO3 *al3, prs_struct *ps, int dept smb_io_unihdr ("hdr_acct_desc", &(al3->hdr_acct_desc) , ps, depth); smb_io_unistr2("uni_acct_desc", &(al3->uni_acct_desc), al3->hdr_acct_desc.buffer, ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_alias_info_ctr(char *desc, ALIAS_INFO_CTR *ctr, prs_struct *ps, int depth) +BOOL samr_alias_info_ctr(char *desc, ALIAS_INFO_CTR *ctr, prs_struct *ps, int depth) { - if (ctr == NULL) return; + if (ctr == NULL) return False; prs_debug(ps, depth, desc, "samr_alias_info_ctr"); depth++; @@ -2805,32 +3044,36 @@ void samr_alias_info_ctr(char *desc, ALIAS_INFO_CTR *ctr, prs_struct *ps, int d } prs_align(ps); + + return True; } /******************************************************************* makes a SAMR_Q_QUERY_ALIASINFO structure. ********************************************************************/ -void make_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO *q_e, +BOOL make_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO *q_e, POLICY_HND *pol, uint16 switch_level) { - if (q_e == NULL || pol == NULL) return; + if (q_e == NULL || pol == NULL) return False; DEBUG(5,("make_samr_q_query_aliasinfo\n")); memcpy(&(q_e->pol), pol, sizeof(*pol)); q_e->switch_level = switch_level; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_query_aliasinfo(char *desc, SAMR_Q_QUERY_ALIASINFO *q_e, prs_struct *ps, int depth) +BOOL samr_io_q_query_aliasinfo(char *desc, SAMR_Q_QUERY_ALIASINFO *q_e, prs_struct *ps, int depth) { - if (q_e == NULL) return; + if (q_e == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_query_aliasinfo"); depth++; @@ -2841,31 +3084,35 @@ void samr_io_q_query_aliasinfo(char *desc, SAMR_Q_QUERY_ALIASINFO *q_e, prs_str prs_align(ps); prs_uint16("switch_level", ps, depth, &(q_e->switch_level)); + + return True; } /******************************************************************* makes a SAMR_R_QUERY_ALIASINFO structure. ********************************************************************/ -void make_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *r_u, ALIAS_INFO_CTR *ctr, +BOOL make_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *r_u, ALIAS_INFO_CTR *ctr, uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_query_aliasinfo\n")); r_u->ptr = (status == 0x0 && ctr != NULL) ? 1 : 0; r_u->ctr = ctr; r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo"); depth++; @@ -2880,30 +3127,34 @@ void samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO *r_u, prs_str } prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_SET_ALIASINFO structure. ********************************************************************/ -void make_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO *q_u, POLICY_HND *hnd, +BOOL make_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO *q_u, POLICY_HND *hnd, ALIAS_INFO_CTR *ctr) { - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("make_samr_q_set_aliasinfo\n")); memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol)); q_u->ctr = ctr; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_set_aliasinfo(char *desc, SAMR_Q_SET_ALIASINFO *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_set_aliasinfo(char *desc, SAMR_Q_SET_ALIASINFO *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_set_aliasinfo"); depth++; @@ -2912,20 +3163,24 @@ void samr_io_q_set_aliasinfo(char *desc, SAMR_Q_SET_ALIASINFO *q_u, prs_struct smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); samr_alias_info_ctr("ctr", q_u->ctr, ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_set_aliasinfo(char *desc, SAMR_R_SET_ALIASINFO *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_set_aliasinfo(char *desc, SAMR_R_SET_ALIASINFO *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_set_aliasinfo"); depth++; prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } @@ -2933,11 +3188,11 @@ void samr_io_r_set_aliasinfo(char *desc, SAMR_R_SET_ALIASINFO *r_u, prs_struct /******************************************************************* makes a SAMR_Q_QUERY_USERALIASES structure. ********************************************************************/ -void make_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u, +BOOL make_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u, POLICY_HND *hnd, DOM_SID *sid) { - if (q_u == NULL || hnd == NULL) return; + if (q_u == NULL || hnd == NULL) return False; DEBUG(5,("make_samr_q_query_useraliases\n")); @@ -2951,17 +3206,19 @@ void make_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u, q_u->ptr_sid[0] = 1; make_dom_sid2(&q_u->sid[0], sid); } + + return True; } /******************************************************************* reads or writes a SAMR_Q_QUERY_USERALIASES structure. ********************************************************************/ -void samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES *q_u, prs_struct *ps, int depth) { fstring tmp; int i; - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_query_useraliases"); depth++; @@ -2994,16 +3251,18 @@ void samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES *q_u, prs } prs_align(ps); + + return True; } /******************************************************************* makes a SAMR_R_QUERY_USERALIASES structure. ********************************************************************/ -void make_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u, +BOOL make_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u, uint32 num_rids, uint32 *rid, uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_query_useraliases\n")); @@ -3023,16 +3282,18 @@ void make_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u, } r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs_struct *ps, int depth) { fstring tmp; int i; - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_query_useraliases"); depth++; @@ -3053,15 +3314,17 @@ void samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs } prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_OPEN_ALIAS structure. ********************************************************************/ -void make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, POLICY_HND *pol, +BOOL make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, POLICY_HND *pol, uint32 unknown_0, uint32 rid) { - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("make_samr_q_open_alias\n")); @@ -3071,14 +3334,16 @@ void make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, POLICY_HND *pol, q_u->unknown_0 = unknown_0; q_u->rid_alias = rid; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_open_alias"); depth++; @@ -3089,14 +3354,16 @@ void samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, i prs_uint32("unknown_0", ps, depth, &(q_u->unknown_0)); prs_uint32("rid_alias", ps, depth, &(q_u->rid_alias)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_open_alias"); depth++; @@ -3107,17 +3374,19 @@ void samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, i prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_LOOKUP_RIDS structure. ********************************************************************/ -void make_samr_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u, +BOOL make_samr_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u, POLICY_HND *pol, uint32 flags, uint32 num_rids, uint32 *rid) { int i; - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("make_samr_r_unknwon_12\n")); @@ -3132,17 +3401,19 @@ void make_samr_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u, { q_u->rid[i] = rid[i]; } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS *q_u, prs_struct *ps, int depth) { int i; fstring tmp; - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_lookup_rids"); depth++; @@ -3167,18 +3438,20 @@ void samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS *q_u, prs_struct *ps, } prs_align(ps); + + return True; } /******************************************************************* makes a SAMR_R_LOOKUP_RIDS structure. ********************************************************************/ -void make_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u, +BOOL make_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u, uint32 num_names, fstring *name, uint8 *type, uint32 status) { int i; - if (r_u == NULL || name == NULL || type == NULL) return; + if (r_u == NULL || name == NULL || type == NULL) return False; DEBUG(5,("make_samr_r_lookup_rids\n")); @@ -3214,16 +3487,18 @@ void make_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u, } r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, int depth) { int i; fstring tmp; - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_lookup_rids"); depth++; @@ -3269,27 +3544,31 @@ void samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, } prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_OPEN_ALIAS structure. ********************************************************************/ -void make_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS *q_u, POLICY_HND *hnd) +BOOL make_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS *q_u, POLICY_HND *hnd) { - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("make_samr_q_delete_alias\n")); memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_delete_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_delete_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_delete_alias"); depth++; @@ -3297,14 +3576,16 @@ void samr_io_q_delete_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS *q_u, prs_struc prs_align(ps); smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_delete_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_delete_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_delete_alias"); depth++; @@ -3313,17 +3594,19 @@ void samr_io_r_delete_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS *r_u, prs_struc smb_io_pol_hnd("pol", &(r_u->pol), ps, depth); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_CREATE_DOM_ALIAS structure. ********************************************************************/ -void make_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS *q_u, POLICY_HND *hnd, +BOOL make_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS *q_u, POLICY_HND *hnd, const char *acct_desc) { int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("make_samr_q_create_dom_alias\n")); @@ -3334,15 +3617,17 @@ void make_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS *q_u, POLICY_HND *hnd, q_u->unknown_1 = 0x001f; q_u->unknown_2 = 0x000f; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_create_dom_alias(char *desc, SAMR_Q_CREATE_DOM_ALIAS *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_create_dom_alias(char *desc, SAMR_Q_CREATE_DOM_ALIAS *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_create_dom_alias"); depth++; @@ -3356,30 +3641,34 @@ void samr_io_q_create_dom_alias(char *desc, SAMR_Q_CREATE_DOM_ALIAS *q_u, prs_s prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1)); prs_uint16("unknown_2", ps, depth, &(q_u->unknown_2)); + + return True; } /******************************************************************* makes a SAMR_R_CREATE_DOM_ALIAS structure. ********************************************************************/ -void make_samr_r_create_dom_alias(SAMR_R_CREATE_DOM_ALIAS *r_u, POLICY_HND *pol, +BOOL make_samr_r_create_dom_alias(SAMR_R_CREATE_DOM_ALIAS *r_u, POLICY_HND *pol, uint32 rid, uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_create_dom_alias\n")); memcpy(&(r_u->alias_pol), pol, sizeof(*pol)); r_u->rid = rid ; r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_create_dom_alias(char *desc, SAMR_R_CREATE_DOM_ALIAS *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_create_dom_alias(char *desc, SAMR_R_CREATE_DOM_ALIAS *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_create_dom_alias"); depth++; @@ -3390,6 +3679,8 @@ void samr_io_r_create_dom_alias(char *desc, SAMR_R_CREATE_DOM_ALIAS *r_u, prs_s prs_uint32("rid", ps, depth, &(r_u->rid)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } @@ -3397,24 +3688,26 @@ void samr_io_r_create_dom_alias(char *desc, SAMR_R_CREATE_DOM_ALIAS *r_u, prs_s /******************************************************************* makes a SAMR_Q_ADD_ALIASMEM structure. ********************************************************************/ -void make_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, POLICY_HND *hnd, +BOOL make_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, POLICY_HND *hnd, DOM_SID *sid) { - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("make_samr_q_add_aliasmem\n")); memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol)); make_dom_sid2(&q_u->sid, sid); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_add_aliasmem"); depth++; @@ -3423,14 +3716,16 @@ void samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM *q_u, prs_struct *p smb_io_pol_hnd ("alias_pol", &(q_u->alias_pol), ps, depth); smb_io_dom_sid2("sid ", &(q_u->sid ), ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_add_aliasmem(char *desc, SAMR_R_ADD_ALIASMEM *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_add_aliasmem(char *desc, SAMR_R_ADD_ALIASMEM *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_add_aliasmem"); depth++; @@ -3438,30 +3733,34 @@ void samr_io_r_add_aliasmem(char *desc, SAMR_R_ADD_ALIASMEM *r_u, prs_struct *p prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_DEL_ALIASMEM structure. ********************************************************************/ -void make_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM *q_u, POLICY_HND *hnd, +BOOL make_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM *q_u, POLICY_HND *hnd, DOM_SID *sid) { - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("make_samr_q_del_aliasmem\n")); memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol)); make_dom_sid2(&q_u->sid, sid); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_del_aliasmem(char *desc, SAMR_Q_DEL_ALIASMEM *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_del_aliasmem(char *desc, SAMR_Q_DEL_ALIASMEM *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_del_aliasmem"); depth++; @@ -3470,14 +3769,16 @@ void samr_io_q_del_aliasmem(char *desc, SAMR_Q_DEL_ALIASMEM *q_u, prs_struct *p smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); smb_io_dom_sid2("sid ", &(q_u->sid ), ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_del_aliasmem(char *desc, SAMR_R_DEL_ALIASMEM *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_del_aliasmem(char *desc, SAMR_R_DEL_ALIASMEM *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_del_aliasmem"); depth++; @@ -3485,26 +3786,30 @@ void samr_io_r_del_aliasmem(char *desc, SAMR_R_DEL_ALIASMEM *r_u, prs_struct *p prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_DELETE_DOM_ALIAS structure. ********************************************************************/ -void make_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS *q_c, POLICY_HND *hnd) +BOOL make_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS *q_c, POLICY_HND *hnd) { - if (q_c == NULL || hnd == NULL) return; + if (q_c == NULL || hnd == NULL) return False; DEBUG(5,("make_samr_q_delete_dom_alias\n")); memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_delete_dom_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_delete_dom_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_delete_dom_alias"); depth++; @@ -3512,27 +3817,31 @@ void samr_io_q_delete_dom_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS *q_u, prs_s prs_align(ps); smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); + + return True; } /******************************************************************* makes a SAMR_R_DELETE_DOM_ALIAS structure. ********************************************************************/ -void make_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS *r_u, +BOOL make_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS *r_u, uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_delete_dom_alias\n")); r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_delete_dom_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_delete_dom_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_delete_dom_alias"); depth++; @@ -3540,27 +3849,31 @@ void samr_io_r_delete_dom_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS *r_u, prs_s prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_QUERY_ALIASMEM structure. ********************************************************************/ -void make_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_c, POLICY_HND *hnd) +BOOL make_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_c, POLICY_HND *hnd) { - if (q_c == NULL || hnd == NULL) return; + if (q_c == NULL || hnd == NULL) return False; DEBUG(5,("make_samr_q_query_aliasmem\n")); memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_query_aliasmem(char *desc, SAMR_Q_QUERY_ALIASMEM *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_query_aliasmem(char *desc, SAMR_Q_QUERY_ALIASMEM *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_query_aliasmem"); depth++; @@ -3568,15 +3881,17 @@ void samr_io_q_query_aliasmem(char *desc, SAMR_Q_QUERY_ALIASMEM *q_u, prs_struc prs_align(ps); smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); + + return True; } /******************************************************************* makes a SAMR_R_QUERY_ALIASMEM structure. ********************************************************************/ -void make_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM *r_u, +BOOL make_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM *r_u, uint32 num_sids, DOM_SID2 *sid, uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_query_aliasmem\n")); @@ -3595,17 +3910,19 @@ void make_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM *r_u, } r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM *r_u, prs_struct *ps, int depth) { int i; uint32 ptr_sid[MAX_LOOKUP_SIDS]; - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_query_aliasmem"); depth++; @@ -3640,17 +3957,19 @@ void samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM *r_u, prs_struc } } prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_LOOKUP_NAMES structure. ********************************************************************/ -void make_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES *q_u, +BOOL make_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES *q_u, POLICY_HND *pol, uint32 flags, uint32 num_names, const char **name) { int i; - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("make_samr_q_lookup_names\n")); @@ -3667,17 +3986,19 @@ void make_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES *q_u, make_uni_hdr(&(q_u->hdr_name[i]), len_name); /* unicode header for user_name */ make_unistr2(&(q_u->uni_name[i]), name[i], len_name); /* unicode string for machine account */ } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *ps, int depth) { int i; - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_lookup_names"); depth++; @@ -3706,17 +4027,19 @@ void samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *p } prs_align(ps); + + return True; } /******************************************************************* makes a SAMR_R_LOOKUP_NAMES structure. ********************************************************************/ -void make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, +BOOL make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, uint32 num_rids, uint32 *rid, uint8 *type, uint32 status) { int i; - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_lookup_names\n")); @@ -3750,17 +4073,19 @@ void make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, } r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *ps, int depth) { int i; fstring tmp; - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_lookup_names"); depth++; @@ -3777,7 +4102,7 @@ void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p if (r_u->num_rids2 != r_u->num_rids1) { /* RPC fault */ - return; + return False; } for (i = 0; i < r_u->num_rids2; i++) @@ -3798,7 +4123,7 @@ void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p if (r_u->num_types2 != r_u->num_types1) { /* RPC fault */ - return; + return False; } for (i = 0; i < r_u->num_types2; i++) @@ -3810,17 +4135,19 @@ void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p } prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void make_samr_q_open_user(SAMR_Q_OPEN_USER *q_u, +BOOL make_samr_q_open_user(SAMR_Q_OPEN_USER *q_u, POLICY_HND *pol, uint32 unk_0, uint32 rid) { - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("samr_make_samr_q_open_user\n")); @@ -3828,14 +4155,16 @@ void make_samr_q_open_user(SAMR_Q_OPEN_USER *q_u, q_u->unknown_0 = unk_0; q_u->user_rid = rid; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_open_user"); depth++; @@ -3849,14 +4178,16 @@ void samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER *q_u, prs_struct *ps, int prs_uint32("user_rid ", ps, depth, &(q_u->user_rid )); prs_align(ps); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_open_user"); depth++; @@ -3867,18 +4198,20 @@ void samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER *r_u, prs_struct *ps, int prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void make_samr_q_create_user(SAMR_Q_CREATE_USER *q_u, +BOOL make_samr_q_create_user(SAMR_Q_CREATE_USER *q_u, POLICY_HND *pol, const char *name, uint16 acb_info, uint32 unk_1) { int len_name; - if (q_u == NULL) return; + if (q_u == NULL) return False; len_name = strlen(name); DEBUG(5,("samr_make_samr_q_create_user\n")); @@ -3890,14 +4223,16 @@ void make_samr_q_create_user(SAMR_Q_CREATE_USER *q_u, q_u->acb_info = acb_info; q_u->unknown_1 = unk_1; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_create_user(char *desc, SAMR_Q_CREATE_USER *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_create_user(char *desc, SAMR_Q_CREATE_USER *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_create_user"); depth++; @@ -3916,17 +4251,19 @@ void samr_io_q_create_user(char *desc, SAMR_Q_CREATE_USER *q_u, prs_struct *ps, prs_uint32("unknown_1", ps, depth, &(q_u->unknown_1)); prs_align(ps); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void make_samr_r_create_user(SAMR_R_CREATE_USER *r_u, +BOOL make_samr_r_create_user(SAMR_R_CREATE_USER *r_u, POLICY_HND *user_pol, uint32 unk_0, uint32 user_rid, uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("samr_make_samr_r_create_user\n")); @@ -3935,14 +4272,16 @@ void make_samr_r_create_user(SAMR_R_CREATE_USER *r_u, r_u->unknown_0 = unk_0; r_u->user_rid = user_rid; r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_create_user"); depth++; @@ -3955,29 +4294,33 @@ void samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER *r_u, prs_struct *ps, prs_uint32("unknown_0", ps, depth, &(r_u->unknown_0)); prs_uint32("user_rid ", ps, depth, &(r_u->user_rid )); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_QUERY_USERINFO structure. ********************************************************************/ -void make_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO *q_u, +BOOL make_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO *q_u, POLICY_HND *hnd, uint16 switch_value) { - if (q_u == NULL || hnd == NULL) return; + if (q_u == NULL || hnd == NULL) return False; DEBUG(5,("make_samr_q_query_userinfo\n")); memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); q_u->switch_value = switch_value; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_query_userinfo(char *desc, SAMR_Q_QUERY_USERINFO *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_query_userinfo(char *desc, SAMR_Q_QUERY_USERINFO *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_query_userinfo"); depth++; @@ -3990,14 +4333,16 @@ void samr_io_q_query_userinfo(char *desc, SAMR_Q_QUERY_USERINFO *q_u, prs_struc prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); /* 0x0015 or 0x0011 */ prs_align(ps); + + return True; } /******************************************************************* reads or writes a LOGON_HRS structure. ********************************************************************/ -static void sam_io_logon_hrs(char *desc, LOGON_HRS *hrs, prs_struct *ps, int depth) +static BOOL sam_io_logon_hrs(char *desc, LOGON_HRS *hrs, prs_struct *ps, int depth) { - if (hrs == NULL) return; + if (hrs == NULL) return False; prs_debug(ps, depth, desc, "sam_io_logon_hrs"); depth++; @@ -4013,27 +4358,31 @@ static void sam_io_logon_hrs(char *desc, LOGON_HRS *hrs, prs_struct *ps, int de } prs_uint8s (False, "hours", ps, depth, hrs->hours, hrs->len); + + return True; } /******************************************************************* makes a SAM_USER_INFO_10 structure. ********************************************************************/ -void make_sam_user_info10(SAM_USER_INFO_10 *usr, +BOOL make_sam_user_info10(SAM_USER_INFO_10 *usr, uint32 acb_info) { - if (usr == NULL) return; + if (usr == NULL) return False; DEBUG(5,("make_sam_user_info10\n")); usr->acb_info = acb_info; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void sam_io_user_info10(char *desc, SAM_USER_INFO_10 *usr, prs_struct *ps, int depth) +BOOL sam_io_user_info10(char *desc, SAM_USER_INFO_10 *usr, prs_struct *ps, int depth) { - if (usr == NULL) return; + if (usr == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_user_info10"); depth++; @@ -4041,12 +4390,14 @@ void sam_io_user_info10(char *desc, SAM_USER_INFO_10 *usr, prs_struct *ps, int prs_align(ps); prs_uint32("acb_info", ps, depth, &(usr->acb_info)); + + return True; } /******************************************************************* makes a SAM_USER_INFO_11 structure. ********************************************************************/ -void make_sam_user_info11(SAM_USER_INFO_11 *usr, +BOOL make_sam_user_info11(SAM_USER_INFO_11 *usr, NTTIME *expiry, char *mach_acct, uint32 rid_user, @@ -4055,7 +4406,7 @@ void make_sam_user_info11(SAM_USER_INFO_11 *usr, { int len_mach_acct; - if (usr == NULL || expiry == NULL || mach_acct == NULL) return; + if (usr == NULL || expiry == NULL || mach_acct == NULL) return False; DEBUG(5,("make_sam_user_info11\n")); @@ -4090,14 +4441,16 @@ void make_sam_user_info11(SAM_USER_INFO_11 *usr, usr->padding_8 = 0; /* 0 - padding 4 bytes */ make_unistr2(&(usr->uni_mach_acct), mach_acct, len_mach_acct); /* unicode string for machine account */ + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int depth) +BOOL sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int depth) { - if (usr == NULL) return; + if (usr == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_unknown_24"); depth++; @@ -4137,6 +4490,8 @@ void sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int prs_align(ps); prs_uint8s (False, "padding_9", ps, depth, usr->padding_9, sizeof(usr->padding_9)); + + return True; } /************************************************************************* @@ -4147,18 +4502,20 @@ void sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int unknown_6 = 0x0000 04ec *************************************************************************/ -void make_sam_user_info24(SAM_USER_INFO_24 *usr, +BOOL make_sam_user_info24(SAM_USER_INFO_24 *usr, char newpass[516]) { memcpy(usr->pass, newpass, sizeof(usr->pass)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void sam_io_user_info24(char *desc, SAM_USER_INFO_24 *usr, prs_struct *ps, int depth) +static BOOL sam_io_user_info24(char *desc, SAM_USER_INFO_24 *usr, prs_struct *ps, int depth) { - if (usr == NULL) return; + if (usr == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_user_info"); depth++; @@ -4167,6 +4524,8 @@ static void sam_io_user_info24(char *desc, SAM_USER_INFO_24 *usr, prs_struct *p prs_uint8s (False, "password", ps, depth, usr->pass, sizeof(usr->pass)); prs_align(ps); + + return True; } @@ -4178,7 +4537,7 @@ static void sam_io_user_info24(char *desc, SAM_USER_INFO_24 *usr, prs_struct *p unknown_6 = 0x0000 04ec *************************************************************************/ -void make_sam_user_info23(SAM_USER_INFO_23 *usr, +BOOL make_sam_user_info23(SAM_USER_INFO_23 *usr, NTTIME *logon_time, /* all zeros */ NTTIME *logoff_time, /* all zeros */ @@ -4277,14 +4636,16 @@ void make_sam_user_info23(SAM_USER_INFO_23 *usr, { memset(&(usr->logon_hrs), 0xff, sizeof(usr->logon_hrs)); } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void sam_io_user_info23(char *desc, SAM_USER_INFO_23 *usr, prs_struct *ps, int depth) +static BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 *usr, prs_struct *ps, int depth) { - if (usr == NULL) return; + if (usr == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_user_info"); depth++; @@ -4347,6 +4708,8 @@ static void sam_io_user_info23(char *desc, SAM_USER_INFO_23 *usr, prs_struct *p sam_io_logon_hrs("logon_hrs", &(usr->logon_hrs) , ps, depth); prs_align(ps); } + + return True; } @@ -4358,7 +4721,7 @@ static void sam_io_user_info23(char *desc, SAM_USER_INFO_23 *usr, prs_struct *p unknown_6 = 0x0000 04ec *************************************************************************/ -void make_sam_user_info21(SAM_USER_INFO_21 *usr, +BOOL make_sam_user_info21(SAM_USER_INFO_21 *usr, NTTIME *logon_time, NTTIME *logoff_time, @@ -4453,15 +4816,17 @@ void make_sam_user_info21(SAM_USER_INFO_21 *usr, { memset(&(usr->logon_hrs), 0xff, sizeof(usr->logon_hrs)); } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *ps, int depth) +static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *ps, int depth) { - if (usr == NULL) return; + if (usr == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_user_info"); depth++; @@ -4523,17 +4888,19 @@ static void sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *p sam_io_logon_hrs("logon_hrs", &(usr->logon_hrs) , ps, depth); prs_align(ps); } + + return True; } /******************************************************************* makes a SAMR_R_QUERY_USERINFO structure. ********************************************************************/ -void make_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO *r_u, +BOOL make_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO *r_u, uint16 switch_value, void *info, uint32 status) { - if (r_u == NULL || info == NULL) return; + if (r_u == NULL || info == NULL) return False; DEBUG(5,("make_samr_r_query_userinfo\n")); @@ -4595,14 +4962,16 @@ void make_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO *r_u, } r_u->status = status; /* return status */ + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_query_userinfo"); depth++; @@ -4626,7 +4995,7 @@ void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc else { DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); - return; + return False; } break; } @@ -4640,7 +5009,7 @@ void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc else { DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); - return; + return False; } break; } @@ -4654,7 +5023,7 @@ void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc else { DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); - return; + return False; } break; } @@ -4667,7 +5036,7 @@ void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc else { DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); - return; + return False; } break; } @@ -4680,7 +5049,7 @@ void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc else { DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); - return; + return False; } break; } @@ -4694,16 +5063,18 @@ void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc } prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_SET_USERINFO structure. ********************************************************************/ -void make_samr_q_set_userinfo(SAMR_Q_SET_USERINFO *q_u, +BOOL make_samr_q_set_userinfo(SAMR_Q_SET_USERINFO *q_u, POLICY_HND *hnd, uint16 switch_value, void *info) { - if (q_u == NULL || hnd == NULL) return; + if (q_u == NULL || hnd == NULL) return False; DEBUG(5,("make_samr_q_set_userinfo\n")); @@ -4733,15 +5104,17 @@ void make_samr_q_set_userinfo(SAMR_Q_SET_USERINFO *q_u, break; } } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_set_userinfo"); depth++; @@ -4768,7 +5141,7 @@ void samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO *q_u, prs_struct *ps if (q_u->info.id == NULL) { DEBUG(2,("samr_io_q_query_userinfo: info pointer not initialised\n")); - return; + return False; } sam_io_user_info24("", q_u->info.id24, ps, depth); break; @@ -4779,7 +5152,7 @@ void samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO *q_u, prs_struct *ps if (q_u->info.id == NULL) { DEBUG(2,("samr_io_q_query_userinfo: info pointer not initialised\n")); - return; + return False; } sam_io_user_info23("", q_u->info.id23, ps, depth); break; @@ -4792,27 +5165,31 @@ void samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO *q_u, prs_struct *ps } prs_align(ps); + + return True; } /******************************************************************* makes a SAMR_R_SET_USERINFO structure. ********************************************************************/ -void make_samr_r_set_userinfo(SAMR_R_SET_USERINFO *r_u, uint32 status) +BOOL make_samr_r_set_userinfo(SAMR_R_SET_USERINFO *r_u, uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_samr_r_set_userinfo\n")); r_u->status = status; /* return status */ + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_set_userinfo(char *desc, SAMR_R_SET_USERINFO *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_set_userinfo(char *desc, SAMR_R_SET_USERINFO *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_set_userinfo"); depth++; @@ -4820,17 +5197,19 @@ void samr_io_r_set_userinfo(char *desc, SAMR_R_SET_USERINFO *r_u, prs_struct *p prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_CONNECT structure. ********************************************************************/ -void make_samr_q_connect(SAMR_Q_CONNECT *q_u, +BOOL make_samr_q_connect(SAMR_Q_CONNECT *q_u, char *srv_name, uint32 unknown_0) { int len_srv_name = strlen(srv_name); - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("make_samr_q_connect\n")); @@ -4840,15 +5219,17 @@ void make_samr_q_connect(SAMR_Q_CONNECT *q_u, /* example values: 0x0000 0002 */ q_u->unknown_0 = unknown_0; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_connect(char *desc, SAMR_Q_CONNECT *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_connect(char *desc, SAMR_Q_CONNECT *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_connect"); depth++; @@ -4861,14 +5242,16 @@ void samr_io_q_connect(char *desc, SAMR_Q_CONNECT *q_u, prs_struct *ps, int dep prs_align(ps); prs_uint32("unknown_0 ", ps, depth, &(q_u->unknown_0 )); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_connect(char *desc, SAMR_R_CONNECT *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_connect(char *desc, SAMR_R_CONNECT *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_connect"); depth++; @@ -4879,14 +5262,16 @@ void samr_io_r_connect(char *desc, SAMR_R_CONNECT *r_u, prs_struct *ps, int dep prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_CONNECT_ANON structure. ********************************************************************/ -void make_samr_q_connect_anon(SAMR_Q_CONNECT_ANON *q_u) +BOOL make_samr_q_connect_anon(SAMR_Q_CONNECT_ANON *q_u) { - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("make_samr_q_connect_anon\n")); @@ -4894,15 +5279,17 @@ void make_samr_q_connect_anon(SAMR_Q_CONNECT_ANON *q_u) q_u->unknown_0 = 0x5c; /* server name (?!!) */ q_u->unknown_1 = 0x01; q_u->unknown_2 = 0x20; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_connect_anon(char *desc, SAMR_Q_CONNECT_ANON *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_connect_anon(char *desc, SAMR_Q_CONNECT_ANON *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_connect_anon"); depth++; @@ -4913,14 +5300,16 @@ void samr_io_q_connect_anon(char *desc, SAMR_Q_CONNECT_ANON *q_u, prs_struct *p prs_uint16("unknown_0", ps, depth, &(q_u->unknown_0)); prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1)); prs_uint32("unknown_2", ps, depth, &(q_u->unknown_2)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_connect_anon(char *desc, SAMR_R_CONNECT_ANON *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_connect_anon(char *desc, SAMR_R_CONNECT_ANON *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_connect_anon"); depth++; @@ -4931,16 +5320,18 @@ void samr_io_r_connect_anon(char *desc, SAMR_R_CONNECT_ANON *r_u, prs_struct *p prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* makes a SAMR_Q_UNKNOWN_38 structure. ********************************************************************/ -void make_samr_q_unknown_38(SAMR_Q_UNKNOWN_38 *q_u, char *srv_name) +BOOL make_samr_q_unknown_38(SAMR_Q_UNKNOWN_38 *q_u, char *srv_name) { int len_srv_name = strlen(srv_name); - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("make_samr_q_unknown_38\n")); @@ -4948,14 +5339,16 @@ void make_samr_q_unknown_38(SAMR_Q_UNKNOWN_38 *q_u, char *srv_name) make_uni_hdr(&(q_u->hdr_srv_name), len_srv_name); make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_unknown_38(char *desc, SAMR_Q_UNKNOWN_38 *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_unknown_38(char *desc, SAMR_Q_UNKNOWN_38 *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_unknown_38"); depth++; @@ -4968,14 +5361,16 @@ void samr_io_q_unknown_38(char *desc, SAMR_Q_UNKNOWN_38 *q_u, prs_struct *ps, i smb_io_unihdr ("", &(q_u->hdr_srv_name), ps, depth); smb_io_unistr2("", &(q_u->uni_srv_name), q_u->hdr_srv_name.buffer, ps, depth); } + + return True; } /******************************************************************* makes a SAMR_R_UNKNOWN_38 structure. ********************************************************************/ -void make_samr_r_unknown_38(SAMR_R_UNKNOWN_38 *r_u) +BOOL make_samr_r_unknown_38(SAMR_R_UNKNOWN_38 *r_u) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_r_unknown_38\n")); @@ -4983,14 +5378,16 @@ void make_samr_r_unknown_38(SAMR_R_UNKNOWN_38 *r_u) r_u->unk_1 = 0; r_u->unk_2 = 0; r_u->unk_3 = 0; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_unknown_38(char *desc, SAMR_R_UNKNOWN_38 *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_unknown_38(char *desc, SAMR_R_UNKNOWN_38 *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_unknown_38"); depth++; @@ -5005,25 +5402,29 @@ void samr_io_r_unknown_38(char *desc, SAMR_R_UNKNOWN_38 *r_u, prs_struct *ps, i prs_align(ps); prs_uint16("unk_3", ps, depth, &(r_u->unk_3)); prs_align(ps); + + return True; } /******************************************************************* make a SAMR_ENC_PASSWD structure. ********************************************************************/ -void make_enc_passwd(SAMR_ENC_PASSWD *pwd, char pass[512]) +BOOL make_enc_passwd(SAMR_ENC_PASSWD *pwd, char pass[512]) { - if (pwd == NULL) return; + if (pwd == NULL) return False; pwd->ptr = 1; memcpy(pwd->pass, pass, sizeof(pwd->pass)); + + return True; } /******************************************************************* reads or writes a SAMR_ENC_PASSWD structure. ********************************************************************/ -void samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD *pwd, prs_struct *ps, int depth) +BOOL samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD *pwd, prs_struct *ps, int depth) { - if (pwd == NULL) return; + if (pwd == NULL) return False; prs_debug(ps, depth, desc, "samr_io_enc_passwd"); depth++; @@ -5032,25 +5433,29 @@ void samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD *pwd, prs_struct *ps, int de prs_uint32("ptr", ps, depth, &(pwd->ptr)); prs_uint8s(False, "pwd", ps, depth, pwd->pass, sizeof(pwd->pass)); + + return True; } /******************************************************************* makes a SAMR_ENC_HASH structure. ********************************************************************/ -void make_enc_hash(SAMR_ENC_HASH *hsh, uchar hash[16]) +BOOL make_enc_hash(SAMR_ENC_HASH *hsh, uchar hash[16]) { - if (hsh == NULL) return; + if (hsh == NULL) return False; hsh->ptr = 1; memcpy(hsh->hash, hash, sizeof(hsh->hash)); + + return True; } /******************************************************************* reads or writes a SAMR_ENC_HASH structure. ********************************************************************/ -void samr_io_enc_hash(char *desc, SAMR_ENC_HASH *hsh, prs_struct *ps, int depth) +BOOL samr_io_enc_hash(char *desc, SAMR_ENC_HASH *hsh, prs_struct *ps, int depth) { - if (hsh == NULL) return; + if (hsh == NULL) return False; prs_debug(ps, depth, desc, "samr_io_enc_hash"); depth++; @@ -5059,12 +5464,14 @@ void samr_io_enc_hash(char *desc, SAMR_ENC_HASH *hsh, prs_struct *ps, int depth) prs_uint32("ptr ", ps, depth, &(hsh->ptr)); prs_uint8s(False, "hash", ps, depth, hsh->hash, sizeof(hsh->hash)); + + return True; } /******************************************************************* makes a SAMR_R_UNKNOWN_38 structure. ********************************************************************/ -void make_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, +BOOL make_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, char *dest_host, char *user_name, char nt_newpass[516], uchar nt_oldhash[16], char lm_newpass[516], uchar lm_oldhash[16]) @@ -5072,7 +5479,7 @@ void make_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, int len_dest_host = strlen(dest_host); int len_user_name = strlen(user_name); - if (q_u == NULL) return; + if (q_u == NULL) return False; DEBUG(5,("make_samr_q_chgpasswd_user\n")); @@ -5089,14 +5496,16 @@ void make_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, make_enc_passwd(&(q_u->lm_newpass), lm_newpass); make_enc_hash (&(q_u->lm_oldhash), lm_oldhash); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user"); depth++; @@ -5122,26 +5531,30 @@ void samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER *q_u, prs_struct samr_io_enc_passwd("lm_newpass", &(q_u->lm_newpass), ps, depth); prs_grow(ps); samr_io_enc_hash ("lm_oldhash", &(q_u->lm_oldhash), ps, depth); + + return True; } /******************************************************************* makes a SAMR_R_CHGPASSWD_USER structure. ********************************************************************/ -void make_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER *r_u, uint32 status) +BOOL make_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER *r_u, uint32 status) { - if (r_u == NULL) return; + if (r_u == NULL) return False; DEBUG(5,("make_r_chgpasswd_user\n")); r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user"); depth++; @@ -5149,6 +5562,8 @@ void samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER *r_u, prs_struct prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 2840070edc..c7d4d09612 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -2,10 +2,10 @@ * Unix SMB/Netbios implementation. * Version 1.9. * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1998, - * Copyright (C) Jeremy R. Allison 1995-1998 - * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, - * Copyright (C) Paul Ashton 1997-1998. + * Copyright (C) Andrew Tridgell 1992-1999, + * Copyright (C) Jeremy R. Allison 1995-1999 + * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, + * Copyright (C) Paul Ashton 1997-1999. * * 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 @@ -31,17 +31,19 @@ extern int DEBUGLEVEL; /******************************************************************* makes a structure. ********************************************************************/ -void make_sec_access(SEC_ACCESS *t, uint32 mask) +BOOL make_sec_access(SEC_ACCESS *t, uint32 mask) { t->mask = mask; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) - { - if (t == NULL) return; +BOOL sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) +{ + if (t == NULL) return False; prs_debug(ps, depth, desc, "sec_io_access"); depth++; @@ -49,13 +51,15 @@ void sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) prs_align(ps); prs_uint32("mask", ps, depth, &(t->mask)); + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 flag) +BOOL make_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 flag) { t->type = type; t->flags = flag; @@ -63,16 +67,18 @@ void make_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 f t->info = mask; sid_copy(&t->sid, sid); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void sec_io_ace(char *desc, SEC_ACE *t, prs_struct *ps, int depth) +BOOL sec_io_ace(char *desc, SEC_ACE *t, prs_struct *ps, int depth) { uint32 old_offset; uint32 offset_ace_size; - if (t == NULL) return; + if (t == NULL) return False; prs_debug(ps, depth, desc, "sec_io_ace"); depth++; @@ -90,12 +96,14 @@ void sec_io_ace(char *desc, SEC_ACE *t, prs_struct *ps, int depth) smb_io_dom_sid("sid ", &t->sid , ps, depth); prs_uint16_post("size ", ps, depth, &t->size, offset_ace_size, old_offset); + + return True; } /******************************************************************* makes a structure. ********************************************************************/ -void make_sec_acl(SEC_ACL *t, uint16 revision, int num_aces, SEC_ACE *ace) +BOOL make_sec_acl(SEC_ACL *t, uint16 revision, int num_aces, SEC_ACE *ace) { int i; t->revision = revision; @@ -107,6 +115,8 @@ void make_sec_acl(SEC_ACL *t, uint16 revision, int num_aces, SEC_ACE *ace) { t->size += ace[i].size; } + + return True; } /******************************************************************* @@ -126,13 +136,13 @@ reads or writes a structure. first of the xx_io_xx functions that allocates its data structures for you as it reads them. ********************************************************************/ -void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) +BOOL sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) { int i; uint32 old_offset; uint32 offset_acl_size; - if (t == NULL) return; + if (t == NULL) return False; prs_debug(ps, depth, desc, "sec_io_acl"); depth++; @@ -156,7 +166,7 @@ void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) { DEBUG(0,("INVALID ACL\n")); ps->offset = 0xfffffffe; - return; + return False; } for (i = 0; i < MIN(t->num_aces, MAX_SEC_ACES); i++) @@ -169,6 +179,8 @@ void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) prs_align(ps); prs_uint16_post("size ", ps, depth, &t->size , offset_acl_size, old_offset); + + return True; } @@ -253,7 +265,8 @@ void free_sec_desc(SEC_DESC *t) if (t->sacl != NULL) { free_sec_acl(t->dacl); -} + + } if (t->owner_sid != NULL) { @@ -261,7 +274,7 @@ void free_sec_desc(SEC_DESC *t) } if (t->grp_sid != NULL) -{ + { free(t->grp_sid); } } @@ -270,7 +283,7 @@ void free_sec_desc(SEC_DESC *t) /******************************************************************* reads or writes a structure. ********************************************************************/ -static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) +static BOOL sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { #if 0 uint32 off_owner_sid; @@ -281,7 +294,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) uint32 old_offset; uint32 max_offset = 0; /* after we're done, move offset to end */ - if (t == NULL) return; + if (t == NULL) return False; prs_debug(ps, depth, desc, "sec_io_desc"); depth++; @@ -317,13 +330,13 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) /* reading */ t->dacl = malloc(sizeof(*t->dacl)); ZERO_STRUCTP(t->dacl); - } + } if (t->dacl == NULL) { DEBUG(0,("INVALID DACL\n")); ps->offset = 0xfffffffe; - return; + return False; } sec_io_acl ("dacl" , t->dacl , ps, depth); @@ -355,7 +368,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { DEBUG(0,("INVALID SACL\n")); ps->offset = 0xfffffffe; - return; + return False; } sec_io_acl ("sacl" , t->sacl , ps, depth); @@ -390,7 +403,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) { DEBUG(0,("INVALID OWNER SID\n")); ps->offset = 0xfffffffe; - return; + return False; } smb_io_dom_sid("owner_sid ", t->owner_sid , ps, depth); @@ -407,20 +420,21 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) if (ps->io) { ps->offset = old_offset + t->off_grp_sid; -} + + } if (ps->io) -{ + { /* reading */ t->grp_sid = malloc(sizeof(*t->grp_sid)); ZERO_STRUCTP(t->grp_sid); } if (t->grp_sid == NULL) - { + { DEBUG(0,("INVALID GROUP SID\n")); ps->offset = 0xfffffffe; - return; - } + return False; + } smb_io_dom_sid("grp_sid", t->grp_sid, ps, depth); prs_align(ps); @@ -429,13 +443,15 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) max_offset = MAX(max_offset, ps->offset); ps->offset = max_offset; + + return True; } /******************************************************************* creates a SEC_DESC_BUF structure. ********************************************************************/ -void make_sec_desc_buf(SEC_DESC_BUF *buf, int len, SEC_DESC *data) - { +BOOL make_sec_desc_buf(SEC_DESC_BUF *buf, int len, SEC_DESC *data) +{ ZERO_STRUCTP(buf); /* max buffer size (allocated size) */ @@ -443,6 +459,8 @@ void make_sec_desc_buf(SEC_DESC_BUF *buf, int len, SEC_DESC *data) buf->undoc = 0; buf->len = data != NULL ? len : 0; buf->sec = data; + + return True; } /******************************************************************* @@ -461,14 +479,14 @@ void free_sec_desc_buf(SEC_DESC_BUF *buf) /******************************************************************* reads or writes a SEC_DESC_BUF structure. ********************************************************************/ -void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) +BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) { uint32 off_len; uint32 off_max_len; uint32 old_offset; uint32 size; - if (sec == NULL) return; + if (sec == NULL) return False; prs_debug(ps, depth, desc, "sec_io_desc_buf"); depth++; @@ -491,7 +509,7 @@ void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) { DEBUG(0,("INVALID SEC_DESC\n")); ps->offset = 0xfffffffe; - return; + return False; } } @@ -504,5 +522,7 @@ void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) size = ps->offset - old_offset; prs_uint32_post("max_len", ps, depth, &(sec->max_len), off_max_len, size == 0 ? sec->max_len : size); prs_uint32_post("len ", ps, depth, &(sec->len ), off_len , size); + + return True; } diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index c66d176c78..c11c1ed43c 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -45,7 +45,7 @@ static uint32 str_len_uni(UNISTR *source) /******************************************************************* This should be moved in a more generic lib. ********************************************************************/ -static void spoolss_io_system_time(char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) +static BOOL spoolss_io_system_time(char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) { prs_uint16("year", ps, depth, &(systime->year)); prs_uint16("month", ps, depth, &(systime->month)); @@ -55,11 +55,13 @@ static void spoolss_io_system_time(char *desc, prs_struct *ps, int depth, SYSTEM prs_uint16("minute", ps, depth, &(systime->minute)); prs_uint16("second", ps, depth, &(systime->second)); prs_uint16("milliseconds", ps, depth, &(systime->milliseconds)); + + return True; } /******************************************************************* ********************************************************************/ -void make_systemtime(SYSTEMTIME *systime, struct tm *unixtime) +BOOL make_systemtime(SYSTEMTIME *systime, struct tm *unixtime) { systime->year=unixtime->tm_year+1900; systime->month=unixtime->tm_mon+1; @@ -69,14 +71,16 @@ void make_systemtime(SYSTEMTIME *systime, struct tm *unixtime) systime->minute=unixtime->tm_min; systime->second=unixtime->tm_sec; systime->milliseconds=0; + + return True; } /******************************************************************* reads or writes an PRINTER_HND structure. ********************************************************************/ -static void smb_io_prt_hnd(char *desc, PRINTER_HND *hnd, prs_struct *ps, int depth) +static BOOL smb_io_prt_hnd(char *desc, PRINTER_HND *hnd, prs_struct *ps, int depth) { - if (hnd == NULL) return; + if (hnd == NULL) return False; prs_debug(ps, depth, desc, "smb_io_prt_hnd"); depth++; @@ -84,14 +88,16 @@ static void smb_io_prt_hnd(char *desc, PRINTER_HND *hnd, prs_struct *ps, int dep prs_align(ps); prs_uint8s (False, "data", ps, depth, hnd->data, PRINTER_HND_SIZE); + + return True; } /******************************************************************* reads or writes an DOC_INFO structure. ********************************************************************/ -static void smb_io_doc_info_1(char *desc, DOC_INFO_1 *info_1, prs_struct *ps, int depth) +static BOOL smb_io_doc_info_1(char *desc, DOC_INFO_1 *info_1, prs_struct *ps, int depth) { - if (info_1 == NULL) return; + if (info_1 == NULL) return False; prs_debug(ps, depth, desc, "smb_io_doc_info_1"); depth++; @@ -105,16 +111,18 @@ static void smb_io_doc_info_1(char *desc, DOC_INFO_1 *info_1, prs_struct *ps, in smb_io_unistr2("", &(info_1->docname), info_1->p_docname, ps, depth); smb_io_unistr2("", &(info_1->outputfile), info_1->p_outputfile, ps, depth); smb_io_unistr2("", &(info_1->datatype), info_1->p_datatype, ps, depth); + + return True; } /******************************************************************* reads or writes an DOC_INFO structure. ********************************************************************/ -static void smb_io_doc_info(char *desc, DOC_INFO *info, prs_struct *ps, int depth) +static BOOL smb_io_doc_info(char *desc, DOC_INFO *info, prs_struct *ps, int depth) { uint32 useless_ptr=0; - if (info == NULL) return; + if (info == NULL) return False; prs_debug(ps, depth, desc, "smb_io_doc_info"); depth++; @@ -147,14 +155,16 @@ static void smb_io_doc_info(char *desc, DOC_INFO *info, prs_struct *ps, int dept DEBUG(0,("Something is obviously wrong somewhere !\n")); break; } + + return True; } /******************************************************************* reads or writes an DOC_INFO_CONTAINER structure. ********************************************************************/ -static void smb_io_doc_info_container(char *desc, DOC_INFO_CONTAINER *cont, prs_struct *ps, int depth) +static BOOL smb_io_doc_info_container(char *desc, DOC_INFO_CONTAINER *cont, prs_struct *ps, int depth) { - if (cont == NULL) return; + if (cont == NULL) return False; prs_debug(ps, depth, desc, "smb_io_doc_info_container"); depth++; @@ -164,12 +174,14 @@ static void smb_io_doc_info_container(char *desc, DOC_INFO_CONTAINER *cont, prs_ prs_uint32("level", ps, depth, &(cont->level)); smb_io_doc_info("",&(cont->docinfo), ps, depth); + + return True; } /******************************************************************* reads or writes an NOTIFY OPTION TYPE structure. ********************************************************************/ -static void smb_io_notify_option_type(char *desc, +static BOOL smb_io_notify_option_type(char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) { @@ -187,12 +199,14 @@ static void smb_io_notify_option_type(char *desc, prs_uint32("count", ps, depth, &(type->count)); prs_uint32("useless ptr", ps, depth, &useless_ptr); + + return True; } /******************************************************************* reads or writes an NOTIFY OPTION TYPE DATA. ********************************************************************/ -static void smb_io_notify_option_type_data(char *desc, +static BOOL smb_io_notify_option_type_data(char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) { @@ -216,12 +230,14 @@ static void smb_io_notify_option_type_data(char *desc, /* read the option type struct */ prs_uint16("fields",ps,depth,&(type->fields[i])); } + + return True; } /******************************************************************* reads or writes an NOTIFY OPTION structure. ********************************************************************/ -static void smb_io_notify_option(char *desc, SPOOL_NOTIFY_OPTION *option, +static BOOL smb_io_notify_option(char *desc, SPOOL_NOTIFY_OPTION *option, prs_struct *ps, int depth) { uint32 useless_ptr; @@ -253,13 +269,15 @@ static void smb_io_notify_option(char *desc, SPOOL_NOTIFY_OPTION *option, smb_io_notify_option_type_data("",&(option->type[i]) ,ps, depth); } + + return True; } /******************************************************************* reads or writes an NOTIFY INFO DATA structure. ********************************************************************/ -static void smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, +static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) { uint32 useless_ptr=0xADDE0FF0; @@ -304,12 +322,14 @@ static void smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_uint32("pointer", ps, depth, &useless_ptr); /*prs_align(ps);*/ } + + return True; } /******************************************************************* reads or writes an NOTIFY INFO DATA structure. ********************************************************************/ -void smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, +BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) { uint32 x; @@ -329,12 +349,14 @@ void smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_uint16s(True,"string",ps,depth,data->notify_data.data.string,x); } prs_align(ps); + + return True; } /******************************************************************* reads or writes an NOTIFY INFO structure. ********************************************************************/ -static void smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, +static BOOL smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, prs_struct *ps, int depth) { uint32 useless_ptr=0x0001; @@ -365,15 +387,17 @@ static void smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, smb_io_notify_info_data_strings(desc, &(info->data[i]), ps, depth); } + + return True; } /******************************************************************* * write a structure. * called from spoolss_r_open_printer (srv_spoolss.c) ********************************************************************/ -void spoolss_io_r_open_printer(char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_open_printer(char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "spoolss_io_r_open_printer"); depth++; @@ -385,15 +409,17 @@ void spoolss_io_r_open_printer(char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct prs_uint32("status code", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* * read a structure. * called from spoolss_q_open_printer (srv_spoolss.c) ********************************************************************/ -void spoolss_io_q_open_printer(char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_open_printer(char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "spoolss_io_q_open_printer"); depth++; @@ -427,15 +453,17 @@ void spoolss_io_q_open_printer(char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct smb_io_unistr2("", &(q_u->station),True,ps,depth); prs_align(ps); smb_io_unistr2("", &(q_u->username),True,ps,depth); + + return True; } /******************************************************************* * read a structure. * called from spoolss_q_getprinterdata (srv_spoolss.c) ********************************************************************/ -void spoolss_io_q_getprinterdata(char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getprinterdata(char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdata"); depth++; @@ -446,15 +474,17 @@ void spoolss_io_q_getprinterdata(char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_st smb_io_unistr2("", &(q_u->valuename),True,ps,depth); prs_align(ps); prs_uint32("size", ps, depth, &(q_u->size)); + + return True; } /******************************************************************* * write a structure. * called from spoolss_r_getprinterdata (srv_spoolss.c) ********************************************************************/ -void spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdata"); depth++; @@ -472,15 +502,17 @@ void spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_st prs_uint32("needed", ps, depth, &(r_u->needed)); prs_uint32("status", ps, depth, &(r_u->status)); prs_align(ps); + + return True; } /******************************************************************* * read a structure. * called from spoolss_q_closeprinter (srv_spoolss.c) ********************************************************************/ -void spoolss_io_q_closeprinter(char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_closeprinter(char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "spoolss_io_q_closeprinter"); depth++; @@ -488,13 +520,15 @@ void spoolss_io_q_closeprinter(char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct prs_align(ps); smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + + return True; } /******************************************************************* * write a structure. * called from spoolss_r_closeprinter (srv_spoolss.c) ********************************************************************/ -void spoolss_io_r_closeprinter(char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_closeprinter(char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_closeprinter"); depth++; @@ -503,15 +537,17 @@ void spoolss_io_r_closeprinter(char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct smb_io_prt_hnd("printer handle",&(r_u->handle),ps,depth); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* * read a structure. * called from spoolss_q_startdocprinter (srv_spoolss.c) ********************************************************************/ -void spoolss_io_q_startdocprinter(char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_startdocprinter(char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "spoolss_io_q_startdocprinter"); depth++; @@ -521,27 +557,31 @@ void spoolss_io_q_startdocprinter(char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_ smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); smb_io_doc_info_container("",&(q_u->doc_info_container), ps, depth); + + return True; } /******************************************************************* * write a structure. * called from spoolss_r_startdocprinter (srv_spoolss.c) ********************************************************************/ -void spoolss_io_r_startdocprinter(char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_startdocprinter(char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_startdocprinter"); depth++; prs_uint32("jobid", ps, depth, &(r_u->jobid)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* * read a structure. * called from spoolss_q_enddocprinter (srv_spoolss.c) ********************************************************************/ -void spoolss_io_q_enddocprinter(char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enddocprinter(char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "spoolss_io_q_enddocprinter"); depth++; @@ -549,26 +589,30 @@ void spoolss_io_q_enddocprinter(char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_stru prs_align(ps); smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + + return True; } /******************************************************************* * write a structure. * called from spoolss_r_enddocprinter (srv_spoolss.c) ********************************************************************/ -void spoolss_io_r_enddocprinter(char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enddocprinter(char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enddocprinter"); depth++; prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* * read a structure. * called from spoolss_q_startpageprinter (srv_spoolss.c) ********************************************************************/ -void spoolss_io_q_startpageprinter(char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_startpageprinter(char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "spoolss_io_q_startpageprinter"); depth++; @@ -576,26 +620,30 @@ void spoolss_io_q_startpageprinter(char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, pr prs_align(ps); smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + + return True; } /******************************************************************* * write a structure. * called from spoolss_r_startpageprinter (srv_spoolss.c) ********************************************************************/ -void spoolss_io_r_startpageprinter(char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_startpageprinter(char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_startpageprinter"); depth++; prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* * read a structure. * called from spoolss_q_endpageprinter (srv_spoolss.c) ********************************************************************/ -void spoolss_io_q_endpageprinter(char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_endpageprinter(char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "spoolss_io_q_endpageprinter"); depth++; @@ -603,26 +651,30 @@ void spoolss_io_q_endpageprinter(char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_st prs_align(ps); smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + + return True; } /******************************************************************* * write a structure. * called from spoolss_r_endpageprinter (srv_spoolss.c) ********************************************************************/ -void spoolss_io_r_endpageprinter(char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_endpageprinter(char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_endpageprinter"); depth++; prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* * read a structure. * called from spoolss_q_writeprinter (srv_spoolss.c) ********************************************************************/ -void spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "spoolss_io_q_writeprinter"); depth++; @@ -639,25 +691,29 @@ void spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct } prs_align(ps); prs_uint32("buffer_size2", ps, depth, &(q_u->buffer_size2)); + + return True; } /******************************************************************* * write a structure. * called from spoolss_r_writeprinter (srv_spoolss.c) ********************************************************************/ -void spoolss_io_r_writeprinter(char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_writeprinter(char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_writeprinter"); depth++; prs_uint32("buffer_written", ps, depth, &(r_u->buffer_written)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* * read a structure. * called from spoolss_q_rffpcnex (srv_spoolss.c) ********************************************************************/ -void spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, +BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, int depth) { uint32 useless_ptr; @@ -679,26 +735,30 @@ void spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, smb_io_notify_option("notify option", &(q_u->option), ps, depth); + + return True; } /******************************************************************* * write a structure. * called from spoolss_r_rffpcnex (srv_spoolss.c) ********************************************************************/ -void spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, +BOOL spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_rffpcnex"); depth++; prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* * read a structure. * called from spoolss_q_rfnpcnex (srv_spoolss.c) ********************************************************************/ -void spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, +BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, int depth) { @@ -712,13 +772,15 @@ void spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_uint32("change", ps, depth, &(q_u->change)); smb_io_notify_option("notify option",&(q_u->option),ps,depth); + + return True; } /******************************************************************* * write a structure. * called from spoolss_r_rfnpcnex (srv_spoolss.c) ********************************************************************/ -void spoolss_io_r_rfnpcnex(char *desc, +BOOL spoolss_io_r_rfnpcnex(char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, int depth) { @@ -732,6 +794,8 @@ void spoolss_io_r_rfnpcnex(char *desc, smb_io_notify_info("notify info",&(r_u->info),ps,depth); prs_align(ps); prs_uint32("status", ps, depth, &(x)); + + return True; } /******************************************************************* @@ -740,6 +804,8 @@ void spoolss_io_r_rfnpcnex(char *desc, static uint32 size_of_uint32(uint32 *value) { return (sizeof(*value)); + + return True; } /******************************************************************* @@ -756,6 +822,8 @@ static uint32 size_of_relative_string(UNISTR *string) size=size*2; /* convert in char */ size=size+4; /* add the size of the ptr */ return (size); + + return True; } /******************************************************************* @@ -767,6 +835,8 @@ static uint32 size_of_device_mode(DEVICEMODE *devmode) return (4); else return (0xDC+4); + + return True; } /******************************************************************* @@ -778,19 +848,23 @@ static uint32 size_of_systemtime(SYSTEMTIME *systime) return (4); else return (sizeof(SYSTEMTIME) +4); + + return True; } /******************************************************************* * write a UNICODE string. * used by all the RPC structs passing a buffer ********************************************************************/ -static void spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) +static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) { - if (uni == NULL) return; + if (uni == NULL) return False; prs_debug(ps, depth, desc, "spoolss_smb_io_unistr"); depth++; prs_unistr("unistr", ps, depth, uni); + + return True; } @@ -798,7 +872,7 @@ static void spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int * write a UNICODE string and its relative pointer. * used by all the RPC structs passing a buffer ********************************************************************/ -static void smb_io_relstr(char *desc, prs_struct *ps, int depth, UNISTR *buffer, +static BOOL smb_io_relstr(char *desc, prs_struct *ps, int depth, UNISTR *buffer, uint32 *start_offset, uint32 *end_offset) { uint32 struct_offset; @@ -813,6 +887,8 @@ static void smb_io_relstr(char *desc, prs_struct *ps, int depth, UNISTR *buffer, relative_offset=*end_offset-*start_offset; prs_uint32("offset", ps, depth, &(relative_offset)); + + return True; } @@ -820,7 +896,7 @@ static void smb_io_relstr(char *desc, prs_struct *ps, int depth, UNISTR *buffer, * write a array UNICODE strings and its relative pointer. * used by 2 RPC structs ********************************************************************/ -static void smb_io_relarraystr(char *desc, prs_struct *ps, int depth, UNISTR ***buffer, +static BOOL smb_io_relarraystr(char *desc, prs_struct *ps, int depth, UNISTR ***buffer, uint32 *start_offset, uint32 *end_offset) { int i=0; @@ -852,13 +928,15 @@ static void smb_io_relarraystr(char *desc, prs_struct *ps, int depth, UNISTR *** relative_offset=*end_offset-*start_offset; prs_uint32("offset", ps, depth, &(relative_offset)); + + return True; } /******************************************************************* * write a DEVICEMODE struct. * on reading allocate memory for the private member ********************************************************************/ -static void smb_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) +static BOOL smb_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) { prs_debug(ps, depth, desc, "smb_io_devmode"); depth++; @@ -910,13 +988,15 @@ static void smb_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *de prs_uint8s(True, "private", ps, depth, devmode->private, devmode->driverextra); DEBUG(8,("smb_io_devmode: parsed\n")); } + + return True; } /******************************************************************* * write a DEVMODE struct and its relative pointer. * used by all the RPC structs passing a buffer ********************************************************************/ -static void smb_io_reldevmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode, +static BOOL smb_io_reldevmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode, uint32 *start_offset, uint32 *end_offset) { uint32 struct_offset; @@ -935,11 +1015,13 @@ static void smb_io_reldevmode(char *desc, prs_struct *ps, int depth, DEVICEMODE relative_offset=*end_offset-*start_offset; prs_uint32("offset", ps, depth, &(relative_offset)); + + return True; } /******************************************************************* ********************************************************************/ -static void smb_io_printer_info_0(char *desc, PRINTER_INFO_0 *info, prs_struct *ps, int depth, +static BOOL smb_io_printer_info_0(char *desc, PRINTER_INFO_0 *info, prs_struct *ps, int depth, uint32 *start_offset, uint32 *end_offset) { prs_debug(ps, depth, desc, "smb_io_printer_info_0"); @@ -977,11 +1059,13 @@ static void smb_io_printer_info_0(char *desc, PRINTER_INFO_0 *info, prs_struct * prs_uint32("unknown21", ps, depth, &(info->unknown21)); prs_uint16("unknown22", ps, depth, &(info->unknown22)); prs_uint32("unknown23", ps, depth, &(info->unknown23)); + + return True; } /******************************************************************* ********************************************************************/ -static void smb_io_printer_info_1(char *desc, PRINTER_INFO_1 *info, prs_struct *ps, int depth, +static BOOL smb_io_printer_info_1(char *desc, PRINTER_INFO_1 *info, prs_struct *ps, int depth, uint32 *start_offset, uint32 *end_offset) { prs_debug(ps, depth, desc, "smb_io_printer_info_1"); @@ -992,11 +1076,13 @@ static void smb_io_printer_info_1(char *desc, PRINTER_INFO_1 *info, prs_struct * smb_io_relstr("description",ps, depth, &(info->description), start_offset, end_offset); smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); smb_io_relstr("comment",ps, depth, &(info->comment), start_offset, end_offset); + + return True; } /******************************************************************* ********************************************************************/ -static void smb_io_printer_info_2(char *desc, PRINTER_INFO_2 *info, prs_struct *ps, int depth, +static BOOL smb_io_printer_info_2(char *desc, PRINTER_INFO_2 *info, prs_struct *ps, int depth, uint32 *start_offset, uint32 *end_offset) { uint32 pipo=0; @@ -1042,11 +1128,13 @@ static void smb_io_printer_info_2(char *desc, PRINTER_INFO_2 *info, prs_struct * ps->offset=devmode_offset; smb_io_reldevmode("devmode", ps, depth, info->devmode, start_offset, end_offset); ps->offset=backup_offset; + + return True; } /******************************************************************* ********************************************************************/ -static void smb_io_printer_driver_info_1(char *desc, DRIVER_INFO_1 *info, prs_struct *ps, int depth, +static BOOL smb_io_printer_driver_info_1(char *desc, DRIVER_INFO_1 *info, prs_struct *ps, int depth, uint32 *start_offset, uint32 *end_offset) { prs_debug(ps, depth, desc, "smb_io_printer_driver_info_1"); @@ -1054,11 +1142,13 @@ static void smb_io_printer_driver_info_1(char *desc, DRIVER_INFO_1 *info, prs_st *start_offset=ps->offset; smb_io_relstr("name", ps, depth, &(info->name), start_offset, end_offset); + + return True; } /******************************************************************* ********************************************************************/ -static void smb_io_printer_driver_info_2(char *desc, DRIVER_INFO_2 *info,prs_struct *ps, int depth, +static BOOL smb_io_printer_driver_info_2(char *desc, DRIVER_INFO_2 *info,prs_struct *ps, int depth, uint32 *start_offset, uint32 *end_offset) { prs_debug(ps, depth, desc, "smb_io_printer_xxx"); @@ -1071,11 +1161,13 @@ static void smb_io_printer_driver_info_2(char *desc, DRIVER_INFO_2 *info,prs_str smb_io_relstr("driverpath", ps, depth, &(info->driverpath), start_offset, end_offset); smb_io_relstr("datafile", ps, depth, &(info->datafile), start_offset, end_offset); smb_io_relstr("configfile", ps, depth, &(info->configfile), start_offset, end_offset); + + return True; } /******************************************************************* ********************************************************************/ -static void smb_io_printer_driver_info_3(char *desc, DRIVER_INFO_3 *info,prs_struct *ps, int depth, +static BOOL smb_io_printer_driver_info_3(char *desc, DRIVER_INFO_3 *info,prs_struct *ps, int depth, uint32 *start_offset, uint32 *end_offset) { prs_debug(ps, depth, desc, "smb_io_printer_driver_info_3"); @@ -1094,11 +1186,13 @@ static void smb_io_printer_driver_info_3(char *desc, DRIVER_INFO_3 *info,prs_str smb_io_relstr("monitorname", ps, depth, &(info->monitorname), start_offset, end_offset); smb_io_relstr("defaultdatatype", ps, depth, &(info->defaultdatatype), start_offset, end_offset); + + return True; } /******************************************************************* ********************************************************************/ -static void smb_io_job_info_1(char *desc, JOB_INFO_1 *info, prs_struct *ps, int depth, +static BOOL smb_io_job_info_1(char *desc, JOB_INFO_1 *info, prs_struct *ps, int depth, uint32 *start_offset, uint32 *end_offset) { prs_debug(ps, depth, desc, "smb_io_job_info_1"); @@ -1118,11 +1212,13 @@ static void smb_io_job_info_1(char *desc, JOB_INFO_1 *info, prs_struct *ps, int prs_uint32("totalpages", ps, depth, &(info->totalpages)); prs_uint32("pagesprinted", ps, depth, &(info->pagesprinted)); spoolss_io_system_time("submitted", ps, depth, &(info->submitted) ); + + return True; } /******************************************************************* ********************************************************************/ -static void smb_io_job_info_2(char *desc, JOB_INFO_2 *info, prs_struct *ps, int depth, +static BOOL smb_io_job_info_2(char *desc, JOB_INFO_2 *info, prs_struct *ps, int depth, uint32 *start_offset, uint32 *end_offset) { int pipo=0; @@ -1157,11 +1253,13 @@ static void smb_io_job_info_2(char *desc, JOB_INFO_2 *info, prs_struct *ps, int spoolss_io_system_time("submitted", ps, depth, &(info->submitted) ); prs_uint32("timeelapsed", ps, depth, &(info->timeelapsed)); prs_uint32("pagesprinted", ps, depth, &(info->pagesprinted)); + + return True; } /******************************************************************* ********************************************************************/ -static void smb_io_form_1(char *desc, FORM_1 *info, prs_struct *ps, int depth, +static BOOL smb_io_form_1(char *desc, FORM_1 *info, prs_struct *ps, int depth, uint32 *start_offset, uint32 *end_offset) { prs_debug(ps, depth, desc, "smb_io_form_1"); @@ -1176,11 +1274,13 @@ static void smb_io_form_1(char *desc, FORM_1 *info, prs_struct *ps, int depth, prs_uint32("top", ps, depth, &(info->top)); prs_uint32("right", ps, depth, &(info->right)); prs_uint32("bottom", ps, depth, &(info->bottom)); + + return True; } /******************************************************************* ********************************************************************/ -static void smb_io_port_2(char *desc, PORT_INFO_2 *info, prs_struct *ps, int depth, +static BOOL smb_io_port_2(char *desc, PORT_INFO_2 *info, prs_struct *ps, int depth, uint32 *start_offset, uint32 *end_offset) { prs_debug(ps, depth, desc, "smb_io_form_1"); @@ -1192,11 +1292,13 @@ static void smb_io_port_2(char *desc, PORT_INFO_2 *info, prs_struct *ps, int dep smb_io_relstr("description",ps, depth, &(info->description), start_offset, end_offset); prs_uint32("port_type", ps, depth, &(info->port_type)); prs_uint32("reserved", ps, depth, &(info->reserved)); + + return True; } /******************************************************************* ********************************************************************/ -static void smb_io_processor_info_1(char *desc, PRINTPROCESSOR_1 *info, prs_struct *ps, int depth, +static BOOL smb_io_processor_info_1(char *desc, PRINTPROCESSOR_1 *info, prs_struct *ps, int depth, uint32 *start_offset, uint32 *end_offset) { prs_debug(ps, depth, desc, "smb_io_processor_info_1"); @@ -1204,11 +1306,13 @@ static void smb_io_processor_info_1(char *desc, PRINTPROCESSOR_1 *info, prs_stru *start_offset=ps->offset; smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); + + return True; } /******************************************************************* ********************************************************************/ -static void smb_io_monitor_info_1(char *desc, PRINTMONITOR_1 *info, prs_struct *ps, int depth, +static BOOL smb_io_monitor_info_1(char *desc, PRINTMONITOR_1 *info, prs_struct *ps, int depth, uint32 *start_offset, uint32 *end_offset) { prs_debug(ps, depth, desc, "smb_io_monitor_info_1"); @@ -1216,6 +1320,8 @@ static void smb_io_monitor_info_1(char *desc, PRINTMONITOR_1 *info, prs_struct * *start_offset=ps->offset; smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); + + return True; } /******************************************************************* @@ -1229,6 +1335,8 @@ static uint32 spoolss_size_printer_info_0(PRINTER_INFO_0 *info) size+=size_of_relative_string( &(info->printername) ); size+=size_of_relative_string( &(info->servername) ); return (size); + + return True; } /******************************************************************* @@ -1243,6 +1351,8 @@ static uint32 spoolss_size_printer_info_1(PRINTER_INFO_1 *info) size+=size_of_relative_string( &(info->name) ); size+=size_of_relative_string( &(info->comment) ); return (size); + + return True; } /******************************************************************* @@ -1278,6 +1388,8 @@ static uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) size+=size_of_uint32( &(info->cjobs) ); size+=size_of_uint32( &(info->averageppm) ); return (size); + + return True; } /******************************************************************* @@ -1291,6 +1403,8 @@ static uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info) DEBUGADD(9,("size: [%d]\n", size)); return (size); + + return True; } /******************************************************************* @@ -1309,6 +1423,8 @@ static uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info) DEBUGADD(9,("size: [%d]\n", size)); return (size); + + return True; } /******************************************************************* @@ -1342,6 +1458,8 @@ static uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) DEBUGADD(9,("size: [%d]\n", size)); return (size); + + return True; } /******************************************************************* @@ -1364,6 +1482,8 @@ static uint32 spoolss_size_job_info_1(JOB_INFO_1 *info) size+=size_of_uint32( &(info->pagesprinted) ); size+=size_of_systemtime( &(info->submitted) ); return (size); + + return True; } /******************************************************************* @@ -1399,6 +1519,8 @@ static uint32 spoolss_size_job_info_2(JOB_INFO_2 *info) size+=size_of_uint32( &(info->timeelapsed) ); size+=size_of_uint32( &(info->pagesprinted) ); return (size); + + return True; } /******************************************************************* @@ -1418,6 +1540,8 @@ static uint32 spoolss_size_form_1(FORM_1 *info) size+=size_of_uint32( &(info->bottom) ); return (size); + + return True; } /******************************************************************* @@ -1435,6 +1559,8 @@ static uint32 spoolss_size_port_info_2(PORT_INFO_2 *info) size+=size_of_uint32( &(info->reserved) ); return (size); + + return True; } /******************************************************************* @@ -1446,6 +1572,8 @@ static uint32 spoolss_size_processor_info_1(PRINTPROCESSOR_1 *info) size+=size_of_relative_string( &(info->name) ); return (size); + + return True; } /******************************************************************* @@ -1457,6 +1585,8 @@ static uint32 spoolss_size_monitor_info_1(PRINTMONITOR_1 *info) size+=size_of_relative_string( &(info->name) ); return (size); + + return True; } /******************************************************************* @@ -1467,7 +1597,7 @@ static uint32 spoolss_size_monitor_info_1(PRINTMONITOR_1 *info) * * jfmxxxx: fix it to also write a buffer ********************************************************************/ -static void spoolss_io_read_buffer(char *desc, prs_struct *ps, int depth, BUFFER *buffer) +static BOOL spoolss_io_read_buffer(char *desc, prs_struct *ps, int depth, BUFFER *buffer) { prs_debug(ps, depth, desc, "spoolss_io_read_buffer"); depth++; @@ -1489,6 +1619,8 @@ static void spoolss_io_read_buffer(char *desc, prs_struct *ps, int depth, BUFFER buffer->data=0x0000; buffer->size=0x0000; } + + return True; } /******************************************************************* @@ -1499,7 +1631,7 @@ static void spoolss_io_read_buffer(char *desc, prs_struct *ps, int depth, BUFFER * * jfmxxxx: fix it to also write a buffer ********************************************************************/ -void spoolss_io_free_buffer(BUFFER *buffer) +BOOL spoolss_io_free_buffer(BUFFER *buffer) { DEBUG(8,("spoolss_io_free_buffer\n")); @@ -1507,13 +1639,15 @@ void spoolss_io_free_buffer(BUFFER *buffer) { free(buffer->data); } + + return True; } /******************************************************************* * read a structure. * called from spoolss_getprinterdriver2 (srv_spoolss.c) ********************************************************************/ -void spoolss_io_q_getprinterdriver2(char *desc, +BOOL spoolss_io_q_getprinterdriver2(char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_struct *ps, int depth) { @@ -1537,13 +1671,15 @@ void spoolss_io_q_getprinterdriver2(char *desc, prs_uint32("buffer size", ps, depth, &(q_u->buf_size)); prs_uint32("status", ps, depth, &(q_u->status)); + + return True; } /******************************************************************* * read a structure. * called from spoolss_getprinterdriver2 (srv_spoolss.c) ********************************************************************/ -void spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, +BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth) { uint32 useless_ptr=0xADDE0FF0; @@ -1658,13 +1794,15 @@ void spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_uint32("pipo", ps, depth, &pipo); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* * read a structure. * called from spoolss_enumprinters (srv_spoolss.c) ********************************************************************/ -void spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, +BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth) { uint32 useless_ptr; @@ -1684,6 +1822,8 @@ void spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_uint32("level", ps, depth, &(q_u->level)); spoolss_io_read_buffer("buffer", ps, depth, &(q_u->buffer)); + + return True; } /******************************************************************* @@ -1691,7 +1831,7 @@ void spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, * called from spoolss_r_enum_printers (srv_spoolss.c) * ********************************************************************/ -void spoolss_io_r_enumprinters(char *desc, +BOOL spoolss_io_r_enumprinters(char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth) { @@ -1744,7 +1884,7 @@ void spoolss_io_r_enumprinters(char *desc, prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); prs_uint32("count", ps, depth, &(r_u->returned)); prs_uint32("status", ps, depth, &(r_u->status)); - return; + return False; } mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); @@ -1780,6 +1920,8 @@ void spoolss_io_r_enumprinters(char *desc, prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); prs_uint32("count", ps, depth, &(r_u->returned)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* @@ -1787,7 +1929,7 @@ void spoolss_io_r_enumprinters(char *desc, * called from spoolss_r_enum_printers (srv_spoolss.c) * ********************************************************************/ -void spoolss_io_r_getprinter(char *desc, +BOOL spoolss_io_r_getprinter(char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth) { @@ -1905,6 +2047,8 @@ void spoolss_io_r_getprinter(char *desc, prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* @@ -1915,7 +2059,7 @@ void spoolss_io_r_getprinter(char *desc, * * jfmxxxx: fix it to also write a buffer ********************************************************************/ -static void spoolss_io_read_buffer8(char *desc, prs_struct *ps, uint8 **buffer, uint32 *size,int depth) +static BOOL spoolss_io_read_buffer8(char *desc, prs_struct *ps, uint8 **buffer, uint32 *size,int depth) { uint32 useless_ptr; @@ -1938,13 +2082,15 @@ static void spoolss_io_read_buffer8(char *desc, prs_struct *ps, uint8 **buffer, *buffer=0x0000; *size=0x0000; } + + return True; } /******************************************************************* * read a structure. * called from spoolss_getprinter (srv_spoolss.c) ********************************************************************/ -void spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, +BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps, int depth) { uint32 count; @@ -1965,11 +2111,13 @@ void spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, } prs_uint32("buffer size", ps, depth, &(q_u->offered)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setprinter"); depth++; @@ -1977,11 +2125,13 @@ void spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -static void spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE **devmode) +static BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE **devmode) { uint32 devmode_size=0x0; uint32 useless_ptr=0x0; @@ -2007,11 +2157,13 @@ static void spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE smb_io_devmode(desc, ps, depth, *devmode); } + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_setprinter"); depth++; @@ -2034,11 +2186,13 @@ void spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps prs_uint32("security.data", ps, depth, &(q_u->security.data)); prs_uint32("command", ps, depth, &(q_u->command)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_fcpn(char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_fcpn(char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_fcpn"); depth++; @@ -2046,11 +2200,13 @@ void spoolss_io_r_fcpn(char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_fcpn(char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_fcpn(char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_fcpn"); @@ -2059,12 +2215,14 @@ void spoolss_io_q_fcpn(char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) prs_align(ps); smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); depth++; @@ -2072,11 +2230,13 @@ void spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int de prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); @@ -2092,11 +2252,13 @@ void spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int de prs_align(ps); prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth) { uint32 useless_ptr=0xADDE0FF0; uint32 start_offset, end_offset, beginning; @@ -2207,11 +2369,13 @@ void spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, in prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); prs_uint32("numofjobs", ps, depth, &(r_u->numofjobs)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); @@ -2229,11 +2393,13 @@ void spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, in prs_align(ps); prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_schedulejob(char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_schedulejob(char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_schedulejob"); depth++; @@ -2241,11 +2407,13 @@ void spoolss_io_r_schedulejob(char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct * prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_schedulejob(char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_schedulejob(char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_schedulejob"); depth++; @@ -2254,11 +2422,13 @@ void spoolss_io_q_schedulejob(char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct * smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); prs_uint32("jobid", ps, depth, &(q_u->jobid)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_setjob(char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_setjob(char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setjob"); depth++; @@ -2266,11 +2436,13 @@ void spoolss_io_r_setjob(char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int de prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_setjob"); depth++; @@ -2285,11 +2457,13 @@ void spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int de */ prs_uint32("level", ps, depth, &(q_u->level)); prs_uint32("command", ps, depth, &(q_u->command)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_enumdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) { uint32 useless_ptr=0xADDE0FF0; uint32 start_offset, end_offset, beginning; @@ -2411,11 +2585,13 @@ void spoolss_io_r_enumdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_s prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); prs_uint32("numofdrivers", ps, depth, &(r_u->numofdrivers)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth) { uint32 useless_ptr=0xADDE0FF0; @@ -2433,11 +2609,13 @@ void spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); prs_align(ps); prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth) { uint32 useless_ptr=0xADDE0FF0; uint32 start_offset, end_offset, beginning; @@ -2520,11 +2698,13 @@ void spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); prs_uint32("numofforms", ps, depth, &(r_u->numofforms)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); @@ -2536,11 +2716,13 @@ void spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); prs_align(ps); prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth) { uint32 useless_ptr=0xADDE0FF0; uint32 start_offset, end_offset, beginning; @@ -2618,11 +2800,13 @@ void spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); prs_uint32("numofports", ps, depth, &(r_u->numofports)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth) { uint32 useless; prs_debug(ps, depth, desc, ""); @@ -2636,12 +2820,14 @@ void spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); prs_align(ps); prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; } /******************************************************************* ********************************************************************/ -void spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 **q_u, prs_struct *ps, int depth) +BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 **q_u, prs_struct *ps, int depth) { SPOOL_PRINTER_INFO_LEVEL_2 *il; @@ -2709,11 +2895,13 @@ void spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 **q_u, } */ + + return True; } /******************************************************************* ********************************************************************/ -void spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth) +BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth) { uint32 useless; uint32 level; @@ -2741,11 +2929,13 @@ void spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s break; } + + return True; } /******************************************************************* ********************************************************************/ -void spool_io_user_level_1(char *desc, SPOOL_USER_LEVEL_1 **q_u, prs_struct *ps, int depth) +BOOL spool_io_user_level_1(char *desc, SPOOL_USER_LEVEL_1 **q_u, prs_struct *ps, int depth) { SPOOL_USER_LEVEL_1 *il; prs_debug(ps, depth, desc, ""); @@ -2775,11 +2965,13 @@ void spool_io_user_level_1(char *desc, SPOOL_USER_LEVEL_1 **q_u, prs_struct *ps, smb_io_unistr2("", &(il->client_name), il->client_name_ptr, ps, depth); prs_align(ps); smb_io_unistr2("", &(il->user_name), il->user_name_ptr, ps, depth); + + return True; } /******************************************************************* ********************************************************************/ -void spool_io_user_level(char *desc, SPOOL_USER_LEVEL *q_u, prs_struct *ps, int depth) +BOOL spool_io_user_level(char *desc, SPOOL_USER_LEVEL *q_u, prs_struct *ps, int depth) { uint32 useless; uint32 level; @@ -2797,11 +2989,13 @@ void spool_io_user_level(char *desc, SPOOL_USER_LEVEL *q_u, prs_struct *ps, int break; } + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth) { uint32 useless; prs_debug(ps, depth, desc, "spoolss_io_q_addprinterex"); @@ -2839,12 +3033,14 @@ void spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct prs_uint32("info_level", ps, depth, &(q_u->user_level)); spool_io_user_level("", &(q_u->user), ps, depth); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addprinterex"); depth++; @@ -2852,11 +3048,13 @@ void spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, prs_struct smb_io_prt_hnd("printer handle",&(r_u->handle),ps,depth); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, +BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, prs_struct *ps, int depth) { SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *il; @@ -2906,6 +3104,8 @@ void spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_ if (il->dependentfiles_ptr) smb_io_buffer5("", &(il->dependentfiles), ps, depth); + + return True; } @@ -2918,7 +3118,7 @@ void spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_ dynamically allocate memory ********************************************************************/ -void uniarray_2_ascarray(BUFFER5 *buf5, char ***ar) +BOOL uniarray_2_ascarray(BUFFER5 *buf5, char ***ar) { char **array; char *string; @@ -2929,7 +3129,7 @@ void uniarray_2_ascarray(BUFFER5 *buf5, char ***ar) uint16 *src; - if (buf5==NULL) return; + if (buf5==NULL) return False; array=NULL; n=0; @@ -2962,6 +3162,8 @@ void uniarray_2_ascarray(BUFFER5 *buf5, char ***ar) *ar=array; DEBUG(10,("Number of dependent files: [%d]\n", i-1)); + + return True; } /******************************************************************* @@ -2969,10 +3171,9 @@ void uniarray_2_ascarray(BUFFER5 *buf5, char ***ar) and null terminated array and size of array at beginning ********************************************************************/ -void smb_io_unibuffer(char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) +BOOL smb_io_unibuffer(char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) { - - if (buffer==NULL) return; + if (buffer==NULL) return False; buffer->undoc=0; buffer->uni_str_len=buffer->uni_max_len; @@ -2981,11 +3182,13 @@ void smb_io_unibuffer(char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) prs_unistr2(True, "buffer ", ps, depth, buffer); + + return True; } /******************************************************************* ********************************************************************/ -void spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth) +BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth) { uint32 useless; uint32 level; @@ -3003,11 +3206,13 @@ void spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LE break; } + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) { uint32 useless; prs_debug(ps, depth, desc, ""); @@ -3020,22 +3225,26 @@ void spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, pr prs_uint32("info_level", ps, depth, &(q_u->level)); spool_io_printer_driver_info_level("", &(q_u->info), ps, depth); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_addprinterdriver(char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_addprinterdriver(char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); depth++; prs_uint32("status", ps, depth, &(q_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, +BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, NT_PRINTER_DRIVER_INFO_LEVEL_3 **asc) { NT_PRINTER_DRIVER_INFO_LEVEL_3 *d; @@ -3072,9 +3281,11 @@ void uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, DEBUGADD(8,( "defaultdatatype: %s\n", d->defaultdatatype)); uniarray_2_ascarray(&(uni->dependentfiles), &(d->dependentfiles) ); + + return True; } -void uni_2_asc_printer_info_2(SPOOL_PRINTER_INFO_LEVEL_2 *uni, +BOOL uni_2_asc_printer_info_2(SPOOL_PRINTER_INFO_LEVEL_2 *uni, NT_PRINTER_INFO_LEVEL_2 **asc) { NT_PRINTER_INFO_LEVEL_2 *d; @@ -3111,9 +3322,11 @@ void uni_2_asc_printer_info_2(SPOOL_PRINTER_INFO_LEVEL_2 *uni, unistr2_to_ascii(d->printprocessor, &(uni->printprocessor), sizeof(d->printprocessor)-1); unistr2_to_ascii(d->datatype, &(uni->datatype), sizeof(d->datatype)-1); unistr2_to_ascii(d->parameters, &(uni->parameters), sizeof(d->parameters)-1); + + return True; } -void convert_printer_info(SPOOL_PRINTER_INFO_LEVEL uni, +BOOL convert_printer_info(SPOOL_PRINTER_INFO_LEVEL uni, NT_PRINTER_INFO_LEVEL *printer, uint32 level) { @@ -3129,9 +3342,11 @@ void convert_printer_info(SPOOL_PRINTER_INFO_LEVEL uni, } + + return True; } -void convert_printer_driver_info(SPOOL_PRINTER_DRIVER_INFO_LEVEL uni, +BOOL convert_printer_driver_info(SPOOL_PRINTER_DRIVER_INFO_LEVEL uni, NT_PRINTER_DRIVER_INFO_LEVEL *printer, uint32 level) { @@ -3148,9 +3363,11 @@ void convert_printer_driver_info(SPOOL_PRINTER_DRIVER_INFO_LEVEL uni, } + + return True; } -void convert_devicemode(DEVICEMODE devmode, NT_DEVICEMODE *nt_devmode) +BOOL convert_devicemode(DEVICEMODE devmode, NT_DEVICEMODE *nt_devmode) { unistr_to_ascii(nt_devmode->devicename, devmode.devicename.buffer, @@ -3203,11 +3420,13 @@ void convert_devicemode(DEVICEMODE devmode, NT_DEVICEMODE *nt_devmode) memcpy(nt_devmode->private, devmode.private, nt_devmode->driverextra); } + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth) { uint32 useless_ptr=0xADDE0FF0; uint32 start_offset, end_offset, beginning; @@ -3280,11 +3499,13 @@ void spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, prs_struct *ps, int depth) { uint32 useless_ptr=0xADDE0FF0; @@ -3302,11 +3523,13 @@ void spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); prs_align(ps); prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth) { uint32 useless_ptr=0xADDE0FF0; uint32 start_offset, end_offset, beginning; @@ -3384,11 +3607,13 @@ void spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); prs_uint32("numofprintprocessors", ps, depth, &(r_u->numofprintprocessors)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, prs_struct *ps, int depth) { uint32 useless; prs_debug(ps, depth, desc, "spoolss_io_q_enumprintprocessors"); @@ -3405,11 +3630,13 @@ void spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); prs_align(ps); prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth) { uint32 useless_ptr=0xADDE0FF0; uint32 start_offset, end_offset, beginning; @@ -3487,11 +3714,13 @@ void spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); prs_uint32("numofprintmonitors", ps, depth, &(r_u->numofprintmonitors)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_enumprintmonitors(char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprintmonitors(char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth) { uint32 useless; prs_debug(ps, depth, desc, "spoolss_io_q_enumprintmonitors"); @@ -3505,11 +3734,13 @@ void spoolss_io_q_enumprintmonitors(char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); prs_align(ps); prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdata"); depth++; @@ -3525,11 +3756,13 @@ void spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_ prs_uint8s(False, "data", ps, depth, r_u->data, r_u->datasize); prs_uint32("realdatasize", ps, depth, &(r_u->realdatasize)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_enumprinterdata(char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprinterdata(char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdata"); depth++; @@ -3539,11 +3772,13 @@ void spoolss_io_q_enumprinterdata(char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_ prs_uint32("index", ps, depth, &(q_u->index)); prs_uint32("valuesize", ps, depth, &(q_u->valuesize)); prs_uint32("datasize", ps, depth, &(q_u->datasize)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_setprinterdata"); depth++; @@ -3571,22 +3806,26 @@ void spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_st } prs_uint32("real_len", ps, depth, &(q_u->real_len)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setprinterdata"); depth++; prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void convert_specific_param(NT_PRINTER_PARAM **param, UNISTR2 value , uint32 type, uint8 *data, uint32 len) +BOOL convert_specific_param(NT_PRINTER_PARAM **param, UNISTR2 value , uint32 type, uint8 *data, uint32 len) { DEBUG(5,("converting a specific param struct\n")); @@ -3609,11 +3848,13 @@ void convert_specific_param(NT_PRINTER_PARAM **param, UNISTR2 value , uint32 typ memcpy((*param)->data, data, len); DEBUGADD(6,("\tvalue:[%s], len:[%d]\n",(*param)->value, (*param)->data_len)); + + return True; } /******************************************************************* ********************************************************************/ -static void spoolss_io_addform(char *desc, FORM *f, uint32 ptr, prs_struct *ps, int depth) +static BOOL spoolss_io_addform(char *desc, FORM *f, uint32 ptr, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_addform"); depth++; @@ -3632,11 +3873,13 @@ static void spoolss_io_addform(char *desc, FORM *f, uint32 ptr, prs_struct *ps, smb_io_unistr2("", &(f->name), f->name_ptr, ps, depth); } + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth) { uint32 useless_ptr=0; prs_debug(ps, depth, desc, "spoolss_io_q_addform"); @@ -3652,22 +3895,26 @@ void spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int prs_uint32("useless_ptr", ps, depth, &(useless_ptr)); spoolss_io_addform("", &(q_u->form), useless_ptr, ps, depth); } + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addform"); depth++; prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth) { uint32 useless_ptr=0; prs_debug(ps, depth, desc, "spoolss_io_q_setform"); @@ -3687,22 +3934,26 @@ void spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int prs_uint32("useless_ptr", ps, depth, &(useless_ptr)); spoolss_io_addform("", &(q_u->form), useless_ptr, ps, depth); } + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_setform(char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_setform(char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setform"); depth++; prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_r_getjob(char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getjob(char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int depth) { uint32 useless_ptr=0xADDE0FF0; uint32 start_offset, end_offset, beginning; @@ -3789,11 +4040,13 @@ void spoolss_io_r_getjob(char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int de prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* ********************************************************************/ -void spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); @@ -3810,4 +4063,6 @@ void spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int de prs_align(ps); prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; } diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index f04e5eabbc..9e140bcc3e 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -3,9 +3,9 @@ * Unix SMB/Netbios implementation. * Version 1.9. * 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 Tridgell 1992-1999, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, + * Copyright (C) Paul Ashton 1997-1999. * * 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 @@ -31,22 +31,24 @@ extern int DEBUGLEVEL; /******************************************************************* makes a SH_INFO_1_STR structure ********************************************************************/ -void make_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark) +BOOL make_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark) { - if (sh1 == NULL) return; + if (sh1 == NULL) return False; DEBUG(5,("make_srv_share_info1_str\n")); make_unistr2(&(sh1->uni_netname), net_name, strlen(net_name)+1); make_unistr2(&(sh1->uni_remark ), remark , strlen(remark )+1); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth) +static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth) { - if (sh1 == NULL) return; + if (sh1 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_share_info1_str"); depth++; @@ -55,28 +57,32 @@ static void srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct * smb_io_unistr2("", &(sh1->uni_netname), True, ps, depth); smb_io_unistr2("", &(sh1->uni_remark ), True, ps, depth); + + return True; } /******************************************************************* makes a SH_INFO_1 structure ********************************************************************/ -void make_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark) +BOOL make_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark) { - if (sh1 == NULL) return; + if (sh1 == NULL) return False; DEBUG(5,("make_srv_share_info1: %s %8x %s\n", net_name, type, remark)); sh1->ptr_netname = net_name != NULL ? 1 : 0; sh1->type = type; sh1->ptr_remark = remark != NULL ? 1 : 0; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) +static BOOL srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) { - if (sh1 == NULL) return; + if (sh1 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_share_info1"); depth++; @@ -86,14 +92,16 @@ static void srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int prs_uint32("ptr_netname", ps, depth, &(sh1->ptr_netname)); prs_uint32("type ", ps, depth, &(sh1->type )); prs_uint32("ptr_remark ", ps, depth, &(sh1->ptr_remark)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_srv_share_info_1(char *desc, SRV_SHARE_INFO_1 *ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_share_info_1(char *desc, SRV_SHARE_INFO_1 *ctr, prs_struct *ps, int depth) { - if (ctr == NULL) return; + if (ctr == NULL) return False; prs_debug(ps, depth, desc, "srv_io_share_1_ctr"); depth++; @@ -130,16 +138,18 @@ static void srv_io_srv_share_info_1(char *desc, SRV_SHARE_INFO_1 *ctr, prs_stru prs_align(ps); } + + return True; } /******************************************************************* makes a SH_INFO_2_STR structure ********************************************************************/ -void make_srv_share_info2_str(SH_INFO_2_STR *sh2, +BOOL make_srv_share_info2_str(SH_INFO_2_STR *sh2, char *net_name, char *remark, char *path, char *passwd) { - if (sh2 == NULL) return; + if (sh2 == NULL) return False; DEBUG(5,("make_srv_share_info2_str\n")); @@ -147,14 +157,16 @@ void make_srv_share_info2_str(SH_INFO_2_STR *sh2, make_unistr2(&(sh2->uni_remark ), remark , strlen(remark )+1); make_unistr2(&(sh2->uni_path ), path , strlen(path )+1); make_unistr2(&(sh2->uni_passwd ), passwd , strlen(passwd )+1); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_share_info2_str(char *desc, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) +static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) { - if (sh2 == NULL) return; + if (sh2 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_share_info2_str"); depth++; @@ -165,17 +177,19 @@ static void srv_io_share_info2_str(char *desc, SH_INFO_2_STR *sh2, prs_struct * smb_io_unistr2("", &(sh2->uni_remark ), True, ps, depth); smb_io_unistr2("", &(sh2->uni_path ), True, ps, depth); smb_io_unistr2("", &(sh2->uni_passwd ), True, ps, depth); + + return True; } /******************************************************************* makes a SH_INFO_2 structure ********************************************************************/ -void make_srv_share_info2(SH_INFO_2 *sh2, +BOOL make_srv_share_info2(SH_INFO_2 *sh2, char *net_name, uint32 type, char *remark, uint32 perms, uint32 max_uses, uint32 num_uses, char *path, char *passwd) { - if (sh2 == NULL) return; + if (sh2 == NULL) return False; DEBUG(5,("make_srv_share_info2: %s %8x %s\n", net_name, type, remark)); @@ -188,14 +202,16 @@ void make_srv_share_info2(SH_INFO_2 *sh2, sh2->type = type; sh2->ptr_path = path != NULL ? 1 : 0; sh2->ptr_passwd = passwd != NULL ? 1 : 0; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) +static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) { - if (sh2 == NULL) return; + if (sh2 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_share_info2"); depth++; @@ -210,14 +226,16 @@ static void srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int prs_uint32("num_uses ", ps, depth, &(sh2->num_uses )); prs_uint32("ptr_path ", ps, depth, &(sh2->ptr_path )); prs_uint32("ptr_passwd ", ps, depth, &(sh2->ptr_passwd )); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_struct *ps, int depth) { - if (ctr == NULL) return; + if (ctr == NULL) return False; prs_debug(ps, depth, desc, "srv_io_share_2_ctr"); depth++; @@ -254,14 +272,16 @@ static void srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_stru prs_align(ps); } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth) { - if (ctr == NULL) return; + if (ctr == NULL) return False; prs_debug(ps, depth, desc, "srv_io_srv_share_ctr"); depth++; @@ -293,18 +313,20 @@ static void srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struc } } } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void make_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, +BOOL make_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, char *srv_name, uint32 share_level, SRV_SHARE_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) { - if (q_n == NULL || ctr == NULL || hnd == NULL) return; + if (q_n == NULL || ctr == NULL || hnd == NULL) return False; q_n->ctr = ctr; @@ -316,14 +338,16 @@ void make_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, q_n->preferred_len = preferred_len; memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth) { - if (q_n == NULL) return; + if (q_n == NULL) return False; prs_debug(ps, depth, desc, "srv_io_q_net_share_enum"); depth++; @@ -345,14 +369,16 @@ void srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len)); smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth) { - if (r_n == NULL) return; + if (r_n == NULL) return False; prs_debug(ps, depth, desc, "srv_io_r_net_share_enum"); depth++; @@ -369,26 +395,30 @@ void srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct prs_uint32("total_entries", ps, depth, &(r_n->total_entries)); smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); prs_uint32("status ", ps, depth, &(r_n->status)); + + return True; } /******************************************************************* makes a SESS_INFO_0_STR structure ********************************************************************/ -void make_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name) +BOOL make_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name) { - if (ss0 == NULL) return; + if (ss0 == NULL) return False; DEBUG(5,("make_srv_sess_info0_str\n")); make_unistr2(&(ss0->uni_name), name, strlen(name)+1); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth) +static BOOL srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth) { - if (ss0 == NULL) return; + if (ss0 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_sess_info0_str"); depth++; @@ -396,26 +426,30 @@ static void srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct prs_align(ps); smb_io_unistr2("", &(ss0->uni_name), True, ps, depth); + + return True; } /******************************************************************* makes a SESS_INFO_0 structure ********************************************************************/ -void make_srv_sess_info0(SESS_INFO_0 *ss0, char *name) +BOOL make_srv_sess_info0(SESS_INFO_0 *ss0, char *name) { - if (ss0 == NULL) return; + if (ss0 == NULL) return False; DEBUG(5,("make_srv_sess_info0: %s\n", name)); ss0->ptr_name = name != NULL ? 1 : 0; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth) +static BOOL srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth) { - if (ss0 == NULL) return; + if (ss0 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_sess_info0"); depth++; @@ -423,14 +457,16 @@ static void srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int prs_align(ps); prs_uint32("ptr_name", ps, depth, &(ss0->ptr_name)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth) +static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth) { - if (ss0 == NULL) return; + if (ss0 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0"); depth++; @@ -467,27 +503,31 @@ static void srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct prs_align(ps); } + + return True; } /******************************************************************* makes a SESS_INFO_1_STR structure ********************************************************************/ -void make_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user) +BOOL make_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user) { - if (ss1 == NULL) return; + if (ss1 == NULL) return False; DEBUG(5,("make_srv_sess_info1_str\n")); make_unistr2(&(ss1->uni_name), name, strlen(name)+1); make_unistr2(&(ss1->uni_user), name, strlen(user)+1); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth) +static BOOL srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth) { - if (ss1 == NULL) return; + if (ss1 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_sess_info1_str"); depth++; @@ -496,17 +536,19 @@ static void srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct smb_io_unistr2("", &(ss1->uni_name), True, ps, depth); smb_io_unistr2("", &(ss1->uni_user), True, ps, depth); + + return True; } /******************************************************************* makes a SESS_INFO_1 structure ********************************************************************/ -void make_srv_sess_info1(SESS_INFO_1 *ss1, +BOOL make_srv_sess_info1(SESS_INFO_1 *ss1, char *name, char *user, uint32 num_opens, uint32 open_time, uint32 idle_time, uint32 user_flags) { - if (ss1 == NULL) return; + if (ss1 == NULL) return False; DEBUG(5,("make_srv_sess_info1: %s\n", name)); @@ -517,14 +559,16 @@ void make_srv_sess_info1(SESS_INFO_1 *ss1, ss1->open_time = open_time; ss1->idle_time = idle_time; ss1->user_flags = user_flags; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth) +static BOOL srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth) { - if (ss1 == NULL) return; + if (ss1 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_sess_info1"); depth++; @@ -538,14 +582,16 @@ static void srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int prs_uint32("open_time ", ps, depth, &(ss1->open_time )); prs_uint32("idle_time ", ps, depth, &(ss1->idle_time )); prs_uint32("user_flags", ps, depth, &(ss1->user_flags)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth) +static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth) { - if (ss1 == NULL) return; + if (ss1 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1"); depth++; @@ -582,14 +628,16 @@ static void srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct prs_align(ps); } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct *ps, int depth) { - if (ctr == NULL) return; + if (ctr == NULL) return False; prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr"); depth++; @@ -621,19 +669,21 @@ static void srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct } } } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, +BOOL make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, char *srv_name, char *qual_name, char *user_name, uint32 sess_level, SRV_SESS_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) { - if (q_n == NULL || ctr == NULL || hnd == NULL) return; + if (q_n == NULL || ctr == NULL || hnd == NULL) return False; q_n->ctr = ctr; @@ -647,14 +697,16 @@ void make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, q_n->preferred_len = preferred_len; memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth) { - if (q_n == NULL) return; + if (q_n == NULL) return False; prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum"); depth++; @@ -684,14 +736,16 @@ void srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *p prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len)); smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth) { - if (r_n == NULL) return; + if (r_n == NULL) return False; prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum"); depth++; @@ -708,26 +762,30 @@ void srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *p prs_uint32("total_entries", ps, depth, &(r_n->total_entries)); smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); prs_uint32("status ", ps, depth, &(r_n->status)); + + return True; } /******************************************************************* makes a CONN_INFO_0 structure ********************************************************************/ -void make_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id) +BOOL make_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id) { - if (ss0 == NULL) return; + if (ss0 == NULL) return False; DEBUG(5,("make_srv_conn_info0\n")); ss0->id = id; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth) +static BOOL srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth) { - if (ss0 == NULL) return; + if (ss0 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_conn_info0"); depth++; @@ -735,14 +793,16 @@ static void srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int prs_align(ps); prs_uint32("id", ps, depth, &(ss0->id)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth) +static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth) { - if (ss0 == NULL) return; + if (ss0 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0"); depth++; @@ -771,27 +831,31 @@ static void srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct prs_align(ps); } + + return True; } /******************************************************************* makes a CONN_INFO_1_STR structure ********************************************************************/ -void make_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name) +BOOL make_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name) { - if (ss1 == NULL) return; + if (ss1 == NULL) return False; DEBUG(5,("make_srv_conn_info1_str\n")); make_unistr2(&(ss1->uni_usr_name), usr_name, strlen(usr_name)+1); make_unistr2(&(ss1->uni_net_name), net_name, strlen(net_name)+1); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth) +static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth) { - if (ss1 == NULL) return; + if (ss1 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_conn_info1_str"); depth++; @@ -800,17 +864,19 @@ static void srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct smb_io_unistr2("", &(ss1->uni_usr_name), True, ps, depth); smb_io_unistr2("", &(ss1->uni_net_name), True, ps, depth); + + return True; } /******************************************************************* makes a CONN_INFO_1 structure ********************************************************************/ -void make_srv_conn_info1(CONN_INFO_1 *ss1, +BOOL make_srv_conn_info1(CONN_INFO_1 *ss1, uint32 id, uint32 type, uint32 num_opens, uint32 num_users, uint32 open_time, char *usr_name, char *net_name) { - if (ss1 == NULL) return; + if (ss1 == NULL) return False; DEBUG(5,("make_srv_conn_info1: %s %s\n", usr_name, net_name)); @@ -822,14 +888,16 @@ void make_srv_conn_info1(CONN_INFO_1 *ss1, ss1->ptr_usr_name = usr_name != NULL ? 1 : 0; ss1->ptr_net_name = net_name != NULL ? 1 : 0; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth) +static BOOL srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth) { - if (ss1 == NULL) return; + if (ss1 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_conn_info1"); depth++; @@ -844,14 +912,16 @@ static void srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int prs_uint32("ptr_usr_name", ps, depth, &(ss1->ptr_usr_name)); prs_uint32("ptr_net_name", ps, depth, &(ss1->ptr_net_name)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth) +static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth) { - if (ss1 == NULL) return; + if (ss1 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1"); depth++; @@ -886,14 +956,16 @@ static void srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct prs_align(ps); } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct *ps, int depth) { - if (ctr == NULL) return; + if (ctr == NULL) return False; prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr"); depth++; @@ -925,18 +997,20 @@ static void srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct } } } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void make_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, +BOOL make_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, char *srv_name, char *qual_name, uint32 conn_level, SRV_CONN_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) { - if (q_n == NULL || ctr == NULL || hnd == NULL) return; + if (q_n == NULL || ctr == NULL || hnd == NULL) return False; q_n->ctr = ctr; @@ -949,14 +1023,16 @@ void make_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, q_n->preferred_len = preferred_len; memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth) { - if (q_n == NULL) return; + if (q_n == NULL) return False; prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum"); depth++; @@ -983,14 +1059,16 @@ void srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *p prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len)); smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth) { - if (r_n == NULL) return; + if (r_n == NULL) return False; prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum"); depth++; @@ -1007,27 +1085,31 @@ void srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *p prs_uint32("total_entries", ps, depth, &(r_n->total_entries)); smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); prs_uint32("status ", ps, depth, &(r_n->status)); + + return True; } /******************************************************************* makes a FILE_INFO_3_STR structure ********************************************************************/ -void make_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name) +BOOL make_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name) { - if (fi3 == NULL) return; + if (fi3 == NULL) return False; DEBUG(5,("make_srv_file_info3_str\n")); make_unistr2(&(fi3->uni_path_name), path_name, strlen(path_name)+1); make_unistr2(&(fi3->uni_user_name), user_name, strlen(user_name)+1); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth) +static BOOL srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth) { - if (sh1 == NULL) return; + if (sh1 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_file_info3_str"); depth++; @@ -1036,16 +1118,18 @@ static void srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct smb_io_unistr2("", &(sh1->uni_path_name), True, ps, depth); smb_io_unistr2("", &(sh1->uni_user_name), True, ps, depth); + + return True; } /******************************************************************* makes a FILE_INFO_3 structure ********************************************************************/ -void make_srv_file_info3(FILE_INFO_3 *fl3, +BOOL make_srv_file_info3(FILE_INFO_3 *fl3, uint32 id, uint32 perms, uint32 num_locks, char *path_name, char *user_name) { - if (fl3 == NULL) return; + if (fl3 == NULL) return False; DEBUG(5,("make_srv_file_info3: %s %s\n", path_name, user_name)); @@ -1055,14 +1139,16 @@ void make_srv_file_info3(FILE_INFO_3 *fl3, fl3->ptr_path_name = path_name != NULL ? 1 : 0; fl3->ptr_user_name = user_name != NULL ? 1 : 0; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) +static BOOL srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) { - if (fl3 == NULL) return; + if (fl3 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_file_info3"); depth++; @@ -1074,14 +1160,16 @@ static void srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int prs_uint32("num_locks ", ps, depth, &(fl3->num_locks )); prs_uint32("ptr_path_name", ps, depth, &(fl3->ptr_path_name)); prs_uint32("ptr_user_name", ps, depth, &(fl3->ptr_user_name)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth) +static BOOL srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth) { - if (fl3 == NULL) return; + if (fl3 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_file_3_fl3"); depth++; @@ -1115,14 +1203,16 @@ static void srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct prs_align(ps); } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static void srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) { - if (ctr == NULL) return; + if (ctr == NULL) return False; prs_debug(ps, depth, desc, "srv_io_srv_file_ctr"); depth++; @@ -1149,18 +1239,20 @@ static void srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct } } } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, +BOOL make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, char *srv_name, char *qual_name, uint32 file_id, uint32 file_level, SRV_FILE_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) { - if (q_n == NULL || ctr == NULL || hnd == NULL) return; + if (q_n == NULL || ctr == NULL || hnd == NULL) return False; q_n->ctr = ctr; @@ -1174,14 +1266,16 @@ void make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, q_n->preferred_len = preferred_len; memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth) { - if (q_n == NULL) return; + if (q_n == NULL) return False; prs_debug(ps, depth, desc, "srv_io_q_net_file_enum"); depth++; @@ -1209,14 +1303,16 @@ void srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *p prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len)); smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth) { - if (r_n == NULL) return; + if (r_n == NULL) return False; prs_debug(ps, depth, desc, "srv_io_r_net_file_enum"); depth++; @@ -1233,16 +1329,18 @@ void srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *p prs_uint32("total_entries", ps, depth, &(r_n->total_entries)); smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); prs_uint32("status ", ps, depth, &(r_n->status)); + + return True; } /******************************************************************* makes a SRV_INFO_101 structure. ********************************************************************/ -void make_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name, +BOOL make_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name, uint32 ver_major, uint32 ver_minor, uint32 srv_type, char *comment) { - if (sv101 == NULL) return; + if (sv101 == NULL) return False; DEBUG(5,("make_srv_info_101\n")); @@ -1252,15 +1350,17 @@ void make_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name, sv101->ver_minor = ver_minor; sv101->srv_type = srv_type; make_buf_unistr2(&(sv101->uni_comment ), &(sv101->ptr_comment) , comment ); + + return True; } /******************************************************************* reads or writes a SRV_INFO_101 structure. ********************************************************************/ -static void srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth) +static BOOL srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth) { - if (sv101 == NULL) return; + if (sv101 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_info_101"); depth++; @@ -1278,18 +1378,20 @@ static void srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, in smb_io_unistr2("uni_name ", &(sv101->uni_name ), True, ps, depth); smb_io_unistr2("uni_comment ", &(sv101->uni_comment ), True, ps, depth); + + return True; } /******************************************************************* makes a SRV_INFO_102 structure. ********************************************************************/ -void make_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name, +BOOL make_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name, char *comment, uint32 ver_major, uint32 ver_minor, uint32 srv_type, uint32 users, uint32 disc, uint32 hidden, uint32 announce, uint32 ann_delta, uint32 licenses, char *usr_path) { - if (sv102 == NULL) return; + if (sv102 == NULL) return False; DEBUG(5,("make_srv_info_102\n")); @@ -1309,15 +1411,17 @@ void make_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name, sv102->ann_delta =ann_delta; sv102->licenses = licenses; make_buf_unistr2(&(sv102->uni_usr_path), &(sv102->ptr_usr_path), usr_path); + + return True; } /******************************************************************* reads or writes a SRV_INFO_102 structure. ********************************************************************/ -static void srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth) +static BOOL srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth) { - if (sv102 == NULL) return; + if (sv102 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_info102"); depth++; @@ -1346,14 +1450,16 @@ static void srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, in smb_io_unistr2("uni_comment ", &(sv102->uni_comment ), True, ps, depth); prs_align(ps); smb_io_unistr2("uni_usr_path", &(sv102->uni_usr_path), True, ps, depth); + + return True; } /******************************************************************* reads or writes a SRV_INFO_102 structure. ********************************************************************/ -static void srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) { - if (ctr == NULL) return; + if (ctr == NULL) return False; prs_debug(ps, depth, desc, "srv_io_info_ctr"); depth++; @@ -1386,29 +1492,33 @@ static void srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int } prs_align(ps); } + + return True; } /******************************************************************* makes a SRV_Q_NET_SRV_GET_INFO structure. ********************************************************************/ -void make_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv, +BOOL make_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv, char *server_name, uint32 switch_value) { - if (srv == NULL) return; + if (srv == NULL) return False; DEBUG(5,("make_srv_q_net_srv_get_info\n")); make_buf_unistr2(&(srv->uni_srv_name), &(srv->ptr_srv_name), server_name); srv->switch_value = switch_value; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth) { - if (q_n == NULL) return; + if (q_n == NULL) return False; prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info"); depth++; @@ -1421,15 +1531,17 @@ void srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_str prs_align(ps); prs_uint32("switch_value ", ps, depth, &(q_n->switch_value)); + + return True; } /******************************************************************* makes a SRV_R_NET_SRV_GET_INFO structure. ********************************************************************/ -void make_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv, +BOOL make_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv, uint32 switch_value, SRV_INFO_CTR *ctr, uint32 status) { - if (srv == NULL) return; + if (srv == NULL) return False; DEBUG(5,("make_srv_r_net_srv_get_info\n")); @@ -1447,14 +1559,16 @@ void make_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv, } srv->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth) { - if (r_n == NULL) return; + if (r_n == NULL) return False; prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info"); depth++; @@ -1464,26 +1578,30 @@ void srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_str srv_io_info_ctr("ctr", r_n->ctr, ps, depth); prs_uint32("status ", ps, depth, &(r_n->status )); + + return True; } /******************************************************************* makes a SRV_Q_NET_REMOTE_TOD structure. ********************************************************************/ -void make_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_t, char *server_name) +BOOL make_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_t, char *server_name) { - if (q_t == NULL) return; + if (q_t == NULL) return False; DEBUG(5,("make_srv_q_net_remote_tod\n")); make_buf_unistr2(&(q_t->uni_srv_name), &(q_t->ptr_srv_name), server_name); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth) { - if (q_n == NULL) return; + if (q_n == NULL) return False; prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod"); depth++; @@ -1492,14 +1610,16 @@ void srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name)); smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); + + return True; } /******************************************************************* reads or writes a TIME_OF_DAY_INFO structure. ********************************************************************/ -static void srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth) +static BOOL srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth) { - if (tod == NULL) return; + if (tod == NULL) return False; prs_debug(ps, depth, desc, "srv_io_time_of_day_info"); depth++; @@ -1519,17 +1639,19 @@ static void srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_stru prs_uint32("year ", ps, depth, &(tod->year )); prs_uint32("weekday ", ps, depth, &(tod->weekday )); + + return True; } /******************************************************************* makes a TIME_OF_DAY_INFO structure. ********************************************************************/ -void make_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs, +BOOL make_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs, uint32 hours, uint32 mins, uint32 secs, uint32 hunds, uint32 zone, uint32 tintervals, uint32 day, uint32 month, uint32 year, uint32 weekday) { - if (tod == NULL) return; + if (tod == NULL) return False; DEBUG(5,("make_time_of_day_info\n")); @@ -1545,15 +1667,17 @@ void make_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs, tod->month = month; tod->year = year; tod->weekday = weekday; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth) { - if (r_n == NULL) return; + if (r_n == NULL) return False; prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod"); depth++; @@ -1565,4 +1689,6 @@ void srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct * srv_io_time_of_day_info("tod", r_n->tod, ps, depth); prs_uint32("status ", ps, depth, &(r_n->status)); + + return True; } diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c index f936df24b9..955d8df595 100644 --- a/source3/rpc_parse/parse_svc.c +++ b/source3/rpc_parse/parse_svc.c @@ -3,9 +3,9 @@ * Unix SMB/Netbios implementation. * Version 1.9. * 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 Tridgell 1992-1999, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, + * Copyright (C) Paul Ashton 1997-1999. * * 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 @@ -30,7 +30,7 @@ extern int DEBUGLEVEL; /******************************************************************* make_svc_q_open_sc_man ********************************************************************/ -void make_svc_q_open_sc_man(SVC_Q_OPEN_SC_MAN *q_u, +BOOL make_svc_q_open_sc_man(SVC_Q_OPEN_SC_MAN *q_u, char *server, char *database, uint32 des_access) { @@ -40,14 +40,16 @@ void make_svc_q_open_sc_man(SVC_Q_OPEN_SC_MAN *q_u, make_buf_unistr2(&(q_u->uni_db_name ), &(q_u->ptr_db_name), database); q_u->des_access = des_access; + + return True; } /******************************************************************* reads or writes a SVC_Q_OPEN_SC_MAN structure. ********************************************************************/ -void svc_io_q_open_sc_man(char *desc, SVC_Q_OPEN_SC_MAN *q_u, prs_struct *ps, int depth) +BOOL svc_io_q_open_sc_man(char *desc, SVC_Q_OPEN_SC_MAN *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "svc_io_q_open_sc_man"); depth++; @@ -64,26 +66,30 @@ void svc_io_q_open_sc_man(char *desc, SVC_Q_OPEN_SC_MAN *q_u, prs_struct *ps, in prs_uint32("des_access", ps, depth, &(q_u->des_access)); prs_align(ps); + + return True; } /******************************************************************* make_svc_r_open_sc_man ********************************************************************/ -void make_svc_r_open_sc_man(SVC_R_OPEN_SC_MAN *r_u, POLICY_HND *hnd, +BOOL make_svc_r_open_sc_man(SVC_R_OPEN_SC_MAN *r_u, POLICY_HND *hnd, uint32 status) { DEBUG(5,("make_svc_r_unknown_0: %d\n", __LINE__)); memcpy(&(r_u->pol), hnd, sizeof(r_u->pol)); r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void svc_io_r_open_sc_man(char *desc, SVC_R_OPEN_SC_MAN *r_u, prs_struct *ps, int depth) +BOOL svc_io_r_open_sc_man(char *desc, SVC_R_OPEN_SC_MAN *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "svc_io_r_open_sc_man"); depth++; @@ -93,12 +99,14 @@ void svc_io_r_open_sc_man(char *desc, SVC_R_OPEN_SC_MAN *r_u, prs_struct *ps, i smb_io_pol_hnd("", &(r_u->pol), ps, depth); prs_uint32("status ", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* make_svc_q_open_service ********************************************************************/ -void make_svc_q_open_service(SVC_Q_OPEN_SERVICE *q_u, +BOOL make_svc_q_open_service(SVC_Q_OPEN_SERVICE *q_u, POLICY_HND *hnd, char *server, uint32 des_access) @@ -109,14 +117,16 @@ void make_svc_q_open_service(SVC_Q_OPEN_SERVICE *q_u, make_unistr2(&(q_u->uni_svc_name), server, strlen(server)+1); q_u->des_access = des_access; + + return True; } /******************************************************************* reads or writes a SVC_Q_OPEN_SERVICE structure. ********************************************************************/ -void svc_io_q_open_service(char *desc, SVC_Q_OPEN_SERVICE *q_u, prs_struct *ps, int depth) +BOOL svc_io_q_open_service(char *desc, SVC_Q_OPEN_SERVICE *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "svc_io_q_open_service"); depth++; @@ -131,26 +141,30 @@ void svc_io_q_open_service(char *desc, SVC_Q_OPEN_SERVICE *q_u, prs_struct *ps, prs_uint32("des_access", ps, depth, &(q_u->des_access)); prs_align(ps); + + return True; } /******************************************************************* make_svc_r_open_service ********************************************************************/ -void make_svc_r_open_service(SVC_R_OPEN_SERVICE *r_u, POLICY_HND *hnd, +BOOL make_svc_r_open_service(SVC_R_OPEN_SERVICE *r_u, POLICY_HND *hnd, uint32 status) { DEBUG(5,("make_svc_r_unknown_0: %d\n", __LINE__)); memcpy(&(r_u->pol), hnd, sizeof(r_u->pol)); r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void svc_io_r_open_service(char *desc, SVC_R_OPEN_SERVICE *r_u, prs_struct *ps, int depth) +BOOL svc_io_r_open_service(char *desc, SVC_R_OPEN_SERVICE *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "svc_io_r_open_service"); depth++; @@ -160,14 +174,16 @@ void svc_io_r_open_service(char *desc, SVC_R_OPEN_SERVICE *r_u, prs_struct *ps, smb_io_pol_hnd("", &(r_u->pol), ps, depth); prs_uint32("status ", ps, depth, &(r_u->status)); + + return True; } /******************************************************************* reads or writes a SVC_Q_START_SERVICE structure. ********************************************************************/ -void svc_io_q_start_service(char *desc, SVC_Q_START_SERVICE *q_s, prs_struct *ps, int depth) +BOOL svc_io_q_start_service(char *desc, SVC_Q_START_SERVICE *q_s, prs_struct *ps, int depth) { - if (q_s == NULL) return; + if (q_s == NULL) return False; prs_debug(ps, depth, desc, "svc_io_q_start_service"); depth++; @@ -195,25 +211,29 @@ void svc_io_q_start_service(char *desc, SVC_Q_START_SERVICE *q_s, prs_struct *ps smb_io_unistr2("", &(q_s->argv[i]), 1, ps, depth); } } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void svc_io_r_start_service(char *desc, SVC_R_START_SERVICE *r_s, prs_struct *ps, int depth) +BOOL svc_io_r_start_service(char *desc, SVC_R_START_SERVICE *r_s, prs_struct *ps, int depth) { - if (r_s == NULL) return; + if (r_s == NULL) return False; prs_debug(ps, depth, desc, "svc_io_r_start_service"); depth++; prs_uint32("status", ps, depth, &(r_s->status)); + + return True; } /******************************************************************* make_svc_query_svc_cfg ********************************************************************/ -void make_svc_query_svc_cfg(QUERY_SERVICE_CONFIG *q_u, +BOOL make_svc_query_svc_cfg(QUERY_SERVICE_CONFIG *q_u, uint32 service_type, uint32 start_type, uint32 error_control, char* bin_path_name, char* load_order_grp, @@ -232,14 +252,16 @@ void make_svc_query_svc_cfg(QUERY_SERVICE_CONFIG *q_u, make_buf_unistr2(&(q_u->uni_dependencies ), &(q_u->ptr_dependencies ), dependencies ); make_buf_unistr2(&(q_u->uni_service_start_name), &(q_u->ptr_service_start_name), service_start_name); make_buf_unistr2(&(q_u->uni_display_name ), &(q_u->ptr_display_name ), disp_name ); + + return True; } /******************************************************************* reads or writes a QUERY_SERVICE_CONFIG structure. ********************************************************************/ -void svc_io_query_svc_cfg(char *desc, QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, int depth) +BOOL svc_io_query_svc_cfg(char *desc, QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "svc_io_query_svc_cfg"); depth++; @@ -266,16 +288,18 @@ void svc_io_query_svc_cfg(char *desc, QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, prs_align(ps); smb_io_unistr2("uni_display_name ", &(q_u->uni_display_name ), q_u->ptr_display_name , ps, depth); prs_align(ps); + + return True; } /******************************************************************* makes an SVC_Q_ENUM_SVCS_STATUS structure. ********************************************************************/ -void make_svc_q_enum_svcs_status(SVC_Q_ENUM_SVCS_STATUS *q_c, POLICY_HND *hnd, +BOOL make_svc_q_enum_svcs_status(SVC_Q_ENUM_SVCS_STATUS *q_c, POLICY_HND *hnd, uint32 service_type, uint32 service_state, uint32 buf_size, uint32 resume_hnd ) { - if (q_c == NULL || hnd == NULL) return; + if (q_c == NULL || hnd == NULL) return False; DEBUG(5,("make_svc_q_enum_svcs_status\n")); @@ -284,14 +308,16 @@ void make_svc_q_enum_svcs_status(SVC_Q_ENUM_SVCS_STATUS *q_c, POLICY_HND *hnd, q_c->service_state = service_state; q_c->buf_size = buf_size; make_enum_hnd(&q_c->resume_hnd, resume_hnd); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void svc_io_q_enum_svcs_status(char *desc, SVC_Q_ENUM_SVCS_STATUS *q_u, prs_struct *ps, int depth) +BOOL svc_io_q_enum_svcs_status(char *desc, SVC_Q_ENUM_SVCS_STATUS *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "svc_io_q_enum_svcs_status"); depth++; @@ -305,17 +331,19 @@ void svc_io_q_enum_svcs_status(char *desc, SVC_Q_ENUM_SVCS_STATUS *q_u, prs_str prs_uint32("service_state", ps, depth, &(q_u->service_state)); prs_uint32("buf_size ", ps, depth, &(q_u->buf_size )); smb_io_enum_hnd("resume_hnd", &(q_u->resume_hnd), ps, depth); + + return True; } /******************************************************************* makes an SVC_R_ENUM_SVCS_STATUS structure. ********************************************************************/ -void make_svc_r_enum_svcs_status(SVC_R_ENUM_SVCS_STATUS *r_c, +BOOL make_svc_r_enum_svcs_status(SVC_R_ENUM_SVCS_STATUS *r_c, ENUM_SRVC_STATUS *svcs, uint32 more_buf_size, uint32 num_svcs, uint32 resume_hnd, uint32 dos_status) { - if (r_c == NULL) return; + if (r_c == NULL) return False; DEBUG(5,("make_svc_r_enum_svcs_status\n")); @@ -324,6 +352,8 @@ void make_svc_r_enum_svcs_status(SVC_R_ENUM_SVCS_STATUS *r_c, r_c->num_svcs = num_svcs; make_enum_hnd(&r_c->resume_hnd, resume_hnd); r_c->dos_status = dos_status; + + return True; } /******************************************************************* @@ -334,10 +364,10 @@ not COMMUNICATE and get some CONSISTENCY TO THEIR DATA STRUCTURES! ARGH! ********************************************************************/ -void svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_struct *ps, int depth) +BOOL svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_struct *ps, int depth) { int i; - if (svc == NULL) return; + if (svc == NULL) return False; prs_debug(ps, depth, desc, "svc_io_r_enum_svcs_status"); depth++; @@ -380,7 +410,7 @@ void svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_stru { DEBUG(0,("svc_io_r_enum_svcs_status: Realloc failed\n")); ps->offset = 0x7fffffff; - return; + return False; } bzero(svc->svcs, svc->num_svcs * sizeof(ENUM_SRVC_STATUS)); @@ -426,7 +456,7 @@ void svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_stru if (svc->svcs == NULL) { - return; + return False; } for (i = 0; i < svc->num_svcs; i++) @@ -482,14 +512,16 @@ void svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_stru smb_io_enum_hnd("resume_hnd", &(svc->resume_hnd), ps, depth); prs_uint32("dos_status", ps, depth, &(svc->dos_status)); } + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void svc_io_svc_status(char *desc, SVC_STATUS *svc, prs_struct *ps, int depth) +BOOL svc_io_svc_status(char *desc, SVC_STATUS *svc, prs_struct *ps, int depth) { - if (svc == NULL) return; + if (svc == NULL) return False; prs_debug(ps, depth, desc, "svc_io_svc_status"); depth++; @@ -503,28 +535,32 @@ void svc_io_svc_status(char *desc, SVC_STATUS *svc, prs_struct *ps, int depth) prs_uint32("svc_specific_exit_code", ps, depth, &(svc->svc_specific_exit_code)); prs_uint32("check_point", ps, depth, &(svc->check_point)); prs_uint32("wait_hint", ps, depth, &(svc->wait_hint)); + + return True; } /******************************************************************* makes an SVC_Q_QUERY_SVC_CONFIG structure. ********************************************************************/ -void make_svc_q_query_svc_config(SVC_Q_QUERY_SVC_CONFIG *q_c, POLICY_HND *hnd, +BOOL make_svc_q_query_svc_config(SVC_Q_QUERY_SVC_CONFIG *q_c, POLICY_HND *hnd, uint32 buf_size) { - if (q_c == NULL || hnd == NULL) return; + if (q_c == NULL || hnd == NULL) return False; DEBUG(5,("make_svc_q_query_svc_config\n")); memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); q_c->buf_size = buf_size; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void svc_io_q_query_svc_config(char *desc, SVC_Q_QUERY_SVC_CONFIG *q_u, prs_struct *ps, int depth) +BOOL svc_io_q_query_svc_config(char *desc, SVC_Q_QUERY_SVC_CONFIG *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "svc_io_q_query_svc_config"); depth++; @@ -534,29 +570,33 @@ void svc_io_q_query_svc_config(char *desc, SVC_Q_QUERY_SVC_CONFIG *q_u, prs_str smb_io_pol_hnd("", &(q_u->pol), ps, depth); prs_align(ps); prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; } /******************************************************************* makes an SVC_R_QUERY_SVC_CONFIG structure. ********************************************************************/ -void make_svc_r_query_svc_config(SVC_R_QUERY_SVC_CONFIG *r_c, +BOOL make_svc_r_query_svc_config(SVC_R_QUERY_SVC_CONFIG *r_c, QUERY_SERVICE_CONFIG *cfg, uint32 buf_size) { - if (r_c == NULL) return; + if (r_c == NULL) return False; DEBUG(5,("make_svc_r_query_svc_config\n")); r_c->cfg = cfg; r_c->buf_size = buf_size; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void svc_io_r_query_svc_config(char *desc, SVC_R_QUERY_SVC_CONFIG *r_u, prs_struct *ps, int depth) +BOOL svc_io_r_query_svc_config(char *desc, SVC_R_QUERY_SVC_CONFIG *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "svc_io_r_query_svc_config"); depth++; @@ -566,14 +606,16 @@ void svc_io_r_query_svc_config(char *desc, SVC_R_QUERY_SVC_CONFIG *r_u, prs_str svc_io_query_svc_cfg("cfg", r_u->cfg, ps, depth); prs_uint32("buf_size", ps, depth, &(r_u->buf_size)); prs_uint32("status ", ps, depth, &(r_u->status )); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void svc_io_q_query_disp_name(char *desc, SVC_Q_QUERY_DISP_NAME *q_u, prs_struct *ps, int depth) +BOOL svc_io_q_query_disp_name(char *desc, SVC_Q_QUERY_DISP_NAME *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "svc_io_q_query_disp_name"); depth++; @@ -587,17 +629,19 @@ void svc_io_q_query_disp_name(char *desc, SVC_Q_QUERY_DISP_NAME *q_u, prs_struct prs_align(ps); prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; } /******************************************************************* makes an SVC_R_QUERY_DISP_NAME structure. ********************************************************************/ -void make_svc_r_query_disp_name(SVC_R_QUERY_DISP_NAME *r_d, +BOOL make_svc_r_query_disp_name(SVC_R_QUERY_DISP_NAME *r_d, char *disp_name, uint32 status) { uint32 len = strlen(disp_name); - if (r_d == NULL) return; + if (r_d == NULL) return False; DEBUG(5,("make_svc_r_query_disp_name\n")); @@ -605,14 +649,16 @@ void make_svc_r_query_disp_name(SVC_R_QUERY_DISP_NAME *r_d, r_d->buf_size = len; r_d->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void svc_io_r_query_disp_name(char *desc, SVC_R_QUERY_DISP_NAME *r_u, prs_struct *ps, int depth) +BOOL svc_io_r_query_disp_name(char *desc, SVC_R_QUERY_DISP_NAME *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "svc_io_r_query_disp_name"); depth++; @@ -624,26 +670,30 @@ void svc_io_r_query_disp_name(char *desc, SVC_R_QUERY_DISP_NAME *r_u, prs_struct prs_uint32("buf_size", ps, depth, &(r_u->buf_size)); prs_uint32("status ", ps, depth, &(r_u->status )); + + return True; } /******************************************************************* makes an SVC_Q_CLOSE structure. ********************************************************************/ -void make_svc_q_close(SVC_Q_CLOSE *q_c, POLICY_HND *hnd) +BOOL make_svc_q_close(SVC_Q_CLOSE *q_c, POLICY_HND *hnd) { - if (q_c == NULL || hnd == NULL) return; + if (q_c == NULL || hnd == NULL) return False; DEBUG(5,("make_svc_q_close\n")); memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void svc_io_q_close(char *desc, SVC_Q_CLOSE *q_u, prs_struct *ps, int depth) +BOOL svc_io_q_close(char *desc, SVC_Q_CLOSE *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "svc_io_q_close"); depth++; @@ -652,14 +702,16 @@ void svc_io_q_close(char *desc, SVC_Q_CLOSE *q_u, prs_struct *ps, int depth) smb_io_pol_hnd("", &(q_u->pol), ps, depth); prs_align(ps); + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void svc_io_r_close(char *desc, SVC_R_CLOSE *r_u, prs_struct *ps, int depth) +BOOL svc_io_r_close(char *desc, SVC_R_CLOSE *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "svc_io_r_close"); depth++; @@ -670,5 +722,7 @@ void svc_io_r_close(char *desc, SVC_R_CLOSE *r_u, prs_struct *ps, int depth) prs_align(ps); prs_uint32("status", ps, depth, &(r_u->status)); + + return True; } diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c index 2386fa6636..91409e2eec 100644 --- a/source3/rpc_parse/parse_wks.c +++ b/source3/rpc_parse/parse_wks.c @@ -3,9 +3,9 @@ * Unix SMB/Netbios implementation. * Version 1.9. * 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 Tridgell 1992-1999, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, + * Copyright (C) Paul Ashton 1997-1999. * * 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 @@ -30,7 +30,7 @@ extern int DEBUGLEVEL; /******************************************************************* make_wks_q_query_info ********************************************************************/ -void make_wks_q_query_info(WKS_Q_QUERY_INFO *q_u, +BOOL make_wks_q_query_info(WKS_Q_QUERY_INFO *q_u, char *server, uint16 switch_value) { DEBUG(5,("make_wks_q_query_info\n")); @@ -38,14 +38,16 @@ void make_wks_q_query_info(WKS_Q_QUERY_INFO *q_u, make_buf_unistr2(&(q_u->uni_srv_name), &(q_u->ptr_srv_name), server); q_u->switch_value = switch_value; + + return True; } /******************************************************************* reads or writes a WKS_Q_QUERY_INFO structure. ********************************************************************/ -void wks_io_q_query_info(char *desc, WKS_Q_QUERY_INFO *q_u, prs_struct *ps, int depth) +BOOL wks_io_q_query_info(char *desc, WKS_Q_QUERY_INFO *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return; + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "wks_io_q_query_info"); depth++; @@ -58,12 +60,14 @@ void wks_io_q_query_info(char *desc, WKS_Q_QUERY_INFO *q_u, prs_struct *ps, int prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); prs_align(ps); + + return True; } /******************************************************************* wks_info_100 ********************************************************************/ -void make_wks_info_100(WKS_INFO_100 *inf, +BOOL make_wks_info_100(WKS_INFO_100 *inf, uint32 platform_id, uint32 ver_major, uint32 ver_minor, char *my_name, char *domain_name) { @@ -75,14 +79,16 @@ void make_wks_info_100(WKS_INFO_100 *inf, make_buf_unistr2(&(inf->uni_compname), &(inf->ptr_compname), my_name ); make_buf_unistr2(&(inf->uni_lan_grp ), &(inf->ptr_lan_grp ), domain_name); + + return True; } /******************************************************************* reads or writes a WKS_INFO_100 structure. ********************************************************************/ -static void wks_io_wks_info_100(char *desc, WKS_INFO_100 *inf, prs_struct *ps, int depth) +static BOOL wks_io_wks_info_100(char *desc, WKS_INFO_100 *inf, prs_struct *ps, int depth) { - if (inf == NULL) return; + if (inf == NULL) return False; prs_debug(ps, depth, desc, "wks_io_wks_info_100"); depth++; @@ -100,6 +106,8 @@ static void wks_io_wks_info_100(char *desc, WKS_INFO_100 *inf, prs_struct *ps, i smb_io_unistr2("", &(inf->uni_lan_grp ), inf->ptr_lan_grp , ps, depth); prs_align(ps); + + return True; } /******************************************************************* @@ -108,7 +116,7 @@ static void wks_io_wks_info_100(char *desc, WKS_INFO_100 *inf, prs_struct *ps, i only supports info level 100 at the moment. ********************************************************************/ -void make_wks_r_query_info(WKS_R_QUERY_INFO *r_u, +BOOL make_wks_r_query_info(WKS_R_QUERY_INFO *r_u, uint32 switch_value, WKS_INFO_100 *wks100, int status) { @@ -120,14 +128,16 @@ void make_wks_r_query_info(WKS_R_QUERY_INFO *r_u, r_u->wks100 = wks100; r_u->status = status; + + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -void wks_io_r_query_info(char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int depth) +BOOL wks_io_r_query_info(char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return; + if (r_u == NULL) return False; prs_debug(ps, depth, desc, "wks_io_r_query_info"); depth++; @@ -141,5 +151,7 @@ void wks_io_r_query_info(char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int wks_io_wks_info_100("inf", r_u->wks100, ps, depth); prs_uint32("status ", ps, depth, &(r_u->status)); + + return True; } -- cgit From df71b9eda72c691b163e504f71f20b50489c59cd Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 15 Oct 1999 19:20:30 +0000 Subject: renamed args due to global "class" variable (This used to be commit 7b3666f01c743ddf599d432a5bcae4408ca73865) --- source3/rpc_parse/parse_reg.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index e37fac16e9..9c6ec61716 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -164,23 +164,23 @@ static BOOL reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, creates a structure. ********************************************************************/ BOOL make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, - char *name, char *class, + char *key_name, char *key_class, SEC_ACCESS *sam_access, SEC_DESC_BUF *sec_buf, int sec_len, SEC_DESC *sec) { - int len_name = name != NULL ? strlen(name ) + 1: 0; - int len_class = class != NULL ? strlen(class) + 1: 0; + int len_name = key_name != NULL ? strlen(key_name ) + 1: 0; + int len_class = key_class != NULL ? strlen(key_class) + 1: 0; ZERO_STRUCTP(q_c); memcpy(&(q_c->pnt_pol), hnd, sizeof(q_c->pnt_pol)); make_uni_hdr(&(q_c->hdr_name), len_name); - make_unistr2(&(q_c->uni_name), name, len_name); + make_unistr2(&(q_c->uni_name), key_name, len_name); make_uni_hdr(&(q_c->hdr_class), len_class); - make_unistr2(&(q_c->uni_class), class, len_class); + make_unistr2(&(q_c->uni_class), key_class, len_class); q_c->reserved = 0x00000000; memcpy(&(q_c->sam_access), sam_access, sizeof(q_c->sam_access)); -- cgit From c941cb581b4bb4204fd32b08993e44ecc49e4455 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 15 Oct 1999 19:21:18 +0000 Subject: oops! srvinfo 2 command caught bug where strings in containers assumed to exist. not good! (This used to be commit 2af635f8b7f346d49d778dd39acb6563156e77f1) --- source3/rpc_parse/parse_srv.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 9e140bcc3e..a282da6ca3 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -56,7 +56,10 @@ static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct * prs_align(ps); smb_io_unistr2("", &(sh1->uni_netname), True, ps, depth); + prs_align(ps); smb_io_unistr2("", &(sh1->uni_remark ), True, ps, depth); + prs_align(ps); + return True; } @@ -164,19 +167,23 @@ BOOL make_srv_share_info2_str(SH_INFO_2_STR *sh2, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) +static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2_STR *ss2, SH_INFO_2 *sh2, prs_struct *ps, int depth) { - if (sh2 == NULL) return False; + if (ss2 == NULL) return False; prs_debug(ps, depth, desc, "srv_io_share_info2_str"); depth++; prs_align(ps); - smb_io_unistr2("", &(sh2->uni_netname), True, ps, depth); - smb_io_unistr2("", &(sh2->uni_remark ), True, ps, depth); - smb_io_unistr2("", &(sh2->uni_path ), True, ps, depth); - smb_io_unistr2("", &(sh2->uni_passwd ), True, ps, depth); + smb_io_unistr2("", &(ss2->uni_netname), sh2->ptr_netname, ps, depth); + prs_align(ps); + smb_io_unistr2("", &(ss2->uni_remark ), sh2->ptr_remark , ps, depth); + prs_align(ps); + smb_io_unistr2("", &(ss2->uni_path ), sh2->ptr_path , ps, depth); + prs_align(ps); + smb_io_unistr2("", &(ss2->uni_passwd ), sh2->ptr_passwd , ps, depth); + prs_align(ps); return True; } @@ -261,13 +268,13 @@ static BOOL srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_stru for (i = 0; i < num_entries; i++) { prs_grow(ps); - srv_io_share_info2("", &(ctr->info_2[i]), ps, depth); + if (!srv_io_share_info2("", &(ctr->info_2[i]), ps, depth)) return False; } for (i = 0; i < num_entries; i++) { prs_grow(ps); - srv_io_share_info2_str("", &(ctr->info_2_str[i]), ps, depth); + if (!srv_io_share_info2_str("", &(ctr->info_2_str[i]), &(ctr->info_2[i]), ps, depth)) return False; } prs_align(ps); -- cgit From 003f7364fd54ccdd190d447e275b70b0f76e95f7 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 15 Oct 1999 20:00:30 +0000 Subject: adding error checking in parsing code (This used to be commit 4c98d71ebd3f1cdaef664d46c998c864af34632a) --- source3/rpc_parse/parse_prs.c | 191 ++++++++++++++++++++++++++++++++---------- 1 file changed, 147 insertions(+), 44 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index f30a05e346..80e7eecf13 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -46,6 +46,7 @@ void prs_init(prs_struct *ps, uint32 size, ps->io = io; ps->align = align; ps->offset = 0; + ps->error = False; ps->data = NULL; mem_buf_init(&(ps->data), margin); @@ -82,7 +83,9 @@ void prs_link(prs_struct *prev, prs_struct *ps, prs_struct *next) ********************************************************************/ void prs_align(prs_struct *ps) { - int mod = ps->offset & (ps->align-1); + int mod; + if (ps->error) return; + mod = ps->offset & (ps->align-1); if (ps->align != 0 && mod != 0) { ps->offset += ps->align - mod; @@ -96,6 +99,7 @@ void prs_align(prs_struct *ps) ********************************************************************/ BOOL prs_grow(prs_struct *ps) { + if (ps->error) return False; return mem_grow_data(&(ps->data), ps->io, ps->offset, False); } @@ -105,8 +109,14 @@ BOOL prs_grow(prs_struct *ps) ********************************************************************/ BOOL _prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8) { - char *q = mem_data(&(ps->data), ps->offset); - if (q == NULL) return False; + char *q; + if (ps->error) return False; + q = mem_data(&(ps->data), ps->offset); + if (q == NULL) + { + ps->error = True; + return False; + } DBG_RW_CVAL(name, depth, ps->offset, ps->io, q, *data8) ps->offset += 1; @@ -119,8 +129,14 @@ BOOL _prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8) ********************************************************************/ BOOL _prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16) { - char *q = mem_data(&(ps->data), ps->offset); - if (q == NULL) return False; + char *q; + if (ps->error) return False; + q = mem_data(&(ps->data), ps->offset); + if (q == NULL) + { + ps->error = True; + return False; + } DBG_RW_SVAL(name, depth, ps->offset, ps->io, q, *data16) ps->offset += 2; @@ -133,8 +149,14 @@ BOOL _prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16) ********************************************************************/ BOOL _prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) { - char *q = mem_data(&(ps->data), offset); - if (q == NULL) return False; + char *q; + if (ps->error) return False; + q = mem_data(&(ps->data), ps->offset); + if (q == NULL) + { + ps->error = True; + return False; + } #ifdef DEBUG_PASSWORD DEBUG(100,("prs_hash1\n")); @@ -154,8 +176,14 @@ BOOL _prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) ********************************************************************/ BOOL _prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) { - char *q = mem_data(&(ps->data), ps->offset); - if (q == NULL) return False; + char *q; + if (ps->error) return False; + q = mem_data(&(ps->data), ps->offset); + if (q == NULL) + { + ps->error = True; + return False; + } DBG_RW_IVAL(name, depth, ps->offset, ps->io, q, *data32) ps->offset += 4; @@ -169,11 +197,19 @@ BOOL _prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) ********************************************************************/ BOOL _prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *data8s, int len) { - char *q = mem_data(&(ps->data), ps->offset); - int end_offset = ps->offset + len * sizeof(uint8); - char *e = mem_data(&(ps->data), end_offset-1); - - if (q == NULL || e == NULL) return False; + char *q; + int end_offset; + char *e; + if (ps->error) return False; + q = mem_data(&(ps->data), ps->offset); + end_offset = ps->offset + len * sizeof(uint8); + e = mem_data(&(ps->data), end_offset-1); + + if (q == NULL || e == NULL) + { + ps->error = True; + return False; + } DBG_RW_PCVAL(charmode, name, depth, ps->offset, ps->io, q, data8s, len) ps->offset = end_offset; @@ -186,11 +222,22 @@ BOOL _prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *da ********************************************************************/ BOOL _prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len) { + char *q; + int end_offset; + char *e; + if (ps->error) return False; + q = mem_data(&(ps->data), ps->offset); + end_offset = ps->offset + len * sizeof(uint8); + e = mem_data(&(ps->data), end_offset-1); char *q = mem_data(&(ps->data), ps->offset); int end_offset = ps->offset + len * sizeof(uint16); char *e = mem_data(&(ps->data), end_offset-1); - if (q == NULL || e == NULL) return False; + if (q == NULL || e == NULL) + { + ps->error = True; + return False; + } DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, data16s, len) ps->offset = end_offset; @@ -203,11 +250,19 @@ BOOL _prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 * ********************************************************************/ BOOL _prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *data32s, int len) { - char *q = mem_data(&(ps->data), ps->offset); - int end_offset = ps->offset + len * sizeof(uint32); - char *e = mem_data(&(ps->data), end_offset-1); - - if (q == NULL || e == NULL) return False; + char *q; + int end_offset; + char *e; + if (ps->error) return False; + q = mem_data(&(ps->data), ps->offset); + end_offset = ps->offset + len * sizeof(uint8); + e = mem_data(&(ps->data), end_offset-1); + + if (q == NULL || e == NULL) + { + ps->error = True; + return False; + } DBG_RW_PIVAL(charmode, name, depth, ps->offset, ps->io, q, data32s, len) ps->offset = end_offset; @@ -221,11 +276,19 @@ BOOL _prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 * ********************************************************************/ BOOL _prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 *str) { - char *q = mem_data(&(ps->data), ps->offset); - int end_offset = ps->offset + str->buf_len; - char *e = mem_data(&(ps->data), end_offset-1); - - if (q == NULL || e == NULL) return False; + char *q; + int end_offset; + char *e; + if (ps->error) return False; + q = mem_data(&(ps->data), ps->offset); + end_offset = ps->offset + len * sizeof(uint8); + e = mem_data(&(ps->data), end_offset-1); + + if (q == NULL || e == NULL) + { + ps->error = True; + return False; + } DBG_RW_PCVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->buf_len) ps->offset = end_offset; @@ -239,11 +302,19 @@ BOOL _prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 ********************************************************************/ BOOL _prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 *str) { - char *q = mem_data(&(ps->data), ps->offset); - int end_offset = ps->offset + str->str_str_len * sizeof(uint8); - char *e = mem_data(&(ps->data), end_offset-1); - - if (q == NULL || e == NULL) return False; + char *q; + int end_offset; + char *e; + if (ps->error) return False; + q = mem_data(&(ps->data), ps->offset); + end_offset = ps->offset + len * sizeof(uint8); + e = mem_data(&(ps->data), end_offset-1); + + if (q == NULL || e == NULL) + { + ps->error = True; + return False; + } DBG_RW_PCVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->str_max_len) ps->offset = end_offset; @@ -257,11 +328,19 @@ BOOL _prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 ********************************************************************/ BOOL _prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *str) { - char *q = mem_data(&(ps->data), ps->offset); - int end_offset = ps->offset + str->uni_str_len * sizeof(uint16); - char *e = mem_data(&(ps->data), end_offset-1); - - if (q == NULL || e == NULL) return False; + char *q; + int end_offset; + char *e; + if (ps->error) return False; + q = mem_data(&(ps->data), ps->offset); + end_offset = ps->offset + len * sizeof(uint8); + e = mem_data(&(ps->data), end_offset-1); + + if (q == NULL || e == NULL) + { + ps->error = True; + return False; + } DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->uni_str_len) ps->offset = end_offset; @@ -275,11 +354,19 @@ BOOL _prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 ********************************************************************/ BOOL _prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int depth) { - char *q = mem_data(&(ps->data), ps->offset); - int end_offset = ps->offset + str->uni_str_len * sizeof(uint16); - char *e = mem_data(&(ps->data), end_offset-1); - - if (q == NULL || e == NULL) return False; + char *q; + int end_offset; + char *e; + if (ps->error) return False; + q = mem_data(&(ps->data), ps->offset); + end_offset = ps->offset + len * sizeof(uint8); + e = mem_data(&(ps->data), end_offset-1); + + if (q == NULL || e == NULL) + { + ps->error = True; + return False; + } DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->str.buffer, str->uni_str_len) ps->offset = end_offset; @@ -293,14 +380,20 @@ BOOL _prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int d BOOL _prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) { int i = -1; - uint8 *start = (uint8*)mem_data(&(ps->data), ps->offset); + uint8 *start; + if (ps->error) return False; + start = (uint8*)mem_data(&(ps->data), ps->offset); do { char *q; i++; q = mem_data(&(ps->data), ps->offset + i*2); - if (q == NULL) return False; + if (q == NULL) + { + ps->error = True; + return False; + } RW_SVAL(ps->io, q, str->buffer[i],0); } while ((i < sizeof(str->buffer) / sizeof(str->buffer[0])) && @@ -324,8 +417,10 @@ BOOL _prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) ********************************************************************/ BOOL _prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, uint16 max_buf_size) { - uint8 *start = (uint8*)mem_data(&(ps->data), ps->offset); int i = -1; /* start off at zero after 1st i++ */ + uint8 *start; + if (ps->error) return False; + start = (uint8*)mem_data(&(ps->data), ps->offset); do { @@ -333,7 +428,11 @@ BOOL _prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, u i++; q = mem_data(&(ps->data), ps->offset + i); - if (q == NULL) return False; + if (q == NULL) + { + ps->error = True; + return False; + } if (i < len || len == 0) { @@ -360,6 +459,7 @@ BOOL _prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, u ********************************************************************/ BOOL _prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset) { + if (ps->error) return False; (*offset) = ps->offset; if (ps->io) { @@ -380,6 +480,7 @@ BOOL _prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint BOOL _prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 ptr_uint16, uint32 start_offset) { + if (ps->error) return False; if (!ps->io) { /* storing: go back and do a retrospective job. i hate this */ @@ -403,6 +504,7 @@ BOOL _prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, ********************************************************************/ BOOL _prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset) { + if (ps->error) return False; (*offset) = ps->offset; if (ps->io) { @@ -423,6 +525,7 @@ BOOL _prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint BOOL _prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 ptr_uint32, uint32 data_size) { + if (ps->error) return False; if (!ps->io) { /* storing: go back and do a retrospective job. i hate this */ -- cgit From 63fa96e2168a98ead5e595134346650eece1c94e Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 15 Oct 1999 20:10:46 +0000 Subject: added prs_struct "error" member, set and checked when prs_struct data is handled. (This used to be commit b4ba49c5c114764247802bd8b0a6dbc0a7f5c2a1) --- source3/rpc_parse/parse_prs.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 80e7eecf13..c50b1d1567 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -227,11 +227,8 @@ BOOL _prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 * char *e; if (ps->error) return False; q = mem_data(&(ps->data), ps->offset); - end_offset = ps->offset + len * sizeof(uint8); + end_offset = ps->offset + len * sizeof(uint16); e = mem_data(&(ps->data), end_offset-1); - char *q = mem_data(&(ps->data), ps->offset); - int end_offset = ps->offset + len * sizeof(uint16); - char *e = mem_data(&(ps->data), end_offset-1); if (q == NULL || e == NULL) { @@ -255,7 +252,7 @@ BOOL _prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 * char *e; if (ps->error) return False; q = mem_data(&(ps->data), ps->offset); - end_offset = ps->offset + len * sizeof(uint8); + end_offset = ps->offset + len * sizeof(uint32); e = mem_data(&(ps->data), end_offset-1); if (q == NULL || e == NULL) @@ -281,7 +278,7 @@ BOOL _prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 char *e; if (ps->error) return False; q = mem_data(&(ps->data), ps->offset); - end_offset = ps->offset + len * sizeof(uint8); + end_offset = ps->offset + str->buf_len; e = mem_data(&(ps->data), end_offset-1); if (q == NULL || e == NULL) @@ -307,7 +304,7 @@ BOOL _prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 char *e; if (ps->error) return False; q = mem_data(&(ps->data), ps->offset); - end_offset = ps->offset + len * sizeof(uint8); + end_offset = ps->offset + str->str_str_len * sizeof(uint8); e = mem_data(&(ps->data), end_offset-1); if (q == NULL || e == NULL) @@ -333,7 +330,7 @@ BOOL _prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 char *e; if (ps->error) return False; q = mem_data(&(ps->data), ps->offset); - end_offset = ps->offset + len * sizeof(uint8); + end_offset = ps->offset + str->uni_str_len * sizeof(uint16); e = mem_data(&(ps->data), end_offset-1); if (q == NULL || e == NULL) @@ -359,7 +356,7 @@ BOOL _prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int d char *e; if (ps->error) return False; q = mem_data(&(ps->data), ps->offset); - end_offset = ps->offset + len * sizeof(uint8); + end_offset = ps->offset + str->uni_str_len * sizeof(uint16); e = mem_data(&(ps->data), end_offset-1); if (q == NULL || e == NULL) -- cgit From c05be7037b15b65706c047b33800a866df9a3005 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 18 Oct 1999 16:26:55 +0000 Subject: initialising enum dom users mem and account name ptrs to NULL. (This used to be commit 6f933fb359e7efc7b685e537b95bdadd6e131727) --- source3/rpc_parse/parse_samr.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 7dae0702cd..d98c429fb1 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1278,6 +1278,9 @@ BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct prs_debug(ps, depth, desc, "samr_io_r_enum_dom_users"); depth++; + r_u->sam = NULL; + r_u->uni_acct_name = NULL; + prs_align(ps); prs_uint32("next_idx ", ps, depth, &(r_u->next_idx )); -- cgit From 87d92a1f1182a6b4e4dbe91d7f574c7ac8aecb21 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 19 Oct 1999 19:55:43 +0000 Subject: need status codes from cli_net_req_chal() and cli_net_auth2(). this format is what i would like _all_ these functions to be (returning status codes, not BOOL) but that's a horrendous amount of work at the moment :) (This used to be commit 02f240604241367f146b26934ad1a1b2563430de) --- source3/rpc_parse/parse_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index e2073d00f1..9614af9b51 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -371,7 +371,7 @@ BOOL net_io_q_trust_dom(char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, makes an NET_Q_REQ_CHAL structure. ********************************************************************/ BOOL make_q_req_chal(NET_Q_REQ_CHAL *q_c, - char *logon_srv, char *logon_clnt, + const char *logon_srv, const char *logon_clnt, DOM_CHAL *clnt_chal) { if (q_c == NULL) return False; -- cgit From 6f9105c853020fde1691a28cd707d6d3f6561b4d Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 21 Oct 1999 16:53:50 +0000 Subject: various. debug levels changed. nmbd doesn't need libsmb/clienttrust.c. samr_lookup_rids() moved to a dynamic memory structure not a static one limited to 32 RIDs. cli_pipe.c reading wasn't checking ERRmoredata when DOS error codes negotiated (this terminates MSRPC code with prejudice). (This used to be commit 8976eca2db43576c32069dcda017e8777048e007) --- source3/rpc_parse/parse_samr.c | 86 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 77 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index d98c429fb1..f0c16469c5 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3388,7 +3388,6 @@ BOOL make_samr_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u, POLICY_HND *pol, uint32 flags, uint32 num_rids, uint32 *rid) { - int i; if (q_u == NULL) return False; DEBUG(5,("make_samr_r_unknwon_12\n")); @@ -3399,11 +3398,7 @@ BOOL make_samr_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u, q_u->flags = flags; q_u->ptr = 0; q_u->num_rids2 = num_rids; - - for (i = 0; i < num_rids; i++) - { - q_u->rid[i] = rid[i]; - } + q_u->rid = rid; return True; } @@ -3468,7 +3463,25 @@ BOOL make_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u, r_u->ptr_types = 1; r_u->num_types2 = num_names; - SMB_ASSERT_ARRAY(r_u->hdr_name, num_names); + r_u->hdr_name = malloc(num_names * sizeof(r_u->hdr_name[0])); + if (r_u->hdr_name == NULL) + { + return False; + } + r_u->uni_name = malloc(num_names * sizeof(r_u->uni_name[0])); + if (r_u->uni_name == NULL) + { + free(r_u->hdr_name); + return False; + } + r_u->type = malloc(r_u->num_types2 * sizeof(r_u->type[0])); + if (r_u->type == NULL) + { + free(r_u->hdr_name); + free(r_u->uni_name); + return False; + } + for (i = 0; i < num_names; i++) { @@ -3497,7 +3510,7 @@ BOOL make_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, int depth) { int i; fstring tmp; @@ -3514,8 +3527,20 @@ BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, if (r_u->ptr_names != 0 && r_u->num_names1 != 0) { - SMB_ASSERT_ARRAY(r_u->hdr_name, r_u->num_names2); + r_u->hdr_name = Realloc(r_u->hdr_name, r_u->num_names2 * + sizeof(r_u->hdr_name[0])); + if (r_u->hdr_name == NULL) + { + return False; + } + r_u->uni_name = Realloc(r_u->uni_name, r_u->num_names2 * + sizeof(r_u->uni_name[0])); + if (r_u->uni_name == NULL) + { + free(r_u->hdr_name); + return False; + } for (i = 0; i < r_u->num_names2; i++) { prs_grow(ps); @@ -3538,6 +3563,21 @@ BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, if (r_u->ptr_types != 0 && r_u->num_types1 != 0) { + r_u->type = Realloc(r_u->type, r_u->num_types2 * + sizeof(r_u->type[0])); + if (r_u->type == NULL) + { + if (r_u->uni_name != NULL) + { + free(r_u->uni_name); + } + if (r_u->hdr_name != NULL) + { + free(r_u->hdr_name); + } + return False; + } + for (i = 0; i < r_u->num_types2; i++) { prs_grow(ps); @@ -3548,9 +3588,37 @@ BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, prs_uint32("status", ps, depth, &(r_u->status)); + if (!ps->io) + { + /* storing. don't need memory any more */ + samr_free_r_lookup_rids(r_u); + } + return True; } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void samr_free_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u) +{ + if (r_u->uni_name != NULL) + { + free(r_u->uni_name); + r_u->uni_name = NULL; + } + if (r_u->hdr_name != NULL) + { + free(r_u->hdr_name); + r_u->hdr_name = NULL; + } + if (r_u->type != NULL) + { + free(r_u->type); + r_u->type = NULL; + } +} + /******************************************************************* makes a SAMR_Q_OPEN_ALIAS structure. ********************************************************************/ -- cgit From 52fed795e156b9db8a0f29d9087042ccdec093f5 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 21 Oct 1999 18:25:12 +0000 Subject: turning some of the rpcclient functions dynamic. this is likely to break a few things... (This used to be commit 4b06f303235d36903b6e9f55ee45b987d98256b0) --- source3/rpc_parse/parse_lsa.c | 2 +- source3/rpc_parse/parse_samr.c | 120 ++++++++++++++++++++++++++++++++--------- 2 files changed, 95 insertions(+), 27 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 1f194aa874..4053da0721 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -906,7 +906,7 @@ BOOL lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, i makes a structure. ********************************************************************/ BOOL make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, - int num_names, const char **names) + int num_names, char **names) { int i; if (q_l == NULL) return False; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index f0c16469c5..9b5ed1d294 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2689,6 +2689,12 @@ BOOL samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_s { prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + r_u->gid = malloc(r_u->num_entries2 * sizeof(r_u->gid[0])); + if (r_u->gid == NULL) + { + return False; + } + for (i = 0; i < r_u->num_entries2; i++) { prs_grow(ps); @@ -3193,7 +3199,7 @@ makes a SAMR_Q_QUERY_USERALIASES structure. ********************************************************************/ BOOL make_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u, POLICY_HND *hnd, - DOM_SID *sid) + uint32 *ptr_sid, DOM_SID2 *sid) { if (q_u == NULL || hnd == NULL) return False; @@ -3205,10 +3211,8 @@ BOOL make_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u, q_u->ptr = 1; q_u->num_sids2 = 1; - { - q_u->ptr_sid[0] = 1; - make_dom_sid2(&q_u->sid[0], sid); - } + q_u->ptr_sid = ptr_sid; + q_u->sid = sid; return True; } @@ -3235,7 +3239,24 @@ BOOL samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES *q_u, prs prs_uint32("ptr ", ps, depth, &(q_u->ptr )); prs_uint32("num_sids2", ps, depth, &(q_u->num_sids2)); - SMB_ASSERT_ARRAY(q_u->ptr_sid, q_u->num_sids2); + if (q_u->num_sids2 != 0) + { + q_u->ptr_sid = Realloc(q_u->ptr_sid, sizeof(q_u->ptr_sid[0]) * + q_u->num_sids2); + if (q_u->ptr_sid == NULL) + { + samr_free_q_query_useraliases(q_u); + return False; + } + + q_u->sid = Realloc(q_u->sid, + sizeof(q_u->sid[0]) * q_u->num_sids2); + if (q_u->sid == NULL) + { + samr_free_q_query_useraliases(q_u); + return False; + } + } for (i = 0; i < q_u->num_sids2; i++) { @@ -3255,9 +3276,31 @@ BOOL samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES *q_u, prs prs_align(ps); + if (!ps->io) + { + /* storing. memory no longer needed */ + samr_free_q_query_useraliases(q_u); + } return True; } +/******************************************************************* +frees memory in a SAMR_Q_QUERY_USERALIASES structure. +********************************************************************/ +void samr_free_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u) +{ + if (q_u->ptr_sid == NULL) + { + free(q_u->ptr_sid); + q_u->ptr_sid = NULL; + } + + if (q_u->sid == NULL) + { + free(q_u->sid); + q_u->sid = NULL; + } +} /******************************************************************* makes a SAMR_R_QUERY_USERALIASES structure. @@ -3309,6 +3352,14 @@ BOOL samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs if (r_u->num_entries != 0) { + r_u->rid = Realloc(r_u->rid, + sizeof(r_u->rid[0]) * r_u->num_entries); + if (r_u->rid == NULL) + { + samr_free_r_query_useraliases(r_u); + return False; + } + for (i = 0; i < r_u->num_entries2; i++) { slprintf(tmp, sizeof(tmp)-1, "rid[%02d]", i); @@ -3318,9 +3369,26 @@ BOOL samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs prs_uint32("status", ps, depth, &(r_u->status)); + if (!ps->io) + { + /* storing. memory no longer needed */ + samr_free_r_query_useraliases(r_u); + } return True; } +/******************************************************************* +frees memory in a SAMR_R_QUERY_USERALIASES structure. +********************************************************************/ +void samr_free_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u) +{ + if (r_u->rid == NULL) + { + free(r_u->rid); + r_u->rid = NULL; + } +} + /******************************************************************* makes a SAMR_Q_OPEN_ALIAS structure. ********************************************************************/ @@ -3426,8 +3494,6 @@ BOOL samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS *q_u, prs_struct *ps, prs_uint32("ptr ", ps, depth, &(q_u->ptr )); prs_uint32("num_rids2", ps, depth, &(q_u->num_rids2)); - SMB_ASSERT_ARRAY(q_u->rid, q_u->num_rids2); - for (i = 0; i < q_u->num_rids2; i++) { prs_grow(ps); @@ -3463,26 +3529,28 @@ BOOL make_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u, r_u->ptr_types = 1; r_u->num_types2 = num_names; - r_u->hdr_name = malloc(num_names * sizeof(r_u->hdr_name[0])); - if (r_u->hdr_name == NULL) - { - return False; - } - r_u->uni_name = malloc(num_names * sizeof(r_u->uni_name[0])); - if (r_u->uni_name == NULL) - { - free(r_u->hdr_name); - return False; - } - r_u->type = malloc(r_u->num_types2 * sizeof(r_u->type[0])); - if (r_u->type == NULL) + if (num_names != 0) { - free(r_u->hdr_name); - free(r_u->uni_name); - return False; + r_u->hdr_name = malloc(num_names * sizeof(r_u->hdr_name[0])); + if (r_u->hdr_name == NULL) + { + samr_free_r_lookup_rids(r_u); + return False; + } + r_u->uni_name = malloc(num_names * sizeof(r_u->uni_name[0])); + if (r_u->uni_name == NULL) + { + samr_free_r_lookup_rids(r_u); + return False; + } + r_u->type = malloc(r_u->num_types2 * sizeof(r_u->type[0])); + if (r_u->type == NULL) + { + samr_free_r_lookup_rids(r_u); + return False; + } } - for (i = 0; i < num_names; i++) { int len = name[i] != NULL ? strlen(name[i]) : 0; @@ -4037,7 +4105,7 @@ makes a SAMR_Q_LOOKUP_NAMES structure. ********************************************************************/ BOOL make_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES *q_u, POLICY_HND *pol, uint32 flags, - uint32 num_names, const char **name) + uint32 num_names, char **name) { int i; if (q_u == NULL) return False; -- cgit From 45b794bdde0cb906216425c8fc2af8610aa8ad3c Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 21 Oct 1999 19:02:57 +0000 Subject: the dynamic memory alloc blood-fest goes on... (This used to be commit 134b20e2a7b5ddfa4cc9bf100de5025c7b98f594) --- source3/rpc_parse/parse_samr.c | 77 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 9b5ed1d294..69c7599a98 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2576,6 +2576,17 @@ BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struc if (r_u->ptr_rids != 0) { prs_uint32("num_rids", ps, depth, &(r_u->num_rids)); + if (r_u->num_rids != 0) + { + r_u->rid = Realloc(r_u->rid, + sizeof(r_u->rid[0]) * + r_u->num_rids); + if (r_u->rid == NULL) + { + samr_free_r_query_groupmem(r_u); + return False; + } + } for (i = 0; i < r_u->num_rids; i++) { prs_grow(ps); @@ -2586,6 +2597,18 @@ BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struc if (r_u->ptr_attrs != 0) { prs_uint32("num_attrs", ps, depth, &(r_u->num_attrs)); + + if (r_u->num_attrs != 0) + { + r_u->attr = Realloc(r_u->attr, + sizeof(r_u->attr[0]) * + r_u->num_attrs); + if (r_u->attr == NULL) + { + samr_free_r_query_groupmem(r_u); + return False; + } + } for (i = 0; i < r_u->num_attrs; i++) { prs_grow(ps); @@ -2596,10 +2619,33 @@ BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struc prs_uint32("status", ps, depth, &(r_u->status)); + if (!ps->io) + { + /* storing. memory no longer needed */ + samr_free_r_query_groupmem(r_u); + } + return True; } +/******************************************************************* +frees a structure. +********************************************************************/ +void samr_free_r_query_groupmem(SAMR_R_QUERY_GROUPMEM *r_u) +{ + if (r_u->rid != NULL) + { + free(r_u->rid); + r_u->rid = NULL; + } + if (r_u->attr != NULL) + { + free(r_u->attr); + r_u->attr = NULL; + } +} + /******************************************************************* makes a SAMR_Q_QUERY_USERGROUPS structure. ********************************************************************/ @@ -3494,6 +3540,17 @@ BOOL samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS *q_u, prs_struct *ps, prs_uint32("ptr ", ps, depth, &(q_u->ptr )); prs_uint32("num_rids2", ps, depth, &(q_u->num_rids2)); + if (q_u->num_rids2 != 0) + { + q_u->rid = Realloc(q_u->rid, sizeof(q_u->rid[0]) * + q_u->num_rids2); + if (q_u->rid == NULL) + { + samr_free_q_lookup_rids(q_u); + return False; + } + } + for (i = 0; i < q_u->num_rids2; i++) { prs_grow(ps); @@ -3503,9 +3560,27 @@ BOOL samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS *q_u, prs_struct *ps, prs_align(ps); + if (!ps->io) + { + /* storing. don't need memory any more */ + samr_free_q_lookup_rids(q_u); + } + return True; } +/******************************************************************* +frees a structure. +********************************************************************/ +void samr_free_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u) +{ + if (q_u->rid != NULL) + { + free(q_u->rid); + q_u->rid = NULL; + } +} + /******************************************************************* makes a SAMR_R_LOOKUP_RIDS structure. @@ -3666,7 +3741,7 @@ BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, } /******************************************************************* -reads or writes a structure. +frees a structure. ********************************************************************/ void samr_free_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u) { -- cgit From 8e1f542ddf97fef925a88e2c3d9c1e82fb2f6683 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 25 Oct 1999 16:22:08 +0000 Subject: one of those wonderful moments when running against a different MSRPC implementation (NT5) when you discover that your code is trash. samr_enum_dom_users(), samr_enum_dom_aliases() and samr_enum_dom_groups() all take a HANDLE for multiple-call enumeration purposes. (This used to be commit 19490d8b4fb8a103f3df4e6104f6f22937b0c518) --- source3/rpc_parse/parse_samr.c | 60 ++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 28 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 69c7599a98..073e0c7577 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2757,7 +2757,8 @@ BOOL samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_s /******************************************************************* makes a SAMR_Q_ENUM_DOM_GROUPS structure. ********************************************************************/ -BOOL make_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol, uint32 size) +BOOL make_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol, + uint32 start_idx, uint32 size) { if (q_e == NULL || pol == NULL) return False; @@ -2765,7 +2766,7 @@ BOOL make_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol, u memcpy(&(q_e->pol), pol, sizeof(*pol)); - q_e->unknown_0 = 0; + q_e->start_idx = start_idx; q_e->max_size = size; return True; @@ -2787,7 +2788,7 @@ BOOL samr_io_q_enum_dom_groups(char *desc, SAMR_Q_ENUM_DOM_GROUPS *q_e, prs_stru smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); prs_align(ps); - prs_uint32("unknown_0", ps, depth, &(q_e->unknown_0)); + prs_uint32("start_idx", ps, depth, &(q_e->start_idx)); prs_uint32("max_size ", ps, depth, &(q_e->max_size )); prs_align(ps); @@ -2800,6 +2801,7 @@ BOOL samr_io_q_enum_dom_groups(char *desc, SAMR_Q_ENUM_DOM_GROUPS *q_e, prs_stru makes a SAMR_R_ENUM_DOM_GROUPS structure. ********************************************************************/ BOOL make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, + uint32 next_idx, uint32 num_sam_entries, DOMAIN_GRP *grps, uint32 status) { @@ -2816,12 +2818,12 @@ BOOL make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, num_sam_entries)); } - r_u->num_entries = num_sam_entries; + r_u->next_idx = next_idx; + r_u->ptr_entries1 = 1; + r_u->num_entries2 = num_sam_entries; if (num_sam_entries > 0) { - r_u->ptr_entries = 1; - r_u->num_entries2 = num_sam_entries; r_u->ptr_entries2 = 1; r_u->num_entries3 = num_sam_entries; @@ -2842,7 +2844,7 @@ BOOL make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, } else { - r_u->ptr_entries = 0; + r_u->num_entries4 = 0; } r_u->status = status; @@ -2864,23 +2866,23 @@ BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_stru prs_align(ps); - prs_uint32("num_entries", ps, depth, &(r_u->num_entries)); - prs_uint32("ptr_entries", ps, depth, &(r_u->ptr_entries)); + prs_uint32("next_idx ", ps, depth, &(r_u->next_idx )); + prs_uint32("ptr_entries1", ps, depth, &(r_u->ptr_entries1)); + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); - if (r_u->num_entries != 0 && r_u->ptr_entries != 0) + if (r_u->num_entries2 != 0 && r_u->ptr_entries1 != 0) { - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); - SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries); + SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries2); - for (i = 0; i < r_u->num_entries; i++) + for (i = 0; i < r_u->num_entries2; i++) { sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); } - for (i = 0; i < r_u->num_entries; i++) + for (i = 0; i < r_u->num_entries2; i++) { smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); } @@ -2898,7 +2900,8 @@ BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_stru /******************************************************************* makes a SAMR_Q_ENUM_DOM_ALIASES structure. ********************************************************************/ -BOOL make_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_e, POLICY_HND *pol, uint32 size) +BOOL make_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_e, POLICY_HND *pol, + uint32 start_idx, uint32 size) { if (q_e == NULL || pol == NULL) return False; @@ -2906,7 +2909,7 @@ BOOL make_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_e, POLICY_HND *pol, memcpy(&(q_e->pol), pol, sizeof(*pol)); - q_e->unknown_0 = 0; + q_e->start_idx = start_idx; q_e->max_size = size; return True; @@ -2928,7 +2931,7 @@ BOOL samr_io_q_enum_dom_aliases(char *desc, SAMR_Q_ENUM_DOM_ALIASES *q_e, prs_s smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); prs_align(ps); - prs_uint32("unknown_0", ps, depth, &(q_e->unknown_0)); + prs_uint32("start_idx", ps, depth, &(q_e->start_idx)); prs_uint32("max_size ", ps, depth, &(q_e->max_size )); prs_align(ps); @@ -2941,6 +2944,7 @@ BOOL samr_io_q_enum_dom_aliases(char *desc, SAMR_Q_ENUM_DOM_ALIASES *q_e, prs_s makes a SAMR_R_ENUM_DOM_ALIASES structure. ********************************************************************/ BOOL make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, + uint32 next_idx, uint32 num_sam_entries, LOCAL_GRP *alss, uint32 status) { @@ -2957,12 +2961,12 @@ BOOL make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, num_sam_entries)); } - r_u->num_entries = num_sam_entries; + r_u->next_idx = next_idx; + r_u->ptr_entries1 = 1; + r_u->num_entries2 = num_sam_entries; if (num_sam_entries > 0) { - r_u->ptr_entries = 1; - r_u->num_entries2 = num_sam_entries; r_u->ptr_entries2 = 1; r_u->num_entries3 = num_sam_entries; @@ -2983,7 +2987,7 @@ BOOL make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, } else { - r_u->ptr_entries = 0; + r_u->num_entries4 = 0; } r_u->status = status; @@ -3005,23 +3009,23 @@ BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_s prs_align(ps); - prs_uint32("num_entries", ps, depth, &(r_u->num_entries)); - prs_uint32("ptr_entries", ps, depth, &(r_u->ptr_entries)); + prs_uint32("next_idx ", ps, depth, &(r_u->next_idx )); + prs_uint32("ptr_entries1", ps, depth, &(r_u->ptr_entries1)); + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); - if (r_u->num_entries != 0 && r_u->ptr_entries != 0) + if (r_u->num_entries2 != 0 && r_u->ptr_entries1 != 0) { - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); - SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries); + SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries2); - for (i = 0; i < r_u->num_entries; i++) + for (i = 0; i < r_u->num_entries2; i++) { sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); } - for (i = 0; i < r_u->num_entries; i++) + for (i = 0; i < r_u->num_entries2; i++) { smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); } -- cgit From fdf6383cbec457e3e38b50bcc801661767fa4c0d Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 25 Oct 1999 17:10:54 +0000 Subject: signed / unsigned and typecast issues (This used to be commit 6e22bf912cb981d91834c63098d41f5f8abaa594) --- source3/rpc_parse/parse_samr.c | 110 +++++++++++++++++++++-------------------- 1 file changed, 56 insertions(+), 54 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 073e0c7577..e111484676 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -726,7 +726,7 @@ reads or writes a SAM_SID_STUFF structure. ********************************************************************/ static BOOL sam_io_sid_stuff(char *desc, SAM_SID_STUFF *stf, prs_struct *ps, int depth) { - int i; + uint32 i; if (stf == NULL) return False; @@ -1217,7 +1217,7 @@ BOOL make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, uint32 next_idx, uint32 num_sam_entries, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES], uint32 status) { - int i; + uint32 i; if (r_u == NULL) return False; @@ -1234,8 +1234,8 @@ BOOL make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, r_u->num_entries2 = num_sam_entries; r_u->num_entries3 = num_sam_entries; - r_u->sam = Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); - r_u->uni_acct_name = Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_acct_name[0])); + r_u->sam = (SAM_ENTRY*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); + r_u->uni_acct_name = (UNISTR2*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_acct_name[0])); if (r_u->sam == NULL || r_u->uni_acct_name == NULL) { @@ -1271,7 +1271,7 @@ reads or writes a structure. ********************************************************************/ BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct *ps, int depth) { - int i; + uint32 i; if (r_u == NULL) return False; @@ -1294,8 +1294,8 @@ BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct if (ps->io) { - r_u->sam = Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); - r_u->uni_acct_name = Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_acct_name[0])); + r_u->sam = (SAM_ENTRY*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); + r_u->uni_acct_name = (UNISTR2*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_acct_name[0])); } if ((r_u->sam == NULL || r_u->uni_acct_name == NULL) && r_u->num_entries2 != 0) @@ -1386,7 +1386,7 @@ BOOL make_sam_dispinfo_1(SAM_DISPINFO_1 *sam, uint32 *num_entries, uint32 len_sam_name, len_sam_full, len_sam_desc; uint32 max_entries, max_data_size; uint32 dsize = 0; - int i; + uint32 i; if (sam == NULL || num_entries == NULL || data_size == NULL) return False; @@ -1424,7 +1424,7 @@ reads or writes a structure. ********************************************************************/ static BOOL sam_io_sam_dispinfo_1(char *desc, SAM_DISPINFO_1 *sam, uint32 num_entries, prs_struct *ps, int depth) { - int i; + uint32 i; if (sam == NULL) return False; @@ -1465,7 +1465,7 @@ BOOL make_sam_dispinfo_2(SAM_DISPINFO_2 *sam, uint32 *num_entries, uint32 len_sam_name, len_sam_desc; uint32 max_entries, max_data_size; uint32 dsize = 0; - int i; + uint32 i; if (sam == NULL || num_entries == NULL || data_size == NULL) return False; @@ -1501,7 +1501,7 @@ reads or writes a structure. ********************************************************************/ static BOOL sam_io_sam_dispinfo_2(char *desc, SAM_DISPINFO_2 *sam, uint32 num_entries, prs_struct *ps, int depth) { - int i; + uint32 i; if (sam == NULL) return False; @@ -1541,7 +1541,7 @@ BOOL make_sam_dispinfo_3(SAM_DISPINFO_3 *sam, uint32 *num_entries, uint32 len_sam_name, len_sam_desc; uint32 max_entries, max_data_size; uint32 dsize = 0; - int i; + uint32 i; if (sam == NULL || num_entries == NULL || data_size == NULL) return False; @@ -1575,9 +1575,9 @@ BOOL make_sam_dispinfo_3(SAM_DISPINFO_3 *sam, uint32 *num_entries, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_3(char *desc, SAM_DISPINFO_3 *sam, int num_entries, prs_struct *ps, int depth) +static BOOL sam_io_sam_dispinfo_3(char *desc, SAM_DISPINFO_3 *sam, uint32 num_entries, prs_struct *ps, int depth) { - int i; + uint32 i; if (sam == NULL) return False; @@ -1618,7 +1618,7 @@ BOOL make_sam_dispinfo_4(SAM_DISPINFO_4 *sam, uint32 *num_entries, uint32 len_sam_name; uint32 max_entries, max_data_size; uint32 dsize = 0; - int i; + uint32 i; if (sam == NULL || num_entries == NULL || data_size == NULL) return False; @@ -1650,9 +1650,9 @@ BOOL make_sam_dispinfo_4(SAM_DISPINFO_4 *sam, uint32 *num_entries, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 *sam, int num_entries, prs_struct *ps, int depth) +static BOOL sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 *sam, uint32 num_entries, prs_struct *ps, int depth) { - int i; + uint32 i; if (sam == NULL) return False; @@ -1690,7 +1690,7 @@ BOOL make_sam_dispinfo_5(SAM_DISPINFO_5 *sam, uint32 *num_entries, uint32 len_sam_name; uint32 max_entries, max_data_size; uint32 dsize = 0; - int i; + uint32 i; if (sam == NULL || num_entries == NULL || data_size == NULL) return False; @@ -1722,9 +1722,9 @@ BOOL make_sam_dispinfo_5(SAM_DISPINFO_5 *sam, uint32 *num_entries, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_5(char *desc, SAM_DISPINFO_5 *sam, int num_entries, prs_struct *ps, int depth) +static BOOL sam_io_sam_dispinfo_5(char *desc, SAM_DISPINFO_5 *sam, uint32 num_entries, prs_struct *ps, int depth) { - int i; + uint32 i; if (sam == NULL) return False; @@ -2556,7 +2556,7 @@ reads or writes a structure. ********************************************************************/ BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struct *ps, int depth) { - int i; + uint32 i; if (r_u == NULL) return False; @@ -2578,7 +2578,7 @@ BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struc prs_uint32("num_rids", ps, depth, &(r_u->num_rids)); if (r_u->num_rids != 0) { - r_u->rid = Realloc(r_u->rid, + r_u->rid = (uint32*)Realloc(r_u->rid, sizeof(r_u->rid[0]) * r_u->num_rids); if (r_u->rid == NULL) @@ -2600,7 +2600,7 @@ BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struc if (r_u->num_attrs != 0) { - r_u->attr = Realloc(r_u->attr, + r_u->attr = (uint32*)Realloc(r_u->attr, sizeof(r_u->attr[0]) * r_u->num_attrs); if (r_u->attr == NULL) @@ -2716,7 +2716,7 @@ reads or writes a structure. ********************************************************************/ BOOL samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_struct *ps, int depth) { - int i; + uint32 i; if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_query_usergroups"); @@ -2735,7 +2735,7 @@ BOOL samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_s { prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); - r_u->gid = malloc(r_u->num_entries2 * sizeof(r_u->gid[0])); + r_u->gid = (DOM_GID*)malloc(r_u->num_entries2 * sizeof(r_u->gid[0])); if (r_u->gid == NULL) { return False; @@ -2805,7 +2805,7 @@ BOOL make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, uint32 num_sam_entries, DOMAIN_GRP *grps, uint32 status) { - int i; + uint32 i; if (r_u == NULL) return False; @@ -2857,7 +2857,7 @@ reads or writes a structure. ********************************************************************/ BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_struct *ps, int depth) { - int i; + uint32 i; if (r_u == NULL) return False; @@ -2948,7 +2948,7 @@ BOOL make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, uint32 num_sam_entries, LOCAL_GRP *alss, uint32 status) { - int i; + uint32 i; if (r_u == NULL) return False; @@ -3000,7 +3000,7 @@ reads or writes a structure. ********************************************************************/ BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_struct *ps, int depth) { - int i; + uint32 i; if (r_u == NULL) return False; @@ -3273,7 +3273,7 @@ reads or writes a SAMR_Q_QUERY_USERALIASES structure. BOOL samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES *q_u, prs_struct *ps, int depth) { fstring tmp; - int i; + uint32 i; if (q_u == NULL) return False; @@ -3291,15 +3291,15 @@ BOOL samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES *q_u, prs if (q_u->num_sids2 != 0) { - q_u->ptr_sid = Realloc(q_u->ptr_sid, sizeof(q_u->ptr_sid[0]) * - q_u->num_sids2); + q_u->ptr_sid = (uint32*)Realloc(q_u->ptr_sid, + sizeof(q_u->ptr_sid[0]) * q_u->num_sids2); if (q_u->ptr_sid == NULL) { samr_free_q_query_useraliases(q_u); return False; } - q_u->sid = Realloc(q_u->sid, + q_u->sid = (DOM_SID2*)Realloc(q_u->sid, sizeof(q_u->sid[0]) * q_u->num_sids2); if (q_u->sid == NULL) { @@ -3388,7 +3388,7 @@ reads or writes a structure. BOOL samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs_struct *ps, int depth) { fstring tmp; - int i; + uint32 i; if (r_u == NULL) return False; prs_debug(ps, depth, desc, "samr_io_r_query_useraliases"); @@ -3402,7 +3402,7 @@ BOOL samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs if (r_u->num_entries != 0) { - r_u->rid = Realloc(r_u->rid, + r_u->rid = (uint32*)Realloc(r_u->rid, sizeof(r_u->rid[0]) * r_u->num_entries); if (r_u->rid == NULL) { @@ -3526,7 +3526,7 @@ reads or writes a structure. ********************************************************************/ BOOL samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS *q_u, prs_struct *ps, int depth) { - int i; + uint32 i; fstring tmp; if (q_u == NULL) return False; @@ -3546,7 +3546,7 @@ BOOL samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS *q_u, prs_struct *ps, if (q_u->num_rids2 != 0) { - q_u->rid = Realloc(q_u->rid, sizeof(q_u->rid[0]) * + q_u->rid = (uint32*)Realloc(q_u->rid, sizeof(q_u->rid[0]) * q_u->num_rids2); if (q_u->rid == NULL) { @@ -3593,7 +3593,7 @@ BOOL make_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u, uint32 num_names, fstring *name, uint8 *type, uint32 status) { - int i; + uint32 i; if (r_u == NULL || name == NULL || type == NULL) return False; DEBUG(5,("make_samr_r_lookup_rids\n")); @@ -3610,19 +3610,19 @@ BOOL make_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u, if (num_names != 0) { - r_u->hdr_name = malloc(num_names * sizeof(r_u->hdr_name[0])); + r_u->hdr_name = (UNIHDR*)malloc(num_names * sizeof(r_u->hdr_name[0])); if (r_u->hdr_name == NULL) { samr_free_r_lookup_rids(r_u); return False; } - r_u->uni_name = malloc(num_names * sizeof(r_u->uni_name[0])); + r_u->uni_name = (UNISTR2*)malloc(num_names * sizeof(r_u->uni_name[0])); if (r_u->uni_name == NULL) { samr_free_r_lookup_rids(r_u); return False; } - r_u->type = malloc(r_u->num_types2 * sizeof(r_u->type[0])); + r_u->type = (uint32*)malloc(r_u->num_types2 * sizeof(r_u->type[0])); if (r_u->type == NULL) { samr_free_r_lookup_rids(r_u); @@ -3659,7 +3659,7 @@ reads or writes a structure. ********************************************************************/ BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, int depth) { - int i; + uint32 i; fstring tmp; if (r_u == NULL) return False; @@ -3674,15 +3674,15 @@ BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, if (r_u->ptr_names != 0 && r_u->num_names1 != 0) { - r_u->hdr_name = Realloc(r_u->hdr_name, r_u->num_names2 * - sizeof(r_u->hdr_name[0])); + r_u->hdr_name = (UNIHDR*)Realloc(r_u->hdr_name, + r_u->num_names2 * sizeof(r_u->hdr_name[0])); if (r_u->hdr_name == NULL) { return False; } - r_u->uni_name = Realloc(r_u->uni_name, r_u->num_names2 * - sizeof(r_u->uni_name[0])); + r_u->uni_name = (UNISTR2*)Realloc(r_u->uni_name, + r_u->num_names2 * sizeof(r_u->uni_name[0])); if (r_u->uni_name == NULL) { free(r_u->hdr_name); @@ -3710,7 +3710,7 @@ BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, if (r_u->ptr_types != 0 && r_u->num_types1 != 0) { - r_u->type = Realloc(r_u->type, r_u->num_types2 * + r_u->type = (uint32*)Realloc(r_u->type, r_u->num_types2 * sizeof(r_u->type[0])); if (r_u->type == NULL) { @@ -4137,7 +4137,7 @@ reads or writes a structure. ********************************************************************/ BOOL samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM *r_u, prs_struct *ps, int depth) { - int i; + uint32 i; uint32 ptr_sid[MAX_LOOKUP_SIDS]; if (r_u == NULL) return False; @@ -4186,7 +4186,7 @@ BOOL make_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES *q_u, POLICY_HND *pol, uint32 flags, uint32 num_names, char **name) { - int i; + uint32 i; if (q_u == NULL) return False; DEBUG(5,("make_samr_q_lookup_names\n")); @@ -4214,7 +4214,7 @@ reads or writes a structure. ********************************************************************/ BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *ps, int depth) { - int i; + uint32 i; if (q_u == NULL) return False; @@ -4256,7 +4256,7 @@ makes a SAMR_R_LOOKUP_NAMES structure. BOOL make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, uint32 num_rids, uint32 *rid, uint8 *type, uint32 status) { - int i; + uint32 i; if (r_u == NULL) return False; DEBUG(5,("make_samr_r_lookup_names\n")); @@ -4300,7 +4300,7 @@ reads or writes a structure. ********************************************************************/ BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *ps, int depth) { - int i; + uint32 i; fstring tmp; if (r_u == NULL) return False; @@ -5355,7 +5355,8 @@ BOOL samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO *q_u, prs_struct *ps } case 24: { - q_u->info.id = Realloc(NULL, sizeof(*q_u->info.id24)); + q_u->info.id = (SAM_USER_INFO_24*)Realloc(NULL, + sizeof(*q_u->info.id24)); if (q_u->info.id == NULL) { DEBUG(2,("samr_io_q_query_userinfo: info pointer not initialised\n")); @@ -5366,7 +5367,8 @@ BOOL samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO *q_u, prs_struct *ps } case 23: { - q_u->info.id = Realloc(NULL, sizeof(*q_u->info.id23)); + q_u->info.id = (SAM_USER_INFO_23*)Realloc(NULL, + sizeof(*q_u->info.id23)); if (q_u->info.id == NULL) { DEBUG(2,("samr_io_q_query_userinfo: info pointer not initialised\n")); -- cgit From 56128244261f8e4c6e1144da66c736fbc2104665 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 25 Oct 1999 19:03:27 +0000 Subject: - typecast malloc / Realloc issues. - signed / unsigned issues. (This used to be commit c8fd555179314baf1672a23db34dc8ad9f2d02bf) --- source3/rpc_parse/parse_lsa.c | 18 ++++++++-------- source3/rpc_parse/parse_misc.c | 7 +++--- source3/rpc_parse/parse_net.c | 16 +++++++------- source3/rpc_parse/parse_prs.c | 4 ++-- source3/rpc_parse/parse_sec.c | 14 ++++++------ source3/rpc_parse/parse_srv.c | 49 +++++++++++++++++++++--------------------- source3/rpc_parse/parse_svc.c | 7 +++--- 7 files changed, 59 insertions(+), 56 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 4053da0721..dbc110a55a 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -66,7 +66,7 @@ reads or writes a DOM_R_REF structure. ********************************************************************/ static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) { - int i, s, n; + uint32 i, s, n; prs_debug(ps, depth, desc, "smb_io_dom_r_ref"); depth++; @@ -716,9 +716,9 @@ BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int dept /******************************************************************* makes a LSA_SID_ENUM structure. ********************************************************************/ -BOOL make_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID **sids) +BOOL make_lsa_sid_enum(LSA_SID_ENUM *sen, uint32 num_entries, DOM_SID **sids) { - int i, i2; + uint32 i, i2; if (sen == NULL || sids == NULL) return False; DEBUG(5,("make_lsa_sid_enum\n")); @@ -752,7 +752,7 @@ reads or writes a LSA_SID_ENUM structure. static BOOL lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) { - int i; + uint32 i; if (sen == NULL) return False; @@ -792,7 +792,7 @@ reads or writes a structure. static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth) { - int i; + uint32 i; if (trn == NULL) return False; @@ -906,9 +906,9 @@ BOOL lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, i makes a structure. ********************************************************************/ BOOL make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, - int num_names, char **names) + uint32 num_names, char **names) { - int i; + uint32 i; if (q_l == NULL) return False; DEBUG(5,("make_q_lookup_names\n")); @@ -941,7 +941,7 @@ reads or writes a structure. ********************************************************************/ BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth) { - int i; + uint32 i; if (q_r == NULL) return False; @@ -981,7 +981,7 @@ reads or writes a structure. ********************************************************************/ BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth) { - int i; + uint32 i; if (r_r == NULL) return False; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 31dc252187..5e83cfeaf3 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -489,7 +489,7 @@ BOOL make_buffer3_uint32(BUFFER3 *str, uint32 val) /******************************************************************* creates a BUFFER3 structure. ********************************************************************/ -BOOL make_buffer3_str(BUFFER3 *str, char *buf, int len) +BOOL make_buffer3_str(BUFFER3 *str, const char *buf, int len) { ZERO_STRUCTP(str); @@ -498,7 +498,7 @@ BOOL make_buffer3_str(BUFFER3 *str, char *buf, int len) str->buf_len = len * 2; /* store the string (little endian buffer) */ - ascii_to_unibuf(str->buffer, buf, str->buf_len); + ascii_to_unibuf((char*)str->buffer, buf, str->buf_len); return True; } @@ -665,7 +665,8 @@ BOOL make_buffer2(BUFFER2 *str, const char *buf, int len) str->undoc = 0; /* store the string */ - ascii_to_unibuf(str->buffer, buf, MIN(str->buf_len, sizeof(str->buffer)-1)); + ascii_to_unibuf((char*)str->buffer, buf, + MIN(str->buf_len, sizeof(str->buffer)-1)); return True; } diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 9614af9b51..790556e8c2 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -296,7 +296,7 @@ makes an NET_R_TRUST_DOM_LIST structure. BOOL make_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, uint32 num_doms, char *dom_name) { - int i = 0; + uint32 i = 0; if (r_t == NULL) return False; @@ -329,7 +329,7 @@ reads or writes an NET_R_TRUST_DOM_LIST structure. ********************************************************************/ BOOL net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth) { - int i; + uint32 i; if (r_t == NULL) return False; prs_debug(ps, depth, desc, "net_io_r_trust_dom"); @@ -939,7 +939,7 @@ BOOL make_net_user_info3(NET_USER_INFO_3 *usr, { /* only cope with one "other" sid, right now. */ /* need to count the number of space-delimited sids */ - int i; + uint32 i; int num_other_sids = 0; int len_user_name = strlen(user_name ); @@ -1029,7 +1029,7 @@ reads or writes a structure. ********************************************************************/ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth) { - int i; + uint32 i; if (usr == NULL) return False; @@ -1440,7 +1440,7 @@ static BOOL net_io_sam_account_info(char *desc, uint8 sess_key[16], SAM_ACCOUNT_INFO *info, prs_struct *ps, int depth) { BUFHDR2 hdr_priv_data; - int i; + uint32 i; if (info == NULL) return False; @@ -1567,7 +1567,7 @@ reads or writes a structure. ********************************************************************/ static BOOL net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_struct *ps, int depth) { - int i; + uint32 i; fstring tmp; if (info == NULL) return False; @@ -1653,7 +1653,7 @@ reads or writes a structure. ********************************************************************/ static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_struct *ps, int depth) { - int i; + uint32 i; fstring tmp; if (info == NULL) return False; @@ -1767,7 +1767,7 @@ reads or writes a structure. BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16], NET_R_SAM_SYNC *r_s, prs_struct *ps, int depth) { - int i; + uint32 i; if (r_s == NULL) return False; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index c50b1d1567..bf4efbe527 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -163,7 +163,7 @@ BOOL _prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) dump_data(100, sess_key, 16); dump_data(100, q, 68); #endif - SamOEMhash(q, sess_key, 2); + SamOEMhash((uchar*)q, sess_key, 2); #ifdef DEBUG_PASSWORD dump_data(100, q, 68); #endif @@ -393,7 +393,7 @@ BOOL _prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) } RW_SVAL(ps->io, q, str->buffer[i],0); } - while ((i < sizeof(str->buffer) / sizeof(str->buffer[0])) && + while ((((size_t)i) < sizeof(str->buffer) / sizeof(str->buffer[0])) && (str->buffer[i] != 0)); diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index c7d4d09612..161e42c9ff 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -138,7 +138,7 @@ first of the xx_io_xx functions that allocates its data structures ********************************************************************/ BOOL sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) { - int i; + uint32 i; uint32 old_offset; uint32 offset_acl_size; @@ -158,7 +158,7 @@ BOOL sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) if (ps->io && t->num_aces != 0) { /* reading */ - t->ace = malloc(sizeof(t->ace[0]) * t->num_aces); + t->ace = (SEC_ACE*)malloc(sizeof(t->ace[0]) * t->num_aces); ZERO_STRUCTP(t->ace); } @@ -328,7 +328,7 @@ static BOOL sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) if (ps->io) { /* reading */ - t->dacl = malloc(sizeof(*t->dacl)); + t->dacl = (SEC_ACL*)malloc(sizeof(*t->dacl)); ZERO_STRUCTP(t->dacl); } @@ -360,7 +360,7 @@ static BOOL sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) if (ps->io) { /* reading */ - t->sacl = malloc(sizeof(*t->sacl)); + t->sacl = (SEC_ACL*)malloc(sizeof(*t->sacl)); ZERO_STRUCTP(t->sacl); } @@ -395,7 +395,7 @@ static BOOL sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) if (ps->io) { /* reading */ - t->owner_sid = malloc(sizeof(*t->owner_sid)); + t->owner_sid = (DOM_SID*)malloc(sizeof(*t->owner_sid)); ZERO_STRUCTP(t->owner_sid); } @@ -425,7 +425,7 @@ static BOOL sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) if (ps->io) { /* reading */ - t->grp_sid = malloc(sizeof(*t->grp_sid)); + t->grp_sid = (DOM_SID*)malloc(sizeof(*t->grp_sid)); ZERO_STRUCTP(t->grp_sid); } @@ -502,7 +502,7 @@ BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) if (sec->len != 0 && ps->io) { /* reading */ - sec->sec = malloc(sizeof(*sec->sec)); + sec->sec = (SEC_DESC*)malloc(sizeof(*sec->sec)); ZERO_STRUCTP(sec->sec); if (sec->sec == NULL) diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index a282da6ca3..9890e0106d 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -116,8 +116,8 @@ static BOOL srv_io_srv_share_info_1(char *desc, SRV_SHARE_INFO_1 *ctr, prs_stru if (ctr->ptr_share_info != 0) { - int i; - int num_entries = ctr->num_entries_read; + uint32 i; + uint32 num_entries = ctr->num_entries_read; if (num_entries > MAX_SHARE_ENTRIES) { num_entries = MAX_SHARE_ENTRIES; /* report this! */ @@ -150,7 +150,7 @@ static BOOL srv_io_srv_share_info_1(char *desc, SRV_SHARE_INFO_1 *ctr, prs_stru ********************************************************************/ BOOL make_srv_share_info2_str(SH_INFO_2_STR *sh2, char *net_name, char *remark, - char *path, char *passwd) + char *path, char *pass) { if (sh2 == NULL) return False; @@ -159,7 +159,7 @@ BOOL make_srv_share_info2_str(SH_INFO_2_STR *sh2, make_unistr2(&(sh2->uni_netname), net_name, strlen(net_name)+1); make_unistr2(&(sh2->uni_remark ), remark , strlen(remark )+1); make_unistr2(&(sh2->uni_path ), path , strlen(path )+1); - make_unistr2(&(sh2->uni_passwd ), passwd , strlen(passwd )+1); + make_unistr2(&(sh2->uni_passwd ), pass , strlen(pass )+1); return True; } @@ -194,7 +194,7 @@ static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2_STR *ss2, SH_INFO_2 *s BOOL make_srv_share_info2(SH_INFO_2 *sh2, char *net_name, uint32 type, char *remark, uint32 perms, uint32 max_uses, uint32 num_uses, - char *path, char *passwd) + char *path, char *pass) { if (sh2 == NULL) return False; @@ -208,7 +208,7 @@ BOOL make_srv_share_info2(SH_INFO_2 *sh2, sh2->num_uses = num_uses; sh2->type = type; sh2->ptr_path = path != NULL ? 1 : 0; - sh2->ptr_passwd = passwd != NULL ? 1 : 0; + sh2->ptr_passwd = pass != NULL ? 1 : 0; return True; } @@ -254,8 +254,8 @@ static BOOL srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_stru if (ctr->ptr_share_info != 0) { - int i; - int num_entries = ctr->num_entries_read; + uint32 i; + uint32 num_entries = ctr->num_entries_read; if (num_entries > MAX_SHARE_ENTRIES) { num_entries = MAX_SHARE_ENTRIES; /* report this! */ @@ -368,7 +368,7 @@ BOOL srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct prs_uint32("share_level", ps, depth, &(q_n->share_level )); - if (q_n->share_level != -1) + if (((int)q_n->share_level) != -1) { srv_io_srv_share_ctr("share_ctr", q_n->ctr, ps, depth); } @@ -485,8 +485,8 @@ static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct if (ss0->ptr_sess_info != 0) { - int i; - int num_entries = ss0->num_entries_read; + uint32 i; + uint32 num_entries = ss0->num_entries_read; if (num_entries > MAX_SESS_ENTRIES) { num_entries = MAX_SESS_ENTRIES; /* report this! */ @@ -610,8 +610,8 @@ static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct if (ss1->ptr_sess_info != 0) { - int i; - int num_entries = ss1->num_entries_read; + uint32 i; + uint32 num_entries = ss1->num_entries_read; if (num_entries > MAX_SESS_ENTRIES) { num_entries = MAX_SESS_ENTRIES; /* report this! */ @@ -735,7 +735,7 @@ BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *p prs_uint32("sess_level", ps, depth, &(q_n->sess_level )); - if (q_n->sess_level != -1) + if (((int)q_n->sess_level) != -1) { srv_io_srv_sess_ctr("sess_ctr", q_n->ctr, ps, depth); } @@ -761,7 +761,7 @@ BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *p prs_uint32("sess_level", ps, depth, &(r_n->sess_level)); - if (r_n->sess_level != -1) + if (((int)r_n->sess_level) != -1) { srv_io_srv_sess_ctr("sess_ctr", r_n->ctr, ps, depth); } @@ -821,8 +821,8 @@ static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct if (ss0->ptr_conn_info != 0) { - int i; - int num_entries = ss0->num_entries_read; + uint32 i; + uint32 num_entries = ss0->num_entries_read; if (num_entries > MAX_CONN_ENTRIES) { num_entries = MAX_CONN_ENTRIES; /* report this! */ @@ -940,8 +940,8 @@ static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct if (ss1->ptr_conn_info != 0) { - int i; - int num_entries = ss1->num_entries_read; + uint32 i; + uint32 num_entries = ss1->num_entries_read; if (num_entries > MAX_CONN_ENTRIES) { num_entries = MAX_CONN_ENTRIES; /* report this! */ @@ -1058,7 +1058,7 @@ BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *p prs_uint32("conn_level", ps, depth, &(q_n->conn_level )); - if (q_n->conn_level != -1) + if (((int)q_n->conn_level) != -1) { srv_io_srv_conn_ctr("conn_ctr", q_n->ctr, ps, depth); } @@ -1084,7 +1084,7 @@ BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *p prs_uint32("conn_level", ps, depth, &(r_n->conn_level)); - if (r_n->conn_level != -1) + if (((int)r_n->conn_level) != -1) { srv_io_srv_conn_ctr("conn_ctr", r_n->ctr, ps, depth); } @@ -1187,8 +1187,9 @@ static BOOL srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct prs_uint32("ptr_file_fl3", ps, depth, &(fl3->ptr_file_info)); if (fl3->ptr_file_info != 0) { - int i; - int num_entries = fl3->num_entries_read; + uint32 i; + uint32 num_entries = fl3->num_entries_read; + if (num_entries > MAX_FILE_ENTRIES) { num_entries = MAX_FILE_ENTRIES; /* report this! */ @@ -1302,7 +1303,7 @@ BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *p prs_uint32("file_id ", ps, depth, &(q_n->file_id )); prs_uint32("file_level", ps, depth, &(q_n->file_level)); - if (q_n->file_level != -1) + if (((int)q_n->file_level) != -1) { srv_io_srv_file_ctr("file_ctr", q_n->ctr, ps, depth); } diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c index 955d8df595..6b1155a90b 100644 --- a/source3/rpc_parse/parse_svc.c +++ b/source3/rpc_parse/parse_svc.c @@ -197,7 +197,7 @@ BOOL svc_io_q_start_service(char *desc, SVC_Q_START_SERVICE *q_s, prs_struct *ps if (q_s->ptr_argv != 0) { - int i; + uint32 i; prs_uint32("argc2 ", ps, depth, &(q_s->argc2)); @@ -366,7 +366,7 @@ ARGH! ********************************************************************/ BOOL svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_struct *ps, int depth) { - int i; + uint32 i; if (svc == NULL) return False; prs_debug(ps, depth, desc, "svc_io_r_enum_svcs_status"); @@ -404,7 +404,8 @@ BOOL svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_stru new_offset = ps->offset; ps->offset = buf_offset; - svc->svcs = Realloc(NULL, svc->num_svcs * sizeof(ENUM_SRVC_STATUS)); + svc->svcs = (ENUM_SRVC_STATUS*)Realloc(NULL, + svc->num_svcs * sizeof(ENUM_SRVC_STATUS)); if (svc->svcs == NULL) { -- cgit From 3d096e1b8f5a253b61cbfa6155b0a16a5394c847 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 29 Oct 1999 16:24:11 +0000 Subject: added HKEY_CLASSES_ROOT MSRPC open call. reg_open_hkcr etc. supported in rpcclient, regenum HKEY_CLASSES_ROOT or regenum HKCR to test. (This used to be commit b0aa933ef4c0b58840430cf3b3cb3cbeb5c7f704) --- source3/rpc_parse/parse_reg.c | 58 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 9c6ec61716..01776974fd 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -27,6 +27,64 @@ extern int DEBUGLEVEL; +/******************************************************************* +creates a structure. +********************************************************************/ +BOOL make_reg_q_open_hkcr(REG_Q_OPEN_HKCR *q_o, + uint16 unknown_0, uint32 level) +{ + q_o->ptr = 1; + q_o->unknown_0 = unknown_0; + q_o->unknown_1 = 0x0; /* random - changes */ + q_o->level = level; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL reg_io_q_open_hkcr(char *desc, REG_Q_OPEN_HKCR *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) return False; + + prs_debug(ps, depth, desc, "reg_io_q_open_hkcr"); + depth++; + + prs_align(ps); + + prs_uint32("ptr ", ps, depth, &(r_q->ptr )); + if (r_q->ptr != 0) + { + prs_uint16("unknown_0", ps, depth, &(r_q->unknown_0)); + prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1)); + prs_uint32("level ", ps, depth, &(r_q->level )); + } + + return True; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL reg_io_r_open_hkcr(char *desc, REG_R_OPEN_HKCR *r_r, prs_struct *ps, int depth) +{ + if (r_r == NULL) return False; + + prs_debug(ps, depth, desc, "reg_io_r_open_hkcr"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_r->pol), ps, depth); + + prs_uint32("status", ps, depth, &(r_r->status)); + + return True; +} + + /******************************************************************* creates a structure. ********************************************************************/ -- cgit From d0fd259514a4cc4e7ec2b021ff68fe0e3fd1bf09 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 29 Oct 1999 17:37:27 +0000 Subject: more reshuffling of enum groups code. more higher order functions. (This used to be commit 497d4231723576390b10f5ea8704bd0af88d76ab) --- source3/rpc_parse/parse_samr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index e111484676..74386e7f99 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1904,7 +1904,8 @@ BOOL samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP *r_u, prs_struct *ps, i makes a GROUP_INFO1 structure. ********************************************************************/ BOOL make_samr_group_info1(GROUP_INFO1 *gr1, - char *acct_name, char *acct_desc) + char *acct_name, char *acct_desc, + uint32 num_members) { int desc_len = acct_desc != NULL ? strlen(acct_desc) : 0; int acct_len = acct_name != NULL ? strlen(acct_name) : 0; @@ -1915,7 +1916,7 @@ BOOL make_samr_group_info1(GROUP_INFO1 *gr1, make_uni_hdr(&(gr1->hdr_acct_name), acct_len); gr1->unknown_1 = 0x3; - gr1->unknown_2 = 0x3; + gr1->num_members = num_members; make_uni_hdr(&(gr1->hdr_acct_desc), desc_len); @@ -1941,7 +1942,7 @@ BOOL samr_io_group_info1(char *desc, GROUP_INFO1 *gr1, prs_struct *ps, int dept smb_io_unihdr ("hdr_acct_name", &(gr1->hdr_acct_name) , ps, depth); prs_uint32("unknown_1", ps, depth, &(gr1->unknown_1)); - prs_uint32("unknown_2", ps, depth, &(gr1->unknown_2)); + prs_uint32("num_members", ps, depth, &(gr1->num_members)); smb_io_unihdr ("hdr_acct_desc", &(gr1->hdr_acct_desc) , ps, depth); -- cgit From 4cda1d2b4faaf9a3abeb338e909a52f8b51fd89d Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 30 Oct 1999 22:34:38 +0000 Subject: NetServerTransportEnum parsing, client-side and rpcclient "srvtransports" added. (This used to be commit 37f4aac06fec3fbb34ed40d1010829b2e1f28558) --- source3/rpc_parse/parse_lsa.c | 4 +- source3/rpc_parse/parse_misc.c | 16 +++ source3/rpc_parse/parse_srv.c | 278 +++++++++++++++++++++++++++++++++++++++-- 3 files changed, 285 insertions(+), 13 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index dbc110a55a..9f8c7d6403 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -540,11 +540,11 @@ BOOL make_q_query_secret(LSA_Q_QUERY_SECRET *q_q, POLICY_HND *pol) memcpy(&(q_q->pol), pol, sizeof(q_q->pol)); /* Want secret */ - q_q->info.ptr_value = 1; + q_q->info.ptr_value = 0; q_q->info.value.ptr_secret = 0; /* Want last change time */ - q_q->info.ptr_update = 1; + q_q->info.ptr_update = 0; /* Don't care about old info */ q_q->oldinfo.ptr_value = 0; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 5e83cfeaf3..69455b7b42 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -557,6 +557,22 @@ BOOL smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) return True; } +/******************************************************************* +creates a BUFFER4 structure. +********************************************************************/ +BOOL make_buffer4_str(BUFFER4 *str, const char *buf, int len) +{ + ZERO_STRUCTP(str); + + /* set up string lengths. */ + str->buf_len = len * 2; + + /* store the string (little endian buffer) */ + ascii_to_unibuf((char*)str->buffer, buf, str->buf_len); + + return True; +} + /******************************************************************* reads or writes a BUFFER4 structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 9890e0106d..c27f58ac26 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -423,7 +423,8 @@ BOOL make_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name) /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth) +static BOOL srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, +const SESS_INFO_0 *si0, prs_struct *ps, int depth) { if (ss0 == NULL) return False; @@ -432,7 +433,7 @@ static BOOL srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct prs_align(ps); - smb_io_unistr2("", &(ss0->uni_name), True, ps, depth); + smb_io_unistr2("", &(ss0->uni_name), si0->ptr_name, ps, depth); return True; } @@ -505,7 +506,9 @@ static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct for (i = 0; i < num_entries; i++) { prs_grow(ps); - srv_io_sess_info0_str("", &(ss0->info_0_str[i]), ps, depth); + srv_io_sess_info0_str("", &(ss0->info_0_str[i]), + &(ss0->info_0[i]), + ps, depth); } prs_align(ps); @@ -532,7 +535,9 @@ BOOL make_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user) /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth) +static BOOL srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, + SESS_INFO_1 *si1, + prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -541,8 +546,8 @@ static BOOL srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct prs_align(ps); - smb_io_unistr2("", &(ss1->uni_name), True, ps, depth); - smb_io_unistr2("", &(ss1->uni_user), True, ps, depth); + smb_io_unistr2("", &(ss1->uni_name), si1->ptr_name, ps, depth); + smb_io_unistr2("", &(ss1->uni_user), si1->ptr_user, ps, depth); return True; } @@ -630,7 +635,9 @@ static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct for (i = 0; i < num_entries; i++) { prs_grow(ps); - srv_io_sess_info1_str("", &(ss1->info_1_str[i]), ps, depth); + srv_io_sess_info1_str("", &(ss1->info_1_str[i]), + &(ss1->info_1[i]), + ps, depth); } prs_align(ps); @@ -860,7 +867,8 @@ BOOL make_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_nam /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth) +static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, + CONN_INFO_1 *ci1, prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -869,8 +877,8 @@ static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct prs_align(ps); - smb_io_unistr2("", &(ss1->uni_usr_name), True, ps, depth); - smb_io_unistr2("", &(ss1->uni_net_name), True, ps, depth); + smb_io_unistr2("", &(ss1->uni_usr_name), ci1->ptr_usr_name, ps, depth); + smb_io_unistr2("", &(ss1->uni_net_name), ci1->ptr_net_name, ps, depth); return True; } @@ -958,7 +966,9 @@ static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct for (i = 0; i < num_entries; i++) { prs_grow(ps); - srv_io_conn_info1_str("", &(ss1->info_1_str[i]), ps, depth); + srv_io_conn_info1_str("", &(ss1->info_1_str[i]), + &(ss1->info_1[i]), + ps, depth); } prs_align(ps); @@ -1096,6 +1106,252 @@ BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *p return True; } +/******************************************************************* + makes a TPRT_INFO_0_STR structure +********************************************************************/ +BOOL make_srv_tprt_info0_str(TPRT_INFO_0_STR *tp0, + char *trans_name, + char *trans_addr, uint32 trans_addr_len, + char *addr_name) +{ + if (tp0 == NULL) return False; + + DEBUG(5,("make_srv_tprt_info0_str\n")); + + make_unistr2(&(tp0->uni_trans_name), trans_name, strlen(trans_name)+1); + make_buffer4_str(&(tp0->buf_trans_addr), trans_addr, trans_addr_len); + make_unistr2(&(tp0->uni_addr_name ), addr_name, strlen(addr_name)+1); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL srv_io_tprt_info0_str(char *desc, TPRT_INFO_0_STR *tp0, + TPRT_INFO_0 *ti0, + prs_struct *ps, int depth) +{ + if (tp0 == NULL) return False; + + prs_debug(ps, depth, desc, "srv_io_tprt_info0_str"); + depth++; + + prs_align(ps); + + smb_io_unistr2("", &(tp0->uni_trans_name), ti0->ptr_trans_name, ps, depth); + smb_io_buffer4("", &(tp0->buf_trans_addr), ti0->ptr_trans_addr, ps, depth); + smb_io_unistr2("", &(tp0->uni_addr_name ), ti0->ptr_addr_name, ps, depth); + + return True; +} + +/******************************************************************* + makes a TPRT_INFO_0 structure +********************************************************************/ +BOOL make_srv_tprt_info0(TPRT_INFO_0 *tp0, + uint32 num_vcs, uint32 trans_addr_len, + char *trans_name, char *trans_addr, + char *addr_name) +{ + if (tp0 == NULL) return False; + + DEBUG(5,("make_srv_tprt_info0: %s %s\n", trans_name, addr_name)); + + tp0->num_vcs = num_vcs; + tp0->ptr_trans_name = trans_name != NULL ? 1 : 0; + tp0->ptr_trans_addr = trans_addr != NULL ? 1 : 0; + tp0->trans_addr_len = trans_addr_len; + tp0->ptr_addr_name = addr_name != NULL ? 1 : 0; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL srv_io_tprt_info0(char *desc, TPRT_INFO_0 *tp0, prs_struct *ps, int depth) +{ + if (tp0 == NULL) return False; + + prs_debug(ps, depth, desc, "srv_io_tprt_info0"); + depth++; + + prs_align(ps); + + prs_uint32("num_vcs ", ps, depth, &(tp0->num_vcs )); + prs_uint32("ptr_trans_name", ps, depth, &(tp0->ptr_trans_name)); + prs_uint32("ptr_trans_addr", ps, depth, &(tp0->ptr_trans_addr)); + prs_uint32("trans_addr_len", ps, depth, &(tp0->trans_addr_len)); + prs_uint32("ptr_addr_name ", ps, depth, &(tp0->ptr_addr_name )); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL srv_io_srv_tprt_info_0(char *desc, SRV_TPRT_INFO_0 *tp0, prs_struct *ps, int depth) +{ + if (tp0 == NULL) return False; + + prs_debug(ps, depth, desc, "srv_io_srv_tprt_info_0"); + depth++; + + prs_align(ps); + + prs_uint32("num_entries_read", ps, depth, &(tp0->num_entries_read)); + prs_uint32("ptr_tprt_info", ps, depth, &(tp0->ptr_tprt_info)); + + if (tp0->ptr_tprt_info != 0) + { + uint32 i; + uint32 num_entries = tp0->num_entries_read; + if (num_entries > MAX_TPRT_ENTRIES) + { + num_entries = MAX_TPRT_ENTRIES; /* report this! */ + } + + prs_uint32("num_entries_read2", ps, depth, &(tp0->num_entries_read2)); + + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + srv_io_tprt_info0("", &(tp0->info_0[i]), ps, depth); + } + + for (i = 0; i < num_entries; i++) + { + prs_grow(ps); + srv_io_tprt_info0_str("", &(tp0->info_0_str[i]), + &(tp0->info_0[i]), + ps, depth); + } + + prs_align(ps); + } + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL srv_io_srv_tprt_ctr(char *desc, SRV_TPRT_INFO_CTR *ctr, prs_struct *ps, int depth) +{ + if (ctr == NULL) return False; + + prs_debug(ps, depth, desc, "srv_io_srv_tprt_ctr"); + depth++; + + prs_align(ps); + + prs_uint32("switch_value", ps, depth, &(ctr->switch_value)); + prs_uint32("ptr_tprt_ctr", ps, depth, &(ctr->ptr_tprt_ctr)); + + if (ctr->ptr_tprt_ctr != 0) + { + switch (ctr->switch_value) + { + case 0: + { + srv_io_srv_tprt_info_0("", &(ctr->tprt.info0), ps, depth); + break; + } + default: + { + DEBUG(5,("%s no transport info at switch_value %d\n", + tab_depth(depth), ctr->switch_value)); + break; + } + } + } + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL make_srv_q_net_tprt_enum(SRV_Q_NET_TPRT_ENUM *q_n, + char *srv_name, + uint32 tprt_level, SRV_TPRT_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd) +{ + if (q_n == NULL || ctr == NULL || hnd == NULL) return False; + + q_n->ctr = ctr; + + DEBUG(5,("make_q_net_tprt_enum\n")); + + make_buf_unistr2(&(q_n->uni_srv_name ), &(q_n->ptr_srv_name ), srv_name ); + + q_n->tprt_level = tprt_level; + q_n->preferred_len = preferred_len; + + memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL srv_io_q_net_tprt_enum(char *desc, SRV_Q_NET_TPRT_ENUM *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_tprt_enum"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name)); + smb_io_unistr2("", &(q_n->uni_srv_name), q_n->ptr_srv_name, ps, depth); + + prs_align(ps); + + prs_uint32("tprt_level", ps, depth, &(q_n->tprt_level )); + + if (((int)q_n->tprt_level) != -1) + { + srv_io_srv_tprt_ctr("tprt_ctr", q_n->ctr, ps, depth); + } + + prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len)); + + smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL srv_io_r_net_tprt_enum(char *desc, SRV_R_NET_TPRT_ENUM *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_tprt_enum"); + depth++; + + prs_align(ps); + + prs_uint32("tprt_level", ps, depth, &(r_n->tprt_level)); + + if (((int)r_n->tprt_level) != -1) + { + srv_io_srv_tprt_ctr("tprt_ctr", r_n->ctr, ps, depth); + } + + prs_uint32("total_entries", ps, depth, &(r_n->total_entries)); + smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); + prs_uint32("status ", ps, depth, &(r_n->status)); + + return True; +} + /******************************************************************* makes a FILE_INFO_3_STR structure ********************************************************************/ -- cgit From dbda98047df356cb854176982db156971d19466a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 31 Oct 1999 04:11:17 +0000 Subject: added svcinfo command. (This used to be commit c243231d8596a732aba69179ff8f3882e7118297) --- source3/rpc_parse/parse_svc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c index 6b1155a90b..43594329b5 100644 --- a/source3/rpc_parse/parse_svc.c +++ b/source3/rpc_parse/parse_svc.c @@ -108,7 +108,7 @@ BOOL svc_io_r_open_sc_man(char *desc, SVC_R_OPEN_SC_MAN *r_u, prs_struct *ps, i ********************************************************************/ BOOL make_svc_q_open_service(SVC_Q_OPEN_SERVICE *q_u, POLICY_HND *hnd, - char *server, + const char *server, uint32 des_access) { DEBUG(5,("make_svc_q_open_service\n")); @@ -209,6 +209,7 @@ BOOL svc_io_q_start_service(char *desc, SVC_Q_START_SERVICE *q_s, prs_struct *ps for (i = 0; i < q_s->argc2; i++) { smb_io_unistr2("", &(q_s->argv[i]), 1, ps, depth); + prs_align(ps); } } @@ -396,6 +397,8 @@ BOOL svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_stru buf_offset = ps->offset; ps->offset = buf_offset + svc->buf_size; + prs_align(ps); + prs_uint32("more_buf_size", ps, depth, &(svc->more_buf_size)); prs_uint32("num_svcs", ps, depth, &(svc->num_svcs)); smb_io_enum_hnd("resume_hnd", &(svc->resume_hnd), ps, depth); @@ -508,6 +511,8 @@ BOOL svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_stru ps->offset = srvc_offset; + prs_align(ps); + prs_uint32("more_buf_size", ps, depth, &(svc->more_buf_size)); prs_uint32("num_svcs", ps, depth, &(svc->num_svcs)); smb_io_enum_hnd("resume_hnd", &(svc->resume_hnd), ps, depth); -- cgit From e7a9b398c79cb77678de18f3fc448131e1d6eb25 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 31 Oct 1999 05:23:32 +0000 Subject: added yet another rpcclient command: svcstart [arg0] [arg1] ... works with command-line completion on the service name (ohh yesss, this is becoming my favourite bit of functionality-on-the-side hee hee :) had to fix the svc_io_q_start_service() code which was missing the ptr_argv[] array in between the array-size and the UNISTR2-array. i.e it's actually an array of _pointers_ to unicode strings... (This used to be commit 2903f22e7ed9306229035accfa757fd810645820) --- source3/rpc_parse/parse_svc.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c index 43594329b5..ef24e06be6 100644 --- a/source3/rpc_parse/parse_svc.c +++ b/source3/rpc_parse/parse_svc.c @@ -178,6 +178,34 @@ BOOL svc_io_r_open_service(char *desc, SVC_R_OPEN_SERVICE *r_u, prs_struct *ps, return True; } +/******************************************************************* +makes an SVC_Q_START_SERVICE structure. +********************************************************************/ +BOOL make_svc_q_start_service(SVC_Q_START_SERVICE *q_c, POLICY_HND *hnd, + uint32 argc, + char **argv) +{ + uint32 i; + + if (q_c == NULL || hnd == NULL) return False; + + DEBUG(5,("make_svc_q_query_svc_config\n")); + + memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); + q_c->argc = argc; + q_c->ptr_args = 1; + q_c->argc2 = argc; + + for (i = 0; i < argc; i++) + { + size_t len_argv = argv[i] != NULL ? strlen(argv[i])+1 : 0; + q_c->ptr_argv[i] = argv[i] != NULL ? 1 : 0; + make_unistr2(&(q_c->argv[i]), argv[i], len_argv); + } + + return True; +} + /******************************************************************* reads or writes a SVC_Q_START_SERVICE structure. ********************************************************************/ @@ -193,9 +221,9 @@ BOOL svc_io_q_start_service(char *desc, SVC_Q_START_SERVICE *q_s, prs_struct *ps prs_align(ps); prs_uint32("argc ", ps, depth, &(q_s->argc )); - prs_uint32("ptr_argv", ps, depth, &(q_s->ptr_argv)); + prs_uint32("ptr_args", ps, depth, &(q_s->ptr_args)); - if (q_s->ptr_argv != 0) + if (q_s->ptr_args != 0) { uint32 i; @@ -203,12 +231,16 @@ BOOL svc_io_q_start_service(char *desc, SVC_Q_START_SERVICE *q_s, prs_struct *ps if (q_s->argc2 > MAX_SVC_ARGS) { - q_s->argc = q_s->argc2 = MAX_SVC_ARGS; + return False; } for (i = 0; i < q_s->argc2; i++) { - smb_io_unistr2("", &(q_s->argv[i]), 1, ps, depth); + prs_uint32("", ps, depth, &(q_s->ptr_argv[i])); + } + for (i = 0; i < q_s->argc2; i++) + { + smb_io_unistr2("", &(q_s->argv[i]), q_s->ptr_argv[i], ps, depth); prs_align(ps); } } -- cgit From 92892c014e8b5bf42e36b60b4479dbda6e20b990 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 1 Nov 1999 17:52:11 +0000 Subject: added rpcclient svcstop command. gnu readline command-completion works. (This used to be commit 926fe6273a8cd9550838ecdfca276f915c92031b) --- source3/rpc_parse/parse_svc.c | 59 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c index ef24e06be6..815f60151e 100644 --- a/source3/rpc_parse/parse_svc.c +++ b/source3/rpc_parse/parse_svc.c @@ -178,6 +178,63 @@ BOOL svc_io_r_open_service(char *desc, SVC_R_OPEN_SERVICE *r_u, prs_struct *ps, return True; } +/******************************************************************* +makes an SVC_Q_STOP_SERVICE structure. +********************************************************************/ +BOOL make_svc_q_stop_service(SVC_Q_STOP_SERVICE *q_c, POLICY_HND *hnd, + uint32 unk) +{ + if (q_c == NULL || hnd == NULL) return False; + + DEBUG(5,("make_svc_q_stop_service\n")); + + memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); + q_c->unknown = unk; + + return True; +} + +/******************************************************************* +reads or writes a SVC_Q_STOP_SERVICE structure. +********************************************************************/ +BOOL svc_io_q_stop_service(char *desc, SVC_Q_STOP_SERVICE *q_s, prs_struct *ps, int depth) +{ + if (q_s == NULL) return False; + + prs_debug(ps, depth, desc, "svc_io_q_stop_service"); + depth++; + + prs_align(ps); + smb_io_pol_hnd("", &(q_s->pol), ps, depth); + + prs_align(ps); + + prs_uint32("unknown", ps, depth, &(q_s->unknown)); + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL svc_io_r_stop_service(char *desc, SVC_R_STOP_SERVICE *r_s, prs_struct *ps, int depth) +{ + if (r_s == NULL) return False; + + prs_debug(ps, depth, desc, "svc_io_r_stop_service"); + depth++; + + prs_uint32("unknown0", ps, depth, &(r_s->unknown0)); + prs_uint32("unknown1", ps, depth, &(r_s->unknown1)); + prs_uint32("unknown2", ps, depth, &(r_s->unknown2)); + prs_uint32("unknown3", ps, depth, &(r_s->unknown3)); + prs_uint32("unknown4", ps, depth, &(r_s->unknown4)); + prs_uint32("unknown5", ps, depth, &(r_s->unknown5)); + prs_uint32("unknown6", ps, depth, &(r_s->unknown6)); + prs_uint32("status", ps, depth, &(r_s->status)); + + return True; +} + /******************************************************************* makes an SVC_Q_START_SERVICE structure. ********************************************************************/ @@ -189,7 +246,7 @@ BOOL make_svc_q_start_service(SVC_Q_START_SERVICE *q_c, POLICY_HND *hnd, if (q_c == NULL || hnd == NULL) return False; - DEBUG(5,("make_svc_q_query_svc_config\n")); + DEBUG(5,("make_svc_q_start_service\n")); memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); q_c->argc = argc; -- cgit From 7032daa88719697076c61fcee6f2140a80eb7128 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 1 Nov 1999 22:25:38 +0000 Subject: added lsaenumdomains command. attempting to get blood out of a stone^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H querysecret to work, it keeps returning access denied. (This used to be commit 953fe6ba9454fa4b8e69426527eca37b011f76ac) --- source3/rpc_parse/parse_lsa.c | 54 +++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 9f8c7d6403..57c22e88cb 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -314,7 +314,7 @@ BOOL lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int dep /******************************************************************* makes an LSA_Q_OPEN_POL2 structure. ********************************************************************/ -BOOL make_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, +BOOL make_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, const char *server_name, uint32 attributes, uint32 desired_access, LSA_SEC_QOS *qos) @@ -540,11 +540,11 @@ BOOL make_q_query_secret(LSA_Q_QUERY_SECRET *q_q, POLICY_HND *pol) memcpy(&(q_q->pol), pol, sizeof(q_q->pol)); /* Want secret */ - q_q->info.ptr_value = 0; + q_q->info.ptr_value = 1; q_q->info.value.ptr_secret = 0; /* Want last change time */ - q_q->info.ptr_update = 0; + q_q->info.ptr_update = 1; /* Don't care about old info */ q_q->oldinfo.ptr_value = 0; @@ -590,6 +590,24 @@ BOOL lsa_io_r_query_secret(char *desc, LSA_R_QUERY_SECRET *r_q, prs_struct *ps, return True; } +/******************************************************************* +makes an LSA_Q_ENUM_TRUST_DOM structure. +********************************************************************/ +BOOL make_q_enum_trust_dom(LSA_Q_ENUM_TRUST_DOM *q_e, + POLICY_HND *pol, + uint32 enum_context, uint32 preferred_len) +{ + if (q_e == NULL) return False; + + DEBUG(5,("make_q_enum_trust_dom\n")); + + memcpy(&(q_e->pol), pol, sizeof(q_e->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. ********************************************************************/ @@ -613,8 +631,9 @@ BOOL lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct makes an LSA_R_ENUM_TRUST_DOM structure. ********************************************************************/ BOOL make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, - uint32 enum_context, char *domain_name, DOM_SID *domain_sid, - uint32 status) + int32 enum_context, + char *domain_name, DOM_SID *domain_sid, + uint32 status) { if (r_e == NULL) return False; @@ -630,9 +649,9 @@ BOOL make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, r_e->ptr_enum_domains = 1; r_e->num_domains2 = 1; - make_uni_hdr2(&(r_e->hdr_domain_name ), len_domain_name); - make_unistr2 (&(r_e->uni_domain_name ), domain_name, len_domain_name); - make_dom_sid2(&(r_e->other_domain_sid), domain_sid); + make_uni_hdr2(&(r_e->hdr_domain_name[0]), len_domain_name); + make_unistr2 (&(r_e->uni_domain_name[0]), domain_name, len_domain_name); + make_dom_sid2(&(r_e->domain_sid[0]), domain_sid); } else { @@ -648,7 +667,7 @@ BOOL make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, /******************************************************************* reads or writes an LSA_R_ENUM_TRUST_DOM structure. ********************************************************************/ -BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth) +BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth) { if (r_e == NULL) return False; @@ -661,10 +680,21 @@ BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct if (r_e->ptr_enum_domains != 0) { + uint32 i; prs_uint32("num_domains2", ps, depth, &(r_e->num_domains2)); - smb_io_unihdr2 ("", &(r_e->hdr_domain_name ), ps, depth); - smb_io_unistr2 ("", &(r_e->uni_domain_name ), r_e->hdr_domain_name.buffer, ps, depth); - smb_io_dom_sid2("", &(r_e->other_domain_sid), ps, depth); + + for (i = 0; i < r_e->num_domains2; i++) + { + + smb_io_unihdr2 ("", &(r_e->hdr_domain_name[i]), ps, depth); + } + + for (i = 0; i < r_e->num_domains2; i++) + { + smb_io_unistr2 ("", &(r_e->uni_domain_name[i] ), r_e->hdr_domain_name[i].buffer, ps, depth); + prs_align(ps); + smb_io_dom_sid2("", &(r_e->domain_sid[i]), ps, depth); + } } prs_uint32("status", ps, depth, &(r_e->status)); -- cgit From 74224aa4f8b113644e4090d4b09c5dbde6339c79 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 1 Nov 1999 23:16:07 +0000 Subject: const char* issues (This used to be commit 11ecec8457a51588a1b55b7f35dec28fe94c0594) --- source3/rpc_parse/parse_net.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 790556e8c2..a1e699a096 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1194,8 +1194,10 @@ BOOL net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int /******************************************************************* makes a NET_Q_SAM_SYNC structure. ********************************************************************/ -BOOL make_q_sam_sync(NET_Q_SAM_SYNC *q_s, char *srv_name, char *cli_name, - DOM_CRED *cli_creds, uint32 database_id) +BOOL make_q_sam_sync(NET_Q_SAM_SYNC *q_s, + const char *srv_name, + const char *cli_name, + DOM_CRED *cli_creds, uint32 database_id) { if (q_s == NULL) return False; -- cgit From aa77f20a5b8fc83799e4befe668eb2da42727ac7 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 2 Nov 1999 23:31:16 +0000 Subject: dynamic mem allocation in enum dom groups and enum dom aliases (This used to be commit baa789fabc45e62889755802fd8ec8c9191fe767) --- source3/rpc_parse/parse_samr.c | 125 +++++++++++++++++++++++++++-------------- 1 file changed, 83 insertions(+), 42 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 74386e7f99..c41d7014bd 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1300,7 +1300,7 @@ BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct if ((r_u->sam == NULL || r_u->uni_acct_name == NULL) && r_u->num_entries2 != 0) { - DEBUG(0,("NULL pointers in SAMR_R_QUERY_DISPINFO\n")); + DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_USERS\n")); r_u->num_entries4 = 0; r_u->status = 0xC0000000|NT_STATUS_MEMORY_NOT_ALLOCATED; return False; @@ -2803,8 +2803,7 @@ makes a SAMR_R_ENUM_DOM_GROUPS structure. ********************************************************************/ BOOL make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, uint32 next_idx, - uint32 num_sam_entries, DOMAIN_GRP *grps, - uint32 status) + uint32 num_sam_entries, DOMAIN_GRP *grps, uint32 status) { uint32 i; @@ -2812,23 +2811,25 @@ BOOL make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, DEBUG(5,("make_samr_r_enum_dom_groups\n")); - if (num_sam_entries >= MAX_SAM_ENTRIES) - { - num_sam_entries = MAX_SAM_ENTRIES; - DEBUG(5,("limiting number of entries to %d\n", - num_sam_entries)); - } - - r_u->next_idx = next_idx; - r_u->ptr_entries1 = 1; - r_u->num_entries2 = num_sam_entries; + r_u->next_idx = next_idx; + r_u->sam = NULL; + r_u->uni_grp_name = NULL; - if (num_sam_entries > 0) + 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; - SMB_ASSERT_ARRAY(r_u->sam, num_sam_entries); + r_u->sam = (SAM_ENTRY*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); + r_u->uni_grp_name = (UNISTR2*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_grp_name[0])); + + if (r_u->sam == NULL || r_u->uni_grp_name == NULL) + { + DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_GROUPS\n")); + return False; + } for (i = 0; i < num_sam_entries; i++) { @@ -2845,7 +2846,9 @@ BOOL make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, } else { - r_u->num_entries4 = 0; + r_u->ptr_entries1 = 0; + r_u->num_entries2 = num_sam_entries; + r_u->ptr_entries2 = 1; } r_u->status = status; @@ -2865,30 +2868,48 @@ BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_stru prs_debug(ps, depth, desc, "samr_io_r_enum_dom_groups"); depth++; + r_u->sam = NULL; + r_u->uni_grp_name = NULL; + prs_align(ps); prs_uint32("next_idx ", ps, depth, &(r_u->next_idx )); prs_uint32("ptr_entries1", ps, depth, &(r_u->ptr_entries1)); - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); - - if (r_u->num_entries2 != 0 && r_u->ptr_entries1 != 0) + + if (r_u->ptr_entries1 != 0) { + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); - SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries2); + if (ps->io) + { + r_u->sam = (SAM_ENTRY*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); + r_u->uni_grp_name = (UNISTR2*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_grp_name[0])); + } + + 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 = 0xC0000000|NT_STATUS_MEMORY_NOT_ALLOCATED; + return False; + } for (i = 0; i < r_u->num_entries2; i++) { + prs_grow(ps); sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); } for (i = 0; i < r_u->num_entries2; i++) { + prs_grow(ps); smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); } prs_align(ps); + } prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); @@ -2897,7 +2918,6 @@ BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_stru return True; } - /******************************************************************* makes a SAMR_Q_ENUM_DOM_ALIASES structure. ********************************************************************/ @@ -2946,8 +2966,7 @@ makes a SAMR_R_ENUM_DOM_ALIASES structure. ********************************************************************/ BOOL make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, uint32 next_idx, - uint32 num_sam_entries, LOCAL_GRP *alss, - uint32 status) + uint32 num_sam_entries, LOCAL_GRP *alss, uint32 status) { uint32 i; @@ -2955,23 +2974,25 @@ BOOL make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, DEBUG(5,("make_samr_r_enum_dom_aliases\n")); - if (num_sam_entries >= MAX_SAM_ENTRIES) - { - num_sam_entries = MAX_SAM_ENTRIES; - DEBUG(5,("limiting number of entries to %d\n", - num_sam_entries)); - } - - r_u->next_idx = next_idx; - r_u->ptr_entries1 = 1; - r_u->num_entries2 = num_sam_entries; + r_u->next_idx = next_idx; + r_u->sam = NULL; + r_u->uni_grp_name = NULL; - if (num_sam_entries > 0) + 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; - SMB_ASSERT_ARRAY(r_u->sam, num_sam_entries); + r_u->sam = (SAM_ENTRY*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); + r_u->uni_grp_name = (UNISTR2*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_grp_name[0])); + + if (r_u->sam == NULL || r_u->uni_grp_name == NULL) + { + DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_ALIASES\n")); + return False; + } for (i = 0; i < num_sam_entries; i++) { @@ -2981,14 +3002,16 @@ BOOL make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, acct_name_len, alss[i].rid); - make_unistr2(&(r_u->uni_grp_name[i]), alss[i].name , acct_name_len); + make_unistr2(&(r_u->uni_grp_name[i]), alss[i].name, acct_name_len); } r_u->num_entries4 = num_sam_entries; } else { - r_u->num_entries4 = 0; + r_u->ptr_entries1 = 0; + r_u->num_entries2 = num_sam_entries; + r_u->ptr_entries2 = 1; } r_u->status = status; @@ -2999,7 +3022,7 @@ BOOL make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_struct *ps, int depth) { uint32 i; @@ -3008,30 +3031,48 @@ BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_s prs_debug(ps, depth, desc, "samr_io_r_enum_dom_aliases"); depth++; + r_u->sam = NULL; + r_u->uni_grp_name = NULL; + prs_align(ps); prs_uint32("next_idx ", ps, depth, &(r_u->next_idx )); prs_uint32("ptr_entries1", ps, depth, &(r_u->ptr_entries1)); - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); - - if (r_u->num_entries2 != 0 && r_u->ptr_entries1 != 0) + + if (r_u->ptr_entries1 != 0) { + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); - SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries2); + if (ps->io) + { + r_u->sam = (SAM_ENTRY*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); + r_u->uni_grp_name = (UNISTR2*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_grp_name[0])); + } + + 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_ALIASES\n")); + r_u->num_entries4 = 0; + r_u->status = 0xC0000000|NT_STATUS_MEMORY_NOT_ALLOCATED; + return False; + } for (i = 0; i < r_u->num_entries2; i++) { + prs_grow(ps); sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); } for (i = 0; i < r_u->num_entries2; i++) { + prs_grow(ps); smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); } prs_align(ps); + } prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); -- cgit From c015b02b43fa0d7743eb555fdf50fc433dc67b98 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 3 Nov 1999 19:58:47 +0000 Subject: three types of array-creation / array-deletion functions: char* UNISTR2* SID* decided to create a higher-order function set, add_item_to_array() free_item_array(). higher-order support routines needed to add a new type: type* item_dup(const type*) void item_free(type*) of course, strdup() and free() are perfect, pre-existing examples of such functions, used in the implementation of add_chars_to_array() and free_char_array(). sid_dup() and free() work for the add_sids_to_array() and free_sid_array() implementations. use unistr2_dup() and created unistr2_free() because the functionality behind these may change into something horrible, like [horror] dynamic memory allocation of the UNISTR2 character array. argh!!!! jean-francois, this function set implements what we talked about over... a year ago, now :-) (This used to be commit a80ea2eb47d298095eb6e5b0455309daa3a631cb) --- source3/rpc_parse/parse_misc.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 69455b7b42..471cb59e1c 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -747,7 +747,7 @@ BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf) /******************************************************************* copies a UNISTR2 structure. ********************************************************************/ -BOOL copy_unistr2(UNISTR2 *str, UNISTR2 *from) +BOOL copy_unistr2(UNISTR2 *str, const UNISTR2 *from) { /* set up string lengths. add one if string is not null-terminated */ str->uni_max_len = from->uni_max_len; @@ -760,6 +760,24 @@ BOOL copy_unistr2(UNISTR2 *str, UNISTR2 *from) return True; } +/******************************************************************* +duplicates a UNISTR2 structure. +********************************************************************/ +UNISTR2 *unistr2_dup(const UNISTR2 *name) +{ + UNISTR2 *copy = (UNISTR2*)malloc(sizeof(*copy)); + copy_unistr2(copy, name); + return copy; +} + +/******************************************************************* +frees a UNISTR2 structure. +********************************************************************/ +void unistr2_free(UNISTR2 *name) +{ + free(name); +} + /******************************************************************* creates a STRING2 structure. ********************************************************************/ -- cgit From 59a7e6cef89a9bd519df64978f8c8f113d66d0ef Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 3 Nov 1999 20:01:07 +0000 Subject: had to move unistr2_dup(), unistr2_free() and unistr2_copy() into util_unistr.c in order to get bin/testparm to compile. (This used to be commit e718ce9c4a3598483e38b8c32bdf2924593edc1e) --- source3/rpc_parse/parse_misc.c | 34 ---------------------------------- 1 file changed, 34 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 471cb59e1c..925adeca12 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -744,40 +744,6 @@ BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf) return True; } -/******************************************************************* -copies a UNISTR2 structure. -********************************************************************/ -BOOL copy_unistr2(UNISTR2 *str, const UNISTR2 *from) -{ - /* set up string lengths. add one if string is not null-terminated */ - str->uni_max_len = from->uni_max_len; - str->undoc = from->undoc; - str->uni_str_len = from->uni_str_len; - - /* copy the string */ - memcpy(str->buffer, from->buffer, sizeof(from->buffer)); - - return True; -} - -/******************************************************************* -duplicates a UNISTR2 structure. -********************************************************************/ -UNISTR2 *unistr2_dup(const UNISTR2 *name) -{ - UNISTR2 *copy = (UNISTR2*)malloc(sizeof(*copy)); - copy_unistr2(copy, name); - return copy; -} - -/******************************************************************* -frees a UNISTR2 structure. -********************************************************************/ -void unistr2_free(UNISTR2 *name) -{ - free(name); -} - /******************************************************************* creates a STRING2 structure. ********************************************************************/ -- cgit From dc963d7939c9f4f5f7850f9c92385c5484df51bb Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 3 Nov 1999 21:51:29 +0000 Subject: dynamic mem allocation in net_srv_transport_enum() parsing. (This used to be commit 6b919ebb4ed8c0082d8bffb299766bff9e718faf) --- source3/rpc_parse/parse_srv.c | 64 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index c27f58ac26..c0530f8987 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1207,13 +1207,25 @@ static BOOL srv_io_srv_tprt_info_0(char *desc, SRV_TPRT_INFO_0 *tp0, prs_struct { uint32 i; uint32 num_entries = tp0->num_entries_read; - if (num_entries > MAX_TPRT_ENTRIES) - { - num_entries = MAX_TPRT_ENTRIES; /* report this! */ - } prs_uint32("num_entries_read2", ps, depth, &(tp0->num_entries_read2)); + if (ps->io) + { + /* reading */ + tp0->info_0 = (TPRT_INFO_0*)malloc(num_entries * + sizeof(tp0->info_0[0])); + + tp0->info_0_str = (TPRT_INFO_0_STR*)malloc(num_entries * + sizeof(tp0->info_0_str[0])); + + if (tp0->info_0 == NULL || tp0->info_0_str == NULL) + { + free_srv_tprt_info_0(tp0); + return False; + } + } + for (i = 0; i < num_entries; i++) { prs_grow(ps); @@ -1231,9 +1243,32 @@ static BOOL srv_io_srv_tprt_info_0(char *desc, SRV_TPRT_INFO_0 *tp0, prs_struct prs_align(ps); } + if (!ps->io) + { + /* writing */ + free_srv_tprt_info_0(tp0); + } + return True; } +/******************************************************************* +frees a structure. +********************************************************************/ +void free_srv_tprt_info_0(SRV_TPRT_INFO_0 *tp0) +{ + if (tp0->info_0 != NULL) + { + free(tp0->info_0); + tp0->info_0 = NULL; + } + if (tp0->info_0_str != NULL) + { + free(tp0->info_0_str); + tp0->info_0_str = NULL; + } +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -1270,6 +1305,27 @@ static BOOL srv_io_srv_tprt_ctr(char *desc, SRV_TPRT_INFO_CTR *ctr, prs_struct return True; } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void free_srv_tprt_ctr(SRV_TPRT_INFO_CTR *ctr) +{ + switch (ctr->switch_value) + { + case 0: + { + free_srv_tprt_info_0(&(ctr->tprt.info0)); + break; + } + default: + { + DEBUG(5,("no transport info at switch_value %d\n", + ctr->switch_value)); + break; + } + } +} + /******************************************************************* reads or writes a structure. ********************************************************************/ -- cgit From 83f2465f0f1432bc0aba76b83f3a781fb7c3a071 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 3 Nov 1999 22:14:38 +0000 Subject: created msrpc_srv_enum_tprt() function by massaging cmd_srv_enum_tprt(). (This used to be commit 3f9455c535607090103a371ff96051a5ce32e461) --- source3/rpc_parse/parse_misc.c | 2 +- source3/rpc_parse/parse_srv.c | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 925adeca12..03cec1128c 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -728,7 +728,7 @@ BOOL smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, i /******************************************************************* creates a UNISTR2 structure: sets up the buffer, too ********************************************************************/ -BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf) +BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf) { if (buf != NULL) { diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index c0530f8987..8ad275229e 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -328,7 +328,7 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struc reads or writes a structure. ********************************************************************/ BOOL make_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, - char *srv_name, + const char *srv_name, uint32 share_level, SRV_SHARE_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) @@ -691,7 +691,7 @@ static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct reads or writes a structure. ********************************************************************/ BOOL make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, - char *srv_name, char *qual_name, + const char *srv_name, const char *qual_name, char *user_name, uint32 sess_level, SRV_SESS_INFO_CTR *ctr, uint32 preferred_len, @@ -1022,7 +1022,7 @@ static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct reads or writes a structure. ********************************************************************/ BOOL make_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, - char *srv_name, char *qual_name, + const char *srv_name, const char *qual_name, uint32 conn_level, SRV_CONN_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) @@ -1330,7 +1330,7 @@ void free_srv_tprt_ctr(SRV_TPRT_INFO_CTR *ctr) reads or writes a structure. ********************************************************************/ BOOL make_srv_q_net_tprt_enum(SRV_Q_NET_TPRT_ENUM *q_n, - char *srv_name, + const char *srv_name, uint32 tprt_level, SRV_TPRT_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) @@ -1567,7 +1567,8 @@ static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct reads or writes a structure. ********************************************************************/ BOOL make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, - char *srv_name, char *qual_name, uint32 file_id, + const char *srv_name, const char *qual_name, + uint32 file_id, uint32 file_level, SRV_FILE_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) -- cgit From cae821d45926157a250e9fa047e0c8aa8c0c2c54 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 4 Nov 1999 00:09:15 +0000 Subject: adding experimental set user password command to rpcclient, it returns error wrong password against nt. ???? (This used to be commit b3f16e6b5aa5ba1b6afa38ad698646c8e765ec90) --- source3/rpc_parse/parse_samr.c | 45 +++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 14 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index c41d7014bd..de87c42473 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5341,27 +5341,19 @@ BOOL make_samr_q_set_userinfo(SAMR_Q_SET_USERINFO *q_u, memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); q_u->switch_value = switch_value; q_u->switch_value2 = switch_value; + q_u->info.id = info; switch (switch_value) { case 0x18: - { - q_u->info.id24 = (SAM_USER_INFO_24*)info; - - break; - } - case 0x17: { - q_u->info.id23 = (SAM_USER_INFO_23*)info; - break; } - default: { DEBUG(4,("make_samr_q_set_userinfo: unsupported switch level\n")); - break; + return False; } } @@ -5397,8 +5389,12 @@ BOOL samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO *q_u, prs_struct *ps } case 24: { - q_u->info.id = (SAM_USER_INFO_24*)Realloc(NULL, - sizeof(*q_u->info.id24)); + if (ps->io) + { + /* reading */ + q_u->info.id = (SAM_USER_INFO_24*)Realloc(NULL, + sizeof(*q_u->info.id24)); + } if (q_u->info.id == NULL) { DEBUG(2,("samr_io_q_query_userinfo: info pointer not initialised\n")); @@ -5409,8 +5405,12 @@ BOOL samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO *q_u, prs_struct *ps } case 23: { - q_u->info.id = (SAM_USER_INFO_23*)Realloc(NULL, - sizeof(*q_u->info.id23)); + if (ps->io) + { + /* reading */ + q_u->info.id = (SAM_USER_INFO_23*)Realloc(NULL, + sizeof(*q_u->info.id23)); + } if (q_u->info.id == NULL) { DEBUG(2,("samr_io_q_query_userinfo: info pointer not initialised\n")); @@ -5428,9 +5428,26 @@ BOOL samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO *q_u, prs_struct *ps } prs_align(ps); + if (!ps->io) + { + free_samr_q_set_userinfo(q_u); + } + return True; } +/******************************************************************* +frees a structure. +********************************************************************/ +void free_samr_q_set_userinfo(SAMR_Q_SET_USERINFO *q_u) +{ + if (q_u->info.id == NULL) + { + free(q_u->info.id); + } + q_u->info.id = NULL; +} + /******************************************************************* makes a SAMR_R_SET_USERINFO structure. ********************************************************************/ -- cgit From fe8383382d5b8221093a5340705c4e5b3731a249 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 4 Nov 1999 21:41:36 +0000 Subject: samuserset -p password. YESSSSS :) you have to use "ntlmv1" at the moment (i.e set client ntlmv2 = no). (This used to be commit f52504c553becc64b89d546a57b1bd9cf1bc5b5c) --- source3/rpc_parse/parse_samr.c | 247 +++++++++++++++++++++++++++++++---------- 1 file changed, 190 insertions(+), 57 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index de87c42473..0059aed756 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -881,7 +881,7 @@ static BOOL sam_io_sam_str1(char *desc, SAM_STR1 *sam, uint32 acct_buf, uint32 smb_io_unistr2("unistr2", &(sam->uni_acct_name), acct_buf, ps, depth); /* account name unicode string */ smb_io_unistr2("unistr2", &(sam->uni_full_name), name_buf, ps, depth); /* full name unicode string */ - smb_io_unistr2("unistr2", &(sam->uni_acct_desc), desc_buf, ps, depth); /* account description unicode string */ + smb_io_unistr2("unistr2", &(sam->uni_acct_desc), desc_buf, ps, depth); /* account desc unicode string */ return True; } @@ -947,7 +947,7 @@ static BOOL sam_io_sam_str2(char *desc, SAM_STR2 *sam, uint32 acct_buf, uint32 prs_align(ps); smb_io_unistr2("unistr2", &(sam->uni_srv_name), acct_buf, ps, depth); /* account name unicode string */ - smb_io_unistr2("unistr2", &(sam->uni_srv_desc), desc_buf, ps, depth); /* account description unicode string */ + smb_io_unistr2("unistr2", &(sam->uni_srv_desc), desc_buf, ps, depth); /* account desc unicode string */ return True; } @@ -1011,7 +1011,7 @@ static BOOL sam_io_sam_str3(char *desc, SAM_STR3 *sam, uint32 acct_buf, uint32 prs_align(ps); smb_io_unistr2("unistr2", &(sam->uni_grp_name), acct_buf, ps, depth); /* account name unicode string */ - smb_io_unistr2("unistr2", &(sam->uni_grp_desc), desc_buf, ps, depth); /* account description unicode string */ + smb_io_unistr2("unistr2", &(sam->uni_grp_desc), desc_buf, ps, depth); /* account desc unicode string */ return True; } @@ -4712,7 +4712,7 @@ BOOL sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int { if (usr == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_unknown_24"); + prs_debug(ps, depth, desc, "samr_io_r_unknown_11"); depth++; prs_align(ps); @@ -4766,6 +4766,7 @@ BOOL make_sam_user_info24(SAM_USER_INFO_24 *usr, char newpass[516]) { memcpy(usr->pass, newpass, sizeof(usr->pass)); + usr->unk_0 = 0x44; return True; } @@ -4783,6 +4784,7 @@ static BOOL sam_io_user_info24(char *desc, SAM_USER_INFO_24 *usr, prs_struct *p prs_align(ps); prs_uint8s (False, "password", ps, depth, usr->pass, sizeof(usr->pass)); + prs_uint16("unk_0", ps, depth, &(usr->unk_0)); /* unknown */ prs_align(ps); return True; @@ -4797,7 +4799,118 @@ static BOOL sam_io_user_info24(char *desc, SAM_USER_INFO_24 *usr, prs_struct *p unknown_6 = 0x0000 04ec *************************************************************************/ -BOOL make_sam_user_info23(SAM_USER_INFO_23 *usr, +BOOL make_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, /* NULL */ + 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, + uint16 acb_info, + + uint32 unknown_3, + uint16 logon_divs, + LOGON_HRS *hrs, + uint32 unknown_5, + char newpass[516], + uint32 unknown_6) +{ + int len_user_name = user_name != NULL ? user_name->uni_str_len : 0; + int len_full_name = full_name != NULL ? full_name->uni_str_len : 0; + int len_home_dir = home_dir != NULL ? home_dir ->uni_str_len : 0; + int len_dir_drive = dir_drive != NULL ? dir_drive->uni_str_len : 0; + int len_logon_script = log_scr != NULL ? log_scr ->uni_str_len : 0; + int len_profile_path = prof_path != NULL ? prof_path->uni_str_len : 0; + int len_description = desc != NULL ? desc ->uni_str_len : 0; + int len_workstations = wkstas != NULL ? wkstas ->uni_str_len : 0; + int len_unknown_str = unk_str != NULL ? unk_str ->uni_str_len : 0; + int len_munged_dial = mung_dial != NULL ? mung_dial->uni_str_len : 0; + + 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 */ + + make_uni_hdr(&(usr->hdr_user_name ), len_user_name ); /* NULL */ + make_uni_hdr(&(usr->hdr_full_name ), len_full_name ); + make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir ); + make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive ); + make_uni_hdr(&(usr->hdr_logon_script), len_logon_script); + make_uni_hdr(&(usr->hdr_profile_path), len_profile_path); + make_uni_hdr(&(usr->hdr_acct_desc ), len_description ); + make_uni_hdr(&(usr->hdr_workstations), len_workstations); + make_uni_hdr(&(usr->hdr_unknown_str ), len_unknown_str ); + make_uni_hdr(&(usr->hdr_munged_dial ), len_munged_dial ); + + bzero(usr->nt_pwd, sizeof(usr->nt_pwd)); + bzero(usr->lm_pwd, sizeof(usr->lm_pwd)); + + usr->user_rid = user_rid; /* 0x0000 0000 */ + usr->group_rid = group_rid; + usr->acb_info = acb_info; + usr->unknown_3 = unknown_3; /* 09f8 27fa */ + + usr->logon_divs = logon_divs; /* should be 168 (hours/week) */ + usr->ptr_logon_hrs = hrs ? 1 : 0; + + bzero(usr->padding1, sizeof(usr->padding1)); + + usr->unknown_5 = unknown_5; /* 0x0001 0000 */ + + memcpy(usr->pass, newpass, sizeof(usr->pass)); + + copy_unistr2(&(usr->uni_user_name ), user_name); + copy_unistr2(&(usr->uni_full_name ), full_name); + copy_unistr2(&(usr->uni_home_dir ), home_dir ); + copy_unistr2(&(usr->uni_dir_drive ), dir_drive); + copy_unistr2(&(usr->uni_logon_script), log_scr ); + copy_unistr2(&(usr->uni_profile_path), prof_path); + copy_unistr2(&(usr->uni_acct_desc ), desc ); + copy_unistr2(&(usr->uni_workstations), wkstas ); + copy_unistr2(&(usr->uni_unknown_str ), unk_str ); + copy_unistr2(&(usr->uni_munged_dial ), mung_dial); + + usr->unknown_6 = unknown_6; /* 0x0000 04ec */ + usr->padding4 = 0; + + if (hrs) + { + memcpy(&(usr->logon_hrs), hrs, sizeof(usr->logon_hrs)); + } + else + { + memset(&(usr->logon_hrs), 0xff, sizeof(usr->logon_hrs)); + } + + return True; +} + +/************************************************************************* + make_sam_user_info23 + + unknown_3 = 0x09f8 27fa + unknown_5 = 0x0001 0000 + unknown_6 = 0x0000 04ec + + *************************************************************************/ +BOOL make_sam_user_info23A(SAM_USER_INFO_23 *usr, NTTIME *logon_time, /* all zeros */ NTTIME *logoff_time, /* all zeros */ @@ -4810,12 +4923,12 @@ BOOL make_sam_user_info23(SAM_USER_INFO_23 *usr, char *full_name, char *home_dir, char *dir_drive, - char *logon_script, - char *profile_path, - char *description, - char *workstations, - char *unknown_str, - char *munged_dial, + char *log_scr, + char *prof_path, + char *desc, + char *wkstas, + char *unk_str, + char *mung_dial, uint32 user_rid, /* 0x0000 0000 */ uint32 group_rid, @@ -4828,16 +4941,16 @@ BOOL make_sam_user_info23(SAM_USER_INFO_23 *usr, char newpass[516], uint32 unknown_6) { - int len_user_name = user_name != NULL ? strlen(user_name ) : 0; - int len_full_name = full_name != NULL ? strlen(full_name ) : 0; - int len_home_dir = home_dir != NULL ? strlen(home_dir ) : 0; - int len_dir_drive = dir_drive != NULL ? strlen(dir_drive ) : 0; - int len_logon_script = logon_script != NULL ? strlen(logon_script) : 0; - int len_profile_path = profile_path != NULL ? strlen(profile_path) : 0; - int len_description = description != NULL ? strlen(description ) : 0; - int len_workstations = workstations != NULL ? strlen(workstations) : 0; - int len_unknown_str = unknown_str != NULL ? strlen(unknown_str ) : 0; - int len_munged_dial = munged_dial != NULL ? strlen(munged_dial ) : 0; + int len_user_name = user_name != NULL ? strlen(user_name) : 0; + int len_full_name = full_name != NULL ? strlen(full_name) : 0; + int len_home_dir = home_dir != NULL ? strlen(home_dir ) : 0; + int len_dir_drive = dir_drive != NULL ? strlen(dir_drive) : 0; + int len_logon_script = log_scr != NULL ? strlen(log_scr ) : 0; + int len_profile_path = prof_path != NULL ? strlen(prof_path) : 0; + int len_description = desc != NULL ? strlen(desc ) : 0; + int len_workstations = wkstas != NULL ? strlen(wkstas ) : 0; + int len_unknown_str = unk_str != NULL ? strlen(unk_str ) : 0; + int len_munged_dial = mung_dial != NULL ? strlen(mung_dial) : 0; usr->logon_time = *logon_time; /* all zeros */ usr->logoff_time = *logoff_time; /* all zeros */ @@ -4878,12 +4991,12 @@ BOOL make_sam_user_info23(SAM_USER_INFO_23 *usr, make_unistr2(&(usr->uni_full_name ), full_name , len_full_name ); make_unistr2(&(usr->uni_home_dir ), home_dir , len_home_dir ); make_unistr2(&(usr->uni_dir_drive ), dir_drive , len_dir_drive ); - make_unistr2(&(usr->uni_logon_script), logon_script, len_logon_script); - make_unistr2(&(usr->uni_profile_path), profile_path, len_profile_path); - make_unistr2(&(usr->uni_acct_desc ), description , len_description ); - make_unistr2(&(usr->uni_workstations), workstations, len_workstations); - make_unistr2(&(usr->uni_unknown_str ), unknown_str , len_unknown_str ); - make_unistr2(&(usr->uni_munged_dial ), munged_dial , len_munged_dial ); + make_unistr2(&(usr->uni_logon_script), log_scr, len_logon_script); + make_unistr2(&(usr->uni_profile_path), prof_path, len_profile_path); + make_unistr2(&(usr->uni_acct_desc ), desc , len_description ); + make_unistr2(&(usr->uni_workstations), wkstas, len_workstations); + make_unistr2(&(usr->uni_unknown_str ), unk_str , len_unknown_str ); + make_unistr2(&(usr->uni_munged_dial ), mung_dial , len_munged_dial ); usr->unknown_6 = unknown_6; /* 0x0000 04ec */ usr->padding4 = 0; @@ -4925,10 +5038,10 @@ static BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 *usr, prs_struct *p smb_io_unihdr("hdr_dir_drive ", &(usr->hdr_dir_drive) , ps, depth); /* home directory drive */ smb_io_unihdr("hdr_logon_script", &(usr->hdr_logon_script), ps, depth); /* logon script unicode string header */ smb_io_unihdr("hdr_profile_path", &(usr->hdr_profile_path), ps, depth); /* profile path unicode string header */ - smb_io_unihdr("hdr_acct_desc ", &(usr->hdr_acct_desc ) , ps, depth); /* account description */ - smb_io_unihdr("hdr_workstations", &(usr->hdr_workstations), ps, depth); /* workstations user can log on from */ + smb_io_unihdr("hdr_acct_desc ", &(usr->hdr_acct_desc ) , ps, depth); /* account desc */ + smb_io_unihdr("hdr_workstations", &(usr->hdr_workstations), ps, depth); /* wkstas user can log on from */ smb_io_unihdr("hdr_unknown_str ", &(usr->hdr_unknown_str ), ps, depth); /* unknown string */ - smb_io_unihdr("hdr_munged_dial ", &(usr->hdr_munged_dial ), ps, depth); /* workstations user can log on from */ + smb_io_unihdr("hdr_munged_dial ", &(usr->hdr_munged_dial ), ps, depth); /* wkstas user can log on from */ prs_uint8s (False, "lm_pwd ", ps, depth, usr->lm_pwd , sizeof(usr->lm_pwd )); prs_uint8s (False, "nt_pwd ", ps, depth, usr->nt_pwd , sizeof(usr->nt_pwd )); @@ -4950,15 +5063,25 @@ static BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 *usr, prs_struct *p /* here begins pointed-to data */ smb_io_unistr2("uni_user_name ", &(usr->uni_user_name) , usr->hdr_user_name .buffer, ps, depth); /* username unicode string */ + prs_align(ps); smb_io_unistr2("uni_full_name ", &(usr->uni_full_name) , usr->hdr_full_name .buffer, ps, depth); /* user's full name unicode string */ + prs_align(ps); smb_io_unistr2("uni_home_dir ", &(usr->uni_home_dir) , usr->hdr_home_dir .buffer, ps, depth); /* home directory unicode string */ + prs_align(ps); smb_io_unistr2("uni_dir_drive ", &(usr->uni_dir_drive) , usr->hdr_dir_drive .buffer, ps, depth); /* home directory drive unicode string */ + prs_align(ps); smb_io_unistr2("uni_logon_script", &(usr->uni_logon_script), usr->hdr_logon_script.buffer, ps, depth); /* logon script unicode string */ + prs_align(ps); smb_io_unistr2("uni_profile_path", &(usr->uni_profile_path), usr->hdr_profile_path.buffer, ps, depth); /* profile path unicode string */ - smb_io_unistr2("uni_acct_desc ", &(usr->uni_acct_desc ), usr->hdr_acct_desc .buffer, ps, depth); /* user description unicode string */ + prs_align(ps); + smb_io_unistr2("uni_acct_desc ", &(usr->uni_acct_desc ), usr->hdr_acct_desc .buffer, ps, depth); /* user desc unicode string */ + prs_align(ps); smb_io_unistr2("uni_workstations", &(usr->uni_workstations), usr->hdr_workstations.buffer, ps, depth); /* worksations user can log on from */ + prs_align(ps); smb_io_unistr2("uni_unknown_str ", &(usr->uni_unknown_str ), usr->hdr_unknown_str .buffer, ps, depth); /* unknown string */ + prs_align(ps); smb_io_unistr2("uni_munged_dial ", &(usr->uni_munged_dial ), usr->hdr_munged_dial .buffer, ps, depth); /* worksations user can log on from */ + prs_align(ps); prs_uint32("unknown_6 ", ps, depth, &(usr->unknown_6 )); prs_uint32("padding4 ", ps, depth, &(usr->padding4 )); @@ -4994,12 +5117,12 @@ BOOL make_sam_user_info21(SAM_USER_INFO_21 *usr, char *full_name, char *home_dir, char *dir_drive, - char *logon_script, - char *profile_path, - char *description, - char *workstations, - char *unknown_str, - char *munged_dial, + char *log_scr, + char *prof_path, + char *desc, + char *wkstas, + char *unk_str, + char *mung_dial, uint32 user_rid, uint32 group_rid, @@ -5011,16 +5134,16 @@ BOOL make_sam_user_info21(SAM_USER_INFO_21 *usr, uint32 unknown_5, uint32 unknown_6) { - int len_user_name = user_name != NULL ? strlen(user_name ) : 0; - int len_full_name = full_name != NULL ? strlen(full_name ) : 0; - int len_home_dir = home_dir != NULL ? strlen(home_dir ) : 0; - int len_dir_drive = dir_drive != NULL ? strlen(dir_drive ) : 0; - int len_logon_script = logon_script != NULL ? strlen(logon_script) : 0; - int len_profile_path = profile_path != NULL ? strlen(profile_path) : 0; - int len_description = description != NULL ? strlen(description ) : 0; - int len_workstations = workstations != NULL ? strlen(workstations) : 0; - int len_unknown_str = unknown_str != NULL ? strlen(unknown_str ) : 0; - int len_munged_dial = munged_dial != NULL ? strlen(munged_dial ) : 0; + int len_user_name = user_name != NULL ? strlen(user_name) : 0; + int len_full_name = full_name != NULL ? strlen(full_name) : 0; + int len_home_dir = home_dir != NULL ? strlen(home_dir ) : 0; + int len_dir_drive = dir_drive != NULL ? strlen(dir_drive) : 0; + int len_logon_script = log_scr != NULL ? strlen(log_scr ) : 0; + int len_profile_path = prof_path != NULL ? strlen(prof_path) : 0; + int len_description = desc != NULL ? strlen(desc ) : 0; + int len_workstations = wkstas != NULL ? strlen(wkstas ) : 0; + int len_unknown_str = unk_str != NULL ? strlen(unk_str ) : 0; + int len_munged_dial = mung_dial != NULL ? strlen(mung_dial) : 0; usr->logon_time = *logon_time; usr->logoff_time = *logoff_time; @@ -5058,12 +5181,12 @@ BOOL make_sam_user_info21(SAM_USER_INFO_21 *usr, make_unistr2(&(usr->uni_full_name ), full_name , len_full_name ); make_unistr2(&(usr->uni_home_dir ), home_dir , len_home_dir ); make_unistr2(&(usr->uni_dir_drive ), dir_drive , len_dir_drive ); - make_unistr2(&(usr->uni_logon_script), logon_script, len_logon_script); - make_unistr2(&(usr->uni_profile_path), profile_path, len_profile_path); - make_unistr2(&(usr->uni_acct_desc ), description , len_description ); - make_unistr2(&(usr->uni_workstations), workstations, len_workstations); - make_unistr2(&(usr->uni_unknown_str ), unknown_str , len_unknown_str ); - make_unistr2(&(usr->uni_munged_dial ), munged_dial , len_munged_dial ); + make_unistr2(&(usr->uni_logon_script), log_scr, len_logon_script); + make_unistr2(&(usr->uni_profile_path), prof_path, len_profile_path); + make_unistr2(&(usr->uni_acct_desc ), desc , len_description ); + make_unistr2(&(usr->uni_workstations), wkstas, len_workstations); + make_unistr2(&(usr->uni_unknown_str ), unk_str , len_unknown_str ); + make_unistr2(&(usr->uni_munged_dial ), mung_dial , len_munged_dial ); usr->unknown_6 = unknown_6; /* 0x0000 04ec */ usr->padding4 = 0; @@ -5106,10 +5229,10 @@ static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *p smb_io_unihdr("hdr_dir_drive ", &(usr->hdr_dir_drive) , ps, depth); /* home directory drive */ smb_io_unihdr("hdr_logon_script", &(usr->hdr_logon_script), ps, depth); /* logon script unicode string header */ smb_io_unihdr("hdr_profile_path", &(usr->hdr_profile_path), ps, depth); /* profile path unicode string header */ - smb_io_unihdr("hdr_acct_desc ", &(usr->hdr_acct_desc ) , ps, depth); /* account description */ - smb_io_unihdr("hdr_workstations", &(usr->hdr_workstations), ps, depth); /* workstations user can log on from */ + smb_io_unihdr("hdr_acct_desc ", &(usr->hdr_acct_desc ) , ps, depth); /* account desc */ + smb_io_unihdr("hdr_workstations", &(usr->hdr_workstations), ps, depth); /* wkstas user can log on from */ smb_io_unihdr("hdr_unknown_str ", &(usr->hdr_unknown_str ), ps, depth); /* unknown string */ - smb_io_unihdr("hdr_munged_dial ", &(usr->hdr_munged_dial ), ps, depth); /* workstations user can log on from */ + smb_io_unihdr("hdr_munged_dial ", &(usr->hdr_munged_dial ), ps, depth); /* wkstas user can log on from */ prs_uint8s (False, "lm_pwd ", ps, depth, usr->lm_pwd , sizeof(usr->lm_pwd )); prs_uint8s (False, "nt_pwd ", ps, depth, usr->nt_pwd , sizeof(usr->nt_pwd )); @@ -5130,15 +5253,25 @@ static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *p /* here begins pointed-to data */ smb_io_unistr2("uni_user_name ", &(usr->uni_user_name) , usr->hdr_user_name .buffer, ps, depth); /* username unicode string */ + prs_align(ps); smb_io_unistr2("uni_full_name ", &(usr->uni_full_name) , usr->hdr_full_name .buffer, ps, depth); /* user's full name unicode string */ + prs_align(ps); smb_io_unistr2("uni_home_dir ", &(usr->uni_home_dir) , usr->hdr_home_dir .buffer, ps, depth); /* home directory unicode string */ + prs_align(ps); smb_io_unistr2("uni_dir_drive ", &(usr->uni_dir_drive) , usr->hdr_dir_drive .buffer, ps, depth); /* home directory drive unicode string */ + prs_align(ps); smb_io_unistr2("uni_logon_script", &(usr->uni_logon_script), usr->hdr_logon_script.buffer, ps, depth); /* logon script unicode string */ + prs_align(ps); smb_io_unistr2("uni_profile_path", &(usr->uni_profile_path), usr->hdr_profile_path.buffer, ps, depth); /* profile path unicode string */ - smb_io_unistr2("uni_acct_desc ", &(usr->uni_acct_desc ), usr->hdr_acct_desc .buffer, ps, depth); /* user description unicode string */ + prs_align(ps); + smb_io_unistr2("uni_acct_desc ", &(usr->uni_acct_desc ), usr->hdr_acct_desc .buffer, ps, depth); /* user desc unicode string */ + prs_align(ps); smb_io_unistr2("uni_workstations", &(usr->uni_workstations), usr->hdr_workstations.buffer, ps, depth); /* worksations user can log on from */ + prs_align(ps); smb_io_unistr2("uni_unknown_str ", &(usr->uni_unknown_str ), usr->hdr_unknown_str .buffer, ps, depth); /* unknown string */ + prs_align(ps); smb_io_unistr2("uni_munged_dial ", &(usr->uni_munged_dial ), usr->hdr_munged_dial .buffer, ps, depth); /* worksations user can log on from */ + prs_align(ps); prs_uint32("unknown_6 ", ps, depth, &(usr->unknown_6 )); prs_uint32("padding4 ", ps, depth, &(usr->padding4 )); -- cgit From 32dedee7f006351c505801dc207dbc46ca08044a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 5 Nov 1999 18:40:38 +0000 Subject: experimental spoolss rpcclient commands (This used to be commit c86edef90e7c96d5a99be29e2d2a3679ed26d97d) --- source3/rpc_parse/parse_spoolss.c | 155 +++++++++++++++++++++++++++++++------- 1 file changed, 128 insertions(+), 27 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index c11c1ed43c..c1d8e54afb 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -413,6 +413,54 @@ BOOL spoolss_io_r_open_printer(char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct return True; } +#if 0 +/******************************************************************* + * make a structure. + ********************************************************************/ +BOOL make_spoolss_io_q_open_printer(SPOOL_Q_OPEN_PRINTER *q_u, + uint32 unk_0, + char *printername, + uint32 unk_1, uint32 cbbuf, uint32 devmod, uint32 des_access, + char *station, + char *username) +{ + int len_name = printername != NULL ? strlen(printername) : 0; + + if (q_u == NULL) return False; + + DEBUG(5,("make_spoolss_io_q_open_printer\n")); + + q_u->unknown0 = unk_0; + make_unistr2(&(q_u->uni_domain), dom_name, len_name); + + + prs_uint32("unknown1", ps, depth, &(q_u->unknown1)); + prs_uint32("cbbuf", ps, depth, &(q_u->cbbuf)); + prs_uint32("devmod", ps, depth, &(q_u->devmod)); + prs_uint32("access required", ps, depth, &(q_u->access_required)); + + /* don't care to decode end of packet by now */ + /* but when acl will be implemented, it will be useful */ + + prs_uint32("unknown2", ps, depth, &(q_u->unknown2)); + prs_uint32("unknown3", ps, depth, &(q_u->unknown3)); + prs_uint32("unknown4", ps, depth, &(q_u->unknown4)); + prs_uint32("unknown5", ps, depth, &(q_u->unknown5)); + prs_uint32("unknown6", ps, depth, &(q_u->unknown6)); + prs_uint32("unknown7", ps, depth, &(q_u->unknown7)); + prs_uint32("unknown8", ps, depth, &(q_u->unknown8)); + prs_uint32("unknown9", ps, depth, &(q_u->unknown9)); + prs_uint32("unknown10", ps, depth, &(q_u->unknown10)); + prs_uint32("unknown11", ps, depth, &(q_u->unknown11)); + + smb_io_unistr2("", &(q_u->station),True,ps,depth); + prs_align(ps); + smb_io_unistr2("", &(q_u->username),True,ps,depth); + + return True; +} +#endif + /******************************************************************* * read a structure. * called from spoolss_q_open_printer (srv_spoolss.c) @@ -457,6 +505,27 @@ BOOL spoolss_io_q_open_printer(char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct return True; } +/******************************************************************* + * make a structure. + ********************************************************************/ +BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, + PRINTER_HND *handle, + char *valuename, + uint32 size) +{ + int len_name = valuename != NULL ? strlen(valuename) : 0; + + if (q_u == NULL) return False; + + DEBUG(5,("make_spoolss_q_getprinterdata\n")); + + memcpy(&(q_u->handle), handle, sizeof(q_u->handle)); + make_unistr2(&(q_u->valuename), valuename, len_name); + q_u->size = size; + + return True; +} + /******************************************************************* * read a structure. * called from spoolss_q_getprinterdata (srv_spoolss.c) @@ -1719,11 +1788,17 @@ BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, } } + if (ps->io) + { + /* reading */ + r_u->offered = bufsize_required; + } + DEBUG(4,("spoolss_io_r_getprinterdriver2, size needed: %d\n",bufsize_required)); DEBUG(4,("spoolss_io_r_getprinterdriver2, size offered: %d\n",r_u->offered)); /* check if the buffer is big enough for the datas */ - if (r_u->offeredoffered < bufsize_required) { /* it's too small */ r_u->status=ERROR_INSUFFICIENT_BUFFER; /* say so */ @@ -1973,11 +2048,11 @@ BOOL spoolss_io_r_getprinter(char *desc, DEBUG(4,("spoolss_io_r_getprinter, size offered: %d\n",r_u->offered)); /* check if the buffer is big enough for the datas */ - if (r_u->offeredoffered < bufsize_required) { /* it's too small */ - r_u->status=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ + r_u->status = ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered = 0; /* don't send back the buffer */ DEBUG(4,("spoolss_io_r_getprinter, buffer too small\n")); @@ -1990,6 +2065,16 @@ BOOL spoolss_io_r_getprinter(char *desc, DEBUG(4,("spoolss_io_r_getprinter, buffer large enough\n")); prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + + if (ps->io) + { + /* reading */ + r_u->printer.info = Realloc(NULL, r_u->offered); + } + + if (bufsize_required <= r_u->offered) + { beginning=ps->offset; start_offset=ps->offset; end_offset=start_offset+r_u->offered; @@ -2046,7 +2131,6 @@ BOOL spoolss_io_r_getprinter(char *desc, prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); prs_uint32("status", ps, depth, &(r_u->status)); - return True; } @@ -2061,27 +2145,35 @@ BOOL spoolss_io_r_getprinter(char *desc, ********************************************************************/ static BOOL spoolss_io_read_buffer8(char *desc, prs_struct *ps, uint8 **buffer, uint32 *size,int depth) { - uint32 useless_ptr; - prs_debug(ps, depth, desc, "spoolss_io_read_buffer8"); depth++; prs_align(ps); - prs_uint32("buffer pointer", ps, depth, &useless_ptr); + prs_uint32("buffer size", ps, depth, size); + *buffer = (uint8 *)Realloc(NULL, (*size) * sizeof(uint8) ); + prs_uint8s(True,"buffer",ps,depth,*buffer,*size); + prs_align(ps); + + return True; +} + +/******************************************************************* + * make a structure. + * called from spoolss_getprinter (srv_spoolss.c) + ********************************************************************/ +BOOL make_spoolss_q_getprinter(SPOOL_Q_GETPRINTER *q_u, + PRINTER_HND *hnd, + uint32 level, + uint32 buf_size) +{ + if (q_u == NULL) return False; + + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - if (useless_ptr != 0x0000) - { - prs_uint32("buffer size", ps, depth, size); - *buffer=(uint8 *)malloc( (*size) * sizeof(uint8) ); - prs_uint8s(True,"buffer",ps,depth,*buffer,*size); - prs_align(ps); - } - else - { - *buffer=0x0000; - *size=0x0000; - } + q_u->level = level; + q_u->buffer = (uint8 *)Realloc(NULL, (buf_size) * sizeof(uint8) ); + q_u->offered = buf_size; return True; } @@ -2093,8 +2185,8 @@ static BOOL spoolss_io_read_buffer8(char *desc, prs_struct *ps, uint8 **buffer, BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps, int depth) { - uint32 count; - uint8 *buffer; + uint32 count = 0; + uint32 buf_ptr = q_u->buffer != NULL ? 1 : 0; prs_debug(ps, depth, desc, "spoolss_io_q_getprinter"); depth++; @@ -2104,15 +2196,24 @@ BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, prs_uint32("level", ps, depth, &(q_u->level)); - spoolss_io_read_buffer8("",ps, &buffer, &count,depth); - if (buffer != 0x0000) + if (!ps->io) { - free(buffer); + /* writing */ + buf_ptr = q_u->buffer != NULL ? 1 : 0; + } + prs_uint32("buffer pointer", ps, depth, &buf_ptr); + + if (buf_ptr != 0) + { + spoolss_io_read_buffer8("",ps, &q_u->buffer, &count,depth); + } + if (q_u->buffer != NULL) + { + free(q_u->buffer); } - prs_uint32("buffer size", ps, depth, &(q_u->offered)); - return True; + return count == q_u->offered; } /******************************************************************* -- cgit From bd6467154e73412753c22022b1615cf471bfa297 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 6 Nov 1999 18:11:19 +0000 Subject: spoolss openprinterex / closeprinter client-code. experimental spoolopen command added. jean-francois, f.y.i. i changed the #define for SPOOLSS_OPENPRINTEREX from op code 0x44 to 0x45. (This used to be commit ef7fa58fd3c259c765c3bc82424d4c0f192ec90e) --- source3/rpc_parse/parse_spoolss.c | 92 ++++++++++++++++++++++----------------- 1 file changed, 52 insertions(+), 40 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index c1d8e54afb..d58a4868e6 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -393,13 +393,14 @@ static BOOL smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, /******************************************************************* * write a structure. - * called from spoolss_r_open_printer (srv_spoolss.c) + * called from static spoolss_r_open_printer_ex (srv_spoolss.c) + * called from spoolss_open_printer_ex (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_open_printer(char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "spoolss_io_r_open_printer"); + prs_debug(ps, depth, desc, "spoolss_io_r_open_printer_ex"); depth++; prs_align(ps); @@ -413,73 +414,67 @@ BOOL spoolss_io_r_open_printer(char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct return True; } -#if 0 /******************************************************************* * make a structure. ********************************************************************/ -BOOL make_spoolss_io_q_open_printer(SPOOL_Q_OPEN_PRINTER *q_u, - uint32 unk_0, +BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, char *printername, - uint32 unk_1, uint32 cbbuf, uint32 devmod, uint32 des_access, + uint32 cbbuf, uint32 devmod, uint32 des_access, char *station, char *username) { int len_name = printername != NULL ? strlen(printername) : 0; + int len_sta = station != NULL ? strlen(station ) : 0; + int len_user = username != NULL ? strlen(username ) : 0; if (q_u == NULL) return False; - DEBUG(5,("make_spoolss_io_q_open_printer\n")); + DEBUG(5,("make_spoolss_io_q_open_printer_ex\n")); - q_u->unknown0 = unk_0; - make_unistr2(&(q_u->uni_domain), dom_name, len_name); + q_u->ptr = 1; + make_unistr2(&(q_u->printername), printername, len_name); + q_u->unknown0 = 0x0; /* 0x0000 0000 */ + q_u->cbbuf = cbbuf; /* 0x0000 0000 */ + q_u->devmod = devmod; /* 0x0000 0000 */ + q_u->access_required = des_access; - prs_uint32("unknown1", ps, depth, &(q_u->unknown1)); - prs_uint32("cbbuf", ps, depth, &(q_u->cbbuf)); - prs_uint32("devmod", ps, depth, &(q_u->devmod)); - prs_uint32("access required", ps, depth, &(q_u->access_required)); - - /* don't care to decode end of packet by now */ - /* but when acl will be implemented, it will be useful */ - - prs_uint32("unknown2", ps, depth, &(q_u->unknown2)); - prs_uint32("unknown3", ps, depth, &(q_u->unknown3)); - prs_uint32("unknown4", ps, depth, &(q_u->unknown4)); - prs_uint32("unknown5", ps, depth, &(q_u->unknown5)); - prs_uint32("unknown6", ps, depth, &(q_u->unknown6)); - prs_uint32("unknown7", ps, depth, &(q_u->unknown7)); - prs_uint32("unknown8", ps, depth, &(q_u->unknown8)); - prs_uint32("unknown9", ps, depth, &(q_u->unknown9)); - prs_uint32("unknown10", ps, depth, &(q_u->unknown10)); - prs_uint32("unknown11", ps, depth, &(q_u->unknown11)); + q_u->unknown1 = 0x1; + q_u->unknown2 = 0x1; + q_u->unknown3 = 0x149f7d8; /* looks like a pointer */ + q_u->unknown4 = 0x1c; + q_u->unknown5 = 0x00b94dd0; + q_u->unknown6 = 0x0149f5cc; /* looks like _another_ pointer */ + q_u->unknown7 = 0x00000565; + q_u->unknown8 = 0x2; + q_u->unknown9 = 0x0; + q_u->unknown10 = 0x0; - smb_io_unistr2("", &(q_u->station),True,ps,depth); - prs_align(ps); - smb_io_unistr2("", &(q_u->username),True,ps,depth); + make_unistr2(&(q_u->station), station, len_sta); + make_unistr2(&(q_u->username), username, len_user); return True; } -#endif /******************************************************************* * read a structure. - * called from spoolss_q_open_printer (srv_spoolss.c) + * called from spoolss_q_open_printer_ex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_open_printer(char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "spoolss_io_q_open_printer"); + prs_debug(ps, depth, desc, "spoolss_io_q_open_printer_ex"); depth++; prs_align(ps); - prs_uint32("unknown0", ps, depth, &(q_u->unknown0)); + prs_uint32("ptr", ps, depth, &(q_u->ptr)); smb_io_unistr2("", &(q_u->printername),True,ps,depth); prs_align(ps); - prs_uint32("unknown1", ps, depth, &(q_u->unknown1)); + prs_uint32("unknown0", ps, depth, &(q_u->unknown0)); prs_uint32("cbbuf", ps, depth, &(q_u->cbbuf)); prs_uint32("devmod", ps, depth, &(q_u->devmod)); prs_uint32("access required", ps, depth, &(q_u->access_required)); @@ -487,6 +482,7 @@ BOOL spoolss_io_q_open_printer(char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct /* don't care to decode end of packet by now */ /* but when acl will be implemented, it will be useful */ + prs_uint32("unknown1", ps, depth, &(q_u->unknown1)); prs_uint32("unknown2", ps, depth, &(q_u->unknown2)); prs_uint32("unknown3", ps, depth, &(q_u->unknown3)); prs_uint32("unknown4", ps, depth, &(q_u->unknown4)); @@ -496,11 +492,11 @@ BOOL spoolss_io_q_open_printer(char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct prs_uint32("unknown8", ps, depth, &(q_u->unknown8)); prs_uint32("unknown9", ps, depth, &(q_u->unknown9)); prs_uint32("unknown10", ps, depth, &(q_u->unknown10)); - prs_uint32("unknown11", ps, depth, &(q_u->unknown11)); smb_io_unistr2("", &(q_u->station),True,ps,depth); prs_align(ps); smb_io_unistr2("", &(q_u->username),True,ps,depth); + prs_align(ps); return True; } @@ -575,9 +571,24 @@ BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_st return True; } +/******************************************************************* + * make a structure. + ********************************************************************/ +BOOL make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER *q_u, PRINTER_HND *hnd) +{ + if (q_u == NULL) return False; + + DEBUG(5,("make_spoolss_q_closeprinter\n")); + + memcpy(&(q_u->handle), hnd, sizeof(q_u->handle)); + + return True; +} + /******************************************************************* * read a structure. - * called from spoolss_q_closeprinter (srv_spoolss.c) + * called from static spoolss_q_closeprinter (srv_spoolss.c) + * called from spoolss_closeprinter (cli_spoolss.c) ********************************************************************/ BOOL spoolss_io_q_closeprinter(char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct *ps, int depth) { @@ -595,7 +606,8 @@ BOOL spoolss_io_q_closeprinter(char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct /******************************************************************* * write a structure. - * called from spoolss_r_closeprinter (srv_spoolss.c) + * called from static spoolss_r_closeprinter (srv_spoolss.c) + * called from spoolss_closeprinter (cli_spoolss.c) ********************************************************************/ BOOL spoolss_io_r_closeprinter(char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct *ps, int depth) { -- cgit From 0f18ca772da544a93799ca130a8f23529aad98f6 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 6 Nov 1999 19:52:04 +0000 Subject: added rpcclient spoolenum command. enumerates printers. spoolss_r_io_enumprinters doesn't decode strings correctly as printer_info_1/2 code has only been written to write structures, not read them. (This used to be commit 135eaa977385cdd5f572a51f654f14d893347d7b) --- source3/rpc_parse/parse_spoolss.c | 188 ++++++++++++++++++++++++++++---------- 1 file changed, 141 insertions(+), 47 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index d58a4868e6..59fbd6ac23 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1690,15 +1690,27 @@ static BOOL spoolss_io_read_buffer(char *desc, prs_struct *ps, int depth, BUFFER if (buffer->ptr != 0x0000) { prs_uint32("size", ps, depth, &(buffer->size)); - buffer->data=(uint8 *)malloc( (buffer->size) * sizeof(uint8) ); - prs_uint8s(True,"buffer", ps, depth, buffer->data, buffer->size); + if (ps->io) + { + /* reading */ + buffer->data=(uint8 *)malloc( buffer->size * sizeof(uint8) ); + } + if (buffer->data == NULL) + { + return False; + } + prs_uint8s(True, "buffer", ps, depth, buffer->data, buffer->size); prs_align(ps); } else { - buffer->data=0x0000; - buffer->size=0x0000; + if (ps->io) + { + /* reading */ + buffer->data=0x0000; + buffer->size=0x0000; + } } return True; @@ -1885,6 +1897,33 @@ BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, return True; } +/******************************************************************* + * make a structure. + ********************************************************************/ +BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, + uint32 flags, + const char* servername, + uint32 level, + uint32 size) +{ + size_t len_name = servername != NULL ? strlen(servername) : 0; + + DEBUG(5,("make_spoolss_q_enumprinters. size: %d\n", size)); + + q_u->flags = flags; + + make_unistr2(&(q_u->servername), servername, len_name); + + q_u->level = level; + q_u->buffer.ptr = (size != 0) ? 1 : 0; + q_u->buffer.size = size; + q_u->buffer.data = (uint8 *)Realloc( NULL, + (q_u->buffer.size) * sizeof(uint8) ); + q_u->buf_size = size; + + return True; +} + /******************************************************************* * read a structure. * called from spoolss_enumprinters (srv_spoolss.c) @@ -1892,24 +1931,34 @@ BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth) { - uint32 useless_ptr; + uint32 useless_ptr = 0x01; prs_debug(ps, depth, desc, "spoolss_io_q_enumprinters"); depth++; prs_align(ps); prs_uint32("flags", ps, depth, &(q_u->flags)); - prs_uint32("useless ptr", ps, depth, &useless_ptr); smb_io_unistr2("", &(q_u->servername),True,ps,depth); - prs_align(ps); prs_uint32("level", ps, depth, &(q_u->level)); spoolss_io_read_buffer("buffer", ps, depth, &(q_u->buffer)); + if (!ps->io) + { + /* writing */ + if (q_u->buffer.data != NULL) + { + free(q_u->buffer.data); + } + q_u->buffer.data = NULL; + } + + prs_uint32("buf_size", ps, depth, &q_u->buf_size); + return True; } @@ -1926,6 +1975,7 @@ BOOL spoolss_io_r_enumprinters(char *desc, int i; uint32 start_offset, end_offset, beginning; uint32 bufsize_required=0; + uint32 tmp_ct = 0; PRINTER_INFO_1 *info1; PRINTER_INFO_2 *info2; @@ -1935,76 +1985,120 @@ BOOL spoolss_io_r_enumprinters(char *desc, prs_align(ps); prs_uint32("pointer", ps, depth, &useless_ptr); - for(i=0;ireturned;i++) + if (!ps->io) { - switch (r_u->level) + /* writing */ + for(i=0;ireturned;i++) { - case 1: - info1 = r_u->printer.printers_1[i]; - bufsize_required += spoolss_size_printer_info_1(info1); - break; - case 2: - info2 = r_u->printer.printers_2[i]; - bufsize_required += spoolss_size_printer_info_2(info2); - break; + switch (r_u->level) + { + case 1: + info1 = r_u->printer.printers_1[i]; + bufsize_required += spoolss_size_printer_info_1(info1); + break; + case 2: + info2 = r_u->printer.printers_2[i]; + bufsize_required += spoolss_size_printer_info_2(info2); + break; + } } + + DEBUG(4,("spoolss_io_r_enumprinters, size needed: %d\n",bufsize_required)); + DEBUG(4,("spoolss_io_r_enumprinters, size offered: %d\n",r_u->offered)); + + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; + r_u->offered=0; + /*r_u->returned=0;*/ + + DEBUG(4,("spoolss_io_r_enumprinters, buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("count", ps, depth, &(r_u->returned)); + prs_uint32("status", ps, depth, &(r_u->status)); + return False; + } + + mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); + + DEBUG(4,("spoolss_io_r_enumprinters, buffer large enough\n")); } + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - DEBUG(4,("spoolss_io_r_enumprinters, size needed: %d\n",bufsize_required)); - DEBUG(4,("spoolss_io_r_enumprinters, size offered: %d\n",r_u->offered)); + /* have to skip to end of buffer when reading, and have to record + * size of buffer when writing. *shudder*. + */ - if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; - r_u->offered=0; - /*r_u->returned=0;*/ + beginning = ps->offset; + start_offset = ps->offset; + end_offset = start_offset + r_u->offered; - DEBUG(4,("spoolss_io_r_enumprinters, buffer too small\n")); + if (ps->io) + { + /* reading */ + ps->offset = beginning + r_u->offered; - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_align(ps); + prs_uint32("buffer size", ps, depth, &(bufsize_required)); prs_uint32("count", ps, depth, &(r_u->returned)); - prs_uint32("status", ps, depth, &(r_u->status)); - return False; - } - - mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); - - DEBUG(4,("spoolss_io_r_enumprinters, buffer large enough\n")); + + ps->offset = beginning; + } - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + tmp_ct = 0; - beginning=ps->offset; - start_offset=ps->offset; - end_offset=start_offset+r_u->offered; - for(i=0;ireturned;i++) { switch (r_u->level) { case 1: + { + if (ps->io) + { + /* reading */ + r_u->printer.printers_1[i] = add_print1_to_array(&tmp_ct, &r_u->printer.printers_1, NULL); + } info1=r_u->printer.printers_1[i]; + if (info1 == NULL) + { + return False; + } smb_io_printer_info_1(desc, info1, ps, depth, &start_offset, &end_offset); break; + } case 2: + { + if (ps->io) + { + /* reading */ + r_u->printer.printers_2[i] = add_print2_to_array(&tmp_ct, &r_u->printer.printers_2, NULL); + } info2=r_u->printer.printers_2[i]; + if (info2 == NULL) + { + return False; + } smb_io_printer_info_2(desc, info2, ps, depth, &start_offset, &end_offset); break; + } } } - ps->offset=beginning+r_u->offered; + ps->offset = beginning + r_u->offered; prs_align(ps); - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("buffer size", ps, depth, &(bufsize_required)); prs_uint32("count", ps, depth, &(r_u->returned)); prs_uint32("status", ps, depth, &(r_u->status)); -- cgit From 4dbd1c135ca286f59a5f692abd51a0c78f4cb6a0 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 6 Nov 1999 20:36:07 +0000 Subject: fixed string function for reading in printer_info_N. (This used to be commit 0249ae50ad8135cf3fd11a3b85f771f2347fcb29) --- source3/rpc_parse/parse_spoolss.c | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 59fbd6ac23..c7d3d894d1 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -956,19 +956,36 @@ static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int static BOOL smb_io_relstr(char *desc, prs_struct *ps, int depth, UNISTR *buffer, uint32 *start_offset, uint32 *end_offset) { - uint32 struct_offset; - uint32 relative_offset; - - struct_offset=ps->offset; - *end_offset-= 2*(str_len_uni(buffer)+1); - ps->offset=*end_offset; - spoolss_smb_io_unistr(desc, buffer, ps, depth); + if (!ps->io) + { + uint32 struct_offset = ps->offset; + uint32 relative_offset; + + /* writing */ + *end_offset -= 2*(str_len_uni(buffer)+1); + ps->offset=*end_offset; + spoolss_smb_io_unistr(desc, buffer, ps, depth); - ps->offset=struct_offset; - relative_offset=*end_offset-*start_offset; + ps->offset=struct_offset; + relative_offset=*end_offset-*start_offset; - prs_uint32("offset", ps, depth, &(relative_offset)); + prs_uint32("offset", ps, depth, &(relative_offset)); + } + else + { + uint32 old_offset; + uint32 relative_offset; + + prs_uint32("offset", ps, depth, &(relative_offset)); + + old_offset = ps->offset; + ps->offset = (*start_offset) + relative_offset; + spoolss_smb_io_unistr(desc, buffer, ps, depth); + + *end_offset = ps->offset; + ps->offset = old_offset; + } return True; } -- cgit From 2c3fdead4d27984b1969b0f2f38bdb494647118b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 6 Nov 1999 21:25:52 +0000 Subject: missed mem_grow_data call (This used to be commit 681cbb9ec1310fa81f4da40ef0cfed92500b5f4e) --- source3/rpc_parse/parse_spoolss.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index c7d3d894d1..6b60b74147 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1716,6 +1716,8 @@ static BOOL spoolss_io_read_buffer(char *desc, prs_struct *ps, int depth, BUFFER { return False; } + mem_grow_data(&(ps->data), ps->io, + ps->data->data_size + buffer->size, 0); prs_uint8s(True, "buffer", ps, depth, buffer->data, buffer->size); prs_align(ps); -- cgit From c6e3fc5838aacde454c4b16436532455c4dd8ecf Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 8 Nov 1999 20:58:06 +0000 Subject: const feeding frenzy (This used to be commit e0eb390ab3e2a0cce191e78ea4ff90d088a8895c) --- source3/rpc_parse/parse_misc.c | 2 +- source3/rpc_parse/parse_samr.c | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 03cec1128c..9f224c120b 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -179,7 +179,7 @@ BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) /******************************************************************* creates a DOM_SID2 structure. ********************************************************************/ -BOOL make_dom_sid2(DOM_SID2 *sid2, DOM_SID *sid) +BOOL make_dom_sid2(DOM_SID2 *sid2, const DOM_SID *sid) { sid_copy(&sid2->sid, sid); sid2->num_auths = sid2->sid.num_auths; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 0059aed756..2cd796f874 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -150,8 +150,8 @@ BOOL samr_io_r_lookup_domain(char *desc, SAMR_R_LOOKUP_DOMAIN *r_u, prs_struct * reads or writes a structure. ********************************************************************/ BOOL make_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, - POLICY_HND *connect_pol, uint32 flags, - DOM_SID *sid) + const POLICY_HND *connect_pol, uint32 flags, + const DOM_SID *sid) { if (q_u == NULL) return False; @@ -1846,7 +1846,7 @@ BOOL samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct makes a SAMR_Q_OPEN_GROUP structure. ********************************************************************/ BOOL make_samr_q_open_group(SAMR_Q_OPEN_GROUP *q_c, - POLICY_HND *hnd, uint32 unk, uint32 rid) + const POLICY_HND *hnd, uint32 unk, uint32 rid) { if (q_c == NULL || hnd == NULL) return False; @@ -3290,7 +3290,7 @@ BOOL samr_io_r_set_aliasinfo(char *desc, SAMR_R_SET_ALIASINFO *r_u, prs_struct makes a SAMR_Q_QUERY_USERALIASES structure. ********************************************************************/ BOOL make_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u, - POLICY_HND *hnd, + const POLICY_HND *hnd, uint32 *ptr_sid, DOM_SID2 *sid) { if (q_u == NULL || hnd == NULL) return False; @@ -3484,7 +3484,7 @@ void samr_free_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u) /******************************************************************* makes a SAMR_Q_OPEN_ALIAS structure. ********************************************************************/ -BOOL make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, POLICY_HND *pol, +BOOL make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, const POLICY_HND *pol, uint32 unknown_0, uint32 rid) { if (q_u == NULL) return False; @@ -3545,7 +3545,7 @@ BOOL samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, i makes a SAMR_Q_LOOKUP_RIDS structure. ********************************************************************/ BOOL make_samr_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u, - POLICY_HND *pol, uint32 flags, + const POLICY_HND *pol, uint32 flags, uint32 num_rids, uint32 *rid) { if (q_u == NULL) return False; @@ -4117,7 +4117,8 @@ BOOL samr_io_r_delete_dom_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS *r_u, prs_s /******************************************************************* makes a SAMR_Q_QUERY_ALIASMEM structure. ********************************************************************/ -BOOL make_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_c, POLICY_HND *hnd) +BOOL make_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_c, + const POLICY_HND *hnd) { if (q_c == NULL || hnd == NULL) return False; @@ -4404,7 +4405,7 @@ BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p reads or writes a structure. ********************************************************************/ BOOL make_samr_q_open_user(SAMR_Q_OPEN_USER *q_u, - POLICY_HND *pol, + const POLICY_HND *pol, uint32 unk_0, uint32 rid) { if (q_u == NULL) return False; @@ -5617,7 +5618,7 @@ BOOL samr_io_r_set_userinfo(char *desc, SAMR_R_SET_USERINFO *r_u, prs_struct *p makes a SAMR_Q_CONNECT structure. ********************************************************************/ BOOL make_samr_q_connect(SAMR_Q_CONNECT *q_u, - char *srv_name, uint32 unknown_0) + const char *srv_name, uint32 unknown_0) { int len_srv_name = strlen(srv_name); -- cgit From 702b085293af8ffe7a04865db78a36c85beb22ee Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 8 Nov 1999 22:00:41 +0000 Subject: preparation for doing a spoolss enum jobs command. had to rewrite spoolss_enumjobs parsing code to do read / writes not just writes. (This used to be commit bc659a09f9103eee9616279e27fafacf89dcd9b9) --- source3/rpc_parse/parse_spoolss.c | 278 ++++++++++++++++++++++++++------------ 1 file changed, 192 insertions(+), 86 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 6b60b74147..059b21644f 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1687,6 +1687,18 @@ static uint32 spoolss_size_monitor_info_1(PRINTMONITOR_1 *info) return True; } +/******************************************************************* + * make a structure. + ********************************************************************/ +static BOOL make_spoolss_buffer(BUFFER* buffer, uint32 size) +{ + buffer->ptr = (size != 0) ? 1 : 0; + buffer->size = size; + buffer->data = (uint8 *)Realloc( NULL, (buffer->size) * sizeof(uint8) ); + + return (buffer->data != NULL || size == 0); +} + /******************************************************************* * read a uint8 buffer of size *size. * allocate memory for it @@ -1732,6 +1744,15 @@ static BOOL spoolss_io_read_buffer(char *desc, prs_struct *ps, int depth, BUFFER } } + if (!ps->io) + { + /* writing */ + if (buffer->data != NULL) + { + free(buffer->data); + } + buffer->data = NULL; + } return True; } @@ -1934,10 +1955,7 @@ BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, make_unistr2(&(q_u->servername), servername, len_name); q_u->level = level; - q_u->buffer.ptr = (size != 0) ? 1 : 0; - q_u->buffer.size = size; - q_u->buffer.data = (uint8 *)Realloc( NULL, - (q_u->buffer.size) * sizeof(uint8) ); + make_spoolss_buffer(&q_u->buffer, size); q_u->buf_size = size; return True; @@ -1966,19 +1984,29 @@ BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, spoolss_io_read_buffer("buffer", ps, depth, &(q_u->buffer)); - if (!ps->io) + prs_uint32("buf_size", ps, depth, &q_u->buf_size); + + return True; +} + +/**************************************************************************** +****************************************************************************/ +void free_r_enumprinters(SPOOL_R_ENUMPRINTERS *r_u) +{ + DEBUG(4,("free_enum_printers_info: [%d] structs to free at level [%d]\n", r_u->returned, r_u->level)); + switch (r_u->level) { - /* writing */ - if (q_u->buffer.data != NULL) + case 1: { - free(q_u->buffer.data); + free_print1_array(r_u->returned, r_u->printer.printers_1); + break; + } + case 2: + { + free_print2_array(r_u->returned, r_u->printer.printers_2); + break; } - q_u->buffer.data = NULL; } - - prs_uint32("buf_size", ps, depth, &q_u->buf_size); - - return True; } /******************************************************************* @@ -1994,7 +2022,6 @@ BOOL spoolss_io_r_enumprinters(char *desc, int i; uint32 start_offset, end_offset, beginning; uint32 bufsize_required=0; - uint32 tmp_ct = 0; PRINTER_INFO_1 *info1; PRINTER_INFO_2 *info2; @@ -2073,10 +2100,10 @@ BOOL spoolss_io_r_enumprinters(char *desc, ps->offset = beginning; } - tmp_ct = 0; - for(i=0;ireturned;i++) { + uint32 tmp_ct = 0; + switch (r_u->level) { case 1: @@ -2121,6 +2148,12 @@ BOOL spoolss_io_r_enumprinters(char *desc, prs_uint32("count", ps, depth, &(r_u->returned)); prs_uint32("status", ps, depth, &(r_u->status)); + if (ps->io) + { + /* writing */ + free_r_enumprinters(r_u); + } + return True; } @@ -2482,6 +2515,26 @@ BOOL spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int de return True; } +/**************************************************************************** +****************************************************************************/ +void free_r_enumjobs(SPOOL_R_ENUMJOBS *r_u) +{ + DEBUG(4,("free_enum_jobs_info: [%d] structs to free at level [%d]\n", r_u->numofjobs, r_u->level)); + switch (r_u->level) + { + case 1: + { + free_job1_array(r_u->numofjobs, r_u->job.job_info_1); + break; + } + case 2: + { + free_job2_array(r_u->numofjobs, r_u->job.job_info_2); + break; + } + } +} + /******************************************************************* ********************************************************************/ BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth) @@ -2489,6 +2542,7 @@ BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, in uint32 useless_ptr=0xADDE0FF0; uint32 start_offset, end_offset, beginning; uint32 bufsize_required=0; + uint32 tmp_ct = 0; int i; prs_debug(ps, depth, desc, "spoolss_io_r_enumjobs"); @@ -2498,104 +2552,158 @@ BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, in prs_uint32("pointer", ps, depth, &useless_ptr); - switch (r_u->level) + if (!ps->io) { - case 1: + /* writing */ + switch (r_u->level) { - JOB_INFO_1 *info; - info=r_u->job.job_info_1; - - for (i=0; inumofjobs; i++) + case 1: { - bufsize_required += spoolss_size_job_info_1(&(info[i])); + for (i=0; inumofjobs; i++) + { + JOB_INFO_1 *info; + info=r_u->job.job_info_1[i]; + bufsize_required += spoolss_size_job_info_1(&(info[i])); + } + break; } - break; + case 2: + { + for (i=0; inumofjobs; i++) + { + JOB_INFO_2 *info; + info=r_u->job.job_info_2[i]; + + bufsize_required += spoolss_size_job_info_2(&(info[i])); + } + break; + } } - case 2: - { - JOB_INFO_2 *info; - info=r_u->job.job_info_2; + + DEBUG(4,("spoolss_io_r_enumjobs, size needed: %d\n",bufsize_required)); + DEBUG(4,("spoolss_io_r_enumjobs, size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ - for (i=0; inumofjobs; i++) - { - bufsize_required += spoolss_size_job_info_2(&(info[i])); - } - break; - } + DEBUG(4,("spoolss_io_r_enumjobs, buffer too small\n")); + + } + mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); } + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + + beginning=ps->offset; + start_offset=ps->offset; + end_offset=start_offset+r_u->offered; - DEBUG(4,("spoolss_io_r_enumjobs, size needed: %d\n",bufsize_required)); - DEBUG(4,("spoolss_io_r_enumjobs, size offered: %d\n",r_u->offered)); + tmp_ct = 0; - /* check if the buffer is big enough for the datas */ - if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ - - DEBUG(4,("spoolss_io_r_enumjobs, buffer too small\n")); + if (ps->io) + { + /* reading */ + ps->offset = beginning + r_u->offered; - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + prs_align(ps); + prs_uint32("buffer size", ps, depth, &(bufsize_required)); + prs_uint32("numofjobs", ps, depth, &(r_u->numofjobs)); + + ps->offset = beginning; } - else - { - mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); - - DEBUG(4,("spoolss_io_r_enumjobs, buffer large enough\n")); - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - beginning=ps->offset; - start_offset=ps->offset; - end_offset=start_offset+r_u->offered; - - switch (r_u->level) + switch (r_u->level) + { + case 1: { - case 1: + JOB_INFO_1 *info; + for (i=0; inumofjobs; i++) { - JOB_INFO_1 *info; - for (i=0; inumofjobs; i++) + if (ps->io) { - info = &(r_u->job.job_info_1[i]); - smb_io_job_info_1(desc, - info, - ps, - depth, - &start_offset, - &end_offset); + /* reading */ + r_u->job.job_info_1[i] = add_job1_to_array(&tmp_ct, &r_u->job.job_info_1, NULL); } - break; + info = r_u->job.job_info_1[i]; + smb_io_job_info_1(desc, + info, + ps, + depth, + &start_offset, + &end_offset); } - case 2: + break; + } + case 2: + { + JOB_INFO_2 *info; + for (i=0; inumofjobs; i++) { - JOB_INFO_2 *info; - for (i=0; inumofjobs; i++) + if (ps->io) { - info = &(r_u->job.job_info_2[i]); - smb_io_job_info_2(desc, - info, - ps, - depth, - &start_offset, - &end_offset); + /* reading */ + r_u->job.job_info_2[i] = add_job2_to_array(&tmp_ct, &r_u->job.job_info_2, NULL); } - break; + info = r_u->job.job_info_2[i]; + smb_io_job_info_2(desc, + info, + ps, + depth, + &start_offset, + &end_offset); } - - } - ps->offset=beginning+r_u->offered; - prs_align(ps); - } + break; + } + + } + ps->offset=beginning+r_u->offered; + prs_align(ps); /* * if the buffer was too small, send the minimum required size * if it was too large, send the real needed size */ - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("buffer size", ps, depth, &(bufsize_required)); prs_uint32("numofjobs", ps, depth, &(r_u->numofjobs)); prs_uint32("status", ps, depth, &(r_u->status)); + if (ps->io) + { + /* writing */ + free_r_enumjobs(r_u); + } + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, PRINTER_HND *hnd, + uint32 firstjob, + uint32 numofjobs, + uint32 level, + uint32 buf_size) +{ + if (q_u == NULL) + { + return False; + } + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + q_u->firstjob = firstjob; + q_u->numofjobs = numofjobs; + q_u->level = level; + + if (!make_spoolss_buffer(&q_u->buffer, buf_size)) + { + return False; + } + q_u->buf_size = buf_size; + return True; } @@ -2616,8 +2724,6 @@ BOOL spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, in spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); - prs_align(ps); - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); return True; -- cgit From 826ad16b363accc4029178cf9087b02362245e11 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 9 Nov 1999 19:35:30 +0000 Subject: debugging rpcclient spoolenum and spooljobs commands. oh, did i forget to mention, there's a spooljobs command, and it uses command-line completion? prints out NT print jobs really nicely, too. (This used to be commit e6e5caf16c8d120f0c11fa63061f2786098e3357) --- source3/rpc_parse/parse_spoolss.c | 159 ++++++++++++++++++++------------------ 1 file changed, 83 insertions(+), 76 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 059b21644f..6f1cfdc63c 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -418,10 +418,10 @@ BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_ * make a structure. ********************************************************************/ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, - char *printername, + const char *printername, uint32 cbbuf, uint32 devmod, uint32 des_access, - char *station, - char *username) + const char *station, + const char *username) { int len_name = printername != NULL ? strlen(printername) : 0; int len_sta = station != NULL ? strlen(station ) : 0; @@ -1722,7 +1722,7 @@ static BOOL spoolss_io_read_buffer(char *desc, prs_struct *ps, int depth, BUFFER if (ps->io) { /* reading */ - buffer->data=(uint8 *)malloc( buffer->size * sizeof(uint8) ); + buffer->data=(uint8 *)Realloc(NULL, buffer->size * sizeof(uint8) ); } if (buffer->data == NULL) { @@ -2022,6 +2022,7 @@ BOOL spoolss_io_r_enumprinters(char *desc, int i; uint32 start_offset, end_offset, beginning; uint32 bufsize_required=0; + uint32 tmp_ct = 0; PRINTER_INFO_1 *info1; PRINTER_INFO_2 *info2; @@ -2102,7 +2103,6 @@ BOOL spoolss_io_r_enumprinters(char *desc, for(i=0;ireturned;i++) { - uint32 tmp_ct = 0; switch (r_u->level) { @@ -2113,7 +2113,7 @@ BOOL spoolss_io_r_enumprinters(char *desc, /* reading */ r_u->printer.printers_1[i] = add_print1_to_array(&tmp_ct, &r_u->printer.printers_1, NULL); } - info1=r_u->printer.printers_1[i]; + info1 = r_u->printer.printers_1[i]; if (info1 == NULL) { return False; @@ -2129,7 +2129,7 @@ BOOL spoolss_io_r_enumprinters(char *desc, /* reading */ r_u->printer.printers_2[i] = add_print2_to_array(&tmp_ct, &r_u->printer.printers_2, NULL); } - info2=r_u->printer.printers_2[i]; + info2 = r_u->printer.printers_2[i]; if (info2 == NULL) { return False; @@ -2148,7 +2148,7 @@ BOOL spoolss_io_r_enumprinters(char *desc, prs_uint32("count", ps, depth, &(r_u->returned)); prs_uint32("status", ps, depth, &(r_u->status)); - if (ps->io) + if (!ps->io) { /* writing */ free_r_enumprinters(r_u); @@ -2539,7 +2539,7 @@ void free_r_enumjobs(SPOOL_R_ENUMJOBS *r_u) ********************************************************************/ BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth) { - uint32 useless_ptr=0xADDE0FF0; + uint32 useless_ptr = 0; uint32 start_offset, end_offset, beginning; uint32 bufsize_required=0; uint32 tmp_ct = 0; @@ -2550,8 +2550,6 @@ BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, in prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - if (!ps->io) { /* writing */ @@ -2587,92 +2585,102 @@ BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, in if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ + r_u->status = ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered = bufsize_required; + useless_ptr = 0; DEBUG(4,("spoolss_io_r_enumjobs, buffer too small\n")); } + else + { + useless_ptr = 1; + } mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); } + prs_uint32("pointer", ps, depth, &useless_ptr); prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - beginning=ps->offset; - start_offset=ps->offset; - end_offset=start_offset+r_u->offered; - - tmp_ct = 0; - - if (ps->io) + if (useless_ptr != 0) { - /* reading */ - ps->offset = beginning + r_u->offered; + beginning=ps->offset; + start_offset=ps->offset; + end_offset=start_offset+r_u->offered; + + tmp_ct = 0; - prs_align(ps); - prs_uint32("buffer size", ps, depth, &(bufsize_required)); - prs_uint32("numofjobs", ps, depth, &(r_u->numofjobs)); + if (ps->io) + { + /* reading */ + ps->offset = beginning + r_u->offered; - ps->offset = beginning; - } - - switch (r_u->level) - { - case 1: + prs_align(ps); + prs_uint32("buffer size", ps, depth, &(bufsize_required)); + prs_uint32("numofjobs", ps, depth, &(r_u->numofjobs)); + + ps->offset = beginning; + } + + switch (r_u->level) { - JOB_INFO_1 *info; - for (i=0; inumofjobs; i++) + case 1: { - if (ps->io) + JOB_INFO_1 *info; + for (i=0; inumofjobs; i++) { - /* reading */ - r_u->job.job_info_1[i] = add_job1_to_array(&tmp_ct, &r_u->job.job_info_1, NULL); + if (ps->io) + { + /* reading */ + r_u->job.job_info_1[i] = add_job1_to_array(&tmp_ct, &r_u->job.job_info_1, NULL); + } + info = r_u->job.job_info_1[i]; + smb_io_job_info_1(desc, + info, + ps, + depth, + &start_offset, + &end_offset); } - info = r_u->job.job_info_1[i]; - smb_io_job_info_1(desc, - info, - ps, - depth, - &start_offset, - &end_offset); + break; } - break; - } - case 2: - { - JOB_INFO_2 *info; - for (i=0; inumofjobs; i++) + case 2: { - if (ps->io) + JOB_INFO_2 *info; + for (i=0; inumofjobs; i++) { - /* reading */ - r_u->job.job_info_2[i] = add_job2_to_array(&tmp_ct, &r_u->job.job_info_2, NULL); + if (ps->io) + { + /* reading */ + r_u->job.job_info_2[i] = add_job2_to_array(&tmp_ct, &r_u->job.job_info_2, NULL); + } + info = r_u->job.job_info_2[i]; + smb_io_job_info_2(desc, + info, + ps, + depth, + &start_offset, + &end_offset); } - info = r_u->job.job_info_2[i]; - smb_io_job_info_2(desc, - info, - ps, - depth, - &start_offset, - &end_offset); + break; } - break; - } - - } - ps->offset=beginning+r_u->offered; - prs_align(ps); - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("buffer size", ps, depth, &(bufsize_required)); + + } + ps->offset=beginning+r_u->offered; + prs_align(ps); + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("buffer size", ps, depth, &(bufsize_required)); + } + prs_uint32("numofjobs", ps, depth, &(r_u->numofjobs)); prs_uint32("status", ps, depth, &(r_u->status)); - if (ps->io) + if (!ps->io) { /* writing */ free_r_enumjobs(r_u); @@ -2683,7 +2691,7 @@ BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, in /******************************************************************* ********************************************************************/ -BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, PRINTER_HND *hnd, +BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const PRINTER_HND *hnd, uint32 firstjob, uint32 numofjobs, uint32 level, @@ -2711,8 +2719,7 @@ BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, PRINTER_HND *hnd, ********************************************************************/ BOOL spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth) { - - prs_debug(ps, depth, desc, ""); + prs_debug(ps, depth, desc, "spoolss_io_q_enumjobs"); depth++; prs_align(ps); -- cgit From b231d2fafaff8dc67ef2dbaec778f716524d4f6a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 15 Nov 1999 22:11:10 +0000 Subject: - added DCE/RPC "fault" PDU support. - disabled (AGAIN) the GETDC "if (MAILSLOT\NTLOGON)" code that will get NT5rc2 to work but WILL break win95 (AGAIN). this needs _not_ to be re-enabled but to be replaced with a better mechanism. - added SMBwrite support (note: SMBwriteX already existed) as NT5rc2 is sending DCE/RPC over SMBwrite not SMBwriteX. (This used to be commit 25c70e3c984c4fed19763ed405741e83fe14f87e) --- source3/rpc_parse/parse_rpc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index b902ee1414..82b0be2802 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -220,6 +220,22 @@ BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) return True; } +/******************************************************************* +reads or writes an RPC_HDR_FAULT structure. +********************************************************************/ +BOOL smb_io_rpc_hdr_fault(char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth) +{ + if (rpc == NULL) return False; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_fault"); + depth++; + + prs_uint32("status ", ps, depth, &(rpc->status )); + prs_uint32("reserved", ps, depth, &(rpc->reserved)); + + return True; +} + /******************************************************************* reads or writes an RPC_IFACE structure. ********************************************************************/ -- cgit From 98ee99eb72e537c1a69317cc81305d728e40ab64 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 15 Nov 1999 22:43:08 +0000 Subject: added rpcclient "enumdomains" command. enumerates names of domains for which a PDC is responsible. typical answers are: plus . against a hierarchical, down-level-compatible NT5 PDC, there's likely to be more than these two entries!!!!! (This used to be commit 3146aa6b6049a0d996e9abbe7dbee8526550e7e0) --- source3/rpc_parse/parse_samr.c | 160 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 2cd796f874..ab45152db0 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2755,6 +2755,166 @@ BOOL samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_s } +/******************************************************************* +makes a SAMR_Q_ENUM_DOMAINS structure. +********************************************************************/ +BOOL make_samr_q_enum_domains(SAMR_Q_ENUM_DOMAINS *q_e, POLICY_HND *pol, + uint32 start_idx, uint32 size) +{ + if (q_e == NULL || pol == NULL) return False; + + DEBUG(5,("make_samr_q_enum_domains\n")); + + memcpy(&(q_e->pol), pol, sizeof(*pol)); + + q_e->start_idx = start_idx; + q_e->max_size = size; + + return True; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_q_enum_domains(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++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + prs_align(ps); + + prs_uint32("start_idx", ps, depth, &(q_e->start_idx)); + prs_uint32("max_size ", ps, depth, &(q_e->max_size )); + + prs_align(ps); + + return True; +} + + +/******************************************************************* +makes a SAMR_R_ENUM_DOMAINS structure. +********************************************************************/ +BOOL make_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS *r_u, + uint32 next_idx, + uint32 num_sam_entries, char **doms, uint32 status) +{ + uint32 i; + + if (r_u == NULL) return False; + + DEBUG(5,("make_samr_r_enum_domains\n")); + + r_u->next_idx = next_idx; + r_u->sam = NULL; + r_u->uni_dom_name = NULL; + + 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->sam = (SAM_ENTRY*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); + r_u->uni_dom_name = (UNISTR2*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_dom_name[0])); + + if (r_u->sam == NULL || r_u->uni_dom_name == NULL) + { + DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOMAINS\n")); + return False; + } + + for (i = 0; i < num_sam_entries; i++) + { + int acct_name_len = doms[i] != NULL ? strlen(doms[i]) : 0; + + make_sam_entry(&(r_u->sam[i]), acct_name_len, 0); + make_unistr2(&(r_u->uni_dom_name[i]), doms[i], acct_name_len); + } + + 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; + } + + r_u->status = status; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_r_enum_domains(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++; + + r_u->sam = NULL; + r_u->uni_dom_name = NULL; + + prs_align(ps); + + prs_uint32("next_idx ", ps, depth, &(r_u->next_idx )); + prs_uint32("ptr_entries1", ps, depth, &(r_u->ptr_entries1)); + + if (r_u->ptr_entries1 != 0) + { + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); + prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); + + if (ps->io) + { + r_u->sam = (SAM_ENTRY*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); + r_u->uni_dom_name = (UNISTR2*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_dom_name[0])); + } + + 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 = 0xC0000000|NT_STATUS_MEMORY_NOT_ALLOCATED; + return False; + } + + for (i = 0; i < r_u->num_entries2; i++) + { + prs_grow(ps); + sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); + } + + for (i = 0; i < r_u->num_entries2; i++) + { + prs_grow(ps); + smb_io_unistr2("", &(r_u->uni_dom_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); + } + + prs_align(ps); + + } + + prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + /******************************************************************* makes a SAMR_Q_ENUM_DOM_GROUPS structure. ********************************************************************/ -- cgit From 089b57b5b4e81ceb854f10e89c5d83fc885f8809 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 15 Nov 1999 23:46:27 +0000 Subject: added server-side samr enum domains. fixed some parsing issues, server-side. (This used to be commit 60b0840106a6f5c283a8339428f3cfeb62398355) --- source3/rpc_parse/parse_samr.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ab45152db0..90ae3e8fee 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1136,7 +1136,7 @@ static BOOL make_sam_entry(SAM_ENTRY *sam, uint32 len_sam_name, uint32 rid) { if (sam == NULL) return False; - DEBUG(5,("make_sam_entry\n")); + DEBUG(10,("make_sam_entry: %d %d\n", len_sam_name, rid)); sam->rid = rid; make_uni_hdr(&(sam->hdr_name), len_sam_name); @@ -1278,9 +1278,6 @@ BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct prs_debug(ps, depth, desc, "samr_io_r_enum_dom_users"); depth++; - r_u->sam = NULL; - r_u->uni_acct_name = NULL; - prs_align(ps); prs_uint32("next_idx ", ps, depth, &(r_u->next_idx )); @@ -2865,9 +2862,6 @@ BOOL samr_io_r_enum_domains(char *desc, SAMR_R_ENUM_DOMAINS *r_u, prs_struct *ps prs_debug(ps, depth, desc, "samr_io_r_enum_domains"); depth++; - r_u->sam = NULL; - r_u->uni_dom_name = NULL; - prs_align(ps); prs_uint32("next_idx ", ps, depth, &(r_u->next_idx )); @@ -2895,14 +2889,18 @@ BOOL samr_io_r_enum_domains(char *desc, SAMR_R_ENUM_DOMAINS *r_u, prs_struct *ps for (i = 0; i < r_u->num_entries2; i++) { + fstring tmp; + slprintf(tmp, sizeof(tmp)-1, "dom[%d]", i); prs_grow(ps); - sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); + sam_io_sam_entry(tmp, &(r_u->sam[i]), ps, depth); } for (i = 0; i < r_u->num_entries2; i++) { + fstring tmp; + slprintf(tmp, sizeof(tmp)-1, "dom[%d]", i); prs_grow(ps); - smb_io_unistr2("", &(r_u->uni_dom_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); + smb_io_unistr2(tmp, &(r_u->uni_dom_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); } prs_align(ps); @@ -3028,9 +3026,6 @@ BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_stru prs_debug(ps, depth, desc, "samr_io_r_enum_dom_groups"); depth++; - r_u->sam = NULL; - r_u->uni_grp_name = NULL; - prs_align(ps); prs_uint32("next_idx ", ps, depth, &(r_u->next_idx )); @@ -3191,9 +3186,6 @@ BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_st prs_debug(ps, depth, desc, "samr_io_r_enum_dom_aliases"); depth++; - r_u->sam = NULL; - r_u->uni_grp_name = NULL; - prs_align(ps); prs_uint32("next_idx ", ps, depth, &(r_u->next_idx )); -- cgit From 8a84d000c96fe4487adba5df0f50fa6e8fb27c24 Mon Sep 17 00:00:00 2001 From: Richard Sharpe Date: Tue, 16 Nov 1999 14:10:23 +0000 Subject: Changes to implement NET_AUTH based on NET_AUTH2, to get Win2000 happier in joining a Samba domain. (This used to be commit 70274b5253182f3541584ecd844f07376a3d3df9) --- source3/rpc_parse/parse_net.c | 60 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index a1e699a096..4864308d70 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -436,6 +436,66 @@ BOOL net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int dep return True; } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL make_q_auth(NET_Q_AUTH *q_a, + const char *logon_srv, const char *acct_name, + uint16 sec_chan, const char *comp_name, + DOM_CHAL *clnt_chal) +{ + if (q_a == NULL) return False; + + DEBUG(5,("make_q_auth: %d\n", __LINE__)); + + make_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)); + + DEBUG(5,("make_q_auth: %d\n", __LINE__)); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL net_io_q_auth(char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth) +{ + int old_align; + if (q_a == NULL) return False; + + prs_debug(ps, depth, desc, "net_io_q_auth"); + depth++; + + prs_align(ps); + + smb_io_log_info ("", &(q_a->clnt_id), ps, depth); /* client identification info */ + /* client challenge is _not_ aligned */ + old_align = ps->align; + ps->align = 0; + smb_io_chal ("", &(q_a->clnt_chal), ps, depth); /* client-calculated credentials */ + ps->align = old_align; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL net_io_r_auth(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++; + + prs_align(ps); + + smb_io_chal ("", &(r_a->srv_chal), ps, depth); /* server challenge */ + prs_uint32("status", ps, depth, &(r_a->status)); + + return True; +} /******************************************************************* reads or writes a structure. -- cgit From 6b56ebb7cf48b350ba4e9fd5c61a8900b805a001 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 16 Nov 1999 17:27:41 +0000 Subject: added two new params: "trusted domains" and "trusting domains". these _may_ not actually ever get used, as trust relationships really need to be established with shared secrets, and you need to get the SID of the trusted and trusting domains, so this may have to go in a private/xxx.mac file. (This used to be commit 71f12138679251a9ebcada35969d9baea286a3e9) --- source3/rpc_parse/parse_net.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 4864308d70..b21f612c8a 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -294,7 +294,7 @@ BOOL net_io_r_logon_ctrl2(char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, i makes an NET_R_TRUST_DOM_LIST structure. ********************************************************************/ BOOL make_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, - uint32 num_doms, char *dom_name) + uint32 num_doms, char **dom_name) { uint32 i = 0; @@ -312,7 +312,7 @@ BOOL make_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, for (i = 0; i < num_doms; i++) { fstring domain_name; - fstrcpy(domain_name, dom_name); + fstrcpy(domain_name, dom_name[i]); strupper(domain_name); make_unistr2(&(r_t->uni_trust_dom_name[i]), domain_name, strlen(domain_name)+1); /* the use of UNISTR2 here is non-standard. */ @@ -357,8 +357,8 @@ BOOL net_io_q_trust_dom(char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, prs_debug(ps, depth, desc, "net_io_q_trust_dom"); depth++; - prs_uint32("ptr ", ps, depth, &(q_l->ptr )); - smb_io_unistr2 ("", &(q_l->uni_server_name), q_l->ptr, ps, depth); + prs_uint32("ptr", ps, depth, &(q_l->ptr)); + smb_io_unistr2 ("name", &(q_l->uni_server_name), q_l->ptr, ps, depth); prs_align(ps); -- cgit From cc8df5ce4955fc721e11ff08de052554894d963a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 16 Nov 1999 21:14:53 +0000 Subject: attempting to get nt5 wksta to join domain. 1) had to fix samr "create user" and "set user info" (level 23). 2) had to fix netlogon enum trust domains 3) registry key needed \\ in it not \. (This used to be commit 70b2c1ecbb4fbbb86fea676c80754485aae5ab13) --- source3/rpc_parse/parse_misc.c | 30 ++++++++++++++++++++++++++++++ source3/rpc_parse/parse_net.c | 30 ++++++++---------------------- source3/rpc_parse/parse_samr.c | 3 ++- 3 files changed, 40 insertions(+), 23 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 9f224c120b..2f2c68648a 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -669,6 +669,36 @@ BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) return True; } +/******************************************************************* +creates a BUFFER2 structure. +********************************************************************/ +BOOL make_buffer2_multi(BUFFER2 *str, char *const* const buf, uint32 num) +{ + int i; + char *dest = (char*)str->buffer; + size_t max_len = sizeof(str->buffer)-1; + + ZERO_STRUCTP(str); + + str->buf_max_len = 0; + str->undoc = 0; + + for (i = 0; i < num && max_len > 0; i++) + { + size_t len = buf[i] != NULL ? strlen(buf[i]) : 0; + + str->buf_max_len += len * 2; + str->buf_len += len * 2; + + ascii_to_unibuf(dest, buf[i], max_len); + + dest += len * 2 + 2; + max_len -= len * 2 + 2; + } + + return True; +} + /******************************************************************* creates a BUFFER2 structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index b21f612c8a..c6e366bbbe 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -296,28 +296,18 @@ makes an NET_R_TRUST_DOM_LIST structure. BOOL make_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, uint32 num_doms, char **dom_name) { - uint32 i = 0; - if (r_t == NULL) return False; DEBUG(5,("make_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++) + make_buffer2_multi(&r_t->uni_trust_dom_name, + dom_name, num_doms); + if (num_doms == 0) { - fstring domain_name; - fstrcpy(domain_name, dom_name[i]); - strupper(domain_name); - make_unistr2(&(r_t->uni_trust_dom_name[i]), domain_name, strlen(domain_name)+1); - /* the use of UNISTR2 here is non-standard. */ - r_t->uni_trust_dom_name[i].undoc = 0x1; + r_t->uni_trust_dom_name.buf_max_len = 0x2; + r_t->uni_trust_dom_name.buf_len = 0x2; } + r_t->uni_trust_dom_name.undoc = 0x1; r_t->status = 0; @@ -329,17 +319,13 @@ reads or writes an NET_R_TRUST_DOM_LIST structure. ********************************************************************/ BOOL net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth) { - uint32 i; if (r_t == NULL) return False; prs_debug(ps, depth, desc, "net_io_r_trust_dom"); depth++; - for (i = 0; i < MAX_TRUST_DOMS; i++) - { - if (r_t->uni_trust_dom_name[i].uni_str_len == 0) break; - smb_io_unistr2("", &(r_t->uni_trust_dom_name[i]), True, ps, depth); - } + smb_io_buffer2("", &r_t->uni_trust_dom_name, True, ps, depth); + prs_align(ps); prs_uint32("status", ps, depth, &(r_t->status)); diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 90ae3e8fee..9ea66bbf4b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -250,7 +250,7 @@ BOOL make_samr_r_unknown_2c(SAMR_R_UNKNOWN_2C *q_u, uint32 status) DEBUG(5,("samr_make_r_unknown_2c\n")); - q_u->unknown_0 = 0x00160000; + q_u->unknown_0 = 0x00150000; q_u->unknown_1 = 0x00000000; q_u->status = status; @@ -5716,6 +5716,7 @@ BOOL samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO *q_u, prs_struct *ps if (!ps->io) { + /* writing */ free_samr_q_set_userinfo(q_u); } -- cgit From ccc8585567804d6a7e6f684a97d58871e2fd9f8a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 18 Nov 1999 00:26:11 +0000 Subject: added regqueryval command (experimental) to get reg_io_q_info() and reg_io_r_info() working properly. previously they weren't well understood (well, they were the first of the registry functions i did, back in december 97, ok??? :-) set ntversion to 0x1 in SAMQUERY, so that we reply same as NT4 srv. (This used to be commit 98ddeaf442cb30972cb281bf0489a6e5f7eb2883) --- source3/rpc_parse/parse_reg.c | 123 +++++++++++++++++++++--------------------- 1 file changed, 60 insertions(+), 63 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 01776974fd..1a0168f21d 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -818,31 +818,31 @@ BOOL reg_io_r_get_key_sec(char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, i /******************************************************************* makes a structure. ********************************************************************/ -BOOL make_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char *product_type, - time_t unix_time, uint8 major, uint8 minor) +BOOL make_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, const char *val_name, + uint8 major, uint8 minor) { - int len_type = strlen(product_type); + int len_type = val_name != NULL ? strlen(val_name) + 1 : 0; if (q_i == NULL) return False; memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); - make_uni_hdr(&(q_i->hdr_type), len_type); - make_unistr2(&(q_i->uni_type), product_type, len_type); + make_uni_hdr(&(q_i->hdr_val), len_type); + make_unistr2(&(q_i->uni_val), val_name, len_type); - q_i->ptr1 = 1; - unix_to_nt_time(&(q_i->time), unix_time); - q_i->major_version1 = major; - q_i->minor_version1 = minor; - memset(q_i->pad1, 0, sizeof(q_i->pad1)); + q_i->ptr_type = 1; + q_i->type = 0x77872314; - q_i->ptr2 = 1; - q_i->major_version2 = major; - q_i->minor_version2 = minor; - memset(q_i->pad2, 0, sizeof(q_i->pad2)); + q_i->ptr_uni_type = 0x1; + q_i->uni_type.buf_max_len = 0x104; + q_i->uni_type.buf_len = 0x0; + q_i->uni_type.undoc = 0; - q_i->ptr3 = 1; - q_i->unknown = 0x00000000; + q_i->ptr_max_len = 1; + q_i->buf_max_len = 0x104; + + q_i->ptr_len = 1; + q_i->buf_len = 0x0; return True; } @@ -860,35 +860,32 @@ BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) prs_align(ps); smb_io_pol_hnd("", &(r_q->pol), ps, depth); - smb_io_unihdr ("", &(r_q->hdr_type), ps, depth); - smb_io_unistr2("", &(r_q->uni_type), r_q->hdr_type.buffer, ps, depth); + smb_io_unihdr ("", &(r_q->hdr_val), ps, depth); + smb_io_unistr2("", &(r_q->uni_val), r_q->hdr_val.buffer, ps, depth); prs_align(ps); - prs_uint32("ptr1", ps, depth, &(r_q->ptr1)); - - if (r_q->ptr1 != 0) + prs_uint32("ptr_type", ps, depth, &(r_q->ptr_type)); + if (r_q->ptr_type != 0) { - smb_io_time("", &(r_q->time), ps, depth); - prs_uint8 ("major_version1", ps, depth, &(r_q->major_version1)); - prs_uint8 ("minor_version1", ps, depth, &(r_q->minor_version1)); - prs_uint8s(False, "pad1", ps, depth, r_q->pad1, sizeof(r_q->pad1)); + prs_uint32("type", ps, depth, &(r_q->type)); } - prs_uint32("ptr2", ps, depth, &(r_q->ptr2)); + prs_uint32("ptr_uni_type", ps, depth, &(r_q->ptr_uni_type)); - if (r_q->ptr2 != 0) + smb_io_buffer2("uni_type", &(r_q->uni_type), r_q->ptr_uni_type, ps, depth); + prs_align(ps); + + prs_uint32("ptr_max_len", ps, depth, &(r_q->ptr_max_len)); + if (r_q->ptr_max_len != 0) { - prs_uint8 ("major_version2", ps, depth, &(r_q->major_version2)); - prs_uint8 ("minor_version2", ps, depth, &(r_q->minor_version2)); - prs_uint8s(False, "pad2", ps, depth, r_q->pad2, sizeof(r_q->pad2)); + prs_uint32("buf_max_len", ps, depth, &(r_q->buf_max_len)); } - prs_uint32("ptr3", ps, depth, &(r_q->ptr3)); - - if (r_q->ptr3 != 0) + prs_uint32("ptr_len", ps, depth, &(r_q->ptr_len)); + if (r_q->ptr_len != 0) { - prs_uint32("unknown", ps, depth, &(r_q->unknown)); + prs_uint32("buf_len", ps, depth, &(r_q->buf_len)); } return True; @@ -899,23 +896,26 @@ BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) creates a structure. ********************************************************************/ BOOL make_reg_r_info(REG_R_INFO *r_r, - uint32 level, char *os_type, + uint32 type, char *buf, uint32 status) { int len; - if (r_r == NULL || os_type == NULL) return False; + if (r_r == NULL || buf == NULL) return False; - len = strlen(os_type); + len = strlen(buf); - r_r->ptr1 = 1; - r_r->level = level; + r_r->ptr_type = type; + r_r->type = type; - r_r->ptr_type = 1; - make_buffer2(&(r_r->uni_type), os_type, len); + r_r->ptr_uni_type = 1; + make_buffer2(&(r_r->uni_type), buf, len); - r_r->ptr2 = r_r->ptr3 = 1; - r_r->unknown_0 = r_r->unknown_1 = len * 2; + r_r->ptr_max_len = 1; + r_r->buf_max_len = r_r->uni_type.buf_max_len; + + r_r->ptr_len = 1; + r_r->buf_len = r_r->uni_type.buf_len; r_r->status = status; @@ -934,31 +934,28 @@ BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) prs_align(ps); - prs_uint32("ptr1", ps, depth, &(r_r->ptr1)); - - if (r_r->ptr1 != 0) + prs_uint32("ptr_type", ps, depth, &(r_r->ptr_type)); + if (r_r->ptr_type != 0) { - prs_uint32("level", ps, depth, &(r_r->level)); - prs_uint32("ptr_type", ps, depth, &(r_r->ptr_type)); - - smb_io_buffer2("uni_type", &(r_r->uni_type), r_r->ptr_type, ps, depth); - prs_align(ps); - - prs_uint32("ptr2", ps, depth, &(r_r->ptr2)); - - if (r_r->ptr2 != 0) - { - prs_uint32("unknown_0", ps, depth, &(r_r->unknown_0)); - } + prs_uint32("type", ps, depth, &(r_r->type)); + } - prs_uint32("ptr3", ps, depth, &(r_r->ptr3)); + prs_uint32("ptr_uni_type", ps, depth, &(r_r->ptr_uni_type)); + smb_io_buffer2("uni_type", &(r_r->uni_type), r_r->ptr_uni_type, ps, depth); + prs_align(ps); - if (r_r->ptr3 != 0) - { - prs_uint32("unknown_1", ps, depth, &(r_r->unknown_1)); - } + prs_uint32("ptr_max_len", ps, depth, &(r_r->ptr_max_len)); + if (r_r->ptr_max_len != 0) + { + prs_uint32("buf_max_len", ps, depth, &(r_r->buf_max_len)); + } + prs_uint32("ptr_len", ps, depth, &(r_r->ptr_len)); + if (r_r->ptr_len != 0) + { + prs_uint32("buf_len", ps, depth, &(r_r->buf_len)); } + prs_uint32("status", ps, depth, &(r_r->status)); return True; -- cgit From a394a4a8fa2c4c0ff03fbc5bc4ea925245ec1fed Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 18 Nov 1999 17:57:21 +0000 Subject: updating reg_value_info() parsing code to take BUFFER2 instead of just a char*. now copes with multiple types. (This used to be commit 3df7c903c5b70f336294a95ad864aedbacf544b0) --- source3/rpc_parse/parse_reg.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 1a0168f21d..ec2699e745 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -896,27 +896,31 @@ BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) creates a structure. ********************************************************************/ BOOL make_reg_r_info(REG_R_INFO *r_r, - uint32 type, char *buf, + uint32 *type, BUFFER2 *buf, uint32 status) { - int len; - - if (r_r == NULL || buf == NULL) return False; - - len = strlen(buf); + if (r_r == NULL) return False; - r_r->ptr_type = type; + r_r->ptr_type = type != NULL ? 1 : 0; r_r->type = type; - r_r->ptr_uni_type = 1; - make_buffer2(&(r_r->uni_type), buf, len); - - r_r->ptr_max_len = 1; - r_r->buf_max_len = r_r->uni_type.buf_max_len; + r_r->ptr_uni_type = buf != NULL ? 1 : 0; + r_r->uni_type = buf; - r_r->ptr_len = 1; - r_r->buf_len = r_r->uni_type.buf_len; + if (buf != NULL) + { + r_r->ptr_max_len = 1; + r_r->buf_max_len = r_r->uni_type->buf_max_len; + r_r->ptr_len = 1; + r_r->buf_len = r_r->uni_type->buf_len; + } + else + { + r_r->ptr_max_len = 0; + r_r->ptr_len = 0; + } + r_r->status = status; return True; @@ -937,11 +941,11 @@ BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) prs_uint32("ptr_type", ps, depth, &(r_r->ptr_type)); if (r_r->ptr_type != 0) { - prs_uint32("type", ps, depth, &(r_r->type)); + prs_uint32("type", ps, depth, r_r->type); } prs_uint32("ptr_uni_type", ps, depth, &(r_r->ptr_uni_type)); - smb_io_buffer2("uni_type", &(r_r->uni_type), r_r->ptr_uni_type, ps, depth); + smb_io_buffer2("uni_type", r_r->uni_type, r_r->ptr_uni_type, ps, depth); prs_align(ps); prs_uint32("ptr_max_len", ps, depth, &(r_r->ptr_max_len)); -- cgit From e3b2f276e04bce6365dfb1a7e0b904b7c788c364 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 18 Nov 1999 19:29:08 +0000 Subject: added samuserset2 rpcclient command to test ACB_XXX bit-setting on samr opcode 0x25. _yet_ another failed attempt to get nt5rc2 to join a samba domain. what _is_ it with this stuff, dammit? (This used to be commit c3913f8ae272c496fc4519141accf01ee9f1e49e) --- source3/rpc_parse/parse_samr.c | 161 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 158 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 9ea66bbf4b..9f4ad7719e 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4931,7 +4931,7 @@ static BOOL sam_io_user_info24(char *desc, SAM_USER_INFO_24 *usr, prs_struct *p { if (usr == NULL) return False; - prs_debug(ps, depth, desc, "lsa_io_user_info"); + prs_debug(ps, depth, desc, "sam_io_user_info24"); depth++; prs_align(ps); @@ -5166,6 +5166,24 @@ BOOL make_sam_user_info23A(SAM_USER_INFO_23 *usr, return True; } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL sam_io_user_info16(char *desc, SAM_USER_INFO_16 *usr, prs_struct *ps, int depth) +{ + if (usr == NULL) return False; + + prs_debug(ps, depth, desc, "sam_io_user_info16"); + depth++; + + prs_align(ps); + + prs_uint16("acb_info", ps, depth, &(usr->acb_info)); + prs_align(ps); + + return True; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -5173,7 +5191,7 @@ static BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 *usr, prs_struct *p { if (usr == NULL) return False; - prs_debug(ps, depth, desc, "lsa_io_user_info"); + prs_debug(ps, depth, desc, "sam_io_user_info23"); depth++; prs_align(ps); @@ -5364,7 +5382,7 @@ static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *p { if (usr == NULL) return False; - prs_debug(ps, depth, desc, "lsa_io_user_info"); + prs_debug(ps, depth, desc, "sam_io_user_info21"); depth++; prs_align(ps); @@ -5767,6 +5785,143 @@ BOOL samr_io_r_set_userinfo(char *desc, SAMR_R_SET_USERINFO *r_u, prs_struct *p return True; } +/******************************************************************* +makes a SAMR_Q_SET_USERINFO2 structure. +********************************************************************/ +BOOL make_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 *q_u, + POLICY_HND *hnd, + uint16 switch_value, void *info) +{ + if (q_u == NULL || hnd == NULL) return False; + + DEBUG(5,("make_samr_q_set_userinfo2\n")); + + memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); + q_u->switch_value = switch_value; + q_u->switch_value2 = switch_value; + q_u->info.id = info; + + switch (switch_value) + { + case 0x10: + { + break; + } + default: + { + DEBUG(4,("make_samr_q_set_userinfo2: unsupported switch level\n")); + return False; + } + } + + return True; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_q_set_userinfo2(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++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); + prs_align(ps); + + prs_uint16("switch_value ", ps, depth, &(q_u->switch_value )); + prs_uint16("switch_value2", ps, depth, &(q_u->switch_value2)); + + prs_align(ps); + + switch (q_u->switch_value) + { + case 0: + { + break; + } + case 16: + { + if (ps->io) + { + /* reading */ + q_u->info.id = (SAM_USER_INFO_16*)Realloc(NULL, + sizeof(*q_u->info.id16)); + } + if (q_u->info.id == NULL) + { + DEBUG(2,("samr_io_q_query_userinfo2: info pointer not initialised\n")); + return False; + } + sam_io_user_info16("", q_u->info.id16, ps, depth); + break; + } + default: + { + DEBUG(2,("samr_io_q_query_userinfo2: unknown switch level\n")); + break; + } + + } + prs_align(ps); + + if (!ps->io) + { + /* writing */ + free_samr_q_set_userinfo2(q_u); + } + + return True; +} + +/******************************************************************* +frees a structure. +********************************************************************/ +void free_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 *q_u) +{ + if (q_u->info.id == NULL) + { + free(q_u->info.id); + } + q_u->info.id = NULL; +} + +/******************************************************************* +makes a SAMR_R_SET_USERINFO2 structure. +********************************************************************/ +BOOL make_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2 *r_u, + uint32 status) +{ + if (r_u == NULL) return False; + + DEBUG(5,("make_samr_r_set_userinfo2\n")); + + r_u->status = status; /* return status */ + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_r_set_userinfo2(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++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + /******************************************************************* makes a SAMR_Q_CONNECT structure. ********************************************************************/ -- cgit From 1c6c4e7e39bde99f8d312516ba530b905bc01da7 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 19 Nov 1999 00:12:16 +0000 Subject: added \PIPE\browser plus experimental brsinfo command. you wouldn't believe the XXXX that MIGHT be involved in getting nt5rc2 to join a samba domain... (This used to be commit 569babb3935950c1b64396955541abf276cc1d92) --- source3/rpc_parse/parse_brs.c | 180 ++++++++++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_rpc.c | 11 +++ 2 files changed, 191 insertions(+) create mode 100644 source3/rpc_parse/parse_brs.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_brs.c b/source3/rpc_parse/parse_brs.c new file mode 100644 index 0000000000..723866e9f9 --- /dev/null +++ b/source3/rpc_parse/parse_brs.c @@ -0,0 +1,180 @@ + +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1999, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, + * Copyright (C) Paul Ashton 1997-1999. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include "includes.h" + +extern int DEBUGLEVEL; + + +/******************************************************************* + make_brs_q_query_info + ********************************************************************/ +BOOL make_brs_q_query_info(BRS_Q_QUERY_INFO *q_u, + const char *server, uint16 switch_value) +{ + DEBUG(5,("make_brs_q_query_info\n")); + + make_buf_unistr2(&(q_u->uni_srv_name), &(q_u->ptr_srv_name), server); + q_u->switch_value1 = switch_value; + q_u->switch_value2 = switch_value; + + q_u->ptr = 1; + q_u->pad1 = 0x0; + q_u->pad2 = 0x0; + + return True; +} + +/******************************************************************* +reads or writes a BRS_Q_QUERY_INFO structure. +********************************************************************/ +BOOL brs_io_q_query_info(char *desc, BRS_Q_QUERY_INFO *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return False; + + prs_debug(ps, depth, desc, "brs_io_q_query_info"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_srv_name", ps, depth, &(q_u->ptr_srv_name)); + smb_io_unistr2("", &(q_u->uni_srv_name), q_u->ptr_srv_name, ps, depth); + prs_align(ps); + + prs_uint16("switch_value1", ps, depth, &(q_u->switch_value1)); + prs_align(ps); + + prs_uint16("switch_value2", ps, depth, &(q_u->switch_value2)); + prs_align(ps); + + prs_uint32("ptr", ps, depth, &(q_u->ptr)); + if (q_u->ptr) + { + prs_uint32("pad1", ps, depth, &(q_u->pad1)); + } + + prs_uint32("pad2", ps, depth, &(q_u->pad2)); + + return True; +} + +/******************************************************************* + brs_info_100 + ********************************************************************/ +BOOL make_brs_info_100(BRS_INFO_100 *inf) +{ + DEBUG(5,("BRS_INFO_100: %d\n", __LINE__)); + + inf->pad1 = 0x0; + inf->ptr2 = 0x1; + inf->pad2 = 0x0; + inf->pad3 = 0x0; + + return True; +} + +/******************************************************************* +reads or writes a BRS_INFO_100 structure. +********************************************************************/ +static BOOL brs_io_brs_info_100(char *desc, BRS_INFO_100 *inf, prs_struct *ps, int depth) +{ + if (inf == NULL) return False; + + prs_debug(ps, depth, desc, "brs_io_brs_info_100"); + depth++; + + prs_align(ps); + + prs_uint32("pad1", ps, depth, &(inf->pad1)); + prs_uint32("ptr2", ps, depth, &(inf->ptr2)); + prs_uint32("pad2", ps, depth, &(inf->pad2)); + prs_uint32("pad3", ps, depth, &(inf->pad3)); + + return True; +} + +/******************************************************************* + make_brs_r_query_info + + only supports info level 100 at the moment. + + ********************************************************************/ +BOOL make_brs_r_query_info(BRS_R_QUERY_INFO *r_u, + uint32 switch_value, void *inf, + int status) +{ + DEBUG(5,("make_brs_r_unknown_0: %d\n", __LINE__)); + + r_u->switch_value1 = switch_value; /* same as in request */ + r_u->switch_value2 = switch_value; /* same as in request */ + + r_u->ptr_1 = inf != NULL ? 1 : 0; /* pointer 1 */ + r_u->info.id = inf; + + r_u->status = status; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL brs_io_r_query_info(char *desc, BRS_R_QUERY_INFO *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "brs_io_r_query_info"); + depth++; + + prs_align(ps); + + prs_uint16("switch_value1", ps, depth, &(r_u->switch_value1)); + prs_align(ps); + + prs_uint16("switch_value2", ps, depth, &(r_u->switch_value2)); + prs_align(ps); + + prs_uint32("ptr_1 ", ps, depth, &(r_u->ptr_1)); + if (r_u->ptr_1 != 0x0) + { + switch (r_u->switch_value1) + { + case 100: + { + brs_io_brs_info_100("inf", r_u->info.brs100, ps, depth); + break; + } + default: + { + break; + } + } + } + + prs_uint32("status ", ps, depth, &(r_u->status)); + + return True; +} + diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 82b0be2802..819e441742 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -52,6 +52,16 @@ interface/version dce/rpc pipe identification }, 0x02 \ } \ +#define SYNT_BROWSER_V0 \ +{ \ + { \ + 0x98, 0xd0, 0xff, 0x6b, \ + 0x12, 0xa1, 0x10, 0x36, \ + 0x98, 0x33, 0x01, 0x28, \ + 0x92, 0x02, 0x01, 0x62 \ + }, 0x00 \ +} \ + #define SYNT_NETLOGON_V2 \ { \ { \ @@ -166,6 +176,7 @@ struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_BROWSER , SYNT_BROWSER_V0 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_NETLOGON, SYNT_NETLOGON_V1, PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, -- cgit From eb8c70cb66e8bec5726e099ca1e5f997d3e4637e Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 19 Nov 1999 01:24:41 +0000 Subject: - surprise! the number of UNICODE strings that didn't have alignment after them is incredible. how did we get away with this for so long? (This used to be commit 3152bde7d855d189f6f8ab9e6291828579cde2d0) --- source3/rpc_parse/parse_samr.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 9f4ad7719e..c50a883ca1 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -117,6 +117,7 @@ BOOL samr_io_q_lookup_domain(char *desc, SAMR_Q_LOOKUP_DOMAIN *q_u, prs_struct * smb_io_unihdr("hdr_domain", &(q_u->hdr_domain), ps, depth); smb_io_unistr2("uni_domain", &(q_u->uni_domain), q_u->hdr_domain.buffer, ps, depth); + prs_align(ps); return True; } @@ -519,6 +520,7 @@ BOOL sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 *u_2, prs_struct *ps, int depth prs_uint8s(False, "padding", ps, depth, u_2->padding, sizeof(u_2->padding)); /* 12 bytes zeros */ smb_io_unistr2( "uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth); /* domain name unicode string */ + prs_align(ps); smb_io_unistr2( "uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth); /* server name unicode string */ prs_align(ps); @@ -880,8 +882,11 @@ static BOOL sam_io_sam_str1(char *desc, SAM_STR1 *sam, uint32 acct_buf, uint32 prs_align(ps); smb_io_unistr2("unistr2", &(sam->uni_acct_name), acct_buf, ps, depth); /* account name unicode string */ + prs_align(ps); smb_io_unistr2("unistr2", &(sam->uni_full_name), name_buf, ps, depth); /* full name unicode string */ + prs_align(ps); smb_io_unistr2("unistr2", &(sam->uni_acct_desc), desc_buf, ps, depth); /* account desc unicode string */ + prs_align(ps); return True; } @@ -947,7 +952,9 @@ static BOOL sam_io_sam_str2(char *desc, SAM_STR2 *sam, uint32 acct_buf, uint32 prs_align(ps); smb_io_unistr2("unistr2", &(sam->uni_srv_name), acct_buf, ps, depth); /* account name unicode string */ + prs_align(ps); smb_io_unistr2("unistr2", &(sam->uni_srv_desc), desc_buf, ps, depth); /* account desc unicode string */ + prs_align(ps); return True; } @@ -1011,7 +1018,9 @@ static BOOL sam_io_sam_str3(char *desc, SAM_STR3 *sam, uint32 acct_buf, uint32 prs_align(ps); smb_io_unistr2("unistr2", &(sam->uni_grp_name), acct_buf, ps, depth); /* account name unicode string */ + prs_align(ps); smb_io_unistr2("unistr2", &(sam->uni_grp_desc), desc_buf, ps, depth); /* account desc unicode string */ + prs_align(ps); return True; } @@ -1313,6 +1322,7 @@ BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct { prs_grow(ps); smb_io_unistr2("", &(r_u->uni_acct_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); + prs_align(ps); } prs_align(ps); @@ -1947,6 +1957,7 @@ BOOL samr_io_group_info1(char *desc, GROUP_INFO1 *gr1, prs_struct *ps, int dept prs_align(ps); smb_io_unistr2("uni_acct_desc", &(gr1->uni_acct_desc), gr1->hdr_acct_desc.buffer, ps, depth); + prs_align(ps); return True; } @@ -1982,6 +1993,7 @@ BOOL samr_io_group_info4(char *desc, GROUP_INFO4 *gr4, prs_struct *ps, int dept smb_io_unihdr ("hdr_acct_desc", &(gr4->hdr_acct_desc) , ps, depth); smb_io_unistr2("uni_acct_desc", &(gr4->uni_acct_desc), gr4->hdr_acct_desc.buffer, ps, depth); + prs_align(ps); return True; } @@ -2901,6 +2913,7 @@ BOOL samr_io_r_enum_domains(char *desc, SAMR_R_ENUM_DOMAINS *r_u, prs_struct *ps slprintf(tmp, sizeof(tmp)-1, "dom[%d]", i); prs_grow(ps); smb_io_unistr2(tmp, &(r_u->uni_dom_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); + prs_align(ps); } prs_align(ps); @@ -3061,6 +3074,7 @@ BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_stru { prs_grow(ps); smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); + prs_align(ps); } prs_align(ps); @@ -3221,6 +3235,7 @@ BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_st { prs_grow(ps); smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); + prs_align(ps); } prs_align(ps); @@ -3265,6 +3280,7 @@ BOOL samr_io_alias_info3(char *desc, ALIAS_INFO3 *al3, prs_struct *ps, int dept smb_io_unihdr ("hdr_acct_desc", &(al3->hdr_acct_desc) , ps, depth); smb_io_unistr2("uni_acct_desc", &(al3->uni_acct_desc), al3->hdr_acct_desc.buffer, ps, depth); + prs_align(ps); return True; } @@ -3893,6 +3909,7 @@ BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, prs_grow(ps); slprintf(tmp, sizeof(tmp) - 1, "str[%02d] ", i); smb_io_unistr2("", &(r_u->uni_name[i]), r_u->hdr_name[i].buffer, ps, depth); + prs_align(ps); } } @@ -4050,6 +4067,7 @@ BOOL samr_io_q_create_dom_alias(char *desc, SAMR_Q_CREATE_DOM_ALIAS *q_u, prs_s smb_io_unihdr ("hdr_acct_desc", &(q_u->hdr_acct_desc) , ps, depth); smb_io_unistr2("uni_acct_desc", &(q_u->uni_acct_desc), q_u->hdr_acct_desc.buffer, ps, depth); + prs_align(ps); prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1)); prs_uint16("unknown_2", ps, depth, &(q_u->unknown_2)); @@ -4437,6 +4455,7 @@ BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *p { prs_grow(ps); smb_io_unistr2("", &(q_u->uni_name[i]), q_u->hdr_name[i].buffer, ps, depth); + prs_align(ps); } prs_align(ps); @@ -6081,6 +6100,7 @@ BOOL samr_io_q_unknown_38(char *desc, SAMR_Q_UNKNOWN_38 *q_u, prs_struct *ps, i { smb_io_unihdr ("", &(q_u->hdr_srv_name), ps, depth); smb_io_unistr2("", &(q_u->uni_srv_name), q_u->hdr_srv_name.buffer, ps, depth); + prs_align(ps); } return True; -- cgit From e1820455c24de024a2ff7418bd2d14ad943563fa Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 19 Nov 1999 02:05:19 +0000 Subject: nt5rc2 falling over because the LsaQueryInfoPolicy() response _must_ have the string max length = string length + 1. if not, then it gets its knickers in a twist over whether the string is NULL-terminated or not. four days. four days i spent on this one. (This used to be commit 9795e5948c698115e34c28993cdb82ba31377f5d) --- source3/rpc_parse/parse_lsa.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 57c22e88cb..596b1cb045 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -105,6 +105,7 @@ static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int de { slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i); smb_io_unistr2(t, &(r_r->ref_dom[n].uni_dom_name), True, ps, depth); /* domain name unicode string */ + prs_align(ps); n++; } -- cgit From ef8ced0ca6688f037d74a5e26b52b41afce37682 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 20 Nov 1999 18:17:29 +0000 Subject: dynamic memory allocation i added a month ago: forgot to ZERO_STRUCT() some of the server-side stuff. Realloc() was being used, so it Realloc()d some random area of memory. oops.dynamic memory allocation i added a month ago: forgot to ZERO_STRUCT() some of the server-side stuff. Realloc() was being used, so it Realloc()d some random area of memory. oops.dynamic memory allocation i added a month ago: forgot to ZERO_STRUCT() some of the server-side stuff. Realloc() was being used, so it Realloc()d some random area of memory. oops. (This used to be commit a51f62f4cf610c23e45251cedb543144747a3e54) --- source3/rpc_parse/parse_samr.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index c50a883ca1..dad9d412e1 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3843,6 +3843,8 @@ BOOL make_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u, for (i = 0; i < num_names; i++) { int len = name[i] != NULL ? strlen(name[i]) : 0; + DEBUG(10,("name[%d]:%s\ttype:%d\n", + i, name[i], type[i])); make_uni_hdr(&(r_u->hdr_name[i]), len); make_unistr2(&(r_u->uni_name[i]), name[i], len); r_u->type[i] = type[i]; -- cgit From 4c4af2ba5ec3c1496576fe88331346cc631699e5 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 23 Nov 1999 18:56:26 +0000 Subject: shuffling msrpc code around so that it can be used independently of rpcclient (This used to be commit e88e7d529b5bdf32ac3bc71fa8e18f6f2a98c695) --- source3/rpc_parse/parse_lsa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 596b1cb045..d3b895dc1a 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -415,8 +415,8 @@ BOOL lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int dept /******************************************************************* makes an LSA_Q_OPEN_SECRET structure. ********************************************************************/ -BOOL make_q_open_secret(LSA_Q_OPEN_SECRET *q_o, POLICY_HND *pol_hnd, - char *secret_name, uint32 desired_access) +BOOL make_q_open_secret(LSA_Q_OPEN_SECRET *q_o, const POLICY_HND *pol_hnd, + const char *secret_name, uint32 desired_access) { int len = strlen(secret_name); -- cgit From 7bd8fd1a102045de38e0e0471e2cf7e2aee47eda Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 23 Nov 1999 18:57:07 +0000 Subject: adding svcctl 0x1b function (This used to be commit d5869df3716fec21d3a4237dbf5d2417d3350e11) --- source3/rpc_parse/parse_svc.c | 179 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c index 815f60151e..b35b98a354 100644 --- a/source3/rpc_parse/parse_svc.c +++ b/source3/rpc_parse/parse_svc.c @@ -821,3 +821,182 @@ BOOL svc_io_r_close(char *desc, SVC_R_CLOSE *r_u, prs_struct *ps, int depth) return True; } +/******************************************************************* +makes a SVC_Q_UNKNOWN_1B structure. +********************************************************************/ +BOOL make_svc_q_unknown_1b(SVC_Q_UNKNOWN_1B *q_u, + const POLICY_HND *pol, uint32 switch_value, + uint32 unknown_1) +{ + if (q_u == NULL) return False; + + DEBUG(5,("make_svc_r_unknwon_12\n")); + + memcpy(&(q_u->pol), pol, sizeof(*pol)); + + q_u->switch_value = switch_value; + q_u->unknown_1 = unknown_1; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL svc_io_q_unknown_1b(char *desc, SVC_Q_UNKNOWN_1B *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return False; + + prs_debug(ps, depth, desc, "svc_io_q_unknown_1b"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); + prs_align(ps); + + prs_uint32("switch_value", ps, depth, &(q_u->switch_value)); + prs_uint32("unknown_1 ", ps, depth, &(q_u->unknown_1 )); + + return True; +} + +/******************************************************************* +makes a SVC_R_UNKNOWN_1B structure. +********************************************************************/ +BOOL make_svc_r_unknown_1b(SVC_R_UNKNOWN_1B *r_u, + uint32 switch_value, uint32 unknown_1, + uint32 num_items, uint32 **item, + uint32 status) +{ + uint32 i; + if (r_u == NULL) return False; + + DEBUG(5,("make_svc_r_unknown_1b\n")); + + if (status == 0x0) + { + r_u->num_items1 = num_items; + r_u->ptr = 1; + r_u->num_items2 = num_items; + + r_u->items = item; + if (num_items != 0) + { + r_u->ptr_items = (uint32*)malloc(num_items * sizeof(r_u->ptr_items[0])); + if (r_u->ptr_items == NULL) + { + svc_free_r_unknown_1b(r_u); + return False; + } + for (i = 0; i < num_items; i++) + { + r_u->ptr_items[i] = item[i] != NULL ? 1 : 0; + } + } + + } + else + { + r_u->num_items1 = num_items; + r_u->ptr_items = 0; + r_u->num_items2 = num_items; + } + + r_u->status = status; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL svc_io_r_unknown_1b(char *desc, SVC_R_UNKNOWN_1B *r_u, prs_struct *ps, int depth) +{ + uint32 i; + uint32 count = 0; + fstring tmp; + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "svc_io_r_unknown_1b"); + depth++; + + prs_align(ps); + + prs_uint32("num_items1", ps, depth, &(r_u->num_items1)); + prs_uint32("ptr ", ps, depth, &(r_u->ptr )); + prs_uint32("num_items2", ps, depth, &(r_u->num_items2)); + + if (r_u->ptr_items != 0 && r_u->num_items1 != 0) + { + r_u->ptr_items = (uint32*)Realloc(r_u->ptr_items, + r_u->num_items2 * sizeof(r_u->ptr_items[0])); + if (r_u->ptr_items == NULL) + { + return False; + } + + for (i = 0; i < r_u->num_items2; i++) + { + prs_grow(ps); + slprintf(tmp, sizeof(tmp) - 1, "ptr_item[%02d]", i); + prs_uint32(tmp, ps, depth, &(r_u->ptr_items[i])); + } + + for (i = 0; i < r_u->num_items2; i++) + { + slprintf(tmp, sizeof(tmp) - 1, "item[%02d]", i); + + if (ps->io) + { + /* reading */ + if (r_u->ptr_items[i] != 0) + { + uint32 item; + prs_uint32(tmp, ps, depth, &item); + add_uint32s_to_array(&count, &r_u->items, &item); + } + else + { + add_uint32s_to_array(&count, &r_u->items, NULL); + } + } + else + { + /* writing */ + if (r_u->ptr_items[i] != 0) + { + prs_uint32(tmp, ps, depth, r_u->items[i]); + } + } + } + } + + prs_uint32("status", ps, depth, &(r_u->status)); + + if (!ps->io) + { + /* storing. don't need memory any more */ + svc_free_r_unknown_1b(r_u); + } + + return True; +} + +/******************************************************************* +frees a structure. +********************************************************************/ +void svc_free_r_unknown_1b(SVC_R_UNKNOWN_1B *r_u) +{ + if (r_u->ptr_items != NULL) + { + free(r_u->ptr_items); + r_u->ptr_items = NULL; + } + if (r_u->items != NULL) + { + free_uint32_array(r_u->num_items1, r_u->items); + r_u->items = NULL; + r_u->num_items1 = 0; + } +} -- cgit From 6b91ecb417ab4dccbd3c0582588f17d24c580e92 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 23 Nov 1999 23:05:47 +0000 Subject: attempted a svcset command. password is encrypted / messed up, therefore command fails. (This used to be commit 9193f0eff56399e9bc09787dbe785b603886eaa3) --- source3/rpc_parse/parse_misc.c | 37 ++++++-- source3/rpc_parse/parse_svc.c | 194 ++++++++++++++--------------------------- 2 files changed, 93 insertions(+), 138 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 2f2c68648a..fe65aaf4d4 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -777,16 +777,37 @@ BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf) /******************************************************************* creates a STRING2 structure. ********************************************************************/ -BOOL make_string2(STRING2 *str, char *buf, int len) +BOOL make_string2(STRING2 *str, const char *buf, int len) { - /* set up string lengths. */ - str->str_max_len = len; - str->undoc = 0; - str->str_str_len = len; + /* set up string lengths. */ + str->str_max_len = len; + str->undoc = 0; + str->str_str_len = len; + + /* store the string */ + if(len != 0) + { + memcpy(str->buffer, buf, len); + } - /* store the string */ - if(len != 0) - memcpy(str->buffer, buf, len); + return True; +} + +/******************************************************************* +creates a STRING2 structure: sets up the buffer, too +********************************************************************/ +BOOL make_buf_string2(STRING2 *str, uint32 *ptr, const char *buf) +{ + if (buf != NULL) + { + *ptr = 1; + make_string2(str, buf, strlen(buf)+1); + } + else + { + *ptr = 0; + make_string2(str, "", 0); + } return True; } diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c index b35b98a354..93ad0dcced 100644 --- a/source3/rpc_parse/parse_svc.c +++ b/source3/rpc_parse/parse_svc.c @@ -822,20 +822,35 @@ BOOL svc_io_r_close(char *desc, SVC_R_CLOSE *r_u, prs_struct *ps, int depth) } /******************************************************************* -makes a SVC_Q_UNKNOWN_1B structure. +makes an SVC_Q_CHANGE_SVC_CONFIG structure. ********************************************************************/ -BOOL make_svc_q_unknown_1b(SVC_Q_UNKNOWN_1B *q_u, - const POLICY_HND *pol, uint32 switch_value, - uint32 unknown_1) +BOOL make_svc_q_change_svc_config(SVC_Q_CHANGE_SVC_CONFIG *q_u, POLICY_HND *hnd, + uint32 service_type, uint32 start_type, + uint32 unknown_0, + uint32 error_control, + char* bin_path_name, char* load_order_grp, + uint32 tag_id, + char* dependencies, char* service_start_name, + char* password, + char* disp_name) { - if (q_u == NULL) return False; + if (q_u == NULL || hnd == NULL) return False; - DEBUG(5,("make_svc_r_unknwon_12\n")); + DEBUG(5,("make_svc_q_change_svc_config\n")); - memcpy(&(q_u->pol), pol, sizeof(*pol)); + memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); - q_u->switch_value = switch_value; - q_u->unknown_1 = unknown_1; + q_u->service_type = service_type; + q_u->start_type = start_type; + q_u->unknown_0 = unknown_0; + q_u->error_control = error_control; + make_buf_unistr2(&(q_u->uni_bin_path_name ), &(q_u->ptr_bin_path_name ), bin_path_name ); + make_buf_unistr2(&(q_u->uni_load_order_grp ), &(q_u->ptr_load_order_grp ), load_order_grp ); + q_u->tag_id = tag_id; + make_buf_unistr2(&(q_u->uni_dependencies ), &(q_u->ptr_dependencies ), dependencies ); + make_buf_unistr2(&(q_u->uni_service_start_name), &(q_u->ptr_service_start_name), service_start_name); + make_buf_string2(&(q_u->str_password ), &(q_u->ptr_password ), password ); + make_buf_unistr2(&(q_u->uni_display_name ), &(q_u->ptr_display_name ), disp_name ); return True; } @@ -843,67 +858,60 @@ BOOL make_svc_q_unknown_1b(SVC_Q_UNKNOWN_1B *q_u, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL svc_io_q_unknown_1b(char *desc, SVC_Q_UNKNOWN_1B *q_u, prs_struct *ps, int depth) +BOOL svc_io_q_change_svc_config(char *desc, SVC_Q_CHANGE_SVC_CONFIG *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "svc_io_q_unknown_1b"); + prs_debug(ps, depth, desc, "svc_io_q_change_svc_config"); depth++; prs_align(ps); - smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); + smb_io_pol_hnd("", &(q_u->pol), ps, depth); + prs_align(ps); + + prs_uint32("service_type ", ps, depth, &(q_u->service_type )); + prs_uint32("start_type ", ps, depth, &(q_u->start_type )); + prs_uint32("unknown_0 ", ps, depth, &(q_u->unknown_0 )); + prs_uint32("error_control ", ps, depth, &(q_u->error_control )); + prs_uint32("ptr_bin_path_name ", ps, depth, &(q_u->ptr_bin_path_name )); + smb_io_unistr2("uni_bin_path_name ", &(q_u->uni_bin_path_name ), q_u->ptr_bin_path_name , ps, depth); + prs_align(ps); + + prs_uint32("ptr_load_order_grp ", ps, depth, &(q_u->ptr_load_order_grp )); + smb_io_unistr2("uni_load_order_grp ", &(q_u->uni_load_order_grp ), q_u->ptr_load_order_grp , ps, depth); + prs_align(ps); + prs_uint32("tag_id ", ps, depth, &(q_u->tag_id )); + prs_uint32("ptr_dependencies ", ps, depth, &(q_u->ptr_dependencies )); + smb_io_unistr2("uni_dependencies ", &(q_u->uni_dependencies ), q_u->ptr_dependencies , ps, depth); + prs_align(ps); + prs_uint32("ptr_service_start_name", ps, depth, &(q_u->ptr_service_start_name)); + smb_io_unistr2("uni_service_start_name", &(q_u->uni_service_start_name), q_u->ptr_service_start_name, ps, depth); + prs_align(ps); + prs_uint32("ptr_password ", ps, depth, &(q_u->ptr_password )); + + smb_io_string2("str_password ", &(q_u->str_password ), q_u->ptr_display_name , ps, depth); prs_align(ps); - prs_uint32("switch_value", ps, depth, &(q_u->switch_value)); - prs_uint32("unknown_1 ", ps, depth, &(q_u->unknown_1 )); + prs_uint32("ptr_display_name ", ps, depth, &(q_u->ptr_display_name )); + smb_io_unistr2("uni_display_name ", &(q_u->uni_display_name ), q_u->ptr_display_name , ps, depth); + prs_align(ps); return True; } /******************************************************************* -makes a SVC_R_UNKNOWN_1B structure. +makes an SVC_R_CHANGE_SVC_CONFIG structure. ********************************************************************/ -BOOL make_svc_r_unknown_1b(SVC_R_UNKNOWN_1B *r_u, - uint32 switch_value, uint32 unknown_1, - uint32 num_items, uint32 **item, - uint32 status) +BOOL make_svc_r_change_svc_config(SVC_R_CHANGE_SVC_CONFIG *r_c, + uint32 unknown_0, uint32 status) { - uint32 i; - if (r_u == NULL) return False; - - DEBUG(5,("make_svc_r_unknown_1b\n")); - - if (status == 0x0) - { - r_u->num_items1 = num_items; - r_u->ptr = 1; - r_u->num_items2 = num_items; - - r_u->items = item; - if (num_items != 0) - { - r_u->ptr_items = (uint32*)malloc(num_items * sizeof(r_u->ptr_items[0])); - if (r_u->ptr_items == NULL) - { - svc_free_r_unknown_1b(r_u); - return False; - } - for (i = 0; i < num_items; i++) - { - r_u->ptr_items[i] = item[i] != NULL ? 1 : 0; - } - } + if (r_c == NULL) return False; - } - else - { - r_u->num_items1 = num_items; - r_u->ptr_items = 0; - r_u->num_items2 = num_items; - } + DEBUG(5,("make_svc_r_change_svc_config\n")); - r_u->status = status; + r_c->unknown_0 = unknown_0; + r_c->status = status; return True; } @@ -911,92 +919,18 @@ BOOL make_svc_r_unknown_1b(SVC_R_UNKNOWN_1B *r_u, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL svc_io_r_unknown_1b(char *desc, SVC_R_UNKNOWN_1B *r_u, prs_struct *ps, int depth) +BOOL svc_io_r_change_svc_config(char *desc, SVC_R_CHANGE_SVC_CONFIG *r_u, prs_struct *ps, int depth) { - uint32 i; - uint32 count = 0; - fstring tmp; if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "svc_io_r_unknown_1b"); + prs_debug(ps, depth, desc, "svc_io_r_change_svc_config"); depth++; prs_align(ps); - prs_uint32("num_items1", ps, depth, &(r_u->num_items1)); - prs_uint32("ptr ", ps, depth, &(r_u->ptr )); - prs_uint32("num_items2", ps, depth, &(r_u->num_items2)); - - if (r_u->ptr_items != 0 && r_u->num_items1 != 0) - { - r_u->ptr_items = (uint32*)Realloc(r_u->ptr_items, - r_u->num_items2 * sizeof(r_u->ptr_items[0])); - if (r_u->ptr_items == NULL) - { - return False; - } - - for (i = 0; i < r_u->num_items2; i++) - { - prs_grow(ps); - slprintf(tmp, sizeof(tmp) - 1, "ptr_item[%02d]", i); - prs_uint32(tmp, ps, depth, &(r_u->ptr_items[i])); - } - - for (i = 0; i < r_u->num_items2; i++) - { - slprintf(tmp, sizeof(tmp) - 1, "item[%02d]", i); - - if (ps->io) - { - /* reading */ - if (r_u->ptr_items[i] != 0) - { - uint32 item; - prs_uint32(tmp, ps, depth, &item); - add_uint32s_to_array(&count, &r_u->items, &item); - } - else - { - add_uint32s_to_array(&count, &r_u->items, NULL); - } - } - else - { - /* writing */ - if (r_u->ptr_items[i] != 0) - { - prs_uint32(tmp, ps, depth, r_u->items[i]); - } - } - } - } - - prs_uint32("status", ps, depth, &(r_u->status)); - - if (!ps->io) - { - /* storing. don't need memory any more */ - svc_free_r_unknown_1b(r_u); - } + prs_uint32("unknown_0", ps, depth, &(r_u->unknown_0)); + prs_uint32("status ", ps, depth, &(r_u->status )); return True; } -/******************************************************************* -frees a structure. -********************************************************************/ -void svc_free_r_unknown_1b(SVC_R_UNKNOWN_1B *r_u) -{ - if (r_u->ptr_items != NULL) - { - free(r_u->ptr_items); - r_u->ptr_items = NULL; - } - if (r_u->items != NULL) - { - free_uint32_array(r_u->num_items1, r_u->items); - r_u->items = NULL; - r_u->num_items1 = 0; - } -} -- cgit From d7889cd22347e7acd4effb7682d442eef7a666e4 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 24 Nov 1999 18:09:33 +0000 Subject: rewrote policy handle code to be generic (it's needed for client-side too) attempted to fix regsetsec command (This used to be commit eaac0923e0e5e3f4c3d944272a71f3235ac2a741) --- source3/rpc_parse/parse_reg.c | 8 ++++---- source3/rpc_parse/parse_sec.c | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index ec2699e745..5e7e950ae4 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -664,13 +664,14 @@ BOOL reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) makes a structure. ********************************************************************/ BOOL make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, + uint32 sec_info, uint32 buf_len, SEC_DESC *sec_desc) { if (q_i == NULL) return False; memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); - q_i->sec_info = DACL_SECURITY_INFORMATION; + q_i->sec_info = sec_info; q_i->ptr = 1; make_buf_hdr(&(q_i->hdr_sec), buf_len, buf_len); @@ -723,15 +724,14 @@ BOOL reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, in makes a structure. ********************************************************************/ BOOL make_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, + uint32 sec_info, uint32 buf_len, SEC_DESC_BUF *sec_buf) { if (q_i == NULL) return False; memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); - q_i->sec_info = OWNER_SECURITY_INFORMATION | - GROUP_SECURITY_INFORMATION | - DACL_SECURITY_INFORMATION; + q_i->sec_info = sec_info; q_i->ptr = sec_buf != NULL ? 1 : 0; q_i->data = sec_buf; diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 161e42c9ff..d4f4f8185f 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -94,6 +94,7 @@ BOOL sec_io_ace(char *desc, SEC_ACE *t, prs_struct *ps, int depth) sec_io_access ("info ", &t->info, ps, depth); prs_align(ps); smb_io_dom_sid("sid ", &t->sid , ps, depth); + prs_align(ps); prs_uint16_post("size ", ps, depth, &t->size, offset_ace_size, old_offset); @@ -519,9 +520,11 @@ BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) sec_io_desc("sec ", sec->sec, ps, depth); } + prs_align(ps); + size = ps->offset - old_offset; - prs_uint32_post("max_len", ps, depth, &(sec->max_len), off_max_len, size == 0 ? sec->max_len : size); - prs_uint32_post("len ", ps, depth, &(sec->len ), off_len , size); + prs_uint32_post("max_len", ps, depth, &(sec->max_len), off_max_len, size == 0 ? sec->max_len : size + 8); + prs_uint32_post("len ", ps, depth, &(sec->len ), off_len , size == 0 ? 0 : size + 8); return True; } -- cgit From a70a4626df78965e1ad9c7f89f5d1c490e373ee0 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 24 Nov 1999 23:11:03 +0000 Subject: service control manager API completed. svcenum -i works, but does not do so twice. possible memory corruption, revolving around getopt(). (This used to be commit 7cacf8bd026f1ee274f1d352c68cf79cf4f3b499) --- source3/rpc_parse/parse_svc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c index 93ad0dcced..08fed7d47c 100644 --- a/source3/rpc_parse/parse_svc.c +++ b/source3/rpc_parse/parse_svc.c @@ -31,7 +31,7 @@ extern int DEBUGLEVEL; make_svc_q_open_sc_man ********************************************************************/ BOOL make_svc_q_open_sc_man(SVC_Q_OPEN_SC_MAN *q_u, - char *server, char *database, + const char *server, const char *database, uint32 des_access) { DEBUG(5,("make_svc_q_open_sc_man\n")); -- cgit From ac4dd24140074a43f880c59e61770ef4e7c6523b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 24 Nov 1999 23:40:20 +0000 Subject: registry API moved over to new format. reg_connect() is the top-level function, which takes \\server_name. tested a _few_ functions. found that regcreatekey receives a Fault PDU. (This used to be commit 45e92258e7df84c21d23c0be7e1d85457ccac551) --- source3/rpc_parse/parse_reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 5e7e950ae4..9f446cc86a 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1350,7 +1350,7 @@ BOOL reg_io_r_open_entry(char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int makes a structure. ********************************************************************/ BOOL make_reg_q_shutdown(REG_Q_SHUTDOWN *q_i, - char *msg, uint32 timeout, uint16 flags) + const char *msg, uint32 timeout, uint16 flags) { int len = strlen(msg) + 1; -- cgit From 75bc1009438c2ff1696205ab0ee5667ec3ef3062 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 25 Nov 1999 05:26:48 +0000 Subject: cool! completed a samr* API that _would_ look like an msdn samr* api... if microsoft bothered to publish it. actually, there are good reasons for not publishing it: people might write programs for it, and then those programs wouldn't work on nt5, for example... (This used to be commit 8ce93b80d3b4e1c1e28aa1dde38cdef184eff3c1) --- source3/rpc_parse/parse_samr.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index dad9d412e1..50f85ea5f2 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5671,8 +5671,28 @@ BOOL make_samr_q_set_userinfo(SAMR_Q_SET_USERINFO *q_u, switch (switch_value) { case 0x18: + { + uchar sess_key[16]; + if (!cli_get_usr_sesskey(hnd, sess_key)) + { + return False; + } +#ifdef DEBUG_PASSWORD + dump_data(100, sess_key, 16); +#endif + SamOEMhash(q_u->info.id24->pass, sess_key, 1); + } case 0x17: { + uchar sess_key[16]; + if (!cli_get_usr_sesskey(hnd, sess_key)) + { + return False; + } +#ifdef DEBUG_PASSWORD + dump_data(100, sess_key, 16); +#endif + SamOEMhash(q_u->info.id23->pass, sess_key, 1); break; } default: -- cgit From c80b85803b9fbc11cbf77486b847da9f38ba3684 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 27 Nov 1999 22:47:17 +0000 Subject: this one's a handle-based one (missed in the first round). (This used to be commit 4c3556fae73c60693355f95f48ac63834ba4dd10) --- source3/rpc_parse/parse_eventlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 6cf476711d..0b49ed5da7 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -27,7 +27,7 @@ extern int DEBUGLEVEL; /******************************************************************* ********************************************************************/ -BOOL make_eventlog_q_open(EVENTLOG_Q_OPEN *q_u, char *journal, char *unk) +BOOL make_eventlog_q_open(EVENTLOG_Q_OPEN *q_u, const char *journal, char *unk) { int len_journal = journal != NULL ? strlen(journal) : 0; int len_unk = unk != NULL ? strlen(unk) : 0; -- cgit From 9720774c6a01d1e267a83cec7eafcedadfb4169c Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 27 Nov 1999 23:25:45 +0000 Subject: well, i stuffed up the spooler commands. (This used to be commit 7a696330586b9ad5157b0c1ab249cc66e9accef7) --- source3/rpc_parse/parse_spoolss.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 6f1cfdc63c..d5490553a2 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -76,9 +76,9 @@ BOOL make_systemtime(SYSTEMTIME *systime, struct tm *unixtime) } /******************************************************************* -reads or writes an PRINTER_HND structure. +reads or writes an POLICY_HND structure. ********************************************************************/ -static BOOL smb_io_prt_hnd(char *desc, PRINTER_HND *hnd, prs_struct *ps, int depth) +static BOOL smb_io_prt_hnd(char *desc, POLICY_HND *hnd, prs_struct *ps, int depth) { if (hnd == NULL) return False; @@ -87,7 +87,7 @@ static BOOL smb_io_prt_hnd(char *desc, PRINTER_HND *hnd, prs_struct *ps, int dep prs_align(ps); - prs_uint8s (False, "data", ps, depth, hnd->data, PRINTER_HND_SIZE); + prs_uint8s (False, "data", ps, depth, hnd->data, POLICY_HND_SIZE); return True; } @@ -505,7 +505,7 @@ BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_ * make a structure. ********************************************************************/ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, - PRINTER_HND *handle, + POLICY_HND *handle, char *valuename, uint32 size) { @@ -574,7 +574,7 @@ BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_st /******************************************************************* * make a structure. ********************************************************************/ -BOOL make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER *q_u, PRINTER_HND *hnd) +BOOL make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER *q_u, POLICY_HND *hnd) { if (q_u == NULL) return False; @@ -2321,7 +2321,7 @@ static BOOL spoolss_io_read_buffer8(char *desc, prs_struct *ps, uint8 **buffer, * called from spoolss_getprinter (srv_spoolss.c) ********************************************************************/ BOOL make_spoolss_q_getprinter(SPOOL_Q_GETPRINTER *q_u, - PRINTER_HND *hnd, + POLICY_HND *hnd, uint32 level, uint32 buf_size) { @@ -2691,7 +2691,7 @@ BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, in /******************************************************************* ********************************************************************/ -BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const PRINTER_HND *hnd, +BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd, uint32 firstjob, uint32 numofjobs, uint32 level, -- cgit From e302cb2b189f679bcf7efe60d5ae9fb4218c1411 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 29 Nov 1999 19:46:57 +0000 Subject: first attempt at getting \PIPE\NETLOGON working. it's pretty horrible. (This used to be commit 44dd3efa6380544e9a515e91960f9271498cefaf) --- source3/rpc_parse/parse_net.c | 44 ++++++++++++++++++++++++++++++++++-------- source3/rpc_parse/parse_samr.c | 4 ++-- 2 files changed, 38 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index c6e366bbbe..cd1476e201 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -163,6 +163,30 @@ static BOOL net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, return True; } +/******************************************************************* +makes an NET_Q_LOGON_CTRL2 structure. +********************************************************************/ +BOOL make_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, + const char* srv_name, + uint32 function_code, + uint32 query_level, + uint32 switch_value) +{ + if (q_l == NULL) return False; + + DEBUG(5,("make_q_logon_ctrl2\n")); + + q_l->ptr = 1; + + make_unistr2(&(q_l->uni_server_name ), srv_name , strlen(srv_name )+1); + + q_l->function_code = function_code; + q_l->query_level = query_level; + q_l->switch_value = switch_value; + + return True; +} + /******************************************************************* reads or writes an NET_Q_LOGON_CTRL2 structure. ********************************************************************/ @@ -552,8 +576,10 @@ BOOL net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth) /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL make_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char *logon_srv, char *acct_name, - uint16 sec_chan, char *comp_name, DOM_CRED *cred, char nt_cypher[16]) +BOOL make_q_srv_pwset(NET_Q_SRV_PWSET *q_s, + const char *logon_srv, const char *acct_name, + uint16 sec_chan, const char *comp_name, + DOM_CRED *cred, char nt_cypher[16]) { if (q_s == NULL || cred == NULL) return False; @@ -634,9 +660,9 @@ static int make_dom_sid2s(char *sids_str, DOM_SID2 *sids, int max_sids) /******************************************************************* makes a NET_ID_INFO_1 structure. ********************************************************************/ -BOOL make_id_info1(NET_ID_INFO_1 *id, char *domain_name, +BOOL make_id_info1(NET_ID_INFO_1 *id, const char *domain_name, uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, - char *user_name, char *wksta_name, + const char *user_name, const char *wksta_name, char sess_key[16], unsigned char lm_cypher[16], unsigned char nt_cypher[16]) { @@ -753,9 +779,10 @@ checking for a logon as it doesn't export the password hashes to anyone who has compromised the secure channel. JRA. ********************************************************************/ -BOOL make_id_info2(NET_ID_INFO_2 *id, char *domain_name, - uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, - char *user_name, char *wksta_name, +BOOL make_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, unsigned char lm_challenge[8], unsigned char lm_chal_resp[24], unsigned char nt_chal_resp[24]) @@ -854,7 +881,8 @@ static BOOL net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int makes a DOM_SAM_INFO structure. ********************************************************************/ BOOL make_sam_info(DOM_SAM_INFO *sam, - char *logon_srv, char *comp_name, DOM_CRED *clnt_cred, + const char *logon_srv, const char *comp_name, + DOM_CRED *clnt_cred, DOM_CRED *rtn_cred, uint16 logon_level, NET_ID_INFO_CTR *ctr, uint16 validation_level) { diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 50f85ea5f2..e9d425d869 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5673,7 +5673,7 @@ BOOL make_samr_q_set_userinfo(SAMR_Q_SET_USERINFO *q_u, case 0x18: { uchar sess_key[16]; - if (!cli_get_usr_sesskey(hnd, sess_key)) + if (!cli_get_sesskey(hnd, sess_key)) { return False; } @@ -5685,7 +5685,7 @@ BOOL make_samr_q_set_userinfo(SAMR_Q_SET_USERINFO *q_u, case 0x17: { uchar sess_key[16]; - if (!cli_get_usr_sesskey(hnd, sess_key)) + if (!cli_get_sesskey(hnd, sess_key)) { return False; } -- cgit From d9cc4c39504534da0f4cd2569c724de4909ebd79 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 1 Dec 1999 18:47:29 +0000 Subject: improving createuser account command to be able to add workstations and then set a default random password. (This used to be commit 7846818432a93295651c8c67445a2d6a0f3b21d8) --- source3/rpc_parse/parse_samr.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index e9d425d869..45dc5b57c8 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4399,7 +4399,7 @@ makes a SAMR_Q_LOOKUP_NAMES structure. ********************************************************************/ BOOL make_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES *q_u, POLICY_HND *pol, uint32 flags, - uint32 num_names, char **name) + uint32 num_names, const char **name) { uint32 i; if (q_u == NULL) return False; @@ -4937,10 +4937,10 @@ BOOL sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int *************************************************************************/ BOOL make_sam_user_info24(SAM_USER_INFO_24 *usr, - char newpass[516]) + char newpass[516], uint16 passlen) { memcpy(usr->pass, newpass, sizeof(usr->pass)); - usr->unk_0 = 0x44; + usr->unk_0 = passlen; return True; } @@ -4948,7 +4948,7 @@ BOOL make_sam_user_info24(SAM_USER_INFO_24 *usr, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info24(char *desc, SAM_USER_INFO_24 *usr, prs_struct *ps, int depth) +static BOOL sam_io_user_info24(char *desc, SAM_USER_INFO_24 *usr, prs_struct *ps, int depth) { if (usr == NULL) return False; @@ -5673,26 +5673,29 @@ BOOL make_samr_q_set_userinfo(SAMR_Q_SET_USERINFO *q_u, case 0x18: { uchar sess_key[16]; - if (!cli_get_sesskey(hnd, sess_key)) + if (!cli_get_usr_sesskey(hnd, sess_key)) { return False; } + SamOEMhash(q_u->info.id24->pass, sess_key, 1); #ifdef DEBUG_PASSWORD dump_data(100, sess_key, 16); + dump_data(100, q_u->info.id24->pass, 516); #endif - SamOEMhash(q_u->info.id24->pass, sess_key, 1); + break; } case 0x17: { uchar sess_key[16]; - if (!cli_get_sesskey(hnd, sess_key)) + if (!cli_get_usr_sesskey(hnd, sess_key)) { return False; } + SamOEMhash(q_u->info.id23->pass, sess_key, 1); #ifdef DEBUG_PASSWORD dump_data(100, sess_key, 16); + dump_data(100, q_u->info.id23->pass, 516); #endif - SamOEMhash(q_u->info.id23->pass, sess_key, 1); break; } default: -- cgit From 86ac6fa9389532bc0e39b4da2fb73766cf29aeb9 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 1 Dec 1999 19:25:51 +0000 Subject: fixing joining to domain plus something weird going down with nt logins... (This used to be commit cef258f1c931ecb7c2dda9d5c9977153e4c1dc73) --- source3/rpc_parse/parse_samr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 45dc5b57c8..8ce5275bae 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4399,7 +4399,7 @@ makes a SAMR_Q_LOOKUP_NAMES structure. ********************************************************************/ BOOL make_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES *q_u, POLICY_HND *pol, uint32 flags, - uint32 num_names, const char **name) + uint32 num_names, char **name) { uint32 i; if (q_u == NULL) return False; -- cgit From f6c5f755681a5b595b7d5f5fefc6394e9001a3e4 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 1 Dec 1999 20:18:21 +0000 Subject: damn, that took a while. nt login password was being stored incorrectly in private .mac file (oops). ntlogin test now works. (This used to be commit c98c66690683965612e9631d77c2dff91ec8a872) --- source3/rpc_parse/parse_misc.c | 10 ++++++---- source3/rpc_parse/parse_net.c | 7 +++---- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index fe65aaf4d4..b38f55983d 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -978,7 +978,9 @@ BOOL smb_io_dom_rid3(char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) /******************************************************************* makes a DOM_CLNT_SRV structure. ********************************************************************/ -static BOOL make_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) +static BOOL make_clnt_srv(DOM_CLNT_SRV *log, + const char *logon_srv, + const char *comp_name) { if (log == NULL) return False; @@ -1122,7 +1124,7 @@ BOOL smb_io_cred(char *desc, DOM_CRED *cred, prs_struct *ps, int depth) makes a DOM_CLNT_INFO2 structure. ********************************************************************/ BOOL make_clnt_info2(DOM_CLNT_INFO2 *clnt, - char *logon_srv, char *comp_name, + const char *logon_srv, const char *comp_name, DOM_CRED *clnt_cred) { if (clnt == NULL) return False; @@ -1170,8 +1172,8 @@ BOOL smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int de makes a DOM_CLNT_INFO structure. ********************************************************************/ BOOL make_clnt_info(DOM_CLNT_INFO *clnt, - char *logon_srv, char *acct_name, - uint16 sec_chan, char *comp_name, + const char *logon_srv, const char *acct_name, + uint16 sec_chan, const char *comp_name, DOM_CRED *cred) { if (clnt == NULL || cred == NULL) return False; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index cd1476e201..455129b6f9 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -884,7 +884,7 @@ BOOL make_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, uint16 validation_level) + NET_ID_INFO_CTR *ctr) { if (sam == NULL) return False; @@ -904,7 +904,6 @@ BOOL make_sam_info(DOM_SAM_INFO *sam, sam->logon_level = logon_level; sam->ctr = ctr; - sam->validation_level = validation_level; return True; } @@ -970,8 +969,6 @@ static BOOL smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int net_io_id_info_ctr("logon_info", sam->ctr, ps, depth); } - prs_uint16("validation_level", ps, depth, &(sam->validation_level)); - return True; } @@ -1194,6 +1191,8 @@ BOOL net_io_q_sam_logon(char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, int d prs_align(ps); smb_io_sam_info("", &(q_l->sam_id), ps, depth); /* domain SID */ + prs_uint16("validation_level", ps, depth, &(q_l->validation_level)); + return True; } -- cgit From a0ba234cf9b40adf6b5390e4e67730163a42883f Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 6 Dec 1999 00:44:32 +0000 Subject: the first independent msrpc daemon - lsarpcd. one horrible cut / paste job from smbd, plus a code split of shared components between the two. the job is not _yet_ complete, as i need to be able to do a become_user() call for security reasons. i picked lsarpcd first because you don't _need_ security on it (microsoft botched so badly on this one, it's not real. at least they fixed this in nt5 with restrictanonymous=0x2). fixing this involves sending the current smb and unix credentials down the unix pipe so that the daemon it eventually goes to can pick them up at the other end. i can't believe this all worked!!! (This used to be commit 2245b0c6d13c7c5886e81f9137b05df883598c26) --- source3/rpc_parse/parse_prs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index bf4efbe527..f53b2da955 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -36,6 +36,16 @@ void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name) DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(depth), ps->offset, fn_name, desc)); } +/******************************************************************* + debug a parse structure + ********************************************************************/ +void prs_debug_out(prs_struct *ps, int level) +{ + DEBUG(level,("ps: io %s align %d offset %d err %d data %p len %d\n", + BOOLSTR(ps->io), ps->align, ps->offset, ps->error, ps->data, + ps->data != NULL ? mem_buf_len(ps->data) : 0)); +} + /******************************************************************* initialise a parse structure ********************************************************************/ -- cgit From 4ab9d91428b66bd2fe407b0dba94f4130160b576 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 8 Dec 1999 21:43:03 +0000 Subject: ABOUT TIME!!!!!!!! damn, this one is bad. started, at least two days ago, to add an authentication mechanism to the smbd<->msrpc redirector/relay, such that sufficient unix / nt information could be transferred across the unix socket to do a become_user() on the other side of the socket. it is necessary that the msrpc daemon inherit the same unix and nt credentials as the smbd process from which it was spawned, until such time as the msrpc daemon receives an authentication request of its own, whereupon the msrpc daemon is responsible for authenticating the new credentials and doing yet another become_user() etc sequence. (This used to be commit 30c7fdd6ef10ecd35594311c1b250b95ff895489) --- source3/rpc_parse/parse_prs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index f53b2da955..4c52e15769 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -429,6 +429,9 @@ BOOL _prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, u if (ps->error) return False; start = (uint8*)mem_data(&(ps->data), ps->offset); + DEBUG(120,("_prs_string: string %s len %d max %d\n", + str, len, max_buf_size)); + do { char *q; @@ -443,7 +446,7 @@ BOOL _prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, u if (i < len || len == 0) { - RW_CVAL(ps->io, q, str[i],0); + RW_CVAL(ps->io, q, str[i], 0); } else { @@ -453,6 +456,9 @@ BOOL _prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, u } while (i < max_buf_size && (len == 0 ? str[i] != 0 : i < len) ); + DEBUG(120,("_prs_string: string %s len %d max %d\n", + str, len, max_buf_size)); + ps->offset += i+1; dump_data(5+depth, (char *)start, i); -- cgit From 6b22909bdefda362a7c45ec3780ce04e15a64c24 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 8 Dec 1999 21:45:57 +0000 Subject: parsing code for transferring unix and nt security credentials over-the-wire. at present, a unix password is missing from the unix credentials, but is not _actually_ expected to be needed. weeelll... maybe :-) this is used to transfer credentials between smbd and msrpc daemons, down a unix socket, so that the unix and nt credentials can be inherited by an msrpc daemon called up from smbd. (This used to be commit 5e68403bbb6f18e754679d967fee9e259d24211c) --- source3/rpc_parse/parse_creds.c | 494 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 494 insertions(+) create mode 100644 source3/rpc_parse/parse_creds.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c new file mode 100644 index 0000000000..127557d1b8 --- /dev/null +++ b/source3/rpc_parse/parse_creds.c @@ -0,0 +1,494 @@ +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tgrpsgell 1992-1999, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, + * Copyright (C) Paul Ashton 1997-1999. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambgrpsge, MA 02139, USA. + */ + + +#include "includes.h" + +extern int DEBUGLEVEL; + + +/******************************************************************* +makes a CREDS_UNIX structure. +********************************************************************/ +BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name) +{ + if (r_u == NULL) return False; + + DEBUG(5,("make_creds_unix\n")); + + fstrcpy(r_u->user_name, user_name); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL creds_io_unix(char *desc, CREDS_UNIX *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "creds_io_unix"); + depth++; + + prs_align(ps); + prs_string("user_name", ps, depth, r_u->user_name, strlen(r_u->user_name), sizeof(r_u->user_name)); + prs_align(ps); + + return True; +} + + +/******************************************************************* +frees a structure. +********************************************************************/ +void creds_free_unix(CREDS_UNIX *r_u) +{ +} + +/******************************************************************* +makes a CREDS_UNIX_SEC structure. +********************************************************************/ +BOOL make_creds_unix_sec(CREDS_UNIX_SEC *r_u, + uint32 uid, uint32 gid, uint32 num_grps, uint32 *grps) +{ + if (r_u == NULL) return False; + + DEBUG(5,("make_creds_unix_sec\n")); + + r_u->uid = uid; + r_u->gid = gid; + r_u->num_grps = num_grps; + r_u->grps = grps; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL creds_io_unix_sec(char *desc, CREDS_UNIX_SEC *r_u, prs_struct *ps, int depth) +{ + uint32 i; + + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "creds_io_unix_sec"); + depth++; + + prs_align(ps); + + prs_uint32("uid", ps, depth, &(r_u->uid)); + prs_uint32("gid", ps, depth, &(r_u->gid)); + prs_uint32("num_grps", ps, depth, &(r_u->num_grps)); + if (r_u->num_grps != 0) + { + r_u->grps = (uint32*)Realloc(r_u->grps, + sizeof(r_u->grps[0]) * + r_u->num_grps); + if (r_u->grps == NULL) + { + creds_free_unix_sec(r_u); + return False; + } + } + for (i = 0; i < r_u->num_grps; i++) + { + prs_grow(ps); + prs_uint32("", ps, depth, &(r_u->grps[i])); + } + return True; +} + + +/******************************************************************* +frees a structure. +********************************************************************/ +void creds_free_unix_sec(CREDS_UNIX_SEC *r_u) +{ + if (r_u->grps != NULL) + { + free(r_u->grps); + r_u->grps = NULL; + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL creds_io_nt_sec(char *desc, CREDS_NT_SEC *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "creds_io_nt"); + depth++; + + prs_align(ps); + + smb_io_dom_sid ("sid", &r_u->sid, ps, depth); + prs_align(ps); + + sec_io_desc_buf("sd ", &r_u->sd , ps, depth); + prs_align(ps); + + return True; +} + +/******************************************************************* +frees a structure. +********************************************************************/ +void creds_free_nt_sec(CREDS_NT_SEC *r_u) +{ +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL creds_io_pwd_info(char *desc, struct pwd_info *pwd, prs_struct *ps, int depth) +{ + if (pwd == NULL) return False; + + prs_debug(ps, depth, desc, "creds_io_pwd_info"); + depth++; + + prs_align(ps); + + prs_uint32("nullpwd", ps, depth, &(pwd->null_pwd)); + if (pwd->null_pwd) + { + return True; + } + + prs_uint32("cleartext", ps, depth, &(pwd->cleartext)); + if (pwd->cleartext) + { + prs_string("password", ps, depth, pwd->password, strlen(pwd->password), sizeof(pwd->password)); + prs_align(ps); + return True; + } + prs_uint32("crypted", ps, depth, &(pwd->crypted)); + + prs_uint8s(False, "smb_lm_pwd", ps, depth, (char*)&pwd->smb_lm_pwd, sizeof(pwd->smb_lm_pwd)); + prs_align(ps); + prs_uint8s(False, "smb_nt_pwd", ps, depth, (char*)&pwd->smb_nt_pwd, sizeof(pwd->smb_nt_pwd)); + prs_align(ps); + + prs_uint8s(False, "smb_lm_owf", ps, depth, (char*)&pwd->smb_lm_owf, sizeof(pwd->smb_lm_owf)); + prs_align(ps); + prs_uint32("nt_owf_len", ps, depth, &(pwd->nt_owf_len)); + if (pwd->nt_owf_len > sizeof(pwd->smb_nt_owf)) + { + return False; + } + prs_uint8s(False, "smb_nt_owf", ps, depth, (char*)&pwd->smb_nt_owf, pwd->nt_owf_len); + prs_align(ps); + + prs_uint8s(False, "lm_cli_chal", ps, depth, (char*)&pwd->lm_cli_chal, sizeof(pwd->lm_cli_chal)); + prs_align(ps); + prs_uint32("nt_cli_chal_len", ps, depth, &(pwd->nt_cli_chal_len)); + + if (pwd->nt_cli_chal_len > sizeof(pwd->nt_cli_chal)) + { + return False; + } + prs_uint8s(False, "nt_cli_chal", ps, depth, (char*)&pwd->nt_cli_chal, pwd->nt_cli_chal_len); + prs_align(ps); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL creds_io_nt(char *desc, CREDS_NT *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "creds_io_nt"); + depth++; + + prs_align(ps); + + /* lkclXXXX CHEAT!!!!!!!! */ + prs_string("user_name", ps, depth, r_u->user_name, strlen(r_u->user_name), sizeof(r_u->user_name)); + prs_align(ps); + prs_string("domain", ps, depth, r_u->domain, strlen(r_u->domain), sizeof(r_u->domain)); + prs_align(ps); + + creds_io_pwd_info("pwd", &r_u->pwd, ps, depth); + prs_align(ps); + + prs_uint32("ntlmssp", ps, depth, &(r_u->ntlmssp_flags)); + + return True; +} + +/******************************************************************* +frees a structure. +********************************************************************/ +void creds_free_nt(CREDS_NT *r_u) +{ +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL creds_io_hybrid(char *desc, CREDS_HYBRID *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "creds_io_hybrid"); + depth++; + + prs_align(ps); + + prs_uint32("reuse", ps, depth, &(r_u->reuse)); + prs_uint32("ptr_ntc", ps, depth, &(r_u->ptr_ntc)); + prs_uint32("ptr_uxc", ps, depth, &(r_u->ptr_uxc)); + if (r_u->ptr_ntc != 0) + { + if (!creds_io_nt ("ntc", &r_u->ntc, ps, depth)) return False; + } + if (r_u->ptr_uxc != 0) + { + if (!creds_io_unix("uxc", &r_u->uxc, ps, depth)) return False; + } + if (r_u->ptr_nts != 0) + { + if (!creds_io_nt_sec ("nts", &r_u->nts, ps, depth)) return False; + } + if (r_u->ptr_uxs != 0) + { + if (!creds_io_unix_sec("uxs", &r_u->uxs, ps, depth)) return False; + } + return True; +} + +void copy_unix_creds(CREDS_UNIX *to, const CREDS_UNIX *from) +{ + if (from == NULL) + { + to->user_name[0] = 0; + return; + } + fstrcpy(to->user_name, from->user_name); +}; + +void copy_nt_sec_creds(CREDS_NT_SEC *to, const CREDS_NT_SEC *from) +{ + if (from == NULL) + { + ZERO_STRUCTP(to); + return; + } + memcpy(&to, &from, sizeof(*from)); +}; + +void copy_unix_sec_creds(CREDS_UNIX_SEC *to, const CREDS_UNIX_SEC *from) +{ + if (from == NULL) + { + to->uid = -1; + to->gid = -1; + to->num_grps = 0; + to->grps = NULL; + return; + } + to->uid = from->uid; + to->gid = from->gid; + to->num_grps = 0; + to->grps = NULL; + + if (from->num_grps != 0) + { + size_t size = to->num_grps * sizeof(to->grps[0]); + to->grps = (uint32*)malloc(size); + if (to->grps == NULL) + { + return; + } + to->num_grps = from->num_grps; + memcpy(to->grps, from->grps, size); + } +}; + +void copy_nt_creds(struct ntuser_creds *to, + const struct ntuser_creds *from) +{ + if (from == NULL) + { + to->domain[0] = 0; + to->user_name[0] = 0; + pwd_set_nullpwd(&to->pwd); + to->ntlmssp_flags = 0; + + return; + } + safe_strcpy(to->domain , from->domain , sizeof(from->domain )-1); + safe_strcpy(to->user_name, from->user_name, sizeof(from->user_name)-1); + memcpy(&to->pwd, &from->pwd, sizeof(from->pwd)); + to->ntlmssp_flags = from->ntlmssp_flags; +}; + +void copy_user_creds(struct user_creds *to, + const struct user_creds *from) +{ + ZERO_STRUCTP(to); + if (from == NULL) + { + to->ptr_ntc = 0; + to->ptr_uxc = 0; + to->ptr_nts = 0; + to->ptr_uxs = 0; + copy_nt_creds(&to->ntc, NULL); + copy_unix_creds(&to->uxc, NULL); + copy_nt_sec_creds(&to->nts, NULL); + copy_unix_sec_creds(&to->uxs, NULL); + to->reuse = False; + return; + } + to->ptr_nts = from->ptr_nts; + to->ptr_uxs = from->ptr_uxs; + to->ptr_ntc = from->ptr_ntc; + to->ptr_uxc = from->ptr_uxc; + if (to->ptr_ntc != 0) + { + copy_nt_creds(&to->ntc, &from->ntc); + } + if (to->ptr_uxc != 0) + { + copy_unix_creds(&to->uxc, &from->uxc); + } + if (to->ptr_ntc != 0) + { + copy_nt_sec_creds(&to->nts, &from->nts); + } + if (to->ptr_uxc != 0) + { + copy_unix_sec_creds(&to->uxs, &from->uxs); + } + to->reuse = from->reuse; +}; + +void free_user_creds(struct user_creds *creds) +{ + creds_free_unix(&creds->uxc); + creds_free_nt (&creds->ntc); + creds_free_unix_sec(&creds->uxs); + creds_free_nt_sec (&creds->nts); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL creds_io_cmd(char *desc, CREDS_CMD *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "creds_io_cmd"); + depth++; + + prs_align(ps); + + prs_uint16("version", ps, depth, &(r_u->version)); + prs_uint16("command", ps, depth, &(r_u->command)); + + prs_string("name ", ps, depth, r_u->name, strlen(r_u->name), sizeof(r_u->name)); + prs_align(ps); + + prs_uint32("ptr_creds", ps, depth, &(r_u->ptr_creds)); + if (r_u->ptr_creds != 0) + { + if (!creds_io_hybrid("creds", r_u->cred, ps, depth)) + { + return False; + } + } + + + return True; +} + + +BOOL create_ntuser_creds( prs_struct *ps, + const char* name, + uint16 version, uint16 command, + const struct ntuser_creds *ntu, + BOOL reuse) +{ + CREDS_CMD cmd; + struct user_creds usr; + + ZERO_STRUCT(cmd); + ZERO_STRUCT(usr); + + DEBUG(10,("create_user_creds: %s %d %d\n", + name, version, command)); + + usr.reuse = reuse; + + fstrcpy(cmd.name, name); + cmd.version = version; + cmd.command = command; + cmd.ptr_creds = ntu != NULL ? 1 : 0; + cmd.cred = &usr; + + if (ntu != NULL) + { + copy_nt_creds(&usr.ntc, ntu); + usr.ptr_ntc = 1; + } + else + { + usr.ptr_ntc = 0; + } + + prs_init(ps, 1024, 4, 0, False); + + ps->offset = 4; + return creds_io_cmd("creds", &cmd, ps, 0); +} + +BOOL create_user_creds( prs_struct *ps, + const char* name, + uint16 version, uint16 command, + const struct user_creds *usr) +{ + CREDS_CMD cmd; + + ZERO_STRUCT(cmd); + + DEBUG(10,("create_user_creds: %s %d %d\n", + name, version, command)); + + fstrcpy(cmd.name, name); + cmd.version = version; + cmd.command = command; + cmd.ptr_creds = usr != NULL ? 1 : 0; + cmd.cred = usr; + + prs_init(ps, 1024, 4, 0, False); + + ps->offset = 4; + return creds_io_cmd("creds", &cmd, ps, 0); +} -- cgit From 0ce128e3550794d4dbbd1def00e87c020f72c992 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 12 Dec 1999 01:25:49 +0000 Subject: delineation between smb and msrpc more marked. smbd now constructs pdus, and then feeds them over either a "local" function call or a "remote" function call to an msrpc service. the "remote" msrpc daemon, on the other side of a unix socket, then calls the same "local" function that smbd would, if the msrpc service were being run from inside smbd. this allows a transition from local msrpc services (inside the same smbd process) to remote (over a unix socket). removed reference to pipes_struct in msrpc services. all msrpc processing functions take rpcsrv_struct which is a structure containing state info for the msrpc functions to decode and create pdus. created become_vuser() which does everything not related to connection_struct that become_user() does. removed, as best i could, connection_struct dependencies from the nt spoolss printing code. todo: remove dcinfo from rpcsrv_struct because this stores NETLOGON-specific info on a per-connection basis, and if the connection dies then so does the info, and that's a fairly serious problem. had to put pretty much everything that is in user_struct into parse_creds.c to feed unix user info over to the msrpc daemons. why? because it's expensive to do unix password/group database lookups, and it's definitely expensive to do nt user profile lookups, not to mention pretty difficult and if you did either of these it would introduce a complication / unnecessary interdependency. so, send uid/gid/num_groups/gid_t* + SID+num_rids+domain_group_rids* + unix username + nt username + nt domain + user session key etc. this is the MINIMUM info identified so far that's actually implemented. missing bits include the called and calling netbios names etc. (basically, anything that can be loaded into standard_sub() and standard_sub_basic()...) (This used to be commit aa3c659a8dba0437c17c60055a6ed30fdfecdb6d) --- source3/rpc_parse/parse_at.c | 2 - source3/rpc_parse/parse_creds.c | 87 ++++++++++++++++++++++++++++++++---- source3/rpc_parse/parse_net.c | 4 -- source3/rpc_parse/parse_prs.c | 92 ++++++++++++++++++++++++++++++++++----- source3/rpc_parse/parse_rpc.c | 4 +- source3/rpc_parse/parse_samr.c | 34 --------------- source3/rpc_parse/parse_spoolss.c | 2 - source3/rpc_parse/parse_srv.c | 15 ------- 8 files changed, 160 insertions(+), 80 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_at.c b/source3/rpc_parse/parse_at.c index 87507230c0..a03a8cfad9 100644 --- a/source3/rpc_parse/parse_at.c +++ b/source3/rpc_parse/parse_at.c @@ -221,14 +221,12 @@ BOOL at_io_r_enum_jobs(char *desc, AT_R_ENUM_JOBS *r_e, prs_struct *ps, int dept for (i = 0; i < r_e->num_entries2; i++) { - prs_grow(ps); prs_uint32("jobid", ps, depth, &(r_e->info[i].jobid)); at_io_job_info("", &(r_e->info[i].info), ps, depth); } for (i = 0; i < r_e->num_entries2; i++) { - prs_grow(ps); smb_io_unistr2("", &(r_e->command[i]), r_e->info[i].info.ptr_command, ps, depth); } diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c index 127557d1b8..c661d5a3c6 100644 --- a/source3/rpc_parse/parse_creds.c +++ b/source3/rpc_parse/parse_creds.c @@ -30,13 +30,19 @@ extern int DEBUGLEVEL; /******************************************************************* makes a CREDS_UNIX structure. ********************************************************************/ -BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name) +BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name, + const char* requested_name, + const char* real_name, + BOOL guest) { if (r_u == NULL) return False; DEBUG(5,("make_creds_unix\n")); - fstrcpy(r_u->user_name, user_name); + fstrcpy(r_u->user_name , user_name); + fstrcpy(r_u->requested_name, requested_name); + fstrcpy(r_u->real_name , real_name); + r_u->guest = guest; return True; } @@ -54,7 +60,11 @@ BOOL creds_io_unix(char *desc, CREDS_UNIX *r_u, prs_struct *ps, int depth) prs_align(ps); prs_string("user_name", ps, depth, r_u->user_name, strlen(r_u->user_name), sizeof(r_u->user_name)); prs_align(ps); - + prs_string("requested_name", ps, depth, r_u->requested_name, strlen(r_u->requested_name), sizeof(r_u->requested_name)); + prs_align(ps); + prs_string("real_name", ps, depth, r_u->real_name, strlen(r_u->real_name), sizeof(r_u->real_name)); + prs_align(ps); + prs_uint32("guest", ps, depth, &(r_u->guest)); return True; } @@ -70,8 +80,9 @@ void creds_free_unix(CREDS_UNIX *r_u) makes a CREDS_UNIX_SEC structure. ********************************************************************/ BOOL make_creds_unix_sec(CREDS_UNIX_SEC *r_u, - uint32 uid, uint32 gid, uint32 num_grps, uint32 *grps) + uint32 uid, uint32 gid, uint32 num_grps, gid_t *grps) { + int i; if (r_u == NULL) return False; DEBUG(5,("make_creds_unix_sec\n")); @@ -79,7 +90,16 @@ BOOL make_creds_unix_sec(CREDS_UNIX_SEC *r_u, r_u->uid = uid; r_u->gid = gid; r_u->num_grps = num_grps; - r_u->grps = grps; + r_u->grps = (uint32*)Realloc(NULL, sizeof(r_u->grps[0]) * + r_u->num_grps); + if (r_u->grps == NULL && num_grps != 0) + { + return False; + } + for (i = 0; i < num_grps; i++) + { + r_u->grps[i] = (gid_t)grps[i]; + } return True; } @@ -114,7 +134,6 @@ BOOL creds_io_unix_sec(char *desc, CREDS_UNIX_SEC *r_u, prs_struct *ps, int dept } for (i = 0; i < r_u->num_grps; i++) { - prs_grow(ps); prs_uint32("", ps, depth, &(r_u->grps[i])); } return True; @@ -133,11 +152,40 @@ void creds_free_unix_sec(CREDS_UNIX_SEC *r_u) } } +/******************************************************************* +makes a CREDS_NT_SEC structure. +********************************************************************/ +BOOL make_creds_nt_sec(CREDS_NT_SEC *r_u, + DOM_SID *sid, uint32 num_grps, uint32 *grps) +{ + int i; + if (r_u == NULL) return False; + + DEBUG(5,("make_creds_unix_sec\n")); + + sid_copy(&r_u->sid, sid); + r_u->num_grps = num_grps; + r_u->grp_rids = (uint32*)Realloc(NULL, sizeof(r_u->grp_rids[0]) * + r_u->num_grps); + + if (r_u->grp_rids == NULL && num_grps != 0) + { + return False; + } + for (i = 0; i < num_grps; i++) + { + r_u->grp_rids[i] = grps[i]; + } + + return True; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ BOOL creds_io_nt_sec(char *desc, CREDS_NT_SEC *r_u, prs_struct *ps, int depth) { + int i; if (r_u == NULL) return False; prs_debug(ps, depth, desc, "creds_io_nt"); @@ -148,8 +196,22 @@ BOOL creds_io_nt_sec(char *desc, CREDS_NT_SEC *r_u, prs_struct *ps, int depth) smb_io_dom_sid ("sid", &r_u->sid, ps, depth); prs_align(ps); - sec_io_desc_buf("sd ", &r_u->sd , ps, depth); - prs_align(ps); + prs_uint32("num_grps", ps, depth, &(r_u->num_grps)); + if (r_u->num_grps != 0) + { + r_u->grp_rids = (uint32*)Realloc(r_u->grp_rids, + sizeof(r_u->grp_rids[0]) * + r_u->num_grps); + if (r_u->grp_rids == NULL) + { + creds_free_nt_sec(r_u); + return False; + } + } + for (i = 0; i < r_u->num_grps; i++) + { + prs_uint32("", ps, depth, &(r_u->grp_rids[i])); + } return True; } @@ -159,6 +221,11 @@ frees a structure. ********************************************************************/ void creds_free_nt_sec(CREDS_NT_SEC *r_u) { + if (r_u->grp_rids != NULL) + { + free(r_u->grp_rids); + r_u->grp_rids = NULL; + } } /******************************************************************* @@ -265,6 +332,8 @@ BOOL creds_io_hybrid(char *desc, CREDS_HYBRID *r_u, prs_struct *ps, int depth) prs_uint32("reuse", ps, depth, &(r_u->reuse)); prs_uint32("ptr_ntc", ps, depth, &(r_u->ptr_ntc)); prs_uint32("ptr_uxc", ps, depth, &(r_u->ptr_uxc)); + prs_uint32("ptr_nts", ps, depth, &(r_u->ptr_nts)); + prs_uint32("ptr_uxs", ps, depth, &(r_u->ptr_uxs)); if (r_u->ptr_ntc != 0) { if (!creds_io_nt ("ntc", &r_u->ntc, ps, depth)) return False; @@ -321,7 +390,7 @@ void copy_unix_sec_creds(CREDS_UNIX_SEC *to, const CREDS_UNIX_SEC *from) if (from->num_grps != 0) { - size_t size = to->num_grps * sizeof(to->grps[0]); + size_t size = from->num_grps * sizeof(from->grps[0]); to->grps = (uint32*)malloc(size); if (to->grps == NULL) { diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 455129b6f9..277c2331b4 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1669,7 +1669,6 @@ static BOOL net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_ for (i = 0; i < info->num_members2; i++) { - prs_grow(ps); slprintf(tmp, sizeof(tmp) - 1, "rids[%02d]", i); prs_uint32(tmp, ps, depth, &(info->rids[i])); } @@ -1688,7 +1687,6 @@ static BOOL net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_ for (i = 0; i < info->num_members3; i++) { - prs_grow(ps); slprintf(tmp, sizeof(tmp) - 1, "attribs[%02d]", i); prs_uint32(tmp, ps, depth, &(info->attribs[i])); } @@ -1754,7 +1752,6 @@ static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_ for (i = 0; i < info->num_sids; i++) { - prs_grow(ps); slprintf(tmp, sizeof(tmp) - 1, "ptr_sids[%02d]", i); prs_uint32(tmp, ps, depth, &(info->ptr_sids[i])); } @@ -1765,7 +1762,6 @@ static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_ { if (info->ptr_sids[i] != 0) { - prs_grow(ps); slprintf(tmp, sizeof(tmp) - 1, "sids[%02d]", i); smb_io_dom_sid2(tmp, &(info->sids[i]), ps, depth); } diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 4c52e15769..d9c07e3885 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -39,10 +39,11 @@ void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name) /******************************************************************* debug a parse structure ********************************************************************/ -void prs_debug_out(prs_struct *ps, int level) +void prs_debug_out(prs_struct *ps, char *msg, int level) { - DEBUG(level,("ps: io %s align %d offset %d err %d data %p len %d\n", - BOOLSTR(ps->io), ps->align, ps->offset, ps->error, ps->data, + DEBUG(level,("%s ps: io %s align %d offset %d err %d data %p len %d\n", + msg, BOOLSTR(ps->io), ps->align, ps->offset, ps->error, + ps->data, ps->data != NULL ? mem_buf_len(ps->data) : 0)); } @@ -69,6 +70,22 @@ void prs_init(prs_struct *ps, uint32 size, } } +/******************************************************************* + copy a parse structure + ********************************************************************/ +BOOL prs_copy(prs_struct *ps, const prs_struct *from) +{ + int len = mem_buf_len(from->data); + prs_init(ps, len, from->align, from->data->margin, from->io); + if (!mem_buf_copy(mem_data(&ps->data, 0), from->data, 0, len)) + { + return False; + } + ps->offset = len; + prs_link(NULL, ps, NULL); + return True; +} + /******************************************************************* initialise a parse structure ********************************************************************/ @@ -85,6 +102,10 @@ void prs_link(prs_struct *prev, prs_struct *ps, prs_struct *next) ps->data->offset.start = prev != NULL ? prev->data->offset.end : 0; ps->data->offset.end = ps->data->offset.start + ps->offset; ps->data->next = next != NULL ? next->data : NULL; + + DEBUG(150,("prs_link: start %d end %d\n", + ps->data->offset.start, + ps->data->offset.end)); } /******************************************************************* @@ -107,12 +128,31 @@ void prs_align(prs_struct *ps) depends on the data stream mode (io) ********************************************************************/ -BOOL prs_grow(prs_struct *ps) +BOOL prs_grow(prs_struct *ps, uint32 new_size) { if (ps->error) return False; - return mem_grow_data(&(ps->data), ps->io, ps->offset, False); + return mem_grow_data(&(ps->data), ps->io, new_size, False); } +/******************************************************************* + lengthens a buffer by len bytes and copies data into it. + ********************************************************************/ +BOOL prs_append_data(prs_struct *ps, const char *data, int len) +{ + int prev_size = ps->data->data_used; + int new_size = prev_size + len; + char *to; + + mem_realloc_data(ps->data, new_size); + to = mem_data(&ps->data, prev_size); + if (to == NULL || ps->data->data_used != new_size) + { + return False; + } + memcpy(to, data, len); + + return True; +} /******************************************************************* stream a uint8 @@ -121,16 +161,19 @@ BOOL _prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8) { char *q; if (ps->error) return False; + prs_grow(ps, ps->offset + 1); q = mem_data(&(ps->data), ps->offset); if (q == NULL) { ps->error = True; + prs_debug_out(ps, "_prs_uint8 error", 5); return False; } DBG_RW_CVAL(name, depth, ps->offset, ps->io, q, *data8) ps->offset += 1; + return True; } @@ -141,10 +184,12 @@ BOOL _prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16) { char *q; if (ps->error) return False; + prs_grow(ps, ps->offset + 2); q = mem_data(&(ps->data), ps->offset); if (q == NULL) { ps->error = True; + prs_debug_out(ps, "_prs_uint16 error", 5); return False; } @@ -165,6 +210,7 @@ BOOL _prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) if (q == NULL) { ps->error = True; + prs_debug_out(ps, "_prs_hash1 error", 5); return False; } @@ -188,10 +234,12 @@ BOOL _prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) { char *q; if (ps->error) return False; + prs_grow(ps, ps->offset + 4); q = mem_data(&(ps->data), ps->offset); if (q == NULL) { ps->error = True; + prs_debug_out(ps, "_prs_uint32 error", 5); return False; } @@ -211,13 +259,15 @@ BOOL _prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *da int end_offset; char *e; if (ps->error) return False; - q = mem_data(&(ps->data), ps->offset); end_offset = ps->offset + len * sizeof(uint8); + prs_grow(ps, end_offset); + q = mem_data(&(ps->data), ps->offset); e = mem_data(&(ps->data), end_offset-1); if (q == NULL || e == NULL) { ps->error = True; + prs_debug_out(ps, "_prs_uint8s error", 5); return False; } @@ -236,13 +286,15 @@ BOOL _prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 * int end_offset; char *e; if (ps->error) return False; - q = mem_data(&(ps->data), ps->offset); end_offset = ps->offset + len * sizeof(uint16); + prs_grow(ps, end_offset); + q = mem_data(&(ps->data), ps->offset); e = mem_data(&(ps->data), end_offset-1); if (q == NULL || e == NULL) { ps->error = True; + prs_debug_out(ps, "_prs_uint16s error", 5); return False; } @@ -261,13 +313,15 @@ BOOL _prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 * int end_offset; char *e; if (ps->error) return False; - q = mem_data(&(ps->data), ps->offset); end_offset = ps->offset + len * sizeof(uint32); + prs_grow(ps, end_offset); + q = mem_data(&(ps->data), ps->offset); e = mem_data(&(ps->data), end_offset-1); if (q == NULL || e == NULL) { ps->error = True; + prs_debug_out(ps, "_prs_uint32s error", 5); return False; } @@ -287,13 +341,15 @@ BOOL _prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 int end_offset; char *e; if (ps->error) return False; + end_offset = ps->offset + str->buf_len * sizeof(uint8); + prs_grow(ps, end_offset); q = mem_data(&(ps->data), ps->offset); - end_offset = ps->offset + str->buf_len; e = mem_data(&(ps->data), end_offset-1); if (q == NULL || e == NULL) { ps->error = True; + prs_debug_out(ps, "_prs_buffer2 error", 5); return False; } @@ -313,13 +369,15 @@ BOOL _prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 int end_offset; char *e; if (ps->error) return False; - q = mem_data(&(ps->data), ps->offset); end_offset = ps->offset + str->str_str_len * sizeof(uint8); + prs_grow(ps, end_offset); + q = mem_data(&(ps->data), ps->offset); e = mem_data(&(ps->data), end_offset-1); if (q == NULL || e == NULL) { ps->error = True; + prs_debug_out(ps, "_prs_string2 error", 5); return False; } @@ -339,13 +397,15 @@ BOOL _prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 int end_offset; char *e; if (ps->error) return False; - q = mem_data(&(ps->data), ps->offset); end_offset = ps->offset + str->uni_str_len * sizeof(uint16); + prs_grow(ps, end_offset); + q = mem_data(&(ps->data), ps->offset); e = mem_data(&(ps->data), end_offset-1); if (q == NULL || e == NULL) { ps->error = True; + prs_debug_out(ps, "_prs_unistr2 error", 5); return False; } @@ -365,13 +425,15 @@ BOOL _prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int d int end_offset; char *e; if (ps->error) return False; - q = mem_data(&(ps->data), ps->offset); end_offset = ps->offset + str->uni_str_len * sizeof(uint16); + prs_grow(ps, end_offset); + q = mem_data(&(ps->data), ps->offset); e = mem_data(&(ps->data), end_offset-1); if (q == NULL || e == NULL) { ps->error = True; + prs_debug_out(ps, "_prs_unistr3 error", 5); return False; } @@ -395,10 +457,12 @@ BOOL _prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) { char *q; i++; + prs_grow(ps, ps->offset + i*2); q = mem_data(&(ps->data), ps->offset + i*2); if (q == NULL) { ps->error = True; + prs_debug_out(ps, "_prs_unistr error", 5); return False; } RW_SVAL(ps->io, q, str->buffer[i],0); @@ -432,15 +496,19 @@ BOOL _prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, u DEBUG(120,("_prs_string: string %s len %d max %d\n", str, len, max_buf_size)); + DEBUG(10,("%s%04x %s: ", tab_depth(depth), ps->offset, name != NULL ? name : "")); + do { char *q; i++; + prs_grow(ps, ps->offset + i); q = mem_data(&(ps->data), ps->offset + i); if (q == NULL) { ps->error = True; + prs_debug_out(ps, "_prs_string error", 5); return False; } diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 819e441742..ac6ea8ea7e 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -270,7 +270,7 @@ creates an RPC_ADDR_STR structure. The name can be null (RPC Alter-Context) ********************************************************************/ -static BOOL make_rpc_addr_str(RPC_ADDR_STR *str, char *name) +static BOOL make_rpc_addr_str(RPC_ADDR_STR *str, const char *name) { if (str == NULL ) return False; if (name == NULL) @@ -434,7 +434,7 @@ jfm: nope two ! The pipe_addr can be NULL ! ********************************************************************/ BOOL make_rpc_hdr_ba(RPC_HDR_BA *rpc, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, - char *pipe_addr, + const char *pipe_addr, uint8 num_results, uint16 result, uint16 reason, RPC_IFACE *transfer) { diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 8ce5275bae..cedfbdebd3 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1314,13 +1314,11 @@ BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct for (i = 0; i < r_u->num_entries2; i++) { - prs_grow(ps); sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); } for (i = 0; i < r_u->num_entries2; i++) { - prs_grow(ps); smb_io_unistr2("", &(r_u->uni_acct_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); prs_align(ps); } @@ -1444,13 +1442,11 @@ static BOOL sam_io_sam_dispinfo_1(char *desc, SAM_DISPINFO_1 *sam, uint32 num_en for (i = 0; i < num_entries; i++) { - prs_grow(ps); sam_io_sam_entry1("", &(sam->sam[i]), ps, depth); } for (i = 0; i < num_entries; i++) { - prs_grow(ps); sam_io_sam_str1 ("", &(sam->str[i]), sam->sam[i].hdr_acct_name.buffer, sam->sam[i].hdr_user_name.buffer, @@ -1521,13 +1517,11 @@ static BOOL sam_io_sam_dispinfo_2(char *desc, SAM_DISPINFO_2 *sam, uint32 num_en for (i = 0; i < num_entries; i++) { - prs_grow(ps); sam_io_sam_entry2("", &(sam->sam[i]), ps, depth); } for (i = 0; i < num_entries; i++) { - prs_grow(ps); sam_io_sam_str2 ("", &(sam->str[i]), sam->sam[i].hdr_srv_name.buffer, sam->sam[i].hdr_srv_desc.buffer, @@ -1597,13 +1591,11 @@ static BOOL sam_io_sam_dispinfo_3(char *desc, SAM_DISPINFO_3 *sam, uint32 num_en for (i = 0; i < num_entries; i++) { - prs_grow(ps); sam_io_sam_entry3("", &(sam->sam[i]), ps, depth); } for (i = 0; i < num_entries; i++) { - prs_grow(ps); sam_io_sam_str3 ("", &(sam->str[i]), sam->sam[i].hdr_grp_name.buffer, sam->sam[i].hdr_grp_desc.buffer, @@ -1672,13 +1664,11 @@ static BOOL sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 *sam, uint32 num_en for (i = 0; i < num_entries; i++) { - prs_grow(ps); sam_io_sam_entry4("", &(sam->sam[i]), ps, depth); } for (i = 0; i < num_entries; i++) { - prs_grow(ps); smb_io_string2("acct_name", &(sam->str[i].acct_name), sam->sam[i].hdr_acct_name.buffer, ps, depth); } @@ -1744,13 +1734,11 @@ static BOOL sam_io_sam_dispinfo_5(char *desc, SAM_DISPINFO_5 *sam, uint32 num_en for (i = 0; i < num_entries; i++) { - prs_grow(ps); sam_io_sam_entry5("", &(sam->sam[i]), ps, depth); } for (i = 0; i < num_entries; i++) { - prs_grow(ps); smb_io_string2("grp_name", &(sam->str[i].grp_name), sam->sam[i].hdr_grp_name.buffer, ps, depth); } @@ -2599,7 +2587,6 @@ BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struc } for (i = 0; i < r_u->num_rids; i++) { - prs_grow(ps); prs_uint32("", ps, depth, &(r_u->rid[i])); } } @@ -2621,7 +2608,6 @@ BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struc } for (i = 0; i < r_u->num_attrs; i++) { - prs_grow(ps); prs_uint32("", ps, depth, &(r_u->attr[i])); } } @@ -2753,7 +2739,6 @@ BOOL samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_s for (i = 0; i < r_u->num_entries2; i++) { - prs_grow(ps); smb_io_gid("", &(r_u->gid[i]), ps, depth); } } @@ -2903,7 +2888,6 @@ BOOL samr_io_r_enum_domains(char *desc, SAMR_R_ENUM_DOMAINS *r_u, prs_struct *ps { fstring tmp; slprintf(tmp, sizeof(tmp)-1, "dom[%d]", i); - prs_grow(ps); sam_io_sam_entry(tmp, &(r_u->sam[i]), ps, depth); } @@ -2911,7 +2895,6 @@ BOOL samr_io_r_enum_domains(char *desc, SAMR_R_ENUM_DOMAINS *r_u, prs_struct *ps { fstring tmp; slprintf(tmp, sizeof(tmp)-1, "dom[%d]", i); - prs_grow(ps); smb_io_unistr2(tmp, &(r_u->uni_dom_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); prs_align(ps); } @@ -3066,13 +3049,11 @@ BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_stru for (i = 0; i < r_u->num_entries2; i++) { - prs_grow(ps); sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); } for (i = 0; i < r_u->num_entries2; i++) { - prs_grow(ps); smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); prs_align(ps); } @@ -3227,13 +3208,11 @@ BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_st for (i = 0; i < r_u->num_entries2; i++) { - prs_grow(ps); sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); } for (i = 0; i < r_u->num_entries2; i++) { - prs_grow(ps); smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); prs_align(ps); } @@ -3528,7 +3507,6 @@ BOOL samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES *q_u, prs { if (q_u->ptr_sid[i] != 0) { - prs_grow(ps); slprintf(tmp, sizeof(tmp)-1, "sid[%02d]", i); smb_io_dom_sid2(tmp, &(q_u->sid[i]), ps, depth); } @@ -3767,7 +3745,6 @@ BOOL samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS *q_u, prs_struct *ps, for (i = 0; i < q_u->num_rids2; i++) { - prs_grow(ps); slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i); prs_uint32(tmp, ps, depth, &(q_u->rid[i])); } @@ -3902,13 +3879,11 @@ BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, } for (i = 0; i < r_u->num_names2; i++) { - prs_grow(ps); slprintf(tmp, sizeof(tmp) - 1, "hdr[%02d] ", i); smb_io_unihdr ("", &(r_u->hdr_name[i]), ps, depth); } for (i = 0; i < r_u->num_names2; i++) { - prs_grow(ps); slprintf(tmp, sizeof(tmp) - 1, "str[%02d] ", i); smb_io_unistr2("", &(r_u->uni_name[i]), r_u->hdr_name[i].buffer, ps, depth); prs_align(ps); @@ -3940,7 +3915,6 @@ BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, for (i = 0; i < r_u->num_types2; i++) { - prs_grow(ps); slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i); prs_uint32(tmp, ps, depth, &(r_u->type[i])); } @@ -4375,13 +4349,11 @@ BOOL samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM *r_u, prs_struc for (i = 0; i < r_u->num_sids1; i++) { - prs_grow(ps); ptr_sid[i] = 1; prs_uint32("", ps, depth, &(ptr_sid[i])); } for (i = 0; i < r_u->num_sids1; i++) { - prs_grow(ps); if (ptr_sid[i] != 0) { smb_io_dom_sid2("", &(r_u->sid[i]), ps, depth); @@ -4450,12 +4422,10 @@ BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *p for (i = 0; i < q_u->num_names2; i++) { - prs_grow(ps); smb_io_unihdr ("", &(q_u->hdr_name[i]), ps, depth); } for (i = 0; i < q_u->num_names2; i++) { - prs_grow(ps); smb_io_unistr2("", &(q_u->uni_name[i]), q_u->hdr_name[i].buffer, ps, depth); prs_align(ps); } @@ -4541,7 +4511,6 @@ BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p for (i = 0; i < r_u->num_rids2; i++) { - prs_grow(ps); slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i); prs_uint32(tmp, ps, depth, &(r_u->rid[i])); } @@ -4562,7 +4531,6 @@ BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p for (i = 0; i < r_u->num_types2; i++) { - prs_grow(ps); slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i); prs_uint32(tmp, ps, depth, &(r_u->type[i])); } @@ -6289,13 +6257,11 @@ BOOL samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER *q_u, prs_struct prs_align(ps); samr_io_enc_passwd("nt_newpass", &(q_u->nt_newpass), ps, depth); - prs_grow(ps); samr_io_enc_hash ("nt_oldhash", &(q_u->nt_oldhash), ps, depth); prs_uint32("unknown", ps, depth, &(q_u->unknown)); samr_io_enc_passwd("lm_newpass", &(q_u->lm_newpass), ps, depth); - prs_grow(ps); samr_io_enc_hash ("lm_oldhash", &(q_u->lm_oldhash), ps, depth); return True; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index d5490553a2..b28b2dcc75 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -376,14 +376,12 @@ static BOOL smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, for (i=0;icount;i++) { - prs_grow(ps); smb_io_notify_info_data(desc, &(info->data[i]), ps, depth); } /* now do the strings at the end of the stream */ for (i=0;icount;i++) { - prs_grow(ps); smb_io_notify_info_data_strings(desc, &(info->data[i]), ps, depth); } diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 8ad275229e..63d27c8c91 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -129,13 +129,11 @@ static BOOL srv_io_srv_share_info_1(char *desc, SRV_SHARE_INFO_1 *ctr, prs_stru for (i = 0; i < num_entries; i++) { - prs_grow(ps); srv_io_share_info1("", &(ctr->info_1[i]), ps, depth); } for (i = 0; i < num_entries; i++) { - prs_grow(ps); srv_io_share_info1_str("", &(ctr->info_1_str[i]), ps, depth); } @@ -267,13 +265,11 @@ static BOOL srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_stru for (i = 0; i < num_entries; i++) { - prs_grow(ps); if (!srv_io_share_info2("", &(ctr->info_2[i]), ps, depth)) return False; } for (i = 0; i < num_entries; i++) { - prs_grow(ps); if (!srv_io_share_info2_str("", &(ctr->info_2_str[i]), &(ctr->info_2[i]), ps, depth)) return False; } @@ -499,13 +495,11 @@ static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct for (i = 0; i < num_entries; i++) { - prs_grow(ps); srv_io_sess_info0("", &(ss0->info_0[i]), ps, depth); } for (i = 0; i < num_entries; i++) { - prs_grow(ps); srv_io_sess_info0_str("", &(ss0->info_0_str[i]), &(ss0->info_0[i]), ps, depth); @@ -628,13 +622,11 @@ static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct for (i = 0; i < num_entries; i++) { - prs_grow(ps); srv_io_sess_info1("", &(ss1->info_1[i]), ps, depth); } for (i = 0; i < num_entries; i++) { - prs_grow(ps); srv_io_sess_info1_str("", &(ss1->info_1_str[i]), &(ss1->info_1[i]), ps, depth); @@ -839,7 +831,6 @@ static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct for (i = 0; i < num_entries; i++) { - prs_grow(ps); srv_io_conn_info0("", &(ss0->info_0[i]), ps, depth); } @@ -959,13 +950,11 @@ static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct for (i = 0; i < num_entries; i++) { - prs_grow(ps); srv_io_conn_info1("", &(ss1->info_1[i]), ps, depth); } for (i = 0; i < num_entries; i++) { - prs_grow(ps); srv_io_conn_info1_str("", &(ss1->info_1_str[i]), &(ss1->info_1[i]), ps, depth); @@ -1228,13 +1217,11 @@ static BOOL srv_io_srv_tprt_info_0(char *desc, SRV_TPRT_INFO_0 *tp0, prs_struct for (i = 0; i < num_entries; i++) { - prs_grow(ps); srv_io_tprt_info0("", &(tp0->info_0[i]), ps, depth); } for (i = 0; i < num_entries; i++) { - prs_grow(ps); srv_io_tprt_info0_str("", &(tp0->info_0_str[i]), &(tp0->info_0[i]), ps, depth); @@ -1511,13 +1498,11 @@ static BOOL srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct for (i = 0; i < num_entries; i++) { - prs_grow(ps); srv_io_file_info3("", &(fl3->info_3[i]), ps, depth); } for (i = 0; i < num_entries; i++) { - prs_grow(ps); srv_io_file_info3_str("", &(fl3->info_3_str[i]), ps, depth); } -- cgit From 4f8a24522c683761c6f2ee23dba56f6c7913377b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 12 Dec 1999 20:03:42 +0000 Subject: final part of "first" phase converting over to msrpc daemon architecture. done a minimal amout of clean-up in the Makefile, removing unnecessary modules from the link stage. this is not complete, yet, and will involve some changes, for example to smbd, to remove dependencies on the password database API that shouldn't be there. for example, smbd should not ever call getsmbpwXXX() it should call the Samr or Lsa API. this first implementation has minor problems with not reinstantiating the same services as the caller. the "homes" service is a good example. (This used to be commit caa50525220b0d0250fa139367593c2de2c12135) --- source3/rpc_parse/parse_spoolss.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b28b2dcc75..5cb6179936 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2024,8 +2024,11 @@ BOOL spoolss_io_r_enumprinters(char *desc, PRINTER_INFO_1 *info1; PRINTER_INFO_2 *info2; + fstring tmp; - prs_debug(ps, depth, desc, "spoolss_io_r_enumprinters"); + slprintf(tmp, sizeof(tmp)-1, "spoolss_io_r_enumprinters %d", r_u->level); + + prs_debug(ps, depth, desc, tmp); depth++; prs_align(ps); prs_uint32("pointer", ps, depth, &useless_ptr); -- cgit From 3db52feb1f3b2c07ce0b06ad4a7099fa6efe3fc7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 13 Dec 1999 13:27:58 +0000 Subject: first pass at updating head branch to be to be the same as the SAMBA_2_0 branch (This used to be commit 453a822a76780063dff23526c35408866d0c0154) --- source3/rpc_parse/parse_lsa.c | 1047 +++--- source3/rpc_parse/parse_misc.c | 1347 ++++---- source3/rpc_parse/parse_net.c | 1858 ++++------- source3/rpc_parse/parse_prs.c | 787 ++--- source3/rpc_parse/parse_reg.c | 1353 ++++---- source3/rpc_parse/parse_rpc.c | 1084 ++++--- source3/rpc_parse/parse_samr.c | 6952 ++++++++++++---------------------------- source3/rpc_parse/parse_sec.c | 704 ++-- source3/rpc_parse/parse_srv.c | 2284 +++++++------ source3/rpc_parse/parse_wks.c | 131 +- 10 files changed, 7191 insertions(+), 10356 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index d3b895dc1a..771e7c31d4 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2,9 +2,9 @@ * Unix SMB/Netbios implementation. * Version 1.9. * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1999, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, - * Copyright (C) Paul Ashton 1997-1999. + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. * * 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 @@ -26,93 +26,109 @@ extern int DEBUGLEVEL; +static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth); + /******************************************************************* -creates a LSA_TRANS_NAME structure. + Inits a LSA_TRANS_NAME structure. ********************************************************************/ -BOOL make_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, + +void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, uint32 sid_name_use, char *name, uint32 idx) { int len_name = strlen(name); + if(len_name == 0) + len_name = 1; + trn->sid_name_use = sid_name_use; - make_uni_hdr(&(trn->hdr_name), len_name); - make_unistr2(uni_name, name, len_name); + init_uni_hdr(&trn->hdr_name, len_name); + init_unistr2(uni_name, name, len_name); trn->domain_idx = idx; - - return True; } /******************************************************************* -reads or writes a LSA_TRANS_NAME structure. + Reads or writes a LSA_TRANS_NAME structure. ********************************************************************/ + static BOOL lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, int depth) { - if (trn == NULL) return False; + if (trn == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_trans_name"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("sid_name_use", ps, depth, &(trn->sid_name_use)); - smb_io_unihdr ("hdr_name", &(trn->hdr_name), ps, depth); - prs_uint32("domain_idx ", ps, depth, &(trn->domain_idx )); + if(!prs_uint32("sid_name_use", ps, depth, &trn->sid_name_use)) + 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; } /******************************************************************* -reads or writes a DOM_R_REF structure. + Reads or writes a DOM_R_REF structure. ********************************************************************/ -static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) + +static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) { - uint32 i, s, n; + int i, s, n; - prs_debug(ps, depth, desc, "smb_io_dom_r_ref"); + prs_debug(ps, depth, desc, "lsa_io_dom_r_ref"); depth++; - if (r_r == NULL) return False; + if (r_r == NULL) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("num_ref_doms_1", ps, depth, &(r_r->num_ref_doms_1)); /* num referenced domains? */ - prs_uint32("ptr_ref_dom ", ps, depth, &(r_r->ptr_ref_dom )); /* undocumented buffer pointer. */ - prs_uint32("max_entries ", ps, depth, &(r_r->max_entries )); /* 32 - max number of entries */ + if(!prs_uint32("num_ref_doms_1", ps, depth, &r_r->num_ref_doms_1)) /* num referenced domains? */ + return False; + if(!prs_uint32("ptr_ref_dom ", ps, depth, &r_r->ptr_ref_dom)) /* undocumented buffer pointer. */ + return False; + if(!prs_uint32("max_entries ", ps, depth, &r_r->max_entries)) /* 32 - max number of entries */ + return False; SMB_ASSERT_ARRAY(r_r->hdr_ref_dom, r_r->num_ref_doms_1); - if (r_r->ptr_ref_dom != 0) - { - prs_uint32("num_ref_doms_2", ps, depth, &(r_r->num_ref_doms_2)); /* 4 - num referenced domains? */ + if (r_r->ptr_ref_dom != 0) { + if(!prs_uint32("num_ref_doms_2", ps, depth, &r_r->num_ref_doms_2)) /* 4 - num referenced domains? */ + return False; + SMB_ASSERT_ARRAY(r_r->ref_dom, r_r->num_ref_doms_2); - for (i = 0; i < r_r->num_ref_doms_1; i++) - { + for (i = 0; i < r_r->num_ref_doms_1; i++) { fstring t; slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i); - smb_io_unihdr(t, &(r_r->hdr_ref_dom[i].hdr_dom_name), ps, depth); + if(!smb_io_unihdr(t, &r_r->hdr_ref_dom[i].hdr_dom_name, ps, depth)) + return False; slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i); - prs_uint32(t, ps, depth, &(r_r->hdr_ref_dom[i].ptr_dom_sid)); + if(!prs_uint32(t, ps, depth, &r_r->hdr_ref_dom[i].ptr_dom_sid)) + return False; } - for (i = 0, n = 0, s = 0; i < r_r->num_ref_doms_2; i++) - { + for (i = 0, n = 0, s = 0; i < r_r->num_ref_doms_2; i++) { fstring t; - if (r_r->hdr_ref_dom[i].hdr_dom_name.buffer != 0) - { + if (r_r->hdr_ref_dom[i].hdr_dom_name.buffer != 0) { slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i); - smb_io_unistr2(t, &(r_r->ref_dom[n].uni_dom_name), True, ps, depth); /* domain name unicode string */ - prs_align(ps); + if(!smb_io_unistr2(t, &r_r->ref_dom[n].uni_dom_name, True, ps, depth)) /* domain name unicode string */ + return False; n++; } - if (r_r->hdr_ref_dom[i].ptr_dom_sid != 0) - { + if (r_r->hdr_ref_dom[i].ptr_dom_sid != 0) { slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i); - smb_io_dom_sid2("", &(r_r->ref_dom[s].ref_dom), ps, depth); /* referenced domain SIDs */ + if(!smb_io_dom_sid2("", &r_r->ref_dom[s].ref_dom, ps, depth)) /* referenced domain SIDs */ + return False; s++; } } @@ -121,55 +137,58 @@ static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int de return True; } - /******************************************************************* -makes an LSA_SEC_QOS structure. + Inits an LSA_SEC_QOS structure. ********************************************************************/ -BOOL make_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff, + +void init_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff, uint32 unknown) { - if (qos == NULL) return False; - - DEBUG(5,("make_lsa_sec_qos\n")); + 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; qos->unknown = unknown; - - return True; } /******************************************************************* -reads or writes an LSA_SEC_QOS structure. + Reads or writes an LSA_SEC_QOS structure. ********************************************************************/ + static BOOL lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int depth) { - int start; + uint32 start; - if (qos == NULL) return False; + if (qos == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_obj_qos"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - start = ps->offset; + start = prs_offset(ps); /* these pointers had _better_ be zero, because we don't know what they point to! */ - prs_uint32("len ", ps, depth, &(qos->len )); /* 0x18 - length (in bytes) inc. the length field. */ - prs_uint16("sec_imp_level ", ps, depth, &(qos->sec_imp_level )); - prs_uint8 ("sec_ctxt_mode ", ps, depth, &(qos->sec_ctxt_mode )); - prs_uint8 ("effective_only", ps, depth, &(qos->effective_only)); - prs_uint32("unknown ", ps, depth, &(qos->unknown )); - - if (qos->len != ps->offset - start) - { + 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(!prs_uint32("unknown ", ps, depth, &qos->unknown)) + 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, ps->offset - start)); + qos->len, prs_offset(ps) - start)); } return True; @@ -177,12 +196,11 @@ static BOOL lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int de /******************************************************************* -makes an LSA_OBJ_ATTR structure. + Inits an LSA_OBJ_ATTR structure. ********************************************************************/ -BOOL make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos) -{ - if (attr == NULL) return False; +void init_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos) +{ DEBUG(5,("make_lsa_obj_attr\n")); attr->len = 0x18; /* length of object attribute block, in bytes */ @@ -191,55 +209,58 @@ BOOL make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos) attr->attributes = attributes; attr->ptr_sec_desc = 0; - if (qos != NULL) - { + if (qos != NULL) { attr->ptr_sec_qos = 1; attr->sec_qos = qos; - } - else - { + } else { attr->ptr_sec_qos = 0; attr->sec_qos = NULL; } - - return True; } /******************************************************************* -reads or writes an LSA_OBJ_ATTR structure. + Reads or writes an LSA_OBJ_ATTR structure. ********************************************************************/ -static BOOL lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int depth) + +static BOOL lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int depth) { - int start; + uint32 start; - if (attr == NULL) return False; + if (attr == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_obj_attr"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - start = ps->offset; + start = prs_offset(ps); /* these pointers had _better_ be zero, because we don't know what they point to! */ - prs_uint32("len ", ps, depth, &(attr->len )); /* 0x18 - length (in bytes) inc. the length field. */ - prs_uint32("ptr_root_dir", ps, depth, &(attr->ptr_root_dir)); /* 0 - root directory (pointer) */ - prs_uint32("ptr_obj_name", ps, depth, &(attr->ptr_obj_name)); /* 0 - object name (pointer) */ - prs_uint32("attributes ", ps, depth, &(attr->attributes )); /* 0 - attributes (undocumented) */ - prs_uint32("ptr_sec_desc", ps, depth, &(attr->ptr_sec_desc)); /* 0 - security descriptior (pointer) */ - prs_uint32("ptr_sec_qos ", ps, depth, &(attr->ptr_sec_qos )); /* security quality of service (pointer) */ - - if (attr->len != ps->offset - start) - { + 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->len != prs_offset(ps) - start) { DEBUG(3,("lsa_io_obj_attr: length %x does not match size %x\n", - attr->len, ps->offset - start)); + attr->len, prs_offset(ps) - start)); } - if (attr->ptr_sec_qos != 0 && attr->sec_qos != NULL) - { - lsa_io_sec_qos("sec_qos", attr->sec_qos, ps, depth); + if (attr->ptr_sec_qos != 0 && attr->sec_qos != NULL) { + if(!lsa_io_sec_qos("sec_qos", attr->sec_qos, ps, depth)) + return False; } return True; @@ -247,688 +268,515 @@ static BOOL lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int /******************************************************************* -makes an LSA_Q_OPEN_POL structure. + Inits an LSA_Q_OPEN_POL structure. ********************************************************************/ -BOOL make_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name, + +void init_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name, uint32 attributes, uint32 desired_access, LSA_SEC_QOS *qos) { - if (r_q == NULL) return False; - DEBUG(5,("make_open_pol: attr:%d da:%d\n", attributes, desired_access)); r_q->ptr = 1; /* undocumented pointer */ if (qos == NULL) - { r_q->des_access = desired_access; - } r_q->system_name = system_name; - make_lsa_obj_attr(&(r_q->attr ), attributes, qos); - - return True; + init_lsa_obj_attr(&r_q->attr, attributes, qos); } /******************************************************************* -reads or writes an LSA_Q_OPEN_POL structure. + Reads or writes an LSA_Q_OPEN_POL structure. ********************************************************************/ -BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int depth) + +BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_q_open_pol"); depth++; - prs_uint32("ptr ", ps, depth, &(r_q->ptr )); - prs_uint16("system_name", ps, depth, &(r_q->system_name )); - prs_align ( ps ); + if(!prs_uint32("ptr ", ps, depth, &r_q->ptr)) + return False; + if(!prs_uint16("system_name", ps, depth, &r_q->system_name)) + return False; + if(!prs_align( ps )) + return False; - lsa_io_obj_attr("", &(r_q->attr ), ps, depth); + if(!lsa_io_obj_attr("", &r_q->attr, ps, depth)) + return False; - if (r_q->attr.ptr_sec_qos == 0) - { - prs_uint32("des_access", ps, depth, &(r_q->des_access)); + if (r_q->attr.ptr_sec_qos == 0) { + if(!prs_uint32("des_access", ps, depth, &r_q->des_access)) + return False; } return True; } /******************************************************************* -reads or writes an LSA_R_OPEN_POL structure. + Reads or writes an LSA_R_OPEN_POL structure. ********************************************************************/ -BOOL lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int depth) + +BOOL lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int depth) { - if (r_p == NULL) return False; + if (r_p == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_r_open_pol"); depth++; - smb_io_pol_hnd("", &(r_p->pol), ps, depth); + if(!smb_io_pol_hnd("", &r_p->pol, ps, depth)) + return False; - prs_uint32("status", ps, depth, &(r_p->status)); + if(!prs_uint32("status", ps, depth, &r_p->status)) + return False; return True; } /******************************************************************* -makes an LSA_Q_OPEN_POL2 structure. + Inits an LSA_Q_OPEN_POL2 structure. ********************************************************************/ -BOOL make_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, const char *server_name, + +void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, uint32 attributes, uint32 desired_access, LSA_SEC_QOS *qos) { - if (r_q == NULL) return False; - DEBUG(5,("make_open_pol2: attr:%d da:%d\n", attributes, desired_access)); r_q->ptr = 1; /* undocumented pointer */ if (qos == NULL) - { r_q->des_access = desired_access; - } - make_unistr2 (&(r_q->uni_server_name), server_name, strlen(server_name)); - make_lsa_obj_attr(&(r_q->attr ), attributes, qos); - - return True; + init_unistr2(&r_q->uni_server_name, server_name, strlen(server_name)); + init_lsa_obj_attr(&r_q->attr, attributes, qos); } /******************************************************************* -reads or writes an LSA_Q_OPEN_POL2 structure. + Reads or writes an LSA_Q_OPEN_POL2 structure. ********************************************************************/ -BOOL lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, int depth) + +BOOL lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_q_open_pol2"); depth++; - prs_uint32("ptr ", ps, depth, &(r_q->ptr )); + if(!prs_uint32("ptr ", ps, depth, &r_q->ptr)) + return False; - smb_io_unistr2 ("", &(r_q->uni_server_name), r_q->ptr, ps, depth); - lsa_io_obj_attr("", &(r_q->attr ), ps, depth); + if(!smb_io_unistr2 ("", &r_q->uni_server_name, r_q->ptr, ps, depth)) + return False; + if(!lsa_io_obj_attr("", &r_q->attr, ps, depth)) + return False; - if (r_q->attr.ptr_sec_qos == 0) - { - prs_uint32("des_access", ps, depth, &(r_q->des_access)); + if (r_q->attr.ptr_sec_qos == 0) { + if(!prs_uint32("des_access", ps, depth, &r_q->des_access)) + return False; } return True; } /******************************************************************* -reads or writes an LSA_R_OPEN_POL2 structure. + Reads or writes an LSA_R_OPEN_POL2 structure. ********************************************************************/ -BOOL lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int depth) + +BOOL lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int depth) { - if (r_p == NULL) return False; + if (r_p == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_r_open_pol2"); depth++; - smb_io_pol_hnd("", &(r_p->pol), ps, depth); + if(!smb_io_pol_hnd("", &r_p->pol, ps, depth)) + return False; - prs_uint32("status", ps, depth, &(r_p->status)); - - return True; + if(!prs_uint32("status", ps, depth, &r_p->status)) + return False; return True; } /******************************************************************* -makes an LSA_Q_QUERY_INFO structure. + Inits an LSA_Q_QUERY_INFO structure. ********************************************************************/ -BOOL make_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class) -{ - if (q_q == NULL || hnd == NULL) return False; +void init_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class) +{ DEBUG(5,("make_q_query\n")); - memcpy(&(q_q->pol), hnd, sizeof(q_q->pol)); + memcpy(&q_q->pol, hnd, sizeof(q_q->pol)); q_q->info_class = info_class; - - return True; } /******************************************************************* -reads or writes an LSA_Q_QUERY_INFO structure. + Reads or writes an LSA_Q_QUERY_INFO structure. ********************************************************************/ -BOOL lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int depth) -{ - if (q_q == NULL) return False; - - prs_debug(ps, depth, desc, "lsa_io_q_query"); - depth++; - - smb_io_pol_hnd("", &(q_q->pol), ps, depth); - - prs_uint16("info_class", ps, depth, &(q_q->info_class)); - - return True; -} - -/******************************************************************* -makes an LSA_Q_OPEN_SECRET structure. -********************************************************************/ -BOOL make_q_open_secret(LSA_Q_OPEN_SECRET *q_o, const POLICY_HND *pol_hnd, - const char *secret_name, uint32 desired_access) -{ - int len = strlen(secret_name); - - if (q_o == NULL) return False; - - DEBUG(5,("make_q_open_secret")); - - memcpy(&(q_o->pol), pol_hnd, sizeof(q_o->pol)); - - make_uni_hdr(&(q_o->hdr_secret), len); - make_unistr2(&(q_o->uni_secret), secret_name, len); - - q_o->des_access = desired_access; - - return True; -} - -/******************************************************************* -reads or writes an LSA_Q_OPEN_SECRET structure. -********************************************************************/ -BOOL lsa_io_q_open_secret(char *desc, LSA_Q_OPEN_SECRET *q_o, prs_struct *ps, int depth) -{ - if (q_o == NULL) return False; - - prs_debug(ps, depth, desc, "lsa_io_q_open_secret"); - depth++; - - smb_io_pol_hnd("", &(q_o->pol), ps, depth); - - prs_align(ps); - smb_io_unihdr ("", &(q_o->hdr_secret), ps, depth); - smb_io_unistr2("", &(q_o->uni_secret), 1, ps, depth); - - prs_align(ps); - prs_uint32("des_access", ps, depth, &(q_o->des_access)); - - return True; -} - -/******************************************************************* -reads or writes an LSA_R_OPEN_SECRET structure. -********************************************************************/ -BOOL lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_o, prs_struct *ps, int depth) -{ - if (r_o == NULL) return False; - - prs_debug(ps, depth, desc, "lsa_io_r_open_secret"); - depth++; - - smb_io_pol_hnd("", &(r_o->pol), ps, depth); - - prs_uint32("status", ps, depth, &(r_o->status)); - - return True; -} - -/******************************************************************* -reads or writes an LSA_SECRET_VALUE structure. -********************************************************************/ -BOOL lsa_io_secret_value(char *desc, LSA_SECRET_VALUE *value, prs_struct *ps, int depth) -{ - if (value == NULL) return False; - - prs_debug(ps, depth, desc, "lsa_io_secret_value"); - depth++; - - prs_align(ps); - prs_uint32("ptr_secret", ps, depth, &(value->ptr_secret)); - - if (value->ptr_secret != 0) - { - smb_io_strhdr2("hdr_secret", &(value->hdr_secret), ps, depth); - smb_io_string2("secret" , &(value->enc_secret), - value->hdr_secret.buffer, ps, depth); - } - - return True; -} - -/******************************************************************* -reads or writes an LSA_SECRET_INFO structure. -********************************************************************/ -BOOL lsa_io_secret_info(char *desc, LSA_SECRET_INFO *info, prs_struct *ps, int depth) -{ - if (info == NULL) return False; - - prs_debug(ps, depth, desc, "lsa_io_secret_info"); - depth++; - - prs_align(ps); - prs_uint32("ptr_value ", ps, depth, &(info->ptr_value )); - - if (info->ptr_value != 0) - { - lsa_io_secret_value("", &(info->value), ps, depth); - } - - prs_align(ps); - prs_uint32("ptr_update", ps, depth, &(info->ptr_update)); - - if (info->ptr_update != 0) - { - ps->align = 8; - prs_align(ps); - ps->align = 4; - - smb_io_time("last_update", &(info->last_update), ps, depth); - } - - return True; -} - -/******************************************************************* -makes an LSA_Q_QUERY_SECRET structure. -********************************************************************/ -BOOL make_q_query_secret(LSA_Q_QUERY_SECRET *q_q, POLICY_HND *pol) -{ - if (q_q == NULL) return False; - - DEBUG(5,("make_q_query_secret\n")); - - memcpy(&(q_q->pol), pol, sizeof(q_q->pol)); - - /* Want secret */ - q_q->info.ptr_value = 1; - q_q->info.value.ptr_secret = 0; - - /* Want last change time */ - q_q->info.ptr_update = 1; - - /* Don't care about old info */ - q_q->oldinfo.ptr_value = 0; - q_q->oldinfo.ptr_update = 0; - - return True; -} - -/******************************************************************* -reads or writes an LSA_Q_QUERY_SECRET structure. -********************************************************************/ -BOOL lsa_io_q_query_secret(char *desc, LSA_Q_QUERY_SECRET *q_q, prs_struct *ps, int depth) -{ - if (q_q == NULL) return False; - prs_debug(ps, depth, desc, "lsa_io_q_query_secret"); - depth++; - - smb_io_pol_hnd("", &(q_q->pol), ps, depth); - - lsa_io_secret_info("", &(q_q->info ), ps, depth); - lsa_io_secret_info("", &(q_q->oldinfo), ps, depth); - - return True; -} - -/******************************************************************* -reads or writes an LSA_Q_QUERY_SECRET structure. -********************************************************************/ -BOOL lsa_io_r_query_secret(char *desc, LSA_R_QUERY_SECRET *r_q, prs_struct *ps, int depth) +BOOL lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (q_q == NULL) + return False; - prs_debug(ps, depth, desc, "lsa_io_r_query_secret"); + prs_debug(ps, depth, desc, "lsa_io_q_query"); depth++; - lsa_io_secret_info("", &(r_q->info ), ps, depth); - lsa_io_secret_info("", &(r_q->oldinfo), ps, depth); + if(!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + return False; - prs_align(ps); - prs_uint32("status", ps, depth, &(r_q->status)); + if(!prs_uint16("info_class", ps, depth, &q_q->info_class)) + return False; return True; } /******************************************************************* -makes an LSA_Q_ENUM_TRUST_DOM structure. + Reads or writes an LSA_Q_ENUM_TRUST_DOM structure. ********************************************************************/ -BOOL make_q_enum_trust_dom(LSA_Q_ENUM_TRUST_DOM *q_e, - POLICY_HND *pol, - uint32 enum_context, uint32 preferred_len) -{ - if (q_e == NULL) return False; - - DEBUG(5,("make_q_enum_trust_dom\n")); - - memcpy(&(q_e->pol), pol, sizeof(q_e->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(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct *ps, int depth) +BOOL lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct *ps, int depth) { - if (q_e == NULL) return False; + if (q_e == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_q_enum_trust_dom"); depth++; - smb_io_pol_hnd("", &(q_e->pol), ps, depth); + if(!smb_io_pol_hnd("", &q_e->pol, ps, depth)) + return False; - prs_uint32("enum_context ", ps, depth, &(q_e->enum_context )); - prs_uint32("preferred_len", ps, depth, &(q_e->preferred_len)); + 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; } /******************************************************************* -makes an LSA_R_ENUM_TRUST_DOM structure. + Inits an LSA_R_ENUM_TRUST_DOM structure. ********************************************************************/ -BOOL make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, - int32 enum_context, - char *domain_name, DOM_SID *domain_sid, - uint32 status) -{ - if (r_e == NULL) return False; +void init_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, + uint32 enum_context, char *domain_name, DOM_SID *domain_sid, + uint32 status) +{ DEBUG(5,("make_r_enum_trust_dom\n")); r_e->enum_context = enum_context; - if (status == 0) - { + if (status == 0) { int len_domain_name = strlen(domain_name); r_e->num_domains = 1; r_e->ptr_enum_domains = 1; r_e->num_domains2 = 1; - make_uni_hdr2(&(r_e->hdr_domain_name[0]), len_domain_name); - make_unistr2 (&(r_e->uni_domain_name[0]), domain_name, len_domain_name); - make_dom_sid2(&(r_e->domain_sid[0]), domain_sid); - } - else - { + init_uni_hdr2(&r_e->hdr_domain_name, len_domain_name); + init_unistr2 (&r_e->uni_domain_name, domain_name, len_domain_name); + init_dom_sid2(&r_e->other_domain_sid, domain_sid); + } else { r_e->num_domains = 0; r_e->ptr_enum_domains = 0; } r_e->status = status; - - return True; } /******************************************************************* -reads or writes an LSA_R_ENUM_TRUST_DOM structure. + Reads or writes an LSA_R_ENUM_TRUST_DOM structure. ********************************************************************/ -BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth) + +BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth) { - if (r_e == NULL) return False; + if (r_e == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_r_enum_trust_dom"); depth++; - prs_uint32("enum_context ", ps, depth, &(r_e->enum_context )); - prs_uint32("num_domains ", ps, depth, &(r_e->num_domains )); - prs_uint32("ptr_enum_domains", ps, depth, &(r_e->ptr_enum_domains)); - - if (r_e->ptr_enum_domains != 0) - { - uint32 i; - prs_uint32("num_domains2", ps, depth, &(r_e->num_domains2)); - - for (i = 0; i < r_e->num_domains2; i++) - { + if(!prs_uint32("enum_context ", ps, depth, &r_e->enum_context)) + return False; + if(!prs_uint32("num_domains ", ps, depth, &r_e->num_domains)) + return False; + if(!prs_uint32("ptr_enum_domains", ps, depth, &r_e->ptr_enum_domains)) + return False; - smb_io_unihdr2 ("", &(r_e->hdr_domain_name[i]), ps, depth); - } - - for (i = 0; i < r_e->num_domains2; i++) - { - smb_io_unistr2 ("", &(r_e->uni_domain_name[i] ), r_e->hdr_domain_name[i].buffer, ps, depth); - prs_align(ps); - smb_io_dom_sid2("", &(r_e->domain_sid[i]), ps, depth); - } + if (r_e->ptr_enum_domains != 0) { + if(!prs_uint32("num_domains2", ps, depth, &r_e->num_domains2)) + return False; + if(!smb_io_unihdr2 ("", &r_e->hdr_domain_name, ps, depth)) + return False; + if(!smb_io_unistr2 ("", &r_e->uni_domain_name, r_e->hdr_domain_name.buffer, ps, depth)) + return False; + if(!smb_io_dom_sid2("", &r_e->other_domain_sid, ps, depth)) + return False; } - prs_uint32("status", ps, depth, &(r_e->status)); + if(!prs_uint32("status", ps, depth, &r_e->status)) + return False; return True; } /******************************************************************* -reads or writes an LSA_Q_QUERY_INFO structure. + Reads or writes an LSA_Q_QUERY_INFO structure. ********************************************************************/ -BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth) + +BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_r_query"); depth++; - prs_uint32("undoc_buffer", ps, depth, &(r_q->undoc_buffer)); + if(!prs_uint32("undoc_buffer", ps, depth, &r_q->undoc_buffer)) + return False; - if (r_q->undoc_buffer != 0) - { - prs_uint16("info_class", ps, depth, &(r_q->info_class)); + if (r_q->undoc_buffer != 0) { + if(!prs_uint16("info_class", ps, depth, &r_q->info_class)) + return False; - switch (r_q->info_class) - { - case 3: - { - smb_io_dom_query_3("", &(r_q->dom.id3), ps, depth); - break; - } - case 5: - { - smb_io_dom_query_5("", &(r_q->dom.id3), ps, depth); - break; - } - default: - { - /* PANIC! */ - break; - } + switch (r_q->info_class) { + case 3: + if(!smb_io_dom_query_3("", &r_q->dom.id3, ps, depth)) + return False; + break; + case 5: + if(!smb_io_dom_query_5("", &r_q->dom.id3, ps, depth)) + return False; + break; + default: + /* PANIC! */ + break; } } - prs_uint32("status", ps, depth, &(r_q->status)); + if(!prs_uint32("status", ps, depth, &r_q->status)) + return False; return True; } /******************************************************************* -makes a LSA_SID_ENUM structure. + Inits a LSA_SID_ENUM structure. ********************************************************************/ -BOOL make_lsa_sid_enum(LSA_SID_ENUM *sen, uint32 num_entries, DOM_SID **sids) + +void init_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID **sids) { - uint32 i, i2; - if (sen == NULL || sids == NULL) return False; + int i, i2; DEBUG(5,("make_lsa_sid_enum\n")); sen->num_entries = num_entries; - sen->ptr_sid_enum = num_entries != 0 ? 1 : 0; + sen->ptr_sid_enum = (num_entries != 0) ? 1 : 0; sen->num_entries2 = num_entries; SMB_ASSERT_ARRAY(sen->sid, sen->num_entries); - for (i = 0, i2 = 0; i < num_entries; i++) - { - if (sids[i] != NULL) - { + for (i = 0, i2 = 0; i < num_entries; i++) { + if (sids[i] != NULL) { sen->ptr_sid[i] = 1; - make_dom_sid2(&(sen->sid[i2]), sids[i]); + init_dom_sid2(&sen->sid[i2], sids[i]); i2++; - } - else - { + } else { sen->ptr_sid[i] = 0; } } - - return True; } /******************************************************************* -reads or writes a LSA_SID_ENUM structure. + Reads or writes a LSA_SID_ENUM structure. ********************************************************************/ + static BOOL lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) { - uint32 i; + int i; - if (sen == NULL) return False; + if (sen == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_sid_enum"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("num_entries ", ps, depth, &(sen->num_entries)); - prs_uint32("ptr_sid_enum", ps, depth, &(sen->ptr_sid_enum)); - prs_uint32("num_entries2", ps, depth, &(sen->num_entries2)); + 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(!prs_uint32("num_entries2", ps, depth, &sen->num_entries2)) + return False; SMB_ASSERT_ARRAY(sen->ptr_sid, sen->num_entries); - for (i = 0; i < sen->num_entries; i++) - { + for (i = 0; i < sen->num_entries; i++) { fstring temp; slprintf(temp, sizeof(temp) - 1, "ptr_sid[%d]", i); - prs_uint32(temp, ps, depth, &(sen->ptr_sid[i])); /* domain SID pointers to be looked up. */ + if(!prs_uint32(temp, ps, depth, &sen->ptr_sid[i])) /* domain SID pointers to be looked up. */ + return False; } SMB_ASSERT_ARRAY(sen->sid, sen->num_entries); - for (i = 0; i < sen->num_entries; i++) - { + for (i = 0; i < sen->num_entries; i++) { fstring temp; slprintf(temp, sizeof(temp) - 1, "sid[%d]", i); - smb_io_dom_sid2(temp, &(sen->sid[i]), ps, depth); /* domain SIDs to be looked up. */ + if(!smb_io_dom_sid2(temp, &sen->sid[i], ps, depth)) /* domain SIDs to be looked up. */ + return False; } return True; } /******************************************************************* -reads or writes a structure. + Inits an LSA_R_ENUM_TRUST_DOM structure. ********************************************************************/ -static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, - prs_struct *ps, int depth) + +void init_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd, + int num_sids, DOM_SID **sids, + uint16 level) { - uint32 i; + DEBUG(5,("make_r_enum_trust_dom\n")); - if (trn == NULL) return False; + memcpy(&q_l->pol, hnd, sizeof(q_l->pol)); + init_lsa_sid_enum(&q_l->sids, num_sids, sids); - prs_debug(ps, depth, desc, "lsa_io_trans_names"); - depth++; + q_l->names.num_entries = 0; + q_l->names.ptr_trans_names = 0; + q_l->names.num_entries2 = 0; - prs_align(ps); - - prs_uint32("num_entries ", ps, depth, &(trn->num_entries)); - prs_uint32("ptr_trans_names", ps, depth, &(trn->ptr_trans_names)); + q_l->level.value = level; +} - if (trn->ptr_trans_names != 0) - { - prs_uint32("num_entries2 ", ps, depth, &(trn->num_entries2)); - SMB_ASSERT_ARRAY(trn->name, trn->num_entries); +/******************************************************************* + Reads or writes a LSA_Q_LOOKUP_SIDS structure. +********************************************************************/ - for (i = 0; i < trn->num_entries2; i++) - { - fstring t; - slprintf(t, sizeof(t) - 1, "name[%d] ", i); +BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, int depth) +{ + if (q_s == NULL) + return False; - lsa_io_trans_name(t, &(trn->name[i]), ps, depth); /* translated name */ + prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids"); + depth++; - } - for (i = 0; i < trn->num_entries2; i++) - { - fstring t; - slprintf(t, sizeof(t) - 1, "name[%d] ", i); + 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(!smb_io_lookup_level("switch ", &q_s->level, ps, depth)) /* lookup level */ + return False; - smb_io_unistr2(t, &(trn->uni_name[i]), trn->name[i].hdr_name.buffer, ps, depth); - prs_align(ps); - } - } + if(!prs_uint32("mapped_count", ps, depth, &q_s->mapped_count)) + return False; return True; } /******************************************************************* -makes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL make_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd, - int num_sids, DOM_SID **sids, - uint16 level) + +static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, + prs_struct *ps, int depth) { - if (q_l == NULL) return False; + int i; - DEBUG(5,("make_q_lookup_sids\n")); + if (trn == NULL) + return False; - memcpy(&(q_l->pol), hnd, sizeof(q_l->pol)); - make_lsa_sid_enum(&(q_l->sids), num_sids, sids); + prs_debug(ps, depth, desc, "lsa_io_trans_names"); + depth++; - q_l->names.ptr_trans_names = 0; - q_l->names.num_entries = 0; + 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; - q_l->level.value = level; - - return True; -} + if (trn->ptr_trans_names != 0) { + if(!prs_uint32("num_entries2 ", ps, depth, &trn->num_entries2)) + return False; + SMB_ASSERT_ARRAY(trn->name, trn->num_entries); -/******************************************************************* -reads or writes a LSA_Q_LOOKUP_SIDS structure. -********************************************************************/ -BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, int depth) -{ - if (q_s == NULL) return False; + for (i = 0; i < trn->num_entries2; i++) { + fstring t; + slprintf(t, sizeof(t) - 1, "name[%d] ", i); - prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids"); - depth++; + if(!lsa_io_trans_name(t, &trn->name[i], ps, depth)) /* translated name */ + return False; + } - prs_align(ps); - - smb_io_pol_hnd ("pol_hnd", &(q_s->pol), ps, depth); /* policy handle */ - lsa_io_sid_enum ("sids ", &(q_s->sids ), ps, depth); /* sids to be looked up */ - lsa_io_trans_names ("names ", &(q_s->names ), ps, depth); /* translated names */ - smb_io_lookup_level("switch ", &(q_s->level ), ps, depth); /* lookup level */ + for (i = 0; i < trn->num_entries2; i++) { + fstring t; + slprintf(t, sizeof(t) - 1, "name[%d] ", i); - prs_uint32("mapped_count", ps, depth, &(q_s->mapped_count)); + 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. + Reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, int depth) + +BOOL lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, int depth) { - if (r_s == NULL) return False; + if (r_s == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_r_lookup_sids"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr_dom_ref", ps, depth, &(r_s->ptr_dom_ref)); + if(!prs_uint32("ptr_dom_ref", ps, depth, &r_s->ptr_dom_ref)) + return False; + if (r_s->ptr_dom_ref != 0) - { - lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth); /* domain reference info */ - } - lsa_io_trans_names("names ", r_s->names , ps, depth); /* translated names */ + 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; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("mapped_count", ps, depth, &(r_s->mapped_count)); + if(!prs_uint32("mapped_count", ps, depth, &r_s->mapped_count)) + return False; - prs_uint32("status ", ps, depth, &(r_s->status)); + if(!prs_uint32("status ", ps, depth, &r_s->status)) + return False; return True; } @@ -936,73 +784,81 @@ BOOL lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, i /******************************************************************* makes a structure. ********************************************************************/ -BOOL make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, - uint32 num_names, char **names) + +void init_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, + int num_names, char **names) { - uint32 i; - if (q_l == NULL) return False; + int i; - DEBUG(5,("make_q_lookup_names\n")); + DEBUG(5,("init_q_lookup_names\n")); - memcpy(&(q_l->pol), hnd, sizeof(q_l->pol)); + memcpy(&q_l->pol, hnd, sizeof(q_l->pol)); - q_l->num_entries = num_names; - q_l->num_entries2 = num_names; + q_l->num_entries = num_names; + q_l->num_entries2 = num_names; SMB_ASSERT_ARRAY(q_l->uni_name, q_l->num_entries); - for (i = 0; i < num_names; i++) - { - const char* name = names[i]; + for (i = 0; i < num_names; i++) { + char* name = names[i]; int len = strlen(name); - make_uni_hdr(&q_l->hdr_name[i], len); - make_unistr2(&q_l->uni_name[i], name, len); + init_uni_hdr(&q_l->hdr_name[i], len); + init_unistr2(&q_l->uni_name[i], name, len); } q_l->num_trans_entries = 0; q_l->ptr_trans_sids = 0; q_l->lookup_level = 1; q_l->mapped_count = 0; - - return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth) + +BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth) { - uint32 i; + int i; - if (q_r == NULL) return False; + if (q_r == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_q_lookup_names"); depth++; - prs_align(ps); - - smb_io_pol_hnd("", &(q_r->pol), ps, depth); /* policy handle */ + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("", &q_r->pol, ps, depth)) /* policy handle */ + return False; - prs_uint32("num_entries ", ps, depth, &(q_r->num_entries)); - prs_uint32("num_entries2 ", ps, depth, &(q_r->num_entries2)); + 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; SMB_ASSERT_ARRAY(q_r->uni_name, q_r->num_entries); - for (i = 0; i < q_r->num_entries; i++) - { - smb_io_unihdr("hdr_name", &(q_r->hdr_name[i]), ps, depth); /* pointer names */ + for (i = 0; i < q_r->num_entries; i++) { + 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++) - { - smb_io_unistr2("dom_name", &(q_r->uni_name[i]), q_r->hdr_name[i].buffer, ps, depth); /* names to be looked up */ - prs_align(ps); + for (i = 0; i < q_r->num_entries; i++) { + 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; } - prs_uint32("num_trans_entries ", ps, depth, &(q_r->num_trans_entries)); - prs_uint32("ptr_trans_sids ", ps, depth, &(q_r->ptr_trans_sids)); - prs_uint32("lookup_level ", ps, depth, &(q_r->lookup_level )); - prs_uint32("mapped_count ", ps, depth, &(q_r->mapped_count )); + 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_uint32("lookup_level ", ps, depth, &q_r->lookup_level)) + return False; + if(!prs_uint32("mapped_count ", ps, depth, &q_r->mapped_count)) + return False; return True; } @@ -1010,93 +866,102 @@ BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth) + +BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth) { - uint32 i; + int i; - if (r_r == NULL) return False; + if (r_r == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_r_lookup_names"); depth++; - prs_align(ps); - - prs_uint32("ptr_dom_ref", ps, depth, &(r_r->ptr_dom_ref)); + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_dom_ref", ps, depth, &r_r->ptr_dom_ref)) + return False; + if (r_r->ptr_dom_ref != 0) - { - lsa_io_dom_r_ref("", r_r->dom_ref, ps, depth); - } + if(!lsa_io_dom_r_ref("", r_r->dom_ref, ps, depth)) + return False; - prs_uint32("num_entries", ps, depth, &(r_r->num_entries)); - prs_uint32("ptr_entries", ps, depth, &(r_r->ptr_entries)); + if(!prs_uint32("num_entries", ps, depth, &r_r->num_entries)) + return False; + if(!prs_uint32("ptr_entries", ps, depth, &r_r->ptr_entries)) + return False; - if (r_r->ptr_entries != 0) - { - prs_uint32("num_entries2", ps, depth, &(r_r->num_entries2)); + if (r_r->ptr_entries != 0) { + if(!prs_uint32("num_entries2", ps, depth, &r_r->num_entries2)) + return False; - if (r_r->num_entries2 != r_r->num_entries) - { + if (r_r->num_entries2 != r_r->num_entries) { /* RPC fault */ return False; } for (i = 0; i < r_r->num_entries2; i++) - { - smb_io_dom_rid2("", &(r_r->dom_rid[i]), ps, depth); /* domain RIDs being looked up */ - } + if(!smb_io_dom_rid2("", &r_r->dom_rid[i], ps, depth)) /* domain RIDs being looked up */ + return False; } - prs_uint32("mapped_count", ps, depth, &(r_r->mapped_count)); + if(!prs_uint32("mapped_count", ps, depth, &r_r->mapped_count)) + return False; - prs_uint32("status ", ps, depth, &(r_r->status)); + if(!prs_uint32("status ", ps, depth, &r_r->status)) + return False; return True; } /******************************************************************* -makes an LSA_Q_CLOSE structure. + Inits an LSA_Q_CLOSE structure. ********************************************************************/ -BOOL make_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd) -{ - if (q_c == NULL || hnd == NULL) return False; +void init_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd) +{ DEBUG(5,("make_lsa_q_close\n")); - memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); - - return True; + memcpy(&q_c->pol, hnd, sizeof(q_c->pol)); } /******************************************************************* -reads or writes an LSA_Q_CLOSE structure. + Reads or writes an LSA_Q_CLOSE structure. ********************************************************************/ -BOOL lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth) + +BOOL lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth) { - if (q_c == NULL) return False; + if (q_c == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_q_close"); depth++; - smb_io_pol_hnd("", &(q_c->pol), ps, depth); + if(!smb_io_pol_hnd("", &q_c->pol, ps, depth)) + return False; return True; } /******************************************************************* -reads or writes an LSA_R_CLOSE structure. + Reads or writes an LSA_R_CLOSE structure. ********************************************************************/ + BOOL lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth) { - if (r_c == NULL) return False; + if (r_c == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_r_close"); depth++; - smb_io_pol_hnd("", &(r_c->pol), ps, depth); + if(!smb_io_pol_hnd("", &r_c->pol, ps, depth)) + return False; - prs_uint32("status", ps, depth, &(r_c->status)); + if(!prs_uint32("status", ps, depth, &r_c->status)) + return False; return True; } - diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index b38f55983d..5277825767 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1,4 +1,3 @@ - /* * Unix SMB/Netbios implementation. * Version 1.9. @@ -27,453 +26,487 @@ extern int DEBUGLEVEL; - /******************************************************************* -reads or writes a BIGINT structure. + Reads or writes a UTIME type. ********************************************************************/ -BOOL smb_io_bigint(char *desc, BIGINT *bigint, prs_struct *ps, int depth) -{ - if (bigint == NULL) return False; - prs_debug(ps, depth, desc, "smb_io_bigint"); - depth++; - - prs_align(ps); - - prs_uint32("low ", ps, depth, &(bigint->low )); - prs_uint32("high", ps, depth, &(bigint->high)); - - return True; -} - -/******************************************************************* -reads or writes a UTIME type. -********************************************************************/ -static BOOL smb_io_utime(char *desc, UTIME *t, prs_struct *ps, int depth) +static BOOL smb_io_utime(char *desc, UTIME *t, prs_struct *ps, int depth) { - if (t == NULL) return False; + if (t == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_utime"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32 ("time", ps, depth, &(t->time)); + if(!prs_uint32 ("time", ps, depth, &t->time)) + return False; return True; } /******************************************************************* -reads or writes an NTTIME structure. + Reads or writes an NTTIME structure. ********************************************************************/ -BOOL smb_io_time(char *desc, NTTIME *nttime, prs_struct *ps, int depth) + +BOOL smb_io_time(char *desc, NTTIME *nttime, prs_struct *ps, int depth) { - if (nttime == NULL) return False; + if (nttime == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_time"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("low ", ps, depth, &(nttime->low )); /* low part */ - prs_uint32("high", ps, depth, &(nttime->high)); /* high part */ + if(!prs_uint32("low ", ps, depth, &nttime->low)) /* low part */ + return False; + if(!prs_uint32("high", ps, depth, &nttime->high)) /* high part */ + return False; return True; } /******************************************************************* -reads or writes a LOOKUP_LEVEL structure. + Reads or writes a LOOKUP_LEVEL structure. ********************************************************************/ + BOOL smb_io_lookup_level(char *desc, LOOKUP_LEVEL *level, prs_struct *ps, int depth) { - if (level == NULL) return False; + if (level == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_lookup_level"); depth++; - prs_align(ps); - prs_uint16("value", ps, depth, &(level->value)); - prs_align(ps); + if(!prs_align(ps)) + return False; + if(!prs_uint16("value", ps, depth, &level->value)) + return False; + if(!prs_align(ps)) + return False; return True; } /******************************************************************* -gets an enumeration handle from an ENUM_HND structure. + Gets an enumeration handle from an ENUM_HND structure. ********************************************************************/ + uint32 get_enum_hnd(ENUM_HND *enh) { return (enh && enh->ptr_hnd != 0) ? enh->handle : 0; - - return True; } /******************************************************************* -makes an ENUM_HND structure. + Inits an ENUM_HND structure. ********************************************************************/ -BOOL make_enum_hnd(ENUM_HND *enh, uint32 hnd) -{ - if (enh == NULL) return False; +void init_enum_hnd(ENUM_HND *enh, uint32 hnd) +{ DEBUG(5,("smb_io_enum_hnd\n")); enh->ptr_hnd = (hnd != 0) ? 1 : 0; enh->handle = hnd; - - return True; } /******************************************************************* -reads or writes an ENUM_HND structure. + Reads or writes an ENUM_HND structure. ********************************************************************/ -BOOL smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) + +BOOL smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) { - if (hnd == NULL) return False; + if (hnd == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_enum_hnd"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr_hnd", ps, depth, &(hnd->ptr_hnd)); /* pointer */ - if (hnd->ptr_hnd != 0) - { - prs_uint32("handle ", ps, depth, &(hnd->handle )); /* enum handle */ + if(!prs_uint32("ptr_hnd", ps, depth, &hnd->ptr_hnd)) /* pointer */ + return False; + + if (hnd->ptr_hnd != 0) { + if(!prs_uint32("handle ", ps, depth, &hnd->handle )) /* enum handle */ + return False; } return True; } /******************************************************************* -reads or writes a DOM_SID structure. + Reads or writes a DOM_SID structure. ********************************************************************/ -BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) + +BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) { int i; - if (sid == NULL) return False; + if (sid == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_dom_sid"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint8 ("sid_rev_num", ps, depth, &(sid->sid_rev_num)); - prs_uint8 ("num_auths ", ps, depth, &(sid->num_auths)); + if(!prs_uint8 ("sid_rev_num", ps, depth, &sid->sid_rev_num)) + return False; + if(!prs_uint8 ("num_auths ", ps, depth, &sid->num_auths)) + return False; for (i = 0; i < 6; i++) { fstring tmp; slprintf(tmp, sizeof(tmp) - 1, "id_auth[%d] ", i); - prs_uint8 (tmp, ps, depth, &(sid->id_auth[i])); + if(!prs_uint8 (tmp, ps, depth, &sid->id_auth[i])) + return False; } /* oops! XXXX should really issue a warning here... */ - if (sid->num_auths > MAXSUBAUTHS) sid->num_auths = MAXSUBAUTHS; + if (sid->num_auths > MAXSUBAUTHS) + sid->num_auths = MAXSUBAUTHS; - prs_uint32s(False, "sub_auths ", ps, depth, sid->sub_auths, sid->num_auths); + if(!prs_uint32s(False, "sub_auths ", ps, depth, sid->sub_auths, sid->num_auths)) + return False; return True; } /******************************************************************* -creates a DOM_SID2 structure. + Inits a DOM_SID structure. + + BIG NOTE: this function only does SIDS where the identauth is not >= 2^32 + identauth >= 2^32 can be detected because it will be specified in hex ********************************************************************/ -BOOL make_dom_sid2(DOM_SID2 *sid2, const DOM_SID *sid) + +void init_dom_sid(DOM_SID *sid, char *str_sid) { - sid_copy(&sid2->sid, sid); - sid2->num_auths = sid2->sid.num_auths; + pstring domsid; + int identauth; + char *p; - return True; -} + if (str_sid == NULL) + { + DEBUG(4,("netlogon domain SID: none\n")); + sid->sid_rev_num = 0; + sid->num_auths = 0; + return; + } + + pstrcpy(domsid, str_sid); -/******************************************************************* -reads or writes a DOM_SID2 structure. -********************************************************************/ -BOOL smb_io_dom_sid2(char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) -{ - if (sid == NULL) return False; + DEBUG(4,("init_dom_sid %d SID: %s\n", __LINE__, domsid)); - prs_debug(ps, depth, desc, "smb_io_dom_sid2"); - depth++; + /* assume, but should check, that domsid starts "S-" */ + p = strtok(domsid+2,"-"); + sid->sid_rev_num = atoi(p); - prs_align(ps); - - prs_uint32("num_auths", ps, depth, &(sid->num_auths)); + /* identauth in decimal should be < 2^32 */ + /* identauth in hex should be >= 2^32 */ + identauth = atoi(strtok(0,"-")); - smb_io_dom_sid("sid", &(sid->sid), ps, depth); + DEBUG(4,("netlogon rev %d\n", sid->sid_rev_num)); + DEBUG(4,("netlogon %s ia %d\n", p, identauth)); - return True; + sid->id_auth[0] = 0; + sid->id_auth[1] = 0; + sid->id_auth[2] = (identauth & 0xff000000) >> 24; + sid->id_auth[3] = (identauth & 0x00ff0000) >> 16; + sid->id_auth[4] = (identauth & 0x0000ff00) >> 8; + sid->id_auth[5] = (identauth & 0x000000ff); + + sid->num_auths = 0; + + while ((p = strtok(0, "-")) != NULL && sid->num_auths < MAXSUBAUTHS) + sid->sub_auths[sid->num_auths++] = atoi(p); + + DEBUG(4,("init_dom_sid: %d SID: %s\n", __LINE__, domsid)); } /******************************************************************* -creates a STRHDR structure. + Inits a DOM_SID2 structure. ********************************************************************/ -BOOL make_str_hdr(STRHDR *hdr, int max_len, int len, uint32 buffer) -{ - hdr->str_max_len = max_len; - hdr->str_str_len = len; - hdr->buffer = buffer; - return True; +void init_dom_sid2(DOM_SID2 *sid2, DOM_SID *sid) +{ + sid2->sid = *sid; + sid2->num_auths = sid2->sid.num_auths; } /******************************************************************* -reads or writes a STRHDR structure. + Reads or writes a DOM_SID2 structure. ********************************************************************/ -BOOL smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth) + +BOOL smb_io_dom_sid2(char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) { - if (hdr == NULL) return False; + if (sid == NULL) + return False; - prs_debug(ps, depth, desc, "smb_io_strhdr"); + prs_debug(ps, depth, desc, "smb_io_dom_sid2"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint16("str_str_len", ps, depth, &(hdr->str_str_len)); - prs_uint16("str_max_len", ps, depth, &(hdr->str_max_len)); - prs_uint32("buffer ", ps, depth, &(hdr->buffer )); + if(!prs_uint32("num_auths", ps, depth, &sid->num_auths)) + return False; - /* oops! XXXX maybe issue a warning that this is happening... */ - if (hdr->str_max_len > MAX_STRINGLEN) hdr->str_max_len = MAX_STRINGLEN; - if (hdr->str_str_len > MAX_STRINGLEN) hdr->str_str_len = MAX_STRINGLEN; + if(!smb_io_dom_sid("sid", &sid->sid, ps, depth)) + return False; return True; } /******************************************************************* -creates a STRHDR2 structure. +creates a STRHDR structure. ********************************************************************/ -BOOL make_strhdr2(STRHDR2 *hdr, uint32 max_len, uint32 len, uint32 buffer) + +void init_str_hdr(STRHDR *hdr, int max_len, int len, uint32 buffer) { hdr->str_max_len = max_len; hdr->str_str_len = len; hdr->buffer = buffer; - - return True; } /******************************************************************* -reads or writes a STRHDR2 structure. + Reads or writes a STRHDR structure. ********************************************************************/ -BOOL smb_io_strhdr2(char *desc, STRHDR2 *hdr, prs_struct *ps, int depth) + +BOOL smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth) { - if (hdr == NULL) return False; + if (hdr == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_strhdr"); depth++; prs_align(ps); - prs_uint32("str_str_len", ps, depth, &(hdr->str_str_len)); - prs_uint32("str_max_len", ps, depth, &(hdr->str_max_len)); - prs_uint32("buffer ", ps, depth, &(hdr->buffer )); + if(!prs_uint16("str_str_len", ps, depth, &hdr->str_str_len)) + return False; + if(!prs_uint16("str_max_len", ps, depth, &hdr->str_max_len)) + return False; + if(!prs_uint32("buffer ", ps, depth, &hdr->buffer)) + return False; /* oops! XXXX maybe issue a warning that this is happening... */ - if (hdr->str_max_len > MAX_STRINGLEN) hdr->str_max_len = MAX_STRINGLEN; - if (hdr->str_str_len > MAX_STRINGLEN) hdr->str_str_len = MAX_STRINGLEN; + if (hdr->str_max_len > MAX_STRINGLEN) + hdr->str_max_len = MAX_STRINGLEN; + if (hdr->str_str_len > MAX_STRINGLEN) + hdr->str_str_len = MAX_STRINGLEN; return True; } /******************************************************************* -creates a UNIHDR structure. + Inits a UNIHDR structure. ********************************************************************/ -BOOL make_uni_hdr(UNIHDR *hdr, int len) + +void init_uni_hdr(UNIHDR *hdr, int len) { hdr->uni_str_len = 2 * len; hdr->uni_max_len = 2 * len; hdr->buffer = len != 0 ? 1 : 0; - - return True; } /******************************************************************* -reads or writes a UNIHDR structure. + Reads or writes a UNIHDR structure. ********************************************************************/ -BOOL smb_io_unihdr(char *desc, UNIHDR *hdr, prs_struct *ps, int depth) + +BOOL smb_io_unihdr(char *desc, UNIHDR *hdr, prs_struct *ps, int depth) { - if (hdr == NULL) return False; + if (hdr == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_unihdr"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint16("uni_str_len", ps, depth, &(hdr->uni_str_len)); - prs_uint16("uni_max_len", ps, depth, &(hdr->uni_max_len)); - prs_uint32("buffer ", ps, depth, &(hdr->buffer )); + if(!prs_uint16("uni_str_len", ps, depth, &hdr->uni_str_len)) + return False; + if(!prs_uint16("uni_max_len", ps, depth, &hdr->uni_max_len)) + return False; + if(!prs_uint32("buffer ", ps, depth, &hdr->buffer)) + return False; /* oops! XXXX maybe issue a warning that this is happening... */ - if (hdr->uni_max_len > MAX_UNISTRLEN) hdr->uni_max_len = MAX_UNISTRLEN; - if (hdr->uni_str_len > MAX_UNISTRLEN) hdr->uni_str_len = MAX_UNISTRLEN; + if (hdr->uni_max_len > MAX_UNISTRLEN) + hdr->uni_max_len = MAX_UNISTRLEN; + if (hdr->uni_str_len > MAX_UNISTRLEN) + hdr->uni_str_len = MAX_UNISTRLEN; return True; } /******************************************************************* -creates a BUFHDR structure. + Inits a BUFHDR structure. ********************************************************************/ -BOOL make_buf_hdr(BUFHDR *hdr, int max_len, int len) + +void init_buf_hdr(BUFHDR *hdr, int max_len, int len) { hdr->buf_max_len = max_len; hdr->buf_len = len; - - return True; } /******************************************************************* - prs_uint16 wrapper. call this and it sets up a pointer to where the - uint16 should be stored, or gets the size if reading + prs_uint16 wrapper. Call this and it sets up a pointer to where the + uint16 should be stored, or gets the size if reading. ********************************************************************/ -BOOL smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset) + +BOOL smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset) { - (*offset) = ps->offset; - if (ps->io) - { + (*offset) = prs_offset(ps); + if (ps->io) { + /* reading. */ - smb_io_hdrbuf(desc, hdr, ps, depth); - } - else - { - ps->offset += sizeof(uint32) * 2; + + if(!smb_io_hdrbuf(desc, hdr, ps, depth)) + return False; + + } else { + + /* writing. */ + + if(!prs_set_offset(ps, prs_offset(ps) + (sizeof(uint32) * 2))) + return False; } return True; } /******************************************************************* - smb_io_hdrbuf wrapper. call this and it retrospectively stores the size. - does nothing on reading, as that is already handled by ...._pre() + smb_io_hdrbuf wrapper. Call this and it retrospectively stores the size. + Does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ -BOOL smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, + +BOOL smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 ptr_hdrbuf, uint32 max_len, uint32 len) { - if (!ps->io) - { - /* storing: go back and do a retrospective job. i hate this */ - uint32 old_offset = ps->offset; + if (!ps->io) { + /* writing: go back and do a retrospective job. i hate this */ + + uint32 old_offset = prs_offset(ps); - make_buf_hdr(hdr, max_len, len); - ps->offset = ptr_hdrbuf; - smb_io_hdrbuf(desc, hdr, ps, depth); - ps->offset = old_offset; + init_buf_hdr(hdr, max_len, len); + if(!prs_set_offset(ps, ptr_hdrbuf)) + return False; + if(!smb_io_hdrbuf(desc, hdr, ps, depth)) + return False; + + if(!prs_set_offset(ps, old_offset)) + return False; } return True; } /******************************************************************* -reads or writes a BUFHDR structure. + Reads or writes a BUFHDR structure. ********************************************************************/ -BOOL smb_io_hdrbuf(char *desc, BUFHDR *hdr, prs_struct *ps, int depth) + +BOOL smb_io_hdrbuf(char *desc, BUFHDR *hdr, prs_struct *ps, int depth) { - if (hdr == NULL) return False; + if (hdr == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_hdrbuf"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("buf_max_len", ps, depth, &(hdr->buf_max_len)); - prs_uint32("buf_len ", ps, depth, &(hdr->buf_len )); + if(!prs_uint32("buf_max_len", ps, depth, &hdr->buf_max_len)) + return False; + if(!prs_uint32("buf_len ", ps, depth, &hdr->buf_len)) + return False; /* oops! XXXX maybe issue a warning that this is happening... */ - if (hdr->buf_max_len > MAX_BUFFERLEN) hdr->buf_max_len = MAX_BUFFERLEN; - if (hdr->buf_len > MAX_BUFFERLEN) hdr->buf_len = MAX_BUFFERLEN; + if (hdr->buf_max_len > MAX_BUFFERLEN) + hdr->buf_max_len = MAX_BUFFERLEN; + if (hdr->buf_len > MAX_BUFFERLEN) + hdr->buf_len = MAX_BUFFERLEN; return True; } /******************************************************************* -creates a BUFHDR2 structure. +creates a UNIHDR2 structure. ********************************************************************/ -BOOL make_bufhdr2(BUFHDR2 *hdr, uint32 info_level, uint32 length, uint32 buffer) -{ - hdr->info_level = info_level; - hdr->length = length; - hdr->buffer = buffer; - - return True; -} -/******************************************************************* -reads or writes a BUFHDR2 structure. -********************************************************************/ -BOOL smb_io_bufhdr2(char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) +void init_uni_hdr2(UNIHDR2 *hdr, int len) { - if (hdr == NULL) return False; - - prs_debug(ps, depth, desc, "smb_io_bufhdr2"); - depth++; - - prs_align(ps); - prs_uint32("info_level", ps, depth, &(hdr->info_level)); - prs_uint32("length ", ps, depth, &(hdr->length )); - prs_uint32("buffer ", ps, depth, &(hdr->buffer )); - - return True; + init_uni_hdr(&hdr->unihdr, len); + hdr->buffer = (len > 0) ? 1 : 0; } /******************************************************************* -creates a UNIHDR2 structure. + Reads or writes a UNIHDR2 structure. ********************************************************************/ -BOOL make_uni_hdr2(UNIHDR2 *hdr, int len) -{ - make_uni_hdr(&(hdr->unihdr), len); - hdr->buffer = len > 0 ? 1 : 0; - - return True; -} -/******************************************************************* -reads or writes a UNIHDR2 structure. -********************************************************************/ -BOOL smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) +BOOL smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) { - if (hdr2 == NULL) return False; + if (hdr2 == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_unihdr2"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_unihdr("hdr", &(hdr2->unihdr), ps, depth); - prs_uint32("buffer", ps, depth, &(hdr2->buffer)); + if(!smb_io_unihdr("hdr", &hdr2->unihdr, ps, depth)) + return False; + if(!prs_uint32("buffer", ps, depth, &hdr2->buffer)) + return False; return True; } /******************************************************************* -creates a UNISTR structure. + Inits a UNISTR structure. ********************************************************************/ -BOOL make_unistr(UNISTR *str, char *buf) -{ - ascii_to_unistr(str->buffer, buf, sizeof(str->buffer)-1); - return True; +void init_unistr(UNISTR *str, char *buf) +{ + /* store the string (null-terminated copy) */ + dos_struni2((char *)str->buffer, buf, sizeof(str->buffer)); } /******************************************************************* reads or writes a UNISTR structure. XXXX NOTE: UNISTR structures NEED to be null-terminated. ********************************************************************/ -BOOL smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) + +BOOL smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) { - if (uni == NULL) return False; + if (uni == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_unistr"); depth++; - prs_unistr("unistr", ps, depth, uni); + if(!prs_align(ps)) + return False; + if(!prs_unistr("unistr", ps, depth, uni)) + return False; return True; } /******************************************************************* -creates a BUFFER3 structure from a uint32 + Inits a BUFFER3 structure from a uint32 ********************************************************************/ -BOOL make_buffer3_uint32(BUFFER3 *str, uint32 val) + +void init_buffer3_uint32(BUFFER3 *str, uint32 val) { ZERO_STRUCTP(str); @@ -482,14 +515,13 @@ BOOL make_buffer3_uint32(BUFFER3 *str, uint32 val) str->buf_len = sizeof(uint32); SIVAL(str->buffer, 0, val); - - return True; } /******************************************************************* -creates a BUFFER3 structure. + Inits a BUFFER3 structure. ********************************************************************/ -BOOL make_buffer3_str(BUFFER3 *str, const char *buf, int len) + +void init_buffer3_str(BUFFER3 *str, char *buf, int len) { ZERO_STRUCTP(str); @@ -497,364 +529,238 @@ BOOL make_buffer3_str(BUFFER3 *str, const char *buf, int len) str->buf_max_len = len * 2; str->buf_len = len * 2; - /* store the string (little endian buffer) */ - ascii_to_unibuf((char*)str->buffer, buf, str->buf_len); - - return True; + /* store the string (null-terminated 8 bit chars into 16 bit chars) */ + dos_struni2((char *)str->buffer, buf, sizeof(str->buffer)); } /******************************************************************* -creates a BUFFER3 structure from a hex string. + Inits a BUFFER3 structure from a hex string. ********************************************************************/ -BOOL make_buffer3_hex(BUFFER3 *str, char *buf) + +void init_buffer3_hex(BUFFER3 *str, char *buf) { ZERO_STRUCTP(str); str->buf_max_len = str->buf_len = strhex_to_str((char *)str->buffer, sizeof(str->buffer), buf); - - return True; } /******************************************************************* -creates a BUFFER3 structure. + Inits a BUFFER3 structure. ********************************************************************/ -BOOL make_buffer3_bytes(BUFFER3 *str, uint8 *buf, int len) + +void init_buffer3_bytes(BUFFER3 *str, uint8 *buf, int len) { ZERO_STRUCTP(str); /* max buffer size (allocated size) */ str->buf_max_len = len; if (buf != NULL) - { memcpy(str->buffer, buf, MIN(str->buf_len, sizeof(str->buffer))); - } str->buf_len = buf != NULL ? len : 0; - - return True; } /******************************************************************* -reads or writes a BUFFER3 structure. - the uni_max_len member tells you how large the buffer is. - the uni_str_len member tells you how much of the buffer is really used. + Reads or writes a BUFFER3 structure. + the uni_max_len member tells you how large the buffer is. + the uni_str_len member tells you how much of the buffer is really used. ********************************************************************/ -BOOL smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) -{ - if (buf3 == NULL) return False; - - prs_debug(ps, depth, desc, "smb_io_buffer3"); - depth++; - prs_align(ps); - - prs_uint32("uni_max_len", ps, depth, &(buf3->buf_max_len)); - if (buf3->buf_max_len > MAX_UNISTRLEN) buf3->buf_max_len = MAX_UNISTRLEN; - - prs_uint8s(True, "buffer ", ps, depth, buf3->buffer, buf3->buf_max_len); - - prs_uint32("buf_len ", ps, depth, &(buf3->buf_len)); - if (buf3->buf_len > MAX_UNISTRLEN) buf3->buf_len = MAX_UNISTRLEN; - - return True; -} - -/******************************************************************* -creates a BUFFER4 structure. -********************************************************************/ -BOOL make_buffer4_str(BUFFER4 *str, const char *buf, int len) +BOOL smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) { - ZERO_STRUCTP(str); - - /* set up string lengths. */ - str->buf_len = len * 2; + if (buf3 == NULL) + return False; - /* store the string (little endian buffer) */ - ascii_to_unibuf((char*)str->buffer, buf, str->buf_len); - - return True; -} - -/******************************************************************* -reads or writes a BUFFER4 structure. -********************************************************************/ -BOOL smb_io_buffer4(char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth) -{ - if ((buf4 == NULL) || (buffer == 0)) return False; - - prs_debug(ps, depth, desc, "smb_io_buffer4"); + prs_debug(ps, depth, desc, "smb_io_buffer3"); depth++; - prs_align(ps); - prs_uint32("buf_len", ps, depth, &(buf4->buf_len)); - - if (buf4->buf_len > MAX_BUFFERLEN) - { - buf4->buf_len = MAX_BUFFERLEN; - } - - prs_uint8s(True, "buffer", ps, depth, buf4->buffer, buf4->buf_len); - - return True; -} - -/******************************************************************* -initialise a BUFFER5 structure. -********************************************************************/ -BOOL init_buffer5(BUFFER5 **str) -{ - BUFFER5 *buf5; - - buf5=(BUFFER5 *)malloc( sizeof(BUFFER5) ); - - buf5->buf_len=0; - buf5->buffer=NULL; - *str=buf5; - - return True; -} - -/******************************************************************* -clear a BUFFER5 structure. -********************************************************************/ -BOOL clear_buffer5(BUFFER5 **str) -{ - BUFFER5 *buf5; + if(!prs_align(ps)) + return False; - buf5=*str; - if (buf5->buffer != NULL ) - { - free(buf5->buffer); - } - free(buf5); - *str=NULL; + if(!prs_uint32("uni_max_len", ps, depth, &buf3->buf_max_len)) + return False; - return True; -} + if (buf3->buf_max_len > MAX_UNISTRLEN) + buf3->buf_max_len = MAX_UNISTRLEN; -/******************************************************************* -creates a BUFFER5 structure. -********************************************************************/ -BOOL make_buffer5(BUFFER5 *str, char *buf, int len) -{ + if(!prs_uint8s(True, "buffer ", ps, depth, buf3->buffer, buf3->buf_max_len)) + return False; - /* max buffer size (allocated size) */ - str->buf_len = len; - str->buffer = (uint16 *)malloc( sizeof(uint16) * len ); - ascii_to_unistr(str->buffer, buf, len); + if(!prs_uint32("buf_len ", ps, depth, &buf3->buf_len)) + return False; + if (buf3->buf_len > MAX_UNISTRLEN) + buf3->buf_len = MAX_UNISTRLEN; return True; } /******************************************************************* -reads or writes a BUFFER5 structure. -the buf_len member tells you how large the buffer is. + Inits a BUFFER2 structure. ********************************************************************/ -BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "smb_io_buffer4"); - depth++; - - if (buf5 == NULL) return False; - - prs_align(ps); - prs_uint32("buf_len", ps, depth, &(buf5->buf_len)); - - /* reading: alloc the buffer first */ - if ( ps->io ) - { - buf5->buffer=(uint16 *)malloc( sizeof(uint16)*buf5->buf_len ); - } - - prs_uint16s(True, "buffer ", ps, depth, buf5->buffer, buf5->buf_len); - - return True; -} -/******************************************************************* -creates a BUFFER2 structure. -********************************************************************/ -BOOL make_buffer2_multi(BUFFER2 *str, char *const* const buf, uint32 num) +void init_buffer2(BUFFER2 *str, uint8 *buf, int len) { - int i; - char *dest = (char*)str->buffer; - size_t max_len = sizeof(str->buffer)-1; - ZERO_STRUCTP(str); - str->buf_max_len = 0; + /* max buffer size (allocated size) */ + str->buf_max_len = len; str->undoc = 0; + str->buf_len = buf != NULL ? len : 0; - for (i = 0; i < num && max_len > 0; i++) - { - size_t len = buf[i] != NULL ? strlen(buf[i]) : 0; - - str->buf_max_len += len * 2; - str->buf_len += len * 2; - - ascii_to_unibuf(dest, buf[i], max_len); - - dest += len * 2 + 2; - max_len -= len * 2 + 2; - } - - return True; + if (buf != NULL) + memcpy(str->buffer, buf, MIN(str->buf_len, sizeof(str->buffer))); } /******************************************************************* -creates a BUFFER2 structure. + Reads or writes a BUFFER2 structure. + the uni_max_len member tells you how large the buffer is. + the uni_str_len member tells you how much of the buffer is really used. ********************************************************************/ -BOOL make_buffer2(BUFFER2 *str, const char *buf, int len) -{ - ZERO_STRUCTP(str); - /* set up string lengths. */ - str->buf_max_len = str->buf_len = len * 2; - str->undoc = 0; - - /* store the string */ - ascii_to_unibuf((char*)str->buffer, buf, - MIN(str->buf_len, sizeof(str->buffer)-1)); - - return True; -} - -/******************************************************************* -reads or writes a BUFFER2 structure. - the uni_max_len member tells you how large the buffer is. - the uni_str_len member tells you how much of the buffer is really used. -********************************************************************/ -BOOL smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth) { - if (buf2 == NULL) return False; + if (buf2 == NULL) + return False; + + if (buffer) { - if (buffer) - { prs_debug(ps, depth, desc, "smb_io_buffer2"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("buf_max_len", ps, depth, &(buf2->buf_max_len)); - prs_uint32("undoc ", ps, depth, &(buf2->undoc )); - prs_uint32("buf_len ", ps, depth, &(buf2->buf_len)); + if(!prs_uint32("uni_max_len", ps, depth, &buf2->buf_max_len)) + return False; + if(!prs_uint32("undoc ", ps, depth, &buf2->undoc)) + return False; + if(!prs_uint32("buf_len ", ps, depth, &buf2->buf_len)) + return False; /* oops! XXXX maybe issue a warning that this is happening... */ - if (buf2->buf_max_len > MAX_UNISTRLEN) buf2->buf_max_len = MAX_UNISTRLEN; - if (buf2->buf_len > MAX_UNISTRLEN) buf2->buf_len = MAX_UNISTRLEN; + if (buf2->buf_max_len > MAX_UNISTRLEN) + buf2->buf_max_len = MAX_UNISTRLEN; + if (buf2->buf_len > MAX_UNISTRLEN) + buf2->buf_len = MAX_UNISTRLEN; /* buffer advanced by indicated length of string NOT by searching for null-termination */ - prs_buffer2(True, "buffer ", ps, depth, buf2); - } - else - { + + if(!prs_buffer2(True, "buffer ", ps, depth, buf2)) + return False; + + } else { + prs_debug(ps, depth, desc, "smb_io_buffer2 - NULL"); depth++; - bzero(buf2, sizeof(*buf2)); - } + memset((char *)buf2, '\0', sizeof(*buf2)); + } return True; } /******************************************************************* creates a UNISTR2 structure: sets up the buffer, too ********************************************************************/ -BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf) + +void init_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf) { - if (buf != NULL) - { + if (buf != NULL) { + *ptr = 1; - make_unistr2(str, buf, strlen(buf)+1); - } - else - { + init_unistr2(str, buf, strlen(buf)+1); + + } else { + *ptr = 0; - make_unistr2(str, "", 0); - } + init_unistr2(str, "", 0); - return True; + } } /******************************************************************* -creates a STRING2 structure. + Copies a UNISTR2 structure. ********************************************************************/ -BOOL make_string2(STRING2 *str, const char *buf, int len) -{ - /* set up string lengths. */ - str->str_max_len = len; - str->undoc = 0; - str->str_str_len = len; - /* store the string */ - if(len != 0) - { - memcpy(str->buffer, buf, len); - } +void copy_unistr2(UNISTR2 *str, UNISTR2 *from) +{ + /* set up string lengths. add one if string is not null-terminated */ + str->uni_max_len = from->uni_max_len; + str->undoc = from->undoc; + str->uni_str_len = from->uni_str_len; - return True; + /* copy the string */ + memcpy(str->buffer, from->buffer, sizeof(from->buffer)); } /******************************************************************* -creates a STRING2 structure: sets up the buffer, too + Creates a STRING2 structure. ********************************************************************/ -BOOL make_buf_string2(STRING2 *str, uint32 *ptr, const char *buf) + +void init_string2(STRING2 *str, char *buf, int len) { - if (buf != NULL) - { - *ptr = 1; - make_string2(str, buf, strlen(buf)+1); - } - else - { - *ptr = 0; - make_string2(str, "", 0); - } + /* set up string lengths. */ + str->str_max_len = len; + str->undoc = 0; + str->str_str_len = len; - return True; + /* store the string */ + if(len != 0) + memcpy(str->buffer, buf, len); } /******************************************************************* -reads or writes a STRING2 structure. -XXXX NOTE: STRING2 structures need NOT be null-terminated. - the str_str_len member tells you how long the string is; - the str_max_len member tells you how large the buffer is. + Reads or writes a STRING2 structure. + XXXX NOTE: STRING2 structures need NOT be null-terminated. + the str_str_len member tells you how long the string is; + the str_max_len member tells you how large the buffer is. ********************************************************************/ -BOOL smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth) + +BOOL smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth) { - if (str2 == NULL) return False; + if (str2 == NULL) + return False; + + if (buffer) { - if (buffer) - { prs_debug(ps, depth, desc, "smb_io_string2"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("str_max_len", ps, depth, &(str2->str_max_len)); - prs_uint32("undoc ", ps, depth, &(str2->undoc )); - prs_uint32("str_str_len", ps, depth, &(str2->str_str_len)); + if(!prs_uint32("str_max_len", ps, depth, &str2->str_max_len)) + return False; + if(!prs_uint32("undoc ", ps, depth, &str2->undoc)) + return False; + if(!prs_uint32("str_str_len", ps, depth, &str2->str_str_len)) + return False; /* oops! XXXX maybe issue a warning that this is happening... */ - if (str2->str_max_len > MAX_STRINGLEN) str2->str_max_len = MAX_STRINGLEN; - if (str2->str_str_len > MAX_STRINGLEN) str2->str_str_len = MAX_STRINGLEN; + if (str2->str_max_len > MAX_STRINGLEN) + str2->str_max_len = MAX_STRINGLEN; + if (str2->str_str_len > MAX_STRINGLEN) + str2->str_str_len = MAX_STRINGLEN; /* buffer advanced by indicated length of string NOT by searching for null-termination */ - prs_string2(True, "buffer ", ps, depth, str2); - } - else - { + if(!prs_string2(True, "buffer ", ps, depth, str2)) + return False; + + } else { + prs_debug(ps, depth, desc, "smb_io_string2 - NULL"); depth++; - bzero(str2, sizeof(*str2)); + memset((char *)str2, '\0', sizeof(*str2)); + } return True; } /******************************************************************* -creates a UNISTR2 structure. + Inits a UNISTR2 structure. ********************************************************************/ -BOOL make_unistr2(UNISTR2 *str, const char *buf, int len) + +void init_unistr2(UNISTR2 *str, char *buf, int len) { ZERO_STRUCTP(str); @@ -863,79 +769,93 @@ BOOL make_unistr2(UNISTR2 *str, const char *buf, int len) str->undoc = 0; str->uni_str_len = len; - /* store the string (wide chars) */ - ascii_to_unistr(str->buffer, buf, len); - - return True; + /* store the string (null-terminated 8 bit chars into 16 bit chars) */ + dos_struni2((char *)str->buffer, buf, sizeof(str->buffer)); } /******************************************************************* -reads or writes a UNISTR2 structure. -XXXX NOTE: UNISTR2 structures need NOT be null-terminated. - the uni_str_len member tells you how long the string is; - the uni_max_len member tells you how large the buffer is. + Reads or writes a UNISTR2 structure. + XXXX NOTE: UNISTR2 structures need NOT be null-terminated. + the uni_str_len member tells you how long the string is; + the uni_max_len member tells you how large the buffer is. ********************************************************************/ -BOOL smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth) + +BOOL smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth) { - if (uni2 == NULL) return False; + if (uni2 == NULL) + return False; + + if (buffer) { - if (buffer) - { prs_debug(ps, depth, desc, "smb_io_unistr2"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("uni_max_len", ps, depth, &(uni2->uni_max_len)); - prs_uint32("undoc ", ps, depth, &(uni2->undoc )); - prs_uint32("uni_str_len", ps, depth, &(uni2->uni_str_len)); + if(!prs_uint32("uni_max_len", ps, depth, &uni2->uni_max_len)) + return False; + if(!prs_uint32("undoc ", ps, depth, &uni2->undoc)) + return False; + if(!prs_uint32("uni_str_len", ps, depth, &uni2->uni_str_len)) + return False; /* oops! XXXX maybe issue a warning that this is happening... */ - if (uni2->uni_max_len > MAX_UNISTRLEN) uni2->uni_max_len = MAX_UNISTRLEN; - if (uni2->uni_str_len > MAX_UNISTRLEN) uni2->uni_str_len = MAX_UNISTRLEN; + if (uni2->uni_max_len > MAX_UNISTRLEN) + uni2->uni_max_len = MAX_UNISTRLEN; + if (uni2->uni_str_len > MAX_UNISTRLEN) + uni2->uni_str_len = MAX_UNISTRLEN; /* buffer advanced by indicated length of string NOT by searching for null-termination */ - prs_unistr2(True, "buffer ", ps, depth, uni2); - } - else - { + if(!prs_unistr2(True, "buffer ", ps, depth, uni2)) + return False; + + } else { + prs_debug(ps, depth, desc, "smb_io_unistr2 - NULL"); depth++; - bzero(uni2, sizeof(*uni2)); + memset((char *)uni2, '\0', sizeof(*uni2)); + } return True; } /******************************************************************* -creates a DOM_RID2 structure. + Inits a DOM_RID2 structure. ********************************************************************/ -BOOL make_dom_rid2(DOM_RID2 *rid2, uint32 rid, uint8 type, uint32 idx) + +void init_dom_rid2(DOM_RID2 *rid2, uint32 rid, uint8 type, uint32 idx) { rid2->type = type; rid2->rid = rid; rid2->rid_idx = idx; - - return True; } /******************************************************************* -reads or writes a DOM_RID2 structure. + Reads or writes a DOM_RID2 structure. ********************************************************************/ -BOOL smb_io_dom_rid2(char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth) + +BOOL smb_io_dom_rid2(char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth) { - if (rid2 == NULL) return False; + if (rid2 == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_dom_rid2"); depth++; - prs_align(ps); - - prs_uint8("type ", ps, depth, &(rid2->type)); - prs_align(ps); - prs_uint32("rid ", ps, depth, &(rid2->rid )); - prs_uint32("rid_idx", ps, depth, &(rid2->rid_idx )); + if(!prs_align(ps)) + return False; + + if(!prs_uint8("type ", ps, depth, &rid2->type)) + return False; + if(!prs_align(ps)) + return False; + if(!prs_uint32("rid ", ps, depth, &rid2->rid)) + return False; + if(!prs_uint32("rid_idx", ps, depth, &rid2->rid_idx)) + return False; return True; } @@ -943,414 +863,495 @@ BOOL smb_io_dom_rid2(char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth) /******************************************************************* creates a DOM_RID3 structure. ********************************************************************/ -BOOL make_dom_rid3(DOM_RID3 *rid3, uint32 rid, uint8 type) -{ - rid3->rid = rid; - rid3->type1 = type; - rid3->ptr_type = 0x1; /* non-zero, basically. */ - rid3->type2 = 0x1; - rid3->unk = type; - return True; +void init_dom_rid3(DOM_RID3 *rid3, uint32 rid, uint8 type) +{ + rid3->rid = rid; + rid3->type1 = type; + rid3->ptr_type = 0x1; /* non-zero, basically. */ + rid3->type2 = 0x1; + rid3->unk = type; } /******************************************************************* reads or writes a DOM_RID3 structure. ********************************************************************/ -BOOL smb_io_dom_rid3(char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) + +BOOL smb_io_dom_rid3(char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) { - if (rid3 == NULL) return False; + if (rid3 == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_dom_rid3"); depth++; - prs_align(ps); - - prs_uint32("rid ", ps, depth, &(rid3->rid )); - prs_uint32("type1 ", ps, depth, &(rid3->type1 )); - prs_uint32("ptr_type", ps, depth, &(rid3->ptr_type)); - prs_uint32("type2 ", ps, depth, &(rid3->type2 )); - prs_uint32("unk ", ps, depth, &(rid3->unk )); + if(!prs_align(ps)) + return False; + + if(!prs_uint32("rid ", ps, depth, &rid3->rid)) + return False; + if(!prs_uint32("type1 ", ps, depth, &rid3->type1)) + return False; + if(!prs_uint32("ptr_type", ps, depth, &rid3->ptr_type)) + return False; + if(!prs_uint32("type2 ", ps, depth, &rid3->type2)) + return False; + if(!prs_uint32("unk ", ps, depth, &rid3->unk)) + return False; return True; } /******************************************************************* -makes a DOM_CLNT_SRV structure. + Inits a DOM_RID4 structure. ********************************************************************/ -static BOOL make_clnt_srv(DOM_CLNT_SRV *log, - const char *logon_srv, - const char *comp_name) + +void init_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid) { - if (log == NULL) return False; + rid4->unknown = unknown; + rid4->attr = attr; + rid4->rid = rid; +} - DEBUG(5,("make_clnt_srv: %d\n", __LINE__)); +/******************************************************************* + Inits a DOM_CLNT_SRV structure. +********************************************************************/ - if (logon_srv != NULL) - { +static void init_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) +{ + DEBUG(5,("init_clnt_srv: %d\n", __LINE__)); + + if (logon_srv != NULL) { log->undoc_buffer = 1; - make_unistr2(&(log->uni_logon_srv), logon_srv, strlen(logon_srv)+1); - } - else - { + init_unistr2(&(log->uni_logon_srv), logon_srv, strlen(logon_srv)+1); + } else { log->undoc_buffer = 0; } - if (comp_name != NULL) - { + if (comp_name != NULL) { log->undoc_buffer2 = 1; - make_unistr2(&(log->uni_comp_name), comp_name, strlen(comp_name)+1); - } - else - { + init_unistr2(&(log->uni_comp_name), comp_name, strlen(comp_name)+1); + } else { log->undoc_buffer2 = 0; } - - return True; } /******************************************************************* -reads or writes a DOM_CLNT_SRV structure. + Inits or writes a DOM_CLNT_SRV structure. ********************************************************************/ -static BOOL smb_io_clnt_srv(char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth) + +static BOOL smb_io_clnt_srv(char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth) { - if (log == NULL) return False; + if (log == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_clnt_srv"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("undoc_buffer ", ps, depth, &(log->undoc_buffer )); - if (log->undoc_buffer != 0) - { - smb_io_unistr2("unistr2", &(log->uni_logon_srv), log->undoc_buffer, ps, depth); + if(!prs_uint32("undoc_buffer ", ps, depth, &log->undoc_buffer)) + return False; + + if (log->undoc_buffer != 0) { + if(!smb_io_unistr2("unistr2", &log->uni_logon_srv, log->undoc_buffer, ps, depth)) + return False; } - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("undoc_buffer2", ps, depth, &(log->undoc_buffer2)); - if (log->undoc_buffer2 != 0) - { - smb_io_unistr2("unistr2", &(log->uni_comp_name), log->undoc_buffer2, ps, depth); + if(!prs_uint32("undoc_buffer2", ps, depth, &log->undoc_buffer2)) + return False; + + if (log->undoc_buffer2 != 0) { + if(!smb_io_unistr2("unistr2", &log->uni_comp_name, log->undoc_buffer2, ps, depth)) + return False; } return True; } /******************************************************************* -makes a DOM_LOG_INFO structure. + Inits a DOM_LOG_INFO structure. ********************************************************************/ -BOOL make_log_info(DOM_LOG_INFO *log, - const char *logon_srv, const char *acct_name, - uint16 sec_chan, const char *comp_name) -{ - if (log == NULL) return False; +void init_log_info(DOM_LOG_INFO *log, char *logon_srv, char *acct_name, + uint16 sec_chan, char *comp_name) +{ DEBUG(5,("make_log_info %d\n", __LINE__)); log->undoc_buffer = 1; - make_unistr2(&(log->uni_logon_srv), logon_srv, strlen(logon_srv)+1); - make_unistr2(&(log->uni_acct_name), acct_name, strlen(acct_name)+1); + init_unistr2(&log->uni_logon_srv, logon_srv, strlen(logon_srv)+1); + init_unistr2(&log->uni_acct_name, acct_name, strlen(acct_name)+1); log->sec_chan = sec_chan; - make_unistr2(&(log->uni_comp_name), comp_name, strlen(comp_name)+1); - - return True; + init_unistr2(&log->uni_comp_name, comp_name, strlen(comp_name)+1); } /******************************************************************* -reads or writes a DOM_LOG_INFO structure. + Reads or writes a DOM_LOG_INFO structure. ********************************************************************/ -BOOL smb_io_log_info(char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth) + +BOOL smb_io_log_info(char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth) { - if (log == NULL) return False; + if (log == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_log_info"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("undoc_buffer", ps, depth, &(log->undoc_buffer)); + if(!prs_uint32("undoc_buffer", ps, depth, &log->undoc_buffer)) + return False; - smb_io_unistr2("unistr2", &(log->uni_logon_srv), True, ps, depth); - smb_io_unistr2("unistr2", &(log->uni_acct_name), True, ps, depth); + if(!smb_io_unistr2("unistr2", &log->uni_logon_srv, True, ps, depth)) + return False; + if(!smb_io_unistr2("unistr2", &log->uni_acct_name, True, ps, depth)) + return False; - prs_uint16("sec_chan", ps, depth, &(log->sec_chan)); + if(!prs_uint16("sec_chan", ps, depth, &log->sec_chan)) + return False; - smb_io_unistr2("unistr2", &(log->uni_comp_name), True, ps, depth); + if(!smb_io_unistr2("unistr2", &log->uni_comp_name, True, ps, depth)) + return False; return True; } /******************************************************************* -reads or writes a DOM_CHAL structure. + Reads or writes a DOM_CHAL structure. ********************************************************************/ -BOOL smb_io_chal(char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) + +BOOL smb_io_chal(char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) { - if (chal == NULL) return False; + if (chal == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_chal"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint8s (False, "data", ps, depth, chal->data, 8); + if(!prs_uint8s (False, "data", ps, depth, chal->data, 8)) + return False; return True; } /******************************************************************* -reads or writes a DOM_CRED structure. + Reads or writes a DOM_CRED structure. ********************************************************************/ + BOOL smb_io_cred(char *desc, DOM_CRED *cred, prs_struct *ps, int depth) { - if (cred == NULL) return False; + if (cred == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_cred"); depth++; - prs_align(ps); - - smb_io_chal ("", &(cred->challenge), ps, depth); - smb_io_utime("", &(cred->timestamp), ps, depth); + if(!prs_align(ps)) + return False; + + if(!smb_io_chal ("", &cred->challenge, ps, depth)) + return False; + if(!smb_io_utime("", &cred->timestamp, ps, depth)) + return False; return True; } /******************************************************************* -makes a DOM_CLNT_INFO2 structure. + Inits a DOM_CLNT_INFO2 structure. ********************************************************************/ -BOOL make_clnt_info2(DOM_CLNT_INFO2 *clnt, - const char *logon_srv, const char *comp_name, + +void init_clnt_info2(DOM_CLNT_INFO2 *clnt, + char *logon_srv, char *comp_name, DOM_CRED *clnt_cred) { - if (clnt == NULL) return False; - DEBUG(5,("make_clnt_info: %d\n", __LINE__)); - make_clnt_srv(&(clnt->login), logon_srv, comp_name); + init_clnt_srv(&(clnt->login), logon_srv, comp_name); - if (clnt_cred != NULL) - { + if (clnt_cred != NULL) { clnt->ptr_cred = 1; memcpy(&(clnt->cred), clnt_cred, sizeof(clnt->cred)); - } - else - { + } else { clnt->ptr_cred = 0; } - - return True; } /******************************************************************* -reads or writes a DOM_CLNT_INFO2 structure. + Reads or writes a DOM_CLNT_INFO2 structure. ********************************************************************/ -BOOL smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth) + +BOOL smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth) { - if (clnt == NULL) return False; + if (clnt == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_clnt_info2"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_clnt_srv("", &(clnt->login), ps, depth); + if(!smb_io_clnt_srv("", &clnt->login, ps, depth)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr_cred", ps, depth, &(clnt->ptr_cred)); - smb_io_cred ("", &(clnt->cred ), ps, depth); + if(!prs_uint32("ptr_cred", ps, depth, &clnt->ptr_cred)) + return False; + if(!smb_io_cred("", &clnt->cred, ps, depth)) + return False; return True; } /******************************************************************* -makes a DOM_CLNT_INFO structure. + Inits a DOM_CLNT_INFO structure. ********************************************************************/ -BOOL make_clnt_info(DOM_CLNT_INFO *clnt, - const char *logon_srv, const char *acct_name, - uint16 sec_chan, const char *comp_name, + +void init_clnt_info(DOM_CLNT_INFO *clnt, + char *logon_srv, char *acct_name, + uint16 sec_chan, char *comp_name, DOM_CRED *cred) { - if (clnt == NULL || cred == NULL) return False; - DEBUG(5,("make_clnt_info\n")); - make_log_info(&(clnt->login), logon_srv, acct_name, sec_chan, comp_name); - memcpy(&(clnt->cred), cred, sizeof(clnt->cred)); - - return True; + init_log_info(&clnt->login, logon_srv, acct_name, sec_chan, comp_name); + memcpy(&clnt->cred, cred, sizeof(clnt->cred)); } /******************************************************************* -reads or writes a DOM_CLNT_INFO structure. + Reads or writes a DOM_CLNT_INFO structure. ********************************************************************/ + BOOL smb_io_clnt_info(char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int depth) { - if (clnt == NULL) return False; + if (clnt == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_clnt_info"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_log_info("", &(clnt->login), ps, depth); - smb_io_cred ("", &(clnt->cred ), ps, depth); + if(!smb_io_log_info("", &clnt->login, ps, depth)) + return False; + if(!smb_io_cred("", &clnt->cred, ps, depth)) + return False; return True; } /******************************************************************* -makes an OWF_INFO structure. + Inits a DOM_LOGON_ID structure. ********************************************************************/ -BOOL make_owf_info(OWF_INFO *hash, uint8 data[16]) + +void init_logon_id(DOM_LOGON_ID *log, uint32 log_id_low, uint32 log_id_high) { - if (hash == NULL) return False; + DEBUG(5,("make_logon_id: %d\n", __LINE__)); + + log->low = log_id_low; + log->high = log_id_high; +} + +/******************************************************************* + Reads or writes a DOM_LOGON_ID structure. +********************************************************************/ - DEBUG(5,("make_owf_info: %d\n", __LINE__)); +BOOL smb_io_logon_id(char *desc, DOM_LOGON_ID *log, prs_struct *ps, int depth) +{ + if (log == NULL) + return False; + + prs_debug(ps, depth, desc, "smb_io_logon_id"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("low ", ps, depth, &log->low )) + return False; + if(!prs_uint32("high", ps, depth, &log->high)) + return False; + + return True; +} + +/******************************************************************* + Inits an OWF_INFO structure. +********************************************************************/ + +void init_owf_info(OWF_INFO *hash, uint8 data[16]) +{ + DEBUG(5,("init_owf_info: %d\n", __LINE__)); if (data != NULL) - { memcpy(hash->data, data, sizeof(hash->data)); - } else - { - bzero(hash->data, sizeof(hash->data)); - } - - return True; + memset((char *)hash->data, '\0', sizeof(hash->data)); } /******************************************************************* -reads or writes an OWF_INFO structure. + Reads or writes an OWF_INFO structure. ********************************************************************/ + BOOL smb_io_owf_info(char *desc, OWF_INFO *hash, prs_struct *ps, int depth) { - if (hash == NULL) return False; + if (hash == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_owf_info"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint8s (False, "data", ps, depth, hash->data, 16); + if(!prs_uint8s (False, "data", ps, depth, hash->data, 16)) + return False; return True; } /******************************************************************* -reads or writes a DOM_GID structure. + Reads or writes a DOM_GID structure. ********************************************************************/ + BOOL smb_io_gid(char *desc, DOM_GID *gid, prs_struct *ps, int depth) { - if (gid == NULL) return False; + if (gid == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_gid"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("g_rid", ps, depth, &(gid->g_rid)); - prs_uint32("attr ", ps, depth, &(gid->attr )); + if(!prs_uint32("g_rid", ps, depth, &gid->g_rid)) + return False; + if(!prs_uint32("attr ", ps, depth, &gid->attr)) + return False; return True; } /******************************************************************* -reads or writes an POLICY_HND structure. + Reads or writes an POLICY_HND structure. ********************************************************************/ -BOOL smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth) + +BOOL smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth) { - if (pol == NULL) return False; + if (pol == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_pol_hnd"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint8s (False, "data", ps, depth, pol->data, POL_HND_SIZE); + if(!prs_uint8s (False, "data", ps, depth, pol->data, POL_HND_SIZE)) + return False; return True; } /******************************************************************* -reads or writes a dom query structure. + Reads or writes a dom query structure. ********************************************************************/ -static BOOL smb_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth) + +static BOOL smb_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth) { - if (d_q == NULL) return False; + if (d_q == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_dom_query"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint16("uni_dom_max_len", ps, depth, &(d_q->uni_dom_max_len)); /* domain name string length * 2 */ - prs_uint16("uni_dom_str_len", ps, depth, &(d_q->uni_dom_str_len)); /* domain name string length * 2 */ - - prs_uint32("buffer_dom_name", ps, depth, &(d_q->buffer_dom_name)); /* undocumented domain name string buffer pointer */ - prs_uint32("buffer_dom_sid ", ps, depth, &(d_q->buffer_dom_sid )); /* undocumented domain SID string buffer pointer */ + 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; - smb_io_unistr2("unistr2", &(d_q->uni_domain_name), d_q->buffer_dom_name, ps, depth); /* domain name (unicode string) */ + 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; - prs_align(ps); + if(!smb_io_unistr2("unistr2", &d_q->uni_domain_name, d_q->buffer_dom_name, ps, depth)) /* domain name (unicode string) */ + return False; - if (d_q->buffer_dom_sid != 0) - { - smb_io_dom_sid2("", &(d_q->dom_sid), ps, depth); /* domain SID */ - } - else - { - bzero(&(d_q->dom_sid), sizeof(d_q->dom_sid)); + 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. + Reads or writes a dom query structure. ********************************************************************/ -BOOL smb_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) -{ - smb_io_dom_query("", d_q, ps, depth); - return True; +BOOL smb_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) +{ + return smb_io_dom_query("", d_q, ps, depth); } /******************************************************************* -reads or writes a dom query structure. + Reads or writes a dom query structure. ********************************************************************/ -BOOL smb_io_dom_query_5(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) -{ - smb_io_dom_query("", d_q, ps, depth); - return True; +BOOL smb_io_dom_query_5(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) +{ + return smb_io_dom_query("", d_q, ps, depth); } /******************************************************************* -reads or writes a UNISTR3 structure. + Reads or writes a UNISTR3 structure. ********************************************************************/ -BOOL smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth) + +BOOL smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth) { - if (name == NULL) return False; + if (name == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_unistr3"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("uni_str_len", ps, depth, &(name->uni_str_len)); + if(!prs_uint32("uni_str_len", ps, depth, &name->uni_str_len)) + return False; /* don't know if len is specified by uni_str_len member... */ /* assume unicode string is unicode-null-terminated, instead */ - prs_unistr3(True, "unistr", name, ps, depth); + if(!prs_unistr3(True, "unistr", name, ps, depth)) + return False; return True; } - diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 277c2331b4..9588d1c53b 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -27,26 +27,31 @@ extern int DEBUGLEVEL; /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL net_io_neg_flags(char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth) + +static BOOL net_io_neg_flags(char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth) { - if (neg == NULL) return False; + if (neg == NULL) + return False; prs_debug(ps, depth, desc, "net_io_neg_flags"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("neg_flags", ps, depth, &(neg->neg_flags)); + if(!prs_uint32("neg_flags", ps, depth, &neg->neg_flags)) + return False; return True; } /******************************************************************* -creates a NETLOGON_INFO_3 structure. + Inits a NETLOGON_INFO_3 structure. ********************************************************************/ -static BOOL make_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_attempts) + +static void init_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_attempts) { info->flags = flags; info->logon_attempts = logon_attempts; @@ -55,67 +60,80 @@ static BOOL make_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_att info->reserved_3 = 0x0; info->reserved_4 = 0x0; info->reserved_5 = 0x0; - - return True; } /******************************************************************* -reads or writes a NETLOGON_INFO_3 structure. + Reads or writes a NETLOGON_INFO_3 structure. ********************************************************************/ + static BOOL net_io_netinfo_3(char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int depth) { - if (info == NULL) return False; + if (info == NULL) + return False; prs_debug(ps, depth, desc, "net_io_netinfo_3"); depth++; - prs_align(ps); - - prs_uint32("flags ", ps, depth, &(info->flags )); - prs_uint32("logon_attempts", ps, depth, &(info->logon_attempts)); - prs_uint32("reserved_1 ", ps, depth, &(info->reserved_1 )); - prs_uint32("reserved_2 ", ps, depth, &(info->reserved_2 )); - prs_uint32("reserved_3 ", ps, depth, &(info->reserved_3 )); - prs_uint32("reserved_4 ", ps, depth, &(info->reserved_4 )); - prs_uint32("reserved_5 ", ps, depth, &(info->reserved_5 )); + 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; } /******************************************************************* -creates a NETLOGON_INFO_1 structure. + Inits a NETLOGON_INFO_1 structure. ********************************************************************/ -static BOOL make_netinfo_1(NETLOGON_INFO_1 *info, uint32 flags, uint32 pdc_status) + +static void init_netinfo_1(NETLOGON_INFO_1 *info, uint32 flags, uint32 pdc_status) { info->flags = flags; info->pdc_status = pdc_status; - - return True; } /******************************************************************* -reads or writes a NETLOGON_INFO_1 structure. + Reads or writes a NETLOGON_INFO_1 structure. ********************************************************************/ -static BOOL net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth) + +static BOOL net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth) { - if (info == NULL) return False; + if (info == NULL) + return False; prs_debug(ps, depth, desc, "net_io_netinfo_1"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("flags ", ps, depth, &(info->flags )); - prs_uint32("pdc_status", ps, depth, &(info->pdc_status)); + if(!prs_uint32("flags ", ps, depth, &info->flags)) + return False; + if(!prs_uint32("pdc_status", ps, depth, &info->pdc_status)) + return False; return True; } /******************************************************************* -creates a NETLOGON_INFO_2 structure. + Inits a NETLOGON_INFO_2 structure. ********************************************************************/ -static BOOL make_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, + +static void init_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, uint32 tc_status, char *trusted_dc_name) { int len_dc_name = strlen(trusted_dc_name); @@ -125,544 +143,499 @@ static BOOL make_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_statu info->tc_status = tc_status; if (trusted_dc_name != NULL) - { - make_unistr2(&(info->uni_trusted_dc_name), trusted_dc_name, len_dc_name+1); - } + init_unistr2(&(info->uni_trusted_dc_name), trusted_dc_name, len_dc_name+1); else - { - make_unistr2(&(info->uni_trusted_dc_name), "", 1); - } - - return True; + init_unistr2(&(info->uni_trusted_dc_name), "", 1); } /******************************************************************* -reads or writes a NETLOGON_INFO_2 structure. + Reads or writes a NETLOGON_INFO_2 structure. ********************************************************************/ -static BOOL net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth) + +static BOOL net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth) { - if (info == NULL) return False; + if (info == NULL) + return False; prs_debug(ps, depth, desc, "net_io_netinfo_2"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("flags ", ps, depth, &(info->flags )); - prs_uint32("pdc_status ", ps, depth, &(info->pdc_status )); - prs_uint32("ptr_trusted_dc_name", ps, depth, &(info->ptr_trusted_dc_name)); - prs_uint32("tc_status ", ps, depth, &(info->tc_status )); - - if (info->ptr_trusted_dc_name != 0) - { - smb_io_unistr2("unistr2", &(info->uni_trusted_dc_name), info->ptr_trusted_dc_name, ps, depth); + 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; } - prs_align(ps); + if(!prs_align(ps)) + return False; return True; } /******************************************************************* -makes an NET_Q_LOGON_CTRL2 structure. + Reads or writes an NET_Q_LOGON_CTRL2 structure. ********************************************************************/ -BOOL make_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, - const char* srv_name, - uint32 function_code, - uint32 query_level, - uint32 switch_value) -{ - if (q_l == NULL) return False; - - DEBUG(5,("make_q_logon_ctrl2\n")); - - q_l->ptr = 1; - - make_unistr2(&(q_l->uni_server_name ), srv_name , strlen(srv_name )+1); - q_l->function_code = function_code; - q_l->query_level = query_level; - q_l->switch_value = switch_value; - - return True; -} - -/******************************************************************* -reads or writes an NET_Q_LOGON_CTRL2 structure. -********************************************************************/ -BOOL net_io_q_logon_ctrl2(char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, int depth) +BOOL net_io_q_logon_ctrl2(char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, int depth) { - if (q_l == NULL) return False; + if (q_l == NULL) + return False; prs_debug(ps, depth, desc, "net_io_q_logon_ctrl2"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr ", ps, depth, &(q_l->ptr )); + if(!prs_uint32("ptr ", ps, depth, &q_l->ptr)) + return False; - smb_io_unistr2 ("", &(q_l->uni_server_name), q_l->ptr, ps, depth); + if(!smb_io_unistr2 ("", &q_l->uni_server_name, q_l->ptr, ps, depth)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("function_code", ps, depth, &(q_l->function_code)); - prs_uint32("query_level ", ps, depth, &(q_l->query_level )); - prs_uint32("switch_value ", ps, depth, &(q_l->switch_value )); + 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; + if(!prs_uint32("switch_value ", ps, depth, &q_l->switch_value)) + return False; return True; } /******************************************************************* -makes an NET_R_LOGON_CTRL2 structure. + Inits an NET_R_LOGON_CTRL2 structure. ********************************************************************/ -BOOL make_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level, + +void init_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level, uint32 flags, uint32 pdc_status, uint32 logon_attempts, uint32 tc_status, char *trusted_domain_name) { - if (r_l == NULL) return False; - DEBUG(5,("make_r_logon_ctrl2\n")); r_l->switch_value = query_level; /* should only be 0x1 */ - switch (query_level) - { - case 1: - { - r_l->ptr = 1; /* undocumented pointer */ - make_netinfo_1(&(r_l->logon.info1), flags, pdc_status); - r_l->status = 0; - - break; - } - case 2: - { - r_l->ptr = 1; /* undocumented pointer */ - make_netinfo_2(&(r_l->logon.info2), flags, pdc_status, - tc_status, trusted_domain_name); - r_l->status = 0; - - break; - } - case 3: - { - r_l->ptr = 1; /* undocumented pointer */ - make_netinfo_3(&(r_l->logon.info3), flags, logon_attempts); - r_l->status = 0; - - break; - } - default: - { - DEBUG(2,("make_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; - } + switch (query_level) { + case 1: + r_l->ptr = 1; /* undocumented pointer */ + init_netinfo_1(&r_l->logon.info1, flags, pdc_status); + r_l->status = 0; + 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 = 0; + break; + case 3: + r_l->ptr = 1; /* undocumented pointer */ + init_netinfo_3(&(r_l->logon.info3), flags, logon_attempts); + r_l->status = 0; + 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; } - - return True; } /******************************************************************* -reads or writes an NET_R_LOGON_CTRL2 structure. + Reads or writes an NET_R_LOGON_CTRL2 structure. ********************************************************************/ -BOOL net_io_r_logon_ctrl2(char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, int depth) + +BOOL net_io_r_logon_ctrl2(char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, int depth) { - if (r_l == NULL) return False; + if (r_l == NULL) + return False; prs_debug(ps, depth, desc, "net_io_r_logon_ctrl2"); depth++; - prs_uint32("switch_value ", ps, depth, &(r_l->switch_value )); - prs_uint32("ptr ", ps, depth, &(r_l->ptr )); - - if (r_l->ptr != 0) - { - switch (r_l->switch_value) - { - case 1: - { - net_io_netinfo_1("", &(r_l->logon.info1), ps, depth); - break; - } - case 2: - { - net_io_netinfo_2("", &(r_l->logon.info2), ps, depth); - break; - } - case 3: - { - net_io_netinfo_3("", &(r_l->logon.info3), ps, depth); - break; - } - default: - { - DEBUG(2,("net_io_r_logon_ctrl2: unsupported switch value %d\n", - r_l->switch_value)); - break; - } + 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; } } - prs_uint32("status ", ps, depth, &(r_l->status )); + if(!prs_uint32("status ", ps, depth, &r_l->status)) + return False; return True; } /******************************************************************* -makes an NET_R_TRUST_DOM_LIST structure. + Inits an NET_R_TRUST_DOM_LIST structure. ********************************************************************/ -BOOL make_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, - uint32 num_doms, char **dom_name) + +void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, + uint32 num_doms, char *dom_name) { - if (r_t == NULL) return False; + int i = 0; DEBUG(5,("make_r_trust_dom\n")); - make_buffer2_multi(&r_t->uni_trust_dom_name, - dom_name, num_doms); - if (num_doms == 0) - { - r_t->uni_trust_dom_name.buf_max_len = 0x2; - r_t->uni_trust_dom_name.buf_len = 0x2; + 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(domain_name); + init_unistr2(&r_t->uni_trust_dom_name[i], domain_name, strlen(domain_name)+1); + /* the use of UNISTR2 here is non-standard. */ + r_t->uni_trust_dom_name[i].undoc = 0x1; } - r_t->uni_trust_dom_name.undoc = 0x1; r_t->status = 0; - - return True; } /******************************************************************* -reads or writes an NET_R_TRUST_DOM_LIST structure. + Reads or writes an NET_R_TRUST_DOM_LIST structure. ********************************************************************/ -BOOL net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth) + +BOOL net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth) { - if (r_t == NULL) return False; + int i; + if (r_t == NULL) + return False; prs_debug(ps, depth, desc, "net_io_r_trust_dom"); depth++; - smb_io_buffer2("", &r_t->uni_trust_dom_name, True, ps, depth); - prs_align(ps); + 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; + } - prs_uint32("status", ps, depth, &(r_t->status)); + if(!prs_uint32("status", ps, depth, &r_t->status)) + return False; return True; } /******************************************************************* -reads or writes an NET_Q_TRUST_DOM_LIST structure. + Reads or writes an NET_Q_TRUST_DOM_LIST structure. ********************************************************************/ -BOOL net_io_q_trust_dom(char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, int depth) + +BOOL net_io_q_trust_dom(char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, int depth) { - if (q_l == NULL) return False; + if (q_l == NULL) + return False; prs_debug(ps, depth, desc, "net_io_q_trust_dom"); depth++; - prs_uint32("ptr", ps, depth, &(q_l->ptr)); - smb_io_unistr2 ("name", &(q_l->uni_server_name), q_l->ptr, ps, 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; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("function_code", ps, depth, &(q_l->function_code)); + if(!prs_uint32("function_code", ps, depth, &q_l->function_code)) + return False; return True; } /******************************************************************* -makes an NET_Q_REQ_CHAL structure. + Inits an NET_Q_REQ_CHAL structure. ********************************************************************/ -BOOL make_q_req_chal(NET_Q_REQ_CHAL *q_c, - const char *logon_srv, const char *logon_clnt, + +void init_q_req_chal(NET_Q_REQ_CHAL *q_c, + char *logon_srv, char *logon_clnt, DOM_CHAL *clnt_chal) { - if (q_c == NULL) return False; - DEBUG(5,("make_q_req_chal: %d\n", __LINE__)); q_c->undoc_buffer = 1; /* don't know what this buffer is */ - make_unistr2(&(q_c->uni_logon_srv ), logon_srv , strlen(logon_srv )+1); - make_unistr2(&(q_c->uni_logon_clnt), logon_clnt, strlen(logon_clnt)+1); + init_unistr2(&q_c->uni_logon_srv, logon_srv , strlen(logon_srv )+1); + init_unistr2(&q_c->uni_logon_clnt, logon_clnt, strlen(logon_clnt)+1); memcpy(q_c->clnt_chal.data, clnt_chal->data, sizeof(clnt_chal->data)); DEBUG(5,("make_q_req_chal: %d\n", __LINE__)); - - return True; } /******************************************************************* -reads or writes an NET_Q_REQ_CHAL structure. + Reads or writes an NET_Q_REQ_CHAL structure. ********************************************************************/ + BOOL net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int depth) { int old_align; - if (q_c == NULL) return False; + + if (q_c == NULL) + return False; prs_debug(ps, depth, desc, "net_io_q_req_chal"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("undoc_buffer", ps, depth, &(q_c->undoc_buffer)); + if(!prs_uint32("undoc_buffer", ps, depth, &q_c->undoc_buffer)) + return False; - smb_io_unistr2("", &(q_c->uni_logon_srv ), True, ps, depth); /* logon server unicode string */ - smb_io_unistr2("", &(q_c->uni_logon_clnt), True, ps, depth); /* logon client unicode string */ + 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; old_align = ps->align; ps->align = 0; /* client challenge is _not_ aligned after the unicode strings */ - smb_io_chal("", &(q_c->clnt_chal), ps, depth); /* client challenge */ + if(!smb_io_chal("", &q_c->clnt_chal, ps, depth)) { + /* client challenge */ + ps->align = old_align; + return False; + } ps->align = old_align; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int depth) + +BOOL net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int depth) { - if (r_c == NULL) return False; + if (r_c == NULL) + return False; prs_debug(ps, depth, desc, "net_io_r_req_chal"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_chal("", &(r_c->srv_chal), ps, depth); /* server challenge */ + if(!smb_io_chal("", &r_c->srv_chal, ps, depth)) /* server challenge */ + return False; - prs_uint32("status", ps, depth, &(r_c->status)); + if(!prs_uint32("status", ps, depth, &r_c->status)) + return False; return True; } -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL make_q_auth(NET_Q_AUTH *q_a, - const char *logon_srv, const char *acct_name, - uint16 sec_chan, const char *comp_name, - DOM_CHAL *clnt_chal) -{ - if (q_a == NULL) return False; - - DEBUG(5,("make_q_auth: %d\n", __LINE__)); - - make_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)); - - DEBUG(5,("make_q_auth: %d\n", __LINE__)); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL net_io_q_auth(char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth) -{ - int old_align; - if (q_a == NULL) return False; - - prs_debug(ps, depth, desc, "net_io_q_auth"); - depth++; - - prs_align(ps); - - smb_io_log_info ("", &(q_a->clnt_id), ps, depth); /* client identification info */ - /* client challenge is _not_ aligned */ - old_align = ps->align; - ps->align = 0; - smb_io_chal ("", &(q_a->clnt_chal), ps, depth); /* client-calculated credentials */ - ps->align = old_align; - - return True; -} /******************************************************************* -reads or writes a structure. + Inits a NET_Q_AUTH_2 struct. ********************************************************************/ -BOOL net_io_r_auth(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++; - - prs_align(ps); - - smb_io_chal ("", &(r_a->srv_chal), ps, depth); /* server challenge */ - prs_uint32("status", ps, depth, &(r_a->status)); - - return True; -} -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL make_q_auth_2(NET_Q_AUTH_2 *q_a, - const char *logon_srv, const char *acct_name, - uint16 sec_chan, const char *comp_name, +void init_q_auth_2(NET_Q_AUTH_2 *q_a, + char *logon_srv, char *acct_name, uint16 sec_chan, char *comp_name, DOM_CHAL *clnt_chal, uint32 clnt_flgs) { - if (q_a == NULL) return False; - - DEBUG(5,("make_q_auth_2: %d\n", __LINE__)); + DEBUG(5,("init_q_auth_2: %d\n", __LINE__)); - make_log_info(&(q_a->clnt_id), logon_srv, acct_name, sec_chan, comp_name); + 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,("make_q_auth_2: %d\n", __LINE__)); - - return True; + DEBUG(5,("init_q_auth_2: %d\n", __LINE__)); } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL net_io_q_auth_2(char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth) + +BOOL net_io_q_auth_2(char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth) { int old_align; - if (q_a == NULL) return False; + if (q_a == NULL) + return False; prs_debug(ps, depth, desc, "net_io_q_auth_2"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_log_info ("", &(q_a->clnt_id), ps, depth); /* client identification info */ + if(!smb_io_log_info ("", &q_a->clnt_id, ps, depth)) /* client identification info */ + return False; /* client challenge is _not_ aligned */ old_align = ps->align; ps->align = 0; - smb_io_chal ("", &(q_a->clnt_chal), ps, depth); /* client-calculated credentials */ + if(!smb_io_chal("", &q_a->clnt_chal, ps, depth)) { + /* client-calculated credentials */ + ps->align = old_align; + return False; + } ps->align = old_align; - net_io_neg_flags("", &(q_a->clnt_flgs), ps, depth); + if(!net_io_neg_flags("", &q_a->clnt_flgs, ps, depth)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth) + +BOOL net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth) { - if (r_a == NULL) return False; + if (r_a == NULL) + return False; prs_debug(ps, depth, desc, "net_io_r_auth_2"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_chal ("", &(r_a->srv_chal), ps, depth); /* server challenge */ - net_io_neg_flags("", &(r_a->srv_flgs), ps, depth); + 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; - prs_uint32("status", ps, depth, &(r_a->status)); + if(!prs_uint32("status", ps, depth, &r_a->status)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Inits a NET_Q_SRV_PWSET. ********************************************************************/ -BOOL make_q_srv_pwset(NET_Q_SRV_PWSET *q_s, - const char *logon_srv, const char *acct_name, - uint16 sec_chan, const char *comp_name, - DOM_CRED *cred, char nt_cypher[16]) -{ - if (q_s == NULL || cred == NULL) return False; +void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char *logon_srv, char *acct_name, + uint16 sec_chan, char *comp_name, DOM_CRED *cred, char nt_cypher[16]) +{ DEBUG(5,("make_q_srv_pwset\n")); - make_clnt_info(&(q_s->clnt_id), logon_srv, acct_name, sec_chan, comp_name, cred); + 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)); - - return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL net_io_q_srv_pwset(char *desc, NET_Q_SRV_PWSET *q_s, prs_struct *ps, int depth) + +BOOL net_io_q_srv_pwset(char *desc, NET_Q_SRV_PWSET *q_s, prs_struct *ps, int depth) { - if (q_s == NULL) return False; + if (q_s == NULL) + return False; prs_debug(ps, depth, desc, "net_io_q_srv_pwset"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_clnt_info("", &(q_s->clnt_id), ps, depth); /* client identification/authentication info */ - prs_uint8s (False, "pwd", ps, depth, q_s->pwd, 16); /* new password - undocumented */ + 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. + Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int depth) + +BOOL net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int depth) { - if (r_s == NULL) return False; + if (r_s == NULL) + return False; prs_debug(ps, depth, desc, "net_io_r_srv_pwset"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_cred("", &(r_s->srv_cred), ps, depth); /* server challenge */ + if(!smb_io_cred("", &r_s->srv_cred, ps, depth)) /* server challenge */ + return False; - prs_uint32("status", ps, depth, &(r_s->status)); + if(!prs_uint32("status", ps, depth, &r_s->status)) + return False; return True; } - /************************************************************************* - make DOM_SID2 array from a string containing multiple sids + Init DOM_SID2 array from a string containing multiple sids *************************************************************************/ -static int make_dom_sid2s(char *sids_str, DOM_SID2 *sids, int max_sids) + +static int init_dom_sid2s(char *sids_str, DOM_SID2 *sids, int max_sids) { char *ptr; pstring s2; - int count; + int count = 0; - DEBUG(4,("make_dom_sid2s: %s\n", sids_str ? sids_str:"")); + DEBUG(4,("init_dom_sid2s: %s\n", sids_str ? sids_str:"")); - if (sids_str == NULL || *sids_str == 0) return 0; - - for (count = 0, ptr = sids_str; - next_token(&ptr, s2, NULL, sizeof(s2)) && count < max_sids; - count++) - { - DOM_SID tmpsid; - string_to_sid(&tmpsid, s2); - make_dom_sid2(&sids[count], &tmpsid); + if(sids_str) { + for (count = 0, ptr = sids_str; + next_token(&ptr, s2, NULL, sizeof(s2)) && count < max_sids; count++) { + DOM_SID tmpsid; + string_to_sid(&tmpsid, s2); + init_dom_sid2(&sids[count], &tmpsid); + } } return count; - - return True; } /******************************************************************* -makes a NET_ID_INFO_1 structure. + Inits a NET_ID_INFO_1 structure. ********************************************************************/ -BOOL make_id_info1(NET_ID_INFO_1 *id, const char *domain_name, + +void init_id_info1(NET_ID_INFO_1 *id, char *domain_name, uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, - const char *user_name, const char *wksta_name, + char *user_name, char *wksta_name, char sess_key[16], unsigned char lm_cypher[16], unsigned char nt_cypher[16]) { @@ -673,30 +646,26 @@ BOOL make_id_info1(NET_ID_INFO_1 *id, const char *domain_name, unsigned char lm_owf[16]; unsigned char nt_owf[16]; - if (id == NULL) return False; - DEBUG(5,("make_id_info1: %d\n", __LINE__)); id->ptr_id_info1 = 1; - make_uni_hdr(&(id->hdr_domain_name), len_domain_name); + init_uni_hdr(&id->hdr_domain_name, len_domain_name); id->param_ctrl = param_ctrl; - id->logon_id.low = log_id_low; - id->logon_id.high = log_id_high; + init_logon_id(&id->logon_id, log_id_low, log_id_high); - make_uni_hdr(&(id->hdr_user_name ), len_user_name ); - make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name ); + init_uni_hdr(&id->hdr_user_name, len_user_name); + init_uni_hdr(&id->hdr_wksta_name, len_wksta_name); - if (lm_cypher && nt_cypher) - { + if (lm_cypher && nt_cypher) { unsigned char key[16]; #ifdef DEBUG_PASSWORD DEBUG(100,("lm cypher:")); - dump_data(100, lm_cypher, 16); + dump_data(100, (char *)lm_cypher, 16); DEBUG(100,("nt cypher:")); - dump_data(100, nt_cypher, 16); + dump_data(100, (char *)nt_cypher, 16); #endif memset(key, 0, 16); @@ -709,63 +678,77 @@ BOOL make_id_info1(NET_ID_INFO_1 *id, const char *domain_name, #ifdef DEBUG_PASSWORD DEBUG(100,("encrypt of lm owf password:")); - dump_data(100, lm_owf, 16); + dump_data(100, (char *)lm_owf, 16); DEBUG(100,("encrypt of nt owf password:")); - dump_data(100, nt_owf, 16); + dump_data(100, (char *)nt_owf, 16); #endif /* set up pointers to cypher blocks */ lm_cypher = lm_owf; nt_cypher = nt_owf; } - make_owf_info(&(id->lm_owf), lm_cypher); - make_owf_info(&(id->nt_owf), nt_cypher); - - make_unistr2(&(id->uni_domain_name), domain_name, len_domain_name); - make_unistr2(&(id->uni_user_name ), user_name , len_user_name ); - make_unistr2(&(id->uni_wksta_name ), wksta_name , len_wksta_name ); + init_owf_info(&id->lm_owf, lm_cypher); + init_owf_info(&id->nt_owf, nt_cypher); - return True; + init_unistr2(&id->uni_domain_name, domain_name, len_domain_name); + init_unistr2(&id->uni_user_name, user_name, len_user_name); + init_unistr2(&id->uni_wksta_name, wksta_name, len_wksta_name); } /******************************************************************* -reads or writes an NET_ID_INFO_1 structure. + Reads or writes an NET_ID_INFO_1 structure. ********************************************************************/ + static BOOL net_io_id_info1(char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth) { - if (id == NULL) return False; + if (id == NULL) + return False; prs_debug(ps, depth, desc, "net_io_id_info1"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr_id_info1", ps, depth, &(id->ptr_id_info1)); + if(!prs_uint32("ptr_id_info1", ps, depth, &id->ptr_id_info1)) + return False; - if (id->ptr_id_info1 != 0) - { - smb_io_unihdr("unihdr", &(id->hdr_domain_name), ps, depth); + if (id->ptr_id_info1 != 0) { + if(!smb_io_unihdr("unihdr", &id->hdr_domain_name, ps, depth)) + return False; - prs_uint32("param_ctrl", ps, depth, &(id->param_ctrl)); - smb_io_bigint("", &(id->logon_id), ps, depth); + if(!prs_uint32("param_ctrl", ps, depth, &id->param_ctrl)) + return False; + if(!smb_io_logon_id("", &id->logon_id, ps, depth)) + return False; - smb_io_unihdr("unihdr", &(id->hdr_user_name ), ps, depth); - smb_io_unihdr("unihdr", &(id->hdr_wksta_name ), ps, depth); + 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; - smb_io_owf_info("", &(id->lm_owf), ps, depth); - smb_io_owf_info("", &(id->nt_owf), ps, depth); + if(!smb_io_owf_info("", &id->lm_owf, ps, depth)) + return False; + if(!smb_io_owf_info("", &id->nt_owf, ps, depth)) + return False; - smb_io_unistr2("unistr2", &(id->uni_domain_name), id->hdr_domain_name.buffer, ps, depth); - smb_io_unistr2("unistr2", &(id->uni_user_name ), id->hdr_user_name.buffer, ps, depth); - smb_io_unistr2("unistr2", &(id->uni_wksta_name ), id->hdr_wksta_name.buffer, ps, depth); + 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; } /******************************************************************* -makes a NET_ID_INFO_2 structure. +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 @@ -779,10 +762,9 @@ checking for a logon as it doesn't export the password hashes to anyone who has compromised the secure channel. JRA. ********************************************************************/ -BOOL make_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, +void init_id_info2(NET_ID_INFO_2 *id, char *domain_name, + uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, + char *user_name, char *wksta_name, unsigned char lm_challenge[8], unsigned char lm_chal_resp[24], unsigned char nt_chal_resp[24]) @@ -790,87 +772,101 @@ BOOL make_id_info2(NET_ID_INFO_2 *id, const char *domain_name, int len_domain_name = strlen(domain_name); int len_user_name = strlen(user_name ); int len_wksta_name = strlen(wksta_name ); - int nt_chal_resp_len = ((nt_chal_resp != NULL) ? 24 : 0); + int nt_chal_resp_len = ((nt_chal_resp != NULL) ? 24 : 0); int lm_chal_resp_len = ((lm_chal_resp != NULL) ? 24 : 0); unsigned char lm_owf[24]; unsigned char nt_owf[24]; - if (id == NULL) return False; - - DEBUG(5,("make_id_info2: %d\n", __LINE__)); + DEBUG(5,("init_id_info2: %d\n", __LINE__)); id->ptr_id_info2 = 1; - make_uni_hdr(&(id->hdr_domain_name), len_domain_name); + init_uni_hdr(&id->hdr_domain_name, len_domain_name); id->param_ctrl = param_ctrl; - id->logon_id.low = log_id_low; - id->logon_id.high = log_id_high; + init_logon_id(&id->logon_id, log_id_low, log_id_high); - make_uni_hdr(&(id->hdr_user_name ), len_user_name ); - make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name ); + init_uni_hdr(&id->hdr_user_name, len_user_name); + init_uni_hdr(&id->hdr_wksta_name, len_wksta_name); - if (nt_chal_resp) - { + if (nt_chal_resp) { /* oops. can only send what-ever-it-is direct */ memcpy(nt_owf, nt_chal_resp, 24); nt_chal_resp = nt_owf; } - if (lm_chal_resp) - { + if (lm_chal_resp) { /* oops. can only send what-ever-it-is direct */ memcpy(lm_owf, lm_chal_resp, 24); lm_chal_resp = lm_owf; } memcpy(id->lm_chal, lm_challenge, sizeof(id->lm_chal)); - make_str_hdr(&(id->hdr_nt_chal_resp), 24, nt_chal_resp_len, nt_chal_resp != NULL ? 1 : 0); - make_str_hdr(&(id->hdr_lm_chal_resp), 24, lm_chal_resp_len, lm_chal_resp != NULL ? 1 : 0); - - make_unistr2(&(id->uni_domain_name), domain_name, len_domain_name); - make_unistr2(&(id->uni_user_name ), user_name , len_user_name ); - make_unistr2(&(id->uni_wksta_name ), wksta_name , len_wksta_name ); + init_str_hdr(&id->hdr_nt_chal_resp, 24, nt_chal_resp_len, (nt_chal_resp != NULL) ? 1 : 0); + init_str_hdr(&id->hdr_lm_chal_resp, 24, lm_chal_resp_len, (lm_chal_resp != NULL) ? 1 : 0); - make_string2(&(id->nt_chal_resp ), (char *)nt_chal_resp , nt_chal_resp_len); - make_string2(&(id->lm_chal_resp ), (char *)lm_chal_resp , lm_chal_resp_len); + init_unistr2(&id->uni_domain_name, domain_name, len_domain_name); + init_unistr2(&id->uni_user_name, user_name, len_user_name); + init_unistr2(&id->uni_wksta_name, wksta_name, len_wksta_name); - return True; + init_string2(&id->nt_chal_resp, (char *)nt_chal_resp, nt_chal_resp_len); + init_string2(&id->lm_chal_resp, (char *)lm_chal_resp, lm_chal_resp_len); } /******************************************************************* -reads or writes an NET_ID_INFO_2 structure. + Reads or writes an NET_ID_INFO_2 structure. ********************************************************************/ + static BOOL net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int depth) { - if (id == NULL) return False; + if (id == NULL) + return False; prs_debug(ps, depth, desc, "net_io_id_info2"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr_id_info2", ps, depth, &(id->ptr_id_info2)); + if(!prs_uint32("ptr_id_info2", ps, depth, &id->ptr_id_info2)) + return False; - if (id->ptr_id_info2 != 0) - { - smb_io_unihdr("unihdr", &(id->hdr_domain_name), ps, depth); + if (id->ptr_id_info2 != 0) { + if(!smb_io_unihdr("unihdr", &id->hdr_domain_name, ps, depth)) + return False; - prs_uint32("param_ctrl", ps, depth, &(id->param_ctrl)); - smb_io_bigint("", &(id->logon_id), ps, depth); + if(!prs_uint32("param_ctrl", ps, depth, &id->param_ctrl)) + return False; + if(!smb_io_logon_id("", &id->logon_id, ps, depth)) + return False; - smb_io_unihdr("unihdr", &(id->hdr_user_name ), ps, depth); - smb_io_unihdr("unihdr", &(id->hdr_wksta_name ), ps, depth); + 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; - prs_uint8s (False, "lm_chal", ps, depth, id->lm_chal, 8); /* lm 8 byte challenge */ + if(!prs_uint8s (False, "lm_chal", ps, depth, id->lm_chal, 8)) /* lm 8 byte challenge */ + return False; - smb_io_strhdr("hdr_nt_chal_resp", &(id->hdr_nt_chal_resp ), ps, depth); - smb_io_strhdr("hdr_lm_chal_resp", &(id->hdr_lm_chal_resp ), ps, depth); + 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; - smb_io_unistr2("uni_domain_name", &(id->uni_domain_name), id->hdr_domain_name .buffer, ps, depth); - smb_io_unistr2("uni_user_name ", &(id->uni_user_name ), id->hdr_user_name .buffer, ps, depth); - smb_io_unistr2("uni_wksta_name ", &(id->uni_wksta_name ), id->hdr_wksta_name .buffer, ps, depth); - smb_io_string2("nt_chal_resp" , &(id->nt_chal_resp) , id->hdr_nt_chal_resp.buffer, ps, depth); - smb_io_string2("lm_chal_resp" , &(id->lm_chal_resp) , id->hdr_lm_chal_resp.buffer, ps, depth); + 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; @@ -878,104 +874,103 @@ static BOOL net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int /******************************************************************* -makes a DOM_SAM_INFO structure. + Inits a DOM_SAM_INFO structure. ********************************************************************/ -BOOL make_sam_info(DOM_SAM_INFO *sam, - const char *logon_srv, const char *comp_name, - DOM_CRED *clnt_cred, + +void init_sam_info(DOM_SAM_INFO *sam, + char *logon_srv, char *comp_name, DOM_CRED *clnt_cred, DOM_CRED *rtn_cred, uint16 logon_level, NET_ID_INFO_CTR *ctr) { - if (sam == NULL) return False; - - DEBUG(5,("make_sam_info: %d\n", __LINE__)); + DEBUG(5,("init_sam_info: %d\n", __LINE__)); - make_clnt_info2(&(sam->client), logon_srv, comp_name, clnt_cred); + init_clnt_info2(&(sam->client), logon_srv, comp_name, clnt_cred); - if (rtn_cred != NULL) - { + if (rtn_cred != NULL) { sam->ptr_rtn_cred = 1; - memcpy(&(sam->rtn_cred), rtn_cred, sizeof(sam->rtn_cred)); - } - else - { + memcpy(&sam->rtn_cred, rtn_cred, sizeof(sam->rtn_cred)); + } else { sam->ptr_rtn_cred = 0; } sam->logon_level = logon_level; sam->ctr = ctr; - - return True; } /******************************************************************* -reads or writes a DOM_SAM_INFO structure. + Reads or writes a DOM_SAM_INFO structure. ********************************************************************/ -static BOOL net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR *ctr, prs_struct *ps, int depth) + +static BOOL net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR *ctr, prs_struct *ps, int depth) { - if (ctr == NULL) return False; + if (ctr == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_sam_info"); depth++; /* don't 4-byte align here! */ - prs_uint16("switch_value ", ps, depth, &(ctr->switch_value)); + if(!prs_uint16("switch_value ", ps, depth, &ctr->switch_value)) + return False; - switch (ctr->switch_value) - { - case 1: - { - net_io_id_info1("", &(ctr->auth.id1), ps, depth); - break; - } - case 2: - { - net_io_id_info2("", &(ctr->auth.id2), ps, depth); - break; - } - default: - { - /* PANIC! */ - DEBUG(4,("smb_io_sam_info: unknown switch_value!\n")); - break; - } + 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: unknown switch_value!\n")); + break; } return True; } /******************************************************************* -reads or writes a DOM_SAM_INFO structure. -********************************************************************/ -static BOOL smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int depth) + Reads or writes a DOM_SAM_INFO structure. + ********************************************************************/ + +static BOOL smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int depth) { - if (sam == NULL) return False; + if (sam == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_sam_info"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_clnt_info2("", &(sam->client ), ps, depth); + if(!smb_io_clnt_info2("", &sam->client, ps, depth)) + return False; - prs_uint32("ptr_rtn_cred ", ps, depth, &(sam->ptr_rtn_cred)); - smb_io_cred ("", &(sam->rtn_cred), ps, depth); + if(!prs_uint32("ptr_rtn_cred ", ps, depth, &sam->ptr_rtn_cred)) + return False; + if(!smb_io_cred("", &sam->rtn_cred, ps, depth)) + return False; - prs_uint16("logon_level ", ps, depth, &(sam->logon_level )); + if(!prs_uint16("logon_level ", ps, depth, &sam->logon_level)) + return False; - if (sam->logon_level != 0 && sam->ctr != NULL) - { - net_io_id_info_ctr("logon_info", sam->ctr, ps, depth); + if (sam->logon_level != 0 && sam->ctr != NULL) { + if(!net_io_id_info_ctr("logon_info", sam->ctr, ps, depth)) + return False; } return True; } /************************************************************************* - make_net_user_info3 + Init *************************************************************************/ -BOOL make_net_user_info3(NET_USER_INFO_3 *usr, + +void init_net_user_info3(NET_USER_INFO_3 *usr, NTTIME *logon_time, NTTIME *logoff_time, @@ -1010,7 +1005,7 @@ BOOL make_net_user_info3(NET_USER_INFO_3 *usr, { /* only cope with one "other" sid, right now. */ /* need to count the number of space-delimited sids */ - uint32 i; + int i; int num_other_sids = 0; int len_user_name = strlen(user_name ); @@ -1023,6 +1018,8 @@ BOOL make_net_user_info3(NET_USER_INFO_3 *usr, int len_logon_srv = strlen(logon_srv); int len_logon_dom = strlen(logon_dom); + memset(usr, '\0', sizeof(*usr)); + usr->ptr_user_info = 1; /* yes, we're bothering to put USER_INFO data here */ usr->logon_time = *logon_time; @@ -1032,12 +1029,12 @@ BOOL make_net_user_info3(NET_USER_INFO_3 *usr, usr->pass_can_change_time = *pass_can_change_time; usr->pass_must_change_time = *pass_must_change_time; - make_uni_hdr(&(usr->hdr_user_name ), len_user_name ); - make_uni_hdr(&(usr->hdr_full_name ), len_full_name ); - make_uni_hdr(&(usr->hdr_logon_script), len_logon_script); - make_uni_hdr(&(usr->hdr_profile_path), len_profile_path); - make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir ); - make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive ); + init_uni_hdr(&usr->hdr_user_name, len_user_name); + init_uni_hdr(&usr->hdr_full_name, len_full_name); + init_uni_hdr(&usr->hdr_logon_script, len_logon_script); + init_uni_hdr(&usr->hdr_profile_path, len_profile_path); + init_uni_hdr(&usr->hdr_home_dir, len_home_dir); + init_uni_hdr(&usr->hdr_dir_drive, len_dir_drive); usr->logon_count = logon_count; usr->bad_pw_count = bad_pw_count; @@ -1049,835 +1046,274 @@ BOOL make_net_user_info3(NET_USER_INFO_3 *usr, usr->user_flgs = user_flgs; if (sess_key != NULL) - { memcpy(usr->user_sess_key, sess_key, sizeof(usr->user_sess_key)); - } else - { - bzero(usr->user_sess_key, sizeof(usr->user_sess_key)); - } + memset((char *)usr->user_sess_key, '\0', sizeof(usr->user_sess_key)); - make_uni_hdr(&(usr->hdr_logon_srv), len_logon_srv); - make_uni_hdr(&(usr->hdr_logon_dom), len_logon_dom); + init_uni_hdr(&usr->hdr_logon_srv, len_logon_srv); + init_uni_hdr(&usr->hdr_logon_dom, len_logon_dom); usr->buffer_dom_id = dom_sid ? 1 : 0; /* yes, we're bothering to put a domain SID in */ - bzero(usr->padding, sizeof(usr->padding)); + memset((char *)usr->padding, '\0', sizeof(usr->padding)); - num_other_sids = make_dom_sid2s(other_sids, usr->other_sids, LSA_MAX_SIDS); + num_other_sids = init_dom_sid2s(other_sids, usr->other_sids, LSA_MAX_SIDS); usr->num_other_sids = num_other_sids; - usr->buffer_other_sids = num_other_sids != 0 ? 1 : 0; + usr->buffer_other_sids = (num_other_sids != 0) ? 1 : 0; - make_unistr2(&(usr->uni_user_name ), user_name , len_user_name ); - make_unistr2(&(usr->uni_full_name ), full_name , len_full_name ); - make_unistr2(&(usr->uni_logon_script), logon_script, len_logon_script); - make_unistr2(&(usr->uni_profile_path), profile_path, len_profile_path); - make_unistr2(&(usr->uni_home_dir ), home_dir , len_home_dir ); - make_unistr2(&(usr->uni_dir_drive ), dir_drive , len_dir_drive ); + init_unistr2(&usr->uni_user_name, user_name, len_user_name); + init_unistr2(&usr->uni_full_name, full_name, len_full_name); + init_unistr2(&usr->uni_logon_script, logon_script, len_logon_script); + init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path); + init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); + init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); usr->num_groups2 = num_groups; SMB_ASSERT_ARRAY(usr->gids, num_groups); for (i = 0; i < num_groups; i++) - { usr->gids[i] = gids[i]; - } - make_unistr2(&(usr->uni_logon_srv), logon_srv, len_logon_srv); - make_unistr2(&(usr->uni_logon_dom), logon_dom, len_logon_dom); + init_unistr2(&usr->uni_logon_srv, logon_srv, len_logon_srv); + init_unistr2(&usr->uni_logon_dom, logon_dom, len_logon_dom); - make_dom_sid2(&(usr->dom_sid), dom_sid); + init_dom_sid2(&usr->dom_sid, dom_sid); /* "other" sids are set up above */ - - return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth) + +static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth) { - uint32 i; + int i; - if (usr == NULL) return False; + if (usr == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_lsa_user_info"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr_user_info ", ps, depth, &(usr->ptr_user_info)); - - if (usr->ptr_user_info != 0) - { - smb_io_time("time", &(usr->logon_time) , ps, depth); /* logon time */ - smb_io_time("time", &(usr->logoff_time) , ps, depth); /* logoff time */ - smb_io_time("time", &(usr->kickoff_time) , ps, depth); /* kickoff time */ - smb_io_time("time", &(usr->pass_last_set_time) , ps, depth); /* password last set time */ - smb_io_time("time", &(usr->pass_can_change_time) , ps, depth); /* password can change time */ - smb_io_time("time", &(usr->pass_must_change_time), ps, depth); /* password must change time */ - - smb_io_unihdr("unihdr", &(usr->hdr_user_name) , ps, depth); /* username unicode string header */ - smb_io_unihdr("unihdr", &(usr->hdr_full_name) , ps, depth); /* user's full name unicode string header */ - smb_io_unihdr("unihdr", &(usr->hdr_logon_script), ps, depth); /* logon script unicode string header */ - smb_io_unihdr("unihdr", &(usr->hdr_profile_path), ps, depth); /* profile path unicode string header */ - smb_io_unihdr("unihdr", &(usr->hdr_home_dir) , ps, depth); /* home directory unicode string header */ - smb_io_unihdr("unihdr", &(usr->hdr_dir_drive) , ps, depth); /* home directory drive unicode string header */ - - prs_uint16("logon_count ", ps, depth, &(usr->logon_count )); /* logon count */ - prs_uint16("bad_pw_count ", ps, depth, &(usr->bad_pw_count)); /* bad password count */ - - prs_uint32("user_id ", ps, depth, &(usr->user_id )); /* User ID */ - prs_uint32("group_id ", ps, depth, &(usr->group_id )); /* Group ID */ - prs_uint32("num_groups ", ps, depth, &(usr->num_groups )); /* num groups */ - prs_uint32("buffer_groups ", ps, depth, &(usr->buffer_groups)); /* undocumented buffer pointer to groups. */ - prs_uint32("user_flgs ", ps, depth, &(usr->user_flgs )); /* user flags */ - - prs_uint8s (False, "user_sess_key", ps, depth, usr->user_sess_key, 16); /* unused user session key */ - - smb_io_unihdr("unihdr", &(usr->hdr_logon_srv), ps, depth); /* logon server unicode string header */ - smb_io_unihdr("unihdr", &(usr->hdr_logon_dom), ps, depth); /* logon domain unicode string header */ - - prs_uint32("buffer_dom_id ", ps, depth, &(usr->buffer_dom_id)); /* undocumented logon domain id pointer */ - prs_uint8s (False, "padding ", ps, depth, usr->padding, 40); /* unused padding bytes? */ - - prs_uint32("num_other_sids", ps, depth, &(usr->num_other_sids)); /* 0 - num_sids */ - prs_uint32("buffer_other_sids", ps, depth, &(usr->buffer_other_sids)); /* NULL - undocumented pointer to SIDs. */ + 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("time", &usr->logon_time, ps, depth)) /* logon time */ + return False; + if(!smb_io_time("time", &usr->logoff_time, ps, depth)) /* logoff time */ + return False; + if(!smb_io_time("time", &usr->kickoff_time, ps, depth)) /* kickoff time */ + return False; + if(!smb_io_time("time", &usr->pass_last_set_time, ps, depth)) /* password last set time */ + return False; + if(!smb_io_time("time", &usr->pass_can_change_time , ps, depth)) /* password can change time */ + return False; + if(!smb_io_time("time", &usr->pass_must_change_time, ps, depth)) /* password must change time */ + return False; + + if(!smb_io_unihdr("unihdr", &usr->hdr_user_name, ps, depth)) /* username unicode string header */ + return False; + if(!smb_io_unihdr("unihdr", &usr->hdr_full_name, ps, depth)) /* user's full name unicode string header */ + return False; + if(!smb_io_unihdr("unihdr", &usr->hdr_logon_script, ps, depth)) /* logon script unicode string header */ + return False; + if(!smb_io_unihdr("unihdr", &usr->hdr_profile_path, ps, depth)) /* profile path unicode string header */ + return False; + if(!smb_io_unihdr("unihdr", &usr->hdr_home_dir, ps, depth)) /* home directory unicode string header */ + return False; + if(!smb_io_unihdr("unihdr", &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_id ", ps, depth, &usr->user_id)) /* User ID */ + return False; + if(!prs_uint32("group_id ", ps, depth, &usr->group_id)) /* Group ID */ + 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; + + if(!prs_uint8s(False, "user_sess_key", ps, depth, usr->user_sess_key, 16)) /* unused user session key */ + return False; + + if(!smb_io_unihdr("unihdr", &usr->hdr_logon_srv, ps, depth)) /* logon server unicode string header */ + return False; + if(!smb_io_unihdr("unihdr", &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, "padding ", ps, depth, usr->padding, 40)) /* unused padding bytes? */ + return False; + + 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; - smb_io_unistr2("unistr2", &(usr->uni_user_name) , usr->hdr_user_name .buffer, ps, depth); /* username unicode string */ - smb_io_unistr2("unistr2", &(usr->uni_full_name) , usr->hdr_full_name .buffer, ps, depth); /* user's full name unicode string */ - smb_io_unistr2("unistr2", &(usr->uni_logon_script), usr->hdr_logon_script.buffer, ps, depth); /* logon script unicode string */ - smb_io_unistr2("unistr2", &(usr->uni_profile_path), usr->hdr_profile_path.buffer, ps, depth); /* profile path unicode string */ - smb_io_unistr2("unistr2", &(usr->uni_home_dir) , usr->hdr_home_dir .buffer, ps, depth); /* home directory unicode string */ - smb_io_unistr2("unistr2", &(usr->uni_dir_drive) , usr->hdr_dir_drive .buffer, ps, depth); /* home directory drive unicode string */ - - prs_align(ps); - prs_uint32("num_groups2 ", ps, depth, &(usr->num_groups2)); /* num groups */ - SMB_ASSERT_ARRAY(usr->gids, usr->num_groups2); - for (i = 0; i < usr->num_groups2; i++) - { - smb_io_gid("", &(usr->gids[i]), ps, depth); /* group info */ - } + if(!smb_io_unistr2("unistr2", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */ + return False; + if(!smb_io_unistr2("unistr2", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth)) /* user's full name unicode string */ + return False; + if(!smb_io_unistr2("unistr2", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */ + return False; + if(!smb_io_unistr2("unistr2", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */ + return False; + if(!smb_io_unistr2("unistr2", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth)) /* home directory unicode string */ + return False; + if(!smb_io_unistr2("unistr2", &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 groups */ + return False; + SMB_ASSERT_ARRAY(usr->gids, usr->num_groups2); + for (i = 0; i < usr->num_groups2; i++) { + if(!smb_io_gid("", &usr->gids[i], ps, depth)) /* group info */ + return False; + } - smb_io_unistr2("unistr2", &( usr->uni_logon_srv), usr->hdr_logon_srv.buffer, ps, depth); /* logon server unicode string */ - smb_io_unistr2("unistr2", &( usr->uni_logon_dom), usr->hdr_logon_srv.buffer, ps, depth); /* logon domain unicode string */ + if(!smb_io_unistr2("unistr2", &usr->uni_logon_srv, usr->hdr_logon_srv.buffer, ps, depth)) /* logon server unicode string */ + return False; + if(!smb_io_unistr2("unistr2", &usr->uni_logon_dom, usr->hdr_logon_srv.buffer, ps, depth)) /* logon domain unicode string */ + return False; - smb_io_dom_sid2("", &(usr->dom_sid), ps, depth); /* domain SID */ + if(!smb_io_dom_sid2("", &usr->dom_sid, ps, depth)) /* domain SID */ + return False; - SMB_ASSERT_ARRAY(usr->other_sids, usr->num_other_sids); + SMB_ASSERT_ARRAY(usr->other_sids, usr->num_other_sids); - for (i = 0; i < usr->num_other_sids; i++) - { - smb_io_dom_sid2("", &(usr->other_sids[i]), ps, depth); /* other domain SIDs */ - } + 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; } return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL net_io_q_sam_logon(char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, int depth) + +BOOL net_io_q_sam_logon(char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, int depth) { - if (q_l == NULL) return False; + if (q_l == NULL) + return False; prs_debug(ps, depth, desc, "net_io_q_sam_logon"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_sam_info("", &(q_l->sam_id), ps, depth); /* domain SID */ - prs_uint16("validation_level", ps, depth, &(q_l->validation_level)); + if(!smb_io_sam_info("", &q_l->sam_id, ps, depth)) /* domain SID */ + return False; + if(!prs_uint16("validation_level", ps, depth, &q_l->validation_level)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_sam_logon(char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, int depth) + +BOOL net_io_r_sam_logon(char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, int depth) { - if (r_l == NULL) return False; + if (r_l == NULL) + return False; prs_debug(ps, depth, desc, "net_io_r_sam_logon"); depth++; - prs_uint32("buffer_creds", ps, depth, &(r_l->buffer_creds)); /* undocumented buffer pointer */ - smb_io_cred("", &(r_l->srv_creds), ps, depth); /* server credentials. server time stamp appears to be ignored. */ + 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; - prs_uint16("switch_value", ps, depth, &(r_l->switch_value)); - prs_align(ps); + if(!prs_uint16("switch_value", ps, depth, &r_l->switch_value)) + return False; + if(!prs_align(ps)) + return False; - if (r_l->switch_value != 0) - { - net_io_user_info3("", r_l->user, ps, depth); + if (r_l->switch_value != 0) { + if(!net_io_user_info3("", r_l->user, ps, depth)) + return False; } - prs_uint32("auth_resp ", ps, depth, &(r_l->auth_resp)); /* 1 - Authoritative response; 0 - Non-Auth? */ + if(!prs_uint32("auth_resp ", ps, depth, &r_l->auth_resp)) /* 1 - Authoritative response; 0 - Non-Auth? */ + return False; - prs_uint32("status ", ps, depth, &(r_l->status)); + if(!prs_uint32("status ", ps, depth, &r_l->status)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ + BOOL net_io_q_sam_logoff(char *desc, NET_Q_SAM_LOGOFF *q_l, prs_struct *ps, int depth) { - if (q_l == NULL) return False; + if (q_l == NULL) + return False; prs_debug(ps, depth, desc, "net_io_q_sam_logoff"); depth++; - prs_align(ps); - - smb_io_sam_info("", &(q_l->sam_id), ps, depth); /* domain SID */ - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL net_io_r_sam_logoff(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++; - - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("buffer_creds", ps, depth, &(r_l->buffer_creds)); /* undocumented buffer pointer */ - smb_io_cred("", &(r_l->srv_creds), ps, depth); /* server credentials. server time stamp appears to be ignored. */ - - prs_uint32("status ", ps, depth, &(r_l->status)); + if(!smb_io_sam_info("", &q_l->sam_id, ps, depth)) /* domain SID */ + return False; return True; } /******************************************************************* -makes a NET_Q_SAM_SYNC structure. + Reads or writes a structure. ********************************************************************/ -BOOL make_q_sam_sync(NET_Q_SAM_SYNC *q_s, - const char *srv_name, - const char *cli_name, - DOM_CRED *cli_creds, uint32 database_id) -{ - if (q_s == NULL) return False; - - DEBUG(5,("make_q_sam_sync\n")); - - make_unistr2(&(q_s->uni_srv_name), srv_name, strlen(srv_name)+1); - make_unistr2(&(q_s->uni_cli_name), cli_name, strlen(cli_name)+1); - - 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->restart_state = 0; - q_s->sync_context = 0; - q_s->max_size = 0xffff; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL net_io_q_sam_sync(char *desc, NET_Q_SAM_SYNC *q_s, prs_struct *ps, int depth) +BOOL net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int depth) { - if (q_s == NULL) return False; - - prs_debug(ps, depth, desc, "net_io_q_sam_sync"); - depth++; - - smb_io_unistr2("", &(q_s->uni_srv_name), True, ps, depth); - smb_io_unistr2("", &(q_s->uni_cli_name), True, ps, depth); - - smb_io_cred("", &(q_s->cli_creds), ps, depth); - smb_io_cred("", &(q_s->ret_creds), ps, depth); - - prs_uint32("database_id ", ps, depth, &(q_s->database_id )); - prs_uint32("restart_state", ps, depth, &(q_s->restart_state)); - prs_uint32("sync_context ", ps, depth, &(q_s->sync_context )); - - prs_uint32("max_size", ps, depth, &(q_s->max_size)); - - return True; -} - -/******************************************************************* -makes a SAM_DELTA_HDR structure. -********************************************************************/ -BOOL make_sam_delta_hdr(SAM_DELTA_HDR *delta, uint16 type, uint32 rid) -{ - if (delta == NULL) return False; - - DEBUG(5,("make_sam_delta_hdr\n")); - - delta->type2 = delta->type = type; - delta->target_rid = rid; - - delta->type3 = type; - delta->ptr_delta = 1; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL net_io_sam_delta_hdr(char *desc, SAM_DELTA_HDR *delta, prs_struct *ps, int depth) -{ - if (delta == NULL) return False; - - prs_debug(ps, depth, desc, "net_io_sam_delta_hdr"); - depth++; - - prs_uint16("type", ps, depth, &(delta->type )); - prs_uint16("type2", ps, depth, &(delta->type2 )); - prs_uint32("target_rid", ps, depth, &(delta->target_rid)); - - prs_uint32("type3", ps, depth, &(delta->type3 )); - prs_uint32("ptr_delta", ps, depth, &(delta->ptr_delta )); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL net_io_sam_domain_info(char *desc, SAM_DOMAIN_INFO *info, prs_struct *ps, int depth) -{ - if (info == NULL) return False; - - prs_debug(ps, depth, desc, "net_io_sam_domain_info"); - depth++; + if (r_l == NULL) + return False; - smb_io_unihdr("hdr_dom_name" , &(info->hdr_dom_name) , ps, depth); - smb_io_unihdr("hdr_oem_info" , &(info->hdr_oem_info) , ps, depth); - - smb_io_bigint("force_logoff" , &(info->force_logoff) , ps, depth); - prs_uint16("min_pwd_len" , ps, depth, &(info->min_pwd_len )); - prs_uint16("pwd_history_len" , ps, depth, &(info->pwd_history_len)); - smb_io_bigint("max_pwd_age" , &(info->max_pwd_age) , ps, depth); - smb_io_bigint("min_pwd_age" , &(info->min_pwd_age) , ps, depth); - smb_io_bigint("dom_mod_count", &(info->dom_mod_count), ps, depth); - smb_io_time("creation_time" , &(info->creation_time), ps, depth); - - smb_io_bufhdr2("hdr_sec_desc", &(info->hdr_sec_desc) , ps, depth); - smb_io_unihdr ("hdr_unknown" , &(info->hdr_unknown) , ps, depth); - ps->offset += 40; - - smb_io_unistr2("uni_dom_name", &(info->uni_dom_name), - info->hdr_dom_name.buffer, ps, depth); - smb_io_unistr2("buf_oem_info", &(info->buf_oem_info), - info->hdr_oem_info.buffer, ps, depth); - - smb_io_buffer4("buf_sec_desc", &(info->buf_sec_desc), - info->hdr_sec_desc.buffer, ps, depth); - smb_io_unistr2("buf_unknown" , &(info->buf_unknown ), - info->hdr_unknown .buffer, ps, depth); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL net_io_sam_group_info(char *desc, SAM_GROUP_INFO *info, prs_struct *ps, int depth) -{ - if (info == NULL) return False; - - prs_debug(ps, depth, desc, "net_io_sam_group_info"); - depth++; - - smb_io_unihdr ("hdr_grp_name", &(info->hdr_grp_name), ps, depth); - smb_io_gid ("gid", &(info->gid), ps, depth); - smb_io_unihdr ("hdr_grp_desc", &(info->hdr_grp_desc), ps, depth); - smb_io_bufhdr2("hdr_sec_desc", &(info->hdr_sec_desc), ps, depth); - ps->offset += 48; - - smb_io_unistr2("uni_grp_name", &(info->uni_grp_name), - info->hdr_grp_name.buffer, ps, depth); - smb_io_unistr2("uni_grp_desc", &(info->uni_grp_desc), - info->hdr_grp_desc.buffer, ps, depth); - smb_io_buffer4("buf_sec_desc", &(info->buf_sec_desc), - info->hdr_sec_desc.buffer, ps, depth); - - return True; -} - -/******************************************************************* -makes a SAM_ACCOUNT_INFO structure. -********************************************************************/ -BOOL make_sam_account_info(SAM_ACCOUNT_INFO *info, char *user_name, - char *full_name, uint32 user_rid, uint32 group_rid, - char *home_dir, char *dir_drive, char *logon_script, - char *acct_desc, uint32 acb_info, char *profile) -{ - int len_user_name = strlen(user_name); - int len_full_name = strlen(full_name); - int len_home_dir = strlen(home_dir); - int len_dir_drive = strlen(dir_drive); - int len_logon_script = strlen(logon_script); - int len_acct_desc = strlen(acct_desc); - int len_profile = strlen(profile); - - DEBUG(5,("make_sam_account_info\n")); - - make_uni_hdr(&(info->hdr_acct_name ), len_user_name ); - make_uni_hdr(&(info->hdr_full_name ), len_full_name ); - make_uni_hdr(&(info->hdr_home_dir ), len_home_dir ); - make_uni_hdr(&(info->hdr_dir_drive ), len_dir_drive ); - make_uni_hdr(&(info->hdr_logon_script), len_logon_script); - make_uni_hdr(&(info->hdr_acct_desc ), len_acct_desc ); - make_uni_hdr(&(info->hdr_profile ), len_profile ); - - /* not present */ - make_uni_hdr(&(info->hdr_workstations), 0); - make_uni_hdr(&(info->hdr_comment), 0); - make_uni_hdr(&(info->hdr_parameters), 0); - make_bufhdr2(&(info->hdr_sec_desc), 0, 0, 0); - - info->user_rid = user_rid; - info->group_rid = group_rid; - - init_nt_time(&(info->logon_time)); - init_nt_time(&(info->logoff_time)); - init_nt_time(&(info->pwd_last_set_time)); - init_nt_time(&(info->acct_expiry_time)); - - info->logon_divs = 0xA8; - info->ptr_logon_hrs = 0; /* Don't care right now */ - - info->bad_pwd_count = 0; - info->logon_count = 0; - info->acb_info = acb_info; - info->nt_pwd_present = 0; - info->lm_pwd_present = 0; - info->pwd_expired = 0; - info->country = 0; - info->codepage = 0; - - info->unknown1 = 0x4EC; - info->unknown2 = 0; - - make_unistr2(&(info->uni_acct_name), user_name, len_user_name+1); - make_unistr2(&(info->uni_full_name), full_name, len_full_name+1); - make_unistr2(&(info->uni_home_dir ), home_dir , len_home_dir +1); - make_unistr2(&(info->uni_dir_drive), dir_drive, len_dir_drive+1); - make_unistr2(&(info->uni_logon_script), logon_script, len_logon_script+1); - make_unistr2(&(info->uni_acct_desc), acct_desc, len_acct_desc+1); - make_unistr2(&(info->uni_profile ), profile , len_profile +1); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL net_io_sam_passwd_info(char *desc, SAM_PWD *pwd, - prs_struct *ps, int depth) -{ - if (pwd == NULL) return False; - - prs_debug(ps, depth, desc, "net_io_sam_passwd_info"); + prs_debug(ps, depth, desc, "net_io_r_sam_logoff"); depth++; - prs_uint32("unk_0 ", ps, depth, &(pwd->unk_0 )); - - smb_io_unihdr ("hdr_lm_pwd", &(pwd->hdr_lm_pwd), ps, depth); - prs_uint8s(False, "buf_lm_pwd", ps, depth, pwd->buf_lm_pwd, 16); + if(!prs_align(ps)) + return False; - smb_io_unihdr ("hdr_nt_pwd", &(pwd->hdr_nt_pwd), ps, depth); - prs_uint8s(False, "buf_nt_pwd", ps, depth, pwd->buf_nt_pwd, 16); - - smb_io_unihdr("", &(pwd->hdr_empty_lm), ps, depth); - smb_io_unihdr("", &(pwd->hdr_empty_nt), ps, depth); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL net_io_sam_account_info(char *desc, uint8 sess_key[16], - SAM_ACCOUNT_INFO *info, prs_struct *ps, int depth) -{ - BUFHDR2 hdr_priv_data; - uint32 i; - - if (info == NULL) return False; - - prs_debug(ps, depth, desc, "net_io_sam_account_info"); - depth++; - - smb_io_unihdr("hdr_acct_name", &(info->hdr_acct_name), ps, depth); - smb_io_unihdr("hdr_full_name", &(info->hdr_full_name), ps, depth); - - prs_uint32("user_rid ", ps, depth, &(info->user_rid )); - prs_uint32("group_rid", ps, depth, &(info->group_rid)); - - smb_io_unihdr("hdr_home_dir " , &(info->hdr_home_dir ), ps, depth); - smb_io_unihdr("hdr_dir_drive" , &(info->hdr_dir_drive), ps, depth); - smb_io_unihdr("hdr_logon_script", &(info->hdr_logon_script), ps, depth); - smb_io_unihdr("hdr_acct_desc" , &(info->hdr_acct_desc), ps, depth); - smb_io_unihdr("hdr_workstations", &(info->hdr_workstations), ps, depth); - - smb_io_time("logon_time" , &(info->logon_time ), ps, depth); - smb_io_time("logoff_time", &(info->logoff_time), ps, depth); - - prs_uint32("logon_divs ", ps, depth, &(info->logon_divs )); - prs_uint32("ptr_logon_hrs", ps, depth, &(info->ptr_logon_hrs)); - - prs_uint16("bad_pwd_count", ps, depth, &(info->bad_pwd_count)); - prs_uint16("logon_count" , ps, depth, &(info->logon_count )); - smb_io_time("pwd_last_set_time", &(info->pwd_last_set_time), ps, depth); - smb_io_time("acct_expiry_time" , &(info->acct_expiry_time ), ps, depth); - - prs_uint32("acb_info", ps, depth, &(info->acb_info)); - prs_uint8s(False, "nt_pwd", ps, depth, info->nt_pwd, 16); - prs_uint8s(False, "lm_pwd", ps, depth, info->lm_pwd, 16); - prs_uint8("lm_pwd_present", ps, depth, &(info->lm_pwd_present)); - prs_uint8("nt_pwd_present", ps, depth, &(info->nt_pwd_present)); - prs_uint8("pwd_expired" , ps, depth, &(info->pwd_expired )); - - smb_io_unihdr("hdr_comment" , &(info->hdr_comment ), ps, depth); - smb_io_unihdr("hdr_parameters", &(info->hdr_parameters), ps, depth); - prs_uint16("country" , ps, depth, &(info->country )); - prs_uint16("codepage", ps, depth, &(info->codepage)); - - smb_io_bufhdr2("hdr_priv_data", &(hdr_priv_data), ps, depth); - smb_io_bufhdr2("hdr_sec_desc" , &(info->hdr_sec_desc) , ps, depth); - smb_io_unihdr ("hdr_profile" , &(info->hdr_profile) , ps, depth); - - for (i = 0; i < 3; i++) - { - smb_io_unihdr("hdr_reserved", &(info->hdr_reserved[i]), ps, depth); - } - - for (i = 0; i < 4; i++) - { - prs_uint32("dw_reserved", ps, depth, &(info->dw_reserved[i])); - } - - smb_io_unistr2("uni_acct_name", &(info->uni_acct_name), - info->hdr_acct_name.buffer, ps, depth); - prs_align(ps); - smb_io_unistr2("uni_full_name", &(info->uni_full_name), - info->hdr_full_name.buffer, ps, depth); - prs_align(ps); - smb_io_unistr2("uni_home_dir ", &(info->uni_home_dir ), - info->hdr_home_dir .buffer, ps, depth); - prs_align(ps); - smb_io_unistr2("uni_dir_drive", &(info->uni_dir_drive), - info->hdr_dir_drive.buffer, ps, depth); - prs_align(ps); - smb_io_unistr2("uni_logon_script", &(info->uni_logon_script), - info->hdr_logon_script.buffer, ps, depth); - prs_align(ps); - smb_io_unistr2("uni_acct_desc", &(info->uni_acct_desc), - info->hdr_acct_desc.buffer, ps, depth); - prs_align(ps); - smb_io_unistr2("uni_workstations", &(info->uni_workstations), - info->hdr_workstations.buffer, ps, depth); - prs_align(ps); - - prs_uint32("unknown1", ps, depth, &(info->unknown1)); - prs_uint32("unknown2", ps, depth, &(info->unknown2)); - - smb_io_buffer4("buf_logon_hrs" , &(info->buf_logon_hrs ), - info->ptr_logon_hrs, ps, depth); - prs_align(ps); - smb_io_unistr2("uni_comment" , &(info->uni_comment ), - info->hdr_comment.buffer, ps, depth); - prs_align(ps); - smb_io_unistr2("uni_parameters", &(info->uni_parameters), - info->hdr_parameters.buffer, ps, depth); - prs_align(ps); - if (hdr_priv_data.buffer != 0) - { - int old_offset; - uint32 len = 0x44; - prs_uint32("pwd_len", ps, depth, &len); - old_offset = ps->offset; - if (len == 0x44) - { - if (ps->io) - { - /* reading */ - prs_hash1(ps, ps->offset, sess_key); - } - net_io_sam_passwd_info("pass", &(info->pass), ps, depth); - if (!ps->io) - { - /* writing */ - prs_hash1(ps, old_offset, sess_key); - } - } - ps->offset = old_offset + len; - } - smb_io_buffer4("buf_sec_desc" , &(info->buf_sec_desc ), - info->hdr_sec_desc.buffer, ps, depth); - prs_align(ps); - smb_io_unistr2("uni_profile" , &(info->uni_profile ), - info->hdr_profile.buffer, ps, depth); - prs_align(ps); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_struct *ps, int depth) -{ - uint32 i; - fstring tmp; - - if (info == NULL) return False; - - prs_debug(ps, depth, desc, "net_io_sam_group_mem_info"); - depth++; - - prs_align(ps); - prs_uint32("ptr_rids ", ps, depth, &(info->ptr_rids )); - prs_uint32("ptr_attribs", ps, depth, &(info->ptr_attribs)); - prs_uint32("num_members", ps, depth, &(info->num_members)); - ps->offset += 16; - - if (info->ptr_rids != 0) - { - prs_uint32("num_members2", ps, depth, &(info->num_members2)); - if (info->num_members2 != info->num_members) - { - /* RPC fault */ - return False; - } - - SMB_ASSERT_ARRAY(info->rids, info->num_members2); - - for (i = 0; i < info->num_members2; i++) - { - slprintf(tmp, sizeof(tmp) - 1, "rids[%02d]", i); - prs_uint32(tmp, ps, depth, &(info->rids[i])); - } - } - - if (info->ptr_attribs != 0) - { - prs_uint32("num_members3", ps, depth, &(info->num_members3)); - if (info->num_members3 != info->num_members) - { - /* RPC fault */ - return False; - } - - SMB_ASSERT_ARRAY(info->attribs, info->num_members3); - - for (i = 0; i < info->num_members3; i++) - { - slprintf(tmp, sizeof(tmp) - 1, "attribs[%02d]", i); - prs_uint32(tmp, ps, depth, &(info->attribs[i])); - } - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL net_io_sam_alias_info(char *desc, SAM_ALIAS_INFO *info, prs_struct *ps, int depth) -{ - if (info == NULL) return False; - - prs_debug(ps, depth, desc, "net_io_sam_alias_info"); - depth++; - - smb_io_unihdr ("hdr_als_name", &(info->hdr_als_name), ps, depth); - prs_uint32("als_rid", ps, depth, &(info->als_rid)); - smb_io_bufhdr2("hdr_sec_desc", &(info->hdr_sec_desc), ps, depth); - smb_io_unihdr ("hdr_als_desc", &(info->hdr_als_desc), ps, depth); - ps->offset += 40; - - smb_io_unistr2("uni_als_name", &(info->uni_als_name), - info->hdr_als_name.buffer, ps, depth); - smb_io_buffer4("buf_sec_desc", &(info->buf_sec_desc), - info->hdr_sec_desc.buffer, ps, depth); - smb_io_unistr2("uni_als_desc", &(info->uni_als_desc), - info->hdr_als_name.buffer, ps, depth); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_struct *ps, int depth) -{ - uint32 i; - fstring tmp; - - if (info == NULL) return False; - - prs_debug(ps, depth, desc, "net_io_sam_alias_mem_info"); - depth++; - - prs_align(ps); - prs_uint32("num_members", ps, depth, &(info->num_members)); - prs_uint32("ptr_members", ps, depth, &(info->ptr_members)); - ps->offset += 16; - - if (info->ptr_members != 0) - { - prs_uint32("num_sids", ps, depth, &(info->num_sids)); - if (info->num_sids != info->num_members) - { - /* RPC fault */ - return False; - } - - SMB_ASSERT_ARRAY(info->ptr_sids, info->num_sids); - - for (i = 0; i < info->num_sids; i++) - { - slprintf(tmp, sizeof(tmp) - 1, "ptr_sids[%02d]", i); - prs_uint32(tmp, ps, depth, &(info->ptr_sids[i])); - } - - SMB_ASSERT_ARRAY(info->sids, info->num_sids); - - for (i = 0; i < info->num_sids; i++) - { - if (info->ptr_sids[i] != 0) - { - slprintf(tmp, sizeof(tmp) - 1, "sids[%02d]", i); - smb_io_dom_sid2(tmp, &(info->sids[i]), ps, depth); - } - } - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], - SAM_DELTA_CTR *delta, uint16 type, - prs_struct *ps, int depth) -{ - if (delta == NULL) return False; - - prs_debug(ps, depth, desc, "net_io_sam_delta_ctr"); - depth++; - - switch (type) - { - case 1: - { - net_io_sam_domain_info("", &(delta->domain_info), - ps, depth); - break; - } - case 2: - { - net_io_sam_group_info("", &(delta->group_info), - ps, depth); - break; - } - case 5: - { - net_io_sam_account_info("", sess_key, - &(delta->account_info), - ps, depth); - break; - } - case 8: - { - net_io_sam_group_mem_info("", &(delta->grp_mem_info), - ps, depth); - break; - } - case 9: - { - net_io_sam_alias_info("", &(delta->alias_info), - ps, depth); - break; - } - case 0xC: - { - net_io_sam_alias_mem_info("", &(delta->als_mem_info), - ps, depth); - break; - } - default: - { - DEBUG(0, ("Replication error: Unknown delta type %x\n", type)); - break; - } - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16], - NET_R_SAM_SYNC *r_s, prs_struct *ps, int depth) -{ - uint32 i; - - if (r_s == NULL) return False; - - prs_debug(ps, depth, desc, "net_io_r_sam_sync"); - depth++; - - smb_io_cred("", &(r_s->srv_creds), ps, depth); - prs_uint32("sync_context", ps, depth, &(r_s->sync_context)); - - prs_uint32("ptr_deltas", ps, depth, &(r_s->ptr_deltas)); - if (r_s->ptr_deltas != 0) - { - prs_uint32("num_deltas ", ps, depth, &(r_s->num_deltas )); - prs_uint32("ptr_deltas2", ps, depth, &(r_s->ptr_deltas2)); - if (r_s->ptr_deltas2 != 0) - { - prs_uint32("num_deltas2", ps, depth, &(r_s->num_deltas2)); - if (r_s->num_deltas2 != r_s->num_deltas) - { - /* RPC fault */ - return False; - } - - for (i = 0; i < r_s->num_deltas2; i++) - { - net_io_sam_delta_hdr("", &r_s->hdr_deltas[i], ps, depth); - } - - for (i = 0; i < r_s->num_deltas2; i++) - { - net_io_sam_delta_ctr("", sess_key, - &r_s->deltas[i], - r_s->hdr_deltas[i].type3, ps, depth); - } - } - } + 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; - prs_align(ps); - prs_uint32("status", ps, depth, &(r_s->status)); + if(!prs_uint32("status ", ps, depth, &r_l->status)) + return False; return True; } diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index d9c07e3885..f5f4eb67b8 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -2,8 +2,9 @@ Unix SMB/Netbios implementation. Version 1.9. Samba memory buffer functions - Copyright (C) Andrew Tridgell 1992-1999 - Copyright (C) Luke Kenneth Casson Leighton 1996-1999 + Copyright (C) Andrew Tridgell 1992-1997 + Copyright (C) Luke Kenneth Casson Leighton 1996-1997 + Copyright (C) Jeremy Allison 1999. 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 @@ -33,523 +34,567 @@ extern int DEBUGLEVEL; ********************************************************************/ void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name) { - DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(depth), ps->offset, fn_name, desc)); + DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(depth), ps->data_offset, fn_name, desc)); } /******************************************************************* - debug a parse structure + Initialise a parse structure - malloc the data if requested. ********************************************************************/ -void prs_debug_out(prs_struct *ps, char *msg, int level) + +BOOL prs_init(prs_struct *ps, uint32 size, uint8 align, BOOL io) { - DEBUG(level,("%s ps: io %s align %d offset %d err %d data %p len %d\n", - msg, BOOLSTR(ps->io), ps->align, ps->offset, ps->error, - ps->data, - ps->data != NULL ? mem_buf_len(ps->data) : 0)); + ZERO_STRUCTP(ps); + ps->io = io; + ps->bigendian_data = False; + ps->align = align; + ps->is_dynamic = False; + ps->data_offset = 0; + ps->buffer_size = 0; + ps->data_p = NULL; + + if (size != 0) { + ps->buffer_size = size; + if((ps->data_p = (char *)malloc((size_t)size)) == NULL) { + DEBUG(0,("prs_init: malloc fail for %u bytes.\n", (unsigned int)size)); + return False; + } + ps->is_dynamic = True; /* We own this memory. */ + } + + return True; } /******************************************************************* - initialise a parse structure + Delete the memory in a parse structure - if we own it. ********************************************************************/ -void prs_init(prs_struct *ps, uint32 size, - uint8 align, uint32 margin, - BOOL io) + +void prs_mem_free(prs_struct *ps) { - ps->io = io; - ps->align = align; - ps->offset = 0; - ps->error = False; + if(ps->is_dynamic && (ps->data_p != NULL)) + free(ps->data_p); + ps->is_dynamic = False; + ps->data_p = NULL; + ps->buffer_size = 0; + ps->data_offset = 0; +} - ps->data = NULL; - mem_buf_init(&(ps->data), margin); +/******************************************************************* + Hand some already allocated memory to a prs_struct. + ********************************************************************/ - if (size != 0) - { - mem_alloc_data(ps->data, size); - ps->data->offset.start = 0; - ps->data->offset.end = 0xffffffff; - } +void prs_give_memory(prs_struct *ps, char *buf, uint32 size, BOOL is_dynamic) +{ + ps->is_dynamic = is_dynamic; + ps->data_p = buf; + ps->buffer_size = size; } /******************************************************************* - copy a parse structure + Take some memory back from a prs_struct. ********************************************************************/ -BOOL prs_copy(prs_struct *ps, const prs_struct *from) + +char *prs_take_memory(prs_struct *ps, uint32 *psize) { - int len = mem_buf_len(from->data); - prs_init(ps, len, from->align, from->data->margin, from->io); - if (!mem_buf_copy(mem_data(&ps->data, 0), from->data, 0, len)) - { + char *ret = ps->data_p; + if(psize) + *psize = ps->buffer_size; + ps->is_dynamic = False; + prs_mem_free(ps); + return ret; +} + +/******************************************************************* + Attempt, if needed, to grow a data buffer. + Also depends on the data stream mode (io). + ********************************************************************/ + +BOOL prs_grow(prs_struct *ps, uint32 extra_space) +{ + uint32 new_size; + char *new_data; + + if(ps->data_offset + extra_space <= ps->buffer_size) + return True; + + /* + * We cannot grow the buffer if we're not reading + * into the prs_struct, or if we don't own the memory. + */ + + if(UNMARSHALLING(ps) || !ps->is_dynamic) { + DEBUG(0,("prs_grow: Buffer overflow - unable to expand buffer by %u bytes.\n", + (unsigned int)extra_space)); return False; } - ps->offset = len; - prs_link(NULL, ps, NULL); + + /* + * Decide how much extra space we really need. + */ + + extra_space -= (ps->buffer_size - ps->data_offset); + + if(ps->buffer_size == 0) { + + /* + * Ensure we have at least a PDU's length, or extra_space, whichever + * is greater. + */ + + new_size = MAX(MAX_PDU_FRAG_LEN,extra_space); + + if((new_data = malloc(new_size)) == NULL) { + DEBUG(0,("prs_grow: Malloc failure for size %u.\n", (unsigned int)new_size)); + return False; + } + memset(new_data, '\0', new_size ); + } else { + + /* + * If the current buffer size is bigger than the space needed, just + * double it, else add extra_space. + */ + + new_size = MAX(ps->buffer_size*2, ps->buffer_size + extra_space); + + if((new_data = Realloc(ps->data_p, new_size)) == NULL) { + DEBUG(0,("prs_grow: Realloc failure for size %u.\n", + (unsigned int)new_size)); + return False; + } + } + + ps->buffer_size = new_size; + ps->data_p = new_data; + return True; } /******************************************************************* - initialise a parse structure + Attempt to force a data buffer to grow by len bytes. + This is only used when appending more data onto a prs_struct + when reading an rpc reply, before unmarshalling it. ********************************************************************/ -void prs_mem_free(prs_struct *ps) + +BOOL prs_force_grow(prs_struct *ps, uint32 extra_space) { - mem_buf_free(&(ps->data)); + uint32 new_size = ps->buffer_size + extra_space; + char *new_data; + + if(!UNMARSHALLING(ps) || !ps->is_dynamic) { + DEBUG(0,("prs_force_grow: Buffer overflow - unable to expand buffer by %u bytes.\n", + (unsigned int)extra_space)); + return False; + } + + if((new_data = Realloc(ps->data_p, new_size)) == NULL) { + DEBUG(0,("prs_force_grow: Realloc failure for size %u.\n", + (unsigned int)new_size)); + return False; + } + + ps->buffer_size = new_size; + ps->data_p = new_data; + + return True; } /******************************************************************* - link one parsing structure to another + Get the data pointer (external interface). ********************************************************************/ -void prs_link(prs_struct *prev, prs_struct *ps, prs_struct *next) -{ - ps->data->offset.start = prev != NULL ? prev->data->offset.end : 0; - ps->data->offset.end = ps->data->offset.start + ps->offset; - ps->data->next = next != NULL ? next->data : NULL; - DEBUG(150,("prs_link: start %d end %d\n", - ps->data->offset.start, - ps->data->offset.end)); +char *prs_data_p(prs_struct *ps) +{ + return ps->data_p; } /******************************************************************* - align a pointer to a multiple of align_offset bytes. looks like it - will work for offsets of 0, 2 and 4... + Get the current data size (external interface). ********************************************************************/ -void prs_align(prs_struct *ps) + +uint32 prs_data_size(prs_struct *ps) { - int mod; - if (ps->error) return; - mod = ps->offset & (ps->align-1); - if (ps->align != 0 && mod != 0) - { - ps->offset += ps->align - mod; - } + return ps->buffer_size; } /******************************************************************* - attempt, if appropriate, to grow a data buffer. - - depends on the data stream mode (io) + Fetch the current offset (external interface). ********************************************************************/ -BOOL prs_grow(prs_struct *ps, uint32 new_size) + +uint32 prs_offset(prs_struct *ps) { - if (ps->error) return False; - return mem_grow_data(&(ps->data), ps->io, new_size, False); + return ps->data_offset; } /******************************************************************* - lengthens a buffer by len bytes and copies data into it. + Set the current offset (external interface). ********************************************************************/ -BOOL prs_append_data(prs_struct *ps, const char *data, int len) + +BOOL prs_set_offset(prs_struct *ps, uint32 offset) { - int prev_size = ps->data->data_used; - int new_size = prev_size + len; - char *to; + if(offset <= ps->data_offset) { + ps->data_offset = offset; + return True; + } - mem_realloc_data(ps->data, new_size); - to = mem_data(&ps->data, prev_size); - if (to == NULL || ps->data->data_used != new_size) - { + if(!prs_grow(ps, offset - ps->data_offset)) return False; - } - memcpy(to, data, len); + ps->data_offset = offset; return True; } /******************************************************************* - stream a uint8 + Append the data from one parse_struct into another. ********************************************************************/ -BOOL _prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8) + +BOOL prs_append_prs_data(prs_struct *dst, prs_struct *src) { - char *q; - if (ps->error) return False; - prs_grow(ps, ps->offset + 1); - q = mem_data(&(ps->data), ps->offset); - if (q == NULL) - { - ps->error = True; - prs_debug_out(ps, "_prs_uint8 error", 5); + if(!prs_grow(dst, prs_offset(src))) return False; - } - - DBG_RW_CVAL(name, depth, ps->offset, ps->io, q, *data8) - ps->offset += 1; + memcpy(&dst->data_p[dst->data_offset], prs_data_p(src), (size_t)prs_offset(src)); + dst->data_offset += prs_offset(src); return True; } /******************************************************************* - stream a uint16 + Append the data from a buffer into a parse_struct. ********************************************************************/ -BOOL _prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16) + +BOOL prs_append_data(prs_struct *dst, char *src, uint32 len) { - char *q; - if (ps->error) return False; - prs_grow(ps, ps->offset + 2); - q = mem_data(&(ps->data), ps->offset); - if (q == NULL) - { - ps->error = True; - prs_debug_out(ps, "_prs_uint16 error", 5); + if(!prs_grow(dst, len)) return False; - } - DBG_RW_SVAL(name, depth, ps->offset, ps->io, q, *data16) - ps->offset += 2; + memcpy(&dst->data_p[dst->data_offset], src, (size_t)len); + dst->data_offset += len; return True; } /******************************************************************* - hash a stream. + Set the data as big-endian (external interface). ********************************************************************/ -BOOL _prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) + +void prs_set_bigendian_data(prs_struct *ps) { - char *q; - if (ps->error) return False; - q = mem_data(&(ps->data), ps->offset); + ps->bigendian_data = True; +} + +/******************************************************************* + Align a the data_len to a multiple of align bytes - filling with + zeros. + ********************************************************************/ + +BOOL prs_align(prs_struct *ps) +{ + uint32 mod = ps->data_offset & (ps->align-1); + + if (ps->align != 0 && mod != 0) { + uint32 extra_space = (ps->align - mod); + if(!prs_grow(ps, extra_space)) + return False; + memset(&ps->data_p[ps->data_offset], '\0', (size_t)extra_space); + ps->data_offset += extra_space; + } + + return True; +} + +/******************************************************************* + Ensure we can read/write to a given offset. + ********************************************************************/ + +char *prs_mem_get(prs_struct *ps, uint32 extra_size) +{ + if(UNMARSHALLING(ps)) { + /* + * If reading, ensure that we can read the requested size item. + */ + if (ps->data_offset + extra_size > ps->buffer_size) { + DEBUG(0,("prs_mem_get: reading data of size %u would overrun buffer.\n", + (unsigned int)extra_size )); + return NULL; + } + } else { + /* + * Writing - grow the buffer if needed. + */ + if(!prs_grow(ps, extra_size)) + return False; + } + return &ps->data_p[ps->data_offset]; +} + +/******************************************************************* + Stream a uint8. + ********************************************************************/ + +BOOL prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8) +{ + char *q = prs_mem_get(ps, sizeof(uint8)); if (q == NULL) - { - ps->error = True; - prs_debug_out(ps, "_prs_hash1 error", 5); return False; - } -#ifdef DEBUG_PASSWORD - DEBUG(100,("prs_hash1\n")); - dump_data(100, sess_key, 16); - dump_data(100, q, 68); -#endif - SamOEMhash((uchar*)q, sess_key, 2); -#ifdef DEBUG_PASSWORD - dump_data(100, q, 68); -#endif + DBG_RW_CVAL(name, depth, ps->data_offset, ps->io, q, *data8) + ps->data_offset += sizeof(uint8); return True; } /******************************************************************* - stream a uint32 + Stream a uint16. ********************************************************************/ -BOOL _prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) + +BOOL prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16) { - char *q; - if (ps->error) return False; - prs_grow(ps, ps->offset + 4); - q = mem_data(&(ps->data), ps->offset); + char *q = prs_mem_get(ps, sizeof(uint16)); if (q == NULL) - { - ps->error = True; - prs_debug_out(ps, "_prs_uint32 error", 5); return False; - } - DBG_RW_IVAL(name, depth, ps->offset, ps->io, q, *data32) - ps->offset += 4; + DBG_RW_SVAL(name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, *data16) + ps->data_offset += sizeof(uint16); return True; } - -/****************************************************************** - stream an array of uint8s. length is number of uint8s +/******************************************************************* + Stream a uint32. ********************************************************************/ -BOOL _prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *data8s, int len) + +BOOL prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) { - char *q; - int end_offset; - char *e; - if (ps->error) return False; - end_offset = ps->offset + len * sizeof(uint8); - prs_grow(ps, end_offset); - q = mem_data(&(ps->data), ps->offset); - e = mem_data(&(ps->data), end_offset-1); - - if (q == NULL || e == NULL) - { - ps->error = True; - prs_debug_out(ps, "_prs_uint8s error", 5); + char *q = prs_mem_get(ps, sizeof(uint32)); + if (q == NULL) return False; - } - DBG_RW_PCVAL(charmode, name, depth, ps->offset, ps->io, q, data8s, len) - ps->offset = end_offset; + DBG_RW_IVAL(name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, *data32) + ps->data_offset += sizeof(uint32); return True; } + /****************************************************************** - stream an array of uint16s. length is number of uint16s + Stream an array of uint8s. Length is number of uint8s. ********************************************************************/ -BOOL _prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len) + +BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *data8s, int len) { - char *q; - int end_offset; - char *e; - if (ps->error) return False; - end_offset = ps->offset + len * sizeof(uint16); - prs_grow(ps, end_offset); - q = mem_data(&(ps->data), ps->offset); - e = mem_data(&(ps->data), end_offset-1); - - if (q == NULL || e == NULL) - { - ps->error = True; - prs_debug_out(ps, "_prs_uint16s error", 5); + char *q = prs_mem_get(ps, len * sizeof(uint8)); + if (q == NULL) return False; - } - DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, data16s, len) - ps->offset = end_offset; + DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, ps->io, q, data8s, len) + ps->data_offset += (len * sizeof(uint8)); return True; } /****************************************************************** - stream an array of uint32s. length is number of uint32s + Stream an array of uint32s. Length is number of uint32s. ********************************************************************/ -BOOL _prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *data32s, int len) + +BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *data32s, int len) { - char *q; - int end_offset; - char *e; - if (ps->error) return False; - end_offset = ps->offset + len * sizeof(uint32); - prs_grow(ps, end_offset); - q = mem_data(&(ps->data), ps->offset); - e = mem_data(&(ps->data), end_offset-1); - - if (q == NULL || e == NULL) - { - ps->error = True; - prs_debug_out(ps, "_prs_uint32s error", 5); + char *q = prs_mem_get(ps, len * sizeof(uint32)); + if (q == NULL) return False; - } - DBG_RW_PIVAL(charmode, name, depth, ps->offset, ps->io, q, data32s, len) - ps->offset = end_offset; + DBG_RW_PIVAL(charmode, name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, data32s, len) + ps->data_offset += (len * sizeof(uint32)); return True; } /****************************************************************** - stream a "not" unicode string, length/buffer specified separately, - in byte chars + Stream a "not" unicode string, length/buffer specified separately, + in byte chars. String is in little-endian format. ********************************************************************/ -BOOL _prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 *str) + +BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 *str) { - char *q; - int end_offset; - char *e; - if (ps->error) return False; - end_offset = ps->offset + str->buf_len * sizeof(uint8); - prs_grow(ps, end_offset); - q = mem_data(&(ps->data), ps->offset); - e = mem_data(&(ps->data), end_offset-1); - - if (q == NULL || e == NULL) - { - ps->error = True; - prs_debug_out(ps, "_prs_buffer2 error", 5); + char *p = (char *)str->buffer; + char *q = prs_mem_get(ps, str->buf_len); + if (q == NULL) return False; - } - DBG_RW_PCVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->buf_len) - ps->offset = end_offset; + /* If we're using big-endian, reverse to get little-endian. */ + if(ps->bigendian_data) + DBG_RW_PSVAL(charmode, name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, p, str->buf_len/2) + else + DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, ps->io, q, p, str->buf_len) + ps->data_offset += str->buf_len; return True; } /****************************************************************** - stream a string, length/buffer specified separately, + Stream a string, length/buffer specified separately, in uint8 chars. ********************************************************************/ -BOOL _prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 *str) + +BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 *str) { - char *q; - int end_offset; - char *e; - if (ps->error) return False; - end_offset = ps->offset + str->str_str_len * sizeof(uint8); - prs_grow(ps, end_offset); - q = mem_data(&(ps->data), ps->offset); - e = mem_data(&(ps->data), end_offset-1); - - if (q == NULL || e == NULL) - { - ps->error = True; - prs_debug_out(ps, "_prs_string2 error", 5); + char *q = prs_mem_get(ps, str->str_str_len * sizeof(uint8)); + if (q == NULL) return False; - } - DBG_RW_PCVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->str_max_len) - ps->offset = end_offset; + DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, ps->io, q, str->buffer, str->str_max_len) + ps->data_offset += (str->str_str_len * sizeof(uint8)); return True; } /****************************************************************** - stream a unicode string, length/buffer specified separately, - in uint16 chars. + Stream a unicode string, length/buffer specified separately, + in uint16 chars. We use DBG_RW_PCVAL, not DBG_RW_PSVAL here + as the unicode string is already in little-endian format. ********************************************************************/ -BOOL _prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *str) + +BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *str) { - char *q; - int end_offset; - char *e; - if (ps->error) return False; - end_offset = ps->offset + str->uni_str_len * sizeof(uint16); - prs_grow(ps, end_offset); - q = mem_data(&(ps->data), ps->offset); - e = mem_data(&(ps->data), end_offset-1); - - if (q == NULL || e == NULL) - { - ps->error = True; - prs_debug_out(ps, "_prs_unistr2 error", 5); + char *p = (char *)str->buffer; + char *q = prs_mem_get(ps, str->uni_str_len * sizeof(uint16)); + if (q == NULL) return False; - } - DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->buffer, str->uni_str_len) - ps->offset = end_offset; + /* If we're using big-endian, reverse to get little-endian. */ + if(ps->bigendian_data) + DBG_RW_PSVAL(charmode, name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, p, str->uni_str_len) + else + DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, ps->io, q, p, str->uni_str_len * 2) + ps->data_offset += (str->uni_str_len * sizeof(uint16)); return True; } /****************************************************************** - stream a unicode string, length/buffer specified separately, - in uint16 chars. + Stream a unicode string, length/buffer specified separately, + in uint16 chars. We use DBG_RW_PCVAL, not DBG_RW_PSVAL here + as the unicode string is already in little-endian format. ********************************************************************/ -BOOL _prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int depth) + +BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int depth) { - char *q; - int end_offset; - char *e; - if (ps->error) return False; - end_offset = ps->offset + str->uni_str_len * sizeof(uint16); - prs_grow(ps, end_offset); - q = mem_data(&(ps->data), ps->offset); - e = mem_data(&(ps->data), end_offset-1); - - if (q == NULL || e == NULL) - { - ps->error = True; - prs_debug_out(ps, "_prs_unistr3 error", 5); + char *p = (char *)str->str.buffer; + char *q = prs_mem_get(ps, str->uni_str_len * sizeof(uint16)); + if (q == NULL) return False; - } - DBG_RW_PSVAL(charmode, name, depth, ps->offset, ps->io, q, str->str.buffer, str->uni_str_len) - ps->offset = end_offset; + /* If we're using big-endian, reverse to get little-endian. */ + if(ps->bigendian_data) + DBG_RW_PSVAL(charmode, name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, p, str->uni_str_len) + else + DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, ps->io, q, p, str->uni_str_len * 2) + ps->data_offset += (str->uni_str_len * sizeof(uint16)); return True; } /******************************************************************* - stream a unicode null-terminated string + Stream a unicode null-terminated string. As the string is already + in little-endian format then do it as a stream of bytes. ********************************************************************/ -BOOL _prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) + +BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) { - int i = -1; + int len = 0; + unsigned char *p = (unsigned char *)str->buffer; uint8 *start; - if (ps->error) return False; - start = (uint8*)mem_data(&(ps->data), ps->offset); + char *q; + + for(len = 0; len < (sizeof(str->buffer) / sizeof(str->buffer[0])) && + str->buffer[len] != 0; len++) + ; - do + q = prs_mem_get(ps, len*2); + if (q == NULL) + return False; + + start = (uint8*)q; + + len = 0; + do { - char *q; - i++; - prs_grow(ps, ps->offset + i*2); - q = mem_data(&(ps->data), ps->offset + i*2); - if (q == NULL) - { - ps->error = True; - prs_debug_out(ps, "_prs_unistr error", 5); - return False; + if(ps->bigendian_data) { + RW_SVAL(ps->io, ps->bigendian_data, q, *p, 0) + p += 2; + q += 2; + } else { + RW_CVAL(ps->io, q, *p, 0); + p++; + q++; + RW_CVAL(ps->io, q, *p, 0); + p++; + q++; } - RW_SVAL(ps->io, q, str->buffer[i],0); - } - while ((((size_t)i) < sizeof(str->buffer) / sizeof(str->buffer[0])) && - (str->buffer[i] != 0)); - + len++; + } while ((len < (sizeof(str->buffer) / sizeof(str->buffer[0]))) && + (str->buffer[len] != 0)); - ps->offset += (i+1)*2; + ps->data_offset += len*2; - dump_data(5+depth, (char *)start, i * 2); + dump_data(5+depth, (char *)start, len * 2); return True; } /******************************************************************* - stream a null-terminated string. len is strlen, and therefore does + Stream a null-terminated string. len is strlen, and therefore does not include the null-termination character. - - len == 0 indicates variable length string - (up to max size of pstring - 1024 chars). - ********************************************************************/ -BOOL _prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, uint16 max_buf_size) + +BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, int len, int max_buf_size) { - int i = -1; /* start off at zero after 1st i++ */ + char *q; uint8 *start; - if (ps->error) return False; - start = (uint8*)mem_data(&(ps->data), ps->offset); + int i; - DEBUG(120,("_prs_string: string %s len %d max %d\n", - str, len, max_buf_size)); + len = MIN(len, (max_buf_size-1)); - DEBUG(10,("%s%04x %s: ", tab_depth(depth), ps->offset, name != NULL ? name : "")); + q = prs_mem_get(ps, len+1); + if (q == NULL) + return False; - do - { - char *q; - i++; - - prs_grow(ps, ps->offset + i); - q = mem_data(&(ps->data), ps->offset + i); - if (q == NULL) - { - ps->error = True; - prs_debug_out(ps, "_prs_string error", 5); - return False; - } + start = (uint8*)q; - if (i < len || len == 0) - { - RW_CVAL(ps->io, q, str[i], 0); - } - else - { - uint8 dummy = 0; - RW_CVAL(ps->io, q, dummy,0); - } + for(i = 0; i < len; i++) { + RW_CVAL(ps->io, q, str[i],0); + q++; + } - } while (i < max_buf_size && (len == 0 ? str[i] != 0 : i < len) ); + /* The terminating null. */ + str[i] = '\0'; - DEBUG(120,("_prs_string: string %s len %d max %d\n", - str, len, max_buf_size)); + if (MARSHALLING(ps)) { + RW_CVAL(ps->io, q, str[i], 0); + } - ps->offset += i+1; + ps->data_offset += len+1; - dump_data(5+depth, (char *)start, i); + dump_data(5+depth, (char *)start, len); return True; } /******************************************************************* - prs_uint16 wrapper. call this and it sets up a pointer to where the - uint16 should be stored, or gets the size if reading + prs_uint16 wrapper. Call this and it sets up a pointer to where the + uint16 should be stored, or gets the size if reading. ********************************************************************/ -BOOL _prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset) + +BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset) { - if (ps->error) return False; - (*offset) = ps->offset; - if (ps->io) - { + (*offset) = ps->data_offset; + if (UNMARSHALLING(ps)) { /* reading. */ - return _prs_uint16(name, ps, depth, data16); - } - else - { - ps->offset += sizeof(uint16); + return prs_uint16(name, ps, depth, data16); + } else { + char *q = prs_mem_get(ps, sizeof(uint16)); + if(q ==NULL) + return False; + ps->data_offset += sizeof(uint16); } return True; } @@ -558,43 +603,42 @@ BOOL _prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint prs_uint16 wrapper. call this and it retrospectively stores the size. does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ -BOOL _prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, + +BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 ptr_uint16, uint32 start_offset) { - if (ps->error) return False; - if (!ps->io) - { - /* storing: go back and do a retrospective job. i hate this */ - uint16 data_size = ps->offset - start_offset; - uint32 old_offset = ps->offset; - - ps->offset = ptr_uint16; - prs_uint16(name, ps, depth, &data_size); - ps->offset = old_offset; - } - else - { - ps->offset = start_offset + (*data16); + if (MARSHALLING(ps)) { + /* + * Writing - temporarily move the offset pointer. + */ + uint16 data_size = ps->data_offset - start_offset; + uint32 old_offset = ps->data_offset; + + ps->data_offset = ptr_uint16; + if(!prs_uint16(name, ps, depth, &data_size)) { + ps->data_offset = old_offset; + return False; + } + ps->data_offset = old_offset; + } else { + ps->data_offset = start_offset + (uint32)(*data16); } return True; } /******************************************************************* - prs_uint32 wrapper. call this and it sets up a pointer to where the - uint32 should be stored, or gets the size if reading + prs_uint32 wrapper. Call this and it sets up a pointer to where the + uint32 should be stored, or gets the size if reading. ********************************************************************/ -BOOL _prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset) + +BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset) { - if (ps->error) return False; - (*offset) = ps->offset; - if (ps->io) - { + (*offset) = ps->data_offset; + if (UNMARSHALLING(ps)) { /* reading. */ - return _prs_uint32(name, ps, depth, data32); - } - else - { - ps->offset += sizeof(uint32); + return prs_uint32(name, ps, depth, data32); + } else { + ps->data_offset += sizeof(uint32); } return True; } @@ -603,18 +647,21 @@ BOOL _prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint prs_uint32 wrapper. call this and it retrospectively stores the size. does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ -BOOL _prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32, + +BOOL prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 ptr_uint32, uint32 data_size) { - if (ps->error) return False; - if (!ps->io) - { - /* storing: go back and do a retrospective job. i hate this */ - uint32 old_offset = ps->offset; - ps->offset = ptr_uint32; - prs_uint32(name, ps, depth, &data_size); - ps->offset = old_offset; + if (MARSHALLING(ps)) { + /* + * Writing - temporarily move the offset pointer. + */ + uint32 old_offset = ps->data_offset; + ps->data_offset = ptr_uint32; + if(!prs_uint32(name, ps, depth, &data_size)) { + ps->data_offset = old_offset; + return False; + } + ps->data_offset = old_offset; } return True; } - diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 9f446cc86a..23262279a4 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -2,9 +2,9 @@ * Unix SMB/Netbios implementation. * Version 1.9. * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1999, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, - * Copyright (C) Paul Ashton 1997-1999. + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. * * 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 @@ -28,95 +28,43 @@ extern int DEBUGLEVEL; /******************************************************************* -creates a structure. + Inits a structure. ********************************************************************/ -BOOL make_reg_q_open_hkcr(REG_Q_OPEN_HKCR *q_o, - uint16 unknown_0, uint32 level) -{ - q_o->ptr = 1; - q_o->unknown_0 = unknown_0; - q_o->unknown_1 = 0x0; /* random - changes */ - q_o->level = level; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL reg_io_q_open_hkcr(char *desc, REG_Q_OPEN_HKCR *r_q, prs_struct *ps, int depth) -{ - if (r_q == NULL) return False; - - prs_debug(ps, depth, desc, "reg_io_q_open_hkcr"); - depth++; - - prs_align(ps); - - prs_uint32("ptr ", ps, depth, &(r_q->ptr )); - if (r_q->ptr != 0) - { - prs_uint16("unknown_0", ps, depth, &(r_q->unknown_0)); - prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1)); - prs_uint32("level ", ps, depth, &(r_q->level )); - } - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL reg_io_r_open_hkcr(char *desc, REG_R_OPEN_HKCR *r_r, prs_struct *ps, int depth) -{ - if (r_r == NULL) return False; - - prs_debug(ps, depth, desc, "reg_io_r_open_hkcr"); - depth++; - prs_align(ps); - - smb_io_pol_hnd("", &(r_r->pol), ps, depth); - - prs_uint32("status", ps, depth, &(r_r->status)); - - return True; -} - - -/******************************************************************* -creates a structure. -********************************************************************/ -BOOL make_reg_q_open_hklm(REG_Q_OPEN_HKLM *q_o, +void init_reg_q_open_hklm(REG_Q_OPEN_HKLM *q_o, uint16 unknown_0, uint32 level) { q_o->ptr = 1; q_o->unknown_0 = unknown_0; q_o->unknown_1 = 0x0; /* random - changes */ q_o->level = level; - - return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_open_hklm(char *desc, REG_Q_OPEN_HKLM *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_q_open_hklm"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - prs_uint32("ptr ", ps, depth, &(r_q->ptr )); - if (r_q->ptr != 0) - { - prs_uint16("unknown_0", ps, depth, &(r_q->unknown_0)); - prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1)); - prs_uint32("level ", ps, depth, &(r_q->level )); + if(!prs_uint32("ptr ", ps, depth, &r_q->ptr)) + return False; + + if (r_q->ptr != 0) { + if(!prs_uint16("unknown_0", ps, depth, &r_q->unknown_0)) + return False; + if(!prs_uint16("unknown_1", ps, depth, &r_q->unknown_1)) + return False; + if(!prs_uint32("level ", ps, depth, &r_q->level)) + return False; } return True; @@ -126,64 +74,75 @@ BOOL reg_io_q_open_hklm(char *desc, REG_Q_OPEN_HKLM *r_q, prs_struct *ps, int d /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_r_open_hklm(char *desc, REG_R_OPEN_HKLM *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return False; + if (r_r == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_r_open_hklm"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(r_r->pol), ps, depth); + if(!smb_io_pol_hnd("", &r_r->pol, ps, depth)) + return False; - prs_uint32("status", ps, depth, &(r_r->status)); + if(!prs_uint32("status", ps, depth, &r_r->status)) + return False; return True; } /******************************************************************* -creates a structure. + Inits a structure. ********************************************************************/ -BOOL make_reg_q_flush_key(REG_Q_FLUSH_KEY *q_u, POLICY_HND *pol) -{ - memcpy(&(q_u->pol), pol, sizeof(q_u->pol)); - return True; +void init_reg_q_flush_key(REG_Q_FLUSH_KEY *q_u, POLICY_HND *pol) +{ + memcpy(&q_u->pol, pol, sizeof(q_u->pol)); } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_flush_key(char *desc, REG_Q_FLUSH_KEY *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_q_flush_key"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(r_q->pol), ps, depth); + if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) + return False; return True; } - /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_r_flush_key(char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return False; + if (r_r == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_r_flush_key"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_r->status)); + if(!prs_uint32("status", ps, depth, &r_r->status)) + return False; return True; } @@ -191,167 +150,197 @@ BOOL reg_io_r_flush_key(char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, int d /******************************************************************* reads or writes SEC_DESC_BUF and SEC_DATA structures. ********************************************************************/ -static BOOL reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, - SEC_DESC_BUF *data, prs_struct *ps, int depth) + +static BOOL reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, SEC_DESC_BUF *data, prs_struct *ps, int depth) { - if (ptr != 0) - { + if (ptr != 0) { uint32 hdr_offset; uint32 old_offset; - smb_io_hdrbuf_pre("hdr_sec", hdr_sec, ps, depth, &hdr_offset); - old_offset = ps->offset; - if (ptr3 != NULL) - { - prs_uint32("ptr3", ps, depth, ptr3); + if(!smb_io_hdrbuf_pre("hdr_sec", hdr_sec, ps, depth, &hdr_offset)) + return False; + + old_offset = prs_offset(ps); + + if (ptr3 != NULL) { + if(!prs_uint32("ptr3", ps, depth, ptr3)) + return False; } - if (ptr3 == NULL || *ptr3 != 0) - { - sec_io_desc_buf("data ", data , ps, depth); + + if (ptr3 == NULL || *ptr3 != 0) { + if(!sec_io_desc_buf("data ", &data, ps, depth)) /* JRA - this line is probably wrong... */ + return False; } - smb_io_hdrbuf_post("hdr_sec", hdr_sec, ps, depth, hdr_offset, - data->max_len, data->len); - ps->offset = old_offset + data->len + sizeof(uint32) * ((ptr3 != NULL) ? 5 : 3); - prs_align(ps); + + if(!smb_io_hdrbuf_post("hdr_sec", hdr_sec, ps, depth, hdr_offset, + data->max_len, data->len)) + return False; + if(!prs_set_offset(ps, old_offset + data->len + sizeof(uint32) * ((ptr3 != NULL) ? 5 : 3))) + return False; + + if(prs_align(ps)) + return False; } return True; } - /******************************************************************* -creates a structure. + Inits a structure. ********************************************************************/ -BOOL make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, - char *key_name, char *key_class, - SEC_ACCESS *sam_access, - SEC_DESC_BUF *sec_buf, - int sec_len, SEC_DESC *sec) + +void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, + char *name, char *class, SEC_ACCESS *sam_access, + SEC_DESC_BUF *sec_buf) { - int len_name = key_name != NULL ? strlen(key_name ) + 1: 0; - int len_class = key_class != NULL ? strlen(key_class) + 1: 0; + int len_name = name != NULL ? strlen(name ) + 1: 0; + int len_class = class != NULL ? strlen(class) + 1: 0; ZERO_STRUCTP(q_c); - memcpy(&(q_c->pnt_pol), hnd, sizeof(q_c->pnt_pol)); + memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); - make_uni_hdr(&(q_c->hdr_name), len_name); - make_unistr2(&(q_c->uni_name), key_name, len_name); + init_uni_hdr(&q_c->hdr_name, len_name); + init_unistr2(&q_c->uni_name, name, len_name); - make_uni_hdr(&(q_c->hdr_class), len_class); - make_unistr2(&(q_c->uni_class), key_class, len_class); + init_uni_hdr(&q_c->hdr_class, len_class); + init_unistr2(&q_c->uni_class, class, len_class); q_c->reserved = 0x00000000; - memcpy(&(q_c->sam_access), sam_access, sizeof(q_c->sam_access)); + memcpy(&q_c->sam_access, sam_access, sizeof(q_c->sam_access)); q_c->ptr1 = 1; q_c->sec_info = DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION; q_c->data = sec_buf; q_c->ptr2 = 1; - make_buf_hdr(&(q_c->hdr_sec), sec_len, sec_len); + init_buf_hdr(&q_c->hdr_sec, sec_buf->len, sec_buf->len); q_c->ptr3 = 1; - make_sec_desc_buf(q_c->data, sec_len, sec); - q_c->unknown_2 = 0x00000000; - - return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_create_key(char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_q_create_key"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(r_q->pnt_pol), ps, depth); - - smb_io_unihdr ("", &(r_q->hdr_name), ps, depth); - smb_io_unistr2("", &(r_q->uni_name), r_q->hdr_name.buffer, ps, depth); - prs_align(ps); - - smb_io_unihdr ("", &(r_q->hdr_class), ps, depth); - smb_io_unistr2("", &(r_q->uni_class), r_q->hdr_class.buffer, ps, depth); - prs_align(ps); - - prs_uint32("reserved", ps, depth, &(r_q->reserved)); - sec_io_access("sam_access", &r_q->sam_access, ps, depth); - - prs_uint32("ptr1", ps, depth, &(r_q->ptr1)); - if (r_q->ptr1 != 0) - { - prs_uint32("sec_info", ps, depth, &(r_q->sec_info)); + if(!smb_io_pol_hnd("", &r_q->pnt_pol, ps, depth)) + return False; + + if(!smb_io_unihdr ("", &r_q->hdr_name, ps, depth)) + return False; + if(!smb_io_unistr2("", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth)) + return False; + if(prs_align(ps)) + return False; + + if(!smb_io_unihdr ("", &r_q->hdr_class, ps, depth)) + return False; + if(!smb_io_unistr2("", &r_q->uni_class, r_q->hdr_class.buffer, ps, depth)) + return False; + if(prs_align(ps)) + return False; + + if(!prs_uint32("reserved", ps, depth, &r_q->reserved)) + return False; + if(!sec_io_access("sam_access", &r_q->sam_access, ps, depth)) + return False; + + if(!prs_uint32("ptr1", ps, depth, &r_q->ptr1)) + return False; + + if (r_q->ptr1 != 0) { + if(!prs_uint32("sec_info", ps, depth, &r_q->sec_info)) + return False; } - prs_uint32("ptr2", ps, depth, &(r_q->ptr2)); - reg_io_hdrbuf_sec(r_q->ptr2, &r_q->ptr3, &r_q->hdr_sec, r_q->data, ps, depth); + if(!prs_uint32("ptr2", ps, depth, &r_q->ptr2)) + return False; + if(!reg_io_hdrbuf_sec(r_q->ptr2, &r_q->ptr3, &r_q->hdr_sec, r_q->data, ps, depth)) + return False; - prs_uint32("unknown_2", ps, depth, &(r_q->unknown_2)); + if(!prs_uint32("unknown_2", ps, depth, &r_q->unknown_2)) + return False; return True; } - /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_r_create_key(char *desc, REG_R_CREATE_KEY *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return False; + if (r_r == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_r_create_key"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(r_r->key_pol), ps, depth); - prs_uint32("unknown", ps, depth, &(r_r->unknown)); + if(!smb_io_pol_hnd("", &r_r->key_pol, ps, depth)) + return False; + if(!prs_uint32("unknown", ps, depth, &r_r->unknown)) + return False; - prs_uint32("status", ps, depth, &(r_r->status)); + if(!prs_uint32("status", ps, depth, &r_r->status)) + return False; return True; } /******************************************************************* -creates a structure. + Inits a structure. ********************************************************************/ -BOOL make_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd, + +void init_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd, char *name) { int len_name = name != NULL ? strlen(name ) + 1: 0; ZERO_STRUCTP(q_c); - memcpy(&(q_c->pnt_pol), hnd, sizeof(q_c->pnt_pol)); - - make_uni_hdr(&(q_c->hdr_name), len_name); - make_unistr2(&(q_c->uni_name), name, len_name); + memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); - return True; + init_uni_hdr(&q_c->hdr_name, len_name); + init_unistr2(&q_c->uni_name, name, len_name); } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_delete_val(char *desc, REG_Q_DELETE_VALUE *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_q_delete_val"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(r_q->pnt_pol), ps, depth); + if(!smb_io_pol_hnd("", &r_q->pnt_pol, ps, depth)) + return False; - smb_io_unihdr ("", &(r_q->hdr_name), ps, depth); - smb_io_unistr2("", &(r_q->uni_name), r_q->hdr_name.buffer, ps, depth); - prs_align(ps); + if(!smb_io_unihdr ("", &r_q->hdr_name, ps, depth)) + return False; + if(!smb_io_unistr2("", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth)) + return False; + if(prs_align(ps)) + return False; return True; } @@ -360,112 +349,127 @@ BOOL reg_io_q_delete_val(char *desc, REG_Q_DELETE_VALUE *r_q, prs_struct *ps, i /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_r_delete_val(char *desc, REG_R_DELETE_VALUE *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return False; + if (r_r == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_r_delete_val"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_r->status)); + if(!prs_uint32("status", ps, depth, &r_r->status)) + return False; return True; } - /******************************************************************* -creates a structure. + Inits a structure. ********************************************************************/ -BOOL make_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd, + +void init_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd, char *name) { int len_name = name != NULL ? strlen(name ) + 1: 0; ZERO_STRUCTP(q_c); - memcpy(&(q_c->pnt_pol), hnd, sizeof(q_c->pnt_pol)); + memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); - make_uni_hdr(&(q_c->hdr_name), len_name); - make_unistr2(&(q_c->uni_name), name, len_name); - - return True; + init_uni_hdr(&q_c->hdr_name, len_name); + init_unistr2(&q_c->uni_name, name, len_name); } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_delete_key(char *desc, REG_Q_DELETE_KEY *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_q_delete_key"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(r_q->pnt_pol), ps, depth); + if(!smb_io_pol_hnd("", &r_q->pnt_pol, ps, depth)) + return False; - smb_io_unihdr ("", &(r_q->hdr_name), ps, depth); - smb_io_unistr2("", &(r_q->uni_name), r_q->hdr_name.buffer, ps, depth); - prs_align(ps); + if(!smb_io_unihdr ("", &r_q->hdr_name, ps, depth)) + return False; + if(!smb_io_unistr2("", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth)) + return False; + if(prs_align(ps)) + return False; return True; } - /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_r_delete_key(char *desc, REG_R_DELETE_KEY *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return False; + if (r_r == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_r_delete_key"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_r->status)); + if(!prs_uint32("status", ps, depth, &r_r->status)) + return False; return True; } - /******************************************************************* -creates a structure. + Inits a structure. ********************************************************************/ -BOOL make_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, + +void init_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, uint32 max_class_len) { ZERO_STRUCTP(q_o); - memcpy(&(q_o->pol), hnd, sizeof(q_o->pol)); - q_o->hdr_class.uni_str_len = 0; - q_o->hdr_class.uni_max_len = max_class_len * 2; - q_o->hdr_class.buffer = max_class_len > 0 ? 1 : 0; + memcpy(&q_o->pol, hnd, sizeof(q_o->pol)); + init_uni_hdr(&q_o->hdr_class, max_class_len); q_o->uni_class.uni_max_len = max_class_len; - - return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_query_key(char *desc, REG_Q_QUERY_KEY *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_q_query_key"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(r_q->pol), ps, depth); - smb_io_unihdr ("", &(r_q->hdr_class), ps, depth); - smb_io_unistr2("", &(r_q->uni_class), r_q->hdr_class.buffer, ps, depth); + if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) + return False; + if(!smb_io_unihdr ("", &r_q->hdr_class, ps, depth)) + return False; + if(!smb_io_unistr2("", &r_q->uni_class, r_q->hdr_class.buffer, ps, depth)) + return False; - prs_align(ps); + if(prs_align(ps)) + return False; return True; } @@ -474,168 +478,198 @@ BOOL reg_io_q_query_key(char *desc, REG_Q_QUERY_KEY *r_q, prs_struct *ps, int d /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return False; + if (r_r == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_r_query_key"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_unihdr ("", &(r_r->hdr_class), ps, depth); - smb_io_unistr2("", &(r_r->uni_class), r_r->hdr_class.buffer, ps, depth); - - prs_align(ps); - - prs_uint32("num_subkeys ", ps, depth, &(r_r->num_subkeys )); - prs_uint32("max_subkeylen ", ps, depth, &(r_r->max_subkeylen )); - prs_uint32("mak_subkeysize", ps, depth, &(r_r->max_subkeysize)); - prs_uint32("num_values ", ps, depth, &(r_r->num_values )); - prs_uint32("max_valnamelen", ps, depth, &(r_r->max_valnamelen)); - prs_uint32("max_valbufsize", ps, depth, &(r_r->max_valbufsize)); - prs_uint32("sec_desc ", ps, depth, &(r_r->sec_desc )); - smb_io_time("mod_time ", &(r_r->mod_time), ps, depth); + if(!smb_io_unihdr ("", &r_r->hdr_class, ps, depth)) + return False; + if(!smb_io_unistr2("", &r_r->uni_class, r_r->hdr_class.buffer, ps, depth)) + return False; + + if(prs_align(ps)) + return False; + + if(!prs_uint32("num_subkeys ", ps, depth, &r_r->num_subkeys)) + return False; + if(!prs_uint32("max_subkeylen ", ps, depth, &r_r->max_subkeylen)) + return False; + if(!prs_uint32("mak_subkeysize", ps, depth, &r_r->max_subkeysize)) + return False; + if(!prs_uint32("num_values ", ps, depth, &r_r->num_values)) + return False; + if(!prs_uint32("max_valnamelen", ps, depth, &r_r->max_valnamelen)) + return False; + if(!prs_uint32("max_valbufsize", ps, depth, &r_r->max_valbufsize)) + return False; + if(!prs_uint32("sec_desc ", ps, depth, &r_r->sec_desc)) + return False; + if(!smb_io_time("mod_time ", &r_r->mod_time, ps, depth)) + return False; - prs_uint32("status", ps, depth, &(r_r->status)); + if(!prs_uint32("status", ps, depth, &r_r->status)) + return False; return True; } - /******************************************************************* -creates a structure. + Inits a structure. ********************************************************************/ -BOOL make_reg_q_unk_1a(REG_Q_UNK_1A *q_o, POLICY_HND *hnd) -{ - memcpy(&(q_o->pol), hnd, sizeof(q_o->pol)); - return True; +void init_reg_q_unk_1a(REG_Q_UNK_1A *q_o, POLICY_HND *hnd) +{ + memcpy(&q_o->pol, hnd, sizeof(q_o->pol)); } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_unk_1a(char *desc, REG_Q_UNK_1A *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_q_unk_1a"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(r_q->pol), ps, depth); + if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) + return False; return True; } - /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_r_unk_1a(char *desc, REG_R_UNK_1A *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return False; + if (r_r == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_r_unk_1a"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - prs_uint32("unknown", ps, depth, &(r_r->unknown)); - prs_uint32("status" , ps, depth, &(r_r->status )); + if(!prs_uint32("unknown", ps, depth, &r_r->unknown)) + return False; + if(!prs_uint32("status" , ps, depth, &r_r->status)) + return False; return True; } - /******************************************************************* -creates a structure. + Inits a structure. ********************************************************************/ -BOOL make_reg_q_open_hku(REG_Q_OPEN_HKU *q_o, + +void init_reg_q_open_hku(REG_Q_OPEN_HKU *q_o, uint16 unknown_0, uint32 level) { q_o->ptr = 1; q_o->unknown_0 = unknown_0; q_o->unknown_1 = 0x0; /* random - changes */ q_o->level = level; - - return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_open_hku(char *desc, REG_Q_OPEN_HKU *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_q_open_hku"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - prs_uint32("ptr ", ps, depth, &(r_q->ptr )); - if (r_q->ptr != 0) - { - prs_uint16("unknown_0", ps, depth, &(r_q->unknown_0)); - prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1)); - prs_uint32("level ", ps, depth, &(r_q->level )); + if(!prs_uint32("ptr ", ps, depth, &r_q->ptr)) + return False; + if (r_q->ptr != 0) { + if(!prs_uint16("unknown_0", ps, depth, &r_q->unknown_0)) + return False; + if(!prs_uint16("unknown_1", ps, depth, &r_q->unknown_1)) + return False; + if(!prs_uint32("level ", ps, depth, &r_q->level)) + return False; } return True; } - /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_r_open_hku(char *desc, REG_R_OPEN_HKU *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return False; + if (r_r == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_r_open_hku"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(r_r->pol), ps, depth); + if(!smb_io_pol_hnd("", &r_r->pol, ps, depth)) + return False; - prs_uint32("status", ps, depth, &(r_r->status)); + if(!prs_uint32("status", ps, depth, &r_r->status)) + return False; return True; } - /******************************************************************* -makes an REG_Q_CLOSE structure. + Inits an REG_Q_CLOSE structure. ********************************************************************/ -BOOL make_reg_q_close(REG_Q_CLOSE *q_c, POLICY_HND *hnd) -{ - if (q_c == NULL || hnd == NULL) return False; - DEBUG(5,("make_reg_q_close\n")); - - memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); +void init_reg_q_close(REG_Q_CLOSE *q_c, POLICY_HND *hnd) +{ + DEBUG(5,("init_reg_q_close\n")); - return True; + memcpy(&q_c->pol, hnd, sizeof(q_c->pol)); } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_close(char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return False; + if (q_u == NULL) + return False; - prs_debug(ps, depth, desc, "reg_io_q_close"); + prs_debug(ps, depth, desc, "reg_io_q_unknown_1"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(q_u->pol), ps, depth); - prs_align(ps); + if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) + return False; + if(prs_align(ps)) + return False; return True; } @@ -643,19 +677,25 @@ BOOL reg_io_q_close(char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth) /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return False; + if (r_u == NULL) + return False; - prs_debug(ps, depth, desc, "reg_io_r_close"); + prs_debug(ps, depth, desc, "reg_io_r_unknown_1"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(r_u->pol), ps, depth); - prs_align(ps); + if(!smb_io_pol_hnd("", &r_u->pol, ps, depth)) + return False; + if(prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } @@ -663,41 +703,43 @@ BOOL reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) /******************************************************************* makes a structure. ********************************************************************/ -BOOL make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, - uint32 sec_info, - uint32 buf_len, SEC_DESC *sec_desc) -{ - if (q_i == NULL) return False; - memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); +void init_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, SEC_DESC_BUF *sec_desc_buf) +{ + memcpy(&q_i->pol, pol, sizeof(q_i->pol)); - q_i->sec_info = sec_info; + q_i->sec_info = DACL_SECURITY_INFORMATION; q_i->ptr = 1; - make_buf_hdr(&(q_i->hdr_sec), buf_len, buf_len); - make_sec_desc_buf(q_i->data, buf_len, sec_desc); - - return True; + init_buf_hdr(&q_i->hdr_sec, sec_desc_buf->len, sec_desc_buf->len); + q_i->data = sec_desc_buf; } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_q_set_key_sec"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(r_q->pol), ps, depth); + if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) + return False; - prs_uint32("sec_info", ps, depth, &(r_q->sec_info)); - prs_uint32("ptr ", ps, depth, &(r_q->ptr )); + if(!prs_uint32("sec_info", ps, depth, &r_q->sec_info)) + return False; + if(!prs_uint32("ptr ", ps, depth, &r_q->ptr)) + return False; - reg_io_hdrbuf_sec(r_q->ptr, NULL, &r_q->hdr_sec, r_q->data, ps, depth); + if(!reg_io_hdrbuf_sec(r_q->ptr, NULL, &r_q->hdr_sec, r_q->data, ps, depth)) + return False; return True; } @@ -705,16 +747,20 @@ BOOL reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, i /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_r_set_key_sec"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_q->status)); + if(!prs_uint32("status", ps, depth, &r_q->status)) + return False; return True; } @@ -723,46 +769,47 @@ BOOL reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, in /******************************************************************* makes a structure. ********************************************************************/ -BOOL make_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, - uint32 sec_info, - uint32 buf_len, SEC_DESC_BUF *sec_buf) -{ - if (q_i == NULL) return False; - memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); +void init_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, + uint32 sec_buf_size, SEC_DESC_BUF *psdb) +{ + memcpy(&q_i->pol, pol, sizeof(q_i->pol)); - q_i->sec_info = sec_info; + q_i->sec_info = OWNER_SECURITY_INFORMATION | + GROUP_SECURITY_INFORMATION | + DACL_SECURITY_INFORMATION; - q_i->ptr = sec_buf != NULL ? 1 : 0; - q_i->data = sec_buf; + q_i->ptr = psdb != NULL ? 1 : 0; + q_i->data = psdb; - if (sec_buf != NULL) - { - make_buf_hdr(&(q_i->hdr_sec), buf_len, 0); - make_sec_desc_buf(q_i->data, buf_len, NULL); - } - - return True; + init_buf_hdr(&q_i->hdr_sec, sec_buf_size, 0); } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_get_key_sec(char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_q_get_key_sec"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(r_q->pol), ps, depth); + if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) + return False; - prs_uint32("sec_info", ps, depth, &(r_q->sec_info)); - prs_uint32("ptr ", ps, depth, &(r_q->ptr )); + if(!prs_uint32("sec_info", ps, depth, &r_q->sec_info)) + return False; + if(!prs_uint32("ptr ", ps, depth, &r_q->ptr)) + return False; - reg_io_hdrbuf_sec(r_q->ptr, NULL, &r_q->hdr_sec, r_q->data, ps, depth); + if(!reg_io_hdrbuf_sec(r_q->ptr, NULL, &r_q->hdr_sec, r_q->data, ps, depth)) + return False; return True; } @@ -771,196 +818,217 @@ BOOL reg_io_q_get_key_sec(char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, i /******************************************************************* makes a structure. ********************************************************************/ - void make_reg_r_get_key_sec(REG_R_GET_KEY_SEC *r_i, POLICY_HND *pol, + void init_reg_r_get_key_sec(REG_R_GET_KEY_SEC *r_i, POLICY_HND *pol, uint32 buf_len, uint8 *buf, uint32 status) { - if (r_i == NULL) return False; - r_i->ptr = 1; - make_buf_hdr(&(r_i->hdr_sec), buf_len, buf_len); - make_sec_desc_buf(r_i->data, buf_len, 1); + init_buf_hdr(&r_i->hdr_sec, buf_len, buf_len); + init_sec_desc_buf(r_i->data, buf_len, 1); r_i->status = status; /* 0x0000 0000 or 0x0000 007a */ - - return True; } #endif /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_r_get_key_sec(char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_r_get_key_sec"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - prs_uint32("ptr ", ps, depth, &(r_q->ptr )); - - if (r_q->ptr != 0) - { - smb_io_hdrbuf("", &(r_q->hdr_sec), ps, depth); - sec_io_desc_buf("", r_q->data, ps, depth); - - prs_align(ps); + if(!prs_uint32("ptr ", ps, depth, &r_q->ptr)) + return False; + + if (r_q->ptr != 0) { + if(!smb_io_hdrbuf("", &r_q->hdr_sec, ps, depth)) + return False; + if(!sec_io_desc_buf("", &r_q->data, ps, depth)) + return False; + if(prs_align(ps)) + return False; } - prs_uint32("status", ps, depth, &(r_q->status)); + if(!prs_uint32("status", ps, depth, &r_q->status)) + return False; return True; } - /******************************************************************* makes a structure. ********************************************************************/ -BOOL make_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, const char *val_name, - uint8 major, uint8 minor) -{ - int len_type = val_name != NULL ? strlen(val_name) + 1 : 0; - if (q_i == NULL) return False; - - memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); - - make_uni_hdr(&(q_i->hdr_val), len_type); - make_unistr2(&(q_i->uni_val), val_name, len_type); +void init_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char *product_type, + time_t unix_time, uint8 major, uint8 minor) +{ + int len_type = strlen(product_type); - q_i->ptr_type = 1; - q_i->type = 0x77872314; + memcpy(&q_i->pol, pol, sizeof(q_i->pol)); - q_i->ptr_uni_type = 0x1; - q_i->uni_type.buf_max_len = 0x104; - q_i->uni_type.buf_len = 0x0; - q_i->uni_type.undoc = 0; + init_uni_hdr(&q_i->hdr_type, len_type); + init_unistr2(&q_i->uni_type, product_type, len_type); - q_i->ptr_max_len = 1; - q_i->buf_max_len = 0x104; + q_i->ptr1 = 1; + unix_to_nt_time(&q_i->time, unix_time); + q_i->major_version1 = major; + q_i->minor_version1 = minor; + memset(q_i->pad1, 0, sizeof(q_i->pad1)); - q_i->ptr_len = 1; - q_i->buf_len = 0x0; + q_i->ptr2 = 1; + q_i->major_version2 = major; + q_i->minor_version2 = minor; + memset(q_i->pad2, 0, sizeof(q_i->pad2)); - return True; + q_i->ptr3 = 1; + q_i->unknown = 0x00000000; } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_q_info"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(r_q->pol), ps, depth); - smb_io_unihdr ("", &(r_q->hdr_val), ps, depth); - smb_io_unistr2("", &(r_q->uni_val), r_q->hdr_val.buffer, ps, depth); - - prs_align(ps); + if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) + return False; + if(!smb_io_unihdr ("", &r_q->hdr_type, ps, depth)) + return False; + if(!smb_io_unistr2("", &r_q->uni_type, r_q->hdr_type.buffer, ps, depth)) + return False; + + if(prs_align(ps)) + return False; - prs_uint32("ptr_type", ps, depth, &(r_q->ptr_type)); - if (r_q->ptr_type != 0) - { - prs_uint32("type", ps, depth, &(r_q->type)); + if(!prs_uint32("ptr1", ps, depth, &r_q->ptr1)) + return False; + + if (r_q->ptr1 != 0) { + if(!smb_io_time("", &r_q->time, ps, depth)) + return False; + if(!prs_uint8 ("major_version1", ps, depth, &r_q->major_version1)) + return False; + if(!prs_uint8 ("minor_version1", ps, depth, &r_q->minor_version1)) + return False; + if(!prs_uint8s(False, "pad1", ps, depth, r_q->pad1, sizeof(r_q->pad1))) + return False; } - prs_uint32("ptr_uni_type", ps, depth, &(r_q->ptr_uni_type)); - - smb_io_buffer2("uni_type", &(r_q->uni_type), r_q->ptr_uni_type, ps, depth); - prs_align(ps); + if(!prs_uint32("ptr2", ps, depth, &r_q->ptr2)) + return False; - prs_uint32("ptr_max_len", ps, depth, &(r_q->ptr_max_len)); - if (r_q->ptr_max_len != 0) - { - prs_uint32("buf_max_len", ps, depth, &(r_q->buf_max_len)); + if (r_q->ptr2 != 0) { + if(!prs_uint8 ("major_version2", ps, depth, &r_q->major_version2)) + return False; + if(!prs_uint8 ("minor_version2", ps, depth, &r_q->minor_version2)) + return False; + if(!prs_uint8s(False, "pad2", ps, depth, r_q->pad2, sizeof(r_q->pad2))) + return False; } - prs_uint32("ptr_len", ps, depth, &(r_q->ptr_len)); - if (r_q->ptr_len != 0) - { - prs_uint32("buf_len", ps, depth, &(r_q->buf_len)); + if(!prs_uint32("ptr3", ps, depth, &r_q->ptr3)) + return False; + + if (r_q->ptr3 != 0) { + if(!prs_uint32("unknown", ps, depth, &r_q->unknown)) + return False; } return True; } - /******************************************************************* -creates a structure. + Inits a structure. ********************************************************************/ -BOOL make_reg_r_info(REG_R_INFO *r_r, - uint32 *type, BUFFER2 *buf, + +void init_reg_r_info(REG_R_INFO *r_r, + uint32 level, char *os_type, + uint32 unknown_0, uint32 unknown_1, uint32 status) { - if (r_r == NULL) return False; + uint8 buf[512]; + int len = dos_struni2((char *)buf, os_type, sizeof(buf)); - r_r->ptr_type = type != NULL ? 1 : 0; - r_r->type = type; + r_r->ptr1 = 1; + r_r->level = level; - r_r->ptr_uni_type = buf != NULL ? 1 : 0; - r_r->uni_type = buf; + r_r->ptr_type = 1; + init_buffer2(&r_r->uni_type, buf, len*2); - if (buf != NULL) - { - r_r->ptr_max_len = 1; - r_r->buf_max_len = r_r->uni_type->buf_max_len; + r_r->ptr2 = 1; + r_r->unknown_0 = unknown_0; - r_r->ptr_len = 1; - r_r->buf_len = r_r->uni_type->buf_len; - } - else - { - r_r->ptr_max_len = 0; - r_r->ptr_len = 0; - } - - r_r->status = status; + r_r->ptr3 = 1; + r_r->unknown_1 = unknown_1; - return True; + r_r->status = status; } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return False; + if (r_r == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_r_info"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - prs_uint32("ptr_type", ps, depth, &(r_r->ptr_type)); - if (r_r->ptr_type != 0) - { - prs_uint32("type", ps, depth, r_r->type); - } + if(!prs_uint32("ptr1", ps, depth, &r_r->ptr1)) + return False; + + if (r_r->ptr1 != 0) { + if(!prs_uint32("level", ps, depth, &r_r->level)) + return False; + if(!prs_uint32("ptr_type", ps, depth, &r_r->ptr_type)) + return False; + + if(!smb_io_buffer2("uni_type", &r_r->uni_type, r_r->ptr_type, ps, depth)) + return False; + if(prs_align(ps)) + return False; + + if(!prs_uint32("ptr2", ps, depth, &r_r->ptr2)) + return False; + + if (r_r->ptr2 != 0) { + if(!prs_uint32("unknown_0", ps, depth, &r_r->unknown_0)) + return False; + } - prs_uint32("ptr_uni_type", ps, depth, &(r_r->ptr_uni_type)); - smb_io_buffer2("uni_type", r_r->uni_type, r_r->ptr_uni_type, ps, depth); - prs_align(ps); + if(!prs_uint32("ptr3", ps, depth, &r_r->ptr3)) + return False; - prs_uint32("ptr_max_len", ps, depth, &(r_r->ptr_max_len)); - if (r_r->ptr_max_len != 0) - { - prs_uint32("buf_max_len", ps, depth, &(r_r->buf_max_len)); - } + if (r_r->ptr3 != 0) { + if(!prs_uint32("unknown_1", ps, depth, &r_r->unknown_1)) + return False; + } - prs_uint32("ptr_len", ps, depth, &(r_r->ptr_len)); - if (r_r->ptr_len != 0) - { - prs_uint32("buf_len", ps, depth, &(r_r->buf_len)); } - - prs_uint32("status", ps, depth, &(r_r->status)); + if(!prs_uint32("status", ps, depth, &r_r->status)) + return False; return True; } @@ -968,20 +1036,17 @@ BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) /******************************************************************* makes a structure. ********************************************************************/ -BOOL make_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol, + +void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol, uint32 val_idx, uint32 max_val_len, uint32 max_buf_len) { - if (q_i == NULL) return False; - ZERO_STRUCTP(q_i); - memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); + memcpy(&q_i->pol, pol, sizeof(q_i->pol)); q_i->val_index = val_idx; - q_i->hdr_name.uni_str_len = 0; - q_i->hdr_name.uni_max_len = max_val_len * 2; - q_i->hdr_name.buffer = max_val_len > 0 ? 1 : 0; + init_uni_hdr(&q_i->hdr_name, max_val_len); q_i->uni_name.uni_max_len = max_val_len; q_i->ptr_type = 1; @@ -995,49 +1060,61 @@ BOOL make_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol, q_i->ptr2 = 1; q_i->len_value2 = 0; - - return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_enum_val(char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int depth) { - if (q_q == NULL) return False; + if (q_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_q_enum_val"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(q_q->pol), ps, depth); + if(!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + return False; - prs_uint32("val_index", ps, depth, &(q_q->val_index)); - smb_io_unihdr ("hdr_name", &(q_q->hdr_name), ps, depth); - smb_io_unistr2("uni_name", &(q_q->uni_name), q_q->hdr_name.buffer, ps, depth); - prs_align(ps); - - prs_uint32("ptr_type", ps, depth, &(q_q->ptr_type)); - - if (q_q->ptr_type != 0) - { - prs_uint32("type", ps, depth, &(q_q->type)); + if(!prs_uint32("val_index", ps, depth, &q_q->val_index)) + return False; + if(!smb_io_unihdr ("hdr_name", &q_q->hdr_name, ps, depth)) + return False; + if(!smb_io_unistr2("uni_name", &q_q->uni_name, q_q->hdr_name.buffer, ps, depth)) + return False; + if(prs_align(ps)) + return False; + + if(!prs_uint32("ptr_type", ps, depth, &q_q->ptr_type)) + return False; + + if (q_q->ptr_type != 0) { + if(!prs_uint32("type", ps, depth, &q_q->type)) + return False; } - prs_uint32("ptr_value", ps, depth, &(q_q->ptr_value)); - smb_io_buffer2("buf_value", &(q_q->buf_value), q_q->ptr_value, ps, depth); - prs_align(ps); - - prs_uint32("ptr1", ps, depth, &(q_q->ptr1)); - if (q_q->ptr1 != 0) - { - prs_uint32("len_value1", ps, depth, &(q_q->len_value1)); + if(!prs_uint32("ptr_value", ps, depth, &q_q->ptr_value)) + return False; + if(!smb_io_buffer2("buf_value", &q_q->buf_value, q_q->ptr_value, ps, depth)) + return False; + if(prs_align(ps)) + return False; + + if(!prs_uint32("ptr1", ps, depth, &q_q->ptr1)) + return False; + if (q_q->ptr1 != 0) { + if(!prs_uint32("len_value1", ps, depth, &q_q->len_value1)) + return False; } - prs_uint32("ptr2", ps, depth, &(q_q->ptr2)); - if (q_q->ptr2 != 0) - { - prs_uint32("len_value2", ps, depth, &(q_q->len_value2)); + if(!prs_uint32("ptr2", ps, depth, &q_q->ptr2)) + return False; + if (q_q->ptr2 != 0) { + if(!prs_uint32("len_value2", ps, depth, &q_q->len_value2)) + return False; } return True; @@ -1046,43 +1123,56 @@ BOOL reg_io_q_enum_val(char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int d /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_r_enum_val(char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_r_enum_val"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_unihdr ("hdr_name", &(r_q->hdr_name), ps, depth); - smb_io_unistr2("uni_name", &(r_q->uni_name), r_q->hdr_name.buffer, ps, depth); - prs_align(ps); - - prs_uint32("ptr_type", ps, depth, &(r_q->ptr_type)); - - if (r_q->ptr_type != 0) - { - prs_uint32("type", ps, depth, &(r_q->type)); + if(!smb_io_unihdr ("hdr_name", &r_q->hdr_name, ps, depth)) + return False; + if(!smb_io_unistr2("uni_name", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth)) + return False; + if(prs_align(ps)) + return False; + + if(!prs_uint32("ptr_type", ps, depth, &r_q->ptr_type)) + return False; + + if (r_q->ptr_type != 0) { + if(!prs_uint32("type", ps, depth, &r_q->type)) + return False; } - prs_uint32("ptr_value", ps, depth, &(r_q->ptr_value)); - smb_io_buffer2("buf_value", r_q->buf_value, r_q->ptr_value, ps, depth); - prs_align(ps); - - prs_uint32("ptr1", ps, depth, &(r_q->ptr1)); - if (r_q->ptr1 != 0) - { - prs_uint32("len_value1", ps, depth, &(r_q->len_value1)); + if(!prs_uint32("ptr_value", ps, depth, &r_q->ptr_value)) + return False; + if(!smb_io_buffer2("buf_value", r_q->buf_value, r_q->ptr_value, ps, depth)) + return False; + if(prs_align(ps)) + return False; + + if(!prs_uint32("ptr1", ps, depth, &r_q->ptr1)) + return False; + if (r_q->ptr1 != 0) { + if(!prs_uint32("len_value1", ps, depth, &r_q->len_value1)) + return False; } - prs_uint32("ptr2", ps, depth, &(r_q->ptr2)); - if (r_q->ptr2 != 0) - { - prs_uint32("len_value2", ps, depth, &(r_q->len_value2)); + if(!prs_uint32("ptr2", ps, depth, &r_q->ptr2)) + return False; + if (r_q->ptr2 != 0) { + if(!prs_uint32("len_value2", ps, depth, &r_q->len_value2)) + return False; } - prs_uint32("status", ps, depth, &(r_q->status)); + if(!prs_uint32("status", ps, depth, &r_q->status)) + return False; return True; } @@ -1090,48 +1180,55 @@ BOOL reg_io_r_enum_val(char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, int d /******************************************************************* makes a structure. ********************************************************************/ -BOOL make_reg_q_create_val(REG_Q_CREATE_VALUE *q_i, POLICY_HND *pol, + +void init_reg_q_create_val(REG_Q_CREATE_VALUE *q_i, POLICY_HND *pol, char *val_name, uint32 type, BUFFER3 *val) { int val_len = strlen(val_name) + 1; - if (q_i == NULL) return False; - ZERO_STRUCTP(q_i); - memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); + memcpy(&q_i->pol, pol, sizeof(q_i->pol)); - make_uni_hdr(&q_i->hdr_name, val_len); - make_unistr2(&(q_i->uni_name), val_name, val_len); + init_uni_hdr(&q_i->hdr_name, val_len); + init_unistr2(&q_i->uni_name, val_name, val_len); q_i->type = type; q_i->buf_value = val; - - return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_create_val(char *desc, REG_Q_CREATE_VALUE *q_q, prs_struct *ps, int depth) { - if (q_q == NULL) return False; + if (q_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_q_create_val"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(q_q->pol), ps, depth); + if(!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + return False; - smb_io_unihdr ("hdr_name", &(q_q->hdr_name), ps, depth); - smb_io_unistr2("uni_name", &(q_q->uni_name), q_q->hdr_name.buffer, ps, depth); - prs_align(ps); - - prs_uint32("type", ps, depth, &(q_q->type)); - smb_io_buffer3("buf_value", q_q->buf_value, ps, depth); - prs_align(ps); + if(!smb_io_unihdr ("hdr_name", &q_q->hdr_name, ps, depth)) + return False; + if(!smb_io_unistr2("uni_name", &q_q->uni_name, q_q->hdr_name.buffer, ps, depth)) + return False; + if(prs_align(ps)) + return False; + + if(!prs_uint32("type", ps, depth, &q_q->type)) + return False; + if(!smb_io_buffer3("buf_value", q_q->buf_value, ps, depth)) + return False; + if(prs_align(ps)) + return False; return True; } @@ -1139,16 +1236,20 @@ BOOL reg_io_q_create_val(char *desc, REG_Q_CREATE_VALUE *q_q, prs_struct *ps, i /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_r_create_val(char *desc, REG_R_CREATE_VALUE *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_r_create_val"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_q->status)); + if(!prs_uint32("status", ps, depth, &r_q->status)) + return False; return True; } @@ -1156,11 +1257,10 @@ BOOL reg_io_r_create_val(char *desc, REG_R_CREATE_VALUE *r_q, prs_struct *ps, i /******************************************************************* makes a structure. ********************************************************************/ -BOOL make_reg_q_enum_key(REG_Q_ENUM_KEY *q_i, POLICY_HND *pol, uint32 key_idx) -{ - if (q_i == NULL) return False; - memcpy(&(q_i->pol), pol, sizeof(q_i->pol)); +void init_reg_q_enum_key(REG_Q_ENUM_KEY *q_i, POLICY_HND *pol, uint32 key_idx) +{ + memcpy(&q_i->pol, pol, sizeof(q_i->pol)); q_i->key_index = key_idx; q_i->key_name_len = 0; @@ -1174,49 +1274,58 @@ BOOL make_reg_q_enum_key(REG_Q_ENUM_KEY *q_i, POLICY_HND *pol, uint32 key_idx) memset(q_i->pad2, 0, sizeof(q_i->pad2)); q_i->ptr3 = 1; - init_nt_time(&(q_i->time)); /* ignored ? */ - - return True; + unix_to_nt_time(&q_i->time, 0); /* current time? */ } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_enum_key(char *desc, REG_Q_ENUM_KEY *q_q, prs_struct *ps, int depth) { - if (q_q == NULL) return False; + if (q_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_q_enum_key"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(q_q->pol), ps, depth); + if(!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + return False; - prs_uint32("key_index", ps, depth, &(q_q->key_index)); - prs_uint16("key_name_len", ps, depth, &(q_q->key_name_len)); - prs_uint16("unknown_1", ps, depth, &(q_q->unknown_1)); - - prs_uint32("ptr1", ps, depth, &(q_q->ptr1)); - - if (q_q->ptr1 != 0) - { - prs_uint32("unknown_2", ps, depth, &(q_q->unknown_2)); - prs_uint8s(False, "pad1", ps, depth, q_q->pad1, sizeof(q_q->pad1)); + if(!prs_uint32("key_index", ps, depth, &q_q->key_index)) + return False; + if(!prs_uint16("key_name_len", ps, depth, &q_q->key_name_len)) + return False; + if(!prs_uint16("unknown_1", ps, depth, &q_q->unknown_1)) + return False; + + if(!prs_uint32("ptr1", ps, depth, &q_q->ptr1)) + return False; + + if (q_q->ptr1 != 0) { + if(!prs_uint32("unknown_2", ps, depth, &q_q->unknown_2)) + return False; + if(!prs_uint8s(False, "pad1", ps, depth, q_q->pad1, sizeof(q_q->pad1))) + return False; } - prs_uint32("ptr2", ps, depth, &(q_q->ptr2)); + if(!prs_uint32("ptr2", ps, depth, &q_q->ptr2)) + return False; - if (q_q->ptr2 != 0) - { - prs_uint8s(False, "pad2", ps, depth, q_q->pad2, sizeof(q_q->pad2)); + if (q_q->ptr2 != 0) { + if(!prs_uint8s(False, "pad2", ps, depth, q_q->pad2, sizeof(q_q->pad2))) + return False; } - prs_uint32("ptr3", ps, depth, &(q_q->ptr3)); + if(!prs_uint32("ptr3", ps, depth, &q_q->ptr3)) + return False; - if (q_q->ptr3 != 0) - { - smb_io_time("", &(q_q->time), ps, depth); + if (q_q->ptr3 != 0) { + if(!smb_io_time("", &q_q->time, ps, depth)) + return False; } return True; @@ -1225,193 +1334,141 @@ BOOL reg_io_q_enum_key(char *desc, REG_Q_ENUM_KEY *q_q, prs_struct *ps, int dep /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_r_enum_key(char *desc, REG_R_ENUM_KEY *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_r_enum_key"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - prs_uint16("key_name_len", ps, depth, &(r_q->key_name_len)); - prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1)); - - prs_uint32("ptr1", ps, depth, &(r_q->ptr1)); - - if (r_q->ptr1 != 0) - { - prs_uint32("unknown_2", ps, depth, &(r_q->unknown_2)); - prs_uint32("unknown_3", ps, depth, &(r_q->unknown_3)); - smb_io_unistr3("key_name", &(r_q->key_name), ps, depth); - prs_align(ps); + if(!prs_uint16("key_name_len", ps, depth, &r_q->key_name_len)) + return False; + if(!prs_uint16("unknown_1", ps, depth, &r_q->unknown_1)) + return False; + + if(!prs_uint32("ptr1", ps, depth, &r_q->ptr1)) + return False; + + if (r_q->ptr1 != 0) { + if(!prs_uint32("unknown_2", ps, depth, &r_q->unknown_2)) + return False; + if(!prs_uint32("unknown_3", ps, depth, &r_q->unknown_3)) + return False; + if(!smb_io_unistr3("key_name", &r_q->key_name, ps, depth)) + return False; + if(prs_align(ps)) + return False; } - prs_uint32("ptr2", ps, depth, &(r_q->ptr2)); + if(!prs_uint32("ptr2", ps, depth, &r_q->ptr2)) + return False; - if (r_q->ptr2 != 0) - { - prs_uint8s(False, "pad2", ps, depth, r_q->pad2, sizeof(r_q->pad2)); + if (r_q->ptr2 != 0) { + if(!prs_uint8s(False, "pad2", ps, depth, r_q->pad2, sizeof(r_q->pad2))) + return False; } - prs_uint32("ptr3", ps, depth, &(r_q->ptr3)); + if(!prs_uint32("ptr3", ps, depth, &r_q->ptr3)) + return False; - if (r_q->ptr3 != 0) - { - smb_io_time("", &(r_q->time), ps, depth); + if (r_q->ptr3 != 0) { + if(!smb_io_time("", &r_q->time, ps, depth)) + return False; } - prs_uint32("status", ps, depth, &(r_q->status)); + if(!prs_uint32("status", ps, depth, &r_q->status)) + return False; return True; } - /******************************************************************* makes a structure. ********************************************************************/ -BOOL make_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, + +void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, char *key_name, uint32 unk) { int len_name = strlen(key_name)+1; - if (r_q == NULL) return False; - - memcpy(&(r_q->pol), pol, sizeof(r_q->pol)); + memcpy(&r_q->pol, pol, sizeof(r_q->pol)); - make_uni_hdr(&(r_q->hdr_name), len_name); - make_unistr2(&(r_q->uni_name), key_name, len_name); + init_uni_hdr(&r_q->hdr_name, len_name); + init_unistr2(&r_q->uni_name, key_name, len_name); r_q->unknown_0 = 0x00000000; r_q->unknown_1 = unk; - - return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_q_entry"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(r_q->pol), ps, depth); - smb_io_unihdr ("", &(r_q->hdr_name), ps, depth); - smb_io_unistr2("", &(r_q->uni_name), r_q->hdr_name.buffer, ps, depth); - - prs_align(ps); + if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) + return False; + if(!smb_io_unihdr ("", &r_q->hdr_name, ps, depth)) + return False; + if(!smb_io_unistr2("", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth)) + return False; + + if(prs_align(ps)) + return False; - prs_uint32("unknown_0", ps, depth, &(r_q->unknown_0)); - prs_uint32("unknown_1", ps, depth, &(r_q->unknown_1)); + if(!prs_uint32("unknown_0", ps, depth, &r_q->unknown_0)) + return False; + if(!prs_uint32("unknown_1", ps, depth, &r_q->unknown_1)) + return False; return True; } - /******************************************************************* -creates a structure. + Inits a structure. ********************************************************************/ -BOOL make_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r, + +void init_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r, POLICY_HND *pol, uint32 status) { - if (r_r == NULL) return False; - - memcpy(&(r_r->pol), pol, sizeof(r_r->pol)); + memcpy(&r_r->pol, pol, sizeof(r_r->pol)); r_r->status = status; - - return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_r_open_entry(char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int depth) { - if (r_r == NULL) return False; + if (r_r == NULL) + return False; prs_debug(ps, depth, desc, "reg_io_r_open_entry"); depth++; - prs_align(ps); + if(prs_align(ps)) + return False; - smb_io_pol_hnd("", &(r_r->pol), ps, depth); + if(!smb_io_pol_hnd("", &r_r->pol, ps, depth)) + return False; - prs_uint32("status", ps, depth, &(r_r->status)); + if(!prs_uint32("status", ps, depth, &r_r->status)) + return False; return True; } - -/******************************************************************* -makes a structure. -********************************************************************/ -BOOL make_reg_q_shutdown(REG_Q_SHUTDOWN *q_i, - const char *msg, uint32 timeout, uint16 flags) -{ - int len = strlen(msg) + 1; - - if (q_i == NULL) return False; - - ZERO_STRUCTP(q_i); - - q_i->ptr_0 = 1; - q_i->ptr_1 = 1; - q_i->ptr_2 = 1; - - make_uni_hdr(&q_i->hdr_msg, len); - make_unistr2(&(q_i->uni_msg), msg, len); - - q_i->timeout = timeout; - q_i->flags = flags; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL reg_io_q_shutdown(char *desc, REG_Q_SHUTDOWN *q_q, prs_struct *ps, int depth) -{ - if (q_q == NULL) return False; - - prs_debug(ps, depth, desc, "reg_io_q_shutdown"); - depth++; - - prs_align(ps); - - prs_uint32("ptr_0", ps, depth, &(q_q->ptr_0)); - prs_uint32("ptr_1", ps, depth, &(q_q->ptr_1)); - prs_uint32("ptr_2", ps, depth, &(q_q->ptr_2)); - - smb_io_unihdr ("hdr_msg", &(q_q->hdr_msg), ps, depth); - smb_io_unistr2("uni_msg", &(q_q->uni_msg), q_q->hdr_msg.buffer, ps, depth); - prs_align(ps); - - prs_uint32("timeout", ps, depth, &(q_q->timeout)); - prs_uint16("flags ", ps, depth, &(q_q->flags )); - prs_align(ps); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL reg_io_r_shutdown(char *desc, REG_R_SHUTDOWN *r_q, prs_struct *ps, int depth) -{ - if (r_q == NULL) return False; - - prs_debug(ps, depth, desc, "reg_io_r_shutdown"); - depth++; - - prs_align(ps); - - prs_uint32("status", ps, depth, &(r_q->status)); - - return True; -} - diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index ac6ea8ea7e..d4ea84628a 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -3,9 +3,10 @@ * Unix SMB/Netbios implementation. * Version 1.9. * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1999, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, - * Copyright (C) Paul Ashton 1997-1999. + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. + * Copyright (C) Jeremy Allison 1999. * * 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 @@ -32,501 +33,476 @@ extern int DEBUGLEVEL; interface/version dce/rpc pipe identification ********************************************************************/ -#define TRANS_SYNT_V2 \ -{ \ - { \ - 0x04, 0x5d, 0x88, 0x8a, \ - 0xeb, 0x1c, 0xc9, 0x11, \ - 0x9f, 0xe8, 0x08, 0x00, \ - 0x2b, 0x10, 0x48, 0x60 \ - }, 0x02 \ -} \ - -#define SYNT_SVCCTL_V2 \ -{ \ - { \ - 0x81, 0xbb, 0x7a, 0x36, \ - 0x44, 0x98, 0xf1, 0x35, \ - 0xad, 0x32, 0x98, 0xf0, \ - 0x38, 0x00, 0x10, 0x03 \ - }, 0x02 \ -} \ - -#define SYNT_BROWSER_V0 \ -{ \ - { \ - 0x98, 0xd0, 0xff, 0x6b, \ - 0x12, 0xa1, 0x10, 0x36, \ - 0x98, 0x33, 0x01, 0x28, \ - 0x92, 0x02, 0x01, 0x62 \ - }, 0x00 \ -} \ - -#define SYNT_NETLOGON_V2 \ -{ \ - { \ - 0x04, 0x5d, 0x88, 0x8a, \ - 0xeb, 0x1c, 0xc9, 0x11, \ - 0x9f, 0xe8, 0x08, 0x00, \ - 0x2b, 0x10, 0x48, 0x60 \ - }, 0x02 \ -} \ - -#define SYNT_WKSSVC_V1 \ -{ \ - { \ - 0x98, 0xd0, 0xff, 0x6b, \ - 0x12, 0xa1, 0x10, 0x36, \ - 0x98, 0x33, 0x46, 0xc3, \ - 0xf8, 0x7e, 0x34, 0x5a \ - }, 0x01 \ -} \ - -#define SYNT_SRVSVC_V3 \ -{ \ - { \ - 0xc8, 0x4f, 0x32, 0x4b, \ - 0x70, 0x16, 0xd3, 0x01, \ - 0x12, 0x78, 0x5a, 0x47, \ - 0xbf, 0x6e, 0xe1, 0x88 \ - }, 0x03 \ -} \ - -#define SYNT_LSARPC_V0 \ -{ \ - { \ - 0x78, 0x57, 0x34, 0x12, \ - 0x34, 0x12, 0xcd, 0xab, \ - 0xef, 0x00, 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xab \ - }, 0x00 \ -} \ - -#define SYNT_SAMR_V1 \ -{ \ - { \ - 0x78, 0x57, 0x34, 0x12, \ - 0x34, 0x12, 0xcd, 0xab, \ - 0xef, 0x00, 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xac \ - }, 0x01 \ -} \ - -#define SYNT_NETLOGON_V1 \ -{ \ - { \ - 0x78, 0x56, 0x34, 0x12, \ - 0x34, 0x12, 0xcd, 0xab, \ - 0xef, 0x00, 0x01, 0x23, \ - 0x45, 0x67, 0xcf, 0xfb \ - }, 0x01 \ -} \ - -#define SYNT_WINREG_V1 \ -{ \ - { \ - 0x01, 0xd0, 0x8c, 0x33, \ - 0x44, 0x22, 0xf1, 0x31, \ - 0xaa, 0xaa, 0x90, 0x00, \ - 0x38, 0x00, 0x10, 0x03 \ - }, 0x01 \ -} \ - -#define SYNT_ATSVC_V1 \ -{ \ - { \ - 0x82, 0x06, 0xf7, 0x1f, \ - 0x51, 0x0a, 0xe8, 0x30, \ - 0x07, 0x6d, 0x74, 0x0b, \ - 0xe8, 0xce, 0xe9, 0x8b \ - }, 0x01 \ -} \ - -#define SYNT_SPOOLSS_V1 \ -{ \ - { \ - 0x78, 0x56, 0x34, 0x12, \ - 0x34, 0x12, 0xcd, 0xab, \ - 0xef, 0x00, 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xab \ - }, 0x01 \ -} \ - -#define SYNT_NONE_V0 \ -{ \ - { \ - 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00 \ - }, 0x00 \ -} \ - -#define SYNT_EVENTLOG_V0 \ -{ \ - { \ - 0xdc, 0x3f, 0x27, 0x82, \ - 0x2a, 0xe3, 0xc3, 0x18, \ - 0x3f, 0x78, 0x82, 0x79, \ - 0x29, 0xdc, 0x23, 0xea \ - }, 0x00 \ -} - \ +#define TRANS_SYNT_V2 \ +{ \ + { \ + 0x8a885d04, 0x1ceb, 0x11c9, \ + { 0x9f, 0xe8, 0x08, 0x00, \ + 0x2b, 0x10, 0x48, 0x60 } \ + }, 0x02 \ +} + +#define SYNT_NETLOGON_V2 \ +{ \ + { \ + 0x8a885d04, 0x1ceb, 0x11c9, \ + { 0x9f, 0xe8, 0x08, 0x00, \ + 0x2b, 0x10, 0x48, 0x60 } \ + }, 0x02 \ +} + +#define SYNT_WKSSVC_V1 \ +{ \ + { \ + 0x6bffd098, 0xa112, 0x3610, \ + { 0x98, 0x33, 0x46, 0xc3, \ + 0xf8, 0x7e, 0x34, 0x5a } \ + }, 0x01 \ +} + +#define SYNT_SRVSVC_V3 \ +{ \ + { \ + 0x4b324fc8, 0x1670, 0x01d3, \ + { 0x12, 0x78, 0x5a, 0x47, \ + 0xbf, 0x6e, 0xe1, 0x88 } \ + }, 0x03 \ +} + +#define SYNT_LSARPC_V0 \ +{ \ + { \ + 0x12345778, 0x1234, 0xabcd, \ + { 0xef, 0x00, 0x01, 0x23, \ + 0x45, 0x67, 0x89, 0xab } \ + }, 0x00 \ +} + +#define SYNT_SAMR_V1 \ +{ \ + { \ + 0x12345778, 0x1234, 0xabcd, \ + { 0xef, 0x00, 0x01, 0x23, \ + 0x45, 0x67, 0x89, 0xac } \ + }, 0x01 \ +} + +#define SYNT_NETLOGON_V1 \ +{ \ + { \ + 0x12345678, 0x1234, 0xabcd, \ + { 0xef, 0x00, 0x01, 0x23, \ + 0x45, 0x67, 0xcf, 0xfb } \ + }, 0x01 \ +} + +#define SYNT_WINREG_V1 \ +{ \ + { \ + 0x338cd001, 0x2244, 0x31f1, \ + { 0xaa, 0xaa, 0x90, 0x00, \ + 0x38, 0x00, 0x10, 0x03 } \ + }, 0x01 \ +} + +#define SYNT_NONE_V0 \ +{ \ + { \ + 0x0, 0x0, 0x0, \ + { 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00 } \ + }, 0x00 \ +} + +/* pipe string names */ +#define PIPE_SRVSVC "\\PIPE\\srvsvc" +#define PIPE_SAMR "\\PIPE\\samr" +#define PIPE_WINREG "\\PIPE\\winreg" +#define PIPE_WKSSVC "\\PIPE\\wkssvc" +#define PIPE_NETLOGON "\\PIPE\\NETLOGON" +#define PIPE_NTLSA "\\PIPE\\ntlsa" +#define PIPE_NTSVCS "\\PIPE\\ntsvcs" +#define PIPE_LSASS "\\PIPE\\lsass" +#define PIPE_LSARPC "\\PIPE\\lsarpc" + struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_BROWSER , SYNT_BROWSER_V0 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_NETLOGON, SYNT_NETLOGON_V1, PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, - { PIPE_ATSVC , SYNT_ATSVC_V1 , PIPE_ATSVC , TRANS_SYNT_V2 }, - { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, - { PIPE_EVENTLOG, SYNT_EVENTLOG_V0, PIPE_EVENTLOG , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; /******************************************************************* -creates an RPC_HDR structure. + Inits an RPC_HDR structure. ********************************************************************/ -BOOL make_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, + +void init_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, uint32 call_id, int data_len, int auth_len) { - if (hdr == NULL) return False; - hdr->major = 5; /* RPC version 5 */ hdr->minor = 0; /* minor version 0 */ hdr->pkt_type = pkt_type; /* RPC packet type */ hdr->flags = flags; /* dce/rpc flags */ - hdr->pack_type = 0x10; /* packed data representation */ + hdr->pack_type[0] = 0x10; /* little-endian data representation */ + hdr->pack_type[1] = 0; /* packed data representation */ + hdr->pack_type[2] = 0; /* packed data representation */ + hdr->pack_type[3] = 0; /* packed data representation */ hdr->frag_len = data_len; /* fragment length, fill in later */ hdr->auth_len = auth_len; /* authentication length */ hdr->call_id = call_id; /* call identifier - match incoming RPC */ - - return True; } /******************************************************************* -reads or writes an RPC_HDR structure. + Reads or writes an RPC_HDR structure. ********************************************************************/ + BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return False; + if (rpc == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr"); depth++; - prs_uint8 ("major ", ps, depth, &(rpc->major)); - prs_uint8 ("minor ", ps, depth, &(rpc->minor)); - prs_uint8 ("pkt_type ", ps, depth, &(rpc->pkt_type)); - prs_uint8 ("flags ", ps, depth, &(rpc->flags)); - prs_uint32("pack_type ", ps, depth, &(rpc->pack_type)); - prs_uint16("frag_len ", ps, depth, &(rpc->frag_len)); - prs_uint16("auth_len ", ps, depth, &(rpc->auth_len)); - prs_uint32("call_id ", ps, depth, &(rpc->call_id)); - - return True; -} + if(!prs_uint8 ("major ", ps, depth, &rpc->major)) + return False; -/******************************************************************* -reads or writes an RPC_HDR_FAULT structure. -********************************************************************/ -BOOL smb_io_rpc_hdr_fault(char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth) -{ - if (rpc == NULL) return False; + if(!prs_uint8 ("minor ", ps, depth, &rpc->minor)) + return False; + if(!prs_uint8 ("pkt_type ", ps, depth, &rpc->pkt_type)) + return False; + if(!prs_uint8 ("flags ", ps, depth, &rpc->flags)) + return False; + if(!prs_uint8("pack_type0", ps, depth, &rpc->pack_type[0])) + return False; + if(!prs_uint8("pack_type1", ps, depth, &rpc->pack_type[1])) + return False; + if(!prs_uint8("pack_type2", ps, depth, &rpc->pack_type[2])) + return False; + if(!prs_uint8("pack_type3", ps, depth, &rpc->pack_type[3])) + return False; - prs_debug(ps, depth, desc, "smb_io_rpc_hdr_fault"); - depth++; + /* + * If reading and pack_type[0] == 0 then the data is in big-endian + * format. Set the flag in the prs_struct to specify reverse-endainness. + */ - prs_uint32("status ", ps, depth, &(rpc->status )); - prs_uint32("reserved", ps, depth, &(rpc->reserved)); + if (ps->io && rpc->pack_type[0] == 0) { + DEBUG(10,("smb_io_rpc_hdr: PDU data format is big-endian. Setting flag.\n")); + prs_set_bigendian_data(ps); + } + if(!prs_uint16("frag_len ", ps, depth, &rpc->frag_len)) + return False; + if(!prs_uint16("auth_len ", ps, depth, &rpc->auth_len)) + return False; + if(!prs_uint32("call_id ", ps, depth, &rpc->call_id)) + return False; return True; } /******************************************************************* -reads or writes an RPC_IFACE structure. + Reads or writes an RPC_IFACE structure. ********************************************************************/ -static BOOL smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) + +static BOOL smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) { - if (ifc == NULL) return False; + if (ifc == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_iface"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; + + if(!prs_uint32 ("data ", ps, depth, &ifc->uuid.time_low)) + return False; + if(!prs_uint16 ("data ", ps, depth, &ifc->uuid.time_mid)) + return False; + if(!prs_uint16 ("data ", ps, depth, &ifc->uuid.time_hi_and_version)) + return False; - prs_uint8s (False, "data ", ps, depth, ifc->data, sizeof(ifc->data)); - prs_uint32 ( "version", ps, depth, &(ifc->version)); + if(!prs_uint8s (False, "data ", ps, depth, ifc->uuid.remaining, sizeof(ifc->uuid.remaining))) + return False; + if(!prs_uint32 ( "version", ps, depth, &(ifc->version))) + return False; return True; } /******************************************************************* -creates an RPC_ADDR_STR structure. - -The name can be null (RPC Alter-Context) + Inits an RPC_ADDR_STR structure. ********************************************************************/ -static BOOL make_rpc_addr_str(RPC_ADDR_STR *str, const char *name) -{ - if (str == NULL ) return False; - if (name == NULL) - { - str->len = 1; - fstrcpy(str->str, ""); - } - else - { - str->len = strlen(name) + 1; - fstrcpy(str->str, name); - } - return True; +static void init_rpc_addr_str(RPC_ADDR_STR *str, char *name) +{ + str->len = strlen(name) + 1; + fstrcpy(str->str, name); } /******************************************************************* -reads or writes an RPC_ADDR_STR structure. + Reads or writes an RPC_ADDR_STR structure. ********************************************************************/ + static BOOL smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) { - if (str == NULL) return False; + if (str == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_addr_str"); depth++; - prs_align(ps); - - prs_uint16 ( "len", ps, depth, &(str->len)); - prs_uint8s (True, "str", ps, depth, (uchar*)str->str, str->len); + if(!prs_align(ps)) + return False; + if(!prs_uint16 ( "len", ps, depth, &str->len)) + return False; + if(!prs_uint8s (True, "str", ps, depth, (uchar*)str->str, MIN(str->len, sizeof(str->str)) )) + return False; return True; } /******************************************************************* -creates an RPC_HDR_BBA structure. + Inits an RPC_HDR_BBA structure. ********************************************************************/ -static BOOL make_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid) -{ - if (bba == NULL) return False; +static void init_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid) +{ bba->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ bba->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ bba->assoc_gid = assoc_gid; /* associated group id (0x0) */ - - return True; } /******************************************************************* -reads or writes an RPC_HDR_BBA structure. + Reads or writes an RPC_HDR_BBA structure. ********************************************************************/ + static BOOL smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return False; + if (rpc == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_bba"); depth++; - prs_uint16("max_tsize", ps, depth, &(rpc->max_tsize)); - prs_uint16("max_rsize", ps, depth, &(rpc->max_rsize)); - prs_uint32("assoc_gid", ps, depth, &(rpc->assoc_gid)); - + if(!prs_uint16("max_tsize", ps, depth, &rpc->max_tsize)) + return False; + if(!prs_uint16("max_rsize", ps, depth, &rpc->max_rsize)) + return False; + if(!prs_uint32("assoc_gid", ps, depth, &rpc->assoc_gid)) + return False; return True; } /******************************************************************* -creates an RPC_HDR_RB structure. + Inits an RPC_HDR_RB structure. ********************************************************************/ -BOOL make_rpc_hdr_rb(RPC_HDR_RB *rpc, + +void init_rpc_hdr_rb(RPC_HDR_RB *rpc, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, uint32 num_elements, uint16 context_id, uint8 num_syntaxes, RPC_IFACE *abstract, RPC_IFACE *transfer) { - if (rpc == NULL) return False; - - make_rpc_hdr_bba(&(rpc->bba), max_tsize, max_rsize, assoc_gid); + init_rpc_hdr_bba(&rpc->bba, max_tsize, max_rsize, assoc_gid); rpc->num_elements = num_elements ; /* the number of elements (0x1) */ rpc->context_id = context_id ; /* presentation context identifier (0x0) */ rpc->num_syntaxes = num_syntaxes ; /* the number of syntaxes (has always been 1?)(0x1) */ /* num and vers. of interface client is using */ - memcpy(&(rpc->abstract), abstract, sizeof(rpc->abstract)); + rpc->abstract = *abstract; /* num and vers. of interface to use for replies */ - memcpy(&(rpc->transfer), transfer, sizeof(rpc->transfer)); - - return True; + rpc->transfer = *transfer; } /******************************************************************* -reads or writes an RPC_HDR_RB structure. + Reads or writes an RPC_HDR_RB structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) + +BOOL smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return False; + if (rpc == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_rb"); depth++; - smb_io_rpc_hdr_bba("", &(rpc->bba), ps, depth); + if(!smb_io_rpc_hdr_bba("", &rpc->bba, ps, depth)) + return False; - prs_uint32("num_elements", ps, depth, &(rpc->num_elements)); - prs_uint16("context_id ", ps, depth, &(rpc->context_id )); - prs_uint8 ("num_syntaxes", ps, depth, &(rpc->num_syntaxes)); + if(!prs_uint32("num_elements", ps, depth, &rpc->num_elements)) + return False; + if(!prs_uint16("context_id ", ps, depth, &rpc->context_id )) + return False; + if(!prs_uint8 ("num_syntaxes", ps, depth, &rpc->num_syntaxes)) + return False; - smb_io_rpc_iface("", &(rpc->abstract), ps, depth); - smb_io_rpc_iface("", &(rpc->transfer), ps, depth); + if(!smb_io_rpc_iface("", &rpc->abstract, ps, depth)) + return False; + if(!smb_io_rpc_iface("", &rpc->transfer, ps, depth)) + return False; return True; } /******************************************************************* -creates an RPC_RESULTS structure. - -lkclXXXX only one reason at the moment! + Inits an RPC_RESULTS structure. + lkclXXXX only one reason at the moment! ********************************************************************/ -static BOOL make_rpc_results(RPC_RESULTS *res, + +static void init_rpc_results(RPC_RESULTS *res, uint8 num_results, uint16 result, uint16 reason) { - if (res == NULL) return False; - res->num_results = num_results; /* the number of results (0x01) */ res->result = result ; /* result (0x00 = accept) */ res->reason = reason ; /* reason (0x00 = no reason specified) */ - - return True; } /******************************************************************* -reads or writes an RPC_RESULTS structure. - -lkclXXXX only one reason at the moment! + Reads or writes an RPC_RESULTS structure. + lkclXXXX only one reason at the moment! ********************************************************************/ -static BOOL smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) + +static BOOL smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) { - if (res == NULL) return False; + if (res == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_results"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint8 ("num_results", ps, depth, &(res->num_results)); + if(!prs_uint8 ("num_results", ps, depth, &res->num_results)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint16("result ", ps, depth, &(res->result )); - prs_uint16("reason ", ps, depth, &(res->reason )); - + if(!prs_uint16("result ", ps, depth, &res->result)) + return False; + if(!prs_uint16("reason ", ps, depth, &res->reason)) + return False; return True; } /******************************************************************* -creates an RPC_HDR_BA structure. + Init an RPC_HDR_BA structure. -lkclXXXX only one reason at the moment! -jfm: nope two ! The pipe_addr can be NULL ! + lkclXXXX only one reason at the moment! ********************************************************************/ -BOOL make_rpc_hdr_ba(RPC_HDR_BA *rpc, + +void init_rpc_hdr_ba(RPC_HDR_BA *rpc, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, - const char *pipe_addr, + char *pipe_addr, uint8 num_results, uint16 result, uint16 reason, RPC_IFACE *transfer) { - if (rpc == NULL || transfer == NULL) return False; - - make_rpc_hdr_bba (&(rpc->bba ), max_tsize, max_rsize, assoc_gid); - make_rpc_addr_str(&(rpc->addr), pipe_addr); - make_rpc_results (&(rpc->res ), num_results, result, reason); + init_rpc_hdr_bba (&rpc->bba, max_tsize, max_rsize, assoc_gid); + init_rpc_addr_str(&rpc->addr, pipe_addr); + init_rpc_results (&rpc->res, num_results, result, reason); /* the transfer syntax from the request */ - memcpy(&(rpc->transfer), transfer, sizeof(rpc->transfer)); - - return True; + memcpy(&rpc->transfer, transfer, sizeof(rpc->transfer)); } /******************************************************************* -reads or writes an RPC_HDR_BA structure. + Reads or writes an RPC_HDR_BA structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) + +BOOL smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return False; + if (rpc == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_ba"); depth++; - smb_io_rpc_hdr_bba ("", &(rpc->bba) , ps, depth); - smb_io_rpc_addr_str("", &(rpc->addr) , ps, depth); - smb_io_rpc_results ("", &(rpc->res) , ps, depth); - smb_io_rpc_iface ("", &(rpc->transfer), ps, depth); - + if(!smb_io_rpc_hdr_bba("", &rpc->bba, ps, depth)) + return False; + if(!smb_io_rpc_addr_str("", &rpc->addr, ps, depth)) + return False; + if(!smb_io_rpc_results("", &rpc->res, ps, depth)) + return False; + if(!smb_io_rpc_iface("", &rpc->transfer, ps, depth)) + return False; return True; } /******************************************************************* -creates an RPC_HDR_REQ structure. + Init an RPC_HDR_REQ structure. ********************************************************************/ -BOOL make_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum) -{ - if (hdr == NULL) return False; +void init_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum) +{ hdr->alloc_hint = alloc_hint; /* allocation hint */ hdr->context_id = 0; /* presentation context identifier */ hdr->opnum = opnum; /* opnum */ - - return True; } /******************************************************************* -reads or writes an RPC_HDR_REQ structure. + Reads or writes an RPC_HDR_REQ structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) + +BOOL smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return False; + if (rpc == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_req"); depth++; - prs_uint32("alloc_hint", ps, depth, &(rpc->alloc_hint)); - prs_uint16("context_id", ps, depth, &(rpc->context_id)); - prs_uint16("opnum ", ps, depth, &(rpc->opnum)); - + if(!prs_uint32("alloc_hint", ps, depth, &rpc->alloc_hint)) + return False; + if(!prs_uint16("context_id", ps, depth, &rpc->context_id)) + return False; + if(!prs_uint16("opnum ", ps, depth, &rpc->opnum)) + return False; return True; } /******************************************************************* -reads or writes an RPC_HDR_RESP structure. + Reads or writes an RPC_HDR_RESP structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) + +BOOL smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return False; + if (rpc == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_resp"); depth++; - prs_uint32("alloc_hint", ps, depth, &(rpc->alloc_hint)); - prs_uint16("context_id", ps, depth, &(rpc->context_id)); - prs_uint8 ("cancel_ct ", ps, depth, &(rpc->cancel_count)); - prs_uint8 ("reserved ", ps, depth, &(rpc->reserved)); - + if(!prs_uint32("alloc_hint", ps, depth, &rpc->alloc_hint)) + return False; + if(!prs_uint16("context_id", ps, depth, &rpc->context_id)) + return False; + if(!prs_uint8 ("cancel_ct ", ps, depth, &rpc->cancel_count)) + return False; + if(!prs_uint8 ("reserved ", ps, depth, &rpc->reserved)) + return False; return True; } /******************************************************************* -creates an RPC_HDR_AUTHA structure. + Init an RPC_HDR_AUTHA structure. ********************************************************************/ -BOOL make_rpc_hdr_autha(RPC_HDR_AUTHA *rai, + +void init_rpc_hdr_autha(RPC_HDR_AUTHA *rai, uint16 max_tsize, uint16 max_rsize, uint8 auth_type, uint8 auth_level, uint8 stub_type_len) { - if (rai == NULL) return False; - rai->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ rai->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ @@ -536,194 +512,228 @@ BOOL make_rpc_hdr_autha(RPC_HDR_AUTHA *rai, rai->padding = 0; /* padding 0x00 */ rai->unknown = 0x0014a0c0; /* non-zero pointer to something */ - - return True; } /******************************************************************* -reads or writes an RPC_HDR_AUTHA structure. + Reads or writes an RPC_HDR_AUTHA structure. ********************************************************************/ + BOOL smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) { - if (rai == NULL) return False; + if (rai == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_autha"); depth++; - prs_uint16("max_tsize ", ps, depth, &(rai->max_tsize)); - prs_uint16("max_rsize ", ps, depth, &(rai->max_rsize)); + if(!prs_uint16("max_tsize ", ps, depth, &rai->max_tsize)) + return False; + if(!prs_uint16("max_rsize ", ps, depth, &rai->max_rsize)) + return False; - prs_uint8 ("auth_type ", ps, depth, &(rai->auth_type )); /* 0x0a nt lm ssp */ - prs_uint8 ("auth_level ", ps, depth, &(rai->auth_level ));/* 0x06 */ - prs_uint8 ("stub_type_len", ps, depth, &(rai->stub_type_len)); - prs_uint8 ("padding ", ps, depth, &(rai->padding )); + if(!prs_uint8 ("auth_type ", ps, depth, &rai->auth_type)) /* 0x0a nt lm ssp */ + return False; + if(!prs_uint8 ("auth_level ", ps, depth, &rai->auth_level)) /* 0x06 */ + return False; + if(!prs_uint8 ("stub_type_len", ps, depth, &rai->stub_type_len)) + return False; + if(!prs_uint8 ("padding ", ps, depth, &rai->padding)) + return False; - prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ + if(!prs_uint32("unknown ", ps, depth, &rai->unknown)) /* 0x0014a0c0 */ + return False; return True; } /******************************************************************* -checks an RPC_HDR_AUTH structure. + Checks an RPC_HDR_AUTH structure. ********************************************************************/ + BOOL rpc_hdr_auth_chk(RPC_HDR_AUTH *rai) { - return ((rai->auth_type == 0x0a || rai->auth_type == 0x44) && - rai->auth_level == 0x06); - - return True; + return (rai->auth_type == NTLMSSP_AUTH_TYPE && rai->auth_level == NTLMSSP_AUTH_LEVEL); } /******************************************************************* -creates an RPC_HDR_AUTH structure. + Inits an RPC_HDR_AUTH structure. ********************************************************************/ -BOOL make_rpc_hdr_auth(RPC_HDR_AUTH *rai, + +void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, uint8 auth_type, uint8 auth_level, uint8 stub_type_len, uint32 ptr) { - if (rai == NULL) return False; - rai->auth_type = auth_type; /* nt lm ssp 0x0a */ rai->auth_level = auth_level; /* 0x06 */ rai->stub_type_len = stub_type_len; /* 0x00 */ rai->padding = 0; /* padding 0x00 */ rai->unknown = ptr; /* non-zero pointer to something */ - - return True; } /******************************************************************* -reads or writes an RPC_HDR_AUTH structure. + Reads or writes an RPC_HDR_AUTH structure. ********************************************************************/ + BOOL smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) { - if (rai == NULL) return False; + if (rai == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_auth"); depth++; - prs_uint8 ("auth_type ", ps, depth, &(rai->auth_type )); /* 0x0a nt lm ssp */ - prs_uint8 ("auth_level ", ps, depth, &(rai->auth_level ));/* 0x06 */ - prs_uint8 ("stub_type_len", ps, depth, &(rai->stub_type_len)); - prs_uint8 ("padding ", ps, depth, &(rai->padding )); + if(!prs_align(ps)) + return False; + + if(!prs_uint8 ("auth_type ", ps, depth, &rai->auth_type)) /* 0x0a nt lm ssp */ + return False; + if(!prs_uint8 ("auth_level ", ps, depth, &rai->auth_level)) /* 0x06 */ + return False; + if(!prs_uint8 ("stub_type_len", ps, depth, &rai->stub_type_len)) + return False; + if(!prs_uint8 ("padding ", ps, depth, &rai->padding)) + return False; - prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ + if(!prs_uint32("unknown ", ps, depth, &rai->unknown)) /* 0x0014a0c0 */ + return False; return True; } /******************************************************************* -checks an RPC_AUTH_NTLMSSP_VERIFIER structure. + Checks an RPC_AUTH_VERIFIER structure. ********************************************************************/ -BOOL rpc_auth_ntlmssp_verifier_chk(RPC_AUTH_NTLMSSP_VERIFIER *rav, + +BOOL rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav, char *signature, uint32 msg_type) { return (strequal(rav->signature, signature) && rav->msg_type == msg_type); - - return True; } /******************************************************************* -creates an RPC_AUTH_NTLMSSP_VERIFIER structure. + Inits an RPC_AUTH_VERIFIER structure. ********************************************************************/ -BOOL make_rpc_auth_ntlmssp_verifier(RPC_AUTH_NTLMSSP_VERIFIER *rav, + +void init_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, char *signature, uint32 msg_type) { - if (rav == NULL) return False; - fstrcpy(rav->signature, signature); /* "NTLMSSP" */ rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */ - - return True; } /******************************************************************* -reads or writes an RPC_AUTH_NTLMSSP_VERIFIER structure. + Reads or writes an RPC_AUTH_VERIFIER structure. ********************************************************************/ -BOOL smb_io_rpc_auth_ntlmssp_verifier(char *desc, RPC_AUTH_NTLMSSP_VERIFIER *rav, prs_struct *ps, int depth) + +BOOL smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) { - if (rav == NULL) return False; + if (rav == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); depth++; - prs_string("signature", ps, depth, rav->signature, 0, sizeof(rav->signature)); /* "NTLMSSP" */ - prs_uint32("msg_type ", ps, depth, &(rav->msg_type )); /* NTLMSSP_MESSAGE_TYPE */ + /* "NTLMSSP" */ + if(!prs_string("signature", ps, depth, rav->signature, strlen("NTLMSSP"), + sizeof(rav->signature))) + return False; + if(!prs_uint32("msg_type ", ps, depth, &rav->msg_type)) /* NTLMSSP_MESSAGE_TYPE */ + return False; return True; } /******************************************************************* -creates an RPC_AUTH_NTLMSSP_NEG structure. + Inits an RPC_AUTH_NTLMSSP_NEG structure. ********************************************************************/ -BOOL make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, + +void init_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, uint32 neg_flgs, fstring myname, fstring domain) { int len_myname = strlen(myname); int len_domain = strlen(domain); - if (neg == NULL) return False; - neg->neg_flgs = neg_flgs ; /* 0x00b2b3 */ - make_str_hdr(&neg->hdr_domain, len_domain, len_domain, 0x20 + len_myname); - make_str_hdr(&neg->hdr_myname, len_myname, len_myname, 0x20); + init_str_hdr(&neg->hdr_domain, len_domain, len_domain, 0x20 + len_myname); + init_str_hdr(&neg->hdr_myname, len_myname, len_myname, 0x20); fstrcpy(neg->myname, myname); fstrcpy(neg->domain, domain); - - return True; } /******************************************************************* -reads or writes an RPC_AUTH_NTLMSSP_NEG structure. - -*** lkclXXXX HACK ALERT! *** + Reads or writes an RPC_AUTH_NTLMSSP_NEG structure. + *** lkclXXXX HACK ALERT! *** ********************************************************************/ + BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) { - if (neg == NULL) return False; + if (neg == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_neg"); depth++; - prs_uint32("neg_flgs ", ps, depth, &(neg->neg_flgs)); + if(!prs_uint32("neg_flgs ", ps, depth, &neg->neg_flgs)) + return False; - if (ps->io) - { + if (ps->io) { uint32 old_offset; + uint32 old_neg_flags = neg->neg_flgs; /* reading */ ZERO_STRUCTP(neg); - smb_io_strhdr("hdr_domain", &(neg->hdr_domain), ps, depth); - smb_io_strhdr("hdr_myname", &(neg->hdr_myname), ps, depth); + neg->neg_flgs = old_neg_flags; + + if(!smb_io_strhdr("hdr_domain", &neg->hdr_domain, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_myname", &neg->hdr_myname, ps, depth)) + return False; + + old_offset = prs_offset(ps); - old_offset = ps->offset; + /* lkclXXXX HACK! */ + if(!prs_set_offset(ps, neg->hdr_myname.buffer + 0x50)) + return False; - ps->offset = neg->hdr_myname .buffer + 0x50; /* lkclXXXX HACK! */ - prs_uint8s(True , "myname", ps, depth, (uint8*)neg->myname , MIN(neg->hdr_myname .str_str_len, sizeof(neg->myname ))); - old_offset += neg->hdr_myname .str_str_len; + if(!prs_uint8s(True, "myname", ps, depth, (uint8*)neg->myname, + MIN(neg->hdr_myname.str_str_len, sizeof(neg->myname)))) + return False; + + old_offset += neg->hdr_myname.str_str_len; + + /* lkclXXXX HACK! */ + if(!prs_set_offset(ps, neg->hdr_domain.buffer + 0x50)) + return False; + + if(!prs_uint8s(True, "domain", ps, depth, (uint8*)neg->domain, + MIN(neg->hdr_domain.str_str_len, sizeof(neg->domain )))) + return False; - ps->offset = neg->hdr_domain .buffer + 0x50; /* lkclXXXX HACK! */ - prs_uint8s(True , "domain", ps, depth, (uint8*)neg->domain , MIN(neg->hdr_domain .str_str_len, sizeof(neg->domain ))); old_offset += neg->hdr_domain .str_str_len; - ps->offset = old_offset; - } - else - { + if(!prs_set_offset(ps, old_offset)) + return False; + } else { /* writing */ - smb_io_strhdr("hdr_domain", &(neg->hdr_domain), ps, depth); - smb_io_strhdr("hdr_myname", &(neg->hdr_myname), ps, depth); - - prs_uint8s(True , "myname", ps, depth, (uint8*)neg->myname , MIN(neg->hdr_myname .str_str_len, sizeof(neg->myname ))); - prs_uint8s(True , "domain", ps, depth, (uint8*)neg->domain , MIN(neg->hdr_domain .str_str_len, sizeof(neg->domain ))); + if(!smb_io_strhdr("hdr_domain", &neg->hdr_domain, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_myname", &neg->hdr_myname, ps, depth)) + return False; + + if(!prs_uint8s(True, "myname", ps, depth, (uint8*)neg->myname, + MIN(neg->hdr_myname.str_str_len, sizeof(neg->myname)))) + return False; + if(!prs_uint8s(True, "domain", ps, depth, (uint8*)neg->domain, + MIN(neg->hdr_domain.str_str_len, sizeof(neg->domain )))) + return False; } return True; @@ -732,76 +742,72 @@ BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru /******************************************************************* creates an RPC_AUTH_NTLMSSP_CHAL structure. ********************************************************************/ -BOOL make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, + +void init_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, uint32 neg_flags, uint8 challenge[8]) { - if (chl == NULL) return False; - chl->unknown_1 = 0x0; chl->unknown_2 = 0x00000028; chl->neg_flags = neg_flags; /* 0x0082b1 */ memcpy(chl->challenge, challenge, sizeof(chl->challenge)); - bzero (chl->reserved , sizeof(chl->reserved)); - - return True; + memset((char *)chl->reserved , '\0', sizeof(chl->reserved)); } /******************************************************************* -reads or writes an RPC_AUTH_NTLMSSP_CHAL structure. + Reads or writes an RPC_AUTH_NTLMSSP_CHAL structure. ********************************************************************/ + BOOL smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth) { - if (chl == NULL) return False; + if (chl == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chal"); depth++; - prs_uint32("unknown_1", ps, depth, &(chl->unknown_1)); /* 0x0000 0000 */ - prs_uint32("unknown_2", ps, depth, &(chl->unknown_2)); /* 0x0000 b2b3 */ - prs_uint32("neg_flags", ps, depth, &(chl->neg_flags)); /* 0x0000 82b1 */ + if(!prs_uint32("unknown_1", ps, depth, &chl->unknown_1)) /* 0x0000 0000 */ + return False; + if(!prs_uint32("unknown_2", ps, depth, &chl->unknown_2)) /* 0x0000 b2b3 */ + return False; + if(!prs_uint32("neg_flags", ps, depth, &chl->neg_flags)) /* 0x0000 82b1 */ + return False; - prs_uint8s (False, "challenge", ps, depth, chl->challenge, sizeof(chl->challenge)); - prs_uint8s (False, "reserved ", ps, depth, chl->reserved , sizeof(chl->reserved )); + if(!prs_uint8s (False, "challenge", ps, depth, chl->challenge, sizeof(chl->challenge))) + return False; + if(!prs_uint8s (False, "reserved ", ps, depth, chl->reserved , sizeof(chl->reserved ))) + return False; return True; } /******************************************************************* -creates an RPC_AUTH_NTLMSSP_RESP structure. - -*** lkclXXXX FUDGE! HAVE TO MANUALLY SPECIFY OFFSET HERE (0x1c bytes) *** -*** lkclXXXX the actual offset is at the start of the auth verifier *** + Inits an RPC_AUTH_NTLMSSP_RESP structure. + *** lkclXXXX FUDGE! HAVE TO MANUALLY SPECIFY OFFSET HERE (0x1c bytes) *** + *** lkclXXXX the actual offset is at the start of the auth verifier *** ********************************************************************/ -BOOL make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, - uchar lm_resp[24], - uchar *nt_resp, size_t nt_len, + +void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, + uchar lm_resp[24], uchar nt_resp[24], char *domain, char *user, char *wks, uint32 neg_flags) { uint32 offset; int dom_len = strlen(domain); - int wks_len = strlen(wks ); - int usr_len = strlen(user ); - int lm_len = nt_len != 0 ? (lm_resp != NULL ? 24 : 0) : 1; + int wks_len = strlen(wks); + int usr_len = strlen(user); + int lm_len = (lm_resp != NULL) ? 24 : 0; + int nt_len = (nt_resp != NULL) ? 24 : 0; DEBUG(5,("make_rpc_auth_ntlmssp_resp\n")); - if (rsp == NULL) return False; - #ifdef DEBUG_PASSWORD DEBUG(100,("lm_resp\n")); - if (lm_resp != NULL) - { - dump_data(100, lm_resp, lm_len); - } + dump_data(100, (char *)lm_resp, 24); DEBUG(100,("nt_resp\n")); - if (nt_resp != NULL) - { - dump_data(100, nt_resp, nt_len); - } + dump_data(100, (char *)nt_resp, 24); #endif DEBUG(6,("dom: %s user: %s wks: %s neg_flgs: 0x%x\n", @@ -816,153 +822,190 @@ BOOL make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, usr_len *= 2; } - make_str_hdr(&rsp->hdr_domain , dom_len, dom_len, offset); + init_str_hdr(&rsp->hdr_domain, dom_len, dom_len, offset); offset += dom_len; - make_str_hdr(&rsp->hdr_usr , usr_len, usr_len, offset); + init_str_hdr(&rsp->hdr_usr, usr_len, usr_len, offset); offset += usr_len; - make_str_hdr(&rsp->hdr_wks , wks_len, wks_len, offset); + init_str_hdr(&rsp->hdr_wks, wks_len, wks_len, offset); offset += wks_len; - make_str_hdr(&rsp->hdr_lm_resp, lm_len , lm_len , offset); + init_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, offset); offset += lm_len; - make_str_hdr(&rsp->hdr_nt_resp, nt_len , nt_len , offset); + init_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, offset); offset += nt_len; - make_str_hdr(&rsp->hdr_sess_key, 0, 0, offset); + init_str_hdr(&rsp->hdr_sess_key, 0, 0, offset); rsp->neg_flags = neg_flags; - if (lm_resp != NULL && lm_len != 1) - { - memcpy(rsp->lm_resp, lm_resp, lm_len); - } - else - { - rsp->lm_resp[0] = 0; - } - if (nt_resp != NULL) - { - memcpy(rsp->nt_resp, nt_resp, nt_len); - } - else - { - rsp->nt_resp[0] = 0; - } + memcpy(rsp->lm_resp, lm_resp, 24); + memcpy(rsp->nt_resp, nt_resp, 24); - if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) - { - ascii_to_unibuf(rsp->domain, domain, sizeof(rsp->domain)-2); - ascii_to_unibuf(rsp->user , user , sizeof(rsp->user )-2); - ascii_to_unibuf(rsp->wks , wks , sizeof(rsp->wks )-2); - } - else - { + if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { + dos_struni2(rsp->domain, domain, sizeof(rsp->domain)); + dos_struni2(rsp->user, user, sizeof(rsp->user)); + dos_struni2(rsp->wks, wks, sizeof(rsp->wks)); + } else { fstrcpy(rsp->domain, domain); - fstrcpy(rsp->user , user ); - fstrcpy(rsp->wks , wks ); + fstrcpy(rsp->user, user); + fstrcpy(rsp->wks, wks); } rsp->sess_key[0] = 0; - - return True; } /******************************************************************* -reads or writes an RPC_AUTH_NTLMSSP_RESP structure. - -*** lkclXXXX FUDGE! HAVE TO MANUALLY SPECIFY OFFSET HERE (0x1c bytes) *** -*** lkclXXXX the actual offset is at the start of the auth verifier *** + Reads or writes an RPC_AUTH_NTLMSSP_RESP structure. + *** lkclXXXX FUDGE! HAVE TO MANUALLY SPECIFY OFFSET HERE (0x1c bytes) *** + *** lkclXXXX the actual offset is at the start of the auth verifier *** ********************************************************************/ + BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) { - if (rsp == NULL) return False; + if (rsp == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_resp"); depth++; - if (ps->io) - { + if (ps->io) { uint32 old_offset; /* reading */ ZERO_STRUCTP(rsp); - smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); - smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); - smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); - smb_io_strhdr("hdr_user ", &rsp->hdr_usr , ps, depth); - smb_io_strhdr("hdr_wks ", &rsp->hdr_wks , ps, depth); - smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth); + if(!smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_domain ", &rsp->hdr_domain, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_user ", &rsp->hdr_usr, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_wks ", &rsp->hdr_wks, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth)) + return False; + + if(!prs_uint32("neg_flags", ps, depth, &rsp->neg_flags)) /* 0x0000 82b1 */ + return False; + + old_offset = prs_offset(ps); - prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ + if(!prs_set_offset(ps, rsp->hdr_domain.buffer + 0x1c)) + return False; - old_offset = ps->offset; + if(!prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain, + MIN(rsp->hdr_domain.str_str_len, sizeof(rsp->domain)))) + return False; - ps->offset = rsp->hdr_domain .buffer + 0x1c; - prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); - old_offset += rsp->hdr_domain .str_str_len; + old_offset += rsp->hdr_domain.str_str_len; - ps->offset = rsp->hdr_usr .buffer + 0x1c; - prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); - old_offset += rsp->hdr_usr .str_str_len; + if(!prs_set_offset(ps, rsp->hdr_usr.buffer + 0x1c)) + return False; - ps->offset = rsp->hdr_wks .buffer + 0x1c; - prs_uint8s(True , "wks ", ps, depth, (uint8*)rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); - old_offset += rsp->hdr_wks .str_str_len; + if(!prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user, + MIN(rsp->hdr_usr.str_str_len, sizeof(rsp->user)))) + return False; - ps->offset = rsp->hdr_lm_resp .buffer + 0x1c; - prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); - old_offset += rsp->hdr_lm_resp .str_str_len; + old_offset += rsp->hdr_usr.str_str_len; - ps->offset = rsp->hdr_nt_resp .buffer + 0x1c; - prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); - old_offset += rsp->hdr_nt_resp .str_str_len; + if(!prs_set_offset(ps, rsp->hdr_wks.buffer + 0x1c)) + return False; + + if(!prs_uint8s(True, "wks ", ps, depth, (uint8*)rsp->wks, + MIN(rsp->hdr_wks.str_str_len, sizeof(rsp->wks)))) + return False; + + old_offset += rsp->hdr_wks.str_str_len; + + if(!prs_set_offset(ps, rsp->hdr_lm_resp.buffer + 0x1c)) + return False; + + if(!prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp, + MIN(rsp->hdr_lm_resp.str_str_len, sizeof(rsp->lm_resp )))) + return False; + + old_offset += rsp->hdr_lm_resp.str_str_len; + + if(!prs_set_offset(ps, rsp->hdr_nt_resp.buffer + 0x1c)) + return False; + + if(!prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp, + MIN(rsp->hdr_nt_resp.str_str_len, sizeof(rsp->nt_resp )))) + return False; + + old_offset += rsp->hdr_nt_resp.str_str_len; + + if (rsp->hdr_sess_key.str_str_len != 0) { + + if(!prs_set_offset(ps, rsp->hdr_sess_key.buffer + 0x1c)) + return False; - if (rsp->hdr_sess_key.str_str_len != 0) - { - ps->offset = rsp->hdr_sess_key.buffer + 0x1c; old_offset += rsp->hdr_sess_key.str_str_len; - prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); + + if(!prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, + MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key)))) + return False; } - ps->offset = old_offset; - } - else - { + if(!prs_set_offset(ps, old_offset)) + return False; + } else { /* writing */ - smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); - smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); - smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); - smb_io_strhdr("hdr_user ", &rsp->hdr_usr , ps, depth); - smb_io_strhdr("hdr_wks ", &rsp->hdr_wks , ps, depth); - smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth); - - prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ - - prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); - prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); - prs_uint8s(True , "wks ", ps, depth, (uint8*)rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); - prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); - prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); - prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); + if(!smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_domain ", &rsp->hdr_domain, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_user ", &rsp->hdr_usr, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_wks ", &rsp->hdr_wks, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth)) + return False; + + if(!prs_uint32("neg_flags", ps, depth, &rsp->neg_flags)) /* 0x0000 82b1 */ + return False; + + if(!prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain, + MIN(rsp->hdr_domain.str_str_len, sizeof(rsp->domain)))) + return False; + + if(!prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user, + MIN(rsp->hdr_usr.str_str_len, sizeof(rsp->user)))) + return False; + + if(!prs_uint8s(True , "wks ", ps, depth, (uint8*)rsp->wks, + MIN(rsp->hdr_wks.str_str_len, sizeof(rsp->wks)))) + return False; + if(!prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp, + MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp)))) + return False; + if(!prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp, + MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp )))) + return False; + if(!prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, + MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key)))) + return False; } return True; } /******************************************************************* -checks an RPC_AUTH_NTLMSSP_CHK structure. + Checks an RPC_AUTH_NTLMSSP_CHK structure. ********************************************************************/ + BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 seq_num) { if (chk == NULL) - { return False; - } if (chk->crc32 != crc32 || chk->ver != NTLMSSP_SIGN_VERSION || @@ -975,41 +1018,44 @@ BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 seq_nu return False; } return True; - - return True; } /******************************************************************* -creates an RPC_AUTH_NTLMSSP_CHK structure. + Inits an RPC_AUTH_NTLMSSP_CHK structure. ********************************************************************/ -BOOL make_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, + +void init_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 ver, uint32 crc32, uint32 seq_num) { - if (chk == NULL) return False; - - chk->ver = ver ; + chk->ver = ver; chk->reserved = 0x0; - chk->crc32 = crc32 ; - chk->seq_num = seq_num ; - - return True; + chk->crc32 = crc32; + chk->seq_num = seq_num; } /******************************************************************* -reads or writes an RPC_AUTH_NTLMSSP_CHK structure. + Reads or writes an RPC_AUTH_NTLMSSP_CHK structure. ********************************************************************/ + BOOL smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth) { - if (chk == NULL) return False; + if (chk == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chk"); depth++; - prs_uint32("ver ", ps, depth, &(chk->ver )); - prs_uint32("reserved", ps, depth, &(chk->reserved)); - prs_uint32("crc32 ", ps, depth, &(chk->crc32 )); - prs_uint32("seq_num ", ps, depth, &(chk->seq_num )); + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ver ", ps, depth, &chk->ver)) + return False; + if(!prs_uint32("reserved", ps, depth, &chk->reserved)) + return False; + if(!prs_uint32("crc32 ", ps, depth, &chk->crc32)) + return False; + if(!prs_uint32("seq_num ", ps, depth, &chk->seq_num)) + return False; return True; } - diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index cedfbdebd3..effe329376 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2,9 +2,9 @@ * Unix SMB/Netbios implementation. * Version 1.9. * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1999, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, - * Copyright (C) Paul Ashton 1997-1999. + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. * * 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 @@ -28,444 +28,314 @@ extern int DEBUGLEVEL; /******************************************************************* -makes a SAMR_Q_CLOSE_HND structure. + Inits a SAMR_Q_CLOSE_HND structure. ********************************************************************/ -BOOL make_samr_q_close_hnd(SAMR_Q_CLOSE_HND *q_c, POLICY_HND *hnd) -{ - if (q_c == NULL || hnd == NULL) return False; - - DEBUG(5,("make_samr_q_close_hnd\n")); - memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); +void init_samr_q_close_hnd(SAMR_Q_CLOSE_HND *q_c, POLICY_HND *hnd) +{ + DEBUG(5,("init_samr_q_close_hnd\n")); - return True; + memcpy(&q_c->pol, hnd, sizeof(q_c->pol)); } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ + BOOL samr_io_q_close_hnd(char *desc, SAMR_Q_CLOSE_HND *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return False; + if (q_u == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_q_close_hnd"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); - prs_align(ps); + if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ + BOOL samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return False; + if (r_u == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_r_close_hnd"); depth++; - prs_align(ps); - - smb_io_pol_hnd("pol", &(r_u->pol), ps, depth); - prs_align(ps); - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -makes a SAMR_Q_LOOKUP_DOMAIN structure. -********************************************************************/ -BOOL make_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN *q_u, - POLICY_HND *pol, const char *dom_name) -{ - int len_name = strlen(dom_name); - - if (q_u == NULL) return False; + if(!prs_align(ps)) + return False; - DEBUG(5,("make_samr_q_lookup_domain\n")); + if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; - memcpy(&(q_u->connect_pol), pol, sizeof(*pol)); - - make_uni_hdr(&(q_u->hdr_domain), len_name); - make_unistr2(&(q_u->uni_domain), dom_name, len_name); + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_lookup_domain(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++; - - prs_align(ps); - - smb_io_pol_hnd("connect_pol", &(q_u->connect_pol), ps, depth); - prs_align(ps); - - smb_io_unihdr("hdr_domain", &(q_u->hdr_domain), ps, depth); - smb_io_unistr2("uni_domain", &(q_u->uni_domain), - q_u->hdr_domain.buffer, ps, depth); - prs_align(ps); - - return True; -} /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_lookup_domain(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++; - - prs_align(ps); - prs_uint32("ptr", ps, depth, &(r_u->ptr_sid)); - - if (r_u->ptr_sid != 0) - { - smb_io_dom_sid2("sid", &(r_u->dom_sid), ps, depth); - prs_align(ps); - } - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL make_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, - const POLICY_HND *connect_pol, uint32 flags, - const DOM_SID *sid) +void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, + POLICY_HND *connect_pol, uint32 rid, + DOM_SID *sid) { - if (q_u == NULL) return False; - - DEBUG(5,("samr_make_samr_q_open_domain\n")); + DEBUG(5,("samr_init_q_open_domain\n")); memcpy(&q_u->connect_pol, connect_pol, sizeof(q_u->connect_pol)); - q_u->flags = flags; - make_dom_sid2(&(q_u->dom_sid), sid); - - return True; + q_u->rid = rid; + init_dom_sid2(&q_u->dom_sid, sid); } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN *q_u, prs_struct *ps, int depth) + +BOOL samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return False; + if (q_u == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_q_open_domain"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("connect_pol", &(q_u->connect_pol), ps, depth); - prs_align(ps); + if(!smb_io_pol_hnd("connect_pol", &q_u->connect_pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; - prs_uint32("flags", ps, depth, &(q_u->flags)); + if(!prs_uint32("rid", ps, depth, &q_u->rid)) + return False; - smb_io_dom_sid2("sid", &(q_u->dom_sid), ps, depth); - prs_align(ps); + if(!smb_io_dom_sid2("sid", &q_u->dom_sid, ps, depth)) + return False; + if(!prs_align(ps)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN *r_u, prs_struct *ps, int depth) + +BOOL samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return False; + if (r_u == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_r_open_domain"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("domain_pol", &(r_u->domain_pol), ps, depth); - prs_align(ps); + if(!smb_io_pol_hnd("domain_pol", &r_u->domain_pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL make_samr_q_unknown_2c(SAMR_Q_UNKNOWN_2C *q_u, POLICY_HND *user_pol) -{ - if (q_u == NULL) return False; - DEBUG(5,("samr_make_samr_q_unknown_2c\n")); +void init_samr_q_unknown_2c(SAMR_Q_UNKNOWN_2C *q_u, POLICY_HND *user_pol) +{ + DEBUG(5,("samr_init_q_unknown_2c\n")); memcpy(&q_u->user_pol, user_pol, sizeof(q_u->user_pol)); - - return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ + BOOL samr_io_q_unknown_2c(char *desc, SAMR_Q_UNKNOWN_2C *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return False; + if (q_u == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_q_unknown_2c"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("user_pol", &(q_u->user_pol), ps, depth); - prs_align(ps); + if(!smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; return True; } /******************************************************************* -makes a structure. + Inits a structure. ********************************************************************/ -BOOL make_samr_r_unknown_2c(SAMR_R_UNKNOWN_2C *q_u, uint32 status) -{ - if (q_u == NULL) return False; - DEBUG(5,("samr_make_r_unknown_2c\n")); +void init_samr_r_unknown_2c(SAMR_R_UNKNOWN_2C *q_u, uint32 status) +{ + DEBUG(5,("samr_init_r_unknown_2c\n")); - q_u->unknown_0 = 0x00150000; + q_u->unknown_0 = 0x00160000; q_u->unknown_1 = 0x00000000; q_u->status = status; - - return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ + BOOL samr_io_r_unknown_2c(char *desc, SAMR_R_UNKNOWN_2C *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return False; + if (r_u == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_r_unknown_2c"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("unknown_0", ps, depth, &(r_u->unknown_0)); - prs_uint32("unknown_1", ps, depth, &(r_u->unknown_1)); - prs_uint32("status ", ps, depth, &(r_u->status )); + if(!prs_uint32("unknown_0", ps, depth, &r_u->unknown_0)) + return False; + if(!prs_uint32("unknown_1", ps, depth, &r_u->unknown_1)) + return False; + if(!prs_uint32("status ", ps, depth, &r_u->status)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Inits a SAMR_Q_UNKNOWN_3 structure. ********************************************************************/ -BOOL make_samr_q_unknown_3(SAMR_Q_UNKNOWN_3 *q_u, + +void init_samr_q_unknown_3(SAMR_Q_UNKNOWN_3 *q_u, POLICY_HND *user_pol, uint16 switch_value) { - if (q_u == NULL) return False; - - DEBUG(5,("samr_make_samr_q_unknown_3\n")); + DEBUG(5,("samr_init_q_unknown_3\n")); memcpy(&q_u->user_pol, user_pol, sizeof(q_u->user_pol)); q_u->switch_value = switch_value; - - return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ + BOOL samr_io_q_unknown_3(char *desc, SAMR_Q_UNKNOWN_3 *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return False; + if (q_u == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_q_unknown_3"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("user_pol", &(q_u->user_pol), ps, depth); - prs_align(ps); + if(!smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth)) + return False; - prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); - prs_align(ps); + if(!prs_align(ps)) + return False; + + if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) + return False; + if(!prs_align(ps)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Inits a SAMR_Q_QUERY_DOMAIN_INFO structure. ********************************************************************/ -BOOL make_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO *q_u, + +void init_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO *q_u, POLICY_HND *domain_pol, uint16 switch_value) { - if (q_u == NULL) return False; - - DEBUG(5,("samr_make_samr_q_query_dom_info\n")); + DEBUG(5,("init_samr_q_query_dom_info\n")); memcpy(&q_u->domain_pol, domain_pol, sizeof(q_u->domain_pol)); q_u->switch_value = switch_value; - - return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ + BOOL samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return False; + if (q_u == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_q_query_dom_info"); depth++; - prs_align(ps); - - smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth); - prs_align(ps); - - prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); - prs_align(ps); - - return True; -} - - -/******************************************************************* -makes a structure. -********************************************************************/ -BOOL make_unk_info3(SAM_UNK_INFO_3 *u_3) -{ - if (u_3 == NULL) return False; - - u_3->unknown_0 = 0x00000000; - u_3->unknown_1 = 0x80000000; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL sam_io_unk_info3(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++; - - prs_uint32("unknown_0", ps, depth, &u_3->unknown_0); /* 0x0000 0000 */ - prs_uint32("unknown_1", ps, depth, &u_3->unknown_1); /* 0x8000 0000 */ - - prs_align(ps); - - - return True; -} - -/******************************************************************* -makes a structure. -********************************************************************/ -BOOL make_unk_info6(SAM_UNK_INFO_6 *u_6) -{ - if (u_6 == NULL) return False; - - u_6->unknown_0 = 0x00000000; - u_6->ptr_0 = 1; - memset(u_6->padding, 0, sizeof(u_6->padding)); /* 12 bytes zeros */ - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL sam_io_unk_info6(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++; - - prs_uint32("unknown_0", ps, depth, &u_6->unknown_0); /* 0x0000 0000 */ - prs_uint32("ptr_0", ps, depth, &u_6->ptr_0); /* pointer to unknown structure */ - prs_uint8s(False, "padding", ps, depth, u_6->padding, sizeof(u_6->padding)); /* 12 bytes zeros */ - - prs_align(ps); - + if(!prs_align(ps)) + return False; - return True; -} + if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; -/******************************************************************* -makes a structure. -********************************************************************/ -BOOL make_unk_info7(SAM_UNK_INFO_7 *u_7) -{ - if (u_7 == NULL) return False; + if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) + return False; + if(!prs_align(ps)) + return False; - u_7->unknown_0 = 0x0003; return True; } /******************************************************************* -reads or writes a structure. + Inits a structure. ********************************************************************/ -BOOL sam_io_unk_info7(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++; - prs_uint16("unknown_0", ps, depth, &u_7->unknown_0); /* 0x0003 */ - prs_align(ps); - - - return True; -} - -/******************************************************************* -makes a structure. -********************************************************************/ -BOOL make_unk_info2(SAM_UNK_INFO_2 *u_2, char *domain, char *server) +void init_unk_info2(SAM_UNK_INFO_2 *u_2, char *domain, char *server) { int len_domain = strlen(domain); int len_server = strlen(server); - if (u_2 == NULL) return False; - u_2->unknown_0 = 0x00000000; u_2->unknown_1 = 0x80000000; u_2->unknown_2 = 0x00000000; u_2->ptr_0 = 1; - make_uni_hdr(&(u_2->hdr_domain), len_domain); - make_uni_hdr(&(u_2->hdr_server), len_server); + init_uni_hdr(&u_2->hdr_domain, len_domain); + init_uni_hdr(&u_2->hdr_server, len_server); u_2->seq_num = 0x10000000; u_2->unknown_3 = 0x00000000; @@ -473,221 +343,177 @@ BOOL make_unk_info2(SAM_UNK_INFO_2 *u_2, char *domain, char *server) u_2->unknown_4 = 0x00000001; u_2->unknown_5 = 0x00000003; u_2->unknown_6 = 0x00000001; - u_2->num_domain_usrs = MAX_SAM_ENTRIES; - u_2->num_domain_grps = MAX_SAM_ENTRIES; - u_2->num_local_grps = MAX_SAM_ENTRIES; + u_2->num_domain_usrs = 0x00000008; + u_2->num_domain_grps = 0x00000003; + u_2->num_local_grps = 0x00000003; memset(u_2->padding, 0, sizeof(u_2->padding)); /* 12 bytes zeros */ - make_unistr2(&u_2->uni_domain, domain, len_domain); - make_unistr2(&u_2->uni_server, server, len_server); - - return True; + init_unistr2(&u_2->uni_domain, domain, len_domain); + init_unistr2(&u_2->uni_server, server, len_server); } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ + BOOL sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 *u_2, prs_struct *ps, int depth) { - if (u_2 == NULL) return False; + if (u_2 == NULL) + return False; prs_debug(ps, depth, desc, "sam_io_unk_info2"); depth++; - prs_uint32("unknown_0", ps, depth, &u_2->unknown_0); /* 0x0000 0000 */ - prs_uint32("unknown_1", ps, depth, &u_2->unknown_1); /* 0x8000 0000 */ - prs_uint32("unknown_2", ps, depth, &u_2->unknown_2); /* 0x0000 0000 */ + if(!prs_uint32("unknown_0", ps, depth, &u_2->unknown_0)) /* 0x0000 0000 */ + return False; + if(!prs_uint32("unknown_1", ps, depth, &u_2->unknown_1)) /* 0x8000 0000 */ + return False; + if(!prs_uint32("unknown_2", ps, depth, &u_2->unknown_2)) /* 0x0000 0000 */ + return False; - prs_uint32("ptr_0", ps, depth, &u_2->ptr_0); /* pointer to unknown structure */ - smb_io_unihdr("hdr_domain", &u_2->hdr_domain, ps, depth); /* domain name unicode header */ - smb_io_unihdr("hdr_server", &u_2->hdr_server, ps, depth); /* server name unicode header */ + if(!prs_uint32("ptr_0", ps, depth, &u_2->ptr_0)) /* pointer to unknown structure */ + return False; + if(!smb_io_unihdr("hdr_domain", &u_2->hdr_domain, ps, depth)) /* domain name unicode header */ + return False; + if(!smb_io_unihdr("hdr_server", &u_2->hdr_server, ps, depth)) /* server name unicode header */ + return False; /* put all the data in here, at the moment, including what the above pointer is referring to */ - prs_uint32("seq_num ", ps, depth, &u_2->seq_num ); /* 0x0000 0099 or 0x1000 0000 */ - prs_uint32("unknown_3 ", ps, depth, &u_2->unknown_3 ); /* 0x0000 0000 */ + if(!prs_uint32("seq_num ", ps, depth, &u_2->seq_num )) /* 0x0000 0099 or 0x1000 0000 */ + return False; + if(!prs_uint32("unknown_3 ", ps, depth, &u_2->unknown_3 )) /* 0x0000 0000 */ + return False; - prs_uint32("unknown_4 ", ps, depth, &u_2->unknown_4 ); /* 0x0000 0001 */ - prs_uint32("unknown_5 ", ps, depth, &u_2->unknown_5 ); /* 0x0000 0003 */ - prs_uint32("unknown_6 ", ps, depth, &u_2->unknown_6 ); /* 0x0000 0001 */ - prs_uint32("num_domain_usrs ", ps, depth, &u_2->num_domain_usrs ); /* 0x0000 0008 */ - prs_uint32("num_domain_grps", ps, depth, &u_2->num_domain_grps); /* 0x0000 0003 */ - prs_uint32("num_local_grps", ps, depth, &u_2->num_local_grps); /* 0x0000 0003 */ - - prs_uint8s(False, "padding", ps, depth, u_2->padding, sizeof(u_2->padding)); /* 12 bytes zeros */ - - smb_io_unistr2( "uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth); /* domain name unicode string */ - prs_align(ps); - smb_io_unistr2( "uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth); /* server name unicode string */ - - prs_align(ps); - + if(!prs_uint32("unknown_4 ", ps, depth, &u_2->unknown_4 )) /* 0x0000 0001 */ + return False; + if(!prs_uint32("unknown_5 ", ps, depth, &u_2->unknown_5 )) /* 0x0000 0003 */ + 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 )) /* 0x0000 0008 */ + return False; + if(!prs_uint32("num_domain_grps", ps, depth, &u_2->num_domain_grps)) /* 0x0000 0003 */ + return False; + if(!prs_uint32("num_local_grps", ps, depth, &u_2->num_local_grps)) /* 0x0000 0003 */ + return False; - return True; -} + if(!prs_uint8s(False, "padding", ps, depth, u_2->padding, sizeof(u_2->padding))) /* 12 bytes zeros */ + return False; -/******************************************************************* -makes a structure. -********************************************************************/ -BOOL make_unk_info1(SAM_UNK_INFO_1 *u_1) -{ - if (u_1 == NULL) return False; + if(!smb_io_unistr2( "uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth)) /* domain name unicode string */ + return False; + if(!smb_io_unistr2( "uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth)) /* server name unicode string */ + return False; - memset(u_1->padding, 0, sizeof(u_1->padding)); /* 12 bytes zeros */ - u_1->unknown_1 = 0x80000000; - u_1->unknown_2 = 0x00000000; + if(!prs_align(ps)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Inits a SAMR_R_QUERY_DOMAIN_INFO structure. ********************************************************************/ -BOOL sam_io_unk_info1(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++; - - prs_uint8s(False, "padding", ps, depth, u_1->padding, sizeof(u_1->padding)); /* 12 bytes zeros */ - - prs_uint32("unknown_1", ps, depth, &u_1->unknown_1); /* 0x8000 0000 */ - prs_uint32("unknown_2", ps, depth, &u_1->unknown_2); /* 0x0000 0000 */ - - prs_align(ps); - - return True; -} -/******************************************************************* -makes a SAMR_R_QUERY_DOMAIN_INFO structure. -********************************************************************/ -BOOL make_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO *r_u, +void init_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO *r_u, uint16 switch_value, SAM_UNK_CTR *ctr, uint32 status) { - if (r_u == NULL || ctr == NULL) return False; - - DEBUG(5,("make_samr_r_query_dom_info\n")); + DEBUG(5,("init_samr_r_query_dom_info\n")); r_u->ptr_0 = 0; r_u->switch_value = 0; r_u->status = status; /* return status */ - if (status == 0) - { + if (status == 0) { r_u->switch_value = switch_value; r_u->ptr_0 = 1; r_u->ctr = ctr; } - - return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ + BOOL samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return False; + if (r_u == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_r_query_dom_info"); depth++; - prs_align(ps); - - prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0)); + if(!prs_align(ps)) + return False; - if (r_u->ptr_0 != 0 && r_u->ctr != NULL) - { - prs_uint16("switch_value", ps, depth, &(r_u->switch_value)); - prs_align(ps); + if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0)) + return False; + 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 0x07: - { - sam_io_unk_info7("unk_inf7", &r_u->ctr->info.inf7, ps, depth); - break; - } - case 0x06: - { - sam_io_unk_info6("unk_inf6", &r_u->ctr->info.inf6, ps, depth); - break; - } - case 0x03: - { - sam_io_unk_info3("unk_inf3", &r_u->ctr->info.inf3, ps, depth); - break; - } - case 0x02: - { - sam_io_unk_info2("unk_inf2", &r_u->ctr->info.inf2, ps, depth); - break; - } - case 0x01: - { - sam_io_unk_info1("unk_inf1", &r_u->ctr->info.inf1, ps, depth); - break; - } - default: - { - DEBUG(3,("samr_io_r_query_dom_info: unknown switch level 0x%x\n", - r_u->switch_value)); - r_u->status = 0xC0000000|NT_STATUS_INVALID_INFO_CLASS; + if (r_u->ptr_0 != 0 && r_u->ctr != NULL) { + switch (r_u->switch_value) { + case 0x02: + if(!sam_io_unk_info2("unk_inf2", &r_u->ctr->info.inf2, ps, depth)) return False; - } + break; + default: + DEBUG(3,("samr_io_r_query_dom_info: unknown switch level 0x%x\n", + r_u->switch_value)); + return False; } } - prs_uint32("status ", ps, depth, &(r_u->status)); - return True; } /******************************************************************* - makes a DOM_SID3 structure. - - calculate length by adding up the size of the components. + Inits a DOM_SID3 structure. + Calculate length by adding up the size of the components. ********************************************************************/ -BOOL make_dom_sid3(DOM_SID3 *sid3, uint16 unk_0, uint16 unk_1, DOM_SID *sid) -{ - if (sid3 == NULL) return False; - sid3->sid = *sid; +void init_dom_sid3(DOM_SID3 *sid3, uint16 unk_0, uint16 unk_1, DOM_SID *sid) +{ + sid3->sid = *sid; sid3->len = 2 + 8 + sid3->sid.num_auths * 4; - - return True; } /******************************************************************* -reads or writes a SAM_SID3 structure. + Reads or writes a SAM_SID3 structure. -this one's odd, because the length (in bytes) is specified at the beginning. -the length _includes_ the length of the length, too :-) + this one's odd, because the length (in bytes) is specified at the beginning. + the length _includes_ the length of the length, too :-) ********************************************************************/ + static BOOL sam_io_dom_sid3(char *desc, DOM_SID3 *sid3, prs_struct *ps, int depth) { - if (sid3 == NULL) return False; + if (sid3 == NULL) + return False; prs_debug(ps, depth, desc, "sam_io_dom_sid3"); depth++; - prs_uint16("len", ps, depth, &(sid3->len)); - prs_align(ps); - smb_io_dom_sid("", &(sid3->sid), ps, depth); + if(!prs_uint16("len", ps, depth, &sid3->len)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_dom_sid("", &sid3->sid, ps, depth)) + return False; return True; } /******************************************************************* -makes a SAMR_R_UNKNOWN3 structure. + Inits a SAMR_R_UNKNOWN3 structure. unknown_2 : 0x0001 unknown_3 : 0x8004 @@ -698,7 +524,8 @@ unknown_6 : 0x0002 unknown_7 : 0x5800 or 0x0070 ********************************************************************/ -static BOOL make_sam_sid_stuff(SAM_SID_STUFF *stf, + +static void init_sam_sid_stuff(SAM_SID_STUFF *stf, uint16 unknown_2, uint16 unknown_3, uint32 unknown_4, uint16 unknown_6, uint16 unknown_7, int num_sid3s, DOM_SID3 sid3[MAX_SAM_SIDS]) @@ -706,7 +533,7 @@ static BOOL make_sam_sid_stuff(SAM_SID_STUFF *stf, stf->unknown_2 = unknown_2; stf->unknown_3 = unknown_3; - bzero(stf->padding1, sizeof(stf->padding1)); + memset((char *)stf->padding1, '\0', sizeof(stf->padding1)); stf->unknown_4 = unknown_4; stf->unknown_5 = unknown_4; @@ -719,77 +546,81 @@ static BOOL make_sam_sid_stuff(SAM_SID_STUFF *stf, stf->padding2 = 0x0000; memcpy(stf->sid, sid3, sizeof(DOM_SID3) * num_sid3s); - - return True; } /******************************************************************* -reads or writes a SAM_SID_STUFF structure. + Reads or writes a SAM_SID_STUFF structure. ********************************************************************/ + static BOOL sam_io_sid_stuff(char *desc, SAM_SID_STUFF *stf, prs_struct *ps, int depth) { - uint32 i; + int i; - if (stf == NULL) return False; + if (stf == NULL) + return False; - DEBUG(5,("make_sam_sid_stuff\n")); + DEBUG(5,("init_sam_sid_stuff\n")); - prs_uint16("unknown_2", ps, depth, &(stf->unknown_2)); - prs_uint16("unknown_3", ps, depth, &(stf->unknown_3)); + if(!prs_uint16("unknown_2", ps, depth, &stf->unknown_2)) + return False; + if(!prs_uint16("unknown_3", ps, depth, &stf->unknown_3)) + return False; - prs_uint8s(False, "padding1", ps, depth, stf->padding1, sizeof(stf->padding1)); + if(!prs_uint8s(False, "padding1", ps, depth, stf->padding1, sizeof(stf->padding1))) + return False; - prs_uint32("unknown_4", ps, depth, &(stf->unknown_4)); - prs_uint32("unknown_5", ps, depth, &(stf->unknown_5)); - prs_uint16("unknown_6", ps, depth, &(stf->unknown_6)); - prs_uint16("unknown_7", ps, depth, &(stf->unknown_7)); - - prs_uint32("num_sids ", ps, depth, &(stf->num_sids )); - prs_uint16("padding2 ", ps, depth, &(stf->padding2 )); + if(!prs_uint32("unknown_4", ps, depth, &stf->unknown_4)) + return False; + if(!prs_uint32("unknown_5", ps, depth, &stf->unknown_5)) + return False; + if(!prs_uint16("unknown_6", ps, depth, &stf->unknown_6)) + return False; + if(!prs_uint16("unknown_7", ps, depth, &stf->unknown_7)) + return False; + + if(!prs_uint32("num_sids ", ps, depth, &stf->num_sids )) + return False; + if(!prs_uint16("padding2 ", ps, depth, &stf->padding2 )) + return False; SMB_ASSERT_ARRAY(stf->sid, stf->num_sids); - for (i = 0; i < stf->num_sids; i++) - { - sam_io_dom_sid3("", &(stf->sid[i]), ps, depth); + for (i = 0; i < stf->num_sids; i++) { + if(!sam_io_dom_sid3("", &(stf->sid[i]), ps, depth)) + return False; } return True; } /******************************************************************* -reads or writes a SAMR_R_UNKNOWN3 structure. + Inits or writes a SAMR_R_UNKNOWN3 structure. ********************************************************************/ -BOOL make_samr_r_unknown_3(SAMR_R_UNKNOWN_3 *r_u, + +void init_samr_r_unknown_3(SAMR_R_UNKNOWN_3 *r_u, uint16 unknown_2, uint16 unknown_3, uint32 unknown_4, uint16 unknown_6, uint16 unknown_7, int num_sid3s, DOM_SID3 sid3[MAX_SAM_SIDS], uint32 status) { - if (r_u == NULL) return False; - - DEBUG(5,("samr_make_r_unknown_3\n")); + DEBUG(5,("samr_init_r_unknown_3\n")); r_u->ptr_0 = 0; r_u->ptr_1 = 0; - if (status == 0x0) - { + if (status == 0x0) { r_u->ptr_0 = 1; r_u->ptr_1 = 1; - make_sam_sid_stuff(&(r_u->sid_stuff), unknown_2, unknown_3, + init_sam_sid_stuff(&(r_u->sid_stuff), unknown_2, unknown_3, unknown_4, unknown_6, unknown_7, num_sid3s, sid3); } r_u->status = status; - - return True; } - /******************************************************************* -reads or writes a SAMR_R_UNKNOWN_3 structure. + Reads or writes a SAMR_R_UNKNOWN_3 structure. this one's odd, because the daft buggers use a different mechanism for writing out the array of sids. they put the number of sids in @@ -800,4493 +631,2108 @@ is put at the beginning of the data stream. wierd. ********************************************************************/ + BOOL samr_io_r_unknown_3(char *desc, SAMR_R_UNKNOWN_3 *r_u, prs_struct *ps, int depth) { int ptr_len0=0; int ptr_len1=0; int ptr_sid_stuff = 0; - if (r_u == NULL) return False; + if (r_u == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_r_unknown_3"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0 )); + if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0)) + return False; - if (ps->io) - { + if (ps->io) { /* reading. do the length later */ - prs_uint32("sid_stuff_len0", ps, depth, &(r_u->sid_stuff_len0)); - } - else - { + if(!prs_uint32("sid_stuff_len0", ps, depth, &r_u->sid_stuff_len0)) + return False; + } else { /* storing */ - ptr_len0 = ps->offset; ps->offset += 4; + ptr_len0 = prs_offset(ps); + if(!prs_set_offset(ps, ptr_len0 + 4)) + return False; } - if (r_u->ptr_0 != 0) - { - prs_uint32("ptr_1 ", ps, depth, &(r_u->ptr_1 )); - if (ps->io) - { + if (r_u->ptr_0 != 0) { + if(!prs_uint32("ptr_1 ", ps, depth, &r_u->ptr_1)) + return False; + if (ps->io) { /* reading. do the length later */ - prs_uint32("sid_stuff_len1", ps, depth, &(r_u->sid_stuff_len1)); - } - else - { + if(!prs_uint32("sid_stuff_len1", ps, depth, &r_u->sid_stuff_len1)) + return False; + } else { /* storing */ - ptr_len1 = ps->offset; ps->offset += 4; + ptr_len1 = prs_offset(ps); + if(!prs_set_offset(ps, ptr_len1 + 4)) + return False; } - if (r_u->ptr_1 != 0) - { - ptr_sid_stuff = ps->offset; - sam_io_sid_stuff("", &(r_u->sid_stuff), ps, depth); + if (r_u->ptr_1 != 0) { + ptr_sid_stuff = prs_offset(ps); + if(!sam_io_sid_stuff("", &r_u->sid_stuff, ps, depth)) + return False; } } - if (!(ps->io)) /* storing not reading. do the length, now. */ - { - if (ptr_sid_stuff != 0) - { - uint32 sid_stuff_len = ps->offset - ptr_sid_stuff; - int old_len = ps->offset; + if (!(ps->io)) { + /* storing not reading. do the length, now. */ - ps->offset = ptr_len0; - prs_uint32("sid_stuff_len0", ps, depth, &sid_stuff_len); + if (ptr_sid_stuff != 0) { + int old_len = prs_offset(ps); + uint32 sid_stuff_len = old_len - ptr_sid_stuff; - ps->offset = ptr_len1; - prs_uint32("sid_stuff_len1", ps, depth, &sid_stuff_len); + if(!prs_set_offset(ps, ptr_len0)) + return False; + if(!prs_uint32("sid_stuff_len0", ps, depth, &sid_stuff_len)) + return False; + + if(!prs_set_offset(ps, ptr_len1)) + return False; + if(!prs_uint32("sid_stuff_len1", ps, depth, &sid_stuff_len)) + return False; - ps->offset = old_len; + if(!prs_set_offset(ps, old_len)) + return False; } } - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } /******************************************************************* -reads or writes a SAM_STR1 structure. + Reads or writes a SAM_STR1 structure. ********************************************************************/ -static BOOL sam_io_sam_str1(char *desc, SAM_STR1 *sam, uint32 acct_buf, uint32 name_buf, uint32 desc_buf, prs_struct *ps, int depth) + +static BOOL sam_io_sam_str1(char *desc, SAM_STR1 *sam, uint32 acct_buf, + uint32 name_buf, uint32 desc_buf, prs_struct *ps, int depth) { - if (sam == NULL) return False; + if (sam == NULL) + return False; prs_debug(ps, depth, desc, "sam_io_sam_str1"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_unistr2("unistr2", &(sam->uni_acct_name), acct_buf, ps, depth); /* account name unicode string */ - prs_align(ps); - smb_io_unistr2("unistr2", &(sam->uni_full_name), name_buf, ps, depth); /* full name unicode string */ - prs_align(ps); - smb_io_unistr2("unistr2", &(sam->uni_acct_desc), desc_buf, ps, depth); /* account desc unicode string */ - prs_align(ps); + if(!smb_io_unistr2("unistr2", &sam->uni_acct_name, acct_buf, ps, depth)) /* account name unicode string */ + return False; + if(!smb_io_unistr2("unistr2", &sam->uni_full_name, name_buf, ps, depth)) /* full name unicode string */ + return False; + if(!smb_io_unistr2("unistr2", &sam->uni_acct_desc, desc_buf, ps, depth)) /* account description unicode string */ + return False; return True; } /******************************************************************* -makes a SAM_ENTRY1 structure. + Inits a SAM_ENTRY1 structure. ********************************************************************/ -static BOOL make_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, + +static void init_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, uint32 len_sam_name, uint32 len_sam_full, uint32 len_sam_desc, uint32 rid_user, uint16 acb_info) { - if (sam == NULL) return False; - - DEBUG(5,("make_sam_entry1\n")); + DEBUG(5,("init_sam_entry1\n")); sam->user_idx = user_idx; sam->rid_user = rid_user; sam->acb_info = acb_info; sam->pad = 0; - make_uni_hdr(&(sam->hdr_acct_name), len_sam_name); - make_uni_hdr(&(sam->hdr_user_name), len_sam_full); - make_uni_hdr(&(sam->hdr_user_desc), len_sam_desc); - - return True; + init_uni_hdr(&sam->hdr_acct_name, len_sam_name); + init_uni_hdr(&sam->hdr_user_name, len_sam_full); + init_uni_hdr(&sam->hdr_user_desc, len_sam_desc); } /******************************************************************* -reads or writes a SAM_ENTRY1 structure. + Reads or writes a SAM_ENTRY1 structure. ********************************************************************/ + static BOOL sam_io_sam_entry1(char *desc, SAM_ENTRY1 *sam, prs_struct *ps, int depth) { - if (sam == NULL) return False; + if (sam == NULL) + return False; prs_debug(ps, depth, desc, "sam_io_sam_entry1"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("user_idx ", ps, depth, &(sam->user_idx )); + if(!prs_uint32("user_idx ", ps, depth, &sam->user_idx)) + return False; - prs_uint32("rid_user ", ps, depth, &(sam->rid_user )); - prs_uint16("acb_info ", ps, depth, &(sam->acb_info )); - prs_uint16("pad ", ps, depth, &(sam->pad )); + if(!prs_uint32("rid_user ", ps, depth, &sam->rid_user)) + return False; + if(!prs_uint16("acb_info ", ps, depth, &sam->acb_info)) + return False; + if(!prs_uint16("pad ", ps, depth, &sam->pad)) + return False; - smb_io_unihdr("unihdr", &(sam->hdr_acct_name), ps, depth); /* account name unicode string header */ - smb_io_unihdr("unihdr", &(sam->hdr_user_name), ps, depth); /* account name unicode string header */ - smb_io_unihdr("unihdr", &(sam->hdr_user_desc), ps, depth); /* account name unicode string header */ + if(!smb_io_unihdr("unihdr", &sam->hdr_acct_name, ps, depth)) /* account name unicode string header */ + return False; + if(!smb_io_unihdr("unihdr", &sam->hdr_user_name, ps, depth)) /* account name unicode string header */ + return False; + if(!smb_io_unihdr("unihdr", &sam->hdr_user_desc, ps, depth)) /* account name unicode string header */ + return False; return True; } /******************************************************************* -reads or writes a SAM_STR2 structure. + Reads or writes a SAM_STR2 structure. ********************************************************************/ + static BOOL sam_io_sam_str2(char *desc, SAM_STR2 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth) { - if (sam == NULL) return False; + if (sam == NULL) + return False; prs_debug(ps, depth, desc, "sam_io_sam_str2"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_unistr2("unistr2", &(sam->uni_srv_name), acct_buf, ps, depth); /* account name unicode string */ - prs_align(ps); - smb_io_unistr2("unistr2", &(sam->uni_srv_desc), desc_buf, ps, depth); /* account desc unicode string */ - prs_align(ps); + if(!smb_io_unistr2("unistr2", &sam->uni_srv_name, acct_buf, ps, depth)) /* account name unicode string */ + return False; + if(!smb_io_unistr2("unistr2", &sam->uni_srv_desc, desc_buf, ps, depth)) /* account description unicode string */ + return False; return True; } /******************************************************************* -makes a SAM_ENTRY2 structure. + Inits a SAM_ENTRY2 structure. ********************************************************************/ -static BOOL make_sam_entry2(SAM_ENTRY2 *sam, uint32 user_idx, + +static void init_sam_entry2(SAM_ENTRY2 *sam, uint32 user_idx, uint32 len_sam_name, uint32 len_sam_desc, uint32 rid_user, uint16 acb_info) { - if (sam == NULL) return False; - - DEBUG(5,("make_sam_entry2\n")); + DEBUG(5,("init_sam_entry2\n")); sam->user_idx = user_idx; sam->rid_user = rid_user; sam->acb_info = acb_info; sam->pad = 0; - make_uni_hdr(&(sam->hdr_srv_name), len_sam_name); - make_uni_hdr(&(sam->hdr_srv_desc), len_sam_desc); - - return True; + init_uni_hdr(&sam->hdr_srv_name, len_sam_name); + init_uni_hdr(&sam->hdr_srv_desc, len_sam_desc); } /******************************************************************* -reads or writes a SAM_ENTRY2 structure. + Reads or writes a SAM_ENTRY2 structure. ********************************************************************/ + static BOOL sam_io_sam_entry2(char *desc, SAM_ENTRY2 *sam, prs_struct *ps, int depth) { - if (sam == NULL) return False; + if (sam == NULL) + return False; prs_debug(ps, depth, desc, "sam_io_sam_entry2"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("user_idx ", ps, depth, &(sam->user_idx )); + if(!prs_uint32("user_idx ", ps, depth, &sam->user_idx)) + return False; - prs_uint32("rid_user ", ps, depth, &(sam->rid_user )); - prs_uint16("acb_info ", ps, depth, &(sam->acb_info )); - prs_uint16("pad ", ps, depth, &(sam->pad )); + if(!prs_uint32("rid_user ", ps, depth, &sam->rid_user)) + return False; + if(!prs_uint16("acb_info ", ps, depth, &sam->acb_info)) + return False; + if(!prs_uint16("pad ", ps, depth, &sam->pad)) + return False; - smb_io_unihdr("unihdr", &(sam->hdr_srv_name), ps, depth); /* account name unicode string header */ - smb_io_unihdr("unihdr", &(sam->hdr_srv_desc), ps, depth); /* account name unicode string header */ + 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. + Reads or writes a SAM_STR3 structure. ********************************************************************/ + static BOOL sam_io_sam_str3(char *desc, SAM_STR3 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth) { - if (sam == NULL) return False; + if (sam == NULL) + return False; prs_debug(ps, depth, desc, "sam_io_sam_str3"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_unistr2("unistr2", &(sam->uni_grp_name), acct_buf, ps, depth); /* account name unicode string */ - prs_align(ps); - smb_io_unistr2("unistr2", &(sam->uni_grp_desc), desc_buf, ps, depth); /* account desc unicode string */ - prs_align(ps); + if(!smb_io_unistr2("unistr2", &sam->uni_grp_name, acct_buf, ps, depth)) /* account name unicode string */ + return False; + if(!smb_io_unistr2("unistr2", &sam->uni_grp_desc, desc_buf, ps, depth)) /* account description unicode string */ + return False; return True; } /******************************************************************* -makes a SAM_ENTRY3 structure. + Inits a SAM_ENTRY3 structure. ********************************************************************/ -static BOOL make_sam_entry3(SAM_ENTRY3 *sam, uint32 grp_idx, + +static void init_sam_entry3(SAM_ENTRY3 *sam, uint32 grp_idx, uint32 len_grp_name, uint32 len_grp_desc, uint32 rid_grp) { - if (sam == NULL) return False; - - DEBUG(5,("make_sam_entry3\n")); + 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 */ - make_uni_hdr(&(sam->hdr_grp_name), len_grp_name); - make_uni_hdr(&(sam->hdr_grp_desc), len_grp_desc); - - return True; + init_uni_hdr(&sam->hdr_grp_name, len_grp_name); + init_uni_hdr(&sam->hdr_grp_desc, len_grp_desc); } /******************************************************************* -reads or writes a SAM_ENTRY3 structure. + Reads or writes a SAM_ENTRY3 structure. ********************************************************************/ + static BOOL sam_io_sam_entry3(char *desc, SAM_ENTRY3 *sam, prs_struct *ps, int depth) { - if (sam == NULL) return False; + if (sam == NULL) + return False; prs_debug(ps, depth, desc, "sam_io_sam_entry3"); depth++; - prs_align(ps); - - prs_uint32("grp_idx", ps, depth, &(sam->grp_idx)); - - prs_uint32("rid_grp", ps, depth, &(sam->rid_grp)); - prs_uint32("attr ", ps, depth, &(sam->attr )); - - smb_io_unihdr("unihdr", &(sam->hdr_grp_name), ps, depth); /* account name unicode string header */ - smb_io_unihdr("unihdr", &(sam->hdr_grp_desc), ps, depth); /* account name unicode string header */ - - return True; -} - -/******************************************************************* -makes a SAM_ENTRY4 structure. -********************************************************************/ -static BOOL make_sam_entry4(SAM_ENTRY4 *sam, uint32 user_idx, - uint32 len_acct_name) -{ - if (sam == NULL) return False; - - DEBUG(5,("make_sam_entry4\n")); - - sam->user_idx = user_idx; - make_str_hdr(&(sam->hdr_acct_name), len_acct_name, len_acct_name, - len_acct_name != 0); - - return True; -} - -/******************************************************************* -reads or writes a SAM_ENTRY4 structure. -********************************************************************/ -static BOOL sam_io_sam_entry4(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++; - - prs_align(ps); - - prs_uint32("user_idx", ps, depth, &(sam->user_idx)); - smb_io_strhdr("strhdr", &(sam->hdr_acct_name), ps, depth); - - return True; -} + if(!prs_align(ps)) + return False; -/******************************************************************* -makes a SAM_ENTRY5 structure. -********************************************************************/ -static BOOL make_sam_entry5(SAM_ENTRY5 *sam, uint32 grp_idx, - uint32 len_grp_name) -{ - if (sam == NULL) return False; + if(!prs_uint32("grp_idx", ps, depth, &sam->grp_idx)) + return False; - DEBUG(5,("make_sam_entry5\n")); + if(!prs_uint32("rid_grp", ps, depth, &sam->rid_grp)) + return False; + if(!prs_uint32("attr ", ps, depth, &sam->attr)) + return False; - sam->grp_idx = grp_idx; - make_str_hdr(&(sam->hdr_grp_name), len_grp_name, len_grp_name, - len_grp_name != 0); + 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; } /******************************************************************* -reads or writes a SAM_ENTRY5 structure. + Inits a SAM_ENTRY structure. ********************************************************************/ -static BOOL sam_io_sam_entry5(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++; - - prs_align(ps); - - prs_uint32("grp_idx", ps, depth, &(sam->grp_idx)); - smb_io_strhdr("strhdr", &(sam->hdr_grp_name), ps, depth); - - return True; -} -/******************************************************************* -makes a SAM_ENTRY structure. -********************************************************************/ -static BOOL make_sam_entry(SAM_ENTRY *sam, uint32 len_sam_name, uint32 rid) +static void init_sam_entry(SAM_ENTRY *sam, uint32 len_sam_name, uint32 rid) { - if (sam == NULL) return False; - - DEBUG(10,("make_sam_entry: %d %d\n", len_sam_name, rid)); + DEBUG(5,("init_sam_entry\n")); sam->rid = rid; - make_uni_hdr(&(sam->hdr_name), len_sam_name); - - return True; + init_uni_hdr(&sam->hdr_name, len_sam_name); } /******************************************************************* -reads or writes a SAM_ENTRY structure. + Reads or writes a SAM_ENTRY structure. ********************************************************************/ + static BOOL sam_io_sam_entry(char *desc, SAM_ENTRY *sam, prs_struct *ps, int depth) { - if (sam == NULL) return False; + if (sam == NULL) + return False; prs_debug(ps, depth, desc, "sam_io_sam_entry"); depth++; - prs_align(ps); - prs_uint32("rid", ps, depth, &(sam->rid )); - smb_io_unihdr("unihdr", &(sam->hdr_name), ps, depth); /* account name unicode string header */ + 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; } /******************************************************************* -makes a SAMR_Q_ENUM_DOM_USERS structure. + Inits a SAMR_Q_ENUM_DOM_USERS structure. ********************************************************************/ -BOOL make_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_e, POLICY_HND *pol, - uint32 start_idx, + +void init_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_e, POLICY_HND *pol, + uint16 req_num_entries, uint16 unk_0, uint16 acb_mask, uint16 unk_1, uint32 size) { - if (q_e == NULL || pol == NULL) return False; + DEBUG(5,("init_q_enum_dom_users\n")); - DEBUG(5,("make_samr_q_enum_dom_users\n")); + memcpy(&q_e->pol, pol, sizeof(*pol)); - memcpy(&(q_e->pol), pol, sizeof(*pol)); - - q_e->start_idx = start_idx; /* zero indicates lots */ + q_e->req_num_entries = req_num_entries; /* zero indicates lots */ + q_e->unknown_0 = unk_0; /* this gets returned in the response */ q_e->acb_mask = acb_mask; q_e->unknown_1 = unk_1; q_e->max_size = size; - - return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ + BOOL samr_io_q_enum_dom_users(char *desc, SAMR_Q_ENUM_DOM_USERS *q_e, prs_struct *ps, int depth) { - if (q_e == NULL) return False; + if (q_e == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_q_enum_dom_users"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); - prs_align(ps); + if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; - prs_uint32("start_idx", ps, depth, &(q_e->start_idx)); - prs_uint16("acb_mask ", ps, depth, &(q_e->acb_mask )); - prs_uint16("unknown_1", ps, depth, &(q_e->unknown_1)); + if(!prs_uint16("req_num_entries", ps, depth, &q_e->req_num_entries)) + return False; + if(!prs_uint16("unknown_0 ", ps, depth, &q_e->unknown_0)) + return False; - prs_uint32("max_size ", ps, depth, &(q_e->max_size )); + if(!prs_uint16("acb_mask ", ps, depth, &q_e->acb_mask)) + return False; + if(!prs_uint16("unknown_1 ", ps, depth, &q_e->unknown_1)) + return False; - prs_align(ps); + if(!prs_uint32("max_size ", ps, depth, &q_e->max_size)) + return False; + + if(!prs_align(ps)) + return False; return True; } /******************************************************************* -makes a SAMR_R_ENUM_DOM_USERS structure. + Inits a SAMR_R_ENUM_DOM_USERS structure. ********************************************************************/ -BOOL make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, - uint32 next_idx, + +void init_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, + uint16 total_num_entries, uint16 unk_0, uint32 num_sam_entries, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES], uint32 status) { - uint32 i; + int i; - if (r_u == NULL) return False; + DEBUG(5,("init_samr_r_enum_dom_users\n")); - DEBUG(5,("make_samr_r_enum_dom_users\n")); + if (num_sam_entries >= MAX_SAM_ENTRIES) { + num_sam_entries = MAX_SAM_ENTRIES; + DEBUG(5,("limiting number of entries to %d\n", + num_sam_entries)); + } - r_u->next_idx = next_idx; - r_u->sam = NULL; - r_u->uni_acct_name = NULL; + r_u->total_num_entries = total_num_entries; + r_u->unknown_0 = unk_0; - if (num_sam_entries != 0) - { + if (total_num_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->sam = (SAM_ENTRY*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); - r_u->uni_acct_name = (UNISTR2*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_acct_name[0])); + SMB_ASSERT_ARRAY(r_u->sam, num_sam_entries); + SMB_ASSERT_ARRAY(r_u->uni_acct_name, num_sam_entries); - if (r_u->sam == NULL || r_u->uni_acct_name == NULL) - { - DEBUG(0,("NULL pointers in SAMR_R_QUERY_DISPINFO\n")); - return False; - } - - for (i = 0; i < num_sam_entries; i++) - { - make_sam_entry(&(r_u->sam[i]), + for (i = 0; i < num_sam_entries; i++) { + init_sam_entry(&(r_u->sam[i]), pass[i].uni_user_name.uni_str_len, pass[i].user_rid); - copy_unistr2(&(r_u->uni_acct_name[i]), &(pass[i].uni_user_name)); + copy_unistr2(&r_u->uni_acct_name[i], &(pass[i].uni_user_name)); } r_u->num_entries4 = num_sam_entries; - } - else - { + } else { r_u->ptr_entries1 = 0; r_u->num_entries2 = num_sam_entries; r_u->ptr_entries2 = 1; } r_u->status = status; - - return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct *ps, int depth) + +BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct *ps, int depth) { - uint32 i; + int i; - if (r_u == NULL) return False; + if (r_u == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_r_enum_dom_users"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("next_idx ", ps, depth, &(r_u->next_idx )); - prs_uint32("ptr_entries1", ps, depth, &(r_u->ptr_entries1)); + if(!prs_uint16("total_num_entries", ps, depth, &r_u->total_num_entries)) + return False; + if(!prs_uint16("unknown_0 ", ps, depth, &r_u->unknown_0)) + return False; + if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1)) + return False; - if (r_u->ptr_entries1 != 0) - { - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); - prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); - prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); + if (r_u->total_num_entries != 0 && 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 (ps->io) - { - r_u->sam = (SAM_ENTRY*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); - r_u->uni_acct_name = (UNISTR2*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_acct_name[0])); - } + SMB_ASSERT_ARRAY(r_u->sam, 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 = 0xC0000000|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++) - { - sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); - } + SMB_ASSERT_ARRAY(r_u->uni_acct_name, r_u->num_entries2); - for (i = 0; i < r_u->num_entries2; i++) - { - smb_io_unistr2("", &(r_u->uni_acct_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); - prs_align(ps); + 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; } - prs_align(ps); + if(!prs_align(ps)) + return False; + if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4)) + return False; } - prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } /******************************************************************* -makes a SAMR_Q_QUERY_DISPINFO structure. + Inits a SAMR_Q_ENUM_DOM_ALIASES structure. ********************************************************************/ -BOOL make_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_e, POLICY_HND *pol, - uint16 switch_level, uint32 start_idx, - uint32 max_entries) -{ - if (q_e == NULL || pol == NULL) return False; - DEBUG(5,("make_samr_q_query_dispinfo\n")); - - memcpy(&(q_e->domain_pol), pol, sizeof(*pol)); - - q_e->switch_level = switch_level; +void init_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_e, POLICY_HND *pol, uint32 size) +{ + DEBUG(5,("init_q_enum_dom_aliases\n")); - q_e->start_idx = start_idx; - q_e->max_entries = max_entries; - q_e->max_size = 0xffff; /* Not especially useful */ + memcpy(&q_e->pol, pol, sizeof(*pol)); - return True; + q_e->unknown_0 = 0; + q_e->max_size = size; } + /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO *q_e, prs_struct *ps, int depth) + +BOOL samr_io_q_enum_dom_aliases(char *desc, SAMR_Q_ENUM_DOM_ALIASES *q_e, prs_struct *ps, int depth) { - if (q_e == NULL) return False; + if (q_e == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_q_query_dispinfo"); + prs_debug(ps, depth, desc, "samr_io_q_enum_dom_aliases"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("domain_pol", &(q_e->domain_pol), ps, depth); - prs_align(ps); + if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; - prs_uint16("switch_level", ps, depth, &(q_e->switch_level)); - prs_align(ps); + if(!prs_uint32("unknown_0", ps, depth, &q_e->unknown_0)) + return False; + if(!prs_uint32("max_size ", ps, depth, &q_e->max_size )) + return False; - prs_uint32("start_idx ", ps, depth, &(q_e->start_idx )); - prs_uint32("max_entries ", ps, depth, &(q_e->max_entries )); - prs_uint32("max_size ", ps, depth, &(q_e->max_size )); + if(!prs_align(ps)) + return False; return True; } /******************************************************************* -makes a SAM_DISPINFO_1 structure. + Inits a SAMR_R_ENUM_DOM_ALIASES structure. ********************************************************************/ -BOOL make_sam_dispinfo_1(SAM_DISPINFO_1 *sam, uint32 *num_entries, - uint32 *data_size, uint32 start_idx, - SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) -{ - uint32 len_sam_name, len_sam_full, len_sam_desc; - uint32 max_entries, max_data_size; - uint32 dsize = 0; - uint32 i; - - if (sam == NULL || num_entries == NULL || data_size == NULL) return False; - - DEBUG(5,("make_sam_dispinfo_1\n")); - - max_entries = *num_entries; - max_data_size = *data_size; - for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) - { - len_sam_name = pass[i].uni_user_name.uni_str_len; - len_sam_full = pass[i].uni_full_name.uni_str_len; - len_sam_desc = pass[i].uni_acct_desc.uni_str_len; - - make_sam_entry1(&(sam->sam[i]), start_idx + i + 1, - len_sam_name, len_sam_full, len_sam_desc, - pass[i].user_rid, pass[i].acb_info); +void init_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, + uint32 num_sam_entries, SAM_USER_INFO_21 grps[MAX_SAM_ENTRIES], + uint32 status) +{ + int i; - copy_unistr2(&(sam->str[i].uni_acct_name), &(pass[i].uni_user_name)); - copy_unistr2(&(sam->str[i].uni_full_name), &(pass[i].uni_full_name)); - copy_unistr2(&(sam->str[i].uni_acct_desc), &(pass[i].uni_acct_desc)); + DEBUG(5,("init_samr_r_enum_dom_aliases\n")); - dsize += sizeof(SAM_ENTRY1); - dsize += len_sam_name + len_sam_full + len_sam_desc; + if (num_sam_entries >= MAX_SAM_ENTRIES) { + num_sam_entries = MAX_SAM_ENTRIES; + DEBUG(5,("limiting number of entries to %d\n", + num_sam_entries)); } - *num_entries = i; - *data_size = dsize; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL sam_io_sam_dispinfo_1(char *desc, SAM_DISPINFO_1 *sam, uint32 num_entries, prs_struct *ps, int depth) -{ - uint32 i; + r_u->num_entries = num_sam_entries; - if (sam == NULL) return False; - - prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_1"); - depth++; + if (num_sam_entries > 0) { + r_u->ptr_entries = 1; + r_u->num_entries2 = num_sam_entries; + r_u->ptr_entries2 = 1; + r_u->num_entries3 = num_sam_entries; - prs_align(ps); + SMB_ASSERT_ARRAY(r_u->sam, num_sam_entries); - SMB_ASSERT_ARRAY(sam->sam, num_entries); + for (i = 0; i < num_sam_entries; i++) { + init_sam_entry(&r_u->sam[i], + grps[i].uni_user_name.uni_str_len, + grps[i].user_rid); - for (i = 0; i < num_entries; i++) - { - sam_io_sam_entry1("", &(sam->sam[i]), ps, depth); - } + copy_unistr2(&r_u->uni_grp_name[i], &(grps[i].uni_user_name)); + } - for (i = 0; i < num_entries; i++) - { - 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); + r_u->num_entries4 = num_sam_entries; + } else { + r_u->ptr_entries = 0; } - return True; + r_u->status = status; } - /******************************************************************* -makes a SAM_DISPINFO_2 structure. + Reads or writes a structure. ********************************************************************/ -BOOL make_sam_dispinfo_2(SAM_DISPINFO_2 *sam, uint32 *num_entries, - uint32 *data_size, uint32 start_idx, - SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) -{ - uint32 len_sam_name, len_sam_desc; - uint32 max_entries, max_data_size; - uint32 dsize = 0; - uint32 i; - - if (sam == NULL || num_entries == NULL || data_size == NULL) return False; - DEBUG(5,("make_sam_dispinfo_2\n")); - - max_entries = *num_entries; - max_data_size = *data_size; - - for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) - { - len_sam_name = pass[i].uni_user_name.uni_str_len; - len_sam_desc = pass[i].uni_acct_desc.uni_str_len; - - make_sam_entry2(&(sam->sam[i]), start_idx + i + 1, - len_sam_name, len_sam_desc, - pass[i].user_rid, pass[i].acb_info); +BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_struct *ps, int depth) +{ + int i; - copy_unistr2(&(sam->str[i].uni_srv_name), &(pass[i].uni_user_name)); - copy_unistr2(&(sam->str[i].uni_srv_desc), &(pass[i].uni_acct_desc)); + if (r_u == NULL) + return False; - dsize += sizeof(SAM_ENTRY2); - dsize += len_sam_name + len_sam_desc; - } + prs_debug(ps, depth, desc, "samr_io_r_enum_dom_aliases"); + depth++; - *num_entries = i; - *data_size = dsize; + if(!prs_align(ps)) + return False; - return True; -} + 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; -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL sam_io_sam_dispinfo_2(char *desc, SAM_DISPINFO_2 *sam, uint32 num_entries, prs_struct *ps, int depth) -{ - uint32 i; + if (r_u->num_entries != 0 && r_u->ptr_entries != 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 (sam == NULL) return False; + SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries); - prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_2"); - depth++; + for (i = 0; i < r_u->num_entries; i++) { + if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth)) + return False; + } - prs_align(ps); + for (i = 0; i < r_u->num_entries; i++) { + if(!smb_io_unistr2("", &r_u->uni_grp_name[i], r_u->sam[i].hdr_name.buffer, ps, depth)) + return False; + } - SMB_ASSERT_ARRAY(sam->sam, num_entries); + if(!prs_align(ps)) + return False; - for (i = 0; i < num_entries; i++) - { - sam_io_sam_entry2("", &(sam->sam[i]), ps, depth); + if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4)) + return False; } - for (i = 0; i < num_entries; i++) - { - sam_io_sam_str2 ("", &(sam->str[i]), - sam->sam[i].hdr_srv_name.buffer, - sam->sam[i].hdr_srv_desc.buffer, - ps, depth); - } + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } /******************************************************************* -makes a SAM_DISPINFO_3 structure. + Inits a SAMR_Q_QUERY_DISPINFO structure. ********************************************************************/ -BOOL make_sam_dispinfo_3(SAM_DISPINFO_3 *sam, uint32 *num_entries, - uint32 *data_size, uint32 start_idx, - DOMAIN_GRP *grp) -{ - uint32 len_sam_name, len_sam_desc; - uint32 max_entries, max_data_size; - uint32 dsize = 0; - uint32 i; - - if (sam == NULL || num_entries == NULL || data_size == NULL) return False; - DEBUG(5,("make_sam_dispinfo_3\n")); - - max_entries = *num_entries; - max_data_size = *data_size; - - for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) - { - len_sam_name = strlen(grp[i].name); - len_sam_desc = strlen(grp[i].comment); - - make_sam_entry3(&(sam->sam[i]), start_idx + i + 1, - len_sam_name, len_sam_desc, - grp[i].rid); - - make_unistr2(&(sam->str[i].uni_grp_name), grp[i].name , len_sam_name); - make_unistr2(&(sam->str[i].uni_grp_desc), grp[i].comment, len_sam_desc); +void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_e, POLICY_HND *pol, + uint16 switch_level, uint32 start_idx, uint32 size) +{ + DEBUG(5,("init_q_query_dispinfo\n")); - dsize += sizeof(SAM_ENTRY3); - dsize += (len_sam_name + len_sam_desc) * 2; - } + memcpy(&q_e->pol, pol, sizeof(*pol)); - *num_entries = i; - *data_size = dsize; + q_e->switch_level = switch_level; - return True; + q_e->unknown_0 = 0; + q_e->start_idx = start_idx; + q_e->unknown_1 = 0x000007d0; + q_e->max_size = size; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_3(char *desc, SAM_DISPINFO_3 *sam, uint32 num_entries, prs_struct *ps, int depth) -{ - uint32 i; - if (sam == NULL) return False; +BOOL samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO *q_e, prs_struct *ps, int depth) +{ + if (q_e == NULL) + return False; - prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_3"); + prs_debug(ps, depth, desc, "samr_io_q_query_dispinfo"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - SMB_ASSERT_ARRAY(sam->sam, num_entries); + if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; - for (i = 0; i < num_entries; i++) - { - sam_io_sam_entry3("", &(sam->sam[i]), ps, depth); - } + if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level)) + return False; + if(!prs_uint16("unknown_0 ", ps, depth, &q_e->unknown_0)) + return False; + if(!prs_uint32("start_idx ", ps, depth, &q_e->start_idx)) + return False; + if(!prs_uint32("unknown_1 ", ps, depth, &q_e->unknown_1)) + return False; + if(!prs_uint32("max_size ", ps, depth, &q_e->max_size)) + return False; - for (i = 0; i < num_entries; i++) - { - sam_io_sam_str3 ("", &(sam->str[i]), - sam->sam[i].hdr_grp_name.buffer, - sam->sam[i].hdr_grp_desc.buffer, - ps, depth); - } + if(!prs_align(ps)) + return False; return True; } /******************************************************************* -makes a SAM_DISPINFO_4 structure. + Inits a SAM_INFO_2 structure. ********************************************************************/ -BOOL make_sam_dispinfo_4(SAM_DISPINFO_4 *sam, uint32 *num_entries, - uint32 *data_size, uint32 start_idx, - SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) -{ - fstring sam_name; - uint32 len_sam_name; - uint32 max_entries, max_data_size; - uint32 dsize = 0; - uint32 i; - if (sam == NULL || num_entries == NULL || data_size == NULL) return False; +void init_sam_info_2(SAM_INFO_2 *sam, uint32 acb_mask, + uint32 start_idx, uint32 num_sam_entries, + SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) +{ + int i; + int entries_added; - DEBUG(5,("make_sam_dispinfo_4\n")); + DEBUG(5,("init_sam_info_2\n")); - max_entries = *num_entries; - max_data_size = *data_size; + if (num_sam_entries >= MAX_SAM_ENTRIES) { + num_sam_entries = MAX_SAM_ENTRIES; + DEBUG(5,("limiting number of entries to %d\n", + num_sam_entries)); + } - for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) - { - len_sam_name = pass[i].uni_user_name.uni_str_len; + for (i = start_idx, entries_added = 0; i < num_sam_entries; i++) { + if (IS_BITS_SET_ALL(pass[i].acb_info, acb_mask)) { + init_sam_entry2(&sam->sam[entries_added], + start_idx + entries_added + 1, + pass[i].uni_user_name.uni_str_len, + pass[i].uni_acct_desc.uni_str_len, + pass[i].user_rid, + pass[i].acb_info); - make_sam_entry4(&(sam->sam[i]), start_idx + i + 1, - len_sam_name); + copy_unistr2(&sam->str[entries_added].uni_srv_name, &pass[i].uni_user_name); + copy_unistr2(&sam->str[entries_added].uni_srv_desc, &pass[i].uni_acct_desc); - unistr2_to_ascii(sam_name, &(pass[i].uni_user_name), sizeof(sam_name)); - make_string2(&(sam->str[i].acct_name), sam_name, len_sam_name); + entries_added++; + } - dsize += sizeof(SAM_ENTRY4); - dsize += len_sam_name; + sam->num_entries = entries_added; + sam->ptr_entries = 1; + sam->num_entries2 = entries_added; } - - *num_entries = i; - *data_size = dsize; - - return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 *sam, uint32 num_entries, prs_struct *ps, int depth) + +static BOOL sam_io_sam_info_2(char *desc, SAM_INFO_2 *sam, prs_struct *ps, int depth) { - uint32 i; + int i; - if (sam == NULL) return False; + if (sam == NULL) + return False; - prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_4"); + prs_debug(ps, depth, desc, "sam_io_sam_info_2"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; + + if(!prs_uint32("num_entries ", ps, depth, &sam->num_entries)) + return False; + if(!prs_uint32("ptr_entries ", ps, depth, &sam->ptr_entries)) + return False; - SMB_ASSERT_ARRAY(sam->sam, num_entries); + if(!prs_uint32("num_entries2 ", ps, depth, &sam->num_entries2)) + return False; - for (i = 0; i < num_entries; i++) - { - sam_io_sam_entry4("", &(sam->sam[i]), ps, depth); + SMB_ASSERT_ARRAY(sam->sam, sam->num_entries); + + for (i = 0; i < sam->num_entries; i++) { + if(!sam_io_sam_entry2("", &sam->sam[i], ps, depth)) + return False; } - for (i = 0; i < num_entries; i++) - { - smb_io_string2("acct_name", &(sam->str[i].acct_name), - sam->sam[i].hdr_acct_name.buffer, ps, depth); + for (i = 0; i < sam->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; } - /******************************************************************* -makes a SAM_DISPINFO_5 structure. + Inits a SAM_INFO_1 structure. ********************************************************************/ -BOOL make_sam_dispinfo_5(SAM_DISPINFO_5 *sam, uint32 *num_entries, - uint32 *data_size, uint32 start_idx, - DOMAIN_GRP *grp) -{ - uint32 len_sam_name; - uint32 max_entries, max_data_size; - uint32 dsize = 0; - uint32 i; - - if (sam == NULL || num_entries == NULL || data_size == NULL) return False; - DEBUG(5,("make_sam_dispinfo_5\n")); +void init_sam_info_1(SAM_INFO_1 *sam, uint32 acb_mask, + uint32 start_idx, uint32 num_sam_entries, + SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) +{ + int i; + int entries_added; - max_entries = *num_entries; - max_data_size = *data_size; + DEBUG(5,("init_sam_info_1\n")); - for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) - { - len_sam_name = strlen(grp[i].name); + if (num_sam_entries >= MAX_SAM_ENTRIES) { + num_sam_entries = MAX_SAM_ENTRIES; + DEBUG(5,("limiting number of entries to %d\n", + num_sam_entries)); + } - make_sam_entry5(&(sam->sam[i]), start_idx + i + 1, - len_sam_name); + for (i = start_idx, entries_added = 0; i < num_sam_entries; i++) { + if (IS_BITS_SET_ALL(pass[i].acb_info, acb_mask)) { + init_sam_entry1(&sam->sam[entries_added], + start_idx + entries_added + 1, + pass[i].uni_user_name.uni_str_len, + pass[i].uni_full_name.uni_str_len, + pass[i].uni_acct_desc.uni_str_len, + pass[i].user_rid, + pass[i].acb_info); - make_string2(&(sam->str[i].grp_name), grp[i].name, - len_sam_name); + copy_unistr2(&sam->str[entries_added].uni_acct_name, &pass[i].uni_user_name); + copy_unistr2(&sam->str[entries_added].uni_full_name, &pass[i].uni_full_name); + copy_unistr2(&sam->str[entries_added].uni_acct_desc, &pass[i].uni_acct_desc); - dsize += sizeof(SAM_ENTRY5); - dsize += len_sam_name; + entries_added++; + } } - *num_entries = i; - *data_size = dsize; - - return True; + sam->num_entries = entries_added; + sam->ptr_entries = 1; + sam->num_entries2 = entries_added; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_5(char *desc, SAM_DISPINFO_5 *sam, uint32 num_entries, prs_struct *ps, int depth) + +static BOOL sam_io_sam_info_1(char *desc, SAM_INFO_1 *sam, prs_struct *ps, int depth) { - uint32 i; + int i; - if (sam == NULL) return False; + if (sam == NULL) + return False; - prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_5"); + prs_debug(ps, depth, desc, "sam_io_sam_info_1"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; + + if(!prs_uint32("num_entries ", ps, depth, &sam->num_entries)) + return False; + if(!prs_uint32("ptr_entries ", ps, depth, &sam->ptr_entries)) + return False; - SMB_ASSERT_ARRAY(sam->sam, num_entries); + if(!prs_uint32("num_entries2 ", ps, depth, &sam->num_entries2)) + return False; - for (i = 0; i < num_entries; i++) - { - sam_io_sam_entry5("", &(sam->sam[i]), ps, depth); + SMB_ASSERT_ARRAY(sam->sam, sam->num_entries); + + for (i = 0; i < sam->num_entries; i++) { + if(!sam_io_sam_entry1("", &sam->sam[i], ps, depth)) + return False; } - for (i = 0; i < num_entries; i++) - { - smb_io_string2("grp_name", &(sam->str[i].grp_name), - sam->sam[i].hdr_grp_name.buffer, ps, depth); + for (i = 0; i < sam->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; } - /******************************************************************* -makes a SAMR_R_QUERY_DISPINFO structure. + Inits a SAMR_R_QUERY_DISPINFO structure. ********************************************************************/ -BOOL make_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO *r_u, - uint32 num_entries, uint32 data_size, - uint16 switch_level, SAM_DISPINFO_CTR *ctr, - uint32 status) -{ - if (r_u == NULL) return False; - DEBUG(5,("make_samr_r_query_dispinfo: level %d\n", switch_level)); +void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO *r_u, + uint16 switch_level, SAM_INFO_CTR *ctr, uint32 status) +{ + DEBUG(5,("init_samr_r_query_dispinfo\n")); - r_u->total_size = 0; /* not calculated */ - r_u->data_size = data_size; + if (status == 0x0) { + r_u->unknown_0 = 0x0000001; + r_u->unknown_1 = 0x0000001; + } else { + r_u->unknown_0 = 0x0; + r_u->unknown_1 = 0x0; + } r_u->switch_level = switch_level; - r_u->num_entries = num_entries; - r_u->ptr_entries = 1; - r_u->num_entries2 = num_entries; r_u->ctr = ctr; - r_u->status = status; - - return True; } - /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct *ps, int depth) + +BOOL samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return False; + if (r_u == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_r_query_dispinfo"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("total_size ", ps, depth, &(r_u->total_size )); - prs_uint32("data_size ", ps, depth, &(r_u->data_size )); - prs_uint16("switch_level", ps, depth, &(r_u->switch_level)); - prs_align(ps); + if(!prs_uint32("unknown_0 ", ps, depth, &r_u->unknown_0)) + return False; + if(!prs_uint32("unknown_1 ", ps, depth, &r_u->unknown_1)) + return False; + if(!prs_uint16("switch_level ", ps, depth, &r_u->switch_level)) + return False; - prs_uint32("num_entries ", ps, depth, &(r_u->num_entries )); - prs_uint32("ptr_entries ", ps, depth, &(r_u->ptr_entries )); - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + if(!prs_align(ps)) + return False; - switch (r_u->switch_level) - { - case 0x1: - { - sam_io_sam_dispinfo_1("users", r_u->ctr->sam.info1, r_u->num_entries, ps, depth); - break; - } - case 0x2: - { - sam_io_sam_dispinfo_2("servers", r_u->ctr->sam.info2, r_u->num_entries, ps, depth); - break; - } - case 0x3: - { - sam_io_sam_dispinfo_3("groups", r_u->ctr->sam.info3, r_u->num_entries, ps, depth); - break; - } - case 0x4: - { - sam_io_sam_dispinfo_4("user list", r_u->ctr->sam.info4,r_u->num_entries, ps, depth); - break; - } - case 0x5: - { - sam_io_sam_dispinfo_5("group list", r_u->ctr->sam.info5, r_u->num_entries, ps, depth); - break; - } - default: - { - DEBUG(5,("samr_io_r_query_dispinfo: unknown switch value\n")); - break; - } + switch (r_u->switch_level) { + case 0x1: + if(!sam_io_sam_info_1("users", r_u->ctr->sam.info1, ps, depth)) + return False; + break; + case 0x2: + if(!sam_io_sam_info_2("servers", r_u->ctr->sam.info2, ps, depth)) + return False; + break; + default: + DEBUG(5,("samr_io_r_query_dispinfo: unknown switch value\n")); + break; } - prs_align(ps); - prs_align(ps); - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } - /******************************************************************* -makes a SAMR_Q_OPEN_GROUP structure. + Inits a SAMR_Q_ENUM_DOM_GROUPS structure. ********************************************************************/ -BOOL make_samr_q_open_group(SAMR_Q_OPEN_GROUP *q_c, - const POLICY_HND *hnd, uint32 unk, uint32 rid) + +void init_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol, + uint16 switch_level, uint32 start_idx, uint32 size) { - if (q_c == NULL || hnd == NULL) return False; + DEBUG(5,("init_q_enum_dom_groups\n")); - DEBUG(5,("make_samr_q_open_group\n")); + memcpy(&q_e->pol, pol, sizeof(*pol)); - memcpy(&(q_c->domain_pol), hnd, sizeof(q_c->domain_pol)); - q_c->unknown = unk; - q_c->rid_group = rid; + q_e->switch_level = switch_level; - return True; + q_e->unknown_0 = 0; + q_e->start_idx = start_idx; + q_e->unknown_1 = 0x000007d0; + q_e->max_size = size; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_open_group(char *desc, SAMR_Q_OPEN_GROUP *q_u, prs_struct *ps, int depth) + +BOOL samr_io_q_enum_dom_groups(char *desc, SAMR_Q_ENUM_DOM_GROUPS *q_e, prs_struct *ps, int depth) { - if (q_u == NULL) return False; + if (q_e == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_q_open_group"); + prs_debug(ps, depth, desc, "samr_io_q_enum_dom_groups"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth); + if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level)) + return False; + if(!prs_uint16("unknown_0 ", ps, depth, &q_e->unknown_0)) + return False; + if(!prs_uint32("start_idx ", ps, depth, &q_e->start_idx)) + return False; + if(!prs_uint32("unknown_1 ", ps, depth, &q_e->unknown_1)) + return False; + if(!prs_uint32("max_size ", ps, depth, &q_e->max_size)) + return False; - prs_uint32("unknown ", ps, depth, &(q_u->unknown )); - prs_uint32("rid_group", ps, depth, &(q_u->rid_group)); + if(!prs_align(ps)) + return False; return True; } + /******************************************************************* -reads or writes a structure. + Inits a SAMR_R_ENUM_DOM_GROUPS structure. ********************************************************************/ -BOOL samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP *r_u, prs_struct *ps, int depth) + +void init_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, + uint32 start_idx, uint32 num_sam_entries, + SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES], + uint32 status) { - if (r_u == NULL) return False; + int i; + int entries_added; - prs_debug(ps, depth, desc, "samr_io_r_open_group"); - depth++; + DEBUG(5,("init_samr_r_enum_dom_groups\n")); - prs_align(ps); + if (num_sam_entries >= MAX_SAM_ENTRIES) { + num_sam_entries = MAX_SAM_ENTRIES; + DEBUG(5,("limiting number of entries to %d\n", + num_sam_entries)); + } - smb_io_pol_hnd("pol", &(r_u->pol), ps, depth); - prs_align(ps); - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - - -/******************************************************************* -makes a GROUP_INFO1 structure. -********************************************************************/ -BOOL make_samr_group_info1(GROUP_INFO1 *gr1, - char *acct_name, char *acct_desc, - uint32 num_members) -{ - int desc_len = acct_desc != NULL ? strlen(acct_desc) : 0; - int acct_len = acct_name != NULL ? strlen(acct_name) : 0; - if (gr1 == NULL) return False; - - DEBUG(5,("make_samr_group_info1\n")); - - make_uni_hdr(&(gr1->hdr_acct_name), acct_len); + if (status == 0x0) { + for (i = start_idx, entries_added = 0; i < num_sam_entries; i++) { + init_sam_entry3(&r_u->sam[entries_added], + start_idx + entries_added + 1, + pass[i].uni_user_name.uni_str_len, + pass[i].uni_acct_desc.uni_str_len, + pass[i].user_rid); - gr1->unknown_1 = 0x3; - gr1->num_members = num_members; + copy_unistr2(&r_u->str[entries_added].uni_grp_name, + &pass[i].uni_user_name); + copy_unistr2(&r_u->str[entries_added].uni_grp_desc, + &pass[i].uni_acct_desc); - make_uni_hdr(&(gr1->hdr_acct_desc), desc_len); + entries_added++; + } - make_unistr2(&(gr1->uni_acct_name), acct_name, acct_len); - make_unistr2(&(gr1->uni_acct_desc), acct_desc, desc_len); + if (entries_added > 0) { + r_u->unknown_0 = 0x0000492; + r_u->unknown_1 = 0x000049a; + } else { + r_u->unknown_0 = 0x0; + r_u->unknown_1 = 0x0; + } + r_u->switch_level = 3; + r_u->num_entries = entries_added; + r_u->ptr_entries = 1; + r_u->num_entries2 = entries_added; + } else { + r_u->switch_level = 0; + } - return True; + r_u->status = status; } - /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_group_info1(char *desc, GROUP_INFO1 *gr1, prs_struct *ps, int depth) + +BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_struct *ps, int depth) { - if (gr1 == NULL) return False; + int i; + + if (r_u == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_group_info1"); + prs_debug(ps, depth, desc, "samr_io_r_enum_dom_groups"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_unihdr ("hdr_acct_name", &(gr1->hdr_acct_name) , ps, depth); + if(!prs_uint32("unknown_0 ", ps, depth, &r_u->unknown_0)) + return False; + if(!prs_uint32("unknown_1 ", ps, depth, &r_u->unknown_1)) + return False; + if(!prs_uint32("switch_level ", ps, depth, &r_u->switch_level)) + return False; + + if (r_u->switch_level != 0) { + 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; - prs_uint32("unknown_1", ps, depth, &(gr1->unknown_1)); - prs_uint32("num_members", ps, depth, &(gr1->num_members)); + if(!prs_uint32("num_entries2 ", ps, depth, &r_u->num_entries2)) + return False; - smb_io_unihdr ("hdr_acct_desc", &(gr1->hdr_acct_desc) , ps, depth); + SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries); - smb_io_unistr2("uni_acct_name", &(gr1->uni_acct_name), gr1->hdr_acct_name.buffer, ps, depth); - prs_align(ps); + for (i = 0; i < r_u->num_entries; i++) { + if(!sam_io_sam_entry3("", &r_u->sam[i], ps, depth)) + return False; + } - smb_io_unistr2("uni_acct_desc", &(gr1->uni_acct_desc), gr1->hdr_acct_desc.buffer, ps, depth); - prs_align(ps); + for (i = 0; i < r_u->num_entries; i++) { + if(!sam_io_sam_str3 ("", &r_u->str[i], + r_u->sam[i].hdr_grp_name.buffer, + r_u->sam[i].hdr_grp_desc.buffer, + ps, depth)) + return False; + } + } + + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } /******************************************************************* -makes a GROUP_INFO4 structure. + Inits a SAMR_Q_QUERY_ALIASINFO structure. ********************************************************************/ -BOOL make_samr_group_info4(GROUP_INFO4 *gr4, const char *acct_desc) -{ - int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - if (gr4 == NULL) return False; - DEBUG(5,("make_samr_group_info4\n")); +void init_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO *q_e, + POLICY_HND *pol, + uint16 switch_level) +{ + DEBUG(5,("init_q_query_aliasinfo\n")); - make_uni_hdr(&(gr4->hdr_acct_desc), acct_len); - make_unistr2(&(gr4->uni_acct_desc), acct_desc, acct_len); + memcpy(&q_e->pol, pol, sizeof(*pol)); - return True; + q_e->switch_level = switch_level; } - /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_group_info4(char *desc, GROUP_INFO4 *gr4, prs_struct *ps, int depth) + +BOOL samr_io_q_query_aliasinfo(char *desc, SAMR_Q_QUERY_ALIASINFO *q_e, prs_struct *ps, int depth) { - if (gr4 == NULL) return False; + if (q_e == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_group_info4"); + prs_debug(ps, depth, desc, "samr_io_q_query_aliasinfo"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_unihdr ("hdr_acct_desc", &(gr4->hdr_acct_desc) , ps, depth); - smb_io_unistr2("uni_acct_desc", &(gr4->uni_acct_desc), gr4->hdr_acct_desc.buffer, ps, depth); - prs_align(ps); + if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Inits a SAMR_R_QUERY_ALIASINFO structure. ********************************************************************/ -BOOL samr_group_info_ctr(char *desc, GROUP_INFO_CTR *ctr, prs_struct *ps, int depth) + +void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *r_u, + uint16 switch_value, char *acct_desc, + uint32 status) { - if (ctr == NULL) return False; + DEBUG(5,("init_samr_r_query_aliasinfo\n")); - prs_debug(ps, depth, desc, "samr_group_info_ctr"); - depth++; + r_u->ptr = 0; - prs_uint16("switch_value1", ps, depth, &(ctr->switch_value1)); - prs_uint16("switch_value2", ps, depth, &(ctr->switch_value2)); + if (status == 0) { + r_u->switch_value = switch_value; - switch (ctr->switch_value1) - { - case 1: - { - samr_io_group_info1("group_info1", &(ctr->group.info1), ps, depth); - break; - } - case 4: - { - samr_io_group_info4("group_info4", &(ctr->group.info4), ps, depth); - break; - } - default: - { - DEBUG(4,("samr_group_info_ctr: unsupported switch level\n")); - break; + switch (switch_value) { + case 3: + { + int acct_len = acct_desc ? strlen(acct_desc) : 0; + + r_u->ptr = 1; + + init_uni_hdr(&r_u->alias.info3.hdr_acct_desc, acct_len); + init_unistr2(&r_u->alias.info3.uni_acct_desc, acct_desc, acct_len); + + break; + } + default: + DEBUG(4,("init_samr_r_query_aliasinfo: unsupported switch level\n")); + break; } } - prs_align(ps); - - return True; + r_u->status = status; } - /******************************************************************* -makes a SAMR_Q_CREATE_DOM_GROUP structure. + Reads or writes a structure. ********************************************************************/ -BOOL make_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP *q_e, - POLICY_HND *pol, - const char *acct_desc) + +BOOL samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO *r_u, prs_struct *ps, int depth) { - int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - if (q_e == NULL || pol == NULL) return False; + if (r_u == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo"); + depth++; - DEBUG(5,("make_samr_q_create_dom_group\n")); + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr ", ps, depth, &r_u->ptr)) + return False; + + if (r_u->ptr != 0) { + if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value)) + return False; + if(!prs_align(ps)) + return False; - memcpy(&(q_e->pol), pol, sizeof(*pol)); + if (r_u->switch_value != 0) { + switch (r_u->switch_value) { + case 3: + if(!smb_io_unihdr ("", &r_u->alias.info3.hdr_acct_desc, ps, depth)) + return False; + if(!smb_io_unistr2("", &r_u->alias.info3.uni_acct_desc, + r_u->alias.info3.hdr_acct_desc.buffer, ps, depth)) + return False; + break; + default: + DEBUG(4,("samr_io_r_query_aliasinfo: unsupported switch level\n")); + break; + } + } + } - make_uni_hdr(&(q_e->hdr_acct_desc), acct_len); - make_unistr2(&(q_e->uni_acct_desc), acct_desc, acct_len); + if(!prs_align(ps)) + return False; - q_e->unknown_1 = 0x0002; - q_e->unknown_2 = 0x0001; + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } - /******************************************************************* -reads or writes a structure. + Reads or writes a SAMR_Q_LOOKUP_IDS structure. ********************************************************************/ -BOOL samr_io_q_create_dom_group(char *desc, SAMR_Q_CREATE_DOM_GROUP *q_e, prs_struct *ps, int depth) + +BOOL samr_io_q_lookup_ids(char *desc, SAMR_Q_LOOKUP_IDS *q_u, prs_struct *ps, int depth) { - if (q_e == NULL) return False; + fstring tmp; + int i; - prs_debug(ps, depth, desc, "samr_io_q_create_dom_group"); + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_q_lookup_ids"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); - prs_align(ps); + if(!smb_io_pol_hnd("pol", &(q_u->pol), ps, depth)) + return False; + if(!prs_align(ps)) + return False; - smb_io_unihdr ("hdr_acct_desc", &(q_e->hdr_acct_desc), ps, depth); - smb_io_unistr2("uni_acct_desc", &(q_e->uni_acct_desc), q_e->hdr_acct_desc.buffer, ps, depth); - prs_align(ps); + 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(!prs_uint32("num_sids2", ps, depth, &q_u->num_sids2)) + return False; + + SMB_ASSERT_ARRAY(q_u->ptr_sid, q_u->num_sids2); + + 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; + } + } - prs_uint16("unknown_1", ps, depth, &(q_e->unknown_1)); - prs_uint16("unknown_2", ps, depth, &(q_e->unknown_2)); + if(!prs_align(ps)) + return False; return True; } - /******************************************************************* -makes a SAMR_R_CREATE_DOM_GROUP structure. + Inits a SAMR_R_LOOKUP_IDS structure. ********************************************************************/ -BOOL make_samr_r_create_dom_group(SAMR_R_CREATE_DOM_GROUP *r_u, POLICY_HND *pol, - uint32 rid, uint32 status) + +void init_samr_r_lookup_ids(SAMR_R_LOOKUP_IDS *r_u, + uint32 num_rids, uint32 *rid, uint32 status) { - if (r_u == NULL) return False; + int i; - DEBUG(5,("make_samr_r_create_dom_group\n")); + DEBUG(5,("init_samr_r_lookup_ids\n")); - memcpy(&(r_u->pol), pol, sizeof(*pol)); + if (status == 0x0) { + r_u->num_entries = num_rids; + r_u->ptr = 1; + r_u->num_entries2 = num_rids; - r_u->rid = rid ; - r_u->status = status; + SMB_ASSERT_ARRAY(r_u->rid, num_rids); - return True; -} + for (i = 0; i < num_rids; i++) { + r_u->rid[i] = rid[i]; + } + } else { + r_u->num_entries = 0; + r_u->ptr = 0; + r_u->num_entries2 = 0; + } + r_u->status = status; +} /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_create_dom_group(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++; +BOOL samr_io_r_lookup_ids(char *desc, SAMR_R_LOOKUP_IDS *r_u, prs_struct *ps, int depth) +{ + fstring tmp; + int i; - prs_align(ps); + if (r_u == NULL) + return False; - smb_io_pol_hnd("pol", &(r_u->pol), ps, depth); - prs_align(ps); + prs_debug(ps, depth, desc, "samr_io_r_lookup_ids"); + depth++; - prs_uint32("rid ", ps, depth, &(r_u->rid )); - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_align(ps)) + return False; - return True; -} + 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(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2)) + return False; -/******************************************************************* -makes a SAMR_Q_DELETE_DOM_GROUP structure. -********************************************************************/ -BOOL make_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP *q_c, POLICY_HND *hnd) -{ - if (q_c == NULL || hnd == NULL) return False; + if (r_u->num_entries != 0) { + SMB_ASSERT_ARRAY(r_u->rid, r_u->num_entries2); - DEBUG(5,("make_samr_q_delete_dom_group\n")); + for (i = 0; i < r_u->num_entries2; i++) { + slprintf(tmp, sizeof(tmp)-1, "rid[%02d]", i); + if(!prs_uint32(tmp, ps, depth, &r_u->rid[i])) + return False; + } + } - memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol)); + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_delete_dom_group(char *desc, SAMR_Q_DELETE_DOM_GROUP *q_u, prs_struct *ps, int depth) + +BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return False; + int i; + + if (q_u == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_q_delete_dom_group"); + prs_debug(ps, depth, desc, "samr_io_q_lookup_names"); depth++; prs_align(ps); - smb_io_pol_hnd("group_pol", &(q_u->group_pol), ps, depth); + if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) + return False; + if(!prs_align(ps)) + 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; + + SMB_ASSERT_ARRAY(q_u->hdr_name, q_u->num_names2); + + 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; } + /******************************************************************* -makes a SAMR_R_DELETE_DOM_GROUP structure. + Inits a SAMR_R_LOOKUP_NAMES structure. ********************************************************************/ -BOOL make_samr_r_delete_dom_group(SAMR_R_DELETE_DOM_GROUP *r_u, - uint32 status) + +void init_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, + uint32 num_rids, uint32 *rid, uint8 *type, uint32 status) { - if (r_u == NULL) return False; + int i; - DEBUG(5,("make_samr_r_delete_dom_group\n")); + DEBUG(5,("init_samr_r_lookup_names\n")); - r_u->status = status; + if (status == 0x0) { + r_u->num_types1 = num_rids; + r_u->ptr_types = 1; + r_u->num_types2 = num_rids; - return True; + r_u->num_rids1 = num_rids; + r_u->ptr_rids = 1; + r_u->num_rids2 = num_rids; + + SMB_ASSERT_ARRAY(r_u->rid, num_rids); + + for (i = 0; i < num_rids; i++) { + r_u->rid [i] = rid [i]; + r_u->type[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->status = status; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_delete_dom_group(char *desc, SAMR_R_DELETE_DOM_GROUP *r_u, prs_struct *ps, int depth) + +BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return False; + int i; + fstring tmp; + + if (r_u == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_r_delete_dom_group"); + prs_debug(ps, depth, desc, "samr_io_r_lookup_names"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_u->status)); + 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; - return True; -} + 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; + } + 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->rid[i])) + return False; + } + } -/******************************************************************* -makes a SAMR_Q_DEL_GROUPMEM structure. -********************************************************************/ -BOOL make_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM *q_e, - POLICY_HND *pol, - uint32 rid) -{ - if (q_e == NULL || pol == NULL) 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; - DEBUG(5,("make_samr_q_del_groupmem\n")); + if (r_u->num_types2 != r_u->num_types1) { + /* RPC fault */ + return False; + } - memcpy(&(q_e->pol), pol, sizeof(*pol)); + 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; + } + } - q_e->rid = rid; + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } - /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_del_groupmem(char *desc, SAMR_Q_DEL_GROUPMEM *q_e, prs_struct *ps, int depth) + +BOOL samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, int depth) { - if (q_e == NULL) return False; + int i; + fstring tmp; - prs_debug(ps, depth, desc, "samr_io_q_del_groupmem"); + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_q_unknown_12"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); - prs_align(ps); + if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + if(!prs_uint32("num_gids1", ps, depth, &q_u->num_gids1)) + return False; + if(!prs_uint32("rid ", ps, depth, &q_u->rid)) + return False; + if(!prs_uint32("ptr ", ps, depth, &q_u->ptr)) + return False; + if(!prs_uint32("num_gids2", ps, depth, &q_u->num_gids2)) + return False; + + SMB_ASSERT_ARRAY(q_u->gid, q_u->num_gids2); + + for (i = 0; i < q_u->num_gids2; i++) { + slprintf(tmp, sizeof(tmp) - 1, "gid[%02d] ", i); + if(!prs_uint32(tmp, ps, depth, &q_u->gid[i])) + return False; + } - prs_uint32("rid ", ps, depth, &(q_e->rid)); + if(!prs_align(ps)) + return False; return True; } - /******************************************************************* -makes a SAMR_R_DEL_GROUPMEM structure. + Inits a SAMR_R_UNKNOWN_12 structure. ********************************************************************/ -BOOL make_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM *r_u, POLICY_HND *pol, + +void init_samr_r_unknown_12(SAMR_R_UNKNOWN_12 *r_u, + uint32 num_aliases, fstring *als_name, uint32 *num_als_usrs, uint32 status) { - if (r_u == NULL) return False; + int i; - DEBUG(5,("make_samr_r_del_groupmem\n")); + DEBUG(5,("init_samr_r_unknown_12\n")); - r_u->status = status; - - return True; -} + if (status == 0x0) { + r_u->num_aliases1 = num_aliases; + r_u->ptr_aliases = 1; + r_u->num_aliases2 = num_aliases; + r_u->num_als_usrs1 = num_aliases; + r_u->ptr_als_usrs = 1; + r_u->num_als_usrs2 = num_aliases; -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_del_groupmem(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++; + SMB_ASSERT_ARRAY(r_u->hdr_als_name, num_aliases); - prs_align(ps); + for (i = 0; i < num_aliases; i++) { + int als_len = als_name[i] != NULL ? strlen(als_name[i]) : 0; + init_uni_hdr(&r_u->hdr_als_name[i], als_len); + init_unistr2(&r_u->uni_als_name[i], als_name[i], als_len); + r_u->num_als_usrs[i] = num_als_usrs[i]; + } + } else { + r_u->num_aliases1 = num_aliases; + r_u->ptr_aliases = 0; + r_u->num_aliases2 = num_aliases; - prs_uint32("status", ps, depth, &(r_u->status)); + r_u->num_als_usrs1 = num_aliases; + r_u->ptr_als_usrs = 0; + r_u->num_als_usrs2 = num_aliases; + } - return True; + r_u->status = status; } - /******************************************************************* -makes a SAMR_Q_ADD_GROUPMEM structure. + Reads or writes a structure. ********************************************************************/ -BOOL make_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM *q_e, - POLICY_HND *pol, - uint32 rid) + +BOOL samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, int depth) { - if (q_e == NULL || pol == NULL) return False; + int i; + fstring tmp; - DEBUG(5,("make_samr_q_add_groupmem\n")); + if (r_u == NULL) + return False; - memcpy(&(q_e->pol), pol, sizeof(*pol)); + prs_debug(ps, depth, desc, "samr_io_r_unknown_12"); + depth++; - q_e->rid = rid; - q_e->unknown = 0x0005; + if(!prs_align(ps)) + return False; - return True; -} + if(!prs_uint32("num_aliases1", ps, depth, &r_u->num_aliases1)) + return False; + if(!prs_uint32("ptr_aliases ", ps, depth, &r_u->ptr_aliases )) + return False; + if(!prs_uint32("num_aliases2", ps, depth, &r_u->num_aliases2)) + return False; + if (r_u->ptr_aliases != 0 && r_u->num_aliases1 != 0) { + SMB_ASSERT_ARRAY(r_u->hdr_als_name, r_u->num_aliases2); -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_add_groupmem(char *desc, SAMR_Q_ADD_GROUPMEM *q_e, prs_struct *ps, int depth) -{ - if (q_e == NULL) return False; + for (i = 0; i < r_u->num_aliases2; i++) { + slprintf(tmp, sizeof(tmp) - 1, "als_hdr[%02d] ", i); + if(!smb_io_unihdr ("", &r_u->hdr_als_name[i], ps, depth)) + return False; + } + for (i = 0; i < r_u->num_aliases2; i++) { + slprintf(tmp, sizeof(tmp) - 1, "als_str[%02d] ", i); + if(!smb_io_unistr2("", &r_u->uni_als_name[i], r_u->hdr_als_name[i].buffer, ps, depth)) + return False; + } + } - prs_debug(ps, depth, desc, "samr_io_q_add_groupmem"); - depth++; + if(!prs_align(ps)) + return False; - prs_align(ps); + if(!prs_uint32("num_als_usrs1", ps, depth, &r_u->num_als_usrs1)) + return False; + if(!prs_uint32("ptr_als_usrs ", ps, depth, &r_u->ptr_als_usrs)) + return False; + if(!prs_uint32("num_als_usrs2", ps, depth, &r_u->num_als_usrs2)) + return False; - smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); - prs_align(ps); + if (r_u->ptr_als_usrs != 0 && r_u->num_als_usrs1 != 0) { + SMB_ASSERT_ARRAY(r_u->num_als_usrs, r_u->num_als_usrs2); - prs_uint32("rid ", ps, depth, &(q_e->rid)); - prs_uint32("unknown", ps, depth, &(q_e->unknown)); + for (i = 0; i < r_u->num_als_usrs2; i++) { + slprintf(tmp, sizeof(tmp) - 1, "als_usrs[%02d] ", i); + if(!prs_uint32(tmp, ps, depth, &r_u->num_als_usrs[i])) + return False; + } + } + + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } /******************************************************************* -makes a SAMR_R_ADD_GROUPMEM structure. + Inits a SAMR_Q_OPEN_USER struct. ********************************************************************/ -BOOL make_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM *r_u, POLICY_HND *pol, - uint32 status) + +void init_samr_q_open_user(SAMR_Q_OPEN_USER *q_u, + POLICY_HND *pol, + uint32 unk_0, uint32 rid) { - if (r_u == NULL) return False; + DEBUG(5,("samr_init_q_open_user\n")); - DEBUG(5,("make_samr_r_add_groupmem\n")); - - r_u->status = status; - - return True; + memcpy(&q_u->domain_pol, pol, sizeof(q_u->domain_pol)); + + q_u->unknown_0 = unk_0; + q_u->user_rid = rid; } - /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_add_groupmem(char *desc, SAMR_R_ADD_GROUPMEM *r_u, prs_struct *ps, int depth) + +BOOL samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER *q_u, prs_struct *ps, int depth) { - if (r_u == NULL) return False; + if (q_u == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_r_add_groupmem"); + prs_debug(ps, depth, desc, "samr_io_q_open_user"); depth++; - prs_align(ps); - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - + if(!prs_align(ps)) + return False; -/******************************************************************* -makes a SAMR_Q_SET_GROUPINFO structure. -********************************************************************/ -BOOL make_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO *q_e, - POLICY_HND *pol, GROUP_INFO_CTR *ctr) -{ - if (q_e == NULL || pol == NULL) return False; + if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; - DEBUG(5,("make_samr_q_set_groupinfo\n")); + if(!prs_uint32("unknown_0", ps, depth, &q_u->unknown_0)) + return False; + if(!prs_uint32("user_rid ", ps, depth, &q_u->user_rid)) + return False; - memcpy(&(q_e->pol), pol, sizeof(*pol)); - q_e->ctr = ctr; + if(!prs_align(ps)) + return False; return True; } - /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_groupinfo(char *desc, SAMR_Q_SET_GROUPINFO *q_e, prs_struct *ps, int depth) + +BOOL samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER *r_u, prs_struct *ps, int depth) { - if (q_e == NULL) return False; + if (r_u == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_q_set_groupinfo"); + prs_debug(ps, depth, desc, "samr_io_r_open_user"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); - prs_align(ps); + if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; - samr_group_info_ctr("ctr", q_e->ctr, ps, depth); + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } - /******************************************************************* -makes a SAMR_R_SET_GROUPINFO structure. + Inits a SAMR_Q_QUERY_USERGROUPS structure. ********************************************************************/ -BOOL make_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO *r_u, - uint32 status) -{ - if (r_u == NULL) return False; - DEBUG(5,("make_samr_r_set_groupinfo\n")); - - r_u->status = status; +void init_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u, + POLICY_HND *hnd) +{ + DEBUG(5,("init_samr_q_query_usergroups\n")); - return True; + memcpy(&q_u->pol, hnd, sizeof(q_u->pol)); } - /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_groupinfo(char *desc, SAMR_R_SET_GROUPINFO *r_u, prs_struct *ps, int depth) + +BOOL samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS *q_u, prs_struct *ps, int depth) { - if (r_u == NULL) return False; + if (q_u == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_r_set_groupinfo"); + prs_debug(ps, depth, desc, "samr_io_q_query_usergroups"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_u->status)); + if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; return True; } /******************************************************************* -makes a SAMR_Q_QUERY_GROUPINFO structure. + Inits a SAMR_R_QUERY_USERGROUPS structure. ********************************************************************/ -BOOL make_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO *q_e, - POLICY_HND *pol, - uint16 switch_level) -{ - if (q_e == NULL || pol == NULL) return False; - - DEBUG(5,("make_samr_q_query_groupinfo\n")); - - memcpy(&(q_e->pol), pol, sizeof(*pol)); - - q_e->switch_level = switch_level; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_query_groupinfo(char *desc, SAMR_Q_QUERY_GROUPINFO *q_e, prs_struct *ps, int depth) +void init_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u, + uint32 num_gids, DOM_GID *gid, uint32 status) { - if (q_e == NULL) return False; - - prs_debug(ps, depth, desc, "samr_io_q_query_groupinfo"); - depth++; + DEBUG(5,("init_samr_r_query_usergroups\n")); - prs_align(ps); - - smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); - prs_align(ps); + if (status == 0x0) { + r_u->ptr_0 = 1; + r_u->num_entries = num_gids; + r_u->ptr_1 = 1; + r_u->num_entries2 = num_gids; - prs_uint16("switch_level", ps, depth, &(q_e->switch_level)); + r_u->gid = gid; + } else { + r_u->ptr_0 = 0; + r_u->num_entries = 0; + r_u->ptr_1 = 0; + } - return True; + r_u->status = status; } - /******************************************************************* -makes a SAMR_R_QUERY_GROUPINFO structure. + Reads or writes a structure. ********************************************************************/ -BOOL make_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO *r_u, GROUP_INFO_CTR *ctr, - uint32 status) -{ - if (r_u == NULL) return False; - DEBUG(5,("make_samr_r_query_groupinfo\n")); +BOOL samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_struct *ps, int depth) +{ + int i; - r_u->ptr = (status == 0x0 && ctr != NULL) ? 1 : 0; - r_u->ctr = ctr; - r_u->status = status; + if (r_u == NULL) + return False; - return True; -} + prs_debug(ps, depth, desc, "samr_io_r_query_usergroups"); + depth++; + if(!prs_align(ps)) + return False; -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_query_groupinfo(char *desc, SAMR_R_QUERY_GROUPINFO *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; + if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0)) + return False; - prs_debug(ps, depth, desc, "samr_io_r_query_groupinfo"); - depth++; + 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; - prs_align(ps); + if (r_u->num_entries != 0) { + if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2)) + return False; - prs_uint32("ptr", ps, depth, &(r_u->ptr)); - - if (r_u->ptr != 0) - { - samr_group_info_ctr("ctr", r_u->ctr, ps, depth); + for (i = 0; i < r_u->num_entries2; i++) { + if(!smb_io_gid("", &r_u->gid[i], ps, depth)) + return False; + } + } } - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } - /******************************************************************* -makes a SAMR_Q_QUERY_GROUPMEM structure. + Inits a SAMR_Q_QUERY_USERINFO structure. ********************************************************************/ -BOOL make_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM *q_c, POLICY_HND *hnd) -{ - if (q_c == NULL || hnd == NULL) return False; - - DEBUG(5,("make_samr_q_query_groupmem\n")); - - memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol)); - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_query_groupmem(char *desc, SAMR_Q_QUERY_GROUPMEM *q_u, prs_struct *ps, int depth) +void init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO *q_u, + POLICY_HND *hnd, uint16 switch_value) { - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "samr_io_q_query_groupmem"); - depth++; + DEBUG(5,("init_samr_q_query_userinfo\n")); - prs_align(ps); - - smb_io_pol_hnd("group_pol", &(q_u->group_pol), ps, depth); - - return True; + memcpy(&q_u->pol, hnd, sizeof(q_u->pol)); + q_u->switch_value = switch_value; } /******************************************************************* -makes a SAMR_R_QUERY_GROUPMEM structure. + Reads or writes a structure. ********************************************************************/ -BOOL make_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM *r_u, - uint32 num_entries, uint32 *rid, uint32 *attr, uint32 status) -{ - if (r_u == NULL) return False; - DEBUG(5,("make_samr_r_query_groupmem\n")); - - if (status == 0x0) - { - r_u->ptr = 1; - r_u->num_entries = num_entries; +BOOL samr_io_q_query_userinfo(char *desc, SAMR_Q_QUERY_USERINFO *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; - r_u->ptr_attrs = attr != NULL ? 1 : 0; - r_u->ptr_rids = rid != NULL ? 1 : 0; + prs_debug(ps, depth, desc, "samr_io_q_query_userinfo"); + depth++; - r_u->num_rids = num_entries; - r_u->rid = rid; + if(!prs_align(ps)) + return False; - r_u->num_attrs = num_entries; - r_u->attr = attr; - } - else - { - r_u->ptr = 0; - r_u->num_entries = 0; - } + if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; - r_u->status = status; + if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) /* 0x0015 or 0x0011 */ + return False; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a LOGON_HRS structure. ********************************************************************/ -BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struct *ps, int depth) -{ - uint32 i; - if (r_u == NULL) return False; +static BOOL sam_io_logon_hrs(char *desc, LOGON_HRS *hrs, prs_struct *ps, int depth) +{ + if (hrs == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_r_query_groupmem"); + prs_debug(ps, depth, desc, "sam_io_logon_hrs"); depth++; - prs_align(ps); - - prs_uint32("ptr", ps, depth, &(r_u->ptr)); - prs_uint32("num_entries ", ps, depth, &(r_u->num_entries)); - - if (r_u->ptr != 0) - { - prs_uint32("ptr_rids ", ps, depth, &(r_u->ptr_rids )); - prs_uint32("ptr_attrs", ps, depth, &(r_u->ptr_attrs)); - - if (r_u->ptr_rids != 0) - { - prs_uint32("num_rids", ps, depth, &(r_u->num_rids)); - if (r_u->num_rids != 0) - { - r_u->rid = (uint32*)Realloc(r_u->rid, - sizeof(r_u->rid[0]) * - r_u->num_rids); - if (r_u->rid == NULL) - { - samr_free_r_query_groupmem(r_u); - return False; - } - } - for (i = 0; i < r_u->num_rids; i++) - { - prs_uint32("", ps, depth, &(r_u->rid[i])); - } - } - - if (r_u->ptr_attrs != 0) - { - prs_uint32("num_attrs", ps, depth, &(r_u->num_attrs)); + if(!prs_align(ps)) + return False; + + if(!prs_uint32 ( "len ", ps, depth, &hrs->len)) + return False; - if (r_u->num_attrs != 0) - { - r_u->attr = (uint32*)Realloc(r_u->attr, - sizeof(r_u->attr[0]) * - r_u->num_attrs); - if (r_u->attr == NULL) - { - samr_free_r_query_groupmem(r_u); - return False; - } - } - for (i = 0; i < r_u->num_attrs; i++) - { - prs_uint32("", ps, depth, &(r_u->attr[i])); - } - } + if (hrs->len > 64) { + DEBUG(5,("sam_io_logon_hrs: truncating length\n")); + hrs->len = 64; } - prs_uint32("status", ps, depth, &(r_u->status)); - - if (!ps->io) - { - /* storing. memory no longer needed */ - samr_free_r_query_groupmem(r_u); - } + if(!prs_uint8s (False, "hours", ps, depth, hrs->hours, hrs->len)) + return False; return True; } - /******************************************************************* -frees a structure. + Inits a SAM_USER_INFO_10 structure. ********************************************************************/ -void samr_free_r_query_groupmem(SAMR_R_QUERY_GROUPMEM *r_u) -{ - if (r_u->rid != NULL) - { - free(r_u->rid); - r_u->rid = NULL; - } - if (r_u->attr != NULL) - { - free(r_u->attr); - r_u->attr = NULL; - } -} -/******************************************************************* -makes a SAMR_Q_QUERY_USERGROUPS structure. -********************************************************************/ -BOOL make_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u, - POLICY_HND *hnd) +void init_sam_user_info10(SAM_USER_INFO_10 *usr, + uint32 acb_info) { - if (q_u == NULL || hnd == NULL) return False; - - DEBUG(5,("make_samr_q_query_usergroups\n")); + DEBUG(5,("init_sam_user_info10\n")); - memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); - - return True; + usr->acb_info = acb_info; } - /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS *q_u, prs_struct *ps, int depth) + +BOOL sam_io_user_info10(char *desc, SAM_USER_INFO_10 *usr, prs_struct *ps, int depth) { - if (q_u == NULL) return False; + if (usr == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_q_query_usergroups"); + prs_debug(ps, depth, desc, "samr_io_r_user_info10"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); - prs_align(ps); + if(!prs_uint32("acb_info", ps, depth, &usr->acb_info)) + return False; return True; } /******************************************************************* -makes a SAMR_R_QUERY_USERGROUPS structure. + Inits a SAM_USER_INFO_11 structure. ********************************************************************/ -BOOL make_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u, - uint32 num_gids, DOM_GID *gid, uint32 status) -{ - if (r_u == NULL) return False; - - DEBUG(5,("make_samr_r_query_usergroups\n")); - if (status == 0x0) - { - 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; +void init_sam_user_info11(SAM_USER_INFO_11 *usr, + NTTIME *expiry, + char *mach_acct, + uint32 rid_user, + uint32 rid_group, + uint16 acct_ctrl) + +{ + int len_mach_acct; - r_u->gid = gid; - } - else - { - r_u->ptr_0 = 0; - r_u->num_entries = 0; - r_u->ptr_1 = 0; - } + DEBUG(5,("init_sam_user_info11\n")); - r_u->status = status; + len_mach_acct = strlen(mach_acct); - return True; -} + memcpy(&usr->expiry,expiry, sizeof(usr->expiry)); /* expiry time or something? */ + memset((char *)usr->padding_1, '\0', sizeof(usr->padding_1)); /* 0 - padding 24 bytes */ -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_struct *ps, int depth) -{ - uint32 i; - if (r_u == NULL) return False; + init_uni_hdr(&usr->hdr_mach_acct, len_mach_acct); /* unicode header for machine account */ + usr->padding_2 = 0; /* 0 - padding 4 bytes */ - prs_debug(ps, depth, desc, "samr_io_r_query_usergroups"); - depth++; + usr->ptr_1 = 1; /* pointer */ + memset((char *)usr->padding_3, '\0', sizeof(usr->padding_3)); /* 0 - padding 32 bytes */ + usr->padding_4 = 0; /* 0 - padding 4 bytes */ - prs_align(ps); + usr->ptr_2 = 1; /* pointer */ + usr->padding_5 = 0; /* 0 - padding 4 bytes */ - prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0 )); + usr->ptr_3 = 1; /* pointer */ + memset((char *)usr->padding_6, '\0', sizeof(usr->padding_6)); /* 0 - padding 32 bytes */ - if (r_u->ptr_0 != 0) - { - prs_uint32("num_entries ", ps, depth, &(r_u->num_entries)); - prs_uint32("ptr_1 ", ps, depth, &(r_u->ptr_1 )); + usr->rid_user = rid_user; + usr->rid_group = rid_group; - if (r_u->num_entries != 0) - { - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + usr->acct_ctrl = acct_ctrl; + usr->unknown_3 = 0x0000; - r_u->gid = (DOM_GID*)malloc(r_u->num_entries2 * sizeof(r_u->gid[0])); - if (r_u->gid == NULL) - { - return False; - } + usr->unknown_4 = 0x003f; /* 0x003f - 16 bit unknown */ + usr->unknown_5 = 0x003c; /* 0x003c - 16 bit unknown */ - for (i = 0; i < r_u->num_entries2; i++) - { - smb_io_gid("", &(r_u->gid[i]), ps, depth); - } - } - } - prs_uint32("status", ps, depth, &(r_u->status)); + memset((char *)usr->padding_7, '\0', sizeof(usr->padding_7)); /* 0 - padding 16 bytes */ + usr->padding_8 = 0; /* 0 - padding 4 bytes */ + + init_unistr2(&usr->uni_mach_acct, mach_acct, len_mach_acct); /* unicode string for machine account */ - return True; + memset((char *)usr->padding_9, '\0', sizeof(usr->padding_9)); /* 0 - padding 48 bytes */ } - /******************************************************************* -makes a SAMR_Q_ENUM_DOMAINS structure. + Reads or writes a structure. ********************************************************************/ -BOOL make_samr_q_enum_domains(SAMR_Q_ENUM_DOMAINS *q_e, POLICY_HND *pol, - uint32 start_idx, uint32 size) -{ - if (q_e == NULL || pol == NULL) return False; - - DEBUG(5,("make_samr_q_enum_domains\n")); - memcpy(&(q_e->pol), pol, sizeof(*pol)); +BOOL sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int depth) +{ + if (usr == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_r_unknown_24"); + 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; - q_e->start_idx = start_idx; - q_e->max_size = size; + if(!prs_uint8s(False, "padding_9", ps, depth, usr->padding_9, sizeof(usr->padding_9))) + return False; return True; } +/************************************************************************* + init_sam_user_info21 -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_enum_domains(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++; + unknown_3 = 0x00ff ffff + unknown_5 = 0x0002 0000 + unknown_6 = 0x0000 04ec - prs_align(ps); + *************************************************************************/ - smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); - prs_align(ps); +void init_sam_user_info21(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, - prs_uint32("start_idx", ps, depth, &(q_e->start_idx)); - prs_uint32("max_size ", ps, depth, &(q_e->max_size )); + char *user_name, + char *full_name, + char *home_dir, + char *dir_drive, + char *logon_script, + char *profile_path, + char *description, + char *workstations, + char *unknown_str, + char *munged_dial, - prs_align(ps); - - return True; -} - - -/******************************************************************* -makes a SAMR_R_ENUM_DOMAINS structure. -********************************************************************/ -BOOL make_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS *r_u, - uint32 next_idx, - uint32 num_sam_entries, char **doms, uint32 status) -{ - uint32 i; - - if (r_u == NULL) return False; - - DEBUG(5,("make_samr_r_enum_domains\n")); - - r_u->next_idx = next_idx; - r_u->sam = NULL; - r_u->uni_dom_name = NULL; - - 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->sam = (SAM_ENTRY*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); - r_u->uni_dom_name = (UNISTR2*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_dom_name[0])); - - if (r_u->sam == NULL || r_u->uni_dom_name == NULL) - { - DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOMAINS\n")); - return False; - } - - for (i = 0; i < num_sam_entries; i++) - { - int acct_name_len = doms[i] != NULL ? strlen(doms[i]) : 0; - - make_sam_entry(&(r_u->sam[i]), acct_name_len, 0); - make_unistr2(&(r_u->uni_dom_name[i]), doms[i], acct_name_len); - } - - 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; - } - - r_u->status = status; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_enum_domains(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++; - - prs_align(ps); - - prs_uint32("next_idx ", ps, depth, &(r_u->next_idx )); - prs_uint32("ptr_entries1", ps, depth, &(r_u->ptr_entries1)); - - if (r_u->ptr_entries1 != 0) - { - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); - prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); - prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); - - if (ps->io) - { - r_u->sam = (SAM_ENTRY*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); - r_u->uni_dom_name = (UNISTR2*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_dom_name[0])); - } - - 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 = 0xC0000000|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); - sam_io_sam_entry(tmp, &(r_u->sam[i]), ps, depth); - } - - for (i = 0; i < r_u->num_entries2; i++) - { - fstring tmp; - slprintf(tmp, sizeof(tmp)-1, "dom[%d]", i); - smb_io_unistr2(tmp, &(r_u->uni_dom_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); - prs_align(ps); - } - - prs_align(ps); - - } - - prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -makes a SAMR_Q_ENUM_DOM_GROUPS structure. -********************************************************************/ -BOOL make_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol, - uint32 start_idx, uint32 size) -{ - if (q_e == NULL || pol == NULL) return False; - - DEBUG(5,("make_samr_q_enum_dom_groups\n")); - - memcpy(&(q_e->pol), pol, sizeof(*pol)); - - q_e->start_idx = start_idx; - q_e->max_size = size; - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_enum_dom_groups(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++; - - prs_align(ps); - - smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); - prs_align(ps); - - prs_uint32("start_idx", ps, depth, &(q_e->start_idx)); - prs_uint32("max_size ", ps, depth, &(q_e->max_size )); - - prs_align(ps); - - return True; -} - - -/******************************************************************* -makes a SAMR_R_ENUM_DOM_GROUPS structure. -********************************************************************/ -BOOL make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, - uint32 next_idx, - uint32 num_sam_entries, DOMAIN_GRP *grps, uint32 status) -{ - uint32 i; - - if (r_u == NULL) return False; - - DEBUG(5,("make_samr_r_enum_dom_groups\n")); - - r_u->next_idx = next_idx; - r_u->sam = NULL; - r_u->uni_grp_name = NULL; - - 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->sam = (SAM_ENTRY*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); - r_u->uni_grp_name = (UNISTR2*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_grp_name[0])); - - if (r_u->sam == NULL || r_u->uni_grp_name == NULL) - { - DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_GROUPS\n")); - return False; - } - - for (i = 0; i < num_sam_entries; i++) - { - int acct_name_len = strlen(grps[i].name); - - make_sam_entry(&(r_u->sam[i]), - acct_name_len, - grps[i].rid); - - make_unistr2(&(r_u->uni_grp_name[i]), grps[i].name, acct_name_len); - } - - 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; - } - - r_u->status = status; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_enum_dom_groups(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++; - - prs_align(ps); - - prs_uint32("next_idx ", ps, depth, &(r_u->next_idx )); - prs_uint32("ptr_entries1", ps, depth, &(r_u->ptr_entries1)); - - if (r_u->ptr_entries1 != 0) - { - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); - prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); - prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); - - if (ps->io) - { - r_u->sam = (SAM_ENTRY*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); - r_u->uni_grp_name = (UNISTR2*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_grp_name[0])); - } - - 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 = 0xC0000000|NT_STATUS_MEMORY_NOT_ALLOCATED; - return False; - } - - for (i = 0; i < r_u->num_entries2; i++) - { - sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); - } - - for (i = 0; i < r_u->num_entries2; i++) - { - smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); - prs_align(ps); - } - - prs_align(ps); - - } - - prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -makes a SAMR_Q_ENUM_DOM_ALIASES structure. -********************************************************************/ -BOOL make_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_e, POLICY_HND *pol, - uint32 start_idx, uint32 size) -{ - if (q_e == NULL || pol == NULL) return False; - - DEBUG(5,("make_samr_q_enum_dom_aliases\n")); - - memcpy(&(q_e->pol), pol, sizeof(*pol)); - - q_e->start_idx = start_idx; - q_e->max_size = size; - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_enum_dom_aliases(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++; - - prs_align(ps); - - smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); - prs_align(ps); - - prs_uint32("start_idx", ps, depth, &(q_e->start_idx)); - prs_uint32("max_size ", ps, depth, &(q_e->max_size )); - - prs_align(ps); - - return True; -} - - -/******************************************************************* -makes a SAMR_R_ENUM_DOM_ALIASES structure. -********************************************************************/ -BOOL make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, - uint32 next_idx, - uint32 num_sam_entries, LOCAL_GRP *alss, uint32 status) -{ - uint32 i; - - if (r_u == NULL) return False; - - DEBUG(5,("make_samr_r_enum_dom_aliases\n")); - - r_u->next_idx = next_idx; - r_u->sam = NULL; - r_u->uni_grp_name = NULL; - - 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->sam = (SAM_ENTRY*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); - r_u->uni_grp_name = (UNISTR2*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_grp_name[0])); - - if (r_u->sam == NULL || r_u->uni_grp_name == NULL) - { - DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_ALIASES\n")); - return False; - } - - for (i = 0; i < num_sam_entries; i++) - { - int acct_name_len = strlen(alss[i].name); - - make_sam_entry(&(r_u->sam[i]), - acct_name_len, - alss[i].rid); - - make_unistr2(&(r_u->uni_grp_name[i]), alss[i].name, acct_name_len); - } - - 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; - } - - r_u->status = status; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_enum_dom_aliases(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++; - - prs_align(ps); - - prs_uint32("next_idx ", ps, depth, &(r_u->next_idx )); - prs_uint32("ptr_entries1", ps, depth, &(r_u->ptr_entries1)); - - if (r_u->ptr_entries1 != 0) - { - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); - prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); - prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); - - if (ps->io) - { - r_u->sam = (SAM_ENTRY*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->sam[0])); - r_u->uni_grp_name = (UNISTR2*)Realloc(NULL, r_u->num_entries2 * sizeof(r_u->uni_grp_name[0])); - } - - 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_ALIASES\n")); - r_u->num_entries4 = 0; - r_u->status = 0xC0000000|NT_STATUS_MEMORY_NOT_ALLOCATED; - return False; - } - - for (i = 0; i < r_u->num_entries2; i++) - { - sam_io_sam_entry("", &(r_u->sam[i]), ps, depth); - } - - for (i = 0; i < r_u->num_entries2; i++) - { - smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth); - prs_align(ps); - } - - prs_align(ps); - - } - - prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - - -/******************************************************************* -makes a ALIAS_INFO3 structure. -********************************************************************/ -BOOL make_samr_alias_info3(ALIAS_INFO3 *al3, const char *acct_desc) -{ - int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - if (al3 == NULL) return False; - - DEBUG(5,("make_samr_alias_info3\n")); - - make_uni_hdr(&(al3->hdr_acct_desc), acct_len); - make_unistr2(&(al3->uni_acct_desc), acct_desc, acct_len); - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_alias_info3(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++; - - prs_align(ps); - - smb_io_unihdr ("hdr_acct_desc", &(al3->hdr_acct_desc) , ps, depth); - smb_io_unistr2("uni_acct_desc", &(al3->uni_acct_desc), al3->hdr_acct_desc.buffer, ps, depth); - prs_align(ps); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_alias_info_ctr(char *desc, ALIAS_INFO_CTR *ctr, prs_struct *ps, int depth) -{ - if (ctr == NULL) return False; - - prs_debug(ps, depth, desc, "samr_alias_info_ctr"); - depth++; - - prs_uint16("switch_value1", ps, depth, &(ctr->switch_value1)); - prs_uint16("switch_value2", ps, depth, &(ctr->switch_value2)); - - switch (ctr->switch_value1) - { - case 3: - { - samr_io_alias_info3("alias_info3", &(ctr->alias.info3), ps, depth); - break; - } - default: - { - DEBUG(4,("samr_alias_info_ctr: unsupported switch level\n")); - break; - } - } - - prs_align(ps); - - return True; -} - - -/******************************************************************* -makes a SAMR_Q_QUERY_ALIASINFO structure. -********************************************************************/ -BOOL make_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO *q_e, - POLICY_HND *pol, - uint16 switch_level) -{ - if (q_e == NULL || pol == NULL) return False; - - DEBUG(5,("make_samr_q_query_aliasinfo\n")); - - memcpy(&(q_e->pol), pol, sizeof(*pol)); - - q_e->switch_level = switch_level; - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_query_aliasinfo(char *desc, SAMR_Q_QUERY_ALIASINFO *q_e, prs_struct *ps, int depth) -{ - if (q_e == NULL) return False; - - prs_debug(ps, depth, desc, "samr_io_q_query_aliasinfo"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); - prs_align(ps); - - prs_uint16("switch_level", ps, depth, &(q_e->switch_level)); - - return True; -} - - -/******************************************************************* -makes a SAMR_R_QUERY_ALIASINFO structure. -********************************************************************/ -BOOL make_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *r_u, ALIAS_INFO_CTR *ctr, - uint32 status) -{ - if (r_u == NULL) return False; - - DEBUG(5,("make_samr_r_query_aliasinfo\n")); - - r_u->ptr = (status == 0x0 && ctr != NULL) ? 1 : 0; - r_u->ctr = ctr; - r_u->status = status; - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo"); - depth++; - - prs_align(ps); - - prs_uint32("ptr", ps, depth, &(r_u->ptr)); - - if (r_u->ptr != 0) - { - samr_alias_info_ctr("ctr", r_u->ctr, ps, depth); - } - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - - -/******************************************************************* -makes a SAMR_Q_SET_ALIASINFO structure. -********************************************************************/ -BOOL make_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO *q_u, POLICY_HND *hnd, - ALIAS_INFO_CTR *ctr) -{ - if (q_u == NULL) return False; - - DEBUG(5,("make_samr_q_set_aliasinfo\n")); - - memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol)); - q_u->ctr = ctr; - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_set_aliasinfo(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++; - - prs_align(ps); - - smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); - samr_alias_info_ctr("ctr", q_u->ctr, ps, depth); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_set_aliasinfo(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++; - - prs_align(ps); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - - - -/******************************************************************* -makes a SAMR_Q_QUERY_USERALIASES structure. -********************************************************************/ -BOOL make_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u, - const POLICY_HND *hnd, - uint32 *ptr_sid, DOM_SID2 *sid) -{ - if (q_u == NULL || hnd == NULL) return False; - - DEBUG(5,("make_samr_q_query_useraliases\n")); - - memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); - - q_u->num_sids1 = 1; - q_u->ptr = 1; - q_u->num_sids2 = 1; - - q_u->ptr_sid = ptr_sid; - q_u->sid = sid; - - return True; -} - -/******************************************************************* -reads or writes a SAMR_Q_QUERY_USERALIASES structure. -********************************************************************/ -BOOL samr_io_q_query_useraliases(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++; - - prs_align(ps); - - smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); - prs_align(ps); - - prs_uint32("num_sids1", ps, depth, &(q_u->num_sids1)); - prs_uint32("ptr ", ps, depth, &(q_u->ptr )); - prs_uint32("num_sids2", ps, depth, &(q_u->num_sids2)); - - if (q_u->num_sids2 != 0) - { - q_u->ptr_sid = (uint32*)Realloc(q_u->ptr_sid, - sizeof(q_u->ptr_sid[0]) * q_u->num_sids2); - if (q_u->ptr_sid == NULL) - { - samr_free_q_query_useraliases(q_u); - return False; - } - - q_u->sid = (DOM_SID2*)Realloc(q_u->sid, - sizeof(q_u->sid[0]) * q_u->num_sids2); - if (q_u->sid == NULL) - { - samr_free_q_query_useraliases(q_u); - return False; - } - } - - for (i = 0; i < q_u->num_sids2; i++) - { - slprintf(tmp, sizeof(tmp) - 1, "ptr[%02d]", i); - prs_uint32(tmp, ps, depth, &(q_u->ptr_sid[i])); - } - - for (i = 0; i < q_u->num_sids2; i++) - { - if (q_u->ptr_sid[i] != 0) - { - slprintf(tmp, sizeof(tmp)-1, "sid[%02d]", i); - smb_io_dom_sid2(tmp, &(q_u->sid[i]), ps, depth); - } - } - - prs_align(ps); - - if (!ps->io) - { - /* storing. memory no longer needed */ - samr_free_q_query_useraliases(q_u); - } - return True; -} - -/******************************************************************* -frees memory in a SAMR_Q_QUERY_USERALIASES structure. -********************************************************************/ -void samr_free_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u) -{ - if (q_u->ptr_sid == NULL) - { - free(q_u->ptr_sid); - q_u->ptr_sid = NULL; - } - - if (q_u->sid == NULL) - { - free(q_u->sid); - q_u->sid = NULL; - } -} - -/******************************************************************* -makes a SAMR_R_QUERY_USERALIASES structure. -********************************************************************/ -BOOL make_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u, - uint32 num_rids, uint32 *rid, uint32 status) -{ - if (r_u == NULL) return False; - - DEBUG(5,("make_samr_r_query_useraliases\n")); - - if (status == 0x0) - { - 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; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs_struct *ps, int depth) -{ - fstring tmp; - uint32 i; - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "samr_io_r_query_useraliases"); - depth++; - - prs_align(ps); - - prs_uint32("num_entries", ps, depth, &(r_u->num_entries)); - prs_uint32("ptr ", ps, depth, &(r_u->ptr )); - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); - - if (r_u->num_entries != 0) - { - r_u->rid = (uint32*)Realloc(r_u->rid, - sizeof(r_u->rid[0]) * r_u->num_entries); - if (r_u->rid == NULL) - { - samr_free_r_query_useraliases(r_u); - return False; - } - - for (i = 0; i < r_u->num_entries2; i++) - { - slprintf(tmp, sizeof(tmp)-1, "rid[%02d]", i); - prs_uint32(tmp, ps, depth, &(r_u->rid[i])); - } - } - - prs_uint32("status", ps, depth, &(r_u->status)); - - if (!ps->io) - { - /* storing. memory no longer needed */ - samr_free_r_query_useraliases(r_u); - } - return True; -} - -/******************************************************************* -frees memory in a SAMR_R_QUERY_USERALIASES structure. -********************************************************************/ -void samr_free_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u) -{ - if (r_u->rid == NULL) - { - free(r_u->rid); - r_u->rid = NULL; - } -} - -/******************************************************************* -makes a SAMR_Q_OPEN_ALIAS structure. -********************************************************************/ -BOOL make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, const POLICY_HND *pol, - uint32 unknown_0, uint32 rid) -{ - if (q_u == NULL) return False; - - DEBUG(5,("make_samr_q_open_alias\n")); - - memcpy(&(q_u->dom_pol), pol, sizeof(q_u->dom_pol)); - - /* example values: 0x0000 0008 */ - q_u->unknown_0 = unknown_0; - - q_u->rid_alias = rid; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_open_alias(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++; - - prs_align(ps); - - smb_io_pol_hnd("dom_pol", &(q_u->dom_pol), ps, depth); - - prs_uint32("unknown_0", ps, depth, &(q_u->unknown_0)); - prs_uint32("rid_alias", ps, depth, &(q_u->rid_alias)); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_open_alias(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++; - - prs_align(ps); - - smb_io_pol_hnd("pol", &(r_u->pol), ps, depth); - prs_align(ps); - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -makes a SAMR_Q_LOOKUP_RIDS structure. -********************************************************************/ -BOOL make_samr_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u, - const POLICY_HND *pol, uint32 flags, - uint32 num_rids, uint32 *rid) -{ - if (q_u == NULL) return False; - - DEBUG(5,("make_samr_r_unknwon_12\n")); - - memcpy(&(q_u->pol), pol, sizeof(*pol)); - - q_u->num_rids1 = num_rids; - q_u->flags = flags; - q_u->ptr = 0; - q_u->num_rids2 = num_rids; - q_u->rid = rid; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_lookup_rids(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++; - - prs_align(ps); - - smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); - prs_align(ps); - - prs_uint32("num_rids1", ps, depth, &(q_u->num_rids1)); - prs_uint32("flags ", ps, depth, &(q_u->flags )); - prs_uint32("ptr ", ps, depth, &(q_u->ptr )); - prs_uint32("num_rids2", ps, depth, &(q_u->num_rids2)); - - if (q_u->num_rids2 != 0) - { - q_u->rid = (uint32*)Realloc(q_u->rid, sizeof(q_u->rid[0]) * - q_u->num_rids2); - if (q_u->rid == NULL) - { - samr_free_q_lookup_rids(q_u); - return False; - } - } - - for (i = 0; i < q_u->num_rids2; i++) - { - slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i); - prs_uint32(tmp, ps, depth, &(q_u->rid[i])); - } - - prs_align(ps); - - if (!ps->io) - { - /* storing. don't need memory any more */ - samr_free_q_lookup_rids(q_u); - } - - return True; -} - -/******************************************************************* -frees a structure. -********************************************************************/ -void samr_free_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u) -{ - if (q_u->rid != NULL) - { - free(q_u->rid); - q_u->rid = NULL; - } -} - - -/******************************************************************* -makes a SAMR_R_LOOKUP_RIDS structure. -********************************************************************/ -BOOL make_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u, - uint32 num_names, fstring *name, uint8 *type, - uint32 status) -{ - uint32 i; - if (r_u == NULL || name == NULL || type == NULL) return False; - - DEBUG(5,("make_samr_r_lookup_rids\n")); - - if (status == 0x0) - { - 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; - - if (num_names != 0) - { - r_u->hdr_name = (UNIHDR*)malloc(num_names * sizeof(r_u->hdr_name[0])); - if (r_u->hdr_name == NULL) - { - samr_free_r_lookup_rids(r_u); - return False; - } - r_u->uni_name = (UNISTR2*)malloc(num_names * sizeof(r_u->uni_name[0])); - if (r_u->uni_name == NULL) - { - samr_free_r_lookup_rids(r_u); - return False; - } - r_u->type = (uint32*)malloc(r_u->num_types2 * sizeof(r_u->type[0])); - if (r_u->type == NULL) - { - samr_free_r_lookup_rids(r_u); - return False; - } - } - - for (i = 0; i < num_names; i++) - { - int len = name[i] != NULL ? strlen(name[i]) : 0; - DEBUG(10,("name[%d]:%s\ttype:%d\n", - i, name[i], type[i])); - make_uni_hdr(&(r_u->hdr_name[i]), len); - make_unistr2(&(r_u->uni_name[i]), name[i], len); - r_u->type[i] = type[i]; - } - } - 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; - } - - r_u->status = status; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_lookup_rids(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++; - - prs_align(ps); - - prs_uint32("num_names1", ps, depth, &(r_u->num_names1)); - prs_uint32("ptr_names ", ps, depth, &(r_u->ptr_names )); - prs_uint32("num_names2", ps, depth, &(r_u->num_names2)); - - if (r_u->ptr_names != 0 && r_u->num_names1 != 0) - { - r_u->hdr_name = (UNIHDR*)Realloc(r_u->hdr_name, - r_u->num_names2 * sizeof(r_u->hdr_name[0])); - if (r_u->hdr_name == NULL) - { - return False; - } - - r_u->uni_name = (UNISTR2*)Realloc(r_u->uni_name, - r_u->num_names2 * sizeof(r_u->uni_name[0])); - if (r_u->uni_name == NULL) - { - free(r_u->hdr_name); - return False; - } - for (i = 0; i < r_u->num_names2; i++) - { - slprintf(tmp, sizeof(tmp) - 1, "hdr[%02d] ", i); - smb_io_unihdr ("", &(r_u->hdr_name[i]), ps, depth); - } - for (i = 0; i < r_u->num_names2; i++) - { - slprintf(tmp, sizeof(tmp) - 1, "str[%02d] ", i); - smb_io_unistr2("", &(r_u->uni_name[i]), r_u->hdr_name[i].buffer, ps, depth); - prs_align(ps); - } - } - - prs_align(ps); - - prs_uint32("num_types1", ps, depth, &(r_u->num_types1)); - prs_uint32("ptr_types ", ps, depth, &(r_u->ptr_types )); - prs_uint32("num_types2", ps, depth, &(r_u->num_types2)); - - if (r_u->ptr_types != 0 && r_u->num_types1 != 0) - { - r_u->type = (uint32*)Realloc(r_u->type, r_u->num_types2 * - sizeof(r_u->type[0])); - if (r_u->type == NULL) - { - if (r_u->uni_name != NULL) - { - free(r_u->uni_name); - } - if (r_u->hdr_name != NULL) - { - free(r_u->hdr_name); - } - return False; - } - - for (i = 0; i < r_u->num_types2; i++) - { - slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i); - prs_uint32(tmp, ps, depth, &(r_u->type[i])); - } - } - - prs_uint32("status", ps, depth, &(r_u->status)); - - if (!ps->io) - { - /* storing. don't need memory any more */ - samr_free_r_lookup_rids(r_u); - } - - return True; -} - -/******************************************************************* -frees a structure. -********************************************************************/ -void samr_free_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u) -{ - if (r_u->uni_name != NULL) - { - free(r_u->uni_name); - r_u->uni_name = NULL; - } - if (r_u->hdr_name != NULL) - { - free(r_u->hdr_name); - r_u->hdr_name = NULL; - } - if (r_u->type != NULL) - { - free(r_u->type); - r_u->type = NULL; - } -} - -/******************************************************************* -makes a SAMR_Q_OPEN_ALIAS structure. -********************************************************************/ -BOOL make_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS *q_u, POLICY_HND *hnd) -{ - if (q_u == NULL) return False; - - DEBUG(5,("make_samr_q_delete_alias\n")); - - memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol)); - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_delete_alias(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++; - - prs_align(ps); - - smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_delete_alias(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++; - - prs_align(ps); - - smb_io_pol_hnd("pol", &(r_u->pol), ps, depth); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - - -/******************************************************************* -makes a SAMR_Q_CREATE_DOM_ALIAS structure. -********************************************************************/ -BOOL make_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS *q_u, POLICY_HND *hnd, - const char *acct_desc) -{ - int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - if (q_u == NULL) return False; - - DEBUG(5,("make_samr_q_create_dom_alias\n")); - - memcpy(&(q_u->dom_pol), hnd, sizeof(q_u->dom_pol)); - - make_uni_hdr(&(q_u->hdr_acct_desc), acct_len); - make_unistr2(&(q_u->uni_acct_desc), acct_desc, acct_len); - - q_u->unknown_1 = 0x001f; - q_u->unknown_2 = 0x000f; - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_create_dom_alias(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++; - - prs_align(ps); - - smb_io_pol_hnd("dom_pol", &(q_u->dom_pol), ps, depth); - - smb_io_unihdr ("hdr_acct_desc", &(q_u->hdr_acct_desc) , ps, depth); - smb_io_unistr2("uni_acct_desc", &(q_u->uni_acct_desc), q_u->hdr_acct_desc.buffer, ps, depth); - prs_align(ps); - - prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1)); - prs_uint16("unknown_2", ps, depth, &(q_u->unknown_2)); - - return True; -} - -/******************************************************************* -makes a SAMR_R_CREATE_DOM_ALIAS structure. -********************************************************************/ -BOOL make_samr_r_create_dom_alias(SAMR_R_CREATE_DOM_ALIAS *r_u, POLICY_HND *pol, - uint32 rid, uint32 status) -{ - if (r_u == NULL) return False; - - DEBUG(5,("make_samr_r_create_dom_alias\n")); - - memcpy(&(r_u->alias_pol), pol, sizeof(*pol)); - r_u->rid = rid ; - r_u->status = status; - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_create_dom_alias(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++; - - prs_align(ps); - - smb_io_pol_hnd("alias_pol", &(r_u->alias_pol), ps, depth); - prs_uint32("rid", ps, depth, &(r_u->rid)); - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - - - -/******************************************************************* -makes a SAMR_Q_ADD_ALIASMEM structure. -********************************************************************/ -BOOL make_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, POLICY_HND *hnd, - DOM_SID *sid) -{ - if (q_u == NULL) return False; - - DEBUG(5,("make_samr_q_add_aliasmem\n")); - - memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol)); - make_dom_sid2(&q_u->sid, sid); - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_add_aliasmem(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++; - - prs_align(ps); - - smb_io_pol_hnd ("alias_pol", &(q_u->alias_pol), ps, depth); - smb_io_dom_sid2("sid ", &(q_u->sid ), ps, depth); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_add_aliasmem(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++; - - prs_align(ps); - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - - -/******************************************************************* -makes a SAMR_Q_DEL_ALIASMEM structure. -********************************************************************/ -BOOL make_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM *q_u, POLICY_HND *hnd, - DOM_SID *sid) -{ - if (q_u == NULL) return False; - - DEBUG(5,("make_samr_q_del_aliasmem\n")); - - memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol)); - make_dom_sid2(&q_u->sid, sid); - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_del_aliasmem(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++; - - prs_align(ps); - - smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); - smb_io_dom_sid2("sid ", &(q_u->sid ), ps, depth); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_del_aliasmem(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++; - - prs_align(ps); - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -makes a SAMR_Q_DELETE_DOM_ALIAS structure. -********************************************************************/ -BOOL make_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS *q_c, POLICY_HND *hnd) -{ - if (q_c == NULL || hnd == NULL) return False; - - DEBUG(5,("make_samr_q_delete_dom_alias\n")); - - memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol)); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_delete_dom_alias(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++; - - prs_align(ps); - - smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); - - return True; -} - -/******************************************************************* -makes a SAMR_R_DELETE_DOM_ALIAS structure. -********************************************************************/ -BOOL make_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS *r_u, - uint32 status) -{ - if (r_u == NULL) return False; - - DEBUG(5,("make_samr_r_delete_dom_alias\n")); - - r_u->status = status; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_delete_dom_alias(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++; - - prs_align(ps); - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - - -/******************************************************************* -makes a SAMR_Q_QUERY_ALIASMEM structure. -********************************************************************/ -BOOL make_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_c, - const POLICY_HND *hnd) -{ - if (q_c == NULL || hnd == NULL) return False; - - DEBUG(5,("make_samr_q_query_aliasmem\n")); - - memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol)); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_query_aliasmem(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++; - - prs_align(ps); - - smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth); - - return True; -} - -/******************************************************************* -makes a SAMR_R_QUERY_ALIASMEM structure. -********************************************************************/ -BOOL make_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM *r_u, - uint32 num_sids, DOM_SID2 *sid, uint32 status) -{ - if (r_u == NULL) return False; - - DEBUG(5,("make_samr_r_query_aliasmem\n")); - - if (status == 0x0) - { - 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; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM *r_u, prs_struct *ps, int depth) -{ - uint32 i; - uint32 ptr_sid[MAX_LOOKUP_SIDS]; - - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "samr_io_r_query_aliasmem"); - depth++; - - prs_align(ps); - - prs_uint32("num_sids ", ps, depth, &(r_u->num_sids)); - prs_uint32("ptr", ps, depth, &(r_u->ptr)); - - if (r_u->ptr != 0) - { - SMB_ASSERT_ARRAY(ptr_sid, r_u->num_sids); - - if (r_u->num_sids != 0) - { - prs_uint32("num_sids1", ps, depth, &(r_u->num_sids1)); - - for (i = 0; i < r_u->num_sids1; i++) - { - ptr_sid[i] = 1; - prs_uint32("", ps, depth, &(ptr_sid[i])); - } - for (i = 0; i < r_u->num_sids1; i++) - { - if (ptr_sid[i] != 0) - { - smb_io_dom_sid2("", &(r_u->sid[i]), ps, depth); - } - } - } - } - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -makes a SAMR_Q_LOOKUP_NAMES structure. -********************************************************************/ -BOOL make_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES *q_u, - POLICY_HND *pol, uint32 flags, - uint32 num_names, char **name) -{ - uint32 i; - if (q_u == NULL) return False; - - DEBUG(5,("make_samr_q_lookup_names\n")); - - memcpy(&(q_u->pol), pol, sizeof(*pol)); - - q_u->num_names1 = num_names; - q_u->flags = flags; - q_u->ptr = 0; - q_u->num_names2 = num_names; - - for (i = 0; i < num_names; i++) - { - int len_name = name[i] != NULL ? strlen(name[i]) : 0; - make_uni_hdr(&(q_u->hdr_name[i]), len_name); /* unicode header for user_name */ - make_unistr2(&(q_u->uni_name[i]), name[i], len_name); /* unicode string for machine account */ - } - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_lookup_names(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++; - - prs_align(ps); - - smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); - prs_align(ps); - - prs_uint32("num_names1", ps, depth, &(q_u->num_names1)); - prs_uint32("flags ", ps, depth, &(q_u->flags )); - prs_uint32("ptr ", ps, depth, &(q_u->ptr )); - prs_uint32("num_names2", ps, depth, &(q_u->num_names2)); - - SMB_ASSERT_ARRAY(q_u->hdr_name, q_u->num_names2); - - for (i = 0; i < q_u->num_names2; i++) - { - smb_io_unihdr ("", &(q_u->hdr_name[i]), ps, depth); - } - for (i = 0; i < q_u->num_names2; i++) - { - smb_io_unistr2("", &(q_u->uni_name[i]), q_u->hdr_name[i].buffer, ps, depth); - prs_align(ps); - } - - prs_align(ps); - - return True; -} - - -/******************************************************************* -makes a SAMR_R_LOOKUP_NAMES structure. -********************************************************************/ -BOOL make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, - uint32 num_rids, uint32 *rid, uint8 *type, uint32 status) -{ - uint32 i; - if (r_u == NULL) return False; - - DEBUG(5,("make_samr_r_lookup_names\n")); - - if (status == 0x0) - { - 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; - - SMB_ASSERT_ARRAY(r_u->rid, num_rids); - - for (i = 0; i < num_rids; i++) - { - r_u->rid [i] = rid [i]; - r_u->type[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->status = status; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_lookup_names(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++; - - prs_align(ps); - - prs_uint32("num_rids1", ps, depth, &(r_u->num_rids1)); - prs_uint32("ptr_rids ", ps, depth, &(r_u->ptr_rids )); - - if (r_u->ptr_rids != 0) - { - prs_uint32("num_rids2", ps, depth, &(r_u->num_rids2)); - - if (r_u->num_rids2 != r_u->num_rids1) - { - /* RPC fault */ - return False; - } - - for (i = 0; i < r_u->num_rids2; i++) - { - slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i); - prs_uint32(tmp, ps, depth, &(r_u->rid[i])); - } - } - - prs_uint32("num_types1", ps, depth, &(r_u->num_types1)); - prs_uint32("ptr_types ", ps, depth, &(r_u->ptr_types )); - - if (r_u->ptr_types != 0) - { - prs_uint32("num_types2", ps, depth, &(r_u->num_types2)); - - if (r_u->num_types2 != r_u->num_types1) - { - /* RPC fault */ - return False; - } - - for (i = 0; i < r_u->num_types2; i++) - { - slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i); - prs_uint32(tmp, ps, depth, &(r_u->type[i])); - } - } - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL make_samr_q_open_user(SAMR_Q_OPEN_USER *q_u, - const POLICY_HND *pol, - uint32 unk_0, uint32 rid) -{ - if (q_u == NULL) return False; - - DEBUG(5,("samr_make_samr_q_open_user\n")); - - memcpy(&q_u->domain_pol, pol, sizeof(q_u->domain_pol)); - - q_u->unknown_0 = unk_0; - q_u->user_rid = rid; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_open_user(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++; - - prs_align(ps); - - smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth); - prs_align(ps); - - prs_uint32("unknown_0", ps, depth, &(q_u->unknown_0)); - prs_uint32("user_rid ", ps, depth, &(q_u->user_rid )); - - prs_align(ps); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_open_user(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++; - - prs_align(ps); - - smb_io_pol_hnd("user_pol", &(r_u->user_pol), ps, depth); - prs_align(ps); - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL make_samr_q_create_user(SAMR_Q_CREATE_USER *q_u, - POLICY_HND *pol, - const char *name, - uint16 acb_info, uint32 unk_1) -{ - int len_name; - if (q_u == NULL) return False; - len_name = strlen(name); - - DEBUG(5,("samr_make_samr_q_create_user\n")); - - memcpy(&q_u->domain_pol, pol, sizeof(q_u->domain_pol)); - - make_uni_hdr(&(q_u->hdr_name), len_name); - make_unistr2(&(q_u->uni_name), name, len_name); - - q_u->acb_info = acb_info; - q_u->unknown_1 = unk_1; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_create_user(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++; - - prs_align(ps); - - smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth); - prs_align(ps); - - smb_io_unihdr ("unihdr", &(q_u->hdr_name), ps, depth); - smb_io_unistr2("unistr2", &(q_u->uni_name), q_u->hdr_name.buffer, ps, depth); - prs_align(ps); - - prs_uint16("acb_info", ps, depth, &(q_u->acb_info)); - prs_align(ps); - prs_uint32("unknown_1", ps, depth, &(q_u->unknown_1)); - - prs_align(ps); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL make_samr_r_create_user(SAMR_R_CREATE_USER *r_u, - POLICY_HND *user_pol, - uint32 unk_0, uint32 user_rid, - uint32 status) -{ - if (r_u == NULL) return False; - - DEBUG(5,("samr_make_samr_r_create_user\n")); - - memcpy(&r_u->user_pol, user_pol, sizeof(r_u->user_pol)); - - r_u->unknown_0 = unk_0; - r_u->user_rid = user_rid; - r_u->status = status; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_create_user(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++; - - prs_align(ps); - - smb_io_pol_hnd("user_pol", &(r_u->user_pol), ps, depth); - prs_align(ps); - - prs_uint32("unknown_0", ps, depth, &(r_u->unknown_0)); - prs_uint32("user_rid ", ps, depth, &(r_u->user_rid )); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -makes a SAMR_Q_QUERY_USERINFO structure. -********************************************************************/ -BOOL make_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO *q_u, - POLICY_HND *hnd, uint16 switch_value) -{ - if (q_u == NULL || hnd == NULL) return False; - - DEBUG(5,("make_samr_q_query_userinfo\n")); - - memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); - q_u->switch_value = switch_value; - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_query_userinfo(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++; - - prs_align(ps); - - smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); - prs_align(ps); - - prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); /* 0x0015 or 0x0011 */ - - prs_align(ps); - - return True; -} - -/******************************************************************* -reads or writes a LOGON_HRS structure. -********************************************************************/ -static BOOL sam_io_logon_hrs(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++; - - prs_align(ps); - - prs_uint32 ( "len ", ps, depth, &(hrs->len )); - - if (hrs->len > 64) - { - DEBUG(5,("sam_io_logon_hrs: truncating length\n")); - hrs->len = 64; - } - - prs_uint8s (False, "hours", ps, depth, hrs->hours, hrs->len); - - return True; -} - -/******************************************************************* -makes a SAM_USER_INFO_10 structure. -********************************************************************/ -BOOL make_sam_user_info10(SAM_USER_INFO_10 *usr, - uint32 acb_info) -{ - if (usr == NULL) return False; - - DEBUG(5,("make_sam_user_info10\n")); - - usr->acb_info = acb_info; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL sam_io_user_info10(char *desc, SAM_USER_INFO_10 *usr, prs_struct *ps, int depth) -{ - if (usr == NULL) return False; - - prs_debug(ps, depth, desc, "samr_io_r_user_info10"); - depth++; - - prs_align(ps); - - prs_uint32("acb_info", ps, depth, &(usr->acb_info)); - - return True; -} - -/******************************************************************* -makes a SAM_USER_INFO_11 structure. -********************************************************************/ -BOOL make_sam_user_info11(SAM_USER_INFO_11 *usr, - NTTIME *expiry, - char *mach_acct, - uint32 rid_user, - uint32 rid_group, - uint16 acct_ctrl) - -{ - int len_mach_acct; - if (usr == NULL || expiry == NULL || mach_acct == NULL) return False; - - DEBUG(5,("make_sam_user_info11\n")); - - len_mach_acct = strlen(mach_acct); - - memcpy(&(usr->expiry),expiry, sizeof(usr->expiry)); /* expiry time or something? */ - bzero(usr->padding_1, sizeof(usr->padding_1)); /* 0 - padding 24 bytes */ - - make_uni_hdr(&(usr->hdr_mach_acct), len_mach_acct); /* unicode header for machine account */ - usr->padding_2 = 0; /* 0 - padding 4 bytes */ - - usr->ptr_1 = 1; /* pointer */ - bzero(usr->padding_3, sizeof(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 */ - bzero(usr->padding_6, sizeof(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 */ - - bzero(usr->padding_7, sizeof(usr->padding_7)); /* 0 - padding 16 bytes */ - usr->padding_8 = 0; /* 0 - padding 4 bytes */ - - make_unistr2(&(usr->uni_mach_acct), mach_acct, len_mach_acct); /* unicode string for machine account */ - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int depth) -{ - if (usr == NULL) return False; - - prs_debug(ps, depth, desc, "samr_io_r_unknown_11"); - depth++; - - prs_align(ps); - - prs_uint8s (False, "padding_0", ps, depth, usr->padding_0, sizeof(usr->padding_0)); - - smb_io_time("time", &(usr->expiry), ps, depth); - - prs_uint8s (False, "padding_1", ps, depth, usr->padding_1, sizeof(usr->padding_1)); - - smb_io_unihdr ("unihdr", &(usr->hdr_mach_acct), ps, depth); - prs_uint32( "padding_2", ps, depth, &(usr->padding_2)); - - prs_uint32( "ptr_1 ", ps, depth, &(usr->ptr_1 )); - prs_uint8s (False, "padding_3", ps, depth, usr->padding_3, sizeof(usr->padding_3)); - prs_uint32( "padding_4", ps, depth, &(usr->padding_4)); - - prs_uint32( "ptr_2 ", ps, depth, &(usr->ptr_2 )); - prs_uint32( "padding_5", ps, depth, &(usr->padding_5)); - - prs_uint32( "ptr_3 ", ps, depth, &(usr->ptr_3 )); - prs_uint8s (False, "padding_6", ps, depth, usr->padding_6, sizeof(usr->padding_6)); - - prs_uint32( "rid_user ", ps, depth, &(usr->rid_user )); - prs_uint32( "rid_group", ps, depth, &(usr->rid_group)); - prs_uint16( "acct_ctrl", ps, depth, &(usr->acct_ctrl)); - prs_uint16( "unknown_3", ps, depth, &(usr->unknown_3)); - prs_uint16( "unknown_4", ps, depth, &(usr->unknown_4)); - prs_uint16( "unknown_5", ps, depth, &(usr->unknown_5)); - - prs_uint8s (False, "padding_7", ps, depth, usr->padding_7, sizeof(usr->padding_7)); - prs_uint32( "padding_8", ps, depth, &(usr->padding_8)); - - smb_io_unistr2("unistr2", &(usr->uni_mach_acct), True, ps, depth); - prs_align(ps); - - prs_uint8s (False, "padding_9", ps, depth, usr->padding_9, sizeof(usr->padding_9)); - - return True; -} - -/************************************************************************* - make_sam_user_infoa - - unknown_3 = 0x09f8 27fa - unknown_5 = 0x0001 0000 - unknown_6 = 0x0000 04ec - - *************************************************************************/ -BOOL make_sam_user_info24(SAM_USER_INFO_24 *usr, - char newpass[516], uint16 passlen) -{ - memcpy(usr->pass, newpass, sizeof(usr->pass)); - usr->unk_0 = passlen; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL sam_io_user_info24(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++; - - prs_align(ps); - - prs_uint8s (False, "password", ps, depth, usr->pass, sizeof(usr->pass)); - prs_uint16("unk_0", ps, depth, &(usr->unk_0)); /* unknown */ - prs_align(ps); - - return True; -} - - -/************************************************************************* - make_sam_user_info23 - - unknown_3 = 0x09f8 27fa - unknown_5 = 0x0001 0000 - unknown_6 = 0x0000 04ec - - *************************************************************************/ -BOOL make_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, /* NULL */ - 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, - uint16 acb_info, - - uint32 unknown_3, - uint16 logon_divs, - LOGON_HRS *hrs, - uint32 unknown_5, - char newpass[516], - uint32 unknown_6) -{ - int len_user_name = user_name != NULL ? user_name->uni_str_len : 0; - int len_full_name = full_name != NULL ? full_name->uni_str_len : 0; - int len_home_dir = home_dir != NULL ? home_dir ->uni_str_len : 0; - int len_dir_drive = dir_drive != NULL ? dir_drive->uni_str_len : 0; - int len_logon_script = log_scr != NULL ? log_scr ->uni_str_len : 0; - int len_profile_path = prof_path != NULL ? prof_path->uni_str_len : 0; - int len_description = desc != NULL ? desc ->uni_str_len : 0; - int len_workstations = wkstas != NULL ? wkstas ->uni_str_len : 0; - int len_unknown_str = unk_str != NULL ? unk_str ->uni_str_len : 0; - int len_munged_dial = mung_dial != NULL ? mung_dial->uni_str_len : 0; - - 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 */ - - make_uni_hdr(&(usr->hdr_user_name ), len_user_name ); /* NULL */ - make_uni_hdr(&(usr->hdr_full_name ), len_full_name ); - make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir ); - make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive ); - make_uni_hdr(&(usr->hdr_logon_script), len_logon_script); - make_uni_hdr(&(usr->hdr_profile_path), len_profile_path); - make_uni_hdr(&(usr->hdr_acct_desc ), len_description ); - make_uni_hdr(&(usr->hdr_workstations), len_workstations); - make_uni_hdr(&(usr->hdr_unknown_str ), len_unknown_str ); - make_uni_hdr(&(usr->hdr_munged_dial ), len_munged_dial ); - - bzero(usr->nt_pwd, sizeof(usr->nt_pwd)); - bzero(usr->lm_pwd, sizeof(usr->lm_pwd)); - - usr->user_rid = user_rid; /* 0x0000 0000 */ - usr->group_rid = group_rid; - usr->acb_info = acb_info; - usr->unknown_3 = unknown_3; /* 09f8 27fa */ - - usr->logon_divs = logon_divs; /* should be 168 (hours/week) */ - usr->ptr_logon_hrs = hrs ? 1 : 0; - - bzero(usr->padding1, sizeof(usr->padding1)); - - usr->unknown_5 = unknown_5; /* 0x0001 0000 */ - - memcpy(usr->pass, newpass, sizeof(usr->pass)); - - copy_unistr2(&(usr->uni_user_name ), user_name); - copy_unistr2(&(usr->uni_full_name ), full_name); - copy_unistr2(&(usr->uni_home_dir ), home_dir ); - copy_unistr2(&(usr->uni_dir_drive ), dir_drive); - copy_unistr2(&(usr->uni_logon_script), log_scr ); - copy_unistr2(&(usr->uni_profile_path), prof_path); - copy_unistr2(&(usr->uni_acct_desc ), desc ); - copy_unistr2(&(usr->uni_workstations), wkstas ); - copy_unistr2(&(usr->uni_unknown_str ), unk_str ); - copy_unistr2(&(usr->uni_munged_dial ), mung_dial); - - usr->unknown_6 = unknown_6; /* 0x0000 04ec */ - usr->padding4 = 0; - - if (hrs) - { - memcpy(&(usr->logon_hrs), hrs, sizeof(usr->logon_hrs)); - } - else - { - memset(&(usr->logon_hrs), 0xff, sizeof(usr->logon_hrs)); - } - - return True; -} - -/************************************************************************* - make_sam_user_info23 - - unknown_3 = 0x09f8 27fa - unknown_5 = 0x0001 0000 - unknown_6 = 0x0000 04ec - - *************************************************************************/ -BOOL make_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, - char *desc, - char *wkstas, - char *unk_str, - char *mung_dial, - - uint32 user_rid, /* 0x0000 0000 */ - uint32 group_rid, - uint16 acb_info, - - uint32 unknown_3, - uint16 logon_divs, - LOGON_HRS *hrs, - uint32 unknown_5, - char newpass[516], - uint32 unknown_6) -{ - int len_user_name = user_name != NULL ? strlen(user_name) : 0; - int len_full_name = full_name != NULL ? strlen(full_name) : 0; - int len_home_dir = home_dir != NULL ? strlen(home_dir ) : 0; - int len_dir_drive = dir_drive != NULL ? strlen(dir_drive) : 0; - int len_logon_script = log_scr != NULL ? strlen(log_scr ) : 0; - int len_profile_path = prof_path != NULL ? strlen(prof_path) : 0; - int len_description = desc != NULL ? strlen(desc ) : 0; - int len_workstations = wkstas != NULL ? strlen(wkstas ) : 0; - int len_unknown_str = unk_str != NULL ? strlen(unk_str ) : 0; - int len_munged_dial = mung_dial != NULL ? strlen(mung_dial) : 0; - - 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 */ - - make_uni_hdr(&(usr->hdr_user_name ), len_user_name ); /* NULL */ - make_uni_hdr(&(usr->hdr_full_name ), len_full_name ); - make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir ); - make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive ); - make_uni_hdr(&(usr->hdr_logon_script), len_logon_script); - make_uni_hdr(&(usr->hdr_profile_path), len_profile_path); - make_uni_hdr(&(usr->hdr_acct_desc ), len_description ); - make_uni_hdr(&(usr->hdr_workstations), len_workstations); - make_uni_hdr(&(usr->hdr_unknown_str ), len_unknown_str ); - make_uni_hdr(&(usr->hdr_munged_dial ), len_munged_dial ); - - bzero(usr->nt_pwd, sizeof(usr->nt_pwd)); - bzero(usr->lm_pwd, sizeof(usr->lm_pwd)); - - usr->user_rid = user_rid; /* 0x0000 0000 */ - usr->group_rid = group_rid; - usr->acb_info = acb_info; - usr->unknown_3 = unknown_3; /* 09f8 27fa */ - - usr->logon_divs = logon_divs; /* should be 168 (hours/week) */ - usr->ptr_logon_hrs = hrs ? 1 : 0; - - bzero(usr->padding1, sizeof(usr->padding1)); - - usr->unknown_5 = unknown_5; /* 0x0001 0000 */ - - memcpy(usr->pass, newpass, sizeof(usr->pass)); - - make_unistr2(&(usr->uni_user_name ), user_name , len_user_name ); /* NULL */ - make_unistr2(&(usr->uni_full_name ), full_name , len_full_name ); - make_unistr2(&(usr->uni_home_dir ), home_dir , len_home_dir ); - make_unistr2(&(usr->uni_dir_drive ), dir_drive , len_dir_drive ); - make_unistr2(&(usr->uni_logon_script), log_scr, len_logon_script); - make_unistr2(&(usr->uni_profile_path), prof_path, len_profile_path); - make_unistr2(&(usr->uni_acct_desc ), desc , len_description ); - make_unistr2(&(usr->uni_workstations), wkstas, len_workstations); - make_unistr2(&(usr->uni_unknown_str ), unk_str , len_unknown_str ); - make_unistr2(&(usr->uni_munged_dial ), mung_dial , len_munged_dial ); - - usr->unknown_6 = unknown_6; /* 0x0000 04ec */ - usr->padding4 = 0; - - if (hrs) - { - memcpy(&(usr->logon_hrs), hrs, sizeof(usr->logon_hrs)); - } - else - { - memset(&(usr->logon_hrs), 0xff, sizeof(usr->logon_hrs)); - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL sam_io_user_info16(char *desc, SAM_USER_INFO_16 *usr, prs_struct *ps, int depth) -{ - if (usr == NULL) return False; - - prs_debug(ps, depth, desc, "sam_io_user_info16"); - depth++; - - prs_align(ps); - - prs_uint16("acb_info", ps, depth, &(usr->acb_info)); - prs_align(ps); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL sam_io_user_info23(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++; - - prs_align(ps); - - smb_io_time("logon_time ", &(usr->logon_time) , ps, depth); - smb_io_time("logoff_time ", &(usr->logoff_time) , ps, depth); - smb_io_time("kickoff_time ", &(usr->kickoff_time) , ps, depth); - smb_io_time("pass_last_set_time ", &(usr->pass_last_set_time) , ps, depth); - smb_io_time("pass_can_change_time ", &(usr->pass_can_change_time) , ps, depth); - smb_io_time("pass_must_change_time", &(usr->pass_must_change_time), ps, depth); - - smb_io_unihdr("hdr_user_name ", &(usr->hdr_user_name) , ps, depth); /* username unicode string header */ - smb_io_unihdr("hdr_full_name ", &(usr->hdr_full_name) , ps, depth); /* user's full name unicode string header */ - smb_io_unihdr("hdr_home_dir ", &(usr->hdr_home_dir) , ps, depth); /* home directory unicode string header */ - smb_io_unihdr("hdr_dir_drive ", &(usr->hdr_dir_drive) , ps, depth); /* home directory drive */ - smb_io_unihdr("hdr_logon_script", &(usr->hdr_logon_script), ps, depth); /* logon script unicode string header */ - smb_io_unihdr("hdr_profile_path", &(usr->hdr_profile_path), ps, depth); /* profile path unicode string header */ - smb_io_unihdr("hdr_acct_desc ", &(usr->hdr_acct_desc ) , ps, depth); /* account desc */ - smb_io_unihdr("hdr_workstations", &(usr->hdr_workstations), ps, depth); /* wkstas user can log on from */ - smb_io_unihdr("hdr_unknown_str ", &(usr->hdr_unknown_str ), ps, depth); /* unknown string */ - smb_io_unihdr("hdr_munged_dial ", &(usr->hdr_munged_dial ), ps, depth); /* wkstas user can log on from */ - - prs_uint8s (False, "lm_pwd ", ps, depth, usr->lm_pwd , sizeof(usr->lm_pwd )); - prs_uint8s (False, "nt_pwd ", ps, depth, usr->nt_pwd , sizeof(usr->nt_pwd )); - - prs_uint32("user_rid ", ps, depth, &(usr->user_rid )); /* User ID */ - prs_uint32("group_rid ", ps, depth, &(usr->group_rid )); /* Group ID */ - prs_uint16("acb_info ", ps, depth, &(usr->acb_info )); /* Group ID */ - prs_align(ps); - - prs_uint32("unknown_3 ", ps, depth, &(usr->unknown_3 )); - prs_uint16("logon_divs ", ps, depth, &(usr->logon_divs )); /* logon divisions per week */ - prs_align(ps); - prs_uint32("ptr_logon_hrs ", ps, depth, &(usr->ptr_logon_hrs)); - prs_uint8s (False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1)); - prs_uint32("unknown_5 ", ps, depth, &(usr->unknown_5 )); - - prs_uint8s (False, "password ", ps, depth, usr->pass, sizeof(usr->pass)); - - /* here begins pointed-to data */ - - smb_io_unistr2("uni_user_name ", &(usr->uni_user_name) , usr->hdr_user_name .buffer, ps, depth); /* username unicode string */ - prs_align(ps); - smb_io_unistr2("uni_full_name ", &(usr->uni_full_name) , usr->hdr_full_name .buffer, ps, depth); /* user's full name unicode string */ - prs_align(ps); - smb_io_unistr2("uni_home_dir ", &(usr->uni_home_dir) , usr->hdr_home_dir .buffer, ps, depth); /* home directory unicode string */ - prs_align(ps); - smb_io_unistr2("uni_dir_drive ", &(usr->uni_dir_drive) , usr->hdr_dir_drive .buffer, ps, depth); /* home directory drive unicode string */ - prs_align(ps); - smb_io_unistr2("uni_logon_script", &(usr->uni_logon_script), usr->hdr_logon_script.buffer, ps, depth); /* logon script unicode string */ - prs_align(ps); - smb_io_unistr2("uni_profile_path", &(usr->uni_profile_path), usr->hdr_profile_path.buffer, ps, depth); /* profile path unicode string */ - prs_align(ps); - smb_io_unistr2("uni_acct_desc ", &(usr->uni_acct_desc ), usr->hdr_acct_desc .buffer, ps, depth); /* user desc unicode string */ - prs_align(ps); - smb_io_unistr2("uni_workstations", &(usr->uni_workstations), usr->hdr_workstations.buffer, ps, depth); /* worksations user can log on from */ - prs_align(ps); - smb_io_unistr2("uni_unknown_str ", &(usr->uni_unknown_str ), usr->hdr_unknown_str .buffer, ps, depth); /* unknown string */ - prs_align(ps); - smb_io_unistr2("uni_munged_dial ", &(usr->uni_munged_dial ), usr->hdr_munged_dial .buffer, ps, depth); /* worksations user can log on from */ - prs_align(ps); - - prs_uint32("unknown_6 ", ps, depth, &(usr->unknown_6 )); - prs_uint32("padding4 ", ps, depth, &(usr->padding4 )); - - if (usr->ptr_logon_hrs) - { - sam_io_logon_hrs("logon_hrs", &(usr->logon_hrs) , ps, depth); - prs_align(ps); - } - - return True; -} - - -/************************************************************************* - make_sam_user_info21 - - unknown_3 = 0x00ff ffff - unknown_5 = 0x0002 0000 - unknown_6 = 0x0000 04ec - - *************************************************************************/ -BOOL make_sam_user_info21(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, - - char *user_name, - char *full_name, - char *home_dir, - char *dir_drive, - char *log_scr, - char *prof_path, - char *desc, - char *wkstas, - char *unk_str, - char *mung_dial, - - uint32 user_rid, - uint32 group_rid, - uint16 acb_info, + uint32 user_rid, + uint32 group_rid, + uint16 acb_info, uint32 unknown_3, uint16 logon_divs, @@ -5294,16 +2740,16 @@ BOOL make_sam_user_info21(SAM_USER_INFO_21 *usr, uint32 unknown_5, uint32 unknown_6) { - int len_user_name = user_name != NULL ? strlen(user_name) : 0; - int len_full_name = full_name != NULL ? strlen(full_name) : 0; - int len_home_dir = home_dir != NULL ? strlen(home_dir ) : 0; - int len_dir_drive = dir_drive != NULL ? strlen(dir_drive) : 0; - int len_logon_script = log_scr != NULL ? strlen(log_scr ) : 0; - int len_profile_path = prof_path != NULL ? strlen(prof_path) : 0; - int len_description = desc != NULL ? strlen(desc ) : 0; - int len_workstations = wkstas != NULL ? strlen(wkstas ) : 0; - int len_unknown_str = unk_str != NULL ? strlen(unk_str ) : 0; - int len_munged_dial = mung_dial != NULL ? strlen(mung_dial) : 0; + int len_user_name = user_name != NULL ? strlen(user_name ) : 0; + int len_full_name = full_name != NULL ? strlen(full_name ) : 0; + int len_home_dir = home_dir != NULL ? strlen(home_dir ) : 0; + int len_dir_drive = dir_drive != NULL ? strlen(dir_drive ) : 0; + int len_logon_script = logon_script != NULL ? strlen(logon_script) : 0; + int len_profile_path = profile_path != NULL ? strlen(profile_path) : 0; + int len_description = description != NULL ? strlen(description ) : 0; + int len_workstations = workstations != NULL ? strlen(workstations) : 0; + int len_unknown_str = unknown_str != NULL ? strlen(unknown_str ) : 0; + int len_munged_dial = munged_dial != NULL ? strlen(munged_dial ) : 0; usr->logon_time = *logon_time; usr->logoff_time = *logoff_time; @@ -5312,19 +2758,19 @@ BOOL make_sam_user_info21(SAM_USER_INFO_21 *usr, usr->pass_can_change_time = *pass_can_change_time; usr->pass_must_change_time = *pass_must_change_time; - make_uni_hdr(&(usr->hdr_user_name ), len_user_name ); - make_uni_hdr(&(usr->hdr_full_name ), len_full_name ); - make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir ); - make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive ); - make_uni_hdr(&(usr->hdr_logon_script), len_logon_script); - make_uni_hdr(&(usr->hdr_profile_path), len_profile_path); - make_uni_hdr(&(usr->hdr_acct_desc ), len_description ); - make_uni_hdr(&(usr->hdr_workstations), len_workstations); - make_uni_hdr(&(usr->hdr_unknown_str ), len_unknown_str ); - make_uni_hdr(&(usr->hdr_munged_dial ), len_munged_dial ); + init_uni_hdr(&usr->hdr_user_name, len_user_name); + init_uni_hdr(&usr->hdr_full_name, len_full_name); + init_uni_hdr(&usr->hdr_home_dir, len_home_dir); + init_uni_hdr(&usr->hdr_dir_drive, len_dir_drive); + init_uni_hdr(&usr->hdr_logon_script, len_logon_script); + init_uni_hdr(&usr->hdr_profile_path, len_profile_path); + init_uni_hdr(&usr->hdr_acct_desc, len_description); + init_uni_hdr(&usr->hdr_workstations, len_workstations); + init_uni_hdr(&usr->hdr_unknown_str, len_unknown_str); + init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); - bzero(usr->nt_pwd, sizeof(usr->nt_pwd)); - bzero(usr->lm_pwd, sizeof(usr->lm_pwd)); + memset((char *)usr->nt_pwd, '\0', sizeof(usr->nt_pwd)); + memset((char *)usr->lm_pwd, '\0', sizeof(usr->lm_pwd)); usr->user_rid = user_rid; usr->group_rid = group_rid; @@ -5335,807 +2781,659 @@ BOOL make_sam_user_info21(SAM_USER_INFO_21 *usr, usr->ptr_logon_hrs = hrs ? 1 : 0; usr->unknown_5 = unknown_5; /* 0x0002 0000 */ - bzero(usr->padding1, sizeof(usr->padding1)); + memset((char *)usr->padding1, '\0', sizeof(usr->padding1)); - make_unistr2(&(usr->uni_user_name ), user_name , len_user_name ); - make_unistr2(&(usr->uni_full_name ), full_name , len_full_name ); - make_unistr2(&(usr->uni_home_dir ), home_dir , len_home_dir ); - make_unistr2(&(usr->uni_dir_drive ), dir_drive , len_dir_drive ); - make_unistr2(&(usr->uni_logon_script), log_scr, len_logon_script); - make_unistr2(&(usr->uni_profile_path), prof_path, len_profile_path); - make_unistr2(&(usr->uni_acct_desc ), desc , len_description ); - make_unistr2(&(usr->uni_workstations), wkstas, len_workstations); - make_unistr2(&(usr->uni_unknown_str ), unk_str , len_unknown_str ); - make_unistr2(&(usr->uni_munged_dial ), mung_dial , len_munged_dial ); + init_unistr2(&usr->uni_user_name, user_name, len_user_name); + init_unistr2(&usr->uni_full_name, full_name, len_full_name); + init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); + init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); + init_unistr2(&usr->uni_logon_script, logon_script, len_logon_script); + init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path); + init_unistr2(&usr->uni_acct_desc, description, len_description); + init_unistr2(&usr->uni_workstations, workstations, len_workstations); + init_unistr2(&usr->uni_unknown_str, unknown_str, len_unknown_str); + init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial); usr->unknown_6 = unknown_6; /* 0x0000 04ec */ usr->padding4 = 0; if (hrs) - { memcpy(&(usr->logon_hrs), hrs, sizeof(usr->logon_hrs)); - } else - { memset(&(usr->logon_hrs), 0xff, sizeof(usr->logon_hrs)); - } - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL sam_io_user_info21(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++; - - prs_align(ps); - - smb_io_time("logon_time ", &(usr->logon_time) , ps, depth); - smb_io_time("logoff_time ", &(usr->logoff_time) , ps, depth); - smb_io_time("kickoff_time ", &(usr->kickoff_time) , ps, depth); - smb_io_time("pass_last_set_time ", &(usr->pass_last_set_time) , ps, depth); - smb_io_time("pass_can_change_time ", &(usr->pass_can_change_time) , ps, depth); - smb_io_time("pass_must_change_time", &(usr->pass_must_change_time), ps, depth); - - smb_io_unihdr("hdr_user_name ", &(usr->hdr_user_name) , ps, depth); /* username unicode string header */ - smb_io_unihdr("hdr_full_name ", &(usr->hdr_full_name) , ps, depth); /* user's full name unicode string header */ - smb_io_unihdr("hdr_home_dir ", &(usr->hdr_home_dir) , ps, depth); /* home directory unicode string header */ - smb_io_unihdr("hdr_dir_drive ", &(usr->hdr_dir_drive) , ps, depth); /* home directory drive */ - smb_io_unihdr("hdr_logon_script", &(usr->hdr_logon_script), ps, depth); /* logon script unicode string header */ - smb_io_unihdr("hdr_profile_path", &(usr->hdr_profile_path), ps, depth); /* profile path unicode string header */ - smb_io_unihdr("hdr_acct_desc ", &(usr->hdr_acct_desc ) , ps, depth); /* account desc */ - smb_io_unihdr("hdr_workstations", &(usr->hdr_workstations), ps, depth); /* wkstas user can log on from */ - smb_io_unihdr("hdr_unknown_str ", &(usr->hdr_unknown_str ), ps, depth); /* unknown string */ - smb_io_unihdr("hdr_munged_dial ", &(usr->hdr_munged_dial ), ps, depth); /* wkstas user can log on from */ - - prs_uint8s (False, "lm_pwd ", ps, depth, usr->lm_pwd , sizeof(usr->lm_pwd )); - prs_uint8s (False, "nt_pwd ", ps, depth, usr->nt_pwd , sizeof(usr->nt_pwd )); - - prs_uint32("user_rid ", ps, depth, &(usr->user_rid )); /* User ID */ - prs_uint32("group_rid ", ps, depth, &(usr->group_rid )); /* Group ID */ - prs_uint16("acb_info ", ps, depth, &(usr->acb_info )); /* Group ID */ - prs_align(ps); - - prs_uint32("unknown_3 ", ps, depth, &(usr->unknown_3 )); - prs_uint16("logon_divs ", ps, depth, &(usr->logon_divs )); /* logon divisions per week */ - prs_align(ps); - prs_uint32("ptr_logon_hrs ", ps, depth, &(usr->ptr_logon_hrs)); - prs_uint32("unknown_5 ", ps, depth, &(usr->unknown_5 )); - - prs_uint8s (False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1)); - - /* here begins pointed-to data */ - - smb_io_unistr2("uni_user_name ", &(usr->uni_user_name) , usr->hdr_user_name .buffer, ps, depth); /* username unicode string */ - prs_align(ps); - smb_io_unistr2("uni_full_name ", &(usr->uni_full_name) , usr->hdr_full_name .buffer, ps, depth); /* user's full name unicode string */ - prs_align(ps); - smb_io_unistr2("uni_home_dir ", &(usr->uni_home_dir) , usr->hdr_home_dir .buffer, ps, depth); /* home directory unicode string */ - prs_align(ps); - smb_io_unistr2("uni_dir_drive ", &(usr->uni_dir_drive) , usr->hdr_dir_drive .buffer, ps, depth); /* home directory drive unicode string */ - prs_align(ps); - smb_io_unistr2("uni_logon_script", &(usr->uni_logon_script), usr->hdr_logon_script.buffer, ps, depth); /* logon script unicode string */ - prs_align(ps); - smb_io_unistr2("uni_profile_path", &(usr->uni_profile_path), usr->hdr_profile_path.buffer, ps, depth); /* profile path unicode string */ - prs_align(ps); - smb_io_unistr2("uni_acct_desc ", &(usr->uni_acct_desc ), usr->hdr_acct_desc .buffer, ps, depth); /* user desc unicode string */ - prs_align(ps); - smb_io_unistr2("uni_workstations", &(usr->uni_workstations), usr->hdr_workstations.buffer, ps, depth); /* worksations user can log on from */ - prs_align(ps); - smb_io_unistr2("uni_unknown_str ", &(usr->uni_unknown_str ), usr->hdr_unknown_str .buffer, ps, depth); /* unknown string */ - prs_align(ps); - smb_io_unistr2("uni_munged_dial ", &(usr->uni_munged_dial ), usr->hdr_munged_dial .buffer, ps, depth); /* worksations user can log on from */ - prs_align(ps); - - prs_uint32("unknown_6 ", ps, depth, &(usr->unknown_6 )); - prs_uint32("padding4 ", ps, depth, &(usr->padding4 )); - - if (usr->ptr_logon_hrs) - { - sam_io_logon_hrs("logon_hrs", &(usr->logon_hrs) , ps, depth); - prs_align(ps); - } - - return True; -} - - -/******************************************************************* -makes a SAMR_R_QUERY_USERINFO structure. -********************************************************************/ -BOOL make_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO *r_u, - uint16 switch_value, void *info, uint32 status) - -{ - if (r_u == NULL || info == NULL) return False; - - DEBUG(5,("make_samr_r_query_userinfo\n")); - - r_u->ptr = 0; - r_u->switch_value = 0; - - if (status == 0) - { - r_u->switch_value = switch_value; - - switch (switch_value) - { - case 0x10: - { - r_u->ptr = 1; - r_u->info.id10 = (SAM_USER_INFO_10*)info; - - break; - } - - case 0x11: - { - r_u->ptr = 1; - r_u->info.id11 = (SAM_USER_INFO_11*)info; - - break; - } - - case 21: - { - r_u->ptr = 1; - r_u->info.id21 = (SAM_USER_INFO_21*)info; - - break; - } - - case 23: - { - r_u->ptr = 1; - r_u->info.id23 = (SAM_USER_INFO_23*)info; - - break; - } - - case 24: - { - r_u->ptr = 1; - r_u->info.id24 = (SAM_USER_INFO_24*)info; - - break; - } - - default: - { - DEBUG(4,("make_samr_r_query_userinfo: unsupported switch level\n")); - break; - } - } - } - - r_u->status = status; /* return status */ - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_query_userinfo(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++; - - prs_align(ps); - - prs_uint32("ptr ", ps, depth, &(r_u->ptr )); - prs_uint16("switch_value", ps, depth, &(r_u->switch_value)); - prs_align(ps); - - if (r_u->ptr != 0 && r_u->switch_value != 0 && r_u->info.id != NULL) - { - switch (r_u->switch_value) - { - case 0x10: - { - if (r_u->info.id10 != NULL) - { - sam_io_user_info10("", r_u->info.id10, ps, depth); - } - else - { - DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); - return False; - } - break; - } -/* - case 0x11: - { - if (r_u->info.id11 != NULL) - { - sam_io_user_info11("", r_u->info.id11, ps, depth); - } - else - { - DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); - return False; - } - break; - } -*/ - case 21: - { - if (r_u->info.id21 != NULL) - { - sam_io_user_info21("", r_u->info.id21, ps, depth); - } - else - { - DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); - return False; - } - break; - } - case 23: - { - if (r_u->info.id23 != NULL) - { - sam_io_user_info23("", r_u->info.id23, ps, depth); - } - else - { - DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); - return False; - } - break; - } - case 24: - { - if (r_u->info.id24 != NULL) - { - sam_io_user_info24("", r_u->info.id24, ps, depth); - } - else - { - DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); - return False; - } - break; - } - default: - { - DEBUG(2,("samr_io_r_query_userinfo: unknown switch level\n")); - break; - } - - } - } +} + + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *ps, int depth) +{ + if (usr == NULL) + return False; - prs_uint32("status", ps, depth, &(r_u->status)); + prs_debug(ps, depth, desc, "lsa_io_user_info"); + 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 description */ + return False; + if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* workstations user can log on from */ + return False; + if(!smb_io_unihdr("hdr_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */ + return False; + if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* workstations 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_uint16("acb_info ", ps, depth, &usr->acb_info)) /* Group ID */ + return False; + if(!prs_align(ps)) + return False; + + if(!prs_uint32("unknown_3 ", ps, depth, &usr->unknown_3)) + 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_uint32("unknown_5 ", ps, depth, &usr->unknown_5)) + return False; + + if(!prs_uint8s (False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1))) + 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 description 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_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str .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)) /* worksations user can log on from */ + return False; + + if(!prs_uint32("unknown_6 ", ps, depth, &usr->unknown_6)) + return False; + if(!prs_uint32("padding4 ", ps, depth, &usr->padding4)) + return False; + + if (usr->ptr_logon_hrs) { + if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + } return True; } /******************************************************************* -makes a SAMR_Q_SET_USERINFO structure. + Inits a SAMR_R_QUERY_USERINFO structure. ********************************************************************/ -BOOL make_samr_q_set_userinfo(SAMR_Q_SET_USERINFO *q_u, - POLICY_HND *hnd, - uint16 switch_value, void *info) + +void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO *r_u, + uint16 switch_value, void *info, uint32 status) { - if (q_u == NULL || hnd == NULL) return False; + DEBUG(5,("init_samr_r_query_userinfo\n")); - DEBUG(5,("make_samr_q_set_userinfo\n")); + r_u->ptr = 0; + r_u->switch_value = 0; - memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); - q_u->switch_value = switch_value; - q_u->switch_value2 = switch_value; - q_u->info.id = info; + if (status == 0) { + r_u->switch_value = switch_value; - switch (switch_value) - { - case 0x18: - { - uchar sess_key[16]; - if (!cli_get_usr_sesskey(hnd, sess_key)) - { - return False; - } - SamOEMhash(q_u->info.id24->pass, sess_key, 1); -#ifdef DEBUG_PASSWORD - dump_data(100, sess_key, 16); - dump_data(100, q_u->info.id24->pass, 516); -#endif + switch (switch_value) { + case 0x10: + r_u->ptr = 1; + r_u->info.id10 = (SAM_USER_INFO_10*)info; break; - } - case 0x17: - { - uchar sess_key[16]; - if (!cli_get_usr_sesskey(hnd, sess_key)) - { - return False; - } - SamOEMhash(q_u->info.id23->pass, sess_key, 1); -#ifdef DEBUG_PASSWORD - dump_data(100, sess_key, 16); - dump_data(100, q_u->info.id23->pass, 516); -#endif + + case 0x11: + r_u->ptr = 1; + r_u->info.id11 = (SAM_USER_INFO_11*)info; break; - } + + case 21: + r_u->ptr = 1; + r_u->info.id21 = (SAM_USER_INFO_21*)info; + break; + default: - { - DEBUG(4,("make_samr_q_set_userinfo: unsupported switch level\n")); - return False; + DEBUG(4,("init_samr_r_query_aliasinfo: unsupported switch level\n")); + break; } } - return True; + r_u->status = status; /* return status */ } - /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO *q_u, prs_struct *ps, int depth) + +BOOL samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struct *ps, int depth) { - if (q_u == NULL) return False; + if (r_u == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_q_set_userinfo"); + prs_debug(ps, depth, desc, "samr_io_r_query_userinfo"); depth++; - prs_align(ps); - - smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); - prs_align(ps); - - prs_uint16("switch_value ", ps, depth, &(q_u->switch_value )); - prs_uint16("switch_value2", ps, depth, &(q_u->switch_value2)); + if(!prs_align(ps)) + return False; - prs_align(ps); + if(!prs_uint32("ptr ", ps, depth, &r_u->ptr)) + return False; + if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value)) + return False; + if(!prs_align(ps)) + return False; - switch (q_u->switch_value) - { - case 0: - { - break; - } - case 24: - { - if (ps->io) - { - /* reading */ - q_u->info.id = (SAM_USER_INFO_24*)Realloc(NULL, - sizeof(*q_u->info.id24)); - } - if (q_u->info.id == NULL) - { - DEBUG(2,("samr_io_q_query_userinfo: info pointer not initialised\n")); + if (r_u->ptr != 0 && r_u->switch_value != 0) { + switch (r_u->switch_value) { + case 0x10: + if (r_u->info.id10 != NULL) { + if(!sam_io_user_info10("", r_u->info.id10, ps, depth)) + return False; + } else { + DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); return False; } - sam_io_user_info24("", q_u->info.id24, ps, depth); break; - } - case 23: - { - if (ps->io) - { - /* reading */ - q_u->info.id = (SAM_USER_INFO_23*)Realloc(NULL, - sizeof(*q_u->info.id23)); +/* + case 0x11: + if (r_u->info.id11 != NULL) { + if(!sam_io_user_info11("", r_u->info.id11, ps, depth)) + return False; + } else { + DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); + return False; } - if (q_u->info.id == NULL) - { - DEBUG(2,("samr_io_q_query_userinfo: info pointer not initialised\n")); + break; +*/ + case 21: + if (r_u->info.id21 != NULL) { + if(!sam_io_user_info21("", r_u->info.id21, ps, depth)) + return False; + } else { + DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); return False; } - sam_io_user_info23("", q_u->info.id23, ps, depth); break; - } default: - { - DEBUG(2,("samr_io_q_query_userinfo: unknown switch level\n")); + DEBUG(2,("samr_io_r_query_userinfo: unknown switch level\n")); break; } - } - prs_align(ps); - if (!ps->io) - { - /* writing */ - free_samr_q_set_userinfo(q_u); - } + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } /******************************************************************* -frees a structure. + Reads or writes a structure. ********************************************************************/ -void free_samr_q_set_userinfo(SAMR_Q_SET_USERINFO *q_u) -{ - if (q_u->info.id == NULL) - { - free(q_u->info.id); - } - q_u->info.id = NULL; -} -/******************************************************************* -makes a SAMR_R_SET_USERINFO structure. -********************************************************************/ -BOOL make_samr_r_set_userinfo(SAMR_R_SET_USERINFO *r_u, uint32 status) - +BOOL samr_io_q_unknown_32(char *desc, SAMR_Q_UNKNOWN_32 *q_u, prs_struct *ps, int depth) { - if (r_u == NULL) return False; + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_q_unknown_32"); + depth++; - DEBUG(5,("make_samr_r_set_userinfo\n")); + if(!prs_align(ps)) + return False; - r_u->status = status; /* return status */ + if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + if(!smb_io_unihdr ("", &q_u->hdr_mach_acct, ps, depth)) + return False; + if(!smb_io_unistr2("", &q_u->uni_mach_acct, q_u->hdr_mach_acct.buffer, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("acct_ctrl", ps, depth, &q_u->acct_ctrl)) + return False; + if(!prs_uint16("unknown_1", ps, depth, &q_u->unknown_1)) + return False; + if(!prs_uint16("unknown_2", ps, depth, &q_u->unknown_2)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_userinfo(char *desc, SAMR_R_SET_USERINFO *r_u, prs_struct *ps, int depth) + +BOOL samr_io_r_unknown_32(char *desc, SAMR_R_UNKNOWN_32 *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return False; + if (r_u == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_r_set_userinfo"); + prs_debug(ps, depth, desc, "samr_io_r_unknown_32"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } /******************************************************************* -makes a SAMR_Q_SET_USERINFO2 structure. + Inits a SAMR_Q_CONNECT structure. ********************************************************************/ -BOOL make_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 *q_u, - POLICY_HND *hnd, - uint16 switch_value, void *info) -{ - if (q_u == NULL || hnd == NULL) return False; - DEBUG(5,("make_samr_q_set_userinfo2\n")); +void init_samr_q_connect(SAMR_Q_CONNECT *q_u, + char *srv_name, uint32 unknown_0) +{ + int len_srv_name = strlen(srv_name); - memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); - q_u->switch_value = switch_value; - q_u->switch_value2 = switch_value; - q_u->info.id = info; + DEBUG(5,("init_q_connect\n")); - switch (switch_value) - { - case 0x10: - { - break; - } - default: - { - DEBUG(4,("make_samr_q_set_userinfo2: unsupported switch level\n")); - return False; - } - } + /* make PDC server name \\server */ + q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0; + init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name+1); - return True; + /* example values: 0x0000 0002 */ + q_u->unknown_0 = unknown_0; } - /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_userinfo2(char *desc, SAMR_Q_SET_USERINFO2 *q_u, prs_struct *ps, int depth) + +BOOL samr_io_q_connect(char *desc, SAMR_Q_CONNECT *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return False; + if (q_u == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_q_set_userinfo2"); + prs_debug(ps, depth, desc, "samr_io_q_connect"); depth++; - prs_align(ps); - - smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); - prs_align(ps); - - prs_uint16("switch_value ", ps, depth, &(q_u->switch_value )); - prs_uint16("switch_value2", ps, depth, &(q_u->switch_value2)); + if(!prs_align(ps)) + return False; - prs_align(ps); + 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; - switch (q_u->switch_value) - { - case 0: - { - break; - } - case 16: - { - if (ps->io) - { - /* reading */ - q_u->info.id = (SAM_USER_INFO_16*)Realloc(NULL, - sizeof(*q_u->info.id16)); - } - if (q_u->info.id == NULL) - { - DEBUG(2,("samr_io_q_query_userinfo2: info pointer not initialised\n")); - return False; - } - sam_io_user_info16("", q_u->info.id16, ps, depth); - break; - } - default: - { - DEBUG(2,("samr_io_q_query_userinfo2: unknown switch level\n")); - break; - } - - } - prs_align(ps); + if(!prs_align(ps)) + return False; - if (!ps->io) - { - /* writing */ - free_samr_q_set_userinfo2(q_u); - } + if(!prs_uint32("unknown_0 ", ps, depth, &q_u->unknown_0)) + return False; return True; } /******************************************************************* -frees a structure. + Reads or writes a structure. ********************************************************************/ -void free_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 *q_u) + +BOOL samr_io_r_connect(char *desc, SAMR_R_CONNECT *r_u, prs_struct *ps, int depth) { - if (q_u->info.id == NULL) - { - free(q_u->info.id); - } - q_u->info.id = NULL; + 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_align(ps)) + return False; + + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; } /******************************************************************* -makes a SAMR_R_SET_USERINFO2 structure. + Inits a SAMR_Q_CONNECT_ANON structure. ********************************************************************/ -BOOL make_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2 *r_u, - uint32 status) -{ - if (r_u == NULL) return False; - DEBUG(5,("make_samr_r_set_userinfo2\n")); - - r_u->status = status; /* return status */ +void init_samr_q_connect_anon(SAMR_Q_CONNECT_ANON *q_u) +{ + DEBUG(5,("init_q_connect_anon\n")); - return True; + q_u->ptr = 1; + q_u->unknown_0 = 0x5c; /* server name (?!!) */ + q_u->unknown_1 = 0x01; + q_u->unknown_2 = 0x20; } + /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_userinfo2(char *desc, SAMR_R_SET_USERINFO2 *r_u, prs_struct *ps, int depth) + +BOOL samr_io_q_connect_anon(char *desc, SAMR_Q_CONNECT_ANON *q_u, prs_struct *ps, int depth) { - if (r_u == NULL) return False; + if (q_u == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_r_set_userinfo2"); + prs_debug(ps, depth, desc, "samr_io_q_connect_anon"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("ptr ", ps, depth, &q_u->ptr)) + return False; + if(!prs_uint16("unknown_0", ps, depth, &q_u->unknown_0)) + return False; + if(!prs_uint16("unknown_1", ps, depth, &q_u->unknown_1)) + return False; + if(!prs_uint32("unknown_2", ps, depth, &q_u->unknown_2)) + return False; return True; } /******************************************************************* -makes a SAMR_Q_CONNECT structure. + Reads or writes a structure. ********************************************************************/ -BOOL make_samr_q_connect(SAMR_Q_CONNECT *q_u, - const char *srv_name, uint32 unknown_0) + +BOOL samr_io_r_connect_anon(char *desc, SAMR_R_CONNECT_ANON *r_u, prs_struct *ps, int depth) { - int len_srv_name = strlen(srv_name); + if (r_u == NULL) + return False; - if (q_u == NULL) return False; + prs_debug(ps, depth, desc, "samr_io_r_connect_anon"); + depth++; - DEBUG(5,("make_samr_q_connect\n")); + if(!prs_align(ps)) + return False; - /* make PDC server name \\server */ - q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0; - make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name+1); + if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; - /* example values: 0x0000 0002 */ - q_u->unknown_0 = unknown_0; + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } - /******************************************************************* -reads or writes a structure. + Inits a SAMR_Q_OPEN_ALIAS structure. ********************************************************************/ -BOOL samr_io_q_connect(char *desc, SAMR_Q_CONNECT *q_u, prs_struct *ps, int depth) +void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, + uint32 unknown_0, uint32 rid) { - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "samr_io_q_connect"); - depth++; - - prs_align(ps); + DEBUG(5,("init_q_open_alias\n")); - prs_uint32("ptr_srv_name", ps, depth, &(q_u->ptr_srv_name)); - smb_io_unistr2("", &(q_u->uni_srv_name), q_u->ptr_srv_name, ps, depth); - - prs_align(ps); - - prs_uint32("unknown_0 ", ps, depth, &(q_u->unknown_0 )); + /* example values: 0x0000 0008 */ + q_u->unknown_0 = unknown_0; - return True; + q_u->rid_alias = rid; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_connect(char *desc, SAMR_R_CONNECT *r_u, prs_struct *ps, int depth) + +BOOL samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, int depth) { - if (r_u == NULL) return False; + if (q_u == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_r_connect"); + prs_debug(ps, depth, desc, "samr_io_q_open_alias"); depth++; - prs_align(ps); - - smb_io_pol_hnd("connect_pol", &(r_u->connect_pol), ps, depth); - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("unknown_0", ps, depth, &q_u->unknown_0)) + return False; + if(!prs_uint32("rid_alias", ps, depth, &q_u->rid_alias)) + return False; return True; } /******************************************************************* -makes a SAMR_Q_CONNECT_ANON structure. + Reads or writes a structure. ********************************************************************/ -BOOL make_samr_q_connect_anon(SAMR_Q_CONNECT_ANON *q_u) + +BOOL samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, int depth) { - if (q_u == NULL) return False; + if (r_u == NULL) + return False; - DEBUG(5,("make_samr_q_connect_anon\n")); + prs_debug(ps, depth, desc, "samr_io_r_open_alias"); + depth++; - q_u->ptr = 1; - q_u->unknown_0 = 0x5c; /* server name (?!!) */ - q_u->unknown_1 = 0x01; - q_u->unknown_2 = 0x20; + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } - /******************************************************************* -reads or writes a structure. + Inits a SAMR_Q_UNKNOWN_12 structure. ********************************************************************/ -BOOL samr_io_q_connect_anon(char *desc, SAMR_Q_CONNECT_ANON *q_u, prs_struct *ps, int depth) + +void init_samr_q_unknown_12(SAMR_Q_UNKNOWN_12 *q_u, + POLICY_HND *pol, uint32 rid, + uint32 num_gids, uint32 *gid) { - if (q_u == NULL) return False; + int i; - prs_debug(ps, depth, desc, "samr_io_q_connect_anon"); - depth++; + DEBUG(5,("init_samr_r_unknwon_12\n")); - prs_align(ps); + memcpy(&q_u->pol, pol, sizeof(*pol)); - prs_uint32("ptr ", ps, depth, &(q_u->ptr )); - prs_uint16("unknown_0", ps, depth, &(q_u->unknown_0)); - prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1)); - prs_uint32("unknown_2", ps, depth, &(q_u->unknown_2)); + q_u->num_gids1 = num_gids; + q_u->rid = rid; + q_u->ptr = 0; + q_u->num_gids2 = num_gids; - return True; + for (i = 0; i < num_gids; i++) { + q_u->gid[i] = gid[i]; + } } /******************************************************************* -reads or writes a structure. + Inits a SAMR_Q_UNKNOWN_21 structure. ********************************************************************/ -BOOL samr_io_r_connect_anon(char *desc, SAMR_R_CONNECT_ANON *r_u, prs_struct *ps, int depth) + +void init_samr_q_unknown_21(SAMR_Q_UNKNOWN_21 *q_c, + POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) { - if (r_u == NULL) return False; + DEBUG(5,("init_samr_q_unknown_21\n")); - prs_debug(ps, depth, desc, "samr_io_r_connect_anon"); - depth++; + memcpy(&q_c->group_pol, hnd, sizeof(q_c->group_pol)); + q_c->unknown_1 = unk_1; + q_c->unknown_2 = unk_2; +} - prs_align(ps); - smb_io_pol_hnd("connect_pol", &(r_u->connect_pol), ps, depth); - prs_align(ps); +/******************************************************************* + Inits a SAMR_Q_UNKNOWN_13 structure. +********************************************************************/ - prs_uint32("status", ps, depth, &(r_u->status)); +void init_samr_q_unknown_13(SAMR_Q_UNKNOWN_13 *q_c, + POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) +{ + DEBUG(5,("init_samr_q_unknown_13\n")); - return True; + memcpy(&q_c->alias_pol, hnd, sizeof(q_c->alias_pol)); + q_c->unknown_1 = unk_1; + q_c->unknown_2 = unk_2; } /******************************************************************* -makes a SAMR_Q_UNKNOWN_38 structure. + Inits a SAMR_Q_UNKNOWN_38 structure. ********************************************************************/ -BOOL make_samr_q_unknown_38(SAMR_Q_UNKNOWN_38 *q_u, char *srv_name) +void init_samr_q_unknown_38(SAMR_Q_UNKNOWN_38 *q_u, char *srv_name) { int len_srv_name = strlen(srv_name); - if (q_u == NULL) return False; - - DEBUG(5,("make_samr_q_unknown_38\n")); + DEBUG(5,("init_q_unknown_38\n")); q_u->ptr = 1; - make_uni_hdr(&(q_u->hdr_srv_name), len_srv_name); - make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name); + init_uni_hdr(&q_u->hdr_srv_name, len_srv_name); + init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name); - - return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ + BOOL samr_io_q_unknown_38(char *desc, SAMR_Q_UNKNOWN_38 *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return False; + if (q_u == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_q_unknown_38"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr", ps, depth, &(q_u->ptr)); - if (q_u->ptr != 0) - { - smb_io_unihdr ("", &(q_u->hdr_srv_name), ps, depth); - smb_io_unistr2("", &(q_u->uni_srv_name), q_u->hdr_srv_name.buffer, ps, depth); - prs_align(ps); + 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; } /******************************************************************* -makes a SAMR_R_UNKNOWN_38 structure. + Inits a SAMR_R_UNKNOWN_38 structure. ********************************************************************/ -BOOL make_samr_r_unknown_38(SAMR_R_UNKNOWN_38 *r_u) -{ - if (r_u == NULL) return False; - DEBUG(5,("make_r_unknown_38\n")); +void init_samr_r_unknown_38(SAMR_R_UNKNOWN_38 *r_u) +{ + DEBUG(5,("init_r_unknown_38\n")); r_u->unk_0 = 0; r_u->unk_1 = 0; r_u->unk_2 = 0; r_u->unk_3 = 0; - - return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ + BOOL samr_io_r_unknown_38(char *desc, SAMR_R_UNKNOWN_38 *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return False; + if (r_u == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_r_unknown_38"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint16("unk_0", ps, depth, &(r_u->unk_0)); - prs_align(ps); - prs_uint16("unk_1", ps, depth, &(r_u->unk_1)); - prs_align(ps); - prs_uint16("unk_2", ps, depth, &(r_u->unk_2)); - prs_align(ps); - prs_uint16("unk_3", ps, depth, &(r_u->unk_3)); - prs_align(ps); + if(!prs_uint16("unk_0", ps, depth, &r_u->unk_0)) + return False; + if(!prs_align(ps)) + return False; + if(!prs_uint16("unk_1", ps, depth, &r_u->unk_1)) + return False; + if(!prs_align(ps)) + return False; + if(!prs_uint16("unk_2", ps, depth, &r_u->unk_2)) + return False; + if(!prs_align(ps)) + return False; + if(!prs_uint16("unk_3", ps, depth, &r_u->unk_3)) + return False; + if(!prs_align(ps)) + return False; return True; } @@ -6143,69 +3441,74 @@ BOOL samr_io_r_unknown_38(char *desc, SAMR_R_UNKNOWN_38 *r_u, prs_struct *ps, i /******************************************************************* make a SAMR_ENC_PASSWD structure. ********************************************************************/ -BOOL make_enc_passwd(SAMR_ENC_PASSWD *pwd, char pass[512]) -{ - if (pwd == NULL) return False; +void init_enc_passwd(SAMR_ENC_PASSWD *pwd, char pass[512]) +{ pwd->ptr = 1; memcpy(pwd->pass, pass, sizeof(pwd->pass)); - - return True; } /******************************************************************* -reads or writes a SAMR_ENC_PASSWD structure. + Reads or writes a SAMR_ENC_PASSWD structure. ********************************************************************/ + BOOL samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD *pwd, prs_struct *ps, int depth) { - if (pwd == NULL) return False; + if (pwd == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_enc_passwd"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr", ps, depth, &(pwd->ptr)); - prs_uint8s(False, "pwd", ps, depth, pwd->pass, sizeof(pwd->pass)); + if(!prs_uint32("ptr", ps, depth, &pwd->ptr)) + return False; + if(!prs_uint8s(False, "pwd", ps, depth, pwd->pass, sizeof(pwd->pass))) + return False; return True; } /******************************************************************* -makes a SAMR_ENC_HASH structure. + Inits a SAMR_ENC_HASH structure. ********************************************************************/ -BOOL make_enc_hash(SAMR_ENC_HASH *hsh, uchar hash[16]) -{ - if (hsh == NULL) return False; +void init_enc_hash(SAMR_ENC_HASH *hsh, uchar hash[16]) +{ hsh->ptr = 1; memcpy(hsh->hash, hash, sizeof(hsh->hash)); - - return True; } /******************************************************************* -reads or writes a SAMR_ENC_HASH structure. + Reads or writes a SAMR_ENC_HASH structure. ********************************************************************/ + BOOL samr_io_enc_hash(char *desc, SAMR_ENC_HASH *hsh, prs_struct *ps, int depth) { - if (hsh == NULL) return False; + if (hsh == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_enc_hash"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr ", ps, depth, &(hsh->ptr)); - prs_uint8s(False, "hash", ps, depth, hsh->hash, sizeof(hsh->hash)); + if(!prs_uint32("ptr ", ps, depth, &hsh->ptr)) + return False; + if(!prs_uint8s(False, "hash", ps, depth, hsh->hash, sizeof(hsh->hash))) + return False; return True; } /******************************************************************* -makes a SAMR_R_UNKNOWN_38 structure. + Inits a SAMR_R_UNKNOWN_38 structure. ********************************************************************/ -BOOL make_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, + +void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, char *dest_host, char *user_name, char nt_newpass[516], uchar nt_oldhash[16], char lm_newpass[516], uchar lm_oldhash[16]) @@ -6213,89 +3516,94 @@ BOOL make_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, int len_dest_host = strlen(dest_host); int len_user_name = strlen(user_name); - if (q_u == NULL) return False; - - DEBUG(5,("make_samr_q_chgpasswd_user\n")); + DEBUG(5,("init_samr_q_chgpasswd_user\n")); q_u->ptr_0 = 1; - make_uni_hdr(&(q_u->hdr_dest_host), len_dest_host); - make_unistr2(&(q_u->uni_dest_host), dest_host, len_dest_host); - make_uni_hdr(&(q_u->hdr_user_name), len_user_name); - make_unistr2(&(q_u->uni_user_name), user_name, len_user_name); + init_uni_hdr(&q_u->hdr_dest_host, len_dest_host); + init_unistr2(&q_u->uni_dest_host, dest_host, len_dest_host); + init_uni_hdr(&q_u->hdr_user_name, len_user_name); + init_unistr2(&q_u->uni_user_name, user_name, len_user_name); - make_enc_passwd(&(q_u->nt_newpass), nt_newpass); - make_enc_hash (&(q_u->nt_oldhash), nt_oldhash); + init_enc_passwd(&q_u->nt_newpass, nt_newpass); + init_enc_hash(&q_u->nt_oldhash, nt_oldhash); q_u->unknown = 0x01; - make_enc_passwd(&(q_u->lm_newpass), lm_newpass); - make_enc_hash (&(q_u->lm_oldhash), lm_oldhash); - - return True; + init_enc_passwd(&q_u->lm_newpass, lm_newpass); + init_enc_hash (&q_u->lm_oldhash, lm_oldhash); } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ + BOOL samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return False; + if (q_u == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user"); depth++; - prs_align(ps); - - prs_uint32("ptr_0", ps, depth, &(q_u->ptr_0)); + if(!prs_align(ps)) + return False; - smb_io_unihdr ("", &(q_u->hdr_dest_host), ps, depth); - smb_io_unistr2("", &(q_u->uni_dest_host), q_u->hdr_dest_host.buffer, ps, depth); - prs_align(ps); + if(!prs_uint32("ptr_0", ps, depth, &q_u->ptr_0)) + return False; - smb_io_unihdr ("", &(q_u->hdr_user_name), ps, depth); - smb_io_unistr2("", &(q_u->uni_user_name), q_u->hdr_user_name.buffer, ps, depth); - prs_align(ps); + 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(!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; - samr_io_enc_passwd("nt_newpass", &(q_u->nt_newpass), ps, depth); - samr_io_enc_hash ("nt_oldhash", &(q_u->nt_oldhash), ps, depth); + 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; - prs_uint32("unknown", ps, depth, &(q_u->unknown)); + if(!prs_uint32("unknown", ps, depth, &q_u->unknown)) + return False; - samr_io_enc_passwd("lm_newpass", &(q_u->lm_newpass), ps, depth); - samr_io_enc_hash ("lm_oldhash", &(q_u->lm_oldhash), ps, depth); + 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; } /******************************************************************* -makes a SAMR_R_CHGPASSWD_USER structure. + Inits a SAMR_R_CHGPASSWD_USER structure. ********************************************************************/ -BOOL make_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER *r_u, uint32 status) -{ - if (r_u == NULL) return False; - DEBUG(5,("make_r_chgpasswd_user\n")); +void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER *r_u, uint32 status) +{ + DEBUG(5,("init_r_chgpasswd_user\n")); r_u->status = status; - - return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ + BOOL samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return False; + if (r_u == NULL) + return False; prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("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 d4f4f8185f..541949e51e 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -2,10 +2,10 @@ * Unix SMB/Netbios implementation. * Version 1.9. * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1999, - * Copyright (C) Jeremy R. Allison 1995-1999 - * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, - * Copyright (C) Paul Ashton 1997-1999. + * Copyright (C) Andrew Tridgell 1992-1998, + * Copyright (C) Jeremy R. Allison 1995-1998 + * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, + * Copyright (C) Paul Ashton 1997-1998. * * 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 @@ -27,505 +27,593 @@ extern int DEBUGLEVEL; +#define SD_HEADER_SIZE 0x14 /******************************************************************* -makes a structure. + Sets up a SEC_ACCESS structure. ********************************************************************/ -BOOL make_sec_access(SEC_ACCESS *t, uint32 mask) + +void init_sec_access(SEC_ACCESS *t, uint32 mask) { t->mask = mask; - - return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a SEC_ACCESS structure. ********************************************************************/ + BOOL sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) { - if (t == NULL) return False; + if (t == NULL) + return False; prs_debug(ps, depth, desc, "sec_io_access"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("mask", ps, depth, &(t->mask)); + if(!prs_uint32("mask", ps, depth, &(t->mask))) + return False; return True; } /******************************************************************* -makes a structure. + Sets up a SEC_ACE structure. ********************************************************************/ -BOOL make_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 flag) + +void init_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 flag) { t->type = type; t->flags = flag; t->size = sid_size(sid) + 8; t->info = mask; + ZERO_STRUCTP(&t->sid); sid_copy(&t->sid, sid); - - return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a SEC_ACE structure. ********************************************************************/ -BOOL sec_io_ace(char *desc, SEC_ACE *t, prs_struct *ps, int depth) + +BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth) { uint32 old_offset; uint32 offset_ace_size; - if (t == NULL) return False; + + if (psa == NULL) + return False; prs_debug(ps, depth, desc, "sec_io_ace"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - old_offset = ps->offset; + old_offset = prs_offset(ps); + + if(!prs_uint8("type ", ps, depth, &psa->type)) + return False; + + if(!prs_uint8("flags", ps, depth, &psa->flags)) + return False; - prs_uint8 ("type ", ps, depth, &(t->type)); - prs_uint8 ("flags", ps, depth, &(t->flags)); - prs_uint16_pre("size ", ps, depth, &(t->size ), &offset_ace_size); + if(!prs_uint16_pre("size ", ps, depth, &psa->size, &offset_ace_size)) + return False; + + if(!sec_io_access("info ", &psa->info, ps, depth)) + return False; - sec_io_access ("info ", &t->info, ps, depth); - prs_align(ps); - smb_io_dom_sid("sid ", &t->sid , ps, depth); - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint16_post("size ", ps, depth, &t->size, offset_ace_size, old_offset); + if(!smb_io_dom_sid("sid ", &psa->sid , ps, depth)) + return False; + + if(!prs_uint16_post("size ", ps, depth, &psa->size, offset_ace_size, old_offset)) + return False; return True; } /******************************************************************* -makes a structure. + Create a SEC_ACL structure. ********************************************************************/ -BOOL make_sec_acl(SEC_ACL *t, uint16 revision, int num_aces, SEC_ACE *ace) + +SEC_ACL *make_sec_acl(uint16 revision, int num_aces, SEC_ACE *ace_list) { + SEC_ACL *dst; int i; - t->revision = revision; - t->num_aces = num_aces; - t->size = 4; - t->ace = ace; - - for (i = 0; i < num_aces; i++) - { - t->size += ace[i].size; + + if((dst = (SEC_ACL *)malloc(sizeof(SEC_ACL))) == NULL) + return NULL; + + ZERO_STRUCTP(dst); + + dst->revision = revision; + dst->num_aces = num_aces; + dst->size = 8; + + if((dst->ace_list = (SEC_ACE *)malloc( sizeof(SEC_ACE) * num_aces )) == NULL) { + free_sec_acl(&dst); + return NULL; } - return True; + for (i = 0; i < num_aces; i++) { + dst->ace_list[i] = ace_list[i]; /* Structure copy. */ + dst->size += ace_list[i].size; + } + + return dst; } /******************************************************************* -frees a structure. + Duplicate a SEC_ACL structure. ********************************************************************/ -void free_sec_acl(SEC_ACL *t) + +SEC_ACL *dup_sec_acl( SEC_ACL *src) { - if (t->ace != NULL) - { - free(t->ace); - } + if(src == NULL) + return NULL; + + return make_sec_acl( src->revision, src->num_aces, src->ace_list); } /******************************************************************* -reads or writes a structure. + Delete a SEC_ACL structure. +********************************************************************/ + +void free_sec_acl(SEC_ACL **ppsa) +{ + SEC_ACL *psa; -first of the xx_io_xx functions that allocates its data structures + if(ppsa == NULL || *ppsa == NULL) + return; + + psa = *ppsa; + if (psa->ace_list != NULL) + free(psa->ace_list); + + free(psa); + *ppsa = NULL; +} + +/******************************************************************* + Reads or writes a SEC_ACL structure. + + First of the xx_io_xx functions that allocates its data structures for you as it reads them. ********************************************************************/ -BOOL sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth) + +BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) { - uint32 i; + int i; uint32 old_offset; uint32 offset_acl_size; + SEC_ACL *psa; - if (t == NULL) return False; + if (ppsa == NULL) + return False; + + psa = *ppsa; + + if(UNMARSHALLING(ps) && psa == NULL) { + /* + * This is a read and we must allocate the stuct to read into. + */ + if((psa = (SEC_ACL *)malloc(sizeof(SEC_ACL))) == NULL) + return False; + ZERO_STRUCTP(psa); + *ppsa = psa; + } prs_debug(ps, depth, desc, "sec_io_acl"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - old_offset = ps->offset; + old_offset = prs_offset(ps); - prs_uint16("revision", ps, depth, &(t->revision)); - prs_uint16_pre("size ", ps, depth, &(t->size ), &offset_acl_size); - prs_uint32("num_aces ", ps, depth, &(t->num_aces )); + if(!prs_uint16("revision", ps, depth, &psa->revision)) + return False; - if (ps->io && t->num_aces != 0) - { - /* reading */ - t->ace = (SEC_ACE*)malloc(sizeof(t->ace[0]) * t->num_aces); - ZERO_STRUCTP(t->ace); - } + if(!prs_uint16_pre("size ", ps, depth, &psa->size, &offset_acl_size)) + return False; - if (t->ace == NULL && t->num_aces != 0) - { - DEBUG(0,("INVALID ACL\n")); - ps->offset = 0xfffffffe; + if(!prs_uint32("num_aces ", ps, depth, &psa->num_aces)) return False; + + if (UNMARSHALLING(ps) && psa->num_aces != 0) { + /* reading */ + if((psa->ace_list = malloc(sizeof(psa->ace_list[0]) * psa->num_aces)) == NULL) + return False; + ZERO_STRUCTP(psa->ace_list); } - for (i = 0; i < MIN(t->num_aces, MAX_SEC_ACES); i++) - { + for (i = 0; i < psa->num_aces; i++) { fstring tmp; - slprintf(tmp, sizeof(tmp)-1, "ace[%02d]: ", i); - sec_io_ace(tmp, &t->ace[i], ps, depth); + slprintf(tmp, sizeof(tmp)-1, "ace_list[%02d]: ", i); + if(!sec_io_ace(tmp, &psa->ace_list[i], ps, depth)) + return False; } - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint16_post("size ", ps, depth, &t->size , offset_acl_size, old_offset); + if(!prs_uint16_post("size ", ps, depth, &psa->size, offset_acl_size, old_offset)) + return False; return True; } - /******************************************************************* -makes a structure + Creates a SEC_DESC structure ********************************************************************/ -int make_sec_desc(SEC_DESC *t, uint16 revision, uint16 type, + +SEC_DESC *make_sec_desc(uint16 revision, uint16 type, DOM_SID *owner_sid, DOM_SID *grp_sid, - SEC_ACL *sacl, SEC_ACL *dacl) + SEC_ACL *sacl, SEC_ACL *dacl, size_t *sec_desc_size) { + SEC_DESC *dst; uint32 offset; - t->revision = revision; - t->type = type; + *sec_desc_size = 0; + + if(( dst = (SEC_DESC *)malloc(sizeof(SEC_DESC))) == NULL) + return NULL; + + ZERO_STRUCTP(dst); + + dst->revision = revision; + dst->type = type; + + dst->off_owner_sid = 0; + dst->off_grp_sid = 0; + dst->off_sacl = 0; + dst->off_dacl = 0; + + if(owner_sid && ((dst->owner_sid = sid_dup(owner_sid)) == NULL)) + goto error_exit; - t->off_owner_sid = 0; - t->off_grp_sid = 0; - t->off_sacl = 0; - t->off_dacl = 0; + if(grp_sid && ((dst->grp_sid = sid_dup(grp_sid)) == NULL)) + goto error_exit; - t->dacl = dacl; - t->sacl = sacl; - t->owner_sid = owner_sid; - t->grp_sid = grp_sid; + if(sacl && ((dst->sacl = dup_sec_acl(sacl)) == NULL)) + goto error_exit; + if(dacl && ((dst->dacl = dup_sec_acl(dacl)) == NULL)) + goto error_exit; + offset = 0x0; - if (dacl != NULL) - { + /* + * Work out the linearization sizes. + */ + + if (dst->owner_sid != NULL) { + if (offset == 0) - { - offset = 0x14; - } - t->off_dacl = offset; - offset += dacl->size; + offset = SD_HEADER_SIZE; + + dst->off_owner_sid = offset; + offset += ((sid_size(dst->owner_sid) + 3) & ~3); } - if (sacl != NULL) - { + if (dst->grp_sid != NULL) { + if (offset == 0) - { - offset = 0x14; - } - t->off_dacl = offset; - offset += dacl->size; + offset = SD_HEADER_SIZE; + + dst->off_grp_sid = offset; + offset += ((sid_size(dst->grp_sid) + 3) & ~3); } - if (owner_sid != NULL) - { + if (dst->sacl != NULL) { + if (offset == 0) - { - offset = 0x14; - } - t->off_owner_sid = offset; - offset += sid_size(owner_sid); + offset = SD_HEADER_SIZE; + + dst->off_sacl = offset; + offset += ((sacl->size + 3) & ~3); } - if (grp_sid != NULL) - { + if (dst->dacl != NULL) { + if (offset == 0) - { - offset = 0x14; - } - t->off_grp_sid = offset; - offset += sid_size(grp_sid); + offset = SD_HEADER_SIZE; + + dst->off_dacl = offset; + offset += ((dacl->size + 3) & ~3); } - return (offset == 0) ? 0x14 : offset; + *sec_desc_size = (size_t)((offset == 0) ? SD_HEADER_SIZE : offset); + return dst; + +error_exit: + + *sec_desc_size = 0; + free_sec_desc(&dst); + return NULL; } +/******************************************************************* + Duplicate a SEC_DESC structure. +********************************************************************/ + +SEC_DESC *dup_sec_desc( SEC_DESC *src) +{ + size_t dummy; + + if(src == NULL) + return NULL; + + return make_sec_desc( src->revision, src->type, + src->owner_sid, src->grp_sid, src->sacl, + src->dacl, &dummy); +} /******************************************************************* -frees a structure + Deletes a SEC_DESC structure ********************************************************************/ -void free_sec_desc(SEC_DESC *t) + +void free_sec_desc(SEC_DESC **ppsd) { - if (t->dacl != NULL) - { - free_sec_acl(t->dacl); - } + SEC_DESC *psd; - if (t->sacl != NULL) - { - free_sec_acl(t->dacl); + if(ppsd == NULL || *ppsd == NULL) + return; - } + psd = *ppsd; - if (t->owner_sid != NULL) - { - free(t->owner_sid); - } + free_sec_acl(&psd->dacl); + free_sec_acl(&psd->dacl); + free(psd->owner_sid); + free(psd->grp_sid); + free(psd); + *ppsd = NULL; +} - if (t->grp_sid != NULL) - { - free(t->grp_sid); - } +/******************************************************************* + Creates a SEC_DESC structure with typical defaults. +********************************************************************/ + +SEC_DESC *make_standard_sec_desc(DOM_SID *owner_sid, DOM_SID *grp_sid, + SEC_ACL *dacl, size_t *sec_desc_size) +{ + return make_sec_desc(1, SEC_DESC_SELF_RELATIVE|SEC_DESC_DACL_PRESENT, + owner_sid, grp_sid, NULL, dacl, sec_desc_size); } /******************************************************************* -reads or writes a structure. + Reads or writes a SEC_DESC structure. + If reading and the *ppsd = NULL, allocates the structure. ********************************************************************/ -static BOOL sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth) + +BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) { -#if 0 - uint32 off_owner_sid; - uint32 off_grp_sid ; - uint32 off_sacl ; - uint32 off_dacl ; -#endif uint32 old_offset; uint32 max_offset = 0; /* after we're done, move offset to end */ + SEC_DESC *psd; + + if (ppsd == NULL) + return False; - if (t == NULL) return False; + psd = *ppsd; + + if(UNMARSHALLING(ps) && psd == NULL) { + if((psd = (SEC_DESC *)malloc(sizeof(SEC_DESC))) == NULL) + return False; + ZERO_STRUCTP(psd); + *ppsd = psd; + } prs_debug(ps, depth, desc, "sec_io_desc"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; /* start of security descriptor stored for back-calc offset purposes */ - old_offset = ps->offset; - - prs_uint16("revision ", ps, depth, &(t->revision )); - prs_uint16("type ", ps, depth, &(t->type )); - - prs_uint32("off_owner_sid", ps, depth, &(t->off_owner_sid)); - prs_uint32("off_grp_sid ", ps, depth, &(t->off_grp_sid )); - prs_uint32("off_sacl ", ps, depth, &(t->off_sacl )); - prs_uint32("off_dacl ", ps, depth, &(t->off_dacl )); -#if 0 - prs_uint32_pre("off_owner_sid", ps, depth, &(t->off_owner_sid), &off_owner_sid); - prs_uint32_pre("off_grp_sid ", ps, depth, &(t->off_grp_sid ), &off_grp_sid ); - prs_uint32_pre("off_sacl ", ps, depth, &(t->off_sacl ), &off_sacl ); - prs_uint32_pre("off_dacl ", ps, depth, &(t->off_dacl ), &off_dacl ); -#endif - max_offset = MAX(max_offset, ps->offset); - - if (IS_BITS_SET_ALL(t->type, SEC_DESC_DACL_PRESENT)) - { -#if 0 - prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , ps->offset - old_offset); -#endif - ps->offset = old_offset + t->off_dacl; - if (ps->io) - { - /* reading */ - t->dacl = (SEC_ACL*)malloc(sizeof(*t->dacl)); - ZERO_STRUCTP(t->dacl); - } + old_offset = prs_offset(ps); - if (t->dacl == NULL) - { - DEBUG(0,("INVALID DACL\n")); - ps->offset = 0xfffffffe; - return False; - } + if(!prs_uint16("revision ", ps, depth, &psd->revision)) + return False; - sec_io_acl ("dacl" , t->dacl , ps, depth); - prs_align(ps); - } -#if 0 - else - { - prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl ), off_dacl , 0); - } -#endif - - max_offset = MAX(max_offset, ps->offset); - - if (IS_BITS_SET_ALL(t->type, SEC_DESC_SACL_PRESENT)) - { -#if 0 - prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , ps->offset - old_offset); -#endif - ps->offset = old_offset + t->off_sacl; - if (ps->io) - { - /* reading */ - t->sacl = (SEC_ACL*)malloc(sizeof(*t->sacl)); - ZERO_STRUCTP(t->sacl); - } + if(!prs_uint16("type ", ps, depth, &psd->type)) + return False; - if (t->sacl == NULL) - { - DEBUG(0,("INVALID SACL\n")); - ps->offset = 0xfffffffe; - return False; - } + if(!prs_uint32("off_owner_sid", ps, depth, &psd->off_owner_sid)) + return False; - sec_io_acl ("sacl" , t->sacl , ps, depth); - prs_align(ps); - } -#if 0 - else - { - prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl ), off_sacl , 0); - } -#endif - - max_offset = MAX(max_offset, ps->offset); - -#if 0 - prs_uint32_post("off_owner_sid", ps, depth, &(t->off_owner_sid), off_owner_sid, ps->offset - old_offset); -#endif - if (t->off_owner_sid != 0) - { - if (ps->io) - { - ps->offset = old_offset + t->off_owner_sid; - } - if (ps->io) - { + if(!prs_uint32("off_grp_sid ", ps, depth, &psd->off_grp_sid)) + return False; + + if(!prs_uint32("off_sacl ", ps, depth, &psd->off_sacl)) + return False; + + if(!prs_uint32("off_dacl ", ps, depth, &psd->off_dacl)) + return False; + + max_offset = MAX(max_offset, prs_offset(ps)); + + if (psd->off_owner_sid != 0) { + + if (UNMARSHALLING(ps)) { + if(!prs_set_offset(ps, old_offset + psd->off_owner_sid)) + return False; /* reading */ - t->owner_sid = (DOM_SID*)malloc(sizeof(*t->owner_sid)); - ZERO_STRUCTP(t->owner_sid); + if((psd->owner_sid = malloc(sizeof(*psd->owner_sid))) == NULL) + return False; + ZERO_STRUCTP(psd->owner_sid); } - if (t->owner_sid == NULL) - { - DEBUG(0,("INVALID OWNER SID\n")); - ps->offset = 0xfffffffe; + if(!smb_io_dom_sid("owner_sid ", psd->owner_sid , ps, depth)) + return False; + if(!prs_align(ps)) return False; - } - - smb_io_dom_sid("owner_sid ", t->owner_sid , ps, depth); - prs_align(ps); } - max_offset = MAX(max_offset, ps->offset); + max_offset = MAX(max_offset, prs_offset(ps)); -#if 0 - prs_uint32_post("off_grp_sid ", ps, depth, &(t->off_grp_sid ), off_grp_sid , ps->offset - old_offset); -#endif - if (t->off_grp_sid != 0) - { - if (ps->io) - { - ps->offset = old_offset + t->off_grp_sid; + if (psd->off_grp_sid != 0) { - } - if (ps->io) - { + if (UNMARSHALLING(ps)) { /* reading */ - t->grp_sid = (DOM_SID*)malloc(sizeof(*t->grp_sid)); - ZERO_STRUCTP(t->grp_sid); + if(!prs_set_offset(ps, old_offset + psd->off_grp_sid)) + return False; + if((psd->grp_sid = malloc(sizeof(*psd->grp_sid))) == NULL) + return False; + ZERO_STRUCTP(psd->grp_sid); } - if (t->grp_sid == NULL) - { - DEBUG(0,("INVALID GROUP SID\n")); - ps->offset = 0xfffffffe; + if(!smb_io_dom_sid("grp_sid", psd->grp_sid, ps, depth)) return False; - } + if(!prs_align(ps)) + return False; + } + + max_offset = MAX(max_offset, prs_offset(ps)); - smb_io_dom_sid("grp_sid", t->grp_sid, ps, depth); - prs_align(ps); + if (IS_BITS_SET_ALL(psd->type, SEC_DESC_SACL_PRESENT) && psd->off_sacl) { + if(!prs_set_offset(ps, old_offset + psd->off_sacl)) + return False; + if(!sec_io_acl("sacl", &psd->sacl, ps, depth)) + return False; + if(!prs_align(ps)) + return False; } - max_offset = MAX(max_offset, ps->offset); + max_offset = MAX(max_offset, prs_offset(ps)); + + if (IS_BITS_SET_ALL(psd->type, SEC_DESC_DACL_PRESENT) && psd->off_dacl != 0) { + if(!prs_set_offset(ps, old_offset + psd->off_dacl)) + return False; + if(!sec_io_acl("dacl", &psd->dacl, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + } - ps->offset = max_offset; + max_offset = MAX(max_offset, prs_offset(ps)); + if(!prs_set_offset(ps, max_offset)) + return False; return True; } /******************************************************************* -creates a SEC_DESC_BUF structure. + Creates a SEC_DESC_BUF structure. ********************************************************************/ -BOOL make_sec_desc_buf(SEC_DESC_BUF *buf, int len, SEC_DESC *data) + +SEC_DESC_BUF *make_sec_desc_buf(int len, SEC_DESC *sec_desc) { - ZERO_STRUCTP(buf); + SEC_DESC_BUF *dst; + + if((dst = (SEC_DESC_BUF *)malloc(sizeof(SEC_DESC_BUF))) == NULL) + return NULL; + + ZERO_STRUCTP(dst); /* max buffer size (allocated size) */ - buf->max_len = len; - buf->undoc = 0; - buf->len = data != NULL ? len : 0; - buf->sec = data; + dst->max_len = len; + dst->len = len; - return True; + if(sec_desc && ((dst->sec = dup_sec_desc(sec_desc)) == NULL)) { + free_sec_desc_buf(&dst); + return NULL; + } + + return dst; } /******************************************************************* -frees a SEC_DESC_BUF structure. + Duplicates a SEC_DESC_BUF structure. ********************************************************************/ -void free_sec_desc_buf(SEC_DESC_BUF *buf) + +SEC_DESC_BUF *dup_sec_desc_buf(SEC_DESC_BUF *src) { - if (buf->sec != NULL) - { - free_sec_desc(buf->sec); - free(buf->sec); - } + if(src == NULL) + return NULL; + + return make_sec_desc_buf( src->len, src->sec); +} + +/******************************************************************* + Deletes a SEC_DESC_BUF structure. +********************************************************************/ + +void free_sec_desc_buf(SEC_DESC_BUF **ppsdb) +{ + SEC_DESC_BUF *psdb; + + if(ppsdb == NULL || *ppsdb == NULL) + return; + + psdb = *ppsdb; + free_sec_desc(&psdb->sec); + free(psdb); + *ppsdb = NULL; } /******************************************************************* -reads or writes a SEC_DESC_BUF structure. + Reads or writes a SEC_DESC_BUF structure. ********************************************************************/ -BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth) + +BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth) { uint32 off_len; uint32 off_max_len; uint32 old_offset; uint32 size; + SEC_DESC_BUF *psdb; + + if (ppsdb == NULL) + return False; - if (sec == NULL) return False; + psdb = *ppsdb; + + if (UNMARSHALLING(ps) && psdb == NULL) { + if((psdb = (SEC_DESC_BUF *)malloc(sizeof(SEC_DESC_BUF))) == NULL) + return False; + ZERO_STRUCTP(psdb); + *ppsdb = psdb; + } prs_debug(ps, depth, desc, "sec_io_desc_buf"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32_pre("max_len", ps, depth, &(sec->max_len), &off_max_len); - prs_uint32 ("undoc ", ps, depth, &(sec->undoc )); - prs_uint32_pre("len ", ps, depth, &(sec->len ), &off_len); + if(!prs_uint32_pre("max_len", ps, depth, &psdb->max_len, &off_max_len)) + return False; - old_offset = ps->offset; + if(!prs_uint32 ("undoc ", ps, depth, &psdb->undoc)) + return False; - if (sec->len != 0 && ps->io) - { - /* reading */ - sec->sec = (SEC_DESC*)malloc(sizeof(*sec->sec)); - ZERO_STRUCTP(sec->sec); + if(!prs_uint32_pre("len ", ps, depth, &psdb->len, &off_len)) + return False; - if (sec->sec == NULL) - { - DEBUG(0,("INVALID SEC_DESC\n")); - ps->offset = 0xfffffffe; - return False; - } - } + old_offset = prs_offset(ps); /* reading, length is non-zero; writing, descriptor is non-NULL */ - if ((sec->len != 0 || (!ps->io)) && sec->sec != NULL) - { - sec_io_desc("sec ", sec->sec, ps, depth); + if ((psdb->len != 0 || MARSHALLING(ps)) && psdb->sec != NULL) { + if(!sec_io_desc("sec ", &psdb->sec, ps, depth)) + return False; } - prs_align(ps); - - size = ps->offset - old_offset; - prs_uint32_post("max_len", ps, depth, &(sec->max_len), off_max_len, size == 0 ? sec->max_len : size + 8); - prs_uint32_post("len ", ps, depth, &(sec->len ), off_len , size == 0 ? 0 : size + 8); + size = prs_offset(ps) - old_offset; + if(!prs_uint32_post("max_len", ps, depth, &psdb->max_len, off_max_len, size == 0 ? psdb->max_len : size)) + return False; + + if(!prs_uint32_post("len ", ps, depth, &psdb->len, off_len, size)) + return False; return True; } - diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 63d27c8c91..8997b05e0b 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -3,9 +3,10 @@ * Unix SMB/Netbios implementation. * Version 1.9. * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1999, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, - * Copyright (C) Paul Ashton 1997-1999. + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. + * Copyright (C) Jeremy Allison 1999. * * 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 @@ -27,39 +28,37 @@ extern int DEBUGLEVEL; - /******************************************************************* - makes a SH_INFO_1_STR structure + Inits a SH_INFO_1_STR structure ********************************************************************/ -BOOL make_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark) -{ - if (sh1 == NULL) return False; - - DEBUG(5,("make_srv_share_info1_str\n")); - make_unistr2(&(sh1->uni_netname), net_name, strlen(net_name)+1); - make_unistr2(&(sh1->uni_remark ), remark , strlen(remark )+1); +void init_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark) +{ + DEBUG(5,("init_srv_share_info1_str\n")); - return True; + init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1); + init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1); } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth) + +static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth) { - if (sh1 == NULL) return False; + if (sh1 == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_share_info1_str"); depth++; - prs_align(ps); - - smb_io_unistr2("", &(sh1->uni_netname), True, ps, depth); - prs_align(ps); - smb_io_unistr2("", &(sh1->uni_remark ), True, ps, depth); - prs_align(ps); + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth)) + return False; + if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth)) + return False; return True; } @@ -67,940 +66,768 @@ static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct * /******************************************************************* makes a SH_INFO_1 structure ********************************************************************/ -BOOL make_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark) -{ - if (sh1 == NULL) return False; - DEBUG(5,("make_srv_share_info1: %s %8x %s\n", net_name, type, remark)); +void init_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark) +{ + DEBUG(5,("init_srv_share_info1: %s %8x %s\n", net_name, type, remark)); - sh1->ptr_netname = net_name != NULL ? 1 : 0; + sh1->ptr_netname = (net_name != NULL) ? 1 : 0; sh1->type = type; - sh1->ptr_remark = remark != NULL ? 1 : 0; - - return True; + sh1->ptr_remark = (remark != NULL) ? 1 : 0; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) + +static BOOL srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) { - if (sh1 == NULL) return False; + if (sh1 == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_share_info1"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr_netname", ps, depth, &(sh1->ptr_netname)); - prs_uint32("type ", ps, depth, &(sh1->type )); - prs_uint32("ptr_remark ", ps, depth, &(sh1->ptr_remark)); + if(!prs_uint32("ptr_netname", ps, depth, &sh1->ptr_netname)) + return False; + if(!prs_uint32("type ", ps, depth, &sh1->type)) + return False; + if(!prs_uint32("ptr_remark ", ps, depth, &sh1->ptr_remark)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Inits a SH_INFO_2_STR structure ********************************************************************/ -static BOOL srv_io_srv_share_info_1(char *desc, SRV_SHARE_INFO_1 *ctr, prs_struct *ps, int depth) -{ - if (ctr == NULL) return False; - - prs_debug(ps, depth, desc, "srv_io_share_1_ctr"); - depth++; - - prs_align(ps); - - prs_uint32("num_entries_read", ps, depth, &(ctr->num_entries_read)); - prs_uint32("ptr_share_info", ps, depth, &(ctr->ptr_share_info)); - if (ctr->ptr_share_info != 0) - { - uint32 i; - uint32 num_entries = ctr->num_entries_read; - if (num_entries > MAX_SHARE_ENTRIES) - { - num_entries = MAX_SHARE_ENTRIES; /* report this! */ - } - - prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2)); - - SMB_ASSERT_ARRAY(ctr->info_1, num_entries); - - for (i = 0; i < num_entries; i++) - { - srv_io_share_info1("", &(ctr->info_1[i]), ps, depth); - } - - for (i = 0; i < num_entries; i++) - { - srv_io_share_info1_str("", &(ctr->info_1_str[i]), ps, depth); - } - - prs_align(ps); - } - - return True; -} - -/******************************************************************* - makes a SH_INFO_2_STR structure -********************************************************************/ -BOOL make_srv_share_info2_str(SH_INFO_2_STR *sh2, +void init_srv_share_info2_str(SH_INFO_2_STR *sh2, char *net_name, char *remark, - char *path, char *pass) + char *path, char *passwd) { - if (sh2 == NULL) return False; - - DEBUG(5,("make_srv_share_info2_str\n")); - - make_unistr2(&(sh2->uni_netname), net_name, strlen(net_name)+1); - make_unistr2(&(sh2->uni_remark ), remark , strlen(remark )+1); - make_unistr2(&(sh2->uni_path ), path , strlen(path )+1); - make_unistr2(&(sh2->uni_passwd ), pass , strlen(pass )+1); + DEBUG(5,("init_srv_share_info2_str\n")); - return True; + init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1); + init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh2->uni_path, path, strlen(path)+1); + init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1); } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2_STR *ss2, SH_INFO_2 *sh2, prs_struct *ps, int depth) + +static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) { - if (ss2 == NULL) return False; + if (sh2 == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_share_info2_str"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_unistr2("", &(ss2->uni_netname), sh2->ptr_netname, ps, depth); - prs_align(ps); - smb_io_unistr2("", &(ss2->uni_remark ), sh2->ptr_remark , ps, depth); - prs_align(ps); - smb_io_unistr2("", &(ss2->uni_path ), sh2->ptr_path , ps, depth); - prs_align(ps); - smb_io_unistr2("", &(ss2->uni_passwd ), sh2->ptr_passwd , ps, depth); - prs_align(ps); + if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth)) + return False; + if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth)) + return False; + if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth)) + return False; + if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth)) + return False; return True; } /******************************************************************* - makes a SH_INFO_2 structure + Inits a SH_INFO_2 structure ********************************************************************/ -BOOL make_srv_share_info2(SH_INFO_2 *sh2, + +void init_srv_share_info2(SH_INFO_2 *sh2, char *net_name, uint32 type, char *remark, uint32 perms, uint32 max_uses, uint32 num_uses, - char *path, char *pass) + char *path, char *passwd) { - if (sh2 == NULL) return False; - - DEBUG(5,("make_srv_share_info2: %s %8x %s\n", net_name, type, remark)); + DEBUG(5,("init_srv_share_info2: %s %8x %s\n", net_name, type, remark)); - sh2->ptr_netname = net_name != NULL ? 1 : 0; + sh2->ptr_netname = (net_name != NULL) ? 1 : 0; sh2->type = type; - sh2->ptr_remark = remark != NULL ? 1 : 0; + sh2->ptr_remark = (remark != NULL) ? 1 : 0; sh2->perms = perms; sh2->max_uses = max_uses; sh2->num_uses = num_uses; sh2->type = type; - sh2->ptr_path = path != NULL ? 1 : 0; - sh2->ptr_passwd = pass != NULL ? 1 : 0; - - return True; + sh2->ptr_path = (path != NULL) ? 1 : 0; + sh2->ptr_passwd = (passwd != NULL) ? 1 : 0; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) + +static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) { - if (sh2 == NULL) return False; + if (sh2 == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_share_info2"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr_netname", ps, depth, &(sh2->ptr_netname)); - prs_uint32("type ", ps, depth, &(sh2->type )); - prs_uint32("ptr_remark ", ps, depth, &(sh2->ptr_remark )); - prs_uint32("perms ", ps, depth, &(sh2->perms )); - prs_uint32("max_uses ", ps, depth, &(sh2->max_uses )); - prs_uint32("num_uses ", ps, depth, &(sh2->num_uses )); - prs_uint32("ptr_path ", ps, depth, &(sh2->ptr_path )); - prs_uint32("ptr_passwd ", ps, depth, &(sh2->ptr_passwd )); + if(!prs_uint32("ptr_netname", ps, depth, &sh2->ptr_netname)) + return False; + if(!prs_uint32("type ", ps, depth, &sh2->type)) + return False; + if(!prs_uint32("ptr_remark ", ps, depth, &sh2->ptr_remark)) + return False; + if(!prs_uint32("perms ", ps, depth, &sh2->perms)) + return False; + if(!prs_uint32("max_uses ", ps, depth, &sh2->max_uses)) + return False; + if(!prs_uint32("num_uses ", ps, depth, &sh2->num_uses)) + return False; + if(!prs_uint32("ptr_path ", ps, depth, &sh2->ptr_path)) + return False; + if(!prs_uint32("ptr_passwd ", ps, depth, &sh2->ptr_passwd)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_share_info_2(char *desc, SRV_SHARE_INFO_2 *ctr, prs_struct *ps, int depth) -{ - if (ctr == NULL) return False; - - prs_debug(ps, depth, desc, "srv_io_share_2_ctr"); - depth++; - - prs_align(ps); - - prs_uint32("num_entries_read", ps, depth, &(ctr->num_entries_read)); - prs_uint32("ptr_share_info", ps, depth, &(ctr->ptr_share_info)); - - if (ctr->ptr_share_info != 0) - { - uint32 i; - uint32 num_entries = ctr->num_entries_read; - if (num_entries > MAX_SHARE_ENTRIES) - { - num_entries = MAX_SHARE_ENTRIES; /* report this! */ - } - - prs_uint32("num_entries_read2", ps, depth, &(ctr->num_entries_read2)); - - SMB_ASSERT_ARRAY(ctr->info_2, num_entries); - - for (i = 0; i < num_entries; i++) - { - if (!srv_io_share_info2("", &(ctr->info_2[i]), ps, depth)) return False; - } - for (i = 0; i < num_entries; i++) - { - if (!srv_io_share_info2_str("", &(ctr->info_2_str[i]), &(ctr->info_2[i]), ps, depth)) return False; - } - - prs_align(ps); - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth) { - if (ctr == NULL) return False; + if (ctr == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_srv_share_ctr"); depth++; - prs_align(ps); - - prs_uint32("switch_value", ps, depth, &(ctr->switch_value)); - prs_uint32("ptr_share_ctr", ps, depth, &(ctr->ptr_share_ctr)); - - if (ctr->ptr_share_ctr != 0) - { - switch (ctr->switch_value) - { - case 2: - { - srv_io_srv_share_info_2("", &(ctr->share.info2), ps, depth); - break; - } - case 1: - { - srv_io_srv_share_info_1("", &(ctr->share.info1), ps, depth); - break; - } - default: - { - DEBUG(5,("%s no share info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); - break; - } - } + if (UNMARSHALLING(ps)) { + memset(ctr, '\0', sizeof(SRV_SHARE_INFO_CTR)); } - return True; -} + if(!prs_align(ps)) + return False; -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL make_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, - const char *srv_name, - uint32 share_level, SRV_SHARE_INFO_CTR *ctr, - uint32 preferred_len, - ENUM_HND *hnd) -{ - if (q_n == NULL || ctr == NULL || hnd == NULL) return False; - - q_n->ctr = ctr; + if(!prs_uint32("info_level", ps, depth, &ctr->info_level)) + return False; - DEBUG(5,("make_q_net_share_enum\n")); + if (ctr->info_level == 0) + return True; - make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name); + if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) + return False; + if(!prs_uint32("ptr_share_info", ps, depth, &ctr->ptr_share_info)) + return False; - q_n->share_level = share_level; - q_n->preferred_len = preferred_len; + if (ctr->ptr_share_info == 0) + return True; - memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); + if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries)) + return False; + if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries)) + return False; - return True; -} + if (ctr->ptr_entries == 0) { + if (ctr->num_entries == 0) + return True; + else + return False; + } -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) return False; + if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2)) + return False; - prs_debug(ps, depth, desc, "srv_io_q_net_share_enum"); - depth++; + if (ctr->num_entries2 != ctr->num_entries) + return False; - prs_align(ps); + switch (ctr->switch_value) { + case 1: + { + SRV_SHARE_INFO_1 *info1 = ctr->share.info1; + int num_entries = ctr->num_entries; + int i; - prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name)); - smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); + if (UNMARSHALLING(ps)) { + if (!(info1 = malloc(num_entries * sizeof(SRV_SHARE_INFO_1)))) + return False; + memset(info1, '\0', num_entries * sizeof(SRV_SHARE_INFO_1)); + ctr->share.info1 = info1; + } - prs_align(ps); + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1("", &info1[i].info_1, ps, depth)) + return False; + } - prs_uint32("share_level", ps, depth, &(q_n->share_level )); + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1_str("", &info1[i].info_1_str, ps, depth)) + return False; + } - if (((int)q_n->share_level) != -1) - { - srv_io_srv_share_ctr("share_ctr", q_n->ctr, ps, depth); + break; } - prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len)); - - smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) return False; + case 2: + { + SRV_SHARE_INFO_2 *info2 = ctr->share.info2; + int num_entries = ctr->num_entries; + int i; - prs_debug(ps, depth, desc, "srv_io_r_net_share_enum"); - depth++; + if (UNMARSHALLING(ps)) { + if (!(info2 = malloc(num_entries * sizeof(SRV_SHARE_INFO_2)))) + return False; + memset(info2, '\0', num_entries * sizeof(SRV_SHARE_INFO_2)); + ctr->share.info2 = info2; + } - prs_align(ps); + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info2("", &info2[i].info_2, ps, depth)) + return False; + } - prs_uint32("share_level", ps, depth, &(r_n->share_level)); + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info2_str("", &info2[i].info_2_str, ps, depth)) + return False; + } - if (r_n->share_level != 0) - { - srv_io_srv_share_ctr("share_ctr", r_n->ctr, ps, depth); + break; } - prs_uint32("total_entries", ps, depth, &(r_n->total_entries)); - smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); - prs_uint32("status ", ps, depth, &(r_n->status)); + default: + DEBUG(5,("%s no share info at switch_value %d\n", + tab_depth(depth), ctr->switch_value)); + break; + } return True; } /******************************************************************* - makes a SESS_INFO_0_STR structure + Frees a SRV_SHARE_INFO_CTR structure. ********************************************************************/ -BOOL make_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name) -{ - if (ss0 == NULL) return False; - DEBUG(5,("make_srv_sess_info0_str\n")); - - make_unistr2(&(ss0->uni_name), name, strlen(name)+1); - - return True; +void free_srv_share_info_ctr(SRV_SHARE_INFO_CTR *ctr) +{ + if(!ctr) + return; + if(ctr->share.info) + free(ctr->share.info); + memset(ctr, '\0', sizeof(SRV_SHARE_INFO_CTR)); } /******************************************************************* -reads or writes a structure. + Frees a SRV_Q_NET_SHARE_ENUM structure. ********************************************************************/ -static BOOL srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, -const SESS_INFO_0 *si0, prs_struct *ps, int depth) -{ - if (ss0 == NULL) return False; - - prs_debug(ps, depth, desc, "srv_io_sess_info0_str"); - depth++; - - prs_align(ps); - smb_io_unistr2("", &(ss0->uni_name), si0->ptr_name, ps, depth); - - return True; +void free_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n) +{ + if(!q_n) + return; + free_srv_share_info_ctr(&q_n->ctr); + memset(q_n, '\0', sizeof(SRV_Q_NET_SHARE_ENUM)); } /******************************************************************* - makes a SESS_INFO_0 structure + Frees a SRV_R_NET_SHARE_ENUM structure. ********************************************************************/ -BOOL make_srv_sess_info0(SESS_INFO_0 *ss0, char *name) -{ - if (ss0 == NULL) return False; - - DEBUG(5,("make_srv_sess_info0: %s\n", name)); - ss0->ptr_name = name != NULL ? 1 : 0; - - return True; +void free_srv_r_net_share_enum(SRV_R_NET_SHARE_ENUM *r_n) +{ + if(!r_n) + return; + free_srv_share_info_ctr(&r_n->ctr); + memset(r_n, '\0', sizeof(SRV_R_NET_SHARE_ENUM)); } /******************************************************************* -reads or writes a structure. + Inits a SRV_Q_NET_SHARE_ENUM structure. ********************************************************************/ -static BOOL srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth) + +void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, + char *srv_name, uint32 info_level, + uint32 preferred_len, ENUM_HND *hnd) { - if (ss0 == NULL) return False; - prs_debug(ps, depth, desc, "srv_io_sess_info0"); - depth++; + DEBUG(5,("init_q_net_share_enum\n")); - prs_align(ps); + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - prs_uint32("ptr_name", ps, depth, &(ss0->ptr_name)); + q_n->ctr.info_level = q_n->ctr.switch_value = info_level; + q_n->ctr.ptr_share_info = 0; + q_n->preferred_len = preferred_len; - return True; + memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth) + +BOOL srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth) { - if (ss0 == NULL) return False; + if (q_n == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0"); + prs_debug(ps, depth, desc, "srv_io_q_net_share_enum"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("num_entries_read", ps, depth, &(ss0->num_entries_read)); - prs_uint32("ptr_sess_info", ps, depth, &(ss0->ptr_sess_info)); + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; - if (ss0->ptr_sess_info != 0) - { - uint32 i; - uint32 num_entries = ss0->num_entries_read; - if (num_entries > MAX_SESS_ENTRIES) - { - num_entries = MAX_SESS_ENTRIES; /* report this! */ - } - - prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2)); - - SMB_ASSERT_ARRAY(ss0->info_0, num_entries); + if(!srv_io_srv_share_ctr("share_ctr", &q_n->ctr, ps, depth)) + return False; - for (i = 0; i < num_entries; i++) - { - srv_io_sess_info0("", &(ss0->info_0[i]), ps, depth); - } + if(!prs_align(ps)) + return False; - for (i = 0; i < num_entries; i++) - { - srv_io_sess_info0_str("", &(ss0->info_0_str[i]), - &(ss0->info_0[i]), - ps, depth); - } + if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) + return False; - prs_align(ps); - } + if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) + return False; return True; } /******************************************************************* - makes a SESS_INFO_1_STR structure + Reads or writes a structure. ********************************************************************/ -BOOL make_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user) -{ - if (ss1 == NULL) return False; - - DEBUG(5,("make_srv_sess_info1_str\n")); - make_unistr2(&(ss1->uni_name), name, strlen(name)+1); - make_unistr2(&(ss1->uni_user), name, strlen(user)+1); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, - SESS_INFO_1 *si1, - prs_struct *ps, int depth) +BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth) { - if (ss1 == NULL) return False; + if (r_n == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_sess_info1_str"); + prs_debug(ps, depth, desc, "srv_io_r_net_share_enum"); depth++; - prs_align(ps); + if(!srv_io_srv_share_ctr("share_ctr", &r_n->ctr, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; - smb_io_unistr2("", &(ss1->uni_name), si1->ptr_name, ps, depth); - smb_io_unistr2("", &(ss1->uni_user), si1->ptr_user, ps, depth); + if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) + return False; + if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) + return False; + if(!prs_uint32("status ", ps, depth, &r_n->status)) + return False; return True; } /******************************************************************* - makes a SESS_INFO_1 structure + Frees a SRV_Q_NET_SHARE_GET_INFO structure. ********************************************************************/ -BOOL make_srv_sess_info1(SESS_INFO_1 *ss1, - char *name, char *user, - uint32 num_opens, uint32 open_time, uint32 idle_time, - uint32 user_flags) -{ - if (ss1 == NULL) return False; - - DEBUG(5,("make_srv_sess_info1: %s\n", name)); - ss1->ptr_name = name != NULL ? 1 : 0; - ss1->ptr_user = user != NULL ? 1 : 0; - - ss1->num_opens = num_opens; - ss1->open_time = open_time; - ss1->idle_time = idle_time; - ss1->user_flags = user_flags; - - return True; +void free_srv_q_net_share_get_info(SRV_Q_NET_SHARE_GET_INFO *q_n) +{ + if(!q_n) + return; + memset(q_n, '\0', sizeof(SRV_Q_NET_SHARE_GET_INFO)); } /******************************************************************* -reads or writes a structure. + Frees a SRV_R_NET_SHARE_GET_INFO structure. ********************************************************************/ -static BOOL srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth) -{ - if (ss1 == NULL) return False; - prs_debug(ps, depth, desc, "srv_io_sess_info1"); - depth++; - - prs_align(ps); - - prs_uint32("ptr_name ", ps, depth, &(ss1->ptr_name )); - prs_uint32("ptr_user ", ps, depth, &(ss1->ptr_user )); - - prs_uint32("num_opens ", ps, depth, &(ss1->num_opens )); - prs_uint32("open_time ", ps, depth, &(ss1->open_time )); - prs_uint32("idle_time ", ps, depth, &(ss1->idle_time )); - prs_uint32("user_flags", ps, depth, &(ss1->user_flags)); - - return True; +void free_srv_r_net_share_get_info(SRV_R_NET_SHARE_GET_INFO *r_n) +{ + if(!r_n) + return; + memset(r_n, '\0', sizeof(SRV_R_NET_SHARE_GET_INFO)); } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth) + +BOOL srv_io_q_net_share_get_info(char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth) { - if (ss1 == NULL) return False; + if (q_n == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1"); + prs_debug(ps, depth, desc, "srv_io_q_net_share_get_info"); depth++; - prs_align(ps); - - prs_uint32("num_entries_read", ps, depth, &(ss1->num_entries_read)); - prs_uint32("ptr_sess_info", ps, depth, &(ss1->ptr_sess_info)); - - if (ss1->ptr_sess_info != 0) - { - uint32 i; - uint32 num_entries = ss1->num_entries_read; - if (num_entries > MAX_SESS_ENTRIES) - { - num_entries = MAX_SESS_ENTRIES; /* report this! */ - } - - prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2)); + if(!prs_align(ps)) + return False; - SMB_ASSERT_ARRAY(ss1->info_1, num_entries); + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; - for (i = 0; i < num_entries; i++) - { - srv_io_sess_info1("", &(ss1->info_1[i]), ps, depth); - } + if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth)) + return False; - for (i = 0; i < num_entries; i++) - { - srv_io_sess_info1_str("", &(ss1->info_1_str[i]), - &(ss1->info_1[i]), - ps, depth); - } + if(!prs_align(ps)) + return False; - prs_align(ps); - } + if(!prs_uint32("info_level", ps, depth, &q_n->info_level)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct *ps, int depth) + +BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth) { - if (ctr == NULL) return False; + if (r_n == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr"); + prs_debug(ps, depth, desc, "srv_io_r_net_share_get_info"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("switch_value", ps, depth, &(ctr->switch_value)); - prs_uint32("ptr_sess_ctr", ps, depth, &(ctr->ptr_sess_ctr)); + if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value )) + return False; - if (ctr->ptr_sess_ctr != 0) - { - switch (ctr->switch_value) - { - case 0: - { - srv_io_srv_sess_info_0("", &(ctr->sess.info0), ps, depth); - break; - } - case 1: - { - srv_io_srv_sess_info_1("", &(ctr->sess.info1), ps, depth); - break; - } - default: - { - DEBUG(5,("%s no session info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); - break; - } - } - } + if(!prs_uint32("ptr_share_ctr", ps, depth, &r_n->ptr_share_ctr)) + return False; - return True; -} + if (r_n->ptr_share_ctr != 0) { + switch (r_n->switch_value) { + case 1: + if(!srv_io_share_info1("", &r_n->share.info1.info_1, ps, depth)) + return False; -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL make_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, - const char *srv_name, const char *qual_name, - char *user_name, - uint32 sess_level, SRV_SESS_INFO_CTR *ctr, - uint32 preferred_len, - ENUM_HND *hnd) -{ - if (q_n == NULL || ctr == NULL || hnd == NULL) return False; + if(!srv_io_share_info1_str("", &r_n->share.info1.info_1_str, ps, depth)) + return False; - q_n->ctr = ctr; + break; + case 2: + if(!srv_io_share_info2("", &r_n->share.info2.info_2, ps, depth)) + return False; - DEBUG(5,("make_q_net_sess_enum\n")); + if(!srv_io_share_info2_str("", &r_n->share.info2.info_2_str, ps, depth)) + return False; - make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name); - make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name); - make_buf_unistr2(&(q_n->uni_user_name), &(q_n->ptr_user_name), user_name); + break; + default: + DEBUG(5,("%s no share info at switch_value %d\n", + tab_depth(depth), r_n->switch_value)); + break; + } + } - q_n->sess_level = sess_level; - q_n->preferred_len = preferred_len; + if(!prs_align(ps)) + return False; - memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); + if(!prs_uint32("status", ps, depth, &r_n->status)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Inits a SESS_INFO_0_STR structure ********************************************************************/ -BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum"); - depth++; - - prs_align(ps); - - prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name)); - smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); - - prs_align(ps); - - prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name)); - smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth); - prs_align(ps); - - prs_uint32("ptr_user_name", ps, depth, &(q_n->ptr_user_name)); - smb_io_unistr2("", &(q_n->uni_user_name), q_n->ptr_user_name, ps, depth); - prs_align(ps); - prs_uint32("sess_level", ps, depth, &(q_n->sess_level )); - - if (((int)q_n->sess_level) != -1) - { - srv_io_srv_sess_ctr("sess_ctr", q_n->ctr, ps, depth); - } - - prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len)); - - smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); +void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name) +{ + DEBUG(5,("init_srv_sess_info0_str\n")); - return True; + init_unistr2(&ss0->uni_name, name, strlen(name)+1); } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth) + +static BOOL srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth) { - if (r_n == NULL) return False; + if (ss0 == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum"); + prs_debug(ps, depth, desc, "srv_io_sess_info0_str"); depth++; - prs_align(ps); - - prs_uint32("sess_level", ps, depth, &(r_n->sess_level)); - - if (((int)r_n->sess_level) != -1) - { - srv_io_srv_sess_ctr("sess_ctr", r_n->ctr, ps, depth); - } + if(!prs_align(ps)) + return False; - prs_uint32("total_entries", ps, depth, &(r_n->total_entries)); - smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); - prs_uint32("status ", ps, depth, &(r_n->status)); + if(!smb_io_unistr2("", &ss0->uni_name, True, ps, depth)) + return False; return True; } /******************************************************************* - makes a CONN_INFO_0 structure + Inits a SESS_INFO_0 structure ********************************************************************/ -BOOL make_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id) -{ - if (ss0 == NULL) return False; - - DEBUG(5,("make_srv_conn_info0\n")); - ss0->id = id; +void init_srv_sess_info0(SESS_INFO_0 *ss0, char *name) +{ + DEBUG(5,("init_srv_sess_info0: %s\n", name)); - return True; + ss0->ptr_name = (name != NULL) ? 1 : 0; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth) + +static BOOL srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth) { - if (ss0 == NULL) return False; + if (ss0 == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_conn_info0"); + prs_debug(ps, depth, desc, "srv_io_sess_info0"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("id", ps, depth, &(ss0->id)); + if(!prs_uint32("ptr_name", ps, depth, &ss0->ptr_name)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth) + +static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth) { - if (ss0 == NULL) return False; + if (ss0 == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0"); + prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("num_entries_read", ps, depth, &(ss0->num_entries_read)); - prs_uint32("ptr_conn_info", ps, depth, &(ss0->ptr_conn_info)); + if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read)) + return False; + if(!prs_uint32("ptr_sess_info", ps, depth, &ss0->ptr_sess_info)) + return False; - if (ss0->ptr_conn_info != 0) - { - uint32 i; - uint32 num_entries = ss0->num_entries_read; - if (num_entries > MAX_CONN_ENTRIES) - { - num_entries = MAX_CONN_ENTRIES; /* report this! */ + if (ss0->ptr_sess_info != 0) { + int i; + int num_entries = ss0->num_entries_read; + + if (num_entries > MAX_SESS_ENTRIES) { + num_entries = MAX_SESS_ENTRIES; /* report this! */ } - prs_uint32("num_entries_read2", ps, depth, &(ss0->num_entries_read2)); + if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2)) + return False; + + SMB_ASSERT_ARRAY(ss0->info_0, num_entries); + + for (i = 0; i < num_entries; i++) { + if(!srv_io_sess_info0("", &ss0->info_0[i], ps, depth)) + return False; + } - for (i = 0; i < num_entries; i++) - { - srv_io_conn_info0("", &(ss0->info_0[i]), ps, depth); + for (i = 0; i < num_entries; i++) { + if(!srv_io_sess_info0_str("", &ss0->info_0_str[i], ps, depth)) + return False; } - prs_align(ps); + if(!prs_align(ps)) + return False; } return True; } /******************************************************************* - makes a CONN_INFO_1_STR structure + Inits a SESS_INFO_1_STR structure ********************************************************************/ -BOOL make_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name) -{ - if (ss1 == NULL) return False; - DEBUG(5,("make_srv_conn_info1_str\n")); - - make_unistr2(&(ss1->uni_usr_name), usr_name, strlen(usr_name)+1); - make_unistr2(&(ss1->uni_net_name), net_name, strlen(net_name)+1); +void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user) +{ + DEBUG(5,("init_srv_sess_info1_str\n")); - return True; + init_unistr2(&ss1->uni_name, name, strlen(name)+1); + init_unistr2(&ss1->uni_user, name, strlen(user)+1); } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, - CONN_INFO_1 *ci1, prs_struct *ps, int depth) + +static BOOL srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth) { - if (ss1 == NULL) return False; + if (ss1 == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_conn_info1_str"); + prs_debug(ps, depth, desc, "srv_io_sess_info1_str"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_unistr2("", &(ss1->uni_usr_name), ci1->ptr_usr_name, ps, depth); - smb_io_unistr2("", &(ss1->uni_net_name), ci1->ptr_net_name, ps, depth); + if(!smb_io_unistr2("", &ss1->uni_name, True, ps, depth)) + return False; + if(!smb_io_unistr2("", &(ss1->uni_user), True, ps, depth)) + return False; return True; } /******************************************************************* - makes a CONN_INFO_1 structure + Inits a SESS_INFO_1 structure ********************************************************************/ -BOOL make_srv_conn_info1(CONN_INFO_1 *ss1, - uint32 id, uint32 type, - uint32 num_opens, uint32 num_users, uint32 open_time, - char *usr_name, char *net_name) -{ - if (ss1 == NULL) return False; - - DEBUG(5,("make_srv_conn_info1: %s %s\n", usr_name, net_name)); - ss1->id = id ; - ss1->type = type ; - ss1->num_opens = num_opens ; - ss1->num_users = num_users; - ss1->open_time = open_time; +void init_srv_sess_info1(SESS_INFO_1 *ss1, + char *name, char *user, + uint32 num_opens, uint32 open_time, uint32 idle_time, + uint32 user_flags) +{ + DEBUG(5,("init_srv_sess_info1: %s\n", name)); - ss1->ptr_usr_name = usr_name != NULL ? 1 : 0; - ss1->ptr_net_name = net_name != NULL ? 1 : 0; + ss1->ptr_name = (name != NULL) ? 1 : 0; + ss1->ptr_user = (user != NULL) ? 1 : 0; - return True; + ss1->num_opens = num_opens; + ss1->open_time = open_time; + ss1->idle_time = idle_time; + ss1->user_flags = user_flags; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth) + +static BOOL srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth) { - if (ss1 == NULL) return False; + if (ss1 == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_conn_info1"); + prs_debug(ps, depth, desc, "srv_io_sess_info1"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("id ", ps, depth, &(ss1->id )); - prs_uint32("type ", ps, depth, &(ss1->type )); - prs_uint32("num_opens ", ps, depth, &(ss1->num_opens )); - prs_uint32("num_users ", ps, depth, &(ss1->num_users )); - prs_uint32("open_time ", ps, depth, &(ss1->open_time )); + if(!prs_uint32("ptr_name ", ps, depth, &ss1->ptr_name)) + return False; + if(!prs_uint32("ptr_user ", ps, depth, &ss1->ptr_user)) + return False; - prs_uint32("ptr_usr_name", ps, depth, &(ss1->ptr_usr_name)); - prs_uint32("ptr_net_name", ps, depth, &(ss1->ptr_net_name)); + if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens)) + return False; + if(!prs_uint32("open_time ", ps, depth, &ss1->open_time)) + return False; + if(!prs_uint32("idle_time ", ps, depth, &ss1->idle_time)) + return False; + if(!prs_uint32("user_flags", ps, depth, &ss1->user_flags)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth) + +static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth) { - if (ss1 == NULL) return False; + if (ss1 == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1"); + prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("num_entries_read", ps, depth, &(ss1->num_entries_read)); - prs_uint32("ptr_conn_info", ps, depth, &(ss1->ptr_conn_info)); + if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read)) + return False; + if(!prs_uint32("ptr_sess_info", ps, depth, &ss1->ptr_sess_info)) + return False; - if (ss1->ptr_conn_info != 0) - { - uint32 i; - uint32 num_entries = ss1->num_entries_read; - if (num_entries > MAX_CONN_ENTRIES) - { - num_entries = MAX_CONN_ENTRIES; /* report this! */ + if (ss1->ptr_sess_info != 0) { + int i; + int num_entries = ss1->num_entries_read; + + if (num_entries > MAX_SESS_ENTRIES) { + num_entries = MAX_SESS_ENTRIES; /* report this! */ } - prs_uint32("num_entries_read2", ps, depth, &(ss1->num_entries_read2)); + if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2)) + return False; - for (i = 0; i < num_entries; i++) - { - srv_io_conn_info1("", &(ss1->info_1[i]), ps, depth); + SMB_ASSERT_ARRAY(ss1->info_1, num_entries); + + for (i = 0; i < num_entries; i++) { + if(!srv_io_sess_info1("", &ss1->info_1[i], ps, depth)) + return False; } - for (i = 0; i < num_entries; i++) - { - srv_io_conn_info1_str("", &(ss1->info_1_str[i]), - &(ss1->info_1[i]), - ps, depth); + for (i = 0; i < num_entries; i++) { + if(!srv_io_sess_info1_str("", &ss1->info_1_str[i], ps, depth)) + return False; } - prs_align(ps); + if(!prs_align(ps)) + return False; } return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct *ps, int depth) + +static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct *ps, int depth) { - if (ctr == NULL) return False; + if (ctr == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr"); + prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("switch_value", ps, depth, &(ctr->switch_value)); - prs_uint32("ptr_conn_ctr", ps, depth, &(ctr->ptr_conn_ctr)); + if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) + return False; + if(!prs_uint32("ptr_sess_ctr", ps, depth, &ctr->ptr_sess_ctr)) + return False; - if (ctr->ptr_conn_ctr != 0) - { - switch (ctr->switch_value) - { - case 0: - { - srv_io_srv_conn_info_0("", &(ctr->conn.info0), ps, depth); - break; - } - case 1: - { - srv_io_srv_conn_info_1("", &(ctr->conn.info1), ps, depth); - break; - } - default: - { - DEBUG(5,("%s no connection info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); - break; - } + if (ctr->ptr_sess_ctr != 0) { + switch (ctr->switch_value) { + case 0: + if(!srv_io_srv_sess_info_0("", &ctr->sess.info0, ps, depth)) + return False; + break; + case 1: + if(!srv_io_srv_sess_info_1("", &ctr->sess.info1, ps, depth)) + return False; + break; + default: + DEBUG(5,("%s no session info at switch_value %d\n", + tab_depth(depth), ctr->switch_value)); + break; } } @@ -1008,540 +835,626 @@ static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct } /******************************************************************* -reads or writes a structure. + Inits a SRV_Q_NET_SESS_ENUM structure. ********************************************************************/ -BOOL make_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, - const char *srv_name, const char *qual_name, - uint32 conn_level, SRV_CONN_INFO_CTR *ctr, + +void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, + char *srv_name, char *qual_name, + uint32 sess_level, SRV_SESS_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) { - if (q_n == NULL || ctr == NULL || hnd == NULL) return False; - q_n->ctr = ctr; - DEBUG(5,("make_q_net_conn_enum\n")); + DEBUG(5,("init_q_net_sess_enum\n")); - make_buf_unistr2(&(q_n->uni_srv_name ), &(q_n->ptr_srv_name ), srv_name ); - make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name); + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); + init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name); - q_n->conn_level = conn_level; + q_n->sess_level = sess_level; q_n->preferred_len = preferred_len; - memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); - - return True; + memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth) + +BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth) { - if (q_n == NULL) return False; + if (q_n == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum"); + prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name)); - smb_io_unistr2("", &(q_n->uni_srv_name), q_n->ptr_srv_name, ps, depth); + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name)); - smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth); + if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("conn_level", ps, depth, &(q_n->conn_level )); + if(!prs_uint32("sess_level", ps, depth, &q_n->sess_level)) + return False; - if (((int)q_n->conn_level) != -1) - { - srv_io_srv_conn_ctr("conn_ctr", q_n->ctr, ps, depth); + if (q_n->sess_level != -1) { + if(!srv_io_srv_sess_ctr("sess_ctr", q_n->ctr, ps, depth)) + return False; } - prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len)); + if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) + return False; - smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); + if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth) + +BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth) { - if (r_n == NULL) return False; + if (r_n == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum"); + prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("conn_level", ps, depth, &(r_n->conn_level)); + if(!prs_uint32("sess_level", ps, depth, &r_n->sess_level)) + return False; - if (((int)r_n->conn_level) != -1) - { - srv_io_srv_conn_ctr("conn_ctr", r_n->ctr, ps, depth); + if (r_n->sess_level != -1) { + if(!srv_io_srv_sess_ctr("sess_ctr", r_n->ctr, ps, depth)) + return False; } - prs_uint32("total_entries", ps, depth, &(r_n->total_entries)); - smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); - prs_uint32("status ", ps, depth, &(r_n->status)); + if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) + return False; + if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) + return False; + if(!prs_uint32("status ", ps, depth, &r_n->status)) + return False; return True; } /******************************************************************* - makes a TPRT_INFO_0_STR structure + Inits a CONN_INFO_0 structure ********************************************************************/ -BOOL make_srv_tprt_info0_str(TPRT_INFO_0_STR *tp0, - char *trans_name, - char *trans_addr, uint32 trans_addr_len, - char *addr_name) -{ - if (tp0 == NULL) return False; - - DEBUG(5,("make_srv_tprt_info0_str\n")); - make_unistr2(&(tp0->uni_trans_name), trans_name, strlen(trans_name)+1); - make_buffer4_str(&(tp0->buf_trans_addr), trans_addr, trans_addr_len); - make_unistr2(&(tp0->uni_addr_name ), addr_name, strlen(addr_name)+1); +void init_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id) +{ + DEBUG(5,("init_srv_conn_info0\n")); - return True; + ss0->id = id; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_tprt_info0_str(char *desc, TPRT_INFO_0_STR *tp0, - TPRT_INFO_0 *ti0, - prs_struct *ps, int depth) + +static BOOL srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth) { - if (tp0 == NULL) return False; + if (ss0 == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_tprt_info0_str"); + prs_debug(ps, depth, desc, "srv_io_conn_info0"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_unistr2("", &(tp0->uni_trans_name), ti0->ptr_trans_name, ps, depth); - smb_io_buffer4("", &(tp0->buf_trans_addr), ti0->ptr_trans_addr, ps, depth); - smb_io_unistr2("", &(tp0->uni_addr_name ), ti0->ptr_addr_name, ps, depth); + if(!prs_uint32("id", ps, depth, &ss0->id)) + return False; return True; } /******************************************************************* - makes a TPRT_INFO_0 structure + Reads or writes a structure. ********************************************************************/ -BOOL make_srv_tprt_info0(TPRT_INFO_0 *tp0, - uint32 num_vcs, uint32 trans_addr_len, - char *trans_name, char *trans_addr, - char *addr_name) + +static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth) { - if (tp0 == NULL) return False; + if (ss0 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0"); + depth++; - DEBUG(5,("make_srv_tprt_info0: %s %s\n", trans_name, addr_name)); + if(!prs_align(ps)) + return False; + + if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read)) + return False; + if(!prs_uint32("ptr_conn_info", ps, depth, &ss0->ptr_conn_info)) + return False; + + if (ss0->ptr_conn_info != 0) { + int i; + int num_entries = ss0->num_entries_read; + + if (num_entries > MAX_CONN_ENTRIES) { + num_entries = MAX_CONN_ENTRIES; /* report this! */ + } + + if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2)) + return False; + + for (i = 0; i < num_entries; i++) { + if(!srv_io_conn_info0("", &ss0->info_0[i], ps, depth)) + return False; + } - tp0->num_vcs = num_vcs; - tp0->ptr_trans_name = trans_name != NULL ? 1 : 0; - tp0->ptr_trans_addr = trans_addr != NULL ? 1 : 0; - tp0->trans_addr_len = trans_addr_len; - tp0->ptr_addr_name = addr_name != NULL ? 1 : 0; + if(!prs_align(ps)) + return False; + } return True; } /******************************************************************* -reads or writes a structure. + Inits a CONN_INFO_1_STR structure ********************************************************************/ -static BOOL srv_io_tprt_info0(char *desc, TPRT_INFO_0 *tp0, prs_struct *ps, int depth) -{ - if (tp0 == NULL) return False; - prs_debug(ps, depth, desc, "srv_io_tprt_info0"); - depth++; - - prs_align(ps); - - prs_uint32("num_vcs ", ps, depth, &(tp0->num_vcs )); - prs_uint32("ptr_trans_name", ps, depth, &(tp0->ptr_trans_name)); - prs_uint32("ptr_trans_addr", ps, depth, &(tp0->ptr_trans_addr)); - prs_uint32("trans_addr_len", ps, depth, &(tp0->trans_addr_len)); - prs_uint32("ptr_addr_name ", ps, depth, &(tp0->ptr_addr_name )); +void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name) +{ + DEBUG(5,("init_srv_conn_info1_str\n")); - return True; + init_unistr2(&ss1->uni_usr_name, usr_name, strlen(usr_name)+1); + init_unistr2(&ss1->uni_net_name, net_name, strlen(net_name)+1); } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_tprt_info_0(char *desc, SRV_TPRT_INFO_0 *tp0, prs_struct *ps, int depth) + +static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth) { - if (tp0 == NULL) return False; + if (ss1 == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_srv_tprt_info_0"); + prs_debug(ps, depth, desc, "srv_io_conn_info1_str"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("num_entries_read", ps, depth, &(tp0->num_entries_read)); - prs_uint32("ptr_tprt_info", ps, depth, &(tp0->ptr_tprt_info)); + if(!smb_io_unistr2("", &ss1->uni_usr_name, True, ps, depth)) + return False; + if(!smb_io_unistr2("", &ss1->uni_net_name, True, ps, depth)) + return False; - if (tp0->ptr_tprt_info != 0) - { - uint32 i; - uint32 num_entries = tp0->num_entries_read; + return True; +} - prs_uint32("num_entries_read2", ps, depth, &(tp0->num_entries_read2)); +/******************************************************************* + Inits a CONN_INFO_1 structure +********************************************************************/ - if (ps->io) - { - /* reading */ - tp0->info_0 = (TPRT_INFO_0*)malloc(num_entries * - sizeof(tp0->info_0[0])); +void init_srv_conn_info1(CONN_INFO_1 *ss1, + uint32 id, uint32 type, + uint32 num_opens, uint32 num_users, uint32 open_time, + char *usr_name, char *net_name) +{ + DEBUG(5,("init_srv_conn_info1: %s %s\n", usr_name, net_name)); - tp0->info_0_str = (TPRT_INFO_0_STR*)malloc(num_entries * - sizeof(tp0->info_0_str[0])); + ss1->id = id ; + ss1->type = type ; + ss1->num_opens = num_opens ; + ss1->num_users = num_users; + ss1->open_time = open_time; - if (tp0->info_0 == NULL || tp0->info_0_str == NULL) - { - free_srv_tprt_info_0(tp0); - return False; - } - } + ss1->ptr_usr_name = (usr_name != NULL) ? 1 : 0; + ss1->ptr_net_name = (net_name != NULL) ? 1 : 0; +} - for (i = 0; i < num_entries; i++) - { - srv_io_tprt_info0("", &(tp0->info_0[i]), ps, depth); - } +/******************************************************************* + Reads or writes a structure. +********************************************************************/ - for (i = 0; i < num_entries; i++) - { - srv_io_tprt_info0_str("", &(tp0->info_0_str[i]), - &(tp0->info_0[i]), - ps, depth); - } +static BOOL srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth) +{ + if (ss1 == NULL) + return False; - prs_align(ps); - } + prs_debug(ps, depth, desc, "srv_io_conn_info1"); + depth++; - if (!ps->io) - { - /* writing */ - free_srv_tprt_info_0(tp0); - } + if(!prs_align(ps)) + return False; + + if(!prs_uint32("id ", ps, depth, &ss1->id)) + return False; + if(!prs_uint32("type ", ps, depth, &ss1->type)) + return False; + if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens)) + return False; + if(!prs_uint32("num_users ", ps, depth, &ss1->num_users)) + return False; + if(!prs_uint32("open_time ", ps, depth, &ss1->open_time)) + return False; + + if(!prs_uint32("ptr_usr_name", ps, depth, &ss1->ptr_usr_name)) + return False; + if(!prs_uint32("ptr_net_name", ps, depth, &ss1->ptr_net_name)) + return False; return True; } /******************************************************************* -frees a structure. + Reads or writes a structure. ********************************************************************/ -void free_srv_tprt_info_0(SRV_TPRT_INFO_0 *tp0) -{ - if (tp0->info_0 != NULL) - { - free(tp0->info_0); - tp0->info_0 = NULL; - } - if (tp0->info_0_str != NULL) - { - free(tp0->info_0_str); - tp0->info_0_str = NULL; - } -} -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL srv_io_srv_tprt_ctr(char *desc, SRV_TPRT_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth) { - if (ctr == NULL) return False; + if (ss1 == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_srv_tprt_ctr"); + prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("switch_value", ps, depth, &(ctr->switch_value)); - prs_uint32("ptr_tprt_ctr", ps, depth, &(ctr->ptr_tprt_ctr)); + if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read)) + return False; + if(!prs_uint32("ptr_conn_info", ps, depth, &ss1->ptr_conn_info)) + return False; - if (ctr->ptr_tprt_ctr != 0) - { - switch (ctr->switch_value) - { - case 0: - { - srv_io_srv_tprt_info_0("", &(ctr->tprt.info0), ps, depth); - break; - } - default: - { - DEBUG(5,("%s no transport info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); - break; - } + if (ss1->ptr_conn_info != 0) { + int i; + int num_entries = ss1->num_entries_read; + + if (num_entries > MAX_CONN_ENTRIES) { + num_entries = MAX_CONN_ENTRIES; /* report this! */ + } + + if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2)) + return False; + + for (i = 0; i < num_entries; i++) { + if(!srv_io_conn_info1("", &ss1->info_1[i], ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_conn_info1_str("", &ss1->info_1_str[i], ps, depth)) + return False; } + + if(!prs_align(ps)) + return False; } return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -void free_srv_tprt_ctr(SRV_TPRT_INFO_CTR *ctr) + +static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct *ps, int depth) { - switch (ctr->switch_value) - { + if (ctr == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) + return False; + if(!prs_uint32("ptr_conn_ctr", ps, depth, &ctr->ptr_conn_ctr)) + return False; + + if (ctr->ptr_conn_ctr != 0) { + switch (ctr->switch_value) { case 0: - { - free_srv_tprt_info_0(&(ctr->tprt.info0)); + if(!srv_io_srv_conn_info_0("", &ctr->conn.info0, ps, depth)) + return False; + break; + case 1: + if(!srv_io_srv_conn_info_1("", &ctr->conn.info1, ps, depth)) + return False; break; - } default: - { - DEBUG(5,("no transport info at switch_value %d\n", - ctr->switch_value)); + DEBUG(5,("%s no connection info at switch_value %d\n", + tab_depth(depth), ctr->switch_value)); break; } } + + return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL make_srv_q_net_tprt_enum(SRV_Q_NET_TPRT_ENUM *q_n, - const char *srv_name, - uint32 tprt_level, SRV_TPRT_INFO_CTR *ctr, + +void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, + char *srv_name, char *qual_name, + uint32 conn_level, SRV_CONN_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) { - if (q_n == NULL || ctr == NULL || hnd == NULL) return False; + DEBUG(5,("init_q_net_conn_enum\n")); q_n->ctr = ctr; - DEBUG(5,("make_q_net_tprt_enum\n")); + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name ); + init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name); - make_buf_unistr2(&(q_n->uni_srv_name ), &(q_n->ptr_srv_name ), srv_name ); - - q_n->tprt_level = tprt_level; + q_n->conn_level = conn_level; q_n->preferred_len = preferred_len; - memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); - - return True; + memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_tprt_enum(char *desc, SRV_Q_NET_TPRT_ENUM *q_n, prs_struct *ps, int depth) + +BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth) { - if (q_n == NULL) return False; + if (q_n == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_q_net_tprt_enum"); + prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, q_n->ptr_srv_name, ps, depth)) + return False; - prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name)); - smb_io_unistr2("", &(q_n->uni_srv_name), q_n->ptr_srv_name, ps, depth); + if(!prs_align(ps)) + return False; - prs_align(ps); + if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth)) + return False; - prs_uint32("tprt_level", ps, depth, &(q_n->tprt_level )); + if(!prs_align(ps)) + return False; + + if(!prs_uint32("conn_level", ps, depth, &q_n->conn_level)) + return False; - if (((int)q_n->tprt_level) != -1) - { - srv_io_srv_tprt_ctr("tprt_ctr", q_n->ctr, ps, depth); + if (q_n->conn_level != -1) { + if(!srv_io_srv_conn_ctr("conn_ctr", q_n->ctr, ps, depth)) + return False; } - prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len)); + if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) + return False; - smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); + if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_tprt_enum(char *desc, SRV_R_NET_TPRT_ENUM *r_n, prs_struct *ps, int depth) + +BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth) { - if (r_n == NULL) return False; + if (r_n == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_r_net_tprt_enum"); + prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("tprt_level", ps, depth, &(r_n->tprt_level)); + if(!prs_uint32("conn_level", ps, depth, &r_n->conn_level)) + return False; - if (((int)r_n->tprt_level) != -1) - { - srv_io_srv_tprt_ctr("tprt_ctr", r_n->ctr, ps, depth); + if (r_n->conn_level != -1) { + if(!srv_io_srv_conn_ctr("conn_ctr", r_n->ctr, ps, depth)) + return False; } - prs_uint32("total_entries", ps, depth, &(r_n->total_entries)); - smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); - prs_uint32("status ", ps, depth, &(r_n->status)); + if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) + return False; + if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) + return False; + if(!prs_uint32("status ", ps, depth, &r_n->status)) + return False; return True; } /******************************************************************* - makes a FILE_INFO_3_STR structure + Inits a FILE_INFO_3_STR structure ********************************************************************/ -BOOL make_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name) -{ - if (fi3 == NULL) return False; - DEBUG(5,("make_srv_file_info3_str\n")); - - make_unistr2(&(fi3->uni_path_name), path_name, strlen(path_name)+1); - make_unistr2(&(fi3->uni_user_name), user_name, strlen(user_name)+1); +void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name) +{ + DEBUG(5,("init_srv_file_info3_str\n")); - return True; + init_unistr2(&fi3->uni_path_name, path_name, strlen(path_name)+1); + init_unistr2(&fi3->uni_user_name, user_name, strlen(user_name)+1); } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth) + +static BOOL srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth) { - if (sh1 == NULL) return False; + if (sh1 == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_file_info3_str"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_unistr2("", &(sh1->uni_path_name), True, ps, depth); - smb_io_unistr2("", &(sh1->uni_user_name), True, ps, depth); + if(!smb_io_unistr2("", &sh1->uni_path_name, True, ps, depth)) + return False; + if(!smb_io_unistr2("", &sh1->uni_user_name, True, ps, depth)) + return False; return True; } /******************************************************************* - makes a FILE_INFO_3 structure + Inits a FILE_INFO_3 structure ********************************************************************/ -BOOL make_srv_file_info3(FILE_INFO_3 *fl3, + +void init_srv_file_info3(FILE_INFO_3 *fl3, uint32 id, uint32 perms, uint32 num_locks, char *path_name, char *user_name) { - if (fl3 == NULL) return False; - - DEBUG(5,("make_srv_file_info3: %s %s\n", path_name, user_name)); + DEBUG(5,("init_srv_file_info3: %s %s\n", path_name, user_name)); fl3->id = id; fl3->perms = perms; fl3->num_locks = num_locks; - fl3->ptr_path_name = path_name != NULL ? 1 : 0; - fl3->ptr_user_name = user_name != NULL ? 1 : 0; - - return True; + fl3->ptr_path_name = (path_name != NULL) ? 1 : 0; + fl3->ptr_user_name = (user_name != NULL) ? 1 : 0; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) + +static BOOL srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) { - if (fl3 == NULL) return False; + if (fl3 == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_file_info3"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("id ", ps, depth, &(fl3->id )); - prs_uint32("perms ", ps, depth, &(fl3->perms )); - prs_uint32("num_locks ", ps, depth, &(fl3->num_locks )); - prs_uint32("ptr_path_name", ps, depth, &(fl3->ptr_path_name)); - prs_uint32("ptr_user_name", ps, depth, &(fl3->ptr_user_name)); + if(!prs_uint32("id ", ps, depth, &fl3->id)) + return False; + if(!prs_uint32("perms ", ps, depth, &fl3->perms)) + return False; + if(!prs_uint32("num_locks ", ps, depth, &fl3->num_locks)) + return False; + if(!prs_uint32("ptr_path_name", ps, depth, &fl3->ptr_path_name)) + return False; + if(!prs_uint32("ptr_user_name", ps, depth, &fl3->ptr_user_name)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth) + +static BOOL srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth) { - if (fl3 == NULL) return False; + if (fl3 == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_file_3_fl3"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("num_entries_read", ps, depth, &(fl3->num_entries_read)); - prs_uint32("ptr_file_fl3", ps, depth, &(fl3->ptr_file_info)); - if (fl3->ptr_file_info != 0) - { - uint32 i; - uint32 num_entries = fl3->num_entries_read; + if(!prs_uint32("num_entries_read", ps, depth, &fl3->num_entries_read)) + return False; + if(!prs_uint32("ptr_file_fl3", ps, depth, &fl3->ptr_file_info)) + return False; - if (num_entries > MAX_FILE_ENTRIES) - { + if (fl3->ptr_file_info != 0) { + int i; + int num_entries = fl3->num_entries_read; + + if (num_entries > MAX_FILE_ENTRIES) { num_entries = MAX_FILE_ENTRIES; /* report this! */ } - prs_uint32("num_entries_read2", ps, depth, &(fl3->num_entries_read2)); + if(!prs_uint32("num_entries_read2", ps, depth, &fl3->num_entries_read2)) + return False; - for (i = 0; i < num_entries; i++) - { - srv_io_file_info3("", &(fl3->info_3[i]), ps, depth); + for (i = 0; i < num_entries; i++) { + if(!srv_io_file_info3("", &fl3->info_3[i], ps, depth)) + return False; } - for (i = 0; i < num_entries; i++) - { - srv_io_file_info3_str("", &(fl3->info_3_str[i]), ps, depth); + for (i = 0; i < num_entries; i++) { + if(!srv_io_file_info3_str("", &fl3->info_3_str[i], ps, depth)) + return False; } - prs_align(ps); + if(!prs_align(ps)) + return False; } return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) + +static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) { - if (ctr == NULL) return False; + if (ctr == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_srv_file_ctr"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("switch_value", ps, depth, &(ctr->switch_value)); - prs_uint32("ptr_file_ctr", ps, depth, &(ctr->ptr_file_ctr)); + if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) + return False; + if(!prs_uint32("ptr_file_ctr", ps, depth, &ctr->ptr_file_ctr)) + return False; - if (ctr->ptr_file_ctr != 0) - { - switch (ctr->switch_value) - { - case 3: - { - srv_io_srv_file_info_3("", &(ctr->file.info3), ps, depth); - break; - } - default: - { - DEBUG(5,("%s no file info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); - break; - } + if (ctr->ptr_file_ctr != 0) { + switch (ctr->switch_value) { + case 3: + if(!srv_io_srv_file_info_3("", &ctr->file.info3, ps, depth)) + return False; + break; + default: + DEBUG(5,("%s no file info at switch_value %d\n", + tab_depth(depth), ctr->switch_value)); + break; } } @@ -1549,164 +1462,184 @@ static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct } /******************************************************************* -reads or writes a structure. + Inits a SRV_Q_NET_FILE_ENUM structure. ********************************************************************/ -BOOL make_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, - const char *srv_name, const char *qual_name, - uint32 file_id, + +void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, + char *srv_name, char *qual_name, uint32 file_level, SRV_FILE_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) { - if (q_n == NULL || ctr == NULL || hnd == NULL) return False; + DEBUG(5,("init_q_net_file_enum\n")); q_n->ctr = ctr; - DEBUG(5,("make_q_net_file_enum\n")); + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); + init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name); - make_buf_unistr2(&(q_n->uni_srv_name), &(q_n->ptr_srv_name), srv_name); - make_buf_unistr2(&(q_n->uni_qual_name), &(q_n->ptr_qual_name), qual_name); - - q_n->file_id = file_id; q_n->file_level = file_level; q_n->preferred_len = preferred_len; - memcpy(&(q_n->enum_hnd), hnd, sizeof(*hnd)); - - return True; + memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth) + +BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth) { - if (q_n == NULL) return False; + if (q_n == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_q_net_file_enum"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr_srv_name", ps, depth, &(q_n->ptr_srv_name)); - smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr_qual_name", ps, depth, &(q_n->ptr_qual_name)); - smb_io_unistr2("", &(q_n->uni_qual_name), q_n->ptr_qual_name, ps, depth); + if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("file_id ", ps, depth, &(q_n->file_id )); - prs_uint32("file_level", ps, depth, &(q_n->file_level)); + if(!prs_uint32("file_level", ps, depth, &q_n->file_level)) + return False; - if (((int)q_n->file_level) != -1) - { - srv_io_srv_file_ctr("file_ctr", q_n->ctr, ps, depth); + if (q_n->file_level != -1) { + if(!srv_io_srv_file_ctr("file_ctr", q_n->ctr, ps, depth)) + return False; } - prs_uint32("preferred_len", ps, depth, &(q_n->preferred_len)); + if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) + return False; - smb_io_enum_hnd("enum_hnd", &(q_n->enum_hnd), ps, depth); + if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) + return False; return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth) + +BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth) { - if (r_n == NULL) return False; + if (r_n == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_r_net_file_enum"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("file_level", ps, depth, &(r_n->file_level)); + if(!prs_uint32("file_level", ps, depth, &r_n->file_level)) + return False; - if (r_n->file_level != 0) - { - srv_io_srv_file_ctr("file_ctr", r_n->ctr, ps, depth); + if (r_n->file_level != 0) { + if(!srv_io_srv_file_ctr("file_ctr", r_n->ctr, ps, depth)) + return False; } - prs_uint32("total_entries", ps, depth, &(r_n->total_entries)); - smb_io_enum_hnd("enum_hnd", &(r_n->enum_hnd), ps, depth); - prs_uint32("status ", ps, depth, &(r_n->status)); + if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) + return False; + if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) + return False; + if(!prs_uint32("status ", ps, depth, &r_n->status)) + return False; return True; } /******************************************************************* - makes a SRV_INFO_101 structure. + Inits a SRV_INFO_101 structure. ********************************************************************/ -BOOL make_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name, + +void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name, uint32 ver_major, uint32 ver_minor, uint32 srv_type, char *comment) { - if (sv101 == NULL) return False; - - DEBUG(5,("make_srv_info_101\n")); + DEBUG(5,("init_srv_info_101\n")); sv101->platform_id = platform_id; - make_buf_unistr2(&(sv101->uni_name ), &(sv101->ptr_name ) , name ); + init_buf_unistr2(&sv101->uni_name, &sv101->ptr_name, name); sv101->ver_major = ver_major; sv101->ver_minor = ver_minor; sv101->srv_type = srv_type; - make_buf_unistr2(&(sv101->uni_comment ), &(sv101->ptr_comment) , comment ); - - return True; + init_buf_unistr2(&sv101->uni_comment, &sv101->ptr_comment, comment); } - /******************************************************************* - reads or writes a SRV_INFO_101 structure. + Reads or writes a SRV_INFO_101 structure. ********************************************************************/ -static BOOL srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth) + +static BOOL srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth) { - if (sv101 == NULL) return False; + if (sv101 == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_info_101"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("platform_id ", ps, depth, &(sv101->platform_id )); - prs_uint32("ptr_name ", ps, depth, &(sv101->ptr_name )); - prs_uint32("ver_major ", ps, depth, &(sv101->ver_major )); - prs_uint32("ver_minor ", ps, depth, &(sv101->ver_minor )); - prs_uint32("srv_type ", ps, depth, &(sv101->srv_type )); - prs_uint32("ptr_comment ", ps, depth, &(sv101->ptr_comment )); + if(!prs_uint32("platform_id ", ps, depth, &sv101->platform_id)) + return False; + if(!prs_uint32("ptr_name ", ps, depth, &sv101->ptr_name)) + return False; + if(!prs_uint32("ver_major ", ps, depth, &sv101->ver_major)) + return False; + if(!prs_uint32("ver_minor ", ps, depth, &sv101->ver_minor)) + return False; + if(!prs_uint32("srv_type ", ps, depth, &sv101->srv_type)) + return False; + if(!prs_uint32("ptr_comment ", ps, depth, &sv101->ptr_comment)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_unistr2("uni_name ", &(sv101->uni_name ), True, ps, depth); - smb_io_unistr2("uni_comment ", &(sv101->uni_comment ), True, ps, depth); + if(!smb_io_unistr2("uni_name ", &sv101->uni_name, True, ps, depth)) + return False; + if(!smb_io_unistr2("uni_comment ", &sv101->uni_comment, True, ps, depth)) + return False; return True; } /******************************************************************* - makes a SRV_INFO_102 structure. + Inits a SRV_INFO_102 structure. ********************************************************************/ -BOOL make_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name, + +void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name, char *comment, uint32 ver_major, uint32 ver_minor, uint32 srv_type, uint32 users, uint32 disc, uint32 hidden, uint32 announce, uint32 ann_delta, uint32 licenses, char *usr_path) { - if (sv102 == NULL) return False; - - DEBUG(5,("make_srv_info_102\n")); + DEBUG(5,("init_srv_info_102\n")); sv102->platform_id = platform_id; - make_buf_unistr2(&(sv102->uni_name ), &(sv102->ptr_name ), name ); + init_buf_unistr2(&sv102->uni_name, &sv102->ptr_name, name); sv102->ver_major = ver_major; sv102->ver_minor = ver_minor; sv102->srv_type = srv_type; - make_buf_unistr2(&(sv102->uni_comment ), &(sv102->ptr_comment ), comment ); + init_buf_unistr2(&sv102->uni_comment, &sv102->ptr_comment, comment); /* same as 101 up to here */ @@ -1716,250 +1649,277 @@ BOOL make_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name, sv102->announce = announce; sv102->ann_delta =ann_delta; sv102->licenses = licenses; - make_buf_unistr2(&(sv102->uni_usr_path), &(sv102->ptr_usr_path), usr_path); - - return True; + init_buf_unistr2(&sv102->uni_usr_path, &sv102->ptr_usr_path, usr_path); } /******************************************************************* - reads or writes a SRV_INFO_102 structure. + Reads or writes a SRV_INFO_102 structure. ********************************************************************/ -static BOOL srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth) + +static BOOL srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth) { - if (sv102 == NULL) return False; + if (sv102 == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_info102"); depth++; - prs_align(ps); - - prs_uint32("platform_id ", ps, depth, &(sv102->platform_id )); - prs_uint32("ptr_name ", ps, depth, &(sv102->ptr_name )); - prs_uint32("ver_major ", ps, depth, &(sv102->ver_major )); - prs_uint32("ver_minor ", ps, depth, &(sv102->ver_minor )); - prs_uint32("srv_type ", ps, depth, &(sv102->srv_type )); - prs_uint32("ptr_comment ", ps, depth, &(sv102->ptr_comment )); + if(!prs_align(ps)) + return False; + + if(!prs_uint32("platform_id ", ps, depth, &sv102->platform_id)) + return False; + if(!prs_uint32("ptr_name ", ps, depth, &sv102->ptr_name)) + return False; + if(!prs_uint32("ver_major ", ps, depth, &sv102->ver_major)) + return False; + if(!prs_uint32("ver_minor ", ps, depth, &sv102->ver_minor)) + return False; + if(!prs_uint32("srv_type ", ps, depth, &sv102->srv_type)) + return False; + if(!prs_uint32("ptr_comment ", ps, depth, &sv102->ptr_comment)) + return False; /* same as 101 up to here */ - prs_uint32("users ", ps, depth, &(sv102->users )); - prs_uint32("disc ", ps, depth, &(sv102->disc )); - prs_uint32("hidden ", ps, depth, &(sv102->hidden )); - prs_uint32("announce ", ps, depth, &(sv102->announce )); - prs_uint32("ann_delta ", ps, depth, &(sv102->ann_delta )); - prs_uint32("licenses ", ps, depth, &(sv102->licenses )); - prs_uint32("ptr_usr_path", ps, depth, &(sv102->ptr_usr_path)); - - smb_io_unistr2("uni_name ", &(sv102->uni_name ), True, ps, depth); - prs_align(ps); - smb_io_unistr2("uni_comment ", &(sv102->uni_comment ), True, ps, depth); - prs_align(ps); - smb_io_unistr2("uni_usr_path", &(sv102->uni_usr_path), True, ps, depth); - - return True; -} - -/******************************************************************* - reads or writes a SRV_INFO_102 structure. + if(!prs_uint32("users ", ps, depth, &sv102->users)) + return False; + if(!prs_uint32("disc ", ps, depth, &sv102->disc)) + return False; + if(!prs_uint32("hidden ", ps, depth, &sv102->hidden)) + return False; + if(!prs_uint32("announce ", ps, depth, &sv102->announce)) + return False; + if(!prs_uint32("ann_delta ", ps, depth, &sv102->ann_delta)) + return False; + if(!prs_uint32("licenses ", ps, depth, &sv102->licenses)) + return False; + if(!prs_uint32("ptr_usr_path", ps, depth, &sv102->ptr_usr_path)) + return False; + + if(!smb_io_unistr2("uni_name ", &sv102->uni_name, True, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("uni_comment ", &sv102->uni_comment, True, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("uni_usr_path", &sv102->uni_usr_path, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a SRV_INFO_102 structure. ********************************************************************/ -static BOOL srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) + +static BOOL srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) { - if (ctr == NULL) return False; + if (ctr == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_info_ctr"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("switch_value", ps, depth, &(ctr->switch_value)); - prs_uint32("ptr_srv_ctr ", ps, depth, &(ctr->ptr_srv_ctr )); + if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) + return False; + if(!prs_uint32("ptr_srv_ctr ", ps, depth, &ctr->ptr_srv_ctr)) + return False; - if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL) - { - switch (ctr->switch_value) - { - case 101: - { - srv_io_info_101("sv101", &(ctr->srv.sv101), ps, depth); - break; - } - case 102: - { - srv_io_info_102("sv102", &(ctr->srv.sv102), ps, depth); - break; - } - default: - { - DEBUG(5,("%s no server info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); - break; - } + if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL) { + switch (ctr->switch_value) { + case 101: + if(!srv_io_info_101("sv101", &ctr->srv.sv101, ps, depth)) + return False; + break; + case 102: + if(!srv_io_info_102("sv102", &ctr->srv.sv102, ps, depth)) + return False; + break; + default: + DEBUG(5,("%s no server info at switch_value %d\n", + tab_depth(depth), ctr->switch_value)); + break; } - prs_align(ps); + if(!prs_align(ps)) + return False; } return True; } /******************************************************************* - makes a SRV_Q_NET_SRV_GET_INFO structure. + Inits a SRV_Q_NET_SRV_GET_INFO structure. ********************************************************************/ -BOOL make_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv, + +void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv, char *server_name, uint32 switch_value) { - if (srv == NULL) return False; + DEBUG(5,("init_srv_q_net_srv_get_info\n")); - DEBUG(5,("make_srv_q_net_srv_get_info\n")); - - make_buf_unistr2(&(srv->uni_srv_name), &(srv->ptr_srv_name), server_name); + init_buf_unistr2(&srv->uni_srv_name, &srv->ptr_srv_name, server_name); srv->switch_value = switch_value; - - return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth) + +BOOL srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth) { - if (q_n == NULL) return False; + if (q_n == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name)); - smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); + if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("switch_value ", ps, depth, &(q_n->switch_value)); + if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) + return False; return True; } /******************************************************************* - makes a SRV_R_NET_SRV_GET_INFO structure. + Inits a SRV_R_NET_SRV_GET_INFO structure. ********************************************************************/ -BOOL make_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv, + +void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv, uint32 switch_value, SRV_INFO_CTR *ctr, uint32 status) { - if (srv == NULL) return False; - - DEBUG(5,("make_srv_r_net_srv_get_info\n")); + DEBUG(5,("init_srv_r_net_srv_get_info\n")); srv->ctr = ctr; - if (status == 0x0) - { + if (status == 0x0) { srv->ctr->switch_value = switch_value; srv->ctr->ptr_srv_ctr = 1; - } - else - { + } else { srv->ctr->switch_value = 0; srv->ctr->ptr_srv_ctr = 0; } srv->status = status; - - return True; } /******************************************************************* - reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth) + +BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth) { - if (r_n == NULL) return False; + if (r_n == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - srv_io_info_ctr("ctr", r_n->ctr, ps, depth); + if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth)) + return False; - prs_uint32("status ", ps, depth, &(r_n->status )); + if(!prs_uint32("status ", ps, depth, &r_n->status)) + return False; return True; } -/******************************************************************* - makes a SRV_Q_NET_REMOTE_TOD structure. - ********************************************************************/ -BOOL make_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_t, char *server_name) -{ - if (q_t == NULL) return False; - - DEBUG(5,("make_srv_q_net_remote_tod\n")); - - make_buf_unistr2(&(q_t->uni_srv_name), &(q_t->ptr_srv_name), server_name); - - return True; -} /******************************************************************* - reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth) + +BOOL srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth) { - if (q_n == NULL) return False; + if (q_n == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr_srv_name ", ps, depth, &(q_n->ptr_srv_name)); - smb_io_unistr2("", &(q_n->uni_srv_name), True, ps, depth); + if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; return True; } /******************************************************************* - reads or writes a TIME_OF_DAY_INFO structure. + Reads or writes a TIME_OF_DAY_INFO structure. ********************************************************************/ -static BOOL srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth) + +static BOOL srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth) { - if (tod == NULL) return False; + if (tod == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_time_of_day_info"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("elapsedt ", ps, depth, &(tod->elapsedt )); - prs_uint32("msecs ", ps, depth, &(tod->msecs )); - prs_uint32("hours ", ps, depth, &(tod->hours )); - prs_uint32("mins ", ps, depth, &(tod->mins )); - prs_uint32("secs ", ps, depth, &(tod->secs )); - prs_uint32("hunds ", ps, depth, &(tod->hunds )); - prs_uint32("timezone ", ps, depth, &(tod->zone )); - prs_uint32("tintervals ", ps, depth, &(tod->tintervals)); - prs_uint32("day ", ps, depth, &(tod->day )); - prs_uint32("month ", ps, depth, &(tod->month )); - prs_uint32("year ", ps, depth, &(tod->year )); - prs_uint32("weekday ", ps, depth, &(tod->weekday )); - - - return True; -} - -/******************************************************************* - makes a TIME_OF_DAY_INFO structure. + if(!prs_uint32("elapsedt ", ps, depth, &tod->elapsedt)) + return False; + if(!prs_uint32("msecs ", ps, depth, &tod->msecs)) + return False; + if(!prs_uint32("hours ", ps, depth, &tod->hours)) + return False; + if(!prs_uint32("mins ", ps, depth, &tod->mins)) + return False; + if(!prs_uint32("secs ", ps, depth, &tod->secs)) + return False; + if(!prs_uint32("hunds ", ps, depth, &tod->hunds)) + return False; + if(!prs_uint32("timezone ", ps, depth, &tod->zone)) + return False; + if(!prs_uint32("tintervals ", ps, depth, &tod->tintervals)) + return False; + if(!prs_uint32("day ", ps, depth, &tod->day)) + return False; + if(!prs_uint32("month ", ps, depth, &tod->month)) + return False; + if(!prs_uint32("year ", ps, depth, &tod->year)) + return False; + if(!prs_uint32("weekday ", ps, depth, &tod->weekday)) + return False; + + return True; +} + +/******************************************************************* + Inits a TIME_OF_DAY_INFO structure. ********************************************************************/ -BOOL make_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs, + +void init_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs, uint32 hours, uint32 mins, uint32 secs, uint32 hunds, uint32 zone, uint32 tintervals, uint32 day, uint32 month, uint32 year, uint32 weekday) { - if (tod == NULL) return False; - - DEBUG(5,("make_time_of_day_info\n")); + DEBUG(5,("init_time_of_day_info\n")); tod->elapsedt = elapsedt; tod->msecs = msecs; @@ -1973,28 +1933,32 @@ BOOL make_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs, tod->month = month; tod->year = year; tod->weekday = weekday; - - return True; } /******************************************************************* - reads or writes a structure. + Reads or writes a structure. ********************************************************************/ + BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth) { - if (r_n == NULL) return False; + if (r_n == NULL) + return False; prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr_srv_tod ", ps, depth, &(r_n->ptr_srv_tod)); + if(!prs_uint32("ptr_srv_tod ", ps, depth, &r_n->ptr_srv_tod)) + return False; - srv_io_time_of_day_info("tod", r_n->tod, ps, depth); + if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth)) + return False; - prs_uint32("status ", ps, depth, &(r_n->status)); + if(!prs_uint32("status ", ps, depth, &r_n->status)) + return False; return True; } diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c index 91409e2eec..7357e3d2f3 100644 --- a/source3/rpc_parse/parse_wks.c +++ b/source3/rpc_parse/parse_wks.c @@ -3,9 +3,9 @@ * Unix SMB/Netbios implementation. * Version 1.9. * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1999, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, - * Copyright (C) Paul Ashton 1997-1999. + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. * * 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 @@ -28,38 +28,44 @@ extern int DEBUGLEVEL; /******************************************************************* - make_wks_q_query_info + Init ********************************************************************/ -BOOL make_wks_q_query_info(WKS_Q_QUERY_INFO *q_u, + +void init_wks_q_query_info(WKS_Q_QUERY_INFO *q_u, char *server, uint16 switch_value) { - DEBUG(5,("make_wks_q_query_info\n")); + DEBUG(5,("init_wks_q_query_info\n")); - make_buf_unistr2(&(q_u->uni_srv_name), &(q_u->ptr_srv_name), server); + init_buf_unistr2(&q_u->uni_srv_name, &q_u->ptr_srv_name, server); q_u->switch_value = switch_value; - - - return True; } /******************************************************************* -reads or writes a WKS_Q_QUERY_INFO structure. + Reads or writes a WKS_Q_QUERY_INFO structure. ********************************************************************/ + BOOL wks_io_q_query_info(char *desc, WKS_Q_QUERY_INFO *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return False; + if (q_u == NULL) + return False; prs_debug(ps, depth, desc, "wks_io_q_query_info"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr_srv_name", ps, depth, &(q_u->ptr_srv_name)); - smb_io_unistr2("", &(q_u->uni_srv_name), q_u->ptr_srv_name, ps, depth); - prs_align(ps); + 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; - prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); - prs_align(ps); + if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) + return False; + if(!prs_align(ps)) + return False; return True; } @@ -67,60 +73,72 @@ BOOL wks_io_q_query_info(char *desc, WKS_Q_QUERY_INFO *q_u, prs_struct *ps, int /******************************************************************* wks_info_100 ********************************************************************/ -BOOL make_wks_info_100(WKS_INFO_100 *inf, + +void init_wks_info_100(WKS_INFO_100 *inf, uint32 platform_id, uint32 ver_major, uint32 ver_minor, char *my_name, char *domain_name) { - DEBUG(5,("WKS_INFO_100: %d\n", __LINE__)); + DEBUG(5,("Init WKS_INFO_100: %d\n", __LINE__)); inf->platform_id = platform_id; /* 0x0000 01f4 - unknown */ inf->ver_major = ver_major; /* os major version */ inf->ver_minor = ver_minor; /* os minor version */ - make_buf_unistr2(&(inf->uni_compname), &(inf->ptr_compname), my_name ); - make_buf_unistr2(&(inf->uni_lan_grp ), &(inf->ptr_lan_grp ), domain_name); - - return True; + init_buf_unistr2(&inf->uni_compname, &inf->ptr_compname, my_name ); + init_buf_unistr2(&inf->uni_lan_grp, &inf->ptr_lan_grp, domain_name); } /******************************************************************* -reads or writes a WKS_INFO_100 structure. + Reads or writes a WKS_INFO_100 structure. ********************************************************************/ + static BOOL wks_io_wks_info_100(char *desc, WKS_INFO_100 *inf, prs_struct *ps, int depth) { - if (inf == NULL) return False; + if (inf == NULL) + return False; prs_debug(ps, depth, desc, "wks_io_wks_info_100"); depth++; - prs_align(ps); - - prs_uint32("platform_id ", ps, depth, &(inf->platform_id )); /* 0x0000 01f4 - unknown */ - prs_uint32("ptr_compname", ps, depth, &(inf->ptr_compname)); /* pointer to computer name */ - prs_uint32("ptr_lan_grp ", ps, depth, &(inf->ptr_lan_grp )); /* pointer to LAN group name */ - prs_uint32("ver_major ", ps, depth, &(inf->ver_major )); /* 4 - major os version */ - prs_uint32("ver_minor ", ps, depth, &(inf->ver_minor )); /* 0 - minor os version */ - - smb_io_unistr2("", &(inf->uni_compname), inf->ptr_compname, ps, depth); - prs_align(ps); - - smb_io_unistr2("", &(inf->uni_lan_grp ), inf->ptr_lan_grp , ps, depth); - prs_align(ps); + if(!prs_align(ps)) + return False; + + if(!prs_uint32("platform_id ", ps, depth, &inf->platform_id)) /* 0x0000 01f4 - unknown */ + return False; + if(!prs_uint32("ptr_compname", ps, depth, &inf->ptr_compname)) /* pointer to computer name */ + return False; + if(!prs_uint32("ptr_lan_grp ", ps, depth, &inf->ptr_lan_grp)) /* pointer to LAN group name */ + return False; + if(!prs_uint32("ver_major ", ps, depth, &inf->ver_major)) /* 4 - major os version */ + return False; + if(!prs_uint32("ver_minor ", ps, depth, &inf->ver_minor)) /* 0 - minor os version */ + return False; + + if(!smb_io_unistr2("", &inf->uni_compname, inf->ptr_compname, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + if(!smb_io_unistr2("", &inf->uni_lan_grp, inf->ptr_lan_grp , ps, depth)) + return False; + if(!prs_align(ps)) + return False; return True; } /******************************************************************* - make_wks_r_query_info + Inits WKS_R_QUERY_INFO. only supports info level 100 at the moment. ********************************************************************/ -BOOL make_wks_r_query_info(WKS_R_QUERY_INFO *r_u, + +void init_wks_r_query_info(WKS_R_QUERY_INFO *r_u, uint32 switch_value, WKS_INFO_100 *wks100, int status) { - DEBUG(5,("make_wks_r_unknown_0: %d\n", __LINE__)); + DEBUG(5,("init_wks_r_unknown_0: %d\n", __LINE__)); r_u->switch_value = switch_value; /* same as in request */ @@ -128,30 +146,35 @@ BOOL make_wks_r_query_info(WKS_R_QUERY_INFO *r_u, r_u->wks100 = wks100; r_u->status = status; - - return True; } /******************************************************************* -reads or writes a structure. + Reads or writes a structure. ********************************************************************/ -BOOL wks_io_r_query_info(char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int depth) + +BOOL wks_io_r_query_info(char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return False; + if (r_u == NULL) + return False; prs_debug(ps, depth, desc, "wks_io_r_query_info"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint16("switch_value", ps, depth, &(r_u->switch_value)); /* level 100 (0x64) */ - prs_align(ps); + if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value)) /* level 100 (0x64) */ + return False; + if(!prs_align(ps)) + return False; - prs_uint32("ptr_1 ", ps, depth, &(r_u->ptr_1 )); /* pointer 1 */ - wks_io_wks_info_100("inf", r_u->wks100, ps, depth); + if(!prs_uint32("ptr_1 ", ps, depth, &r_u->ptr_1)) /* pointer 1 */ + return False; + if(!wks_io_wks_info_100("inf", r_u->wks100, ps, depth)) + return False; - prs_uint32("status ", ps, depth, &(r_u->status)); + if(!prs_uint32("status ", ps, depth, &r_u->status)) + return False; return True; } - -- cgit From 32a965e09ce4befe971855e11e1fb5ceb51a9ed1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 13 Dec 1999 13:35:20 +0000 Subject: 2nd phase of head branch sync with SAMBA_2_0 - this delets all the files that were in the head branch but weren't in SAMBA_2_0 (This used to be commit d7b208786590b5a28618590172b8d523627dda09) --- source3/rpc_parse/parse_at.c | 299 --- source3/rpc_parse/parse_brs.c | 180 -- source3/rpc_parse/parse_creds.c | 563 ----- source3/rpc_parse/parse_eventlog.c | 261 --- source3/rpc_parse/parse_spoolss.c | 4408 ------------------------------------ source3/rpc_parse/parse_svc.c | 936 -------- 6 files changed, 6647 deletions(-) delete mode 100644 source3/rpc_parse/parse_at.c delete mode 100644 source3/rpc_parse/parse_brs.c delete mode 100644 source3/rpc_parse/parse_creds.c delete mode 100644 source3/rpc_parse/parse_eventlog.c delete mode 100644 source3/rpc_parse/parse_spoolss.c delete mode 100644 source3/rpc_parse/parse_svc.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_at.c b/source3/rpc_parse/parse_at.c deleted file mode 100644 index a03a8cfad9..0000000000 --- a/source3/rpc_parse/parse_at.c +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Unix SMB/Netbios implementation. - * Version 2.1. - * RPC parsing routines: scheduler service - * Copyright (C) Matthew Chapman 1999, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, - * Copyright (C) Andrew Tridgell 1992-1999. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "includes.h" - -extern int DEBUGLEVEL; - -/******************************************************************* - make_at_q_add_job - ********************************************************************/ -BOOL make_at_q_add_job(AT_Q_ADD_JOB *q_a, char *server, - AT_JOB_INFO *info, char *command) -{ - DEBUG(5,("make_at_q_add_job\n")); - - make_buf_unistr2(&(q_a->uni_srv_name), &(q_a->ptr_srv_name), server); - memcpy(&(q_a->info), info, sizeof(q_a->info)); - make_unistr2(&(q_a->command), command, strlen(command)+1); - - return True; -} - -/******************************************************************* -reads or writes a AT_JOB_INFO structure. -********************************************************************/ -BOOL at_io_job_info(char *desc, AT_JOB_INFO *info, prs_struct *ps, int depth) -{ - if (info == NULL) return False; - - prs_debug(ps, depth, desc, "at_io_job_info"); - depth++; - - prs_align(ps); - - prs_uint32("time", ps, depth, &(info->time)); - prs_uint32("monthdays", ps, depth, &(info->monthdays)); - prs_uint8("weekdays", ps, depth, &(info->weekdays)); - prs_uint8("flags", ps, depth, &(info->flags)); - prs_align(ps); - - prs_uint32("ptr_command", ps, depth, &(info->ptr_command)); - - return True; -} - -/******************************************************************* -reads or writes a AT_Q_ADD_JOB structure. -********************************************************************/ -BOOL at_io_q_add_job(char *desc, AT_Q_ADD_JOB *q_a, prs_struct *ps, int depth) -{ - if (q_a == NULL) return False; - - prs_debug(ps, depth, desc, "at_q_add_job"); - depth++; - - prs_align(ps); - prs_uint32("ptr_srv_name", ps, depth, &(q_a->ptr_srv_name)); - smb_io_unistr2("", &(q_a->uni_srv_name), q_a->ptr_srv_name, ps, depth); - at_io_job_info("", &(q_a->info), ps, depth); - smb_io_unistr2("", &(q_a->command), q_a->info.ptr_command, ps, depth); - - return True; -} - -/******************************************************************* -reads or writes a AT_R_ADD_JOB structure. -********************************************************************/ -BOOL at_io_r_add_job(char *desc, AT_R_ADD_JOB *r_a, prs_struct *ps, int depth) -{ - if (r_a == NULL) return False; - - prs_debug(ps, depth, desc, "at_r_add_job"); - depth++; - - prs_align(ps); - prs_uint32("jobid", ps, depth, &(r_a->jobid)); - prs_uint32("status", ps, depth, &(r_a->status)); - - return True; -} - -/******************************************************************* - make_at_q_del_job - ********************************************************************/ -BOOL make_at_q_del_job(AT_Q_DEL_JOB *q_a, char *server, uint32 min_jobid, - uint32 max_jobid) -{ - DEBUG(5,("make_at_q_del_job\n")); - - make_buf_unistr2(&(q_a->uni_srv_name), &(q_a->ptr_srv_name), server); - q_a->min_jobid = min_jobid; - q_a->max_jobid = max_jobid; - - return True; -} - -/******************************************************************* -reads or writes a AT_Q_DEL_JOB structure. -********************************************************************/ -BOOL at_io_q_del_job(char *desc, AT_Q_DEL_JOB *q_d, prs_struct *ps, int depth) -{ - if (q_d == NULL) return False; - - prs_debug(ps, depth, desc, "at_q_del_job"); - depth++; - - prs_align(ps); - - prs_uint32("ptr_srv_name", ps, depth, &(q_d->ptr_srv_name)); - smb_io_unistr2("", &(q_d->uni_srv_name), q_d->ptr_srv_name, ps, depth); - prs_align(ps); - prs_uint32("min_jobid", ps, depth, &(q_d->min_jobid)); - prs_uint32("max_jobid", ps, depth, &(q_d->max_jobid)); - - return True; -} - -/******************************************************************* -reads or writes a AT_R_DEL_JOB structure. -********************************************************************/ -BOOL at_io_r_del_job(char *desc, AT_R_DEL_JOB *r_d, prs_struct *ps, int depth) -{ - if (r_d == NULL) return False; - - prs_debug(ps, depth, desc, "at_r_del_job"); - depth++; - - prs_align(ps); - prs_uint32("status", ps, depth, &(r_d->status)); - - return True; -} - -/******************************************************************* - make_at_q_enum_jobs - ********************************************************************/ -BOOL make_at_q_enum_jobs(AT_Q_ENUM_JOBS *q_e, char *server) -{ - DEBUG(5,("make_at_q_enum_jobs\n")); - - make_buf_unistr2(&(q_e->uni_srv_name), &(q_e->ptr_srv_name), server); - q_e->unknown0 = 0; - q_e->unknown1 = 0; - q_e->max_len = 0xffff; - q_e->ptr_resume = 1; - q_e->hnd_resume = 0; - - return True; -} - -/******************************************************************* -reads or writes a AT_Q_ENUM_JOBS structure. -********************************************************************/ -BOOL at_io_q_enum_jobs(char *desc, AT_Q_ENUM_JOBS *q_e, prs_struct *ps, int depth) -{ - if (q_e == NULL) return False; - - prs_debug(ps, depth, desc, "at_q_enum_jobs"); - depth++; - - prs_align(ps); - prs_uint32("ptr_srv_name", ps, depth, &(q_e->ptr_srv_name)); - smb_io_unistr2("", &(q_e->uni_srv_name), q_e->ptr_srv_name, ps, depth); - prs_align(ps); - prs_uint32("unknown0", ps, depth, &(q_e->unknown0)); - prs_uint32("unknown1", ps, depth, &(q_e->unknown1)); - prs_uint32("max_len" , ps, depth, &(q_e->max_len )); - - prs_uint32("ptr_resume", ps, depth, &(q_e->ptr_resume)); - prs_uint32("hnd_resume", ps, depth, &(q_e->hnd_resume)); - - return True; -} - -/******************************************************************* -reads or writes a AT_R_ENUM_JOBS structure. -********************************************************************/ -BOOL at_io_r_enum_jobs(char *desc, AT_R_ENUM_JOBS *r_e, prs_struct *ps, int depth) -{ - if (r_e == NULL) return False; - - prs_debug(ps, depth, desc, "at_r_enum_jobs"); - depth++; - - prs_align(ps); - prs_uint32("num_entries", ps, depth, &(r_e->num_entries)); - prs_uint32("ptr_entries", ps, depth, &(r_e->ptr_entries)); - - if (r_e->ptr_entries != 0) - { - int i; - - prs_uint32("num_entries2", ps, depth, &(r_e->num_entries2)); - if (r_e->num_entries2 != r_e->num_entries) - { - /* RPC fault */ - return False; - } - - SMB_ASSERT_ARRAY(r_e->info, r_e->num_entries2); - - for (i = 0; i < r_e->num_entries2; i++) - { - prs_uint32("jobid", ps, depth, &(r_e->info[i].jobid)); - at_io_job_info("", &(r_e->info[i].info), ps, depth); - } - - for (i = 0; i < r_e->num_entries2; i++) - { - smb_io_unistr2("", &(r_e->command[i]), - r_e->info[i].info.ptr_command, ps, depth); - } - } - - prs_align(ps); - prs_uint32("total_entries", ps, depth, &(r_e->total_entries)); - prs_uint32("ptr_resume" , ps, depth, &(r_e->ptr_resume )); - prs_uint32("hnd_resume" , ps, depth, &(r_e->hnd_resume )); - - prs_uint32("status", ps, depth, &(r_e->status)); - - return True; -} - -/******************************************************************* - make_at_q_query_job - ********************************************************************/ -BOOL make_at_q_query_job(AT_Q_QUERY_JOB *q_q, char *server, uint32 jobid) -{ - DEBUG(5,("make_at_q_query_job\n")); - - make_buf_unistr2(&(q_q->uni_srv_name), &(q_q->ptr_srv_name), server); - q_q->jobid = jobid; - - return True; -} - -/******************************************************************* -reads or writes a AT_Q_QUERY_JOB structure. -********************************************************************/ -BOOL at_io_q_query_job(char *desc, AT_Q_QUERY_JOB *q_q, prs_struct *ps, int depth) -{ - if (q_q == NULL) return False; - - prs_debug(ps, depth, desc, "at_q_query_job"); - depth++; - - prs_align(ps); - prs_uint32("ptr_srv_name", ps, depth, &(q_q->ptr_srv_name)); - smb_io_unistr2("", &(q_q->uni_srv_name), q_q->ptr_srv_name, ps, depth); - prs_align(ps); - prs_uint32("jobid", ps, depth, &(q_q->jobid)); - - return True; -} - -/******************************************************************* -reads or writes a AT_R_QUERY_JOB structure. -********************************************************************/ -BOOL at_io_r_query_job(char *desc, AT_R_QUERY_JOB *r_q, prs_struct *ps, int depth) -{ - if (r_q == NULL) return False; - - prs_debug(ps, depth, desc, "at_r_query_job"); - depth++; - - prs_align(ps); - prs_uint32("ptr_info", ps, depth, &(r_q->ptr_info)); - if (r_q->ptr_info != 0) - { - at_io_job_info("", &(r_q->info), ps, depth); - smb_io_unistr2("", &(r_q->command), r_q->info.ptr_command, ps, depth); - } - - prs_align(ps); - prs_uint32("status", ps, depth, &(r_q->status)); - - return True; -} diff --git a/source3/rpc_parse/parse_brs.c b/source3/rpc_parse/parse_brs.c deleted file mode 100644 index 723866e9f9..0000000000 --- a/source3/rpc_parse/parse_brs.c +++ /dev/null @@ -1,180 +0,0 @@ - -/* - * Unix SMB/Netbios implementation. - * Version 1.9. - * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1999, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, - * Copyright (C) Paul Ashton 1997-1999. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -#include "includes.h" - -extern int DEBUGLEVEL; - - -/******************************************************************* - make_brs_q_query_info - ********************************************************************/ -BOOL make_brs_q_query_info(BRS_Q_QUERY_INFO *q_u, - const char *server, uint16 switch_value) -{ - DEBUG(5,("make_brs_q_query_info\n")); - - make_buf_unistr2(&(q_u->uni_srv_name), &(q_u->ptr_srv_name), server); - q_u->switch_value1 = switch_value; - q_u->switch_value2 = switch_value; - - q_u->ptr = 1; - q_u->pad1 = 0x0; - q_u->pad2 = 0x0; - - return True; -} - -/******************************************************************* -reads or writes a BRS_Q_QUERY_INFO structure. -********************************************************************/ -BOOL brs_io_q_query_info(char *desc, BRS_Q_QUERY_INFO *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "brs_io_q_query_info"); - depth++; - - prs_align(ps); - - prs_uint32("ptr_srv_name", ps, depth, &(q_u->ptr_srv_name)); - smb_io_unistr2("", &(q_u->uni_srv_name), q_u->ptr_srv_name, ps, depth); - prs_align(ps); - - prs_uint16("switch_value1", ps, depth, &(q_u->switch_value1)); - prs_align(ps); - - prs_uint16("switch_value2", ps, depth, &(q_u->switch_value2)); - prs_align(ps); - - prs_uint32("ptr", ps, depth, &(q_u->ptr)); - if (q_u->ptr) - { - prs_uint32("pad1", ps, depth, &(q_u->pad1)); - } - - prs_uint32("pad2", ps, depth, &(q_u->pad2)); - - return True; -} - -/******************************************************************* - brs_info_100 - ********************************************************************/ -BOOL make_brs_info_100(BRS_INFO_100 *inf) -{ - DEBUG(5,("BRS_INFO_100: %d\n", __LINE__)); - - inf->pad1 = 0x0; - inf->ptr2 = 0x1; - inf->pad2 = 0x0; - inf->pad3 = 0x0; - - return True; -} - -/******************************************************************* -reads or writes a BRS_INFO_100 structure. -********************************************************************/ -static BOOL brs_io_brs_info_100(char *desc, BRS_INFO_100 *inf, prs_struct *ps, int depth) -{ - if (inf == NULL) return False; - - prs_debug(ps, depth, desc, "brs_io_brs_info_100"); - depth++; - - prs_align(ps); - - prs_uint32("pad1", ps, depth, &(inf->pad1)); - prs_uint32("ptr2", ps, depth, &(inf->ptr2)); - prs_uint32("pad2", ps, depth, &(inf->pad2)); - prs_uint32("pad3", ps, depth, &(inf->pad3)); - - return True; -} - -/******************************************************************* - make_brs_r_query_info - - only supports info level 100 at the moment. - - ********************************************************************/ -BOOL make_brs_r_query_info(BRS_R_QUERY_INFO *r_u, - uint32 switch_value, void *inf, - int status) -{ - DEBUG(5,("make_brs_r_unknown_0: %d\n", __LINE__)); - - r_u->switch_value1 = switch_value; /* same as in request */ - r_u->switch_value2 = switch_value; /* same as in request */ - - r_u->ptr_1 = inf != NULL ? 1 : 0; /* pointer 1 */ - r_u->info.id = inf; - - r_u->status = status; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL brs_io_r_query_info(char *desc, BRS_R_QUERY_INFO *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "brs_io_r_query_info"); - depth++; - - prs_align(ps); - - prs_uint16("switch_value1", ps, depth, &(r_u->switch_value1)); - prs_align(ps); - - prs_uint16("switch_value2", ps, depth, &(r_u->switch_value2)); - prs_align(ps); - - prs_uint32("ptr_1 ", ps, depth, &(r_u->ptr_1)); - if (r_u->ptr_1 != 0x0) - { - switch (r_u->switch_value1) - { - case 100: - { - brs_io_brs_info_100("inf", r_u->info.brs100, ps, depth); - break; - } - default: - { - break; - } - } - } - - prs_uint32("status ", ps, depth, &(r_u->status)); - - return True; -} - diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c deleted file mode 100644 index c661d5a3c6..0000000000 --- a/source3/rpc_parse/parse_creds.c +++ /dev/null @@ -1,563 +0,0 @@ -/* - * Unix SMB/Netbios implementation. - * Version 1.9. - * RPC Pipe client / server routines - * Copyright (C) Andrew Tgrpsgell 1992-1999, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, - * Copyright (C) Paul Ashton 1997-1999. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambgrpsge, MA 02139, USA. - */ - - -#include "includes.h" - -extern int DEBUGLEVEL; - - -/******************************************************************* -makes a CREDS_UNIX structure. -********************************************************************/ -BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name, - const char* requested_name, - const char* real_name, - BOOL guest) -{ - if (r_u == NULL) return False; - - DEBUG(5,("make_creds_unix\n")); - - fstrcpy(r_u->user_name , user_name); - fstrcpy(r_u->requested_name, requested_name); - fstrcpy(r_u->real_name , real_name); - r_u->guest = guest; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL creds_io_unix(char *desc, CREDS_UNIX *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "creds_io_unix"); - depth++; - - prs_align(ps); - prs_string("user_name", ps, depth, r_u->user_name, strlen(r_u->user_name), sizeof(r_u->user_name)); - prs_align(ps); - prs_string("requested_name", ps, depth, r_u->requested_name, strlen(r_u->requested_name), sizeof(r_u->requested_name)); - prs_align(ps); - prs_string("real_name", ps, depth, r_u->real_name, strlen(r_u->real_name), sizeof(r_u->real_name)); - prs_align(ps); - prs_uint32("guest", ps, depth, &(r_u->guest)); - return True; -} - - -/******************************************************************* -frees a structure. -********************************************************************/ -void creds_free_unix(CREDS_UNIX *r_u) -{ -} - -/******************************************************************* -makes a CREDS_UNIX_SEC structure. -********************************************************************/ -BOOL make_creds_unix_sec(CREDS_UNIX_SEC *r_u, - uint32 uid, uint32 gid, uint32 num_grps, gid_t *grps) -{ - int i; - if (r_u == NULL) return False; - - DEBUG(5,("make_creds_unix_sec\n")); - - r_u->uid = uid; - r_u->gid = gid; - r_u->num_grps = num_grps; - r_u->grps = (uint32*)Realloc(NULL, sizeof(r_u->grps[0]) * - r_u->num_grps); - if (r_u->grps == NULL && num_grps != 0) - { - return False; - } - for (i = 0; i < num_grps; i++) - { - r_u->grps[i] = (gid_t)grps[i]; - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL creds_io_unix_sec(char *desc, CREDS_UNIX_SEC *r_u, prs_struct *ps, int depth) -{ - uint32 i; - - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "creds_io_unix_sec"); - depth++; - - prs_align(ps); - - prs_uint32("uid", ps, depth, &(r_u->uid)); - prs_uint32("gid", ps, depth, &(r_u->gid)); - prs_uint32("num_grps", ps, depth, &(r_u->num_grps)); - if (r_u->num_grps != 0) - { - r_u->grps = (uint32*)Realloc(r_u->grps, - sizeof(r_u->grps[0]) * - r_u->num_grps); - if (r_u->grps == NULL) - { - creds_free_unix_sec(r_u); - return False; - } - } - for (i = 0; i < r_u->num_grps; i++) - { - prs_uint32("", ps, depth, &(r_u->grps[i])); - } - return True; -} - - -/******************************************************************* -frees a structure. -********************************************************************/ -void creds_free_unix_sec(CREDS_UNIX_SEC *r_u) -{ - if (r_u->grps != NULL) - { - free(r_u->grps); - r_u->grps = NULL; - } -} - -/******************************************************************* -makes a CREDS_NT_SEC structure. -********************************************************************/ -BOOL make_creds_nt_sec(CREDS_NT_SEC *r_u, - DOM_SID *sid, uint32 num_grps, uint32 *grps) -{ - int i; - if (r_u == NULL) return False; - - DEBUG(5,("make_creds_unix_sec\n")); - - sid_copy(&r_u->sid, sid); - r_u->num_grps = num_grps; - r_u->grp_rids = (uint32*)Realloc(NULL, sizeof(r_u->grp_rids[0]) * - r_u->num_grps); - - if (r_u->grp_rids == NULL && num_grps != 0) - { - return False; - } - for (i = 0; i < num_grps; i++) - { - r_u->grp_rids[i] = grps[i]; - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL creds_io_nt_sec(char *desc, CREDS_NT_SEC *r_u, prs_struct *ps, int depth) -{ - int i; - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "creds_io_nt"); - depth++; - - prs_align(ps); - - smb_io_dom_sid ("sid", &r_u->sid, ps, depth); - prs_align(ps); - - prs_uint32("num_grps", ps, depth, &(r_u->num_grps)); - if (r_u->num_grps != 0) - { - r_u->grp_rids = (uint32*)Realloc(r_u->grp_rids, - sizeof(r_u->grp_rids[0]) * - r_u->num_grps); - if (r_u->grp_rids == NULL) - { - creds_free_nt_sec(r_u); - return False; - } - } - for (i = 0; i < r_u->num_grps; i++) - { - prs_uint32("", ps, depth, &(r_u->grp_rids[i])); - } - - return True; -} - -/******************************************************************* -frees a structure. -********************************************************************/ -void creds_free_nt_sec(CREDS_NT_SEC *r_u) -{ - if (r_u->grp_rids != NULL) - { - free(r_u->grp_rids); - r_u->grp_rids = NULL; - } -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL creds_io_pwd_info(char *desc, struct pwd_info *pwd, prs_struct *ps, int depth) -{ - if (pwd == NULL) return False; - - prs_debug(ps, depth, desc, "creds_io_pwd_info"); - depth++; - - prs_align(ps); - - prs_uint32("nullpwd", ps, depth, &(pwd->null_pwd)); - if (pwd->null_pwd) - { - return True; - } - - prs_uint32("cleartext", ps, depth, &(pwd->cleartext)); - if (pwd->cleartext) - { - prs_string("password", ps, depth, pwd->password, strlen(pwd->password), sizeof(pwd->password)); - prs_align(ps); - return True; - } - prs_uint32("crypted", ps, depth, &(pwd->crypted)); - - prs_uint8s(False, "smb_lm_pwd", ps, depth, (char*)&pwd->smb_lm_pwd, sizeof(pwd->smb_lm_pwd)); - prs_align(ps); - prs_uint8s(False, "smb_nt_pwd", ps, depth, (char*)&pwd->smb_nt_pwd, sizeof(pwd->smb_nt_pwd)); - prs_align(ps); - - prs_uint8s(False, "smb_lm_owf", ps, depth, (char*)&pwd->smb_lm_owf, sizeof(pwd->smb_lm_owf)); - prs_align(ps); - prs_uint32("nt_owf_len", ps, depth, &(pwd->nt_owf_len)); - if (pwd->nt_owf_len > sizeof(pwd->smb_nt_owf)) - { - return False; - } - prs_uint8s(False, "smb_nt_owf", ps, depth, (char*)&pwd->smb_nt_owf, pwd->nt_owf_len); - prs_align(ps); - - prs_uint8s(False, "lm_cli_chal", ps, depth, (char*)&pwd->lm_cli_chal, sizeof(pwd->lm_cli_chal)); - prs_align(ps); - prs_uint32("nt_cli_chal_len", ps, depth, &(pwd->nt_cli_chal_len)); - - if (pwd->nt_cli_chal_len > sizeof(pwd->nt_cli_chal)) - { - return False; - } - prs_uint8s(False, "nt_cli_chal", ps, depth, (char*)&pwd->nt_cli_chal, pwd->nt_cli_chal_len); - prs_align(ps); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL creds_io_nt(char *desc, CREDS_NT *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "creds_io_nt"); - depth++; - - prs_align(ps); - - /* lkclXXXX CHEAT!!!!!!!! */ - prs_string("user_name", ps, depth, r_u->user_name, strlen(r_u->user_name), sizeof(r_u->user_name)); - prs_align(ps); - prs_string("domain", ps, depth, r_u->domain, strlen(r_u->domain), sizeof(r_u->domain)); - prs_align(ps); - - creds_io_pwd_info("pwd", &r_u->pwd, ps, depth); - prs_align(ps); - - prs_uint32("ntlmssp", ps, depth, &(r_u->ntlmssp_flags)); - - return True; -} - -/******************************************************************* -frees a structure. -********************************************************************/ -void creds_free_nt(CREDS_NT *r_u) -{ -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL creds_io_hybrid(char *desc, CREDS_HYBRID *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "creds_io_hybrid"); - depth++; - - prs_align(ps); - - prs_uint32("reuse", ps, depth, &(r_u->reuse)); - prs_uint32("ptr_ntc", ps, depth, &(r_u->ptr_ntc)); - prs_uint32("ptr_uxc", ps, depth, &(r_u->ptr_uxc)); - prs_uint32("ptr_nts", ps, depth, &(r_u->ptr_nts)); - prs_uint32("ptr_uxs", ps, depth, &(r_u->ptr_uxs)); - if (r_u->ptr_ntc != 0) - { - if (!creds_io_nt ("ntc", &r_u->ntc, ps, depth)) return False; - } - if (r_u->ptr_uxc != 0) - { - if (!creds_io_unix("uxc", &r_u->uxc, ps, depth)) return False; - } - if (r_u->ptr_nts != 0) - { - if (!creds_io_nt_sec ("nts", &r_u->nts, ps, depth)) return False; - } - if (r_u->ptr_uxs != 0) - { - if (!creds_io_unix_sec("uxs", &r_u->uxs, ps, depth)) return False; - } - return True; -} - -void copy_unix_creds(CREDS_UNIX *to, const CREDS_UNIX *from) -{ - if (from == NULL) - { - to->user_name[0] = 0; - return; - } - fstrcpy(to->user_name, from->user_name); -}; - -void copy_nt_sec_creds(CREDS_NT_SEC *to, const CREDS_NT_SEC *from) -{ - if (from == NULL) - { - ZERO_STRUCTP(to); - return; - } - memcpy(&to, &from, sizeof(*from)); -}; - -void copy_unix_sec_creds(CREDS_UNIX_SEC *to, const CREDS_UNIX_SEC *from) -{ - if (from == NULL) - { - to->uid = -1; - to->gid = -1; - to->num_grps = 0; - to->grps = NULL; - return; - } - to->uid = from->uid; - to->gid = from->gid; - to->num_grps = 0; - to->grps = NULL; - - if (from->num_grps != 0) - { - size_t size = from->num_grps * sizeof(from->grps[0]); - to->grps = (uint32*)malloc(size); - if (to->grps == NULL) - { - return; - } - to->num_grps = from->num_grps; - memcpy(to->grps, from->grps, size); - } -}; - -void copy_nt_creds(struct ntuser_creds *to, - const struct ntuser_creds *from) -{ - if (from == NULL) - { - to->domain[0] = 0; - to->user_name[0] = 0; - pwd_set_nullpwd(&to->pwd); - to->ntlmssp_flags = 0; - - return; - } - safe_strcpy(to->domain , from->domain , sizeof(from->domain )-1); - safe_strcpy(to->user_name, from->user_name, sizeof(from->user_name)-1); - memcpy(&to->pwd, &from->pwd, sizeof(from->pwd)); - to->ntlmssp_flags = from->ntlmssp_flags; -}; - -void copy_user_creds(struct user_creds *to, - const struct user_creds *from) -{ - ZERO_STRUCTP(to); - if (from == NULL) - { - to->ptr_ntc = 0; - to->ptr_uxc = 0; - to->ptr_nts = 0; - to->ptr_uxs = 0; - copy_nt_creds(&to->ntc, NULL); - copy_unix_creds(&to->uxc, NULL); - copy_nt_sec_creds(&to->nts, NULL); - copy_unix_sec_creds(&to->uxs, NULL); - to->reuse = False; - return; - } - to->ptr_nts = from->ptr_nts; - to->ptr_uxs = from->ptr_uxs; - to->ptr_ntc = from->ptr_ntc; - to->ptr_uxc = from->ptr_uxc; - if (to->ptr_ntc != 0) - { - copy_nt_creds(&to->ntc, &from->ntc); - } - if (to->ptr_uxc != 0) - { - copy_unix_creds(&to->uxc, &from->uxc); - } - if (to->ptr_ntc != 0) - { - copy_nt_sec_creds(&to->nts, &from->nts); - } - if (to->ptr_uxc != 0) - { - copy_unix_sec_creds(&to->uxs, &from->uxs); - } - to->reuse = from->reuse; -}; - -void free_user_creds(struct user_creds *creds) -{ - creds_free_unix(&creds->uxc); - creds_free_nt (&creds->ntc); - creds_free_unix_sec(&creds->uxs); - creds_free_nt_sec (&creds->nts); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL creds_io_cmd(char *desc, CREDS_CMD *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "creds_io_cmd"); - depth++; - - prs_align(ps); - - prs_uint16("version", ps, depth, &(r_u->version)); - prs_uint16("command", ps, depth, &(r_u->command)); - - prs_string("name ", ps, depth, r_u->name, strlen(r_u->name), sizeof(r_u->name)); - prs_align(ps); - - prs_uint32("ptr_creds", ps, depth, &(r_u->ptr_creds)); - if (r_u->ptr_creds != 0) - { - if (!creds_io_hybrid("creds", r_u->cred, ps, depth)) - { - return False; - } - } - - - return True; -} - - -BOOL create_ntuser_creds( prs_struct *ps, - const char* name, - uint16 version, uint16 command, - const struct ntuser_creds *ntu, - BOOL reuse) -{ - CREDS_CMD cmd; - struct user_creds usr; - - ZERO_STRUCT(cmd); - ZERO_STRUCT(usr); - - DEBUG(10,("create_user_creds: %s %d %d\n", - name, version, command)); - - usr.reuse = reuse; - - fstrcpy(cmd.name, name); - cmd.version = version; - cmd.command = command; - cmd.ptr_creds = ntu != NULL ? 1 : 0; - cmd.cred = &usr; - - if (ntu != NULL) - { - copy_nt_creds(&usr.ntc, ntu); - usr.ptr_ntc = 1; - } - else - { - usr.ptr_ntc = 0; - } - - prs_init(ps, 1024, 4, 0, False); - - ps->offset = 4; - return creds_io_cmd("creds", &cmd, ps, 0); -} - -BOOL create_user_creds( prs_struct *ps, - const char* name, - uint16 version, uint16 command, - const struct user_creds *usr) -{ - CREDS_CMD cmd; - - ZERO_STRUCT(cmd); - - DEBUG(10,("create_user_creds: %s %d %d\n", - name, version, command)); - - fstrcpy(cmd.name, name); - cmd.version = version; - cmd.command = command; - cmd.ptr_creds = usr != NULL ? 1 : 0; - cmd.cred = usr; - - prs_init(ps, 1024, 4, 0, False); - - ps->offset = 4; - return creds_io_cmd("creds", &cmd, ps, 0); -} diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c deleted file mode 100644 index 0b49ed5da7..0000000000 --- a/source3/rpc_parse/parse_eventlog.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Unix SMB/Netbios implementation. - * Version 1.9. - * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1999, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, - * Copyright (C) Jean Franois Micouleau 1998-1999. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "includes.h" - -extern int DEBUGLEVEL; - -/******************************************************************* -********************************************************************/ -BOOL make_eventlog_q_open(EVENTLOG_Q_OPEN *q_u, const char *journal, char *unk) -{ - int len_journal = journal != NULL ? strlen(journal) : 0; - int len_unk = unk != NULL ? strlen(unk) : 0; - - q_u->ptr0=0x1; - q_u->unk0=0x5c; - q_u->unk1=0x01; - - make_uni_hdr(&(q_u->hdr_source), len_journal); - make_unistr2(&(q_u->uni_source), journal, len_journal); - - make_uni_hdr(&(q_u->hdr_unk), len_unk); - make_unistr2(&(q_u->uni_unk), unk, len_unk); - - q_u->unk6=0x01; - q_u->unk7=0x01; - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL eventlog_io_q_open(char *desc, EVENTLOG_Q_OPEN *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "eventlog_io_q_open"); - depth++; - - prs_align(ps); - - prs_uint32("ptr0", ps, depth, &(q_u->ptr0)); - - prs_uint16("unk0", ps, depth, &(q_u->unk0)); - prs_uint16("unk1", ps, depth, &(q_u->unk1)); - - smb_io_unihdr("hdr_source", &(q_u->hdr_source), ps, depth); - smb_io_unistr2("uni_source", &(q_u->uni_source), - q_u->hdr_source.buffer, ps, depth); - prs_align(ps); - - smb_io_unihdr("hdr_unk", &(q_u->hdr_unk), ps, depth); - smb_io_unistr2("uni_unk", &(q_u->uni_unk), - q_u->hdr_unk.buffer, ps, depth); - prs_align(ps); - - prs_uint32("unk6", ps, depth, &(q_u->unk6)); - prs_uint32("unk7", ps, depth, &(q_u->unk7)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL eventlog_io_r_open(char *desc, EVENTLOG_R_OPEN *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "eventlog_io_r_open"); - depth++; - - prs_align(ps); - smb_io_pol_hnd("", &(r_u->pol), ps, depth); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL make_eventlog_q_close(EVENTLOG_Q_CLOSE *q_u, POLICY_HND *pol) -{ - memcpy(&(q_u->pol.data), pol->data, sizeof(q_u->pol.data)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL eventlog_io_q_close(char *desc, EVENTLOG_Q_CLOSE *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "eventlog_io_q_close"); - depth++; - - prs_align(ps); - smb_io_pol_hnd("", &(q_u->pol), ps, depth); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL eventlog_io_r_close(char *desc, EVENTLOG_R_CLOSE *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "eventlog_io_r_close"); - depth++; - - prs_align(ps); - smb_io_pol_hnd("", &(r_u->pol), ps, depth); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL make_eventlog_q_numofeventlogrec(EVENTLOG_Q_NUMOFEVENTLOGREC *q_u, POLICY_HND *pol) -{ - memcpy(&(q_u->pol.data), pol->data, sizeof(q_u->pol.data)); - - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL eventlog_io_q_numofeventlogrec(char *desc,EVENTLOG_Q_NUMOFEVENTLOGREC *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "eventlog_io_q_numofeventlogrec"); - depth++; - - prs_align(ps); - smb_io_pol_hnd("", &(q_u->pol), ps, depth); - - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL eventlog_io_r_numofeventlogrec(char *desc, EVENTLOG_R_NUMOFEVENTLOGREC *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "eventlog_io_r_numofeventlogrec"); - depth++; - - prs_align(ps); - prs_uint32("number", ps, depth, &(r_u->number)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL make_eventlog_q_readeventlog(EVENTLOG_Q_READEVENTLOG *q_u, POLICY_HND *pol, - uint32 flags, uint32 offset, uint32 number_of_bytes) -{ - memcpy(&(q_u->pol.data), pol->data, sizeof(q_u->pol.data)); - q_u->flags=flags; - q_u->offset=offset; - q_u->number_of_bytes=number_of_bytes; - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL eventlog_io_q_readeventlog(char *desc, EVENTLOG_Q_READEVENTLOG *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "eventlog_io_q_readeventlog"); - depth++; - - prs_align(ps); - smb_io_pol_hnd("", &(q_u->pol), ps, depth); - prs_uint32("flags", ps, depth, &(q_u->flags)); - prs_uint32("offset", ps, depth, &(q_u->offset)); - prs_uint32("number_of_bytes", ps, depth, &(q_u->number_of_bytes)); - - return True; -} - -/******************************************************************* -********************************************************************/ -static BOOL eventlog_io_eventlog(char *desc, EVENTLOGRECORD *ev, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "eventlog_io_eventlog"); - depth++; - - prs_align(ps); - prs_uint32("size", ps, depth, &(ev->size)); - prs_uint32("reserved", ps, depth, &(ev->reserved)); - prs_uint32("recordnumber", ps, depth, &(ev->recordnumber)); - prs_uint32("creationtime", ps, depth, &(ev->creationtime)); - prs_uint32("writetime", ps, depth, &(ev->writetime)); - prs_uint32("eventnumber", ps, depth, &(ev->eventnumber)); - - prs_uint16("eventtype", ps, depth, &(ev->eventtype)); - prs_uint16("num_of_strings", ps, depth, &(ev->num_of_strings)); - prs_uint16("category", ps, depth, &(ev->category)); - prs_uint16("reserved_flag", ps, depth, &(ev->reserved_flag)); - - prs_uint32("closingrecord", ps, depth, &(ev->closingrecord)); - prs_uint32("stringoffset", ps, depth, &(ev->stringoffset)); - prs_uint32("sid_length", ps, depth, &(ev->sid_length)); - prs_uint32("sid_offset", ps, depth, &(ev->sid_offset)); - prs_uint32("data_length", ps, depth, &(ev->data_length)); - prs_uint32("data_offset", ps, depth, &(ev->data_offset)); - - smb_io_unistr("", &(ev->sourcename), ps, depth); - smb_io_unistr("", &(ev->computername), ps, depth); - - if (ev->sid_length!=0) - smb_io_unistr("", &(ev->sid), ps, depth); - - if (ev->num_of_strings!=0) - smb_io_unistr("", &(ev->strings),ps, depth); - - if (ev->data_length) - smb_io_unistr("", &(ev->data), ps, depth); - - prs_uint32("size2", ps, depth, &(ev->size2)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL eventlog_io_r_readeventlog(char *desc, EVENTLOG_R_READEVENTLOG *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "eventlog_io_r_readeventlog"); - depth++; - - prs_align(ps); - prs_uint32("number_of_bytes", ps, depth, &(r_u->number_of_bytes)); - - if (r_u->number_of_bytes!= 0) - eventlog_io_eventlog("", r_u->event, ps, depth); - - prs_uint32("sent_size", ps, depth, &(r_u->sent_size)); - prs_uint32("real_size", ps, depth, &(r_u->real_size)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c deleted file mode 100644 index 5cb6179936..0000000000 --- a/source3/rpc_parse/parse_spoolss.c +++ /dev/null @@ -1,4408 +0,0 @@ -/* - * Unix SMB/Netbios implementation. - * Version 1.9. - * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1998, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, - * Copyright (C) Jean Franois Micouleau 1998. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -#include "includes.h" -#include "nterr.h" - -extern int DEBUGLEVEL; - - -/******************************************************************* -return the length of a UNISTR string. -********************************************************************/ -static uint32 str_len_uni(UNISTR *source) -{ - uint32 i=0; - - while (source->buffer[i]!=0x0000) - { - i++; - } - return i; -} - -/******************************************************************* -This should be moved in a more generic lib. -********************************************************************/ -static BOOL spoolss_io_system_time(char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) -{ - prs_uint16("year", ps, depth, &(systime->year)); - prs_uint16("month", ps, depth, &(systime->month)); - prs_uint16("dayofweek", ps, depth, &(systime->dayofweek)); - prs_uint16("day", ps, depth, &(systime->day)); - prs_uint16("hour", ps, depth, &(systime->hour)); - prs_uint16("minute", ps, depth, &(systime->minute)); - prs_uint16("second", ps, depth, &(systime->second)); - prs_uint16("milliseconds", ps, depth, &(systime->milliseconds)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL make_systemtime(SYSTEMTIME *systime, struct tm *unixtime) -{ - systime->year=unixtime->tm_year+1900; - systime->month=unixtime->tm_mon+1; - systime->dayofweek=unixtime->tm_wday; - systime->day=unixtime->tm_mday; - systime->hour=unixtime->tm_hour; - systime->minute=unixtime->tm_min; - systime->second=unixtime->tm_sec; - systime->milliseconds=0; - - return True; -} - -/******************************************************************* -reads or writes an POLICY_HND structure. -********************************************************************/ -static BOOL smb_io_prt_hnd(char *desc, POLICY_HND *hnd, prs_struct *ps, int depth) -{ - if (hnd == NULL) return False; - - prs_debug(ps, depth, desc, "smb_io_prt_hnd"); - depth++; - - prs_align(ps); - - prs_uint8s (False, "data", ps, depth, hnd->data, POLICY_HND_SIZE); - - return True; -} - -/******************************************************************* -reads or writes an DOC_INFO structure. -********************************************************************/ -static BOOL smb_io_doc_info_1(char *desc, DOC_INFO_1 *info_1, prs_struct *ps, int depth) -{ - if (info_1 == NULL) return False; - - prs_debug(ps, depth, desc, "smb_io_doc_info_1"); - depth++; - - prs_align(ps); - - prs_uint32("p_docname", ps, depth, &(info_1->p_docname)); - prs_uint32("p_outputfile", ps, depth, &(info_1->p_outputfile)); - prs_uint32("p_datatype", ps, depth, &(info_1->p_datatype)); - - smb_io_unistr2("", &(info_1->docname), info_1->p_docname, ps, depth); - smb_io_unistr2("", &(info_1->outputfile), info_1->p_outputfile, ps, depth); - smb_io_unistr2("", &(info_1->datatype), info_1->p_datatype, ps, depth); - - return True; -} - -/******************************************************************* -reads or writes an DOC_INFO structure. -********************************************************************/ -static BOOL smb_io_doc_info(char *desc, DOC_INFO *info, prs_struct *ps, int depth) -{ - uint32 useless_ptr=0; - - if (info == NULL) return False; - - prs_debug(ps, depth, desc, "smb_io_doc_info"); - depth++; - - prs_align(ps); - - prs_uint32("switch_value", ps, depth, &(info->switch_value)); - - prs_uint32("doc_info_X ptr", ps, depth, &(useless_ptr)); - - switch (info->switch_value) - { - case 1: - smb_io_doc_info_1("",&(info->doc_info_1), ps, depth); - break; - case 2: - /* - this is just a placeholder - - MSDN July 1998 says doc_info_2 is only on - Windows 95, and as Win95 doesn't do RPC to print - this case is nearly impossible - - Maybe one day with Windows for dishwasher 2037 ... - - */ - /* smb_io_doc_info_2("",&(info->doc_info_2), ps, depth); */ - break; - default: - DEBUG(0,("Something is obviously wrong somewhere !\n")); - break; - } - - return True; -} - -/******************************************************************* -reads or writes an DOC_INFO_CONTAINER structure. -********************************************************************/ -static BOOL smb_io_doc_info_container(char *desc, DOC_INFO_CONTAINER *cont, prs_struct *ps, int depth) -{ - if (cont == NULL) return False; - - prs_debug(ps, depth, desc, "smb_io_doc_info_container"); - depth++; - - prs_align(ps); - - prs_uint32("level", ps, depth, &(cont->level)); - - smb_io_doc_info("",&(cont->docinfo), ps, depth); - - return True; -} - -/******************************************************************* -reads or writes an NOTIFY OPTION TYPE structure. -********************************************************************/ -static BOOL smb_io_notify_option_type(char *desc, - SPOOL_NOTIFY_OPTION_TYPE *type, - prs_struct *ps, int depth) -{ - uint32 useless_ptr; - - prs_debug(ps, depth, desc, "smb_io_notify_option_type"); - depth++; - - prs_align(ps); - - prs_uint16("type", ps, depth, &(type->type)); - prs_uint16("reserved0", ps, depth, &(type->reserved0)); - prs_uint32("reserved1", ps, depth, &(type->reserved1)); - prs_uint32("reserved2", ps, depth, &(type->reserved2)); - prs_uint32("count", ps, depth, &(type->count)); - prs_uint32("useless ptr", ps, depth, &useless_ptr); - - - return True; -} - -/******************************************************************* -reads or writes an NOTIFY OPTION TYPE DATA. -********************************************************************/ -static BOOL smb_io_notify_option_type_data(char *desc, - SPOOL_NOTIFY_OPTION_TYPE *type, - prs_struct *ps, int depth) -{ - uint32 count; - int i; - - prs_debug(ps, depth, desc, "smb_io_notify_option_type_data"); - depth++; - - prs_align(ps); - - prs_uint32("count", ps, depth, &count); - - if (count != type->count) - { - DEBUG(4,("What a mess, count was %x now is %x !\n",type->count,count)); - type->count=count; - } - for(i=0;ifields[i])); - } - - return True; -} - -/******************************************************************* -reads or writes an NOTIFY OPTION structure. -********************************************************************/ -static BOOL smb_io_notify_option(char *desc, SPOOL_NOTIFY_OPTION *option, - prs_struct *ps, int depth) -{ - uint32 useless_ptr; - int i; - - prs_debug(ps, depth, desc, "smb_io_notify_option"); - depth++; - - prs_align(ps); - - /* memory pointer to the struct */ - prs_uint32("useless ptr", ps, depth, &useless_ptr); - - prs_uint32("version", ps, depth, &(option->version)); - prs_uint32("reserved", ps, depth, &(option->reserved)); - prs_uint32("count", ps, depth, &(option->count)); - prs_uint32("useless ptr", ps, depth, &useless_ptr); - prs_uint32("count", ps, depth, &(option->count)); - - /* read the option type struct */ - for(i=0;icount;i++) - { - smb_io_notify_option_type("",&(option->type[i]) ,ps, depth); - } - - /* now read the type associated with the option type struct */ - for(i=0;icount;i++) - { - smb_io_notify_option_type_data("",&(option->type[i]) ,ps, depth); - } - - - return True; -} - - -/******************************************************************* -reads or writes an NOTIFY INFO DATA structure. -********************************************************************/ -static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, - prs_struct *ps, int depth) -{ - uint32 useless_ptr=0xADDE0FF0; - - uint32 how_many_words; - BOOL isvalue; - uint32 x; - - prs_debug(ps, depth, desc, "smb_io_notify_info_data"); - depth++; - - how_many_words=data->size; - if (how_many_words==POINTER) - { - how_many_words=TWO_VALUE; - } - - isvalue=data->enc_type; - - prs_align(ps); - prs_uint16("type", ps, depth, &(data->type)); - prs_uint16("field", ps, depth, &(data->field)); - /*prs_align(ps);*/ - - prs_uint32("how many words", ps, depth, &how_many_words); - prs_uint32("id", ps, depth, &(data->id)); - prs_uint32("how many words", ps, depth, &how_many_words); - /*prs_align(ps);*/ - - if (isvalue==True) - { - prs_uint32("value[0]", ps, depth, &(data->notify_data.value[0])); - prs_uint32("value[1]", ps, depth, &(data->notify_data.value[1])); - /*prs_align(ps);*/ - } - else - { - /* it's a string */ - /* length in ascii including \0 */ - x=2*(data->notify_data.data.length+1); - prs_uint32("string length", ps, depth, &x ); - prs_uint32("pointer", ps, depth, &useless_ptr); - /*prs_align(ps);*/ - } - - return True; -} - -/******************************************************************* -reads or writes an NOTIFY INFO DATA structure. -********************************************************************/ -BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, - prs_struct *ps, int depth) -{ - uint32 x; - BOOL isvalue; - - prs_debug(ps, depth, desc, "smb_io_notify_info_data"); - depth++; - - prs_align(ps); - isvalue=data->enc_type; - - if (isvalue==False) - { - /* length of string in unicode include \0 */ - x=data->notify_data.data.length+1; - prs_uint32("string length", ps, depth, &x ); - prs_uint16s(True,"string",ps,depth,data->notify_data.data.string,x); - } - prs_align(ps); - - return True; -} - -/******************************************************************* -reads or writes an NOTIFY INFO structure. -********************************************************************/ -static BOOL smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, - prs_struct *ps, int depth) -{ - uint32 useless_ptr=0x0001; - int i; - - info->version=0x02; - prs_debug(ps, depth, desc, "smb_io_notify_info"); - depth++; - - prs_align(ps); - - prs_uint32("pointer", ps, depth, &useless_ptr); - prs_uint32("count", ps, depth, &(info->count)); - prs_uint32("version", ps, depth, &(info->version)); - prs_uint32("flags", ps, depth, &(info->flags)); - prs_uint32("count", ps, depth, &(info->count)); - - for (i=0;icount;i++) - { - smb_io_notify_info_data(desc, &(info->data[i]), ps, depth); - } - - /* now do the strings at the end of the stream */ - for (i=0;icount;i++) - { - smb_io_notify_info_data_strings(desc, &(info->data[i]), - ps, depth); - } - - return True; -} - -/******************************************************************* - * write a structure. - * called from static spoolss_r_open_printer_ex (srv_spoolss.c) - * called from spoolss_open_printer_ex (cli_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "spoolss_io_r_open_printer_ex"); - depth++; - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(r_u->handle),ps,depth); - -/* prs_align(ps);*/ - - prs_uint32("status code", ps, depth, &(r_u->status)); - - - return True; -} - -/******************************************************************* - * make a structure. - ********************************************************************/ -BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, - const char *printername, - uint32 cbbuf, uint32 devmod, uint32 des_access, - const char *station, - const char *username) -{ - int len_name = printername != NULL ? strlen(printername) : 0; - int len_sta = station != NULL ? strlen(station ) : 0; - int len_user = username != NULL ? strlen(username ) : 0; - - if (q_u == NULL) return False; - - DEBUG(5,("make_spoolss_io_q_open_printer_ex\n")); - - q_u->ptr = 1; - make_unistr2(&(q_u->printername), printername, len_name); - - q_u->unknown0 = 0x0; /* 0x0000 0000 */ - q_u->cbbuf = cbbuf; /* 0x0000 0000 */ - q_u->devmod = devmod; /* 0x0000 0000 */ - q_u->access_required = des_access; - - q_u->unknown1 = 0x1; - q_u->unknown2 = 0x1; - q_u->unknown3 = 0x149f7d8; /* looks like a pointer */ - q_u->unknown4 = 0x1c; - q_u->unknown5 = 0x00b94dd0; - q_u->unknown6 = 0x0149f5cc; /* looks like _another_ pointer */ - q_u->unknown7 = 0x00000565; - q_u->unknown8 = 0x2; - q_u->unknown9 = 0x0; - q_u->unknown10 = 0x0; - - make_unistr2(&(q_u->station), station, len_sta); - make_unistr2(&(q_u->username), username, len_user); - - return True; -} - -/******************************************************************* - * read a structure. - * called from spoolss_q_open_printer_ex (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "spoolss_io_q_open_printer_ex"); - depth++; - - prs_align(ps); - - prs_uint32("ptr", ps, depth, &(q_u->ptr)); - smb_io_unistr2("", &(q_u->printername),True,ps,depth); - - prs_align(ps); - - prs_uint32("unknown0", ps, depth, &(q_u->unknown0)); - prs_uint32("cbbuf", ps, depth, &(q_u->cbbuf)); - prs_uint32("devmod", ps, depth, &(q_u->devmod)); - prs_uint32("access required", ps, depth, &(q_u->access_required)); - - /* don't care to decode end of packet by now */ - /* but when acl will be implemented, it will be useful */ - - prs_uint32("unknown1", ps, depth, &(q_u->unknown1)); - prs_uint32("unknown2", ps, depth, &(q_u->unknown2)); - prs_uint32("unknown3", ps, depth, &(q_u->unknown3)); - prs_uint32("unknown4", ps, depth, &(q_u->unknown4)); - prs_uint32("unknown5", ps, depth, &(q_u->unknown5)); - prs_uint32("unknown6", ps, depth, &(q_u->unknown6)); - prs_uint32("unknown7", ps, depth, &(q_u->unknown7)); - prs_uint32("unknown8", ps, depth, &(q_u->unknown8)); - prs_uint32("unknown9", ps, depth, &(q_u->unknown9)); - prs_uint32("unknown10", ps, depth, &(q_u->unknown10)); - - smb_io_unistr2("", &(q_u->station),True,ps,depth); - prs_align(ps); - smb_io_unistr2("", &(q_u->username),True,ps,depth); - prs_align(ps); - - return True; -} - -/******************************************************************* - * make a structure. - ********************************************************************/ -BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, - POLICY_HND *handle, - char *valuename, - uint32 size) -{ - int len_name = valuename != NULL ? strlen(valuename) : 0; - - if (q_u == NULL) return False; - - DEBUG(5,("make_spoolss_q_getprinterdata\n")); - - memcpy(&(q_u->handle), handle, sizeof(q_u->handle)); - make_unistr2(&(q_u->valuename), valuename, len_name); - q_u->size = size; - - return True; -} - -/******************************************************************* - * read a structure. - * called from spoolss_q_getprinterdata (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_q_getprinterdata(char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdata"); - depth++; - - prs_align(ps); - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - prs_align(ps); - smb_io_unistr2("", &(q_u->valuename),True,ps,depth); - prs_align(ps); - prs_uint32("size", ps, depth, &(q_u->size)); - - return True; -} - -/******************************************************************* - * write a structure. - * called from spoolss_r_getprinterdata (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdata"); - depth++; - - /* grow buffer mem enough */ - mem_grow_data(&(ps->data), ps->io, r_u->size+100, 0); - - prs_align(ps); - prs_uint32("type", ps, depth, &(r_u->type)); - prs_uint32("size", ps, depth, &(r_u->size)); - - prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size); - prs_align(ps); - - prs_uint32("needed", ps, depth, &(r_u->needed)); - prs_uint32("status", ps, depth, &(r_u->status)); - prs_align(ps); - - return True; -} - -/******************************************************************* - * make a structure. - ********************************************************************/ -BOOL make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER *q_u, POLICY_HND *hnd) -{ - if (q_u == NULL) return False; - - DEBUG(5,("make_spoolss_q_closeprinter\n")); - - memcpy(&(q_u->handle), hnd, sizeof(q_u->handle)); - - return True; -} - -/******************************************************************* - * read a structure. - * called from static spoolss_q_closeprinter (srv_spoolss.c) - * called from spoolss_closeprinter (cli_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_q_closeprinter(char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "spoolss_io_q_closeprinter"); - depth++; - - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - - return True; -} - -/******************************************************************* - * write a structure. - * called from static spoolss_r_closeprinter (srv_spoolss.c) - * called from spoolss_closeprinter (cli_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_r_closeprinter(char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_closeprinter"); - depth++; - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(r_u->handle),ps,depth); - prs_uint32("status", ps, depth, &(r_u->status)); - - - return True; -} - -/******************************************************************* - * read a structure. - * called from spoolss_q_startdocprinter (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_q_startdocprinter(char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "spoolss_io_q_startdocprinter"); - depth++; - - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - - smb_io_doc_info_container("",&(q_u->doc_info_container), ps, depth); - - return True; -} - -/******************************************************************* - * write a structure. - * called from spoolss_r_startdocprinter (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_r_startdocprinter(char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_startdocprinter"); - depth++; - prs_uint32("jobid", ps, depth, &(r_u->jobid)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* - * read a structure. - * called from spoolss_q_enddocprinter (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_q_enddocprinter(char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "spoolss_io_q_enddocprinter"); - depth++; - - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - - return True; -} - -/******************************************************************* - * write a structure. - * called from spoolss_r_enddocprinter (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_r_enddocprinter(char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_enddocprinter"); - depth++; - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* - * read a structure. - * called from spoolss_q_startpageprinter (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_q_startpageprinter(char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "spoolss_io_q_startpageprinter"); - depth++; - - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - - return True; -} - -/******************************************************************* - * write a structure. - * called from spoolss_r_startpageprinter (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_r_startpageprinter(char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_startpageprinter"); - depth++; - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* - * read a structure. - * called from spoolss_q_endpageprinter (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_q_endpageprinter(char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "spoolss_io_q_endpageprinter"); - depth++; - - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - - return True; -} - -/******************************************************************* - * write a structure. - * called from spoolss_r_endpageprinter (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_r_endpageprinter(char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_endpageprinter"); - depth++; - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* - * read a structure. - * called from spoolss_q_writeprinter (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "spoolss_io_q_writeprinter"); - depth++; - - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("buffer_size", ps, depth, &(q_u->buffer_size)); - - if (q_u->buffer_size!=0) - { - q_u->buffer=(uint8 *)malloc(q_u->buffer_size*sizeof(uint8)); - prs_uint8s(True, "buffer", ps, depth, q_u->buffer, q_u->buffer_size); - } - prs_align(ps); - prs_uint32("buffer_size2", ps, depth, &(q_u->buffer_size2)); - - return True; -} - -/******************************************************************* - * write a structure. - * called from spoolss_r_writeprinter (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_r_writeprinter(char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_writeprinter"); - depth++; - prs_uint32("buffer_written", ps, depth, &(r_u->buffer_written)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* - * read a structure. - * called from spoolss_q_rffpcnex (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, - prs_struct *ps, int depth) -{ - uint32 useless_ptr; - - prs_debug(ps, depth, desc, "spoolss_io_q_rffpcnex"); - depth++; - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("flags", ps, depth, &(q_u->flags)); - prs_uint32("options", ps, depth, &(q_u->options)); - prs_uint32("useless ptr", ps, depth, &useless_ptr); - /*prs_align(ps);*/ - - smb_io_unistr2("", &(q_u->localmachine), True, ps, depth); - - prs_align(ps); - prs_uint32("printerlocal", ps, depth, &(q_u->printerlocal)); - - smb_io_notify_option("notify option", &(q_u->option), ps, depth); - - - return True; -} - -/******************************************************************* - * write a structure. - * called from spoolss_r_rffpcnex (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_rffpcnex"); - depth++; - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* - * read a structure. - * called from spoolss_q_rfnpcnex (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, - prs_struct *ps, int depth) -{ - - prs_debug(ps, depth, desc, "spoolss_io_q_rfnpcnex"); - depth++; - - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - - prs_uint32("change", ps, depth, &(q_u->change)); - - smb_io_notify_option("notify option",&(q_u->option),ps,depth); - - return True; -} - -/******************************************************************* - * write a structure. - * called from spoolss_r_rfnpcnex (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_r_rfnpcnex(char *desc, - SPOOL_R_RFNPCNEX *r_u, - prs_struct *ps, int depth) -{ - uint32 x=0x0; - - prs_debug(ps, depth, desc, "spoolss_io_r_rfnpcnex"); - depth++; - - prs_align(ps); - - smb_io_notify_info("notify info",&(r_u->info),ps,depth); - prs_align(ps); - prs_uint32("status", ps, depth, &(x)); - - return True; -} - -/******************************************************************* - * return the length of a uint32 (obvious, but the code is clean) - ********************************************************************/ -static uint32 size_of_uint32(uint32 *value) -{ - return (sizeof(*value)); - - return True; -} - -/******************************************************************* - * return the length of a UNICODE string in number of char, includes: - * - the leading zero - * - the relative pointer size - ********************************************************************/ -static uint32 size_of_relative_string(UNISTR *string) -{ - uint32 size=0; - - size=str_len_uni(string); /* the string length */ - size=size+1; /* add the leading zero */ - size=size*2; /* convert in char */ - size=size+4; /* add the size of the ptr */ - return (size); - - return True; -} - -/******************************************************************* - * return the length of a uint32 (obvious, but the code is clean) - ********************************************************************/ -static uint32 size_of_device_mode(DEVICEMODE *devmode) -{ - if (devmode==NULL) - return (4); - else - return (0xDC+4); - - return True; -} - -/******************************************************************* - * return the length of a uint32 (obvious, but the code is clean) - ********************************************************************/ -static uint32 size_of_systemtime(SYSTEMTIME *systime) -{ - if (systime==NULL) - return (4); - else - return (sizeof(SYSTEMTIME) +4); - - return True; -} - -/******************************************************************* - * write a UNICODE string. - * used by all the RPC structs passing a buffer - ********************************************************************/ -static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) -{ - if (uni == NULL) return False; - - prs_debug(ps, depth, desc, "spoolss_smb_io_unistr"); - depth++; - prs_unistr("unistr", ps, depth, uni); - - return True; -} - - -/******************************************************************* - * write a UNICODE string and its relative pointer. - * used by all the RPC structs passing a buffer - ********************************************************************/ -static BOOL smb_io_relstr(char *desc, prs_struct *ps, int depth, UNISTR *buffer, - uint32 *start_offset, uint32 *end_offset) -{ - if (!ps->io) - { - uint32 struct_offset = ps->offset; - uint32 relative_offset; - - /* writing */ - *end_offset -= 2*(str_len_uni(buffer)+1); - ps->offset=*end_offset; - spoolss_smb_io_unistr(desc, buffer, ps, depth); - - ps->offset=struct_offset; - relative_offset=*end_offset-*start_offset; - - prs_uint32("offset", ps, depth, &(relative_offset)); - } - else - { - uint32 old_offset; - uint32 relative_offset; - - prs_uint32("offset", ps, depth, &(relative_offset)); - - old_offset = ps->offset; - ps->offset = (*start_offset) + relative_offset; - - spoolss_smb_io_unistr(desc, buffer, ps, depth); - - *end_offset = ps->offset; - ps->offset = old_offset; - } - return True; -} - - -/******************************************************************* - * write a array UNICODE strings and its relative pointer. - * used by 2 RPC structs - ********************************************************************/ -static BOOL smb_io_relarraystr(char *desc, prs_struct *ps, int depth, UNISTR ***buffer, - uint32 *start_offset, uint32 *end_offset) -{ - int i=0; - uint32 struct_offset; - uint32 relative_offset; - struct_offset=ps->offset; - - while ( (*buffer)[i]!=0x0000 ) - { - i++; - } - - i--; - - /* that's for the ending NULL */ - *end_offset-=2; - - do - { - *end_offset-= 2*(str_len_uni((*buffer)[i])+1); - ps->offset=*end_offset; - spoolss_smb_io_unistr(desc, (*buffer)[i], ps, depth); - - i--; - } - while (i>=0); - - ps->offset=struct_offset; - relative_offset=*end_offset-*start_offset; - - prs_uint32("offset", ps, depth, &(relative_offset)); - - return True; -} - -/******************************************************************* - * write a DEVICEMODE struct. - * on reading allocate memory for the private member - ********************************************************************/ -static BOOL smb_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) -{ - prs_debug(ps, depth, desc, "smb_io_devmode"); - depth++; - - prs_uint16s(True,"devicename", ps, depth, devmode->devicename.buffer, 32); - prs_uint16("specversion", ps, depth, &(devmode->specversion)); - prs_uint16("driverversion", ps, depth, &(devmode->driverversion)); - prs_uint16("size", ps, depth, &(devmode->size)); - prs_uint16("driverextra", ps, depth, &(devmode->driverextra)); - prs_uint32("fields", ps, depth, &(devmode->fields)); - prs_uint16("orientation", ps, depth, &(devmode->orientation)); - prs_uint16("papersize", ps, depth, &(devmode->papersize)); - prs_uint16("paperlength", ps, depth, &(devmode->paperlength)); - prs_uint16("paperwidth", ps, depth, &(devmode->paperwidth)); - prs_uint16("scale", ps, depth, &(devmode->scale)); - prs_uint16("copies", ps, depth, &(devmode->copies)); - prs_uint16("defaultsource", ps, depth, &(devmode->defaultsource)); - prs_uint16("printquality", ps, depth, &(devmode->printquality)); - prs_uint16("color", ps, depth, &(devmode->color)); - prs_uint16("duplex", ps, depth, &(devmode->duplex)); - prs_uint16("yresolution", ps, depth, &(devmode->yresolution)); - prs_uint16("ttoption", ps, depth, &(devmode->ttoption)); - prs_uint16("collate", ps, depth, &(devmode->collate)); - prs_uint16s(True, "formname", ps, depth, devmode->formname.buffer, 32); - prs_uint16("logpixels", ps, depth, &(devmode->logpixels)); - prs_uint32("bitsperpel", ps, depth, &(devmode->bitsperpel)); - prs_uint32("pelswidth", ps, depth, &(devmode->pelswidth)); - prs_uint32("pelsheight", ps, depth, &(devmode->pelsheight)); - prs_uint32("displayflags", ps, depth, &(devmode->displayflags)); - prs_uint32("displayfrequency", ps, depth, &(devmode->displayfrequency)); - prs_uint32("icmmethod", ps, depth, &(devmode->icmmethod)); - prs_uint32("icmintent", ps, depth, &(devmode->icmintent)); - prs_uint32("mediatype", ps, depth, &(devmode->mediatype)); - prs_uint32("dithertype", ps, depth, &(devmode->dithertype)); - prs_uint32("reserved1", ps, depth, &(devmode->reserved1)); - prs_uint32("reserved2", ps, depth, &(devmode->reserved2)); - prs_uint32("panningwidth", ps, depth, &(devmode->panningwidth)); - prs_uint32("panningheight", ps, depth, &(devmode->panningheight)); - - if (devmode->driverextra!=0) - { - if (ps->io) - { - devmode->private=(uint8 *)malloc(devmode->driverextra*sizeof(uint8)); - DEBUG(7,("smb_io_devmode: allocated memory [%d] for private\n",devmode->driverextra)); - } - DEBUG(7,("smb_io_devmode: parsing [%d] bytes of private\n",devmode->driverextra)); - - prs_uint8s(True, "private", ps, depth, devmode->private, devmode->driverextra); - DEBUG(8,("smb_io_devmode: parsed\n")); - } - - return True; -} - -/******************************************************************* - * write a DEVMODE struct and its relative pointer. - * used by all the RPC structs passing a buffer - ********************************************************************/ -static BOOL smb_io_reldevmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode, - uint32 *start_offset, uint32 *end_offset) -{ - uint32 struct_offset; - uint32 relative_offset; - - prs_debug(ps, depth, desc, "smb_io_reldevmode"); - depth++; - - struct_offset=ps->offset; - *end_offset-= (devmode->size+devmode->driverextra); - ps->offset=*end_offset; - - smb_io_devmode(desc, ps, depth, devmode); - - ps->offset=struct_offset; - relative_offset=*end_offset-*start_offset; - - prs_uint32("offset", ps, depth, &(relative_offset)); - - return True; -} - -/******************************************************************* -********************************************************************/ -static BOOL smb_io_printer_info_0(char *desc, PRINTER_INFO_0 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - prs_debug(ps, depth, desc, "smb_io_printer_info_0"); - depth++; - *start_offset=ps->offset; - - smb_io_relstr("printername",ps, depth, &(info->printername), start_offset, end_offset); - smb_io_relstr("servername",ps, depth, &(info->servername), start_offset, end_offset); - prs_uint32("cjobs", ps, depth, &(info->cjobs)); - prs_uint32("attributes", ps, depth, &(info->attributes)); - - prs_uint32("unknown0", ps, depth, &(info->unknown0)); - prs_uint32("unknown1", ps, depth, &(info->unknown1)); - prs_uint32("unknown2", ps, depth, &(info->unknown2)); - prs_uint32("unknown3", ps, depth, &(info->unknown3)); - prs_uint32("unknown4", ps, depth, &(info->unknown4)); - prs_uint32("unknown5", ps, depth, &(info->unknown5)); - prs_uint32("unknown6", ps, depth, &(info->unknown6)); - prs_uint16("majorversion", ps, depth, &(info->majorversion)); - prs_uint16("buildversion", ps, depth, &(info->buildversion)); - prs_uint32("unknown7", ps, depth, &(info->unknown7)); - prs_uint32("unknown8", ps, depth, &(info->unknown8)); - prs_uint32("unknown9", ps, depth, &(info->unknown9)); - prs_uint32("unknown10", ps, depth, &(info->unknown10)); - prs_uint32("unknown11", ps, depth, &(info->unknown11)); - prs_uint32("unknown12", ps, depth, &(info->unknown12)); - prs_uint32("unknown13", ps, depth, &(info->unknown13)); - prs_uint32("unknown14", ps, depth, &(info->unknown14)); - prs_uint32("unknown15", ps, depth, &(info->unknown15)); - prs_uint32("unknown16", ps, depth, &(info->unknown16)); - prs_uint32("unknown17", ps, depth, &(info->unknown17)); - prs_uint32("unknown18", ps, depth, &(info->unknown18)); - prs_uint32("status" , ps, depth, &(info->status)); - prs_uint32("unknown20", ps, depth, &(info->unknown20)); - prs_uint32("unknown21", ps, depth, &(info->unknown21)); - prs_uint16("unknown22", ps, depth, &(info->unknown22)); - prs_uint32("unknown23", ps, depth, &(info->unknown23)); - - return True; -} - -/******************************************************************* -********************************************************************/ -static BOOL smb_io_printer_info_1(char *desc, PRINTER_INFO_1 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - prs_debug(ps, depth, desc, "smb_io_printer_info_1"); - depth++; - *start_offset=ps->offset; - - prs_uint32("flags", ps, depth, &(info->flags)); - smb_io_relstr("description",ps, depth, &(info->description), start_offset, end_offset); - smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); - smb_io_relstr("comment",ps, depth, &(info->comment), start_offset, end_offset); - - return True; -} - -/******************************************************************* -********************************************************************/ -static BOOL smb_io_printer_info_2(char *desc, PRINTER_INFO_2 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - uint32 pipo=0; - uint32 devmode_offset; - uint32 backup_offset; - - prs_debug(ps, depth, desc, "smb_io_printer_info_2"); - depth++; - *start_offset=ps->offset; - - smb_io_relstr("servername", ps, depth, &(info->servername), start_offset, end_offset); - smb_io_relstr("printername", ps, depth, &(info->printername), start_offset, end_offset); - smb_io_relstr("sharename", ps, depth, &(info->sharename), start_offset, end_offset); - smb_io_relstr("portname", ps, depth, &(info->portname), start_offset, end_offset); - smb_io_relstr("drivername", ps, depth, &(info->drivername), start_offset, end_offset); - smb_io_relstr("comment", ps, depth, &(info->comment), start_offset, end_offset); - smb_io_relstr("location", ps, depth, &(info->location), start_offset, end_offset); - - devmode_offset=ps->offset; - ps->offset=ps->offset+4; - - smb_io_relstr("sepfile", ps, depth, &(info->sepfile), start_offset, end_offset); - smb_io_relstr("printprocessor",ps, depth, &(info->printprocessor), start_offset, end_offset); - smb_io_relstr("datatype", ps, depth, &(info->datatype), start_offset, end_offset); - smb_io_relstr("parameters", ps, depth, &(info->parameters), start_offset, end_offset); - - prs_uint32("security descriptor", ps, depth, &(pipo)); - - prs_uint32("attributes", ps, depth, &(info->attributes)); - prs_uint32("priority", ps, depth, &(info->priority)); - prs_uint32("defpriority", ps, depth, &(info->defaultpriority)); - prs_uint32("starttime", ps, depth, &(info->starttime)); - prs_uint32("untiltime", ps, depth, &(info->untiltime)); - prs_uint32("status", ps, depth, &(info->status)); - prs_uint32("jobs", ps, depth, &(info->cjobs)); - prs_uint32("averageppm", ps, depth, &(info->averageppm)); - - /* - I'm not sure if putting the devmode at the end the struct is worth it - but NT does it - */ - backup_offset=ps->offset; - ps->offset=devmode_offset; - smb_io_reldevmode("devmode", ps, depth, info->devmode, start_offset, end_offset); - ps->offset=backup_offset; - - return True; -} - -/******************************************************************* -********************************************************************/ -static BOOL smb_io_printer_driver_info_1(char *desc, DRIVER_INFO_1 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - prs_debug(ps, depth, desc, "smb_io_printer_driver_info_1"); - depth++; - *start_offset=ps->offset; - - smb_io_relstr("name", ps, depth, &(info->name), start_offset, end_offset); - - return True; -} - -/******************************************************************* -********************************************************************/ -static BOOL smb_io_printer_driver_info_2(char *desc, DRIVER_INFO_2 *info,prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - prs_debug(ps, depth, desc, "smb_io_printer_xxx"); - depth++; - *start_offset=ps->offset; - - prs_uint32("version", ps, depth, &(info->version)); - smb_io_relstr("name", ps, depth, &(info->name), start_offset, end_offset); - smb_io_relstr("architecture", ps, depth, &(info->architecture), start_offset, end_offset); - smb_io_relstr("driverpath", ps, depth, &(info->driverpath), start_offset, end_offset); - smb_io_relstr("datafile", ps, depth, &(info->datafile), start_offset, end_offset); - smb_io_relstr("configfile", ps, depth, &(info->configfile), start_offset, end_offset); - - return True; -} - -/******************************************************************* -********************************************************************/ -static BOOL smb_io_printer_driver_info_3(char *desc, DRIVER_INFO_3 *info,prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - prs_debug(ps, depth, desc, "smb_io_printer_driver_info_3"); - depth++; - *start_offset=ps->offset; - - prs_uint32("version", ps, depth, &(info->version)); - smb_io_relstr("name", ps, depth, &(info->name), start_offset, end_offset); - smb_io_relstr("architecture", ps, depth, &(info->architecture), start_offset, end_offset); - smb_io_relstr("driverpath", ps, depth, &(info->driverpath), start_offset, end_offset); - smb_io_relstr("datafile", ps, depth, &(info->datafile), start_offset, end_offset); - smb_io_relstr("configfile", ps, depth, &(info->configfile), start_offset, end_offset); - smb_io_relstr("helpfile", ps, depth, &(info->helpfile), start_offset, end_offset); - - smb_io_relarraystr("dependentfiles", ps, depth, &(info->dependentfiles), start_offset, end_offset); - - smb_io_relstr("monitorname", ps, depth, &(info->monitorname), start_offset, end_offset); - smb_io_relstr("defaultdatatype", ps, depth, &(info->defaultdatatype), start_offset, end_offset); - - return True; -} - -/******************************************************************* -********************************************************************/ -static BOOL smb_io_job_info_1(char *desc, JOB_INFO_1 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - prs_debug(ps, depth, desc, "smb_io_job_info_1"); - depth++; - *start_offset=ps->offset; - - prs_uint32("jobid", ps, depth, &(info->jobid)); - smb_io_relstr("printername", ps, depth, &(info->printername), start_offset, end_offset); - smb_io_relstr("machinename", ps, depth, &(info->machinename), start_offset, end_offset); - smb_io_relstr("username", ps, depth, &(info->username), start_offset, end_offset); - smb_io_relstr("document", ps, depth, &(info->document), start_offset, end_offset); - smb_io_relstr("datatype", ps, depth, &(info->datatype), start_offset, end_offset); - smb_io_relstr("text_status", ps, depth, &(info->text_status), start_offset, end_offset); - prs_uint32("status", ps, depth, &(info->status)); - prs_uint32("priority", ps, depth, &(info->priority)); - prs_uint32("position", ps, depth, &(info->position)); - prs_uint32("totalpages", ps, depth, &(info->totalpages)); - prs_uint32("pagesprinted", ps, depth, &(info->pagesprinted)); - spoolss_io_system_time("submitted", ps, depth, &(info->submitted) ); - - return True; -} - -/******************************************************************* -********************************************************************/ -static BOOL smb_io_job_info_2(char *desc, JOB_INFO_2 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - int pipo=0; - prs_debug(ps, depth, desc, "smb_io_job_info_2"); - depth++; - *start_offset=ps->offset; - - prs_uint32("jobid", ps, depth, &(info->jobid)); - smb_io_relstr("printername", ps, depth, &(info->printername), start_offset, end_offset); - smb_io_relstr("machinename", ps, depth, &(info->machinename), start_offset, end_offset); - smb_io_relstr("username", ps, depth, &(info->username), start_offset, end_offset); - smb_io_relstr("document", ps, depth, &(info->document), start_offset, end_offset); - smb_io_relstr("notifyname", ps, depth, &(info->notifyname), start_offset, end_offset); - smb_io_relstr("datatype", ps, depth, &(info->datatype), start_offset, end_offset); - - smb_io_relstr("printprocessor", ps, depth, &(info->printprocessor), start_offset, end_offset); - smb_io_relstr("parameters", ps, depth, &(info->parameters), start_offset, end_offset); - smb_io_relstr("drivername", ps, depth, &(info->drivername), start_offset, end_offset); - smb_io_reldevmode("devmode", ps, depth, info->devmode, start_offset, end_offset); - smb_io_relstr("text_status", ps, depth, &(info->text_status), start_offset, end_offset); - -/* SEC_DESC sec_desc;*/ - prs_uint32("Hack! sec desc", ps, depth, &pipo); - - prs_uint32("status", ps, depth, &(info->status)); - prs_uint32("priority", ps, depth, &(info->priority)); - prs_uint32("position", ps, depth, &(info->position)); - prs_uint32("starttime", ps, depth, &(info->starttime)); - prs_uint32("untiltime", ps, depth, &(info->untiltime)); - prs_uint32("totalpages", ps, depth, &(info->totalpages)); - prs_uint32("size", ps, depth, &(info->size)); - spoolss_io_system_time("submitted", ps, depth, &(info->submitted) ); - prs_uint32("timeelapsed", ps, depth, &(info->timeelapsed)); - prs_uint32("pagesprinted", ps, depth, &(info->pagesprinted)); - - return True; -} - -/******************************************************************* -********************************************************************/ -static BOOL smb_io_form_1(char *desc, FORM_1 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - prs_debug(ps, depth, desc, "smb_io_form_1"); - depth++; - *start_offset=ps->offset; - - prs_uint32("flag", ps, depth, &(info->flag)); - smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); - prs_uint32("width", ps, depth, &(info->width)); - prs_uint32("length", ps, depth, &(info->length)); - prs_uint32("left", ps, depth, &(info->left)); - prs_uint32("top", ps, depth, &(info->top)); - prs_uint32("right", ps, depth, &(info->right)); - prs_uint32("bottom", ps, depth, &(info->bottom)); - - return True; -} - -/******************************************************************* -********************************************************************/ -static BOOL smb_io_port_2(char *desc, PORT_INFO_2 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - prs_debug(ps, depth, desc, "smb_io_form_1"); - depth++; - *start_offset=ps->offset; - - smb_io_relstr("port_name",ps, depth, &(info->port_name), start_offset, end_offset); - smb_io_relstr("monitor_name",ps, depth, &(info->monitor_name), start_offset, end_offset); - smb_io_relstr("description",ps, depth, &(info->description), start_offset, end_offset); - prs_uint32("port_type", ps, depth, &(info->port_type)); - prs_uint32("reserved", ps, depth, &(info->reserved)); - - return True; -} - -/******************************************************************* -********************************************************************/ -static BOOL smb_io_processor_info_1(char *desc, PRINTPROCESSOR_1 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - prs_debug(ps, depth, desc, "smb_io_processor_info_1"); - depth++; - *start_offset=ps->offset; - - smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); - - return True; -} - -/******************************************************************* -********************************************************************/ -static BOOL smb_io_monitor_info_1(char *desc, PRINTMONITOR_1 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - prs_debug(ps, depth, desc, "smb_io_monitor_info_1"); - depth++; - *start_offset=ps->offset; - - smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); - - return True; -} - -/******************************************************************* -return the size required by a struct in the stream -********************************************************************/ -static uint32 spoolss_size_printer_info_0(PRINTER_INFO_0 *info) -{ - int size=0; - - size+=size_of_uint32( &(info->attributes) ); - size+=size_of_relative_string( &(info->printername) ); - size+=size_of_relative_string( &(info->servername) ); - return (size); - - return True; -} - -/******************************************************************* -return the size required by a struct in the stream -********************************************************************/ -static uint32 spoolss_size_printer_info_1(PRINTER_INFO_1 *info) -{ - int size=0; - - size+=size_of_uint32( &(info->flags) ); - size+=size_of_relative_string( &(info->description) ); - size+=size_of_relative_string( &(info->name) ); - size+=size_of_relative_string( &(info->comment) ); - return (size); - - return True; -} - -/******************************************************************* -return the size required by a struct in the stream -********************************************************************/ -static uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) -{ - int size=0; - - size+=4; /* the security descriptor */ - size+=info->devmode->size+4; /* size of the devmode and the ptr */ - size+=info->devmode->driverextra; /* if a devmode->private section exists, add its size */ - - size+=size_of_relative_string( &(info->servername) ); - size+=size_of_relative_string( &(info->printername) ); - size+=size_of_relative_string( &(info->sharename) ); - size+=size_of_relative_string( &(info->portname) ); - size+=size_of_relative_string( &(info->drivername) ); - size+=size_of_relative_string( &(info->comment) ); - size+=size_of_relative_string( &(info->location) ); - - size+=size_of_relative_string( &(info->sepfile) ); - size+=size_of_relative_string( &(info->printprocessor) ); - size+=size_of_relative_string( &(info->datatype) ); - size+=size_of_relative_string( &(info->parameters) ); - - size+=size_of_uint32( &(info->attributes) ); - size+=size_of_uint32( &(info->priority) ); - size+=size_of_uint32( &(info->defaultpriority) ); - size+=size_of_uint32( &(info->starttime) ); - size+=size_of_uint32( &(info->untiltime) ); - size+=size_of_uint32( &(info->status) ); - size+=size_of_uint32( &(info->cjobs) ); - size+=size_of_uint32( &(info->averageppm) ); - return (size); - - return True; -} - -/******************************************************************* -return the size required by a struct in the stream -********************************************************************/ -static uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info) -{ - int size=0; - DEBUG(9,("Sizing driver info_1\n")); - size+=size_of_relative_string( &(info->name) ); - - DEBUGADD(9,("size: [%d]\n", size)); - return (size); - - return True; -} - -/******************************************************************* -return the size required by a struct in the stream -********************************************************************/ -static uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info) -{ - int size=0; - DEBUG(9,("Sizing driver info_2\n")); - size+=size_of_uint32( &(info->version) ); - size+=size_of_relative_string( &(info->name) ); - size+=size_of_relative_string( &(info->architecture) ); - size+=size_of_relative_string( &(info->driverpath) ); - size+=size_of_relative_string( &(info->datafile) ); - size+=size_of_relative_string( &(info->configfile) ); - - DEBUGADD(9,("size: [%d]\n", size)); - return (size); - - return True; -} - -/******************************************************************* -return the size required by a struct in the stream -********************************************************************/ -static uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) -{ - int size=0; - UNISTR **string; - int i=0; - - DEBUG(9,("Sizing driver info_3\n")); - size+=size_of_uint32( &(info->version) ); - size+=size_of_relative_string( &(info->name) ); - size+=size_of_relative_string( &(info->architecture) ); - size+=size_of_relative_string( &(info->driverpath) ); - size+=size_of_relative_string( &(info->datafile) ); - size+=size_of_relative_string( &(info->configfile) ); - size+=size_of_relative_string( &(info->helpfile) ); - size+=size_of_relative_string( &(info->monitorname) ); - size+=size_of_relative_string( &(info->defaultdatatype) ); - - string=info->dependentfiles; - - while ( (string)[i]!=0x0000 ) - { - size+=2*(1+ str_len_uni( string[i] ) ); - i++; - } - size+=6; - - DEBUGADD(9,("size: [%d]\n", size)); - return (size); - - return True; -} - -/******************************************************************* -return the size required by a struct in the stream -********************************************************************/ -static uint32 spoolss_size_job_info_1(JOB_INFO_1 *info) -{ - int size=0; - size+=size_of_uint32( &(info->jobid) ); - size+=size_of_relative_string( &(info->printername) ); - size+=size_of_relative_string( &(info->machinename) ); - size+=size_of_relative_string( &(info->username) ); - size+=size_of_relative_string( &(info->document) ); - size+=size_of_relative_string( &(info->datatype) ); - size+=size_of_relative_string( &(info->text_status) ); - size+=size_of_uint32( &(info->status) ); - size+=size_of_uint32( &(info->priority) ); - size+=size_of_uint32( &(info->position) ); - size+=size_of_uint32( &(info->totalpages) ); - size+=size_of_uint32( &(info->pagesprinted) ); - size+=size_of_systemtime( &(info->submitted) ); - return (size); - - return True; -} - -/******************************************************************* -return the size required by a struct in the stream -********************************************************************/ -static uint32 spoolss_size_job_info_2(JOB_INFO_2 *info) -{ - int size=0; - - size+=4; /* size of sec desc ptr */ - - size+=size_of_uint32( &(info->jobid) ); - size+=size_of_relative_string( &(info->printername) ); - size+=size_of_relative_string( &(info->machinename) ); - size+=size_of_relative_string( &(info->username) ); - size+=size_of_relative_string( &(info->document) ); - size+=size_of_relative_string( &(info->notifyname) ); - size+=size_of_relative_string( &(info->datatype) ); - size+=size_of_relative_string( &(info->printprocessor) ); - size+=size_of_relative_string( &(info->parameters) ); - size+=size_of_relative_string( &(info->drivername) ); - size+=size_of_device_mode( info->devmode ); - size+=size_of_relative_string( &(info->text_status) ); -/* SEC_DESC sec_desc;*/ - size+=size_of_uint32( &(info->status) ); - size+=size_of_uint32( &(info->priority) ); - size+=size_of_uint32( &(info->position) ); - size+=size_of_uint32( &(info->starttime) ); - size+=size_of_uint32( &(info->untiltime) ); - size+=size_of_uint32( &(info->totalpages) ); - size+=size_of_uint32( &(info->size) ); - size+=size_of_systemtime( &(info->submitted) ); - size+=size_of_uint32( &(info->timeelapsed) ); - size+=size_of_uint32( &(info->pagesprinted) ); - return (size); - - return True; -} - -/******************************************************************* -return the size required by a struct in the stream -********************************************************************/ -static uint32 spoolss_size_form_1(FORM_1 *info) -{ - int size=0; - - size+=size_of_uint32( &(info->flag) ); - size+=size_of_relative_string( &(info->name) ); - size+=size_of_uint32( &(info->width) ); - size+=size_of_uint32( &(info->length) ); - size+=size_of_uint32( &(info->left) ); - size+=size_of_uint32( &(info->top) ); - size+=size_of_uint32( &(info->right) ); - size+=size_of_uint32( &(info->bottom) ); - - return (size); - - return True; -} - -/******************************************************************* -return the size required by a struct in the stream -********************************************************************/ -static uint32 spoolss_size_port_info_2(PORT_INFO_2 *info) -{ - int size=0; - - size+=size_of_relative_string( &(info->port_name) ); - size+=size_of_relative_string( &(info->monitor_name) ); - size+=size_of_relative_string( &(info->description) ); - - size+=size_of_uint32( &(info->port_type) ); - size+=size_of_uint32( &(info->reserved) ); - - return (size); - - return True; -} - -/******************************************************************* -return the size required by a struct in the stream -********************************************************************/ -static uint32 spoolss_size_processor_info_1(PRINTPROCESSOR_1 *info) -{ - int size=0; - size+=size_of_relative_string( &(info->name) ); - - return (size); - - return True; -} - -/******************************************************************* -return the size required by a struct in the stream -********************************************************************/ -static uint32 spoolss_size_monitor_info_1(PRINTMONITOR_1 *info) -{ - int size=0; - size+=size_of_relative_string( &(info->name) ); - - return (size); - - return True; -} - -/******************************************************************* - * make a structure. - ********************************************************************/ -static BOOL make_spoolss_buffer(BUFFER* buffer, uint32 size) -{ - buffer->ptr = (size != 0) ? 1 : 0; - buffer->size = size; - buffer->data = (uint8 *)Realloc( NULL, (buffer->size) * sizeof(uint8) ); - - return (buffer->data != NULL || size == 0); -} - -/******************************************************************* - * read a uint8 buffer of size *size. - * allocate memory for it - * return a pointer to the allocated memory and the size - * return NULL and a size of 0 if the buffer is empty - * - * jfmxxxx: fix it to also write a buffer - ********************************************************************/ -static BOOL spoolss_io_read_buffer(char *desc, prs_struct *ps, int depth, BUFFER *buffer) -{ - prs_debug(ps, depth, desc, "spoolss_io_read_buffer"); - depth++; - - prs_align(ps); - - prs_uint32("pointer", ps, depth, &(buffer->ptr)); - - if (buffer->ptr != 0x0000) - { - prs_uint32("size", ps, depth, &(buffer->size)); - if (ps->io) - { - /* reading */ - buffer->data=(uint8 *)Realloc(NULL, buffer->size * sizeof(uint8) ); - } - if (buffer->data == NULL) - { - return False; - } - mem_grow_data(&(ps->data), ps->io, - ps->data->data_size + buffer->size, 0); - prs_uint8s(True, "buffer", ps, depth, buffer->data, buffer->size); - prs_align(ps); - - } - else - { - if (ps->io) - { - /* reading */ - buffer->data=0x0000; - buffer->size=0x0000; - } - } - - if (!ps->io) - { - /* writing */ - if (buffer->data != NULL) - { - free(buffer->data); - } - buffer->data = NULL; - } - return True; -} - -/******************************************************************* - * read a uint8 buffer of size *size. - * allocate memory for it - * return a pointer to the allocated memory and the size - * return NULL and a size of 0 if the buffer is empty - * - * jfmxxxx: fix it to also write a buffer - ********************************************************************/ -BOOL spoolss_io_free_buffer(BUFFER *buffer) -{ - DEBUG(8,("spoolss_io_free_buffer\n")); - - if (buffer->ptr != 0x0000) - { - free(buffer->data); - } - - return True; -} - -/******************************************************************* - * read a structure. - * called from spoolss_getprinterdriver2 (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_q_getprinterdriver2(char *desc, - SPOOL_Q_GETPRINTERDRIVER2 *q_u, - prs_struct *ps, int depth) -{ - uint32 useless_ptr; - prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdriver2"); - depth++; - - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("pointer", ps, depth, &useless_ptr); - smb_io_unistr2("architecture", &(q_u->architecture),True,ps,depth); - - prs_align(ps); - - prs_uint32("level", ps, depth, &(q_u->level)); - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); - - prs_align(ps); - - prs_uint32("buffer size", ps, depth, &(q_u->buf_size)); - prs_uint32("status", ps, depth, &(q_u->status)); - - - return True; -} - -/******************************************************************* - * read a structure. - * called from spoolss_getprinterdriver2 (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, - prs_struct *ps, int depth) -{ - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - uint32 pipo=0; - DRIVER_INFO_1 *info1; - DRIVER_INFO_2 *info2; - DRIVER_INFO_3 *info3; - - prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriver2"); - depth++; - - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - - info1 = r_u->printer.info1; - info2 = r_u->printer.info2; - info3 = r_u->printer.info3; - - switch (r_u->level) - { - case 1: - { - bufsize_required += spoolss_size_printer_driver_info_1(info1); - break; - } - case 2: - { - bufsize_required += spoolss_size_printer_driver_info_2(info2); - break; - } - case 3: - { - bufsize_required += spoolss_size_printer_driver_info_3(info3); - break; - } - } - - if (ps->io) - { - /* reading */ - r_u->offered = bufsize_required; - } - - DEBUG(4,("spoolss_io_r_getprinterdriver2, size needed: %d\n",bufsize_required)); - DEBUG(4,("spoolss_io_r_getprinterdriver2, size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - if (r_u->offered < bufsize_required) - { - /* it's too small */ - r_u->status=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ - - DEBUG(4,("spoolss_io_r_getprinterdriver2, buffer too small\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - else - { - mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); - - DEBUG(4,("spoolss_io_r_getprinterdriver2, buffer large enough\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - - beginning=ps->offset; - start_offset=ps->offset; - end_offset=start_offset+r_u->offered; - - switch (r_u->level) - { - case 1: - { - smb_io_printer_driver_info_1(desc, - info1, - ps, - depth, - &start_offset, - &end_offset); - break; - } - case 2: - { - smb_io_printer_driver_info_2(desc, - info2, - ps, - depth, - &start_offset, - &end_offset); - break; - } - case 3: - { - smb_io_printer_driver_info_3(desc, - info3, - ps, - depth, - &start_offset, - &end_offset); - break; - } - - } - - ps->offset=beginning+r_u->offered; - prs_align(ps); - } - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("pipo", ps, depth, &pipo); - prs_uint32("pipo", ps, depth, &pipo); - prs_uint32("status", ps, depth, &(r_u->status)); - - - return True; -} - -/******************************************************************* - * make a structure. - ********************************************************************/ -BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, - uint32 flags, - const char* servername, - uint32 level, - uint32 size) -{ - size_t len_name = servername != NULL ? strlen(servername) : 0; - - DEBUG(5,("make_spoolss_q_enumprinters. size: %d\n", size)); - - q_u->flags = flags; - - make_unistr2(&(q_u->servername), servername, len_name); - - q_u->level = level; - make_spoolss_buffer(&q_u->buffer, size); - q_u->buf_size = size; - - return True; -} - -/******************************************************************* - * read a structure. - * called from spoolss_enumprinters (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, - prs_struct *ps, int depth) -{ - uint32 useless_ptr = 0x01; - prs_debug(ps, depth, desc, "spoolss_io_q_enumprinters"); - depth++; - - prs_align(ps); - - prs_uint32("flags", ps, depth, &(q_u->flags)); - prs_uint32("useless ptr", ps, depth, &useless_ptr); - - smb_io_unistr2("", &(q_u->servername),True,ps,depth); - prs_align(ps); - - prs_uint32("level", ps, depth, &(q_u->level)); - - spoolss_io_read_buffer("buffer", ps, depth, &(q_u->buffer)); - - prs_uint32("buf_size", ps, depth, &q_u->buf_size); - - return True; -} - -/**************************************************************************** -****************************************************************************/ -void free_r_enumprinters(SPOOL_R_ENUMPRINTERS *r_u) -{ - DEBUG(4,("free_enum_printers_info: [%d] structs to free at level [%d]\n", r_u->returned, r_u->level)); - switch (r_u->level) - { - case 1: - { - free_print1_array(r_u->returned, r_u->printer.printers_1); - break; - } - case 2: - { - free_print2_array(r_u->returned, r_u->printer.printers_2); - break; - } - } -} - -/******************************************************************* - * write a structure. - * called from spoolss_r_enum_printers (srv_spoolss.c) - * - ********************************************************************/ -BOOL spoolss_io_r_enumprinters(char *desc, - SPOOL_R_ENUMPRINTERS *r_u, - prs_struct *ps, int depth) -{ - uint32 useless_ptr=0xADDE0FF0; - int i; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - uint32 tmp_ct = 0; - - PRINTER_INFO_1 *info1; - PRINTER_INFO_2 *info2; - fstring tmp; - - slprintf(tmp, sizeof(tmp)-1, "spoolss_io_r_enumprinters %d", r_u->level); - - prs_debug(ps, depth, desc, tmp); - depth++; - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - - if (!ps->io) - { - /* writing */ - for(i=0;ireturned;i++) - { - switch (r_u->level) - { - case 1: - info1 = r_u->printer.printers_1[i]; - bufsize_required += spoolss_size_printer_info_1(info1); - break; - case 2: - info2 = r_u->printer.printers_2[i]; - bufsize_required += spoolss_size_printer_info_2(info2); - break; - } - } - - DEBUG(4,("spoolss_io_r_enumprinters, size needed: %d\n",bufsize_required)); - DEBUG(4,("spoolss_io_r_enumprinters, size offered: %d\n",r_u->offered)); - - if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; - r_u->offered=0; - /*r_u->returned=0;*/ - - DEBUG(4,("spoolss_io_r_enumprinters, buffer too small\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("count", ps, depth, &(r_u->returned)); - prs_uint32("status", ps, depth, &(r_u->status)); - return False; - } - - mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); - - DEBUG(4,("spoolss_io_r_enumprinters, buffer large enough\n")); - } - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - - /* have to skip to end of buffer when reading, and have to record - * size of buffer when writing. *shudder*. - */ - - beginning = ps->offset; - start_offset = ps->offset; - end_offset = start_offset + r_u->offered; - - if (ps->io) - { - /* reading */ - ps->offset = beginning + r_u->offered; - - prs_align(ps); - prs_uint32("buffer size", ps, depth, &(bufsize_required)); - prs_uint32("count", ps, depth, &(r_u->returned)); - - ps->offset = beginning; - } - - for(i=0;ireturned;i++) - { - - switch (r_u->level) - { - case 1: - { - if (ps->io) - { - /* reading */ - r_u->printer.printers_1[i] = add_print1_to_array(&tmp_ct, &r_u->printer.printers_1, NULL); - } - info1 = r_u->printer.printers_1[i]; - if (info1 == NULL) - { - return False; - } - smb_io_printer_info_1(desc, info1, ps, depth, - &start_offset, &end_offset); - break; - } - case 2: - { - if (ps->io) - { - /* reading */ - r_u->printer.printers_2[i] = add_print2_to_array(&tmp_ct, &r_u->printer.printers_2, NULL); - } - info2 = r_u->printer.printers_2[i]; - if (info2 == NULL) - { - return False; - } - smb_io_printer_info_2(desc, info2, ps, depth, - &start_offset, &end_offset); - break; - } - } - } - - ps->offset = beginning + r_u->offered; - prs_align(ps); - - prs_uint32("buffer size", ps, depth, &(bufsize_required)); - prs_uint32("count", ps, depth, &(r_u->returned)); - prs_uint32("status", ps, depth, &(r_u->status)); - - if (!ps->io) - { - /* writing */ - free_r_enumprinters(r_u); - } - - return True; -} - -/******************************************************************* - * write a structure. - * called from spoolss_r_enum_printers (srv_spoolss.c) - * - ********************************************************************/ -BOOL spoolss_io_r_getprinter(char *desc, - SPOOL_R_GETPRINTER *r_u, - prs_struct *ps, int depth) -{ - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - - prs_debug(ps, depth, desc, "spoolss_io_r_getprinter"); - depth++; - - prs_align(ps); - - prs_uint32("pointer", ps, depth, &useless_ptr); - - switch (r_u->level) - { - case 0: - { - PRINTER_INFO_0 *info; - info = r_u->printer.info0; - bufsize_required += spoolss_size_printer_info_0(info); - break; - } - case 1: - { - PRINTER_INFO_1 *info; - info = r_u->printer.info1; - bufsize_required += spoolss_size_printer_info_1(info); - break; - } - case 2: - { - PRINTER_INFO_2 *info; - info = r_u->printer.info2; - bufsize_required += spoolss_size_printer_info_2(info); - break; - } - } - - DEBUG(4,("spoolss_io_r_getprinter, size needed: %d\n",bufsize_required)); - DEBUG(4,("spoolss_io_r_getprinter, size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - if (r_u->offered < bufsize_required) - { - /* it's too small */ - r_u->status = ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered = 0; /* don't send back the buffer */ - - DEBUG(4,("spoolss_io_r_getprinter, buffer too small\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - else - { - mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); - - DEBUG(4,("spoolss_io_r_getprinter, buffer large enough\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - - if (ps->io) - { - /* reading */ - r_u->printer.info = Realloc(NULL, r_u->offered); - } - - if (bufsize_required <= r_u->offered) - { - beginning=ps->offset; - start_offset=ps->offset; - end_offset=start_offset+r_u->offered; - - switch (r_u->level) - { - case 0: - { - PRINTER_INFO_0 *info; - info = r_u->printer.info0; - smb_io_printer_info_0(desc, - info, - ps, - depth, - &start_offset, - &end_offset); - break; - } - case 1: - { - PRINTER_INFO_1 *info; - info = r_u->printer.info1; - smb_io_printer_info_1(desc, - info, - ps, - depth, - &start_offset, - &end_offset); - break; - } - case 2: - { - PRINTER_INFO_2 *info; - info = r_u->printer.info2; - smb_io_printer_info_2(desc, - info, - ps, - depth, - &start_offset, - &end_offset); - break; - } - - } - - ps->offset=beginning+r_u->offered; - prs_align(ps); - } - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* - * read a uint8 buffer of size *size. - * allocate memory for it - * return a pointer to the allocated memory and the size - * return NULL and a size of 0 if the buffer is empty - * - * jfmxxxx: fix it to also write a buffer - ********************************************************************/ -static BOOL spoolss_io_read_buffer8(char *desc, prs_struct *ps, uint8 **buffer, uint32 *size,int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_read_buffer8"); - depth++; - - prs_align(ps); - - prs_uint32("buffer size", ps, depth, size); - *buffer = (uint8 *)Realloc(NULL, (*size) * sizeof(uint8) ); - prs_uint8s(True,"buffer",ps,depth,*buffer,*size); - prs_align(ps); - - return True; -} - -/******************************************************************* - * make a structure. - * called from spoolss_getprinter (srv_spoolss.c) - ********************************************************************/ -BOOL make_spoolss_q_getprinter(SPOOL_Q_GETPRINTER *q_u, - POLICY_HND *hnd, - uint32 level, - uint32 buf_size) -{ - if (q_u == NULL) return False; - - memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - - q_u->level = level; - q_u->buffer = (uint8 *)Realloc(NULL, (buf_size) * sizeof(uint8) ); - q_u->offered = buf_size; - - return True; -} - -/******************************************************************* - * read a structure. - * called from spoolss_getprinter (srv_spoolss.c) - ********************************************************************/ -BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, - prs_struct *ps, int depth) -{ - uint32 count = 0; - uint32 buf_ptr = q_u->buffer != NULL ? 1 : 0; - prs_debug(ps, depth, desc, "spoolss_io_q_getprinter"); - depth++; - - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - - prs_uint32("level", ps, depth, &(q_u->level)); - - if (!ps->io) - { - /* writing */ - buf_ptr = q_u->buffer != NULL ? 1 : 0; - } - prs_uint32("buffer pointer", ps, depth, &buf_ptr); - - if (buf_ptr != 0) - { - spoolss_io_read_buffer8("",ps, &q_u->buffer, &count,depth); - } - if (q_u->buffer != NULL) - { - free(q_u->buffer); - } - prs_uint32("buffer size", ps, depth, &(q_u->offered)); - - return count == q_u->offered; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_setprinter"); - depth++; - - prs_align(ps); - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -static BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE **devmode) -{ - uint32 devmode_size=0x0; - uint32 useless_ptr=0x0; - - prs_debug(ps, depth, desc, "spoolss_io_devmode"); - depth++; - - prs_uint32("devmode_size", ps, depth, &(devmode_size)); - prs_uint32("useless_ptr", ps, depth, &(useless_ptr)); - - if (devmode_size!=0 && useless_ptr!=0) - { - /* so we have a DEVICEMODE to follow */ - if (ps->io) - { - DEBUG(9,("Allocating memory for spoolss_io_devmode\n")); - *devmode=(DEVICEMODE *)malloc(sizeof(DEVICEMODE)); - ZERO_STRUCTP(*devmode); - } - - /* this is bad code, shouldn't be there */ - prs_uint32("devmode_size", ps, depth, &(devmode_size)); - - smb_io_devmode(desc, ps, depth, *devmode); - } - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_q_setprinter"); - depth++; - - prs_align(ps); - - smb_io_prt_hnd("printer handle", &(q_u->handle),ps,depth); - prs_uint32("level", ps, depth, &(q_u->level)); - - /* again a designed mess */ - /* sometimes I'm wondering how all of this work ! */ - - /* To be correct it need to be split in 3 functions */ - - spool_io_printer_info_level("", &(q_u->info), ps, depth); - - spoolss_io_devmode(desc, ps, depth, &(q_u->devmode)); - - prs_uint32("security.size_of_buffer", ps, depth, &(q_u->security.size_of_buffer)); - prs_uint32("security.data", ps, depth, &(q_u->security.data)); - - prs_uint32("command", ps, depth, &(q_u->command)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_fcpn(char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_fcpn"); - depth++; - - prs_align(ps); - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_fcpn(char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) -{ - - prs_debug(ps, depth, desc, "spoolss_io_q_fcpn"); - depth++; - - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - - return True; -} - - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, ""); - depth++; - - prs_align(ps); - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int depth) -{ - - prs_debug(ps, depth, desc, ""); - depth++; - - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("level", ps, depth, &(q_u->level)); - - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); - - prs_align(ps); - - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); - - return True; -} - -/**************************************************************************** -****************************************************************************/ -void free_r_enumjobs(SPOOL_R_ENUMJOBS *r_u) -{ - DEBUG(4,("free_enum_jobs_info: [%d] structs to free at level [%d]\n", r_u->numofjobs, r_u->level)); - switch (r_u->level) - { - case 1: - { - free_job1_array(r_u->numofjobs, r_u->job.job_info_1); - break; - } - case 2: - { - free_job2_array(r_u->numofjobs, r_u->job.job_info_2); - break; - } - } -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth) -{ - uint32 useless_ptr = 0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - uint32 tmp_ct = 0; - int i; - - prs_debug(ps, depth, desc, "spoolss_io_r_enumjobs"); - depth++; - - prs_align(ps); - - if (!ps->io) - { - /* writing */ - switch (r_u->level) - { - case 1: - { - for (i=0; inumofjobs; i++) - { - JOB_INFO_1 *info; - info=r_u->job.job_info_1[i]; - bufsize_required += spoolss_size_job_info_1(&(info[i])); - } - break; - } - case 2: - { - for (i=0; inumofjobs; i++) - { - JOB_INFO_2 *info; - info=r_u->job.job_info_2[i]; - - bufsize_required += spoolss_size_job_info_2(&(info[i])); - } - break; - } - } - - DEBUG(4,("spoolss_io_r_enumjobs, size needed: %d\n",bufsize_required)); - DEBUG(4,("spoolss_io_r_enumjobs, size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - if (r_u->offeredstatus = ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered = bufsize_required; - useless_ptr = 0; - - DEBUG(4,("spoolss_io_r_enumjobs, buffer too small\n")); - - } - else - { - useless_ptr = 1; - } - mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); - } - - prs_uint32("pointer", ps, depth, &useless_ptr); - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - - if (useless_ptr != 0) - { - beginning=ps->offset; - start_offset=ps->offset; - end_offset=start_offset+r_u->offered; - - tmp_ct = 0; - - if (ps->io) - { - /* reading */ - ps->offset = beginning + r_u->offered; - - prs_align(ps); - prs_uint32("buffer size", ps, depth, &(bufsize_required)); - prs_uint32("numofjobs", ps, depth, &(r_u->numofjobs)); - - ps->offset = beginning; - } - - switch (r_u->level) - { - case 1: - { - JOB_INFO_1 *info; - for (i=0; inumofjobs; i++) - { - if (ps->io) - { - /* reading */ - r_u->job.job_info_1[i] = add_job1_to_array(&tmp_ct, &r_u->job.job_info_1, NULL); - } - info = r_u->job.job_info_1[i]; - smb_io_job_info_1(desc, - info, - ps, - depth, - &start_offset, - &end_offset); - } - break; - } - case 2: - { - JOB_INFO_2 *info; - for (i=0; inumofjobs; i++) - { - if (ps->io) - { - /* reading */ - r_u->job.job_info_2[i] = add_job2_to_array(&tmp_ct, &r_u->job.job_info_2, NULL); - } - info = r_u->job.job_info_2[i]; - smb_io_job_info_2(desc, - info, - ps, - depth, - &start_offset, - &end_offset); - } - break; - } - - } - ps->offset=beginning+r_u->offered; - prs_align(ps); - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("buffer size", ps, depth, &(bufsize_required)); - } - - prs_uint32("numofjobs", ps, depth, &(r_u->numofjobs)); - prs_uint32("status", ps, depth, &(r_u->status)); - - if (!ps->io) - { - /* writing */ - free_r_enumjobs(r_u); - } - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd, - uint32 firstjob, - uint32 numofjobs, - uint32 level, - uint32 buf_size) -{ - if (q_u == NULL) - { - return False; - } - memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - q_u->firstjob = firstjob; - q_u->numofjobs = numofjobs; - q_u->level = level; - - if (!make_spoolss_buffer(&q_u->buffer, buf_size)) - { - return False; - } - q_u->buf_size = buf_size; - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_q_enumjobs"); - depth++; - - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("firstjob", ps, depth, &(q_u->firstjob)); - prs_uint32("numofjobs", ps, depth, &(q_u->numofjobs)); - prs_uint32("level", ps, depth, &(q_u->level)); - - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); - - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_schedulejob(char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_schedulejob"); - depth++; - - prs_align(ps); - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_schedulejob(char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_q_schedulejob"); - depth++; - - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("jobid", ps, depth, &(q_u->jobid)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_setjob(char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_setjob"); - depth++; - - prs_align(ps); - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_q_setjob"); - depth++; - - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("jobid", ps, depth, &(q_u->jobid)); - /* - * level is usually 0. If (level!=0) then I'm in trouble ! - * I will try to generate setjob command with level!=0, one day. - */ - prs_uint32("level", ps, depth, &(q_u->level)); - prs_uint32("command", ps, depth, &(q_u->command)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_enumdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) -{ - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - int i; - - prs_debug(ps, depth, desc, "spoolss_io_r_enumdrivers"); - depth++; - - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - - DEBUG(7,("Level [%d], number [%d]\n", r_u->level, r_u->numofdrivers)); - switch (r_u->level) - { - case 1: - { - DRIVER_INFO_1 *driver_info_1; - driver_info_1=r_u->driver.driver_info_1; - - for (i=0; inumofdrivers; i++) - { - bufsize_required += spoolss_size_printer_driver_info_1(&(driver_info_1[i])); - } - break; - } - case 2: - { - DRIVER_INFO_2 *driver_info_2; - driver_info_2=r_u->driver.driver_info_2; - - for (i=0; inumofdrivers; i++) - { - bufsize_required += spoolss_size_printer_driver_info_2(&(driver_info_2[i])); - } - break; - } - case 3: - { - DRIVER_INFO_3 *driver_info_3; - driver_info_3=r_u->driver.driver_info_3; - - for (i=0; inumofdrivers; i++) - { - bufsize_required += spoolss_size_printer_driver_info_3(&(driver_info_3[i])); - } - break; - } - } - - DEBUGADD(7,("size needed: %d\n",bufsize_required)); - DEBUGADD(7,("size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - - if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ - DEBUGADD(8,("buffer too small\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - else - { - mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); - - DEBUGADD(8,("buffer large enough\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - beginning=ps->offset; - start_offset=ps->offset; - end_offset=start_offset+r_u->offered; - - switch (r_u->level) - { - case 1: - { - DRIVER_INFO_1 *info; - for (i=0; inumofdrivers; i++) - { - info = &(r_u->driver.driver_info_1[i]); - smb_io_printer_driver_info_1(desc, info, ps, depth, &start_offset, &end_offset); - } - break; - } - case 2: - { - DRIVER_INFO_2 *info; - for (i=0; inumofdrivers; i++) - { - info = &(r_u->driver.driver_info_2[i]); - smb_io_printer_driver_info_2(desc, info, ps, depth, &start_offset, &end_offset); - } - break; - } - case 3: - { - DRIVER_INFO_3 *info; - for (i=0; inumofdrivers; i++) - { - info = &(r_u->driver.driver_info_3[i]); - smb_io_printer_driver_info_3(desc, info, ps, depth, &start_offset, &end_offset); - } - break; - } - } - ps->offset=beginning+r_u->offered; - prs_align(ps); - } - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("numofdrivers", ps, depth, &(r_u->numofdrivers)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth) -{ - - uint32 useless_ptr=0xADDE0FF0; - prs_debug(ps, depth, desc, ""); - depth++; - - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - smb_io_unistr2("", &(q_u->name),True,ps,depth); - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - smb_io_unistr2("", &(q_u->environment),True,ps,depth); - prs_align(ps); - prs_uint32("level", ps, depth, &(q_u->level)); - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); - prs_align(ps); - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth) -{ - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - int i; - - prs_debug(ps, depth, desc, "spoolss_io_r_enumforms"); - depth++; - - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - switch (r_u->level) - { - case 1: - { - FORM_1 *forms_1; - forms_1=r_u->forms_1; - - for (i=0; inumofforms; i++) - { - bufsize_required += spoolss_size_form_1(&(forms_1[i])); - } - break; - } - } - - DEBUG(4,("spoolss_io_r_enumforms, size needed: %d\n",bufsize_required)); - DEBUG(4,("spoolss_io_r_enumforms, size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - - if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ - - DEBUG(4,("spoolss_io_r_enumforms, buffer too small\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - else - { - mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); - - DEBUG(4,("spoolss_io_r_enumforms, buffer large enough\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - - if (r_u->offered!=0) - { - beginning=ps->offset; - start_offset=ps->offset; - end_offset=start_offset+r_u->offered; - - switch (r_u->level) - { - case 1: - { - FORM_1 *info; - for (i=0; inumofforms; i++) - { - info = &(r_u->forms_1[i]); - smb_io_form_1(desc, info, ps, depth, &start_offset, &end_offset); - } - break; - } - } - ps->offset=beginning+r_u->offered; - prs_align(ps); - } - } - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("numofforms", ps, depth, &(r_u->numofforms)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, int depth) -{ - - prs_debug(ps, depth, desc, ""); - depth++; - - prs_align(ps); - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("level", ps, depth, &(q_u->level)); - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); - prs_align(ps); - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth) -{ - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - int i; - - prs_debug(ps, depth, desc, "spoolss_io_r_enumports"); - depth++; - - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - switch (r_u->level) - { - case 2: - { - PORT_INFO_2 *port_2; - port_2=r_u->port.port_info_2; - - for (i=0; inumofports; i++) - { - bufsize_required += spoolss_size_port_info_2(&(port_2[i])); - } - break; - } - } - - DEBUG(4,("size needed: %d\n",bufsize_required)); - DEBUG(4,("size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ - - DEBUG(4,("buffer too small\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - else - { - mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); - - DEBUG(4,("buffer large enough\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - beginning=ps->offset; - start_offset=ps->offset; - end_offset=start_offset+r_u->offered; - - switch (r_u->level) - { - case 2: - { - PORT_INFO_2 *info; - for (i=0; inumofports; i++) - { - info = &(r_u->port.port_info_2[i]); - smb_io_port_2(desc, info, ps, depth, &start_offset, &end_offset); - } - break; - } - } - ps->offset=beginning+r_u->offered; - prs_align(ps); - } - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("numofports", ps, depth, &(r_u->numofports)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth) -{ - uint32 useless; - prs_debug(ps, depth, desc, ""); - depth++; - - prs_align(ps); - prs_uint32("useless", ps, depth, &useless); - smb_io_unistr2("", &(q_u->name),True,ps,depth); - prs_align(ps); - prs_uint32("level", ps, depth, &(q_u->level)); - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); - prs_align(ps); - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); - - return True; -} - - -/******************************************************************* -********************************************************************/ -BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 **q_u, prs_struct *ps, int depth) -{ - SPOOL_PRINTER_INFO_LEVEL_2 *il; - - prs_debug(ps, depth, desc, ""); - depth++; - - /* reading */ - if (ps->io) - { - il=(SPOOL_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2)); - ZERO_STRUCTP(il); - *q_u=il; - DEBUG(7,("lecture: memoire ok\n")); - } - else - { - il=*q_u; - } - - prs_align(ps); - - prs_uint32("servername_ptr", ps, depth, &(il->servername_ptr)); - prs_uint32("printername_ptr", ps, depth, &(il->printername_ptr)); - prs_uint32("sharename_ptr", ps, depth, &(il->sharename_ptr)); - prs_uint32("portname_ptr", ps, depth, &(il->portname_ptr)); - prs_uint32("drivername_ptr", ps, depth, &(il->drivername_ptr)); - prs_uint32("comment_ptr", ps, depth, &(il->comment_ptr)); - prs_uint32("location_ptr", ps, depth, &(il->location_ptr)); - prs_uint32("devmode_ptr", ps, depth, &(il->devmode_ptr)); - prs_uint32("sepfile_ptr", ps, depth, &(il->sepfile_ptr)); - prs_uint32("printprocessor_ptr", ps, depth, &(il->printprocessor_ptr)); - prs_uint32("datatype_ptr", ps, depth, &(il->datatype_ptr)); - prs_uint32("parameters_ptr", ps, depth, &(il->parameters_ptr)); - prs_uint32("secdesc_ptr", ps, depth, &(il->secdesc_ptr)); - - prs_uint32("attributes", ps, depth, &(il->attributes)); - prs_uint32("priority", ps, depth, &(il->priority)); - prs_uint32("default_priority", ps, depth, &(il->default_priority)); - prs_uint32("starttime", ps, depth, &(il->starttime)); - prs_uint32("untiltime", ps, depth, &(il->untiltime)); - prs_uint32("status", ps, depth, &(il->status)); - prs_uint32("cjobs", ps, depth, &(il->cjobs)); - prs_uint32("averageppm", ps, depth, &(il->averageppm)); - - smb_io_unistr2("", &(il->servername), il->servername_ptr, ps, depth); - smb_io_unistr2("", &(il->printername), il->printername_ptr, ps, depth); - smb_io_unistr2("", &(il->sharename), il->sharename_ptr, ps, depth); - smb_io_unistr2("", &(il->portname), il->portname_ptr, ps, depth); - smb_io_unistr2("", &(il->drivername), il->drivername_ptr, ps, depth); - smb_io_unistr2("", &(il->comment), il->comment_ptr, ps, depth); - smb_io_unistr2("", &(il->location), il->location_ptr, ps, depth); - smb_io_unistr2("", &(il->sepfile), il->sepfile_ptr, ps, depth); - smb_io_unistr2("", &(il->printprocessor), il->printprocessor_ptr, ps, depth); - smb_io_unistr2("", &(il->datatype), il->datatype_ptr, ps, depth); - smb_io_unistr2("", &(il->parameters), il->parameters_ptr, ps, depth); - - prs_align(ps); - - /* this code as nothing to do here !!! - - if (il->secdesc_ptr) - { - il->secdesc=NULL; - sec_io_desc_buf("", &(il->secdesc), ps, depth); - } - - */ - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth) -{ - uint32 useless; - uint32 level; - prs_debug(ps, depth, desc, ""); - depth++; - - prs_align(ps); - prs_uint32("info level", ps, depth, &level); - prs_uint32("useless", ps, depth, &useless); - - switch (level) - { - /* - * level 0 is used by setprinter when managing the queue - * (hold, stop, start a queue) - */ - case 0: - break; - /* - * level 2 is used by addprinter - * and by setprinter when updating printer's info - */ - case 2: - spool_io_printer_info_level_2("", &(il->info_2), ps, depth); - break; - } - - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spool_io_user_level_1(char *desc, SPOOL_USER_LEVEL_1 **q_u, prs_struct *ps, int depth) -{ - SPOOL_USER_LEVEL_1 *il; - prs_debug(ps, depth, desc, ""); - depth++; - - /* reading */ - if (ps->io) - { - il=(SPOOL_USER_LEVEL_1 *)malloc(sizeof(SPOOL_USER_LEVEL_1)); - ZERO_STRUCTP(il); - *q_u=il; - } - else - { - il=*q_u; - } - - prs_align(ps); - prs_uint32("size", ps, depth, &(il->size)); - prs_uint32("client_name_ptr", ps, depth, &(il->client_name_ptr)); - prs_uint32("user_name_ptr", ps, depth, &(il->user_name_ptr)); - prs_uint32("build", ps, depth, &(il->build)); - prs_uint32("major", ps, depth, &(il->major)); - prs_uint32("minor", ps, depth, &(il->minor)); - prs_uint32("processor", ps, depth, &(il->processor)); - - smb_io_unistr2("", &(il->client_name), il->client_name_ptr, ps, depth); - prs_align(ps); - smb_io_unistr2("", &(il->user_name), il->user_name_ptr, ps, depth); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spool_io_user_level(char *desc, SPOOL_USER_LEVEL *q_u, prs_struct *ps, int depth) -{ - uint32 useless; - uint32 level; - prs_debug(ps, depth, desc, "spool_io_user_level"); - depth++; - - prs_align(ps); - prs_uint32("info_level", ps, depth, &level); - prs_uint32("useless", ps, depth, &useless); - - switch (level) - { - case 1: - spool_io_user_level_1("", &(q_u->user_level_1), ps, depth); - break; - - } - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth) -{ - uint32 useless; - prs_debug(ps, depth, desc, "spoolss_io_q_addprinterex"); - depth++; - - /* - * I think that's one of the few well written functions. - * the sub-structures are correctly parsed and analysed - * the info level are handled in a nice way. - */ - - prs_align(ps); - prs_uint32("useless", ps, depth, &useless); - smb_io_unistr2("", &(q_u->server_name),True,ps,depth); - prs_align(ps); - - prs_uint32("info_level", ps, depth, &(q_u->level)); - - spool_io_printer_info_level("", &(q_u->info), ps, depth); - - /* the 4 unknown are all 0 */ - - /* - * en fait ils sont pas inconnu - * par recoupement avec rpcSetPrinter - * c'est le devicemode - * et le security descriptor. - */ - - prs_uint32("unk0", ps, depth, &(q_u->unk0)); - prs_uint32("unk1", ps, depth, &(q_u->unk1)); - prs_uint32("unk2", ps, depth, &(q_u->unk2)); - prs_uint32("unk3", ps, depth, &(q_u->unk3)); - - prs_uint32("info_level", ps, depth, &(q_u->user_level)); - - spool_io_user_level("", &(q_u->user), ps, depth); - - return True; -} - - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_addprinterex"); - depth++; - - smb_io_prt_hnd("printer handle",&(r_u->handle),ps,depth); - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, - prs_struct *ps, int depth) -{ - SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *il; - - prs_debug(ps, depth, desc, ""); - depth++; - - /* reading */ - if (ps->io) - { - il=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *)malloc(sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); - ZERO_STRUCTP(il); - *q_u=il; - DEBUG(1,("lecture: memoire ok\n")); - } - else - { - il=*q_u; - } - - prs_align(ps); - - prs_uint32("cversion", ps, depth, &(il->cversion)); - prs_uint32("name", ps, depth, &(il->name_ptr)); - prs_uint32("environment", ps, depth, &(il->environment_ptr)); - prs_uint32("driverpath", ps, depth, &(il->driverpath_ptr)); - prs_uint32("datafile", ps, depth, &(il->datafile_ptr)); - prs_uint32("configfile", ps, depth, &(il->configfile_ptr)); - prs_uint32("helpfile", ps, depth, &(il->helpfile_ptr)); - prs_uint32("monitorname", ps, depth, &(il->monitorname_ptr)); - prs_uint32("defaultdatatype", ps, depth, &(il->defaultdatatype_ptr)); - prs_uint32("dependentfilessize", ps, depth, &(il->dependentfilessize)); - prs_uint32("dependentfiles", ps, depth, &(il->dependentfiles_ptr)); - - prs_align(ps); - - smb_io_unistr2("", &(il->name), il->name_ptr, ps, depth); - smb_io_unistr2("", &(il->environment), il->environment_ptr, ps, depth); - smb_io_unistr2("", &(il->driverpath), il->driverpath_ptr, ps, depth); - smb_io_unistr2("", &(il->datafile), il->datafile_ptr, ps, depth); - smb_io_unistr2("", &(il->configfile), il->configfile_ptr, ps, depth); - smb_io_unistr2("", &(il->helpfile), il->helpfile_ptr, ps, depth); - smb_io_unistr2("", &(il->monitorname), il->monitorname_ptr, ps, depth); - smb_io_unistr2("", &(il->defaultdatatype), il->defaultdatatype_ptr, ps, depth); - - prs_align(ps); - if (il->dependentfiles_ptr) - smb_io_buffer5("", &(il->dependentfiles), ps, depth); - - - return True; -} - - -/******************************************************************* - convert a buffer of UNICODE strings null terminated - the buffer is terminated by a NULL - - convert to an ascii array (null terminated) - - dynamically allocate memory - -********************************************************************/ -BOOL uniarray_2_ascarray(BUFFER5 *buf5, char ***ar) -{ - char **array; - char *string; - char *destend; - char *dest; - uint32 n; - uint32 i; - - uint16 *src; - - if (buf5==NULL) return False; - - array=NULL; - n=0; - i=0; - src=buf5->buffer; - - string=(char *)malloc(sizeof(char)*buf5->buf_len); - - destend = string + buf5->buf_len; - dest=string; - - while (dest < destend) - { - *(dest++) = (char)*(src++); - } - - /* that ugly for the first one but that's working */ - array=(char **)Realloc(array, sizeof(char *)*(i+1)); - array[i++]=string; - - while ( n < buf5->buf_len ) - { - if ( *(string++) == '\0' ) - { - array=(char **)Realloc(array, sizeof(char *)*(i+1)); - array[i++]=string; - } - n++; - } - *ar=array; - - DEBUG(10,("Number of dependent files: [%d]\n", i-1)); - - return True; -} - -/******************************************************************* - read a UNICODE array with null terminated strings - and null terminated array - and size of array at beginning -********************************************************************/ -BOOL smb_io_unibuffer(char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) -{ - if (buffer==NULL) return False; - - buffer->undoc=0; - buffer->uni_str_len=buffer->uni_max_len; - - prs_uint32("buffer_size", ps, depth, &(buffer->uni_max_len)); - - prs_unistr2(True, "buffer ", ps, depth, buffer); - - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth) -{ - uint32 useless; - uint32 level; - prs_debug(ps, depth, desc, ""); - depth++; - - prs_align(ps); - prs_uint32("info level", ps, depth, &level); - prs_uint32("useless", ps, depth, &useless); - - switch (level) - { - case 3: - spool_io_printer_driver_info_level_3("", &(il->info_3), ps, depth); - break; - } - - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) -{ - uint32 useless; - prs_debug(ps, depth, desc, ""); - depth++; - - prs_align(ps); - prs_uint32("useless", ps, depth, &useless); - smb_io_unistr2("", &(q_u->server_name),True,ps,depth); - prs_align(ps); - prs_uint32("info_level", ps, depth, &(q_u->level)); - - spool_io_printer_driver_info_level("", &(q_u->info), ps, depth); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_addprinterdriver(char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, ""); - depth++; - - prs_uint32("status", ps, depth, &(q_u->status)); - - return True; -} - - -/******************************************************************* -********************************************************************/ -BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, - NT_PRINTER_DRIVER_INFO_LEVEL_3 **asc) -{ - NT_PRINTER_DRIVER_INFO_LEVEL_3 *d; - - DEBUG(7,("uni_2_asc_printer_driver_3: Converting from UNICODE to ASCII\n")); - - if (*asc==NULL) - { - *asc=(NT_PRINTER_DRIVER_INFO_LEVEL_3 *)malloc(sizeof(NT_PRINTER_DRIVER_INFO_LEVEL_3)); - ZERO_STRUCTP(*asc); - } - - d=*asc; - - d->cversion=uni->cversion; - - unistr2_to_ascii(d->name, &(uni->name), sizeof(d->name)-1); - unistr2_to_ascii(d->environment, &(uni->environment), sizeof(d->environment)-1); - unistr2_to_ascii(d->driverpath, &(uni->driverpath), sizeof(d->driverpath)-1); - unistr2_to_ascii(d->datafile, &(uni->datafile), sizeof(d->datafile)-1); - unistr2_to_ascii(d->configfile, &(uni->configfile), sizeof(d->configfile)-1); - unistr2_to_ascii(d->helpfile, &(uni->helpfile), sizeof(d->helpfile)-1); - unistr2_to_ascii(d->monitorname, &(uni->monitorname), sizeof(d->monitorname)-1); - unistr2_to_ascii(d->defaultdatatype, &(uni->defaultdatatype), sizeof(d->defaultdatatype)-1); - - DEBUGADD(8,( "version: %d\n", d->cversion)); - DEBUGADD(8,( "name: %s\n", d->name)); - DEBUGADD(8,( "environment: %s\n", d->environment)); - DEBUGADD(8,( "driverpath: %s\n", d->driverpath)); - DEBUGADD(8,( "datafile: %s\n", d->datafile)); - DEBUGADD(8,( "configfile: %s\n", d->configfile)); - DEBUGADD(8,( "helpfile: %s\n", d->helpfile)); - DEBUGADD(8,( "monitorname: %s\n", d->monitorname)); - DEBUGADD(8,( "defaultdatatype: %s\n", d->defaultdatatype)); - - uniarray_2_ascarray(&(uni->dependentfiles), &(d->dependentfiles) ); - - return True; -} - -BOOL uni_2_asc_printer_info_2(SPOOL_PRINTER_INFO_LEVEL_2 *uni, - NT_PRINTER_INFO_LEVEL_2 **asc) -{ - NT_PRINTER_INFO_LEVEL_2 *d; - - DEBUG(7,("Converting from UNICODE to ASCII\n")); - - if (*asc==NULL) - { - DEBUGADD(8,("allocating memory\n")); - - *asc=(NT_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(NT_PRINTER_INFO_LEVEL_2)); - ZERO_STRUCTP(*asc); - } - DEBUGADD(8,("start converting\n")); - - d=*asc; - - d->attributes=uni->attributes; - d->priority=uni->priority; - d->default_priority=uni->default_priority; - d->starttime=uni->starttime; - d->untiltime=uni->untiltime; - d->status=uni->status; - d->cjobs=uni->cjobs; - - unistr2_to_ascii(d->servername, &(uni->servername), sizeof(d->servername)-1); - unistr2_to_ascii(d->printername, &(uni->printername), sizeof(d->printername)-1); - unistr2_to_ascii(d->sharename, &(uni->sharename), sizeof(d->sharename)-1); - unistr2_to_ascii(d->portname, &(uni->portname), sizeof(d->portname)-1); - unistr2_to_ascii(d->drivername, &(uni->drivername), sizeof(d->drivername)-1); - unistr2_to_ascii(d->comment, &(uni->comment), sizeof(d->comment)-1); - unistr2_to_ascii(d->location, &(uni->location), sizeof(d->location)-1); - unistr2_to_ascii(d->sepfile, &(uni->sepfile), sizeof(d->sepfile)-1); - unistr2_to_ascii(d->printprocessor, &(uni->printprocessor), sizeof(d->printprocessor)-1); - unistr2_to_ascii(d->datatype, &(uni->datatype), sizeof(d->datatype)-1); - unistr2_to_ascii(d->parameters, &(uni->parameters), sizeof(d->parameters)-1); - - return True; -} - -BOOL convert_printer_info(SPOOL_PRINTER_INFO_LEVEL uni, - NT_PRINTER_INFO_LEVEL *printer, - uint32 level) -{ - switch (level) - { - case 2: - { - uni_2_asc_printer_info_2(uni.info_2, &(printer->info_2)); - break; - } - default: - break; - } - - - - return True; -} - -BOOL convert_printer_driver_info(SPOOL_PRINTER_DRIVER_INFO_LEVEL uni, - NT_PRINTER_DRIVER_INFO_LEVEL *printer, - uint32 level) -{ - switch (level) - { - case 3: - { - printer->info_3=NULL; - uni_2_asc_printer_driver_3(uni.info_3, &(printer->info_3)); - break; - } - default: - break; - } - - - - return True; -} - -BOOL convert_devicemode(DEVICEMODE devmode, NT_DEVICEMODE *nt_devmode) -{ - unistr_to_ascii(nt_devmode->devicename, - devmode.devicename.buffer, - 31); - - unistr_to_ascii(nt_devmode->formname, - devmode.formname.buffer, - 31); - - nt_devmode->specversion=devmode.specversion; - nt_devmode->driverversion=devmode.driverversion; - nt_devmode->size=devmode.size; - nt_devmode->driverextra=devmode.driverextra; - nt_devmode->fields=devmode.fields; - nt_devmode->orientation=devmode.orientation; - nt_devmode->papersize=devmode.papersize; - nt_devmode->paperlength=devmode.paperlength; - nt_devmode->paperwidth=devmode.paperwidth; - nt_devmode->scale=devmode.scale; - nt_devmode->copies=devmode.copies; - nt_devmode->defaultsource=devmode.defaultsource; - nt_devmode->printquality=devmode.printquality; - nt_devmode->color=devmode.color; - nt_devmode->duplex=devmode.duplex; - nt_devmode->yresolution=devmode.yresolution; - nt_devmode->ttoption=devmode.ttoption; - nt_devmode->collate=devmode.collate; - - nt_devmode->logpixels=devmode.logpixels; - nt_devmode->bitsperpel=devmode.bitsperpel; - nt_devmode->pelswidth=devmode.pelswidth; - nt_devmode->pelsheight=devmode.pelsheight; - nt_devmode->displayflags=devmode.displayflags; - nt_devmode->displayfrequency=devmode.displayfrequency; - nt_devmode->icmmethod=devmode.icmmethod; - nt_devmode->icmintent=devmode.icmintent; - nt_devmode->mediatype=devmode.mediatype; - nt_devmode->dithertype=devmode.dithertype; - nt_devmode->reserved1=devmode.reserved1; - nt_devmode->reserved2=devmode.reserved2; - nt_devmode->panningwidth=devmode.panningwidth; - nt_devmode->panningheight=devmode.panningheight; - - if (nt_devmode->driverextra != 0) - { - /* if we had a previous private delete it and make a new one */ - if (nt_devmode->private != NULL) - free(nt_devmode->private); - nt_devmode->private=(uint8 *)malloc(nt_devmode->driverextra * sizeof(uint8)); - memcpy(nt_devmode->private, devmode.private, nt_devmode->driverextra); - } - - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth) -{ - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - - prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriverdir"); - depth++; - - prs_align(ps); - - prs_uint32("pointer", ps, depth, &useless_ptr); - - switch (r_u->level) - { - case 1: - { - DRIVER_DIRECTORY_1 *driver_info_1; - driver_info_1=&(r_u->driver.driver_info_1); - - bufsize_required = size_of_relative_string(&(driver_info_1->name)); - break; - } - } - - DEBUG(4,("spoolss_io_r_getprinterdriverdir, size needed: %d\n",bufsize_required)); - DEBUG(4,("spoolss_io_r_getprinterdriverdir, size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - - if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ - DEBUG(4,("spoolss_io_r_getprinterdriverdir, buffer too small\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - else - { - mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); - - DEBUG(4,("spoolss_io_r_getprinterdriverdir, buffer large enough\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - beginning=ps->offset; - start_offset=ps->offset; - end_offset=start_offset+r_u->offered; - - switch (r_u->level) - { - case 1: - { - DRIVER_DIRECTORY_1 *info; - info = &(r_u->driver.driver_info_1); - prs_unistr("name", ps, depth, &(info->name)); - /*smb_io_printer_driver_dir_1(desc, info, ps, depth, &start_offset, &end_offset);*/ - break; - } - } - ps->offset=beginning+r_u->offered; - prs_align(ps); - } - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, prs_struct *ps, int depth) -{ - - uint32 useless_ptr=0xADDE0FF0; - prs_debug(ps, depth, desc, ""); - depth++; - - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - smb_io_unistr2("", &(q_u->name),True,ps,depth); - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - smb_io_unistr2("", &(q_u->environment),True,ps,depth); - prs_align(ps); - prs_uint32("level", ps, depth, &(q_u->level)); - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); - prs_align(ps); - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth) -{ - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - int i; - - prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocessors"); - depth++; - - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - switch (r_u->level) - { - case 1: - { - PRINTPROCESSOR_1 *info_1; - info_1=r_u->info_1; - - for (i=0; inumofprintprocessors; i++) - { - bufsize_required += spoolss_size_processor_info_1(&(info_1[i])); - } - break; - } - } - - DEBUG(4,("size needed: %d\n",bufsize_required)); - DEBUG(4,("size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ - - DEBUG(4,("buffer too small\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - else - { - mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); - - DEBUG(4,("buffer large enough\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - beginning=ps->offset; - start_offset=ps->offset; - end_offset=start_offset+r_u->offered; - - switch (r_u->level) - { - case 1: - { - PRINTPROCESSOR_1 *info_1; - for (i=0; inumofprintprocessors; i++) - { - info_1 = &(r_u->info_1[i]); - smb_io_processor_info_1(desc, info_1, ps, depth, &start_offset, &end_offset); - } - break; - } - } - ps->offset=beginning+r_u->offered; - prs_align(ps); - } - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("numofprintprocessors", ps, depth, &(r_u->numofprintprocessors)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, prs_struct *ps, int depth) -{ - uint32 useless; - prs_debug(ps, depth, desc, "spoolss_io_q_enumprintprocessors"); - depth++; - - prs_align(ps); - prs_uint32("useless", ps, depth, &useless); - smb_io_unistr2("", &(q_u->name),True,ps,depth); - prs_align(ps); - prs_uint32("useless", ps, depth, &useless); - smb_io_unistr2("", &(q_u->environment),True,ps,depth); - prs_align(ps); - prs_uint32("level", ps, depth, &(q_u->level)); - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); - prs_align(ps); - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth) -{ - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - int i; - - prs_debug(ps, depth, desc, "spoolss_io_r_enumprintmonitors"); - depth++; - - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - switch (r_u->level) - { - case 1: - { - PRINTMONITOR_1 *info_1; - info_1=r_u->info_1; - - for (i=0; inumofprintmonitors; i++) - { - bufsize_required += spoolss_size_monitor_info_1(&(info_1[i])); - } - break; - } - } - - DEBUG(4,("size needed: %d\n",bufsize_required)); - DEBUG(4,("size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ - - DEBUG(4,("buffer too small\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - else - { - mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); - - DEBUG(4,("buffer large enough\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - beginning=ps->offset; - start_offset=ps->offset; - end_offset=start_offset+r_u->offered; - - switch (r_u->level) - { - case 1: - { - PRINTMONITOR_1 *info_1; - for (i=0; inumofprintmonitors; i++) - { - info_1 = &(r_u->info_1[i]); - smb_io_monitor_info_1(desc, info_1, ps, depth, &start_offset, &end_offset); - } - break; - } - } - ps->offset=beginning+r_u->offered; - prs_align(ps); - } - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("numofprintmonitors", ps, depth, &(r_u->numofprintmonitors)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_enumprintmonitors(char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth) -{ - uint32 useless; - prs_debug(ps, depth, desc, "spoolss_io_q_enumprintmonitors"); - depth++; - - prs_align(ps); - prs_uint32("useless", ps, depth, &useless); - smb_io_unistr2("", &(q_u->name),True,ps,depth); - prs_align(ps); - prs_uint32("level", ps, depth, &(q_u->level)); - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); - prs_align(ps); - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdata"); - depth++; - - prs_align(ps); - prs_uint32("valuesize", ps, depth, &(r_u->valuesize)); - prs_unistr("value", ps, depth, &(r_u->value)); - prs_uint32("realvaluesize", ps, depth, &(r_u->realvaluesize)); - - prs_uint32("type", ps, depth, &(r_u->type)); - - prs_uint32("datasize", ps, depth, &(r_u->datasize)); - prs_uint8s(False, "data", ps, depth, r_u->data, r_u->datasize); - prs_uint32("realdatasize", ps, depth, &(r_u->realdatasize)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_enumprinterdata(char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdata"); - depth++; - - prs_align(ps); - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("index", ps, depth, &(q_u->index)); - prs_uint32("valuesize", ps, depth, &(q_u->valuesize)); - prs_uint32("datasize", ps, depth, &(q_u->datasize)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_q_setprinterdata"); - depth++; - - prs_align(ps); - smb_io_prt_hnd("printer handle", &(q_u->handle), ps, depth); - smb_io_unistr2("", &(q_u->value), True, ps, depth); - - prs_align(ps); - - prs_uint32("type", ps, depth, &(q_u->type)); - - prs_uint32("max_len", ps, depth, &(q_u->max_len)); - - switch (q_u->type) - { - case 0x1: - case 0x3: - case 0x4: - case 0x7: - q_u->data=(uint8 *)malloc(q_u->max_len * sizeof(uint8)); - prs_uint8s(False,"data", ps, depth, q_u->data, q_u->max_len); - prs_align(ps); - break; - } - - prs_uint32("real_len", ps, depth, &(q_u->real_len)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_setprinterdata"); - depth++; - - prs_align(ps); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL convert_specific_param(NT_PRINTER_PARAM **param, UNISTR2 value , uint32 type, uint8 *data, uint32 len) -{ - DEBUG(5,("converting a specific param struct\n")); - - if (*param == NULL) - { - *param=(NT_PRINTER_PARAM *)malloc(sizeof(NT_PRINTER_PARAM)); - ZERO_STRUCTP(*param); - DEBUGADD(6,("Allocated a new PARAM struct\n")); - } - unistr2_to_ascii((*param)->value, &value, sizeof((*param)->value)-1); - (*param)->type = type; - - /* le champ data n'est pas NULL termine */ - /* on stocke donc la longueur */ - - (*param)->data_len=len; - - (*param)->data=(uint8 *)malloc(len * sizeof(uint8)); - - memcpy((*param)->data, data, len); - - DEBUGADD(6,("\tvalue:[%s], len:[%d]\n",(*param)->value, (*param)->data_len)); - - return True; -} - -/******************************************************************* -********************************************************************/ -static BOOL spoolss_io_addform(char *desc, FORM *f, uint32 ptr, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_addform"); - depth++; - prs_align(ps); - - if (ptr!=0) - { - prs_uint32("flags", ps, depth, &(f->flags)); - prs_uint32("name_ptr", ps, depth, &(f->name_ptr)); - prs_uint32("size_x", ps, depth, &(f->size_x)); - prs_uint32("size_y", ps, depth, &(f->size_y)); - prs_uint32("left", ps, depth, &(f->left)); - prs_uint32("top", ps, depth, &(f->top)); - prs_uint32("right", ps, depth, &(f->right)); - prs_uint32("bottom", ps, depth, &(f->bottom)); - - smb_io_unistr2("", &(f->name), f->name_ptr, ps, depth); - } - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth) -{ - uint32 useless_ptr=0; - prs_debug(ps, depth, desc, "spoolss_io_q_addform"); - depth++; - - prs_align(ps); - smb_io_prt_hnd("printer handle", &(q_u->handle), ps, depth); - prs_uint32("level", ps, depth, &(q_u->level)); - prs_uint32("level2", ps, depth, &(q_u->level2)); - - if (q_u->level==1) - { - prs_uint32("useless_ptr", ps, depth, &(useless_ptr)); - spoolss_io_addform("", &(q_u->form), useless_ptr, ps, depth); - } - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_addform"); - depth++; - - prs_align(ps); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth) -{ - uint32 useless_ptr=0; - prs_debug(ps, depth, desc, "spoolss_io_q_setform"); - depth++; - - prs_align(ps); - smb_io_prt_hnd("printer handle", &(q_u->handle), ps, depth); - smb_io_unistr2("", &(q_u->name), True, ps, depth); - - prs_align(ps); - - prs_uint32("level", ps, depth, &(q_u->level)); - prs_uint32("level2", ps, depth, &(q_u->level2)); - - if (q_u->level==1) - { - prs_uint32("useless_ptr", ps, depth, &(useless_ptr)); - spoolss_io_addform("", &(q_u->form), useless_ptr, ps, depth); - } - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_setform(char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_setform"); - depth++; - - prs_align(ps); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_r_getjob(char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int depth) -{ - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - - prs_debug(ps, depth, desc, "spoolss_io_r_getjob"); - depth++; - - prs_align(ps); - - prs_uint32("pointer", ps, depth, &useless_ptr); - - switch (r_u->level) - { - case 1: - { - JOB_INFO_1 *info; - info=r_u->job.job_info_1; - - bufsize_required += spoolss_size_job_info_1(info); - break; - } - case 2: - { - JOB_INFO_2 *info; - info=r_u->job.job_info_2; - - bufsize_required += spoolss_size_job_info_2(info); - break; - } - } - - DEBUG(4,("spoolss_io_r_getjob, size needed: %d\n",bufsize_required)); - DEBUG(4,("spoolss_io_r_getjob, size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ - - DEBUG(4,("spoolss_io_r_getjob, buffer too small\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - else - { - mem_grow_data(&(ps->data), ps->io, r_u->offered, 0); - - DEBUG(4,("spoolss_io_r_enumjobs, buffer large enough\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - beginning=ps->offset; - start_offset=ps->offset; - end_offset=start_offset+r_u->offered; - - switch (r_u->level) - { - case 1: - { - JOB_INFO_1 *info; - info = r_u->job.job_info_1; - smb_io_job_info_1(desc, info, ps, depth, &start_offset, &end_offset); - break; - } - case 2: - { - JOB_INFO_2 *info; - info = r_u->job.job_info_2; - smb_io_job_info_2(desc, info, ps, depth, &start_offset, &end_offset); - break; - } - - } - ps->offset=beginning+r_u->offered; - prs_align(ps); - } - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -********************************************************************/ -BOOL spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int depth) -{ - - prs_debug(ps, depth, desc, ""); - depth++; - - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("jobid", ps, depth, &(q_u->jobid)); - prs_uint32("level", ps, depth, &(q_u->level)); - - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); - - prs_align(ps); - - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); - - return True; -} diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c deleted file mode 100644 index 08fed7d47c..0000000000 --- a/source3/rpc_parse/parse_svc.c +++ /dev/null @@ -1,936 +0,0 @@ - -/* - * Unix SMB/Netbios implementation. - * Version 1.9. - * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1999, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, - * Copyright (C) Paul Ashton 1997-1999. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -#include "includes.h" - -extern int DEBUGLEVEL; - -/******************************************************************* - make_svc_q_open_sc_man - ********************************************************************/ -BOOL make_svc_q_open_sc_man(SVC_Q_OPEN_SC_MAN *q_u, - const char *server, const char *database, - uint32 des_access) -{ - DEBUG(5,("make_svc_q_open_sc_man\n")); - - make_buf_unistr2(&(q_u->uni_srv_name), &(q_u->ptr_srv_name), server); - make_buf_unistr2(&(q_u->uni_db_name ), &(q_u->ptr_db_name), database); - q_u->des_access = des_access; - - - return True; -} - -/******************************************************************* -reads or writes a SVC_Q_OPEN_SC_MAN structure. -********************************************************************/ -BOOL svc_io_q_open_sc_man(char *desc, SVC_Q_OPEN_SC_MAN *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_q_open_sc_man"); - depth++; - - prs_align(ps); - - prs_uint32("ptr_srv_name", ps, depth, &(q_u->ptr_srv_name)); - smb_io_unistr2("", &(q_u->uni_srv_name), q_u->ptr_srv_name, ps, depth); - prs_align(ps); - - prs_uint32("ptr_db_name", ps, depth, &(q_u->ptr_db_name)); - smb_io_unistr2("", &(q_u->uni_db_name), q_u->ptr_db_name, ps, depth); - prs_align(ps); - - prs_uint32("des_access", ps, depth, &(q_u->des_access)); - prs_align(ps); - - return True; -} - -/******************************************************************* - make_svc_r_open_sc_man - ********************************************************************/ -BOOL make_svc_r_open_sc_man(SVC_R_OPEN_SC_MAN *r_u, POLICY_HND *hnd, - uint32 status) -{ - DEBUG(5,("make_svc_r_unknown_0: %d\n", __LINE__)); - - memcpy(&(r_u->pol), hnd, sizeof(r_u->pol)); - r_u->status = status; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL svc_io_r_open_sc_man(char *desc, SVC_R_OPEN_SC_MAN *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_r_open_sc_man"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("", &(r_u->pol), ps, depth); - - prs_uint32("status ", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* - make_svc_q_open_service - ********************************************************************/ -BOOL make_svc_q_open_service(SVC_Q_OPEN_SERVICE *q_u, - POLICY_HND *hnd, - const char *server, - uint32 des_access) -{ - DEBUG(5,("make_svc_q_open_service\n")); - - memcpy(&(q_u->scman_pol), hnd, sizeof(q_u->scman_pol)); - make_unistr2(&(q_u->uni_svc_name), server, strlen(server)+1); - q_u->des_access = des_access; - - - return True; -} - -/******************************************************************* -reads or writes a SVC_Q_OPEN_SERVICE structure. -********************************************************************/ -BOOL svc_io_q_open_service(char *desc, SVC_Q_OPEN_SERVICE *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_q_open_service"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("", &(q_u->scman_pol), ps, depth); - prs_align(ps); - - smb_io_unistr2("", &(q_u->uni_svc_name), 1, ps, depth); - prs_align(ps); - - prs_uint32("des_access", ps, depth, &(q_u->des_access)); - prs_align(ps); - - return True; -} - -/******************************************************************* - make_svc_r_open_service - ********************************************************************/ -BOOL make_svc_r_open_service(SVC_R_OPEN_SERVICE *r_u, POLICY_HND *hnd, - uint32 status) -{ - DEBUG(5,("make_svc_r_unknown_0: %d\n", __LINE__)); - - memcpy(&(r_u->pol), hnd, sizeof(r_u->pol)); - r_u->status = status; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL svc_io_r_open_service(char *desc, SVC_R_OPEN_SERVICE *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_r_open_service"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("", &(r_u->pol), ps, depth); - - prs_uint32("status ", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -makes an SVC_Q_STOP_SERVICE structure. -********************************************************************/ -BOOL make_svc_q_stop_service(SVC_Q_STOP_SERVICE *q_c, POLICY_HND *hnd, - uint32 unk) -{ - if (q_c == NULL || hnd == NULL) return False; - - DEBUG(5,("make_svc_q_stop_service\n")); - - memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); - q_c->unknown = unk; - - return True; -} - -/******************************************************************* -reads or writes a SVC_Q_STOP_SERVICE structure. -********************************************************************/ -BOOL svc_io_q_stop_service(char *desc, SVC_Q_STOP_SERVICE *q_s, prs_struct *ps, int depth) -{ - if (q_s == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_q_stop_service"); - depth++; - - prs_align(ps); - smb_io_pol_hnd("", &(q_s->pol), ps, depth); - - prs_align(ps); - - prs_uint32("unknown", ps, depth, &(q_s->unknown)); - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL svc_io_r_stop_service(char *desc, SVC_R_STOP_SERVICE *r_s, prs_struct *ps, int depth) -{ - if (r_s == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_r_stop_service"); - depth++; - - prs_uint32("unknown0", ps, depth, &(r_s->unknown0)); - prs_uint32("unknown1", ps, depth, &(r_s->unknown1)); - prs_uint32("unknown2", ps, depth, &(r_s->unknown2)); - prs_uint32("unknown3", ps, depth, &(r_s->unknown3)); - prs_uint32("unknown4", ps, depth, &(r_s->unknown4)); - prs_uint32("unknown5", ps, depth, &(r_s->unknown5)); - prs_uint32("unknown6", ps, depth, &(r_s->unknown6)); - prs_uint32("status", ps, depth, &(r_s->status)); - - return True; -} - -/******************************************************************* -makes an SVC_Q_START_SERVICE structure. -********************************************************************/ -BOOL make_svc_q_start_service(SVC_Q_START_SERVICE *q_c, POLICY_HND *hnd, - uint32 argc, - char **argv) -{ - uint32 i; - - if (q_c == NULL || hnd == NULL) return False; - - DEBUG(5,("make_svc_q_start_service\n")); - - memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); - q_c->argc = argc; - q_c->ptr_args = 1; - q_c->argc2 = argc; - - for (i = 0; i < argc; i++) - { - size_t len_argv = argv[i] != NULL ? strlen(argv[i])+1 : 0; - q_c->ptr_argv[i] = argv[i] != NULL ? 1 : 0; - make_unistr2(&(q_c->argv[i]), argv[i], len_argv); - } - - return True; -} - -/******************************************************************* -reads or writes a SVC_Q_START_SERVICE structure. -********************************************************************/ -BOOL svc_io_q_start_service(char *desc, SVC_Q_START_SERVICE *q_s, prs_struct *ps, int depth) -{ - if (q_s == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_q_start_service"); - depth++; - - prs_align(ps); - smb_io_pol_hnd("", &(q_s->pol), ps, depth); - - prs_align(ps); - prs_uint32("argc ", ps, depth, &(q_s->argc )); - prs_uint32("ptr_args", ps, depth, &(q_s->ptr_args)); - - if (q_s->ptr_args != 0) - { - uint32 i; - - prs_uint32("argc2 ", ps, depth, &(q_s->argc2)); - - if (q_s->argc2 > MAX_SVC_ARGS) - { - return False; - } - - for (i = 0; i < q_s->argc2; i++) - { - prs_uint32("", ps, depth, &(q_s->ptr_argv[i])); - } - for (i = 0; i < q_s->argc2; i++) - { - smb_io_unistr2("", &(q_s->argv[i]), q_s->ptr_argv[i], ps, depth); - prs_align(ps); - } - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL svc_io_r_start_service(char *desc, SVC_R_START_SERVICE *r_s, prs_struct *ps, int depth) -{ - if (r_s == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_r_start_service"); - depth++; - - prs_uint32("status", ps, depth, &(r_s->status)); - - return True; -} - -/******************************************************************* - make_svc_query_svc_cfg - ********************************************************************/ -BOOL make_svc_query_svc_cfg(QUERY_SERVICE_CONFIG *q_u, - uint32 service_type, uint32 start_type, - uint32 error_control, - char* bin_path_name, char* load_order_grp, - uint32 tag_id, - char* dependencies, char* service_start_name, - char* disp_name) -{ - DEBUG(5,("make_svc_query_svc_cfg\n")); - - q_u->service_type = service_type; - q_u->start_type = start_type; - q_u->error_control = error_control; - make_buf_unistr2(&(q_u->uni_bin_path_name ), &(q_u->ptr_bin_path_name ), bin_path_name ); - make_buf_unistr2(&(q_u->uni_load_order_grp ), &(q_u->ptr_load_order_grp ), load_order_grp ); - q_u->tag_id = tag_id; - make_buf_unistr2(&(q_u->uni_dependencies ), &(q_u->ptr_dependencies ), dependencies ); - make_buf_unistr2(&(q_u->uni_service_start_name), &(q_u->ptr_service_start_name), service_start_name); - make_buf_unistr2(&(q_u->uni_display_name ), &(q_u->ptr_display_name ), disp_name ); - - return True; -} - -/******************************************************************* -reads or writes a QUERY_SERVICE_CONFIG structure. -********************************************************************/ -BOOL svc_io_query_svc_cfg(char *desc, QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_query_svc_cfg"); - depth++; - - prs_align(ps); - - prs_uint32("service_type ", ps, depth, &(q_u->service_type )); - prs_uint32("start_type ", ps, depth, &(q_u->start_type )); - prs_uint32("error_control ", ps, depth, &(q_u->error_control )); - prs_uint32("ptr_bin_path_name ", ps, depth, &(q_u->ptr_bin_path_name )); - prs_uint32("ptr_load_order_grp ", ps, depth, &(q_u->ptr_load_order_grp )); - prs_uint32("tag_id ", ps, depth, &(q_u->tag_id )); - prs_uint32("ptr_dependencies ", ps, depth, &(q_u->ptr_dependencies )); - prs_uint32("ptr_service_start_name", ps, depth, &(q_u->ptr_service_start_name)); - prs_uint32("ptr_display_name ", ps, depth, &(q_u->ptr_display_name )); - - smb_io_unistr2("uni_bin_path_name ", &(q_u->uni_bin_path_name ), q_u->ptr_bin_path_name , ps, depth); - prs_align(ps); - smb_io_unistr2("uni_load_order_grp ", &(q_u->uni_load_order_grp ), q_u->ptr_load_order_grp , ps, depth); - prs_align(ps); - smb_io_unistr2("uni_dependencies ", &(q_u->uni_dependencies ), q_u->ptr_dependencies , ps, depth); - prs_align(ps); - smb_io_unistr2("uni_service_start_name", &(q_u->uni_service_start_name), q_u->ptr_service_start_name, ps, depth); - prs_align(ps); - smb_io_unistr2("uni_display_name ", &(q_u->uni_display_name ), q_u->ptr_display_name , ps, depth); - prs_align(ps); - - return True; -} - -/******************************************************************* -makes an SVC_Q_ENUM_SVCS_STATUS structure. -********************************************************************/ -BOOL make_svc_q_enum_svcs_status(SVC_Q_ENUM_SVCS_STATUS *q_c, POLICY_HND *hnd, - uint32 service_type, uint32 service_state, - uint32 buf_size, uint32 resume_hnd ) -{ - if (q_c == NULL || hnd == NULL) return False; - - DEBUG(5,("make_svc_q_enum_svcs_status\n")); - - memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); - q_c->service_type = service_type; - q_c->service_state = service_state; - q_c->buf_size = buf_size; - make_enum_hnd(&q_c->resume_hnd, resume_hnd); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL svc_io_q_enum_svcs_status(char *desc, SVC_Q_ENUM_SVCS_STATUS *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_q_enum_svcs_status"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("", &(q_u->pol), ps, depth); - prs_align(ps); - - prs_uint32("service_type ", ps, depth, &(q_u->service_type )); - prs_uint32("service_state", ps, depth, &(q_u->service_state)); - prs_uint32("buf_size ", ps, depth, &(q_u->buf_size )); - smb_io_enum_hnd("resume_hnd", &(q_u->resume_hnd), ps, depth); - - return True; -} - -/******************************************************************* -makes an SVC_R_ENUM_SVCS_STATUS structure. -********************************************************************/ -BOOL make_svc_r_enum_svcs_status(SVC_R_ENUM_SVCS_STATUS *r_c, - ENUM_SRVC_STATUS *svcs, uint32 more_buf_size, - uint32 num_svcs, uint32 resume_hnd, - uint32 dos_status) -{ - if (r_c == NULL) return False; - - DEBUG(5,("make_svc_r_enum_svcs_status\n")); - - r_c->svcs = svcs; - r_c->more_buf_size = more_buf_size; - r_c->num_svcs = num_svcs; - make_enum_hnd(&r_c->resume_hnd, resume_hnd); - r_c->dos_status = dos_status; - - return True; -} - -/******************************************************************* -reads or writes a SVC_R_ENUM_SVCS_STATUS structure. - -this is another wierd structure. WHY oh WHY can the microsoft teams -not COMMUNICATE and get some CONSISTENCY TO THEIR DATA STRUCTURES! -ARGH! - -********************************************************************/ -BOOL svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_struct *ps, int depth) -{ - uint32 i; - if (svc == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_r_enum_svcs_status"); - depth++; - - prs_align(ps); - - /* - * format is actually as laid out in SVC_R_ENUM_SVCS_STATUS. - * the reason for all the jumping about, which is horrible - * and can be avoided, is due to the use of offsets instead - * of pointers. - * - * if i ever find out that these offsets are in fact non-zero - * tokens just like pointer-tokens, i am going to go MAD. - */ - - if (ps->io) - { - /* reading */ - - uint32 buf_offset; - uint32 new_offset; - - prs_uint32("buf_size", ps, depth, &(svc->buf_size)); - - buf_offset = ps->offset; - ps->offset = buf_offset + svc->buf_size; - - prs_align(ps); - - prs_uint32("more_buf_size", ps, depth, &(svc->more_buf_size)); - prs_uint32("num_svcs", ps, depth, &(svc->num_svcs)); - smb_io_enum_hnd("resume_hnd", &(svc->resume_hnd), ps, depth); - prs_uint32("dos_status", ps, depth, &(svc->dos_status)); - - new_offset = ps->offset; - ps->offset = buf_offset; - - svc->svcs = (ENUM_SRVC_STATUS*)Realloc(NULL, - svc->num_svcs * sizeof(ENUM_SRVC_STATUS)); - - if (svc->svcs == NULL) - { - DEBUG(0,("svc_io_r_enum_svcs_status: Realloc failed\n")); - ps->offset = 0x7fffffff; - return False; - } - - bzero(svc->svcs, svc->num_svcs * sizeof(ENUM_SRVC_STATUS)); - - for (i = 0; i < svc->num_svcs; i++) - { - fstring name; - uint32 old_offset; - uint32 srvc_offset; - uint32 disp_offset; - - prs_uint32("srvc_offset", ps, depth, &srvc_offset); - prs_uint32("disp_offset", ps, depth, &disp_offset); - svc_io_svc_status("status", &svc->svcs[i].status, ps, depth); - - old_offset = ps->offset; - - ps->offset = buf_offset + srvc_offset; - slprintf(name, sizeof(name)-1, "srvc[%02d]", i); - smb_io_unistr(name, &svc->svcs[i].uni_srvc_name, ps, depth); - - ps->offset = buf_offset + disp_offset; - slprintf(name, sizeof(name)-1, "disp[%02d]", i); - smb_io_unistr(name, &svc->svcs[i].uni_disp_name, ps, depth); - - ps->offset = old_offset; - } - - ps->offset = new_offset; - } - else - { - /* writing */ - - uint32 buf_offset; - uint32 old_buf_offset; - uint32 srvc_offset = 9 * sizeof(uint32) * svc->num_svcs; - - prs_uint32_pre("buf_size", ps, depth, &svc->buf_size, &buf_offset); - old_buf_offset = ps->offset; - - srvc_offset += old_buf_offset; - - if (svc->svcs == NULL) - { - return False; - } - - for (i = 0; i < svc->num_svcs; i++) - { - fstring name; - uint32 old_offset; - - /* - * store unicode string offset and unicode string - */ - - srvc_offset -= old_buf_offset; - prs_uint32("srvc_offset", ps, depth, &srvc_offset); - srvc_offset += old_buf_offset; - - slprintf(name, sizeof(name)-1, "srvc[%02d]", i); - - old_offset = ps->offset; - ps->offset = srvc_offset; - smb_io_unistr(name, &svc->svcs[i].uni_srvc_name, ps, depth); - srvc_offset = ps->offset; - ps->offset = old_offset; - - /* - * store unicode string offset and unicode string - */ - - srvc_offset -= old_buf_offset; - prs_uint32("disp_offset", ps, depth, &srvc_offset); - srvc_offset += old_buf_offset; - - slprintf(name, sizeof(name)-1, "disp[%02d]", i); - - old_offset = ps->offset; - ps->offset = srvc_offset; - smb_io_unistr(name, &svc->svcs[i].uni_disp_name, ps, depth); - srvc_offset = ps->offset; - ps->offset = old_offset; - - /* - * store status info - */ - - svc_io_svc_status("status", &svc->svcs[i].status, ps, depth); - } - - prs_uint32_post("buf_size", ps, depth, &svc->buf_size, buf_offset, srvc_offset - buf_offset - sizeof(uint32)); - - ps->offset = srvc_offset; - - prs_align(ps); - - prs_uint32("more_buf_size", ps, depth, &(svc->more_buf_size)); - prs_uint32("num_svcs", ps, depth, &(svc->num_svcs)); - smb_io_enum_hnd("resume_hnd", &(svc->resume_hnd), ps, depth); - prs_uint32("dos_status", ps, depth, &(svc->dos_status)); - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL svc_io_svc_status(char *desc, SVC_STATUS *svc, prs_struct *ps, int depth) -{ - if (svc == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_svc_status"); - depth++; - - prs_align(ps); - - prs_uint32("svc_type", ps, depth, &(svc->svc_type)); - prs_uint32("current_state", ps, depth, &(svc->current_state)); - prs_uint32("controls_accepted", ps, depth, &(svc->controls_accepted)); - prs_uint32("win32_exit_code", ps, depth, &(svc->win32_exit_code)); - prs_uint32("svc_specific_exit_code", ps, depth, &(svc->svc_specific_exit_code)); - prs_uint32("check_point", ps, depth, &(svc->check_point)); - prs_uint32("wait_hint", ps, depth, &(svc->wait_hint)); - - return True; -} - -/******************************************************************* -makes an SVC_Q_QUERY_SVC_CONFIG structure. -********************************************************************/ -BOOL make_svc_q_query_svc_config(SVC_Q_QUERY_SVC_CONFIG *q_c, POLICY_HND *hnd, - uint32 buf_size) -{ - if (q_c == NULL || hnd == NULL) return False; - - DEBUG(5,("make_svc_q_query_svc_config\n")); - - memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); - q_c->buf_size = buf_size; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL svc_io_q_query_svc_config(char *desc, SVC_Q_QUERY_SVC_CONFIG *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_q_query_svc_config"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("", &(q_u->pol), ps, depth); - prs_align(ps); - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); - - return True; -} - -/******************************************************************* -makes an SVC_R_QUERY_SVC_CONFIG structure. -********************************************************************/ -BOOL make_svc_r_query_svc_config(SVC_R_QUERY_SVC_CONFIG *r_c, - QUERY_SERVICE_CONFIG *cfg, - uint32 buf_size) -{ - if (r_c == NULL) return False; - - DEBUG(5,("make_svc_r_query_svc_config\n")); - - r_c->cfg = cfg; - r_c->buf_size = buf_size; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL svc_io_r_query_svc_config(char *desc, SVC_R_QUERY_SVC_CONFIG *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_r_query_svc_config"); - depth++; - - prs_align(ps); - - svc_io_query_svc_cfg("cfg", r_u->cfg, ps, depth); - prs_uint32("buf_size", ps, depth, &(r_u->buf_size)); - prs_uint32("status ", ps, depth, &(r_u->status )); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL svc_io_q_query_disp_name(char *desc, SVC_Q_QUERY_DISP_NAME *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_q_query_disp_name"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("", &(q_u->scman_pol), ps, depth); - prs_align(ps); - - smb_io_unistr2("uni_svc_name", &(q_u->uni_svc_name), 1, ps, depth); - prs_align(ps); - - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); - - return True; -} - -/******************************************************************* -makes an SVC_R_QUERY_DISP_NAME structure. -********************************************************************/ -BOOL make_svc_r_query_disp_name(SVC_R_QUERY_DISP_NAME *r_d, - char *disp_name, uint32 status) -{ - uint32 len = strlen(disp_name); - - if (r_d == NULL) return False; - - DEBUG(5,("make_svc_r_query_disp_name\n")); - - make_unistr2(&(r_d->uni_disp_name), disp_name, len+1); - r_d->buf_size = len; - - r_d->status = status; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL svc_io_r_query_disp_name(char *desc, SVC_R_QUERY_DISP_NAME *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_r_query_disp_name"); - depth++; - - prs_align(ps); - - smb_io_unistr2("uni_disp_name", &(r_u->uni_disp_name), 1, ps, depth); - prs_align(ps); - - prs_uint32("buf_size", ps, depth, &(r_u->buf_size)); - prs_uint32("status ", ps, depth, &(r_u->status )); - - return True; -} - -/******************************************************************* -makes an SVC_Q_CLOSE structure. -********************************************************************/ -BOOL make_svc_q_close(SVC_Q_CLOSE *q_c, POLICY_HND *hnd) -{ - if (q_c == NULL || hnd == NULL) return False; - - DEBUG(5,("make_svc_q_close\n")); - - memcpy(&(q_c->pol), hnd, sizeof(q_c->pol)); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL svc_io_q_close(char *desc, SVC_Q_CLOSE *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_q_close"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("", &(q_u->pol), ps, depth); - prs_align(ps); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL svc_io_r_close(char *desc, SVC_R_CLOSE *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_r_close"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("", &(r_u->pol), ps, depth); - prs_align(ps); - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* -makes an SVC_Q_CHANGE_SVC_CONFIG structure. -********************************************************************/ -BOOL make_svc_q_change_svc_config(SVC_Q_CHANGE_SVC_CONFIG *q_u, POLICY_HND *hnd, - uint32 service_type, uint32 start_type, - uint32 unknown_0, - uint32 error_control, - char* bin_path_name, char* load_order_grp, - uint32 tag_id, - char* dependencies, char* service_start_name, - char* password, - char* disp_name) -{ - if (q_u == NULL || hnd == NULL) return False; - - DEBUG(5,("make_svc_q_change_svc_config\n")); - - memcpy(&(q_u->pol), hnd, sizeof(q_u->pol)); - - q_u->service_type = service_type; - q_u->start_type = start_type; - q_u->unknown_0 = unknown_0; - q_u->error_control = error_control; - make_buf_unistr2(&(q_u->uni_bin_path_name ), &(q_u->ptr_bin_path_name ), bin_path_name ); - make_buf_unistr2(&(q_u->uni_load_order_grp ), &(q_u->ptr_load_order_grp ), load_order_grp ); - q_u->tag_id = tag_id; - make_buf_unistr2(&(q_u->uni_dependencies ), &(q_u->ptr_dependencies ), dependencies ); - make_buf_unistr2(&(q_u->uni_service_start_name), &(q_u->ptr_service_start_name), service_start_name); - make_buf_string2(&(q_u->str_password ), &(q_u->ptr_password ), password ); - make_buf_unistr2(&(q_u->uni_display_name ), &(q_u->ptr_display_name ), disp_name ); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL svc_io_q_change_svc_config(char *desc, SVC_Q_CHANGE_SVC_CONFIG *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_q_change_svc_config"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("", &(q_u->pol), ps, depth); - prs_align(ps); - - prs_uint32("service_type ", ps, depth, &(q_u->service_type )); - prs_uint32("start_type ", ps, depth, &(q_u->start_type )); - prs_uint32("unknown_0 ", ps, depth, &(q_u->unknown_0 )); - prs_uint32("error_control ", ps, depth, &(q_u->error_control )); - prs_uint32("ptr_bin_path_name ", ps, depth, &(q_u->ptr_bin_path_name )); - smb_io_unistr2("uni_bin_path_name ", &(q_u->uni_bin_path_name ), q_u->ptr_bin_path_name , ps, depth); - prs_align(ps); - - prs_uint32("ptr_load_order_grp ", ps, depth, &(q_u->ptr_load_order_grp )); - smb_io_unistr2("uni_load_order_grp ", &(q_u->uni_load_order_grp ), q_u->ptr_load_order_grp , ps, depth); - prs_align(ps); - prs_uint32("tag_id ", ps, depth, &(q_u->tag_id )); - prs_uint32("ptr_dependencies ", ps, depth, &(q_u->ptr_dependencies )); - smb_io_unistr2("uni_dependencies ", &(q_u->uni_dependencies ), q_u->ptr_dependencies , ps, depth); - prs_align(ps); - prs_uint32("ptr_service_start_name", ps, depth, &(q_u->ptr_service_start_name)); - smb_io_unistr2("uni_service_start_name", &(q_u->uni_service_start_name), q_u->ptr_service_start_name, ps, depth); - prs_align(ps); - prs_uint32("ptr_password ", ps, depth, &(q_u->ptr_password )); - - smb_io_string2("str_password ", &(q_u->str_password ), q_u->ptr_display_name , ps, depth); - prs_align(ps); - - prs_uint32("ptr_display_name ", ps, depth, &(q_u->ptr_display_name )); - smb_io_unistr2("uni_display_name ", &(q_u->uni_display_name ), q_u->ptr_display_name , ps, depth); - prs_align(ps); - - return True; -} - -/******************************************************************* -makes an SVC_R_CHANGE_SVC_CONFIG structure. -********************************************************************/ -BOOL make_svc_r_change_svc_config(SVC_R_CHANGE_SVC_CONFIG *r_c, - uint32 unknown_0, uint32 status) -{ - if (r_c == NULL) return False; - - DEBUG(5,("make_svc_r_change_svc_config\n")); - - r_c->unknown_0 = unknown_0; - r_c->status = status; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL svc_io_r_change_svc_config(char *desc, SVC_R_CHANGE_SVC_CONFIG *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "svc_io_r_change_svc_config"); - depth++; - - prs_align(ps); - - prs_uint32("unknown_0", ps, depth, &(r_u->unknown_0)); - prs_uint32("status ", ps, depth, &(r_u->status )); - - return True; -} - -- cgit From fbd17c8dafeefac788f4bc1c41045726825f513f Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 3 Jan 2000 19:19:48 +0000 Subject: simple mods to add msrpc pipe redirection. default behaviour: fall back to using internal msrpc code in smbd. (This used to be commit 8976e26d46cb991710bc77463f7f928ac00dd4d8) --- source3/rpc_parse/parse_creds.c | 578 ++++++++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_prs.c | 24 ++ 2 files changed, 602 insertions(+) create mode 100644 source3/rpc_parse/parse_creds.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c new file mode 100644 index 0000000000..74dac2f011 --- /dev/null +++ b/source3/rpc_parse/parse_creds.c @@ -0,0 +1,578 @@ +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tgrpsgell 1992-1999, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, + * Copyright (C) Paul Ashton 1997-1999. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambgrpsge, MA 02139, USA. + */ + + +#include "includes.h" + +extern int DEBUGLEVEL; + + +/******************************************************************* +makes a CREDS_UNIX structure. +********************************************************************/ +BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name, + const char* requested_name, + const char* real_name, + BOOL guest) +{ + if (r_u == NULL) return False; + + DEBUG(5,("make_creds_unix\n")); + + fstrcpy(r_u->user_name , user_name); + fstrcpy(r_u->requested_name, requested_name); + fstrcpy(r_u->real_name , real_name); + r_u->guest = guest; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL creds_io_unix(char *desc, CREDS_UNIX *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "creds_io_unix"); + depth++; + + prs_align(ps); + prs_string("user_name", ps, depth, r_u->user_name, strlen(r_u->user_name), sizeof(r_u->user_name)); + prs_align(ps); + prs_string("requested_name", ps, depth, r_u->requested_name, strlen(r_u->requested_name), sizeof(r_u->requested_name)); + prs_align(ps); + prs_string("real_name", ps, depth, r_u->real_name, strlen(r_u->real_name), sizeof(r_u->real_name)); + prs_align(ps); + prs_uint32("guest", ps, depth, &(r_u->guest)); + return True; +} + + +/******************************************************************* +frees a structure. +********************************************************************/ +void creds_free_unix(CREDS_UNIX *r_u) +{ +} + +/******************************************************************* +makes a CREDS_UNIX_SEC structure. +********************************************************************/ +BOOL make_creds_unix_sec(CREDS_UNIX_SEC *r_u, + uint32 uid, uint32 gid, uint32 num_grps, gid_t *grps) +{ + int i; + if (r_u == NULL) return False; + + DEBUG(5,("make_creds_unix_sec\n")); + + r_u->uid = uid; + r_u->gid = gid; + r_u->num_grps = num_grps; + r_u->grps = (uint32*)Realloc(NULL, sizeof(r_u->grps[0]) * + r_u->num_grps); + if (r_u->grps == NULL && num_grps != 0) + { + return False; + } + for (i = 0; i < num_grps; i++) + { + r_u->grps[i] = (gid_t)grps[i]; + } + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL creds_io_unix_sec(char *desc, CREDS_UNIX_SEC *r_u, prs_struct *ps, int depth) +{ + uint32 i; + + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "creds_io_unix_sec"); + depth++; + + prs_align(ps); + + prs_uint32("uid", ps, depth, &(r_u->uid)); + prs_uint32("gid", ps, depth, &(r_u->gid)); + prs_uint32("num_grps", ps, depth, &(r_u->num_grps)); + if (r_u->num_grps != 0) + { + r_u->grps = (uint32*)Realloc(r_u->grps, + sizeof(r_u->grps[0]) * + r_u->num_grps); + if (r_u->grps == NULL) + { + creds_free_unix_sec(r_u); + return False; + } + } + for (i = 0; i < r_u->num_grps; i++) + { + prs_uint32("", ps, depth, &(r_u->grps[i])); + } + return True; +} + + +/******************************************************************* +frees a structure. +********************************************************************/ +void creds_free_unix_sec(CREDS_UNIX_SEC *r_u) +{ + if (r_u->grps != NULL) + { + free(r_u->grps); + r_u->grps = NULL; + } +} + +/******************************************************************* +makes a CREDS_NT_SEC structure. +********************************************************************/ +BOOL make_creds_nt_sec(CREDS_NT_SEC *r_u, + DOM_SID *sid, uint32 num_grps, uint32 *grps) +{ + int i; + if (r_u == NULL) return False; + + DEBUG(5,("make_creds_unix_sec\n")); + + sid_copy(&r_u->sid, sid); + r_u->num_grps = num_grps; + r_u->grp_rids = (uint32*)Realloc(NULL, sizeof(r_u->grp_rids[0]) * + r_u->num_grps); + + if (r_u->grp_rids == NULL && num_grps != 0) + { + return False; + } + for (i = 0; i < num_grps; i++) + { + r_u->grp_rids[i] = grps[i]; + } + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL creds_io_nt_sec(char *desc, CREDS_NT_SEC *r_u, prs_struct *ps, int depth) +{ + int i; + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "creds_io_nt"); + depth++; + + prs_align(ps); + + smb_io_dom_sid ("sid", &r_u->sid, ps, depth); + prs_align(ps); + + prs_uint32("num_grps", ps, depth, &(r_u->num_grps)); + if (r_u->num_grps != 0) + { + r_u->grp_rids = (uint32*)Realloc(r_u->grp_rids, + sizeof(r_u->grp_rids[0]) * + r_u->num_grps); + if (r_u->grp_rids == NULL) + { + creds_free_nt_sec(r_u); + return False; + } + } + for (i = 0; i < r_u->num_grps; i++) + { + prs_uint32("", ps, depth, &(r_u->grp_rids[i])); + } + + return True; +} + +/******************************************************************* +frees a structure. +********************************************************************/ +void creds_free_nt_sec(CREDS_NT_SEC *r_u) +{ + if (r_u->grp_rids != NULL) + { + free(r_u->grp_rids); + r_u->grp_rids = NULL; + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL creds_io_pwd_info(char *desc, struct pwd_info *pwd, prs_struct *ps, int depth) +{ + if (pwd == NULL) return False; + + prs_debug(ps, depth, desc, "creds_io_pwd_info"); + depth++; + + prs_align(ps); + + prs_uint32("nullpwd", ps, depth, &(pwd->null_pwd)); + if (pwd->null_pwd) + { + return True; + } + + prs_uint32("cleartext", ps, depth, &(pwd->cleartext)); + if (pwd->cleartext) + { + prs_string("password", ps, depth, pwd->password, strlen(pwd->password), sizeof(pwd->password)); + prs_align(ps); + return True; + } + prs_uint32("crypted", ps, depth, &(pwd->crypted)); + + prs_uint8s(False, "smb_lm_pwd", ps, depth, (char*)&pwd->smb_lm_pwd, sizeof(pwd->smb_lm_pwd)); + prs_align(ps); + prs_uint8s(False, "smb_nt_pwd", ps, depth, (char*)&pwd->smb_nt_pwd, sizeof(pwd->smb_nt_pwd)); + prs_align(ps); + + prs_uint8s(False, "smb_lm_owf", ps, depth, (char*)&pwd->smb_lm_owf, sizeof(pwd->smb_lm_owf)); + prs_align(ps); + prs_uint32("nt_owf_len", ps, depth, &(pwd->nt_owf_len)); + if (pwd->nt_owf_len > sizeof(pwd->smb_nt_owf)) + { + return False; + } + prs_uint8s(False, "smb_nt_owf", ps, depth, (char*)&pwd->smb_nt_owf, pwd->nt_owf_len); + prs_align(ps); + + prs_uint8s(False, "lm_cli_chal", ps, depth, (char*)&pwd->lm_cli_chal, sizeof(pwd->lm_cli_chal)); + prs_align(ps); + prs_uint32("nt_cli_chal_len", ps, depth, &(pwd->nt_cli_chal_len)); + + if (pwd->nt_cli_chal_len > sizeof(pwd->nt_cli_chal)) + { + return False; + } + prs_uint8s(False, "nt_cli_chal", ps, depth, (char*)&pwd->nt_cli_chal, pwd->nt_cli_chal_len); + prs_align(ps); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL creds_io_nt(char *desc, CREDS_NT *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "creds_io_nt"); + depth++; + + prs_align(ps); + + /* lkclXXXX CHEAT!!!!!!!! */ + prs_string("user_name", ps, depth, r_u->user_name, strlen(r_u->user_name), sizeof(r_u->user_name)); + prs_align(ps); + prs_string("domain", ps, depth, r_u->domain, strlen(r_u->domain), sizeof(r_u->domain)); + prs_align(ps); + + creds_io_pwd_info("pwd", &r_u->pwd, ps, depth); + prs_align(ps); + + prs_uint32("ntlmssp", ps, depth, &(r_u->ntlmssp_flags)); + + return True; +} + +/******************************************************************* +frees a structure. +********************************************************************/ +void creds_free_nt(CREDS_NT *r_u) +{ +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL creds_io_hybrid(char *desc, CREDS_HYBRID *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "creds_io_hybrid"); + depth++; + + prs_align(ps); + + prs_uint32("reuse", ps, depth, &(r_u->reuse)); + prs_uint32("ptr_ntc", ps, depth, &(r_u->ptr_ntc)); + prs_uint32("ptr_uxc", ps, depth, &(r_u->ptr_uxc)); + prs_uint32("ptr_nts", ps, depth, &(r_u->ptr_nts)); + prs_uint32("ptr_uxs", ps, depth, &(r_u->ptr_uxs)); + if (r_u->ptr_ntc != 0) + { + if (!creds_io_nt ("ntc", &r_u->ntc, ps, depth)) return False; + } + if (r_u->ptr_uxc != 0) + { + if (!creds_io_unix("uxc", &r_u->uxc, ps, depth)) return False; + } + if (r_u->ptr_nts != 0) + { + if (!creds_io_nt_sec ("nts", &r_u->nts, ps, depth)) return False; + } + if (r_u->ptr_uxs != 0) + { + if (!creds_io_unix_sec("uxs", &r_u->uxs, ps, depth)) return False; + } + return True; +} + +void copy_unix_creds(CREDS_UNIX *to, const CREDS_UNIX *from) +{ + if (from == NULL) + { + to->user_name[0] = 0; + return; + } + fstrcpy(to->user_name, from->user_name); +}; + +void copy_nt_sec_creds(CREDS_NT_SEC *to, const CREDS_NT_SEC *from) +{ + if (from == NULL) + { + ZERO_STRUCTP(to); + return; + } + sid_copy(&to->sid, &from->sid); + to->num_grps = 0; + to->grp_rids = NULL; + + if (from->num_grps != 0) + { + size_t size = from->num_grps * sizeof(from->grp_rids[0]); + to->grp_rids = (uint32*)malloc(size); + if (to->grp_rids == NULL) + { + return; + } + to->num_grps = from->num_grps; + memcpy(to->grp_rids, from->grp_rids, size); + } +}; + +void copy_unix_sec_creds(CREDS_UNIX_SEC *to, const CREDS_UNIX_SEC *from) +{ + if (from == NULL) + { + to->uid = -1; + to->gid = -1; + to->num_grps = 0; + to->grps = NULL; + return; + } + to->uid = from->uid; + to->gid = from->gid; + to->num_grps = 0; + to->grps = NULL; + + if (from->num_grps != 0) + { + size_t size = from->num_grps * sizeof(from->grps[0]); + to->grps = (uint32*)malloc(size); + if (to->grps == NULL) + { + return; + } + to->num_grps = from->num_grps; + memcpy(to->grps, from->grps, size); + } +}; + +void copy_nt_creds(struct ntuser_creds *to, + const struct ntuser_creds *from) +{ + if (from == NULL) + { + DEBUG(10,("copy_nt_creds: null creds\n")); + to->domain[0] = 0; + to->user_name[0] = 0; + pwd_set_nullpwd(&to->pwd); + to->ntlmssp_flags = 0; + + return; + } + safe_strcpy(to->domain , from->domain , sizeof(from->domain )-1); + safe_strcpy(to->user_name, from->user_name, sizeof(from->user_name)-1); + memcpy(&to->pwd, &from->pwd, sizeof(from->pwd)); + to->ntlmssp_flags = from->ntlmssp_flags; +}; + +void copy_user_creds(struct user_creds *to, + const struct user_creds *from) +{ + ZERO_STRUCTP(to); + if (from == NULL) + { + to->ptr_ntc = 0; + to->ptr_uxc = 0; + to->ptr_nts = 0; + to->ptr_uxs = 0; + copy_nt_creds(&to->ntc, NULL); + copy_unix_creds(&to->uxc, NULL); + copy_nt_sec_creds(&to->nts, NULL); + copy_unix_sec_creds(&to->uxs, NULL); + to->reuse = False; + return; + } + to->ptr_nts = from->ptr_nts; + to->ptr_uxs = from->ptr_uxs; + to->ptr_ntc = from->ptr_ntc; + to->ptr_uxc = from->ptr_uxc; + if (to->ptr_ntc != 0) + { + copy_nt_creds(&to->ntc, &from->ntc); + } + if (to->ptr_uxc != 0) + { + copy_unix_creds(&to->uxc, &from->uxc); + } + if (to->ptr_nts != 0) + { + copy_nt_sec_creds(&to->nts, &from->nts); + } + if (to->ptr_uxs != 0) + { + copy_unix_sec_creds(&to->uxs, &from->uxs); + } + to->reuse = from->reuse; +}; + +void free_user_creds(struct user_creds *creds) +{ + creds_free_unix(&creds->uxc); + creds_free_nt (&creds->ntc); + creds_free_unix_sec(&creds->uxs); + creds_free_nt_sec (&creds->nts); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL creds_io_cmd(char *desc, CREDS_CMD *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "creds_io_cmd"); + depth++; + + prs_align(ps); + + prs_uint16("version", ps, depth, &(r_u->version)); + prs_uint16("command", ps, depth, &(r_u->command)); + + prs_string("name ", ps, depth, r_u->name, strlen(r_u->name), sizeof(r_u->name)); + prs_align(ps); + + prs_uint32("ptr_creds", ps, depth, &(r_u->ptr_creds)); + if (r_u->ptr_creds != 0) + { + if (!creds_io_hybrid("creds", r_u->cred, ps, depth)) + { + return False; + } + } + + + return True; +} + + +BOOL create_ntuser_creds( prs_struct *ps, + const char* name, + uint16 version, uint16 command, + const struct ntuser_creds *ntu, + BOOL reuse) +{ + CREDS_CMD cmd; + struct user_creds usr; + + ZERO_STRUCT(cmd); + ZERO_STRUCT(usr); + + DEBUG(10,("create_user_creds: %s %d %d\n", + name, version, command)); + + usr.reuse = reuse; + + fstrcpy(cmd.name, name); + cmd.version = version; + cmd.command = command; + cmd.ptr_creds = ntu != NULL ? 1 : 0; + cmd.cred = &usr; + + if (ntu != NULL) + { + copy_nt_creds(&usr.ntc, ntu); + usr.ptr_ntc = 1; + } + else + { + usr.ptr_ntc = 0; + } + + prs_init(ps, 1024, 4, False); + + ps->data_offset = 4; + return creds_io_cmd("creds", &cmd, ps, 0); +} + +BOOL create_user_creds( prs_struct *ps, + const char* name, + uint16 version, uint16 command, + const struct user_creds *usr) +{ + CREDS_CMD cmd; + + ZERO_STRUCT(cmd); + + DEBUG(10,("create_user_creds: %s %d %d\n", + name, version, command)); + + fstrcpy(cmd.name, name); + cmd.version = version; + cmd.command = command; + cmd.ptr_creds = usr != NULL ? 1 : 0; + cmd.cred = usr; + + prs_init(ps, 1024, 4, False); + + ps->data_offset = 4; + return creds_io_cmd("creds", &cmd, ps, 0); +} diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index f5f4eb67b8..6bb07c5f64 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -64,6 +64,30 @@ BOOL prs_init(prs_struct *ps, uint32 size, uint8 align, BOOL io) return True; } +/******************************************************************* + read from a socket into memory. + ********************************************************************/ +BOOL prs_read(prs_struct *ps, int fd, size_t len, int timeout) +{ + BOOL ok; + size_t prev_size = ps->buffer_size; + if (!prs_grow(ps, len)) + { + return False; + } + + if (timeout > 0) + { + ok = (read_with_timeout(fd, &ps->data_p[prev_size], + len, len,timeout) == len); + } + else + { + ok = (read_data(fd, &ps->data_p[prev_size], len) == len); + } + return ok; +} + /******************************************************************* Delete the memory in a parse structure - if we own it. ********************************************************************/ -- cgit From 8433aa437990357a327dbed19afc8033a1ed9be4 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 11 Jan 2000 02:00:31 +0000 Subject: modified smbd/msrpc credential transfer system. user session key is *missing* from samba cvs main, therefore it is set to all zeros. this will cause, amongst other things, administrator-changing-user-passwords, and setting up new accounts, to fail, as the user's password can only be decoded with the session key (in this case, the administrator's usr sess key). it's never a perfect world, is it? (This used to be commit 3362fcdfa492cfd1d9d4ec35ef2108192302b984) --- source3/rpc_parse/parse_creds.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c index 74dac2f011..54c9c48cba 100644 --- a/source3/rpc_parse/parse_creds.c +++ b/source3/rpc_parse/parse_creds.c @@ -334,6 +334,7 @@ BOOL creds_io_hybrid(char *desc, CREDS_HYBRID *r_u, prs_struct *ps, int depth) prs_uint32("ptr_uxc", ps, depth, &(r_u->ptr_uxc)); prs_uint32("ptr_nts", ps, depth, &(r_u->ptr_nts)); prs_uint32("ptr_uxs", ps, depth, &(r_u->ptr_uxs)); + prs_uint32("ptr_ssk", ps, depth, &(r_u->ptr_ssk)); if (r_u->ptr_ntc != 0) { if (!creds_io_nt ("ntc", &r_u->ntc, ps, depth)) return False; @@ -350,6 +351,14 @@ BOOL creds_io_hybrid(char *desc, CREDS_HYBRID *r_u, prs_struct *ps, int depth) { if (!creds_io_unix_sec("uxs", &r_u->uxs, ps, depth)) return False; } + if (r_u->ptr_ssk != 0) + { + prs_uint8s(False, "usr_sess_key", ps, depth, (char*)&r_u->usr_sess_key, sizeof(r_u->usr_sess_key)); + } + else + { + memset(r_u->usr_sess_key, 0, sizeof(r_u->usr_sess_key)); + } return True; } @@ -432,6 +441,9 @@ void copy_nt_creds(struct ntuser_creds *to, safe_strcpy(to->user_name, from->user_name, sizeof(from->user_name)-1); memcpy(&to->pwd, &from->pwd, sizeof(from->pwd)); to->ntlmssp_flags = from->ntlmssp_flags; + DEBUG(10,("copy_nt_creds: user %s domain %s flgs: %x\n", + to->user_name, to->domain, + to->ntlmssp_flags)); }; void copy_user_creds(struct user_creds *to, @@ -444,6 +456,7 @@ void copy_user_creds(struct user_creds *to, to->ptr_uxc = 0; to->ptr_nts = 0; to->ptr_uxs = 0; + to->ptr_ssk = 0; copy_nt_creds(&to->ntc, NULL); copy_unix_creds(&to->uxc, NULL); copy_nt_sec_creds(&to->nts, NULL); @@ -455,6 +468,7 @@ void copy_user_creds(struct user_creds *to, to->ptr_uxs = from->ptr_uxs; to->ptr_ntc = from->ptr_ntc; to->ptr_uxc = from->ptr_uxc; + to->ptr_ssk = from->ptr_ssk; if (to->ptr_ntc != 0) { copy_nt_creds(&to->ntc, &from->ntc); @@ -471,6 +485,11 @@ void copy_user_creds(struct user_creds *to, { copy_unix_sec_creds(&to->uxs, &from->uxs); } + if (to->ptr_ssk != 0) + { + memcpy(to->usr_sess_key, from->usr_sess_key, + sizeof(to->usr_sess_key)); + } to->reuse = from->reuse; }; -- cgit From 012be9ee7343f2bc46590783788f38e95ed8ef14 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 14 Jan 2000 19:34:57 +0000 Subject: Added HP change. Jeremy. (This used to be commit 4914d2f161b6a82789f3a9decccb636fb21264c5) --- source3/rpc_parse/parse_reg.c | 107 +++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 53 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 23262279a4..cc970e4150 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -5,6 +5,7 @@ * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997. + * Copyright (C) Hewlett-Packard Company 1999. * * 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 @@ -52,9 +53,9 @@ BOOL reg_io_q_open_hklm(char *desc, REG_Q_OPEN_HKLM *r_q, prs_struct *ps, int d prs_debug(ps, depth, desc, "reg_io_q_open_hklm"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; - + if(!prs_uint32("ptr ", ps, depth, &r_q->ptr)) return False; @@ -83,7 +84,7 @@ BOOL reg_io_r_open_hklm(char *desc, REG_R_OPEN_HKLM *r_r, prs_struct *ps, int d prs_debug(ps, depth, desc, "reg_io_r_open_hklm"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &r_r->pol, ps, depth)) @@ -117,7 +118,7 @@ BOOL reg_io_q_flush_key(char *desc, REG_Q_FLUSH_KEY *r_q, prs_struct *ps, int d prs_debug(ps, depth, desc, "reg_io_q_flush_key"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) @@ -138,7 +139,7 @@ BOOL reg_io_r_flush_key(char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, int d prs_debug(ps, depth, desc, "reg_io_r_flush_key"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("status", ps, depth, &r_r->status)) @@ -177,7 +178,7 @@ static BOOL reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, SEC_DES if(!prs_set_offset(ps, old_offset + data->len + sizeof(uint32) * ((ptr3 != NULL) ? 5 : 3))) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; } @@ -230,7 +231,7 @@ BOOL reg_io_q_create_key(char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int prs_debug(ps, depth, desc, "reg_io_q_create_key"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &r_q->pnt_pol, ps, depth)) @@ -240,14 +241,14 @@ BOOL reg_io_q_create_key(char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int return False; if(!smb_io_unistr2("", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_unihdr ("", &r_q->hdr_class, ps, depth)) return False; if(!smb_io_unistr2("", &r_q->uni_class, r_q->hdr_class.buffer, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("reserved", ps, depth, &r_q->reserved)) @@ -286,7 +287,7 @@ BOOL reg_io_r_create_key(char *desc, REG_R_CREATE_KEY *r_r, prs_struct *ps, int prs_debug(ps, depth, desc, "reg_io_r_create_key"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &r_r->key_pol, ps, depth)) @@ -329,7 +330,7 @@ BOOL reg_io_q_delete_val(char *desc, REG_Q_DELETE_VALUE *r_q, prs_struct *ps, i prs_debug(ps, depth, desc, "reg_io_q_delete_val"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &r_q->pnt_pol, ps, depth)) @@ -339,7 +340,7 @@ BOOL reg_io_q_delete_val(char *desc, REG_Q_DELETE_VALUE *r_q, prs_struct *ps, i return False; if(!smb_io_unistr2("", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; return True; @@ -358,7 +359,7 @@ BOOL reg_io_r_delete_val(char *desc, REG_R_DELETE_VALUE *r_r, prs_struct *ps, i prs_debug(ps, depth, desc, "reg_io_r_delete_val"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("status", ps, depth, &r_r->status)) @@ -395,7 +396,7 @@ BOOL reg_io_q_delete_key(char *desc, REG_Q_DELETE_KEY *r_q, prs_struct *ps, int prs_debug(ps, depth, desc, "reg_io_q_delete_key"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &r_q->pnt_pol, ps, depth)) @@ -405,7 +406,7 @@ BOOL reg_io_q_delete_key(char *desc, REG_Q_DELETE_KEY *r_q, prs_struct *ps, int return False; if(!smb_io_unistr2("", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; return True; @@ -423,7 +424,7 @@ BOOL reg_io_r_delete_key(char *desc, REG_R_DELETE_KEY *r_r, prs_struct *ps, int prs_debug(ps, depth, desc, "reg_io_r_delete_key"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("status", ps, depth, &r_r->status)) @@ -458,7 +459,7 @@ BOOL reg_io_q_query_key(char *desc, REG_Q_QUERY_KEY *r_q, prs_struct *ps, int d prs_debug(ps, depth, desc, "reg_io_q_query_key"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) @@ -468,7 +469,7 @@ BOOL reg_io_q_query_key(char *desc, REG_Q_QUERY_KEY *r_q, prs_struct *ps, int d if(!smb_io_unistr2("", &r_q->uni_class, r_q->hdr_class.buffer, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; return True; @@ -487,7 +488,7 @@ BOOL reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int d prs_debug(ps, depth, desc, "reg_io_r_query_key"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_unihdr ("", &r_r->hdr_class, ps, depth)) @@ -495,7 +496,7 @@ BOOL reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int d if(!smb_io_unistr2("", &r_r->uni_class, r_r->hdr_class.buffer, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("num_subkeys ", ps, depth, &r_r->num_subkeys)) @@ -542,7 +543,7 @@ BOOL reg_io_q_unk_1a(char *desc, REG_Q_UNK_1A *r_q, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "reg_io_q_unk_1a"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) @@ -563,7 +564,7 @@ BOOL reg_io_r_unk_1a(char *desc, REG_R_UNK_1A *r_r, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "reg_io_r_unk_1a"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("unknown", ps, depth, &r_r->unknown)) @@ -599,7 +600,7 @@ BOOL reg_io_q_open_hku(char *desc, REG_Q_OPEN_HKU *r_q, prs_struct *ps, int dep prs_debug(ps, depth, desc, "reg_io_q_open_hku"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("ptr ", ps, depth, &r_q->ptr)) @@ -628,7 +629,7 @@ BOOL reg_io_r_open_hku(char *desc, REG_R_OPEN_HKU *r_r, prs_struct *ps, int dep prs_debug(ps, depth, desc, "reg_io_r_open_hku"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &r_r->pol, ps, depth)) @@ -663,12 +664,12 @@ BOOL reg_io_q_close(char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "reg_io_q_unknown_1"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; return True; @@ -686,12 +687,12 @@ BOOL reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "reg_io_r_unknown_1"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &r_u->pol, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("status", ps, depth, &r_u->status)) @@ -727,7 +728,7 @@ BOOL reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, i prs_debug(ps, depth, desc, "reg_io_q_set_key_sec"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) @@ -756,7 +757,7 @@ BOOL reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, in prs_debug(ps, depth, desc, "reg_io_r_set_key_sec"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("status", ps, depth, &r_q->status)) @@ -797,7 +798,7 @@ BOOL reg_io_q_get_key_sec(char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, i prs_debug(ps, depth, desc, "reg_io_q_get_key_sec"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) @@ -842,7 +843,7 @@ BOOL reg_io_r_get_key_sec(char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, i prs_debug(ps, depth, desc, "reg_io_r_get_key_sec"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("ptr ", ps, depth, &r_q->ptr)) @@ -853,7 +854,7 @@ BOOL reg_io_r_get_key_sec(char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, i return False; if(!sec_io_desc_buf("", &r_q->data, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; } @@ -904,7 +905,7 @@ BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "reg_io_q_info"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) @@ -914,7 +915,7 @@ BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) if(!smb_io_unistr2("", &r_q->uni_type, r_q->hdr_type.buffer, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("ptr1", ps, depth, &r_q->ptr1)) @@ -993,7 +994,7 @@ BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "reg_io_r_info"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("ptr1", ps, depth, &r_r->ptr1)) @@ -1007,7 +1008,7 @@ BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) if(!smb_io_buffer2("uni_type", &r_r->uni_type, r_r->ptr_type, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("ptr2", ps, depth, &r_r->ptr2)) @@ -1074,7 +1075,7 @@ BOOL reg_io_q_enum_val(char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int d prs_debug(ps, depth, desc, "reg_io_q_enum_val"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &q_q->pol, ps, depth)) @@ -1086,7 +1087,7 @@ BOOL reg_io_q_enum_val(char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int d return False; if(!smb_io_unistr2("uni_name", &q_q->uni_name, q_q->hdr_name.buffer, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("ptr_type", ps, depth, &q_q->ptr_type)) @@ -1101,7 +1102,7 @@ BOOL reg_io_q_enum_val(char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int d return False; if(!smb_io_buffer2("buf_value", &q_q->buf_value, q_q->ptr_value, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("ptr1", ps, depth, &q_q->ptr1)) @@ -1132,14 +1133,14 @@ BOOL reg_io_r_enum_val(char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, int d prs_debug(ps, depth, desc, "reg_io_r_enum_val"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_unihdr ("hdr_name", &r_q->hdr_name, ps, depth)) return False; if(!smb_io_unistr2("uni_name", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("ptr_type", ps, depth, &r_q->ptr_type)) @@ -1154,7 +1155,7 @@ BOOL reg_io_r_enum_val(char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, int d return False; if(!smb_io_buffer2("buf_value", r_q->buf_value, r_q->ptr_value, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("ptr1", ps, depth, &r_q->ptr1)) @@ -1210,7 +1211,7 @@ BOOL reg_io_q_create_val(char *desc, REG_Q_CREATE_VALUE *q_q, prs_struct *ps, i prs_debug(ps, depth, desc, "reg_io_q_create_val"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &q_q->pol, ps, depth)) @@ -1220,14 +1221,14 @@ BOOL reg_io_q_create_val(char *desc, REG_Q_CREATE_VALUE *q_q, prs_struct *ps, i return False; if(!smb_io_unistr2("uni_name", &q_q->uni_name, q_q->hdr_name.buffer, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("type", ps, depth, &q_q->type)) return False; if(!smb_io_buffer3("buf_value", q_q->buf_value, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; return True; @@ -1245,7 +1246,7 @@ BOOL reg_io_r_create_val(char *desc, REG_R_CREATE_VALUE *r_q, prs_struct *ps, i prs_debug(ps, depth, desc, "reg_io_r_create_val"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("status", ps, depth, &r_q->status)) @@ -1289,7 +1290,7 @@ BOOL reg_io_q_enum_key(char *desc, REG_Q_ENUM_KEY *q_q, prs_struct *ps, int dep prs_debug(ps, depth, desc, "reg_io_q_enum_key"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &q_q->pol, ps, depth)) @@ -1343,7 +1344,7 @@ BOOL reg_io_r_enum_key(char *desc, REG_R_ENUM_KEY *r_q, prs_struct *ps, int dep prs_debug(ps, depth, desc, "reg_io_r_enum_key"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint16("key_name_len", ps, depth, &r_q->key_name_len)) @@ -1361,7 +1362,7 @@ BOOL reg_io_r_enum_key(char *desc, REG_R_ENUM_KEY *r_q, prs_struct *ps, int dep return False; if(!smb_io_unistr3("key_name", &r_q->key_name, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; } @@ -1417,7 +1418,7 @@ BOOL reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int prs_debug(ps, depth, desc, "reg_io_q_entry"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) @@ -1427,7 +1428,7 @@ BOOL reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int if(!smb_io_unistr2("", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth)) return False; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!prs_uint32("unknown_0", ps, depth, &r_q->unknown_0)) @@ -1461,7 +1462,7 @@ BOOL reg_io_r_open_entry(char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int prs_debug(ps, depth, desc, "reg_io_r_open_entry"); depth++; - if(prs_align(ps)) + if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("", &r_r->pol, ps, depth)) -- cgit From 34edb1b47eac98674e79297bd7219cbaa8368bcf Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 17 Jan 2000 23:01:23 +0000 Subject: SAMR_R_UNKNOWN_38 is 3 uint16 params (4-byte aligned) followed by status code. (This used to be commit 55035b8984c135ddd2c4e3be18caf8833975841d) --- source3/rpc_parse/parse_samr.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index effe329376..2327ee7798 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3400,7 +3400,8 @@ void init_samr_r_unknown_38(SAMR_R_UNKNOWN_38 *r_u) r_u->unk_0 = 0; r_u->unk_1 = 0; r_u->unk_2 = 0; - r_u->unk_3 = 0; + + r_u->status = 0x0; } /******************************************************************* @@ -3430,9 +3431,7 @@ BOOL samr_io_r_unknown_38(char *desc, SAMR_R_UNKNOWN_38 *r_u, prs_struct *ps, i return False; if(!prs_align(ps)) return False; - if(!prs_uint16("unk_3", ps, depth, &r_u->unk_3)) - return False; - if(!prs_align(ps)) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; -- cgit From d91bfabc5df7226cc1b0da231e18fd16c8807a25 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 21 Jan 2000 02:33:21 +0000 Subject: made cvs main up-to-date with samba_tng, with addition of process id to msrpc loop-back interface. (This used to be commit adbf97c0a93149e17496b002ecc8ecdb3f360ed5) --- source3/rpc_parse/parse_creds.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c index 54c9c48cba..ba45fa163a 100644 --- a/source3/rpc_parse/parse_creds.c +++ b/source3/rpc_parse/parse_creds.c @@ -330,6 +330,7 @@ BOOL creds_io_hybrid(char *desc, CREDS_HYBRID *r_u, prs_struct *ps, int depth) prs_align(ps); prs_uint32("reuse", ps, depth, &(r_u->reuse)); + prs_uint32("ptr_ntc", ps, depth, &(r_u->ptr_ntc)); prs_uint32("ptr_uxc", ps, depth, &(r_u->ptr_uxc)); prs_uint32("ptr_nts", ps, depth, &(r_u->ptr_nts)); @@ -464,11 +465,15 @@ void copy_user_creds(struct user_creds *to, to->reuse = False; return; } + + to->reuse = from->reuse; + to->ptr_nts = from->ptr_nts; to->ptr_uxs = from->ptr_uxs; to->ptr_ntc = from->ptr_ntc; to->ptr_uxc = from->ptr_uxc; to->ptr_ssk = from->ptr_ssk; + if (to->ptr_ntc != 0) { copy_nt_creds(&to->ntc, &from->ntc); @@ -490,7 +495,6 @@ void copy_user_creds(struct user_creds *to, memcpy(to->usr_sess_key, from->usr_sess_key, sizeof(to->usr_sess_key)); } - to->reuse = from->reuse; }; void free_user_creds(struct user_creds *creds) @@ -515,6 +519,7 @@ BOOL creds_io_cmd(char *desc, CREDS_CMD *r_u, prs_struct *ps, int depth) prs_uint16("version", ps, depth, &(r_u->version)); prs_uint16("command", ps, depth, &(r_u->command)); + prs_uint32("pid ", ps, depth, &(r_u->pid )); prs_string("name ", ps, depth, r_u->name, strlen(r_u->name), sizeof(r_u->name)); prs_align(ps); @@ -536,6 +541,7 @@ BOOL creds_io_cmd(char *desc, CREDS_CMD *r_u, prs_struct *ps, int depth) BOOL create_ntuser_creds( prs_struct *ps, const char* name, uint16 version, uint16 command, + uint32 pid, const struct ntuser_creds *ntu, BOOL reuse) { @@ -553,6 +559,7 @@ BOOL create_ntuser_creds( prs_struct *ps, fstrcpy(cmd.name, name); cmd.version = version; cmd.command = command; + cmd.pid = pid ; cmd.ptr_creds = ntu != NULL ? 1 : 0; cmd.cred = &usr; @@ -575,6 +582,7 @@ BOOL create_ntuser_creds( prs_struct *ps, BOOL create_user_creds( prs_struct *ps, const char* name, uint16 version, uint16 command, + uint32 pid, const struct user_creds *usr) { CREDS_CMD cmd; @@ -587,6 +595,7 @@ BOOL create_user_creds( prs_struct *ps, fstrcpy(cmd.name, name); cmd.version = version; cmd.command = command; + cmd.pid = pid ; cmd.ptr_creds = usr != NULL ? 1 : 0; cmd.cred = usr; -- cgit From 6a6749d81e892bb06bfdc0fefdc428e5e6599f71 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 7 Feb 2000 16:17:59 +0000 Subject: First commit of the spoolss code to the HEAD branch. still needs a lot of cleaning/debuging. J.F. (This used to be commit bd9d4cdde9193c120c6f4e8cf72f87cd67a9387e) --- source3/rpc_parse/parse_spoolss.c | 4806 +++++++++++++++++++++++++++++++++++++ 1 file changed, 4806 insertions(+) create mode 100644 source3/rpc_parse/parse_spoolss.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c new file mode 100644 index 0000000000..a6f72a3181 --- /dev/null +++ b/source3/rpc_parse/parse_spoolss.c @@ -0,0 +1,4806 @@ +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-2000, + * Copyright (C) Luke Kenneth Casson Leighton 1996-2000, + * Copyright (C) Jean Franois Micouleau 1998-2000. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include "includes.h" +#include "nterr.h" + +extern int DEBUGLEVEL; +/******************************************************************* +return the length of a UNISTR string. +********************************************************************/ +static uint32 str_len_uni(UNISTR *source) +{ + uint32 i=0; + + while (source->buffer[i]!=0x0000) + { + i++; + } + return i; +} + +/******************************************************************* +This should be moved in a more generic lib. +********************************************************************/ +static BOOL spoolss_io_system_time(char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) +{ + prs_uint16("year", ps, depth, &(systime->year)); + prs_uint16("month", ps, depth, &(systime->month)); + prs_uint16("dayofweek", ps, depth, &(systime->dayofweek)); + prs_uint16("day", ps, depth, &(systime->day)); + prs_uint16("hour", ps, depth, &(systime->hour)); + prs_uint16("minute", ps, depth, &(systime->minute)); + prs_uint16("second", ps, depth, &(systime->second)); + prs_uint16("milliseconds", ps, depth, &(systime->milliseconds)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL make_systemtime(SYSTEMTIME *systime, struct tm *unixtime) +{ + systime->year=unixtime->tm_year+1900; + systime->month=unixtime->tm_mon+1; + systime->dayofweek=unixtime->tm_wday; + systime->day=unixtime->tm_mday; + systime->hour=unixtime->tm_hour; + systime->minute=unixtime->tm_min; + systime->second=unixtime->tm_sec; + systime->milliseconds=0; + + return True; +} + +/******************************************************************* +reads or writes an POLICY_HND structure. +********************************************************************/ +static BOOL smb_io_prt_hnd(char *desc, POLICY_HND *hnd, prs_struct *ps, int depth) +{ + if (hnd == NULL) return False; + + prs_debug(ps, depth, desc, "smb_io_prt_hnd"); + depth++; + + prs_align(ps); + + prs_uint8s (False, "data", ps, depth, hnd->data, POLICY_HND_SIZE); + + return True; +} + +/******************************************************************* +reads or writes an DOC_INFO structure. +********************************************************************/ +static BOOL smb_io_doc_info_1(char *desc, DOC_INFO_1 *info_1, prs_struct *ps, int depth) +{ + if (info_1 == NULL) return False; + + prs_debug(ps, depth, desc, "smb_io_doc_info_1"); + depth++; + + prs_align(ps); + + prs_uint32("p_docname", ps, depth, &(info_1->p_docname)); + prs_uint32("p_outputfile", ps, depth, &(info_1->p_outputfile)); + prs_uint32("p_datatype", ps, depth, &(info_1->p_datatype)); + + smb_io_unistr2("", &(info_1->docname), info_1->p_docname, ps, depth); + smb_io_unistr2("", &(info_1->outputfile), info_1->p_outputfile, ps, depth); + smb_io_unistr2("", &(info_1->datatype), info_1->p_datatype, ps, depth); + + return True; +} + +/******************************************************************* +reads or writes an DOC_INFO structure. +********************************************************************/ +static BOOL smb_io_doc_info(char *desc, DOC_INFO *info, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0; + + if (info == NULL) return False; + + prs_debug(ps, depth, desc, "smb_io_doc_info"); + depth++; + + prs_align(ps); + + prs_uint32("switch_value", ps, depth, &(info->switch_value)); + + prs_uint32("doc_info_X ptr", ps, depth, &(useless_ptr)); + + switch (info->switch_value) + { + case 1: + smb_io_doc_info_1("",&(info->doc_info_1), ps, depth); + break; + case 2: + /* + this is just a placeholder + + MSDN July 1998 says doc_info_2 is only on + Windows 95, and as Win95 doesn't do RPC to print + this case is nearly impossible + + Maybe one day with Windows for dishwasher 2037 ... + + */ + /* smb_io_doc_info_2("",&(info->doc_info_2), ps, depth); */ + break; + default: + DEBUG(0,("Something is obviously wrong somewhere !\n")); + break; + } + + return True; +} + +/******************************************************************* +reads or writes an DOC_INFO_CONTAINER structure. +********************************************************************/ +static BOOL smb_io_doc_info_container(char *desc, DOC_INFO_CONTAINER *cont, prs_struct *ps, int depth) +{ + if (cont == NULL) return False; + + prs_debug(ps, depth, desc, "smb_io_doc_info_container"); + depth++; + + prs_align(ps); + + prs_uint32("level", ps, depth, &(cont->level)); + + smb_io_doc_info("",&(cont->docinfo), ps, depth); + + return True; +} + +/******************************************************************* +reads or writes an NOTIFY OPTION TYPE structure. +********************************************************************/ +static BOOL smb_io_notify_option_type(char *desc, + SPOOL_NOTIFY_OPTION_TYPE *type, + prs_struct *ps, int depth) +{ + uint32 useless_ptr; + + prs_debug(ps, depth, desc, "smb_io_notify_option_type"); + depth++; + + prs_align(ps); + + prs_uint16("type", ps, depth, &(type->type)); + prs_uint16("reserved0", ps, depth, &(type->reserved0)); + prs_uint32("reserved1", ps, depth, &(type->reserved1)); + prs_uint32("reserved2", ps, depth, &(type->reserved2)); + prs_uint32("count", ps, depth, &(type->count)); + prs_uint32("useless ptr", ps, depth, &useless_ptr); + + + return True; +} + +/******************************************************************* +reads or writes an NOTIFY OPTION TYPE DATA. +********************************************************************/ +static BOOL smb_io_notify_option_type_data(char *desc, + SPOOL_NOTIFY_OPTION_TYPE *type, + prs_struct *ps, int depth) +{ + uint32 count; + int i; + + prs_debug(ps, depth, desc, "smb_io_notify_option_type_data"); + depth++; + + prs_align(ps); + + prs_uint32("count", ps, depth, &count); + + if (count != type->count) + { + DEBUG(4,("What a mess, count was %x now is %x !\n",type->count,count)); + type->count=count; + } + for(i=0;ifields[i])); + } + + return True; +} + +/******************************************************************* +reads or writes an NOTIFY OPTION structure. +********************************************************************/ +static BOOL smb_io_notify_option(char *desc, SPOOL_NOTIFY_OPTION *option, + prs_struct *ps, int depth) +{ + uint32 useless_ptr; + int i; + + prs_debug(ps, depth, desc, "smb_io_notify_option"); + depth++; + + prs_align(ps); + + /* memory pointer to the struct */ + prs_uint32("useless ptr", ps, depth, &useless_ptr); + + prs_uint32("version", ps, depth, &(option->version)); + prs_uint32("reserved", ps, depth, &(option->reserved)); + prs_uint32("count", ps, depth, &(option->count)); + prs_uint32("useless ptr", ps, depth, &useless_ptr); + prs_uint32("count", ps, depth, &(option->count)); + + /* read the option type struct */ + for(i=0;icount;i++) + { + smb_io_notify_option_type("",&(option->type[i]) ,ps, depth); + } + + /* now read the type associated with the option type struct */ + for(i=0;icount;i++) + { + smb_io_notify_option_type_data("",&(option->type[i]) ,ps, depth); + } + + + return True; +} + + +/******************************************************************* +reads or writes an NOTIFY INFO DATA structure. +********************************************************************/ +static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, + prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + + uint32 how_many_words; + BOOL isvalue; + uint32 x; + + prs_debug(ps, depth, desc, "smb_io_notify_info_data"); + depth++; + + how_many_words=data->size; + if (how_many_words==POINTER) + { + how_many_words=TWO_VALUE; + } + + isvalue=data->enc_type; + + prs_align(ps); + prs_uint16("type", ps, depth, &(data->type)); + prs_uint16("field", ps, depth, &(data->field)); + /*prs_align(ps);*/ + + prs_uint32("how many words", ps, depth, &how_many_words); + prs_uint32("id", ps, depth, &(data->id)); + prs_uint32("how many words", ps, depth, &how_many_words); + /*prs_align(ps);*/ + + if (isvalue==True) + { + prs_uint32("value[0]", ps, depth, &(data->notify_data.value[0])); + prs_uint32("value[1]", ps, depth, &(data->notify_data.value[1])); + /*prs_align(ps);*/ + } + else + { + /* it's a string */ + /* length in ascii including \0 */ + x=2*(data->notify_data.data.length+1); + prs_uint32("string length", ps, depth, &x ); + prs_uint32("pointer", ps, depth, &useless_ptr); + /*prs_align(ps);*/ + } + + return True; +} + +/******************************************************************* +reads or writes an NOTIFY INFO DATA structure. +********************************************************************/ +BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, + prs_struct *ps, int depth) +{ + uint32 x; + BOOL isvalue; + + prs_debug(ps, depth, desc, "smb_io_notify_info_data"); + depth++; + + prs_align(ps); + isvalue=data->enc_type; + + if (isvalue==False) + { + /* length of string in unicode include \0 */ + x=data->notify_data.data.length+1; + prs_uint32("string length", ps, depth, &x ); + prs_uint16s(True,"string",ps,depth,data->notify_data.data.string,x); + } + prs_align(ps); + + return True; +} + +/******************************************************************* +reads or writes an NOTIFY INFO structure. +********************************************************************/ +static BOOL smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, + prs_struct *ps, int depth) +{ + uint32 useless_ptr=0x0001; + int i; + + info->version=0x02; + prs_debug(ps, depth, desc, "smb_io_notify_info"); + depth++; + + prs_align(ps); + + prs_uint32("pointer", ps, depth, &useless_ptr); + prs_uint32("count", ps, depth, &(info->count)); + prs_uint32("version", ps, depth, &(info->version)); + prs_uint32("flags", ps, depth, &(info->flags)); + prs_uint32("count", ps, depth, &(info->count)); + + for (i=0;icount;i++) + { + smb_io_notify_info_data(desc, &(info->data[i]), ps, depth); + } + + /* now do the strings at the end of the stream */ + for (i=0;icount;i++) + { + smb_io_notify_info_data_strings(desc, &(info->data[i]), + ps, depth); + } + + return True; +} + + +/******************************************************************* +********************************************************************/ +static BOOL spool_io_user_level_1(char *desc, SPOOL_USER_1 *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, ""); + depth++; + + /* reading */ + if (ps->io) + ZERO_STRUCTP(q_u); + + if (!prs_align(ps)) + return False; + if (!prs_uint32("size", ps, depth, &(q_u->size))) + return False; + if (!prs_uint32("client_name_ptr", ps, depth, &(q_u->client_name_ptr))) + return False; + if (!prs_uint32("user_name_ptr", ps, depth, &(q_u->user_name_ptr))) + return False; + if (!prs_uint32("build", ps, depth, &(q_u->build))) + return False; + if (!prs_uint32("major", ps, depth, &(q_u->major))) + return False; + if (!prs_uint32("minor", ps, depth, &(q_u->minor))) + return False; + if (!prs_uint32("processor", ps, depth, &(q_u->processor))) + return False; + + if (!smb_io_unistr2("", &(q_u->client_name), q_u->client_name_ptr, ps, depth)) + return False; + if (!prs_align(ps)) + return False; + if (!smb_io_unistr2("", &(q_u->user_name), q_u->user_name_ptr, ps, depth)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ +static BOOL spool_io_user_level(char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, int depth) +{ + if (q_u==NULL) + return False; + + prs_debug(ps, depth, desc, "spool_io_user_level"); + depth++; + + if (!prs_align(ps)) + return False; + if (!prs_uint32("level", ps, depth, &q_u->level)) + return False; + if (!prs_uint32("ptr", ps, depth, &q_u->ptr)) + return False; + + switch (q_u->level) { + case 1: + if (!spool_io_user_level_1("", &(q_u->user1), ps, depth)) + return False; + break; + default: + return False; + } + + return True; +} + +/******************************************************************* + * read or write a DEVICEMODE struct. + * on reading allocate memory for the private member + ********************************************************************/ +static BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) +{ + prs_debug(ps, depth, desc, "spoolss_io_devmode"); + depth++; + + if (!prs_uint16s(True,"devicename", ps, depth, devmode->devicename.buffer, 32)) + return False; + if (!prs_uint16("specversion", ps, depth, &(devmode->specversion))) + return False; + if (!prs_uint16("driverversion", ps, depth, &(devmode->driverversion))) + return False; + if (!prs_uint16("size", ps, depth, &(devmode->size))) + return False; + if (!prs_uint16("driverextra", ps, depth, &(devmode->driverextra))) + return False; + if (!prs_uint32("fields", ps, depth, &(devmode->fields))) + return False; + if (!prs_uint16("orientation", ps, depth, &(devmode->orientation))) + return False; + if (!prs_uint16("papersize", ps, depth, &(devmode->papersize))) + return False; + if (!prs_uint16("paperlength", ps, depth, &(devmode->paperlength))) + return False; + if (!prs_uint16("paperwidth", ps, depth, &(devmode->paperwidth))) + return False; + if (!prs_uint16("scale", ps, depth, &(devmode->scale))) + return False; + if (!prs_uint16("copies", ps, depth, &(devmode->copies))) + return False; + if (!prs_uint16("defaultsource", ps, depth, &(devmode->defaultsource))) + return False; + if (!prs_uint16("printquality", ps, depth, &(devmode->printquality))) + return False; + if (!prs_uint16("color", ps, depth, &(devmode->color))) + return False; + if (!prs_uint16("duplex", ps, depth, &(devmode->duplex))) + return False; + if (!prs_uint16("yresolution", ps, depth, &(devmode->yresolution))) + return False; + if (!prs_uint16("ttoption", ps, depth, &(devmode->ttoption))) + return False; + if (!prs_uint16("collate", ps, depth, &(devmode->collate))) + return False; + if (!prs_uint16s(True, "formname", ps, depth, devmode->formname.buffer, 32)) + return False; + if (!prs_uint16("logpixels", ps, depth, &(devmode->logpixels))) + return False; + if (!prs_uint32("bitsperpel", ps, depth, &(devmode->bitsperpel))) + return False; + if (!prs_uint32("pelswidth", ps, depth, &(devmode->pelswidth))) + return False; + if (!prs_uint32("pelsheight", ps, depth, &(devmode->pelsheight))) + return False; + if (!prs_uint32("displayflags", ps, depth, &(devmode->displayflags))) + return False; + if (!prs_uint32("displayfrequency", ps, depth, &(devmode->displayfrequency))) + return False; + if (!prs_uint32("icmmethod", ps, depth, &(devmode->icmmethod))) + return False; + if (!prs_uint32("icmintent", ps, depth, &(devmode->icmintent))) + return False; + if (!prs_uint32("mediatype", ps, depth, &(devmode->mediatype))) + return False; + if (!prs_uint32("dithertype", ps, depth, &(devmode->dithertype))) + return False; + if (!prs_uint32("reserved1", ps, depth, &(devmode->reserved1))) + return False; + if (!prs_uint32("reserved2", ps, depth, &(devmode->reserved2))) + return False; + if (!prs_uint32("panningwidth", ps, depth, &(devmode->panningwidth))) + return False; + if (!prs_uint32("panningheight", ps, depth, &(devmode->panningheight))) + return False; + + if (devmode->driverextra!=0) + { + if (UNMARSHALLING(ps)) { + devmode->private=(uint8 *)malloc(devmode->driverextra*sizeof(uint8)); + DEBUG(7,("spoolss_io_devmode: allocated memory [%d] for private\n",devmode->driverextra)); + } + + DEBUG(7,("spoolss_io_devmode: parsing [%d] bytes of private\n",devmode->driverextra)); + if (!prs_uint8s(True, "private", ps, depth, devmode->private, devmode->driverextra)) + return False; + } + + return True; +} + +/******************************************************************* + Read or write a DEVICEMODE container +********************************************************************/ +static BOOL spoolss_io_devmode_cont(char *desc, DEVMODE_CTR *dm_c, prs_struct *ps, int depth) +{ + if (dm_c==NULL) + return False; + + prs_debug(ps, depth, desc, "spoolss_io_devmode_cont"); + depth++; + + if (!prs_uint32("size", ps, depth, &dm_c->size)) + return False; + + if (!prs_uint32("devmode_ptr", ps, depth, &dm_c->devmode_ptr)) + return False; + + if (dm_c->size==0 || dm_c->devmode_ptr==0) { + if (UNMARSHALLING(ps)) + /* if while reading there is no DEVMODE ... */ + dm_c->devmode=NULL; + return True; + } + + /* so we have a DEVICEMODE to follow */ + if (UNMARSHALLING(ps)) { + DEBUG(9,("Allocating memory for spoolss_io_devmode\n")); + dm_c->devmode=(DEVICEMODE *)malloc(sizeof(DEVICEMODE)); + ZERO_STRUCTP(dm_c->devmode); + } + + /* this is bad code, shouldn't be there */ + if (!prs_uint32("size", ps, depth, &dm_c->size)) + return False; + + if (!spoolss_io_devmode(desc, ps, depth, dm_c->devmode)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ +static BOOL spoolss_io_printer_default(char *desc, PRINTER_DEFAULT *pd, prs_struct *ps, int depth) +{ + if (pd==NULL) + return False; + + prs_debug(ps, depth, desc, "spoolss_io_printer_default"); + depth++; + + if (!prs_uint32("datatype_ptr", ps, depth, &pd->datatype_ptr)) + return False; + + if (!smb_io_unistr2("datatype", &(pd->datatype), pd->datatype_ptr, ps,depth)) + return False; + + if (!prs_align(ps)) + return False; + + if (!spoolss_io_devmode_cont("", &(pd->devmode_cont), ps, depth)) + return False; + + if (!prs_uint32("access_required", ps, depth, &pd->access_required)) + return False; + + return True; +} + +/******************************************************************* + * make a structure. + ********************************************************************/ +BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, + const char *printername, + uint32 cbbuf, uint32 devmod, uint32 des_access, + const char *station, + const char *username) +{ + int len_name = printername != NULL ? strlen(printername) : 0; + int len_sta = station != NULL ? strlen(station ) : 0; + int len_user = username != NULL ? strlen(username ) : 0; + + if (q_u == NULL) return False; + + DEBUG(5,("make_spoolss_io_q_open_printer_ex\n")); + + q_u->printername_ptr = 1; + init_unistr2(&(q_u->printername), printername, len_name); + +/* + q_u->unknown0 = 0x0; + q_u->cbbuf = cbbuf; + q_u->devmod = devmod; + q_u->access_required = des_access; +*/ +/* q_u->unknown1 = 0x1; + q_u->unknown2 = 0x1; + q_u->unknown3 = 0x149f7d8; + q_u->unknown4 = 0x1c; + q_u->unknown5 = 0x00b94dd0; + q_u->unknown6 = 0x0149f5cc; + q_u->unknown7 = 0x00000565; + q_u->unknown8 = 0x2; + q_u->unknown9 = 0x0; + q_u->unknown10 = 0x0; + + init_unistr2(&(q_u->station), station, len_sta); + init_unistr2(&(q_u->username), username, len_user); +*/ + return True; +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_open_printer_ex (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_open_printer_ex"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("printername_ptr", ps, depth, &(q_u->printername_ptr))) + return False; + if (!smb_io_unistr2("", &(q_u->printername), q_u->printername_ptr, ps,depth)) + return False; + + if (!prs_align(ps)) + return False; + + if (!spoolss_io_printer_default("", &(q_u->printer_default), ps, depth)) + return False; + + if (!prs_uint32("user_switch", ps, depth, &(q_u->user_switch))) + return False; + + if (!spool_io_user_level("", &(q_u->user_ctr), ps, depth)) + return False; + + return True; +} + +/******************************************************************* + * write a structure. + * called from static spoolss_r_open_printer_ex (srv_spoolss.c) + * called from spoolss_open_printer_ex (cli_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_r_open_printer_ex"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!smb_io_prt_hnd("printer handle",&(r_u->handle),ps,depth)) + return False; + + if (!prs_uint32("status code", ps, depth, &(r_u->status))) + return False; + + return True; +} +/******************************************************************* + * make a structure. + ********************************************************************/ +BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, + POLICY_HND *handle, + char *valuename, + uint32 size) +{ + int len_name = valuename != NULL ? strlen(valuename) : 0; + + if (q_u == NULL) return False; + + DEBUG(5,("make_spoolss_q_getprinterdata\n")); + + memcpy(&(q_u->handle), handle, sizeof(q_u->handle)); + init_unistr2(&(q_u->valuename), valuename, len_name); + q_u->size = size; + + return True; +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_getprinterdata (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_q_getprinterdata(char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdata"); + depth++; + + if (!prs_align(ps)) + return False; + if (!smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth)) + return False; + if (!prs_align(ps)) + return False; + if (!smb_io_unistr2("valuename", &(q_u->valuename),True,ps,depth)) + return False; + if (!prs_align(ps)) + return False; + if (!prs_uint32("size", ps, depth, &(q_u->size))) + return False; + + return True; +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_getprinterdata (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdata"); + depth++; + + prs_align(ps); + prs_uint32("type", ps, depth, &(r_u->type)); + prs_uint32("size", ps, depth, &(r_u->size)); + + prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size); + prs_align(ps); + + prs_uint32("needed", ps, depth, &(r_u->needed)); + prs_uint32("status", ps, depth, &(r_u->status)); + prs_align(ps); + + return True; +} + +/******************************************************************* + * make a structure. + ********************************************************************/ +BOOL make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER *q_u, POLICY_HND *hnd) +{ + if (q_u == NULL) return False; + + DEBUG(5,("make_spoolss_q_closeprinter\n")); + + memcpy(&(q_u->handle), hnd, sizeof(q_u->handle)); + + return True; +} + +/******************************************************************* + * read a structure. + * called from static spoolss_q_closeprinter (srv_spoolss.c) + * called from spoolss_closeprinter (cli_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_q_closeprinter(char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_closeprinter"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + + return True; +} + +/******************************************************************* + * write a structure. + * called from static spoolss_r_closeprinter (srv_spoolss.c) + * called from spoolss_closeprinter (cli_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_r_closeprinter(char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_closeprinter"); + depth++; + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(r_u->handle),ps,depth); + prs_uint32("status", ps, depth, &(r_u->status)); + + + return True; +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_startdocprinter (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_q_startdocprinter(char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_startdocprinter"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + + smb_io_doc_info_container("",&(q_u->doc_info_container), ps, depth); + + return True; +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_startdocprinter (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_r_startdocprinter(char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_startdocprinter"); + depth++; + prs_uint32("jobid", ps, depth, &(r_u->jobid)); + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_enddocprinter (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_q_enddocprinter(char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_enddocprinter"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + + return True; +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_enddocprinter (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_r_enddocprinter(char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_enddocprinter"); + depth++; + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_startpageprinter (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_q_startpageprinter(char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_startpageprinter"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + + return True; +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_startpageprinter (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_r_startpageprinter(char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_startpageprinter"); + depth++; + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_endpageprinter (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_q_endpageprinter(char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_endpageprinter"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + + return True; +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_endpageprinter (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_r_endpageprinter(char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_endpageprinter"); + depth++; + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_writeprinter (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_writeprinter"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("buffer_size", ps, depth, &(q_u->buffer_size)); + + if (q_u->buffer_size!=0) + { + q_u->buffer=(uint8 *)malloc(q_u->buffer_size*sizeof(uint8)); + prs_uint8s(True, "buffer", ps, depth, q_u->buffer, q_u->buffer_size); + } + prs_align(ps); + prs_uint32("buffer_size2", ps, depth, &(q_u->buffer_size2)); + + return True; +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_writeprinter (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_r_writeprinter(char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_writeprinter"); + depth++; + prs_uint32("buffer_written", ps, depth, &(r_u->buffer_written)); + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_rffpcnex (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, + prs_struct *ps, int depth) +{ + uint32 useless_ptr; + + prs_debug(ps, depth, desc, "spoolss_io_q_rffpcnex"); + depth++; + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("flags", ps, depth, &(q_u->flags)); + prs_uint32("options", ps, depth, &(q_u->options)); + prs_uint32("useless ptr", ps, depth, &useless_ptr); + /*prs_align(ps);*/ + + smb_io_unistr2("", &(q_u->localmachine), True, ps, depth); + + prs_align(ps); + prs_uint32("printerlocal", ps, depth, &(q_u->printerlocal)); + + smb_io_notify_option("notify option", &(q_u->option), ps, depth); + + + return True; +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_rffpcnex (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_rffpcnex"); + depth++; + + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_rfnpcnex (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, + prs_struct *ps, int depth) +{ + + prs_debug(ps, depth, desc, "spoolss_io_q_rfnpcnex"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + + prs_uint32("change", ps, depth, &(q_u->change)); + + smb_io_notify_option("notify option",&(q_u->option),ps,depth); + + return True; +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_rfnpcnex (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_r_rfnpcnex(char *desc, + SPOOL_R_RFNPCNEX *r_u, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_rfnpcnex"); + depth++; + + prs_align(ps); + + smb_io_notify_info("notify info",&(r_u->info),ps,depth); + prs_align(ps); + prs_uint32("status", ps, depth, &r_u->status); + + return True; +} + +/******************************************************************* + * return the length of a uint32 (obvious, but the code is clean) + ********************************************************************/ +static uint32 size_of_uint32(uint32 *value) +{ + return (sizeof(*value)); + + return True; +} + +/******************************************************************* + * return the length of a UNICODE string in number of char, includes: + * - the leading zero + * - the relative pointer size + ********************************************************************/ +static uint32 size_of_relative_string(UNISTR *string) +{ + uint32 size=0; + + size=str_len_uni(string); /* the string length */ + size=size+1; /* add the leading zero */ + size=size*2; /* convert in char */ + size=size+4; /* add the size of the ptr */ + return (size); + + return True; +} + +/******************************************************************* + * return the length of a uint32 (obvious, but the code is clean) + ********************************************************************/ +static uint32 size_of_device_mode(DEVICEMODE *devmode) +{ + if (devmode==NULL) + return (4); + else + return (0xDC+4); + + return True; +} + +/******************************************************************* + * return the length of a uint32 (obvious, but the code is clean) + ********************************************************************/ +static uint32 size_of_systemtime(SYSTEMTIME *systime) +{ + if (systime==NULL) + return (4); + else + return (sizeof(SYSTEMTIME) +4); + + return True; +} + +/******************************************************************* + * write a UNICODE string. + * used by all the RPC structs passing a buffer + ********************************************************************/ +static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) +{ + if (uni == NULL) + return False; + + prs_debug(ps, depth, desc, "spoolss_smb_io_unistr"); + depth++; + if (!prs_unistr("unistr", ps, depth, uni)) + return False; + + return True; +} + + +/******************************************************************* + * write a UNICODE string and its relative pointer. + * used by all the RPC structs passing a buffer + ********************************************************************/ +static BOOL smb_io_relstr(char *desc, prs_struct *ps, int depth, UNISTR *buffer, + uint32 *start_offset, uint32 *end_offset) +{ + if (!ps->io) + { + uint32 struct_offset = prs_offset(ps); + uint32 relative_offset; + + /* writing */ + *end_offset -= 2*(str_len_uni(buffer)+1); + prs_set_offset(ps, *end_offset); + spoolss_smb_io_unistr(desc, buffer, ps, depth); + + prs_set_offset(ps,struct_offset); + relative_offset=*end_offset-*start_offset; + + prs_uint32("offset", ps, depth, &(relative_offset)); + } + else + { + uint32 old_offset; + uint32 relative_offset; + + prs_uint32("offset", ps, depth, &(relative_offset)); + + old_offset = prs_offset(ps); + prs_set_offset(ps, (*start_offset) + relative_offset); + + spoolss_smb_io_unistr(desc, buffer, ps, depth); + + *end_offset = prs_offset(ps); + prs_set_offset(ps, old_offset); + } + return True; +} + +/******************************************************************* + * write a UNICODE string and its relative pointer. + * used by all the RPC structs passing a buffer + * + * As I'm a nice guy, I'm forcing myself to explain this code. + * MS did a good job in the overall spoolss code except in some + * functions where they are passing the API buffer directly in the + * RPC request/reply. That's to maintain compatiility at the API level. + * They could have done it the good way the first time. + * + * So what happen is: the strings are written at the buffer's end, + * in the reverse order of the original structure. Some pointers to + * the strings are also in the buffer. Those are relative to the + * buffer's start. + * + * If you don't understand or want to change that function, + * first get in touch with me: jfm@samba.org + * + ********************************************************************/ +static BOOL new_smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *string) +{ + prs_struct *ps=&(buffer->prs); + + if (MARSHALLING(ps)) + { + uint32 struct_offset = prs_offset(ps); + uint32 relative_offset; + + buffer->string_at_end -= 2*(str_len_uni(string)+1); + prs_set_offset(ps, buffer->string_at_end); + + /* write the string */ + if (!spoolss_smb_io_unistr(desc, string, ps, depth)) + return False; + + prs_set_offset(ps, struct_offset); + + relative_offset=buffer->string_at_end-buffer->struct_start; + /* write its offset */ + if (!prs_uint32("offset", ps, depth, &relative_offset)) + return False; + } + else + { + uint32 old_offset; + + /* read the offset */ + if (!prs_uint32("offset", ps, depth, &(buffer->string_at_end))) + return False; + + old_offset = prs_offset(ps); + prs_set_offset(ps, buffer->string_at_end); + + /* read the string */ + if (!spoolss_smb_io_unistr(desc, string, ps, depth)) + return False; + + prs_set_offset(ps, old_offset); + } + return True; +} + + +/******************************************************************* + * write a array UNICODE strings and its relative pointer. + * used by 2 RPC structs + ********************************************************************/ +static BOOL smb_io_relarraystr(char *desc, prs_struct *ps, int depth, UNISTR ***buffer, + uint32 *start_offset, uint32 *end_offset) +{ + int i=0; + uint32 struct_offset; + uint32 relative_offset; + struct_offset=prs_offset(ps); + + while ( (*buffer)[i]!=0x0000 ) + { + i++; + } + + i--; + + /* that's for the ending NULL */ + *end_offset-=2; + + do + { + *end_offset-= 2*(str_len_uni((*buffer)[i])+1); + prs_set_offset(ps, *end_offset); + spoolss_smb_io_unistr(desc, (*buffer)[i], ps, depth); + + i--; + } + while (i>=0); + + prs_set_offset(ps, struct_offset); + relative_offset=*end_offset-*start_offset; + + prs_uint32("offset", ps, depth, &(relative_offset)); + + return True; +} + +/******************************************************************* + * write a DEVMODE struct and its relative pointer. + * used by all the RPC structs passing a buffer + ********************************************************************/ +static BOOL smb_io_reldevmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode, + uint32 *start_offset, uint32 *end_offset) +{ + uint32 struct_offset; + uint32 relative_offset; + + prs_debug(ps, depth, desc, "smb_io_reldevmode"); + depth++; + + struct_offset=prs_offset(ps); + *end_offset-= (devmode->size+devmode->driverextra); + prs_set_offset(ps, *end_offset); + + spoolss_io_devmode(desc, ps, depth, devmode); + + prs_set_offset(ps, struct_offset); + relative_offset=*end_offset-*start_offset; + + prs_uint32("offset", ps, depth, &(relative_offset)); + + return True; +} + +/******************************************************************* +********************************************************************/ +static BOOL smb_io_printer_info_0(char *desc, PRINTER_INFO_0 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_printer_info_0"); + depth++; + *start_offset=prs_offset(ps); + + smb_io_relstr("printername",ps, depth, &(info->printername), start_offset, end_offset); + smb_io_relstr("servername",ps, depth, &(info->servername), start_offset, end_offset); + prs_uint32("cjobs", ps, depth, &(info->cjobs)); + prs_uint32("attributes", ps, depth, &(info->attributes)); + + prs_uint32("unknown0", ps, depth, &(info->unknown0)); + prs_uint32("unknown1", ps, depth, &(info->unknown1)); + prs_uint32("unknown2", ps, depth, &(info->unknown2)); + prs_uint32("unknown3", ps, depth, &(info->unknown3)); + prs_uint32("unknown4", ps, depth, &(info->unknown4)); + prs_uint32("unknown5", ps, depth, &(info->unknown5)); + prs_uint32("unknown6", ps, depth, &(info->unknown6)); + prs_uint16("majorversion", ps, depth, &(info->majorversion)); + prs_uint16("buildversion", ps, depth, &(info->buildversion)); + prs_uint32("unknown7", ps, depth, &(info->unknown7)); + prs_uint32("unknown8", ps, depth, &(info->unknown8)); + prs_uint32("unknown9", ps, depth, &(info->unknown9)); + prs_uint32("unknown10", ps, depth, &(info->unknown10)); + prs_uint32("unknown11", ps, depth, &(info->unknown11)); + prs_uint32("unknown12", ps, depth, &(info->unknown12)); + prs_uint32("unknown13", ps, depth, &(info->unknown13)); + prs_uint32("unknown14", ps, depth, &(info->unknown14)); + prs_uint32("unknown15", ps, depth, &(info->unknown15)); + prs_uint32("unknown16", ps, depth, &(info->unknown16)); + prs_uint32("unknown17", ps, depth, &(info->unknown17)); + prs_uint32("unknown18", ps, depth, &(info->unknown18)); + prs_uint32("status" , ps, depth, &(info->status)); + prs_uint32("unknown20", ps, depth, &(info->unknown20)); + prs_uint32("unknown21", ps, depth, &(info->unknown21)); + prs_uint16("unknown22", ps, depth, &(info->unknown22)); + prs_uint32("unknown23", ps, depth, &(info->unknown23)); + + return True; +} + +/******************************************************************* +********************************************************************/ +static BOOL smb_io_printer_info_1(char *desc, PRINTER_INFO_1 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_printer_info_1"); + depth++; + *start_offset=prs_offset(ps); + + prs_uint32("flags", ps, depth, &(info->flags)); + smb_io_relstr("description",ps, depth, &(info->description), start_offset, end_offset); + smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); + smb_io_relstr("comment",ps, depth, &(info->comment), start_offset, end_offset); + + return True; +} + +/******************************************************************* +********************************************************************/ +static BOOL smb_io_printer_info_2(char *desc, PRINTER_INFO_2 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + uint32 pipo=0; + uint32 devmode_offset; + uint32 backup_offset; + + prs_debug(ps, depth, desc, "smb_io_printer_info_2"); + depth++; + *start_offset=prs_offset(ps); + + smb_io_relstr("servername", ps, depth, &(info->servername), start_offset, end_offset); + smb_io_relstr("printername", ps, depth, &(info->printername), start_offset, end_offset); + smb_io_relstr("sharename", ps, depth, &(info->sharename), start_offset, end_offset); + smb_io_relstr("portname", ps, depth, &(info->portname), start_offset, end_offset); + smb_io_relstr("drivername", ps, depth, &(info->drivername), start_offset, end_offset); + smb_io_relstr("comment", ps, depth, &(info->comment), start_offset, end_offset); + smb_io_relstr("location", ps, depth, &(info->location), start_offset, end_offset); + + devmode_offset=prs_offset(ps); + prs_set_offset(ps, prs_offset(ps)+4); + + smb_io_relstr("sepfile", ps, depth, &(info->sepfile), start_offset, end_offset); + smb_io_relstr("printprocessor",ps, depth, &(info->printprocessor), start_offset, end_offset); + smb_io_relstr("datatype", ps, depth, &(info->datatype), start_offset, end_offset); + smb_io_relstr("parameters", ps, depth, &(info->parameters), start_offset, end_offset); + + prs_uint32("security descriptor", ps, depth, &(pipo)); + + prs_uint32("attributes", ps, depth, &(info->attributes)); + prs_uint32("priority", ps, depth, &(info->priority)); + prs_uint32("defpriority", ps, depth, &(info->defaultpriority)); + prs_uint32("starttime", ps, depth, &(info->starttime)); + prs_uint32("untiltime", ps, depth, &(info->untiltime)); + prs_uint32("status", ps, depth, &(info->status)); + prs_uint32("jobs", ps, depth, &(info->cjobs)); + prs_uint32("averageppm", ps, depth, &(info->averageppm)); + + /* + I'm not sure if putting the devmode at the end the struct is worth it + but NT does it + */ + backup_offset=prs_offset(ps); + prs_set_offset(ps, devmode_offset); + smb_io_reldevmode("devmode", ps, depth, info->devmode, start_offset, end_offset); + prs_set_offset(ps, backup_offset); + + return True; +} + +/******************************************************************* +********************************************************************/ +static BOOL smb_io_printer_driver_info_1(char *desc, DRIVER_INFO_1 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_printer_driver_info_1"); + depth++; + *start_offset=prs_offset(ps); + + smb_io_relstr("name", ps, depth, &(info->name), start_offset, end_offset); + + return True; +} + +/******************************************************************* +********************************************************************/ +static BOOL smb_io_printer_driver_info_2(char *desc, DRIVER_INFO_2 *info,prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_printer_xxx"); + depth++; + *start_offset=prs_offset(ps); + + prs_uint32("version", ps, depth, &(info->version)); + smb_io_relstr("name", ps, depth, &(info->name), start_offset, end_offset); + smb_io_relstr("architecture", ps, depth, &(info->architecture), start_offset, end_offset); + smb_io_relstr("driverpath", ps, depth, &(info->driverpath), start_offset, end_offset); + smb_io_relstr("datafile", ps, depth, &(info->datafile), start_offset, end_offset); + smb_io_relstr("configfile", ps, depth, &(info->configfile), start_offset, end_offset); + + return True; +} + +/******************************************************************* +********************************************************************/ +static BOOL smb_io_printer_driver_info_3(char *desc, DRIVER_INFO_3 *info,prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_printer_driver_info_3"); + depth++; + *start_offset=prs_offset(ps); + + prs_uint32("version", ps, depth, &(info->version)); + smb_io_relstr("name", ps, depth, &(info->name), start_offset, end_offset); + smb_io_relstr("architecture", ps, depth, &(info->architecture), start_offset, end_offset); + smb_io_relstr("driverpath", ps, depth, &(info->driverpath), start_offset, end_offset); + smb_io_relstr("datafile", ps, depth, &(info->datafile), start_offset, end_offset); + smb_io_relstr("configfile", ps, depth, &(info->configfile), start_offset, end_offset); + smb_io_relstr("helpfile", ps, depth, &(info->helpfile), start_offset, end_offset); + + smb_io_relarraystr("dependentfiles", ps, depth, &(info->dependentfiles), start_offset, end_offset); + + smb_io_relstr("monitorname", ps, depth, &(info->monitorname), start_offset, end_offset); + smb_io_relstr("defaultdatatype", ps, depth, &(info->defaultdatatype), start_offset, end_offset); + + return True; +} + +/******************************************************************* +********************************************************************/ +static BOOL smb_io_job_info_1(char *desc, JOB_INFO_1 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_job_info_1"); + depth++; + *start_offset=prs_offset(ps); + + prs_uint32("jobid", ps, depth, &(info->jobid)); + smb_io_relstr("printername", ps, depth, &(info->printername), start_offset, end_offset); + smb_io_relstr("machinename", ps, depth, &(info->machinename), start_offset, end_offset); + smb_io_relstr("username", ps, depth, &(info->username), start_offset, end_offset); + smb_io_relstr("document", ps, depth, &(info->document), start_offset, end_offset); + smb_io_relstr("datatype", ps, depth, &(info->datatype), start_offset, end_offset); + smb_io_relstr("text_status", ps, depth, &(info->text_status), start_offset, end_offset); + prs_uint32("status", ps, depth, &(info->status)); + prs_uint32("priority", ps, depth, &(info->priority)); + prs_uint32("position", ps, depth, &(info->position)); + prs_uint32("totalpages", ps, depth, &(info->totalpages)); + prs_uint32("pagesprinted", ps, depth, &(info->pagesprinted)); + spoolss_io_system_time("submitted", ps, depth, &(info->submitted) ); + + return True; +} + +/******************************************************************* +********************************************************************/ +static BOOL smb_io_job_info_2(char *desc, JOB_INFO_2 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + int pipo=0; + prs_debug(ps, depth, desc, "smb_io_job_info_2"); + depth++; + *start_offset=prs_offset(ps); + + prs_uint32("jobid", ps, depth, &(info->jobid)); + smb_io_relstr("printername", ps, depth, &(info->printername), start_offset, end_offset); + smb_io_relstr("machinename", ps, depth, &(info->machinename), start_offset, end_offset); + smb_io_relstr("username", ps, depth, &(info->username), start_offset, end_offset); + smb_io_relstr("document", ps, depth, &(info->document), start_offset, end_offset); + smb_io_relstr("notifyname", ps, depth, &(info->notifyname), start_offset, end_offset); + smb_io_relstr("datatype", ps, depth, &(info->datatype), start_offset, end_offset); + + smb_io_relstr("printprocessor", ps, depth, &(info->printprocessor), start_offset, end_offset); + smb_io_relstr("parameters", ps, depth, &(info->parameters), start_offset, end_offset); + smb_io_relstr("drivername", ps, depth, &(info->drivername), start_offset, end_offset); + smb_io_reldevmode("devmode", ps, depth, info->devmode, start_offset, end_offset); + smb_io_relstr("text_status", ps, depth, &(info->text_status), start_offset, end_offset); + +/* SEC_DESC sec_desc;*/ + prs_uint32("Hack! sec desc", ps, depth, &pipo); + + prs_uint32("status", ps, depth, &(info->status)); + prs_uint32("priority", ps, depth, &(info->priority)); + prs_uint32("position", ps, depth, &(info->position)); + prs_uint32("starttime", ps, depth, &(info->starttime)); + prs_uint32("untiltime", ps, depth, &(info->untiltime)); + prs_uint32("totalpages", ps, depth, &(info->totalpages)); + prs_uint32("size", ps, depth, &(info->size)); + spoolss_io_system_time("submitted", ps, depth, &(info->submitted) ); + prs_uint32("timeelapsed", ps, depth, &(info->timeelapsed)); + prs_uint32("pagesprinted", ps, depth, &(info->pagesprinted)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL new_smb_io_form_1(char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth) +{ + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "new_smb_io_form_1"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if (!prs_uint32("flag", ps, depth, &(info->flag))) + return False; + + if (!new_smb_io_relstr("name", buffer, depth, &(info->name))) + return False; + + if (!prs_uint32("width", ps, depth, &(info->width))) + return False; + if (!prs_uint32("length", ps, depth, &(info->length))) + return False; + if (!prs_uint32("left", ps, depth, &(info->left))) + return False; + if (!prs_uint32("top", ps, depth, &(info->top))) + return False; + if (!prs_uint32("right", ps, depth, &(info->right))) + return False; + if (!prs_uint32("bottom", ps, depth, &(info->bottom))) + return False; + + return True; +} + +/******************************************************************* + Read/write a BUFFER struct. +********************************************************************/ +static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUFFER *buffer) +{ + if (buffer == NULL) + return False; + + prs_debug(ps, depth, desc, "new_spoolss_io_buffer"); + depth++; + + if (!prs_uint32("ptr", ps, depth, &(buffer->ptr))) + return False; + + /* reading */ + if (UNMARSHALLING(ps)) { + buffer->size=0; + buffer->string_at_end=0; + + if (buffer->ptr==0) { + if (!prs_init(&(buffer->prs), 0, 4, UNMARSHALL)) + return False; + return True; + } + + if (!prs_uint32("size", ps, depth, &(buffer->size))) + return False; + + if (!prs_init(&(buffer->prs), buffer->size, 4, UNMARSHALL)) + return False; + + if (!prs_append_some_prs_data(&(buffer->prs), ps, buffer->size)) + return False; + + prs_set_offset(&(buffer->prs),0); + + prs_set_offset(ps, buffer->size+prs_offset(ps)); + + buffer->string_at_end=buffer->size; + + return True; + } + else { + /* writing */ + if (buffer->ptr==0) + return True; + + if (!prs_uint32("size", ps, depth, &(buffer->size))) + return False; + + if (!prs_append_some_prs_data(ps, &(buffer->prs), buffer->size)) + return False; + } + + return True; +} + +/******************************************************************* + move a BUFFER from the query to the reply. +********************************************************************/ +void new_spoolss_move_buffer(NEW_BUFFER *src, NEW_BUFFER **dest) +{ + prs_switch_type(&(src->prs), MARSHALL); + prs_set_offset(&(src->prs), 0); + prs_force_dynamic(&(src->prs)); + + *dest=src; +} + +/******************************************************************* + create a BUFFER struct. +********************************************************************/ +void new_spoolss_allocate_buffer(NEW_BUFFER **buffer) +{ + if (buffer==NULL) + return; + + *buffer=(NEW_BUFFER *)malloc(sizeof(NEW_BUFFER)); + + (*buffer)->ptr=0x0; + (*buffer)->size=0; + (*buffer)->string_at_end=0; +} + +/******************************************************************* + Destroy a BUFFER struct. +********************************************************************/ +void new_spoolss_free_buffer(NEW_BUFFER *buffer) +{ + if (buffer==NULL) + return; + + prs_mem_free(&(buffer->prs)); + buffer->ptr=0x0; + buffer->size=0; + buffer->string_at_end=0; + + free(buffer); +} + +/******************************************************************* + Get the size of a BUFFER struct. +********************************************************************/ +uint32 new_get_buffer_size(NEW_BUFFER *buffer) +{ + return (buffer->size); +} + +/******************************************************************* +********************************************************************/ +static BOOL smb_io_form_1(char *desc, FORM_1 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_form_1"); + depth++; + *start_offset=prs_offset(ps); + + prs_uint32("flag", ps, depth, &(info->flag)); + smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); + prs_uint32("width", ps, depth, &(info->width)); + prs_uint32("length", ps, depth, &(info->length)); + prs_uint32("left", ps, depth, &(info->left)); + prs_uint32("top", ps, depth, &(info->top)); + prs_uint32("right", ps, depth, &(info->right)); + prs_uint32("bottom", ps, depth, &(info->bottom)); + + return True; +} + +/******************************************************************* +********************************************************************/ +static BOOL smb_io_port_2(char *desc, PORT_INFO_2 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_port_2"); + depth++; + *start_offset=prs_offset(ps); + + smb_io_relstr("port_name",ps, depth, &(info->port_name), start_offset, end_offset); + smb_io_relstr("monitor_name",ps, depth, &(info->monitor_name), start_offset, end_offset); + smb_io_relstr("description",ps, depth, &(info->description), start_offset, end_offset); + prs_uint32("port_type", ps, depth, &(info->port_type)); + prs_uint32("reserved", ps, depth, &(info->reserved)); + + return True; +} + +/******************************************************************* +********************************************************************/ +static BOOL smb_io_processor_info_1(char *desc, PRINTPROCESSOR_1 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_processor_info_1"); + depth++; + *start_offset=prs_offset(ps); + + smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); + + return True; +} + +/******************************************************************* +********************************************************************/ +static BOOL smb_io_monitor_info_1(char *desc, PRINTMONITOR_1 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + prs_debug(ps, depth, desc, "smb_io_monitor_info_1"); + depth++; + *start_offset=prs_offset(ps); + + smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); + + return True; +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_printer_info_0(PRINTER_INFO_0 *info) +{ + int size=0; + + size+=size_of_uint32( &(info->attributes) ); + size+=size_of_relative_string( &(info->printername) ); + size+=size_of_relative_string( &(info->servername) ); + return (size); + + return True; +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_printer_info_1(PRINTER_INFO_1 *info) +{ + int size=0; + + size+=size_of_uint32( &(info->flags) ); + size+=size_of_relative_string( &(info->description) ); + size+=size_of_relative_string( &(info->name) ); + size+=size_of_relative_string( &(info->comment) ); + return (size); + + return True; +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) +{ + int size=0; + + size+=4; /* the security descriptor */ + size+=info->devmode->size+4; /* size of the devmode and the ptr */ + size+=info->devmode->driverextra; /* if a devmode->private section exists, add its size */ + + size+=size_of_relative_string( &(info->servername) ); + size+=size_of_relative_string( &(info->printername) ); + size+=size_of_relative_string( &(info->sharename) ); + size+=size_of_relative_string( &(info->portname) ); + size+=size_of_relative_string( &(info->drivername) ); + size+=size_of_relative_string( &(info->comment) ); + size+=size_of_relative_string( &(info->location) ); + + size+=size_of_relative_string( &(info->sepfile) ); + size+=size_of_relative_string( &(info->printprocessor) ); + size+=size_of_relative_string( &(info->datatype) ); + size+=size_of_relative_string( &(info->parameters) ); + + size+=size_of_uint32( &(info->attributes) ); + size+=size_of_uint32( &(info->priority) ); + size+=size_of_uint32( &(info->defaultpriority) ); + size+=size_of_uint32( &(info->starttime) ); + size+=size_of_uint32( &(info->untiltime) ); + size+=size_of_uint32( &(info->status) ); + size+=size_of_uint32( &(info->cjobs) ); + size+=size_of_uint32( &(info->averageppm) ); + return (size); + + return True; +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info) +{ + int size=0; + DEBUG(9,("Sizing driver info_1\n")); + size+=size_of_relative_string( &(info->name) ); + + DEBUGADD(9,("size: [%d]\n", size)); + return (size); + + return True; +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info) +{ + int size=0; + DEBUG(9,("Sizing driver info_2\n")); + size+=size_of_uint32( &(info->version) ); + size+=size_of_relative_string( &(info->name) ); + size+=size_of_relative_string( &(info->architecture) ); + size+=size_of_relative_string( &(info->driverpath) ); + size+=size_of_relative_string( &(info->datafile) ); + size+=size_of_relative_string( &(info->configfile) ); + + DEBUGADD(9,("size: [%d]\n", size)); + return (size); + + return True; +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) +{ + int size=0; + UNISTR **string; + int i=0; + + DEBUG(9,("Sizing driver info_3\n")); + size+=size_of_uint32( &(info->version) ); + size+=size_of_relative_string( &(info->name) ); + size+=size_of_relative_string( &(info->architecture) ); + size+=size_of_relative_string( &(info->driverpath) ); + size+=size_of_relative_string( &(info->datafile) ); + size+=size_of_relative_string( &(info->configfile) ); + size+=size_of_relative_string( &(info->helpfile) ); + size+=size_of_relative_string( &(info->monitorname) ); + size+=size_of_relative_string( &(info->defaultdatatype) ); + + string=info->dependentfiles; + + while ( (string)[i]!=0x0000 ) + { + size+=2*(1+ str_len_uni( string[i] ) ); + i++; + } + size+=6; + + DEBUGADD(9,("size: [%d]\n", size)); + return (size); + + return True; +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_job_info_1(JOB_INFO_1 *info) +{ + int size=0; + size+=size_of_uint32( &(info->jobid) ); + size+=size_of_relative_string( &(info->printername) ); + size+=size_of_relative_string( &(info->machinename) ); + size+=size_of_relative_string( &(info->username) ); + size+=size_of_relative_string( &(info->document) ); + size+=size_of_relative_string( &(info->datatype) ); + size+=size_of_relative_string( &(info->text_status) ); + size+=size_of_uint32( &(info->status) ); + size+=size_of_uint32( &(info->priority) ); + size+=size_of_uint32( &(info->position) ); + size+=size_of_uint32( &(info->totalpages) ); + size+=size_of_uint32( &(info->pagesprinted) ); + size+=size_of_systemtime( &(info->submitted) ); + return (size); + + return True; +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_job_info_2(JOB_INFO_2 *info) +{ + int size=0; + + size+=4; /* size of sec desc ptr */ + + size+=size_of_uint32( &(info->jobid) ); + size+=size_of_relative_string( &(info->printername) ); + size+=size_of_relative_string( &(info->machinename) ); + size+=size_of_relative_string( &(info->username) ); + size+=size_of_relative_string( &(info->document) ); + size+=size_of_relative_string( &(info->notifyname) ); + size+=size_of_relative_string( &(info->datatype) ); + size+=size_of_relative_string( &(info->printprocessor) ); + size+=size_of_relative_string( &(info->parameters) ); + size+=size_of_relative_string( &(info->drivername) ); + size+=size_of_device_mode( info->devmode ); + size+=size_of_relative_string( &(info->text_status) ); +/* SEC_DESC sec_desc;*/ + size+=size_of_uint32( &(info->status) ); + size+=size_of_uint32( &(info->priority) ); + size+=size_of_uint32( &(info->position) ); + size+=size_of_uint32( &(info->starttime) ); + size+=size_of_uint32( &(info->untiltime) ); + size+=size_of_uint32( &(info->totalpages) ); + size+=size_of_uint32( &(info->size) ); + size+=size_of_systemtime( &(info->submitted) ); + size+=size_of_uint32( &(info->timeelapsed) ); + size+=size_of_uint32( &(info->pagesprinted) ); + return (size); + + return True; +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +uint32 spoolss_size_form_1(FORM_1 *info) +{ + int size=0; + + size+=size_of_uint32( &(info->flag) ); + size+=size_of_relative_string( &(info->name) ); + size+=size_of_uint32( &(info->width) ); + size+=size_of_uint32( &(info->length) ); + size+=size_of_uint32( &(info->left) ); + size+=size_of_uint32( &(info->top) ); + size+=size_of_uint32( &(info->right) ); + size+=size_of_uint32( &(info->bottom) ); + + return (size); + + return True; +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_port_info_2(PORT_INFO_2 *info) +{ + int size=0; + + size+=size_of_relative_string( &(info->port_name) ); + size+=size_of_relative_string( &(info->monitor_name) ); + size+=size_of_relative_string( &(info->description) ); + + size+=size_of_uint32( &(info->port_type) ); + size+=size_of_uint32( &(info->reserved) ); + + return (size); + + return True; +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_processor_info_1(PRINTPROCESSOR_1 *info) +{ + int size=0; + size+=size_of_relative_string( &(info->name) ); + + return (size); + + return True; +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +static uint32 spoolss_size_monitor_info_1(PRINTMONITOR_1 *info) +{ + int size=0; + size+=size_of_relative_string( &(info->name) ); + + return (size); + + return True; +} + +/******************************************************************* + * make a structure. + ********************************************************************/ +static BOOL make_spoolss_buffer(BUFFER* buffer, uint32 size) +{ + buffer->ptr = (size != 0) ? 1 : 0; + buffer->size = size; + buffer->data = (uint8 *)Realloc( NULL, (buffer->size) * sizeof(uint8) ); + + return (buffer->data != NULL || size == 0); +} + +/******************************************************************* + * read a uint8 buffer of size *size. + * allocate memory for it + * return a pointer to the allocated memory and the size + * return NULL and a size of 0 if the buffer is empty + * + * jfmxxxx: fix it to also write a buffer + ********************************************************************/ +static BOOL spoolss_io_read_buffer(char *desc, prs_struct *ps, int depth, BUFFER *buffer) +{ + prs_debug(ps, depth, desc, "spoolss_io_read_buffer"); + depth++; + + prs_align(ps); + + prs_uint32("pointer", ps, depth, &(buffer->ptr)); + + if (buffer->ptr != 0x0000) + { + prs_uint32("size", ps, depth, &(buffer->size)); + if (ps->io) + { + /* reading */ + buffer->data=(uint8 *)Realloc(NULL, buffer->size * sizeof(uint8) ); + } + if (buffer->data == NULL) + { + return False; + } + prs_uint8s(True, "buffer", ps, depth, buffer->data, buffer->size); + prs_align(ps); + + } + else + { + if (ps->io) + { + /* reading */ + buffer->data=0x0000; + buffer->size=0x0000; + } + } + + if (!ps->io) + { + /* writing */ + if (buffer->data != NULL) + { + free(buffer->data); + } + buffer->data = NULL; + } + return True; +} + +/******************************************************************* + * read a uint8 buffer of size *size. + * allocate memory for it + * return a pointer to the allocated memory and the size + * return NULL and a size of 0 if the buffer is empty + * + * jfmxxxx: fix it to also write a buffer + ********************************************************************/ +BOOL spoolss_io_free_buffer(BUFFER *buffer) +{ + DEBUG(8,("spoolss_io_free_buffer\n")); + + if (buffer->ptr != 0x0000) + { + free(buffer->data); + } + + return True; +} + +/******************************************************************* + * read a structure. + * called from spoolss_getprinterdriver2 (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_q_getprinterdriver2(char *desc, + SPOOL_Q_GETPRINTERDRIVER2 *q_u, + prs_struct *ps, int depth) +{ + uint32 useless_ptr; + prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdriver2"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("pointer", ps, depth, &useless_ptr); + smb_io_unistr2("architecture", &(q_u->architecture),True,ps,depth); + + prs_align(ps); + + prs_uint32("level", ps, depth, &(q_u->level)); + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + + prs_align(ps); + + prs_uint32("buffer size", ps, depth, &(q_u->buf_size)); + DEBUG(0,("spoolss_io_q_getprinterdriver2: renamed status - unknown\n")); + prs_uint32("unknown", ps, depth, &(q_u->unknown)); + + return True; +} + +/******************************************************************* + * read a structure. + * called from spoolss_getprinterdriver2 (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, + prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + uint32 pipo=0; + DRIVER_INFO_1 *info1; + DRIVER_INFO_2 *info2; + DRIVER_INFO_3 *info3; + + prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriver2"); + depth++; + + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + + info1 = r_u->ctr.driver.info1; + info2 = r_u->ctr.driver.info2; + info3 = r_u->ctr.driver.info3; + + switch (r_u->level) + { + case 1: + { + bufsize_required += spoolss_size_printer_driver_info_1(info1); + break; + } + case 2: + { + bufsize_required += spoolss_size_printer_driver_info_2(info2); + break; + } + case 3: + { + bufsize_required += spoolss_size_printer_driver_info_3(info3); + break; + } + } + + if (ps->io) + { + /* reading */ + r_u->offered = bufsize_required; + } + + DEBUG(4,("spoolss_io_r_getprinterdriver2, size needed: %d\n",bufsize_required)); + DEBUG(4,("spoolss_io_r_getprinterdriver2, size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + if (r_u->offered < bufsize_required) + { + /* it's too small */ + r_u->status=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ + + DEBUG(4,("spoolss_io_r_getprinterdriver2, buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + DEBUG(4,("spoolss_io_r_getprinterdriver2, buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + + beginning=prs_offset(ps); + start_offset=prs_offset(ps); + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 1: + { + smb_io_printer_driver_info_1(desc, + info1, + ps, + depth, + &start_offset, + &end_offset); + break; + } + case 2: + { + smb_io_printer_driver_info_2(desc, + info2, + ps, + depth, + &start_offset, + &end_offset); + break; + } + case 3: + { + smb_io_printer_driver_info_3(desc, + info3, + ps, + depth, + &start_offset, + &end_offset); + break; + } + + } + + prs_set_offset(ps, beginning+r_u->offered); + prs_align(ps); + } + + if (!ps->io) + { + /* writing */ + switch (r_u->level) + { + case 1: + { + safe_free(info1); + break; + } + case 2: + { + safe_free(info2); + break; + } + case 3: + { + if (info3!=NULL) + { + UNISTR **dependentfiles; + int j=0; + dependentfiles=info3->dependentfiles; + while ( dependentfiles[j] != NULL ) + { + free(dependentfiles[j]); + j++; + } + free(dependentfiles); + + free(info3); + } + break; + } + + } + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("pipo", ps, depth, &pipo); + prs_uint32("pipo", ps, depth, &pipo); + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* + * make a structure. + ********************************************************************/ +BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, + uint32 flags, + const char* servername, + uint32 level, + uint32 size) +{ + size_t len_name = servername != NULL ? strlen(servername) : 0; + + DEBUG(5,("make_spoolss_q_enumprinters. size: %d\n", size)); + + q_u->flags = flags; + + init_unistr2(&q_u->servername, servername, len_name); + + q_u->level = level; + make_spoolss_buffer(&q_u->buffer, size); + q_u->buf_size = size; + + return True; +} + +/******************************************************************* + * read a structure. + * called from spoolss_enumprinters (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, + prs_struct *ps, int depth) +{ + uint32 useless_ptr = 0x01; + prs_debug(ps, depth, desc, "spoolss_io_q_enumprinters"); + depth++; + + prs_align(ps); + + prs_uint32("flags", ps, depth, &(q_u->flags)); + prs_uint32("useless ptr", ps, depth, &useless_ptr); + + smb_io_unistr2("", &q_u->servername,True,ps,depth); + prs_align(ps); + + prs_uint32("level", ps, depth, &(q_u->level)); + + spoolss_io_read_buffer("buffer", ps, depth, &(q_u->buffer)); + + prs_uint32("buf_size", ps, depth, &q_u->buf_size); + + return True; +} + +/**************************************************************************** +****************************************************************************/ +void free_r_enumprinters(SPOOL_R_ENUMPRINTERS *r_u) +{ + DEBUG(4,("free_enum_printers_info: [%d] structs to free at level [%d]\n", r_u->returned, r_u->level)); + switch (r_u->level) + { + case 1: + { + free_print1_array(r_u->returned, r_u->ctr.printer.printers_1); + break; + } + case 2: + { + free_print2_array(r_u->returned, r_u->ctr.printer.printers_2); + break; + } + } +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_enum_printers (srv_spoolss.c) + * + ********************************************************************/ +BOOL spoolss_io_r_enumprinters(char *desc, + SPOOL_R_ENUMPRINTERS *r_u, + prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + int i; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + uint32 tmp_ct = 0; + + PRINTER_INFO_1 *info1; + PRINTER_INFO_2 *info2; + fstring tmp; + + slprintf(tmp, sizeof(tmp)-1, "spoolss_io_r_enumprinters %d", r_u->level); + + prs_debug(ps, depth, desc, tmp); + depth++; + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + + if (!ps->io) + { + /* writing */ + for(i=0;ireturned;i++) + { + switch (r_u->level) + { + case 1: + info1 = r_u->ctr.printer.printers_1[i]; + bufsize_required += spoolss_size_printer_info_1(info1); + break; + case 2: + info2 = r_u->ctr.printer.printers_2[i]; + bufsize_required += spoolss_size_printer_info_2(info2); + break; + } + } + + DEBUG(4,("spoolss_io_r_enumprinters, size needed: %d\n",bufsize_required)); + DEBUG(4,("spoolss_io_r_enumprinters, size offered: %d\n",r_u->offered)); + + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; + r_u->offered=0; + /*r_u->returned=0;*/ + + DEBUG(4,("spoolss_io_r_enumprinters, buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("count", ps, depth, &(r_u->returned)); + prs_uint32("status", ps, depth, &(r_u->status)); + return False; + } + + DEBUG(4,("spoolss_io_r_enumprinters, buffer large enough\n")); + } + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + + /* have to skip to end of buffer when reading, and have to record + * size of buffer when writing. *shudder*. + */ + + beginning = prs_offset(ps); + start_offset = prs_offset(ps); + end_offset = start_offset + r_u->offered; + + if (ps->io) + { + /* reading */ + prs_set_offset(ps, beginning + r_u->offered); + + prs_align(ps); + prs_uint32("buffer size", ps, depth, &(bufsize_required)); + prs_uint32("count", ps, depth, &(r_u->returned)); + + prs_set_offset(ps, beginning); + } + + for(i=0;ireturned;i++) + { + + switch (r_u->level) + { + case 1: + { + if (ps->io) + { + /* reading */ +/* r_u->ctr.printer.printers_1[i] = add_print1_to_array(&tmp_ct, &r_u->ctr.printer.printers_1, NULL);*/ + } + info1 = r_u->ctr.printer.printers_1[i]; + if (info1 == NULL) + { + return False; + } + smb_io_printer_info_1(desc, info1, ps, depth, + &start_offset, &end_offset); + break; + } + case 2: + { + if (ps->io) + { + /* reading */ +/* + r_u->ctr.printer.printers_2[i] = add_print2_to_array(&tmp_ct, &r_u->ctr.printer.printers_2, NULL); +*/ } + info2 = r_u->ctr.printer.printers_2[i]; + if (info2 == NULL) + { + return False; + } + smb_io_printer_info_2(desc, info2, ps, depth, + &start_offset, &end_offset); + break; + } + } + } + + prs_set_offset(ps, beginning + r_u->offered); + prs_align(ps); + + prs_uint32("buffer size", ps, depth, &(bufsize_required)); + prs_uint32("count", ps, depth, &(r_u->returned)); + prs_uint32("status", ps, depth, &(r_u->status)); + + if (!ps->io) + { + /* writing */ + free_r_enumprinters(r_u); + } + + return True; +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_enum_printers (srv_spoolss.c) + * + ********************************************************************/ +BOOL spoolss_io_r_getprinter(char *desc, + SPOOL_R_GETPRINTER *r_u, + prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + + prs_debug(ps, depth, desc, "spoolss_io_r_getprinter"); + depth++; + + prs_align(ps); + + prs_uint32("pointer", ps, depth, &useless_ptr); + + switch (r_u->level) + { + case 0: + { + PRINTER_INFO_0 *info; + info = r_u->ctr.printer.info0; + bufsize_required += spoolss_size_printer_info_0(info); + break; + } + case 1: + { + PRINTER_INFO_1 *info; + info = r_u->ctr.printer.info1; + bufsize_required += spoolss_size_printer_info_1(info); + break; + } + case 2: + { + PRINTER_INFO_2 *info; + info = r_u->ctr.printer.info2; + bufsize_required += spoolss_size_printer_info_2(info); + break; + } + } + + DEBUG(4,("spoolss_io_r_getprinter, size needed: %d\n",bufsize_required)); + DEBUG(4,("spoolss_io_r_getprinter, size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + if (r_u->offered < bufsize_required) + { + /* it's too small */ + r_u->status = ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered = 0; /* don't send back the buffer */ + + DEBUG(4,("spoolss_io_r_getprinter, buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + DEBUG(4,("spoolss_io_r_getprinter, buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + + if (ps->io) + { + /* reading */ + r_u->ctr.printer.info = Realloc(NULL, r_u->offered); + } + + if (bufsize_required <= r_u->offered) + { + beginning=prs_offset(ps); + start_offset=prs_offset(ps); + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 0: + { + PRINTER_INFO_0 *info; + info = r_u->ctr.printer.info0; + smb_io_printer_info_0(desc, + info, + ps, + depth, + &start_offset, + &end_offset); + if (!ps->io) + { + /* writing */ + free(info); + } + break; + } + case 1: + { + PRINTER_INFO_1 *info; + info = r_u->ctr.printer.info1; + smb_io_printer_info_1(desc, + info, + ps, + depth, + &start_offset, + &end_offset); + if (!ps->io) + { + /* writing */ + free(info); + } + break; + } + case 2: + { + PRINTER_INFO_2 *info; + info = r_u->ctr.printer.info2; + smb_io_printer_info_2(desc, + info, + ps, + depth, + &start_offset, + &end_offset); + if (!ps->io) + { + /* writing */ + free_printer_info_2(info); + } + break; + } + + } + + prs_set_offset(ps, beginning+r_u->offered); + prs_align(ps); + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* + * read a uint8 buffer of size *size. + * allocate memory for it + * return a pointer to the allocated memory and the size + * return NULL and a size of 0 if the buffer is empty + * + * jfmxxxx: fix it to also write a buffer + ********************************************************************/ +static BOOL spoolss_io_read_buffer8(char *desc, prs_struct *ps, uint8 **buffer, uint32 *size,int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_read_buffer8"); + depth++; + + prs_align(ps); + + prs_uint32("buffer size", ps, depth, size); + *buffer = (uint8 *)Realloc(NULL, (*size) * sizeof(uint8) ); + prs_uint8s(True,"buffer",ps,depth,*buffer,*size); + prs_align(ps); + + return True; +} + +/******************************************************************* + * make a structure. + * called from spoolss_getprinter (srv_spoolss.c) + ********************************************************************/ +BOOL make_spoolss_q_getprinter(SPOOL_Q_GETPRINTER *q_u, + POLICY_HND *hnd, + uint32 level, + uint32 buf_size) +{ + if (q_u == NULL) return False; + + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + + q_u->level = level; + q_u->buffer = (uint8 *)Realloc(NULL, (buf_size) * sizeof(uint8) ); + q_u->offered = buf_size; + + return True; +} + +/******************************************************************* + * read a structure. + * called from spoolss_getprinter (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, + prs_struct *ps, int depth) +{ + uint32 count = 0; + uint32 buf_ptr = q_u->buffer != NULL ? 1 : 0; + prs_debug(ps, depth, desc, "spoolss_io_q_getprinter"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + + prs_uint32("level", ps, depth, &(q_u->level)); + + if (!ps->io) + { + /* writing */ + buf_ptr = q_u->buffer != NULL ? 1 : 0; + } + prs_uint32("buffer pointer", ps, depth, &buf_ptr); + + if (buf_ptr != 0) + { + spoolss_io_read_buffer8("",ps, &q_u->buffer, &count,depth); + } + if (q_u->buffer != NULL) + { + free(q_u->buffer); + } + prs_uint32("buffer size", ps, depth, &(q_u->offered)); + + return count == q_u->offered; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_setprinter"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_setprinter"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle", &(q_u->handle),ps,depth); + prs_uint32("level", ps, depth, &(q_u->level)); + + /* again a designed mess */ + /* sometimes I'm wondering how all of this work ! */ + + /* To be correct it need to be split in 3 functions */ + + spool_io_printer_info_level("", &(q_u->info), ps, depth); + + spoolss_io_devmode(desc, ps, depth, q_u->devmode); + + prs_uint32("security.size_of_buffer", ps, depth, &(q_u->security.size_of_buffer)); + prs_uint32("security.data", ps, depth, &(q_u->security.data)); + + prs_uint32("command", ps, depth, &(q_u->command)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_fcpn(char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_fcpn"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_fcpn(char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) +{ + + prs_debug(ps, depth, desc, "spoolss_io_q_fcpn"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + + return True; +} + + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int depth) +{ + + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("level", ps, depth, &(q_u->level)); + + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + + prs_align(ps); + + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; +} + +/**************************************************************************** +****************************************************************************/ +void free_job_info_ctr(JOB_INFO_CTR *ctr, uint32 level, uint32 numofjobs) +{ + DEBUG(4,("free_enum_jobs_info: [%d] structs to free at level [%d]\n", + numofjobs, level)); + switch (level) + { + case 1: + { + free_job1_array(numofjobs, + ctr->job.job_info_1); + break; + } + case 2: + { + free_job2_array(numofjobs, + ctr->job.job_info_2); + break; + } + } +} + +/**************************************************************************** +****************************************************************************/ +void free_r_enumjobs(SPOOL_R_ENUMJOBS *r_u) +{ + free_job_info_ctr(&r_u->ctr, r_u->level, r_u->numofjobs); +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr = 0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + uint32 tmp_ct = 0; + int i; + + prs_debug(ps, depth, desc, "spoolss_io_r_enumjobs"); + depth++; + + prs_align(ps); + + if (!ps->io) + { + /* writing */ + switch (r_u->level) + { + case 1: + { + for (i=0; inumofjobs; i++) + { + JOB_INFO_1 *info; + info=r_u->ctr.job.job_info_1[i]; + bufsize_required += spoolss_size_job_info_1(&(info[i])); + } + break; + } + case 2: + { + for (i=0; inumofjobs; i++) + { + JOB_INFO_2 *info; + info=r_u->ctr.job.job_info_2[i]; + + bufsize_required += spoolss_size_job_info_2(&(info[i])); + } + break; + } + } + + DEBUG(4,("spoolss_io_r_enumjobs, size needed: %d\n", + bufsize_required)); + DEBUG(4,("spoolss_io_r_enumjobs, size offered: %d\n", + r_u->offered)); + + /* check if the buffer is big enough for the datas */ + if (r_u->offeredstatus = ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered = bufsize_required; + useless_ptr = 0; + + DEBUG(4,("spoolss_io_r_enumjobs, buffer too small\n")); + + } + else + { + useless_ptr = 1; + } + } + + prs_uint32("pointer", ps, depth, &useless_ptr); + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + + if (useless_ptr != 0) + { + beginning=prs_offset(ps); + start_offset=prs_offset(ps); + end_offset=start_offset+r_u->offered; + + tmp_ct = 0; + + if (ps->io) + { + /* reading */ + prs_set_offset(ps, beginning + r_u->offered); + + prs_align(ps); + prs_uint32("buffer size", ps, depth, &(bufsize_required)); + prs_uint32("numofjobs", ps, depth, &(r_u->numofjobs)); + + prs_set_offset(ps, beginning); + } + + switch (r_u->level) + { + case 1: + { + JOB_INFO_1 *info; + for (i=0; inumofjobs; i++) + { + if (ps->io) + { + /* reading */ +/* r_u->ctr.job.job_info_1[i] = add_job1_to_array(&tmp_ct, &r_u->ctr.job.job_info_1, NULL);*/ + } + info = r_u->ctr.job.job_info_1[i]; + smb_io_job_info_1(desc, + info, + ps, + depth, + &start_offset, + &end_offset); + } + break; + } + case 2: + { + JOB_INFO_2 *info; + for (i=0; inumofjobs; i++) + { + if (ps->io) + { + /* reading */ +/* r_u->ctr.job.job_info_2[i] = add_job2_to_array(&tmp_ct, &r_u->ctr.job.job_info_2, NULL);*/ + } + info = r_u->ctr.job.job_info_2[i]; + smb_io_job_info_2(desc, + info, + ps, + depth, + &start_offset, + &end_offset); + } + break; + } + + } + prs_set_offset(ps, beginning+r_u->offered); + prs_align(ps); + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("buffer size", ps, depth, &(bufsize_required)); + } + + prs_uint32("numofjobs", ps, depth, &(r_u->numofjobs)); + prs_uint32("status", ps, depth, &(r_u->status)); + + if (!ps->io) + { + /* writing */ + free_r_enumjobs(r_u); + } + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd, + uint32 firstjob, + uint32 numofjobs, + uint32 level, + uint32 buf_size) +{ + if (q_u == NULL) + { + return False; + } + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + q_u->firstjob = firstjob; + q_u->numofjobs = numofjobs; + q_u->level = level; + + if (!make_spoolss_buffer(&q_u->buffer, buf_size)) + { + return False; + } + q_u->buf_size = buf_size; + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_enumjobs"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("firstjob", ps, depth, &(q_u->firstjob)); + prs_uint32("numofjobs", ps, depth, &(q_u->numofjobs)); + prs_uint32("level", ps, depth, &(q_u->level)); + + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_schedulejob(char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_schedulejob"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_schedulejob(char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_schedulejob"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("jobid", ps, depth, &(q_u->jobid)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_setjob(char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_setjob"); + depth++; + + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_setjob"); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("jobid", ps, depth, &(q_u->jobid)); + /* + * level is usually 0. If (level!=0) then I'm in trouble ! + * I will try to generate setjob command with level!=0, one day. + */ + prs_uint32("level", ps, depth, &(q_u->level)); + prs_uint32("command", ps, depth, &(q_u->command)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_enumdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + int i; + + prs_debug(ps, depth, desc, "spoolss_io_r_enumdrivers"); + depth++; + + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + + DEBUG(7,("Level [%d], number [%d]\n", r_u->level, r_u->numofdrivers)); + switch (r_u->level) + { + case 1: + { + DRIVER_INFO_1 *driver_info_1; + driver_info_1=r_u->ctr.driver.info1; + + for (i=0; inumofdrivers; i++) + { + bufsize_required += spoolss_size_printer_driver_info_1(&(driver_info_1[i])); + } + break; + } + case 2: + { + DRIVER_INFO_2 *driver_info_2; + driver_info_2=r_u->ctr.driver.info2; + + for (i=0; inumofdrivers; i++) + { + bufsize_required += spoolss_size_printer_driver_info_2(&(driver_info_2[i])); + } + break; + } + case 3: + { + DRIVER_INFO_3 *driver_info_3; + driver_info_3=r_u->ctr.driver.info3; + + for (i=0; inumofdrivers; i++) + { + bufsize_required += spoolss_size_printer_driver_info_3(&(driver_info_3[i])); + } + break; + } + } + + DEBUGADD(7,("size needed: %d\n",bufsize_required)); + DEBUGADD(7,("size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ + DEBUGADD(8,("buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + DEBUGADD(8,("buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + beginning=prs_offset(ps); + start_offset=prs_offset(ps); + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 1: + { + DRIVER_INFO_1 *info; + for (i=0; inumofdrivers; i++) + { + info = &(r_u->ctr.driver.info1[i]); + smb_io_printer_driver_info_1(desc, info, ps, depth, &start_offset, &end_offset); + } + break; + } + case 2: + { + DRIVER_INFO_2 *info; + for (i=0; inumofdrivers; i++) + { + info = &(r_u->ctr.driver.info2[i]); + smb_io_printer_driver_info_2(desc, info, ps, depth, &start_offset, &end_offset); + } + break; + } + case 3: + { + DRIVER_INFO_3 *info; + for (i=0; inumofdrivers; i++) + { + info = &(r_u->ctr.driver.info3[i]); + smb_io_printer_driver_info_3(desc, info, ps, depth, &start_offset, &end_offset); + } + break; + } + } + prs_set_offset(ps, beginning+r_u->offered); + prs_align(ps); + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("numofdrivers", ps, depth, &(r_u->numofdrivers)); + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + + +void free_spoolss_r_enumdrivers(SPOOL_R_ENUMPRINTERDRIVERS *r_u) +{ + switch (r_u->level) + { + case 1: + { + DRIVER_INFO_1 *driver_info_1; + driver_info_1=r_u->ctr.driver.info1; + + free(driver_info_1); + break; + } + case 2: + { + DRIVER_INFO_2 *driver_info_2; + driver_info_2=r_u->ctr.driver.info2; + + free(driver_info_2); + break; + } + case 3: + { + DRIVER_INFO_3 *driver_info_3; + + UNISTR **dependentfiles; + int i; + + driver_info_3=r_u->ctr.driver.info3; + + for (i=0; inumofdrivers; i++) + { + int j=0; + dependentfiles=(driver_info_3[i]).dependentfiles; + while ( dependentfiles[j] != NULL ) + { + free(dependentfiles[j]); + j++; + } + + free(dependentfiles); + } + free(driver_info_3); + break; + } + } +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth) +{ + + uint32 useless_ptr=0xADDE0FF0; + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + smb_io_unistr2("", &(q_u->name),True,ps,depth); + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + smb_io_unistr2("", &(q_u->environment),True,ps,depth); + prs_align(ps); + prs_uint32("level", ps, depth, &(q_u->level)); + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + prs_align(ps); + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, int depth) +{ + + prs_debug(ps, depth, desc, "spoolss_io_q_enumforms"); + depth++; + + if (!prs_align(ps)) + return False; + if (!smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth)) + return False; + if (!prs_uint32("level", ps, depth, &(q_u->level))) + return False; + + if (!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + return False; + + if (!prs_align(ps)) + return False; + if (!prs_uint32("offered", ps, depth, &(q_u->offered))) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL new_spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "new_spoolss_io_r_enumforms"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + return False; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("size of buffer needed", ps, depth, &(r_u->needed))) + return False; + + if (!prs_uint32("numofforms", ps, depth, &(r_u->numofforms))) + return False; + + if (!prs_uint32("status", ps, depth, &(r_u->status))) + return False; + + return True; + +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + int i; + + prs_debug(ps, depth, desc, "spoolss_io_r_enumports"); + depth++; + + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + switch (r_u->level) + { + case 2: + { + PORT_INFO_2 *port_2; + port_2=r_u->ctr.port.info_2; + + for (i=0; inumofports; i++) + { + bufsize_required += spoolss_size_port_info_2(&(port_2[i])); + } + break; + } + } + + DEBUG(4,("size needed: %d\n",bufsize_required)); + DEBUG(4,("size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ + + DEBUG(4,("buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + DEBUG(4,("buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + beginning=prs_offset(ps); + start_offset=prs_offset(ps); + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 2: + { + PORT_INFO_2 *info; + for (i=0; inumofports; i++) + { + info = &(r_u->ctr.port.info_2[i]); + smb_io_port_2(desc, info, ps, depth, &start_offset, &end_offset); + } + break; + } + } + prs_set_offset(ps, beginning+r_u->offered); + prs_align(ps); + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("numofports", ps, depth, &(r_u->numofports)); + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +void spoolss_free_r_enumports(SPOOL_R_ENUMPORTS *r_u) +{ + switch (r_u->level) + { + case 2: + { + safe_free(r_u->ctr.port.info_2); + break; + } + } +} +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth) +{ + uint32 useless; + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + prs_uint32("useless", ps, depth, &useless); + smb_io_unistr2("", &(q_u->name),True,ps,depth); + prs_align(ps); + prs_uint32("level", ps, depth, &(q_u->level)); + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + prs_align(ps); + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; +} + + +/******************************************************************* +********************************************************************/ +BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 **q_u, prs_struct *ps, int depth) +{ + SPOOL_PRINTER_INFO_LEVEL_2 *il; + + prs_debug(ps, depth, desc, ""); + depth++; + + /* reading */ + if (ps->io) + { + il=(SPOOL_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2)); + ZERO_STRUCTP(il); + *q_u=il; + DEBUG(7,("lecture: memoire ok\n")); + } + else + { + il=*q_u; + } + + prs_align(ps); + + prs_uint32("servername_ptr", ps, depth, &(il->servername_ptr)); + prs_uint32("printername_ptr", ps, depth, &(il->printername_ptr)); + prs_uint32("sharename_ptr", ps, depth, &(il->sharename_ptr)); + prs_uint32("portname_ptr", ps, depth, &(il->portname_ptr)); + prs_uint32("drivername_ptr", ps, depth, &(il->drivername_ptr)); + prs_uint32("comment_ptr", ps, depth, &(il->comment_ptr)); + prs_uint32("location_ptr", ps, depth, &(il->location_ptr)); + prs_uint32("devmode_ptr", ps, depth, &(il->devmode_ptr)); + prs_uint32("sepfile_ptr", ps, depth, &(il->sepfile_ptr)); + prs_uint32("printprocessor_ptr", ps, depth, &(il->printprocessor_ptr)); + prs_uint32("datatype_ptr", ps, depth, &(il->datatype_ptr)); + prs_uint32("parameters_ptr", ps, depth, &(il->parameters_ptr)); + prs_uint32("secdesc_ptr", ps, depth, &(il->secdesc_ptr)); + + prs_uint32("attributes", ps, depth, &(il->attributes)); + prs_uint32("priority", ps, depth, &(il->priority)); + prs_uint32("default_priority", ps, depth, &(il->default_priority)); + prs_uint32("starttime", ps, depth, &(il->starttime)); + prs_uint32("untiltime", ps, depth, &(il->untiltime)); + prs_uint32("status", ps, depth, &(il->status)); + prs_uint32("cjobs", ps, depth, &(il->cjobs)); + prs_uint32("averageppm", ps, depth, &(il->averageppm)); + + smb_io_unistr2("", &(il->servername), il->servername_ptr, ps, depth); + smb_io_unistr2("", &(il->printername), il->printername_ptr, ps, depth); + smb_io_unistr2("", &(il->sharename), il->sharename_ptr, ps, depth); + smb_io_unistr2("", &(il->portname), il->portname_ptr, ps, depth); + smb_io_unistr2("", &(il->drivername), il->drivername_ptr, ps, depth); + smb_io_unistr2("", &(il->comment), il->comment_ptr, ps, depth); + smb_io_unistr2("", &(il->location), il->location_ptr, ps, depth); + smb_io_unistr2("", &(il->sepfile), il->sepfile_ptr, ps, depth); + smb_io_unistr2("", &(il->printprocessor), il->printprocessor_ptr, ps, depth); + smb_io_unistr2("", &(il->datatype), il->datatype_ptr, ps, depth); + smb_io_unistr2("", &(il->parameters), il->parameters_ptr, ps, depth); + + prs_align(ps); + + /* this code as nothing to do here !!! + + if (il->secdesc_ptr) + { + il->secdesc=NULL; + sec_io_desc_buf("", &(il->secdesc), ps, depth); + } + + */ + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth) +{ + uint32 useless; + uint32 level; + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + prs_uint32("info level", ps, depth, &level); + prs_uint32("useless", ps, depth, &useless); + + switch (level) + { + /* + * level 0 is used by setprinter when managing the queue + * (hold, stop, start a queue) + */ + case 0: + break; + /* + * level 2 is used by addprinter + * and by setprinter when updating printer's info + */ + case 2: + spool_io_printer_info_level_2("", &(il->info_2), ps, depth); + break; + } + + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth) +{ + uint32 useless; + prs_debug(ps, depth, desc, "spoolss_io_q_addprinterex"); + depth++; + + /* + * I think that's one of the few well written functions. + * the sub-structures are correctly parsed and analysed + * the info level are handled in a nice way. + */ + + prs_align(ps); + prs_uint32("useless", ps, depth, &useless); + smb_io_unistr2("", &(q_u->server_name),True,ps,depth); + prs_align(ps); + + prs_uint32("info_level", ps, depth, &(q_u->level)); + + spool_io_printer_info_level("", &(q_u->info), ps, depth); + + /* the 4 unknown are all 0 */ + + /* + * en fait ils sont pas inconnu + * par recoupement avec rpcSetPrinter + * c'est le devicemode + * et le security descriptor. + */ + + prs_uint32("unk0", ps, depth, &(q_u->unk0)); + prs_uint32("unk1", ps, depth, &(q_u->unk1)); + prs_uint32("unk2", ps, depth, &(q_u->unk2)); + prs_uint32("unk3", ps, depth, &(q_u->unk3)); + + prs_uint32("info_level", ps, depth, &(q_u->user_level)); + + spool_io_user_level("", &(q_u->user), ps, depth); + + return True; +} + + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_addprinterex"); + depth++; + + smb_io_prt_hnd("printer handle",&(r_u->handle),ps,depth); + + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, + prs_struct *ps, int depth) +{ + SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *il; + + prs_debug(ps, depth, desc, ""); + depth++; + + /* reading */ + if (ps->io) + { + il=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *)malloc(sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); + ZERO_STRUCTP(il); + *q_u=il; + DEBUG(1,("lecture: memoire ok\n")); + } + else + { + il=*q_u; + } + + prs_align(ps); + + prs_uint32("cversion", ps, depth, &(il->cversion)); + prs_uint32("name", ps, depth, &(il->name_ptr)); + prs_uint32("environment", ps, depth, &(il->environment_ptr)); + prs_uint32("driverpath", ps, depth, &(il->driverpath_ptr)); + prs_uint32("datafile", ps, depth, &(il->datafile_ptr)); + prs_uint32("configfile", ps, depth, &(il->configfile_ptr)); + prs_uint32("helpfile", ps, depth, &(il->helpfile_ptr)); + prs_uint32("monitorname", ps, depth, &(il->monitorname_ptr)); + prs_uint32("defaultdatatype", ps, depth, &(il->defaultdatatype_ptr)); + prs_uint32("dependentfilessize", ps, depth, &(il->dependentfilessize)); + prs_uint32("dependentfiles", ps, depth, &(il->dependentfiles_ptr)); + + prs_align(ps); + + smb_io_unistr2("", &(il->name), il->name_ptr, ps, depth); + smb_io_unistr2("", &(il->environment), il->environment_ptr, ps, depth); + smb_io_unistr2("", &(il->driverpath), il->driverpath_ptr, ps, depth); + smb_io_unistr2("", &(il->datafile), il->datafile_ptr, ps, depth); + smb_io_unistr2("", &(il->configfile), il->configfile_ptr, ps, depth); + smb_io_unistr2("", &(il->helpfile), il->helpfile_ptr, ps, depth); + smb_io_unistr2("", &(il->monitorname), il->monitorname_ptr, ps, depth); + smb_io_unistr2("", &(il->defaultdatatype), il->defaultdatatype_ptr, ps, depth); + + prs_align(ps); + if (il->dependentfiles_ptr) + smb_io_buffer5("", &(il->dependentfiles), ps, depth); + + + return True; +} + + +/******************************************************************* + convert a buffer of UNICODE strings null terminated + the buffer is terminated by a NULL + + convert to an ascii array (null terminated) + + dynamically allocate memory + +********************************************************************/ +BOOL uniarray_2_ascarray(BUFFER5 *buf5, char ***ar) +{ + char **array; + char *string; + char *destend; + char *dest; + uint32 n; + uint32 i; + + uint16 *src; + + if (buf5==NULL) return False; + + array=NULL; + n=0; + i=0; + src=buf5->buffer; + + string=(char *)malloc(sizeof(char)*buf5->buf_len); + + destend = string + buf5->buf_len; + dest=string; + + while (dest < destend) + { + *(dest++) = (char)*(src++); + } + + /* that ugly for the first one but that's working */ + array=(char **)Realloc(array, sizeof(char *)*(i+1)); + array[i++]=string; + + while ( n < buf5->buf_len ) + { + if ( *(string++) == '\0' ) + { + array=(char **)Realloc(array, sizeof(char *)*(i+1)); + array[i++]=string; + } + n++; + } + *ar=array; + + DEBUG(10,("Number of dependent files: [%d]\n", i-1)); + + return True; +} + +/******************************************************************* + read a UNICODE array with null terminated strings + and null terminated array + and size of array at beginning +********************************************************************/ +BOOL smb_io_unibuffer(char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) +{ + if (buffer==NULL) return False; + + buffer->undoc=0; + buffer->uni_str_len=buffer->uni_max_len; + + prs_uint32("buffer_size", ps, depth, &(buffer->uni_max_len)); + + prs_unistr2(True, "buffer ", ps, depth, buffer); + + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth) +{ + uint32 useless; + uint32 level; + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + prs_uint32("info level", ps, depth, &level); + prs_uint32("useless", ps, depth, &useless); + + switch (level) + { + case 3: + spool_io_printer_driver_info_level_3("", &(il->info_3), ps, depth); + break; + } + + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) +{ + uint32 useless; + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + prs_uint32("useless", ps, depth, &useless); + smb_io_unistr2("", &(q_u->server_name),True,ps,depth); + prs_align(ps); + prs_uint32("info_level", ps, depth, &(q_u->level)); + + spool_io_printer_driver_info_level("", &(q_u->info), ps, depth); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_addprinterdriver(char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, ""); + depth++; + + prs_uint32("status", ps, depth, &(q_u->status)); + + return True; +} + + +/******************************************************************* +********************************************************************/ +BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, + NT_PRINTER_DRIVER_INFO_LEVEL_3 **asc) +{ + NT_PRINTER_DRIVER_INFO_LEVEL_3 *d; + + DEBUG(7,("uni_2_asc_printer_driver_3: Converting from UNICODE to ASCII\n")); + + if (*asc==NULL) + { + *asc=(NT_PRINTER_DRIVER_INFO_LEVEL_3 *)malloc(sizeof(NT_PRINTER_DRIVER_INFO_LEVEL_3)); + ZERO_STRUCTP(*asc); + } + + d=*asc; + + d->cversion=uni->cversion; + + unistr2_to_ascii(d->name, &(uni->name), sizeof(d->name)-1); + unistr2_to_ascii(d->environment, &(uni->environment), sizeof(d->environment)-1); + unistr2_to_ascii(d->driverpath, &(uni->driverpath), sizeof(d->driverpath)-1); + unistr2_to_ascii(d->datafile, &(uni->datafile), sizeof(d->datafile)-1); + unistr2_to_ascii(d->configfile, &(uni->configfile), sizeof(d->configfile)-1); + unistr2_to_ascii(d->helpfile, &(uni->helpfile), sizeof(d->helpfile)-1); + unistr2_to_ascii(d->monitorname, &(uni->monitorname), sizeof(d->monitorname)-1); + unistr2_to_ascii(d->defaultdatatype, &(uni->defaultdatatype), sizeof(d->defaultdatatype)-1); + + DEBUGADD(8,( "version: %d\n", d->cversion)); + DEBUGADD(8,( "name: %s\n", d->name)); + DEBUGADD(8,( "environment: %s\n", d->environment)); + DEBUGADD(8,( "driverpath: %s\n", d->driverpath)); + DEBUGADD(8,( "datafile: %s\n", d->datafile)); + DEBUGADD(8,( "configfile: %s\n", d->configfile)); + DEBUGADD(8,( "helpfile: %s\n", d->helpfile)); + DEBUGADD(8,( "monitorname: %s\n", d->monitorname)); + DEBUGADD(8,( "defaultdatatype: %s\n", d->defaultdatatype)); + + uniarray_2_ascarray(&(uni->dependentfiles), &(d->dependentfiles) ); + + return True; +} + +BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, + NT_PRINTER_INFO_LEVEL_2 **asc) +{ + NT_PRINTER_INFO_LEVEL_2 *d; + + DEBUG(7,("Converting from UNICODE to ASCII\n")); + + if (*asc==NULL) + { + DEBUGADD(8,("allocating memory\n")); + + *asc=(NT_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(NT_PRINTER_INFO_LEVEL_2)); + ZERO_STRUCTP(*asc); + } + DEBUGADD(8,("start converting\n")); + + d=*asc; + + d->attributes=uni->attributes; + d->priority=uni->priority; + d->default_priority=uni->default_priority; + d->starttime=uni->starttime; + d->untiltime=uni->untiltime; + d->status=uni->status; + d->cjobs=uni->cjobs; + + unistr2_to_ascii(d->servername, &(uni->servername), sizeof(d->servername)-1); + unistr2_to_ascii(d->printername, &(uni->printername), sizeof(d->printername)-1); + unistr2_to_ascii(d->sharename, &(uni->sharename), sizeof(d->sharename)-1); + unistr2_to_ascii(d->portname, &(uni->portname), sizeof(d->portname)-1); + unistr2_to_ascii(d->drivername, &(uni->drivername), sizeof(d->drivername)-1); + unistr2_to_ascii(d->comment, &(uni->comment), sizeof(d->comment)-1); + unistr2_to_ascii(d->location, &(uni->location), sizeof(d->location)-1); + unistr2_to_ascii(d->sepfile, &(uni->sepfile), sizeof(d->sepfile)-1); + unistr2_to_ascii(d->printprocessor, &(uni->printprocessor), sizeof(d->printprocessor)-1); + unistr2_to_ascii(d->datatype, &(uni->datatype), sizeof(d->datatype)-1); + unistr2_to_ascii(d->parameters, &(uni->parameters), sizeof(d->parameters)-1); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + + prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriverdir"); + depth++; + + prs_align(ps); + + prs_uint32("pointer", ps, depth, &useless_ptr); + + switch (r_u->level) + { + case 1: + { + DRIVER_DIRECTORY_1 *driver_info_1; + driver_info_1=&(r_u->ctr.driver.info_1); + + bufsize_required = size_of_relative_string(&(driver_info_1->name)); + break; + } + } + + DEBUG(4,("spoolss_io_r_getprinterdriverdir, size needed: %d\n",bufsize_required)); + DEBUG(4,("spoolss_io_r_getprinterdriverdir, size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ + DEBUG(4,("spoolss_io_r_getprinterdriverdir, buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + DEBUG(4,("spoolss_io_r_getprinterdriverdir, buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + beginning=prs_offset(ps); + start_offset=prs_offset(ps); + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 1: + { + DRIVER_DIRECTORY_1 *info; + info = &(r_u->ctr.driver.info_1); + prs_unistr("name", ps, depth, &(info->name)); + /*smb_io_printer_driver_dir_1(desc, info, ps, depth, &start_offset, &end_offset);*/ + break; + } + } + prs_set_offset(ps, beginning+r_u->offered); + prs_align(ps); + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, prs_struct *ps, int depth) +{ + + uint32 useless_ptr=0xADDE0FF0; + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + smb_io_unistr2("", &(q_u->name),True,ps,depth); + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + smb_io_unistr2("", &(q_u->environment),True,ps,depth); + prs_align(ps); + prs_uint32("level", ps, depth, &(q_u->level)); + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + prs_align(ps); + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + int i; + + prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocessors"); + depth++; + + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + switch (r_u->level) + { + case 1: + { + PRINTPROCESSOR_1 *info_1; + info_1=r_u->info_1; + + for (i=0; inumofprintprocessors; i++) + { + bufsize_required += spoolss_size_processor_info_1(&(info_1[i])); + } + break; + } + } + + DEBUG(4,("size needed: %d\n",bufsize_required)); + DEBUG(4,("size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ + + DEBUG(4,("buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + DEBUG(4,("buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + beginning=prs_offset(ps); + start_offset=prs_offset(ps); + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 1: + { + PRINTPROCESSOR_1 *info_1; + for (i=0; inumofprintprocessors; i++) + { + info_1 = &(r_u->info_1[i]); + smb_io_processor_info_1(desc, info_1, ps, depth, &start_offset, &end_offset); + } + break; + } + } + prs_set_offset(ps, beginning+r_u->offered); + prs_align(ps); + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("numofprintprocessors", ps, depth, &(r_u->numofprintprocessors)); + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, prs_struct *ps, int depth) +{ + uint32 useless; + prs_debug(ps, depth, desc, "spoolss_io_q_enumprintprocessors"); + depth++; + + prs_align(ps); + prs_uint32("useless", ps, depth, &useless); + smb_io_unistr2("", &(q_u->name),True,ps,depth); + prs_align(ps); + prs_uint32("useless", ps, depth, &useless); + smb_io_unistr2("", &(q_u->environment),True,ps,depth); + prs_align(ps); + prs_uint32("level", ps, depth, &(q_u->level)); + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + prs_align(ps); + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + int i; + + prs_debug(ps, depth, desc, "spoolss_io_r_enumprintmonitors"); + depth++; + + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); + switch (r_u->level) + { + case 1: + { + PRINTMONITOR_1 *info_1; + info_1=r_u->info_1; + + for (i=0; inumofprintmonitors; i++) + { + bufsize_required += spoolss_size_monitor_info_1(&(info_1[i])); + } + break; + } + } + + DEBUG(4,("size needed: %d\n",bufsize_required)); + DEBUG(4,("size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ + + DEBUG(4,("buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + DEBUG(4,("buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + beginning=prs_offset(ps); + start_offset=prs_offset(ps); + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 1: + { + PRINTMONITOR_1 *info_1; + for (i=0; inumofprintmonitors; i++) + { + info_1 = &(r_u->info_1[i]); + smb_io_monitor_info_1(desc, info_1, ps, depth, &start_offset, &end_offset); + } + break; + } + } + prs_set_offset(ps, beginning+r_u->offered); + prs_align(ps); + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("numofprintmonitors", ps, depth, &(r_u->numofprintmonitors)); + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_enumprintmonitors(char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth) +{ + uint32 useless; + prs_debug(ps, depth, desc, "spoolss_io_q_enumprintmonitors"); + depth++; + + prs_align(ps); + prs_uint32("useless", ps, depth, &useless); + smb_io_unistr2("", &(q_u->name),True,ps,depth); + prs_align(ps); + prs_uint32("level", ps, depth, &(q_u->level)); + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + prs_align(ps); + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdata"); + depth++; + + prs_align(ps); + prs_uint32("valuesize", ps, depth, &(r_u->valuesize)); + prs_unistr("value", ps, depth, &(r_u->value)); + prs_uint32("realvaluesize", ps, depth, &(r_u->realvaluesize)); + + prs_uint32("type", ps, depth, &(r_u->type)); + + prs_uint32("datasize", ps, depth, &(r_u->datasize)); + prs_uint8s(False, "data", ps, depth, r_u->data, r_u->datasize); + prs_uint32("realdatasize", ps, depth, &(r_u->realdatasize)); + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_enumprinterdata(char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdata"); + depth++; + + prs_align(ps); + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("index", ps, depth, &(q_u->index)); + prs_uint32("valuesize", ps, depth, &(q_u->valuesize)); + prs_uint32("datasize", ps, depth, &(q_u->datasize)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_setprinterdata"); + depth++; + + prs_align(ps); + smb_io_prt_hnd("printer handle", &(q_u->handle), ps, depth); + smb_io_unistr2("", &(q_u->value), True, ps, depth); + + prs_align(ps); + + prs_uint32("type", ps, depth, &(q_u->type)); + + prs_uint32("max_len", ps, depth, &(q_u->max_len)); + + switch (q_u->type) + { + case 0x1: + case 0x3: + case 0x4: + case 0x7: + q_u->data=(uint8 *)malloc(q_u->max_len * sizeof(uint8)); + prs_uint8s(False,"data", ps, depth, q_u->data, q_u->max_len); + prs_align(ps); + break; + } + + prs_uint32("real_len", ps, depth, &(q_u->real_len)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_setprinterdata"); + depth++; + + prs_align(ps); + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL convert_specific_param(NT_PRINTER_PARAM **param, const UNISTR2 *value, + uint32 type, const uint8 *data, uint32 len) +{ + DEBUG(5,("converting a specific param struct\n")); + + if (*param == NULL) + { + *param=(NT_PRINTER_PARAM *)malloc(sizeof(NT_PRINTER_PARAM)); + ZERO_STRUCTP(*param); + DEBUGADD(6,("Allocated a new PARAM struct\n")); + } + unistr2_to_ascii((*param)->value, value, sizeof((*param)->value)-1); + (*param)->type = type; + + /* le champ data n'est pas NULL termine */ + /* on stocke donc la longueur */ + + (*param)->data_len=len; + + (*param)->data=(uint8 *)malloc(len * sizeof(uint8)); + + memcpy((*param)->data, data, len); + + DEBUGADD(6,("\tvalue:[%s], len:[%d]\n",(*param)->value, (*param)->data_len)); + + return True; +} + +/******************************************************************* +********************************************************************/ +static BOOL spoolss_io_addform(char *desc, FORM *f, uint32 ptr, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_addform"); + depth++; + prs_align(ps); + + if (ptr!=0) + { + prs_uint32("flags", ps, depth, &(f->flags)); + prs_uint32("name_ptr", ps, depth, &(f->name_ptr)); + prs_uint32("size_x", ps, depth, &(f->size_x)); + prs_uint32("size_y", ps, depth, &(f->size_y)); + prs_uint32("left", ps, depth, &(f->left)); + prs_uint32("top", ps, depth, &(f->top)); + prs_uint32("right", ps, depth, &(f->right)); + prs_uint32("bottom", ps, depth, &(f->bottom)); + + smb_io_unistr2("", &(f->name), f->name_ptr, ps, depth); + } + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0; + prs_debug(ps, depth, desc, "spoolss_io_q_addform"); + depth++; + + prs_align(ps); + smb_io_prt_hnd("printer handle", &(q_u->handle), ps, depth); + prs_uint32("level", ps, depth, &(q_u->level)); + prs_uint32("level2", ps, depth, &(q_u->level2)); + + if (q_u->level==1) + { + prs_uint32("useless_ptr", ps, depth, &(useless_ptr)); + spoolss_io_addform("", &(q_u->form), useless_ptr, ps, depth); + } + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_addform"); + depth++; + + prs_align(ps); + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0; + prs_debug(ps, depth, desc, "spoolss_io_q_setform"); + depth++; + + prs_align(ps); + smb_io_prt_hnd("printer handle", &(q_u->handle), ps, depth); + smb_io_unistr2("", &(q_u->name), True, ps, depth); + + prs_align(ps); + + prs_uint32("level", ps, depth, &(q_u->level)); + prs_uint32("level2", ps, depth, &(q_u->level2)); + + if (q_u->level==1) + { + prs_uint32("useless_ptr", ps, depth, &(useless_ptr)); + spoolss_io_addform("", &(q_u->form), useless_ptr, ps, depth); + } + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_setform(char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_setform"); + depth++; + + prs_align(ps); + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_getjob(char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int depth) +{ + uint32 useless_ptr=0xADDE0FF0; + uint32 start_offset, end_offset, beginning; + uint32 bufsize_required=0; + + prs_debug(ps, depth, desc, "spoolss_io_r_getjob"); + depth++; + + prs_align(ps); + + prs_uint32("pointer", ps, depth, &useless_ptr); + + switch (r_u->level) + { + case 1: + { + JOB_INFO_1 *info; + info=r_u->ctr.job.job_info_1; + + bufsize_required += spoolss_size_job_info_1(info); + break; + } + case 2: + { + JOB_INFO_2 *info; + info=r_u->ctr.job.job_info_2; + + bufsize_required += spoolss_size_job_info_2(info); + break; + } + } + + DEBUG(4,("spoolss_io_r_getjob, size needed: %d\n",bufsize_required)); + DEBUG(4,("spoolss_io_r_getjob, size offered: %d\n",r_u->offered)); + + /* check if the buffer is big enough for the datas */ + if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ + r_u->offered=0; /* don't send back the buffer */ + + DEBUG(4,("spoolss_io_r_getjob, buffer too small\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + } + else + { + DEBUG(4,("spoolss_io_r_enumjobs, buffer large enough\n")); + + prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + beginning=prs_offset(ps); + start_offset=prs_offset(ps); + end_offset=start_offset+r_u->offered; + + switch (r_u->level) + { + case 1: + { + JOB_INFO_1 *info; + info = r_u->ctr.job.job_info_1; + smb_io_job_info_1(desc, info, ps, depth, &start_offset, &end_offset); + break; + } + case 2: + { + JOB_INFO_2 *info; + info = r_u->ctr.job.job_info_2; + smb_io_job_info_2(desc, info, ps, depth, &start_offset, &end_offset); + break; + } + + } + prs_set_offset(ps, beginning+r_u->offered); + prs_align(ps); + } + + /* + * if the buffer was too small, send the minimum required size + * if it was too large, send the real needed size + */ + + prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/**************************************************************************** +****************************************************************************/ +void free_spoolss_r_getjob(SPOOL_R_GETJOB *r_u) +{ + switch (r_u->level) + { + case 1: + { + free(r_u->ctr.job.job_info_1); + break; + } + case 2: + { + free_job_info_2(r_u->ctr.job.job_info_2); + break; + } + } +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int depth) +{ + + prs_debug(ps, depth, desc, ""); + depth++; + + prs_align(ps); + + smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + prs_uint32("jobid", ps, depth, &(q_u->jobid)); + prs_uint32("level", ps, depth, &(q_u->level)); + + spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + + prs_align(ps); + + prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + + return True; +} + +void free_devmode(DEVICEMODE *devmode) +{ + if (devmode!=NULL) + { + if (devmode->private!=NULL) + free(devmode->private); + free(devmode); + } +} + +void free_printer_info_2(PRINTER_INFO_2 *printer) +{ + if (printer!=NULL) + { + free_devmode(printer->devmode); + free(printer); + } +} + +static PRINTER_INFO_2 *prt2_dup(const PRINTER_INFO_2* from) +{ + PRINTER_INFO_2 *copy = (PRINTER_INFO_2 *)malloc(sizeof(PRINTER_INFO_2)); + if (copy != NULL) + { + if (from != NULL) + { + memcpy(copy, from, sizeof(*copy)); + } + else + { + ZERO_STRUCTP(copy); + } + } + return copy; +} + +void free_print2_array(uint32 num_entries, PRINTER_INFO_2 **entries) +{ + void(*fn)(void*) = (void(*)(void*))&free_printer_info_2; + free_void_array(num_entries, (void**)entries, *fn); +} + +PRINTER_INFO_2 *add_print2_to_array(uint32 *len, PRINTER_INFO_2 ***array, + const PRINTER_INFO_2 *prt) +{ + void*(*fn)(const void*) = (void*(*)(const void*))&prt2_dup; + return (PRINTER_INFO_2*)add_copy_to_array(len, + (void***)array, (const void*)prt, *fn, True); +} + +static PRINTER_INFO_1 *prt1_dup(const PRINTER_INFO_1* from) +{ + PRINTER_INFO_1 *copy = (PRINTER_INFO_1 *)malloc(sizeof(PRINTER_INFO_1)); + if (copy != NULL) + { + if (from != NULL) + { + memcpy(copy, from, sizeof(*copy)); + } + else + { + ZERO_STRUCTP(copy); + } + } + return copy; +} + +void free_print1_array(uint32 num_entries, PRINTER_INFO_1 **entries) +{ + void(*fn)(void*) = (void(*)(void*))&free; + free_void_array(num_entries, (void**)entries, *fn); +} + +PRINTER_INFO_1 *add_print1_to_array(uint32 *len, PRINTER_INFO_1 ***array, + const PRINTER_INFO_1 *prt) +{ + void*(*fn)(const void*) = (void*(*)(const void*))&prt1_dup; + return (PRINTER_INFO_1*)add_copy_to_array(len, + (void***)array, (const void*)prt, *fn, True); +} + +static JOB_INFO_1 *job1_dup(const JOB_INFO_1* from) +{ + JOB_INFO_1 *copy = (JOB_INFO_1 *)malloc(sizeof(JOB_INFO_1)); + if (copy != NULL) + { + if (from != NULL) + { + memcpy(copy, from, sizeof(*copy)); + } + else + { + ZERO_STRUCTP(copy); + } + } + return copy; +} + +void free_job1_array(uint32 num_entries, JOB_INFO_1 **entries) +{ + void(*fn)(void*) = (void(*)(void*))&free; + free_void_array(num_entries, (void**)entries, *fn); +} + +JOB_INFO_1 *add_job1_to_array(uint32 *len, JOB_INFO_1 ***array, + const JOB_INFO_1 *job) +{ + void*(*fn)(const void*) = (void*(*)(const void*))&job1_dup; + return (JOB_INFO_1*)add_copy_to_array(len, + (void***)array, (const void*)job, *fn, True); +} + +static JOB_INFO_2 *job2_dup(const JOB_INFO_2* from) +{ + JOB_INFO_2 *copy = (JOB_INFO_2 *)malloc(sizeof(JOB_INFO_2)); + if (copy != NULL) + { + if (from != NULL) + { + memcpy(copy, from, sizeof(*copy)); + } + else + { + ZERO_STRUCTP(copy); + } + } + return copy; +} + +void free_job_info_2(JOB_INFO_2 *job) +{ + if (job!=NULL) + { + free_devmode(job->devmode); + free(job); + } +} + +void free_job2_array(uint32 num_entries, JOB_INFO_2 **entries) +{ + void(*fn)(void*) = (void(*)(void*))&free_job_info_2; + free_void_array(num_entries, (void**)entries, *fn); +} + +JOB_INFO_2 *add_job2_to_array(uint32 *len, JOB_INFO_2 ***array, + const JOB_INFO_2 *job) +{ + void*(*fn)(const void*) = (void*(*)(const void*))&job2_dup; + return (JOB_INFO_2*)add_copy_to_array(len, + (void***)array, (const void*)job, *fn, True); +} + -- cgit From 195e3d44daccc3b6457486018ba0322ac9d44566 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 7 Feb 2000 16:25:15 +0000 Subject: spoolss definitions. also added some prs_struct functions, 'cause I'm handling buffers as prs_struct. J.F. (This used to be commit 81e375bbbe0fb022a44a2aaaa3729a9518b7a854) --- source3/rpc_parse/parse_misc.c | 25 +++++++++++++++++++++ source3/rpc_parse/parse_prs.c | 50 ++++++++++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_rpc.c | 21 +++++++++--------- 3 files changed, 85 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 5277825767..21d97b444c 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -592,6 +592,31 @@ BOOL smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) return True; } +/******************************************************************* +reads or writes a BUFFER5 structure. +the buf_len member tells you how large the buffer is. +********************************************************************/ +BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "smb_io_buffer4"); + depth++; + + if (buf5 == NULL) return False; + + prs_align(ps); + prs_uint32("buf_len", ps, depth, &(buf5->buf_len)); + + /* reading: alloc the buffer first */ + if ( ps->io ) + { + buf5->buffer=(uint16 *)malloc( sizeof(uint16)*buf5->buf_len ); + } + + prs_uint16s(True, "buffer", ps, depth, buf5->buffer, buf5->buf_len); + + return True; +} + /******************************************************************* Inits a BUFFER2 structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 6bb07c5f64..24eff1b779 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -282,6 +282,21 @@ BOOL prs_append_prs_data(prs_struct *dst, prs_struct *src) return True; } +/******************************************************************* + Append some data from one parse_struct into another. + ********************************************************************/ + +BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, uint32 len) +{ + if(!prs_grow(dst, len)) + return False; + + memcpy(&dst->data_p[dst->data_offset], prs_data_p(src), (size_t)len); + dst->data_offset += len; + + return True; +} + /******************************************************************* Append the data from a buffer into a parse_struct. ********************************************************************/ @@ -351,6 +366,25 @@ char *prs_mem_get(prs_struct *ps, uint32 extra_size) return &ps->data_p[ps->data_offset]; } +/******************************************************************* + Change the struct type. + ********************************************************************/ + +BOOL prs_switch_type(prs_struct *ps, BOOL io) +{ + if ((ps->io ^ io) == True) + ps->io=io; +} + +/******************************************************************* + Force a prs_struct to be dynamic even when it's size is 0. + ********************************************************************/ + +void prs_force_dynamic(prs_struct *ps) +{ + ps->is_dynamic=True; +} + /******************************************************************* Stream a uint8. ********************************************************************/ @@ -416,6 +450,22 @@ BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *dat return True; } +/****************************************************************** + Stream an array of uint16s. Length is number of uint16s. + ********************************************************************/ + +BOOL prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len) +{ + char *q = prs_mem_get(ps, len * sizeof(uint16)); + if (q == NULL) + return False; + + DBG_RW_PSVAL(charmode, name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, data16s, len) + ps->data_offset += (len * sizeof(uint16)); + + return True; +} + /****************************************************************** Stream an array of uint32s. Length is number of uint32s. ********************************************************************/ diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index d4ea84628a..54d3eea74d 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -105,6 +105,15 @@ interface/version dce/rpc pipe identification }, 0x01 \ } +#define SYNT_SPOOLSS_V1 \ +{ \ + { \ + 0x12345678, 0x1234, 0xabcb, \ + { 0xef, 0x00, 0x01, 0x23, \ + 0x45, 0x67, 0x89, 0xab } \ + }, 0x01 \ +} + #define SYNT_NONE_V0 \ { \ { \ @@ -114,17 +123,6 @@ interface/version dce/rpc pipe identification }, 0x00 \ } -/* pipe string names */ -#define PIPE_SRVSVC "\\PIPE\\srvsvc" -#define PIPE_SAMR "\\PIPE\\samr" -#define PIPE_WINREG "\\PIPE\\winreg" -#define PIPE_WKSSVC "\\PIPE\\wkssvc" -#define PIPE_NETLOGON "\\PIPE\\NETLOGON" -#define PIPE_NTLSA "\\PIPE\\ntlsa" -#define PIPE_NTSVCS "\\PIPE\\ntsvcs" -#define PIPE_LSASS "\\PIPE\\lsass" -#define PIPE_LSARPC "\\PIPE\\lsarpc" - struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ @@ -134,6 +132,7 @@ struct pipe_id_info pipe_names [] = { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, + { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From 07fd3b392d8b3dc5bc8c72584e31a7369b92ff13 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 7 Feb 2000 18:06:54 +0000 Subject: Hum, I should remove my gloves when I'm in front of an xterm :) fixed a stupid bug in unistr2_to_ascii that I introduced fixed getprinterdata() (This used to be commit 2f544a807714024c0fe2ddc26e11c9ddcb47e81f) --- source3/rpc_parse/parse_spoolss.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index a6f72a3181..de998267b3 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -772,22 +772,30 @@ BOOL spoolss_io_q_getprinterdata(char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_st ********************************************************************/ BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) return False; + if (r_u == NULL) + return False; prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdata"); depth++; - prs_align(ps); - prs_uint32("type", ps, depth, &(r_u->type)); - prs_uint32("size", ps, depth, &(r_u->size)); + if (!prs_align(ps)) + return False; + if (!prs_uint32("type", ps, depth, &(r_u->type))) + return False; + if (!prs_uint32("size", ps, depth, &(r_u->size))) + return False; - prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size); - prs_align(ps); + if (!prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size)) + return False; + + if (!prs_align(ps)) + return False; - prs_uint32("needed", ps, depth, &(r_u->needed)); - prs_uint32("status", ps, depth, &(r_u->status)); - prs_align(ps); - + if (!prs_uint32("needed", ps, depth, &(r_u->needed))) + return False; + if (!prs_uint32("status", ps, depth, &(r_u->status))) + return False; + return True; } -- cgit From 8688933c7feb87179c178a30e4fc42970fe1da8f Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Tue, 15 Feb 2000 18:07:45 +0000 Subject: fix the reply of rpc_alter_context OpenPrinterEx is now decoding correctly the query most of the EnumXXX use the new_buffer struct. check the (un)marshalling return code. conclusion: still a long way to go. all the client code has to be rewritten, and I still wonder how to implement correctly the notify stuff. (This used to be commit 3d6d3863751787b08d40268c83221add1487a5c9) --- source3/rpc_parse/parse_prs.c | 19 +- source3/rpc_parse/parse_spoolss.c | 1777 +++++++++++++++++-------------------- 2 files changed, 827 insertions(+), 969 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 24eff1b779..5d0ea832c8 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -150,15 +150,13 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) (unsigned int)extra_space)); return False; } - + /* * Decide how much extra space we really need. */ extra_space -= (ps->buffer_size - ps->data_offset); - if(ps->buffer_size == 0) { - /* * Ensure we have at least a PDU's length, or extra_space, whichever * is greater. @@ -172,21 +170,18 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) } memset(new_data, '\0', new_size ); } else { - /* * If the current buffer size is bigger than the space needed, just * double it, else add extra_space. */ + new_size = MAX(ps->buffer_size*2, ps->buffer_size + extra_space); - new_size = MAX(ps->buffer_size*2, ps->buffer_size + extra_space); - - if((new_data = Realloc(ps->data_p, new_size)) == NULL) { + if ((new_data = Realloc(ps->data_p, new_size)) == NULL) { DEBUG(0,("prs_grow: Realloc failure for size %u.\n", (unsigned int)new_size)); return False; } } - ps->buffer_size = new_size; ps->data_p = new_data; @@ -286,12 +281,12 @@ BOOL prs_append_prs_data(prs_struct *dst, prs_struct *src) Append some data from one parse_struct into another. ********************************************************************/ -BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, uint32 len) -{ +BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uint32 len) +{ if(!prs_grow(dst, len)) return False; - - memcpy(&dst->data_p[dst->data_offset], prs_data_p(src), (size_t)len); + + memcpy(&dst->data_p[dst->data_offset], prs_data_p(src)+start, (size_t)len); dst->data_offset += len; return True; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index de998267b3..66fa2f1da5 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -825,9 +825,11 @@ BOOL spoolss_io_q_closeprinter(char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct prs_debug(ps, depth, desc, "spoolss_io_q_closeprinter"); depth++; - prs_align(ps); + if (!prs_align(ps)) + return False; - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + if (!smb_io_prt_hnd("printer handle",&q_u->handle,ps,depth)) + return False; return True; } @@ -841,12 +843,15 @@ BOOL spoolss_io_r_closeprinter(char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct { prs_debug(ps, depth, desc, "spoolss_io_r_closeprinter"); depth++; - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(r_u->handle),ps,depth); - prs_uint32("status", ps, depth, &(r_u->status)); + if (!prs_align(ps)) + return False; + if (!smb_io_prt_hnd("printer handle",&r_u->handle,ps,depth)) + return False; + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; + return True; } @@ -1240,8 +1245,7 @@ static BOOL new_smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR { prs_struct *ps=&(buffer->prs); - if (MARSHALLING(ps)) - { + if (MARSHALLING(ps)) { uint32 struct_offset = prs_offset(ps); uint32 relative_offset; @@ -1254,13 +1258,12 @@ static BOOL new_smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR prs_set_offset(ps, struct_offset); - relative_offset=buffer->string_at_end-buffer->struct_start; + relative_offset=buffer->string_at_end - buffer->struct_start; /* write its offset */ if (!prs_uint32("offset", ps, depth, &relative_offset)) return False; } - else - { + else { uint32 old_offset; /* read the offset */ @@ -1284,6 +1287,67 @@ static BOOL new_smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR * write a array UNICODE strings and its relative pointer. * used by 2 RPC structs ********************************************************************/ +static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR ***string) +{ + prs_struct *ps=&(buffer->prs); + + if (MARSHALLING(ps)) { + uint32 struct_offset = prs_offset(ps); + uint32 relative_offset; + int i=0; + + while ( (*string)[i]!=0x0000 ) + i++; + i--; + + /* count the ending NULL of the array */ + buffer->string_at_end -= 2; + + /* jfm: FIXME: write a (uint16) 0 for the ending NULL */ + + do + { + buffer->string_at_end -= 2*(str_len_uni((*string)[i])+1); + prs_set_offset(ps, buffer->string_at_end); + + /* write the string */ + if (!spoolss_smb_io_unistr(desc, (*string)[i], ps, depth)) + return False; + + i--; + } + while (i>=0); + + prs_set_offset(ps, struct_offset); + + relative_offset=buffer->string_at_end - buffer->struct_start; + /* write its offset */ + if (!prs_uint32("offset", ps, depth, &relative_offset)) + return False; + } + else { + uint32 old_offset; + + /* read the offset */ + if (!prs_uint32("offset", ps, depth, &(buffer->string_at_end))) + return False; + + old_offset = prs_offset(ps); + prs_set_offset(ps, buffer->string_at_end); + + /* read the string */ + + /* jfm: FIXME: alloc memory and read all the strings until the string is NULL */ + +/* + if (!spoolss_smb_io_unistr(desc, string, ps, depth)) + return False; +*/ + prs_set_offset(ps, old_offset); + } + return True; +} + static BOOL smb_io_relarraystr(char *desc, prs_struct *ps, int depth, UNISTR ***buffer, uint32 *start_offset, uint32 *end_offset) { @@ -1321,9 +1385,54 @@ static BOOL smb_io_relarraystr(char *desc, prs_struct *ps, int depth, UNISTR *** } /******************************************************************* - * write a DEVMODE struct and its relative pointer. - * used by all the RPC structs passing a buffer - ********************************************************************/ + Parse a DEVMODE structure and its relative pointer. +********************************************************************/ +static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEVICEMODE *devmode) +{ + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "new_smb_io_reldevmode"); + depth++; + + if (MARSHALLING(ps)) { + uint32 struct_offset = prs_offset(ps); + uint32 relative_offset; + + buffer->string_at_end -= (devmode->size+devmode->driverextra); + + prs_set_offset(ps, buffer->string_at_end); + + /* write the DEVMODE */ + if (!spoolss_io_devmode(desc, ps, depth, devmode)) + return False; + + prs_set_offset(ps, struct_offset); + + relative_offset=buffer->string_at_end - buffer->struct_start; + /* write its offset */ + if (!prs_uint32("offset", ps, depth, &relative_offset)) + return False; + } + else { + uint32 old_offset; + + /* read the offset */ + if (!prs_uint32("offset", ps, depth, &(buffer->string_at_end))) + return False; + + old_offset = prs_offset(ps); + prs_set_offset(ps, buffer->string_at_end + buffer->struct_start); + + /* read the string */ + if (!spoolss_io_devmode(desc, ps, depth, devmode)) + return False; + + prs_set_offset(ps, old_offset); + } + return True; +} + + static BOOL smb_io_reldevmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode, uint32 *start_offset, uint32 *end_offset) { @@ -1392,76 +1501,112 @@ static BOOL smb_io_printer_info_0(char *desc, PRINTER_INFO_0 *info, prs_struct * } /******************************************************************* + Parse a PRINTER_INFO_1 structure. ********************************************************************/ -static BOOL smb_io_printer_info_1(char *desc, PRINTER_INFO_1 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) +BOOL new_smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info, int depth) { - prs_debug(ps, depth, desc, "smb_io_printer_info_1"); + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "new_smb_io_printer_info_1"); depth++; - *start_offset=prs_offset(ps); - prs_uint32("flags", ps, depth, &(info->flags)); - smb_io_relstr("description",ps, depth, &(info->description), start_offset, end_offset); - smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); - smb_io_relstr("comment",ps, depth, &(info->comment), start_offset, end_offset); + buffer->struct_start=prs_offset(ps); + + if (!prs_uint32("flags", ps, depth, &info->flags)) + return False; + if (!new_smb_io_relstr("description", buffer, depth, &info->description)) + return False; + if (!new_smb_io_relstr("name", buffer, depth, &info->name)) + return False; + if (!new_smb_io_relstr("comment", buffer, depth, &info->comment)) + return False; return True; } /******************************************************************* + Parse a PRINTER_INFO_2 structure. ********************************************************************/ -static BOOL smb_io_printer_info_2(char *desc, PRINTER_INFO_2 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) +BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) { + /* hack for the SEC DESC */ uint32 pipo=0; - uint32 devmode_offset; - uint32 backup_offset; - prs_debug(ps, depth, desc, "smb_io_printer_info_2"); + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "new_smb_io_printer_info_2"); depth++; - *start_offset=prs_offset(ps); - smb_io_relstr("servername", ps, depth, &(info->servername), start_offset, end_offset); - smb_io_relstr("printername", ps, depth, &(info->printername), start_offset, end_offset); - smb_io_relstr("sharename", ps, depth, &(info->sharename), start_offset, end_offset); - smb_io_relstr("portname", ps, depth, &(info->portname), start_offset, end_offset); - smb_io_relstr("drivername", ps, depth, &(info->drivername), start_offset, end_offset); - smb_io_relstr("comment", ps, depth, &(info->comment), start_offset, end_offset); - smb_io_relstr("location", ps, depth, &(info->location), start_offset, end_offset); - - devmode_offset=prs_offset(ps); - prs_set_offset(ps, prs_offset(ps)+4); + buffer->struct_start=prs_offset(ps); - smb_io_relstr("sepfile", ps, depth, &(info->sepfile), start_offset, end_offset); - smb_io_relstr("printprocessor",ps, depth, &(info->printprocessor), start_offset, end_offset); - smb_io_relstr("datatype", ps, depth, &(info->datatype), start_offset, end_offset); - smb_io_relstr("parameters", ps, depth, &(info->parameters), start_offset, end_offset); - - prs_uint32("security descriptor", ps, depth, &(pipo)); - - prs_uint32("attributes", ps, depth, &(info->attributes)); - prs_uint32("priority", ps, depth, &(info->priority)); - prs_uint32("defpriority", ps, depth, &(info->defaultpriority)); - prs_uint32("starttime", ps, depth, &(info->starttime)); - prs_uint32("untiltime", ps, depth, &(info->untiltime)); - prs_uint32("status", ps, depth, &(info->status)); - prs_uint32("jobs", ps, depth, &(info->cjobs)); - prs_uint32("averageppm", ps, depth, &(info->averageppm)); + if (!new_smb_io_relstr("servername", buffer, depth, &info->servername)) + return False; + if (!new_smb_io_relstr("printername", buffer, depth, &info->printername)) + return False; + if (!new_smb_io_relstr("sharename", buffer, depth, &info->sharename)) + return False; + if (!new_smb_io_relstr("portname", buffer, depth, &info->portname)) + return False; + if (!new_smb_io_relstr("drivername", buffer, depth, &info->drivername)) + return False; + if (!new_smb_io_relstr("comment", buffer, depth, &info->comment)) + return False; + if (!new_smb_io_relstr("location", buffer, depth, &info->location)) + return False; - /* - I'm not sure if putting the devmode at the end the struct is worth it - but NT does it - */ - backup_offset=prs_offset(ps); - prs_set_offset(ps, devmode_offset); - smb_io_reldevmode("devmode", ps, depth, info->devmode, start_offset, end_offset); - prs_set_offset(ps, backup_offset); + /* NT parses the DEVMODE at the end of the struct */ + if (!new_smb_io_reldevmode("devmode", buffer, depth, info->devmode)) + return False; + + if (!new_smb_io_relstr("sepfile", buffer, depth, &info->sepfile)) + return False; + if (!new_smb_io_relstr("printprocessor", buffer, depth, &info->printprocessor)) + return False; + if (!new_smb_io_relstr("datatype", buffer, depth, &info->datatype)) + return False; + if (!new_smb_io_relstr("parameters", buffer, depth, &info->parameters)) + return False; + + if (!prs_uint32("security descriptor", ps, depth, &pipo)) + return False; + if (!prs_uint32("attributes", ps, depth, &info->attributes)) + return False; + if (!prs_uint32("priority", ps, depth, &info->priority)) + return False; + if (!prs_uint32("defpriority", ps, depth, &info->defaultpriority)) + return False; + if (!prs_uint32("starttime", ps, depth, &info->starttime)) + return False; + if (!prs_uint32("untiltime", ps, depth, &info->untiltime)) + return False; + if (!prs_uint32("status", ps, depth, &info->status)) + return False; + if (!prs_uint32("jobs", ps, depth, &info->cjobs)) + return False; + if (!prs_uint32("averageppm", ps, depth, &info->averageppm)) + return False; return True; } /******************************************************************* -********************************************************************/ + Parse a DRIVER_INFO_1 structure. +********************************************************************/ +BOOL new_smb_io_printer_driver_info_1(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_1 *info, int depth) +{ + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "new_smb_io_printer_driver_info_1"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if (!new_smb_io_relstr("name", buffer, depth, &info->name)) + return False; + + return True; +} + static BOOL smb_io_printer_driver_info_1(char *desc, DRIVER_INFO_1 *info, prs_struct *ps, int depth, uint32 *start_offset, uint32 *end_offset) { @@ -1475,7 +1620,33 @@ static BOOL smb_io_printer_driver_info_1(char *desc, DRIVER_INFO_1 *info, prs_st } /******************************************************************* -********************************************************************/ + Parse a DRIVER_INFO_2 structure. +********************************************************************/ +BOOL new_smb_io_printer_driver_info_2(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) +{ + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "new_smb_io_printer_driver_info_2"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if (!prs_uint32("version", ps, depth, &info->version)) + return False; + if (!new_smb_io_relstr("name", buffer, depth, &info->name)) + return False; + if (!new_smb_io_relstr("architecture", buffer, depth, &info->architecture)) + return False; + if (!new_smb_io_relstr("driverpath", buffer, depth, &info->driverpath)) + return False; + if (!new_smb_io_relstr("datafile", buffer, depth, &info->datafile)) + return False; + if (!new_smb_io_relstr("configfile", buffer, depth, &info->configfile)) + return False; + + return True; +} + static BOOL smb_io_printer_driver_info_2(char *desc, DRIVER_INFO_2 *info,prs_struct *ps, int depth, uint32 *start_offset, uint32 *end_offset) { @@ -1494,7 +1665,43 @@ static BOOL smb_io_printer_driver_info_2(char *desc, DRIVER_INFO_2 *info,prs_str } /******************************************************************* -********************************************************************/ + Parse a DRIVER_INFO_3 structure. +********************************************************************/ +BOOL new_smb_io_printer_driver_info_3(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_3 *info, int depth) +{ + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "new_smb_io_printer_driver_info_3"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if (!prs_uint32("version", ps, depth, &info->version)) + return False; + if (!new_smb_io_relstr("name", buffer, depth, &info->name)) + return False; + if (!new_smb_io_relstr("architecture", buffer, depth, &info->architecture)) + return False; + if (!new_smb_io_relstr("driverpath", buffer, depth, &info->driverpath)) + return False; + if (!new_smb_io_relstr("datafile", buffer, depth, &info->datafile)) + return False; + if (!new_smb_io_relstr("configfile", buffer, depth, &info->configfile)) + return False; + if (!new_smb_io_relstr("helpfile", buffer, depth, &info->helpfile)) + return False; + + if (!new_smb_io_relarraystr("dependentfiles", buffer, depth, &info->dependentfiles)) + return False; + + if (!new_smb_io_relstr("monitorname", buffer, depth, &info->monitorname)) + return False; + if (!new_smb_io_relstr("defaultdatatype", buffer, depth, &info->defaultdatatype)) + return False; + + return True; +} + static BOOL smb_io_printer_driver_info_3(char *desc, DRIVER_INFO_3 *info,prs_struct *ps, int depth, uint32 *start_offset, uint32 *end_offset) { @@ -1519,7 +1726,47 @@ static BOOL smb_io_printer_driver_info_3(char *desc, DRIVER_INFO_3 *info,prs_str } /******************************************************************* + Parse a JOB_INFO_1 structure. ********************************************************************/ +BOOL new_smb_io_job_info_1(char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int depth) +{ + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "new_smb_io_job_info_1"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if (!prs_uint32("jobid", ps, depth, &info->jobid)) + return False; + if (!new_smb_io_relstr("printername", buffer, depth, &info->printername)) + return False; + if (!new_smb_io_relstr("machinename", buffer, depth, &info->machinename)) + return False; + if (!new_smb_io_relstr("username", buffer, depth, &info->username)) + return False; + if (!new_smb_io_relstr("document", buffer, depth, &info->document)) + return False; + if (!new_smb_io_relstr("datatype", buffer, depth, &info->datatype)) + return False; + if (!new_smb_io_relstr("text_status", buffer, depth, &info->text_status)) + return False; + if (!prs_uint32("status", ps, depth, &info->status)) + return False; + if (!prs_uint32("priority", ps, depth, &info->priority)) + return False; + if (!prs_uint32("position", ps, depth, &info->position)) + return False; + if (!prs_uint32("totalpages", ps, depth, &info->totalpages)) + return False; + if (!prs_uint32("pagesprinted", ps, depth, &info->pagesprinted)) + return False; + if (!spoolss_io_system_time("submitted", ps, depth, &info->submitted)) + return False; + + return True; +} + static BOOL smb_io_job_info_1(char *desc, JOB_INFO_1 *info, prs_struct *ps, int depth, uint32 *start_offset, uint32 *end_offset) { @@ -1545,30 +1792,94 @@ static BOOL smb_io_job_info_1(char *desc, JOB_INFO_1 *info, prs_struct *ps, int } /******************************************************************* + Parse a JOB_INFO_2 structure. ********************************************************************/ -static BOOL smb_io_job_info_2(char *desc, JOB_INFO_2 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) +BOOL new_smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int depth) { int pipo=0; - prs_debug(ps, depth, desc, "smb_io_job_info_2"); - depth++; - *start_offset=prs_offset(ps); + prs_struct *ps=&(buffer->prs); - prs_uint32("jobid", ps, depth, &(info->jobid)); - smb_io_relstr("printername", ps, depth, &(info->printername), start_offset, end_offset); - smb_io_relstr("machinename", ps, depth, &(info->machinename), start_offset, end_offset); - smb_io_relstr("username", ps, depth, &(info->username), start_offset, end_offset); - smb_io_relstr("document", ps, depth, &(info->document), start_offset, end_offset); - smb_io_relstr("notifyname", ps, depth, &(info->notifyname), start_offset, end_offset); - smb_io_relstr("datatype", ps, depth, &(info->datatype), start_offset, end_offset); + prs_debug(ps, depth, desc, "new_smb_io_job_info_2"); + depth++; - smb_io_relstr("printprocessor", ps, depth, &(info->printprocessor), start_offset, end_offset); - smb_io_relstr("parameters", ps, depth, &(info->parameters), start_offset, end_offset); - smb_io_relstr("drivername", ps, depth, &(info->drivername), start_offset, end_offset); - smb_io_reldevmode("devmode", ps, depth, info->devmode, start_offset, end_offset); - smb_io_relstr("text_status", ps, depth, &(info->text_status), start_offset, end_offset); + buffer->struct_start=prs_offset(ps); + + if (!prs_uint32("jobid",ps, depth, &info->jobid)) + return False; + if (!new_smb_io_relstr("printername", buffer, depth, &info->printername)) + return False; + if (!new_smb_io_relstr("machinename", buffer, depth, &info->machinename)) + return False; + if (!new_smb_io_relstr("username", buffer, depth, &info->username)) + return False; + if (!new_smb_io_relstr("document", buffer, depth, &info->document)) + return False; + if (!new_smb_io_relstr("notifyname", buffer, depth, &info->notifyname)) + return False; + if (!new_smb_io_relstr("datatype", buffer, depth, &info->datatype)) + return False; -/* SEC_DESC sec_desc;*/ + if (!new_smb_io_relstr("printprocessor", buffer, depth, &info->printprocessor)) + return False; + if (!new_smb_io_relstr("parameters", buffer, depth, &info->parameters)) + return False; + if (!new_smb_io_relstr("drivername", buffer, depth, &info->drivername)) + return False; + if (!new_smb_io_reldevmode("devmode", buffer, depth, info->devmode)) + return False; + if (!new_smb_io_relstr("text_status", buffer, depth, &info->text_status)) + return False; + +/* SEC_DESC sec_desc;*/ + if (!prs_uint32("Hack! sec desc", ps, depth, &pipo)) + return False; + + if (!prs_uint32("status",ps, depth, &info->status)) + return False; + if (!prs_uint32("priority",ps, depth, &info->priority)) + return False; + if (!prs_uint32("position",ps, depth, &info->position)) + return False; + if (!prs_uint32("starttime",ps, depth, &info->starttime)) + return False; + if (!prs_uint32("untiltime",ps, depth, &info->untiltime)) + return False; + if (!prs_uint32("totalpages",ps, depth, &info->totalpages)) + return False; + if (!prs_uint32("size",ps, depth, &info->size)) + return False; + if (!spoolss_io_system_time("submitted", ps, depth, &info->submitted) ) + return False; + if (!prs_uint32("timeelapsed",ps, depth, &info->timeelapsed)) + return False; + if (!prs_uint32("pagesprinted",ps, depth, &info->pagesprinted)) + return False; + + return True; +} +static BOOL smb_io_job_info_2(char *desc, JOB_INFO_2 *info, prs_struct *ps, int depth, + uint32 *start_offset, uint32 *end_offset) +{ + int pipo=0; + prs_debug(ps, depth, desc, "smb_io_job_info_2"); + depth++; + *start_offset=prs_offset(ps); + + prs_uint32("jobid", ps, depth, &(info->jobid)); + smb_io_relstr("printername", ps, depth, &(info->printername), start_offset, end_offset); + smb_io_relstr("machinename", ps, depth, &(info->machinename), start_offset, end_offset); + smb_io_relstr("username", ps, depth, &(info->username), start_offset, end_offset); + smb_io_relstr("document", ps, depth, &(info->document), start_offset, end_offset); + smb_io_relstr("notifyname", ps, depth, &(info->notifyname), start_offset, end_offset); + smb_io_relstr("datatype", ps, depth, &(info->datatype), start_offset, end_offset); + + smb_io_relstr("printprocessor", ps, depth, &(info->printprocessor), start_offset, end_offset); + smb_io_relstr("parameters", ps, depth, &(info->parameters), start_offset, end_offset); + smb_io_relstr("drivername", ps, depth, &(info->drivername), start_offset, end_offset); + smb_io_reldevmode("devmode", ps, depth, info->devmode, start_offset, end_offset); + smb_io_relstr("text_status", ps, depth, &(info->text_status), start_offset, end_offset); + +/* SEC_DESC sec_desc;*/ prs_uint32("Hack! sec desc", ps, depth, &pipo); prs_uint32("status", ps, depth, &(info->status)); @@ -1643,18 +1954,20 @@ static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUF return True; } - if (!prs_uint32("size", ps, depth, &(buffer->size))) + if (!prs_uint32("size", ps, depth, &buffer->size)) return False; if (!prs_init(&(buffer->prs), buffer->size, 4, UNMARSHALL)) return False; - if (!prs_append_some_prs_data(&(buffer->prs), ps, buffer->size)) + if (!prs_append_some_prs_data(&(buffer->prs), ps, prs_offset(ps), buffer->size)) return False; - prs_set_offset(&(buffer->prs),0); + if (!prs_set_offset(&buffer->prs, 0)) + return False; - prs_set_offset(ps, buffer->size+prs_offset(ps)); + if (!prs_set_offset(ps, buffer->size+prs_offset(ps))) + return False; buffer->string_at_end=buffer->size; @@ -1667,12 +1980,9 @@ static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUF if (!prs_uint32("size", ps, depth, &(buffer->size))) return False; - - if (!prs_append_some_prs_data(ps, &(buffer->prs), buffer->size)) + if (!prs_append_some_prs_data(ps, &(buffer->prs), 0, buffer->size)) return False; - } - - return True; + } } /******************************************************************* @@ -1746,9 +2056,50 @@ static BOOL smb_io_form_1(char *desc, FORM_1 *info, prs_struct *ps, int depth, return True; } +/******************************************************************* + Parse a PORT_INFO_2 structure. +********************************************************************/ +BOOL new_smb_io_port_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) +{ + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "new_smb_io_port_1"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if(!new_smb_io_relstr("port_name", buffer, depth, &info->port_name)) + return False; + + return True; +} /******************************************************************* + Parse a PORT_INFO_2 structure. ********************************************************************/ +BOOL new_smb_io_port_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) +{ + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "new_smb_io_port_2"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if(!new_smb_io_relstr("port_name", buffer, depth, &info->port_name)) + return False; + if(!new_smb_io_relstr("monitor_name", buffer, depth, &info->monitor_name)) + return False; + if(!new_smb_io_relstr("description", buffer, depth, &info->description)) + return False; + if(!prs_uint32("port_type", ps, depth, &info->port_type)) + return False; + if(!prs_uint32("reserved", ps, depth, &info->reserved)) + return False; + + return True; +} + static BOOL smb_io_port_2(char *desc, PORT_INFO_2 *info, prs_struct *ps, int depth, uint32 *start_offset, uint32 *end_offset) { @@ -1767,28 +2118,55 @@ static BOOL smb_io_port_2(char *desc, PORT_INFO_2 *info, prs_struct *ps, int dep /******************************************************************* ********************************************************************/ -static BOOL smb_io_processor_info_1(char *desc, PRINTPROCESSOR_1 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) +BOOL smb_io_printprocessor_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR_1 *info, int depth) { - prs_debug(ps, depth, desc, "smb_io_processor_info_1"); + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "smb_io_printprocessor_info_1"); depth++; - *start_offset=prs_offset(ps); - smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); + buffer->struct_start=prs_offset(ps); + + if (new_smb_io_relstr("name", buffer, depth, &info->name)) + return False; return True; } /******************************************************************* ********************************************************************/ -static BOOL smb_io_monitor_info_1(char *desc, PRINTMONITOR_1 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) +BOOL smb_io_printmonitor_info_1(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_1 *info, int depth) { - prs_debug(ps, depth, desc, "smb_io_monitor_info_1"); + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "smb_io_printmonitor_info_1"); depth++; - *start_offset=prs_offset(ps); - smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); + buffer->struct_start=prs_offset(ps); + + if (!new_smb_io_relstr("name", buffer, depth, &info->name)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL smb_io_printmonitor_info_2(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_2 *info, int depth) +{ + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "smb_io_printmonitor_info_2"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if (!new_smb_io_relstr("name", buffer, depth, &info->name)) + return False; + if (!new_smb_io_relstr("environment", buffer, depth, &info->environment)) + return False; + if (!new_smb_io_relstr("dll_name", buffer, depth, &info->dll_name)) + return False; return True; } @@ -1811,7 +2189,7 @@ static uint32 spoolss_size_printer_info_0(PRINTER_INFO_0 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ -static uint32 spoolss_size_printer_info_1(PRINTER_INFO_1 *info) +uint32 spoolss_size_printer_info_1(PRINTER_INFO_1 *info) { int size=0; @@ -1819,15 +2197,14 @@ static uint32 spoolss_size_printer_info_1(PRINTER_INFO_1 *info) size+=size_of_relative_string( &(info->description) ); size+=size_of_relative_string( &(info->name) ); size+=size_of_relative_string( &(info->comment) ); - return (size); - return True; + return size; } /******************************************************************* return the size required by a struct in the stream -********************************************************************/ -static uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) +********************************************************************/ +uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) { int size=0; @@ -1856,15 +2233,13 @@ static uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) size+=size_of_uint32( &(info->status) ); size+=size_of_uint32( &(info->cjobs) ); size+=size_of_uint32( &(info->averageppm) ); - return (size); - - return True; + return size; } /******************************************************************* return the size required by a struct in the stream -********************************************************************/ -static uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info) +********************************************************************/ +uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info) { int size=0; DEBUG(9,("Sizing driver info_1\n")); @@ -1878,8 +2253,8 @@ static uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info) /******************************************************************* return the size required by a struct in the stream -********************************************************************/ -static uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info) +********************************************************************/ +uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info) { int size=0; DEBUG(9,("Sizing driver info_2\n")); @@ -1898,8 +2273,8 @@ static uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info) /******************************************************************* return the size required by a struct in the stream -********************************************************************/ -static uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) +********************************************************************/ +uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) { int size=0; UNISTR **string; @@ -1934,7 +2309,7 @@ static uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ -static uint32 spoolss_size_job_info_1(JOB_INFO_1 *info) +uint32 spoolss_size_job_info_1(JOB_INFO_1 *info) { int size=0; size+=size_of_uint32( &(info->jobid) ); @@ -1950,15 +2325,14 @@ static uint32 spoolss_size_job_info_1(JOB_INFO_1 *info) size+=size_of_uint32( &(info->totalpages) ); size+=size_of_uint32( &(info->pagesprinted) ); size+=size_of_systemtime( &(info->submitted) ); - return (size); - return True; + return size; } /******************************************************************* return the size required by a struct in the stream ********************************************************************/ -static uint32 spoolss_size_job_info_2(JOB_INFO_2 *info) +uint32 spoolss_size_job_info_2(JOB_INFO_2 *info) { int size=0; @@ -2008,15 +2382,25 @@ uint32 spoolss_size_form_1(FORM_1 *info) size+=size_of_uint32( &(info->right) ); size+=size_of_uint32( &(info->bottom) ); - return (size); + return size; +} - return True; +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +uint32 spoolss_size_port_info_1(PORT_INFO_1 *info) +{ + int size=0; + + size+=size_of_relative_string( &(info->port_name) ); + + return size; } /******************************************************************* return the size required by a struct in the stream ********************************************************************/ -static uint32 spoolss_size_port_info_2(PORT_INFO_2 *info) +uint32 spoolss_size_port_info_2(PORT_INFO_2 *info) { int size=0; @@ -2027,40 +2411,49 @@ static uint32 spoolss_size_port_info_2(PORT_INFO_2 *info) size+=size_of_uint32( &(info->port_type) ); size+=size_of_uint32( &(info->reserved) ); - return (size); + return size; +} - return True; +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +uint32 spoolss_size_printprocessor_info_1(PRINTPROCESSOR_1 *info) +{ + int size=0; + size+=size_of_relative_string( &info->name ); + + return size; } /******************************************************************* return the size required by a struct in the stream ********************************************************************/ -static uint32 spoolss_size_processor_info_1(PRINTPROCESSOR_1 *info) +uint32 spoolss_size_printmonitor_info_1(PRINTMONITOR_1 *info) { int size=0; - size+=size_of_relative_string( &(info->name) ); + size+=size_of_relative_string( &info->name ); - return (size); + return size; - return True; } /******************************************************************* return the size required by a struct in the stream ********************************************************************/ -static uint32 spoolss_size_monitor_info_1(PRINTMONITOR_1 *info) +uint32 spoolss_size_printmonitor_info_2(PRINTMONITOR_2 *info) { int size=0; - size+=size_of_relative_string( &(info->name) ); + size+=size_of_relative_string( &info->name); + size+=size_of_relative_string( &info->environment); + size+=size_of_relative_string( &info->dll_name); - return (size); - - return True; + return size; } /******************************************************************* * make a structure. ********************************************************************/ +/* static BOOL make_spoolss_buffer(BUFFER* buffer, uint32 size) { buffer->ptr = (size != 0) ? 1 : 0; @@ -2069,6 +2462,7 @@ static BOOL make_spoolss_buffer(BUFFER* buffer, uint32 size) return (buffer->data != NULL || size == 0); } +*/ /******************************************************************* * read a uint8 buffer of size *size. @@ -2358,8 +2752,8 @@ BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, init_unistr2(&q_u->servername, servername, len_name); q_u->level = level; - make_spoolss_buffer(&q_u->buffer, size); - q_u->buf_size = size; + /*make_spoolss_buffer(&q_u->buffer, size);*/ +/* q_u->buf_size = size;*/ return True; } @@ -2371,45 +2765,63 @@ BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth) { - uint32 useless_ptr = 0x01; prs_debug(ps, depth, desc, "spoolss_io_q_enumprinters"); depth++; - prs_align(ps); - - prs_uint32("flags", ps, depth, &(q_u->flags)); - prs_uint32("useless ptr", ps, depth, &useless_ptr); + if (!prs_align(ps)) + return False; - smb_io_unistr2("", &q_u->servername,True,ps,depth); - prs_align(ps); + if (!prs_uint32("flags", ps, depth, &q_u->flags)) + return False; + if (!prs_uint32("servername_ptr", ps, depth, &q_u->servername_ptr)) + return False; - prs_uint32("level", ps, depth, &(q_u->level)); + if (!smb_io_unistr2("", &q_u->servername, q_u->servername_ptr, ps, depth)) + return False; + + if (!prs_align(ps)) + return False; + if (!prs_uint32("level", ps, depth, &q_u->level)) + return False; - spoolss_io_read_buffer("buffer", ps, depth, &(q_u->buffer)); + if (!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + return False; - prs_uint32("buf_size", ps, depth, &q_u->buf_size); + if (!prs_align(ps)) + return False; + if (!prs_uint32("offered", ps, depth, &q_u->offered)) + return False; return True; } -/**************************************************************************** -****************************************************************************/ -void free_r_enumprinters(SPOOL_R_ENUMPRINTERS *r_u) -{ - DEBUG(4,("free_enum_printers_info: [%d] structs to free at level [%d]\n", r_u->returned, r_u->level)); - switch (r_u->level) - { - case 1: - { - free_print1_array(r_u->returned, r_u->ctr.printer.printers_1); - break; - } - case 2: - { - free_print2_array(r_u->returned, r_u->ctr.printer.printers_2); - break; - } - } +/******************************************************************* + Parse a SPOOL_R_ENUMPRINTERS structure. + ********************************************************************/ +BOOL new_spoolss_io_r_enumprinters(char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "new_spoolss_io_r_enumprinters"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + return False; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("needed", ps, depth, &r_u->needed)) + return False; + + if (!prs_uint32("returned", ps, depth, &r_u->returned)) + return False; + + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; } /******************************************************************* @@ -2417,198 +2829,48 @@ void free_r_enumprinters(SPOOL_R_ENUMPRINTERS *r_u) * called from spoolss_r_enum_printers (srv_spoolss.c) * ********************************************************************/ -BOOL spoolss_io_r_enumprinters(char *desc, - SPOOL_R_ENUMPRINTERS *r_u, +BOOL spoolss_io_r_getprinter(char *desc, + SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth) { uint32 useless_ptr=0xADDE0FF0; - int i; uint32 start_offset, end_offset, beginning; uint32 bufsize_required=0; - uint32 tmp_ct = 0; - - PRINTER_INFO_1 *info1; - PRINTER_INFO_2 *info2; - fstring tmp; - - slprintf(tmp, sizeof(tmp)-1, "spoolss_io_r_enumprinters %d", r_u->level); - - prs_debug(ps, depth, desc, tmp); + + prs_debug(ps, depth, desc, "spoolss_io_r_getprinter"); depth++; + prs_align(ps); + prs_uint32("pointer", ps, depth, &useless_ptr); - if (!ps->io) + switch (r_u->level) { - /* writing */ - for(i=0;ireturned;i++) + case 0: { - switch (r_u->level) - { - case 1: - info1 = r_u->ctr.printer.printers_1[i]; - bufsize_required += spoolss_size_printer_info_1(info1); - break; - case 2: - info2 = r_u->ctr.printer.printers_2[i]; - bufsize_required += spoolss_size_printer_info_2(info2); - break; - } + PRINTER_INFO_0 *info; + info = r_u->ctr.printer.info0; + bufsize_required += spoolss_size_printer_info_0(info); + break; } - - DEBUG(4,("spoolss_io_r_enumprinters, size needed: %d\n",bufsize_required)); - DEBUG(4,("spoolss_io_r_enumprinters, size offered: %d\n",r_u->offered)); - - if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; - r_u->offered=0; - /*r_u->returned=0;*/ - - DEBUG(4,("spoolss_io_r_enumprinters, buffer too small\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("count", ps, depth, &(r_u->returned)); - prs_uint32("status", ps, depth, &(r_u->status)); - return False; + case 1: + { + PRINTER_INFO_1 *info; + info = r_u->ctr.printer.info1; + bufsize_required += spoolss_size_printer_info_1(info); + break; + } + case 2: + { + PRINTER_INFO_2 *info; + info = r_u->ctr.printer.info2; + bufsize_required += spoolss_size_printer_info_2(info); + break; } - - DEBUG(4,("spoolss_io_r_enumprinters, buffer large enough\n")); } - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - - /* have to skip to end of buffer when reading, and have to record - * size of buffer when writing. *shudder*. - */ - - beginning = prs_offset(ps); - start_offset = prs_offset(ps); - end_offset = start_offset + r_u->offered; - - if (ps->io) - { - /* reading */ - prs_set_offset(ps, beginning + r_u->offered); - - prs_align(ps); - prs_uint32("buffer size", ps, depth, &(bufsize_required)); - prs_uint32("count", ps, depth, &(r_u->returned)); - - prs_set_offset(ps, beginning); - } - - for(i=0;ireturned;i++) - { - - switch (r_u->level) - { - case 1: - { - if (ps->io) - { - /* reading */ -/* r_u->ctr.printer.printers_1[i] = add_print1_to_array(&tmp_ct, &r_u->ctr.printer.printers_1, NULL);*/ - } - info1 = r_u->ctr.printer.printers_1[i]; - if (info1 == NULL) - { - return False; - } - smb_io_printer_info_1(desc, info1, ps, depth, - &start_offset, &end_offset); - break; - } - case 2: - { - if (ps->io) - { - /* reading */ -/* - r_u->ctr.printer.printers_2[i] = add_print2_to_array(&tmp_ct, &r_u->ctr.printer.printers_2, NULL); -*/ } - info2 = r_u->ctr.printer.printers_2[i]; - if (info2 == NULL) - { - return False; - } - smb_io_printer_info_2(desc, info2, ps, depth, - &start_offset, &end_offset); - break; - } - } - } - - prs_set_offset(ps, beginning + r_u->offered); - prs_align(ps); - - prs_uint32("buffer size", ps, depth, &(bufsize_required)); - prs_uint32("count", ps, depth, &(r_u->returned)); - prs_uint32("status", ps, depth, &(r_u->status)); - - if (!ps->io) - { - /* writing */ - free_r_enumprinters(r_u); - } - - return True; -} - -/******************************************************************* - * write a structure. - * called from spoolss_r_enum_printers (srv_spoolss.c) - * - ********************************************************************/ -BOOL spoolss_io_r_getprinter(char *desc, - SPOOL_R_GETPRINTER *r_u, - prs_struct *ps, int depth) -{ - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - - prs_debug(ps, depth, desc, "spoolss_io_r_getprinter"); - depth++; - - prs_align(ps); - - prs_uint32("pointer", ps, depth, &useless_ptr); - - switch (r_u->level) - { - case 0: - { - PRINTER_INFO_0 *info; - info = r_u->ctr.printer.info0; - bufsize_required += spoolss_size_printer_info_0(info); - break; - } - case 1: - { - PRINTER_INFO_1 *info; - info = r_u->ctr.printer.info1; - bufsize_required += spoolss_size_printer_info_1(info); - break; - } - case 2: - { - PRINTER_INFO_2 *info; - info = r_u->ctr.printer.info2; - bufsize_required += spoolss_size_printer_info_2(info); - break; - } - } - - DEBUG(4,("spoolss_io_r_getprinter, size needed: %d\n",bufsize_required)); - DEBUG(4,("spoolss_io_r_getprinter, size offered: %d\n",r_u->offered)); + DEBUG(4,("spoolss_io_r_getprinter, size needed: %d\n",bufsize_required)); + DEBUG(4,("spoolss_io_r_getprinter, size offered: %d\n",r_u->offered)); /* check if the buffer is big enough for the datas */ if (r_u->offered < bufsize_required) @@ -2663,12 +2925,14 @@ BOOL spoolss_io_r_getprinter(char *desc, { PRINTER_INFO_1 *info; info = r_u->ctr.printer.info1; + /* smb_io_printer_info_1(desc, info, ps, depth, &start_offset, &end_offset); + */ if (!ps->io) { /* writing */ @@ -2680,12 +2944,14 @@ BOOL spoolss_io_r_getprinter(char *desc, { PRINTER_INFO_2 *info; info = r_u->ctr.printer.info2; + /* smb_io_printer_info_2(desc, info, ps, depth, &start_offset, &end_offset); + */ if (!ps->io) { /* writing */ @@ -2901,191 +3167,35 @@ BOOL spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int de return True; } -/**************************************************************************** -****************************************************************************/ -void free_job_info_ctr(JOB_INFO_CTR *ctr, uint32 level, uint32 numofjobs) -{ - DEBUG(4,("free_enum_jobs_info: [%d] structs to free at level [%d]\n", - numofjobs, level)); - switch (level) - { - case 1: - { - free_job1_array(numofjobs, - ctr->job.job_info_1); - break; - } - case 2: - { - free_job2_array(numofjobs, - ctr->job.job_info_2); - break; - } - } -} - -/**************************************************************************** -****************************************************************************/ -void free_r_enumjobs(SPOOL_R_ENUMJOBS *r_u) -{ - free_job_info_ctr(&r_u->ctr, r_u->level, r_u->numofjobs); -} - /******************************************************************* ********************************************************************/ BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth) { - uint32 useless_ptr = 0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - uint32 tmp_ct = 0; - int i; - prs_debug(ps, depth, desc, "spoolss_io_r_enumjobs"); depth++; - prs_align(ps); - - if (!ps->io) - { - /* writing */ - switch (r_u->level) - { - case 1: - { - for (i=0; inumofjobs; i++) - { - JOB_INFO_1 *info; - info=r_u->ctr.job.job_info_1[i]; - bufsize_required += spoolss_size_job_info_1(&(info[i])); - } - break; - } - case 2: - { - for (i=0; inumofjobs; i++) - { - JOB_INFO_2 *info; - info=r_u->ctr.job.job_info_2[i]; - - bufsize_required += spoolss_size_job_info_2(&(info[i])); - } - break; - } - } - - DEBUG(4,("spoolss_io_r_enumjobs, size needed: %d\n", - bufsize_required)); - DEBUG(4,("spoolss_io_r_enumjobs, size offered: %d\n", - r_u->offered)); - - /* check if the buffer is big enough for the datas */ - if (r_u->offeredstatus = ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered = bufsize_required; - useless_ptr = 0; - - DEBUG(4,("spoolss_io_r_enumjobs, buffer too small\n")); - - } - else - { - useless_ptr = 1; - } - } - - prs_uint32("pointer", ps, depth, &useless_ptr); - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - - if (useless_ptr != 0) - { - beginning=prs_offset(ps); - start_offset=prs_offset(ps); - end_offset=start_offset+r_u->offered; + if (!prs_align(ps)) + return False; - tmp_ct = 0; - - if (ps->io) - { - /* reading */ - prs_set_offset(ps, beginning + r_u->offered); - - prs_align(ps); - prs_uint32("buffer size", ps, depth, &(bufsize_required)); - prs_uint32("numofjobs", ps, depth, &(r_u->numofjobs)); + if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + return False; - prs_set_offset(ps, beginning); - } + if (!prs_align(ps)) + return False; - switch (r_u->level) - { - case 1: - { - JOB_INFO_1 *info; - for (i=0; inumofjobs; i++) - { - if (ps->io) - { - /* reading */ -/* r_u->ctr.job.job_info_1[i] = add_job1_to_array(&tmp_ct, &r_u->ctr.job.job_info_1, NULL);*/ - } - info = r_u->ctr.job.job_info_1[i]; - smb_io_job_info_1(desc, - info, - ps, - depth, - &start_offset, - &end_offset); - } - break; - } - case 2: - { - JOB_INFO_2 *info; - for (i=0; inumofjobs; i++) - { - if (ps->io) - { - /* reading */ -/* r_u->ctr.job.job_info_2[i] = add_job2_to_array(&tmp_ct, &r_u->ctr.job.job_info_2, NULL);*/ - } - info = r_u->ctr.job.job_info_2[i]; - smb_io_job_info_2(desc, - info, - ps, - depth, - &start_offset, - &end_offset); - } - break; - } + if (!prs_uint32("needed", ps, depth, &r_u->needed)) + return False; - } - prs_set_offset(ps, beginning+r_u->offered); - prs_align(ps); + if (!prs_uint32("returned", ps, depth, &r_u->returned)) + return False; - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("buffer size", ps, depth, &(bufsize_required)); - } - - prs_uint32("numofjobs", ps, depth, &(r_u->numofjobs)); - prs_uint32("status", ps, depth, &(r_u->status)); - - if (!ps->io) - { - /* writing */ - free_r_enumjobs(r_u); - } + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; - return True; + return True; } + /******************************************************************* ********************************************************************/ BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd, @@ -3102,13 +3212,13 @@ BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd, q_u->firstjob = firstjob; q_u->numofjobs = numofjobs; q_u->level = level; - +/* if (!make_spoolss_buffer(&q_u->buffer, buf_size)) { return False; } q_u->buf_size = buf_size; - +*/ return True; } @@ -3119,16 +3229,24 @@ BOOL spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, in prs_debug(ps, depth, desc, "spoolss_io_q_enumjobs"); depth++; - prs_align(ps); + if (!prs_align(ps)) + return False; - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("firstjob", ps, depth, &(q_u->firstjob)); - prs_uint32("numofjobs", ps, depth, &(q_u->numofjobs)); - prs_uint32("level", ps, depth, &(q_u->level)); - - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + if (!smb_io_prt_hnd("printer handle",&q_u->handle, ps, depth)) + return False; + + if (!prs_uint32("firstjob", ps, depth, &q_u->firstjob)) + return False; + if (!prs_uint32("numofjobs", ps, depth, &q_u->numofjobs)) + return False; + if (!prs_uint32("level", ps, depth, &q_u->level)) + return False; - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + if (!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + return False; + + if (!prs_uint32("offered", ps, depth, &q_u->offered)) + return False; return True; } @@ -3198,199 +3316,72 @@ BOOL spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int de } /******************************************************************* + Parse a SPOOL_R_ENUMPRINTERDRIVERS structure. ********************************************************************/ -BOOL spoolss_io_r_enumdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) -{ - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - int i; - - prs_debug(ps, depth, desc, "spoolss_io_r_enumdrivers"); +BOOL new_spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "new_spoolss_io_r_enumprinterdrivers"); depth++; - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - - DEBUG(7,("Level [%d], number [%d]\n", r_u->level, r_u->numofdrivers)); - switch (r_u->level) - { - case 1: - { - DRIVER_INFO_1 *driver_info_1; - driver_info_1=r_u->ctr.driver.info1; - - for (i=0; inumofdrivers; i++) - { - bufsize_required += spoolss_size_printer_driver_info_1(&(driver_info_1[i])); - } - break; - } - case 2: - { - DRIVER_INFO_2 *driver_info_2; - driver_info_2=r_u->ctr.driver.info2; - - for (i=0; inumofdrivers; i++) - { - bufsize_required += spoolss_size_printer_driver_info_2(&(driver_info_2[i])); - } - break; - } - case 3: - { - DRIVER_INFO_3 *driver_info_3; - driver_info_3=r_u->ctr.driver.info3; - - for (i=0; inumofdrivers; i++) - { - bufsize_required += spoolss_size_printer_driver_info_3(&(driver_info_3[i])); - } - break; - } - } - - DEBUGADD(7,("size needed: %d\n",bufsize_required)); - DEBUGADD(7,("size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - - if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ - DEBUGADD(8,("buffer too small\n")); + if (!prs_align(ps)) + return False; + + if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + return False; - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - else - { - DEBUGADD(8,("buffer large enough\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - beginning=prs_offset(ps); - start_offset=prs_offset(ps); - end_offset=start_offset+r_u->offered; + if (!prs_align(ps)) + return False; - switch (r_u->level) - { - case 1: - { - DRIVER_INFO_1 *info; - for (i=0; inumofdrivers; i++) - { - info = &(r_u->ctr.driver.info1[i]); - smb_io_printer_driver_info_1(desc, info, ps, depth, &start_offset, &end_offset); - } - break; - } - case 2: - { - DRIVER_INFO_2 *info; - for (i=0; inumofdrivers; i++) - { - info = &(r_u->ctr.driver.info2[i]); - smb_io_printer_driver_info_2(desc, info, ps, depth, &start_offset, &end_offset); - } - break; - } - case 3: - { - DRIVER_INFO_3 *info; - for (i=0; inumofdrivers; i++) - { - info = &(r_u->ctr.driver.info3[i]); - smb_io_printer_driver_info_3(desc, info, ps, depth, &start_offset, &end_offset); - } - break; - } - } - prs_set_offset(ps, beginning+r_u->offered); - prs_align(ps); - } - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("numofdrivers", ps, depth, &(r_u->numofdrivers)); - prs_uint32("status", ps, depth, &(r_u->status)); + if (!prs_uint32("needed", ps, depth, &r_u->needed)) + return False; + + if (!prs_uint32("returned", ps, depth, &r_u->returned)) + return False; + + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; - return True; + return True; } -void free_spoolss_r_enumdrivers(SPOOL_R_ENUMPRINTERDRIVERS *r_u) -{ - switch (r_u->level) - { - case 1: - { - DRIVER_INFO_1 *driver_info_1; - driver_info_1=r_u->ctr.driver.info1; - - free(driver_info_1); - break; - } - case 2: - { - DRIVER_INFO_2 *driver_info_2; - driver_info_2=r_u->ctr.driver.info2; - - free(driver_info_2); - break; - } - case 3: - { - DRIVER_INFO_3 *driver_info_3; - - UNISTR **dependentfiles; - int i; - - driver_info_3=r_u->ctr.driver.info3; - - for (i=0; inumofdrivers; i++) - { - int j=0; - dependentfiles=(driver_info_3[i]).dependentfiles; - while ( dependentfiles[j] != NULL ) - { - free(dependentfiles[j]); - j++; - } - - free(dependentfiles); - } - free(driver_info_3); - break; - } - } -} - /******************************************************************* + Parse a SPOOL_Q_ENUMPRINTERDRIVERS structure. ********************************************************************/ BOOL spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth) { - uint32 useless_ptr=0xADDE0FF0; - prs_debug(ps, depth, desc, ""); + prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdrivers"); depth++; - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - smb_io_unistr2("", &(q_u->name),True,ps,depth); - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - smb_io_unistr2("", &(q_u->environment),True,ps,depth); - prs_align(ps); - prs_uint32("level", ps, depth, &(q_u->level)); - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); - prs_align(ps); - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + if (!prs_align(ps)) + return False; + + if (!prs_uint32("name_ptr", ps, depth, &q_u->name_ptr)) + return False; + if (!smb_io_unistr2("", &q_u->name, q_u->name_ptr,ps, depth)) + return False; + + if (!prs_align(ps)) + return False; + if (!prs_uint32("environment_ptr", ps, depth, &q_u->environment_ptr)) + return False; + if (!smb_io_unistr2("", &q_u->environment, q_u->environment_ptr, ps, depth)) + return False; + + if (!prs_align(ps)) + return False; + if (!prs_uint32("level", ps, depth, &q_u->level)) + return False; + + if (!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + return False; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("offered", ps, depth, &q_u->offered)) + return False; return True; } @@ -3451,114 +3442,61 @@ BOOL new_spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct * } /******************************************************************* + Parse a SPOOL_R_ENUMPORTS structure. ********************************************************************/ -BOOL spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth) -{ - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - int i; - - prs_debug(ps, depth, desc, "spoolss_io_r_enumports"); +BOOL new_spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "new_spoolss_io_r_enumports"); depth++; - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - switch (r_u->level) - { - case 2: - { - PORT_INFO_2 *port_2; - port_2=r_u->ctr.port.info_2; - - for (i=0; inumofports; i++) - { - bufsize_required += spoolss_size_port_info_2(&(port_2[i])); - } - break; - } - } - - DEBUG(4,("size needed: %d\n",bufsize_required)); - DEBUG(4,("size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ - - DEBUG(4,("buffer too small\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - else - { - DEBUG(4,("buffer large enough\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - beginning=prs_offset(ps); - start_offset=prs_offset(ps); - end_offset=start_offset+r_u->offered; - - switch (r_u->level) - { - case 2: - { - PORT_INFO_2 *info; - for (i=0; inumofports; i++) - { - info = &(r_u->ctr.port.info_2[i]); - smb_io_port_2(desc, info, ps, depth, &start_offset, &end_offset); - } - break; - } - } - prs_set_offset(ps, beginning+r_u->offered); - prs_align(ps); - } - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("numofports", ps, depth, &(r_u->numofports)); - prs_uint32("status", ps, depth, &(r_u->status)); + if (!prs_align(ps)) + return False; + + if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + return False; - return True; -} + if (!prs_align(ps)) + return False; + + if (!prs_uint32("needed", ps, depth, &r_u->needed)) + return False; + + if (!prs_uint32("returned", ps, depth, &r_u->returned)) + return False; + + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; -void spoolss_free_r_enumports(SPOOL_R_ENUMPORTS *r_u) -{ - switch (r_u->level) - { - case 2: - { - safe_free(r_u->ctr.port.info_2); - break; - } - } + return True; } + /******************************************************************* ********************************************************************/ BOOL spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth) { - uint32 useless; prs_debug(ps, depth, desc, ""); depth++; - prs_align(ps); - prs_uint32("useless", ps, depth, &useless); - smb_io_unistr2("", &(q_u->name),True,ps,depth); - prs_align(ps); - prs_uint32("level", ps, depth, &(q_u->level)); - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); - prs_align(ps); - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + if (!prs_align(ps)) + return False; + + if (!prs_uint32("", ps, depth, &q_u->name_ptr)) + return False; + if (!smb_io_unistr2("", &q_u->name,True,ps,depth)) + return False; + + if (!prs_align(ps)) + return False; + if (!prs_uint32("level", ps, depth, &q_u->level)) + return False; + + if (!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + return False; + + if (!prs_align(ps)) + return False; + if (!prs_uint32("offered", ps, depth, &q_u->offered)) + return False; return True; } @@ -4110,82 +4048,28 @@ BOOL spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q ********************************************************************/ BOOL spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth) { - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - int i; - prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocessors"); depth++; - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - switch (r_u->level) - { - case 1: - { - PRINTPROCESSOR_1 *info_1; - info_1=r_u->info_1; - - for (i=0; inumofprintprocessors; i++) - { - bufsize_required += spoolss_size_processor_info_1(&(info_1[i])); - } - break; - } - } - - DEBUG(4,("size needed: %d\n",bufsize_required)); - DEBUG(4,("size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ + if (!prs_align(ps)) + return False; - DEBUG(4,("buffer too small\n")); + if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + return False; - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - else - { - DEBUG(4,("buffer large enough\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - beginning=prs_offset(ps); - start_offset=prs_offset(ps); - end_offset=start_offset+r_u->offered; + if (!prs_align(ps)) + return False; - switch (r_u->level) - { - case 1: - { - PRINTPROCESSOR_1 *info_1; - for (i=0; inumofprintprocessors; i++) - { - info_1 = &(r_u->info_1[i]); - smb_io_processor_info_1(desc, info_1, ps, depth, &start_offset, &end_offset); - } - break; - } - } - prs_set_offset(ps, beginning+r_u->offered); - prs_align(ps); - } - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("numofprintprocessors", ps, depth, &(r_u->numofprintprocessors)); - prs_uint32("status", ps, depth, &(r_u->status)); + if (!prs_uint32("needed", ps, depth, &r_u->needed)) + return False; + + if (!prs_uint32("returned", ps, depth, &r_u->returned)) + return False; + + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; - return True; + return True; } /******************************************************************* @@ -4196,121 +4080,100 @@ BOOL spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q prs_debug(ps, depth, desc, "spoolss_io_q_enumprintprocessors"); depth++; - prs_align(ps); - prs_uint32("useless", ps, depth, &useless); - smb_io_unistr2("", &(q_u->name),True,ps,depth); - prs_align(ps); - prs_uint32("useless", ps, depth, &useless); - smb_io_unistr2("", &(q_u->environment),True,ps,depth); - prs_align(ps); - prs_uint32("level", ps, depth, &(q_u->level)); - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); - prs_align(ps); - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + if (!prs_align(ps)) + return False; + + if (!prs_uint32("name_ptr", ps, depth, &q_u->name_ptr)) + return False; + if (!smb_io_unistr2("name", &q_u->name, True, ps, depth)) + return False; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("", ps, depth, &q_u->environment_ptr)) + return False; + if (!smb_io_unistr2("", &q_u->environment, q_u->environment_ptr, ps, depth)) + return False; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("level", ps, depth, &q_u->level)) + return False; + + if(!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + return False; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("offered", ps, depth, &q_u->offered)) + return False; return True; } /******************************************************************* + Parse a SPOOL_Q_ENUMPRINTMONITORS structure. ********************************************************************/ -BOOL spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth) -{ - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - int i; - - prs_debug(ps, depth, desc, "spoolss_io_r_enumprintmonitors"); +BOOL spoolss_io_q_enumprintmonitors(char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_enumprintmonitors"); depth++; - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - switch (r_u->level) - { - case 1: - { - PRINTMONITOR_1 *info_1; - info_1=r_u->info_1; - - for (i=0; inumofprintmonitors; i++) - { - bufsize_required += spoolss_size_monitor_info_1(&(info_1[i])); - } - break; - } - } - - DEBUG(4,("size needed: %d\n",bufsize_required)); - DEBUG(4,("size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ + if (!prs_align(ps)) + return False; - DEBUG(4,("buffer too small\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - else - { - DEBUG(4,("buffer large enough\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - beginning=prs_offset(ps); - start_offset=prs_offset(ps); - end_offset=start_offset+r_u->offered; + if (!prs_uint32("name_ptr", ps, depth, &q_u->name_ptr)) + return False; + if (!smb_io_unistr2("name", &q_u->name, True, ps, depth)) + return False; - switch (r_u->level) - { - case 1: - { - PRINTMONITOR_1 *info_1; - for (i=0; inumofprintmonitors; i++) - { - info_1 = &(r_u->info_1[i]); - smb_io_monitor_info_1(desc, info_1, ps, depth, &start_offset, &end_offset); - } - break; - } - } - prs_set_offset(ps, beginning+r_u->offered); - prs_align(ps); - } - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("numofprintmonitors", ps, depth, &(r_u->numofprintmonitors)); - prs_uint32("status", ps, depth, &(r_u->status)); + if (!prs_align(ps)) + return False; + + if (!prs_uint32("level", ps, depth, &q_u->level)) + return False; + + if(!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + return False; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("offered", ps, depth, &q_u->offered)) + return False; return True; } /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumprintmonitors(char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth) -{ - uint32 useless; - prs_debug(ps, depth, desc, "spoolss_io_q_enumprintmonitors"); +BOOL spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_enumprintmonitors"); depth++; - prs_align(ps); - prs_uint32("useless", ps, depth, &useless); - smb_io_unistr2("", &(q_u->name),True,ps,depth); - prs_align(ps); - prs_uint32("level", ps, depth, &(q_u->level)); - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); - prs_align(ps); - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + if (!prs_align(ps)) + return False; + + if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + return False; - return True; + if (!prs_align(ps)) + return False; + + if (!prs_uint32("needed", ps, depth, &r_u->needed)) + return False; + + if (!prs_uint32("returned", ps, depth, &r_u->returned)) + return False; + + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; } /******************************************************************* -- cgit From 0e004212d25ebee5db7b27e017ddb1015f4c2a7e Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 21 Feb 2000 01:58:13 +0000 Subject: more rewrite ... comitting before starting on new functions. J.F. (This used to be commit f9c20801114f72b587a6e8c3177cbab13dbdcc28) --- source3/rpc_parse/parse_spoolss.c | 1309 ++++++++++++------------------------- 1 file changed, 432 insertions(+), 877 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 66fa2f1da5..796466337f 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -675,21 +675,20 @@ BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_ if (!prs_align(ps)) return False; - if (!prs_uint32("printername_ptr", ps, depth, &(q_u->printername_ptr))) + if (!prs_uint32("printername_ptr", ps, depth, &q_u->printername_ptr)) return False; - if (!smb_io_unistr2("", &(q_u->printername), q_u->printername_ptr, ps,depth)) + if (!smb_io_unistr2("", &q_u->printername, q_u->printername_ptr, ps,depth)) return False; if (!prs_align(ps)) return False; - if (!spoolss_io_printer_default("", &(q_u->printer_default), ps, depth)) + if (!spoolss_io_printer_default("", &q_u->printer_default, ps, depth)) return False; - if (!prs_uint32("user_switch", ps, depth, &(q_u->user_switch))) - return False; - - if (!spool_io_user_level("", &(q_u->user_ctr), ps, depth)) + if (!prs_uint32("user_switch", ps, depth, &q_u->user_switch)) + return False; + if (!spool_io_user_level("", &q_u->user_ctr, ps, depth)) return False; return True; @@ -1116,8 +1115,6 @@ BOOL spoolss_io_r_rfnpcnex(char *desc, static uint32 size_of_uint32(uint32 *value) { return (sizeof(*value)); - - return True; } /******************************************************************* @@ -1133,9 +1130,8 @@ static uint32 size_of_relative_string(UNISTR *string) size=size+1; /* add the leading zero */ size=size*2; /* convert in char */ size=size+4; /* add the size of the ptr */ - return (size); - return True; + return size; } /******************************************************************* @@ -1147,8 +1143,6 @@ static uint32 size_of_device_mode(DEVICEMODE *devmode) return (4); else return (0xDC+4); - - return True; } /******************************************************************* @@ -1160,8 +1154,6 @@ static uint32 size_of_systemtime(SYSTEMTIME *systime) return (4); else return (sizeof(SYSTEMTIME) +4); - - return True; } /******************************************************************* @@ -1177,8 +1169,6 @@ static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth++; if (!prs_unistr("unistr", ps, depth, uni)) return False; - - return True; } @@ -1457,45 +1447,79 @@ static BOOL smb_io_reldevmode(char *desc, prs_struct *ps, int depth, DEVICEMODE } /******************************************************************* + Parse a PRINTER_INFO_0 structure. ********************************************************************/ -static BOOL smb_io_printer_info_0(char *desc, PRINTER_INFO_0 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) +BOOL new_smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *info, int depth) { + prs_struct *ps=&(buffer->prs); + prs_debug(ps, depth, desc, "smb_io_printer_info_0"); depth++; - *start_offset=prs_offset(ps); - smb_io_relstr("printername",ps, depth, &(info->printername), start_offset, end_offset); - smb_io_relstr("servername",ps, depth, &(info->servername), start_offset, end_offset); - prs_uint32("cjobs", ps, depth, &(info->cjobs)); - prs_uint32("attributes", ps, depth, &(info->attributes)); - - prs_uint32("unknown0", ps, depth, &(info->unknown0)); - prs_uint32("unknown1", ps, depth, &(info->unknown1)); - prs_uint32("unknown2", ps, depth, &(info->unknown2)); - prs_uint32("unknown3", ps, depth, &(info->unknown3)); - prs_uint32("unknown4", ps, depth, &(info->unknown4)); - prs_uint32("unknown5", ps, depth, &(info->unknown5)); - prs_uint32("unknown6", ps, depth, &(info->unknown6)); - prs_uint16("majorversion", ps, depth, &(info->majorversion)); - prs_uint16("buildversion", ps, depth, &(info->buildversion)); - prs_uint32("unknown7", ps, depth, &(info->unknown7)); - prs_uint32("unknown8", ps, depth, &(info->unknown8)); - prs_uint32("unknown9", ps, depth, &(info->unknown9)); - prs_uint32("unknown10", ps, depth, &(info->unknown10)); - prs_uint32("unknown11", ps, depth, &(info->unknown11)); - prs_uint32("unknown12", ps, depth, &(info->unknown12)); - prs_uint32("unknown13", ps, depth, &(info->unknown13)); - prs_uint32("unknown14", ps, depth, &(info->unknown14)); - prs_uint32("unknown15", ps, depth, &(info->unknown15)); - prs_uint32("unknown16", ps, depth, &(info->unknown16)); - prs_uint32("unknown17", ps, depth, &(info->unknown17)); - prs_uint32("unknown18", ps, depth, &(info->unknown18)); - prs_uint32("status" , ps, depth, &(info->status)); - prs_uint32("unknown20", ps, depth, &(info->unknown20)); - prs_uint32("unknown21", ps, depth, &(info->unknown21)); - prs_uint16("unknown22", ps, depth, &(info->unknown22)); - prs_uint32("unknown23", ps, depth, &(info->unknown23)); + buffer->struct_start=prs_offset(ps); + + if (!new_smb_io_relstr("printername", buffer, depth, &info->printername)) + return False; + if (!new_smb_io_relstr("servername", buffer, depth, &info->servername)) + return False; + + if(!prs_uint32("cjobs", ps, depth, &info->cjobs)) + return False; + if(!prs_uint32("attributes", ps, depth, &info->attributes)) + 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("unknown3", ps, depth, &info->unknown3)) + return False; + if(!prs_uint32("unknown4", ps, depth, &info->unknown4)) + return False; + if(!prs_uint32("unknown5", ps, depth, &info->unknown5)) + return False; + if(!prs_uint32("unknown6", ps, depth, &info->unknown6)) + return False; + if(!prs_uint16("majorversion", ps, depth, &info->majorversion)) + return False; + if(!prs_uint16("buildversion", ps, depth, &info->buildversion)) + return False; + if(!prs_uint32("unknown7", ps, depth, &info->unknown7)) + return False; + if(!prs_uint32("unknown8", ps, depth, &info->unknown8)) + return False; + if(!prs_uint32("unknown9", ps, depth, &info->unknown9)) + return False; + if(!prs_uint32("unknown10", ps, depth, &info->unknown10)) + return False; + if(!prs_uint32("unknown11", ps, depth, &info->unknown11)) + return False; + if(!prs_uint32("unknown12", ps, depth, &info->unknown12)) + return False; + if(!prs_uint32("unknown13", ps, depth, &info->unknown13)) + return False; + if(!prs_uint32("unknown14", ps, depth, &info->unknown14)) + return False; + if(!prs_uint32("unknown15", ps, depth, &info->unknown15)) + return False; + if(!prs_uint32("unknown16", ps, depth, &info->unknown16)) + return False; + if(!prs_uint32("unknown17", ps, depth, &info->unknown17)) + return False; + if(!prs_uint32("unknown18", ps, depth, &info->unknown18)) + return False; + if(!prs_uint32("status" , ps, depth, &info->status)) + return False; + if(!prs_uint32("unknown20", ps, depth, &info->unknown20)) + return False; + if(!prs_uint32("unknown21", ps, depth, &info->unknown21)) + return False; + if(!prs_uint16("unknown22", ps, depth, &info->unknown22)) + return False; + if(!prs_uint32("unknown23", ps, depth, &info->unknown23)) + return False; return True; } @@ -1767,30 +1791,6 @@ BOOL new_smb_io_job_info_1(char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int return True; } -static BOOL smb_io_job_info_1(char *desc, JOB_INFO_1 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - prs_debug(ps, depth, desc, "smb_io_job_info_1"); - depth++; - *start_offset=prs_offset(ps); - - prs_uint32("jobid", ps, depth, &(info->jobid)); - smb_io_relstr("printername", ps, depth, &(info->printername), start_offset, end_offset); - smb_io_relstr("machinename", ps, depth, &(info->machinename), start_offset, end_offset); - smb_io_relstr("username", ps, depth, &(info->username), start_offset, end_offset); - smb_io_relstr("document", ps, depth, &(info->document), start_offset, end_offset); - smb_io_relstr("datatype", ps, depth, &(info->datatype), start_offset, end_offset); - smb_io_relstr("text_status", ps, depth, &(info->text_status), start_offset, end_offset); - prs_uint32("status", ps, depth, &(info->status)); - prs_uint32("priority", ps, depth, &(info->priority)); - prs_uint32("position", ps, depth, &(info->position)); - prs_uint32("totalpages", ps, depth, &(info->totalpages)); - prs_uint32("pagesprinted", ps, depth, &(info->pagesprinted)); - spoolss_io_system_time("submitted", ps, depth, &(info->submitted) ); - - return True; -} - /******************************************************************* Parse a JOB_INFO_2 structure. ********************************************************************/ @@ -1857,44 +1857,6 @@ BOOL new_smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int return True; } -static BOOL smb_io_job_info_2(char *desc, JOB_INFO_2 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - int pipo=0; - prs_debug(ps, depth, desc, "smb_io_job_info_2"); - depth++; - *start_offset=prs_offset(ps); - - prs_uint32("jobid", ps, depth, &(info->jobid)); - smb_io_relstr("printername", ps, depth, &(info->printername), start_offset, end_offset); - smb_io_relstr("machinename", ps, depth, &(info->machinename), start_offset, end_offset); - smb_io_relstr("username", ps, depth, &(info->username), start_offset, end_offset); - smb_io_relstr("document", ps, depth, &(info->document), start_offset, end_offset); - smb_io_relstr("notifyname", ps, depth, &(info->notifyname), start_offset, end_offset); - smb_io_relstr("datatype", ps, depth, &(info->datatype), start_offset, end_offset); - - smb_io_relstr("printprocessor", ps, depth, &(info->printprocessor), start_offset, end_offset); - smb_io_relstr("parameters", ps, depth, &(info->parameters), start_offset, end_offset); - smb_io_relstr("drivername", ps, depth, &(info->drivername), start_offset, end_offset); - smb_io_reldevmode("devmode", ps, depth, info->devmode, start_offset, end_offset); - smb_io_relstr("text_status", ps, depth, &(info->text_status), start_offset, end_offset); - -/* SEC_DESC sec_desc;*/ - prs_uint32("Hack! sec desc", ps, depth, &pipo); - - prs_uint32("status", ps, depth, &(info->status)); - prs_uint32("priority", ps, depth, &(info->priority)); - prs_uint32("position", ps, depth, &(info->position)); - prs_uint32("starttime", ps, depth, &(info->starttime)); - prs_uint32("untiltime", ps, depth, &(info->untiltime)); - prs_uint32("totalpages", ps, depth, &(info->totalpages)); - prs_uint32("size", ps, depth, &(info->size)); - spoolss_io_system_time("submitted", ps, depth, &(info->submitted) ); - prs_uint32("timeelapsed", ps, depth, &(info->timeelapsed)); - prs_uint32("pagesprinted", ps, depth, &(info->pagesprinted)); - - return True; -} /******************************************************************* ********************************************************************/ @@ -2056,8 +2018,27 @@ static BOOL smb_io_form_1(char *desc, FORM_1 *info, prs_struct *ps, int depth, return True; } + /******************************************************************* - Parse a PORT_INFO_2 structure. + Parse a DRIVER_DIRECTORY_1 structure. +********************************************************************/ +BOOL new_smb_io_driverdir_1(char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 *info, int depth) +{ + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "new_smb_io_driverdir_1"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if(!new_smb_io_relstr("name", buffer, depth, &info->name)) + return False; + + return True; +} + +/******************************************************************* + Parse a PORT_INFO_1 structure. ********************************************************************/ BOOL new_smb_io_port_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) { @@ -2174,16 +2155,18 @@ BOOL smb_io_printmonitor_info_2(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_2 * /******************************************************************* return the size required by a struct in the stream ********************************************************************/ -static uint32 spoolss_size_printer_info_0(PRINTER_INFO_0 *info) +uint32 spoolss_size_printer_info_0(PRINTER_INFO_0 *info) { int size=0; - + + size+=24*4; + size+=6; + size+=size_of_uint32( &(info->attributes) ); size+=size_of_relative_string( &(info->printername) ); size+=size_of_relative_string( &(info->servername) ); - return (size); - return True; + return size; } /******************************************************************* @@ -2242,13 +2225,9 @@ return the size required by a struct in the stream uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info) { int size=0; - DEBUG(9,("Sizing driver info_1\n")); size+=size_of_relative_string( &(info->name) ); - DEBUGADD(9,("size: [%d]\n", size)); - return (size); - - return True; + return size; } /******************************************************************* @@ -2257,7 +2236,6 @@ return the size required by a struct in the stream uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info) { int size=0; - DEBUG(9,("Sizing driver info_2\n")); size+=size_of_uint32( &(info->version) ); size+=size_of_relative_string( &(info->name) ); size+=size_of_relative_string( &(info->architecture) ); @@ -2265,10 +2243,7 @@ uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info) size+=size_of_relative_string( &(info->datafile) ); size+=size_of_relative_string( &(info->configfile) ); - DEBUGADD(9,("size: [%d]\n", size)); - return (size); - - return True; + return size; } /******************************************************************* @@ -2280,7 +2255,6 @@ uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) UNISTR **string; int i=0; - DEBUG(9,("Sizing driver info_3\n")); size+=size_of_uint32( &(info->version) ); size+=size_of_relative_string( &(info->name) ); size+=size_of_relative_string( &(info->architecture) ); @@ -2300,10 +2274,7 @@ uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) } size+=6; - DEBUGADD(9,("size: [%d]\n", size)); - return (size); - - return True; + return size; } /******************************************************************* @@ -2361,9 +2332,8 @@ uint32 spoolss_size_job_info_2(JOB_INFO_2 *info) size+=size_of_systemtime( &(info->submitted) ); size+=size_of_uint32( &(info->timeelapsed) ); size+=size_of_uint32( &(info->pagesprinted) ); - return (size); - return True; + return size; } /******************************************************************* @@ -2392,7 +2362,19 @@ uint32 spoolss_size_port_info_1(PORT_INFO_1 *info) { int size=0; - size+=size_of_relative_string( &(info->port_name) ); + size+=size_of_relative_string( &info->port_name ); + + return size; +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +uint32 spoolss_size_driverdir_info_1(DRIVER_DIRECTORY_1 *info) +{ + int size=0; + + size+=size_of_relative_string( &info->name ); return size; } @@ -2404,12 +2386,12 @@ uint32 spoolss_size_port_info_2(PORT_INFO_2 *info) { int size=0; - size+=size_of_relative_string( &(info->port_name) ); - size+=size_of_relative_string( &(info->monitor_name) ); - size+=size_of_relative_string( &(info->description) ); + size+=size_of_relative_string( &info->port_name ); + size+=size_of_relative_string( &info->monitor_name ); + size+=size_of_relative_string( &info->description ); - size+=size_of_uint32( &(info->port_type) ); - size+=size_of_uint32( &(info->reserved) ); + size+=size_of_uint32( &info->port_type ); + size+=size_of_uint32( &info->reserved ); return size; } @@ -2434,7 +2416,6 @@ uint32 spoolss_size_printmonitor_info_1(PRINTMONITOR_1 *info) size+=size_of_relative_string( &info->name ); return size; - } /******************************************************************* @@ -2450,123 +2431,41 @@ uint32 spoolss_size_printmonitor_info_2(PRINTMONITOR_2 *info) return size; } -/******************************************************************* - * make a structure. - ********************************************************************/ -/* -static BOOL make_spoolss_buffer(BUFFER* buffer, uint32 size) -{ - buffer->ptr = (size != 0) ? 1 : 0; - buffer->size = size; - buffer->data = (uint8 *)Realloc( NULL, (buffer->size) * sizeof(uint8) ); - - return (buffer->data != NULL || size == 0); -} -*/ - -/******************************************************************* - * read a uint8 buffer of size *size. - * allocate memory for it - * return a pointer to the allocated memory and the size - * return NULL and a size of 0 if the buffer is empty - * - * jfmxxxx: fix it to also write a buffer - ********************************************************************/ -static BOOL spoolss_io_read_buffer(char *desc, prs_struct *ps, int depth, BUFFER *buffer) -{ - prs_debug(ps, depth, desc, "spoolss_io_read_buffer"); - depth++; - - prs_align(ps); - - prs_uint32("pointer", ps, depth, &(buffer->ptr)); - - if (buffer->ptr != 0x0000) - { - prs_uint32("size", ps, depth, &(buffer->size)); - if (ps->io) - { - /* reading */ - buffer->data=(uint8 *)Realloc(NULL, buffer->size * sizeof(uint8) ); - } - if (buffer->data == NULL) - { - return False; - } - prs_uint8s(True, "buffer", ps, depth, buffer->data, buffer->size); - prs_align(ps); - - } - else - { - if (ps->io) - { - /* reading */ - buffer->data=0x0000; - buffer->size=0x0000; - } - } - - if (!ps->io) - { - /* writing */ - if (buffer->data != NULL) - { - free(buffer->data); - } - buffer->data = NULL; - } - return True; -} - -/******************************************************************* - * read a uint8 buffer of size *size. - * allocate memory for it - * return a pointer to the allocated memory and the size - * return NULL and a size of 0 if the buffer is empty - * - * jfmxxxx: fix it to also write a buffer - ********************************************************************/ -BOOL spoolss_io_free_buffer(BUFFER *buffer) -{ - DEBUG(8,("spoolss_io_free_buffer\n")); - - if (buffer->ptr != 0x0000) - { - free(buffer->data); - } - - return True; -} - /******************************************************************* * read a structure. * called from spoolss_getprinterdriver2 (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_getprinterdriver2(char *desc, - SPOOL_Q_GETPRINTERDRIVER2 *q_u, - prs_struct *ps, int depth) +BOOL spoolss_io_q_getprinterdriver2(char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_struct *ps, int depth) { - uint32 useless_ptr; prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdriver2"); depth++; - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("pointer", ps, depth, &useless_ptr); - smb_io_unistr2("architecture", &(q_u->architecture),True,ps,depth); + if(!prs_align(ps)) + return False; - prs_align(ps); + if(!smb_io_prt_hnd("printer handle", &q_u->handle, ps, depth)) + return False; + if(!prs_uint32("architecture_ptr", ps, depth, &q_u->architecture_ptr)) + return False; + if(!smb_io_unistr2("architecture", &q_u->architecture, q_u->architecture_ptr, ps, depth)) + return False; - prs_uint32("level", ps, depth, &(q_u->level)); - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + if(!prs_align(ps)) + return False; + if(!prs_uint32("level", ps, depth, &q_u->level)) + return False; + + if(!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("buffer size", ps, depth, &(q_u->buf_size)); - DEBUG(0,("spoolss_io_q_getprinterdriver2: renamed status - unknown\n")); - prs_uint32("unknown", ps, depth, &(q_u->unknown)); + if(!prs_uint32("offered", ps, depth, &q_u->offered)) + return False; + + if(!prs_uint32("unknown", ps, depth, &q_u->unknown)) + return False; return True; } @@ -2575,164 +2474,44 @@ BOOL spoolss_io_q_getprinterdriver2(char *desc, * read a structure. * called from spoolss_getprinterdriver2 (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, - prs_struct *ps, int depth) +BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth) { - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - uint32 pipo=0; - DRIVER_INFO_1 *info1; - DRIVER_INFO_2 *info2; - DRIVER_INFO_3 *info3; - prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriver2"); depth++; - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - - info1 = r_u->ctr.driver.info1; - info2 = r_u->ctr.driver.info2; - info3 = r_u->ctr.driver.info3; - - switch (r_u->level) - { - case 1: - { - bufsize_required += spoolss_size_printer_driver_info_1(info1); - break; - } - case 2: - { - bufsize_required += spoolss_size_printer_driver_info_2(info2); - break; - } - case 3: - { - bufsize_required += spoolss_size_printer_driver_info_3(info3); - break; - } - } - - if (ps->io) - { - /* reading */ - r_u->offered = bufsize_required; - } - - DEBUG(4,("spoolss_io_r_getprinterdriver2, size needed: %d\n",bufsize_required)); - DEBUG(4,("spoolss_io_r_getprinterdriver2, size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - if (r_u->offered < bufsize_required) - { - /* it's too small */ - r_u->status=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ + if (!prs_align(ps)) + return False; - DEBUG(4,("spoolss_io_r_getprinterdriver2, buffer too small\n")); + if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + return False; - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - else - { - DEBUG(4,("spoolss_io_r_getprinterdriver2, buffer large enough\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); + if (!prs_align(ps)) + return False; + if (!prs_uint32("needed", ps, depth, &r_u->needed)) + return False; + if (!prs_uint32("unknown0", ps, depth, &r_u->unknown0)) + return False; + if (!prs_uint32("unknown1", ps, depth, &r_u->unknown1)) + return False; + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; - beginning=prs_offset(ps); - start_offset=prs_offset(ps); - end_offset=start_offset+r_u->offered; - - switch (r_u->level) - { - case 1: - { - smb_io_printer_driver_info_1(desc, - info1, - ps, - depth, - &start_offset, - &end_offset); - break; - } - case 2: - { - smb_io_printer_driver_info_2(desc, - info2, - ps, - depth, - &start_offset, - &end_offset); - break; - } - case 3: - { - smb_io_printer_driver_info_3(desc, - info3, - ps, - depth, - &start_offset, - &end_offset); - break; - } - - } - - prs_set_offset(ps, beginning+r_u->offered); - prs_align(ps); - } - - if (!ps->io) + return True; +} + +/* + UNISTR **dependentfiles; + int j=0; + dependentfiles=info3->dependentfiles; + while ( dependentfiles[j] != NULL ) { - /* writing */ - switch (r_u->level) - { - case 1: - { - safe_free(info1); - break; - } - case 2: - { - safe_free(info2); - break; - } - case 3: - { - if (info3!=NULL) - { - UNISTR **dependentfiles; - int j=0; - dependentfiles=info3->dependentfiles; - while ( dependentfiles[j] != NULL ) - { - free(dependentfiles[j]); - j++; - } - free(dependentfiles); - - free(info3); - } - break; - } - - } + free(dependentfiles[j]); + j++; } + free(dependentfiles); - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("pipo", ps, depth, &pipo); - prs_uint32("pipo", ps, depth, &pipo); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} + free(info3); +*/ /******************************************************************* * make a structure. @@ -2762,8 +2541,7 @@ BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, * read a structure. * called from spoolss_enumprinters (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, - prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinters"); depth++; @@ -2829,175 +2607,27 @@ BOOL new_spoolss_io_r_enumprinters(char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_st * called from spoolss_r_enum_printers (srv_spoolss.c) * ********************************************************************/ -BOOL spoolss_io_r_getprinter(char *desc, - SPOOL_R_GETPRINTER *r_u, - prs_struct *ps, int depth) +BOOL spoolss_io_r_getprinter(char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth) { - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - prs_debug(ps, depth, desc, "spoolss_io_r_getprinter"); depth++; - prs_align(ps); - - prs_uint32("pointer", ps, depth, &useless_ptr); - - switch (r_u->level) - { - case 0: - { - PRINTER_INFO_0 *info; - info = r_u->ctr.printer.info0; - bufsize_required += spoolss_size_printer_info_0(info); - break; - } - case 1: - { - PRINTER_INFO_1 *info; - info = r_u->ctr.printer.info1; - bufsize_required += spoolss_size_printer_info_1(info); - break; - } - case 2: - { - PRINTER_INFO_2 *info; - info = r_u->ctr.printer.info2; - bufsize_required += spoolss_size_printer_info_2(info); - break; - } - } - - DEBUG(4,("spoolss_io_r_getprinter, size needed: %d\n",bufsize_required)); - DEBUG(4,("spoolss_io_r_getprinter, size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - if (r_u->offered < bufsize_required) - { - /* it's too small */ - r_u->status = ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered = 0; /* don't send back the buffer */ + if (!prs_align(ps)) + return False; - DEBUG(4,("spoolss_io_r_getprinter, buffer too small\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - else - { - DEBUG(4,("spoolss_io_r_getprinter, buffer large enough\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - - if (ps->io) - { - /* reading */ - r_u->ctr.printer.info = Realloc(NULL, r_u->offered); - } + if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + return False; - if (bufsize_required <= r_u->offered) - { - beginning=prs_offset(ps); - start_offset=prs_offset(ps); - end_offset=start_offset+r_u->offered; - - switch (r_u->level) - { - case 0: - { - PRINTER_INFO_0 *info; - info = r_u->ctr.printer.info0; - smb_io_printer_info_0(desc, - info, - ps, - depth, - &start_offset, - &end_offset); - if (!ps->io) - { - /* writing */ - free(info); - } - break; - } - case 1: - { - PRINTER_INFO_1 *info; - info = r_u->ctr.printer.info1; - /* - smb_io_printer_info_1(desc, - info, - ps, - depth, - &start_offset, - &end_offset); - */ - if (!ps->io) - { - /* writing */ - free(info); - } - break; - } - case 2: - { - PRINTER_INFO_2 *info; - info = r_u->ctr.printer.info2; - /* - smb_io_printer_info_2(desc, - info, - ps, - depth, - &start_offset, - &end_offset); - */ - if (!ps->io) - { - /* writing */ - free_printer_info_2(info); - } - break; - } + if (!prs_align(ps)) + return False; - } + if (!prs_uint32("needed", ps, depth, &r_u->needed)) + return False; - prs_set_offset(ps, beginning+r_u->offered); - prs_align(ps); - } - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -/******************************************************************* - * read a uint8 buffer of size *size. - * allocate memory for it - * return a pointer to the allocated memory and the size - * return NULL and a size of 0 if the buffer is empty - * - * jfmxxxx: fix it to also write a buffer - ********************************************************************/ -static BOOL spoolss_io_read_buffer8(char *desc, prs_struct *ps, uint8 **buffer, uint32 *size,int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_read_buffer8"); - depth++; - - prs_align(ps); - - prs_uint32("buffer size", ps, depth, size); - *buffer = (uint8 *)Realloc(NULL, (*size) * sizeof(uint8) ); - prs_uint8s(True,"buffer",ps,depth,*buffer,*size); - prs_align(ps); + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; - return True; + return True; } /******************************************************************* @@ -3024,38 +2654,28 @@ BOOL make_spoolss_q_getprinter(SPOOL_Q_GETPRINTER *q_u, * read a structure. * called from spoolss_getprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, - prs_struct *ps, int depth) +BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps, int depth) { - uint32 count = 0; - uint32 buf_ptr = q_u->buffer != NULL ? 1 : 0; prs_debug(ps, depth, desc, "spoolss_io_q_getprinter"); depth++; - prs_align(ps); + if (!prs_align(ps)) + return False; - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - - prs_uint32("level", ps, depth, &(q_u->level)); + if(!smb_io_prt_hnd("printer handle", &q_u->handle, ps, depth)) + return False; + if (!prs_uint32("level", ps, depth, &q_u->level)) + return False; - if (!ps->io) - { - /* writing */ - buf_ptr = q_u->buffer != NULL ? 1 : 0; - } - prs_uint32("buffer pointer", ps, depth, &buf_ptr); + if (!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + return False; - if (buf_ptr != 0) - { - spoolss_io_read_buffer8("",ps, &q_u->buffer, &count,depth); - } - if (q_u->buffer != NULL) - { - free(q_u->buffer); - } - prs_uint32("buffer size", ps, depth, &(q_u->offered)); + if (!prs_align(ps)) + return False; + if (!prs_uint32("offered", ps, depth, &q_u->offered)) + return False; - return count == q_u->offered; + return True; } /******************************************************************* @@ -3138,9 +2758,11 @@ BOOL spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int de prs_debug(ps, depth, desc, ""); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } @@ -3149,20 +2771,25 @@ BOOL spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int de ********************************************************************/ BOOL spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, ""); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("level", ps, depth, &(q_u->level)); + if(!smb_io_prt_hnd("printer handle", &q_u->handle, ps, depth)) + return False; + if(!prs_uint32("level", ps, depth, &q_u->level)) + return False; - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + if(!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + if(!prs_uint32("offered", ps, depth, &q_u->offered)) + return False; return True; } @@ -3589,8 +3216,7 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s prs_uint32("info level", ps, depth, &level); prs_uint32("useless", ps, depth, &useless); - switch (level) - { + switch (level) { /* * level 0 is used by setprinter when managing the queue * (hold, stop, start a queue) @@ -3614,7 +3240,6 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s ********************************************************************/ BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth) { - uint32 useless; prs_debug(ps, depth, desc, "spoolss_io_q_addprinterex"); depth++; @@ -3624,32 +3249,44 @@ BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct * the info level are handled in a nice way. */ - prs_align(ps); - prs_uint32("useless", ps, depth, &useless); - smb_io_unistr2("", &(q_u->server_name),True,ps,depth); - prs_align(ps); + if(!prs_align(ps)) + return False; + if(!prs_uint32("", ps, depth, &q_u->server_name_ptr)) + return False; + if(!smb_io_unistr2("", &q_u->server_name, q_u->server_name_ptr, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("info_level", ps, depth, &q_u->level)) + return False; - prs_uint32("info_level", ps, depth, &(q_u->level)); - - spool_io_printer_info_level("", &(q_u->info), ps, depth); - - /* the 4 unknown are all 0 */ + if(!spool_io_printer_info_level("", &(q_u->info), ps, depth)) + return False; + /* the 4 unknown are all 0 */ + /* * en fait ils sont pas inconnu * par recoupement avec rpcSetPrinter * c'est le devicemode * et le security descriptor. */ - - prs_uint32("unk0", ps, depth, &(q_u->unk0)); - prs_uint32("unk1", ps, depth, &(q_u->unk1)); - prs_uint32("unk2", ps, depth, &(q_u->unk2)); - prs_uint32("unk3", ps, depth, &(q_u->unk3)); - - prs_uint32("info_level", ps, depth, &(q_u->user_level)); - spool_io_user_level("", &(q_u->user), ps, depth); + if(!prs_uint32("unk0", ps, depth, &q_u->unk0)) + return False; + if(!prs_uint32("unk1", ps, depth, &q_u->unk1)) + return False; + if(!prs_uint32("unk2", ps, depth, &q_u->unk2)) + return False; + if(!prs_uint32("unk3", ps, depth, &q_u->unk3)) + return False; + + if(!prs_uint32("user_switch", ps, depth, &q_u->user_switch)) + return False; + if(!spool_io_user_level("", &q_u->user_ctr, ps, depth)) + return False; return True; } @@ -3676,52 +3313,71 @@ BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_ { SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *il; - prs_debug(ps, depth, desc, ""); + prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level_3"); depth++; /* reading */ - if (ps->io) - { + if (UNMARSHALLING(ps)) { il=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *)malloc(sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); ZERO_STRUCTP(il); *q_u=il; - DEBUG(1,("lecture: memoire ok\n")); } - else - { + else { il=*q_u; } - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("cversion", ps, depth, &(il->cversion)); - prs_uint32("name", ps, depth, &(il->name_ptr)); - prs_uint32("environment", ps, depth, &(il->environment_ptr)); - prs_uint32("driverpath", ps, depth, &(il->driverpath_ptr)); - prs_uint32("datafile", ps, depth, &(il->datafile_ptr)); - prs_uint32("configfile", ps, depth, &(il->configfile_ptr)); - prs_uint32("helpfile", ps, depth, &(il->helpfile_ptr)); - prs_uint32("monitorname", ps, depth, &(il->monitorname_ptr)); - prs_uint32("defaultdatatype", ps, depth, &(il->defaultdatatype_ptr)); - prs_uint32("dependentfilessize", ps, depth, &(il->dependentfilessize)); - prs_uint32("dependentfiles", ps, depth, &(il->dependentfiles_ptr)); + if(!prs_uint32("cversion", ps, depth, &il->cversion)) + return False; + if(!prs_uint32("name", ps, depth, &il->name_ptr)) + return False; + if(!prs_uint32("environment", ps, depth, &il->environment_ptr)) + return False; + if(!prs_uint32("driverpath", ps, depth, &il->driverpath_ptr)) + return False; + if(!prs_uint32("datafile", ps, depth, &il->datafile_ptr)) + return False; + if(!prs_uint32("configfile", ps, depth, &il->configfile_ptr)) + return False; + if(!prs_uint32("helpfile", ps, depth, &il->helpfile_ptr)) + return False; + if(!prs_uint32("monitorname", ps, depth, &il->monitorname_ptr)) + return False; + if(!prs_uint32("defaultdatatype", ps, depth, &il->defaultdatatype_ptr)) + return False; + if(!prs_uint32("dependentfilessize", ps, depth, &il->dependentfilessize)) + return False; + if(!prs_uint32("dependentfiles", ps, depth, &il->dependentfiles_ptr)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_unistr2("", &(il->name), il->name_ptr, ps, depth); - smb_io_unistr2("", &(il->environment), il->environment_ptr, ps, depth); - smb_io_unistr2("", &(il->driverpath), il->driverpath_ptr, ps, depth); - smb_io_unistr2("", &(il->datafile), il->datafile_ptr, ps, depth); - smb_io_unistr2("", &(il->configfile), il->configfile_ptr, ps, depth); - smb_io_unistr2("", &(il->helpfile), il->helpfile_ptr, ps, depth); - smb_io_unistr2("", &(il->monitorname), il->monitorname_ptr, ps, depth); - smb_io_unistr2("", &(il->defaultdatatype), il->defaultdatatype_ptr, ps, depth); + if(!smb_io_unistr2("name", &il->name, il->name_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("environment", &il->environment, il->environment_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("driverpath", &il->driverpath, il->driverpath_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("datafile", &il->datafile, il->datafile_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("configfile", &il->configfile, il->configfile_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("helpfile", &il->helpfile, il->helpfile_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("monitorname", &il->monitorname, il->monitorname_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("defaultdatatype", &il->defaultdatatype, il->defaultdatatype_ptr, ps, depth)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; + if (il->dependentfiles_ptr) smb_io_buffer5("", &(il->dependentfiles), ps, depth); - return True; } @@ -3807,23 +3463,25 @@ BOOL smb_io_unibuffer(char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) ********************************************************************/ BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth) { - uint32 useless; - uint32 level; - prs_debug(ps, depth, desc, ""); + prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level"); depth++; - prs_align(ps); - prs_uint32("info level", ps, depth, &level); - prs_uint32("useless", ps, depth, &useless); + if(!prs_align(ps)) + return False; + if(!prs_uint32("level", ps, depth, &il->level)) + return False; + if(!prs_uint32("ptr", ps, depth, &il->ptr)) + return False; + + if (il->ptr==0) + return True; - switch (level) - { + switch (il->level) { case 3: spool_io_printer_driver_info_level_3("", &(il->info_3), ps, depth); break; } - return True; } @@ -3831,17 +3489,24 @@ BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LE ********************************************************************/ BOOL spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) { - uint32 useless; - prs_debug(ps, depth, desc, ""); + prs_debug(ps, depth, desc, "spoolss_io_q_addprinterdriver"); depth++; - prs_align(ps); - prs_uint32("useless", ps, depth, &useless); - smb_io_unistr2("", &(q_u->server_name),True,ps,depth); - prs_align(ps); - prs_uint32("info_level", ps, depth, &(q_u->level)); + if(!prs_align(ps)) + return False; + + if(!prs_uint32("server_name_ptr", ps, depth, &q_u->server_name_ptr)) + return False; + if(!smb_io_unistr2("server_name", &q_u->server_name, q_u->server_name_ptr, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + if(!prs_uint32("info_level", ps, depth, &q_u->level)) + return False; - spool_io_printer_driver_info_level("", &(q_u->info), ps, depth); + if(!spool_io_printer_driver_info_level("", &q_u->info, ps, depth)) + return False; return True; } @@ -3850,10 +3515,11 @@ BOOL spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, pr ********************************************************************/ BOOL spoolss_io_r_addprinterdriver(char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, ""); + prs_debug(ps, depth, desc, "spoolss_io_r_addprinterdriver"); depth++; - prs_uint32("status", ps, depth, &(q_u->status)); + if(!prs_uint32("status", ps, depth, &q_u->status)) + return False; return True; } @@ -3944,104 +3610,70 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, } /******************************************************************* + Parse a SPOOL_Q_GETPRINTERDRIVERDIR structure. ********************************************************************/ -BOOL spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth) -{ - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - - prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriverdir"); +BOOL spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdriverdir"); depth++; - prs_align(ps); - - prs_uint32("pointer", ps, depth, &useless_ptr); - - switch (r_u->level) - { - case 1: - { - DRIVER_DIRECTORY_1 *driver_info_1; - driver_info_1=&(r_u->ctr.driver.info_1); - - bufsize_required = size_of_relative_string(&(driver_info_1->name)); - break; - } - } - - DEBUG(4,("spoolss_io_r_getprinterdriverdir, size needed: %d\n",bufsize_required)); - DEBUG(4,("spoolss_io_r_getprinterdriverdir, size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - - if (r_u->offeredname_ptr)) + return False; + if(!smb_io_unistr2("", &q_u->name, q_u->name_ptr, ps, depth)) + return False; - /* it's too small */ - r_u->status=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ - DEBUG(4,("spoolss_io_r_getprinterdriverdir, buffer too small\n")); + if(!prs_align(ps)) + return False; + + if(!prs_uint32("", ps, depth, &q_u->environment_ptr)) + return False; + if(!smb_io_unistr2("", &q_u->environment, q_u->environment_ptr, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - else - { - DEBUG(4,("spoolss_io_r_getprinterdriverdir, buffer large enough\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - beginning=prs_offset(ps); - start_offset=prs_offset(ps); - end_offset=start_offset+r_u->offered; + if(!prs_uint32("level", ps, depth, &q_u->level)) + return False; - switch (r_u->level) - { - case 1: - { - DRIVER_DIRECTORY_1 *info; - info = &(r_u->ctr.driver.info_1); - prs_unistr("name", ps, depth, &(info->name)); - /*smb_io_printer_driver_dir_1(desc, info, ps, depth, &start_offset, &end_offset);*/ - break; - } - } - prs_set_offset(ps, beginning+r_u->offered); - prs_align(ps); - } - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("status", ps, depth, &(r_u->status)); + if(!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("offered", ps, depth, &q_u->offered)) + return False; return True; } /******************************************************************* + Parse a SPOOL_R_GETPRINTERDRIVERDIR structure. ********************************************************************/ -BOOL spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, prs_struct *ps, int depth) -{ - - uint32 useless_ptr=0xADDE0FF0; - prs_debug(ps, depth, desc, ""); +BOOL spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriverdir"); depth++; - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - smb_io_unistr2("", &(q_u->name),True,ps,depth); - prs_align(ps); - prs_uint32("pointer", ps, depth, &useless_ptr); - smb_io_unistr2("", &(q_u->environment),True,ps,depth); - prs_align(ps); - prs_uint32("level", ps, depth, &(q_u->level)); - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); - prs_align(ps); - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + if (!prs_align(ps)) + return False; + + if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + return False; - return True; + if (!prs_align(ps)) + return False; + + if (!prs_uint32("needed", ps, depth, &r_u->needed)) + return False; + + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; } /******************************************************************* @@ -4295,23 +3927,23 @@ BOOL convert_specific_param(NT_PRINTER_PARAM **param, const UNISTR2 *value, ********************************************************************/ static BOOL spoolss_io_addform(char *desc, FORM *f, uint32 ptr, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, "spoolss_io_addform"); - depth++; - prs_align(ps); - - if (ptr!=0) - { - prs_uint32("flags", ps, depth, &(f->flags)); - prs_uint32("name_ptr", ps, depth, &(f->name_ptr)); - prs_uint32("size_x", ps, depth, &(f->size_x)); - prs_uint32("size_y", ps, depth, &(f->size_y)); - prs_uint32("left", ps, depth, &(f->left)); - prs_uint32("top", ps, depth, &(f->top)); - prs_uint32("right", ps, depth, &(f->right)); - prs_uint32("bottom", ps, depth, &(f->bottom)); + prs_debug(ps, depth, desc, "spoolss_io_addform"); + depth++; + prs_align(ps); - smb_io_unistr2("", &(f->name), f->name_ptr, ps, depth); - } + if (ptr!=0) + { + prs_uint32("flags", ps, depth, &(f->flags)); + prs_uint32("name_ptr", ps, depth, &(f->name_ptr)); + prs_uint32("size_x", ps, depth, &(f->size_x)); + prs_uint32("size_y", ps, depth, &(f->size_y)); + prs_uint32("left", ps, depth, &(f->left)); + prs_uint32("top", ps, depth, &(f->top)); + prs_uint32("right", ps, depth, &(f->right)); + prs_uint32("bottom", ps, depth, &(f->bottom)); + + smb_io_unistr2("", &(f->name), f->name_ptr, ps, depth); + } return True; } @@ -4320,20 +3952,20 @@ static BOOL spoolss_io_addform(char *desc, FORM *f, uint32 ptr, prs_struct *ps, ********************************************************************/ BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth) { - uint32 useless_ptr=0; - prs_debug(ps, depth, desc, "spoolss_io_q_addform"); - depth++; + uint32 useless_ptr=0; + prs_debug(ps, depth, desc, "spoolss_io_q_addform"); + depth++; - prs_align(ps); - smb_io_prt_hnd("printer handle", &(q_u->handle), ps, depth); - prs_uint32("level", ps, depth, &(q_u->level)); - prs_uint32("level2", ps, depth, &(q_u->level2)); + prs_align(ps); + smb_io_prt_hnd("printer handle", &(q_u->handle), ps, depth); + prs_uint32("level", ps, depth, &(q_u->level)); + prs_uint32("level2", ps, depth, &(q_u->level2)); - if (q_u->level==1) - { - prs_uint32("useless_ptr", ps, depth, &(useless_ptr)); - spoolss_io_addform("", &(q_u->form), useless_ptr, ps, depth); - } + if (q_u->level==1) + { + prs_uint32("useless_ptr", ps, depth, &(useless_ptr)); + spoolss_io_addform("", &(q_u->form), useless_ptr, ps, depth); + } return True; } @@ -4342,11 +3974,11 @@ BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int ********************************************************************/ BOOL spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, "spoolss_io_r_addform"); - depth++; + prs_debug(ps, depth, desc, "spoolss_io_r_addform"); + depth++; - prs_align(ps); - prs_uint32("status", ps, depth, &(r_u->status)); + prs_align(ps); + prs_uint32("status", ps, depth, &(r_u->status)); return True; } @@ -4391,134 +4023,57 @@ BOOL spoolss_io_r_setform(char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int } /******************************************************************* + Parse a SPOOL_R_GETJOB structure. ********************************************************************/ BOOL spoolss_io_r_getjob(char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int depth) { - uint32 useless_ptr=0xADDE0FF0; - uint32 start_offset, end_offset, beginning; - uint32 bufsize_required=0; - prs_debug(ps, depth, desc, "spoolss_io_r_getjob"); depth++; - prs_align(ps); - - prs_uint32("pointer", ps, depth, &useless_ptr); - - switch (r_u->level) - { - case 1: - { - JOB_INFO_1 *info; - info=r_u->ctr.job.job_info_1; - - bufsize_required += spoolss_size_job_info_1(info); - break; - } - case 2: - { - JOB_INFO_2 *info; - info=r_u->ctr.job.job_info_2; - - bufsize_required += spoolss_size_job_info_2(info); - break; - } - } - - DEBUG(4,("spoolss_io_r_getjob, size needed: %d\n",bufsize_required)); - DEBUG(4,("spoolss_io_r_getjob, size offered: %d\n",r_u->offered)); - - /* check if the buffer is big enough for the datas */ - if (r_u->offeredstatus=ERROR_INSUFFICIENT_BUFFER; /* say so */ - r_u->offered=0; /* don't send back the buffer */ + if (!prs_align(ps)) + return False; - DEBUG(4,("spoolss_io_r_getjob, buffer too small\n")); + if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + return False; - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - } - else - { - DEBUG(4,("spoolss_io_r_enumjobs, buffer large enough\n")); - - prs_uint32("size of buffer", ps, depth, &(r_u->offered)); - beginning=prs_offset(ps); - start_offset=prs_offset(ps); - end_offset=start_offset+r_u->offered; + if (!prs_align(ps)) + return False; - switch (r_u->level) - { - case 1: - { - JOB_INFO_1 *info; - info = r_u->ctr.job.job_info_1; - smb_io_job_info_1(desc, info, ps, depth, &start_offset, &end_offset); - break; - } - case 2: - { - JOB_INFO_2 *info; - info = r_u->ctr.job.job_info_2; - smb_io_job_info_2(desc, info, ps, depth, &start_offset, &end_offset); - break; - } + if (!prs_uint32("needed", ps, depth, &r_u->needed)) + return False; - } - prs_set_offset(ps, beginning+r_u->offered); - prs_align(ps); - } - - /* - * if the buffer was too small, send the minimum required size - * if it was too large, send the real needed size - */ - - prs_uint32("size of buffer needed", ps, depth, &(bufsize_required)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; -/**************************************************************************** -****************************************************************************/ -void free_spoolss_r_getjob(SPOOL_R_GETJOB *r_u) -{ - switch (r_u->level) - { - case 1: - { - free(r_u->ctr.job.job_info_1); - break; - } - case 2: - { - free_job_info_2(r_u->ctr.job.job_info_2); - break; - } - } + return True; } /******************************************************************* + Parse a SPOOL_Q_GETJOB structure. ********************************************************************/ BOOL spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, ""); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("jobid", ps, depth, &(q_u->jobid)); - prs_uint32("level", ps, depth, &(q_u->level)); + if(!smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth)) + return False; + if(!prs_uint32("jobid", ps, depth, &q_u->jobid)) + return False; + if(!prs_uint32("level", ps, depth, &q_u->level)) + return False; - spoolss_io_read_buffer("", ps, depth, &(q_u->buffer)); + if(!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("buf_size", ps, depth, &(q_u->buf_size)); + if(!prs_uint32("offered", ps, depth, &q_u->offered)) + return False; return True; } -- cgit From f3319f7963e04a9642d604e706a10df3cd96dd73 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Thu, 24 Feb 2000 16:27:06 +0000 Subject: converted a couple of bzero() to memset() rewrote the printer notify code, so now it's compatible with SP5 and fully dynamic. No more limits on printers and job lists. removed the make_xxx() functions as they are not used and broken fixed a bug in the open handle function. J.F. (This used to be commit aa9054d14bc940f251639ab897d9f356814f5fc0) --- source3/rpc_parse/parse_spoolss.c | 344 ++++++++++++++++---------------------- 1 file changed, 145 insertions(+), 199 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 796466337f..0979799a98 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -179,24 +179,26 @@ static BOOL smb_io_doc_info_container(char *desc, DOC_INFO_CONTAINER *cont, prs_ /******************************************************************* reads or writes an NOTIFY OPTION TYPE structure. ********************************************************************/ -static BOOL smb_io_notify_option_type(char *desc, - SPOOL_NOTIFY_OPTION_TYPE *type, - prs_struct *ps, int depth) +static BOOL smb_io_notify_option_type(char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) { - uint32 useless_ptr; - prs_debug(ps, depth, desc, "smb_io_notify_option_type"); depth++; - prs_align(ps); - - prs_uint16("type", ps, depth, &(type->type)); - prs_uint16("reserved0", ps, depth, &(type->reserved0)); - prs_uint32("reserved1", ps, depth, &(type->reserved1)); - prs_uint32("reserved2", ps, depth, &(type->reserved2)); - prs_uint32("count", ps, depth, &(type->count)); - prs_uint32("useless ptr", ps, depth, &useless_ptr); + if (!prs_align(ps)) + return False; + if(!prs_uint16("type", ps, depth, &type->type)) + return False; + if(!prs_uint16("reserved0", ps, depth, &type->reserved0)) + return False; + if(!prs_uint32("reserved1", ps, depth, &type->reserved1)) + return False; + if(!prs_uint32("reserved2", ps, depth, &type->reserved2)) + return False; + if(!prs_uint32("count", ps, depth, &type->count)) + return False; + if(!prs_uint32("fields_ptr", ps, depth, &type->fields_ptr)) + return False; return True; } @@ -204,79 +206,97 @@ static BOOL smb_io_notify_option_type(char *desc, /******************************************************************* reads or writes an NOTIFY OPTION TYPE DATA. ********************************************************************/ -static BOOL smb_io_notify_option_type_data(char *desc, - SPOOL_NOTIFY_OPTION_TYPE *type, - prs_struct *ps, int depth) +static BOOL smb_io_notify_option_type_data(char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) { - uint32 count; int i; prs_debug(ps, depth, desc, "smb_io_notify_option_type_data"); depth++; - prs_align(ps); + /* if there are no fields just return */ + if (type->fields_ptr==0) + return True; + + if(!prs_align(ps)) + return False; - prs_uint32("count", ps, depth, &count); + if(!prs_uint32("count2", ps, depth, &type->count2)) + return False; - if (count != type->count) - { - DEBUG(4,("What a mess, count was %x now is %x !\n",type->count,count)); - type->count=count; - } - for(i=0;ifields[i])); - } + if (type->count2 != type->count) + DEBUG(4,("What a mess, count was %x now is %x !\n", type->count, type->count2)); + /* parse the option type data */ + for(i=0;icount2;i++) + if(!prs_uint16("fields",ps,depth,&(type->fields[i]))) + return False; return True; } /******************************************************************* reads or writes an NOTIFY OPTION structure. ********************************************************************/ -static BOOL smb_io_notify_option(char *desc, SPOOL_NOTIFY_OPTION *option, - prs_struct *ps, int depth) -{ - uint32 useless_ptr; +static BOOL smb_io_notify_option_type_ctr(char *desc, SPOOL_NOTIFY_OPTION_TYPE_CTR *ctr , prs_struct *ps, int depth) +{ int i; - - prs_debug(ps, depth, desc, "smb_io_notify_option"); + + prs_debug(ps, depth, desc, "smb_io_notify_option_type_ctr"); depth++; - prs_align(ps); + if(!prs_uint32("count", ps, depth, &ctr->count)) + return False; - /* memory pointer to the struct */ - prs_uint32("useless ptr", ps, depth, &useless_ptr); + /* reading */ + if (UNMARSHALLING(ps)) + ctr->type=(SPOOL_NOTIFY_OPTION_TYPE *)malloc(ctr->count*sizeof(SPOOL_NOTIFY_OPTION_TYPE)); + + /* the option type struct */ + for(i=0;icount;i++) + if(!smb_io_notify_option_type("", &(ctr->type[i]) , ps, depth)) + return False; + + /* the type associated with the option type struct */ + for(i=0;icount;i++) + if(!smb_io_notify_option_type_data("", &(ctr->type[i]) , ps, depth)) + return False; - prs_uint32("version", ps, depth, &(option->version)); - prs_uint32("reserved", ps, depth, &(option->reserved)); - prs_uint32("count", ps, depth, &(option->count)); - prs_uint32("useless ptr", ps, depth, &useless_ptr); - prs_uint32("count", ps, depth, &(option->count)); - - /* read the option type struct */ - for(i=0;icount;i++) - { - smb_io_notify_option_type("",&(option->type[i]) ,ps, depth); - } + return True; +} - /* now read the type associated with the option type struct */ - for(i=0;icount;i++) - { - smb_io_notify_option_type_data("",&(option->type[i]) ,ps, depth); +/******************************************************************* +reads or writes an NOTIFY OPTION structure. +********************************************************************/ +static BOOL smb_io_notify_option(char *desc, SPOOL_NOTIFY_OPTION *option, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "smb_io_notify_option"); + depth++; + + if(!prs_uint32("version", ps, depth, &option->version)) + return False; + if(!prs_uint32("flags", ps, depth, &option->flags)) + return False; + if(!prs_uint32("count", ps, depth, &option->count)) + return False; + if(!prs_uint32("option_type_ptr", ps, depth, &option->option_type_ptr)) + return False; + + /* marshalling or unmarshalling, that would work */ + if (option->option_type_ptr!=0) { + if(!smb_io_notify_option_type_ctr("", &option->ctr ,ps, depth)) + return False; + } + else { + option->ctr.type=NULL; + option->ctr.count=0; } - return True; } - /******************************************************************* reads or writes an NOTIFY INFO DATA structure. ********************************************************************/ -static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, - prs_struct *ps, int depth) +static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) { uint32 useless_ptr=0xADDE0FF0; @@ -354,19 +374,16 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, /******************************************************************* reads or writes an NOTIFY INFO structure. ********************************************************************/ -static BOOL smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, - prs_struct *ps, int depth) +static BOOL smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, prs_struct *ps, int depth) { - uint32 useless_ptr=0x0001; int i; - info->version=0x02; prs_debug(ps, depth, desc, "smb_io_notify_info"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("pointer", ps, depth, &useless_ptr); prs_uint32("count", ps, depth, &(info->count)); prs_uint32("version", ps, depth, &(info->version)); prs_uint32("flags", ps, depth, &(info->flags)); @@ -380,8 +397,7 @@ static BOOL smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, /* now do the strings at the end of the stream */ for (i=0;icount;i++) { - smb_io_notify_info_data_strings(desc, &(info->data[i]), - ps, depth); + smb_io_notify_info_data_strings(desc, &(info->data[i]), ps, depth); } return True; @@ -617,49 +633,6 @@ static BOOL spoolss_io_printer_default(char *desc, PRINTER_DEFAULT *pd, prs_stru return True; } -/******************************************************************* - * make a structure. - ********************************************************************/ -BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, - const char *printername, - uint32 cbbuf, uint32 devmod, uint32 des_access, - const char *station, - const char *username) -{ - int len_name = printername != NULL ? strlen(printername) : 0; - int len_sta = station != NULL ? strlen(station ) : 0; - int len_user = username != NULL ? strlen(username ) : 0; - - if (q_u == NULL) return False; - - DEBUG(5,("make_spoolss_io_q_open_printer_ex\n")); - - q_u->printername_ptr = 1; - init_unistr2(&(q_u->printername), printername, len_name); - -/* - q_u->unknown0 = 0x0; - q_u->cbbuf = cbbuf; - q_u->devmod = devmod; - q_u->access_required = des_access; -*/ -/* q_u->unknown1 = 0x1; - q_u->unknown2 = 0x1; - q_u->unknown3 = 0x149f7d8; - q_u->unknown4 = 0x1c; - q_u->unknown5 = 0x00b94dd0; - q_u->unknown6 = 0x0149f5cc; - q_u->unknown7 = 0x00000565; - q_u->unknown8 = 0x2; - q_u->unknown9 = 0x0; - q_u->unknown10 = 0x0; - - init_unistr2(&(q_u->station), station, len_sta); - init_unistr2(&(q_u->username), username, len_user); -*/ - return True; -} - /******************************************************************* * read a structure. * called from spoolss_q_open_printer_ex (srv_spoolss.c) @@ -1026,29 +999,43 @@ BOOL spoolss_io_r_writeprinter(char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct * read a structure. * called from spoolss_q_rffpcnex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, - prs_struct *ps, int depth) +BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, int depth) { - uint32 useless_ptr; - prs_debug(ps, depth, desc, "spoolss_io_q_rffpcnex"); depth++; - prs_align(ps); - - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("flags", ps, depth, &(q_u->flags)); - prs_uint32("options", ps, depth, &(q_u->options)); - prs_uint32("useless ptr", ps, depth, &useless_ptr); - /*prs_align(ps);*/ - smb_io_unistr2("", &(q_u->localmachine), True, ps, depth); - - prs_align(ps); - prs_uint32("printerlocal", ps, depth, &(q_u->printerlocal)); + if(!prs_align(ps)) + return False; - smb_io_notify_option("notify option", &(q_u->option), ps, depth); + if(!smb_io_prt_hnd("printer handle", &q_u->handle, ps, depth)) + return False; + if(!prs_uint32("flags", ps, depth, &q_u->flags)) + return False; + if(!prs_uint32("options", ps, depth, &q_u->options)) + return False; + if(!prs_uint32("localmachine_ptr", ps, depth, &q_u->localmachine_ptr)) + return False; + if(!smb_io_unistr2("localmachine", &q_u->localmachine, q_u->localmachine_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + if(!prs_uint32("printerlocal", ps, depth, &q_u->printerlocal)) + return False; + if(!prs_uint32("option_ptr", ps, depth, &q_u->option_ptr)) + return False; + + if (q_u->option_ptr!=0) { + + if (UNMARSHALLING(ps)) + q_u->option=(SPOOL_NOTIFY_OPTION *)malloc(sizeof(SPOOL_NOTIFY_OPTION)); + + if(!smb_io_notify_option("notify option", q_u->option, ps, depth)) + return False; + } + return True; } @@ -1056,13 +1043,13 @@ BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, * write a structure. * called from spoolss_r_rffpcnex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, - prs_struct *ps, int depth) +BOOL spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_rffpcnex"); depth++; - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } @@ -1071,20 +1058,31 @@ BOOL spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, * read a structure. * called from spoolss_q_rfnpcnex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, - prs_struct *ps, int depth) +BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, "spoolss_io_q_rfnpcnex"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + if(!smb_io_prt_hnd("printer handle",&q_u->handle,ps,depth)) + return False; - prs_uint32("change", ps, depth, &(q_u->change)); + if(!prs_uint32("change", ps, depth, &q_u->change)) + return False; + + if(!prs_uint32("option_ptr", ps, depth, &q_u->option_ptr)) + return False; + + if (q_u->option_ptr!=0) { + + if (UNMARSHALLING(ps)) + q_u->option=(SPOOL_NOTIFY_OPTION *)malloc(sizeof(SPOOL_NOTIFY_OPTION)); - smb_io_notify_option("notify option",&(q_u->option),ps,depth); + if(!smb_io_notify_option("notify option", q_u->option, ps, depth)) + return False; + } return True; } @@ -1093,18 +1091,24 @@ BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, * write a structure. * called from spoolss_r_rfnpcnex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_rfnpcnex(char *desc, - SPOOL_R_RFNPCNEX *r_u, - prs_struct *ps, int depth) +BOOL spoolss_io_r_rfnpcnex(char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_rfnpcnex"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; + + if (!prs_uint32("info_ptr", ps, depth, &r_u->info_ptr)) + return False; - smb_io_notify_info("notify info",&(r_u->info),ps,depth); - prs_align(ps); - prs_uint32("status", ps, depth, &r_u->status); + if(!smb_io_notify_info("notify info", &r_u->info ,ps,depth)) + return False; + + if(!prs_align(ps)) + return False; + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } @@ -2499,44 +2503,6 @@ BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, return True; } -/* - UNISTR **dependentfiles; - int j=0; - dependentfiles=info3->dependentfiles; - while ( dependentfiles[j] != NULL ) - { - free(dependentfiles[j]); - j++; - } - free(dependentfiles); - - free(info3); -*/ - -/******************************************************************* - * make a structure. - ********************************************************************/ -BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, - uint32 flags, - const char* servername, - uint32 level, - uint32 size) -{ - size_t len_name = servername != NULL ? strlen(servername) : 0; - - DEBUG(5,("make_spoolss_q_enumprinters. size: %d\n", size)); - - q_u->flags = flags; - - init_unistr2(&q_u->servername, servername, len_name); - - q_u->level = level; - /*make_spoolss_buffer(&q_u->buffer, size);*/ -/* q_u->buf_size = size;*/ - - return True; -} - /******************************************************************* * read a structure. * called from spoolss_enumprinters (srv_spoolss.c) @@ -2630,26 +2596,6 @@ BOOL spoolss_io_r_getprinter(char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps return True; } -/******************************************************************* - * make a structure. - * called from spoolss_getprinter (srv_spoolss.c) - ********************************************************************/ -BOOL make_spoolss_q_getprinter(SPOOL_Q_GETPRINTER *q_u, - POLICY_HND *hnd, - uint32 level, - uint32 buf_size) -{ - if (q_u == NULL) return False; - - memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - - q_u->level = level; - q_u->buffer = (uint8 *)Realloc(NULL, (buf_size) * sizeof(uint8) ); - q_u->offered = buf_size; - - return True; -} - /******************************************************************* * read a structure. * called from spoolss_getprinter (srv_spoolss.c) -- cgit From badee62bca8b81db7ede74ac8ea7710b14a07b4c Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Sat, 26 Feb 2000 22:22:24 +0000 Subject: rewrote enumprinterdata. still a bug in it but reproducing it hard and borring. I need a client test program urgently!!! rewrote setprinter, doesn't coredump anymore, and no memleak. J.F. (This used to be commit b76ae1f92f4f12b38c4245456cdd2db970724077) --- source3/rpc_parse/parse_spoolss.c | 241 ++++++++++++++++++++++---------------- 1 file changed, 139 insertions(+), 102 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 0979799a98..d1f7ed61a4 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -575,6 +575,9 @@ static BOOL spoolss_io_devmode_cont(char *desc, DEVMODE_CTR *dm_c, prs_struct *p prs_debug(ps, depth, desc, "spoolss_io_devmode_cont"); depth++; + if(!prs_align(ps)) + return False; + if (!prs_uint32("size", ps, depth, &dm_c->size)) return False; @@ -1164,8 +1167,9 @@ static uint32 size_of_systemtime(SYSTEMTIME *systime) * write a UNICODE string. * used by all the RPC structs passing a buffer ********************************************************************/ -static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) +static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) { + uint16 zero=0; if (uni == NULL) return False; @@ -1173,6 +1177,8 @@ static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth++; if (!prs_unistr("unistr", ps, depth, uni)) return False; + if (!prs_uint16("null", ps, depth, &zero)) + return False; } @@ -2645,24 +2651,25 @@ BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps prs_debug(ps, depth, desc, "spoolss_io_q_setprinter"); depth++; - prs_align(ps); - - smb_io_prt_hnd("printer handle", &(q_u->handle),ps,depth); - prs_uint32("level", ps, depth, &(q_u->level)); - - /* again a designed mess */ - /* sometimes I'm wondering how all of this work ! */ + if(!prs_align(ps)) + return False; - /* To be correct it need to be split in 3 functions */ + if(!smb_io_prt_hnd("printer handle", &q_u->handle ,ps, depth)) + return False; + if(!prs_uint32("level", ps, depth, &q_u->level)) + return False; - spool_io_printer_info_level("", &(q_u->info), ps, depth); + if(!spool_io_printer_info_level("", &q_u->info, ps, depth)) + return False; - spoolss_io_devmode(desc, ps, depth, q_u->devmode); + if (!spoolss_io_devmode_cont(desc, &q_u->devmode_ctr, ps, depth)) + return False; - prs_uint32("security.size_of_buffer", ps, depth, &(q_u->security.size_of_buffer)); - prs_uint32("security.data", ps, depth, &(q_u->security.data)); + prs_uint32("security.size_of_buffer", ps, depth, &q_u->security.size_of_buffer); + prs_uint32("security.data", ps, depth, &q_u->security.data); - prs_uint32("command", ps, depth, &(q_u->command)); + if(!prs_uint32("command", ps, depth, &q_u->command)) + return False; return True; } @@ -3074,77 +3081,83 @@ BOOL spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, return True; } - /******************************************************************* + Parse a SPOOL_PRINTER_INFO_LEVEL_2 structure. ********************************************************************/ -BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 **q_u, prs_struct *ps, int depth) +BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, prs_struct *ps, int depth) { - SPOOL_PRINTER_INFO_LEVEL_2 *il; - - prs_debug(ps, depth, desc, ""); + prs_debug(ps, depth, desc, "spool_io_printer_info_level_2"); depth++; - - /* reading */ - if (ps->io) - { - il=(SPOOL_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2)); - ZERO_STRUCTP(il); - *q_u=il; - DEBUG(7,("lecture: memoire ok\n")); - } - else - { - il=*q_u; - } - prs_align(ps); - - prs_uint32("servername_ptr", ps, depth, &(il->servername_ptr)); - prs_uint32("printername_ptr", ps, depth, &(il->printername_ptr)); - prs_uint32("sharename_ptr", ps, depth, &(il->sharename_ptr)); - prs_uint32("portname_ptr", ps, depth, &(il->portname_ptr)); - prs_uint32("drivername_ptr", ps, depth, &(il->drivername_ptr)); - prs_uint32("comment_ptr", ps, depth, &(il->comment_ptr)); - prs_uint32("location_ptr", ps, depth, &(il->location_ptr)); - prs_uint32("devmode_ptr", ps, depth, &(il->devmode_ptr)); - prs_uint32("sepfile_ptr", ps, depth, &(il->sepfile_ptr)); - prs_uint32("printprocessor_ptr", ps, depth, &(il->printprocessor_ptr)); - prs_uint32("datatype_ptr", ps, depth, &(il->datatype_ptr)); - prs_uint32("parameters_ptr", ps, depth, &(il->parameters_ptr)); - prs_uint32("secdesc_ptr", ps, depth, &(il->secdesc_ptr)); - - prs_uint32("attributes", ps, depth, &(il->attributes)); - prs_uint32("priority", ps, depth, &(il->priority)); - prs_uint32("default_priority", ps, depth, &(il->default_priority)); - prs_uint32("starttime", ps, depth, &(il->starttime)); - prs_uint32("untiltime", ps, depth, &(il->untiltime)); - prs_uint32("status", ps, depth, &(il->status)); - prs_uint32("cjobs", ps, depth, &(il->cjobs)); - prs_uint32("averageppm", ps, depth, &(il->averageppm)); - - smb_io_unistr2("", &(il->servername), il->servername_ptr, ps, depth); - smb_io_unistr2("", &(il->printername), il->printername_ptr, ps, depth); - smb_io_unistr2("", &(il->sharename), il->sharename_ptr, ps, depth); - smb_io_unistr2("", &(il->portname), il->portname_ptr, ps, depth); - smb_io_unistr2("", &(il->drivername), il->drivername_ptr, ps, depth); - smb_io_unistr2("", &(il->comment), il->comment_ptr, ps, depth); - smb_io_unistr2("", &(il->location), il->location_ptr, ps, depth); - smb_io_unistr2("", &(il->sepfile), il->sepfile_ptr, ps, depth); - smb_io_unistr2("", &(il->printprocessor), il->printprocessor_ptr, ps, depth); - smb_io_unistr2("", &(il->datatype), il->datatype_ptr, ps, depth); - smb_io_unistr2("", &(il->parameters), il->parameters_ptr, ps, depth); + if(!prs_align(ps)) + return False; - prs_align(ps); + if(!prs_uint32("servername_ptr", ps, depth, &il->servername_ptr)) + return False; + if(!prs_uint32("printername_ptr", ps, depth, &il->printername_ptr)) + return False; + if(!prs_uint32("sharename_ptr", ps, depth, &il->sharename_ptr)) + return False; + if(!prs_uint32("portname_ptr", ps, depth, &il->portname_ptr)) + return False; + if(!prs_uint32("drivername_ptr", ps, depth, &il->drivername_ptr)) + return False; + if(!prs_uint32("comment_ptr", ps, depth, &il->comment_ptr)) + return False; + if(!prs_uint32("location_ptr", ps, depth, &il->location_ptr)) + return False; + if(!prs_uint32("devmode_ptr", ps, depth, &il->devmode_ptr)) + return False; + if(!prs_uint32("sepfile_ptr", ps, depth, &il->sepfile_ptr)) + return False; + if(!prs_uint32("printprocessor_ptr", ps, depth, &il->printprocessor_ptr)) + return False; + if(!prs_uint32("datatype_ptr", ps, depth, &il->datatype_ptr)) + return False; + if(!prs_uint32("parameters_ptr", ps, depth, &il->parameters_ptr)) + return False; + if(!prs_uint32("secdesc_ptr", ps, depth, &il->secdesc_ptr)) + return False; - /* this code as nothing to do here !!! - - if (il->secdesc_ptr) - { - il->secdesc=NULL; - sec_io_desc_buf("", &(il->secdesc), ps, depth); - } - - */ + if(!prs_uint32("attributes", ps, depth, &il->attributes)) + return False; + if(!prs_uint32("priority", ps, depth, &il->priority)) + return False; + if(!prs_uint32("default_priority", ps, depth, &il->default_priority)) + return False; + if(!prs_uint32("starttime", ps, depth, &il->starttime)) + return False; + if(!prs_uint32("untiltime", ps, depth, &il->untiltime)) + return False; + if(!prs_uint32("status", ps, depth, &il->status)) + return False; + if(!prs_uint32("cjobs", ps, depth, &il->cjobs)) + return False; + if(!prs_uint32("averageppm", ps, depth, &il->averageppm)) + return False; + + if(!smb_io_unistr2("servername", &il->servername, il->servername_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("printername", &il->printername, il->printername_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("sharename", &il->sharename, il->sharename_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("portname", &il->portname, il->portname_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("drivername", &il->drivername, il->drivername_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("comment", &il->comment, il->comment_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("location", &il->location, il->location_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("sepfile", &il->sepfile, il->sepfile_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("printprocessor", &il->printprocessor, il->printprocessor_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("datatype", &il->datatype, il->datatype_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("parameters", &il->parameters, il->parameters_ptr, ps, depth)) + return False; return True; } @@ -3153,16 +3166,24 @@ BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 **q_u, ********************************************************************/ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth) { - uint32 useless; - uint32 level; - prs_debug(ps, depth, desc, ""); + prs_debug(ps, depth, desc, "spool_io_printer_info_level"); depth++; - prs_align(ps); - prs_uint32("info level", ps, depth, &level); - prs_uint32("useless", ps, depth, &useless); - - switch (level) { + if(!prs_align(ps)) + return False; + if(!prs_uint32("level", ps, depth, &il->level)) + return False; + if(!prs_uint32("info_ptr", ps, depth, &il->info_ptr)) + return False; + + /* if no struct inside just return */ + if (il->info_ptr==0) { + if (UNMARSHALLING(ps)) + il->info_2=NULL; + return True; + } + + switch (il->level) { /* * level 0 is used by setprinter when managing the queue * (hold, stop, start a queue) @@ -3174,11 +3195,13 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s * and by setprinter when updating printer's info */ case 2: - spool_io_printer_info_level_2("", &(il->info_2), ps, depth); + if (UNMARSHALLING(ps)) + il->info_2=(SPOOL_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2)); + if (!spool_io_printer_info_level_2("", il->info_2, ps, depth)) + return False; break; } - return True; } @@ -3761,17 +3784,26 @@ BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_ prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdata"); depth++; - prs_align(ps); - prs_uint32("valuesize", ps, depth, &(r_u->valuesize)); - prs_unistr("value", ps, depth, &(r_u->value)); - prs_uint32("realvaluesize", ps, depth, &(r_u->realvaluesize)); + if(!prs_align(ps)) + return False; + if(!prs_uint32("valuesize", ps, depth, &r_u->valuesize)) + return False; + if(!prs_uint16s(False, "value", ps, depth, r_u->value, r_u->valuesize)) + return False; + if(!prs_uint32("realvaluesize", ps, depth, &r_u->realvaluesize)) + return False; - prs_uint32("type", ps, depth, &(r_u->type)); + if(!prs_uint32("type", ps, depth, &r_u->type)) + return False; - prs_uint32("datasize", ps, depth, &(r_u->datasize)); - prs_uint8s(False, "data", ps, depth, r_u->data, r_u->datasize); - prs_uint32("realdatasize", ps, depth, &(r_u->realdatasize)); - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("datasize", ps, depth, &r_u->datasize)) + return False; + if(!prs_uint8s(False, "data", ps, depth, r_u->data, r_u->datasize)) + return False; + if(!prs_uint32("realdatasize", ps, depth, &r_u->realdatasize)) + return False; + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } @@ -3783,11 +3815,16 @@ BOOL spoolss_io_q_enumprinterdata(char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_ prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdata"); depth++; - prs_align(ps); - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("index", ps, depth, &(q_u->index)); - prs_uint32("valuesize", ps, depth, &(q_u->valuesize)); - prs_uint32("datasize", ps, depth, &(q_u->datasize)); + if(!prs_align(ps)) + return False; + if(!smb_io_prt_hnd("printer handle",&q_u->handle,ps,depth)) + return False; + if(!prs_uint32("index", ps, depth, &q_u->index)) + return False; + if(!prs_uint32("valuesize", ps, depth, &q_u->valuesize)) + return False; + if(!prs_uint32("datasize", ps, depth, &q_u->datasize)) + return False; return True; } -- cgit From fd3acf437acb923757e1b59b503c864b4d1c45cc Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Sat, 26 Feb 2000 23:01:02 +0000 Subject: added enumprintprocessordatatypes now NT is happy and the "always send data in RAW mode" is checked J.F. (This used to be commit d7bcfe17cee64a513595d7c44456e93e88f2448b) --- source3/rpc_parse/parse_spoolss.c | 98 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index d1f7ed61a4..452cbb1531 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2124,6 +2124,23 @@ BOOL smb_io_printprocessor_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR return True; } +/******************************************************************* +********************************************************************/ +BOOL smb_io_printprocdatatype_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCDATATYPE_1 *info, int depth) +{ + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "smb_io_printprocdatatype_info_1"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if (new_smb_io_relstr("name", buffer, depth, &info->name)) + return False; + + return True; +} + /******************************************************************* ********************************************************************/ BOOL smb_io_printmonitor_info_1(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_1 *info, int depth) @@ -2417,6 +2434,17 @@ uint32 spoolss_size_printprocessor_info_1(PRINTPROCESSOR_1 *info) return size; } +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +uint32 spoolss_size_printprocdatatype_info_1(PRINTPROCDATATYPE_1 *info) +{ + int size=0; + size+=size_of_relative_string( &info->name ); + + return size; +} + /******************************************************************* return the size required by a struct in the stream ********************************************************************/ @@ -3715,6 +3743,76 @@ BOOL spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q return True; } +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_enumprintprocdatatypes(char *desc, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocdatatypes"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + return False; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("needed", ps, depth, &r_u->needed)) + return False; + + if (!prs_uint32("returned", ps, depth, &r_u->returned)) + return False; + + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_enumprintprocdatatypes(char *desc, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, prs_struct *ps, int depth) +{ + uint32 useless; + prs_debug(ps, depth, desc, "spoolss_io_q_enumprintprocdatatypes"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("name_ptr", ps, depth, &q_u->name_ptr)) + return False; + if (!smb_io_unistr2("name", &q_u->name, True, ps, depth)) + return False; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("processor_ptr", ps, depth, &q_u->processor_ptr)) + return False; + if (!smb_io_unistr2("processor", &q_u->processor, q_u->processor_ptr, ps, depth)) + return False; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("level", ps, depth, &q_u->level)) + return False; + + if(!new_spoolss_io_buffer("buffer", ps, depth, q_u->buffer)) + return False; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("offered", ps, depth, &q_u->offered)) + return False; + + return True; +} + /******************************************************************* Parse a SPOOL_Q_ENUMPRINTMONITORS structure. ********************************************************************/ -- cgit From 4fb014372e7bcf1b40396841f162a14cb58a086a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 29 Feb 2000 21:39:54 +0000 Subject: Fixes from Luke, back-ported from TNG to Win2k. Correctly return FAULT_PDU on unknown rpc calls. Win2k now correctly shows the owners of files. Jeremy. (This used to be commit 066898689f496dc655c3f0a553ac5e884e078022) --- source3/rpc_parse/parse_rpc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 54d3eea74d..48d64972bf 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -493,6 +493,26 @@ BOOL smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int dept return True; } +/******************************************************************* + Reads or writes an RPC_HDR_FAULT structure. +********************************************************************/ + +BOOL smb_io_rpc_hdr_fault(char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth) +{ + if (rpc == NULL) + return False; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_fault"); + depth++; + + if(!prs_uint32("status ", ps, depth, &rpc->status)) + return False; + if(!prs_uint32("reserved", ps, depth, &rpc->reserved)) + return False; + + return True; +} + /******************************************************************* Init an RPC_HDR_AUTHA structure. ********************************************************************/ -- cgit From 78d7ba5ca021518ec5c088eb492b36710e556c31 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 6 Mar 2000 11:13:40 +0000 Subject: changed prs_unistr to parse empty and non-empty strings the same way. fixed typo in SPOOLSS_SYNT some cleanup of unused functions wrote make_spoolss_enumprinter and make_spoolss_openprinterex for rpcclient as I'm trying to keep in sync the parsing code between HEAD and TNG. Will commit changes to TNG after lunch. J.F. (This used to be commit 025cdb345f6de287a41d4449b2662dbc5e762bf2) --- source3/rpc_parse/parse_prs.c | 29 ++- source3/rpc_parse/parse_rpc.c | 2 +- source3/rpc_parse/parse_spoolss.c | 363 +++++++++++++------------------------- 3 files changed, 139 insertions(+), 255 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 5d0ea832c8..64c1590b7d 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -365,7 +365,7 @@ char *prs_mem_get(prs_struct *ps, uint32 extra_size) Change the struct type. ********************************************************************/ -BOOL prs_switch_type(prs_struct *ps, BOOL io) +void prs_switch_type(prs_struct *ps, BOOL io) { if ((ps->io ^ io) == True) ps->io=io; @@ -573,22 +573,22 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) unsigned char *p = (unsigned char *)str->buffer; uint8 *start; char *q; + char zero=0; for(len = 0; len < (sizeof(str->buffer) / sizeof(str->buffer[0])) && str->buffer[len] != 0; len++) ; - q = prs_mem_get(ps, len*2); + q = prs_mem_get(ps, (len+1)*2); if (q == NULL) return False; start = (uint8*)q; - len = 0; - do - { + for(len = 0; len < (sizeof(str->buffer) / sizeof(str->buffer[0])) && + str->buffer[len] != 0; len++) { if(ps->bigendian_data) { - RW_SVAL(ps->io, ps->bigendian_data, q, *p, 0) + RW_SVAL(ps->io, ps->bigendian_data, q, *p, 0); p += 2; q += 2; } else { @@ -599,10 +599,21 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) p++; q++; } - len++; - } while ((len < (sizeof(str->buffer) / sizeof(str->buffer[0]))) && - (str->buffer[len] != 0)); + } + + /* + * even if the string is 'empty' (only an \0 char) + * at this point the leading \0 hasn't been parsed. + * so parse it now + */ + + RW_CVAL(ps->io, q, zero, 0); + q++; + RW_CVAL(ps->io, q, zero, 0); + q++; + len++; + ps->data_offset += len*2; dump_data(5+depth, (char *)start, len * 2); diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 48d64972bf..90200312bd 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -108,7 +108,7 @@ interface/version dce/rpc pipe identification #define SYNT_SPOOLSS_V1 \ { \ { \ - 0x12345678, 0x1234, 0xabcb, \ + 0x12345678, 0x1234, 0xabcd, \ { 0xef, 0x00, 0x01, 0x23, \ 0x45, 0x67, 0x89, 0xab } \ }, 0x01 \ diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 452cbb1531..d9e761da61 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -25,6 +25,16 @@ #include "includes.h" #include "nterr.h" +#ifdef TNG + #define prs_uint16 _prs_uint16 + #define prs_uint32 _prs_uint32 + #define prs_uint8s _prs_uint8s + #define prs_uint16s _prs_uint16s + #define prs_unistr _prs_unistr + #define init_unistr2 make_unistr2 +#endif + + extern int DEBUGLEVEL; /******************************************************************* return the length of a UNISTR string. @@ -73,23 +83,6 @@ BOOL make_systemtime(SYSTEMTIME *systime, struct tm *unixtime) return True; } -/******************************************************************* -reads or writes an POLICY_HND structure. -********************************************************************/ -static BOOL smb_io_prt_hnd(char *desc, POLICY_HND *hnd, prs_struct *ps, int depth) -{ - if (hnd == NULL) return False; - - prs_debug(ps, depth, desc, "smb_io_prt_hnd"); - depth++; - - prs_align(ps); - - prs_uint8s (False, "data", ps, depth, hnd->data, POLICY_HND_SIZE); - - return True; -} - /******************************************************************* reads or writes an DOC_INFO structure. ********************************************************************/ @@ -636,6 +629,41 @@ static BOOL spoolss_io_printer_default(char *desc, PRINTER_DEFAULT *pd, prs_stru return True; } +/******************************************************************* + * init a structure. + ********************************************************************/ +BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, fstring printername, fstring datatype, + uint32 access_required, fstring client_name, fstring user_name) +{ + DEBUG(5,("make_spoolss_q_open_printer_ex\n")); + q_u->printername_ptr = (printername!=NULL)?1:0; + init_unistr2(&(q_u->printername), printername, strlen(printername)); + + q_u->printer_default.datatype_ptr = 0; +/* + q_u->printer_default.datatype_ptr = (datatype!=NULL)?1:0; + init_unistr2(&(q_u->printer_default.datatype), datatype, strlen(datatype)); +*/ + q_u->printer_default.devmode_cont.size=0; + q_u->printer_default.devmode_cont.devmode_ptr=0; + q_u->printer_default.devmode_cont.devmode=NULL; + q_u->printer_default.access_required=access_required; + q_u->user_switch=1; + q_u->user_ctr.level=1; + q_u->user_ctr.ptr=1; + q_u->user_ctr.user1.size=strlen(client_name)+strlen(user_name)+8; + q_u->user_ctr.user1.client_name_ptr = (client_name!=NULL)?1:0; + q_u->user_ctr.user1.user_name_ptr = (user_name!=NULL)?1:0; + q_u->user_ctr.user1.build=1381; + q_u->user_ctr.user1.major=2; + q_u->user_ctr.user1.minor=0; + q_u->user_ctr.user1.processor=0; + init_unistr2(&(q_u->user_ctr.user1.client_name), client_name, strlen(client_name)); + init_unistr2(&(q_u->user_ctr.user1.user_name), user_name, strlen(user_name)); + + return True; +} + /******************************************************************* * read a structure. * called from spoolss_q_open_printer_ex (srv_spoolss.c) @@ -685,7 +713,7 @@ BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_ if (!prs_align(ps)) return False; - if (!smb_io_prt_hnd("printer handle",&(r_u->handle),ps,depth)) + if (!smb_io_pol_hnd("printer handle",&(r_u->handle),ps,depth)) return False; if (!prs_uint32("status code", ps, depth, &(r_u->status))) @@ -727,7 +755,7 @@ BOOL spoolss_io_q_getprinterdata(char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_st if (!prs_align(ps)) return False; - if (!smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth)) + if (!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) return False; if (!prs_align(ps)) return False; @@ -803,7 +831,7 @@ BOOL spoolss_io_q_closeprinter(char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct if (!prs_align(ps)) return False; - if (!smb_io_prt_hnd("printer handle",&q_u->handle,ps,depth)) + if (!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; return True; @@ -822,7 +850,7 @@ BOOL spoolss_io_r_closeprinter(char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct if (!prs_align(ps)) return False; - if (!smb_io_prt_hnd("printer handle",&r_u->handle,ps,depth)) + if (!smb_io_pol_hnd("printer handle",&r_u->handle,ps,depth)) return False; if (!prs_uint32("status", ps, depth, &r_u->status)) return False; @@ -843,7 +871,7 @@ BOOL spoolss_io_q_startdocprinter(char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_ prs_align(ps); - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth); smb_io_doc_info_container("",&(q_u->doc_info_container), ps, depth); @@ -877,7 +905,7 @@ BOOL spoolss_io_q_enddocprinter(char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_stru prs_align(ps); - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth); return True; } @@ -908,7 +936,7 @@ BOOL spoolss_io_q_startpageprinter(char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, pr prs_align(ps); - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth); return True; } @@ -939,7 +967,7 @@ BOOL spoolss_io_q_endpageprinter(char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_st prs_align(ps); - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth); return True; } @@ -970,7 +998,7 @@ BOOL spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct prs_align(ps); - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth); prs_uint32("buffer_size", ps, depth, &(q_u->buffer_size)); if (q_u->buffer_size!=0) @@ -1010,7 +1038,7 @@ BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, in if(!prs_align(ps)) return False; - if(!smb_io_prt_hnd("printer handle", &q_u->handle, ps, depth)) + if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) return False; if(!prs_uint32("flags", ps, depth, &q_u->flags)) return False; @@ -1069,7 +1097,7 @@ BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, in if(!prs_align(ps)) return False; - if(!smb_io_prt_hnd("printer handle",&q_u->handle,ps,depth)) + if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; if(!prs_uint32("change", ps, depth, &q_u->change)) @@ -1169,7 +1197,6 @@ static uint32 size_of_systemtime(SYSTEMTIME *systime) ********************************************************************/ static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) { - uint16 zero=0; if (uni == NULL) return False; @@ -1177,51 +1204,11 @@ static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int d depth++; if (!prs_unistr("unistr", ps, depth, uni)) return False; - if (!prs_uint16("null", ps, depth, &zero)) - return False; -} - -/******************************************************************* - * write a UNICODE string and its relative pointer. - * used by all the RPC structs passing a buffer - ********************************************************************/ -static BOOL smb_io_relstr(char *desc, prs_struct *ps, int depth, UNISTR *buffer, - uint32 *start_offset, uint32 *end_offset) -{ - if (!ps->io) - { - uint32 struct_offset = prs_offset(ps); - uint32 relative_offset; - - /* writing */ - *end_offset -= 2*(str_len_uni(buffer)+1); - prs_set_offset(ps, *end_offset); - spoolss_smb_io_unistr(desc, buffer, ps, depth); - - prs_set_offset(ps,struct_offset); - relative_offset=*end_offset-*start_offset; - - prs_uint32("offset", ps, depth, &(relative_offset)); - } - else - { - uint32 old_offset; - uint32 relative_offset; - - prs_uint32("offset", ps, depth, &(relative_offset)); - - old_offset = prs_offset(ps); - prs_set_offset(ps, (*start_offset) + relative_offset); - - spoolss_smb_io_unistr(desc, buffer, ps, depth); - - *end_offset = prs_offset(ps); - prs_set_offset(ps, old_offset); - } return True; } + /******************************************************************* * write a UNICODE string and its relative pointer. * used by all the RPC structs passing a buffer @@ -1271,7 +1258,7 @@ static BOOL new_smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR return False; old_offset = prs_offset(ps); - prs_set_offset(ps, buffer->string_at_end); + prs_set_offset(ps, buffer->string_at_end+buffer->struct_start); /* read the string */ if (!spoolss_smb_io_unistr(desc, string, ps, depth)) @@ -1348,46 +1335,11 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, UN return True; } -static BOOL smb_io_relarraystr(char *desc, prs_struct *ps, int depth, UNISTR ***buffer, - uint32 *start_offset, uint32 *end_offset) -{ - int i=0; - uint32 struct_offset; - uint32 relative_offset; - struct_offset=prs_offset(ps); - - while ( (*buffer)[i]!=0x0000 ) - { - i++; - } - - i--; - - /* that's for the ending NULL */ - *end_offset-=2; - - do - { - *end_offset-= 2*(str_len_uni((*buffer)[i])+1); - prs_set_offset(ps, *end_offset); - spoolss_smb_io_unistr(desc, (*buffer)[i], ps, depth); - - i--; - } - while (i>=0); - - prs_set_offset(ps, struct_offset); - relative_offset=*end_offset-*start_offset; - - prs_uint32("offset", ps, depth, &(relative_offset)); - - return True; -} /******************************************************************* Parse a DEVMODE structure and its relative pointer. ********************************************************************/ -static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEVICEMODE *devmode) +static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEVICEMODE **devmode) { prs_struct *ps=&(buffer->prs); @@ -1398,12 +1350,12 @@ static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEV uint32 struct_offset = prs_offset(ps); uint32 relative_offset; - buffer->string_at_end -= (devmode->size+devmode->driverextra); + buffer->string_at_end -= ((*devmode)->size + (*devmode)->driverextra); prs_set_offset(ps, buffer->string_at_end); /* write the DEVMODE */ - if (!spoolss_io_devmode(desc, ps, depth, devmode)) + if (!spoolss_io_devmode(desc, ps, depth, *devmode)) return False; prs_set_offset(ps, struct_offset); @@ -1424,7 +1376,8 @@ static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEV prs_set_offset(ps, buffer->string_at_end + buffer->struct_start); /* read the string */ - if (!spoolss_io_devmode(desc, ps, depth, devmode)) + *devmode=(DEVICEMODE *)malloc(sizeof(DEVICEMODE)); + if (!spoolss_io_devmode(desc, ps, depth, *devmode)) return False; prs_set_offset(ps, old_offset); @@ -1433,29 +1386,6 @@ static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEV } -static BOOL smb_io_reldevmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode, - uint32 *start_offset, uint32 *end_offset) -{ - uint32 struct_offset; - uint32 relative_offset; - - prs_debug(ps, depth, desc, "smb_io_reldevmode"); - depth++; - - struct_offset=prs_offset(ps); - *end_offset-= (devmode->size+devmode->driverextra); - prs_set_offset(ps, *end_offset); - - spoolss_io_devmode(desc, ps, depth, devmode); - - prs_set_offset(ps, struct_offset); - relative_offset=*end_offset-*start_offset; - - prs_uint32("offset", ps, depth, &(relative_offset)); - - return True; -} - /******************************************************************* Parse a PRINTER_INFO_0 structure. ********************************************************************/ @@ -1589,7 +1519,7 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i return False; /* NT parses the DEVMODE at the end of the struct */ - if (!new_smb_io_reldevmode("devmode", buffer, depth, info->devmode)) + if (!new_smb_io_reldevmode("devmode", buffer, depth, &info->devmode)) return False; if (!new_smb_io_relstr("sepfile", buffer, depth, &info->sepfile)) @@ -1641,17 +1571,6 @@ BOOL new_smb_io_printer_driver_info_1(char *desc, NEW_BUFFER *buffer, DRIVER_INF return True; } -static BOOL smb_io_printer_driver_info_1(char *desc, DRIVER_INFO_1 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - prs_debug(ps, depth, desc, "smb_io_printer_driver_info_1"); - depth++; - *start_offset=prs_offset(ps); - - smb_io_relstr("name", ps, depth, &(info->name), start_offset, end_offset); - - return True; -} /******************************************************************* Parse a DRIVER_INFO_2 structure. @@ -1681,22 +1600,6 @@ BOOL new_smb_io_printer_driver_info_2(char *desc, NEW_BUFFER *buffer, DRIVER_INF return True; } -static BOOL smb_io_printer_driver_info_2(char *desc, DRIVER_INFO_2 *info,prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - prs_debug(ps, depth, desc, "smb_io_printer_xxx"); - depth++; - *start_offset=prs_offset(ps); - - prs_uint32("version", ps, depth, &(info->version)); - smb_io_relstr("name", ps, depth, &(info->name), start_offset, end_offset); - smb_io_relstr("architecture", ps, depth, &(info->architecture), start_offset, end_offset); - smb_io_relstr("driverpath", ps, depth, &(info->driverpath), start_offset, end_offset); - smb_io_relstr("datafile", ps, depth, &(info->datafile), start_offset, end_offset); - smb_io_relstr("configfile", ps, depth, &(info->configfile), start_offset, end_offset); - - return True; -} /******************************************************************* Parse a DRIVER_INFO_3 structure. @@ -1736,28 +1639,6 @@ BOOL new_smb_io_printer_driver_info_3(char *desc, NEW_BUFFER *buffer, DRIVER_INF return True; } -static BOOL smb_io_printer_driver_info_3(char *desc, DRIVER_INFO_3 *info,prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - prs_debug(ps, depth, desc, "smb_io_printer_driver_info_3"); - depth++; - *start_offset=prs_offset(ps); - - prs_uint32("version", ps, depth, &(info->version)); - smb_io_relstr("name", ps, depth, &(info->name), start_offset, end_offset); - smb_io_relstr("architecture", ps, depth, &(info->architecture), start_offset, end_offset); - smb_io_relstr("driverpath", ps, depth, &(info->driverpath), start_offset, end_offset); - smb_io_relstr("datafile", ps, depth, &(info->datafile), start_offset, end_offset); - smb_io_relstr("configfile", ps, depth, &(info->configfile), start_offset, end_offset); - smb_io_relstr("helpfile", ps, depth, &(info->helpfile), start_offset, end_offset); - - smb_io_relarraystr("dependentfiles", ps, depth, &(info->dependentfiles), start_offset, end_offset); - - smb_io_relstr("monitorname", ps, depth, &(info->monitorname), start_offset, end_offset); - smb_io_relstr("defaultdatatype", ps, depth, &(info->defaultdatatype), start_offset, end_offset); - - return True; -} /******************************************************************* Parse a JOB_INFO_1 structure. @@ -1835,7 +1716,7 @@ BOOL new_smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int return False; if (!new_smb_io_relstr("drivername", buffer, depth, &info->drivername)) return False; - if (!new_smb_io_reldevmode("devmode", buffer, depth, info->devmode)) + if (!new_smb_io_reldevmode("devmode", buffer, depth, &info->devmode)) return False; if (!new_smb_io_relstr("text_status", buffer, depth, &info->text_status)) return False; @@ -1954,7 +1835,9 @@ static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUF return False; if (!prs_append_some_prs_data(ps, &(buffer->prs), 0, buffer->size)) return False; - } + + return True; + } } /******************************************************************* @@ -2008,26 +1891,6 @@ uint32 new_get_buffer_size(NEW_BUFFER *buffer) return (buffer->size); } -/******************************************************************* -********************************************************************/ -static BOOL smb_io_form_1(char *desc, FORM_1 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - prs_debug(ps, depth, desc, "smb_io_form_1"); - depth++; - *start_offset=prs_offset(ps); - - prs_uint32("flag", ps, depth, &(info->flag)); - smb_io_relstr("name",ps, depth, &(info->name), start_offset, end_offset); - prs_uint32("width", ps, depth, &(info->width)); - prs_uint32("length", ps, depth, &(info->length)); - prs_uint32("left", ps, depth, &(info->left)); - prs_uint32("top", ps, depth, &(info->top)); - prs_uint32("right", ps, depth, &(info->right)); - prs_uint32("bottom", ps, depth, &(info->bottom)); - - return True; -} /******************************************************************* Parse a DRIVER_DIRECTORY_1 structure. @@ -2091,21 +1954,6 @@ BOOL new_smb_io_port_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int de return True; } -static BOOL smb_io_port_2(char *desc, PORT_INFO_2 *info, prs_struct *ps, int depth, - uint32 *start_offset, uint32 *end_offset) -{ - prs_debug(ps, depth, desc, "smb_io_port_2"); - depth++; - *start_offset=prs_offset(ps); - - smb_io_relstr("port_name",ps, depth, &(info->port_name), start_offset, end_offset); - smb_io_relstr("monitor_name",ps, depth, &(info->monitor_name), start_offset, end_offset); - smb_io_relstr("description",ps, depth, &(info->description), start_offset, end_offset); - prs_uint32("port_type", ps, depth, &(info->port_type)); - prs_uint32("reserved", ps, depth, &(info->reserved)); - - return True; -} /******************************************************************* ********************************************************************/ @@ -2481,7 +2329,7 @@ BOOL spoolss_io_q_getprinterdriver2(char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, if(!prs_align(ps)) return False; - if(!smb_io_prt_hnd("printer handle", &q_u->handle, ps, depth)) + if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) return False; if(!prs_uint32("architecture_ptr", ps, depth, &q_u->architecture_ptr)) return False; @@ -2537,6 +2385,25 @@ BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, return True; } +/******************************************************************* + * init a structure. + ********************************************************************/ +BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, uint32 flags, + fstring servername, uint32 level, + NEW_BUFFER *buffer, uint32 offered) +{ + q_u->flags=flags; + + q_u->servername_ptr = (servername != NULL) ? 1 : 0; + init_unistr2(&(q_u->servername), servername, strlen(servername)); + + q_u->level=level; + q_u->buffer=buffer; + q_u->offered=offered; + + return True; +} + /******************************************************************* * read a structure. * called from spoolss_enumprinters (srv_spoolss.c) @@ -2642,7 +2509,7 @@ BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps if (!prs_align(ps)) return False; - if(!smb_io_prt_hnd("printer handle", &q_u->handle, ps, depth)) + if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) return False; if (!prs_uint32("level", ps, depth, &q_u->level)) return False; @@ -2682,7 +2549,7 @@ BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps if(!prs_align(ps)) return False; - if(!smb_io_prt_hnd("printer handle", &q_u->handle ,ps, depth)) + if(!smb_io_pol_hnd("printer handle", &q_u->handle ,ps, depth)) return False; if(!prs_uint32("level", ps, depth, &q_u->level)) return False; @@ -2726,7 +2593,7 @@ BOOL spoolss_io_q_fcpn(char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) prs_align(ps); - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth); return True; } @@ -2758,7 +2625,7 @@ BOOL spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int de if(!prs_align(ps)) return False; - if(!smb_io_prt_hnd("printer handle", &q_u->handle, ps, depth)) + if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) return False; if(!prs_uint32("level", ps, depth, &q_u->level)) return False; @@ -2810,7 +2677,8 @@ BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd, uint32 firstjob, uint32 numofjobs, uint32 level, - uint32 buf_size) + NEW_BUFFER *buffer, + uint32 offered) { if (q_u == NULL) { @@ -2820,13 +2688,8 @@ BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd, q_u->firstjob = firstjob; q_u->numofjobs = numofjobs; q_u->level = level; -/* - if (!make_spoolss_buffer(&q_u->buffer, buf_size)) - { - return False; - } - q_u->buf_size = buf_size; -*/ + q_u->buffer= buffer; + q_u->offered = offered; return True; } @@ -2840,7 +2703,7 @@ BOOL spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, in if (!prs_align(ps)) return False; - if (!smb_io_prt_hnd("printer handle",&q_u->handle, ps, depth)) + if (!smb_io_pol_hnd("printer handle",&q_u->handle, ps, depth)) return False; if (!prs_uint32("firstjob", ps, depth, &q_u->firstjob)) @@ -2882,7 +2745,7 @@ BOOL spoolss_io_q_schedulejob(char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct * prs_align(ps); - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth); prs_uint32("jobid", ps, depth, &(q_u->jobid)); return True; @@ -2911,7 +2774,7 @@ BOOL spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int de prs_align(ps); - smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth); + smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth); prs_uint32("jobid", ps, depth, &(q_u->jobid)); /* * level is usually 0. If (level!=0) then I'm in trouble ! @@ -3004,7 +2867,7 @@ BOOL spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, if (!prs_align(ps)) return False; - if (!smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth)) + if (!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) return False; if (!prs_uint32("level", ps, depth, &(q_u->level))) return False; @@ -3296,7 +3159,7 @@ BOOL spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, prs_struct prs_debug(ps, depth, desc, "spoolss_io_r_addprinterex"); depth++; - smb_io_prt_hnd("printer handle",&(r_u->handle),ps,depth); + smb_io_pol_hnd("printer handle",&(r_u->handle),ps,depth); prs_uint32("status", ps, depth, &(r_u->status)); @@ -3705,7 +3568,6 @@ BOOL spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r ********************************************************************/ BOOL spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, prs_struct *ps, int depth) { - uint32 useless; prs_debug(ps, depth, desc, "spoolss_io_q_enumprintprocessors"); depth++; @@ -3775,7 +3637,6 @@ BOOL spoolss_io_r_enumprintprocdatatypes(char *desc, SPOOL_R_ENUMPRINTPROCDATATY ********************************************************************/ BOOL spoolss_io_q_enumprintprocdatatypes(char *desc, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, prs_struct *ps, int depth) { - uint32 useless; prs_debug(ps, depth, desc, "spoolss_io_q_enumprintprocdatatypes"); depth++; @@ -3915,7 +3776,7 @@ BOOL spoolss_io_q_enumprinterdata(char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_ if(!prs_align(ps)) return False; - if(!smb_io_prt_hnd("printer handle",&q_u->handle,ps,depth)) + if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; if(!prs_uint32("index", ps, depth, &q_u->index)) return False; @@ -3927,6 +3788,18 @@ BOOL spoolss_io_q_enumprinterdata(char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_ return True; } +/******************************************************************* +********************************************************************/ +BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, POLICY_HND *hnd, uint32 index, uint32 valuelen, uint32 datalen) +{ + memcpy(&(q_u->handle), hnd, sizeof(q_u->handle)); + q_u->index=index; + q_u->valuesize=valuelen; + q_u->datasize=datalen; + + return True; +} + /******************************************************************* ********************************************************************/ BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_struct *ps, int depth) @@ -3935,7 +3808,7 @@ BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_st depth++; prs_align(ps); - smb_io_prt_hnd("printer handle", &(q_u->handle), ps, depth); + smb_io_pol_hnd("printer handle", &(q_u->handle), ps, depth); smb_io_unistr2("", &(q_u->value), True, ps, depth); prs_align(ps); @@ -4038,7 +3911,7 @@ BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth++; prs_align(ps); - smb_io_prt_hnd("printer handle", &(q_u->handle), ps, depth); + smb_io_pol_hnd("printer handle", &(q_u->handle), ps, depth); prs_uint32("level", ps, depth, &(q_u->level)); prs_uint32("level2", ps, depth, &(q_u->level2)); @@ -4073,7 +3946,7 @@ BOOL spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth++; prs_align(ps); - smb_io_prt_hnd("printer handle", &(q_u->handle), ps, depth); + smb_io_pol_hnd("printer handle", &(q_u->handle), ps, depth); smb_io_unistr2("", &(q_u->name), True, ps, depth); prs_align(ps); @@ -4140,7 +4013,7 @@ BOOL spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int de if(!prs_align(ps)) return False; - if(!smb_io_prt_hnd("printer handle",&(q_u->handle),ps,depth)) + if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) return False; if(!prs_uint32("jobid", ps, depth, &q_u->jobid)) return False; -- cgit From e0ebb76a7453c07c16e8f736233226a774ab58e8 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Fri, 10 Mar 2000 17:12:24 +0000 Subject: getprinter level 0: was to short, found most of the fields, undocumented, undecoded, nothing in MSDN, but now it works :-) cleanup of error codes. fixed some dfs declarations function. J.F. (This used to be commit 87da4404aba29a2ebd999886e4c06958c96d3e05) --- source3/rpc_parse/parse_spoolss.c | 160 ++++++++++++++++++++++++++++---------- 1 file changed, 121 insertions(+), 39 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index d9e761da61..902cc058c3 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -633,7 +633,7 @@ static BOOL spoolss_io_printer_default(char *desc, PRINTER_DEFAULT *pd, prs_stru * init a structure. ********************************************************************/ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, fstring printername, fstring datatype, - uint32 access_required, fstring client_name, fstring user_name) + uint32 access_required, fstring clientname, fstring user_name) { DEBUG(5,("make_spoolss_q_open_printer_ex\n")); q_u->printername_ptr = (printername!=NULL)?1:0; @@ -651,14 +651,14 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, fstring printe q_u->user_switch=1; q_u->user_ctr.level=1; q_u->user_ctr.ptr=1; - q_u->user_ctr.user1.size=strlen(client_name)+strlen(user_name)+8; - q_u->user_ctr.user1.client_name_ptr = (client_name!=NULL)?1:0; + q_u->user_ctr.user1.size=strlen(clientname)+strlen(user_name)+8; + q_u->user_ctr.user1.client_name_ptr = (clientname!=NULL)?1:0; q_u->user_ctr.user1.user_name_ptr = (user_name!=NULL)?1:0; q_u->user_ctr.user1.build=1381; q_u->user_ctr.user1.major=2; q_u->user_ctr.user1.minor=0; q_u->user_ctr.user1.processor=0; - init_unistr2(&(q_u->user_ctr.user1.client_name), client_name, strlen(client_name)); + init_unistr2(&(q_u->user_ctr.user1.client_name), clientname, strlen(clientname)); init_unistr2(&(q_u->user_ctr.user1.user_name), user_name, strlen(user_name)); return True; @@ -1144,6 +1144,14 @@ BOOL spoolss_io_r_rfnpcnex(char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, in return True; } +/******************************************************************* + * return the length of a uint16 (obvious, but the code is clean) + ********************************************************************/ +static uint32 size_of_uint16(uint16 *value) +{ + return (sizeof(*value)); +} + /******************************************************************* * return the length of a uint32 (obvious, but the code is clean) ********************************************************************/ @@ -1151,7 +1159,6 @@ static uint32 size_of_uint32(uint32 *value) { return (sizeof(*value)); } - /******************************************************************* * return the length of a UNICODE string in number of char, includes: * - the leading zero @@ -1405,26 +1412,36 @@ BOOL new_smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *i if(!prs_uint32("cjobs", ps, depth, &info->cjobs)) return False; - if(!prs_uint32("attributes", ps, depth, &info->attributes)) + if(!prs_uint32("total_jobs", ps, depth, &info->total_jobs)) + return False; + if(!prs_uint32("total_bytes", ps, depth, &info->total_bytes)) return False; - if(!prs_uint32("unknown0", ps, depth, &info->unknown0)) + if(!prs_uint16("year", ps, depth, &info->year)) + return False; + if(!prs_uint16("month", ps, depth, &info->month)) return False; - if(!prs_uint32("unknown1", ps, depth, &info->unknown1)) + if(!prs_uint16("dayofweek", ps, depth, &info->dayofweek)) return False; - if(!prs_uint32("unknown2", ps, depth, &info->unknown2)) + if(!prs_uint16("day", ps, depth, &info->day)) return False; - if(!prs_uint32("unknown3", ps, depth, &info->unknown3)) + if(!prs_uint16("hour", ps, depth, &info->hour)) return False; - if(!prs_uint32("unknown4", ps, depth, &info->unknown4)) + if(!prs_uint16("minute", ps, depth, &info->minute)) return False; - if(!prs_uint32("unknown5", ps, depth, &info->unknown5)) + if(!prs_uint16("second", ps, depth, &info->second)) return False; - if(!prs_uint32("unknown6", ps, depth, &info->unknown6)) + if(!prs_uint16("milliseconds", ps, depth, &info->milliseconds)) return False; - if(!prs_uint16("majorversion", ps, depth, &info->majorversion)) + + if(!prs_uint32("global_counter", ps, depth, &info->global_counter)) return False; - if(!prs_uint16("buildversion", ps, depth, &info->buildversion)) + if(!prs_uint32("total_pages", ps, depth, &info->total_pages)) + return False; + + if(!prs_uint16("major_version", ps, depth, &info->major_version)) + return False; + if(!prs_uint16("build_version", ps, depth, &info->build_version)) return False; if(!prs_uint32("unknown7", ps, depth, &info->unknown7)) return False; @@ -1432,11 +1449,11 @@ BOOL new_smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *i return False; if(!prs_uint32("unknown9", ps, depth, &info->unknown9)) return False; - if(!prs_uint32("unknown10", ps, depth, &info->unknown10)) + if(!prs_uint32("session_counter", ps, depth, &info->session_counter)) return False; if(!prs_uint32("unknown11", ps, depth, &info->unknown11)) return False; - if(!prs_uint32("unknown12", ps, depth, &info->unknown12)) + if(!prs_uint32("printer_errors", ps, depth, &info->printer_errors)) return False; if(!prs_uint32("unknown13", ps, depth, &info->unknown13)) return False; @@ -1446,7 +1463,7 @@ BOOL new_smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *i return False; if(!prs_uint32("unknown16", ps, depth, &info->unknown16)) return False; - if(!prs_uint32("unknown17", ps, depth, &info->unknown17)) + if(!prs_uint32("change_id", ps, depth, &info->change_id)) return False; if(!prs_uint32("unknown18", ps, depth, &info->unknown18)) return False; @@ -1454,11 +1471,23 @@ BOOL new_smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *i return False; if(!prs_uint32("unknown20", ps, depth, &info->unknown20)) return False; - if(!prs_uint32("unknown21", ps, depth, &info->unknown21)) + if(!prs_uint32("c_setprinter", ps, depth, &info->c_setprinter)) return False; if(!prs_uint16("unknown22", ps, depth, &info->unknown22)) return False; - if(!prs_uint32("unknown23", ps, depth, &info->unknown23)) + if(!prs_uint16("unknown23", ps, depth, &info->unknown23)) + return False; + if(!prs_uint16("unknown24", ps, depth, &info->unknown24)) + return False; + if(!prs_uint16("unknown25", ps, depth, &info->unknown25)) + return False; + if(!prs_uint16("unknown26", ps, depth, &info->unknown26)) + return False; + if(!prs_uint16("unknown27", ps, depth, &info->unknown27)) + return False; + if(!prs_uint16("unknown28", ps, depth, &info->unknown28)) + return False; + if(!prs_uint16("unknown29", ps, depth, &info->unknown29)) return False; return True; @@ -2034,13 +2063,53 @@ uint32 spoolss_size_printer_info_0(PRINTER_INFO_0 *info) { int size=0; - size+=24*4; - size+=6; + size+=size_of_relative_string( &info->printername ); + size+=size_of_relative_string( &info->servername ); + + size+=size_of_uint32( &info->cjobs); + size+=size_of_uint32( &info->total_jobs); + size+=size_of_uint32( &info->total_bytes); + + size+=size_of_uint16( &info->year); + size+=size_of_uint16( &info->month); + size+=size_of_uint16( &info->dayofweek); + size+=size_of_uint16( &info->day); + size+=size_of_uint16( &info->hour); + size+=size_of_uint16( &info->minute); + size+=size_of_uint16( &info->second); + size+=size_of_uint16( &info->milliseconds); + + size+=size_of_uint32( &info->global_counter); + size+=size_of_uint32( &info->total_pages); + + size+=size_of_uint16( &info->major_version); + size+=size_of_uint16( &info->build_version); + + size+=size_of_uint32( &info->unknown7); + size+=size_of_uint32( &info->unknown8); + size+=size_of_uint32( &info->unknown9); + size+=size_of_uint32( &info->session_counter); + size+=size_of_uint32( &info->unknown11); + size+=size_of_uint32( &info->printer_errors); + size+=size_of_uint32( &info->unknown13); + size+=size_of_uint32( &info->unknown14); + size+=size_of_uint32( &info->unknown15); + size+=size_of_uint32( &info->unknown16); + size+=size_of_uint32( &info->change_id); + size+=size_of_uint32( &info->unknown18); + size+=size_of_uint32( &info->status); + size+=size_of_uint32( &info->unknown20); + size+=size_of_uint32( &info->c_setprinter); + + size+=size_of_uint16( &info->unknown22); + size+=size_of_uint16( &info->unknown23); + size+=size_of_uint16( &info->unknown24); + size+=size_of_uint16( &info->unknown25); + size+=size_of_uint16( &info->unknown26); + size+=size_of_uint16( &info->unknown27); + size+=size_of_uint16( &info->unknown28); + size+=size_of_uint16( &info->unknown29); - size+=size_of_uint32( &(info->attributes) ); - size+=size_of_relative_string( &(info->printername) ); - size+=size_of_relative_string( &(info->servername) ); - return size; } @@ -3432,8 +3501,11 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, NT_PRINTER_INFO_LEVEL_2 **asc) { NT_PRINTER_INFO_LEVEL_2 *d; + NTTIME time_nt; + time_t time_unix; DEBUG(7,("Converting from UNICODE to ASCII\n")); + time_unix=time(NULL); if (*asc==NULL) { @@ -3441,6 +3513,12 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, *asc=(NT_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(NT_PRINTER_INFO_LEVEL_2)); ZERO_STRUCTP(*asc); + + /* we allocate memory iff called from + * addprinter(ex) so we can do one time stuff here. + */ + (*asc)->setuptime=time_unix; + } DEBUGADD(8,("start converting\n")); @@ -3454,17 +3532,21 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, d->status=uni->status; d->cjobs=uni->cjobs; - unistr2_to_ascii(d->servername, &(uni->servername), sizeof(d->servername)-1); - unistr2_to_ascii(d->printername, &(uni->printername), sizeof(d->printername)-1); - unistr2_to_ascii(d->sharename, &(uni->sharename), sizeof(d->sharename)-1); - unistr2_to_ascii(d->portname, &(uni->portname), sizeof(d->portname)-1); - unistr2_to_ascii(d->drivername, &(uni->drivername), sizeof(d->drivername)-1); - unistr2_to_ascii(d->comment, &(uni->comment), sizeof(d->comment)-1); - unistr2_to_ascii(d->location, &(uni->location), sizeof(d->location)-1); - unistr2_to_ascii(d->sepfile, &(uni->sepfile), sizeof(d->sepfile)-1); - unistr2_to_ascii(d->printprocessor, &(uni->printprocessor), sizeof(d->printprocessor)-1); - unistr2_to_ascii(d->datatype, &(uni->datatype), sizeof(d->datatype)-1); - unistr2_to_ascii(d->parameters, &(uni->parameters), sizeof(d->parameters)-1); + unix_to_nt_time(&time_nt, time_unix); + d->changeid=time_nt.low; + + d->c_setprinter++; + + unistr2_to_ascii(d->servername, &uni->servername, sizeof(d->servername)-1); + unistr2_to_ascii(d->printername, &uni->printername, sizeof(d->printername)-1); + unistr2_to_ascii(d->sharename, &uni->sharename, sizeof(d->sharename)-1); + unistr2_to_ascii(d->portname, &uni->portname, sizeof(d->portname)-1); + unistr2_to_ascii(d->drivername, &uni->drivername, sizeof(d->drivername)-1); + unistr2_to_ascii(d->location, &uni->location, sizeof(d->location)-1); + unistr2_to_ascii(d->sepfile, &uni->sepfile, sizeof(d->sepfile)-1); + unistr2_to_ascii(d->printprocessor, &uni->printprocessor, sizeof(d->printprocessor)-1); + unistr2_to_ascii(d->datatype, &uni->datatype, sizeof(d->datatype)-1); + unistr2_to_ascii(d->parameters, &uni->parameters, sizeof(d->parameters)-1); return True; } @@ -3790,10 +3872,10 @@ BOOL spoolss_io_q_enumprinterdata(char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_ /******************************************************************* ********************************************************************/ -BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, POLICY_HND *hnd, uint32 index, uint32 valuelen, uint32 datalen) +BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, POLICY_HND *hnd, uint32 idx, uint32 valuelen, uint32 datalen) { memcpy(&(q_u->handle), hnd, sizeof(q_u->handle)); - q_u->index=index; + q_u->index=idx; q_u->valuesize=valuelen; q_u->datasize=datalen; -- cgit From 79bfb14318423f5a26a4d0dc6fc6faa62b1401f8 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 13 Mar 2000 11:09:20 +0000 Subject: parse correctly getprinterdriver2 found a stupid bug in enumprinters fixed some memleaks found a coredump in enumprinterdata getprinterdriverdir responds correctly now. J.F. (This used to be commit 07f2e194ba61e72320636fb7e5d0f041e255868b) --- source3/rpc_parse/parse_spoolss.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 902cc058c3..85d295eb3f 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1933,7 +1933,7 @@ BOOL new_smb_io_driverdir_1(char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 * buffer->struct_start=prs_offset(ps); - if(!new_smb_io_relstr("name", buffer, depth, &info->name)) + if (!spoolss_smb_io_unistr(desc, &info->name, ps, depth)) return False; return True; @@ -2318,7 +2318,9 @@ uint32 spoolss_size_driverdir_info_1(DRIVER_DIRECTORY_1 *info) { int size=0; - size+=size_of_relative_string( &info->name ); + size=str_len_uni(&info->name); /* the string length */ + size=size+1; /* add the leading zero */ + size=size*2; /* convert in char */ return size; } @@ -2419,7 +2421,9 @@ BOOL spoolss_io_q_getprinterdriver2(char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, if(!prs_uint32("offered", ps, depth, &q_u->offered)) return False; - if(!prs_uint32("unknown", ps, depth, &q_u->unknown)) + if(!prs_uint32("clientmajorversion", ps, depth, &q_u->clientmajorversion)) + return False; + if(!prs_uint32("clientminorversion", ps, depth, &q_u->clientminorversion)) return False; return True; @@ -2444,9 +2448,9 @@ BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, return False; if (!prs_uint32("needed", ps, depth, &r_u->needed)) return False; - if (!prs_uint32("unknown0", ps, depth, &r_u->unknown0)) + if (!prs_uint32("servermajorversion", ps, depth, &r_u->servermajorversion)) return False; - if (!prs_uint32("unknown1", ps, depth, &r_u->unknown1)) + if (!prs_uint32("serverminorversion", ps, depth, &r_u->serverminorversion)) return False; if (!prs_uint32("status", ps, depth, &r_u->status)) return False; -- cgit From c5fbb293a8fe2cc2251ffa0d46c79a2d247f7d9a Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 13 Mar 2000 19:34:04 +0000 Subject: oops ! forgot smb.h in last commit added info level 1 parsing code for addprinter(ex) J.F. (This used to be commit 4847f7b17b2d23e4efd4e7cae6bfcfc2319b9409) --- source3/rpc_parse/parse_spoolss.c | 40 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 85d295eb3f..8ff26e090c 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3045,6 +3045,36 @@ BOOL spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, return True; } +/******************************************************************* + Parse a SPOOL_PRINTER_INFO_LEVEL_1 structure. +********************************************************************/ +BOOL spool_io_printer_info_level_1(char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spool_io_printer_info_level_1"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("flags", ps, depth, &il->flags)) + return False; + if(!prs_uint32("description_ptr", ps, depth, &il->description_ptr)) + return False; + if(!prs_uint32("name_ptr", ps, depth, &il->name_ptr)) + return False; + if(!prs_uint32("comment_ptr", ps, depth, &il->comment_ptr)) + return False; + + if(!smb_io_unistr2("description", &il->description, il->description_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("name", &il->name, il->name_ptr, ps, depth)) + return False; + if(!smb_io_unistr2("comment", &il->comment, il->comment_ptr, ps, depth)) + return False; + + return True; +} + /******************************************************************* Parse a SPOOL_PRINTER_INFO_LEVEL_2 structure. ********************************************************************/ @@ -3142,8 +3172,10 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s /* if no struct inside just return */ if (il->info_ptr==0) { - if (UNMARSHALLING(ps)) + if (UNMARSHALLING(ps)) { + il->info_1=NULL; il->info_2=NULL; + } return True; } @@ -3158,6 +3190,12 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s * level 2 is used by addprinter * and by setprinter when updating printer's info */ + case 1: + if (UNMARSHALLING(ps)) + il->info_1=(SPOOL_PRINTER_INFO_LEVEL_1 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_1)); + if (!spool_io_printer_info_level_1("", il->info_1, ps, depth)) + return False; + break; case 2: if (UNMARSHALLING(ps)) il->info_2=(SPOOL_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2)); -- cgit From b89b75a368c5245c38ebe467b2d3820b3df59c6a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 22 Mar 2000 10:26:09 +0000 Subject: added the following message to all dce/rpc client/server code, except the spoolss code (it's cut from TNG) and the smb-dce/rpc interface code that jeremy has been working up to TNG-functionality. i also want this message to go into SAMBA_2_0 and SAMBA_2_0_RELEASE, because it is intolerable that potentially good modifications be made to code that is going to be thrown away, and people waste their time fixing bugs and adding enhancements that have already been carried out already, up to two years ago in the TNG branch. /* * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY, * INCOMPLETE. PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH. * * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY. * * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH * * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG. * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT * MAY BE LOST. * * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST. * * THANK YOU. * * lkcl@samba.org */ (This used to be commit cfaea90529be222f8df0e20a7ca1289f99c29e09) --- source3/rpc_parse/parse_lsa.c | 26 ++++++++++++++++++++++++++ source3/rpc_parse/parse_misc.c | 26 ++++++++++++++++++++++++++ source3/rpc_parse/parse_net.c | 26 ++++++++++++++++++++++++++ source3/rpc_parse/parse_reg.c | 26 ++++++++++++++++++++++++++ source3/rpc_parse/parse_samr.c | 26 ++++++++++++++++++++++++++ source3/rpc_parse/parse_sec.c | 26 ++++++++++++++++++++++++++ source3/rpc_parse/parse_srv.c | 25 +++++++++++++++++++++++++ source3/rpc_parse/parse_wks.c | 25 +++++++++++++++++++++++++ 8 files changed, 206 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 771e7c31d4..cdd2bb50c6 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1,3 +1,29 @@ + +/* + * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY, + * INCOMPLETE. PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE + * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH. + * + * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY. + * + * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT + * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT + * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH + * + * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT + * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG. + * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG + * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO + * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT + * MAY BE LOST. + * + * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST. + * + * THANK YOU. + * + * lkcl@samba.org + */ + /* * Unix SMB/Netbios implementation. * Version 1.9. diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 21d97b444c..121a479240 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1,3 +1,29 @@ + +/* + * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY, + * INCOMPLETE. PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE + * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH. + * + * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY. + * + * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT + * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT + * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH + * + * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT + * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG. + * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG + * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO + * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT + * MAY BE LOST. + * + * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST. + * + * THANK YOU. + * + * lkcl@samba.org + */ + /* * Unix SMB/Netbios implementation. * Version 1.9. diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 9588d1c53b..de89221409 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1,3 +1,29 @@ + +/* + * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY, + * INCOMPLETE. PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE + * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH. + * + * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY. + * + * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT + * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT + * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH + * + * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT + * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG. + * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG + * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO + * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT + * MAY BE LOST. + * + * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST. + * + * THANK YOU. + * + * lkcl@samba.org + */ + /* * Unix SMB/Netbios implementation. * Version 1.9. diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index cc970e4150..1eba491c33 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1,3 +1,29 @@ + +/* + * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY, + * INCOMPLETE. PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE + * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH. + * + * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY. + * + * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT + * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT + * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH + * + * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT + * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG. + * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG + * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO + * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT + * MAY BE LOST. + * + * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST. + * + * THANK YOU. + * + * lkcl@samba.org + */ + /* * Unix SMB/Netbios implementation. * Version 1.9. diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 2327ee7798..2fd2c3da20 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1,3 +1,29 @@ + +/* + * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY, + * INCOMPLETE. PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE + * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH. + * + * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY. + * + * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT + * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT + * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH + * + * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT + * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG. + * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG + * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO + * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT + * MAY BE LOST. + * + * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST. + * + * THANK YOU. + * + * lkcl@samba.org + */ + /* * Unix SMB/Netbios implementation. * Version 1.9. diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 541949e51e..877745308d 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -1,3 +1,29 @@ + +/* + * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY, + * INCOMPLETE. PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE + * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH. + * + * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY. + * + * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT + * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT + * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH + * + * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT + * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG. + * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG + * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO + * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT + * MAY BE LOST. + * + * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST. + * + * THANK YOU. + * + * lkcl@samba.org + */ + /* * Unix SMB/Netbios implementation. * Version 1.9. diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 8997b05e0b..e2e408476c 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1,4 +1,29 @@ +/* + * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY, + * INCOMPLETE. PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE + * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH. + * + * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY. + * + * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT + * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT + * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH + * + * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT + * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG. + * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG + * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO + * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT + * MAY BE LOST. + * + * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST. + * + * THANK YOU. + * + * lkcl@samba.org + */ + /* * Unix SMB/Netbios implementation. * Version 1.9. diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c index 7357e3d2f3..7dac63c357 100644 --- a/source3/rpc_parse/parse_wks.c +++ b/source3/rpc_parse/parse_wks.c @@ -1,4 +1,29 @@ +/* + * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY, + * INCOMPLETE. PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE + * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH. + * + * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY. + * + * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT + * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT + * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH + * + * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT + * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG. + * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG + * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO + * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT + * MAY BE LOST. + * + * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST. + * + * THANK YOU. + * + * lkcl@samba.org + */ + /* * Unix SMB/Netbios implementation. * Version 1.9. -- cgit From 8f1620125dcb9c29c223f4efb6485528ece70f11 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 22 Mar 2000 19:03:12 +0000 Subject: acconfig.h configure configure.in: Added check for UT_SYSLEN for utmp code. include/byteorder.h: Added alignment macros. include/nameserv.h: Added defines for msg_type field options - from rfc1002. lib/time.c: Typo fix. lib/util_unistr.c: Updates from UNICODE branch. printing/nt_printing.c: bzero -> memset. smbd/connection.c: Added check for UT_SYSLEN for utmp code. Other fixes : Rollback of unapproved commit from Luke. Please *ask* next time before doing large changes to HEAD. Jeremy. (This used to be commit f02999dbf7971b4ea05050d7206205d7737a78b2) --- source3/rpc_parse/parse_lsa.c | 26 -------------------------- source3/rpc_parse/parse_misc.c | 26 -------------------------- source3/rpc_parse/parse_net.c | 26 -------------------------- source3/rpc_parse/parse_reg.c | 26 -------------------------- source3/rpc_parse/parse_samr.c | 26 -------------------------- source3/rpc_parse/parse_sec.c | 26 -------------------------- source3/rpc_parse/parse_srv.c | 25 ------------------------- source3/rpc_parse/parse_wks.c | 25 ------------------------- 8 files changed, 206 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index cdd2bb50c6..771e7c31d4 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1,29 +1,3 @@ - -/* - * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY, - * INCOMPLETE. PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE - * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH. - * - * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY. - * - * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT - * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT - * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH - * - * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT - * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG. - * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG - * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO - * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT - * MAY BE LOST. - * - * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST. - * - * THANK YOU. - * - * lkcl@samba.org - */ - /* * Unix SMB/Netbios implementation. * Version 1.9. diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 121a479240..21d97b444c 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1,29 +1,3 @@ - -/* - * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY, - * INCOMPLETE. PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE - * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH. - * - * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY. - * - * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT - * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT - * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH - * - * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT - * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG. - * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG - * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO - * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT - * MAY BE LOST. - * - * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST. - * - * THANK YOU. - * - * lkcl@samba.org - */ - /* * Unix SMB/Netbios implementation. * Version 1.9. diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index de89221409..9588d1c53b 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1,29 +1,3 @@ - -/* - * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY, - * INCOMPLETE. PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE - * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH. - * - * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY. - * - * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT - * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT - * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH - * - * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT - * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG. - * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG - * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO - * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT - * MAY BE LOST. - * - * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST. - * - * THANK YOU. - * - * lkcl@samba.org - */ - /* * Unix SMB/Netbios implementation. * Version 1.9. diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 1eba491c33..cc970e4150 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1,29 +1,3 @@ - -/* - * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY, - * INCOMPLETE. PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE - * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH. - * - * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY. - * - * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT - * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT - * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH - * - * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT - * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG. - * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG - * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO - * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT - * MAY BE LOST. - * - * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST. - * - * THANK YOU. - * - * lkcl@samba.org - */ - /* * Unix SMB/Netbios implementation. * Version 1.9. diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 2fd2c3da20..2327ee7798 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1,29 +1,3 @@ - -/* - * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY, - * INCOMPLETE. PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE - * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH. - * - * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY. - * - * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT - * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT - * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH - * - * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT - * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG. - * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG - * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO - * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT - * MAY BE LOST. - * - * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST. - * - * THANK YOU. - * - * lkcl@samba.org - */ - /* * Unix SMB/Netbios implementation. * Version 1.9. diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 877745308d..541949e51e 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -1,29 +1,3 @@ - -/* - * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY, - * INCOMPLETE. PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE - * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH. - * - * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY. - * - * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT - * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT - * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH - * - * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT - * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG. - * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG - * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO - * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT - * MAY BE LOST. - * - * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST. - * - * THANK YOU. - * - * lkcl@samba.org - */ - /* * Unix SMB/Netbios implementation. * Version 1.9. diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index e2e408476c..8997b05e0b 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1,29 +1,4 @@ -/* - * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY, - * INCOMPLETE. PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE - * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH. - * - * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY. - * - * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT - * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT - * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH - * - * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT - * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG. - * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG - * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO - * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT - * MAY BE LOST. - * - * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST. - * - * THANK YOU. - * - * lkcl@samba.org - */ - /* * Unix SMB/Netbios implementation. * Version 1.9. diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c index 7dac63c357..7357e3d2f3 100644 --- a/source3/rpc_parse/parse_wks.c +++ b/source3/rpc_parse/parse_wks.c @@ -1,29 +1,4 @@ -/* - * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY, - * INCOMPLETE. PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE - * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH. - * - * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY. - * - * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT - * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT - * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH - * - * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT - * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG. - * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG - * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO - * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT - * MAY BE LOST. - * - * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST. - * - * THANK YOU. - * - * lkcl@samba.org - */ - /* * Unix SMB/Netbios implementation. * Version 1.9. -- cgit From 614929752ecfc7a2f621bc868406d3d77b63895d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 25 Mar 2000 01:37:08 +0000 Subject: rpc_parse/parse_spoolss.c: Added checks on mallocs/overflow checks on all prs_xx calls. smbd/connection.c: Fix from David Lee . Jeremy. (This used to be commit 53721fbc7d2a986cf999b8f031a2d9003c0dccae) --- source3/rpc_parse/parse_spoolss.c | 424 ++++++++++++++++++++++++++------------ 1 file changed, 291 insertions(+), 133 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 8ff26e090c..d88761e081 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -55,14 +55,22 @@ This should be moved in a more generic lib. ********************************************************************/ static BOOL spoolss_io_system_time(char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) { - prs_uint16("year", ps, depth, &(systime->year)); - prs_uint16("month", ps, depth, &(systime->month)); - prs_uint16("dayofweek", ps, depth, &(systime->dayofweek)); - prs_uint16("day", ps, depth, &(systime->day)); - prs_uint16("hour", ps, depth, &(systime->hour)); - prs_uint16("minute", ps, depth, &(systime->minute)); - prs_uint16("second", ps, depth, &(systime->second)); - prs_uint16("milliseconds", ps, depth, &(systime->milliseconds)); + if(!prs_uint16("year", ps, depth, &(systime->year))) + return False; + if(!prs_uint16("month", ps, depth, &(systime->month))) + return False; + if(!prs_uint16("dayofweek", ps, depth, &(systime->dayofweek))) + return False; + if(!prs_uint16("day", ps, depth, &(systime->day))) + return False; + if(!prs_uint16("hour", ps, depth, &(systime->hour))) + return False; + if(!prs_uint16("minute", ps, depth, &(systime->minute))) + return False; + if(!prs_uint16("second", ps, depth, &(systime->second))) + return False; + if(!prs_uint16("milliseconds", ps, depth, &(systime->milliseconds))) + return False; return True; } @@ -93,15 +101,22 @@ static BOOL smb_io_doc_info_1(char *desc, DOC_INFO_1 *info_1, prs_struct *ps, in prs_debug(ps, depth, desc, "smb_io_doc_info_1"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("p_docname", ps, depth, &(info_1->p_docname)); - prs_uint32("p_outputfile", ps, depth, &(info_1->p_outputfile)); - prs_uint32("p_datatype", ps, depth, &(info_1->p_datatype)); + if(!prs_uint32("p_docname", ps, depth, &(info_1->p_docname))) + return False; + if(!prs_uint32("p_outputfile", ps, depth, &(info_1->p_outputfile))) + return False; + if(!prs_uint32("p_datatype", ps, depth, &(info_1->p_datatype))) + return False; - smb_io_unistr2("", &(info_1->docname), info_1->p_docname, ps, depth); - smb_io_unistr2("", &(info_1->outputfile), info_1->p_outputfile, ps, depth); - smb_io_unistr2("", &(info_1->datatype), info_1->p_datatype, ps, depth); + if(!smb_io_unistr2("", &(info_1->docname), info_1->p_docname, ps, depth)) + return False; + if(!smb_io_unistr2("", &(info_1->outputfile), info_1->p_outputfile, ps, depth)) + return False; + if(!smb_io_unistr2("", &(info_1->datatype), info_1->p_datatype, ps, depth)) + return False; return True; } @@ -118,16 +133,20 @@ static BOOL smb_io_doc_info(char *desc, DOC_INFO *info, prs_struct *ps, int dept prs_debug(ps, depth, desc, "smb_io_doc_info"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("switch_value", ps, depth, &(info->switch_value)); + if(!prs_uint32("switch_value", ps, depth, &(info->switch_value))) + return False; - prs_uint32("doc_info_X ptr", ps, depth, &(useless_ptr)); + if(!prs_uint32("doc_info_X ptr", ps, depth, &(useless_ptr))) + return False; switch (info->switch_value) { case 1: - smb_io_doc_info_1("",&(info->doc_info_1), ps, depth); + if(!smb_io_doc_info_1("",&(info->doc_info_1), ps, depth)) + return False; break; case 2: /* @@ -160,11 +179,14 @@ static BOOL smb_io_doc_info_container(char *desc, DOC_INFO_CONTAINER *cont, prs_ prs_debug(ps, depth, desc, "smb_io_doc_info_container"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("level", ps, depth, &(cont->level)); + if(!prs_uint32("level", ps, depth, &(cont->level))) + return False; - smb_io_doc_info("",&(cont->docinfo), ps, depth); + if(!smb_io_doc_info("",&(cont->docinfo), ps, depth)) + return False; return True; } @@ -308,20 +330,28 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs isvalue=data->enc_type; - prs_align(ps); - prs_uint16("type", ps, depth, &(data->type)); - prs_uint16("field", ps, depth, &(data->field)); + if(!prs_align(ps)) + return False; + if(!prs_uint16("type", ps, depth, &(data->type))) + return False; + if(!prs_uint16("field", ps, depth, &(data->field))) + return False; /*prs_align(ps);*/ - prs_uint32("how many words", ps, depth, &how_many_words); - prs_uint32("id", ps, depth, &(data->id)); - prs_uint32("how many words", ps, depth, &how_many_words); + if(!prs_uint32("how many words", ps, depth, &how_many_words)) + return False; + if(!prs_uint32("id", ps, depth, &(data->id))) + return False; + if(!prs_uint32("how many words", ps, depth, &how_many_words)) + return False; /*prs_align(ps);*/ if (isvalue==True) { - prs_uint32("value[0]", ps, depth, &(data->notify_data.value[0])); - prs_uint32("value[1]", ps, depth, &(data->notify_data.value[1])); + if(!prs_uint32("value[0]", ps, depth, &(data->notify_data.value[0]))) + return False; + if(!prs_uint32("value[1]", ps, depth, &(data->notify_data.value[1]))) + return False; /*prs_align(ps);*/ } else @@ -329,8 +359,10 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs /* it's a string */ /* length in ascii including \0 */ x=2*(data->notify_data.data.length+1); - prs_uint32("string length", ps, depth, &x ); - prs_uint32("pointer", ps, depth, &useless_ptr); + if(!prs_uint32("string length", ps, depth, &x )) + return False; + if(!prs_uint32("pointer", ps, depth, &useless_ptr)) + return False; /*prs_align(ps);*/ } @@ -349,17 +381,22 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_debug(ps, depth, desc, "smb_io_notify_info_data"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; + isvalue=data->enc_type; if (isvalue==False) { /* length of string in unicode include \0 */ x=data->notify_data.data.length+1; - prs_uint32("string length", ps, depth, &x ); - prs_uint16s(True,"string",ps,depth,data->notify_data.data.string,x); + if(!prs_uint32("string length", ps, depth, &x )) + return False; + if(!prs_uint16s(True,"string",ps,depth,data->notify_data.data.string,x)) + return False; } - prs_align(ps); + if(!prs_align(ps)) + return False; return True; } @@ -377,20 +414,26 @@ static BOOL smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, prs_struct * if(!prs_align(ps)) return False; - prs_uint32("count", ps, depth, &(info->count)); - prs_uint32("version", ps, depth, &(info->version)); - prs_uint32("flags", ps, depth, &(info->flags)); - prs_uint32("count", ps, depth, &(info->count)); + if(!prs_uint32("count", ps, depth, &(info->count))) + return False; + if(!prs_uint32("version", ps, depth, &(info->version))) + return False; + if(!prs_uint32("flags", ps, depth, &(info->flags))) + return False; + if(!prs_uint32("count", ps, depth, &(info->count))) + return False; for (i=0;icount;i++) { - smb_io_notify_info_data(desc, &(info->data[i]), ps, depth); + if(!smb_io_notify_info_data(desc, &(info->data[i]), ps, depth)) + return False; } /* now do the strings at the end of the stream */ for (i=0;icount;i++) { - smb_io_notify_info_data_strings(desc, &(info->data[i]), ps, depth); + if(!smb_io_notify_info_data_strings(desc, &(info->data[i]), ps, depth)) + return False; } return True; @@ -546,6 +589,8 @@ static BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE { if (UNMARSHALLING(ps)) { devmode->private=(uint8 *)malloc(devmode->driverextra*sizeof(uint8)); + if(devmode->private == NULL) + return False; DEBUG(7,("spoolss_io_devmode: allocated memory [%d] for private\n",devmode->driverextra)); } @@ -588,6 +633,8 @@ static BOOL spoolss_io_devmode_cont(char *desc, DEVMODE_CTR *dm_c, prs_struct *p if (UNMARSHALLING(ps)) { DEBUG(9,("Allocating memory for spoolss_io_devmode\n")); dm_c->devmode=(DEVICEMODE *)malloc(sizeof(DEVICEMODE)); + if(dm_c->devmode == NULL) + return False; ZERO_STRUCTP(dm_c->devmode); } @@ -869,11 +916,14 @@ BOOL spoolss_io_q_startdocprinter(char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_ prs_debug(ps, depth, desc, "spoolss_io_q_startdocprinter"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth); + if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + return False; - smb_io_doc_info_container("",&(q_u->doc_info_container), ps, depth); + if(!smb_io_doc_info_container("",&(q_u->doc_info_container), ps, depth)) + return False; return True; } @@ -886,8 +936,10 @@ BOOL spoolss_io_r_startdocprinter(char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_ { prs_debug(ps, depth, desc, "spoolss_io_r_startdocprinter"); depth++; - prs_uint32("jobid", ps, depth, &(r_u->jobid)); - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("jobid", ps, depth, &(r_u->jobid))) + return False; + if(!prs_uint32("status", ps, depth, &(r_u->status))) + return False; return True; } @@ -903,9 +955,11 @@ BOOL spoolss_io_q_enddocprinter(char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_stru prs_debug(ps, depth, desc, "spoolss_io_q_enddocprinter"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth); + if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + return False; return True; } @@ -918,7 +972,8 @@ BOOL spoolss_io_r_enddocprinter(char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_stru { prs_debug(ps, depth, desc, "spoolss_io_r_enddocprinter"); depth++; - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &(r_u->status))) + return False; return True; } @@ -934,9 +989,11 @@ BOOL spoolss_io_q_startpageprinter(char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, pr prs_debug(ps, depth, desc, "spoolss_io_q_startpageprinter"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth); + if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + return False; return True; } @@ -949,7 +1006,8 @@ BOOL spoolss_io_r_startpageprinter(char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, pr { prs_debug(ps, depth, desc, "spoolss_io_r_startpageprinter"); depth++; - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &(r_u->status))) + return False; return True; } @@ -965,9 +1023,11 @@ BOOL spoolss_io_q_endpageprinter(char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_st prs_debug(ps, depth, desc, "spoolss_io_q_endpageprinter"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth); + if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + return False; return True; } @@ -980,7 +1040,8 @@ BOOL spoolss_io_r_endpageprinter(char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_st { prs_debug(ps, depth, desc, "spoolss_io_r_endpageprinter"); depth++; - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &(r_u->status))) + return False; return True; } @@ -996,18 +1057,26 @@ BOOL spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct prs_debug(ps, depth, desc, "spoolss_io_q_writeprinter"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("buffer_size", ps, depth, &(q_u->buffer_size)); + if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + return False; + if(!prs_uint32("buffer_size", ps, depth, &(q_u->buffer_size))) + return False; if (q_u->buffer_size!=0) { q_u->buffer=(uint8 *)malloc(q_u->buffer_size*sizeof(uint8)); - prs_uint8s(True, "buffer", ps, depth, q_u->buffer, q_u->buffer_size); + if(q_u->buffer == NULL) + return False; + if(!prs_uint8s(True, "buffer", ps, depth, q_u->buffer, q_u->buffer_size)) + return False; } - prs_align(ps); - prs_uint32("buffer_size2", ps, depth, &(q_u->buffer_size2)); + if(!prs_align(ps)) + return False; + if(!prs_uint32("buffer_size2", ps, depth, &(q_u->buffer_size2))) + return False; return True; } @@ -1020,8 +1089,10 @@ BOOL spoolss_io_r_writeprinter(char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct { prs_debug(ps, depth, desc, "spoolss_io_r_writeprinter"); depth++; - prs_uint32("buffer_written", ps, depth, &(r_u->buffer_written)); - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("buffer_written", ps, depth, &(r_u->buffer_written))) + return False; + if(!prs_uint32("status", ps, depth, &(r_u->status))) + return False; return True; } @@ -2605,9 +2676,11 @@ BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps prs_debug(ps, depth, desc, "spoolss_io_r_setprinter"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &(r_u->status))) + return False; return True; } @@ -2633,8 +2706,10 @@ BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps if (!spoolss_io_devmode_cont(desc, &q_u->devmode_ctr, ps, depth)) return False; - prs_uint32("security.size_of_buffer", ps, depth, &q_u->security.size_of_buffer); - prs_uint32("security.data", ps, depth, &q_u->security.data); + if(!prs_uint32("security.size_of_buffer", ps, depth, &q_u->security.size_of_buffer)) + return False; + if(!prs_uint32("security.data", ps, depth, &q_u->security.data)) + return False; if(!prs_uint32("command", ps, depth, &q_u->command)) return False; @@ -2649,9 +2724,11 @@ BOOL spoolss_io_r_fcpn(char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "spoolss_io_r_fcpn"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &(r_u->status))) + return False; return True; } @@ -2664,9 +2741,11 @@ BOOL spoolss_io_q_fcpn(char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "spoolss_io_q_fcpn"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth); + if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + return False; return True; } @@ -2802,9 +2881,11 @@ BOOL spoolss_io_r_schedulejob(char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct * prs_debug(ps, depth, desc, "spoolss_io_r_schedulejob"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &(r_u->status))) + return False; return True; } @@ -2816,10 +2897,13 @@ BOOL spoolss_io_q_schedulejob(char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct * prs_debug(ps, depth, desc, "spoolss_io_q_schedulejob"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("jobid", ps, depth, &(q_u->jobid)); + if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + return False; + if(!prs_uint32("jobid", ps, depth, &(q_u->jobid))) + return False; return True; } @@ -2831,9 +2915,11 @@ BOOL spoolss_io_r_setjob(char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int de prs_debug(ps, depth, desc, "spoolss_io_r_setjob"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &(r_u->status))) + return False; return True; } @@ -2845,16 +2931,21 @@ BOOL spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int de prs_debug(ps, depth, desc, "spoolss_io_q_setjob"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth); - prs_uint32("jobid", ps, depth, &(q_u->jobid)); + if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + return False; + if(!prs_uint32("jobid", ps, depth, &(q_u->jobid))) + return False; /* * level is usually 0. If (level!=0) then I'm in trouble ! * I will try to generate setjob command with level!=0, one day. */ - prs_uint32("level", ps, depth, &(q_u->level)); - prs_uint32("command", ps, depth, &(q_u->command)); + if(!prs_uint32("level", ps, depth, &(q_u->level))) + return False; + if(!prs_uint32("command", ps, depth, &(q_u->command))) + return False; return True; } @@ -3191,14 +3282,20 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s * and by setprinter when updating printer's info */ case 1: - if (UNMARSHALLING(ps)) + if (UNMARSHALLING(ps)) { il->info_1=(SPOOL_PRINTER_INFO_LEVEL_1 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_1)); + if(il->info_1 == NULL) + return False; + } if (!spool_io_printer_info_level_1("", il->info_1, ps, depth)) return False; break; case 2: - if (UNMARSHALLING(ps)) + if (UNMARSHALLING(ps)) { il->info_2=(SPOOL_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2)); + if(il->info_2 == NULL) + return False; + } if (!spool_io_printer_info_level_2("", il->info_2, ps, depth)) return False; break; @@ -3270,9 +3367,11 @@ BOOL spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, prs_struct prs_debug(ps, depth, desc, "spoolss_io_r_addprinterex"); depth++; - smb_io_pol_hnd("printer handle",&(r_u->handle),ps,depth); + if(!smb_io_pol_hnd("printer handle",&(r_u->handle),ps,depth)) + return False; - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &(r_u->status))) + return False; return True; } @@ -3290,6 +3389,8 @@ BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_ /* reading */ if (UNMARSHALLING(ps)) { il=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *)malloc(sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); + if(il == NULL) + return False; ZERO_STRUCTP(il); *q_u=il; } @@ -3381,7 +3482,9 @@ BOOL uniarray_2_ascarray(BUFFER5 *buf5, char ***ar) src=buf5->buffer; string=(char *)malloc(sizeof(char)*buf5->buf_len); - + if(string == NULL) + return False; + destend = string + buf5->buf_len; dest=string; @@ -3392,6 +3495,8 @@ BOOL uniarray_2_ascarray(BUFFER5 *buf5, char ***ar) /* that ugly for the first one but that's working */ array=(char **)Realloc(array, sizeof(char *)*(i+1)); + if(array == NULL) + return False; array[i++]=string; while ( n < buf5->buf_len ) @@ -3399,6 +3504,8 @@ BOOL uniarray_2_ascarray(BUFFER5 *buf5, char ***ar) if ( *(string++) == '\0' ) { array=(char **)Realloc(array, sizeof(char *)*(i+1)); + if(array == NULL) + return False; array[i++]=string; } n++; @@ -3422,10 +3529,11 @@ BOOL smb_io_unibuffer(char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) buffer->undoc=0; buffer->uni_str_len=buffer->uni_max_len; - prs_uint32("buffer_size", ps, depth, &(buffer->uni_max_len)); - - prs_unistr2(True, "buffer ", ps, depth, buffer); + if(!prs_uint32("buffer_size", ps, depth, &(buffer->uni_max_len))) + return False; + if(!prs_unistr2(True, "buffer ", ps, depth, buffer)) + return False; return True; } @@ -3449,7 +3557,8 @@ BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LE switch (il->level) { case 3: - spool_io_printer_driver_info_level_3("", &(il->info_3), ps, depth); + if(!spool_io_printer_driver_info_level_3("", &(il->info_3), ps, depth)) + return False; break; } @@ -3508,6 +3617,8 @@ BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, if (*asc==NULL) { *asc=(NT_PRINTER_DRIVER_INFO_LEVEL_3 *)malloc(sizeof(NT_PRINTER_DRIVER_INFO_LEVEL_3)); + if(*asc == NULL) + return False; ZERO_STRUCTP(*asc); } @@ -3554,6 +3665,8 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, DEBUGADD(8,("allocating memory\n")); *asc=(NT_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(NT_PRINTER_INFO_LEVEL_2)); + if(*asc == NULL) + return False; ZERO_STRUCTP(*asc); /* we allocate memory iff called from @@ -3931,15 +4044,21 @@ BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_st prs_debug(ps, depth, desc, "spoolss_io_q_setprinterdata"); depth++; - prs_align(ps); - smb_io_pol_hnd("printer handle", &(q_u->handle), ps, depth); - smb_io_unistr2("", &(q_u->value), True, ps, depth); + if(!prs_align(ps)) + return False; + if(!smb_io_pol_hnd("printer handle", &(q_u->handle), ps, depth)) + return False; + if(!smb_io_unistr2("", &(q_u->value), True, ps, depth)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("type", ps, depth, &(q_u->type)); + if(!prs_uint32("type", ps, depth, &(q_u->type))) + return False; - prs_uint32("max_len", ps, depth, &(q_u->max_len)); + if(!prs_uint32("max_len", ps, depth, &(q_u->max_len))) + return False; switch (q_u->type) { @@ -3948,12 +4067,17 @@ BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_st case 0x4: case 0x7: q_u->data=(uint8 *)malloc(q_u->max_len * sizeof(uint8)); - prs_uint8s(False,"data", ps, depth, q_u->data, q_u->max_len); - prs_align(ps); + if(q_u->data == NULL) + return False; + if(!prs_uint8s(False,"data", ps, depth, q_u->data, q_u->max_len)) + return False; + if(!prs_align(ps)) + return False; break; } - prs_uint32("real_len", ps, depth, &(q_u->real_len)); + if(!prs_uint32("real_len", ps, depth, &(q_u->real_len))) + return False; return True; } @@ -3965,8 +4089,10 @@ BOOL spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_st prs_debug(ps, depth, desc, "spoolss_io_r_setprinterdata"); depth++; - prs_align(ps); - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_align(ps)) + return False; + if(!prs_uint32("status", ps, depth, &(r_u->status))) + return False; return True; } @@ -3981,6 +4107,8 @@ BOOL convert_specific_param(NT_PRINTER_PARAM **param, const UNISTR2 *value, if (*param == NULL) { *param=(NT_PRINTER_PARAM *)malloc(sizeof(NT_PRINTER_PARAM)); + if(*param == NULL) + return False; ZERO_STRUCTP(*param); DEBUGADD(6,("Allocated a new PARAM struct\n")); } @@ -3993,6 +4121,8 @@ BOOL convert_specific_param(NT_PRINTER_PARAM **param, const UNISTR2 *value, (*param)->data_len=len; (*param)->data=(uint8 *)malloc(len * sizeof(uint8)); + if((*param)->data == NULL) + return False; memcpy((*param)->data, data, len); @@ -4007,20 +4137,30 @@ static BOOL spoolss_io_addform(char *desc, FORM *f, uint32 ptr, prs_struct *ps, { prs_debug(ps, depth, desc, "spoolss_io_addform"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; if (ptr!=0) { - prs_uint32("flags", ps, depth, &(f->flags)); - prs_uint32("name_ptr", ps, depth, &(f->name_ptr)); - prs_uint32("size_x", ps, depth, &(f->size_x)); - prs_uint32("size_y", ps, depth, &(f->size_y)); - prs_uint32("left", ps, depth, &(f->left)); - prs_uint32("top", ps, depth, &(f->top)); - prs_uint32("right", ps, depth, &(f->right)); - prs_uint32("bottom", ps, depth, &(f->bottom)); - - smb_io_unistr2("", &(f->name), f->name_ptr, ps, depth); + if(!prs_uint32("flags", ps, depth, &(f->flags))) + return False; + if(!prs_uint32("name_ptr", ps, depth, &(f->name_ptr))) + return False; + if(!prs_uint32("size_x", ps, depth, &(f->size_x))) + return False; + if(!prs_uint32("size_y", ps, depth, &(f->size_y))) + return False; + if(!prs_uint32("left", ps, depth, &(f->left))) + return False; + if(!prs_uint32("top", ps, depth, &(f->top))) + return False; + if(!prs_uint32("right", ps, depth, &(f->right))) + return False; + if(!prs_uint32("bottom", ps, depth, &(f->bottom))) + return False; + + if(!smb_io_unistr2("", &(f->name), f->name_ptr, ps, depth)) + return False; } return True; @@ -4034,15 +4174,21 @@ BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int prs_debug(ps, depth, desc, "spoolss_io_q_addform"); depth++; - prs_align(ps); - smb_io_pol_hnd("printer handle", &(q_u->handle), ps, depth); - prs_uint32("level", ps, depth, &(q_u->level)); - prs_uint32("level2", ps, depth, &(q_u->level2)); + if(!prs_align(ps)) + return False; + if(!smb_io_pol_hnd("printer handle", &(q_u->handle), ps, depth)) + return False; + if(!prs_uint32("level", ps, depth, &(q_u->level))) + return False; + if(!prs_uint32("level2", ps, depth, &(q_u->level2))) + return False; if (q_u->level==1) { - prs_uint32("useless_ptr", ps, depth, &(useless_ptr)); - spoolss_io_addform("", &(q_u->form), useless_ptr, ps, depth); + if(!prs_uint32("useless_ptr", ps, depth, &(useless_ptr))) + return False; + if(!spoolss_io_addform("", &(q_u->form), useless_ptr, ps, depth)) + return False; } return True; @@ -4055,8 +4201,10 @@ BOOL spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int prs_debug(ps, depth, desc, "spoolss_io_r_addform"); depth++; - prs_align(ps); - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_align(ps)) + return False; + if(!prs_uint32("status", ps, depth, &(r_u->status))) + return False; return True; } @@ -4069,19 +4217,27 @@ BOOL spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int prs_debug(ps, depth, desc, "spoolss_io_q_setform"); depth++; - prs_align(ps); - smb_io_pol_hnd("printer handle", &(q_u->handle), ps, depth); - smb_io_unistr2("", &(q_u->name), True, ps, depth); + if(!prs_align(ps)) + return False; + if(!smb_io_pol_hnd("printer handle", &(q_u->handle), ps, depth)) + return False; + if(!smb_io_unistr2("", &(q_u->name), True, ps, depth)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("level", ps, depth, &(q_u->level)); - prs_uint32("level2", ps, depth, &(q_u->level2)); + if(!prs_uint32("level", ps, depth, &(q_u->level))) + return False; + if(!prs_uint32("level2", ps, depth, &(q_u->level2))) + return False; if (q_u->level==1) { - prs_uint32("useless_ptr", ps, depth, &(useless_ptr)); - spoolss_io_addform("", &(q_u->form), useless_ptr, ps, depth); + if(!prs_uint32("useless_ptr", ps, depth, &(useless_ptr))) + return False; + if(!spoolss_io_addform("", &(q_u->form), useless_ptr, ps, depth)) + return False; } return True; @@ -4094,8 +4250,10 @@ BOOL spoolss_io_r_setform(char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int prs_debug(ps, depth, desc, "spoolss_io_r_setform"); depth++; - prs_align(ps); - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_align(ps)) + return False; + if(!prs_uint32("status", ps, depth, &(r_u->status))) + return False; return True; } -- cgit From 6ca0ed9baa7d2a4b4d46ca730d4984f80965d849 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Wed, 29 Mar 2000 12:36:44 +0000 Subject: rewrote getprinterdriver level 3, now correctly handle the dependent files. A number of memleak fixed some error return values fixed. J.F. (This used to be commit c212fbe009fe556d5329b5d7106159cf21402d82) --- source3/rpc_parse/parse_misc.c | 2 +- source3/rpc_parse/parse_spoolss.c | 277 +++++++++++++++++++++++--------------- 2 files changed, 172 insertions(+), 107 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 21d97b444c..d19fe47a0d 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -598,7 +598,7 @@ the buf_len member tells you how large the buffer is. ********************************************************************/ BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, "smb_io_buffer4"); + prs_debug(ps, depth, desc, "smb_io_buffer5"); depth++; if (buf5 == NULL) return False; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index d88761e081..0450ebd243 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -32,6 +32,7 @@ #define prs_uint16s _prs_uint16s #define prs_unistr _prs_unistr #define init_unistr2 make_unistr2 + #define init_buf_unistr2 make_buf_unistr2 #endif @@ -1255,7 +1256,7 @@ static uint32 size_of_device_mode(DEVICEMODE *devmode) if (devmode==NULL) return (4); else - return (0xDC+4); + return (4+devmode->size+devmode->driverextra); } /******************************************************************* @@ -1349,39 +1350,49 @@ static BOOL new_smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR /******************************************************************* - * write a array UNICODE strings and its relative pointer. + * write a array of UNICODE strings and its relative pointer. * used by 2 RPC structs ********************************************************************/ -static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR ***string) +static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16 **string) { + UNISTR chaine; + prs_struct *ps=&(buffer->prs); if (MARSHALLING(ps)) { uint32 struct_offset = prs_offset(ps); uint32 relative_offset; - int i=0; - - while ( (*string)[i]!=0x0000 ) - i++; - i--; - - /* count the ending NULL of the array */ + uint16 *p; + uint16 *q; + uint16 zero=0; + p=*string; + q=*string; + + /* first write the last 0 */ buffer->string_at_end -= 2; + prs_set_offset(ps, buffer->string_at_end); + + if(!prs_uint16("leading zero", ps, depth, &zero)) + return False; - /* jfm: FIXME: write a (uint16) 0 for the ending NULL */ - do - { - buffer->string_at_end -= 2*(str_len_uni((*string)[i])+1); + { + while (*q!=0) + q++; + + memcpy(chaine.buffer, p, (q-p+1)*sizeof(uint16)); + + buffer->string_at_end -= (q-p+1)*sizeof(uint16); + prs_set_offset(ps, buffer->string_at_end); /* write the string */ - if (!spoolss_smb_io_unistr(desc, (*string)[i], ps, depth)) + if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) return False; - - i--; - } - while (i>=0); + q++; + p=q; + + } while (*p!=0); /* end on the last leading 0 */ prs_set_offset(ps, struct_offset); @@ -1392,22 +1403,32 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, UN } else { uint32 old_offset; + uint16 *chaine2=NULL; + int l_chaine=0; + int l_chaine2=0; + *string=NULL; + /* read the offset */ if (!prs_uint32("offset", ps, depth, &(buffer->string_at_end))) return False; old_offset = prs_offset(ps); - prs_set_offset(ps, buffer->string_at_end); - - /* read the string */ - - /* jfm: FIXME: alloc memory and read all the strings until the string is NULL */ + prs_set_offset(ps, buffer->string_at_end + buffer->struct_start); + + do { + if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) + return False; + + l_chaine=str_len_uni(&chaine); + chaine2=(uint16 *)Realloc(chaine2, (l_chaine2+l_chaine+1)*sizeof(uint16)); + memcpy(chaine2+l_chaine2, chaine.buffer, (l_chaine+1)*sizeof(uint16)); + l_chaine2+=l_chaine+1; + + } while(l_chaine!=0); + + *string=chaine2; -/* - if (!spoolss_smb_io_unistr(desc, string, ps, depth)) - return False; -*/ prs_set_offset(ps, old_offset); } return True; @@ -2207,30 +2228,30 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) int size=0; size+=4; /* the security descriptor */ - size+=info->devmode->size+4; /* size of the devmode and the ptr */ - size+=info->devmode->driverextra; /* if a devmode->private section exists, add its size */ - size+=size_of_relative_string( &(info->servername) ); - size+=size_of_relative_string( &(info->printername) ); - size+=size_of_relative_string( &(info->sharename) ); - size+=size_of_relative_string( &(info->portname) ); - size+=size_of_relative_string( &(info->drivername) ); - size+=size_of_relative_string( &(info->comment) ); - size+=size_of_relative_string( &(info->location) ); + size+=size_of_device_mode( info->devmode ); - size+=size_of_relative_string( &(info->sepfile) ); - size+=size_of_relative_string( &(info->printprocessor) ); - size+=size_of_relative_string( &(info->datatype) ); - size+=size_of_relative_string( &(info->parameters) ); - - size+=size_of_uint32( &(info->attributes) ); - size+=size_of_uint32( &(info->priority) ); - size+=size_of_uint32( &(info->defaultpriority) ); - size+=size_of_uint32( &(info->starttime) ); - size+=size_of_uint32( &(info->untiltime) ); - size+=size_of_uint32( &(info->status) ); - size+=size_of_uint32( &(info->cjobs) ); - size+=size_of_uint32( &(info->averageppm) ); + size+=size_of_relative_string( &info->servername ); + size+=size_of_relative_string( &info->printername ); + size+=size_of_relative_string( &info->sharename ); + size+=size_of_relative_string( &info->portname ); + size+=size_of_relative_string( &info->drivername ); + size+=size_of_relative_string( &info->comment ); + size+=size_of_relative_string( &info->location ); + + size+=size_of_relative_string( &info->sepfile ); + size+=size_of_relative_string( &info->printprocessor ); + size+=size_of_relative_string( &info->datatype ); + size+=size_of_relative_string( &info->parameters ); + + size+=size_of_uint32( &info->attributes ); + size+=size_of_uint32( &info->priority ); + size+=size_of_uint32( &info->defaultpriority ); + size+=size_of_uint32( &info->starttime ); + size+=size_of_uint32( &info->untiltime ); + size+=size_of_uint32( &info->status ); + size+=size_of_uint32( &info->cjobs ); + size+=size_of_uint32( &info->averageppm ); return size; } @@ -2240,7 +2261,7 @@ return the size required by a struct in the stream uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info) { int size=0; - size+=size_of_relative_string( &(info->name) ); + size+=size_of_relative_string( &info->name ); return size; } @@ -2251,12 +2272,12 @@ return the size required by a struct in the stream uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info) { int size=0; - size+=size_of_uint32( &(info->version) ); - size+=size_of_relative_string( &(info->name) ); - size+=size_of_relative_string( &(info->architecture) ); - size+=size_of_relative_string( &(info->driverpath) ); - size+=size_of_relative_string( &(info->datafile) ); - size+=size_of_relative_string( &(info->configfile) ); + size+=size_of_uint32( &info->version ); + size+=size_of_relative_string( &info->name ); + size+=size_of_relative_string( &info->architecture ); + size+=size_of_relative_string( &info->driverpath ); + size+=size_of_relative_string( &info->datafile ); + size+=size_of_relative_string( &info->configfile ); return size; } @@ -2267,26 +2288,24 @@ return the size required by a struct in the stream uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) { int size=0; - UNISTR **string; + uint16 *string; int i=0; - size+=size_of_uint32( &(info->version) ); - size+=size_of_relative_string( &(info->name) ); - size+=size_of_relative_string( &(info->architecture) ); - size+=size_of_relative_string( &(info->driverpath) ); - size+=size_of_relative_string( &(info->datafile) ); - size+=size_of_relative_string( &(info->configfile) ); - size+=size_of_relative_string( &(info->helpfile) ); - size+=size_of_relative_string( &(info->monitorname) ); - size+=size_of_relative_string( &(info->defaultdatatype) ); + size+=size_of_uint32( &info->version ); + size+=size_of_relative_string( &info->name ); + size+=size_of_relative_string( &info->architecture ); + size+=size_of_relative_string( &info->driverpath ); + size+=size_of_relative_string( &info->datafile ); + size+=size_of_relative_string( &info->configfile ); + size+=size_of_relative_string( &info->helpfile ); + size+=size_of_relative_string( &info->monitorname ); + size+=size_of_relative_string( &info->defaultdatatype ); string=info->dependentfiles; - while ( (string)[i]!=0x0000 ) - { - size+=2*(1+ str_len_uni( string[i] ) ); - i++; - } + for (i=0; (string[i]!=0x0000) || (string[i+1]!=0x0000); i++); + + size+=2*i; size+=6; return size; @@ -2298,19 +2317,19 @@ return the size required by a struct in the stream uint32 spoolss_size_job_info_1(JOB_INFO_1 *info) { int size=0; - size+=size_of_uint32( &(info->jobid) ); - size+=size_of_relative_string( &(info->printername) ); - size+=size_of_relative_string( &(info->machinename) ); - size+=size_of_relative_string( &(info->username) ); - size+=size_of_relative_string( &(info->document) ); - size+=size_of_relative_string( &(info->datatype) ); - size+=size_of_relative_string( &(info->text_status) ); - size+=size_of_uint32( &(info->status) ); - size+=size_of_uint32( &(info->priority) ); - size+=size_of_uint32( &(info->position) ); - size+=size_of_uint32( &(info->totalpages) ); - size+=size_of_uint32( &(info->pagesprinted) ); - size+=size_of_systemtime( &(info->submitted) ); + size+=size_of_uint32( &info->jobid ); + size+=size_of_relative_string( &info->printername ); + size+=size_of_relative_string( &info->machinename ); + size+=size_of_relative_string( &info->username ); + size+=size_of_relative_string( &info->document ); + size+=size_of_relative_string( &info->datatype ); + size+=size_of_relative_string( &info->text_status ); + size+=size_of_uint32( &info->status ); + size+=size_of_uint32( &info->priority ); + size+=size_of_uint32( &info->position ); + size+=size_of_uint32( &info->totalpages ); + size+=size_of_uint32( &info->pagesprinted ); + size+=size_of_systemtime( &info->submitted ); return size; } @@ -2324,29 +2343,29 @@ uint32 spoolss_size_job_info_2(JOB_INFO_2 *info) size+=4; /* size of sec desc ptr */ - size+=size_of_uint32( &(info->jobid) ); - size+=size_of_relative_string( &(info->printername) ); - size+=size_of_relative_string( &(info->machinename) ); - size+=size_of_relative_string( &(info->username) ); - size+=size_of_relative_string( &(info->document) ); - size+=size_of_relative_string( &(info->notifyname) ); - size+=size_of_relative_string( &(info->datatype) ); - size+=size_of_relative_string( &(info->printprocessor) ); - size+=size_of_relative_string( &(info->parameters) ); - size+=size_of_relative_string( &(info->drivername) ); + size+=size_of_uint32( &info->jobid ); + size+=size_of_relative_string( &info->printername ); + size+=size_of_relative_string( &info->machinename ); + size+=size_of_relative_string( &info->username ); + size+=size_of_relative_string( &info->document ); + size+=size_of_relative_string( &info->notifyname ); + size+=size_of_relative_string( &info->datatype ); + size+=size_of_relative_string( &info->printprocessor ); + size+=size_of_relative_string( &info->parameters ); + size+=size_of_relative_string( &info->drivername ); size+=size_of_device_mode( info->devmode ); - size+=size_of_relative_string( &(info->text_status) ); + size+=size_of_relative_string( &info->text_status ); /* SEC_DESC sec_desc;*/ - size+=size_of_uint32( &(info->status) ); - size+=size_of_uint32( &(info->priority) ); - size+=size_of_uint32( &(info->position) ); - size+=size_of_uint32( &(info->starttime) ); - size+=size_of_uint32( &(info->untiltime) ); - size+=size_of_uint32( &(info->totalpages) ); - size+=size_of_uint32( &(info->size) ); - size+=size_of_systemtime( &(info->submitted) ); - size+=size_of_uint32( &(info->timeelapsed) ); - size+=size_of_uint32( &(info->pagesprinted) ); + size+=size_of_uint32( &info->status ); + size+=size_of_uint32( &info->priority ); + size+=size_of_uint32( &info->position ); + size+=size_of_uint32( &info->starttime ); + size+=size_of_uint32( &info->untiltime ); + size+=size_of_uint32( &info->totalpages ); + size+=size_of_uint32( &info->size ); + size+=size_of_systemtime( &info->submitted ); + size+=size_of_uint32( &info->timeelapsed ); + size+=size_of_uint32( &info->pagesprinted ); return size; } @@ -2459,6 +2478,33 @@ uint32 spoolss_size_printmonitor_info_2(PRINTMONITOR_2 *info) return size; } +/******************************************************************* + * init a structure. + ********************************************************************/ +BOOL make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u, + const POLICY_HND *hnd, fstring architecture, + uint32 level, uint32 clientmajor, uint32 clientminor, + NEW_BUFFER *buffer, uint32 offered) +{ + if (q_u == NULL) + { + return False; + } + + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + + init_buf_unistr2(&q_u->architecture, &q_u->architecture_ptr, architecture); + + q_u->level=level; + q_u->clientmajorversion=clientmajor; + q_u->clientminorversion=clientminor; + + q_u->buffer=buffer; + q_u->offered=offered; + + return True; +} + /******************************************************************* * read a structure. * called from spoolss_getprinterdriver2 (srv_spoolss.c) @@ -2669,6 +2715,25 @@ BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps return True; } +/******************************************************************* + * init a structure. + ********************************************************************/ +BOOL make_spoolss_q_getprinter(SPOOL_Q_GETPRINTER *q_u, const POLICY_HND *hnd, uint32 level, + NEW_BUFFER *buffer, uint32 offered) +{ + if (q_u == NULL) + { + return False; + } + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + + q_u->level=level; + q_u->buffer=buffer; + q_u->offered=offered; + + return True; +} + /******************************************************************* ********************************************************************/ BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth) -- cgit From 772ab755cdbc9135040e5a8343e5de31d0797044 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 30 Mar 2000 06:42:34 +0000 Subject: Fixed spelling of Andrew's name. (-: (This used to be commit b912fb7dd239ce18a9b2e4ffaf1785d32899dc9f) --- source3/rpc_parse/parse_creds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c index ba45fa163a..46fdc5b78f 100644 --- a/source3/rpc_parse/parse_creds.c +++ b/source3/rpc_parse/parse_creds.c @@ -2,7 +2,7 @@ * Unix SMB/Netbios implementation. * Version 1.9. * RPC Pipe client / server routines - * Copyright (C) Andrew Tgrpsgell 1992-1999, + * Copyright (C) Andrew Tridgell 1992-1999, * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, * Copyright (C) Paul Ashton 1997-1999. * -- cgit From dc2d1544b3718dce5b3d7d91989b3cc5abfdef6b Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Wed, 5 Apr 2000 10:05:32 +0000 Subject: changed all the status code to ERROR_xxx instead of NT_STATUS_xx which are wrong in the spoolss case. fxed a bug in the job notify code (that's the polite answer), the truth is different: there is a bug in the NT spooler service, including SP6a and NT2K. changed the default lpcommand in the LPRNG case. J.F. (This used to be commit 396f73c11b29a47650b3243fef0825252a3cef9b) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 0450ebd243..18e736e9af 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -379,7 +379,7 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, uint32 x; BOOL isvalue; - prs_debug(ps, depth, desc, "smb_io_notify_info_data"); + prs_debug(ps, depth, desc, "smb_io_notify_info_data_strings"); depth++; if(!prs_align(ps)) -- cgit From 974cf7d7c9d82a85a5006f3b688198ae02f91e90 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Wed, 5 Apr 2000 17:53:45 +0000 Subject: off by one error ... J.F. (This used to be commit cef44398f90f670358f2ad430056371d394c7f91) --- source3/rpc_parse/parse_spoolss.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 18e736e9af..fd053dbf45 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2305,8 +2305,11 @@ uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) for (i=0; (string[i]!=0x0000) || (string[i+1]!=0x0000); i++); - size+=2*i; - size+=6; + i=i+2; /* to count all chars including the leading zero */ + i=2*i; /* because we need the value in bytes */ + i=i+4; /* the offset pointer size */ + + size+=i; return size; } -- cgit From aac823aca154c46264dd29510c89b8eafac361c8 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 6 Apr 2000 22:48:53 +0000 Subject: Modified interfaces and added checks around *all* *alloc calls so that errors are returned on memory allocation failure. Jeremy. (This used to be commit 9a118cd4a2b03146b341eeffb62144a2d29b574c) --- source3/rpc_parse/parse_spoolss.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index fd053dbf45..6c62b66277 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -264,7 +264,8 @@ static BOOL smb_io_notify_option_type_ctr(char *desc, SPOOL_NOTIFY_OPTION_TYPE_C /* reading */ if (UNMARSHALLING(ps)) - ctr->type=(SPOOL_NOTIFY_OPTION_TYPE *)malloc(ctr->count*sizeof(SPOOL_NOTIFY_OPTION_TYPE)); + if((ctr->type=(SPOOL_NOTIFY_OPTION_TYPE *)malloc(ctr->count*sizeof(SPOOL_NOTIFY_OPTION_TYPE))) == NULL) + return False; /* the option type struct */ for(i=0;icount;i++) @@ -1133,7 +1134,8 @@ BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, in if (q_u->option_ptr!=0) { if (UNMARSHALLING(ps)) - q_u->option=(SPOOL_NOTIFY_OPTION *)malloc(sizeof(SPOOL_NOTIFY_OPTION)); + if((q_u->option=(SPOOL_NOTIFY_OPTION *)malloc(sizeof(SPOOL_NOTIFY_OPTION))) == NULL) + return False; if(!smb_io_notify_option("notify option", q_u->option, ps, depth)) return False; @@ -1181,7 +1183,8 @@ BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, in if (q_u->option_ptr!=0) { if (UNMARSHALLING(ps)) - q_u->option=(SPOOL_NOTIFY_OPTION *)malloc(sizeof(SPOOL_NOTIFY_OPTION)); + if((q_u->option=(SPOOL_NOTIFY_OPTION *)malloc(sizeof(SPOOL_NOTIFY_OPTION))) == NULL) + return False; if(!smb_io_notify_option("notify option", q_u->option, ps, depth)) return False; @@ -1421,7 +1424,8 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui return False; l_chaine=str_len_uni(&chaine); - chaine2=(uint16 *)Realloc(chaine2, (l_chaine2+l_chaine+1)*sizeof(uint16)); + if((chaine2=(uint16 *)Realloc(chaine2, (l_chaine2+l_chaine+1)*sizeof(uint16))) == NULL) + return False; memcpy(chaine2+l_chaine2, chaine.buffer, (l_chaine+1)*sizeof(uint16)); l_chaine2+=l_chaine+1; @@ -1475,7 +1479,8 @@ static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEV prs_set_offset(ps, buffer->string_at_end + buffer->struct_start); /* read the string */ - *devmode=(DEVICEMODE *)malloc(sizeof(DEVICEMODE)); + if((*devmode=(DEVICEMODE *)malloc(sizeof(DEVICEMODE))) == NULL) + return False; if (!spoolss_io_devmode(desc, ps, depth, *devmode)) return False; @@ -1976,16 +1981,21 @@ void new_spoolss_move_buffer(NEW_BUFFER *src, NEW_BUFFER **dest) /******************************************************************* create a BUFFER struct. ********************************************************************/ -void new_spoolss_allocate_buffer(NEW_BUFFER **buffer) +BOOL new_spoolss_allocate_buffer(NEW_BUFFER **buffer) { if (buffer==NULL) - return; + return False; - *buffer=(NEW_BUFFER *)malloc(sizeof(NEW_BUFFER)); + if((*buffer=(NEW_BUFFER *)malloc(sizeof(NEW_BUFFER))) == NULL) { + DEBUG(0,("new_spoolss_allocate_buffer: malloc fail for size %u.\n", + (unsigned int)sizeof(NEW_BUFFER) )); + return False; + } (*buffer)->ptr=0x0; (*buffer)->size=0; (*buffer)->string_at_end=0; + return True; } /******************************************************************* -- cgit From a130656fc090777ad8daec154bdfe1a0a84eef92 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 13 Apr 2000 18:38:00 +0000 Subject: rpc_parse/parse_rpc.c: Changes from TNG (thanks Luke) for NTLMSSP parsing. smbd/reply.c: Fixed typo in debug. Jeremy. (This used to be commit c2aa6d66b3ca2a1a6dde8e9a1f6e761d98be517a) --- source3/rpc_parse/parse_rpc.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 90200312bd..8d39b6e7c0 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -692,6 +692,7 @@ void init_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) { + uint32 start_offset = prs_offset(ps); if (neg == NULL) return False; @@ -718,8 +719,7 @@ BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru old_offset = prs_offset(ps); - /* lkclXXXX HACK! */ - if(!prs_set_offset(ps, neg->hdr_myname.buffer + 0x50)) + if(!prs_set_offset(ps, neg->hdr_myname.buffer + start_offset - 12)) return False; if(!prs_uint8s(True, "myname", ps, depth, (uint8*)neg->myname, @@ -728,8 +728,7 @@ BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru old_offset += neg->hdr_myname.str_str_len; - /* lkclXXXX HACK! */ - if(!prs_set_offset(ps, neg->hdr_domain.buffer + 0x50)) + if(!prs_set_offset(ps, neg->hdr_domain.buffer + start_offset - 12)) return False; if(!prs_uint8s(True, "domain", ps, depth, (uint8*)neg->domain, @@ -915,7 +914,7 @@ BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st old_offset = prs_offset(ps); - if(!prs_set_offset(ps, rsp->hdr_domain.buffer + 0x1c)) + if(!prs_set_offset(ps, rsp->hdr_domain.buffer + 0xc)) return False; if(!prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain, @@ -924,7 +923,7 @@ BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st old_offset += rsp->hdr_domain.str_str_len; - if(!prs_set_offset(ps, rsp->hdr_usr.buffer + 0x1c)) + if(!prs_set_offset(ps, rsp->hdr_usr.buffer + 0xc)) return False; if(!prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user, @@ -933,7 +932,7 @@ BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st old_offset += rsp->hdr_usr.str_str_len; - if(!prs_set_offset(ps, rsp->hdr_wks.buffer + 0x1c)) + if(!prs_set_offset(ps, rsp->hdr_wks.buffer + 0xc)) return False; if(!prs_uint8s(True, "wks ", ps, depth, (uint8*)rsp->wks, @@ -942,7 +941,7 @@ BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st old_offset += rsp->hdr_wks.str_str_len; - if(!prs_set_offset(ps, rsp->hdr_lm_resp.buffer + 0x1c)) + if(!prs_set_offset(ps, rsp->hdr_lm_resp.buffer + 0xc)) return False; if(!prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp, @@ -951,7 +950,7 @@ BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st old_offset += rsp->hdr_lm_resp.str_str_len; - if(!prs_set_offset(ps, rsp->hdr_nt_resp.buffer + 0x1c)) + if(!prs_set_offset(ps, rsp->hdr_nt_resp.buffer + 0xc)) return False; if(!prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp, @@ -962,7 +961,7 @@ BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st if (rsp->hdr_sess_key.str_str_len != 0) { - if(!prs_set_offset(ps, rsp->hdr_sess_key.buffer + 0x1c)) + if(!prs_set_offset(ps, rsp->hdr_sess_key.buffer + 0x10)) return False; old_offset += rsp->hdr_sess_key.str_str_len; -- cgit From 00e3fe132476fcaed0f4b9bbe74b0a6559c39df0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 25 Apr 2000 14:06:57 +0000 Subject: moved trans2.h and nterr.h into includes.h with all our other includes (This used to be commit d7cd7c88fdabb01d9e40ae8a657737907a21ac37) --- source3/rpc_parse/parse_lsa.c | 1 - source3/rpc_parse/parse_net.c | 1 - source3/rpc_parse/parse_spoolss.c | 1 - 3 files changed, 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 771e7c31d4..a8023bc640 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -22,7 +22,6 @@ */ #include "includes.h" -#include "nterr.h" extern int DEBUGLEVEL; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 9588d1c53b..002d7e56aa 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -22,7 +22,6 @@ */ #include "includes.h" -#include "nterr.h" extern int DEBUGLEVEL; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 6c62b66277..5f1f10521f 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -23,7 +23,6 @@ #include "includes.h" -#include "nterr.h" #ifdef TNG #define prs_uint16 _prs_uint16 -- cgit From b39cee0bb9de856f8e4fa1f8a227ff885a5c56ff Mon Sep 17 00:00:00 2001 From: Shirish Kalele Date: Fri, 28 Apr 2000 18:36:47 +0000 Subject: Added info level 1005 to netsharegetinfo (is the share a DFS root) Added dfs_server announcement in set_default_server_announce_type() (This used to be commit 99d07e13520b04d99999938d259d56fa65c8a8ea) --- source3/rpc_parse/parse_srv.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 8997b05e0b..6eeae80cfc 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -201,6 +201,27 @@ static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int d return True; } +/******************************************************************* + Reads or writes a structure. +********************************************************************/ +static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005, + prs_struct* ps, int depth) +{ + if(sh1005 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1005"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("dfs_root_flag", ps, depth, &sh1005->dfs_root_flag)) + return False; + + return True; +} + /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -527,8 +548,12 @@ BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_ return False; break; + case 1005: + if(!srv_io_share_info1005("", &r_n->share.info1005, + ps, depth)) + return False; default: - DEBUG(5,("%s no share info at switch_value %d\n", + DEBUG(5,("%s no share info at switch_value %d\n", tab_depth(depth), r_n->switch_value)); break; } -- cgit From 59fa2dbe2cb18762e14a86045c7ad403205a3841 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 2 May 2000 15:31:55 +0000 Subject: added support for deleting printers into the spoolss system (This used to be commit e72a5718537b84409fc20ff21951b1d1ab24d97f) --- source3/rpc_parse/parse_spoolss.c | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 5f1f10521f..c5aba9aba7 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -864,6 +864,49 @@ BOOL make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER *q_u, POLICY_HND *hnd) return True; } +/******************************************************************* + * read a structure. + * called from static spoolss_q_deleteprinter (srv_spoolss.c) + * called from spoolss_deleteprinter (cli_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_q_deleteprinter(char *desc, SPOOL_Q_DELETEPRINTER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_deleteprinter"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) + return False; + + return True; +} + +/******************************************************************* + * write a structure. + * called from static spoolss_r_deleteprinter (srv_spoolss.c) + * called from spoolss_deleteprinter (cli_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_r_deleteprinter(char *desc, SPOOL_R_DELETEPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinter"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!smb_io_pol_hnd("printer handle",&r_u->handle,ps,depth)) + return False; + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; +} + + /******************************************************************* * read a structure. * called from static spoolss_q_closeprinter (srv_spoolss.c) -- cgit From 99352a098656ac9d3886d047ff273a6880990d2f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 3 May 2000 02:24:01 +0000 Subject: Insure uninitialized memory read fixes. Jeremy. (This used to be commit 577ddbfbec857dec3ade811f735ec6b183566435) --- source3/rpc_parse/parse_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 002d7e56aa..912e18600e 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -635,7 +635,7 @@ static int init_dom_sid2s(char *sids_str, DOM_SID2 *sids, int max_sids) void init_id_info1(NET_ID_INFO_1 *id, char *domain_name, uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, char *user_name, char *wksta_name, - char sess_key[16], + char *sess_key, unsigned char lm_cypher[16], unsigned char nt_cypher[16]) { int len_domain_name = strlen(domain_name); @@ -994,7 +994,7 @@ void init_net_user_info3(NET_USER_INFO_3 *usr, DOM_GID *gids, uint32 user_flgs, - char sess_key[16], + char *sess_key, char *logon_srv, char *logon_dom, -- cgit From c23e01d049cc7aee34e8ac83efeb74c09aa257a2 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 9 May 2000 13:28:19 +0000 Subject: the beginnings of a new scheme I've working on to allow an easier head/tng merge. It goes something like this: - headers from tng get copied over one at a time - the old headers get renamed to *_old.h - server side code that used the old headers gets a #define OLD_NTDOMAIN 1 #undef OLD_NTDOMAIN at the start and end of the code - mkproto.awk recognises these special defines and does magic stuff so that each .c file sees the right headers - we start moving the rpc client libraries from tng to head. if this goes OK then, in theory, we should be able to move the client side rpc code from tng to head without disturbing the existing head server side code. Then when that works we can consider merging the server side. it remains to be seen if this scheme will work. So far I've moved rpc_samr.h and don't seem to have broken anything. Note this this is still a very delicate operation, as at every step of the way I want to keep head fully functional. Please don't take part unless you discuss it with me first. (This used to be commit f76c037255a6a79d11bec65e863e009a41a4f0fd) --- source3/rpc_parse/parse_samr.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 2327ee7798..1c344c9d30 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1,3 +1,5 @@ +#define OLD_NTDOMAIN 1 + /* * Unix SMB/Netbios implementation. * Version 1.9. @@ -3606,3 +3608,7 @@ BOOL samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER *r_u, prs_struct return True; } + + +#undef OLD_NTDOMAIN + -- cgit From ddc9b8b40642c90fe7c34b088eae4f8075f4033a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 10 May 2000 09:49:55 +0000 Subject: more merging it is now at the stage that winbindd can compile in the head branch, but not link (This used to be commit d178c00aae77710ae6ff20a7f54a30e3bd8232bb) --- source3/rpc_parse/parse_sec.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 541949e51e..5d4b56d745 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -137,13 +137,13 @@ SEC_ACL *make_sec_acl(uint16 revision, int num_aces, SEC_ACE *ace_list) dst->num_aces = num_aces; dst->size = 8; - if((dst->ace_list = (SEC_ACE *)malloc( sizeof(SEC_ACE) * num_aces )) == NULL) { + if((dst->ace = (SEC_ACE *)malloc( sizeof(SEC_ACE) * num_aces )) == NULL) { free_sec_acl(&dst); return NULL; } for (i = 0; i < num_aces; i++) { - dst->ace_list[i] = ace_list[i]; /* Structure copy. */ + dst->ace[i] = ace_list[i]; /* Structure copy. */ dst->size += ace_list[i].size; } @@ -159,7 +159,7 @@ SEC_ACL *dup_sec_acl( SEC_ACL *src) if(src == NULL) return NULL; - return make_sec_acl( src->revision, src->num_aces, src->ace_list); + return make_sec_acl( src->revision, src->num_aces, src->ace); } /******************************************************************* @@ -174,8 +174,8 @@ void free_sec_acl(SEC_ACL **ppsa) return; psa = *ppsa; - if (psa->ace_list != NULL) - free(psa->ace_list); + if (psa->ace != NULL) + free(psa->ace); free(psa); *ppsa = NULL; @@ -229,15 +229,15 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) if (UNMARSHALLING(ps) && psa->num_aces != 0) { /* reading */ - if((psa->ace_list = malloc(sizeof(psa->ace_list[0]) * psa->num_aces)) == NULL) + if((psa->ace = malloc(sizeof(psa->ace[0]) * psa->num_aces)) == NULL) return False; - ZERO_STRUCTP(psa->ace_list); + ZERO_STRUCTP(psa->ace); } for (i = 0; i < psa->num_aces; i++) { fstring tmp; slprintf(tmp, sizeof(tmp)-1, "ace_list[%02d]: ", i); - if(!sec_io_ace(tmp, &psa->ace_list[i], ps, depth)) + if(!sec_io_ace(tmp, &psa->ace[i], ps, depth)) return False; } -- cgit From 0806cf75ff96dee6715610bd61e21cde08fa1c61 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 12 May 2000 14:28:46 +0000 Subject: added spool_io_printer_driver_info_level_6() thsi function and the associated header structure were autogenerated using a little awk based code geerator I wroe ths evening. I'll commit that next ... (This used to be commit 974813f0d4afb6c14ed27c48ab24b19932557f9f) --- source3/rpc_parse/parse_misc.c | 12 +++ source3/rpc_parse/parse_prs.c | 20 +++- source3/rpc_parse/parse_spoolss.c | 193 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 224 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index d19fe47a0d..b12688d362 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1380,3 +1380,15 @@ BOOL smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth) return True; } + + +/******************************************************************* + Stream a uint64_struct + ********************************************************************/ +BOOL prs_uint64(char *name, prs_struct *ps, int depth, UINT64_S *data64) +{ + return prs_uint32(name, ps, depth+1, &data64->low) && + prs_uint32(name, ps, depth+1, &data64->high); +} + + diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 64c1590b7d..2edd080a0e 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -26,6 +26,25 @@ extern int DEBUGLEVEL; #include "includes.h" +/******************************************************************* +dump a prs to a file + ********************************************************************/ +void prs_dump(char *name, int level, prs_struct *ps) +{ + int fd; + pstring fname; + if (DEBUGLEVEL < 50) return; + slprintf(fname,sizeof(fname), "/tmp/%s_%d.prs", name, level); + fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0644); + if (fd != -1) { + write(fd, ps->data_p + ps->data_offset, ps->buffer_size - ps->data_offset); + close(fd); + DEBUG(0,("created %s\n", fname)); + } +} + + + /******************************************************************* debug output for parsing info. @@ -428,7 +447,6 @@ BOOL prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) return True; } - /****************************************************************** Stream an array of uint8s. Length is number of uint8s. ********************************************************************/ diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index c5aba9aba7..62dbc16277 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3574,6 +3574,146 @@ BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_ } +/******************************************************************* +parse a SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure +********************************************************************/ +BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u, + prs_struct *ps, int depth) +{ + SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *il; + + prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level_6"); + depth++; + + /* reading */ + if (UNMARSHALLING(ps)) { + il=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *)malloc(sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6)); + if(il == NULL) + return False; + ZERO_STRUCTP(il); + *q_u=il; + } + else { + il=*q_u; + } + + if(!prs_align(ps)) + return False; + + + /* parse the main elements the packet */ + + if(!prs_uint32("dummy1", ps, depth, &il->dummy1)) + return False; + if(!prs_uint32("version", ps, depth, &il->version)) + return False; + if(!prs_uint32("name_ptr", ps, depth, &il->name_ptr)) + return False; + if(!prs_uint32("environment_ptr", ps, depth, &il->environment_ptr)) + return False; + if(!prs_uint32("driverpath_ptr", ps, depth, &il->driverpath_ptr)) + return False; + if(!prs_uint32("datafile_ptr", ps, depth, &il->datafile_ptr)) + return False; + if(!prs_uint32("configfile_ptr", ps, depth, &il->configfile_ptr)) + return False; + if(!prs_uint32("helpfile_ptr", ps, depth, &il->helpfile_ptr)) + return False; + if(!prs_uint32("monitorname_ptr", ps, depth, &il->monitorname_ptr)) + return False; + if(!prs_uint32("defaultdatatype_ptr", ps, depth, &il->defaultdatatype_ptr)) + return False; + if(!prs_uint32("dependentfiles_len", ps, depth, &il->dependentfiles_len)) + return False; + if(!prs_uint32("dependentfiles_ptr", ps, depth, &il->dependentfiles_ptr)) + return False; + if(!prs_uint32("previousnames_len", ps, depth, &il->previousnames_len)) + return False; + if(!prs_uint32("previousnames_ptr", ps, depth, &il->previousnames_ptr)) + return False; + if(!smb_io_time("driverdate", &il->driverdate, ps, depth)) + return False; + if(!prs_uint64("driverversion", ps, depth, &il->driverversion)) + return False; + if(!prs_uint32("dummy4", ps, depth, &il->dummy4)) + return False; + if(!prs_uint32("mfgname_ptr", ps, depth, &il->mfgname_ptr)) + return False; + if(!prs_uint32("oemurl_ptr", ps, depth, &il->oemurl_ptr)) + return False; + if(!prs_uint32("hardwareid_ptr", ps, depth, &il->hardwareid_ptr)) + return False; + if(!prs_uint32("provider_ptr", ps, depth, &il->provider_ptr)) + return False; + + /* parse the structures in the packet */ + + if(!smb_io_unistr2("name", &il->name, il->name_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("environment", &il->environment, il->environment_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("driverpath", &il->driverpath, il->driverpath_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("datafile", &il->datafile, il->datafile_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("configfile", &il->configfile, il->configfile_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("helpfile", &il->helpfile, il->helpfile_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("monitorname", &il->monitorname, il->monitorname_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("defaultdatatype", &il->defaultdatatype, il->defaultdatatype_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if (il->dependentfiles_ptr) { + if(!smb_io_buffer5("dependentfiles", &il->dependentfiles, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + } + if (il->previousnames_ptr) { + if(!smb_io_buffer5("previousnames", &il->previousnames, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + } + if(!smb_io_unistr2("mfgname", &il->mfgname, il->mfgname_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("oemurl", &il->oemurl, il->oemurl_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("hardwareid", &il->hardwareid, il->hardwareid_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("provider", &il->provider, il->provider_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + + return True; +} + + /******************************************************************* convert a buffer of UNICODE strings null terminated the buffer is terminated by a NULL @@ -3680,6 +3820,13 @@ BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LE if(!spool_io_printer_driver_info_level_3("", &(il->info_3), ps, depth)) return False; break; + case 6: + if(!spool_io_printer_driver_info_level_6("", &(il->info_6), ps, depth)) + return False; + break; + default: + prs_dump("spool_io_printer_driver_info_level", il->level, ps); + return False; } return True; @@ -3770,6 +3917,52 @@ BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, return True; } +/******************************************************************* +********************************************************************/ +BOOL uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni, + NT_PRINTER_DRIVER_INFO_LEVEL_6 **asc) +{ + NT_PRINTER_DRIVER_INFO_LEVEL_6 *d; + + DEBUG(7,("uni_2_asc_printer_driver_6: Converting from UNICODE to ASCII\n")); + + if (*asc==NULL) + { + *asc=(NT_PRINTER_DRIVER_INFO_LEVEL_6 *)malloc(sizeof(NT_PRINTER_DRIVER_INFO_LEVEL_6)); + if(*asc == NULL) + return False; + ZERO_STRUCTP(*asc); + } + + d=*asc; + + d->version=uni->version; + + unistr2_to_ascii(d->name, &(uni->name), sizeof(d->name)-1); + unistr2_to_ascii(d->environment, &(uni->environment), sizeof(d->environment)-1); + unistr2_to_ascii(d->driverpath, &(uni->driverpath), sizeof(d->driverpath)-1); + unistr2_to_ascii(d->datafile, &(uni->datafile), sizeof(d->datafile)-1); + unistr2_to_ascii(d->configfile, &(uni->configfile), sizeof(d->configfile)-1); + unistr2_to_ascii(d->helpfile, &(uni->helpfile), sizeof(d->helpfile)-1); + unistr2_to_ascii(d->monitorname, &(uni->monitorname), sizeof(d->monitorname)-1); + unistr2_to_ascii(d->defaultdatatype, &(uni->defaultdatatype), sizeof(d->defaultdatatype)-1); + + DEBUGADD(8,( "version: %d\n", d->version)); + DEBUGADD(8,( "name: %s\n", d->name)); + DEBUGADD(8,( "environment: %s\n", d->environment)); + DEBUGADD(8,( "driverpath: %s\n", d->driverpath)); + DEBUGADD(8,( "datafile: %s\n", d->datafile)); + DEBUGADD(8,( "configfile: %s\n", d->configfile)); + DEBUGADD(8,( "helpfile: %s\n", d->helpfile)); + DEBUGADD(8,( "monitorname: %s\n", d->monitorname)); + DEBUGADD(8,( "defaultdatatype: %s\n", d->defaultdatatype)); + + uniarray_2_ascarray(&(uni->dependentfiles), &(d->dependentfiles) ); + uniarray_2_ascarray(&(uni->previousnames), &(d->previousnames) ); + + return True; +} + BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, NT_PRINTER_INFO_LEVEL_2 **asc) { -- cgit From fa659fea9b0b71bf62de9dfec61160196c828da1 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 12 May 2000 14:28:48 +0000 Subject: Added unicode_to_dos_char() function to address converting single UNICODE characters to one or more DOS codepage characters. Jeremy. (This used to be commit eefbfb5e16fcf40f335edc840a49f837f6b64111) --- source3/rpc_parse/parse_spoolss.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 62dbc16277..987ae42ff4 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3718,12 +3718,12 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ convert a buffer of UNICODE strings null terminated the buffer is terminated by a NULL - convert to an ascii array (null terminated) + convert to an dos codepage array (null terminated) dynamically allocate memory ********************************************************************/ -BOOL uniarray_2_ascarray(BUFFER5 *buf5, char ***ar) +static BOOL uniarray_2_dosarray(BUFFER5 *buf5, char ***ar) { char **array; char *string; @@ -3750,7 +3750,7 @@ BOOL uniarray_2_ascarray(BUFFER5 *buf5, char ***ar) while (dest < destend) { - *(dest++) = (char)*(src++); + dest += unicode_to_dos_char(dest, (smb_ucs2_t)*(src++)); } /* that ugly for the first one but that's working */ @@ -3912,7 +3912,7 @@ BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, DEBUGADD(8,( "monitorname: %s\n", d->monitorname)); DEBUGADD(8,( "defaultdatatype: %s\n", d->defaultdatatype)); - uniarray_2_ascarray(&(uni->dependentfiles), &(d->dependentfiles) ); + uniarray_2_dosarray(&(uni->dependentfiles), &(d->dependentfiles) ); return True; } -- cgit From b3373e99326cbb9147eb36f839e8b3fa9be43a29 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 12 May 2000 14:28:50 +0000 Subject: changed uniarray_2_ascarray to uniarray_2_dosarray (This used to be commit 4de7202da478baf232c93cc9b8d845889f1d2bab) --- source3/rpc_parse/parse_spoolss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 987ae42ff4..270ce0ff8d 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3957,8 +3957,8 @@ BOOL uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni, DEBUGADD(8,( "monitorname: %s\n", d->monitorname)); DEBUGADD(8,( "defaultdatatype: %s\n", d->defaultdatatype)); - uniarray_2_ascarray(&(uni->dependentfiles), &(d->dependentfiles) ); - uniarray_2_ascarray(&(uni->previousnames), &(d->previousnames) ); + uniarray_2_dosarray(&(uni->dependentfiles), &(d->dependentfiles) ); + uniarray_2_dosarray(&(uni->previousnames), &(d->previousnames) ); return True; } -- cgit From 414caf80a2705c5953af03db736a0d9774fab9fc Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 15 May 2000 07:17:34 +0000 Subject: make prs_dump() store up to 100 variants of each msg type (This used to be commit 0e7819bb4562a840ecb9b7ef12706572b6b60202) --- source3/rpc_parse/parse_prs.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 2edd080a0e..efcd16470a 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -29,13 +29,20 @@ extern int DEBUGLEVEL; /******************************************************************* dump a prs to a file ********************************************************************/ -void prs_dump(char *name, int level, prs_struct *ps) +void prs_dump(char *name, int v, prs_struct *ps) { - int fd; + int fd, i; pstring fname; if (DEBUGLEVEL < 50) return; - slprintf(fname,sizeof(fname), "/tmp/%s_%d.prs", name, level); - fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0644); + for (i=1;i<100;i++) { + if (v != -1) { + slprintf(fname,sizeof(fname), "/tmp/%s_%d.%d.prs", name, v, i); + } else { + slprintf(fname,sizeof(fname), "/tmp/%s.%d.prs", name, i); + } + fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0644); + if (fd != -1 || errno != EEXIST) break; + } if (fd != -1) { write(fd, ps->data_p + ps->data_offset, ps->buffer_size - ps->data_offset); close(fd); -- cgit From bb01686063812c5cdb206d19dd71bc082008d4ac Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 15 May 2000 09:58:58 +0000 Subject: update grow_size in prs_grow (This used to be commit a42da205361bb70778913c8bd9facbb6b9a24937) --- source3/rpc_parse/parse_prs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index efcd16470a..fff1bc27b1 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -44,7 +44,7 @@ void prs_dump(char *name, int v, prs_struct *ps) if (fd != -1 || errno != EEXIST) break; } if (fd != -1) { - write(fd, ps->data_p + ps->data_offset, ps->buffer_size - ps->data_offset); + write(fd, ps->data_p + ps->data_offset, ps->grow_size - ps->data_offset); close(fd); DEBUG(0,("created %s\n", fname)); } @@ -163,6 +163,8 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) uint32 new_size; char *new_data; + ps->grow_size = MAX(ps->grow_size, ps->data_offset + extra_space); + if(ps->data_offset + extra_space <= ps->buffer_size) return True; -- cgit From b599ae9e4020807ec3bbfb8a3c1995a87ef168cf Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 15 May 2000 09:59:25 +0000 Subject: don't call prs_dump() here (This used to be commit 87d9bac3a1b9eba15259abdfea85cf94b3630561) --- source3/rpc_parse/parse_spoolss.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 270ce0ff8d..6bac725658 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3825,7 +3825,6 @@ BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LE return False; break; default: - prs_dump("spool_io_printer_driver_info_level", il->level, ps); return False; } -- cgit From ad9a3a16e000e25693508e0b2eac280f7593d095 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 15 May 2000 20:53:08 +0000 Subject: Added Shirish's reg changes to HEAD. Sync up with 2.2.0 backport. Also added prs_xx error return checks to new code in rpc_parse/parse_reg.c Jeremy. (This used to be commit a148cb996297ed34342660f82ef0e66773d40500) --- source3/rpc_parse/parse_reg.c | 157 ++++++++++++++++++++++-------------------- 1 file changed, 81 insertions(+), 76 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index cc970e4150..e757245f7c 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -868,29 +868,33 @@ BOOL reg_io_r_get_key_sec(char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, i makes a structure. ********************************************************************/ -void init_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char *product_type, - time_t unix_time, uint8 major, uint8 minor) +BOOL init_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char* val_name) { - int len_type = strlen(product_type); + int len_type = val_name != NULL ? strlen(val_name) + 1 : 0; - memcpy(&q_i->pol, pol, sizeof(q_i->pol)); + if (q_i == NULL) + return False; - init_uni_hdr(&q_i->hdr_type, len_type); - init_unistr2(&q_i->uni_type, product_type, len_type); + q_i->pol = *pol; - q_i->ptr1 = 1; - unix_to_nt_time(&q_i->time, unix_time); - q_i->major_version1 = major; - q_i->minor_version1 = minor; - memset(q_i->pad1, 0, sizeof(q_i->pad1)); + init_uni_hdr(&(q_i->hdr_type), len_type); + init_unistr2(&(q_i->uni_type), val_name, len_type); - q_i->ptr2 = 1; - q_i->major_version2 = major; - q_i->minor_version2 = minor; - memset(q_i->pad2, 0, sizeof(q_i->pad2)); + q_i->ptr_reserved = 1; + q_i->ptr_buf = 1; - q_i->ptr3 = 1; - q_i->unknown = 0x00000000; + q_i->ptr_bufsize = 1; + q_i->bufsize = 0; + q_i->buf_unk = 0; + + q_i->unk1 = 0; + q_i->ptr_buflen = 1; + q_i->buflen = 0; + + q_i->ptr_buflen2 = 1; + q_i->buflen2 = 0; + + return True; } /******************************************************************* @@ -918,68 +922,66 @@ BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) if(!prs_align(ps)) return False; - if(!prs_uint32("ptr1", ps, depth, &r_q->ptr1)) + if(!prs_uint32("ptr_reserved", ps, depth, &(r_q->ptr_reserved))) return False; - if (r_q->ptr1 != 0) { - if(!smb_io_time("", &r_q->time, ps, depth)) - return False; - if(!prs_uint8 ("major_version1", ps, depth, &r_q->major_version1)) - return False; - if(!prs_uint8 ("minor_version1", ps, depth, &r_q->minor_version1)) - return False; - if(!prs_uint8s(False, "pad1", ps, depth, r_q->pad1, sizeof(r_q->pad1))) - return False; - } - - if(!prs_uint32("ptr2", ps, depth, &r_q->ptr2)) + if(!prs_uint32("ptr_buf", ps, depth, &(r_q->ptr_buf))) return False; - if (r_q->ptr2 != 0) { - if(!prs_uint8 ("major_version2", ps, depth, &r_q->major_version2)) + if(r_q->ptr_buf) { + if(!prs_uint32("ptr_bufsize", ps, depth, &(r_q->ptr_bufsize))) return False; - if(!prs_uint8 ("minor_version2", ps, depth, &r_q->minor_version2)) + if(!prs_uint32("bufsize", ps, depth, &(r_q->bufsize))) return False; - if(!prs_uint8s(False, "pad2", ps, depth, r_q->pad2, sizeof(r_q->pad2))) + if(!prs_uint32("buf_unk", ps, depth, &(r_q->buf_unk))) return False; } - if(!prs_uint32("ptr3", ps, depth, &r_q->ptr3)) + if(!prs_uint32("unk1", ps, depth, &(r_q->unk1))) return False; - if (r_q->ptr3 != 0) { - if(!prs_uint32("unknown", ps, depth, &r_q->unknown)) - return False; - } + if(!prs_uint32("ptr_buflen", ps, depth, &(r_q->ptr_buflen))) + return False; + if(!prs_uint32("buflen", ps, depth, &(r_q->buflen))) + return False; - return True; + if(!prs_uint32("ptr_buflen2", ps, depth, &(r_q->ptr_buflen2))) + return False; + if(!prs_uint32("buflen2", ps, depth, &(r_q->buflen2))) + return False; + + return True; } /******************************************************************* Inits a structure. ********************************************************************/ -void init_reg_r_info(REG_R_INFO *r_r, - uint32 level, char *os_type, - uint32 unknown_0, uint32 unknown_1, - uint32 status) +BOOL init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r, + BUFFER2* buf, uint32 type, uint32 status) { - uint8 buf[512]; - int len = dos_struni2((char *)buf, os_type, sizeof(buf)); + if(r_r == NULL) + return False; - r_r->ptr1 = 1; - r_r->level = level; + + r_r->ptr_type = 1; + r_r->type = type; - r_r->ptr_type = 1; - init_buffer2(&r_r->uni_type, buf, len*2); + /* if include_keyval is not set, don't send the key value, just + the buflen data. probably used by NT5 to allocate buffer space - SK */ + r_r->ptr_uni_val = include_keyval ? 1:0; + r_r->uni_val = buf; - r_r->ptr2 = 1; - r_r->unknown_0 = unknown_0; + r_r->ptr_max_len = 1; + r_r->buf_max_len = r_r->uni_val->buf_max_len; - r_r->ptr3 = 1; - r_r->unknown_1 = unknown_1; + r_r->ptr_len = 1; + r_r->buf_len = r_r->uni_val->buf_len; - r_r->status = status; + r_r->status = status; + + return True; + } /******************************************************************* @@ -997,41 +999,44 @@ BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) if(!prs_align(ps)) return False; - if(!prs_uint32("ptr1", ps, depth, &r_r->ptr1)) + if(!prs_uint32("ptr_type", ps, depth, &(r_r->ptr_type))) return False; - if (r_r->ptr1 != 0) { - if(!prs_uint32("level", ps, depth, &r_r->level)) - return False; - if(!prs_uint32("ptr_type", ps, depth, &r_r->ptr_type)) + if (r_r->ptr_type != 0) { + if(!prs_uint32("type", ps, depth, &r_r->type)) return False; + } - if(!smb_io_buffer2("uni_type", &r_r->uni_type, r_r->ptr_type, ps, depth)) - return False; - if(!prs_align(ps)) - return False; + if(!prs_uint32("ptr_uni_val", ps, depth, &(r_r->ptr_uni_val))) + return False; - if(!prs_uint32("ptr2", ps, depth, &r_r->ptr2)) + if(r_r->ptr_uni_val != 0) { + if(!smb_io_buffer2("uni_val", r_r->uni_val, r_r->ptr_uni_val, ps, depth)) return False; + } - if (r_r->ptr2 != 0) { - if(!prs_uint32("unknown_0", ps, depth, &r_r->unknown_0)) - return False; - } + if(!prs_align(ps)) + return False; - if(!prs_uint32("ptr3", ps, depth, &r_r->ptr3)) - return False; + if(!prs_uint32("ptr_max_len", ps, depth, &(r_r->ptr_max_len))) + return False; - if (r_r->ptr3 != 0) { - if(!prs_uint32("unknown_1", ps, depth, &r_r->unknown_1)) - return False; - } + if (r_r->ptr_max_len != 0) { + if(!prs_uint32("buf_max_len", ps, depth, &(r_r->buf_max_len))) + return False; + } + if(!prs_uint32("ptr_len", ps, depth, &(r_r->ptr_len))) + return False; + if (r_r->ptr_len != 0) { + if(!prs_uint32("buf_len", ps, depth, &(r_r->buf_len))) + return False; } + if(!prs_uint32("status", ps, depth, &r_r->status)) return False; - return True; + return True; } /******************************************************************* -- cgit From 91b736d2586d1dcfeb3a5ea915608411e5de440f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 16 May 2000 19:45:26 +0000 Subject: Synced up srv_samr with HP changes. Added error checking to original code - what a concept :-). All this code will be replaced with TNG stuff anyway, so not a big deal.... Jeremy. (This used to be commit b090cff4b5fcdef01fc553e6359627bb2285d68e) --- source3/rpc_parse/parse_samr.c | 402 +++++++++++++++++++++++++++++++++-------- 1 file changed, 325 insertions(+), 77 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 1c344c9d30..4a85524263 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1,5 +1,4 @@ #define OLD_NTDOMAIN 1 - /* * Unix SMB/Netbios implementation. * Version 1.9. @@ -1301,9 +1300,8 @@ void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_e, POLICY_HND *pol, q_e->switch_level = switch_level; - q_e->unknown_0 = 0; q_e->start_idx = start_idx; - q_e->unknown_1 = 0x000007d0; + q_e->max_entries = 0; q_e->max_size = size; } @@ -1329,11 +1327,15 @@ BOOL samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO *q_e, prs_struc if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level)) return False; +#if 0 if(!prs_uint16("unknown_0 ", ps, depth, &q_e->unknown_0)) return False; +#else + prs_align(ps); +#endif if(!prs_uint32("start_idx ", ps, depth, &q_e->start_idx)) return False; - if(!prs_uint32("unknown_1 ", ps, depth, &q_e->unknown_1)) + 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; @@ -1446,8 +1448,11 @@ void init_sam_info_1(SAM_INFO_1 *sam, uint32 acb_mask, DEBUG(5,("limiting number of entries to %d\n", num_sam_entries)); } + DEBUG(5,("num_sam_entries: %u, start_idx: %u\n",num_sam_entries, + num_sam_entries)); - for (i = start_idx, entries_added = 0; i < num_sam_entries; i++) { + for (i = 0, entries_added = 0; + i < num_sam_entries; i++) { if (IS_BITS_SET_ALL(pass[i].acb_info, acb_mask)) { init_sam_entry1(&sam->sam[entries_added], start_idx + entries_added + 1, @@ -1462,7 +1467,7 @@ void init_sam_info_1(SAM_INFO_1 *sam, uint32 acb_mask, copy_unistr2(&sam->str[entries_added].uni_acct_desc, &pass[i].uni_acct_desc); entries_added++; - } + } } sam->num_entries = entries_added; @@ -1523,7 +1528,7 @@ void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO *r_u, { DEBUG(5,("init_samr_r_query_dispinfo\n")); - if (status == 0x0) { + if (status == 0x0 || status == 0x105) { r_u->unknown_0 = 0x0000001; r_u->unknown_1 = 0x0000001; } else { @@ -1792,85 +1797,110 @@ BOOL samr_io_q_query_aliasinfo(char *desc, SAMR_Q_QUERY_ALIASINFO *q_e, prs_str Inits a SAMR_R_QUERY_ALIASINFO structure. ********************************************************************/ -void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *r_u, - uint16 switch_value, char *acct_desc, - uint32 status) -{ - DEBUG(5,("init_samr_r_query_aliasinfo\n")); - - r_u->ptr = 0; - - if (status == 0) { - r_u->switch_value = switch_value; - - switch (switch_value) { - case 3: - { - int acct_len = acct_desc ? strlen(acct_desc) : 0; - - r_u->ptr = 1; - - init_uni_hdr(&r_u->alias.info3.hdr_acct_desc, acct_len); - init_unistr2(&r_u->alias.info3.uni_acct_desc, acct_desc, acct_len); - - break; - } - default: - DEBUG(4,("init_samr_r_query_aliasinfo: unsupported switch level\n")); - break; - } +void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *r_u, uint32 switch_level, + char* alias, char* alias_desc) + +{ + int alias_desc_len, alias_len; + + if(r_u == NULL) + return; + + alias_len = alias?strlen(alias):0; + alias_desc_len = alias_desc?strlen(alias_desc):0; + + DEBUG(5,("init_samr_r_query_aliasinfo\n")); + + r_u->switch_value = switch_level; + + if(r_u->status == 0) + { + switch(switch_level) + { + case 1: + { + r_u->ptr = 1; + init_uni_hdr(&r_u->alias.info1.hdr_alias_name, alias_len); + init_unistr2(&r_u->alias.info1.uni_alias_name, alias, alias_len); + r_u->alias.info1.switch_value_1 = switch_level; + init_uni_hdr(&r_u->alias.info1.hdr_alias_desc, alias_desc_len); + init_unistr2(&r_u->alias.info1.uni_alias_desc, alias_desc, alias_desc_len); + break; + } + case 3: + { + r_u->ptr = 1; + init_uni_hdr(&r_u->alias.info3.hdr_acct_desc, alias_desc_len); + init_unistr2(&r_u->alias.info3.uni_acct_desc, alias_desc, alias_desc_len); + break; + } + default: + { + r_u->status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS; + } } - - r_u->status = status; + } } + + /******************************************************************* Reads or writes a structure. ********************************************************************/ BOOL samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) - return False; + if (r_u == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo"); - depth++; + prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo"); + depth++; - if(!prs_align(ps)) - return False; + if(!prs_align(ps)) + return False; - if(!prs_uint32("ptr ", ps, depth, &r_u->ptr)) - return False; + if(!prs_uint32("ptr ", ps, depth, &r_u->ptr)) + return False; - if (r_u->ptr != 0) { - if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value)) - return False; - if(!prs_align(ps)) - return False; - - if (r_u->switch_value != 0) { - switch (r_u->switch_value) { - case 3: - if(!smb_io_unihdr ("", &r_u->alias.info3.hdr_acct_desc, ps, depth)) - return False; - if(!smb_io_unistr2("", &r_u->alias.info3.uni_acct_desc, - r_u->alias.info3.hdr_acct_desc.buffer, ps, depth)) - return False; - break; - default: - DEBUG(4,("samr_io_r_query_aliasinfo: unsupported switch level\n")); - break; - } - } - } - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("status", ps, depth, &r_u->status)) - return False; - - return True; + if (r_u->ptr != 0) { + if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value)) + return False; + if(!prs_align(ps)) + return False; + + if (r_u->switch_value != 0) { + switch (r_u->switch_value) { + case 1: + smb_io_unihdr("",&r_u->alias.info1.hdr_alias_name, ps, depth); + prs_uint32("switch_value_1", ps, depth, &r_u->alias.info1.switch_value_1); + smb_io_unihdr("",&r_u->alias.info1.hdr_alias_desc, ps, depth); + + smb_io_unistr2("", &r_u->alias.info1.uni_alias_name, + r_u->alias.info1.hdr_alias_name.buffer, ps, depth); + smb_io_unistr2("", &r_u->alias.info1.uni_alias_desc, + r_u->alias.info1.hdr_alias_desc.buffer, ps, depth); + break; + case 3: + if(!smb_io_unihdr ("", &r_u->alias.info3.hdr_acct_desc, ps, depth)) + return False; + if(!smb_io_unistr2("", &r_u->alias.info3.uni_acct_desc, + r_u->alias.info3.hdr_acct_desc.buffer, ps, depth)) + return False; + break; + default: + DEBUG(4,("samr_io_r_query_aliasinfo: unsupported switch level\n")); + break; + } + } + } + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; } /******************************************************************* @@ -3402,8 +3432,7 @@ void init_samr_r_unknown_38(SAMR_R_UNKNOWN_38 *r_u) r_u->unk_0 = 0; r_u->unk_1 = 0; r_u->unk_2 = 0; - - r_u->status = 0x0; + r_u->unk_3 = 0; } /******************************************************************* @@ -3433,7 +3462,9 @@ BOOL samr_io_r_unknown_38(char *desc, SAMR_R_UNKNOWN_38 *r_u, prs_struct *ps, i return False; if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_uint16("unk_3", ps, depth, &r_u->unk_3)) + return False; + if(!prs_align(ps)) return False; return True; @@ -3609,6 +3640,223 @@ BOOL samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER *r_u, prs_struct return True; } +/********************************************************************** + Reads or writes a structure + **********************************************************************/ +BOOL samr_io_q_lookup_domain(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++; + + prs_align(ps); + + smb_io_pol_hnd("connect_pol", &(q_u->connect_pol), ps, depth); + + smb_io_unihdr("hdr_domain", &(q_u->hdr_domain), ps, depth); + smb_io_unistr2("uni_domain", &(q_u->uni_domain), + q_u->hdr_domain.buffer, ps, depth); + prs_align(ps); + + return True; +} + +/******************************************************************* +makes a SAMR_R_LOOKUP_DOMAIN structure. +********************************************************************/ +BOOL init_samr_r_lookup_domain(SAMR_R_LOOKUP_DOMAIN * r_u, + DOM_SID *dom_sid, uint32 status) +{ + if (r_u == NULL) + return False; + + DEBUG(5, ("make_samr_r_lookup_domain\n")); + + r_u->status = status; + r_u->ptr_sid = 0; + if (status == 0x0) + { + r_u->ptr_sid = 1; + init_dom_sid2(&r_u->dom_sid, dom_sid); + } + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_r_lookup_domain(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++; + + prs_align(ps); + + prs_uint32("ptr", ps, depth, &(r_u->ptr_sid)); + + if (r_u->ptr_sid != 0) + { + smb_io_dom_sid2("sid", &(r_u->dom_sid), ps, depth); + prs_align(ps); + } + + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_q_enum_domains(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++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + + prs_uint32("start_idx", ps, depth, &(q_e->start_idx)); + prs_uint32("max_size ", ps, depth, &(q_e->max_size)); + + prs_align(ps); + + return True; +} + +/******************************************************************* +makes a SAMR_R_ENUM_DOMAINS structure. +********************************************************************/ +BOOL init_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS * r_u, + uint32 next_idx, fstring* domains, uint32 num_sam_entries) +{ + int i=0; + + if (r_u == NULL) + return False; + + DEBUG(5, ("init_samr_r_enum_domains\n")); + + r_u->next_idx = next_idx; + + r_u->uni_dom_name = (UNISTR2*) malloc(sizeof(UNISTR2) * num_sam_entries); + r_u->sam = (SAM_ENTRY*) malloc(sizeof(SAM_ENTRY) * num_sam_entries); + if(r_u->uni_dom_name == NULL || r_u->sam == NULL) + { + free(r_u->uni_dom_name); + free(r_u->sam); + r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED; + } + + if(r_u->status == 0) + for(i=0;iuni_dom_name[i],domains[i], strlen(domains[i])); + init_sam_entry(&(r_u->sam[i]), strlen(domains[i]), 0); + } + else + { + num_sam_entries = 0; + } + + 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; + } + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_r_enum_domains(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++; + + prs_align(ps); + + prs_uint32("next_idx ", ps, depth, &(r_u->next_idx)); + prs_uint32("ptr_entries1", ps, depth, &(r_u->ptr_entries1)); + + if (r_u->ptr_entries1 != 0) + { + prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); + prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); + prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); -#undef OLD_NTDOMAIN + if (UNMARSHALLING(ps)) + { + r_u->sam = (SAM_ENTRY*) malloc(sizeof(SAM_ENTRY)* + r_u->num_entries2); + r_u->uni_dom_name = (UNISTR2*) malloc(sizeof(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, "domains[%d]", i); + sam_io_sam_entry(tmp, &(r_u->sam[i]), ps, depth); + } + + for (i = 0; i < r_u->num_entries2; i++) + { + fstring tmp; + slprintf(tmp, sizeof(tmp) - 1, "domains[%d]", i); + smb_io_unistr2(tmp, &(r_u->uni_dom_name[i]), + r_u->sam[i].hdr_name.buffer, ps, + depth); + prs_align(ps); + } + + prs_align(ps); + + } + + prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +#undef OLD_NTDOMAIN -- cgit From c560164030c0b842ee06f651a2b019c5596624a2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 17 May 2000 03:12:56 +0000 Subject: Fixed bug where mallocd size of prs_struct could be larger than incoming packet. Ensure new alloced memory is zeroed before use. Jeremy. (This used to be commit 1c3193aa1c1137734dc34ef2e6d62abb0609c30e) --- source3/rpc_parse/parse_prs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index fff1bc27b1..4260b1c8d5 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -209,6 +209,8 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) (unsigned int)new_size)); return False; } + + memset(&new_data[ps->buffer_size], '\0', new_size - ps->buffer_size); } ps->buffer_size = new_size; ps->data_p = new_data; @@ -239,6 +241,8 @@ BOOL prs_force_grow(prs_struct *ps, uint32 extra_space) return False; } + memset(&new_data[ps->buffer_size], '\0', new_size - ps->buffer_size); + ps->buffer_size = new_size; ps->data_p = new_data; @@ -296,7 +300,7 @@ BOOL prs_set_offset(prs_struct *ps, uint32 offset) BOOL prs_append_prs_data(prs_struct *dst, prs_struct *src) { - if(!prs_grow(dst, prs_offset(src))) + if(!prs_force_grow(dst, prs_offset(src))) return False; memcpy(&dst->data_p[dst->data_offset], prs_data_p(src), (size_t)prs_offset(src)); @@ -311,7 +315,7 @@ BOOL prs_append_prs_data(prs_struct *dst, prs_struct *src) BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uint32 len) { - if(!prs_grow(dst, len)) + if(!prs_force_grow(dst, len)) return False; memcpy(&dst->data_p[dst->data_offset], prs_data_p(src)+start, (size_t)len); @@ -326,7 +330,7 @@ BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uin BOOL prs_append_data(prs_struct *dst, char *src, uint32 len) { - if(!prs_grow(dst, len)) + if(!prs_force_grow(dst, len)) return False; memcpy(&dst->data_p[dst->data_offset], src, (size_t)len); -- cgit From 819c15449882a0c08689a4565bf0b31f756f05bd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 17 May 2000 19:17:16 +0000 Subject: Fixed bug I introduced last night (sorry). Now truncate incoming prs_struct buffer size to exact size of incoming data to prevent read overruns into slop space. Jeremy. (This used to be commit aa1a4f46da9584240cd6cee6fb652aa73e77015c) --- source3/rpc_parse/parse_prs.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 4260b1c8d5..dafff63ad9 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -153,6 +153,29 @@ char *prs_take_memory(prs_struct *ps, uint32 *psize) return ret; } +/******************************************************************* + Set a prs_struct to exactly a given size. Will grow or tuncate if neccessary. + ********************************************************************/ + +BOOL prs_set_buffer_size(prs_struct *ps, uint32 newsize) +{ + if (newsize > ps->buffer_size) + return prs_force_grow(ps, newsize - ps->buffer_size); + + if (newsize < ps->buffer_size) { + char *new_data_p = Realloc(ps->data_p, newsize); + if (new_data_p == NULL) { + DEBUG(0,("prs_set_buffer_size: Realloc failure for size %u.\n", + (unsigned int)newsize)); + return False; + } + ps->data_p = new_data_p; + ps->buffer_size = newsize; + } + + return True; +} + /******************************************************************* Attempt, if needed, to grow a data buffer. Also depends on the data stream mode (io). @@ -300,7 +323,7 @@ BOOL prs_set_offset(prs_struct *ps, uint32 offset) BOOL prs_append_prs_data(prs_struct *dst, prs_struct *src) { - if(!prs_force_grow(dst, prs_offset(src))) + if(!prs_grow(dst, prs_offset(src))) return False; memcpy(&dst->data_p[dst->data_offset], prs_data_p(src), (size_t)prs_offset(src)); @@ -315,7 +338,7 @@ BOOL prs_append_prs_data(prs_struct *dst, prs_struct *src) BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uint32 len) { - if(!prs_force_grow(dst, len)) + if(!prs_grow(dst, len)) return False; memcpy(&dst->data_p[dst->data_offset], prs_data_p(src)+start, (size_t)len); @@ -330,7 +353,7 @@ BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uin BOOL prs_append_data(prs_struct *dst, char *src, uint32 len) { - if(!prs_force_grow(dst, len)) + if(!prs_grow(dst, len)) return False; memcpy(&dst->data_p[dst->data_offset], src, (size_t)len); -- cgit From 74d677ec591a715e28dba29a33ee40e1b1c2f830 Mon Sep 17 00:00:00 2001 From: Shirish Kalele Date: Thu, 18 May 2000 18:43:53 +0000 Subject: Added the NETDFS pipe to allow remote administration of the msdfs symlinks on the samba server. (This used to be commit 15e7d8f6c5cddf6ce409ee2505744250d181ec34) --- source3/rpc_parse/parse_dfs.c | 429 ++++++++++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_rpc.c | 10 + 2 files changed, 439 insertions(+) create mode 100644 source3/rpc_parse/parse_dfs.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c new file mode 100644 index 0000000000..71e866e59a --- /dev/null +++ b/source3/rpc_parse/parse_dfs.c @@ -0,0 +1,429 @@ +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * MSDfs RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-2000, + * Copyright (C) Luke Kenneth Casson Leighton 1996-2000, + * Copyright (C) Shirish Kalele 2000. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "includes.h" +#include "nterr.h" +#include "rpc_parse.h" + +extern int DEBUGLEVEL; + +/************************************************************* + Read/write a DFS_R_DFS_EXIST structure + ************************************************************/ +BOOL dfs_io_r_dfs_exist(char *desc, DFS_R_DFS_EXIST *q_d, prs_struct *ps, + int depth) +{ + if(q_d == NULL) return False; + + prs_debug(ps, depth, desc, "dfs_io_r_dfs_exist"); + depth++; + + prs_align(ps); + + prs_uint32("exist flag", ps, 0, &(q_d->dfs_exist_flag)); + return True; +} + +/******************************************************************* +Make a DFS_Q_DFS_REMOVE structure +*******************************************************************/ +BOOL make_dfs_q_dfs_remove(DFS_Q_DFS_REMOVE *q_d, char *entrypath, + char *servername, char *sharename) +{ + DEBUG(5,("make_dfs_q_dfs_remove\n")); + init_unistr2(&(q_d->DfsEntryPath), entrypath, strlen(entrypath)+1); + init_unistr2(&(q_d->ServerName), servername, strlen(servername)+1); + init_unistr2(&(q_d->ShareName), sharename, strlen(sharename)+1); + q_d->ptr_ServerName = q_d->ptr_ShareName = 1; + return True; +} + +/******************************************************************* +Read/write a DFS_Q_DFS_REMOVE structure +*******************************************************************/ +BOOL dfs_io_q_dfs_remove(char *desc, DFS_Q_DFS_REMOVE *q_d, prs_struct *ps, + int depth) +{ + if(q_d == NULL) return False; + + prs_debug(ps, depth, desc, "dfs_io_q_dfs_remove"); + depth++; + + prs_align(ps); + + smb_io_unistr2("DfsEntryPath",&(q_d->DfsEntryPath), 1, ps, depth); + prs_align(ps); + + prs_uint32("ptr_ServerName", ps, depth, &(q_d->ptr_ServerName)); + if(q_d->ptr_ServerName) + smb_io_unistr2("ServerName",&(q_d->ServerName), q_d->ptr_ServerName, + ps, depth); + prs_align(ps); + + prs_uint32("ptr_ShareName", ps, depth, &(q_d->ptr_ShareName)); + if(q_d->ptr_ShareName) + smb_io_unistr2("ShareName",&(q_d->ShareName), q_d->ptr_ShareName, + ps, depth); + prs_align(ps); + + return True; +} + +/******************************************************************* +Read/write a DFS_R_DFS_REMOVE structure +*******************************************************************/ +BOOL dfs_io_r_dfs_remove(char *desc, DFS_R_DFS_REMOVE *r_d, prs_struct *ps, + int depth) +{ + if(r_d == NULL) return False; + + prs_debug(ps, depth, desc, "dfs_io_r_dfs_remove"); + depth++; + + prs_uint32("status", ps, depth, &(r_d->status)); + + return True; +} + +/******************************************************************* +Make a DFS_Q_DFS_ADD structure +*******************************************************************/ +BOOL make_dfs_q_dfs_add(DFS_Q_DFS_ADD *q_d, char *entrypath, char *servername, + char *sharename, char *comment, uint32 flags) +{ + DEBUG(5,("make_dfs_q_dfs_add\n")); + q_d->ptr_DfsEntryPath = q_d->ptr_ServerName = q_d->ptr_ShareName = 1; + init_unistr2(&(q_d->DfsEntryPath), entrypath, strlen(entrypath)+1); + init_unistr2(&(q_d->ServerName), servername, strlen(servername)+1); + init_unistr2(&(q_d->ShareName), sharename, strlen(sharename)+1); + if(comment != NULL) + { + init_unistr2(&(q_d->Comment), comment, strlen(comment)+1); + q_d->ptr_Comment = 1; + } + else + { + q_d->ptr_Comment = 0; + } + + q_d->Flags = flags; + return True; +} + +/************************************************************ + Read/write a DFS_Q_DFS_ADD structure + ************************************************************/ +BOOL dfs_io_q_dfs_add(char *desc, DFS_Q_DFS_ADD *q_d, prs_struct *ps, + int depth) +{ + if(q_d == NULL) return False; + + prs_debug(ps, depth, desc, "dfs_io_q_dfs_add"); + depth++; + + prs_align(ps); + + smb_io_unistr2("DfsEntryPath",&(q_d->DfsEntryPath), 1, ps, depth); + prs_align(ps); + + smb_io_unistr2("ServerName",&(q_d->ServerName), 1, ps, depth); + prs_align(ps); + + prs_uint32("ptr_ShareName", ps, depth, &(q_d->ptr_ShareName)); + smb_io_unistr2("ShareName",&(q_d->ShareName), 1, ps, depth); + prs_align(ps); + + prs_uint32("ptr_Comment", ps, depth, &(q_d->ptr_Comment)); + smb_io_unistr2("",&(q_d->Comment), q_d->ptr_Comment , ps, depth); + prs_align(ps); + + prs_uint32("Flags", ps, depth, &(q_d->Flags)); + return True; +} + +/************************************************************ + Read/write a DFS_R_DFS_ADD structure + ************************************************************/ +BOOL dfs_io_r_dfs_add(char *desc, DFS_R_DFS_ADD *r_d, prs_struct *ps, + int depth) +{ + if(r_d == NULL) return False; + + prs_debug(ps, depth, desc, "dfs_io_r_dfs_add"); + depth++; + + prs_uint32("status", ps, depth, &(r_d->status)); + + return True; +} + +/************************************************************ + Read/write a DFS_Q_GET_INFO structure + ************************************************************/ +BOOL dfs_io_q_dfs_get_info(char* desc, DFS_Q_DFS_GET_INFO* q_i, + prs_struct* ps, int depth) +{ + if(q_i == NULL) return False; + + prs_debug(ps, depth, desc, "dfs_io_q_dfs_get_info"); + depth++; + + smb_io_unistr2("",&(q_i->uni_path), 1, ps, depth); + prs_align(ps); + + prs_uint32("ptr_server", ps, depth, &(q_i->ptr_server)); + if(q_i->ptr_server) + smb_io_unistr2("",&(q_i->uni_server), q_i->ptr_server, ps, depth); + prs_align(ps); + + prs_uint32("ptr_share", ps, depth, &(q_i->ptr_share)); + if(q_i->ptr_share) + smb_io_unistr2("", &(q_i->uni_share), q_i->ptr_share, ps, depth); + prs_align(ps); + + prs_uint32("level", ps, depth, &(q_i->level)); + return True; +} + +/************************************************************ + Read/write a DFS_R_GET_INFO structure + ************************************************************/ +BOOL dfs_io_r_dfs_get_info(char* desc, DFS_R_DFS_GET_INFO* r_i, + prs_struct* ps, int depth) +{ + if(r_i == NULL) return False; + + prs_uint32("level", ps, depth, &(r_i->level)); + prs_uint32("ptr_ctr", ps, depth, &(r_i->ptr_ctr)); + + dfs_io_dfs_info_ctr("", &(r_i->ctr), 1, r_i->level, ps, depth); + prs_uint32("status", ps, depth, &(r_i->status)); + return True; +} + +/************************************************************ + Make a DFS_Q_DFS_ENUM structure + ************************************************************/ +BOOL make_dfs_q_dfs_enum(DFS_Q_DFS_ENUM *q_d, uint32 level, DFS_INFO_CTR *ctr) +{ + q_d->level = level; + q_d->maxpreflen = -1; + q_d->ptr_buffer = 1; + q_d->level2 = level; + + q_d->ptr_num_entries = 1; + q_d->num_entries = 0; + q_d->num_entries2 = 0; + q_d->reshnd.ptr_hnd = 1; + q_d->reshnd.handle = 0; + return True; +} + +/************************************************************ + Read or write the DFS_Q_DFS_ENUM structure + ************************************************************/ +BOOL dfs_io_q_dfs_enum(char *desc, DFS_Q_DFS_ENUM *q_d, prs_struct *ps, + int depth) +{ + if(q_d == NULL) return False; + + prs_debug(ps, depth, desc, "dfs_io_q_dfs_enum"); + depth++; + + prs_align(ps); + + prs_uint32("level", ps, depth, &(q_d->level)); + prs_uint32("maxpreflen", ps, depth, &(q_d->maxpreflen)); + prs_uint32("ptr_buffer", ps, depth, &(q_d->ptr_buffer)); + prs_uint32("level2", ps, depth, &(q_d->level2)); + prs_uint32("level3", ps, depth, &(q_d->level2)); + + prs_uint32("ptr_num_entries", ps, depth, &(q_d->ptr_num_entries)); + prs_uint32("num_entries", ps, depth, &(q_d->num_entries)); + prs_uint32("num_entries2", ps, depth, &(q_d->num_entries2)); + smb_io_enum_hnd("resume_hnd",&(q_d->reshnd), ps, depth); + return True; +} + +/************************************************************ + Read/write a DFS_INFO_CTR structure + ************************************************************/ +BOOL dfs_io_dfs_info_ctr(char* desc, DFS_INFO_CTR* ctr, uint32 num_entries, + uint32 level, + prs_struct* ps, int depth) +{ + switch(level) + { + case 1: + { + int i=0; + + depth++; + /* should depend on whether marshalling or unmarshalling! */ + if(UNMARSHALLING(ps)) + ctr->dfs.info1 = g_new0(DFS_INFO_1, num_entries); + + for(i=0;idfs.info1[i].ptr_entrypath)); + } + for(i=0;idfs.info1[i].entrypath), + ctr->dfs.info1[i].ptr_entrypath, + ps, depth); + prs_align(ps); + } + depth--; + break; + } + case 2: + { + int i=0; + depth++; + if(UNMARSHALLING(ps)) + ctr->dfs.info2 = g_new0(DFS_INFO_2, num_entries); + + for(i=0;idfs.info2[i].ptr_entrypath)); + prs_uint32("ptr_comment", ps, depth, + &(ctr->dfs.info2[i].ptr_comment)); + prs_uint32("state", ps, depth, &(ctr->dfs.info2[i].state)); + prs_uint32("num_storages", ps, depth, + &(ctr->dfs.info2[i].num_storages)); + } + for(i=0;idfs.info2[i].entrypath), + ctr->dfs.info2[i].ptr_entrypath, ps, depth); + prs_align(ps); + smb_io_unistr2("",&(ctr->dfs.info2[i].comment), + ctr->dfs.info2[i].ptr_comment, ps, depth); + prs_align(ps); + } + depth--; + break; + } + case 3: + { + int i=0; + depth++; + if(UNMARSHALLING(ps)) + ctr->dfs.info3 = g_new0(DFS_INFO_3, num_entries); + + for(i=0;idfs.info3[i].ptr_entrypath)); + prs_uint32("ptr_comment", ps, depth, + &(ctr->dfs.info3[i].ptr_comment)); + prs_uint32("state", ps, depth, &(ctr->dfs.info3[i].state)); + prs_uint32("num_storages", ps, depth, + &(ctr->dfs.info3[i].num_storages)); + prs_uint32("ptr_storages", ps, depth, + &(ctr->dfs.info3[i].ptr_storages)); + } + for(i=0;idfs.info3[i].entrypath), + ctr->dfs.info3[i].ptr_entrypath, ps, depth); + prs_align(ps); + smb_io_unistr2("", &(ctr->dfs.info3[i].comment), + ctr->dfs.info3[i].ptr_comment, ps, depth); + prs_align(ps); + prs_uint32("num_storage_infos", ps, depth, + &(ctr->dfs.info3[i].num_storage_infos)); + if(!dfs_io_dfs_storage_info("storage_info", + &(ctr->dfs.info3[i]), + ps, depth)) + return False; + } + } + } + return True; +} +/************************************************************ + Read/write a DFS_R_DFS_ENUM structure + ************************************************************/ +BOOL dfs_io_r_dfs_enum(char *desc, DFS_R_DFS_ENUM *q_d, prs_struct *ps, int depth) +{ + DFS_INFO_CTR *ctr; + if(q_d == NULL) return False; + ctr = q_d->ctr; + if(ctr == NULL) return False; + + prs_debug(ps, depth, desc, "dfs_io_r_dfs_enum"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_buffer", ps, depth, &(q_d->ptr_buffer)); + prs_uint32("level", ps, depth, &(q_d->level)); + prs_uint32("level2", ps, depth, &(ctr->switch_value)); + prs_uint32("ptr_num_entries", ps, depth, &(q_d->ptr_num_entries)); + if(q_d->ptr_num_entries) + prs_uint32("num_entries", ps, depth, &(q_d->num_entries)); + prs_uint32("ptr_num_entries2", ps, depth, &(q_d->ptr_num_entries2)); + if(q_d->ptr_num_entries2) + prs_uint32("num_entries2", ps, depth, &(ctr->num_entries)); + + dfs_io_dfs_info_ctr("", ctr, q_d->num_entries, q_d->level, ps, depth); + + smb_io_enum_hnd("resume_hnd", &(q_d->reshnd), ps, depth); + prs_uint32("status", ps, depth, &(q_d->status)); + return True; +} + +BOOL dfs_io_dfs_storage_info(char *desc, DFS_INFO_3* info3, + prs_struct *ps, int depth) +{ + int i=0; + if(info3 == NULL) return False; + + prs_debug(ps, depth, desc, "smb_io_dfs_storage_info"); + depth++; + + if(UNMARSHALLING(ps)) + info3->storages = g_new0(DFS_STORAGE_INFO, info3->num_storage_infos); + + for(i=0;inum_storage_infos;i++) + { + prs_uint32("storage_state", ps, depth, &(info3->storages[i].state)); + prs_uint32("ptr_servername", ps, depth, + &(info3->storages[i].ptr_servername)); + prs_uint32("ptr_sharename", ps, depth, + &(info3->storages[i].ptr_sharename)); + } + for(i=0;inum_storage_infos;i++) + { + smb_io_unistr2("servername", &(info3->storages[i].servername), + info3->storages[i].ptr_servername, ps, depth); + prs_align(ps); + smb_io_unistr2("sharename", &(info3->storages[i].sharename), + info3->storages[i].ptr_sharename, ps, depth); + prs_align(ps); + } + return True; +} diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 8d39b6e7c0..af0569fd61 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -123,6 +123,15 @@ interface/version dce/rpc pipe identification }, 0x00 \ } +#define SYNT_NETDFS_V3 \ +{ \ + { \ + 0x4fc742e0, 0x4a10, 0x11cf, \ + { 0x82, 0x73, 0x00, 0xaa, \ + 0x00, 0x4a, 0xe6, 0x73 } \ + }, 0x03 \ +} + struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ @@ -133,6 +142,7 @@ struct pipe_id_info pipe_names [] = { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, + { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From 68239f38fd27c6426aa4a042b0993c6efee2ea1d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 24 May 2000 06:20:42 +0000 Subject: a fairly big change in spoolss. got rid of the forms, drivers and printers files in the nt drivers directory and instead use a single tdb note that this is _not_ all finished. (This used to be commit 4fef181af3964311f45e77bdd43d6fb4e546127f) --- source3/rpc_parse/parse_spoolss.c | 69 ++++++++++++--------------------------- 1 file changed, 20 insertions(+), 49 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 6bac725658..4a9c0d2645 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -42,7 +42,9 @@ return the length of a UNISTR string. static uint32 str_len_uni(UNISTR *source) { uint32 i=0; - + + if (!source->buffer) return 0; + while (source->buffer[i]!=0x0000) { i++; @@ -2354,8 +2356,9 @@ uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) size+=size_of_relative_string( &info->defaultdatatype ); string=info->dependentfiles; - - for (i=0; (string[i]!=0x0000) || (string[i+1]!=0x0000); i++); + if (string) { + for (i=0; (string[i]!=0x0000) || (string[i+1]!=0x0000); i++); + } i=i+2; /* to count all chars including the leading zero */ i=2*i; /* because we need the value in bytes */ @@ -3305,6 +3308,7 @@ BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, p return False; if(!prs_uint32("portname_ptr", ps, depth, &il->portname_ptr)) return False; + if(!prs_uint32("drivername_ptr", ps, depth, &il->drivername_ptr)) return False; if(!prs_uint32("comment_ptr", ps, depth, &il->comment_ptr)) @@ -3723,56 +3727,24 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ dynamically allocate memory ********************************************************************/ -static BOOL uniarray_2_dosarray(BUFFER5 *buf5, char ***ar) +static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) { - char **array; - char *string; - char *destend; - char *dest; - uint32 n; - uint32 i; - - uint16 *src; + fstring f; + int n = 0; + char *src; if (buf5==NULL) return False; - array=NULL; - n=0; - i=0; - src=buf5->buffer; - - string=(char *)malloc(sizeof(char)*buf5->buf_len); - if(string == NULL) - return False; + src = (char *)buf5->buffer; + *ar = NULL; - destend = string + buf5->buf_len; - dest=string; - - while (dest < destend) - { - dest += unicode_to_dos_char(dest, (smb_ucs2_t)*(src++)); + while (src < ((char *)buf5->buffer) + buf5->buf_len*2) { + unistr_to_dos(f, src, sizeof(f)-1); + src = skip_unibuf(src, 2*buf5->buf_len - PTR_DIFF(src,buf5->buffer)); + *ar = (fstring *)Realloc(*ar, sizeof(fstring)*(n+2)); + fstrcpy((*ar)[n], f); } - - /* that ugly for the first one but that's working */ - array=(char **)Realloc(array, sizeof(char *)*(i+1)); - if(array == NULL) - return False; - array[i++]=string; - - while ( n < buf5->buf_len ) - { - if ( *(string++) == '\0' ) - { - array=(char **)Realloc(array, sizeof(char *)*(i+1)); - if(array == NULL) - return False; - array[i++]=string; - } - n++; - } - *ar=array; - - DEBUG(10,("Number of dependent files: [%d]\n", i-1)); + fstrcpy((*ar)[n], ""); return True; } @@ -4001,9 +3973,8 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, unix_to_nt_time(&time_nt, time_unix); d->changeid=time_nt.low; - d->c_setprinter++; - + unistr2_to_ascii(d->servername, &uni->servername, sizeof(d->servername)-1); unistr2_to_ascii(d->printername, &uni->printername, sizeof(d->printername)-1); unistr2_to_ascii(d->sharename, &uni->sharename, sizeof(d->sharename)-1); -- cgit From f3c44fba111392a7680e489330f3f69aedbff13d Mon Sep 17 00:00:00 2001 From: Shirish Kalele Date: Fri, 26 May 2000 22:37:08 +0000 Subject: Fixed memory leak in RPC parsing code. Problem in prs_set_buffer_size() was Realloc returns a NULL when newsize is zero (equivalent to a free()). We were returning a failure here without resetting the buffer_size or the data_p pointer in the prs_struct. And we weren't checking for a failure from prs_set_buffer_size(). So realloc's to zero size were not reflected in the prs_struct: memory leak. (This used to be commit 590d9ece8449b1feecfe1aa13e61bcd8fea4e5bf) --- source3/rpc_parse/parse_prs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index dafff63ad9..422b420a3c 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -164,9 +164,11 @@ BOOL prs_set_buffer_size(prs_struct *ps, uint32 newsize) if (newsize < ps->buffer_size) { char *new_data_p = Realloc(ps->data_p, newsize); - if (new_data_p == NULL) { + /* if newsize is zero, Realloc acts like free() & returns NULL*/ + if (new_data_p == NULL && newsize != 0) { DEBUG(0,("prs_set_buffer_size: Realloc failure for size %u.\n", (unsigned int)newsize)); + DEBUG(0,("prs_set_buffer_size: Reason %s\n",strerror(errno))); return False; } ps->data_p = new_data_p; -- cgit From a65dead017b3f52d7c2f753ce8ca876371183629 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 27 May 2000 01:26:34 +0000 Subject: security descs in spoolss. needs parse_sec.c nttrans.c broken. (This used to be commit f9f2a04fdb7b2af1cfe5bf26ec6f0d955ea948b9) --- source3/rpc_parse/parse_sec.c | 697 +++++++++++++++++++------------------- source3/rpc_parse/parse_spoolss.c | 159 ++++++++- 2 files changed, 490 insertions(+), 366 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 5d4b56d745..57fd04e05d 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -2,10 +2,10 @@ * Unix SMB/Netbios implementation. * Version 1.9. * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1998, - * Copyright (C) Jeremy R. Allison 1995-1998 - * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, - * Copyright (C) Paul Ashton 1997-1998. + * Copyright (C) Andrew Tridgell 1992-1999, + * Copyright (C) Jeremy R. Allison 1995-1999 + * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, + * Copyright (C) Paul Ashton 1997-1999. * * 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 @@ -24,18 +24,20 @@ #include "includes.h" +#include "rpc_parse.h" extern int DEBUGLEVEL; -#define SD_HEADER_SIZE 0x14 /******************************************************************* Sets up a SEC_ACCESS structure. ********************************************************************/ -void init_sec_access(SEC_ACCESS *t, uint32 mask) +BOOL make_sec_access(SEC_ACCESS * t, uint32 mask) { + ZERO_STRUCTP(t); t->mask = mask; + return True; } /******************************************************************* @@ -50,11 +52,9 @@ BOOL sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "sec_io_access"); depth++; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("mask", ps, depth, &(t->mask))) - return False; + prs_align(ps); + + prs_uint32("mask", ps, depth, &(t->mask)); return True; } @@ -64,555 +64,540 @@ BOOL sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) Sets up a SEC_ACE structure. ********************************************************************/ -void init_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 flag) +static size_t sec_ace_get_size(const SEC_ACE *ace) +{ + if (ace == NULL) + return 0; + return sid_size(&ace->sid) + 8; +} + +BOOL make_sec_ace(SEC_ACE * t, const DOM_SID *sid, uint8 type, + SEC_ACCESS mask, uint8 flag) { + ZERO_STRUCTP(t); + t->type = type; t->flags = flag; - t->size = sid_size(sid) + 8; t->info = mask; - - ZERO_STRUCTP(&t->sid); sid_copy(&t->sid, sid); + + t->size = sec_ace_get_size(t); + + return True; } /******************************************************************* Reads or writes a SEC_ACE structure. ********************************************************************/ -BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth) +static BOOL sec_io_ace(char *desc, SEC_ACE * t, prs_struct *ps, int depth) { uint32 old_offset; uint32 offset_ace_size; - - if (psa == NULL) + if (t == NULL) return False; prs_debug(ps, depth, desc, "sec_io_ace"); depth++; - if(!prs_align(ps)) - return False; - - old_offset = prs_offset(ps); - - if(!prs_uint8("type ", ps, depth, &psa->type)) - return False; - - if(!prs_uint8("flags", ps, depth, &psa->flags)) - return False; - - if(!prs_uint16_pre("size ", ps, depth, &psa->size, &offset_ace_size)) - return False; + prs_align(ps); - if(!sec_io_access("info ", &psa->info, ps, depth)) - return False; + old_offset = prs_offset(ps); - if(!prs_align(ps)) - return False; + prs_uint8("type ", ps, depth, &(t->type)); + prs_uint8("flags", ps, depth, &(t->flags)); + prs_uint16_pre("size ", ps, depth, &(t->size), &offset_ace_size); - if(!smb_io_dom_sid("sid ", &psa->sid , ps, depth)) - return False; + sec_io_access("info ", &t->info, ps, depth); + prs_align(ps); + smb_io_dom_sid("sid ", &t->sid, ps, depth); + prs_align(ps); - if(!prs_uint16_post("size ", ps, depth, &psa->size, offset_ace_size, old_offset)) - return False; + prs_uint16_post("size ", ps, depth, &t->size, offset_ace_size, + old_offset); return True; } /******************************************************************* - Create a SEC_ACL structure. + Create a SEC_ACL structure. ********************************************************************/ - -SEC_ACL *make_sec_acl(uint16 revision, int num_aces, SEC_ACE *ace_list) +BOOL make_sec_acl(SEC_ACL * t, uint16 revision, int num_aces, SEC_ACE * ace) { - SEC_ACL *dst; int i; - if((dst = (SEC_ACL *)malloc(sizeof(SEC_ACL))) == NULL) - return NULL; + ZERO_STRUCTP(t); - ZERO_STRUCTP(dst); + t->revision = revision; + t->num_aces = num_aces; + t->size = 8; + t->ace = ace; - dst->revision = revision; - dst->num_aces = num_aces; - dst->size = 8; - - if((dst->ace = (SEC_ACE *)malloc( sizeof(SEC_ACE) * num_aces )) == NULL) { - free_sec_acl(&dst); - return NULL; + for (i = 0; i < num_aces; i++) + { + t->size += sec_ace_get_size(&ace[i]); } - for (i = 0; i < num_aces; i++) { - dst->ace[i] = ace_list[i]; /* Structure copy. */ - dst->size += ace_list[i].size; - } - - return dst; + return True; } /******************************************************************* - Duplicate a SEC_ACL structure. + Duplicate a SEC_ACL structure. ********************************************************************/ - SEC_ACL *dup_sec_acl( SEC_ACL *src) { if(src == NULL) return NULL; - return make_sec_acl( src->revision, src->num_aces, src->ace); + return NULL; } /******************************************************************* - Delete a SEC_ACL structure. +frees a structure. ********************************************************************/ - -void free_sec_acl(SEC_ACL **ppsa) +void free_sec_acl(SEC_ACL * t) { - SEC_ACL *psa; - - if(ppsa == NULL || *ppsa == NULL) + if (t == NULL) return; - - psa = *ppsa; - if (psa->ace != NULL) - free(psa->ace); - - free(psa); - *ppsa = NULL; + if (t->ace != NULL) + { + free(t->ace); + t->ace = NULL; + } + t->num_aces = 0; } /******************************************************************* - Reads or writes a SEC_ACL structure. + Reads or writes a structure. First of the xx_io_xx functions that allocates its data structures for you as it reads them. ********************************************************************/ -BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) +static BOOL sec_io_acl(char *desc, SEC_ACL * t, prs_struct *ps, int depth) { - int i; + uint32 i; uint32 old_offset; uint32 offset_acl_size; - SEC_ACL *psa; - if (ppsa == NULL) + if (t == NULL) return False; - psa = *ppsa; - - if(UNMARSHALLING(ps) && psa == NULL) { - /* - * This is a read and we must allocate the stuct to read into. - */ - if((psa = (SEC_ACL *)malloc(sizeof(SEC_ACL))) == NULL) - return False; - ZERO_STRUCTP(psa); - *ppsa = psa; - } - prs_debug(ps, depth, desc, "sec_io_acl"); depth++; - if(!prs_align(ps)) - return False; - + prs_align(ps); + old_offset = prs_offset(ps); - if(!prs_uint16("revision", ps, depth, &psa->revision)) - return False; + prs_uint16("revision", ps, depth, &(t->revision)); + prs_uint16_pre("size ", ps, depth, &(t->size), &offset_acl_size); + prs_uint32("num_aces ", ps, depth, &(t->num_aces)); - if(!prs_uint16_pre("size ", ps, depth, &psa->size, &offset_acl_size)) - return False; + if (ps->io && t->num_aces != 0) + { + /* reading */ + t->ace = (SEC_ACE *) malloc(sizeof(t->ace[0]) * t->num_aces); + ZERO_STRUCTP(t->ace); + } - if(!prs_uint32("num_aces ", ps, depth, &psa->num_aces)) + if (t->ace == NULL && t->num_aces != 0) + { + DEBUG(0, ("INVALID ACL\n")); + prs_set_offset(ps, 0xfffffffe); return False; - - if (UNMARSHALLING(ps) && psa->num_aces != 0) { - /* reading */ - if((psa->ace = malloc(sizeof(psa->ace[0]) * psa->num_aces)) == NULL) - return False; - ZERO_STRUCTP(psa->ace); } - for (i = 0; i < psa->num_aces; i++) { + for (i = 0; i < MIN(t->num_aces, MAX_SEC_ACES); i++) + { fstring tmp; - slprintf(tmp, sizeof(tmp)-1, "ace_list[%02d]: ", i); - if(!sec_io_ace(tmp, &psa->ace[i], ps, depth)) + slprintf(tmp, sizeof(tmp) - 1, "ace[%02d]: ", i); + if(!sec_io_ace(tmp, &t->ace[i], ps, depth)) return False; } - if(!prs_align(ps)) - return False; + prs_align(ps); - if(!prs_uint16_post("size ", ps, depth, &psa->size, offset_acl_size, old_offset)) - return False; + prs_uint16_post("size ", ps, depth, &t->size, offset_acl_size, + old_offset); return True; } + /******************************************************************* Creates a SEC_DESC structure ********************************************************************/ - -SEC_DESC *make_sec_desc(uint16 revision, uint16 type, - DOM_SID *owner_sid, DOM_SID *grp_sid, - SEC_ACL *sacl, SEC_ACL *dacl, size_t *sec_desc_size) +int make_sec_desc(SEC_DESC * t, uint16 revision, uint16 type, + DOM_SID *owner_sid, DOM_SID *grp_sid, + SEC_ACL * sacl, SEC_ACL * dacl) { - SEC_DESC *dst; uint32 offset; - *sec_desc_size = 0; - - if(( dst = (SEC_DESC *)malloc(sizeof(SEC_DESC))) == NULL) - return NULL; + ZERO_STRUCTP(t); - ZERO_STRUCTP(dst); - - dst->revision = revision; - dst->type = type; - - dst->off_owner_sid = 0; - dst->off_grp_sid = 0; - dst->off_sacl = 0; - dst->off_dacl = 0; - - if(owner_sid && ((dst->owner_sid = sid_dup(owner_sid)) == NULL)) - goto error_exit; + t->revision = revision; + t->type = type; - if(grp_sid && ((dst->grp_sid = sid_dup(grp_sid)) == NULL)) - goto error_exit; + t->off_owner_sid = 0; + t->off_grp_sid = 0; + t->off_sacl = 0; + t->off_dacl = 0; - if(sacl && ((dst->sacl = dup_sec_acl(sacl)) == NULL)) - goto error_exit; + t->dacl = dacl; + t->sacl = sacl; + t->owner_sid = owner_sid; + t->grp_sid = grp_sid; - if(dacl && ((dst->dacl = dup_sec_acl(dacl)) == NULL)) - goto error_exit; - offset = 0x0; - /* - * Work out the linearization sizes. - */ - - if (dst->owner_sid != NULL) { - + if (dacl != NULL) + { if (offset == 0) - offset = SD_HEADER_SIZE; - - dst->off_owner_sid = offset; - offset += ((sid_size(dst->owner_sid) + 3) & ~3); + { + offset = 0x14; + } + t->off_dacl = offset; + offset += dacl->size; + offset = ((offset + 3) & ~3); } - if (dst->grp_sid != NULL) { - + if (sacl != NULL) + { if (offset == 0) - offset = SD_HEADER_SIZE; - - dst->off_grp_sid = offset; - offset += ((sid_size(dst->grp_sid) + 3) & ~3); + { + offset = 0x14; + } + t->off_sacl = offset; + offset += sacl->size; + offset = ((offset + 3) & ~3); } - if (dst->sacl != NULL) { - + if (owner_sid != NULL) + { if (offset == 0) - offset = SD_HEADER_SIZE; - - dst->off_sacl = offset; - offset += ((sacl->size + 3) & ~3); + { + offset = 0x14; + } + t->off_owner_sid = offset; + offset += sid_size(owner_sid); + offset = ((offset + 3) & ~3); } - if (dst->dacl != NULL) { - + if (grp_sid != NULL) + { if (offset == 0) - offset = SD_HEADER_SIZE; - - dst->off_dacl = offset; - offset += ((dacl->size + 3) & ~3); + { + offset = 0x14; + } + t->off_grp_sid = offset; + offset += sid_size(grp_sid); } - *sec_desc_size = (size_t)((offset == 0) ? SD_HEADER_SIZE : offset); - return dst; - -error_exit: - - *sec_desc_size = 0; - free_sec_desc(&dst); - return NULL; + return (offset == 0) ? 0x14 : offset; } -/******************************************************************* - Duplicate a SEC_DESC structure. -********************************************************************/ - -SEC_DESC *dup_sec_desc( SEC_DESC *src) -{ - size_t dummy; - - if(src == NULL) - return NULL; - - return make_sec_desc( src->revision, src->type, - src->owner_sid, src->grp_sid, src->sacl, - src->dacl, &dummy); -} /******************************************************************* - Deletes a SEC_DESC structure +frees a structure ********************************************************************/ - -void free_sec_desc(SEC_DESC **ppsd) +void free_sec_desc(SEC_DESC * t) { - SEC_DESC *psd; - - if(ppsd == NULL || *ppsd == NULL) - return; + if (t->dacl != NULL) + { + free_sec_acl(t->dacl); + } - psd = *ppsd; + if (t->sacl != NULL) + { + free_sec_acl(t->dacl); - free_sec_acl(&psd->dacl); - free_sec_acl(&psd->dacl); - free(psd->owner_sid); - free(psd->grp_sid); - free(psd); - *ppsd = NULL; -} + } -/******************************************************************* - Creates a SEC_DESC structure with typical defaults. -********************************************************************/ + if (t->owner_sid != NULL) + { + free(t->owner_sid); + t->owner_sid = NULL; + } -SEC_DESC *make_standard_sec_desc(DOM_SID *owner_sid, DOM_SID *grp_sid, - SEC_ACL *dacl, size_t *sec_desc_size) -{ - return make_sec_desc(1, SEC_DESC_SELF_RELATIVE|SEC_DESC_DACL_PRESENT, - owner_sid, grp_sid, NULL, dacl, sec_desc_size); + if (t->grp_sid != NULL) + { + free(t->grp_sid); + t->grp_sid = NULL; + } } /******************************************************************* - Reads or writes a SEC_DESC structure. - If reading and the *ppsd = NULL, allocates the structure. +reads or writes a structure. ********************************************************************/ - -BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) +BOOL sec_io_desc(char *desc, SEC_DESC * t, prs_struct *ps, int depth) { +#if 0 + uint32 off_owner_sid; + uint32 off_grp_sid; + uint32 off_sacl; + uint32 off_dacl; +#endif uint32 old_offset; - uint32 max_offset = 0; /* after we're done, move offset to end */ - SEC_DESC *psd; + uint32 max_offset = 0; /* after we're done, move offset to end */ - if (ppsd == NULL) + if (t == NULL) return False; - psd = *ppsd; - - if(UNMARSHALLING(ps) && psd == NULL) { - if((psd = (SEC_DESC *)malloc(sizeof(SEC_DESC))) == NULL) - return False; - ZERO_STRUCTP(psd); - *ppsd = psd; - } - prs_debug(ps, depth, desc, "sec_io_desc"); depth++; - if(!prs_align(ps)) - return False; - + prs_align(ps); + /* start of security descriptor stored for back-calc offset purposes */ old_offset = prs_offset(ps); - - if(!prs_uint16("revision ", ps, depth, &psd->revision)) - return False; - - if(!prs_uint16("type ", ps, depth, &psd->type)) - return False; - - if(!prs_uint32("off_owner_sid", ps, depth, &psd->off_owner_sid)) - return False; - - if(!prs_uint32("off_grp_sid ", ps, depth, &psd->off_grp_sid)) - return False; - - if(!prs_uint32("off_sacl ", ps, depth, &psd->off_sacl)) - return False; - - if(!prs_uint32("off_dacl ", ps, depth, &psd->off_dacl)) - return False; - + max_offset = old_offset; + + prs_uint16("revision ", ps, depth, &(t->revision)); + prs_uint16("type ", ps, depth, &(t->type)); + + prs_uint32("off_owner_sid", ps, depth, &(t->off_owner_sid)); + prs_uint32("off_grp_sid ", ps, depth, &(t->off_grp_sid)); + prs_uint32("off_sacl ", ps, depth, &(t->off_sacl)); + prs_uint32("off_dacl ", ps, depth, &(t->off_dacl)); +#if 0 + prs_uint32_pre("off_owner_sid", ps, depth, &(t->off_owner_sid), + &off_owner_sid); + prs_uint32_pre("off_grp_sid ", ps, depth, &(t->off_grp_sid), + &off_grp_sid); + prs_uint32_pre("off_sacl ", ps, depth, &(t->off_sacl), &off_sacl); + prs_uint32_pre("off_dacl ", ps, depth, &(t->off_dacl), &off_dacl); +#endif max_offset = MAX(max_offset, prs_offset(ps)); - if (psd->off_owner_sid != 0) { - - if (UNMARSHALLING(ps)) { - if(!prs_set_offset(ps, old_offset + psd->off_owner_sid)) - return False; + if (IS_BITS_SET_ALL(t->type, SEC_DESC_DACL_PRESENT)) + { +#if 0 + prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl), + off_dacl, prs_offset(ps) - old_offset); +#endif + if(!prs_set_offset(ps, old_offset + t->off_dacl)) + return False; + if (ps->io) + { /* reading */ - if((psd->owner_sid = malloc(sizeof(*psd->owner_sid))) == NULL) - return False; - ZERO_STRUCTP(psd->owner_sid); + t->dacl = (SEC_ACL *) malloc(sizeof(*t->dacl)); + ZERO_STRUCTP(t->dacl); } - if(!smb_io_dom_sid("owner_sid ", psd->owner_sid , ps, depth)) + if (t->dacl == NULL) + { + DEBUG(0, ("INVALID DACL\n")); + prs_set_offset(ps, 0xfffffffe); return False; - if(!prs_align(ps)) + } + + if(!sec_io_acl("dacl", t->dacl, ps, depth)) return False; + prs_align(ps); } +#if 0 + else + { + prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl), + off_dacl, 0); + } +#endif max_offset = MAX(max_offset, prs_offset(ps)); - if (psd->off_grp_sid != 0) { - - if (UNMARSHALLING(ps)) { + if (IS_BITS_SET_ALL(t->type, SEC_DESC_SACL_PRESENT)) + { +#if 0 + prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl), + off_sacl, prs_offset(ps) - old_offset); +#endif + if(!prs_set_offset(ps, old_offset + t->off_sacl)) + return False; + if (ps->io) + { /* reading */ - if(!prs_set_offset(ps, old_offset + psd->off_grp_sid)) - return False; - if((psd->grp_sid = malloc(sizeof(*psd->grp_sid))) == NULL) - return False; - ZERO_STRUCTP(psd->grp_sid); + t->sacl = (SEC_ACL *) malloc(sizeof(*t->sacl)); + ZERO_STRUCTP(t->sacl); } - if(!smb_io_dom_sid("grp_sid", psd->grp_sid, ps, depth)) + if (t->sacl == NULL) + { + DEBUG(0, ("INVALID SACL\n")); + prs_set_offset(ps, 0xfffffffe); return False; - if(!prs_align(ps)) + } + + if(!sec_io_acl("sacl", t->sacl, ps, depth)) return False; + prs_align(ps); + } +#if 0 + else + { + prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl), + off_sacl, 0); } +#endif max_offset = MAX(max_offset, prs_offset(ps)); - if (IS_BITS_SET_ALL(psd->type, SEC_DESC_SACL_PRESENT) && psd->off_sacl) { - if(!prs_set_offset(ps, old_offset + psd->off_sacl)) - return False; - if(!sec_io_acl("sacl", &psd->sacl, ps, depth)) - return False; - if(!prs_align(ps)) +#if 0 + prs_uint32_post("off_owner_sid", ps, depth, &(t->off_owner_sid), + off_owner_sid, prs_offset(ps) - old_offset); +#endif + if (t->off_owner_sid != 0) + { + if (ps->io) + { + if(!prs_set_offset(ps, old_offset + t->off_owner_sid)) + return False; + } + if (ps->io) + { + /* reading */ + t->owner_sid = + (DOM_SID *)malloc(sizeof(*t->owner_sid)); + ZERO_STRUCTP(t->owner_sid); + } + + if (t->owner_sid == NULL) + { + DEBUG(0, ("INVALID OWNER SID\n")); + prs_set_offset(ps, 0xfffffffe); return False; + } + + smb_io_dom_sid("owner_sid ", t->owner_sid, ps, depth); + prs_align(ps); } max_offset = MAX(max_offset, prs_offset(ps)); - if (IS_BITS_SET_ALL(psd->type, SEC_DESC_DACL_PRESENT) && psd->off_dacl != 0) { - if(!prs_set_offset(ps, old_offset + psd->off_dacl)) - return False; - if(!sec_io_acl("dacl", &psd->dacl, ps, depth)) - return False; - if(!prs_align(ps)) +#if 0 + prs_uint32_post("off_grp_sid ", ps, depth, &(t->off_grp_sid), + off_grp_sid, prs_offset(ps) - old_offset); +#endif + if (t->off_grp_sid != 0) + { + if (ps->io) + { + if(!prs_set_offset(ps, old_offset + t->off_grp_sid)) + return False; + } + if (ps->io) + { + /* reading */ + t->grp_sid = (DOM_SID *)malloc(sizeof(*t->grp_sid)); + ZERO_STRUCTP(t->grp_sid); + } + + if (t->grp_sid == NULL) + { + DEBUG(0, ("INVALID GROUP SID\n")); + prs_set_offset(ps, 0xfffffffe); return False; + } + + smb_io_dom_sid("grp_sid", t->grp_sid, ps, depth); + prs_align(ps); } max_offset = MAX(max_offset, prs_offset(ps)); if(!prs_set_offset(ps, max_offset)) return False; + return True; } /******************************************************************* - Creates a SEC_DESC_BUF structure. +creates a SEC_DESC_BUF structure. ********************************************************************/ - -SEC_DESC_BUF *make_sec_desc_buf(int len, SEC_DESC *sec_desc) +BOOL make_sec_desc_buf(SEC_DESC_BUF * buf, int len, SEC_DESC * data) { - SEC_DESC_BUF *dst; - - if((dst = (SEC_DESC_BUF *)malloc(sizeof(SEC_DESC_BUF))) == NULL) - return NULL; - - ZERO_STRUCTP(dst); + ZERO_STRUCTP(buf); /* max buffer size (allocated size) */ - dst->max_len = len; - dst->len = len; - - if(sec_desc && ((dst->sec = dup_sec_desc(sec_desc)) == NULL)) { - free_sec_desc_buf(&dst); - return NULL; - } - - return dst; -} - -/******************************************************************* - Duplicates a SEC_DESC_BUF structure. -********************************************************************/ - -SEC_DESC_BUF *dup_sec_desc_buf(SEC_DESC_BUF *src) -{ - if(src == NULL) - return NULL; + buf->max_len = len; + buf->undoc = 0; + buf->len = data != NULL ? len : 0; + buf->sec = data; - return make_sec_desc_buf( src->len, src->sec); + return True; } /******************************************************************* - Deletes a SEC_DESC_BUF structure. +frees a SEC_DESC_BUF structure. ********************************************************************/ - -void free_sec_desc_buf(SEC_DESC_BUF **ppsdb) +void free_sec_desc_buf(SEC_DESC_BUF * buf) { - SEC_DESC_BUF *psdb; - - if(ppsdb == NULL || *ppsdb == NULL) + if (buf == NULL) return; - - psdb = *ppsdb; - free_sec_desc(&psdb->sec); - free(psdb); - *ppsdb = NULL; + if (buf->sec != NULL) + { + free_sec_desc(buf->sec); + free(buf->sec); + buf->sec = NULL; + } } /******************************************************************* - Reads or writes a SEC_DESC_BUF structure. +reads or writes a SEC_DESC_BUF structure. ********************************************************************/ - -BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth) +BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF * sec, prs_struct *ps, + int depth) { uint32 off_len; uint32 off_max_len; uint32 old_offset; uint32 size; - SEC_DESC_BUF *psdb; - if (ppsdb == NULL) + if (sec == NULL) return False; - psdb = *ppsdb; - - if (UNMARSHALLING(ps) && psdb == NULL) { - if((psdb = (SEC_DESC_BUF *)malloc(sizeof(SEC_DESC_BUF))) == NULL) - return False; - ZERO_STRUCTP(psdb); - *ppsdb = psdb; - } - prs_debug(ps, depth, desc, "sec_io_desc_buf"); depth++; - if(!prs_align(ps)) - return False; - - if(!prs_uint32_pre("max_len", ps, depth, &psdb->max_len, &off_max_len)) - return False; - - if(!prs_uint32 ("undoc ", ps, depth, &psdb->undoc)) - return False; + prs_align(ps); - if(!prs_uint32_pre("len ", ps, depth, &psdb->len, &off_len)) - return False; + prs_uint32_pre("max_len", ps, depth, &(sec->max_len), &off_max_len); + prs_uint32("undoc ", ps, depth, &(sec->undoc)); + prs_uint32_pre("len ", ps, depth, &(sec->len), &off_len); old_offset = prs_offset(ps); - /* reading, length is non-zero; writing, descriptor is non-NULL */ - if ((psdb->len != 0 || MARSHALLING(ps)) && psdb->sec != NULL) { - if(!sec_io_desc("sec ", &psdb->sec, ps, depth)) + if (sec->len != 0 && ps->io) + { + /* reading */ + sec->sec = (SEC_DESC *) malloc(sizeof(*sec->sec)); + ZERO_STRUCTP(sec->sec); + + if (sec->sec == NULL) + { + DEBUG(0, ("INVALID SEC_DESC\n")); + prs_set_offset(ps, 0xfffffffe); return False; + } } - size = prs_offset(ps) - old_offset; - if(!prs_uint32_post("max_len", ps, depth, &psdb->max_len, off_max_len, size == 0 ? psdb->max_len : size)) - return False; + /* reading, length is non-zero; writing, descriptor is non-NULL */ + if ((sec->len != 0 || (!ps->io)) && sec->sec != NULL) + { + sec_io_desc("sec ", sec->sec, ps, depth); + } + + prs_align(ps); + + size = prs_offset(ps) - old_offset - 8; + prs_uint32_post("max_len", ps, depth, &(sec->max_len), off_max_len, + size == 0 ? sec->max_len : size + 8); + prs_uint32_post("len ", ps, depth, &(sec->len), off_len, + size == 0 ? 0 : size + 8); - if(!prs_uint32_post("len ", ps, depth, &psdb->len, off_len, size)) + if(!prs_set_offset(ps, old_offset + size + 8)) return False; return True; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 4a9c0d2645..c33cf58762 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1295,6 +1295,14 @@ static uint32 size_of_relative_string(UNISTR *string) return size; } +/******************************************************************* + * return the length of a uint32 + sec desc + ********************************************************************/ +static uint32 size_of_sec_desc(SEC_DESC *sec) +{ + return 4+1024; +} + /******************************************************************* * return the length of a uint32 (obvious, but the code is clean) ********************************************************************/ @@ -1483,6 +1491,63 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui } +/******************************************************************* + Parse a DEVMODE structure and its relative pointer. +********************************************************************/ +static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, + SEC_DESC **secdesc) +{ + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "new_smb_io_relsecdesc"); + depth++; + + if (MARSHALLING(ps)) + { + uint32 struct_offset = prs_offset(ps); + uint32 relative_offset; + + if (*secdesc != NULL) + { + buffer->string_at_end -= 256; /* HACK! */ + + prs_set_offset(ps, buffer->string_at_end); + + /* write the secdesc */ + if (!sec_io_desc(desc, *secdesc, ps, depth)) + return False; + + prs_set_offset(ps, struct_offset); + } + + relative_offset=buffer->string_at_end - buffer->struct_start; + /* write its offset */ + if (!prs_uint32("offset", ps, depth, &relative_offset)) + return False; + } + else + { + uint32 old_offset; + + /* read the offset */ + if (!prs_uint32("offset", ps, depth, &(buffer->string_at_end))) + return False; + + old_offset = prs_offset(ps); + prs_set_offset(ps, buffer->string_at_end + buffer->struct_start); + + /* read the sd */ + *secdesc = g_new(SEC_DESC, 1); + if (*secdesc == NULL) + return False; + if (!sec_io_desc(desc, *secdesc, ps, depth)) + return False; + + prs_set_offset(ps, old_offset); + } + return True; +} + /******************************************************************* Parse a DEVMODE structure and its relative pointer. ********************************************************************/ @@ -1663,9 +1728,6 @@ BOOL new_smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *i ********************************************************************/ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) { - /* hack for the SEC DESC */ - uint32 pipo=0; - prs_struct *ps=&(buffer->prs); prs_debug(ps, depth, desc, "new_smb_io_printer_info_2"); @@ -1701,8 +1763,9 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i if (!new_smb_io_relstr("parameters", buffer, depth, &info->parameters)) return False; - if (!prs_uint32("security descriptor", ps, depth, &pipo)) + if (!new_smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc)) return False; + if (!prs_uint32("attributes", ps, depth, &info->attributes)) return False; if (!prs_uint32("priority", ps, depth, &info->priority)) @@ -1723,6 +1786,26 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i return True; } +/******************************************************************* + Parse a PRINTER_INFO_3 structure. +********************************************************************/ +BOOL new_smb_io_printer_info_3(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *info, int depth) +{ + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "new_smb_io_printer_info_3"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if (!prs_uint32("flags", ps, depth, &info->flags)) + return False; + if (!sec_io_desc("sec_desc", &info->sec, ps, depth)) + return False; + + return True; +} + /******************************************************************* Parse a DRIVER_INFO_1 structure. ********************************************************************/ @@ -2281,7 +2364,7 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) { int size=0; - size+=4; /* the security descriptor */ + size += size_of_sec_desc( info->secdesc ); size+=size_of_device_mode( info->devmode ); @@ -2309,6 +2392,18 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) return size; } +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +uint32 spoolss_size_printer_info_3(PRINTER_INFO_3 *info) +{ + /* well, we don't actually *know* the damn size of the + * security descriptor. spoolss is a stupidly designed + * api. + */ + return size_of_sec_desc( &info->sec ); +} + /******************************************************************* return the size required by a struct in the stream ********************************************************************/ @@ -2829,9 +2924,7 @@ BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps if (!spoolss_io_devmode_cont(desc, &q_u->devmode_ctr, ps, depth)) return False; - if(!prs_uint32("security.size_of_buffer", ps, depth, &q_u->security.size_of_buffer)) - return False; - if(!prs_uint32("security.data", ps, depth, &q_u->security.data)) + if (!sec_io_desc_buf(desc, &q_u->secdesc_ctr, ps, depth)) return False; if(!prs_uint32("command", ps, depth, &q_u->command)) @@ -3289,6 +3382,23 @@ BOOL spool_io_printer_info_level_1(char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, p return True; } +/******************************************************************* + Parse a SPOOL_PRINTER_INFO_LEVEL_3 structure. +********************************************************************/ +BOOL spool_io_printer_info_level_3(char *desc, SPOOL_PRINTER_INFO_LEVEL_3 *il, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spool_io_printer_info_level_3"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("secdesc_ptr", ps, depth, &il->secdesc_ptr)) + return False; + + return True; +} + /******************************************************************* Parse a SPOOL_PRINTER_INFO_LEVEL_2 structure. ********************************************************************/ @@ -3406,23 +3516,36 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s * and by setprinter when updating printer's info */ case 1: + { if (UNMARSHALLING(ps)) { - il->info_1=(SPOOL_PRINTER_INFO_LEVEL_1 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_1)); + il->info_1=g_new(SPOOL_PRINTER_INFO_LEVEL_1, 1); if(il->info_1 == NULL) return False; } if (!spool_io_printer_info_level_1("", il->info_1, ps, depth)) return False; break; + } case 2: if (UNMARSHALLING(ps)) { - il->info_2=(SPOOL_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2)); + il->info_2=g_new(SPOOL_PRINTER_INFO_LEVEL_2, 1); if(il->info_2 == NULL) return False; } if (!spool_io_printer_info_level_2("", il->info_2, ps, depth)) return False; break; + case 3: + { + if (UNMARSHALLING(ps)) { + il->info_3=g_new(SPOOL_PRINTER_INFO_LEVEL_3, 1); + if(il->info_3 == NULL) + return False; + } + if (!spool_io_printer_info_level_3("", il->info_3, ps, depth)) + return False; + break; + } } return True; @@ -4607,11 +4730,27 @@ void free_devmode(DEVICEMODE *devmode) } } +void free_printer_info_3(PRINTER_INFO_3 *printer) +{ + if (printer!=NULL) + { + free_sec_desc(&printer->sec); + free(printer); + } +} + void free_printer_info_2(PRINTER_INFO_2 *printer) { if (printer!=NULL) { free_devmode(printer->devmode); + printer->devmode = NULL; + if (printer->secdesc != NULL) + { + free_sec_desc(printer->secdesc); + free(printer->secdesc); + printer->secdesc = NULL; + } free(printer); } } -- cgit From 6ec1ae35b4dda41a59c03666aedaf3744bd5312c Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 27 May 2000 04:51:02 +0000 Subject: hack to get setprinter working, level2, null sec desc. (This used to be commit 3f976e713924a2fa47194ae3edfa3f1592e4cf1c) --- source3/rpc_parse/parse_spoolss.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index c33cf58762..4148caa7b2 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2907,6 +2907,8 @@ BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps ********************************************************************/ BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth) { + uint32 ptr_sec_desc = 0; + prs_debug(ps, depth, desc, "spoolss_io_q_setprinter"); depth++; @@ -2924,8 +2926,24 @@ BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps if (!spoolss_io_devmode_cont(desc, &q_u->devmode_ctr, ps, depth)) return False; - if (!sec_io_desc_buf(desc, &q_u->secdesc_ctr, ps, depth)) - return False; + switch (q_u->level) + { + case 2: + { + ptr_sec_desc = q_u->info.info_2->secdesc_ptr; + break; + } + case 3: + { + ptr_sec_desc = q_u->info.info_3->secdesc_ptr; + break; + } + } + if (ptr_sec_desc) + { + if (!sec_io_desc_buf(desc, &q_u->secdesc_ctr, ps, depth)) + return False; + } if(!prs_uint32("command", ps, depth, &q_u->command)) return False; -- cgit From b38aa95bc9becb89fa1b966c7d6ecd91e3d47a99 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 28 May 2000 21:01:14 +0000 Subject: moved notif_y_table struct to spoolss_nt.c only used there. #ifdef'd driver-code out with define RELIES_ON_SMBD_SPECIFIC_CODE because spoolssd doesn't link with smbd/*.c (find_service("print$") is not possible). (This used to be commit 726c359d1d9f1fc8227ca920c888d2f040170e0b) --- source3/rpc_parse/parse_spoolss.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 4148caa7b2..2c562219ba 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -682,8 +682,12 @@ static BOOL spoolss_io_printer_default(char *desc, PRINTER_DEFAULT *pd, prs_stru /******************************************************************* * init a structure. ********************************************************************/ -BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, fstring printername, fstring datatype, - uint32 access_required, fstring clientname, fstring user_name) +BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, + const fstring printername, + const fstring datatype, + uint32 access_required, + const fstring clientname, + const fstring user_name) { DEBUG(5,("make_spoolss_q_open_printer_ex\n")); q_u->printername_ptr = (printername!=NULL)?1:0; @@ -775,8 +779,8 @@ BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_ * make a structure. ********************************************************************/ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, - POLICY_HND *handle, - char *valuename, + const POLICY_HND *handle, + const UNISTR2 *valuename, uint32 size) { int len_name = valuename != NULL ? strlen(valuename) : 0; @@ -785,7 +789,7 @@ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, DEBUG(5,("make_spoolss_q_getprinterdata\n")); - memcpy(&(q_u->handle), handle, sizeof(q_u->handle)); + q_u->handle = *handle; init_unistr2(&(q_u->valuename), valuename, len_name); q_u->size = size; @@ -2635,7 +2639,8 @@ uint32 spoolss_size_printmonitor_info_2(PRINTMONITOR_2 *info) * init a structure. ********************************************************************/ BOOL make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u, - const POLICY_HND *hnd, fstring architecture, + const POLICY_HND *hnd, + const fstring architecture, uint32 level, uint32 clientmajor, uint32 clientminor, NEW_BUFFER *buffer, uint32 offered) { @@ -4451,7 +4456,9 @@ BOOL spoolss_io_q_enumprinterdata(char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_ /******************************************************************* ********************************************************************/ -BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, POLICY_HND *hnd, uint32 idx, uint32 valuelen, uint32 datalen) +BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, + const POLICY_HND *hnd, + uint32 idx, uint32 valuelen, uint32 datalen) { memcpy(&(q_u->handle), hnd, sizeof(q_u->handle)); q_u->index=idx; -- cgit From 85295c5c09e9e4c768f5de1d0192ff74316a7789 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 28 May 2000 23:07:26 +0000 Subject: init_unistr takes a const 2nd arg (ps: I hate const) (This used to be commit 7030b7f06a8784469562562aa346d0c2918734d5) --- source3/rpc_parse/parse_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index b12688d362..e68cd3ae12 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -475,7 +475,7 @@ BOOL smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) Inits a UNISTR structure. ********************************************************************/ -void init_unistr(UNISTR *str, char *buf) +void init_unistr(UNISTR *str, const char *buf) { /* store the string (null-terminated copy) */ dos_struni2((char *)str->buffer, buf, sizeof(str->buffer)); -- cgit From f0080e5a3979fac94d6668cf6ee9d9f61302839c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 1 Jun 2000 17:01:34 +0000 Subject: Getting back to a compilable state (not there yet but close). Added patches for random -> sys_random. Added set_effective_xxx patches for AFS code. Memory allocation changes in spoolss code. Jeremy. (This used to be commit c2099cfb033c2cdb6035f4f7f50ce21b98e1584d) --- source3/rpc_parse/parse_misc.c | 6 +- source3/rpc_parse/parse_samr.c | 4 +- source3/rpc_parse/parse_sec.c | 700 +++++++++++++++++++------------------- source3/rpc_parse/parse_spoolss.c | 30 +- 4 files changed, 371 insertions(+), 369 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index e68cd3ae12..935d83cafa 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -785,14 +785,14 @@ BOOL smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, in Inits a UNISTR2 structure. ********************************************************************/ -void init_unistr2(UNISTR2 *str, char *buf, int len) +void init_unistr2(UNISTR2 *str, const char *buf, size_t len) { ZERO_STRUCTP(str); /* set up string lengths. */ - str->uni_max_len = len; + str->uni_max_len = (uint32)len; str->undoc = 0; - str->uni_str_len = len; + str->uni_str_len = (uint32)len; /* store the string (null-terminated 8 bit chars into 16 bit chars) */ dos_struni2((char *)str->buffer, buf, sizeof(str->buffer)); diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 4a85524263..47e69670f7 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -314,9 +314,6 @@ BOOL samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO *q_u, prs_st if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) return False; - if(!prs_align(ps)) - return False; - return True; } @@ -899,6 +896,7 @@ static void init_sam_entry3(SAM_ENTRY3 *sam, uint32 grp_idx, { DEBUG(5,("init_sam_entry3\n")); + ZERO_STRUCTP(sam); sam->grp_idx = grp_idx; sam->rid_grp = rid_grp; sam->attr = 0x07; /* group rid attributes - gets ignored by nt 4.0 */ diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 57fd04e05d..76e246ca9e 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -2,10 +2,10 @@ * Unix SMB/Netbios implementation. * Version 1.9. * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1999, - * Copyright (C) Jeremy R. Allison 1995-1999 - * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, - * Copyright (C) Paul Ashton 1997-1999. + * Copyright (C) Andrew Tridgell 1992-1998, + * Copyright (C) Jeremy R. Allison 1995-1998 + * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, + * Copyright (C) Paul Ashton 1997-1998. * * 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 @@ -24,20 +24,18 @@ #include "includes.h" -#include "rpc_parse.h" extern int DEBUGLEVEL; +#define SD_HEADER_SIZE 0x14 /******************************************************************* Sets up a SEC_ACCESS structure. ********************************************************************/ -BOOL make_sec_access(SEC_ACCESS * t, uint32 mask) +void init_sec_access(SEC_ACCESS *t, uint32 mask) { - ZERO_STRUCTP(t); t->mask = mask; - return True; } /******************************************************************* @@ -52,9 +50,11 @@ BOOL sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "sec_io_access"); depth++; - prs_align(ps); - - prs_uint32("mask", ps, depth, &(t->mask)); + if(!prs_align(ps)) + return False; + + if(!prs_uint32("mask", ps, depth, &(t->mask))) + return False; return True; } @@ -64,540 +64,558 @@ BOOL sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) Sets up a SEC_ACE structure. ********************************************************************/ -static size_t sec_ace_get_size(const SEC_ACE *ace) -{ - if (ace == NULL) - return 0; - return sid_size(&ace->sid) + 8; -} - -BOOL make_sec_ace(SEC_ACE * t, const DOM_SID *sid, uint8 type, - SEC_ACCESS mask, uint8 flag) +void init_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 flag) { - ZERO_STRUCTP(t); - t->type = type; t->flags = flag; + t->size = sid_size(sid) + 8; t->info = mask; - sid_copy(&t->sid, sid); - - t->size = sec_ace_get_size(t); - return True; + ZERO_STRUCTP(&t->sid); + sid_copy(&t->sid, sid); } /******************************************************************* Reads or writes a SEC_ACE structure. ********************************************************************/ -static BOOL sec_io_ace(char *desc, SEC_ACE * t, prs_struct *ps, int depth) +BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth) { uint32 old_offset; uint32 offset_ace_size; - if (t == NULL) + + if (psa == NULL) return False; prs_debug(ps, depth, desc, "sec_io_ace"); depth++; - prs_align(ps); - + if(!prs_align(ps)) + return False; + old_offset = prs_offset(ps); - prs_uint8("type ", ps, depth, &(t->type)); - prs_uint8("flags", ps, depth, &(t->flags)); - prs_uint16_pre("size ", ps, depth, &(t->size), &offset_ace_size); + if(!prs_uint8("type ", ps, depth, &psa->type)) + return False; + + if(!prs_uint8("flags", ps, depth, &psa->flags)) + return False; + + if(!prs_uint16_pre("size ", ps, depth, &psa->size, &offset_ace_size)) + return False; + + if(!sec_io_access("info ", &psa->info, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; - sec_io_access("info ", &t->info, ps, depth); - prs_align(ps); - smb_io_dom_sid("sid ", &t->sid, ps, depth); - prs_align(ps); + if(!smb_io_dom_sid("sid ", &psa->sid , ps, depth)) + return False; - prs_uint16_post("size ", ps, depth, &t->size, offset_ace_size, - old_offset); + if(!prs_uint16_post("size ", ps, depth, &psa->size, offset_ace_size, old_offset)) + return False; return True; } /******************************************************************* - Create a SEC_ACL structure. + Create a SEC_ACL structure. ********************************************************************/ -BOOL make_sec_acl(SEC_ACL * t, uint16 revision, int num_aces, SEC_ACE * ace) + +SEC_ACL *make_sec_acl(uint16 revision, int num_aces, SEC_ACE *ace_list) { + SEC_ACL *dst; int i; - ZERO_STRUCTP(t); + if((dst = (SEC_ACL *)malloc(sizeof(SEC_ACL))) == NULL) + return NULL; - t->revision = revision; - t->num_aces = num_aces; - t->size = 8; - t->ace = ace; + ZERO_STRUCTP(dst); - for (i = 0; i < num_aces; i++) - { - t->size += sec_ace_get_size(&ace[i]); + dst->revision = revision; + dst->num_aces = num_aces; + dst->size = 8; + + if((dst->ace = (SEC_ACE *)malloc( sizeof(SEC_ACE) * num_aces )) == NULL) { + free_sec_acl(&dst); + return NULL; } - return True; + for (i = 0; i < num_aces; i++) { + dst->ace[i] = ace_list[i]; /* Structure copy. */ + dst->size += ace_list[i].size; + } + + return dst; } /******************************************************************* - Duplicate a SEC_ACL structure. + Duplicate a SEC_ACL structure. ********************************************************************/ + SEC_ACL *dup_sec_acl( SEC_ACL *src) { if(src == NULL) return NULL; - return NULL; + return make_sec_acl( src->revision, src->num_aces, src->ace); } /******************************************************************* -frees a structure. + Delete a SEC_ACL structure. ********************************************************************/ -void free_sec_acl(SEC_ACL * t) + +void free_sec_acl(SEC_ACL **ppsa) { - if (t == NULL) + SEC_ACL *psa; + + if(ppsa == NULL || *ppsa == NULL) return; - if (t->ace != NULL) - { - free(t->ace); - t->ace = NULL; - } - t->num_aces = 0; + + psa = *ppsa; + if (psa->ace != NULL) + free(psa->ace); + + free(psa); + *ppsa = NULL; } /******************************************************************* - Reads or writes a structure. + Reads or writes a SEC_ACL structure. First of the xx_io_xx functions that allocates its data structures for you as it reads them. ********************************************************************/ -static BOOL sec_io_acl(char *desc, SEC_ACL * t, prs_struct *ps, int depth) +BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) { - uint32 i; + int i; uint32 old_offset; uint32 offset_acl_size; + SEC_ACL *psa; - if (t == NULL) + if (ppsa == NULL) return False; + psa = *ppsa; + + if(UNMARSHALLING(ps) && psa == NULL) { + /* + * This is a read and we must allocate the stuct to read into. + */ + if((psa = (SEC_ACL *)malloc(sizeof(SEC_ACL))) == NULL) + return False; + ZERO_STRUCTP(psa); + *ppsa = psa; + } + prs_debug(ps, depth, desc, "sec_io_acl"); depth++; - prs_align(ps); - + if(!prs_align(ps)) + return False; + old_offset = prs_offset(ps); - prs_uint16("revision", ps, depth, &(t->revision)); - prs_uint16_pre("size ", ps, depth, &(t->size), &offset_acl_size); - prs_uint32("num_aces ", ps, depth, &(t->num_aces)); + if(!prs_uint16("revision", ps, depth, &psa->revision)) + return False; - if (ps->io && t->num_aces != 0) - { - /* reading */ - t->ace = (SEC_ACE *) malloc(sizeof(t->ace[0]) * t->num_aces); - ZERO_STRUCTP(t->ace); - } + if(!prs_uint16_pre("size ", ps, depth, &psa->size, &offset_acl_size)) + return False; - if (t->ace == NULL && t->num_aces != 0) - { - DEBUG(0, ("INVALID ACL\n")); - prs_set_offset(ps, 0xfffffffe); + if(!prs_uint32("num_aces ", ps, depth, &psa->num_aces)) return False; + + if (UNMARSHALLING(ps) && psa->num_aces != 0) { + /* reading */ + if((psa->ace = malloc(sizeof(psa->ace[0]) * psa->num_aces)) == NULL) + return False; + ZERO_STRUCTP(psa->ace); } - for (i = 0; i < MIN(t->num_aces, MAX_SEC_ACES); i++) - { + for (i = 0; i < psa->num_aces; i++) { fstring tmp; - slprintf(tmp, sizeof(tmp) - 1, "ace[%02d]: ", i); - if(!sec_io_ace(tmp, &t->ace[i], ps, depth)) + slprintf(tmp, sizeof(tmp)-1, "ace_list[%02d]: ", i); + if(!sec_io_ace(tmp, &psa->ace[i], ps, depth)) return False; } - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint16_post("size ", ps, depth, &t->size, offset_acl_size, - old_offset); + if(!prs_uint16_post("size ", ps, depth, &psa->size, offset_acl_size, old_offset)) + return False; return True; } - /******************************************************************* Creates a SEC_DESC structure ********************************************************************/ -int make_sec_desc(SEC_DESC * t, uint16 revision, uint16 type, - DOM_SID *owner_sid, DOM_SID *grp_sid, - SEC_ACL * sacl, SEC_ACL * dacl) + +SEC_DESC *make_sec_desc(uint16 revision, uint16 type, + DOM_SID *owner_sid, DOM_SID *grp_sid, + SEC_ACL *sacl, SEC_ACL *dacl, size_t *sec_desc_size) { + SEC_DESC *dst; uint32 offset; - ZERO_STRUCTP(t); + *sec_desc_size = 0; - t->revision = revision; - t->type = type; + if(( dst = (SEC_DESC *)malloc(sizeof(SEC_DESC))) == NULL) + return NULL; - t->off_owner_sid = 0; - t->off_grp_sid = 0; - t->off_sacl = 0; - t->off_dacl = 0; + ZERO_STRUCTP(dst); - t->dacl = dacl; - t->sacl = sacl; - t->owner_sid = owner_sid; - t->grp_sid = grp_sid; + dst->revision = revision; + dst->type = type; + dst->off_owner_sid = 0; + dst->off_grp_sid = 0; + dst->off_sacl = 0; + dst->off_dacl = 0; + + if(owner_sid && ((dst->owner_sid = sid_dup(owner_sid)) == NULL)) + goto error_exit; + + if(grp_sid && ((dst->grp_sid = sid_dup(grp_sid)) == NULL)) + goto error_exit; + + if(sacl && ((dst->sacl = dup_sec_acl(sacl)) == NULL)) + goto error_exit; + + if(dacl && ((dst->dacl = dup_sec_acl(dacl)) == NULL)) + goto error_exit; + offset = 0x0; - if (dacl != NULL) - { + /* + * Work out the linearization sizes. + */ + + if (dst->owner_sid != NULL) { + if (offset == 0) - { - offset = 0x14; - } - t->off_dacl = offset; - offset += dacl->size; - offset = ((offset + 3) & ~3); + offset = SD_HEADER_SIZE; + + dst->off_owner_sid = offset; + offset += ((sid_size(dst->owner_sid) + 3) & ~3); } - if (sacl != NULL) - { + if (dst->grp_sid != NULL) { + if (offset == 0) - { - offset = 0x14; - } - t->off_sacl = offset; - offset += sacl->size; - offset = ((offset + 3) & ~3); + offset = SD_HEADER_SIZE; + + dst->off_grp_sid = offset; + offset += ((sid_size(dst->grp_sid) + 3) & ~3); } - if (owner_sid != NULL) - { + if (dst->sacl != NULL) { + if (offset == 0) - { - offset = 0x14; - } - t->off_owner_sid = offset; - offset += sid_size(owner_sid); - offset = ((offset + 3) & ~3); + offset = SD_HEADER_SIZE; + + dst->off_sacl = offset; + offset += ((sacl->size + 3) & ~3); } - if (grp_sid != NULL) - { + if (dst->dacl != NULL) { + if (offset == 0) - { - offset = 0x14; - } - t->off_grp_sid = offset; - offset += sid_size(grp_sid); + offset = SD_HEADER_SIZE; + + dst->off_dacl = offset; + offset += ((dacl->size + 3) & ~3); } - return (offset == 0) ? 0x14 : offset; + *sec_desc_size = (size_t)((offset == 0) ? SD_HEADER_SIZE : offset); + return dst; + +error_exit: + + *sec_desc_size = 0; + free_sec_desc(&dst); + return NULL; } +/******************************************************************* + Duplicate a SEC_DESC structure. +********************************************************************/ + +SEC_DESC *dup_sec_desc( SEC_DESC *src) +{ + size_t dummy; + + if(src == NULL) + return NULL; + + return make_sec_desc( src->revision, src->type, + src->owner_sid, src->grp_sid, src->sacl, + src->dacl, &dummy); +} /******************************************************************* -frees a structure + Deletes a SEC_DESC structure ********************************************************************/ -void free_sec_desc(SEC_DESC * t) + +void free_sec_desc(SEC_DESC **ppsd) { - if (t->dacl != NULL) - { - free_sec_acl(t->dacl); - } + SEC_DESC *psd; - if (t->sacl != NULL) - { - free_sec_acl(t->dacl); + if(ppsd == NULL || *ppsd == NULL) + return; - } + psd = *ppsd; - if (t->owner_sid != NULL) - { - free(t->owner_sid); - t->owner_sid = NULL; - } + free_sec_acl(&psd->dacl); + free_sec_acl(&psd->dacl); + free(psd->owner_sid); + free(psd->grp_sid); + free(psd); + *ppsd = NULL; +} - if (t->grp_sid != NULL) - { - free(t->grp_sid); - t->grp_sid = NULL; - } +/******************************************************************* + Creates a SEC_DESC structure with typical defaults. +********************************************************************/ + +SEC_DESC *make_standard_sec_desc(DOM_SID *owner_sid, DOM_SID *grp_sid, + SEC_ACL *dacl, size_t *sec_desc_size) +{ + return make_sec_desc(1, SEC_DESC_SELF_RELATIVE|SEC_DESC_DACL_PRESENT, + owner_sid, grp_sid, NULL, dacl, sec_desc_size); } /******************************************************************* -reads or writes a structure. + Reads or writes a SEC_DESC structure. + If reading and the *ppsd = NULL, allocates the structure. ********************************************************************/ -BOOL sec_io_desc(char *desc, SEC_DESC * t, prs_struct *ps, int depth) + +BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) { -#if 0 - uint32 off_owner_sid; - uint32 off_grp_sid; - uint32 off_sacl; - uint32 off_dacl; -#endif uint32 old_offset; - uint32 max_offset = 0; /* after we're done, move offset to end */ + uint32 max_offset = 0; /* after we're done, move offset to end */ + SEC_DESC *psd; - if (t == NULL) + if (ppsd == NULL) return False; + psd = *ppsd; + + if(UNMARSHALLING(ps) && psd == NULL) { + if((psd = (SEC_DESC *)malloc(sizeof(SEC_DESC))) == NULL) + return False; + ZERO_STRUCTP(psd); + *ppsd = psd; + } + prs_debug(ps, depth, desc, "sec_io_desc"); depth++; - prs_align(ps); - + if(!prs_align(ps)) + return False; + /* start of security descriptor stored for back-calc offset purposes */ old_offset = prs_offset(ps); - max_offset = old_offset; - - prs_uint16("revision ", ps, depth, &(t->revision)); - prs_uint16("type ", ps, depth, &(t->type)); - - prs_uint32("off_owner_sid", ps, depth, &(t->off_owner_sid)); - prs_uint32("off_grp_sid ", ps, depth, &(t->off_grp_sid)); - prs_uint32("off_sacl ", ps, depth, &(t->off_sacl)); - prs_uint32("off_dacl ", ps, depth, &(t->off_dacl)); -#if 0 - prs_uint32_pre("off_owner_sid", ps, depth, &(t->off_owner_sid), - &off_owner_sid); - prs_uint32_pre("off_grp_sid ", ps, depth, &(t->off_grp_sid), - &off_grp_sid); - prs_uint32_pre("off_sacl ", ps, depth, &(t->off_sacl), &off_sacl); - prs_uint32_pre("off_dacl ", ps, depth, &(t->off_dacl), &off_dacl); -#endif + + if(!prs_uint16("revision ", ps, depth, &psd->revision)) + return False; + + if(!prs_uint16("type ", ps, depth, &psd->type)) + return False; + + if(!prs_uint32("off_owner_sid", ps, depth, &psd->off_owner_sid)) + return False; + + if(!prs_uint32("off_grp_sid ", ps, depth, &psd->off_grp_sid)) + return False; + + if(!prs_uint32("off_sacl ", ps, depth, &psd->off_sacl)) + return False; + + if(!prs_uint32("off_dacl ", ps, depth, &psd->off_dacl)) + return False; + max_offset = MAX(max_offset, prs_offset(ps)); - if (IS_BITS_SET_ALL(t->type, SEC_DESC_DACL_PRESENT)) - { -#if 0 - prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl), - off_dacl, prs_offset(ps) - old_offset); -#endif - if(!prs_set_offset(ps, old_offset + t->off_dacl)) - return False; - if (ps->io) - { + if (psd->off_owner_sid != 0) { + + if (UNMARSHALLING(ps)) { + if(!prs_set_offset(ps, old_offset + psd->off_owner_sid)) + return False; /* reading */ - t->dacl = (SEC_ACL *) malloc(sizeof(*t->dacl)); - ZERO_STRUCTP(t->dacl); + if((psd->owner_sid = malloc(sizeof(*psd->owner_sid))) == NULL) + return False; + ZERO_STRUCTP(psd->owner_sid); } - if (t->dacl == NULL) - { - DEBUG(0, ("INVALID DACL\n")); - prs_set_offset(ps, 0xfffffffe); + if(!smb_io_dom_sid("owner_sid ", psd->owner_sid , ps, depth)) return False; - } - - if(!sec_io_acl("dacl", t->dacl, ps, depth)) + if(!prs_align(ps)) return False; - prs_align(ps); - } -#if 0 - else - { - prs_uint32_post("off_dacl ", ps, depth, &(t->off_dacl), - off_dacl, 0); } -#endif max_offset = MAX(max_offset, prs_offset(ps)); - if (IS_BITS_SET_ALL(t->type, SEC_DESC_SACL_PRESENT)) - { -#if 0 - prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl), - off_sacl, prs_offset(ps) - old_offset); -#endif - if(!prs_set_offset(ps, old_offset + t->off_sacl)) - return False; - if (ps->io) - { + if (psd->off_grp_sid != 0) { + + if (UNMARSHALLING(ps)) { /* reading */ - t->sacl = (SEC_ACL *) malloc(sizeof(*t->sacl)); - ZERO_STRUCTP(t->sacl); + if(!prs_set_offset(ps, old_offset + psd->off_grp_sid)) + return False; + if((psd->grp_sid = malloc(sizeof(*psd->grp_sid))) == NULL) + return False; + ZERO_STRUCTP(psd->grp_sid); } - if (t->sacl == NULL) - { - DEBUG(0, ("INVALID SACL\n")); - prs_set_offset(ps, 0xfffffffe); + if(!smb_io_dom_sid("grp_sid", psd->grp_sid, ps, depth)) return False; - } - - if(!sec_io_acl("sacl", t->sacl, ps, depth)) + if(!prs_align(ps)) return False; - prs_align(ps); } -#if 0 - else - { - prs_uint32_post("off_sacl ", ps, depth, &(t->off_sacl), - off_sacl, 0); - } -#endif max_offset = MAX(max_offset, prs_offset(ps)); -#if 0 - prs_uint32_post("off_owner_sid", ps, depth, &(t->off_owner_sid), - off_owner_sid, prs_offset(ps) - old_offset); -#endif - if (t->off_owner_sid != 0) - { - if (ps->io) - { - if(!prs_set_offset(ps, old_offset + t->off_owner_sid)) - return False; - } - if (ps->io) - { - /* reading */ - t->owner_sid = - (DOM_SID *)malloc(sizeof(*t->owner_sid)); - ZERO_STRUCTP(t->owner_sid); - } - - if (t->owner_sid == NULL) - { - DEBUG(0, ("INVALID OWNER SID\n")); - prs_set_offset(ps, 0xfffffffe); + if (IS_BITS_SET_ALL(psd->type, SEC_DESC_SACL_PRESENT) && psd->off_sacl) { + if(!prs_set_offset(ps, old_offset + psd->off_sacl)) + return False; + if(!sec_io_acl("sacl", &psd->sacl, ps, depth)) + return False; + if(!prs_align(ps)) return False; - } - - smb_io_dom_sid("owner_sid ", t->owner_sid, ps, depth); - prs_align(ps); } max_offset = MAX(max_offset, prs_offset(ps)); -#if 0 - prs_uint32_post("off_grp_sid ", ps, depth, &(t->off_grp_sid), - off_grp_sid, prs_offset(ps) - old_offset); -#endif - if (t->off_grp_sid != 0) - { - if (ps->io) - { - if(!prs_set_offset(ps, old_offset + t->off_grp_sid)) - return False; - } - if (ps->io) - { - /* reading */ - t->grp_sid = (DOM_SID *)malloc(sizeof(*t->grp_sid)); - ZERO_STRUCTP(t->grp_sid); - } - - if (t->grp_sid == NULL) - { - DEBUG(0, ("INVALID GROUP SID\n")); - prs_set_offset(ps, 0xfffffffe); + if (IS_BITS_SET_ALL(psd->type, SEC_DESC_DACL_PRESENT) && psd->off_dacl != 0) { + if(!prs_set_offset(ps, old_offset + psd->off_dacl)) + return False; + if(!sec_io_acl("dacl", &psd->dacl, ps, depth)) + return False; + if(!prs_align(ps)) return False; - } - - smb_io_dom_sid("grp_sid", t->grp_sid, ps, depth); - prs_align(ps); } max_offset = MAX(max_offset, prs_offset(ps)); if(!prs_set_offset(ps, max_offset)) return False; - return True; } /******************************************************************* -creates a SEC_DESC_BUF structure. + Creates a SEC_DESC_BUF structure. ********************************************************************/ -BOOL make_sec_desc_buf(SEC_DESC_BUF * buf, int len, SEC_DESC * data) + +SEC_DESC_BUF *make_sec_desc_buf(size_t len, SEC_DESC *sec_desc) { - ZERO_STRUCTP(buf); + SEC_DESC_BUF *dst; + + if((dst = (SEC_DESC_BUF *)malloc(sizeof(SEC_DESC_BUF))) == NULL) + return NULL; + + ZERO_STRUCTP(dst); /* max buffer size (allocated size) */ - buf->max_len = len; - buf->undoc = 0; - buf->len = data != NULL ? len : 0; - buf->sec = data; + dst->max_len = (uint32)len; + dst->len = (uint32)len; - return True; + if(sec_desc && ((dst->sec = dup_sec_desc(sec_desc)) == NULL)) { + free_sec_desc_buf(&dst); + return NULL; + } + + return dst; } /******************************************************************* -frees a SEC_DESC_BUF structure. + Duplicates a SEC_DESC_BUF structure. ********************************************************************/ -void free_sec_desc_buf(SEC_DESC_BUF * buf) + +SEC_DESC_BUF *dup_sec_desc_buf(SEC_DESC_BUF *src) { - if (buf == NULL) + if(src == NULL) + return NULL; + + return make_sec_desc_buf( src->len, src->sec); +} + +/******************************************************************* + Deletes a SEC_DESC_BUF structure. +********************************************************************/ + +void free_sec_desc_buf(SEC_DESC_BUF **ppsdb) +{ + SEC_DESC_BUF *psdb; + + if(ppsdb == NULL || *ppsdb == NULL) return; - if (buf->sec != NULL) - { - free_sec_desc(buf->sec); - free(buf->sec); - buf->sec = NULL; - } + + psdb = *ppsdb; + free_sec_desc(&psdb->sec); + free(psdb); + *ppsdb = NULL; } /******************************************************************* -reads or writes a SEC_DESC_BUF structure. + Reads or writes a SEC_DESC_BUF structure. ********************************************************************/ -BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF * sec, prs_struct *ps, - int depth) + +BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth) { uint32 off_len; uint32 off_max_len; uint32 old_offset; uint32 size; + SEC_DESC_BUF *psdb; - if (sec == NULL) + if (ppsdb == NULL) return False; + psdb = *ppsdb; + + if (UNMARSHALLING(ps) && psdb == NULL) { + if((psdb = (SEC_DESC_BUF *)malloc(sizeof(SEC_DESC_BUF))) == NULL) + return False; + ZERO_STRUCTP(psdb); + *ppsdb = psdb; + } + prs_debug(ps, depth, desc, "sec_io_desc_buf"); depth++; - prs_align(ps); - - prs_uint32_pre("max_len", ps, depth, &(sec->max_len), &off_max_len); - prs_uint32("undoc ", ps, depth, &(sec->undoc)); - prs_uint32_pre("len ", ps, depth, &(sec->len), &off_len); + if(!prs_align(ps)) + return False; + + if(!prs_uint32_pre("max_len", ps, depth, &psdb->max_len, &off_max_len)) + return False; - old_offset = prs_offset(ps); + if(!prs_uint32 ("undoc ", ps, depth, &psdb->undoc)) + return False; - if (sec->len != 0 && ps->io) - { - /* reading */ - sec->sec = (SEC_DESC *) malloc(sizeof(*sec->sec)); - ZERO_STRUCTP(sec->sec); + if(!prs_uint32_pre("len ", ps, depth, &psdb->len, &off_len)) + return False; - if (sec->sec == NULL) - { - DEBUG(0, ("INVALID SEC_DESC\n")); - prs_set_offset(ps, 0xfffffffe); - return False; - } - } + old_offset = prs_offset(ps); /* reading, length is non-zero; writing, descriptor is non-NULL */ - if ((sec->len != 0 || (!ps->io)) && sec->sec != NULL) - { - sec_io_desc("sec ", sec->sec, ps, depth); + if ((psdb->len != 0 || MARSHALLING(ps)) && psdb->sec != NULL) { + if(!sec_io_desc("sec ", &psdb->sec, ps, depth)) + return False; } - prs_align(ps); - - size = prs_offset(ps) - old_offset - 8; - prs_uint32_post("max_len", ps, depth, &(sec->max_len), off_max_len, - size == 0 ? sec->max_len : size + 8); - prs_uint32_post("len ", ps, depth, &(sec->len), off_len, - size == 0 ? 0 : size + 8); + if(!prs_align(ps)) + return False; + + size = prs_offset(ps) - old_offset; + if(!prs_uint32_post("max_len", ps, depth, &psdb->max_len, off_max_len, size == 0 ? psdb->max_len : size)) + return False; - if(!prs_set_offset(ps, old_offset + size + 8)) + if(!prs_uint32_post("len ", ps, depth, &psdb->len, off_len, size)) return False; return True; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 2c562219ba..db86695365 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1541,10 +1541,7 @@ static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, prs_set_offset(ps, buffer->string_at_end + buffer->struct_start); /* read the sd */ - *secdesc = g_new(SEC_DESC, 1); - if (*secdesc == NULL) - return False; - if (!sec_io_desc(desc, *secdesc, ps, depth)) + if (!sec_io_desc(desc, secdesc, ps, depth)) return False; prs_set_offset(ps, old_offset); @@ -4747,8 +4744,7 @@ BOOL spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int de void free_devmode(DEVICEMODE *devmode) { - if (devmode!=NULL) - { + if (devmode!=NULL) { if (devmode->private!=NULL) free(devmode->private); free(devmode); @@ -4757,25 +4753,20 @@ void free_devmode(DEVICEMODE *devmode) void free_printer_info_3(PRINTER_INFO_3 *printer) { - if (printer!=NULL) - { - free_sec_desc(&printer->sec); + if (printer!=NULL) { + if (printer->sec != NULL) + free_sec_desc(&printer->sec); free(printer); } } void free_printer_info_2(PRINTER_INFO_2 *printer) { - if (printer!=NULL) - { + if (printer!=NULL) { free_devmode(printer->devmode); printer->devmode = NULL; if (printer->secdesc != NULL) - { - free_sec_desc(printer->secdesc); - free(printer->secdesc); - printer->secdesc = NULL; - } + free_sec_desc(&printer->secdesc); free(printer); } } @@ -4783,16 +4774,11 @@ void free_printer_info_2(PRINTER_INFO_2 *printer) static PRINTER_INFO_2 *prt2_dup(const PRINTER_INFO_2* from) { PRINTER_INFO_2 *copy = (PRINTER_INFO_2 *)malloc(sizeof(PRINTER_INFO_2)); - if (copy != NULL) - { + if (copy != NULL) { if (from != NULL) - { memcpy(copy, from, sizeof(*copy)); - } else - { ZERO_STRUCTP(copy); - } } return copy; } -- cgit From 61ab5b46cfb93939651b4426016845a035315bf7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 1 Jun 2000 18:17:22 +0000 Subject: Back to building. Now to test with insure. Added some frees needed to stop memory leaks. Jeremy. (This used to be commit eba31e4e802120c9eb8c4688f521b4de9cb91f5c) --- source3/rpc_parse/parse_dfs.c | 8 ++-- source3/rpc_parse/parse_misc.c | 2 +- source3/rpc_parse/parse_sec.c | 37 +++++++++++++++---- source3/rpc_parse/parse_spoolss.c | 78 ++++++++++++++------------------------- 4 files changed, 62 insertions(+), 63 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index 71e866e59a..31ca53a850 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -281,7 +281,7 @@ BOOL dfs_io_dfs_info_ctr(char* desc, DFS_INFO_CTR* ctr, uint32 num_entries, depth++; /* should depend on whether marshalling or unmarshalling! */ if(UNMARSHALLING(ps)) - ctr->dfs.info1 = g_new0(DFS_INFO_1, num_entries); + ctr->dfs.info1 = (DFS_INFO_1 *)malloc(sizeof(DFS_INFO_1)*num_entries); for(i=0;idfs.info2 = g_new0(DFS_INFO_2, num_entries); + ctr->dfs.info2 = (DFS_INFO_2 *)calloc(num_entries, sizeof(DFS_INFO_2)); for(i=0;idfs.info3 = g_new0(DFS_INFO_3, num_entries); + ctr->dfs.info3 = (DFS_INFO_3 *)calloc(num_entries, sizeof(DFS_INFO_3)); for(i=0;istorages = g_new0(DFS_STORAGE_INFO, info3->num_storage_infos); + info3->storages = (DFS_STORAGE_INFO *)calloc(info3->num_storage_infos, sizeof(DFS_STORAGE_INFO)); for(i=0;inum_storage_infos;i++) { diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 935d83cafa..da2aa4450e 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -686,7 +686,7 @@ BOOL smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, in creates a UNISTR2 structure: sets up the buffer, too ********************************************************************/ -void init_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf) +void init_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf) { if (buf != NULL) { diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 76e246ca9e..2aba894834 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -250,18 +250,41 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) return True; } +/******************************************************************* + Works out the linearization size of a SEC_DESC. +********************************************************************/ + +size_t sec_desc_size(SEC_DESC *psd) +{ + size_t offset = SD_HEADER_SIZE; + + if (psd->owner_sid != NULL) + offset += ((sid_size(psd->owner_sid) + 3) & ~3); + + if (psd->grp_sid != NULL) + offset += ((sid_size(psd->grp_sid) + 3) & ~3); + + if (psd->sacl != NULL) + offset += ((psd->sacl->size + 3) & ~3); + + if (psd->dacl != NULL) + offset += ((psd->dacl->size + 3) & ~3); + + return offset; +} + /******************************************************************* Creates a SEC_DESC structure ********************************************************************/ SEC_DESC *make_sec_desc(uint16 revision, uint16 type, DOM_SID *owner_sid, DOM_SID *grp_sid, - SEC_ACL *sacl, SEC_ACL *dacl, size_t *sec_desc_size) + SEC_ACL *sacl, SEC_ACL *dacl, size_t *sd_size) { SEC_DESC *dst; uint32 offset; - *sec_desc_size = 0; + *sd_size = 0; if(( dst = (SEC_DESC *)malloc(sizeof(SEC_DESC))) == NULL) return NULL; @@ -288,7 +311,7 @@ SEC_DESC *make_sec_desc(uint16 revision, uint16 type, if(dacl && ((dst->dacl = dup_sec_acl(dacl)) == NULL)) goto error_exit; - offset = 0x0; + offset = 0; /* * Work out the linearization sizes. @@ -330,12 +353,12 @@ SEC_DESC *make_sec_desc(uint16 revision, uint16 type, offset += ((dacl->size + 3) & ~3); } - *sec_desc_size = (size_t)((offset == 0) ? SD_HEADER_SIZE : offset); + *sd_size = (size_t)((offset == 0) ? SD_HEADER_SIZE : offset); return dst; error_exit: - *sec_desc_size = 0; + *sd_size = 0; free_sec_desc(&dst); return NULL; } @@ -382,10 +405,10 @@ void free_sec_desc(SEC_DESC **ppsd) ********************************************************************/ SEC_DESC *make_standard_sec_desc(DOM_SID *owner_sid, DOM_SID *grp_sid, - SEC_ACL *dacl, size_t *sec_desc_size) + SEC_ACL *dacl, size_t *sd_size) { return make_sec_desc(1, SEC_DESC_SELF_RELATIVE|SEC_DESC_DACL_PRESENT, - owner_sid, grp_sid, NULL, dacl, sec_desc_size); + owner_sid, grp_sid, NULL, dacl, sd_size); } diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index db86695365..2565439a21 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -775,26 +775,6 @@ BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_ return True; } -/******************************************************************* - * make a structure. - ********************************************************************/ -BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, - const POLICY_HND *handle, - const UNISTR2 *valuename, - uint32 size) -{ - int len_name = valuename != NULL ? strlen(valuename) : 0; - - if (q_u == NULL) return False; - - DEBUG(5,("make_spoolss_q_getprinterdata\n")); - - q_u->handle = *handle; - init_unistr2(&(q_u->valuename), valuename, len_name); - q_u->size = size; - - return True; -} /******************************************************************* * read a structure. @@ -1299,14 +1279,6 @@ static uint32 size_of_relative_string(UNISTR *string) return size; } -/******************************************************************* - * return the length of a uint32 + sec desc - ********************************************************************/ -static uint32 size_of_sec_desc(SEC_DESC *sec) -{ - return 4+1024; -} - /******************************************************************* * return the length of a uint32 (obvious, but the code is clean) ********************************************************************/ @@ -1518,7 +1490,7 @@ static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, prs_set_offset(ps, buffer->string_at_end); /* write the secdesc */ - if (!sec_io_desc(desc, *secdesc, ps, depth)) + if (!sec_io_desc(desc, secdesc, ps, depth)) return False; prs_set_offset(ps, struct_offset); @@ -1801,7 +1773,7 @@ BOOL new_smb_io_printer_info_3(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *i if (!prs_uint32("flags", ps, depth, &info->flags)) return False; - if (!sec_io_desc("sec_desc", &info->sec, ps, depth)) + if (!sec_io_desc("sec_desc", &info->secdesc, ps, depth)) return False; return True; @@ -2350,10 +2322,10 @@ uint32 spoolss_size_printer_info_1(PRINTER_INFO_1 *info) { int size=0; - size+=size_of_uint32( &(info->flags) ); - size+=size_of_relative_string( &(info->description) ); - size+=size_of_relative_string( &(info->name) ); - size+=size_of_relative_string( &(info->comment) ); + size+=size_of_uint32( &info->flags ); + size+=size_of_relative_string( &info->description ); + size+=size_of_relative_string( &info->name ); + size+=size_of_relative_string( &info->comment ); return size; } @@ -2363,9 +2335,10 @@ return the size required by a struct in the stream ********************************************************************/ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) { - int size=0; + uint32 size=0; - size += size_of_sec_desc( info->secdesc ); + size += 4; + size += sec_desc_size( info->secdesc ); size+=size_of_device_mode( info->devmode ); @@ -2398,11 +2371,8 @@ return the size required by a struct in the stream ********************************************************************/ uint32 spoolss_size_printer_info_3(PRINTER_INFO_3 *info) { - /* well, we don't actually *know* the damn size of the - * security descriptor. spoolss is a stupidly designed - * api. - */ - return size_of_sec_desc( &info->sec ); + /* The 4 is for the self relative pointer.. */ + return 4 + (uint32)sec_desc_size( info->secdesc ); } /******************************************************************* @@ -2642,9 +2612,7 @@ BOOL make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u, NEW_BUFFER *buffer, uint32 offered) { if (q_u == NULL) - { return False; - } memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); @@ -2906,7 +2874,18 @@ BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps } /******************************************************************* + Delete the dynamic parts of a SPOOL_Q_SETPRINTE struct. ********************************************************************/ + +void free_spoolss_q_setprinter(SPOOL_Q_SETPRINTER *q_u) +{ + free_sec_desc_buf( &q_u->secdesc_ctr ); +} + +/******************************************************************* + Marshall/unmarshall a SPOOL_Q_SETPRINTER struct. +********************************************************************/ + BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth) { uint32 ptr_sec_desc = 0; @@ -3538,8 +3517,7 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s case 1: { if (UNMARSHALLING(ps)) { - il->info_1=g_new(SPOOL_PRINTER_INFO_LEVEL_1, 1); - if(il->info_1 == NULL) + if ((il->info_1=(SPOOL_PRINTER_INFO_LEVEL_1 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_1))) == NULL) return False; } if (!spool_io_printer_info_level_1("", il->info_1, ps, depth)) @@ -3548,8 +3526,7 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s } case 2: if (UNMARSHALLING(ps)) { - il->info_2=g_new(SPOOL_PRINTER_INFO_LEVEL_2, 1); - if(il->info_2 == NULL) + if ((il->info_2=(SPOOL_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2))) == NULL) return False; } if (!spool_io_printer_info_level_2("", il->info_2, ps, depth)) @@ -3558,8 +3535,7 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s case 3: { if (UNMARSHALLING(ps)) { - il->info_3=g_new(SPOOL_PRINTER_INFO_LEVEL_3, 1); - if(il->info_3 == NULL) + if ((il->info_3=(SPOOL_PRINTER_INFO_LEVEL_3 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_3))) == NULL) return False; } if (!spool_io_printer_info_level_3("", il->info_3, ps, depth)) @@ -4754,8 +4730,8 @@ void free_devmode(DEVICEMODE *devmode) void free_printer_info_3(PRINTER_INFO_3 *printer) { if (printer!=NULL) { - if (printer->sec != NULL) - free_sec_desc(&printer->sec); + if (printer->secdesc != NULL) + free_sec_desc(&printer->secdesc); free(printer); } } -- cgit From 8ff6458a3e568e759969fd1a9c827c4b47008cfb Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 1 Jun 2000 21:52:49 +0000 Subject: More insure found memory leak and corruption fixes. Jeremy. (This used to be commit 3cdcfa6325b9cd2d7f7c90c4b2d1c6ec73fc2f6d) --- source3/rpc_parse/parse_misc.c | 9 +++++++ source3/rpc_parse/parse_spoolss.c | 54 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 60 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index da2aa4450e..fe2778a356 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -617,6 +617,15 @@ BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) return True; } +/******************************************************************* + Frees a BUFFER5 structure (just the malloced part). +********************************************************************/ + +void free_buffer5(BUFFER5 *buf5) +{ + safe_free(buf5->buffer); +} + /******************************************************************* Inits a BUFFER2 structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 2565439a21..5ed7ce2460 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3691,11 +3691,22 @@ BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_ return False; if (il->dependentfiles_ptr) - smb_io_buffer5("", &(il->dependentfiles), ps, depth); + smb_io_buffer5("", &il->dependentfiles, ps, depth); return True; } +void free_spool_printer_driver_info_level_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u) +{ + SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *il = *q_u; + + if (il == NULL) + return; + + free_buffer5(&il->dependentfiles); + + safe_free(q_u); +} /******************************************************************* parse a SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure @@ -3836,6 +3847,19 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ return True; } +void free_spool_printer_driver_info_level_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u) +{ + SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *il = *q_u; + + if (il == NULL) + return; + + free_buffer5(&il->dependentfiles); + free_buffer5(&il->previousnames); + + safe_free(q_u); +} + /******************************************************************* convert a buffer of UNICODE strings null terminated @@ -3908,11 +3932,11 @@ BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LE switch (il->level) { case 3: - if(!spool_io_printer_driver_info_level_3("", &(il->info_3), ps, depth)) + if(!spool_io_printer_driver_info_level_3("", &il->info_3, ps, depth)) return False; break; case 6: - if(!spool_io_printer_driver_info_level_6("", &(il->info_6), ps, depth)) + if(!spool_io_printer_driver_info_level_6("", &il->info_6, ps, depth)) return False; break; default: @@ -3922,6 +3946,21 @@ BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LE return True; } +void free_spool_printer_driver_info_level(SPOOL_PRINTER_DRIVER_INFO_LEVEL *il) +{ + if (il->ptr==0) + return; + + switch (il->level) { + case 3: + free_spool_printer_driver_info_level_3(&il->info_3); + break; + case 6: + free_spool_printer_driver_info_level_6(&il->info_6); + break; + } +} + /******************************************************************* ********************************************************************/ BOOL spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) @@ -3948,6 +3987,15 @@ BOOL spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, pr return True; } +/******************************************************************* + Free the dynamic parts of a printer driver. +********************************************************************/ + +void free_spoolss_q_addprinterdriver(SPOOL_Q_ADDPRINTERDRIVER *q_u) +{ + free_spool_printer_driver_info_level(&q_u->info); +} + /******************************************************************* ********************************************************************/ BOOL spoolss_io_r_addprinterdriver(char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) -- cgit From 01c4ecd2343a4c87a0f023cd58382bf08610304e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 2 Jun 2000 18:38:49 +0000 Subject: Fixed null pointer indirect in addprinterex. Still working on problem with extra directory layer in NT drivers. Jeremy. (This used to be commit 48a80318269c832e702678237e86ba55c10444f1) --- source3/rpc_parse/parse_spoolss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 5ed7ce2460..e81f0c286f 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3705,7 +3705,7 @@ void free_spool_printer_driver_info_level_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 ** free_buffer5(&il->dependentfiles); - safe_free(q_u); + safe_free(il); } /******************************************************************* @@ -3857,7 +3857,7 @@ void free_spool_printer_driver_info_level_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 ** free_buffer5(&il->dependentfiles); free_buffer5(&il->previousnames); - safe_free(q_u); + safe_free(il); } -- cgit From 0cc138993573a8337c335563ba3c5936d260f298 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 2 Jun 2000 21:16:39 +0000 Subject: More memory leak and PANIC action fixes. This is *horrible* code :-(. Jeremy. (This used to be commit ac383bb765ea606fc1105aa91470fcdf453d9335) --- source3/rpc_parse/parse_prs.c | 3 ++ source3/rpc_parse/parse_spoolss.c | 97 ++++++++++++++++++++++++++++----------- 2 files changed, 72 insertions(+), 28 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 422b420a3c..0e057e9403 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -232,6 +232,9 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) if ((new_data = Realloc(ps->data_p, new_size)) == NULL) { DEBUG(0,("prs_grow: Realloc failure for size %u.\n", (unsigned int)new_size)); + /* JRATEST */ + smb_panic("prs_grow: ralloc fail\n"); + /* JRATEST */ return False; } diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index e81f0c286f..55bfd4fe57 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -270,12 +270,12 @@ static BOOL smb_io_notify_option_type_ctr(char *desc, SPOOL_NOTIFY_OPTION_TYPE_C /* the option type struct */ for(i=0;icount;i++) - if(!smb_io_notify_option_type("", &(ctr->type[i]) , ps, depth)) + if(!smb_io_notify_option_type("", &ctr->type[i] , ps, depth)) return False; /* the type associated with the option type struct */ for(i=0;icount;i++) - if(!smb_io_notify_option_type_data("", &(ctr->type[i]) , ps, depth)) + if(!smb_io_notify_option_type_data("", &ctr->type[i] , ps, depth)) return False; return True; @@ -1473,20 +1473,20 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, SEC_DESC **secdesc) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps= &buffer->prs; prs_debug(ps, depth, desc, "new_smb_io_relsecdesc"); depth++; - if (MARSHALLING(ps)) - { + if (MARSHALLING(ps)) { uint32 struct_offset = prs_offset(ps); uint32 relative_offset; - if (*secdesc != NULL) - { - buffer->string_at_end -= 256; /* HACK! */ - + if (*secdesc != NULL) { +#if 0 /* JRA */ + buffer->string_at_end -= 256; /* HACK! */ +#endif + prs_set_offset(ps, buffer->string_at_end); /* write the secdesc */ @@ -1500,9 +1500,7 @@ static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, /* write its offset */ if (!prs_uint32("offset", ps, depth, &relative_offset)) return False; - } - else - { + } else { uint32 old_offset; /* read the offset */ @@ -2874,12 +2872,14 @@ BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps } /******************************************************************* - Delete the dynamic parts of a SPOOL_Q_SETPRINTE struct. + Delete the dynamic parts of a SPOOL_Q_SETPRINTER struct. ********************************************************************/ void free_spoolss_q_setprinter(SPOOL_Q_SETPRINTER *q_u) { + free_spool_printer_info_level(&q_u->info); free_sec_desc_buf( &q_u->secdesc_ctr ); + free_devmode( q_u->devmode_ctr.devmode ); } /******************************************************************* @@ -3519,6 +3519,7 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s if (UNMARSHALLING(ps)) { if ((il->info_1=(SPOOL_PRINTER_INFO_LEVEL_1 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_1))) == NULL) return False; + ZERO_STRUCTP(il->info_1); } if (!spool_io_printer_info_level_1("", il->info_1, ps, depth)) return False; @@ -3528,6 +3529,7 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s if (UNMARSHALLING(ps)) { if ((il->info_2=(SPOOL_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2))) == NULL) return False; + ZERO_STRUCTP(il->info_2); } if (!spool_io_printer_info_level_2("", il->info_2, ps, depth)) return False; @@ -3537,6 +3539,7 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s if (UNMARSHALLING(ps)) { if ((il->info_3=(SPOOL_PRINTER_INFO_LEVEL_3 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_3))) == NULL) return False; + ZERO_STRUCTP(il->info_3); } if (!spool_io_printer_info_level_3("", il->info_3, ps, depth)) return False; @@ -4769,29 +4772,72 @@ BOOL spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int de void free_devmode(DEVICEMODE *devmode) { if (devmode!=NULL) { - if (devmode->private!=NULL) - free(devmode->private); - free(devmode); + safe_free(devmode->private); + safe_free(devmode); } } -void free_printer_info_3(PRINTER_INFO_3 *printer) +void free_printer_info_1(PRINTER_INFO_1 *printer) +{ + safe_free(printer); +} + +void free_printer_info_2(PRINTER_INFO_2 *printer) { if (printer!=NULL) { + free_devmode(printer->devmode); + printer->devmode = NULL; if (printer->secdesc != NULL) free_sec_desc(&printer->secdesc); - free(printer); + safe_free(printer); } } -void free_printer_info_2(PRINTER_INFO_2 *printer) +void free_printer_info_3(PRINTER_INFO_3 *printer) { if (printer!=NULL) { - free_devmode(printer->devmode); - printer->devmode = NULL; if (printer->secdesc != NULL) free_sec_desc(&printer->secdesc); - free(printer); + safe_free(printer); + } +} + +void free_spool_printer_info_1(SPOOL_PRINTER_INFO_LEVEL_1 *printer) +{ + safe_free(printer); +} + +void free_spool_printer_info_2(SPOOL_PRINTER_INFO_LEVEL_2 *printer) +{ + if (printer!=NULL) { + if (printer->secdesc != NULL) + free_sec_desc_buf(&printer->secdesc); + safe_free(printer); + } +} + +void free_spool_printer_info_3(SPOOL_PRINTER_INFO_LEVEL_3 *printer) +{ + safe_free(printer); +} + +void free_spool_printer_info_level(SPOOL_PRINTER_INFO_LEVEL *pil) +{ + if (pil == NULL) + return; + + switch (pil->level) { + case 1: + free_spool_printer_info_1(pil->info_1); + break; + case 2: + free_spool_printer_info_2(pil->info_2); + break; + case 3: + free_spool_printer_info_3(pil->info_3); + break; + default: + break; } } @@ -4824,16 +4870,11 @@ PRINTER_INFO_2 *add_print2_to_array(uint32 *len, PRINTER_INFO_2 ***array, static PRINTER_INFO_1 *prt1_dup(const PRINTER_INFO_1* from) { PRINTER_INFO_1 *copy = (PRINTER_INFO_1 *)malloc(sizeof(PRINTER_INFO_1)); - if (copy != NULL) - { + if (copy != NULL) { if (from != NULL) - { memcpy(copy, from, sizeof(*copy)); - } else - { ZERO_STRUCTP(copy); - } } return copy; } -- cgit From 3ca34cc49f41aa2fd7c9d5ecb7264d48b5c2c0a6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 4 Jun 2000 23:34:11 +0000 Subject: sec_desc_size() needs to handle a null secdesc (This used to be commit b152d75ea677d4025dcaaf3ae9009db0979dc402) --- source3/rpc_parse/parse_sec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 2aba894834..51cf52f706 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -256,7 +256,11 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) size_t sec_desc_size(SEC_DESC *psd) { - size_t offset = SD_HEADER_SIZE; + size_t offset; + + if (!psd) return 0; + + offset = SD_HEADER_SIZE; if (psd->owner_sid != NULL) offset += ((sid_size(psd->owner_sid) + 3) & ~3); @@ -411,7 +415,6 @@ SEC_DESC *make_standard_sec_desc(DOM_SID *owner_sid, DOM_SID *grp_sid, owner_sid, grp_sid, NULL, dacl, sd_size); } - /******************************************************************* Reads or writes a SEC_DESC structure. If reading and the *ppsd = NULL, allocates the structure. -- cgit From d48c727c97becb44da15211152fc702e1978622e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 4 Jun 2000 23:34:55 +0000 Subject: no space was being reserved for the security descriptor in the parse buffer (This used to be commit 417a88fc6a8406ad4244e8cc1317cb7163b07cc0) --- source3/rpc_parse/parse_spoolss.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 55bfd4fe57..34d77f132a 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1481,11 +1481,16 @@ static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, if (MARSHALLING(ps)) { uint32 struct_offset = prs_offset(ps); uint32 relative_offset; + + if (! *secdesc) { + relative_offset = 0; + if (!prs_uint32("offset", ps, depth, &relative_offset)) + return False; + return True; + } if (*secdesc != NULL) { -#if 0 /* JRA */ - buffer->string_at_end -= 256; /* HACK! */ -#endif + buffer->string_at_end -= sec_desc_size(*secdesc); prs_set_offset(ps, buffer->string_at_end); -- cgit From f87246df627f0d940b45f65f812c0c77a2dfa355 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 5 Jun 2000 14:06:13 +0000 Subject: simple increment bug in uniarray_2_dosarray (This used to be commit 6506e6f47085beeaa6588a361a220ab21fc32aa6) --- source3/rpc_parse/parse_spoolss.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 34d77f132a..2e6f8ba590 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3894,6 +3894,7 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) src = skip_unibuf(src, 2*buf5->buf_len - PTR_DIFF(src,buf5->buffer)); *ar = (fstring *)Realloc(*ar, sizeof(fstring)*(n+2)); fstrcpy((*ar)[n], f); + n++; } fstrcpy((*ar)[n], ""); -- cgit From 6d8c131f50e708d4c009355a7c5fe026cf8d350a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 5 Jun 2000 20:55:57 +0000 Subject: Some tidyup fixes (memory leaks etc.). Still no progress with the "no driver" issue. I'm banging my head against comparitive packet dumps right now... Jeremy. (This used to be commit 03cd4aa1443acd958593f37c61ff9c90a43c660b) --- source3/rpc_parse/parse_prs.c | 6 +++--- source3/rpc_parse/parse_spoolss.c | 19 ++++++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 0e057e9403..d277182043 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -232,9 +232,6 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) if ((new_data = Realloc(ps->data_p, new_size)) == NULL) { DEBUG(0,("prs_grow: Realloc failure for size %u.\n", (unsigned int)new_size)); - /* JRATEST */ - smb_panic("prs_grow: ralloc fail\n"); - /* JRATEST */ return False; } @@ -343,6 +340,9 @@ BOOL prs_append_prs_data(prs_struct *dst, prs_struct *src) BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uint32 len) { + if (len == 0) + return True; + if(!prs_grow(dst, len)) return False; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 2e6f8ba590..4530f638bc 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1529,7 +1529,7 @@ static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, ********************************************************************/ static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEVICEMODE **devmode) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "new_smb_io_reldevmode"); depth++; @@ -2022,7 +2022,7 @@ static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUF prs_debug(ps, depth, desc, "new_spoolss_io_buffer"); depth++; - if (!prs_uint32("ptr", ps, depth, &(buffer->ptr))) + if (!prs_uint32("ptr", ps, depth, &buffer->ptr)) return False; /* reading */ @@ -2031,7 +2031,7 @@ static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUF buffer->string_at_end=0; if (buffer->ptr==0) { - if (!prs_init(&(buffer->prs), 0, 4, UNMARSHALL)) + if (!prs_init(&buffer->prs, 0, 4, UNMARSHALL)) return False; return True; } @@ -2039,10 +2039,10 @@ static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUF if (!prs_uint32("size", ps, depth, &buffer->size)) return False; - if (!prs_init(&(buffer->prs), buffer->size, 4, UNMARSHALL)) + if (!prs_init(&buffer->prs, buffer->size, 4, UNMARSHALL)) return False; - if (!prs_append_some_prs_data(&(buffer->prs), ps, prs_offset(ps), buffer->size)) + if (!prs_append_some_prs_data(&buffer->prs, ps, prs_offset(ps), buffer->size)) return False; if (!prs_set_offset(&buffer->prs, 0)) @@ -2060,9 +2060,9 @@ static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUF if (buffer->ptr==0) return True; - if (!prs_uint32("size", ps, depth, &(buffer->size))) + if (!prs_uint32("size", ps, depth, &buffer->size)) return False; - if (!prs_append_some_prs_data(ps, &(buffer->prs), 0, buffer->size)) + if (!prs_append_some_prs_data(ps, &buffer->prs, 0, buffer->size)) return False; return True; @@ -4543,6 +4543,11 @@ BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_st return True; } +void free_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u) +{ + safe_free(q_u->data); +} + /******************************************************************* ********************************************************************/ BOOL spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_struct *ps, int depth) -- cgit From d253db1b9a10644940650cc802feb2a509adbaed Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 6 Jun 2000 20:44:58 +0000 Subject: Memory leak fixes. Jeremy. (This used to be commit 34b63896ab1543936d6b9b382ef6727a161b6bf2) --- source3/rpc_parse/parse_spoolss.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 4530f638bc..ea8aa42a45 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -605,6 +605,15 @@ static BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE return True; } +void free_spoolss_devmode(DEVICEMODE *devmode) +{ + if (devmode == NULL) + return; + + safe_free(devmode->private); + safe_free(devmode); +} + /******************************************************************* Read or write a DEVICEMODE container ********************************************************************/ @@ -752,6 +761,11 @@ BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_ return True; } +void free_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u) +{ + free_spoolss_devmode(q_u->printer_default.devmode_cont.devmode); +} + /******************************************************************* * write a structure. * called from static spoolss_r_open_printer_ex (srv_spoolss.c) -- cgit From 0164047afbd082b0003147845a72ca08b4781b81 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 7 Jun 2000 01:49:23 +0000 Subject: Fixing get/set of security descriptors. Removed ugly hack for NT printing. Fixed up tdb parse stuff memory leaks. Jeremy. (This used to be commit 8ef41f31c53e14ad057d883810a1cd2301fede2a) --- source3/rpc_parse/parse_prs.c | 3 +++ source3/rpc_parse/parse_sec.c | 17 +++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index d277182043..b7fe19f9ab 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -201,6 +201,9 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) if(UNMARSHALLING(ps) || !ps->is_dynamic) { DEBUG(0,("prs_grow: Buffer overflow - unable to expand buffer by %u bytes.\n", (unsigned int)extra_space)); + /* JRATEST */ + smb_panic("prs_grow"); + /* JRATEST */ return False; } diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 51cf52f706..25450e0b19 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -431,11 +431,16 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) psd = *ppsd; - if(UNMARSHALLING(ps) && psd == NULL) { - if((psd = (SEC_DESC *)malloc(sizeof(SEC_DESC))) == NULL) - return False; - ZERO_STRUCTP(psd); - *ppsd = psd; + if (psd == NULL) { + if(UNMARSHALLING(ps)) { + if((psd = (SEC_DESC *)malloc(sizeof(SEC_DESC))) == NULL) + return False; + ZERO_STRUCTP(psd); + *ppsd = psd; + } else { + /* Marshalling - just ignore. */ + return True; + } } prs_debug(ps, depth, desc, "sec_io_desc"); @@ -629,7 +634,7 @@ BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth old_offset = prs_offset(ps); /* reading, length is non-zero; writing, descriptor is non-NULL */ - if ((psdb->len != 0 || MARSHALLING(ps)) && psdb->sec != NULL) { + if ((UNMARSHALLING(ps) && psdb->len != 0) || (MARSHALLING(ps) && psdb->sec != NULL)) { if(!sec_io_desc("sec ", &psdb->sec, ps, depth)) return False; } -- cgit From b2eef912cfaf768fd26b3b2acbcfc0be2951a197 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 8 Jun 2000 00:17:05 +0000 Subject: Cause printer SD's to be displayed correctly (full control). Jeremy. (This used to be commit 341d07c516865bdd9be99f98cd0754d12b25f9c0) --- source3/rpc_parse/parse_sec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 25450e0b19..4a7db6d7c2 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -411,7 +411,7 @@ void free_sec_desc(SEC_DESC **ppsd) SEC_DESC *make_standard_sec_desc(DOM_SID *owner_sid, DOM_SID *grp_sid, SEC_ACL *dacl, size_t *sd_size) { - return make_sec_desc(1, SEC_DESC_SELF_RELATIVE|SEC_DESC_DACL_PRESENT, + return make_sec_desc(SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE|SEC_DESC_DACL_PRESENT, owner_sid, grp_sid, NULL, dacl, sd_size); } -- cgit From 6d38ba721ce57a9a574b5f0c24621df3dfcd0738 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 8 Jun 2000 01:16:42 +0000 Subject: Moved tdb functions that access parse structs into parse_prs.c to prevent builkd breaking. Jeremy. (This used to be commit 6c7adeab0f92844ecefbcb923d0d4763d4c3eaa5) --- source3/rpc_parse/parse_prs.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index b7fe19f9ab..b6bedac536 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -807,3 +807,31 @@ BOOL prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32, } return True; } + +/* useful function to store a structure in rpc wire format */ +int tdb_prs_store(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps) +{ + TDB_DATA kbuf, dbuf; + kbuf.dptr = keystr; + kbuf.dsize = strlen(keystr)+1; + dbuf.dptr = prs_data_p(ps); + dbuf.dsize = prs_offset(ps); + return tdb_store(tdb, kbuf, dbuf, TDB_REPLACE); +} + +/* useful function to fetch a structure into rpc wire format */ +int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps) +{ + TDB_DATA kbuf, dbuf; + kbuf.dptr = keystr; + kbuf.dsize = strlen(keystr)+1; + + dbuf = tdb_fetch(tdb, kbuf); + if (!dbuf.dptr) return -1; + + ZERO_STRUCTP(ps); + prs_init(ps, 0, 4, UNMARSHALL); + prs_give_memory(ps, dbuf.dptr, dbuf.dsize, True); + + return 0; +} -- cgit From ad98207f54a7e3d88108d34c4cf365d5f8bc23ef Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 9 Jun 2000 03:00:34 +0000 Subject: dynamic allocation of NET_USER_INFO_3 gids. jeremy, the intent is to call se_access_check() with usr-sid, grp-sid, array-of-group-rids (but array-of-group-sids would do). please do look at smbd/lanman.c's api_NetWkstaGetInfo, it will show you that we really do need to store the entire NET_USER_INFO_3 structure. then again, api_NetWkstaGetInfo is only used by win9x so who cares :) (This used to be commit bd34f652390adc32c4959d164c628687f526d977) --- source3/rpc_parse/parse_net.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 912e18600e..c1b16b8864 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1070,10 +1070,14 @@ void init_net_user_info3(NET_USER_INFO_3 *usr, usr->num_groups2 = num_groups; - SMB_ASSERT_ARRAY(usr->gids, num_groups); - - for (i = 0; i < num_groups; i++) - usr->gids[i] = gids[i]; + if (num_groups > 0) + { + usr->gids = g_new(DOM_GID, num_groups); + if (usr->gids == NULL) + return; + for (i = 0; i < num_groups; i++) + usr->gids[i] = gids[i]; + } init_unistr2(&usr->uni_logon_srv, logon_srv, len_logon_srv); init_unistr2(&usr->uni_logon_dom, logon_dom, len_logon_dom); @@ -1183,7 +1187,14 @@ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, return False; if(!prs_uint32("num_groups2 ", ps, depth, &usr->num_groups2)) /* num groups */ return False; - SMB_ASSERT_ARRAY(usr->gids, usr->num_groups2); + + if (UNMARSHALLING(ps) && usr->num_groups2 > 0) + { + usr->gids = g_new(DOM_GID, usr->num_groups2); + if (usr->gids == NULL) + return False; + } + for (i = 0; i < usr->num_groups2; i++) { if(!smb_io_gid("", &usr->gids[i], ps, depth)) /* group info */ return False; -- cgit From 03e0164270ffd7ceeb8df6f3cc3917c111dc05f8 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 9 Jun 2000 18:45:31 +0000 Subject: Luke, I am moving the code back into passdb/passdb.c, this the correct place to do this, not in smbd/passwd.c Please don't change this without asking first, I have run this past Andrew so talk to him (I'm on vacation next week). I also removed the g_newXXX macros. There are essentially a private C extension, not used anywhere else in the code, and add no functionality over malloc(XX) and make the code harder to understand (everyone knows what malloc does). Jeremy. (This used to be commit e1b1b6fb6794ba02e1fea510a981fa0ce0d12b58) --- source3/rpc_parse/parse_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index c1b16b8864..bcc8e876b5 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1072,7 +1072,7 @@ void init_net_user_info3(NET_USER_INFO_3 *usr, if (num_groups > 0) { - usr->gids = g_new(DOM_GID, num_groups); + usr->gids = (DOM_GID *)malloc(sizeof(DOM_GID) * num_groups); if (usr->gids == NULL) return; for (i = 0; i < num_groups; i++) @@ -1190,7 +1190,7 @@ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, if (UNMARSHALLING(ps) && usr->num_groups2 > 0) { - usr->gids = g_new(DOM_GID, usr->num_groups2); + usr->gids = (DOM_GID *)malloc(sizeof(DOM_GID)*usr->num_groups2); if (usr->gids == NULL) return False; } -- cgit From 4ec7597d1154c60f0f55feab93f2dc9c776d56f8 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Sat, 10 Jun 2000 22:35:52 +0000 Subject: parsing code for reply[open|close]printer in preparation of the event stuff. J.F. (This used to be commit 1871d4a3f64401f9a6f749ce26d1715e3bcdeac3) --- source3/rpc_parse/parse_spoolss.c | 87 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index ea8aa42a45..9e7d7501bb 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4989,3 +4989,90 @@ JOB_INFO_2 *add_job2_to_array(uint32 *len, JOB_INFO_2 ***array, (void***)array, (const void*)job, *fn, True); } +/******************************************************************* + Parse a SPOOL_Q_REPLYOPENPRINTER structure. +********************************************************************/ +BOOL spoolss_io_q_replyopenprinter(char *desc, SPOOL_Q_REPLYOPENPRINTER *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_replyopenprinter"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_unistr2("", &(q_u->string), True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("printer", ps, depth, &q_u->printer)) + return False; + if(!prs_uint32("type", ps, depth, &q_u->type)) + return False; + + if(!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + return False; + + return True; +} + +/******************************************************************* + Parse a SPOOL_R_REPLYOPENPRINTER structure. +********************************************************************/ +BOOL spoolss_io_r_replyopenprinter(char *desc, SPOOL_R_REPLYOPENPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_replyopenprinter"); + depth++; + + if (!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("printer handle",&(r_u->handle),ps,depth)) + return False; + + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; +} + +/******************************************************************* + Parse a SPOOL_Q_REPLYCLOSEPRINTER structure. +********************************************************************/ +BOOL spoolss_io_q_replycloseprinter(char *desc, SPOOL_Q_REPLYCLOSEPRINTER *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_replycloseprinter"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + return False; + + return True; +} + +/******************************************************************* + Parse a SPOOL_R_REPLYCLOSEPRINTER structure. +********************************************************************/ +BOOL spoolss_io_r_replycloseprinter(char *desc, SPOOL_R_REPLYCLOSEPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_replycloseprinter"); + depth++; + + if (!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("printer handle",&(r_u->handle),ps,depth)) + return False; + + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; +} + + + -- cgit From 69c75c8a165f05c01d13ba4eddbb970540e44b96 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 20 Jun 2000 23:58:56 +0000 Subject: Fixes for Win2k "add printer driver" INFO_LEVEL_6 was wrong, also some memory fixes. Jeremy. (This used to be commit 2a9e645cbddef1cddc5c978310b7efed492758d2) --- source3/rpc_parse/parse_spoolss.c | 47 ++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 25 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 9e7d7501bb..d5f3b1c7c8 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3759,8 +3759,6 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ /* parse the main elements the packet */ - if(!prs_uint32("dummy1", ps, depth, &il->dummy1)) - return False; if(!prs_uint32("version", ps, depth, &il->version)) return False; if(!prs_uint32("name_ptr", ps, depth, &il->name_ptr)) @@ -3836,18 +3834,18 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ return False; if(!prs_align(ps)) return False; - if (il->dependentfiles_ptr) { - if(!smb_io_buffer5("dependentfiles", &il->dependentfiles, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - } - if (il->previousnames_ptr) { - if(!smb_io_buffer5("previousnames", &il->previousnames, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - } + if (il->dependentfiles_ptr) { + if(!smb_io_buffer5("dependentfiles", &il->dependentfiles, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + } + if (il->previousnames_ptr) { + if(!smb_io_buffer5("previousnames", &il->previousnames, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + } if(!smb_io_unistr2("mfgname", &il->mfgname, il->mfgname_ptr, ps, depth)) return False; if(!prs_align(ps)) @@ -3865,7 +3863,6 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ if(!prs_align(ps)) return False; - return True; } @@ -4099,14 +4096,14 @@ BOOL uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni, d->version=uni->version; - unistr2_to_ascii(d->name, &(uni->name), sizeof(d->name)-1); - unistr2_to_ascii(d->environment, &(uni->environment), sizeof(d->environment)-1); - unistr2_to_ascii(d->driverpath, &(uni->driverpath), sizeof(d->driverpath)-1); - unistr2_to_ascii(d->datafile, &(uni->datafile), sizeof(d->datafile)-1); - unistr2_to_ascii(d->configfile, &(uni->configfile), sizeof(d->configfile)-1); - unistr2_to_ascii(d->helpfile, &(uni->helpfile), sizeof(d->helpfile)-1); - unistr2_to_ascii(d->monitorname, &(uni->monitorname), sizeof(d->monitorname)-1); - unistr2_to_ascii(d->defaultdatatype, &(uni->defaultdatatype), sizeof(d->defaultdatatype)-1); + unistr2_to_ascii(d->name, &uni->name, sizeof(d->name)-1); + unistr2_to_ascii(d->environment, &uni->environment, sizeof(d->environment)-1); + unistr2_to_ascii(d->driverpath, &uni->driverpath, sizeof(d->driverpath)-1); + unistr2_to_ascii(d->datafile, &uni->datafile, sizeof(d->datafile)-1); + unistr2_to_ascii(d->configfile, &uni->configfile, sizeof(d->configfile)-1); + unistr2_to_ascii(d->helpfile, &uni->helpfile, sizeof(d->helpfile)-1); + unistr2_to_ascii(d->monitorname, &uni->monitorname, sizeof(d->monitorname)-1); + unistr2_to_ascii(d->defaultdatatype, &uni->defaultdatatype, sizeof(d->defaultdatatype)-1); DEBUGADD(8,( "version: %d\n", d->version)); DEBUGADD(8,( "name: %s\n", d->name)); @@ -4118,8 +4115,8 @@ BOOL uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni, DEBUGADD(8,( "monitorname: %s\n", d->monitorname)); DEBUGADD(8,( "defaultdatatype: %s\n", d->defaultdatatype)); - uniarray_2_dosarray(&(uni->dependentfiles), &(d->dependentfiles) ); - uniarray_2_dosarray(&(uni->previousnames), &(d->previousnames) ); + uniarray_2_dosarray(&uni->dependentfiles, &d->dependentfiles ); + uniarray_2_dosarray(&uni->previousnames, &d->previousnames ); return True; } -- cgit From ec1c58fcc0dc19138fe04533484b8acffef2cf0f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 24 Jun 2000 00:15:08 +0000 Subject: lib/util_sid.c: Uninitialized memory read. rpc_parse/parse_spoolss.c: Added note about prs_align when marshalling a SEC_DESC... rpc_server/srv_lsa.c: Tim - your changes broke the display of the 'everyone' group when doing file access with no winbindd running. This is a partial fix - more when I have analysed this more. rpc_server/srv_spoolss_nt.c: Fix for the 'change driver' problem ! Hurrah ! Jeremy. (This used to be commit 151b131ee01ef916c072bcdaa9943a2e984a0f45) --- source3/rpc_parse/parse_spoolss.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index d5f3b1c7c8..86fee3017f 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1694,7 +1694,7 @@ BOOL new_smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *i ********************************************************************/ BOOL new_smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "new_smb_io_printer_info_1"); depth++; @@ -1718,7 +1718,7 @@ BOOL new_smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *i ********************************************************************/ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "new_smb_io_printer_info_2"); depth++; @@ -2355,6 +2355,7 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) uint32 size=0; size += 4; + /* JRA !!!! TESTME - WHAT ABOUT prs_align.... !!! */ size += sec_desc_size( info->secdesc ); size+=size_of_device_mode( info->devmode ); @@ -2389,6 +2390,7 @@ return the size required by a struct in the stream uint32 spoolss_size_printer_info_3(PRINTER_INFO_3 *info) { /* The 4 is for the self relative pointer.. */ + /* JRA !!!! TESTME - WHAT ABOUT prs_align.... !!! */ return 4 + (uint32)sec_desc_size( info->secdesc ); } -- cgit From 36fd3866efa89b5a537d4cb312e6a0d77ca9b89a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 26 Jun 2000 22:08:20 +0000 Subject: Changing drivers using the properties page works - but only if getting/setting security descriptors is disabled (as it is in this code). If get/set sd's is enabled spooler.exe crashes on NT. I'll investigate and fix that issue next. Jeremy. (This used to be commit 8c9ed874363e6a710bc0fe521bb8c4f7ee219587) --- source3/rpc_parse/parse_prs.c | 3 --- source3/rpc_parse/parse_spoolss.c | 5 ++--- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index b6bedac536..94a6100aa1 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -201,9 +201,6 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) if(UNMARSHALLING(ps) || !ps->is_dynamic) { DEBUG(0,("prs_grow: Buffer overflow - unable to expand buffer by %u bytes.\n", (unsigned int)extra_space)); - /* JRATEST */ - smb_panic("prs_grow"); - /* JRATEST */ return False; } diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 86fee3017f..7e01a379db 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1420,8 +1420,7 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui if(!prs_uint16("leading zero", ps, depth, &zero)) return False; - do - { + while (p && (*p!=0)) { while (*q!=0) q++; @@ -1437,7 +1436,7 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui q++; p=q; - } while (*p!=0); /* end on the last leading 0 */ + } prs_set_offset(ps, struct_offset); -- cgit From 8980d53e7ccd85769357c45183b8670123489fb5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 28 Jun 2000 16:52:59 +0000 Subject: Removed extra uint32 field in auto-notify reply. This fixes some spoolss.exe crashes but there are still more to work on. Jeremy. (This used to be commit aa49dc037fa4e7b00d1a33619da5450a4eda1b9e) --- source3/rpc_parse/parse_spoolss.c | 124 +++++++++++++++++++++++--------------- 1 file changed, 75 insertions(+), 49 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 7e01a379db..0c12623e47 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -326,8 +326,7 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs depth++; how_many_words=data->size; - if (how_many_words==POINTER) - { + if (how_many_words==POINTER) { how_many_words=TWO_VALUE; } @@ -335,30 +334,26 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs if(!prs_align(ps)) return False; - if(!prs_uint16("type", ps, depth, &(data->type))) + if(!prs_uint16("type", ps, depth, &data->type)) return False; - if(!prs_uint16("field", ps, depth, &(data->field))) + if(!prs_uint16("field", ps, depth, &data->field)) return False; /*prs_align(ps);*/ if(!prs_uint32("how many words", ps, depth, &how_many_words)) return False; - if(!prs_uint32("id", ps, depth, &(data->id))) - return False; - if(!prs_uint32("how many words", ps, depth, &how_many_words)) + if(!prs_uint32("id", ps, depth, &data->id)) return False; + /*prs_align(ps);*/ - if (isvalue==True) - { - if(!prs_uint32("value[0]", ps, depth, &(data->notify_data.value[0]))) + if (isvalue==True) { + if(!prs_uint32("value[0]", ps, depth, &data->notify_data.value[0])) return False; - if(!prs_uint32("value[1]", ps, depth, &(data->notify_data.value[1]))) + if(!prs_uint32("value[1]", ps, depth, &data->notify_data.value[1])) return False; /*prs_align(ps);*/ - } - else - { + } else { /* it's a string */ /* length in ascii including \0 */ x=2*(data->notify_data.data.length+1); @@ -389,8 +384,7 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, isvalue=data->enc_type; - if (isvalue==False) - { + if (isvalue==False) { /* length of string in unicode include \0 */ x=data->notify_data.data.length+1; if(!prs_uint32("string length", ps, depth, &x )) @@ -417,25 +411,23 @@ static BOOL smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, prs_struct * if(!prs_align(ps)) return False; - if(!prs_uint32("count", ps, depth, &(info->count))) + if(!prs_uint32("count", ps, depth, &info->count)) return False; - if(!prs_uint32("version", ps, depth, &(info->version))) + if(!prs_uint32("version", ps, depth, &info->version)) return False; - if(!prs_uint32("flags", ps, depth, &(info->flags))) + if(!prs_uint32("flags", ps, depth, &info->flags)) return False; - if(!prs_uint32("count", ps, depth, &(info->count))) + if(!prs_uint32("count", ps, depth, &info->count)) return False; - for (i=0;icount;i++) - { - if(!smb_io_notify_info_data(desc, &(info->data[i]), ps, depth)) + for (i=0;icount;i++) { + if(!smb_io_notify_info_data(desc, &info->data[i], ps, depth)) return False; } /* now do the strings at the end of the stream */ - for (i=0;icount;i++) - { - if(!smb_io_notify_info_data_strings(desc, &(info->data[i]), ps, depth)) + for (i=0;icount;i++) { + if(!smb_io_notify_info_data_strings(desc, &info->data[i], ps, depth)) return False; } @@ -1361,13 +1353,15 @@ static BOOL new_smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR uint32 relative_offset; buffer->string_at_end -= 2*(str_len_uni(string)+1); - prs_set_offset(ps, buffer->string_at_end); + if(!prs_set_offset(ps, buffer->string_at_end)) + return False; /* write the string */ if (!spoolss_smb_io_unistr(desc, string, ps, depth)) return False; - prs_set_offset(ps, struct_offset); + if(!prs_set_offset(ps, struct_offset)) + return False; relative_offset=buffer->string_at_end - buffer->struct_start; /* write its offset */ @@ -1382,13 +1376,15 @@ static BOOL new_smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR return False; old_offset = prs_offset(ps); - prs_set_offset(ps, buffer->string_at_end+buffer->struct_start); + if(!prs_set_offset(ps, buffer->string_at_end+buffer->struct_start)) + return False; /* read the string */ if (!spoolss_smb_io_unistr(desc, string, ps, depth)) return False; - prs_set_offset(ps, old_offset); + if(!prs_set_offset(ps, old_offset)) + return False; } return True; } @@ -1402,7 +1398,7 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui { UNISTR chaine; - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; if (MARSHALLING(ps)) { uint32 struct_offset = prs_offset(ps); @@ -1412,14 +1408,31 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui uint16 zero=0; p=*string; q=*string; + +#if 0 /* JRATEST */ + if (p == NULL) { + relative_offset = 0; + if (!prs_uint32("offset", ps, depth, &relative_offset)) + return False; + return True; + } +#endif /* first write the last 0 */ buffer->string_at_end -= 2; - prs_set_offset(ps, buffer->string_at_end); + if(!prs_set_offset(ps, buffer->string_at_end)) + return False; if(!prs_uint16("leading zero", ps, depth, &zero)) return False; +#if 0 /* JRATEST */ + if (p == NULL) + p = &zero; + if (q == NULL) + q = &zero; +#endif /* JRATEST */ + while (p && (*p!=0)) { while (*q!=0) q++; @@ -1428,7 +1441,8 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui buffer->string_at_end -= (q-p+1)*sizeof(uint16); - prs_set_offset(ps, buffer->string_at_end); + if(!prs_set_offset(ps, buffer->string_at_end)) + return False; /* write the string */ if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) @@ -1438,7 +1452,8 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui } - prs_set_offset(ps, struct_offset); + if(!prs_set_offset(ps, struct_offset)) + return False; relative_offset=buffer->string_at_end - buffer->struct_start; /* write its offset */ @@ -1454,11 +1469,12 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui *string=NULL; /* read the offset */ - if (!prs_uint32("offset", ps, depth, &(buffer->string_at_end))) + if (!prs_uint32("offset", ps, depth, &buffer->string_at_end)) return False; old_offset = prs_offset(ps); - prs_set_offset(ps, buffer->string_at_end + buffer->struct_start); + if(!prs_set_offset(ps, buffer->string_at_end + buffer->struct_start)) + return False; do { if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) @@ -1474,7 +1490,8 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui *string=chaine2; - prs_set_offset(ps, old_offset); + if(!prs_set_offset(ps, old_offset)) + return False; } return True; } @@ -1505,13 +1522,15 @@ static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, if (*secdesc != NULL) { buffer->string_at_end -= sec_desc_size(*secdesc); - prs_set_offset(ps, buffer->string_at_end); + if(!prs_set_offset(ps, buffer->string_at_end)) + return False; /* write the secdesc */ if (!sec_io_desc(desc, secdesc, ps, depth)) return False; - prs_set_offset(ps, struct_offset); + if(!prs_set_offset(ps, struct_offset)) + return False; } relative_offset=buffer->string_at_end - buffer->struct_start; @@ -1522,17 +1541,19 @@ static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, uint32 old_offset; /* read the offset */ - if (!prs_uint32("offset", ps, depth, &(buffer->string_at_end))) + if (!prs_uint32("offset", ps, depth, &buffer->string_at_end)) return False; old_offset = prs_offset(ps); - prs_set_offset(ps, buffer->string_at_end + buffer->struct_start); + if(!prs_set_offset(ps, buffer->string_at_end + buffer->struct_start)) + return False; /* read the sd */ if (!sec_io_desc(desc, secdesc, ps, depth)) return False; - prs_set_offset(ps, old_offset); + if(!prs_set_offset(ps, old_offset)) + return False; } return True; } @@ -1553,13 +1574,15 @@ static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEV buffer->string_at_end -= ((*devmode)->size + (*devmode)->driverextra); - prs_set_offset(ps, buffer->string_at_end); + if(!prs_set_offset(ps, buffer->string_at_end)) + return False; /* write the DEVMODE */ if (!spoolss_io_devmode(desc, ps, depth, *devmode)) return False; - prs_set_offset(ps, struct_offset); + if(!prs_set_offset(ps, struct_offset)) + return False; relative_offset=buffer->string_at_end - buffer->struct_start; /* write its offset */ @@ -1574,7 +1597,8 @@ static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEV return False; old_offset = prs_offset(ps); - prs_set_offset(ps, buffer->string_at_end + buffer->struct_start); + if(!prs_set_offset(ps, buffer->string_at_end + buffer->struct_start)) + return False; /* read the string */ if((*devmode=(DEVICEMODE *)malloc(sizeof(DEVICEMODE))) == NULL) @@ -1582,7 +1606,8 @@ static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEV if (!spoolss_io_devmode(desc, ps, depth, *devmode)) return False; - prs_set_offset(ps, old_offset); + if(!prs_set_offset(ps, old_offset)) + return False; } return True; } @@ -2087,8 +2112,9 @@ static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUF ********************************************************************/ void new_spoolss_move_buffer(NEW_BUFFER *src, NEW_BUFFER **dest) { - prs_switch_type(&(src->prs), MARSHALL); - prs_set_offset(&(src->prs), 0); + prs_switch_type(&src->prs, MARSHALL); + if(!prs_set_offset(&src->prs, 0)) + return; prs_force_dynamic(&(src->prs)); *dest=src; @@ -2122,7 +2148,7 @@ void new_spoolss_free_buffer(NEW_BUFFER *buffer) if (buffer==NULL) return; - prs_mem_free(&(buffer->prs)); + prs_mem_free(&buffer->prs); buffer->ptr=0x0; buffer->size=0; buffer->string_at_end=0; -- cgit From 774b06ee212ee764fb2e17c1f366d0de552c07cc Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 29 Jun 2000 00:52:40 +0000 Subject: Tidy up current spool code - added some JRATEST ifdefs to allow experimentation with what is making spoolss.exe crash - may be removed later. Jeremy. (This used to be commit f3fe384dc39ce49c639a7adf35179a50cb86abf0) --- source3/rpc_parse/parse_spoolss.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 0c12623e47..de20b684cc 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -823,9 +823,9 @@ BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_st if (!prs_align(ps)) return False; - if (!prs_uint32("type", ps, depth, &(r_u->type))) + if (!prs_uint32("type", ps, depth, &r_u->type)) return False; - if (!prs_uint32("size", ps, depth, &(r_u->size))) + if (!prs_uint32("size", ps, depth, &r_u->size)) return False; if (!prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size)) @@ -834,9 +834,9 @@ BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_st if (!prs_align(ps)) return False; - if (!prs_uint32("needed", ps, depth, &(r_u->needed))) + if (!prs_uint32("needed", ps, depth, &r_u->needed)) return False; - if (!prs_uint32("status", ps, depth, &(r_u->status))) + if (!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; @@ -2844,7 +2844,7 @@ BOOL spoolss_io_r_getprinter(char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps if (!prs_align(ps)) return False; - + if (!prs_uint32("needed", ps, depth, &r_u->needed)) return False; @@ -4545,18 +4545,18 @@ BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_st if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("printer handle", &(q_u->handle), ps, depth)) + if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) return False; - if(!smb_io_unistr2("", &(q_u->value), True, ps, depth)) + if(!smb_io_unistr2("", &q_u->value, True, ps, depth)) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("type", ps, depth, &(q_u->type))) + if(!prs_uint32("type", ps, depth, &q_u->type)) return False; - if(!prs_uint32("max_len", ps, depth, &(q_u->max_len))) + if(!prs_uint32("max_len", ps, depth, &q_u->max_len)) return False; switch (q_u->type) @@ -4575,7 +4575,7 @@ BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_st break; } - if(!prs_uint32("real_len", ps, depth, &(q_u->real_len))) + if(!prs_uint32("real_len", ps, depth, &q_u->real_len)) return False; return True; @@ -4595,7 +4595,7 @@ BOOL spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_st if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &(r_u->status))) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; -- cgit From 55f9dc2027a1d5419ae06f079723458c84721fd1 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 1 Jul 2000 05:44:49 +0000 Subject: Removed unneccessary ()'s afer &'s that made it look like we don't know how the C language works :-). Jeremy (This used to be commit d47329649d4f92a52acac7de256d9d9b0afc33c8) --- source3/rpc_parse/parse_spoolss.c | 250 +++++++++++++++++++------------------- 1 file changed, 125 insertions(+), 125 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index de20b684cc..fa065048ed 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -344,6 +344,10 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs return False; if(!prs_uint32("id", ps, depth, &data->id)) return False; +#if 1 /* JRATEST - NEEDED ???? */ + if(!prs_uint32("how many words", ps, depth, &how_many_words)) + return False; +#endif /* JRATEST - NEEDED ???? */ /*prs_align(ps);*/ @@ -513,75 +517,74 @@ static BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE if (!prs_uint16s(True,"devicename", ps, depth, devmode->devicename.buffer, 32)) return False; - if (!prs_uint16("specversion", ps, depth, &(devmode->specversion))) + if (!prs_uint16("specversion", ps, depth, &devmode->specversion)) return False; - if (!prs_uint16("driverversion", ps, depth, &(devmode->driverversion))) + if (!prs_uint16("driverversion", ps, depth, &devmode->driverversion)) return False; - if (!prs_uint16("size", ps, depth, &(devmode->size))) + if (!prs_uint16("size", ps, depth, &devmode->size)) return False; - if (!prs_uint16("driverextra", ps, depth, &(devmode->driverextra))) + if (!prs_uint16("driverextra", ps, depth, &devmode->driverextra)) return False; - if (!prs_uint32("fields", ps, depth, &(devmode->fields))) + if (!prs_uint32("fields", ps, depth, &devmode->fields)) return False; - if (!prs_uint16("orientation", ps, depth, &(devmode->orientation))) + if (!prs_uint16("orientation", ps, depth, &devmode->orientation)) return False; - if (!prs_uint16("papersize", ps, depth, &(devmode->papersize))) + if (!prs_uint16("papersize", ps, depth, &devmode->papersize)) return False; - if (!prs_uint16("paperlength", ps, depth, &(devmode->paperlength))) + if (!prs_uint16("paperlength", ps, depth, &devmode->paperlength)) return False; - if (!prs_uint16("paperwidth", ps, depth, &(devmode->paperwidth))) + if (!prs_uint16("paperwidth", ps, depth, &devmode->paperwidth)) return False; - if (!prs_uint16("scale", ps, depth, &(devmode->scale))) + if (!prs_uint16("scale", ps, depth, &devmode->scale)) return False; - if (!prs_uint16("copies", ps, depth, &(devmode->copies))) + if (!prs_uint16("copies", ps, depth, &devmode->copies)) return False; - if (!prs_uint16("defaultsource", ps, depth, &(devmode->defaultsource))) + if (!prs_uint16("defaultsource", ps, depth, &devmode->defaultsource)) return False; - if (!prs_uint16("printquality", ps, depth, &(devmode->printquality))) + if (!prs_uint16("printquality", ps, depth, &devmode->printquality)) return False; - if (!prs_uint16("color", ps, depth, &(devmode->color))) + if (!prs_uint16("color", ps, depth, &devmode->color)) return False; - if (!prs_uint16("duplex", ps, depth, &(devmode->duplex))) + if (!prs_uint16("duplex", ps, depth, &devmode->duplex)) return False; - if (!prs_uint16("yresolution", ps, depth, &(devmode->yresolution))) + if (!prs_uint16("yresolution", ps, depth, &devmode->yresolution)) return False; - if (!prs_uint16("ttoption", ps, depth, &(devmode->ttoption))) + if (!prs_uint16("ttoption", ps, depth, &devmode->ttoption)) return False; - if (!prs_uint16("collate", ps, depth, &(devmode->collate))) + if (!prs_uint16("collate", ps, depth, &devmode->collate)) return False; if (!prs_uint16s(True, "formname", ps, depth, devmode->formname.buffer, 32)) return False; - if (!prs_uint16("logpixels", ps, depth, &(devmode->logpixels))) + if (!prs_uint16("logpixels", ps, depth, &devmode->logpixels)) return False; - if (!prs_uint32("bitsperpel", ps, depth, &(devmode->bitsperpel))) + if (!prs_uint32("bitsperpel", ps, depth, &devmode->bitsperpel)) return False; - if (!prs_uint32("pelswidth", ps, depth, &(devmode->pelswidth))) + if (!prs_uint32("pelswidth", ps, depth, &devmode->pelswidth)) return False; - if (!prs_uint32("pelsheight", ps, depth, &(devmode->pelsheight))) + if (!prs_uint32("pelsheight", ps, depth, &devmode->pelsheight)) return False; - if (!prs_uint32("displayflags", ps, depth, &(devmode->displayflags))) + if (!prs_uint32("displayflags", ps, depth, &devmode->displayflags)) return False; - if (!prs_uint32("displayfrequency", ps, depth, &(devmode->displayfrequency))) + if (!prs_uint32("displayfrequency", ps, depth, &devmode->displayfrequency)) return False; - if (!prs_uint32("icmmethod", ps, depth, &(devmode->icmmethod))) + if (!prs_uint32("icmmethod", ps, depth, &devmode->icmmethod)) return False; - if (!prs_uint32("icmintent", ps, depth, &(devmode->icmintent))) + if (!prs_uint32("icmintent", ps, depth, &devmode->icmintent)) return False; - if (!prs_uint32("mediatype", ps, depth, &(devmode->mediatype))) + if (!prs_uint32("mediatype", ps, depth, &devmode->mediatype)) return False; - if (!prs_uint32("dithertype", ps, depth, &(devmode->dithertype))) + if (!prs_uint32("dithertype", ps, depth, &devmode->dithertype)) return False; - if (!prs_uint32("reserved1", ps, depth, &(devmode->reserved1))) + if (!prs_uint32("reserved1", ps, depth, &devmode->reserved1)) return False; - if (!prs_uint32("reserved2", ps, depth, &(devmode->reserved2))) + if (!prs_uint32("reserved2", ps, depth, &devmode->reserved2)) return False; - if (!prs_uint32("panningwidth", ps, depth, &(devmode->panningwidth))) + if (!prs_uint32("panningwidth", ps, depth, &devmode->panningwidth)) return False; - if (!prs_uint32("panningheight", ps, depth, &(devmode->panningheight))) + if (!prs_uint32("panningheight", ps, depth, &devmode->panningheight)) return False; - if (devmode->driverextra!=0) - { + if (devmode->driverextra!=0) { if (UNMARSHALLING(ps)) { devmode->private=(uint8 *)malloc(devmode->driverextra*sizeof(uint8)); if(devmode->private == NULL) @@ -972,9 +975,9 @@ BOOL spoolss_io_r_startdocprinter(char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_ { prs_debug(ps, depth, desc, "spoolss_io_r_startdocprinter"); depth++; - if(!prs_uint32("jobid", ps, depth, &(r_u->jobid))) + if(!prs_uint32("jobid", ps, depth, &r_u->jobid)) return False; - if(!prs_uint32("status", ps, depth, &(r_u->status))) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; @@ -994,7 +997,7 @@ BOOL spoolss_io_q_enddocprinter(char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_stru if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; return True; @@ -1008,7 +1011,7 @@ BOOL spoolss_io_r_enddocprinter(char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_stru { prs_debug(ps, depth, desc, "spoolss_io_r_enddocprinter"); depth++; - if(!prs_uint32("status", ps, depth, &(r_u->status))) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; @@ -1028,7 +1031,7 @@ BOOL spoolss_io_q_startpageprinter(char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, pr if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; return True; @@ -1042,7 +1045,7 @@ BOOL spoolss_io_r_startpageprinter(char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, pr { prs_debug(ps, depth, desc, "spoolss_io_r_startpageprinter"); depth++; - if(!prs_uint32("status", ps, depth, &(r_u->status))) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; @@ -1062,7 +1065,7 @@ BOOL spoolss_io_q_endpageprinter(char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_st if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; return True; @@ -1076,7 +1079,7 @@ BOOL spoolss_io_r_endpageprinter(char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_st { prs_debug(ps, depth, desc, "spoolss_io_r_endpageprinter"); depth++; - if(!prs_uint32("status", ps, depth, &(r_u->status))) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; @@ -1096,9 +1099,9 @@ BOOL spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; - if(!prs_uint32("buffer_size", ps, depth, &(q_u->buffer_size))) + if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size)) return False; if (q_u->buffer_size!=0) @@ -1111,7 +1114,7 @@ BOOL spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct } if(!prs_align(ps)) return False; - if(!prs_uint32("buffer_size2", ps, depth, &(q_u->buffer_size2))) + if(!prs_uint32("buffer_size2", ps, depth, &q_u->buffer_size2)) return False; return True; @@ -1125,9 +1128,9 @@ BOOL spoolss_io_r_writeprinter(char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct { prs_debug(ps, depth, desc, "spoolss_io_r_writeprinter"); depth++; - if(!prs_uint32("buffer_written", ps, depth, &(r_u->buffer_written))) + if(!prs_uint32("buffer_written", ps, depth, &r_u->buffer_written)) return False; - if(!prs_uint32("status", ps, depth, &(r_u->status))) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; @@ -1593,7 +1596,7 @@ static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEV uint32 old_offset; /* read the offset */ - if (!prs_uint32("offset", ps, depth, &(buffer->string_at_end))) + if (!prs_uint32("offset", ps, depth, &buffer->string_at_end)) return False; old_offset = prs_offset(ps); @@ -2027,23 +2030,23 @@ BOOL new_smb_io_form_1(char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth) buffer->struct_start=prs_offset(ps); - if (!prs_uint32("flag", ps, depth, &(info->flag))) + if (!prs_uint32("flag", ps, depth, &info->flag)) return False; - if (!new_smb_io_relstr("name", buffer, depth, &(info->name))) + if (!new_smb_io_relstr("name", buffer, depth, &info->name)) return False; - if (!prs_uint32("width", ps, depth, &(info->width))) + if (!prs_uint32("width", ps, depth, &info->width)) return False; - if (!prs_uint32("length", ps, depth, &(info->length))) + if (!prs_uint32("length", ps, depth, &info->length)) return False; - if (!prs_uint32("left", ps, depth, &(info->left))) + if (!prs_uint32("left", ps, depth, &info->left)) return False; - if (!prs_uint32("top", ps, depth, &(info->top))) + if (!prs_uint32("top", ps, depth, &info->top)) return False; - if (!prs_uint32("right", ps, depth, &(info->right))) + if (!prs_uint32("right", ps, depth, &info->right)) return False; - if (!prs_uint32("bottom", ps, depth, &(info->bottom))) + if (!prs_uint32("bottom", ps, depth, &info->bottom)) return False; return True; @@ -2266,7 +2269,7 @@ BOOL smb_io_printprocdatatype_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCDA ********************************************************************/ BOOL smb_io_printmonitor_info_1(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_1 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "smb_io_printmonitor_info_1"); depth++; @@ -2545,14 +2548,14 @@ uint32 spoolss_size_form_1(FORM_1 *info) { int size=0; - size+=size_of_uint32( &(info->flag) ); - size+=size_of_relative_string( &(info->name) ); - size+=size_of_uint32( &(info->width) ); - size+=size_of_uint32( &(info->length) ); - size+=size_of_uint32( &(info->left) ); - size+=size_of_uint32( &(info->top) ); - size+=size_of_uint32( &(info->right) ); - size+=size_of_uint32( &(info->bottom) ); + size+=size_of_uint32( &info->flag ); + size+=size_of_relative_string( &info->name ); + size+=size_of_uint32( &info->width ); + size+=size_of_uint32( &info->length ); + size+=size_of_uint32( &info->left ); + size+=size_of_uint32( &info->top ); + size+=size_of_uint32( &info->right ); + size+=size_of_uint32( &info->bottom ); return size; } @@ -2911,7 +2914,7 @@ BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &(r_u->status))) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; @@ -2988,7 +2991,7 @@ BOOL spoolss_io_r_fcpn(char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &(r_u->status))) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; @@ -3005,7 +3008,7 @@ BOOL spoolss_io_q_fcpn(char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; return True; @@ -3145,7 +3148,7 @@ BOOL spoolss_io_r_schedulejob(char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct * if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &(r_u->status))) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; @@ -3161,9 +3164,9 @@ BOOL spoolss_io_q_schedulejob(char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct * if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; - if(!prs_uint32("jobid", ps, depth, &(q_u->jobid))) + if(!prs_uint32("jobid", ps, depth, &q_u->jobid)) return False; return True; @@ -3179,7 +3182,7 @@ BOOL spoolss_io_r_setjob(char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int de if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &(r_u->status))) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; @@ -3195,17 +3198,17 @@ BOOL spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int de if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; - if(!prs_uint32("jobid", ps, depth, &(q_u->jobid))) + if(!prs_uint32("jobid", ps, depth, &q_u->jobid)) return False; /* * level is usually 0. If (level!=0) then I'm in trouble ! * I will try to generate setjob command with level!=0, one day. */ - if(!prs_uint32("level", ps, depth, &(q_u->level))) + if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!prs_uint32("command", ps, depth, &(q_u->command))) + if(!prs_uint32("command", ps, depth, &q_u->command)) return False; return True; @@ -3292,9 +3295,9 @@ BOOL spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, if (!prs_align(ps)) return False; - if (!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + if (!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; - if (!prs_uint32("level", ps, depth, &(q_u->level))) + if (!prs_uint32("level", ps, depth, &q_u->level)) return False; if (!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) @@ -3302,7 +3305,7 @@ BOOL spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, if (!prs_align(ps)) return False; - if (!prs_uint32("offered", ps, depth, &(q_u->offered))) + if (!prs_uint32("offered", ps, depth, &q_u->offered)) return False; return True; @@ -3324,13 +3327,13 @@ BOOL new_spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct * if (!prs_align(ps)) return False; - if (!prs_uint32("size of buffer needed", ps, depth, &(r_u->needed))) + if (!prs_uint32("size of buffer needed", ps, depth, &r_u->needed)) return False; - if (!prs_uint32("numofforms", ps, depth, &(r_u->numofforms))) + if (!prs_uint32("numofforms", ps, depth, &r_u->numofforms)) return False; - if (!prs_uint32("status", ps, depth, &(r_u->status))) + if (!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; @@ -3622,7 +3625,7 @@ BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct if(!prs_uint32("info_level", ps, depth, &q_u->level)) return False; - if(!spool_io_printer_info_level("", &(q_u->info), ps, depth)) + if(!spool_io_printer_info_level("", &q_u->info, ps, depth)) return False; /* the 4 unknown are all 0 */ @@ -3659,10 +3662,10 @@ BOOL spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, prs_struct prs_debug(ps, depth, desc, "spoolss_io_r_addprinterex"); depth++; - if(!smb_io_pol_hnd("printer handle",&(r_u->handle),ps,depth)) + if(!smb_io_pol_hnd("printer handle",&r_u->handle,ps,depth)) return False; - if(!prs_uint32("status", ps, depth, &(r_u->status))) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; @@ -3951,7 +3954,7 @@ BOOL smb_io_unibuffer(char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) buffer->undoc=0; buffer->uni_str_len=buffer->uni_max_len; - if(!prs_uint32("buffer_size", ps, depth, &(buffer->uni_max_len))) + if(!prs_uint32("buffer_size", ps, depth, &buffer->uni_max_len)) return False; if(!prs_unistr2(True, "buffer ", ps, depth, buffer)) @@ -4078,14 +4081,14 @@ BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, d->cversion=uni->cversion; - unistr2_to_ascii(d->name, &(uni->name), sizeof(d->name)-1); - unistr2_to_ascii(d->environment, &(uni->environment), sizeof(d->environment)-1); - unistr2_to_ascii(d->driverpath, &(uni->driverpath), sizeof(d->driverpath)-1); - unistr2_to_ascii(d->datafile, &(uni->datafile), sizeof(d->datafile)-1); - unistr2_to_ascii(d->configfile, &(uni->configfile), sizeof(d->configfile)-1); - unistr2_to_ascii(d->helpfile, &(uni->helpfile), sizeof(d->helpfile)-1); - unistr2_to_ascii(d->monitorname, &(uni->monitorname), sizeof(d->monitorname)-1); - unistr2_to_ascii(d->defaultdatatype, &(uni->defaultdatatype), sizeof(d->defaultdatatype)-1); + unistr2_to_ascii(d->name, &uni->name, sizeof(d->name)-1); + unistr2_to_ascii(d->environment, &uni->environment, sizeof(d->environment)-1); + unistr2_to_ascii(d->driverpath, &uni->driverpath, sizeof(d->driverpath)-1); + unistr2_to_ascii(d->datafile, &uni->datafile, sizeof(d->datafile)-1); + unistr2_to_ascii(d->configfile, &uni->configfile, sizeof(d->configfile)-1); + unistr2_to_ascii(d->helpfile, &uni->helpfile, sizeof(d->helpfile)-1); + unistr2_to_ascii(d->monitorname, &uni->monitorname, sizeof(d->monitorname)-1); + unistr2_to_ascii(d->defaultdatatype, &uni->defaultdatatype, sizeof(d->defaultdatatype)-1); DEBUGADD(8,( "version: %d\n", d->cversion)); DEBUGADD(8,( "name: %s\n", d->name)); @@ -4528,7 +4531,7 @@ BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, const POLICY_HND *hnd, uint32 idx, uint32 valuelen, uint32 datalen) { - memcpy(&(q_u->handle), hnd, sizeof(q_u->handle)); + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); q_u->index=idx; q_u->valuesize=valuelen; q_u->datasize=datalen; @@ -4646,24 +4649,24 @@ static BOOL spoolss_io_addform(char *desc, FORM *f, uint32 ptr, prs_struct *ps, if (ptr!=0) { - if(!prs_uint32("flags", ps, depth, &(f->flags))) + if(!prs_uint32("flags", ps, depth, &f->flags)) return False; - if(!prs_uint32("name_ptr", ps, depth, &(f->name_ptr))) + if(!prs_uint32("name_ptr", ps, depth, &f->name_ptr)) return False; - if(!prs_uint32("size_x", ps, depth, &(f->size_x))) + if(!prs_uint32("size_x", ps, depth, &f->size_x)) return False; - if(!prs_uint32("size_y", ps, depth, &(f->size_y))) + if(!prs_uint32("size_y", ps, depth, &f->size_y)) return False; - if(!prs_uint32("left", ps, depth, &(f->left))) + if(!prs_uint32("left", ps, depth, &f->left)) return False; - if(!prs_uint32("top", ps, depth, &(f->top))) + if(!prs_uint32("top", ps, depth, &f->top)) return False; - if(!prs_uint32("right", ps, depth, &(f->right))) + if(!prs_uint32("right", ps, depth, &f->right)) return False; - if(!prs_uint32("bottom", ps, depth, &(f->bottom))) + if(!prs_uint32("bottom", ps, depth, &f->bottom)) return False; - if(!smb_io_unistr2("", &(f->name), f->name_ptr, ps, depth)) + if(!smb_io_unistr2("", &f->name, f->name_ptr, ps, depth)) return False; } @@ -4680,18 +4683,18 @@ BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("printer handle", &(q_u->handle), ps, depth)) + if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) return False; - if(!prs_uint32("level", ps, depth, &(q_u->level))) + if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!prs_uint32("level2", ps, depth, &(q_u->level2))) + if(!prs_uint32("level2", ps, depth, &q_u->level2)) return False; if (q_u->level==1) { - if(!prs_uint32("useless_ptr", ps, depth, &(useless_ptr))) + if(!prs_uint32("useless_ptr", ps, depth, &useless_ptr)) return False; - if(!spoolss_io_addform("", &(q_u->form), useless_ptr, ps, depth)) + if(!spoolss_io_addform("", &q_u->form, useless_ptr, ps, depth)) return False; } @@ -4707,7 +4710,7 @@ BOOL spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &(r_u->status))) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; @@ -4723,24 +4726,24 @@ BOOL spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("printer handle", &(q_u->handle), ps, depth)) + if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) return False; - if(!smb_io_unistr2("", &(q_u->name), True, ps, depth)) + if(!smb_io_unistr2("", &q_u->name, True, ps, depth)) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("level", ps, depth, &(q_u->level))) + if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!prs_uint32("level2", ps, depth, &(q_u->level2))) + if(!prs_uint32("level2", ps, depth, &q_u->level2)) return False; if (q_u->level==1) { - if(!prs_uint32("useless_ptr", ps, depth, &(useless_ptr))) + if(!prs_uint32("useless_ptr", ps, depth, &useless_ptr)) return False; - if(!spoolss_io_addform("", &(q_u->form), useless_ptr, ps, depth)) + if(!spoolss_io_addform("", &q_u->form, useless_ptr, ps, depth)) return False; } @@ -4756,7 +4759,7 @@ BOOL spoolss_io_r_setform(char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &(r_u->status))) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; @@ -4799,7 +4802,7 @@ BOOL spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int de if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; if(!prs_uint32("jobid", ps, depth, &q_u->jobid)) return False; @@ -5024,7 +5027,7 @@ BOOL spoolss_io_q_replyopenprinter(char *desc, SPOOL_Q_REPLYOPENPRINTER *q_u, pr if(!prs_align(ps)) return False; - if(!smb_io_unistr2("", &(q_u->string), True, ps, depth)) + if(!smb_io_unistr2("", &q_u->string, True, ps, depth)) return False; if(!prs_align(ps)) @@ -5052,7 +5055,7 @@ BOOL spoolss_io_r_replyopenprinter(char *desc, SPOOL_R_REPLYOPENPRINTER *r_u, pr if (!prs_align(ps)) return False; - if(!smb_io_pol_hnd("printer handle",&(r_u->handle),ps,depth)) + if(!smb_io_pol_hnd("printer handle",&r_u->handle,ps,depth)) return False; if (!prs_uint32("status", ps, depth, &r_u->status)) @@ -5072,7 +5075,7 @@ BOOL spoolss_io_q_replycloseprinter(char *desc, SPOOL_Q_REPLYCLOSEPRINTER *q_u, if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; return True; @@ -5089,7 +5092,7 @@ BOOL spoolss_io_r_replycloseprinter(char *desc, SPOOL_R_REPLYCLOSEPRINTER *r_u, if (!prs_align(ps)) return False; - if(!smb_io_pol_hnd("printer handle",&(r_u->handle),ps,depth)) + if(!smb_io_pol_hnd("printer handle",&r_u->handle,ps,depth)) return False; if (!prs_uint32("status", ps, depth, &r_u->status)) @@ -5097,6 +5100,3 @@ BOOL spoolss_io_r_replycloseprinter(char *desc, SPOOL_R_REPLYCLOSEPRINTER *r_u, return True; } - - - -- cgit From b8262b4bdd1d538bfdeff344fa0ef6ccd4674d59 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Tue, 4 Jul 2000 21:58:45 +0000 Subject: driver_info_6 had a prs_align() that should not have been there. J.F. (This used to be commit a882dd225e464b300cedb52eb43f57f3a56c5b31) --- source3/rpc_parse/parse_spoolss.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index fa065048ed..01fa73b187 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3890,8 +3890,6 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ return False; if(!smb_io_unistr2("provider", &il->provider, il->provider_ptr, ps, depth)) return False; - if(!prs_align(ps)) - return False; return True; } -- cgit From 53e0629979e4196dfde1ccfe76616cab1d7e058e Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Tue, 4 Jul 2000 22:51:05 +0000 Subject: the dummy field in driver_info_6 is before the driver version and not after. I don't know who broke all that code, but I'm ******** (censured) J.F. (This used to be commit 1fae158529ca0d1cb01ff422638418ce0dbd8dbf) --- source3/rpc_parse/parse_spoolss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 01fa73b187..ec8f9901f5 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3817,10 +3817,10 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ return False; if(!smb_io_time("driverdate", &il->driverdate, ps, depth)) return False; - if(!prs_uint64("driverversion", ps, depth, &il->driverversion)) - return False; if(!prs_uint32("dummy4", ps, depth, &il->dummy4)) return False; + if(!prs_uint64("driverversion", ps, depth, &il->driverversion)) + return False; if(!prs_uint32("mfgname_ptr", ps, depth, &il->mfgname_ptr)) return False; if(!prs_uint32("oemurl_ptr", ps, depth, &il->oemurl_ptr)) -- cgit From d2b40a7de259377d937492acedd39988ddd108a4 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 7 Jul 2000 06:20:46 +0000 Subject: More rpcclient merge issues: * fixes some readline bugs from the merge * first attempt at commands (spoolenum almost works) * no changes to existing functions in HEAD; only additions of new functions. I'll weed out what I can as I go. --jerry (This used to be commit 61d2aad5dc2b212b11c981f1eca47efa627e9fc8) --- source3/rpc_parse/parse_creds.c | 24 +++++++++ source3/rpc_parse/parse_prs.c | 114 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 137 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c index 46fdc5b78f..672b9f28e0 100644 --- a/source3/rpc_parse/parse_creds.c +++ b/source3/rpc_parse/parse_creds.c @@ -425,6 +425,30 @@ void copy_unix_sec_creds(CREDS_UNIX_SEC *to, const CREDS_UNIX_SEC *from) } }; +void create_ntc_from_cli_state (CREDS_NT *to, const struct cli_state *cli_from) +{ + /* + * NULL credentials -- + * if this gets executed, it is a programming error. + * fall through to copy_nt_creds() + */ + if (cli_from == NULL) + { + copy_nt_creds (to, cli_from); + return; + } + + safe_strcpy(to->domain , cli_from->domain , sizeof(cli_from->domain )-1); + safe_strcpy(to->user_name, cli_from->user_name, sizeof(cli_from->user_name)-1); + memcpy(&to->pwd, &cli_from->pwd, sizeof(cli_from->pwd)); + to->ntlmssp_flags = cli_from->ntlmssp_flags; + DEBUG(10,("create_ntc_fromcli_state: user %s domain %s flgs: %x\n", + to->user_name, to->domain, + to->ntlmssp_flags)); + +}; + + void copy_nt_creds(struct ntuser_creds *to, const struct ntuser_creds *from) { diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 94a6100aa1..3b17f51c95 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -26,6 +26,35 @@ extern int DEBUGLEVEL; #include "includes.h" +/******************************************************************* + search for a memory buffer that falls within the specified offset + ********************************************************************/ +static const prs_struct *prs_find(const prs_struct *buf, uint32 offset) +{ + const prs_struct *f = NULL; + +#if 0 /* comment out by JERRY */ + if (buf == NULL) + return False; + + f = buf; + + while (f != NULL && offset >= f->end) + { + DEBUG(200, ("prs_find: next[%d..%d]\n", f->start, f->end)); + + f = f->next; + } + + if (f != NULL) + { + DEBUG(200, ("prs_find: found [%d..%d]\n", f->start, f->end)); + } + +#endif + return f; +} + /******************************************************************* dump a prs to a file ********************************************************************/ @@ -63,10 +92,10 @@ void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name) DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(depth), ps->data_offset, fn_name, desc)); } + /******************************************************************* Initialise a parse structure - malloc the data if requested. ********************************************************************/ - BOOL prs_init(prs_struct *ps, uint32 size, uint8 align, BOOL io) { ZERO_STRUCTP(ps); @@ -805,6 +834,89 @@ BOOL prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32, return True; } +/******************************************************************* + frees a memory buffer. + ********************************************************************/ +void prs_free_data(prs_struct *buf) +{ + if (buf == NULL) + return; + + if (buf->data_p != NULL) + { + free(buf->data_p); + buf->data_p = NULL; + } + buf->buffer_size = 0; +} + +/******************************************************************* + reallocate a memory buffer +********************************************************************/ +BOOL prs_realloc_data(prs_struct *buf, size_t new_size) +{ + char *new_data; + + /* prs_sma_init(); JERRY */ + + prs_debug(buf, 200, "prs_realloc_data - before", "prs_realloc_data"); + + SMB_ASSERT(((ssize_t) new_size) >= 0); + + if (new_size == 0) + { + prs_free_data(buf); + return True; + } + + /* new_data = sma_realloc(prs_sma_region, buf->data_p, new_size); */ + new_data = realloc(buf->data_p, new_size); + + if (new_data != NULL) + { + if (new_size > buf->buffer_size) + { + memset(&new_data[buf->buffer_size], 0, + new_size - buf->buffer_size); + } + buf->data_p = new_data; + buf->buffer_size = new_size; + } + else if (buf->buffer_size >= new_size) + { + DEBUG(3, ("prs_realloc_data: warning - " + "could not realloc to %d\n", new_size)); + } + else + { + DEBUG(3, ("prs_realloc_data: error - " + "could not realloc to %d\n", new_size)); + + prs_free_data(buf); + return False; + } + + prs_debug(buf, 200, "prs_realloc_data - after", "prs_realloc_data"); + return True; +} + +/******************************************************************* + return the memory location specified by may return NULL. + ********************************************************************/ +char *prs_data(const prs_struct *buf, uint32 offset) +{ + buf = prs_find(buf, offset); + if (buf != NULL) + { + /* return &(buf->data[offset - buf->start]); */ + return &(buf->data_p[offset]); + } + return NULL; +} + + + + /* useful function to store a structure in rpc wire format */ int tdb_prs_store(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps) { -- cgit From 541303d9693c616437850af725e700f85a9e8865 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 10 Jul 2000 04:56:30 +0000 Subject: Fix for passing NULL pointer as an array parameter in domain_client_validate() (This used to be commit 3ee111bff78826a5ee419554d4ef2b2b2d3ae7aa) --- source3/rpc_parse/parse_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index bcc8e876b5..06430e75e6 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -765,8 +765,8 @@ void init_id_info2(NET_ID_INFO_2 *id, char *domain_name, uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, char *user_name, char *wksta_name, unsigned char lm_challenge[8], - unsigned char lm_chal_resp[24], - unsigned char nt_chal_resp[24]) + unsigned char *lm_chal_resp, + unsigned char *nt_chal_resp) { int len_domain_name = strlen(domain_name); int len_user_name = strlen(user_name ); -- cgit From b561c185972921861946a69b8846681bc7ed3f87 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 10 Jul 2000 06:41:04 +0000 Subject: Fixes for various compile warnings on Solaris 8. (This used to be commit 898a483cdab1ed7d8ff902c0dc0e0620440ae4cd) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index ec8f9901f5..470e25e032 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1957,7 +1957,7 @@ BOOL new_smb_io_job_info_1(char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int ********************************************************************/ BOOL new_smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int depth) { - int pipo=0; + uint pipo=0; prs_struct *ps=&(buffer->prs); prs_debug(ps, depth, desc, "new_smb_io_job_info_2"); -- cgit From 64db2010fbc3c1eaaa2d9c7de5b56c1c9edb06e1 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 10 Jul 2000 19:55:39 +0000 Subject: included a a new prs_unistr(). Is currently #if'd out (denoted by RPCCLIENT_TEST) in order to not break anything in the smbd code (and to give time to review it). Originally written by JF. In effect, this checkin makes no changes to parse_prs.c at all. jerry (This used to be commit 4f431ea1f5d1d3b868d0bb56a299070e608c2512) --- source3/rpc_parse/parse_prs.c | 92 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 3b17f51c95..8bfc638d5d 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -627,6 +627,8 @@ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 * return True; } + + /****************************************************************** Stream a unicode string, length/buffer specified separately, in uint16 chars. We use DBG_RW_PCVAL, not DBG_RW_PSVAL here @@ -709,6 +711,96 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) return True; } +#if 0 /* RPCCLIENT_TEST */ +BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) +{ + int len = 0; + unsigned char *p = (unsigned char *)str->buffer; + uint8 *start; + char *q; + char zero=0; + + if (MARSHALLING(ps)) { + + for(len = 0; len < (sizeof(str->buffer) / sizeof(str->buffer[0])) && + str->buffer[len] != 0; len++) + ; + + q = prs_mem_get(ps, (len+1)*2); + if (q == NULL) + return False; + + start = (uint8*)q; + + for(len = 0; len < (sizeof(str->buffer) / sizeof(str->buffer[0])) && + str->buffer[len] != 0; len++) + { + if(ps->bigendian_data) + { + RW_SVAL(ps->io, ps->bigendian_data, q, *p, 0); + p += 2; + q += 2; + } + else + { + RW_CVAL(ps->io, q, *p, 0); + p++; + q++; + RW_CVAL(ps->io, q, *p, 0); + p++; + q++; + } + } + + /* + * even if the string is 'empty' (only an \0 char) + * at this point the leading \0 hasn't been parsed. + * so parse it now + */ + + RW_CVAL(ps->io, q, zero, 0); + q++; + RW_CVAL(ps->io, q, zero, 0); + q++; + + len++; + + dump_data(5+depth, (char *)start, len * 2); + } + else { /* unmarshalling */ + + len = -1; + q = prs_data_p(ps) + prs_offset(ps); + + do + { + len++; + + if(ps->bigendian_data) + { + RW_SVAL(ps->io, ps->bigendian_data, q, *p, 0); + p += 2; + q += 2; + } else { + RW_CVAL(ps->io, q, *p, 0); + p++; + q++; + RW_CVAL(ps->io, q, *p, 0); + p++; + q++; + } + } while (len < (sizeof(str->buffer) / sizeof(str->buffer[0])) && + str->buffer[len] != 0); + } + + ps->data_offset += len*2; + + return True; +} + +#endif /* RPCCLIENT_TEST */ + + /******************************************************************* Stream a null-terminated string. len is strlen, and therefore does not include the null-termination character. -- cgit From 9ab8dfa381971df9aa8ba7731fa4b8e95a422a4b Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 11 Jul 2000 16:28:59 +0000 Subject: #ifndef RPCCLIENT_TEST use old prs_unistr() #else use new prs_unistr() which handles UNMARSHALL #endif /* RPCCLIENT_TEST */ jerry (This used to be commit fb0e1fb9e31db135eeb8e949a7ad0826906ba1ff) --- source3/rpc_parse/parse_prs.c | 51 ++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 35 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 8bfc638d5d..5b5834084f 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -26,35 +26,6 @@ extern int DEBUGLEVEL; #include "includes.h" -/******************************************************************* - search for a memory buffer that falls within the specified offset - ********************************************************************/ -static const prs_struct *prs_find(const prs_struct *buf, uint32 offset) -{ - const prs_struct *f = NULL; - -#if 0 /* comment out by JERRY */ - if (buf == NULL) - return False; - - f = buf; - - while (f != NULL && offset >= f->end) - { - DEBUG(200, ("prs_find: next[%d..%d]\n", f->start, f->end)); - - f = f->next; - } - - if (f != NULL) - { - DEBUG(200, ("prs_find: found [%d..%d]\n", f->start, f->end)); - } - -#endif - return f; -} - /******************************************************************* dump a prs to a file ********************************************************************/ @@ -657,6 +628,7 @@ BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int de in little-endian format then do it as a stream of bytes. ********************************************************************/ +#ifndef RPCCLIENT_TEST BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) { int len = 0; @@ -710,8 +682,7 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) return True; } - -#if 0 /* RPCCLIENT_TEST */ +#else BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) { int len = 0; @@ -993,16 +964,26 @@ BOOL prs_realloc_data(prs_struct *buf, size_t new_size) } /******************************************************************* - return the memory location specified by may return NULL. + return the memory location specified by offset; may return NULL. ********************************************************************/ char *prs_data(const prs_struct *buf, uint32 offset) { - buf = prs_find(buf, offset); - if (buf != NULL) + + /* do we have something to look at? */ + if (buf == NULL) + return NULL; + + /* check to make sure the offset is within range */ + if ((offset < 0) || (offset >= buf->buffer_size)) + return NULL; + + /* locate the memory address */ + if (buf->data_p != NULL) { - /* return &(buf->data[offset - buf->start]); */ return &(buf->data_p[offset]); } + + /* default return */ return NULL; } -- cgit From 5813ecff99431c3529cd45f3b579ef16e72a46f0 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Wed, 12 Jul 2000 14:10:40 +0000 Subject: - The printers are indexed by the sharename in both get_a_printer() and add_a_printer() now. - correctly unpack the private part of a devmode and remove a memleak - correctly retrieve the pair(value,data) for getprinterdata - handle null devicemode in printer_info_2 I still have some bugs but I'm not crashing anymore NT4SP6 d/c build :-) J.F. (This used to be commit 493f7d11acf753ba24c88e6cbb73d86a8595a66a) --- source3/rpc_parse/parse_spoolss.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 470e25e032..74a93b5776 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1575,6 +1575,15 @@ static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEV uint32 struct_offset = prs_offset(ps); uint32 relative_offset; + if (*devmode == NULL) { + relative_offset=0; + if (!prs_uint32("offset", ps, depth, &relative_offset)) + return False; + DEBUG(8, ("boing, the devmode was NULL\n")); + + return True; + } + buffer->string_at_end -= ((*devmode)->size + (*devmode)->driverextra); if(!prs_set_offset(ps, buffer->string_at_end)) -- cgit From 6c2242eadee7b9e69d3a868426807e525a4f5b0e Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Wed, 12 Jul 2000 16:11:33 +0000 Subject: we are now sure the printer_info_2 timestamp is updated everytime required. J.F. (This used to be commit 08b41bab177affac088c981d7c620728e8e6e9b0) --- source3/rpc_parse/parse_spoolss.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 74a93b5776..c0c6e36ae1 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4162,7 +4162,6 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, NT_PRINTER_INFO_LEVEL_2 **asc) { NT_PRINTER_INFO_LEVEL_2 *d; - NTTIME time_nt; time_t time_unix; DEBUG(7,("Converting from UNICODE to ASCII\n")); @@ -4194,10 +4193,6 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, d->untiltime=uni->untiltime; d->status=uni->status; d->cjobs=uni->cjobs; - - unix_to_nt_time(&time_nt, time_unix); - d->changeid=time_nt.low; - d->c_setprinter++; unistr2_to_ascii(d->servername, &uni->servername, sizeof(d->servername)-1); unistr2_to_ascii(d->printername, &uni->printername, sizeof(d->printername)-1); -- cgit From 2c46a26a8bbc4130a6dc195a77b760d26016d5a1 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 14 Jul 2000 16:58:03 +0000 Subject: removed prs_data(), prs_free_data(), and prs_realloc_data() as these were unneeded and replaced by the real functions already in HEAD. Added a few more functions to parse_spoolss.c to help with the rpcclient merge from TNG. (This used to be commit 3bc9af4c1dbdb664970541f6091982ffccc87b31) --- source3/rpc_parse/parse_prs.c | 93 --------------------------------------- source3/rpc_parse/parse_spoolss.c | 72 +++++++++++++++++++++++++----- 2 files changed, 60 insertions(+), 105 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 5b5834084f..1bda5ef506 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -897,99 +897,6 @@ BOOL prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32, return True; } -/******************************************************************* - frees a memory buffer. - ********************************************************************/ -void prs_free_data(prs_struct *buf) -{ - if (buf == NULL) - return; - - if (buf->data_p != NULL) - { - free(buf->data_p); - buf->data_p = NULL; - } - buf->buffer_size = 0; -} - -/******************************************************************* - reallocate a memory buffer -********************************************************************/ -BOOL prs_realloc_data(prs_struct *buf, size_t new_size) -{ - char *new_data; - - /* prs_sma_init(); JERRY */ - - prs_debug(buf, 200, "prs_realloc_data - before", "prs_realloc_data"); - - SMB_ASSERT(((ssize_t) new_size) >= 0); - - if (new_size == 0) - { - prs_free_data(buf); - return True; - } - - /* new_data = sma_realloc(prs_sma_region, buf->data_p, new_size); */ - new_data = realloc(buf->data_p, new_size); - - if (new_data != NULL) - { - if (new_size > buf->buffer_size) - { - memset(&new_data[buf->buffer_size], 0, - new_size - buf->buffer_size); - } - buf->data_p = new_data; - buf->buffer_size = new_size; - } - else if (buf->buffer_size >= new_size) - { - DEBUG(3, ("prs_realloc_data: warning - " - "could not realloc to %d\n", new_size)); - } - else - { - DEBUG(3, ("prs_realloc_data: error - " - "could not realloc to %d\n", new_size)); - - prs_free_data(buf); - return False; - } - - prs_debug(buf, 200, "prs_realloc_data - after", "prs_realloc_data"); - return True; -} - -/******************************************************************* - return the memory location specified by offset; may return NULL. - ********************************************************************/ -char *prs_data(const prs_struct *buf, uint32 offset) -{ - - /* do we have something to look at? */ - if (buf == NULL) - return NULL; - - /* check to make sure the offset is within range */ - if ((offset < 0) || (offset >= buf->buffer_size)) - return NULL; - - /* locate the memory address */ - if (buf->data_p != NULL) - { - return &(buf->data_p[offset]); - } - - /* default return */ - return NULL; -} - - - - /* useful function to store a structure in rpc wire format */ int tdb_prs_store(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps) { diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index c0c6e36ae1..9f5fdccfe7 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -24,17 +24,6 @@ #include "includes.h" -#ifdef TNG - #define prs_uint16 _prs_uint16 - #define prs_uint32 _prs_uint32 - #define prs_uint8s _prs_uint8s - #define prs_uint16s _prs_uint16s - #define prs_unistr _prs_unistr - #define init_unistr2 make_unistr2 - #define init_buf_unistr2 make_buf_unistr2 -#endif - - extern int DEBUGLEVEL; /******************************************************************* return the length of a UNISTR string. @@ -325,7 +314,7 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs prs_debug(ps, depth, desc, "smb_io_notify_info_data"); depth++; - how_many_words=data->size; + how_many_words=data->size; if (how_many_words==POINTER) { how_many_words=TWO_VALUE; } @@ -785,6 +774,26 @@ BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_ return True; } +/******************************************************************* + * make a structure. + ********************************************************************/ +BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, + const POLICY_HND *handle, + const UNISTR2 *valuename, + uint32 size) +{ + if (q_u == NULL) return False; + + DEBUG(5,("make_spoolss_q_getprinterdata\n")); + + q_u->handle = *handle; + copy_unistr2(&q_u->valuename, valuename); + q_u->size = size; + + return True; +} + + /******************************************************************* * read a structure. * called from spoolss_q_getprinterdata (srv_spoolss.c) @@ -3252,6 +3261,24 @@ BOOL new_spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS return True; } +/******************************************************************* + * init a structure. + ********************************************************************/ +BOOL make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, + const char *name, + const char *environment, + uint32 level, + NEW_BUFFER *buffer, uint32 offered) +{ + init_buf_unistr2(&q_u->name, &q_u->name_ptr, name); + init_buf_unistr2(&q_u->environment, &q_u->environment_ptr, environment); + + q_u->level=level; + q_u->buffer=buffer; + q_u->offered=offered; + + return True; +} /******************************************************************* Parse a SPOOL_Q_ENUMPRINTERDRIVERS structure. @@ -4208,6 +4235,27 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, return True; } +/******************************************************************* + * init a structure. + ********************************************************************/ +BOOL make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR *q_u, + fstring servername, fstring env_name, uint32 level, + NEW_BUFFER *buffer, uint32 offered) +{ + q_u->name_ptr = (servername != NULL) ? 1 : 0; + init_unistr2(&(q_u->name), servername, strlen(servername)); + + q_u->environment_ptr = (env_name != NULL) ? 1 : 0; + init_unistr2(&(q_u->environment), env_name, strlen(env_name)); + + q_u->level=level; + q_u->buffer=buffer; + q_u->offered=offered; + + return True; +} + + /******************************************************************* Parse a SPOOL_Q_GETPRINTERDRIVERDIR structure. ********************************************************************/ -- cgit From 2de59a3bea1c2369f6aef82bfe0d4b31d25ec519 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 18 Jul 2000 05:13:44 +0000 Subject: fixed a bug (my own) in create_ntc_from_cli_state() --jerry (This used to be commit f7bc6df3befb8d0981dbd96f353039a5913321d7) --- source3/rpc_parse/parse_creds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c index 672b9f28e0..9ffc5d7a69 100644 --- a/source3/rpc_parse/parse_creds.c +++ b/source3/rpc_parse/parse_creds.c @@ -434,7 +434,7 @@ void create_ntc_from_cli_state (CREDS_NT *to, const struct cli_state *cli_from) */ if (cli_from == NULL) { - copy_nt_creds (to, cli_from); + copy_nt_creds (to, NULL); return; } @@ -607,7 +607,7 @@ BOOL create_user_creds( prs_struct *ps, const char* name, uint16 version, uint16 command, uint32 pid, - const struct user_creds *usr) + struct user_creds *usr) { CREDS_CMD cmd; -- cgit From 2637bfee06c1fb2d5fcb9345ff56b0883e024f31 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 18 Jul 2000 19:25:32 +0000 Subject: rpc_parse/parse_prs.c: Removed extraneous ()'s. rpc_parse/parse_spoolss.c: Fixed the security descriptor marshalling in a INFO_2 struct. for some reason SD's should be done inline after the info2, not as the last buffer marshall. rpc_server/srv_spoolss_nt.c: Removed extraneous ()'s. Jeremy. (This used to be commit f038a24e9f624fdb04cd52769d45783248ce8a38) --- source3/rpc_parse/parse_prs.c | 4 ++-- source3/rpc_parse/parse_spoolss.c | 40 +++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 23 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 1bda5ef506..5f43e52975 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -817,7 +817,7 @@ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, int len, int m BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset) { - (*offset) = ps->data_offset; + *offset = ps->data_offset; if (UNMARSHALLING(ps)) { /* reading. */ return prs_uint16(name, ps, depth, data16); @@ -864,7 +864,7 @@ BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset) { - (*offset) = ps->data_offset; + *offset = ps->data_offset; if (UNMARSHALLING(ps)) { /* reading. */ return prs_uint32(name, ps, depth, data32); diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 9f5fdccfe7..a6de6d45d9 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -333,10 +333,9 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs return False; if(!prs_uint32("id", ps, depth, &data->id)) return False; -#if 1 /* JRATEST - NEEDED ???? */ if(!prs_uint32("how many words", ps, depth, &how_many_words)) return False; -#endif /* JRATEST - NEEDED ???? */ + /*prs_align(ps);*/ @@ -1358,7 +1357,7 @@ static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int d ********************************************************************/ static BOOL new_smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *string) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; if (MARSHALLING(ps)) { uint32 struct_offset = prs_offset(ps); @@ -1421,15 +1420,6 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui p=*string; q=*string; -#if 0 /* JRATEST */ - if (p == NULL) { - relative_offset = 0; - if (!prs_uint32("offset", ps, depth, &relative_offset)) - return False; - return True; - } -#endif - /* first write the last 0 */ buffer->string_at_end -= 2; if(!prs_set_offset(ps, buffer->string_at_end)) @@ -1438,13 +1428,6 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui if(!prs_uint16("leading zero", ps, depth, &zero)) return False; -#if 0 /* JRATEST */ - if (p == NULL) - p = &zero; - if (q == NULL) - q = &zero; -#endif /* JRATEST */ - while (p && (*p!=0)) { while (*q!=0) q++; @@ -1532,11 +1515,15 @@ static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, } if (*secdesc != NULL) { +#if 0 /* JRATEST */ + if(!prs_set_offset(ps, 0x54)) + return False; +#else buffer->string_at_end -= sec_desc_size(*secdesc); if(!prs_set_offset(ps, buffer->string_at_end)) return False; - +#endif /* write the secdesc */ if (!sec_io_desc(desc, secdesc, ps, depth)) return False; @@ -1547,6 +1534,10 @@ static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, relative_offset=buffer->string_at_end - buffer->struct_start; /* write its offset */ +#if 0 /* JRATEST */ + relative_offset = 0x54; +#endif + if (!prs_uint32("offset", ps, depth, &relative_offset)) return False; } else { @@ -1763,6 +1754,7 @@ BOOL new_smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *i ********************************************************************/ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) { + uint32 sec_offset; prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "new_smb_io_printer_info_2"); @@ -1798,7 +1790,7 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i if (!new_smb_io_relstr("parameters", buffer, depth, &info->parameters)) return False; - if (!new_smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc)) + if (!prs_uint32_pre("secdesc_ptr ", ps, depth, NULL, &sec_offset)) return False; if (!prs_uint32("attributes", ps, depth, &info->attributes)) @@ -1818,6 +1810,12 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i if (!prs_uint32("averageppm", ps, depth, &info->averageppm)) return False; + if (!prs_uint32_post("secdesc_ptr", ps, depth, NULL, sec_offset, info->secdesc ? prs_offset(ps) : 0 )) + return False; + + if (!sec_io_desc("secdesc", &info->secdesc, ps, depth)) + return False; + return True; } -- cgit From e5c5b2723f85467ce5a4a759bbe63ef59958c4ba Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 21 Jul 2000 19:58:24 +0000 Subject: Added functions for enumerating ports on remote print server. Tim, You should also look at new_smb_io_printer_info_2() and see if the change from NULL to &i regarding the secdesc is ok. jerry (This used to be commit a2205c6646aa677090908a4e1532ed8590adc0e0) --- source3/rpc_parse/parse_spoolss.c | 54 ++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index a6de6d45d9..8574112802 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1756,6 +1756,7 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i { uint32 sec_offset; prs_struct *ps=&buffer->prs; + int i = 0; prs_debug(ps, depth, desc, "new_smb_io_printer_info_2"); depth++; @@ -1790,7 +1791,7 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i if (!new_smb_io_relstr("parameters", buffer, depth, &info->parameters)) return False; - if (!prs_uint32_pre("secdesc_ptr ", ps, depth, NULL, &sec_offset)) + if (!prs_uint32_pre("secdesc_ptr ", ps, depth, &i, &sec_offset)) return False; if (!prs_uint32("attributes", ps, depth, &info->attributes)) @@ -1810,7 +1811,7 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i if (!prs_uint32("averageppm", ps, depth, &info->averageppm)) return False; - if (!prs_uint32_post("secdesc_ptr", ps, depth, NULL, sec_offset, info->secdesc ? prs_offset(ps) : 0 )) + if (!prs_uint32_post("secdesc_ptr", ps, depth, &i, sec_offset, info->secdesc ? prs_offset(ps) : 0 )) return False; if (!sec_io_desc("secdesc", &info->secdesc, ps, depth)) @@ -1839,6 +1840,32 @@ BOOL new_smb_io_printer_info_3(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *i return True; } +/******************************************************************* + Parse a PRINTER_INFO_3 structure. +********************************************************************/ +BOOL new_smb_io_port_info_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) +{ + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "new_smb_io_printer_info_3"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if (!new_smb_io_relstr("port_name", buffer, depth, &info->port_name)) + return False; + if (!new_smb_io_relstr("monitor_name", buffer, depth, &info->monitor_name)) + return False; + if (!new_smb_io_relstr("description", buffer, depth, &info->description)) + return False; + if (!prs_uint32("port_type", ps, depth, &info->port_type)) + return False; + if (!prs_uint32("reserved", ps, depth, &info->reserved)) + return False; + + return True; +} + /******************************************************************* Parse a DRIVER_INFO_1 structure. ********************************************************************/ @@ -2780,6 +2807,23 @@ BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, uint32 flags, return True; } +/******************************************************************* + * init a structure. + ********************************************************************/ +BOOL make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS *q_u, + fstring servername, uint32 level, + NEW_BUFFER *buffer, uint32 offered) +{ + q_u->name_ptr = (servername != NULL) ? 1 : 0; + init_buf_unistr2(&q_u->name, &q_u->name_ptr, servername); + + q_u->level=level; + q_u->buffer=buffer; + q_u->offered=offered; + + return True; +} + /******************************************************************* * read a structure. * called from spoolss_enumprinters (srv_spoolss.c) @@ -4240,11 +4284,9 @@ BOOL make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR *q_u, fstring servername, fstring env_name, uint32 level, NEW_BUFFER *buffer, uint32 offered) { - q_u->name_ptr = (servername != NULL) ? 1 : 0; - init_unistr2(&(q_u->name), servername, strlen(servername)); + init_buf_unistr2(&q_u->name, &q_u->name_ptr, servername); - q_u->environment_ptr = (env_name != NULL) ? 1 : 0; - init_unistr2(&(q_u->environment), env_name, strlen(env_name)); + init_buf_unistr2(&q_u->environment, &q_u->environment_ptr, env_name); q_u->level=level; q_u->buffer=buffer; -- cgit From 78bbcec21b0683aa859aceeb42b106580d48e467 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 22 Jul 2000 00:48:29 +0000 Subject: Fixed open handle code in printers - 3 functions were always being done in order - moved them into open_printer_hnd(). Added saving of comment field. Jeremy. (This used to be commit a0ee774fe92e5d0bc84d1d6729e8c538c67e8aba) --- source3/rpc_parse/parse_spoolss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 8574112802..fd120a57ec 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4236,8 +4236,7 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, DEBUG(7,("Converting from UNICODE to ASCII\n")); time_unix=time(NULL); - if (*asc==NULL) - { + if (*asc==NULL) { DEBUGADD(8,("allocating memory\n")); *asc=(NT_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(NT_PRINTER_INFO_LEVEL_2)); @@ -4268,6 +4267,7 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, unistr2_to_ascii(d->sharename, &uni->sharename, sizeof(d->sharename)-1); unistr2_to_ascii(d->portname, &uni->portname, sizeof(d->portname)-1); unistr2_to_ascii(d->drivername, &uni->drivername, sizeof(d->drivername)-1); + unistr2_to_ascii(d->comment, &uni->comment, sizeof(d->comment)-1); unistr2_to_ascii(d->location, &uni->location, sizeof(d->location)-1); unistr2_to_ascii(d->sepfile, &uni->sepfile, sizeof(d->sepfile)-1); unistr2_to_ascii(d->printprocessor, &uni->printprocessor, sizeof(d->printprocessor)-1); -- cgit From 5a5ef183799dd84ff453db849e929533e709fd0b Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Tue, 25 Jul 2000 13:15:16 +0000 Subject: A rather big change set ! (listed in no particular order) - changed the default forms flag to 2 - all short architecture name are uppercased - get_short_archi() is now case unsensitive - the drivers TDB is indexed by archi/version/name - implemented code to move drivers from the upload area to the download area. Someone else need to look at that code. - don't return anymore a default driver if it doesn't exist in the TDB. Instead return an error. - cleaned prs_unistr. - #ifdef out jeremy's new SD parsing in printer_info_2 - removed the unused MANGLE_CODE - #ifdef out the security checking in update_printer() as it doesn't work for me. Zap your ntdrivers.tdb, it won't work anymore. J.F. (This used to be commit ac0a145acc0953a6f362497abbf4dfe70aa522a6) --- source3/rpc_parse/parse_prs.c | 57 --------------------------------------- source3/rpc_parse/parse_spoolss.c | 13 ++++++--- 2 files changed, 9 insertions(+), 61 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 5f43e52975..42a3410752 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -628,61 +628,6 @@ BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int de in little-endian format then do it as a stream of bytes. ********************************************************************/ -#ifndef RPCCLIENT_TEST -BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) -{ - int len = 0; - unsigned char *p = (unsigned char *)str->buffer; - uint8 *start; - char *q; - char zero=0; - - for(len = 0; len < (sizeof(str->buffer) / sizeof(str->buffer[0])) && - str->buffer[len] != 0; len++) - ; - - q = prs_mem_get(ps, (len+1)*2); - if (q == NULL) - return False; - - start = (uint8*)q; - - for(len = 0; len < (sizeof(str->buffer) / sizeof(str->buffer[0])) && - str->buffer[len] != 0; len++) { - if(ps->bigendian_data) { - RW_SVAL(ps->io, ps->bigendian_data, q, *p, 0); - p += 2; - q += 2; - } else { - RW_CVAL(ps->io, q, *p, 0); - p++; - q++; - RW_CVAL(ps->io, q, *p, 0); - p++; - q++; - } - } - - /* - * even if the string is 'empty' (only an \0 char) - * at this point the leading \0 hasn't been parsed. - * so parse it now - */ - - RW_CVAL(ps->io, q, zero, 0); - q++; - RW_CVAL(ps->io, q, zero, 0); - q++; - - len++; - - ps->data_offset += len*2; - - dump_data(5+depth, (char *)start, len * 2); - - return True; -} -#else BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) { int len = 0; @@ -769,8 +714,6 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) return True; } -#endif /* RPCCLIENT_TEST */ - /******************************************************************* Stream a null-terminated string. len is strlen, and therefore does diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index fd120a57ec..b0223d2803 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1791,8 +1791,13 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i if (!new_smb_io_relstr("parameters", buffer, depth, &info->parameters)) return False; - if (!prs_uint32_pre("secdesc_ptr ", ps, depth, &i, &sec_offset)) +#if 0 /* JFMTEST */ + if (!prs_uint32_pre("secdesc_ptr ", ps, depth, NULL, &sec_offset)) return False; +#else + if (!new_smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc)) + return False; +#endif if (!prs_uint32("attributes", ps, depth, &info->attributes)) return False; @@ -1811,12 +1816,13 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i if (!prs_uint32("averageppm", ps, depth, &info->averageppm)) return False; - if (!prs_uint32_post("secdesc_ptr", ps, depth, &i, sec_offset, info->secdesc ? prs_offset(ps) : 0 )) +#if 0 /* JFMTEST */ + if (!prs_uint32_post("secdesc_ptr", ps, depth, NULL, sec_offset, info->secdesc ? prs_offset(ps)-buffer->struct_start : 0 )) return False; if (!sec_io_desc("secdesc", &info->secdesc, ps, depth)) return False; - +#endif return True; } @@ -4285,7 +4291,6 @@ BOOL make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR *q_u, NEW_BUFFER *buffer, uint32 offered) { init_buf_unistr2(&q_u->name, &q_u->name_ptr, servername); - init_buf_unistr2(&q_u->environment, &q_u->environment_ptr, env_name); q_u->level=level; -- cgit From 1e3a5503cd27109e3b79da9d1115ef80317e6849 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Wed, 26 Jul 2000 09:40:49 +0000 Subject: Found out that we are crashing spoolss in enumprinterdata. So fixed enumprinterdatas in rpcclient to debug the server code, and found that the parsing code was missing 2 prs_align(). We are not crashing NT anymore. :-) J.F. (This used to be commit 883f7402d495182aeff85152216cc8b3cfc18bef) --- source3/rpc_parse/parse_spoolss.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b0223d2803..bee8bae8cf 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2434,7 +2434,7 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) size += 4; /* JRA !!!! TESTME - WHAT ABOUT prs_align.... !!! */ size += sec_desc_size( info->secdesc ); - + size+=size_of_device_mode( info->devmode ); size+=size_of_relative_string( &info->servername ); @@ -4581,6 +4581,10 @@ BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_ return False; if(!prs_uint16s(False, "value", ps, depth, r_u->value, r_u->valuesize)) return False; + + if(!prs_align(ps)) + return False; + if(!prs_uint32("realvaluesize", ps, depth, &r_u->realvaluesize)) return False; @@ -4591,6 +4595,9 @@ BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_ return False; if(!prs_uint8s(False, "data", ps, depth, r_u->data, r_u->datasize)) return False; + if(!prs_align(ps)) + return False; + if(!prs_uint32("realdatasize", ps, depth, &r_u->realdatasize)) return False; if(!prs_uint32("status", ps, depth, &r_u->status)) -- cgit From 5ec1642809d9de83da8c88c65d6595c6eb0270f5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 27 Jul 2000 00:47:19 +0000 Subject: Ok - this is a *BIG* change - but it fixes the problems with static strings in the RPC code. This change was prompted by trying to save a long (>256) character comment in the printer properties page. The new system associates a TALLOC_CTX with the pipe struct, and frees the pool on return of a complete PDU. A global TALLOC_CTX is used for the odd buffer allocated in the BUFFERxx code, and is freed in the main loop. This code works with insure, and seems to be free of memory leaks and crashes (so far) but there are probably the occasional problem with code that uses UNISTRxx structs on the stack and expects them to contain storage without doing a init_unistrXX(). This means that rpcclient will probably be horribly broken. A TALLOC_CTX also needed associating with the struct cli_state also, to make the prs_xx code there work. The main interface change is the addition of a TALLOC_CTX to the prs_init calls - used for dynamic allocation in the prs_XXX calls. Now this is in place it should make dynamic allocation of all RPC memory on unmarshall *much* easier to fix. Jeremy. (This used to be commit 0ff2ce543ee54f7364e6d839db6d06e7ef1edcf4) --- source3/rpc_parse/parse_creds.c | 4 +- source3/rpc_parse/parse_misc.c | 190 ++++++++++++++++++++++++-------------- source3/rpc_parse/parse_prs.c | 101 +++++++++++++++----- source3/rpc_parse/parse_spoolss.c | 64 +++++++++---- 4 files changed, 248 insertions(+), 111 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c index 9ffc5d7a69..c34a7f5ac3 100644 --- a/source3/rpc_parse/parse_creds.c +++ b/source3/rpc_parse/parse_creds.c @@ -597,7 +597,7 @@ BOOL create_ntuser_creds( prs_struct *ps, usr.ptr_ntc = 0; } - prs_init(ps, 1024, 4, False); + prs_init(ps, 1024, 4, NULL, False); ps->data_offset = 4; return creds_io_cmd("creds", &cmd, ps, 0); @@ -623,7 +623,7 @@ BOOL create_user_creds( prs_struct *ps, cmd.ptr_creds = usr != NULL ? 1 : 0; cmd.cred = usr; - prs_init(ps, 1024, 4, False); + prs_init(ps, 1024, 4, NULL, False); ps->data_offset = 4; return creds_io_cmd("creds", &cmd, ps, 0); diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index fe2778a356..2a642e1cec 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -26,6 +26,20 @@ extern int DEBUGLEVEL; +static TALLOC_CTX *parse_misc_talloc = NULL; + +/******************************************************************* a +free up temporary memory - called from the main loop +********************************************************************/ + +void parse_talloc_free(void) +{ + if (!parse_misc_talloc) + return; + talloc_destroy(parse_misc_talloc); + parse_misc_talloc = NULL; +} + /******************************************************************* Reads or writes a UTIME type. ********************************************************************/ @@ -296,12 +310,6 @@ BOOL smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth) if(!prs_uint32("buffer ", ps, depth, &hdr->buffer)) return False; - /* oops! XXXX maybe issue a warning that this is happening... */ - if (hdr->str_max_len > MAX_STRINGLEN) - hdr->str_max_len = MAX_STRINGLEN; - if (hdr->str_str_len > MAX_STRINGLEN) - hdr->str_str_len = MAX_STRINGLEN; - return True; } @@ -338,12 +346,6 @@ BOOL smb_io_unihdr(char *desc, UNIHDR *hdr, prs_struct *ps, int depth) if(!prs_uint32("buffer ", ps, depth, &hdr->buffer)) return False; - /* oops! XXXX maybe issue a warning that this is happening... */ - if (hdr->uni_max_len > MAX_UNISTRLEN) - hdr->uni_max_len = MAX_UNISTRLEN; - if (hdr->uni_str_len > MAX_UNISTRLEN) - hdr->uni_str_len = MAX_UNISTRLEN; - return True; } @@ -429,12 +431,6 @@ BOOL smb_io_hdrbuf(char *desc, BUFHDR *hdr, prs_struct *ps, int depth) if(!prs_uint32("buf_len ", ps, depth, &hdr->buf_len)) return False; - /* oops! XXXX maybe issue a warning that this is happening... */ - if (hdr->buf_max_len > MAX_BUFFERLEN) - hdr->buf_max_len = MAX_BUFFERLEN; - if (hdr->buf_len > MAX_BUFFERLEN) - hdr->buf_len = MAX_BUFFERLEN; - return True; } @@ -477,8 +473,21 @@ BOOL smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) void init_unistr(UNISTR *str, const char *buf) { + size_t len = strlen(buf) + 1; + + if (!parse_misc_talloc) + parse_misc_talloc = talloc_init(); + + if (len < MAX_UNISTRLEN) + len = MAX_UNISTRLEN; + len *= sizeof(uint16); + + str->buffer = (uint16 *)talloc(parse_misc_talloc, len); + if (str->buffer == NULL) + smb_panic("init_unistr2: malloc fail\n"); + /* store the string (null-terminated copy) */ - dos_struni2((char *)str->buffer, buf, sizeof(str->buffer)); + dos_struni2((char *)str->buffer, buf, len); } /******************************************************************* @@ -502,6 +511,24 @@ BOOL smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) return True; } +/******************************************************************* + Allocate the BUFFER3 memory. +********************************************************************/ + +static void create_buffer3(BUFFER3 *str, size_t len) +{ + if (!parse_misc_talloc) + parse_misc_talloc = talloc_init(); + + if (len < MAX_BUFFERLEN) + len = MAX_BUFFERLEN; + + str->buffer = talloc(parse_misc_talloc, len); + if (str->buffer == NULL) + smb_panic("create_buffer3: malloc fail\n"); + +} + /******************************************************************* Inits a BUFFER3 structure from a uint32 ********************************************************************/ @@ -514,6 +541,7 @@ void init_buffer3_uint32(BUFFER3 *str, uint32 val) str->buf_max_len = sizeof(uint32); str->buf_len = sizeof(uint32); + create_buffer3(str, sizeof(uint32)); SIVAL(str->buffer, 0, val); } @@ -529,8 +557,10 @@ void init_buffer3_str(BUFFER3 *str, char *buf, int len) str->buf_max_len = len * 2; str->buf_len = len * 2; + create_buffer3(str, str->buf_max_len); + /* store the string (null-terminated 8 bit chars into 16 bit chars) */ - dos_struni2((char *)str->buffer, buf, sizeof(str->buffer)); + dos_struni2((char *)str->buffer, buf, str->buf_max_len); } /******************************************************************* @@ -540,6 +570,7 @@ void init_buffer3_str(BUFFER3 *str, char *buf, int len) void init_buffer3_hex(BUFFER3 *str, char *buf) { ZERO_STRUCTP(str); + create_buffer3(str, strlen(buf)); str->buf_max_len = str->buf_len = strhex_to_str((char *)str->buffer, sizeof(str->buffer), buf); } @@ -553,8 +584,10 @@ void init_buffer3_bytes(BUFFER3 *str, uint8 *buf, int len) /* max buffer size (allocated size) */ str->buf_max_len = len; - if (buf != NULL) - memcpy(str->buffer, buf, MIN(str->buf_len, sizeof(str->buffer))); + if (buf != NULL) { + create_buffer3(str, len); + memcpy(str->buffer, buf, len); + } str->buf_len = buf != NULL ? len : 0; } @@ -578,16 +611,17 @@ BOOL smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) if(!prs_uint32("uni_max_len", ps, depth, &buf3->buf_max_len)) return False; - if (buf3->buf_max_len > MAX_UNISTRLEN) - buf3->buf_max_len = MAX_UNISTRLEN; + if (UNMARSHALLING(ps)) { + buf3->buffer = prs_alloc_mem(ps, buf3->buf_max_len); + if (buf3->buffer == NULL) + return False; + } if(!prs_uint8s(True, "buffer ", ps, depth, buf3->buffer, buf3->buf_max_len)) return False; if(!prs_uint32("buf_len ", ps, depth, &buf3->buf_len)) return False; - if (buf3->buf_len > MAX_UNISTRLEN) - buf3->buf_len = MAX_UNISTRLEN; return True; } @@ -607,9 +641,10 @@ BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) prs_uint32("buf_len", ps, depth, &(buf5->buf_len)); /* reading: alloc the buffer first */ - if ( ps->io ) - { - buf5->buffer=(uint16 *)malloc( sizeof(uint16)*buf5->buf_len ); + if ( UNMARSHALLING(ps) ) { + buf5->buffer=(uint16 *)prs_alloc_mem(ps, sizeof(uint16)*buf5->buf_len ); + if (buf5->buffer == NULL) + return False; } prs_uint16s(True, "buffer", ps, depth, buf5->buffer, buf5->buf_len); @@ -617,15 +652,6 @@ BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) return True; } -/******************************************************************* - Frees a BUFFER5 structure (just the malloced part). -********************************************************************/ - -void free_buffer5(BUFFER5 *buf5) -{ - safe_free(buf5->buffer); -} - /******************************************************************* Inits a BUFFER2 structure. ********************************************************************/ @@ -639,8 +665,17 @@ void init_buffer2(BUFFER2 *str, uint8 *buf, int len) str->undoc = 0; str->buf_len = buf != NULL ? len : 0; - if (buf != NULL) - memcpy(str->buffer, buf, MIN(str->buf_len, sizeof(str->buffer))); + if (buf != NULL) { + if (!parse_misc_talloc) + parse_misc_talloc = talloc_init(); + + if (len < MAX_BUFFERLEN) + len = MAX_BUFFERLEN; + str->buffer = talloc(parse_misc_talloc, len); + if (str->buffer == NULL) + smb_panic("init_buffer2: malloc fail\n"); + memcpy(str->buffer, buf, MIN(str->buf_len, len)); + } } /******************************************************************* @@ -669,12 +704,6 @@ BOOL smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, in if(!prs_uint32("buf_len ", ps, depth, &buf2->buf_len)) return False; - /* oops! XXXX maybe issue a warning that this is happening... */ - if (buf2->buf_max_len > MAX_UNISTRLEN) - buf2->buf_max_len = MAX_UNISTRLEN; - if (buf2->buf_len > MAX_UNISTRLEN) - buf2->buf_len = MAX_UNISTRLEN; - /* buffer advanced by indicated length of string NOT by searching for null-termination */ @@ -721,6 +750,21 @@ void copy_unistr2(UNISTR2 *str, UNISTR2 *from) str->undoc = from->undoc; str->uni_str_len = from->uni_str_len; + if (str->buffer == NULL) { + size_t len = from->uni_max_len * 2; + + if (!parse_misc_talloc) + parse_misc_talloc = talloc_init(); + + if (len < MAX_UNISTRLEN) + len = MAX_UNISTRLEN; + len *= sizeof(uint16); + + str->buffer = (uint16 *)talloc(parse_misc_talloc, len); + if (str->buffer == NULL) + smb_panic("copy_unistr2: malloc fail\n"); + } + /* copy the string */ memcpy(str->buffer, from->buffer, sizeof(from->buffer)); } @@ -731,14 +775,23 @@ void copy_unistr2(UNISTR2 *str, UNISTR2 *from) void init_string2(STRING2 *str, char *buf, int len) { - /* set up string lengths. */ - str->str_max_len = len; - str->undoc = 0; - str->str_str_len = len; - - /* store the string */ - if(len != 0) - memcpy(str->buffer, buf, len); + /* set up string lengths. */ + str->str_max_len = len; + str->undoc = 0; + str->str_str_len = len; + + /* store the string */ + if(len != 0) { + if (!parse_misc_talloc) + parse_misc_talloc = talloc_init(); + + if (len < MAX_STRINGLEN) + len = MAX_STRINGLEN; + str->buffer = talloc(parse_misc_talloc, len); + if (str->buffer == NULL) + smb_panic("init_string2: malloc fail\n"); + memcpy(str->buffer, buf, len); + } } /******************************************************************* @@ -768,12 +821,6 @@ BOOL smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, in if(!prs_uint32("str_str_len", ps, depth, &str2->str_str_len)) return False; - /* oops! XXXX maybe issue a warning that this is happening... */ - if (str2->str_max_len > MAX_STRINGLEN) - str2->str_max_len = MAX_STRINGLEN; - if (str2->str_str_len > MAX_STRINGLEN) - str2->str_str_len = MAX_STRINGLEN; - /* buffer advanced by indicated length of string NOT by searching for null-termination */ if(!prs_string2(True, "buffer ", ps, depth, str2)) @@ -803,8 +850,19 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len) str->undoc = 0; str->uni_str_len = (uint32)len; + if (!parse_misc_talloc) + parse_misc_talloc = talloc_init(); + + if (len < MAX_UNISTRLEN) + len = MAX_UNISTRLEN; + len *= sizeof(uint16); + + str->buffer = (uint16 *)talloc(parse_misc_talloc, len); + if (str->buffer == NULL) + smb_panic("init_unistr2: malloc fail\n"); + /* store the string (null-terminated 8 bit chars into 16 bit chars) */ - dos_struni2((char *)str->buffer, buf, sizeof(str->buffer)); + dos_struni2((char *)str->buffer, buf, len); } /******************************************************************* @@ -834,12 +892,6 @@ BOOL smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, in if(!prs_uint32("uni_str_len", ps, depth, &uni2->uni_str_len)) return False; - /* oops! XXXX maybe issue a warning that this is happening... */ - if (uni2->uni_max_len > MAX_UNISTRLEN) - uni2->uni_max_len = MAX_UNISTRLEN; - if (uni2->uni_str_len > MAX_UNISTRLEN) - uni2->uni_str_len = MAX_UNISTRLEN; - /* buffer advanced by indicated length of string NOT by searching for null-termination */ if(!prs_unistr2(True, "buffer ", ps, depth, uni2)) @@ -957,14 +1009,14 @@ static void init_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) if (logon_srv != NULL) { log->undoc_buffer = 1; - init_unistr2(&(log->uni_logon_srv), logon_srv, strlen(logon_srv)+1); + init_unistr2(&log->uni_logon_srv, logon_srv, strlen(logon_srv)+1); } else { log->undoc_buffer = 0; } if (comp_name != NULL) { log->undoc_buffer2 = 1; - init_unistr2(&(log->uni_comp_name), comp_name, strlen(comp_name)+1); + init_unistr2(&log->uni_comp_name, comp_name, strlen(comp_name)+1); } else { log->undoc_buffer2 = 0; } diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 42a3410752..bf36b5b346 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -67,7 +67,7 @@ void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name) /******************************************************************* Initialise a parse structure - malloc the data if requested. ********************************************************************/ -BOOL prs_init(prs_struct *ps, uint32 size, uint8 align, BOOL io) +BOOL prs_init(prs_struct *ps, uint32 size, uint8 align, TALLOC_CTX *ctx, BOOL io) { ZERO_STRUCTP(ps); ps->io = io; @@ -77,6 +77,7 @@ BOOL prs_init(prs_struct *ps, uint32 size, uint8 align, BOOL io) ps->data_offset = 0; ps->buffer_size = 0; ps->data_p = NULL; + ps->mem_ctx = ctx; if (size != 0) { ps->buffer_size = size; @@ -98,17 +99,12 @@ BOOL prs_read(prs_struct *ps, int fd, size_t len, int timeout) BOOL ok; size_t prev_size = ps->buffer_size; if (!prs_grow(ps, len)) - { return False; - } - if (timeout > 0) - { + if (timeout > 0) { ok = (read_with_timeout(fd, &ps->data_p[prev_size], len, len,timeout) == len); - } - else - { + } else { ok = (read_data(fd, &ps->data_p[prev_size], len) == len); } return ok; @@ -128,6 +124,24 @@ void prs_mem_free(prs_struct *ps) ps->data_offset = 0; } +/******************************************************************* + Allocate memory when unmarshalling... + ********************************************************************/ + +char *prs_alloc_mem(prs_struct *ps, size_t size) +{ + return talloc(ps->mem_ctx, size); +} + +/******************************************************************* + Return the current talloc context we're using. + ********************************************************************/ + +TALLOC_CTX *prs_get_mem_context(prs_struct *ps) +{ + return ps->mem_ctx; +} + /******************************************************************* Hand some already allocated memory to a prs_struct. ********************************************************************/ @@ -543,11 +557,19 @@ BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *d BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 *str) { - char *p = (char *)str->buffer; + char *p; char *q = prs_mem_get(ps, str->buf_len); if (q == NULL) return False; + if (UNMARSHALLING(ps)) { + str->buffer = (uint16 *)prs_alloc_mem(ps,str->buf_len); + if (str->buffer == NULL) + return False; + } + + p = (char *)str->buffer; + /* If we're using big-endian, reverse to get little-endian. */ if(ps->bigendian_data) DBG_RW_PSVAL(charmode, name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, p, str->buf_len/2) @@ -569,6 +591,12 @@ BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 * if (q == NULL) return False; + if (UNMARSHALLING(ps)) { + str->buffer = prs_alloc_mem(ps,str->str_str_len); + if (str->buffer == NULL) + return False; + } + DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, ps->io, q, str->buffer, str->str_max_len) ps->data_offset += (str->str_str_len * sizeof(uint8)); @@ -583,16 +611,24 @@ BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 * BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *str) { - char *p = (char *)str->buffer; + char *p; char *q = prs_mem_get(ps, str->uni_str_len * sizeof(uint16)); if (q == NULL) return False; + if (UNMARSHALLING(ps)) { + str->buffer = (uint16 *)prs_alloc_mem(ps,str->uni_str_len * sizeof(uint16)); + if (str->buffer == NULL) + return False; + } + + p = (char *)str->buffer; + /* If we're using big-endian, reverse to get little-endian. */ if(ps->bigendian_data) DBG_RW_PSVAL(charmode, name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, p, str->uni_str_len) else - DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, ps->io, q, p, str->uni_str_len * 2) + DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, ps->io, q, p, str->uni_str_len * sizeof(uint16)) ps->data_offset += (str->uni_str_len * sizeof(uint16)); return True; @@ -608,16 +644,24 @@ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 * BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int depth) { - char *p = (char *)str->str.buffer; + char *p; char *q = prs_mem_get(ps, str->uni_str_len * sizeof(uint16)); if (q == NULL) return False; + if (UNMARSHALLING(ps)) { + str->str.buffer = (uint16 *)prs_alloc_mem(ps,str->uni_str_len * sizeof(uint16)); + if (str->str.buffer == NULL) + return False; + } + + p = (char *)str->str.buffer; + /* If we're using big-endian, reverse to get little-endian. */ if(ps->bigendian_data) DBG_RW_PSVAL(charmode, name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, p, str->uni_str_len) else - DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, ps->io, q, p, str->uni_str_len * 2) + DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, ps->io, q, p, str->uni_str_len * sizeof(uint16)) ps->data_offset += (str->uni_str_len * sizeof(uint16)); return True; @@ -638,8 +682,7 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) if (MARSHALLING(ps)) { - for(len = 0; len < (sizeof(str->buffer) / sizeof(str->buffer[0])) && - str->buffer[len] != 0; len++) + for(len = 0; str->buffer[len] != 0; len++) ; q = prs_mem_get(ps, (len+1)*2); @@ -648,8 +691,7 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) start = (uint8*)q; - for(len = 0; len < (sizeof(str->buffer) / sizeof(str->buffer[0])) && - str->buffer[len] != 0; len++) + for(len = 0; str->buffer[len] != 0; len++) { if(ps->bigendian_data) { @@ -685,9 +727,27 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) } else { /* unmarshalling */ + uint32 alloc_len = 0; len = -1; q = prs_data_p(ps) + prs_offset(ps); + /* + * Work out how much space we need and talloc it. + */ + { + uint32 max_len = (ps->buffer_size - ps->data_offset)/sizeof(uint16); + uint16 *ptr; + + for ( ptr = (uint16 *)q; *ptr && (alloc_len <= max_len); alloc_len++) + ; + + str->buffer = (uint16 *)prs_alloc_mem(ps,alloc_len * sizeof(uint16)); + if (str->buffer == NULL) + return False; + + p = (unsigned char *)str->buffer; + } + do { len++; @@ -705,8 +765,7 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) p++; q++; } - } while (len < (sizeof(str->buffer) / sizeof(str->buffer[0])) && - str->buffer[len] != 0); + } while (len < alloc_len && str->buffer[len] != 0); } ps->data_offset += len*2; @@ -852,7 +911,7 @@ int tdb_prs_store(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps) } /* useful function to fetch a structure into rpc wire format */ -int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps) +int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *mem_ctx) { TDB_DATA kbuf, dbuf; kbuf.dptr = keystr; @@ -862,7 +921,7 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps) if (!dbuf.dptr) return -1; ZERO_STRUCTP(ps); - prs_init(ps, 0, 4, UNMARSHALL); + prs_init(ps, 0, 4, mem_ctx, UNMARSHALL); prs_give_memory(ps, dbuf.dptr, dbuf.dsize, True); return 0; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index bee8bae8cf..9ec796d3e7 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -503,6 +503,12 @@ static BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE prs_debug(ps, depth, desc, "spoolss_io_devmode"); depth++; + if (UNMARSHALLING(ps)) { + devmode->devicename.buffer = prs_alloc_mem(ps, 32 * sizeof(uint16) ); + if (devmode->devicename.buffer == NULL) + return False; + } + if (!prs_uint16s(True,"devicename", ps, depth, devmode->devicename.buffer, 32)) return False; if (!prs_uint16("specversion", ps, depth, &devmode->specversion)) @@ -541,6 +547,13 @@ static BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE return False; if (!prs_uint16("collate", ps, depth, &devmode->collate)) return False; + + if (UNMARSHALLING(ps)) { + devmode->formname.buffer = prs_alloc_mem(ps, 32 * sizeof(uint16) ); + if (devmode->formname.buffer == NULL) + return False; + } + if (!prs_uint16s(True, "formname", ps, depth, devmode->formname.buffer, 32)) return False; if (!prs_uint16("logpixels", ps, depth, &devmode->logpixels)) @@ -683,12 +696,12 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, { DEBUG(5,("make_spoolss_q_open_printer_ex\n")); q_u->printername_ptr = (printername!=NULL)?1:0; - init_unistr2(&(q_u->printername), printername, strlen(printername)); + init_unistr2(&q_u->printername, printername, strlen(printername)); q_u->printer_default.datatype_ptr = 0; /* q_u->printer_default.datatype_ptr = (datatype!=NULL)?1:0; - init_unistr2(&(q_u->printer_default.datatype), datatype, strlen(datatype)); + init_unistr2(&q_u->printer_default.datatype, datatype, strlen(datatype)); */ q_u->printer_default.devmode_cont.size=0; q_u->printer_default.devmode_cont.devmode_ptr=0; @@ -704,8 +717,8 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, q_u->user_ctr.user1.major=2; q_u->user_ctr.user1.minor=0; q_u->user_ctr.user1.processor=0; - init_unistr2(&(q_u->user_ctr.user1.client_name), clientname, strlen(clientname)); - init_unistr2(&(q_u->user_ctr.user1.user_name), user_name, strlen(user_name)); + init_unistr2(&q_u->user_ctr.user1.client_name, clientname, strlen(clientname)); + init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)); return True; } @@ -1432,19 +1445,28 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui while (*q!=0) q++; + chaine.buffer = malloc((q-p+1)*sizeof(uint16)); + if (chaine.buffer == NULL) + return False; + memcpy(chaine.buffer, p, (q-p+1)*sizeof(uint16)); buffer->string_at_end -= (q-p+1)*sizeof(uint16); - if(!prs_set_offset(ps, buffer->string_at_end)) + if(!prs_set_offset(ps, buffer->string_at_end)) { + free(chaine.buffer); return False; + } /* write the string */ - if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) + if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) { + free(chaine.buffer); return False; + } q++; p=q; + free(chaine.buffer); } if(!prs_set_offset(ps, struct_offset)) @@ -1791,7 +1813,7 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i if (!new_smb_io_relstr("parameters", buffer, depth, &info->parameters)) return False; -#if 0 /* JFMTEST */ +#if 1 /* JFMTEST */ if (!prs_uint32_pre("secdesc_ptr ", ps, depth, NULL, &sec_offset)) return False; #else @@ -1816,7 +1838,7 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i if (!prs_uint32("averageppm", ps, depth, &info->averageppm)) return False; -#if 0 /* JFMTEST */ +#if 1 /* JFMTEST */ if (!prs_uint32_post("secdesc_ptr", ps, depth, NULL, sec_offset, info->secdesc ? prs_offset(ps)-buffer->struct_start : 0 )) return False; @@ -2121,7 +2143,7 @@ static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUF buffer->string_at_end=0; if (buffer->ptr==0) { - if (!prs_init(&buffer->prs, 0, 4, UNMARSHALL)) + if (!prs_init(&buffer->prs, 0, 4, prs_get_mem_context(ps), UNMARSHALL)) return False; return True; } @@ -2129,7 +2151,7 @@ static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUF if (!prs_uint32("size", ps, depth, &buffer->size)) return False; - if (!prs_init(&buffer->prs, buffer->size, 4, UNMARSHALL)) + if (!prs_init(&buffer->prs, buffer->size, 4, prs_get_mem_context(ps), UNMARSHALL)) return False; if (!prs_append_some_prs_data(&buffer->prs, ps, prs_offset(ps), buffer->size)) @@ -2804,7 +2826,7 @@ BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, uint32 flags, q_u->flags=flags; q_u->servername_ptr = (servername != NULL) ? 1 : 0; - init_unistr2(&(q_u->servername), servername, strlen(servername)); + init_unistr2(&q_u->servername, servername, strlen(servername)); q_u->level=level; q_u->buffer=buffer; @@ -3654,8 +3676,11 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s return False; ZERO_STRUCTP(il->info_1); } - if (!spool_io_printer_info_level_1("", il->info_1, ps, depth)) + if (!spool_io_printer_info_level_1("", il->info_1, ps, depth)) { + if (UNMARSHALLING(ps)) + safe_free(il->info_1); return False; + } break; } case 2: @@ -3664,8 +3689,11 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s return False; ZERO_STRUCTP(il->info_2); } - if (!spool_io_printer_info_level_2("", il->info_2, ps, depth)) + if (!spool_io_printer_info_level_2("", il->info_2, ps, depth)) { + if (UNMARSHALLING(ps)) + safe_free(il->info_2); return False; + } break; case 3: { @@ -3674,8 +3702,11 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s return False; ZERO_STRUCTP(il->info_3); } - if (!spool_io_printer_info_level_3("", il->info_3, ps, depth)) + if (!spool_io_printer_info_level_3("", il->info_3, ps, depth)) { + if (UNMARSHALLING(ps)) + safe_free(il->info_3); return False; + } break; } } @@ -3839,8 +3870,6 @@ void free_spool_printer_driver_info_level_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 ** if (il == NULL) return; - free_buffer5(&il->dependentfiles); - safe_free(il); } @@ -3985,9 +4014,6 @@ void free_spool_printer_driver_info_level_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 ** if (il == NULL) return; - free_buffer5(&il->dependentfiles); - free_buffer5(&il->previousnames); - safe_free(il); } -- cgit From 3cc9e1a6a7c27da971ef9f3be7a21b1f7e671c15 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Thu, 27 Jul 2000 08:00:25 +0000 Subject: remove warnings J.F. (This used to be commit 9178d2a1aac26f8d6533f7dc86ff9b19eb72db8b) --- source3/rpc_parse/parse_spoolss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 9ec796d3e7..af946f376a 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -504,7 +504,7 @@ static BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE depth++; if (UNMARSHALLING(ps)) { - devmode->devicename.buffer = prs_alloc_mem(ps, 32 * sizeof(uint16) ); + devmode->devicename.buffer = (uint16 *)prs_alloc_mem(ps, 32 * sizeof(uint16) ); if (devmode->devicename.buffer == NULL) return False; } @@ -549,7 +549,7 @@ static BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE return False; if (UNMARSHALLING(ps)) { - devmode->formname.buffer = prs_alloc_mem(ps, 32 * sizeof(uint16) ); + devmode->formname.buffer = (uint16 *)prs_alloc_mem(ps, 32 * sizeof(uint16) ); if (devmode->formname.buffer == NULL) return False; } -- cgit From b58ebd10dee6e779fb4b977a7f55db1b23001564 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 28 Jul 2000 06:27:32 +0000 Subject: Fixed read overrun in init_string2() (This used to be commit 4ab75143c4466ad0ea8443512dd5ade449d72462) --- source3/rpc_parse/parse_misc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 2a642e1cec..276e66a113 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -775,6 +775,8 @@ void copy_unistr2(UNISTR2 *str, UNISTR2 *from) void init_string2(STRING2 *str, char *buf, int len) { + int alloc_len = 0; + /* set up string lengths. */ str->str_max_len = len; str->undoc = 0; @@ -786,8 +788,8 @@ void init_string2(STRING2 *str, char *buf, int len) parse_misc_talloc = talloc_init(); if (len < MAX_STRINGLEN) - len = MAX_STRINGLEN; - str->buffer = talloc(parse_misc_talloc, len); + alloc_len = MAX_STRINGLEN; + str->buffer = talloc(parse_misc_talloc, alloc_len); if (str->buffer == NULL) smb_panic("init_string2: malloc fail\n"); memcpy(str->buffer, buf, len); -- cgit From f9d3ff99fda642bc0a0a4cd0eeb838df29ea4df6 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 31 Jul 2000 14:56:01 +0000 Subject: More work on rpcclient... * Fixed to work with Jeremy's recent changes re: dunamic memory allocation when unmarshalling unistr[2] * included EnumPorts level 1 * more work on AddPrinterEx --jerry (This used to be commit d321d0dddd052b49c94bef8f214be7343337d907) --- source3/rpc_parse/parse_spoolss.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index af946f376a..2adfc65eeb 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1814,7 +1814,7 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i return False; #if 1 /* JFMTEST */ - if (!prs_uint32_pre("secdesc_ptr ", ps, depth, NULL, &sec_offset)) + if (!prs_uint32_pre("secdesc_ptr ", ps, depth, &i, &sec_offset)) return False; #else if (!new_smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc)) @@ -1869,13 +1869,31 @@ BOOL new_smb_io_printer_info_3(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *i } /******************************************************************* - Parse a PRINTER_INFO_3 structure. + Parse a PORT_INFO_1 structure. +********************************************************************/ +BOOL new_smb_io_port_info_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) +{ + prs_struct *ps=&(buffer->prs); + + prs_debug(ps, depth, desc, "new_smb_io_port_info_1"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if (!new_smb_io_relstr("port_name", buffer, depth, &info->port_name)) + return False; + + return True; +} + +/******************************************************************* + Parse a PORT_INFO_2 structure. ********************************************************************/ BOOL new_smb_io_port_info_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) { prs_struct *ps=&(buffer->prs); - prs_debug(ps, depth, desc, "new_smb_io_printer_info_3"); + prs_debug(ps, depth, desc, "new_smb_io_port_info_2"); depth++; buffer->struct_start=prs_offset(ps); @@ -3665,10 +3683,7 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s */ case 0: break; - /* - * level 2 is used by addprinter - * and by setprinter when updating printer's info - */ + /* DOCUMENT ME!!! What is level 1 used for? */ case 1: { if (UNMARSHALLING(ps)) { @@ -3683,6 +3698,10 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s } break; } + /* + * level 2 is used by addprinter + * and by setprinter when updating printer's info + */ case 2: if (UNMARSHALLING(ps)) { if ((il->info_2=(SPOOL_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2))) == NULL) @@ -3695,6 +3714,7 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s return False; } break; + /* DOCUMENT ME!!! What is level 3 used for? */ case 3: { if (UNMARSHALLING(ps)) { -- cgit From 49fcb300de40d6da8682b485fd2c51236bcbb3dd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 31 Jul 2000 20:41:51 +0000 Subject: Added John Reilly's enumports/addprinter/delprinter scripting code plus the fix for the Win9x printer drivers. Changed command names to add "command" string on the end for some consistancy with the other scripting commands. Added '%P' option to tdbpack/unpack to store long comment string. Made port name be "Samba Printer Port" if no enum port script given. Fixed prs_uint32_pre code to cope with null args. Jeremy. (This used to be commit 902ada63799cf27924c72e24e7593a8c9fb5eba9) --- source3/rpc_parse/parse_prs.c | 2 +- source3/rpc_parse/parse_spoolss.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index bf36b5b346..71806e422e 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -867,7 +867,7 @@ BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset) { *offset = ps->data_offset; - if (UNMARSHALLING(ps)) { + if (UNMARSHALLING(ps) && (data32 != NULL)) { /* reading. */ return prs_uint32(name, ps, depth, data32); } else { diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 2adfc65eeb..d0a745d095 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1778,7 +1778,7 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i { uint32 sec_offset; prs_struct *ps=&buffer->prs; - int i = 0; + uint32 dummy = 0; prs_debug(ps, depth, desc, "new_smb_io_printer_info_2"); depth++; @@ -1814,7 +1814,7 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i return False; #if 1 /* JFMTEST */ - if (!prs_uint32_pre("secdesc_ptr ", ps, depth, &i, &sec_offset)) + if (!prs_uint32_pre("secdesc_ptr ", ps, depth, &dummy, &sec_offset)) return False; #else if (!new_smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc)) -- cgit From 7f36df301e28dc8ca0e5bfadc109d6e907d9ba2b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 1 Aug 2000 18:32:34 +0000 Subject: Tidyup removing many of the 0xC0000000 | NT_STATUS_XXX stuff (only need NT_STATUS_XXX). Removed IS_BITS_xxx macros as they were just reproducing "C" syntax in a more obscure way. Jeremy. (This used to be commit c55bcec817f47d6162466b193d533c877194124a) --- source3/rpc_parse/parse_rpc.c | 5 ++--- source3/rpc_parse/parse_samr.c | 4 ++-- source3/rpc_parse/parse_sec.c | 4 ++-- source3/rpc_parse/parse_spoolss.c | 6 +++--- 4 files changed, 9 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index af0569fd61..c40de10445 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -843,8 +843,7 @@ void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, offset = 0x40; - if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) - { + if (neg_flags & NTLMSSP_NEGOTIATE_UNICODE) { dom_len *= 2; wks_len *= 2; usr_len *= 2; @@ -872,7 +871,7 @@ void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, memcpy(rsp->lm_resp, lm_resp, 24); memcpy(rsp->nt_resp, nt_resp, 24); - if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { + if (neg_flags & NTLMSSP_NEGOTIATE_UNICODE) { dos_struni2(rsp->domain, domain, sizeof(rsp->domain)); dos_struni2(rsp->user, user, sizeof(rsp->user)); dos_struni2(rsp->wks, wks, sizeof(rsp->wks)); diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 47e69670f7..58e65fa0af 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1365,7 +1365,7 @@ void init_sam_info_2(SAM_INFO_2 *sam, uint32 acb_mask, } for (i = start_idx, entries_added = 0; i < num_sam_entries; i++) { - if (IS_BITS_SET_ALL(pass[i].acb_info, acb_mask)) { + if ((pass[i].acb_info & acb_mask) == acb_mask) { init_sam_entry2(&sam->sam[entries_added], start_idx + entries_added + 1, pass[i].uni_user_name.uni_str_len, @@ -1451,7 +1451,7 @@ void init_sam_info_1(SAM_INFO_1 *sam, uint32 acb_mask, for (i = 0, entries_added = 0; i < num_sam_entries; i++) { - if (IS_BITS_SET_ALL(pass[i].acb_info, acb_mask)) { + if ((pass[i].acb_info & acb_mask) == acb_mask) { init_sam_entry1(&sam->sam[entries_added], start_idx + entries_added + 1, pass[i].uni_user_name.uni_str_len, diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 4a7db6d7c2..00a1532470 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -510,7 +510,7 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) max_offset = MAX(max_offset, prs_offset(ps)); - if (IS_BITS_SET_ALL(psd->type, SEC_DESC_SACL_PRESENT) && psd->off_sacl) { + if ((psd->type & SEC_DESC_SACL_PRESENT) && psd->off_sacl) { if(!prs_set_offset(ps, old_offset + psd->off_sacl)) return False; if(!sec_io_acl("sacl", &psd->sacl, ps, depth)) @@ -521,7 +521,7 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) max_offset = MAX(max_offset, prs_offset(ps)); - if (IS_BITS_SET_ALL(psd->type, SEC_DESC_DACL_PRESENT) && psd->off_dacl != 0) { + if ((psd->type & SEC_DESC_DACL_PRESENT) && psd->off_dacl != 0) { if(!prs_set_offset(ps, old_offset + psd->off_dacl)) return False; if(!sec_io_acl("dacl", &psd->dacl, ps, depth)) diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index d0a745d095..e618a81cc8 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -173,10 +173,10 @@ static BOOL smb_io_doc_info_container(char *desc, DOC_INFO_CONTAINER *cont, prs_ if(!prs_align(ps)) return False; - if(!prs_uint32("level", ps, depth, &(cont->level))) + if(!prs_uint32("level", ps, depth, &cont->level)) return False; - if(!smb_io_doc_info("",&(cont->docinfo), ps, depth)) + if(!smb_io_doc_info("",&cont->docinfo, ps, depth)) return False; return True; @@ -234,7 +234,7 @@ static BOOL smb_io_notify_option_type_data(char *desc, SPOOL_NOTIFY_OPTION_TYPE /* parse the option type data */ for(i=0;icount2;i++) - if(!prs_uint16("fields",ps,depth,&(type->fields[i]))) + if(!prs_uint16("fields",ps,depth,&type->fields[i])) return False; return True; } -- cgit From 468af1937d327cc579dbbdae6e4a9b030998f049 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 2 Aug 2000 18:49:36 +0000 Subject: Much though I hate to admit it - JF was completely correct. I cannot now reproduce the bug I had with adding a printer driver, and PrintMig.exe crashes if I use my SD code but works with his. I stand completely corrected :-). - So I'm reverting to his code as it works :-). Jeremy. (This used to be commit d6db29be98f717a9038b5ac1ff492c70ce2e92a7) --- source3/rpc_parse/parse_spoolss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index e618a81cc8..bd33b634f8 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1813,7 +1813,7 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i if (!new_smb_io_relstr("parameters", buffer, depth, &info->parameters)) return False; -#if 1 /* JFMTEST */ +#if 0 /* JFMTEST */ if (!prs_uint32_pre("secdesc_ptr ", ps, depth, &dummy, &sec_offset)) return False; #else @@ -1838,7 +1838,7 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i if (!prs_uint32("averageppm", ps, depth, &info->averageppm)) return False; -#if 1 /* JFMTEST */ +#if 0 /* JFMTEST */ if (!prs_uint32_post("secdesc_ptr", ps, depth, NULL, sec_offset, info->secdesc ? prs_offset(ps)-buffer->struct_start : 0 )) return False; -- cgit From 394795e28b00eb95759938770cd24ee7c75ed39d Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 4 Aug 2000 12:42:19 +0000 Subject: After talking with Jeremy and JF (and staring at packet traces between NT <-> NT), I've come to realize that UNISTR2 strings should be NULL terminated. jerry (This used to be commit c8f9e54beafcb0c0668f1510e7693dbf22485aa8) --- source3/rpc_parse/parse_misc.c | 54 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 276e66a113..c0b700c908 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -852,14 +852,14 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len) str->undoc = 0; str->uni_str_len = (uint32)len; - if (!parse_misc_talloc) + if (!parse_misc_talloc) parse_misc_talloc = talloc_init(); if (len < MAX_UNISTRLEN) len = MAX_UNISTRLEN; len *= sizeof(uint16); - str->buffer = (uint16 *)talloc(parse_misc_talloc, len); + str->buffer = (uint16 *)talloc(parse_misc_talloc, len); if (str->buffer == NULL) smb_panic("init_unistr2: malloc fail\n"); @@ -867,6 +867,56 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len) dos_struni2((char *)str->buffer, buf, len); } +/******************************************************************* + Inits a UNISTR2 structure from a UNISTR +********************************************************************/ +void init_unistr2_from_unistr (UNISTR2 *to, UNISTR *from) +{ + + BOOL found; + uint32 i = 0; + + if ((to == NULL) || (from == NULL) || (from->buffer == NULL)) + return; + + ZERO_STRUCTP (to); + + /* get the length; UNISTR **are** NULL terminated */ + found = False; + while (!found) + { + if ((from->buffer)[i]=='\0' && (from->buffer)[(2*i)+1]=='\0') + found = True; + else + i++; + } + i++; + + if (!found) + { + DEBUG(0,("init_unistr2_from_unistr: non-null terminiated UNISTR!\n")); + return; + } + + /* set up string lengths. */ + to->uni_max_len = i; + to->undoc = 0; + to->uni_str_len = i; + + if (!parse_misc_talloc) + parse_misc_talloc = talloc_init(); + + to->buffer = (uint16 *)talloc(parse_misc_talloc, sizeof(uint16)*(to->uni_str_len)); + if (to->buffer == NULL) + smb_panic("init_unistr2_from_unistr: malloc fail\n"); + + for (i=0; i < to->uni_str_len; i++) + to->buffer[i] = from->buffer[i]; + + return; +} + + /******************************************************************* Reads or writes a UNISTR2 structure. XXXX NOTE: UNISTR2 structures need NOT be null-terminated. -- cgit From 4003a1c55bda51fa418ec7c077bfad775ac88ba5 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 4 Aug 2000 12:46:36 +0000 Subject: clunky support for calling AddPrinterEx(). The code currently reports that the call failed, but the printer shows up on the remote NT client. (note this is the client side call). I've botched the return value somewhere and will fix that today. jerry (This used to be commit e15d9befd24cf5f3410c4be819b2a1fcf68048fb) --- source3/rpc_parse/parse_spoolss.c | 119 +++++++++++++++++++++++++++++++++++--- 1 file changed, 111 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index bd33b634f8..033b680e64 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5,6 +5,7 @@ * Copyright (C) Andrew Tridgell 1992-2000, * Copyright (C) Luke Kenneth Casson Leighton 1996-2000, * Copyright (C) Jean Franois Micouleau 1998-2000. + * Copyright (C) Gerald Carter 2000 * * 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 @@ -723,6 +724,112 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, return True; } +/******************************************************************* + * init a structure. + ********************************************************************/ +BOOL make_spoolss_q_addprinterex(SPOOL_Q_ADDPRINTEREX *q_u, const char *srv_name, + const char* clientname, const char* user_name, + uint32 level, PRINTER_INFO_2 *info) +{ + DEBUG(5,("make_spoolss_q_addprinterex\n")); + + q_u->server_name_ptr = (srv_name!=NULL)?1:0; + init_unistr2(&q_u->server_name, srv_name, strlen(srv_name)); + + q_u->level = level; + + q_u->info.level = level; + q_u->info.info_ptr = (info!=NULL)?1:0; + switch (level) + { + case 2: + /* init q_u->info.info2 from *info */ + if (!make_spool_printer_info_2( &q_u->info.info_2, info)) + { + DEBUG(0,("make_spoolss_q_addprinterex: Unable to fill SPOOL_Q_ADDPRINTEREX struct!\n")); + return False; + } + break; + default : + break; + } + + q_u->unk0 = q_u->unk1 = q_u->unk2 = q_u->unk3 = 0; + + q_u->user_switch=1; + + q_u->user_ctr.level=1; + q_u->user_ctr.ptr=1; + q_u->user_ctr.user1.size=strlen(clientname)+strlen(user_name)+8; + q_u->user_ctr.user1.client_name_ptr = (clientname!=NULL)?1:0; + q_u->user_ctr.user1.user_name_ptr = (user_name!=NULL)?1:0; + q_u->user_ctr.user1.build=1381; + q_u->user_ctr.user1.major=2; + q_u->user_ctr.user1.minor=0; + q_u->user_ctr.user1.processor=0; + init_unistr2(&q_u->user_ctr.user1.client_name, clientname, strlen(clientname)); + init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)); + + return True; +} +/******************************************************************* +create a SPOOL_PRINTER_INFO_2 stuct from a PRINTER_INFO_2 struct +*******************************************************************/ +BOOL make_spool_printer_info_2(SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2, + PRINTER_INFO_2 *info) +{ + + SPOOL_PRINTER_INFO_LEVEL_2 *inf; + + /* allocate the necessary memory */ + inf = (SPOOL_PRINTER_INFO_LEVEL_2*)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2)); + if (spool_info2 == NULL) + { + DEBUG(0,("make_spool_printer_info_2: Unable to malloc SPOOL_PRINTER_INFO_LEVEL_2 sruct!\n")); + return False; + } + + ZERO_STRUCTP(inf); + + inf->servername_ptr = (info->servername.buffer!=NULL)?1:0; + inf->printername_ptr = (info->printername.buffer!=NULL)?1:0; + inf->sharename_ptr = (info->sharename.buffer!=NULL)?1:0; + inf->portname_ptr = (info->portname.buffer!=NULL)?1:0; + inf->drivername_ptr = (info->drivername.buffer!=NULL)?1:0; + inf->comment_ptr = (info->comment.buffer!=NULL)?1:0; + inf->location_ptr = (info->location.buffer!=NULL)?1:0; + inf->devmode_ptr = (info->devmode!=NULL)?1:0; + inf->sepfile_ptr = (info->sepfile.buffer!=NULL)?1:0; + inf->printprocessor_ptr = (info->printprocessor.buffer!=NULL)?1:0; + inf->datatype_ptr = (info->datatype.buffer!=NULL)?1:0; + inf->parameters_ptr = (info->parameters.buffer!=NULL)?1:0; + inf->secdesc_ptr = (info->secdesc!=NULL)?1:0; + inf->attributes = info->attributes; + inf->priority = info->priority; + inf->default_priority = info->defaultpriority; + inf->starttime = info->starttime; + inf->untiltime = info->untiltime; + inf->cjobs = info->cjobs; + inf->averageppm = info->averageppm; + init_unistr2_from_unistr(&inf->servername, &info->servername); + init_unistr2_from_unistr(&inf->printername, &info->printername); + init_unistr2_from_unistr(&inf->sharename, &info->sharename); + init_unistr2_from_unistr(&inf->portname, &info->portname); + init_unistr2_from_unistr(&inf->drivername, &info->drivername); + init_unistr2_from_unistr(&inf->comment, &info->comment); + init_unistr2_from_unistr(&inf->location, &info->location); + init_unistr2_from_unistr(&inf->sepfile, &info->sepfile); + init_unistr2_from_unistr(&inf->printprocessor, &info->printprocessor); + init_unistr2_from_unistr(&inf->datatype, &info->datatype); + init_unistr2_from_unistr(&inf->parameters, &info->parameters); + init_unistr2_from_unistr(&inf->datatype, &info->datatype); + inf->secdesc = NULL; + + *spool_info2 = inf; + + return True; +} + /******************************************************************* * read a structure. * called from spoolss_q_open_printer_ex (srv_spoolss.c) @@ -3741,12 +3848,6 @@ BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct prs_debug(ps, depth, desc, "spoolss_io_q_addprinterex"); depth++; - /* - * I think that's one of the few well written functions. - * the sub-structures are correctly parsed and analysed - * the info level are handled in a nice way. - */ - if(!prs_align(ps)) return False; if(!prs_uint32("", ps, depth, &q_u->server_name_ptr)) @@ -3772,6 +3873,8 @@ BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct * et le security descriptor. */ + if(!prs_align(ps)) + return False; if(!prs_uint32("unk0", ps, depth, &q_u->unk0)) return False; if(!prs_uint32("unk1", ps, depth, &q_u->unk1)) @@ -3789,10 +3892,10 @@ BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct return True; } - /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, + prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addprinterex"); depth++; -- cgit From 139dcbb0bfcf648f18646dcbf0b7b4281c5d4490 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 5 Aug 2000 18:58:45 +0000 Subject: Fixed bug in init_unistr2_from_unistr() found by Elrond. Thanks :-) j- (This used to be commit 4ecd15cd5851e94808756e3da0ce6a066f0a0cd7) --- source3/rpc_parse/parse_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index c0b700c908..73ea4b10d2 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -885,7 +885,7 @@ void init_unistr2_from_unistr (UNISTR2 *to, UNISTR *from) found = False; while (!found) { - if ((from->buffer)[i]=='\0' && (from->buffer)[(2*i)+1]=='\0') + if (from->buffer)[i]=='\0') found = True; else i++; -- cgit From cfb5d7d84c63d2b13e9d756a1c31b07a88c21e3f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 5 Aug 2000 19:03:00 +0000 Subject: removed the for() loop to copy the buffer in init_unistr2_from_unistr() Replaced with a memcpy() Forgot to commit this a few moments ago j- (This used to be commit 34d4fb54c3121d31cb8b29193f71d5e7b5471cdc) --- source3/rpc_parse/parse_misc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 73ea4b10d2..1cc072b7b5 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -906,13 +906,12 @@ void init_unistr2_from_unistr (UNISTR2 *to, UNISTR *from) if (!parse_misc_talloc) parse_misc_talloc = talloc_init(); + /* copy the string now */ to->buffer = (uint16 *)talloc(parse_misc_talloc, sizeof(uint16)*(to->uni_str_len)); if (to->buffer == NULL) smb_panic("init_unistr2_from_unistr: malloc fail\n"); - for (i=0; i < to->uni_str_len; i++) - to->buffer[i] = from->buffer[i]; - + memcpy( to->buffer, from->buffer, to->uni_str_len*sizeof(uint16) ); return; } -- cgit From 8705fbc42cb3d93a7a56f2673e6e1a19d346abee Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 5 Aug 2000 19:18:25 +0000 Subject: it is not my day it seems. :-( Fixed missing ) j- (This used to be commit 7b69cbbde36e51f8f7b74691428a04e8871d8b4a) --- source3/rpc_parse/parse_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 1cc072b7b5..c22f1a5d2e 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -885,7 +885,7 @@ void init_unistr2_from_unistr (UNISTR2 *to, UNISTR *from) found = False; while (!found) { - if (from->buffer)[i]=='\0') + if ((from->buffer)[i]=='\0') found = True; else i++; -- cgit From f296a8d087be261fee51a3a4664685bab1fb5ab1 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 8 Aug 2000 06:57:48 +0000 Subject: All changes related to rpcclient... - cleaned up some code - Fixed a few memory leaks of my own making - Add AddPrinterDriver(); I'm missing some of the semantics here as the call is done correctly, but I'm not getting all the information right in the DRIVER_INFO_3 struct I think. Will work on it tomorrow some more... --jerry (This used to be commit 3bf9a29f34ee4ade5180c5a0b0b9ff4aca7f0f08) --- source3/rpc_parse/parse_spoolss.c | 177 +++++++++++++++++++++++++++++++++++++- 1 file changed, 174 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 033b680e64..8ebdd55473 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -772,6 +772,41 @@ BOOL make_spoolss_q_addprinterex(SPOOL_Q_ADDPRINTEREX *q_u, const char *srv_name return True; } + +/******************************************************************* + free dynamically allocated members + ********************************************************************/ +void free_spoolss_q_addprinterex(SPOOL_Q_ADDPRINTEREX *q_u) +{ + switch (q_u->info.level) + { + case 1: + if (q_u->info.info_1 != NULL) + { + free(q_u->info.info_1); + q_u->info.info_1 = NULL; + } + break; + case 2: + if (q_u->info.info_2 != NULL) + { + free(q_u->info.info_2); + q_u->info.info_2 = NULL; + } + break; + case 3: + if (q_u->info.info_3 != NULL) + { + free(q_u->info.info_3); + q_u->info.info_3 = NULL; + } + break; + } + + return; + +} + /******************************************************************* create a SPOOL_PRINTER_INFO_2 stuct from a PRINTER_INFO_2 struct *******************************************************************/ @@ -898,8 +933,7 @@ BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_ ********************************************************************/ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, const POLICY_HND *handle, - const UNISTR2 *valuename, - uint32 size) + UNISTR2 *valuename, uint32 size) { if (q_u == NULL) return False; @@ -4243,7 +4277,143 @@ void free_spool_printer_driver_info_level(SPOOL_PRINTER_DRIVER_INFO_LEVEL *il) } /******************************************************************* -********************************************************************/ + init a SPOOL_Q_ADDPRINTERDRIVER struct + ******************************************************************/ +BOOL make_spoolss_q_addprinterdriver(SPOOL_Q_ADDPRINTERDRIVER *q_u, + const char* srv_name, uint32 level, + PRINTER_DRIVER_CTR *info) +{ + DEBUG(5,("make_spoolss_q_addprinterdriver\n")); + + q_u->server_name_ptr = (srv_name!=NULL)?1:0; + init_unistr2(&q_u->server_name, srv_name, strlen(srv_name)+1); + + q_u->level = level; + + q_u->info.level = level; + q_u->info.ptr = (info!=NULL)?1:0; + switch (level) + { + /* info level 3 is supported by Windows 95/98, + WinNT and Win2k */ + case 3 : + q_u->info.info_3=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3*) + malloc(sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); + make_spool_driver_info_3(q_u->info.info_3, info->info3); + break; + + /* info level 6 is supported by WinME and Win2k */ + case 6: + /* WRITEME!! will add later --jerry */ + break; + default: + DEBUG(0,("make_spoolss_q_addprinterdriver: Unknown \ +info level [%d]\n", level)); + break; + + } + + return True; +} + +BOOL make_spool_driver_info_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *spool_drv_info, + DRIVER_INFO_3 *info3) +{ + uint32 len = 0; + uint16 *ptr = info3->dependentfiles; + BOOL done = False; + BOOL null_char = False; + + spool_drv_info->cversion = info3->version; + spool_drv_info->name_ptr = (info3->name.buffer!=NULL)?1:0; + spool_drv_info->environment_ptr = (info3->architecture.buffer!=NULL)?1:0; + spool_drv_info->driverpath_ptr = (info3->driverpath.buffer!=NULL)?1:0; + spool_drv_info->datafile_ptr = (info3->datafile.buffer!=NULL)?1:0; + spool_drv_info->configfile_ptr = (info3->configfile.buffer!=NULL)?1:0; + spool_drv_info->helpfile_ptr = (info3->helpfile.buffer!=NULL)?1:0; + spool_drv_info->monitorname_ptr = (info3->monitorname.buffer!=NULL)?1:0; + spool_drv_info->defaultdatatype_ptr = (info3->defaultdatatype.buffer!=NULL)?1:0; + + init_unistr2_from_unistr(&spool_drv_info->name, &info3->name); + init_unistr2_from_unistr(&spool_drv_info->environment, &info3->architecture); + init_unistr2_from_unistr(&spool_drv_info->driverpath, &info3->driverpath); + init_unistr2_from_unistr(&spool_drv_info->datafile, &info3->datafile); + init_unistr2_from_unistr(&spool_drv_info->configfile, &info3->configfile); + init_unistr2_from_unistr(&spool_drv_info->helpfile, &info3->helpfile); + init_unistr2_from_unistr(&spool_drv_info->monitorname, &info3->monitorname); + init_unistr2_from_unistr(&spool_drv_info->defaultdatatype, &info3->defaultdatatype); + + while (!done) + { + switch (*ptr) + { + case 0: + /* the null_char BOOL is used to help locate + two '\0's back to back */ + if (null_char) + done = True; + else + null_char = True; + break; + + default: + null_char = False; + ;; + break; + } + len++; + ptr++; + } + spool_drv_info->dependentfiles_ptr = (info3->dependentfiles!=NULL)?1:0; + spool_drv_info->dependentfilessize = len; + make_spool_buffer5(&spool_drv_info->dependentfiles, len, info3->dependentfiles); + + return True; +} + +void free_spool_driver_info_3 (SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *info) +{ + if (info != NULL) + { + free_spool_buffer5(&info->dependentfiles); + } + + return; +} + +/******************************************************************* + make a BUFFER5 struct from a uint16* + ******************************************************************/ +BOOL make_spool_buffer5(BUFFER5 *buf5, uint32 len, uint16 *src) +{ + + buf5->buf_len = len; + if((buf5->buffer=(uint16*)malloc(sizeof(uint16)*len)) == NULL) + { + DEBUG(0,("make_spool_buffer5: Unable to malloc memory for buffer!\n")); + return False; + } + + memcpy(buf5->buffer, src, sizeof(uint16)*len); + + return True; +} + + +void free_spool_buffer5(BUFFER5 *buf) +{ + if (buf != NULL) + { + free(buf->buffer); + buf->buffer = NULL; + } + + return; +} + +/******************************************************************* + fill in the prs_struct for a ADDPRINTERDRIVER request PDU + ********************************************************************/ BOOL spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_addprinterdriver"); @@ -4855,6 +5025,7 @@ BOOL spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_st return True; } + /******************************************************************* ********************************************************************/ BOOL convert_specific_param(NT_PRINTER_PARAM **param, const UNISTR2 *value, -- cgit From 3a123d2572d91b648e2046a9fa1c0795ce680d3d Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 8 Aug 2000 06:59:35 +0000 Subject: cleanup in init_unistr2_from_unistr() --jerry (This used to be commit 1e00ac19cd001024fa8007eff5137aac877796fa) --- source3/rpc_parse/parse_misc.c | 46 +++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 27 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index c22f1a5d2e..617552009c 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -873,45 +873,37 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len) void init_unistr2_from_unistr (UNISTR2 *to, UNISTR *from) { - BOOL found; - uint32 i = 0; + uint32 i; - if ((to == NULL) || (from == NULL) || (from->buffer == NULL)) - return; - - ZERO_STRUCTP (to); + /* the destination UNISTR2 should never be NULL. + if it is it is a programming error */ - /* get the length; UNISTR **are** NULL terminated */ - found = False; - while (!found) - { - if ((from->buffer)[i]=='\0') - found = True; - else - i++; - } - i++; - - if (!found) - { - DEBUG(0,("init_unistr2_from_unistr: non-null terminiated UNISTR!\n")); + /* if the source UNISTR is NULL, then zero out + the destination string and return */ + ZERO_STRUCTP (to); + if ((from == NULL) || (from->buffer == NULL)) return; - } - /* set up string lengths. */ - to->uni_max_len = i; + /* get the length; UNISTR must be NULL terminated */ + i = 0; + while ((from->buffer)[i]!='\0') + i++; + + /* set up string lengths; uni_max_len is set to i+1 + because we need to account for the final NULL termination */ + to->uni_max_len = i+1; to->undoc = 0; - to->uni_str_len = i; + to->uni_str_len = i+1; if (!parse_misc_talloc) parse_misc_talloc = talloc_init(); - /* copy the string now */ + /* allocate the space and copy the string buffer */ to->buffer = (uint16 *)talloc(parse_misc_talloc, sizeof(uint16)*(to->uni_str_len)); if (to->buffer == NULL) smb_panic("init_unistr2_from_unistr: malloc fail\n"); - - memcpy( to->buffer, from->buffer, to->uni_str_len*sizeof(uint16) ); + memcpy(to->buffer, from->buffer, to->uni_max_len*sizeof(uint16)); + return; } -- cgit From a08d4448964641150cad0e6b3fb0055602ef79be Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 9 Aug 2000 20:14:29 +0000 Subject: More work on AddPrinterDriver() and AddPrinterEx() client RPC's Also fixed init_unistr() to deal with a NULL source character string. -jerry (This used to be commit 8ecd5dd52a6bd867f5d117352048ee43ce7254d9) --- source3/rpc_parse/parse_misc.c | 17 ++++++++++++++--- source3/rpc_parse/parse_spoolss.c | 13 +++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 617552009c..02ab707a40 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -473,21 +473,32 @@ BOOL smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) void init_unistr(UNISTR *str, const char *buf) { - size_t len = strlen(buf) + 1; + size_t len; - if (!parse_misc_talloc) + if (buf == NULL) + { + str->buffer = NULL; + return; + } + + + len = strlen(buf) + 1; + + if (!parse_misc_talloc) parse_misc_talloc = talloc_init(); if (len < MAX_UNISTRLEN) len = MAX_UNISTRLEN; len *= sizeof(uint16); - str->buffer = (uint16 *)talloc(parse_misc_talloc, len); + str->buffer = (uint16 *)talloc(parse_misc_talloc, len); if (str->buffer == NULL) smb_panic("init_unistr2: malloc fail\n"); /* store the string (null-terminated copy) */ dos_struni2((char *)str->buffer, buf, len); + + return; } /******************************************************************* diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 8ebdd55473..20660a9710 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -711,15 +711,15 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, q_u->user_switch=1; q_u->user_ctr.level=1; q_u->user_ctr.ptr=1; - q_u->user_ctr.user1.size=strlen(clientname)+strlen(user_name)+8; + q_u->user_ctr.user1.size=strlen(clientname)+strlen(user_name)+10; q_u->user_ctr.user1.client_name_ptr = (clientname!=NULL)?1:0; q_u->user_ctr.user1.user_name_ptr = (user_name!=NULL)?1:0; q_u->user_ctr.user1.build=1381; q_u->user_ctr.user1.major=2; q_u->user_ctr.user1.minor=0; q_u->user_ctr.user1.processor=0; - init_unistr2(&q_u->user_ctr.user1.client_name, clientname, strlen(clientname)); - init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)); + init_unistr2(&q_u->user_ctr.user1.client_name, clientname, strlen(clientname)+1); + init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)+1); return True; } @@ -760,15 +760,16 @@ BOOL make_spoolss_q_addprinterex(SPOOL_Q_ADDPRINTEREX *q_u, const char *srv_name q_u->user_ctr.level=1; q_u->user_ctr.ptr=1; - q_u->user_ctr.user1.size=strlen(clientname)+strlen(user_name)+8; q_u->user_ctr.user1.client_name_ptr = (clientname!=NULL)?1:0; q_u->user_ctr.user1.user_name_ptr = (user_name!=NULL)?1:0; q_u->user_ctr.user1.build=1381; q_u->user_ctr.user1.major=2; q_u->user_ctr.user1.minor=0; q_u->user_ctr.user1.processor=0; - init_unistr2(&q_u->user_ctr.user1.client_name, clientname, strlen(clientname)); - init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)); + init_unistr2(&q_u->user_ctr.user1.client_name, clientname, strlen(clientname)+1); + init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)+1); + q_u->user_ctr.user1.size=q_u->user_ctr.user1.user_name.uni_str_len + + q_u->user_ctr.user1.client_name.uni_str_len + 2; return True; } -- cgit From 2f9a0f83fe1029fddf3aae5f35ff3ccdf63f3134 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 10 Aug 2000 14:00:40 +0000 Subject: deal with allocation size of 0 in prs_unistr when UNMARSHALLING jerry (This used to be commit 26a73a70e282a5e46cc2b6fe7bc09b406724c9dd) --- source3/rpc_parse/parse_prs.c | 54 ++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 24 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 71806e422e..7bc9578863 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -679,6 +679,8 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) uint8 *start; char *q; char zero=0; + uint32 max_len; + uint16* ptr; if (MARSHALLING(ps)) { @@ -734,38 +736,42 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) /* * Work out how much space we need and talloc it. */ - { - uint32 max_len = (ps->buffer_size - ps->data_offset)/sizeof(uint16); - uint16 *ptr; - - for ( ptr = (uint16 *)q; *ptr && (alloc_len <= max_len); alloc_len++) - ; + max_len = (ps->buffer_size - ps->data_offset)/sizeof(uint16); + for ( ptr = (uint16 *)q; *ptr && (alloc_len <= max_len); alloc_len++) + ; + if (alloc_len > 0) + { str->buffer = (uint16 *)prs_alloc_mem(ps,alloc_len * sizeof(uint16)); if (str->buffer == NULL) return False; p = (unsigned char *)str->buffer; - } - do - { - len++; - - if(ps->bigendian_data) + do { - RW_SVAL(ps->io, ps->bigendian_data, q, *p, 0); - p += 2; - q += 2; - } else { - RW_CVAL(ps->io, q, *p, 0); - p++; - q++; - RW_CVAL(ps->io, q, *p, 0); - p++; - q++; - } - } while (len < alloc_len && str->buffer[len] != 0); + len++; + + if(ps->bigendian_data) + { + RW_SVAL(ps->io, ps->bigendian_data, q, *p, 0); + p += 2; + q += 2; + } else { + RW_CVAL(ps->io, q, *p, 0); + p++; + q++; + RW_CVAL(ps->io, q, *p, 0); + p++; + q++; + } + } while (len < alloc_len && str->buffer[len] != 0); + } + else + { + len = 0; + str->buffer = NULL; + } } ps->data_offset += len*2; -- cgit From 7ce5aacf7e18a61baff14ada94cb626acb446426 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 10 Aug 2000 14:03:13 +0000 Subject: working on the unmarshalling of dependentfiles to a DRIVER_INFO_3 struct. Not wuite there. jerry (This used to be commit 1a145977f09654fc51ebcd40ef7a2aa69aa96cfb) --- source3/rpc_parse/parse_spoolss.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 20660a9710..1a16d7ca9f 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1484,6 +1484,10 @@ static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int d prs_debug(ps, depth, desc, "spoolss_smb_io_unistr"); depth++; + + if (!prs_align(ps)) + return False; + if (!prs_unistr("unistr", ps, depth, uni)) return False; @@ -1642,8 +1646,11 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui l_chaine=str_len_uni(&chaine); if((chaine2=(uint16 *)Realloc(chaine2, (l_chaine2+l_chaine+1)*sizeof(uint16))) == NULL) return False; - memcpy(chaine2+l_chaine2, chaine.buffer, (l_chaine+1)*sizeof(uint16)); - l_chaine2+=l_chaine+1; + if (l_chaine > 0) + { + memcpy(chaine2+l_chaine2, chaine.buffer, (l_chaine+1)*sizeof(uint16)); + l_chaine2+=l_chaine+1; + } } while(l_chaine!=0); -- cgit From f6795780eb2384d17b31650419348b1c89bb5fbe Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 11 Aug 2000 23:13:09 +0000 Subject: Fixed the problem with UNISTR marshalling in a buffer5 struct. The smb_io_unistr() code called a prs_align, this was not being counted in the size or taken account of in the offset calculation. Fixed size_ calculation to always return a size a multiple of 4 and also set the offset correctly. This fixes the problem I saw and will hopefully fix the problem HP reported. JF please check this change. Jeremy. (This used to be commit ceba9f3dcdb4bddae17ec0024692c9074086302d) --- source3/rpc_parse/parse_misc.c | 11 +++---- source3/rpc_parse/parse_spoolss.c | 67 ++++++++++++--------------------------- 2 files changed, 25 insertions(+), 53 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 02ab707a40..e7b8c23619 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -475,8 +475,7 @@ void init_unistr(UNISTR *str, const char *buf) { size_t len; - if (buf == NULL) - { + if (buf == NULL) { str->buffer = NULL; return; } @@ -484,21 +483,19 @@ void init_unistr(UNISTR *str, const char *buf) len = strlen(buf) + 1; - if (!parse_misc_talloc) + if (!parse_misc_talloc) parse_misc_talloc = talloc_init(); if (len < MAX_UNISTRLEN) len = MAX_UNISTRLEN; len *= sizeof(uint16); - str->buffer = (uint16 *)talloc(parse_misc_talloc, len); + str->buffer = (uint16 *)talloc(parse_misc_talloc, len); if (str->buffer == NULL) - smb_panic("init_unistr2: malloc fail\n"); + smb_panic("init_unistr: malloc fail\n"); /* store the string (null-terminated copy) */ dos_struni2((char *)str->buffer, buf, len); - - return; } /******************************************************************* diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 1a16d7ca9f..3550c56e62 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -96,18 +96,18 @@ static BOOL smb_io_doc_info_1(char *desc, DOC_INFO_1 *info_1, prs_struct *ps, in if(!prs_align(ps)) return False; - if(!prs_uint32("p_docname", ps, depth, &(info_1->p_docname))) + if(!prs_uint32("p_docname", ps, depth, &info_1->p_docname)) return False; - if(!prs_uint32("p_outputfile", ps, depth, &(info_1->p_outputfile))) + if(!prs_uint32("p_outputfile", ps, depth, &info_1->p_outputfile)) return False; - if(!prs_uint32("p_datatype", ps, depth, &(info_1->p_datatype))) + if(!prs_uint32("p_datatype", ps, depth, &info_1->p_datatype)) return False; - if(!smb_io_unistr2("", &(info_1->docname), info_1->p_docname, ps, depth)) + if(!smb_io_unistr2("", &info_1->docname, info_1->p_docname, ps, depth)) return False; - if(!smb_io_unistr2("", &(info_1->outputfile), info_1->p_outputfile, ps, depth)) + if(!smb_io_unistr2("", &info_1->outputfile, info_1->p_outputfile, ps, depth)) return False; - if(!smb_io_unistr2("", &(info_1->datatype), info_1->p_datatype, ps, depth)) + if(!smb_io_unistr2("", &info_1->datatype, info_1->p_datatype, ps, depth)) return False; return True; @@ -128,16 +128,16 @@ static BOOL smb_io_doc_info(char *desc, DOC_INFO *info, prs_struct *ps, int dept if(!prs_align(ps)) return False; - if(!prs_uint32("switch_value", ps, depth, &(info->switch_value))) + if(!prs_uint32("switch_value", ps, depth, &info->switch_value)) return False; - if(!prs_uint32("doc_info_X ptr", ps, depth, &(useless_ptr))) + if(!prs_uint32("doc_info_X ptr", ps, depth, &useless_ptr)) return False; switch (info->switch_value) { case 1: - if(!smb_io_doc_info_1("",&(info->doc_info_1), ps, depth)) + if(!smb_io_doc_info_1("",&info->doc_info_1, ps, depth)) return False; break; case 2: @@ -151,7 +151,7 @@ static BOOL smb_io_doc_info(char *desc, DOC_INFO *info, prs_struct *ps, int dept Maybe one day with Windows for dishwasher 2037 ... */ - /* smb_io_doc_info_2("",&(info->doc_info_2), ps, depth); */ + /* smb_io_doc_info_2("",&info->doc_info_2, ps, depth); */ break; default: DEBUG(0,("Something is obviously wrong somewhere !\n")); @@ -1446,6 +1446,8 @@ static uint32 size_of_relative_string(UNISTR *string) size=str_len_uni(string); /* the string length */ size=size+1; /* add the leading zero */ size=size*2; /* convert in char */ + /* Ensure size is 4 byte multiple (prs_align is being called...). */ + size += ((4 - (size & 3)) & 3); size=size+4; /* add the size of the ptr */ return size; @@ -1473,28 +1475,6 @@ static uint32 size_of_systemtime(SYSTEMTIME *systime) return (sizeof(SYSTEMTIME) +4); } -/******************************************************************* - * write a UNICODE string. - * used by all the RPC structs passing a buffer - ********************************************************************/ -static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) -{ - if (uni == NULL) - return False; - - prs_debug(ps, depth, desc, "spoolss_smb_io_unistr"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_unistr("unistr", ps, depth, uni)) - return False; - - return True; -} - - /******************************************************************* * write a UNICODE string and its relative pointer. * used by all the RPC structs passing a buffer @@ -1522,12 +1502,15 @@ static BOOL new_smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR uint32 struct_offset = prs_offset(ps); uint32 relative_offset; - buffer->string_at_end -= 2*(str_len_uni(string)+1); + buffer->string_at_end -= (size_of_relative_string(string) - 4); if(!prs_set_offset(ps, buffer->string_at_end)) return False; + if (!prs_align(ps)) + return False; + buffer->string_at_end = prs_offset(ps); /* write the string */ - if (!spoolss_smb_io_unistr(desc, string, ps, depth)) + if (!smb_io_unistr(desc, string, ps, depth)) return False; if(!prs_set_offset(ps, struct_offset)) @@ -1550,7 +1533,7 @@ static BOOL new_smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR return False; /* read the string */ - if (!spoolss_smb_io_unistr(desc, string, ps, depth)) + if (!smb_io_unistr(desc, string, ps, depth)) return False; if(!prs_set_offset(ps, old_offset)) @@ -1605,7 +1588,7 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui } /* write the string */ - if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) { + if (!smb_io_unistr(desc, &chaine, ps, depth)) { free(chaine.buffer); return False; } @@ -1640,7 +1623,7 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui return False; do { - if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) + if (!smb_io_unistr(desc, &chaine, ps, depth)) return False; l_chaine=str_len_uni(&chaine); @@ -1686,15 +1669,10 @@ static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, } if (*secdesc != NULL) { -#if 0 /* JRATEST */ - if(!prs_set_offset(ps, 0x54)) - return False; -#else buffer->string_at_end -= sec_desc_size(*secdesc); if(!prs_set_offset(ps, buffer->string_at_end)) return False; -#endif /* write the secdesc */ if (!sec_io_desc(desc, secdesc, ps, depth)) return False; @@ -1705,9 +1683,6 @@ static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, relative_offset=buffer->string_at_end - buffer->struct_start; /* write its offset */ -#if 0 /* JRATEST */ - relative_offset = 0x54; -#endif if (!prs_uint32("offset", ps, depth, &relative_offset)) return False; @@ -2418,7 +2393,7 @@ BOOL new_smb_io_driverdir_1(char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 * buffer->struct_start=prs_offset(ps); - if (!spoolss_smb_io_unistr(desc, &info->name, ps, depth)) + if (!smb_io_unistr(desc, &info->name, ps, depth)) return False; return True; -- cgit From 2ca88a0f2d35c8562350597ed4d45b147b3ab438 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 12 Aug 2000 14:31:29 +0000 Subject: fixes to prs_unistr UNMARSHALLING only. Problem was due to talloc's of 0 bytes. jerry (This used to be commit 3fcc59ba928250759bbf3ef46d7c118950a5ba6f) --- source3/rpc_parse/parse_prs.c | 66 ++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 29 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 7bc9578863..469de90434 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -730,7 +730,6 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) else { /* unmarshalling */ uint32 alloc_len = 0; - len = -1; q = prs_data_p(ps) + prs_offset(ps); /* @@ -738,43 +737,52 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) */ max_len = (ps->buffer_size - ps->data_offset)/sizeof(uint16); + /* the test of the value of *ptr helps to catch the circumstance + where we have an emtpty (non-existent) string in the buffer */ for ( ptr = (uint16 *)q; *ptr && (alloc_len <= max_len); alloc_len++) + /* do nothing */ ; - if (alloc_len > 0) - { - str->buffer = (uint16 *)prs_alloc_mem(ps,alloc_len * sizeof(uint16)); - if (str->buffer == NULL) - return False; - p = (unsigned char *)str->buffer; + /* should we allocate anything at all? */ + str->buffer = (uint16 *)prs_alloc_mem(ps,alloc_len * sizeof(uint16)); + if ((str->buffer == NULL) && (alloc_len > 0)) + return False; + + p = (unsigned char *)str->buffer; - do + len = 0; + /* the (len < alloc_len) test is to prevent us from overwriting + memory that is not ours...if we get that far, we have a non-null + terminated string in the buffer and have messed up somewhere */ + while ((len < alloc_len) && (*q != '\0')) + { + if(ps->bigendian_data) { - len++; - - if(ps->bigendian_data) - { - RW_SVAL(ps->io, ps->bigendian_data, q, *p, 0); - p += 2; - q += 2; - } else { - RW_CVAL(ps->io, q, *p, 0); - p++; - q++; - RW_CVAL(ps->io, q, *p, 0); - p++; - q++; - } - } while (len < alloc_len && str->buffer[len] != 0); - } - else + RW_SVAL(ps->io, ps->bigendian_data, q, *p, 0); + p += 2; + q += 2; + } else { + RW_CVAL(ps->io, q, *p, 0); + p++; + q++; + RW_CVAL(ps->io, q, *p, 0); + p++; + q++; + } + + len++; + } + if (len < alloc_len) { - len = 0; - str->buffer = NULL; + /* NULL terminate the UNISTR */ + str->buffer[len++] = '\0'; } } - ps->data_offset += len*2; + /* set the offset in the prs_struct; 'len' points to the + terminiating NULL in the UNISTR so we need to go one more + uint16 */ + ps->data_offset += (len)*2; return True; } -- cgit From 13913e2c97501039ad44a3367134805ae66d38b0 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 12 Aug 2000 14:51:36 +0000 Subject: removed the prs_align in spoolss_smb_io_unistr() (JF, please check) as it was throwing things off when parsing buffers passed in SPOOLSS RPCs fixed the unmarshalling of UNISTR arrays to be double NULL terminated jerry (This used to be commit 236f19659cea87cc35128990954d30c43114b889) --- source3/rpc_parse/parse_spoolss.c | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 3550c56e62..42494ed76e 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1475,6 +1475,32 @@ static uint32 size_of_systemtime(SYSTEMTIME *systime) return (sizeof(SYSTEMTIME) +4); } +/******************************************************************* + * write a UNICODE string. + * used by all the RPC structs passing a buffer + ********************************************************************/ +static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) +{ + if (uni == NULL) + return False; + + prs_debug(ps, depth, desc, "spoolss_smb_io_unistr"); + depth++; + + /* there should be no align here as it can mess up + parsing a NEW_BUFFER->prs */ +#if 0 /* JERRY */ + if (!prs_align(ps)) + return False; +#endif + + if (!prs_unistr("unistr", ps, depth, uni)) + return False; + + return True; +} + + /******************************************************************* * write a UNICODE string and its relative pointer. * used by all the RPC structs passing a buffer @@ -1627,16 +1653,23 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui return False; l_chaine=str_len_uni(&chaine); - if((chaine2=(uint16 *)Realloc(chaine2, (l_chaine2+l_chaine+1)*sizeof(uint16))) == NULL) - return False; + + /* we're going to add two more bytes here in case this + is the last string in the array and we need to add + an extra NULL for termination */ if (l_chaine > 0) { + if((chaine2=(uint16 *)Realloc(chaine2, (l_chaine2+l_chaine+2)*sizeof(uint16))) == NULL) + return False; memcpy(chaine2+l_chaine2, chaine.buffer, (l_chaine+1)*sizeof(uint16)); l_chaine2+=l_chaine+1; } } while(l_chaine!=0); + /* the end should be bould NULL terminated so add + the second one here */ + chaine2[l_chaine2] = '\0'; *string=chaine2; if(!prs_set_offset(ps, old_offset)) @@ -2968,7 +3001,7 @@ BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, uint32 flags, q_u->flags=flags; q_u->servername_ptr = (servername != NULL) ? 1 : 0; - init_unistr2(&q_u->servername, servername, strlen(servername)); + init_buf_unistr2(&q_u->servername, &q_u->servername_ptr, servername); q_u->level=level; q_u->buffer=buffer; -- cgit From e2bb0779af16fe6527ae4aa81bea3f297e503a2d Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 14 Aug 2000 03:17:17 +0000 Subject: fix for new_smb_io_relarraystr() and new_smb_io_relstr() to use spool_smb_io_unistr() as this does not call prs_align() befrore parsing the UNISTR. Parsing a void* buffer from an RPC should not be aligned on 4 byte boundaries. Don't think this change affects any marshalling code, only unmarshalling... jerry (This used to be commit bc154e8522a75540a8504195c1e6f45739167e6b) --- source3/rpc_parse/parse_spoolss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 42494ed76e..1b565cb2d9 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1559,7 +1559,7 @@ static BOOL new_smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR return False; /* read the string */ - if (!smb_io_unistr(desc, string, ps, depth)) + if (!spoolss_smb_io_unistr(desc, string, ps, depth)) return False; if(!prs_set_offset(ps, old_offset)) @@ -1649,7 +1649,7 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui return False; do { - if (!smb_io_unistr(desc, &chaine, ps, depth)) + if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) return False; l_chaine=str_len_uni(&chaine); -- cgit From 7ed3fcad2a75d89c5d7272e2aab8fe3a7f9cd943 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 14 Aug 2000 21:18:02 +0000 Subject: fixed a few bugs in new_smb_io_relarraystr(). Marshalling code path now uses spoolss_smb_io_unistr() also caught a NULL pointer case. i'll update TNG later. (This used to be commit bd4c83eb40a14baf447ac88886d4eafe7b9a309f) --- source3/rpc_parse/parse_spoolss.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 1b565cb2d9..fe8e9c85ca 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1614,7 +1614,7 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui } /* write the string */ - if (!smb_io_unistr(desc, &chaine, ps, depth)) { + if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) { free(chaine.buffer); return False; } @@ -1669,7 +1669,10 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui /* the end should be bould NULL terminated so add the second one here */ - chaine2[l_chaine2] = '\0'; + if (chaine2) + { + chaine2[l_chaine2] = '\0'; + } *string=chaine2; if(!prs_set_offset(ps, old_offset)) -- cgit From 0631c6e3a709969f664be0c56f4eaf145e5e2b5c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 15 Aug 2000 02:33:27 +0000 Subject: Tidied up extra ()'s. Jeremy (This used to be commit f94f37dcab2bc2b68e2b6b4ca440ad53a60e8117) --- source3/rpc_parse/parse_spoolss.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index fe8e9c85ca..5598c619a9 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -441,26 +441,26 @@ static BOOL spool_io_user_level_1(char *desc, SPOOL_USER_1 *q_u, prs_struct *ps, if (!prs_align(ps)) return False; - if (!prs_uint32("size", ps, depth, &(q_u->size))) + if (!prs_uint32("size", ps, depth, &q_u->size)) return False; - if (!prs_uint32("client_name_ptr", ps, depth, &(q_u->client_name_ptr))) + if (!prs_uint32("client_name_ptr", ps, depth, &q_u->client_name_ptr)) return False; - if (!prs_uint32("user_name_ptr", ps, depth, &(q_u->user_name_ptr))) + if (!prs_uint32("user_name_ptr", ps, depth, &q_u->user_name_ptr)) return False; - if (!prs_uint32("build", ps, depth, &(q_u->build))) + if (!prs_uint32("build", ps, depth, &q_u->build)) return False; - if (!prs_uint32("major", ps, depth, &(q_u->major))) + if (!prs_uint32("major", ps, depth, &q_u->major)) return False; - if (!prs_uint32("minor", ps, depth, &(q_u->minor))) + if (!prs_uint32("minor", ps, depth, &q_u->minor)) return False; - if (!prs_uint32("processor", ps, depth, &(q_u->processor))) + if (!prs_uint32("processor", ps, depth, &q_u->processor)) return False; - if (!smb_io_unistr2("", &(q_u->client_name), q_u->client_name_ptr, ps, depth)) + if (!smb_io_unistr2("", &q_u->client_name, q_u->client_name_ptr, ps, depth)) return False; if (!prs_align(ps)) return False; - if (!smb_io_unistr2("", &(q_u->user_name), q_u->user_name_ptr, ps, depth)) + if (!smb_io_unistr2("", &q_u->user_name, q_u->user_name_ptr, ps, depth)) return False; return True; @@ -485,7 +485,7 @@ static BOOL spool_io_user_level(char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, switch (q_u->level) { case 1: - if (!spool_io_user_level_1("", &(q_u->user1), ps, depth)) + if (!spool_io_user_level_1("", &q_u->user1, ps, depth)) return False; break; default: @@ -670,13 +670,13 @@ static BOOL spoolss_io_printer_default(char *desc, PRINTER_DEFAULT *pd, prs_stru if (!prs_uint32("datatype_ptr", ps, depth, &pd->datatype_ptr)) return False; - if (!smb_io_unistr2("datatype", &(pd->datatype), pd->datatype_ptr, ps,depth)) + if (!smb_io_unistr2("datatype", &pd->datatype, pd->datatype_ptr, ps,depth)) return False; if (!prs_align(ps)) return False; - if (!spoolss_io_devmode_cont("", &(pd->devmode_cont), ps, depth)) + if (!spoolss_io_devmode_cont("", &pd->devmode_cont, ps, depth)) return False; if (!prs_uint32("access_required", ps, depth, &pd->access_required)) -- cgit From 4620c705492d1cdede5ab3b47b009273df87f123 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 16 Aug 2000 03:41:02 +0000 Subject: - fixed memcpy bug in copy_unistr2() - init_unistr2_from_unistr() does not NULL terminate the buffer --jerry (This used to be commit 65ee5f9b6ed3c4ad33fefd3c879f2649496fd3f3) --- source3/rpc_parse/parse_misc.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index e7b8c23619..cef2d3e3c2 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -753,15 +753,22 @@ void init_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf) void copy_unistr2(UNISTR2 *str, UNISTR2 *from) { + /* set up string lengths. add one if string is not null-terminated */ str->uni_max_len = from->uni_max_len; str->undoc = from->undoc; str->uni_str_len = from->uni_str_len; + if (from->buffer == NULL) + return; + + /* the string buffer is allocated to the maximum size + (the the length of the source string) to prevent + reallocation of memory. */ if (str->buffer == NULL) { - size_t len = from->uni_max_len * 2; + size_t len = from->uni_max_len * sizeof(uint16); - if (!parse_misc_talloc) + if (!parse_misc_talloc) parse_misc_talloc = talloc_init(); if (len < MAX_UNISTRLEN) @@ -769,12 +776,15 @@ void copy_unistr2(UNISTR2 *str, UNISTR2 *from) len *= sizeof(uint16); str->buffer = (uint16 *)talloc(parse_misc_talloc, len); - if (str->buffer == NULL) + if ((str->buffer == NULL) && (len > 0 )) + { smb_panic("copy_unistr2: malloc fail\n"); + return; + } } /* copy the string */ - memcpy(str->buffer, from->buffer, sizeof(from->buffer)); + memcpy(str->buffer, from->buffer, from->uni_max_len*sizeof(uint16)); } /******************************************************************* @@ -868,8 +878,11 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len) len *= sizeof(uint16); str->buffer = (uint16 *)talloc(parse_misc_talloc, len); - if (str->buffer == NULL) + if ((str->buffer == NULL) && (len > 0)) + { smb_panic("init_unistr2: malloc fail\n"); + return; + } /* store the string (null-terminated 8 bit chars into 16 bit chars) */ dos_struni2((char *)str->buffer, buf, len); @@ -896,12 +909,13 @@ void init_unistr2_from_unistr (UNISTR2 *to, UNISTR *from) i = 0; while ((from->buffer)[i]!='\0') i++; + i++; /* one more to catch the terminating NULL */ /* set up string lengths; uni_max_len is set to i+1 because we need to account for the final NULL termination */ - to->uni_max_len = i+1; + to->uni_max_len = i; to->undoc = 0; - to->uni_str_len = i+1; + to->uni_str_len = i; if (!parse_misc_talloc) parse_misc_talloc = talloc_init(); -- cgit From a9b2a406826b857f41ea9da0984cb49addb30a2f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 16 Aug 2000 03:44:04 +0000 Subject: hack for unmarshalling unistr's on machines with BIG_ENDIAN arch I think we have a lot more of these bugs lurking (i'm fairly confident of it). jerry (This used to be commit 3b14487c7e5218ff3e0ff3118ca1afd706e05247) --- source3/rpc_parse/parse_prs.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 469de90434..f5a0bc642b 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -626,9 +626,17 @@ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 * /* If we're using big-endian, reverse to get little-endian. */ if(ps->bigendian_data) - DBG_RW_PSVAL(charmode, name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, p, str->uni_str_len) + { + DBG_RW_PSVAL(charmode, name, depth, ps->data_offset, + ps->io, ps->bigendian_data, q, p, + str->uni_str_len) + } else - DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, ps->io, q, p, str->uni_str_len * sizeof(uint16)) + { + DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, + ps->io, q, p, str->uni_str_len * sizeof(uint16)) + } + ps->data_offset += (str->uni_str_len * sizeof(uint16)); return True; @@ -762,12 +770,21 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) p += 2; q += 2; } else { +#if WORDS_BIGENDIAN + RW_CVAL(ps->io, q+1, *p, 0); + p++; + RW_CVAL(ps->io, q, *p, 0); + p++; + q+=2; +#else RW_CVAL(ps->io, q, *p, 0); p++; q++; RW_CVAL(ps->io, q, *p, 0); p++; q++; +#endif /* WORDS_BIGENDIAN */ + } len++; -- cgit From 82149af29f401f0ebc422359ddc4f6fc21a424ea Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 17 Aug 2000 20:03:53 +0000 Subject: added comment for my own memory purposes jerry (This used to be commit b64ddbd1aaba8811641e502e96f3bbef01171f52) --- source3/rpc_parse/parse_misc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index cef2d3e3c2..34788068c0 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -910,6 +910,7 @@ void init_unistr2_from_unistr (UNISTR2 *to, UNISTR *from) while ((from->buffer)[i]!='\0') i++; i++; /* one more to catch the terminating NULL */ + /* is this necessary -- jerry? I need to think */ /* set up string lengths; uni_max_len is set to i+1 because we need to account for the final NULL termination */ -- cgit From 9e1f9a5719315aaa9b184fc5b0a750c68fbd8941 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 28 Aug 2000 04:42:31 +0000 Subject: yipee! The spoolss AddJob function has an [in,out] buffer not an [in] buffer (despite the comment in the code to the contrary). Also, we must fail this function - not just blindly reply "no problem" as AddJob should always fail on non-local printers. This fixes a bug where the "print test page" failed about half the time. I suspect it will also fix a bunch of other intermittent spoolss bugs where the client (incorrectly) tries to use the AddJob printing interface. (This used to be commit 14e534a8907c34b53e00a63756efd71903ff9432) --- source3/rpc_parse/parse_spoolss.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 5598c619a9..54794a7343 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3291,6 +3291,15 @@ BOOL spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int de if(!prs_align(ps)) return False; + if(!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("needed", ps, depth, &r_u->needed)) + return False; + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; -- cgit From d407579b94ee2647d1e51c536534024e5c4c51ad Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 30 Aug 2000 00:45:59 +0000 Subject: Implemented AbortPrinter() from Gerald's Win32 test code. Just purge all possible printjobs from that printer (I think this is correct). Added error code returns for print_queue_XXX() functions. Jeremy. (This used to be commit 6d081a9017f87f59b7189ba507e211db01c40af5) --- source3/rpc_parse/parse_spoolss.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 54794a7343..60b6eed0c9 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1022,6 +1022,41 @@ BOOL make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER *q_u, POLICY_HND *hnd) return True; } +/******************************************************************* + * read a structure. + * called from static spoolss_q_abortprinter (srv_spoolss.c) + * called from spoolss_abortprinter (cli_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_q_abortprinter(char *desc, SPOOL_Q_ABORTPRINTER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_abortprinter"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) + return False; + + return True; +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_abortprinter (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_r_abortprinter(char *desc, SPOOL_R_ABORTPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_abortprinter"); + depth++; + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; +} + /******************************************************************* * read a structure. * called from static spoolss_q_deleteprinter (srv_spoolss.c) -- cgit From b26e3d2525c2ee09df426a9921c8c0337c1e071e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 30 Aug 2000 22:54:54 +0000 Subject: Fixed overrun write error when using debuglevel > 50. Jeremy. (This used to be commit 3d9b163655f684f2b98aa72f976379cee869db05) --- source3/rpc_parse/parse_prs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index f5a0bc642b..b9b52a029d 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -44,7 +44,7 @@ void prs_dump(char *name, int v, prs_struct *ps) if (fd != -1 || errno != EEXIST) break; } if (fd != -1) { - write(fd, ps->data_p + ps->data_offset, ps->grow_size - ps->data_offset); + write(fd, ps->data_p + ps->data_offset, ps->buffer_size - ps->data_offset); close(fd); DEBUG(0,("created %s\n", fname)); } -- cgit From fa810d4c8001c10bddce452b4ab1178eb80dee87 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 31 Aug 2000 19:04:51 +0000 Subject: Implemented DELETEFORM tested using Gerald's Win32 test code :-). Jeremy. (This used to be commit 596c21a2af0309ce43a5e52a343a671036d05ebf) --- source3/rpc_parse/parse_spoolss.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 60b6eed0c9..f123198fdb 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5158,6 +5158,38 @@ static BOOL spoolss_io_addform(char *desc, FORM *f, uint32 ptr, prs_struct *ps, return True; } +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_deleteform(char *desc, SPOOL_Q_DELETEFORM *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_deleteform"); + depth++; + + if(!prs_align(ps)) + return False; + if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) + return False; + if(!smb_io_unistr2("form name", &q_u->name, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_deleteform(char *desc, SPOOL_R_DELETEFORM *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_deleteform"); + depth++; + + if(!prs_align(ps)) + return False; + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; +} + /******************************************************************* ********************************************************************/ BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth) -- cgit From d644d4438cfef54733118cbd09f89518ffb318ca Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 5 Sep 2000 20:56:09 +0000 Subject: Implemented GETFORM tested and working using Gerald's Win32 test progs.... Jeremy. (This used to be commit 55ed0a9b0c91159c0fc4282c2171d9ced74a302a) --- source3/rpc_parse/parse_spoolss.c | 57 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index f123198fdb..3b0ddaac9f 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3665,9 +3665,64 @@ BOOL new_spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct * return False; return True; - } +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_q_getform(char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps, int depth) +{ + + prs_debug(ps, depth, desc, "spoolss_io_q_getform"); + depth++; + + if (!prs_align(ps)) + return False; + if (!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) + return False; + if (!smb_io_unistr2("", &q_u->formname,True,ps,depth)) + return False; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("level", ps, depth, &q_u->level)) + return False; + + if (!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + return False; + + if (!prs_align(ps)) + return False; + if (!prs_uint32("offered", ps, depth, &q_u->offered)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL new_spoolss_io_r_getform(char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "new_spoolss_io_r_getform"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + return False; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("size of buffer needed", ps, depth, &r_u->needed)) + return False; + + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; +} /******************************************************************* Parse a SPOOL_R_ENUMPORTS structure. ********************************************************************/ -- cgit From a1f66a820d78244fcab960fe33999c76cc1d65c5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 6 Sep 2000 01:06:39 +0000 Subject: Fix for the SID history problem when using a Win2k domain controller with security=domain. Also fixed to dynamically allocate the SIDs and GIDs. Jeremy. (This used to be commit 2b1f66eb82f05fe0b85ac5b4916e32847b8de675) --- source3/rpc_parse/parse_net.c | 68 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 56 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 06430e75e6..6aa7f5e518 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -608,7 +608,7 @@ BOOL net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int de Init DOM_SID2 array from a string containing multiple sids *************************************************************************/ -static int init_dom_sid2s(char *sids_str, DOM_SID2 *sids, int max_sids) +static int init_dom_sid2s(char *sids_str, DOM_SID2 **ppsids) { char *ptr; pstring s2; @@ -616,12 +616,29 @@ static int init_dom_sid2s(char *sids_str, DOM_SID2 *sids, int max_sids) DEBUG(4,("init_dom_sid2s: %s\n", sids_str ? sids_str:"")); + *ppsids = NULL; + if(sids_str) { + int number; + DOM_SID2 *sids; + + /* Count the number of SIDs. */ for (count = 0, ptr = sids_str; - next_token(&ptr, s2, NULL, sizeof(s2)) && count < max_sids; count++) { + next_token(&ptr, s2, NULL, sizeof(s2)); count++) + ; + + /* Now allocate space for them. */ + *ppsids = (DOM_SID2 *)malloc(count * sizeof(DOM_SID2)); + if (*ppsids == NULL) + return 0; + + sids = *ppsids; + + for (number = 0, ptr = sids_str; + next_token(&ptr, s2, NULL, sizeof(s2)); number++) { DOM_SID tmpsid; string_to_sid(&tmpsid, s2); - init_dom_sid2(&sids[count], &tmpsid); + init_dom_sid2(&sids[number], &tmpsid); } } @@ -1056,7 +1073,7 @@ void init_net_user_info3(NET_USER_INFO_3 *usr, memset((char *)usr->padding, '\0', sizeof(usr->padding)); - num_other_sids = init_dom_sid2s(other_sids, usr->other_sids, LSA_MAX_SIDS); + num_other_sids = init_dom_sid2s(other_sids, &usr->other_sids); usr->num_other_sids = num_other_sids; usr->buffer_other_sids = (num_other_sids != 0) ? 1 : 0; @@ -1070,8 +1087,7 @@ void init_net_user_info3(NET_USER_INFO_3 *usr, usr->num_groups2 = num_groups; - if (num_groups > 0) - { + if (num_groups > 0) { usr->gids = (DOM_GID *)malloc(sizeof(DOM_GID) * num_groups); if (usr->gids == NULL) return; @@ -1086,6 +1102,15 @@ void init_net_user_info3(NET_USER_INFO_3 *usr, /* "other" sids are set up above */ } +/******************************************************************* + Delete any memory allocated by init_user_info_3... +********************************************************************/ + +void free_user_info3(NET_USER_INFO_3 *usr) +{ + safe_free(usr->gids); + safe_free(usr->other_sids); +} /******************************************************************* Reads or writes a structure. @@ -1188,9 +1213,8 @@ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, if(!prs_uint32("num_groups2 ", ps, depth, &usr->num_groups2)) /* num groups */ return False; - if (UNMARSHALLING(ps) && usr->num_groups2 > 0) - { - usr->gids = (DOM_GID *)malloc(sizeof(DOM_GID)*usr->num_groups2); + if (UNMARSHALLING(ps) && usr->num_groups2 > 0) { + usr->gids = (DOM_GID *)prs_alloc_mem(ps, sizeof(DOM_GID)*usr->num_groups2); if (usr->gids == NULL) return False; } @@ -1208,11 +1232,31 @@ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, if(!smb_io_dom_sid2("", &usr->dom_sid, ps, depth)) /* domain SID */ return False; - SMB_ASSERT_ARRAY(usr->other_sids, usr->num_other_sids); + if (usr->num_other_sids) { - for (i = 0; i < usr->num_other_sids; i++) { - if(!smb_io_dom_sid2("", &usr->other_sids[i], ps, depth)) /* other domain SIDs */ + if (UNMARSHALLING(ps)) { + usr->other_sids = (DOM_SID2 *)prs_alloc_mem(ps, sizeof(DOM_SID2)*usr->num_other_sids); + if (usr->other_sids == NULL) + return False; + } + + if(!prs_uint32("num_other_groups", ps, depth, &usr->num_other_groups)) return False; + + if (UNMARSHALLING(ps)) { + usr->other_gids = (DOM_GID *)prs_alloc_mem(ps, sizeof(DOM_GID)*usr->num_other_groups); + if (usr->other_gids == NULL) + return False; + } + + for (i = 0; i < usr->num_other_groups; i++) { + if(!smb_io_gid("", &usr->other_gids[i], ps, depth)) /* other GIDs */ + 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; + } } return True; -- cgit From e0f9de0c49dde82610b0da406b4685e787f69725 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 9 Sep 2000 00:19:35 +0000 Subject: Implemented DELETEPRINTERDATA (tested with Gerald's Win32 progs). Jeremy. (This used to be commit fb48efaf830626f6ef05b88f5f8a74b932ceb257) --- source3/rpc_parse/parse_spoolss.c | 52 ++++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 3b0ddaac9f..953124ebe4 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -954,7 +954,8 @@ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, ********************************************************************/ BOOL spoolss_io_q_getprinterdata(char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth) { - if (q_u == NULL) return False; + if (q_u == NULL) + return False; prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdata"); depth++; @@ -975,6 +976,44 @@ BOOL spoolss_io_q_getprinterdata(char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_st return True; } +/******************************************************************* + * read a structure. + * called from spoolss_q_deleteprinterdata (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_q_deleteprinterdata(char *desc, SPOOL_Q_DELETEPRINTERDATA *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_deleteprinterdata"); + depth++; + + if (!prs_align(ps)) + return False; + if (!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + return False; + if (!prs_align(ps)) + return False; + if (!smb_io_unistr2("valuename", &(q_u->valuename),True,ps,depth)) + return False; + + return True; +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_deleteprinterdata (srv_spoolss.c) + ********************************************************************/ +BOOL spoolss_io_r_deleteprinterdata(char *desc, SPOOL_R_DELETEPRINTERDATA *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterdata"); + depth++; + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; +} + /******************************************************************* * write a structure. * called from spoolss_r_getprinterdata (srv_spoolss.c) @@ -5167,11 +5206,12 @@ BOOL convert_specific_param(NT_PRINTER_PARAM **param, const UNISTR2 *value, (*param)->data_len=len; - (*param)->data=(uint8 *)malloc(len * sizeof(uint8)); - if((*param)->data == NULL) - return False; - - memcpy((*param)->data, data, len); + if (len) { + (*param)->data=(uint8 *)malloc(len * sizeof(uint8)); + if((*param)->data == NULL) + return False; + memcpy((*param)->data, data, len); + } DEBUGADD(6,("\tvalue:[%s], len:[%d]\n",(*param)->value, (*param)->data_len)); -- cgit From ccddd111c6b0c2d41c7b1e3875dca4e760205b79 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 15 Sep 2000 00:15:10 +0000 Subject: Move towards getting W2k p&p to upload NT4.x drivers. Still doesn't work - not sure why (JF - a glance at this would be appreciated). Removed code that JF objected to with enumprinterdata. Added translations to/from level 6 - but Win2k still not happy... hmmm... Jeremy. (This used to be commit e5d98ba9e97eb16337ff6c49f799e130844ae72e) --- source3/rpc_parse/parse_spoolss.c | 145 +++++++++++++++++++++++++++++++++----- 1 file changed, 129 insertions(+), 16 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 953124ebe4..cb24a97938 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1508,6 +1508,14 @@ static uint32 size_of_uint32(uint32 *value) { return (sizeof(*value)); } +/******************************************************************* + * return the length of a NTTIME (obvious, but the code is clean) + ********************************************************************/ +static uint32 size_of_nttime(NTTIME *value) +{ + return (sizeof(*value)); +} + /******************************************************************* * return the length of a UNICODE string in number of char, includes: * - the leading zero @@ -1886,7 +1894,7 @@ static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEV ********************************************************************/ BOOL new_smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "smb_io_printer_info_0"); depth++; @@ -2087,7 +2095,7 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i ********************************************************************/ BOOL new_smb_io_printer_info_3(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "new_smb_io_printer_info_3"); depth++; @@ -2107,7 +2115,7 @@ BOOL new_smb_io_printer_info_3(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *i ********************************************************************/ BOOL new_smb_io_port_info_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "new_smb_io_port_info_1"); depth++; @@ -2125,7 +2133,7 @@ BOOL new_smb_io_port_info_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, i ********************************************************************/ BOOL new_smb_io_port_info_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "new_smb_io_port_info_2"); depth++; @@ -2151,7 +2159,7 @@ BOOL new_smb_io_port_info_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, i ********************************************************************/ BOOL new_smb_io_printer_driver_info_1(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_1 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "new_smb_io_printer_driver_info_1"); depth++; @@ -2170,7 +2178,7 @@ BOOL new_smb_io_printer_driver_info_1(char *desc, NEW_BUFFER *buffer, DRIVER_INF ********************************************************************/ BOOL new_smb_io_printer_driver_info_2(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "new_smb_io_printer_driver_info_2"); depth++; @@ -2199,7 +2207,7 @@ BOOL new_smb_io_printer_driver_info_2(char *desc, NEW_BUFFER *buffer, DRIVER_INF ********************************************************************/ BOOL new_smb_io_printer_driver_info_3(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_3 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "new_smb_io_printer_driver_info_3"); depth++; @@ -2232,13 +2240,71 @@ BOOL new_smb_io_printer_driver_info_3(char *desc, NEW_BUFFER *buffer, DRIVER_INF return True; } +/******************************************************************* + Parse a DRIVER_INFO_6 structure. +********************************************************************/ +BOOL new_smb_io_printer_driver_info_6(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_6 *info, int depth) +{ + prs_struct *ps=&buffer->prs; + + prs_debug(ps, depth, desc, "new_smb_io_printer_driver_info_6"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if (!prs_uint32("version", ps, depth, &info->version)) + return False; + if (!new_smb_io_relstr("name", buffer, depth, &info->name)) + return False; + if (!new_smb_io_relstr("architecture", buffer, depth, &info->architecture)) + return False; + if (!new_smb_io_relstr("driverpath", buffer, depth, &info->driverpath)) + return False; + if (!new_smb_io_relstr("datafile", buffer, depth, &info->datafile)) + return False; + if (!new_smb_io_relstr("configfile", buffer, depth, &info->configfile)) + return False; + if (!new_smb_io_relstr("helpfile", buffer, depth, &info->helpfile)) + return False; + + if (!new_smb_io_relarraystr("dependentfiles", buffer, depth, &info->dependentfiles)) + return False; + + if (!new_smb_io_relstr("monitorname", buffer, depth, &info->monitorname)) + return False; + if (!new_smb_io_relstr("defaultdatatype", buffer, depth, &info->defaultdatatype)) + return False; + + if (!new_smb_io_relarraystr("previousdrivernames", buffer, depth, &info->previousdrivernames)) + return False; + + if (!prs_uint32("date.low", ps, depth, &info->driver_date.low)) + return False; + if (!prs_uint32("date.high", ps, depth, &info->driver_date.high)) + return False; + + if (!prs_uint32("driver_version", ps, depth, &info->driver_version)) + return False; + + if (!new_smb_io_relstr("mfgname", buffer, depth, &info->mfgname)) + return False; + if (!new_smb_io_relstr("oem_url", buffer, depth, &info->oem_url)) + return False; + if (!new_smb_io_relstr("hardware_id", buffer, depth, &info->hardware_id)) + return False; + if (!new_smb_io_relstr("provider", buffer, depth, &info->provider)) + return False; + + return True; +} + /******************************************************************* Parse a JOB_INFO_1 structure. ********************************************************************/ BOOL new_smb_io_job_info_1(char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "new_smb_io_job_info_1"); depth++; @@ -2281,7 +2347,7 @@ BOOL new_smb_io_job_info_1(char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int BOOL new_smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int depth) { uint pipo=0; - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "new_smb_io_job_info_2"); depth++; @@ -2346,7 +2412,7 @@ BOOL new_smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int ********************************************************************/ BOOL new_smb_io_form_1(char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "new_smb_io_form_1"); depth++; @@ -2496,7 +2562,7 @@ uint32 new_get_buffer_size(NEW_BUFFER *buffer) ********************************************************************/ BOOL new_smb_io_driverdir_1(char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "new_smb_io_driverdir_1"); depth++; @@ -2514,7 +2580,7 @@ BOOL new_smb_io_driverdir_1(char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 * ********************************************************************/ BOOL new_smb_io_port_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "new_smb_io_port_1"); depth++; @@ -2532,7 +2598,7 @@ BOOL new_smb_io_port_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int de ********************************************************************/ BOOL new_smb_io_port_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "new_smb_io_port_2"); depth++; @@ -2558,7 +2624,7 @@ BOOL new_smb_io_port_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int de ********************************************************************/ BOOL smb_io_printprocessor_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR_1 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "smb_io_printprocessor_info_1"); depth++; @@ -2575,7 +2641,7 @@ BOOL smb_io_printprocessor_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR ********************************************************************/ BOOL smb_io_printprocdatatype_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCDATATYPE_1 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "smb_io_printprocdatatype_info_1"); depth++; @@ -2609,7 +2675,7 @@ BOOL smb_io_printmonitor_info_1(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_1 * ********************************************************************/ BOOL smb_io_printmonitor_info_2(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_2 *info, int depth) { - prs_struct *ps=&(buffer->prs); + prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "smb_io_printmonitor_info_2"); depth++; @@ -2805,6 +2871,53 @@ uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) return size; } +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +uint32 spoolss_size_printer_driver_info_6(DRIVER_INFO_6 *info) +{ + int size=0; + uint16 *string; + int i=0; + + size+=size_of_uint32( &info->version ); + size+=size_of_relative_string( &info->name ); + size+=size_of_relative_string( &info->architecture ); + size+=size_of_relative_string( &info->driverpath ); + size+=size_of_relative_string( &info->datafile ); + size+=size_of_relative_string( &info->configfile ); + size+=size_of_relative_string( &info->helpfile ); + + string=info->dependentfiles; + if (string) { + for (i=0; (string[i]!=0x0000) || (string[i+1]!=0x0000); i++); + } + + size+=size_of_relative_string( &info->monitorname ); + size+=size_of_relative_string( &info->defaultdatatype ); + + string=info->previousdrivernames; + if (string) { + for (i=0; (string[i]!=0x0000) || (string[i+1]!=0x0000); i++); + } + + size+=size_of_nttime(&info->driver_date); + size+=size_of_uint32( &info->driver_version ); + size+=size_of_relative_string( &info->mfgname ); + size+=size_of_relative_string( &info->oem_url ); + size+=size_of_relative_string( &info->hardware_id ); + size+=size_of_relative_string( &info->provider ); + + i=i+2; /* to count all chars including the leading zero */ + i=2*i; /* because we need the value in bytes */ + i=i+4; /* the offset pointer size */ + + size+=i; + + return size; +} + + /******************************************************************* return the size required by a struct in the stream ********************************************************************/ -- cgit From 244c29619965779d1076ea47d84d0d7edf3bef2d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 15 Sep 2000 21:20:49 +0000 Subject: Fixes from JF as I didn't understand the string array sizing code correctly. Jeremy. (This used to be commit 63a7d0fc359ab7cb2ece74dff0ee25f6bb9fbe36) --- source3/rpc_parse/parse_spoolss.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index cb24a97938..bd4ce43836 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2871,14 +2871,26 @@ uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) return size; } +uint32 spoolss_size_string_array(uint16 *string) +{ + uint32 i = 0; + + if (string) { + for (i=0; (string[i]!=0x0000) || (string[i+1]!=0x0000); i++); + } + i=i+2; /* to count all chars including the leading zero */ + i=2*i; /* because we need the value in bytes */ + i=i+4; /* the offset pointer size */ + + return i; +} + /******************************************************************* return the size required by a struct in the stream ********************************************************************/ uint32 spoolss_size_printer_driver_info_6(DRIVER_INFO_6 *info) { - int size=0; - uint16 *string; - int i=0; + uint32 size=0; size+=size_of_uint32( &info->version ); size+=size_of_relative_string( &info->name ); @@ -2888,18 +2900,12 @@ uint32 spoolss_size_printer_driver_info_6(DRIVER_INFO_6 *info) size+=size_of_relative_string( &info->configfile ); size+=size_of_relative_string( &info->helpfile ); - string=info->dependentfiles; - if (string) { - for (i=0; (string[i]!=0x0000) || (string[i+1]!=0x0000); i++); - } + size+=spoolss_size_string_array(info->dependentfiles); size+=size_of_relative_string( &info->monitorname ); size+=size_of_relative_string( &info->defaultdatatype ); - string=info->previousdrivernames; - if (string) { - for (i=0; (string[i]!=0x0000) || (string[i+1]!=0x0000); i++); - } + size+=spoolss_size_string_array(info->previousdrivernames); size+=size_of_nttime(&info->driver_date); size+=size_of_uint32( &info->driver_version ); @@ -2908,12 +2914,6 @@ uint32 spoolss_size_printer_driver_info_6(DRIVER_INFO_6 *info) size+=size_of_relative_string( &info->hardware_id ); size+=size_of_relative_string( &info->provider ); - i=i+2; /* to count all chars including the leading zero */ - i=2*i; /* because we need the value in bytes */ - i=i+4; /* the offset pointer size */ - - size+=i; - return size; } -- cgit From a2c82976b86cbdddbf9f7cb08f5d461c6cde86c6 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Sat, 16 Sep 2000 10:07:46 +0000 Subject: in a printer_info_6, driver version is 64 bits long and there is a 32 bit padding before. J.F. (This used to be commit cd41d7a35477accec1a82b86f9fa3477e5a49d6e) --- source3/rpc_parse/parse_spoolss.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index bd4ce43836..b9c5ea5daa 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2283,7 +2283,13 @@ BOOL new_smb_io_printer_driver_info_6(char *desc, NEW_BUFFER *buffer, DRIVER_INF if (!prs_uint32("date.high", ps, depth, &info->driver_date.high)) return False; - if (!prs_uint32("driver_version", ps, depth, &info->driver_version)) + if (!prs_uint32("padding", ps, depth, &info->padding)) + return False; + + if (!prs_uint32("driver_version_low", ps, depth, &info->driver_version_low)) + return False; + + if (!prs_uint32("driver_version_high", ps, depth, &info->driver_version_high)) return False; if (!new_smb_io_relstr("mfgname", buffer, depth, &info->mfgname)) @@ -2908,7 +2914,9 @@ uint32 spoolss_size_printer_driver_info_6(DRIVER_INFO_6 *info) size+=spoolss_size_string_array(info->previousdrivernames); size+=size_of_nttime(&info->driver_date); - size+=size_of_uint32( &info->driver_version ); + size+=size_of_uint32( &info->padding ); + size+=size_of_uint32( &info->driver_version_low ); + size+=size_of_uint32( &info->driver_version_high ); size+=size_of_relative_string( &info->mfgname ); size+=size_of_relative_string( &info->oem_url ); size+=size_of_relative_string( &info->hardware_id ); -- cgit From 13904f585cbc4ccd5a366c288e6a32af44c30d27 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 19 Sep 2000 22:32:56 +0000 Subject: param/loadparm.c: Fix based on Damian's code to stop printer scripts getting overwritten. rpc_parse/parse_spoolss.c: Tidyup to call function for relstring arrays. Win2000 now does "Add Printer" successfully !!!!! Jeremy. (This used to be commit d666b958bc335c7fceebeb7a6333d78bc421c30f) --- source3/rpc_parse/parse_spoolss.c | 53 ++++++++++++++------------------------- 1 file changed, 19 insertions(+), 34 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b9c5ea5daa..69d9c5bd83 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2018,9 +2018,7 @@ BOOL new_smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *i ********************************************************************/ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) { - uint32 sec_offset; prs_struct *ps=&buffer->prs; - uint32 dummy = 0; prs_debug(ps, depth, desc, "new_smb_io_printer_info_2"); depth++; @@ -2055,13 +2053,8 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i if (!new_smb_io_relstr("parameters", buffer, depth, &info->parameters)) return False; -#if 0 /* JFMTEST */ - if (!prs_uint32_pre("secdesc_ptr ", ps, depth, &dummy, &sec_offset)) - return False; -#else if (!new_smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc)) return False; -#endif if (!prs_uint32("attributes", ps, depth, &info->attributes)) return False; @@ -2844,14 +2837,29 @@ uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info) return size; } +/******************************************************************* +return the size required by a string array. +********************************************************************/ +uint32 spoolss_size_string_array(uint16 *string) +{ + uint32 i = 0; + + if (string) { + for (i=0; (string[i]!=0x0000) || (string[i+1]!=0x0000); i++); + } + i=i+2; /* to count all chars including the leading zero */ + i=2*i; /* because we need the value in bytes */ + i=i+4; /* the offset pointer size */ + + return i; +} + /******************************************************************* return the size required by a struct in the stream ********************************************************************/ uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) { int size=0; - uint16 *string; - int i=0; size+=size_of_uint32( &info->version ); size+=size_of_relative_string( &info->name ); @@ -2863,34 +2871,11 @@ uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) size+=size_of_relative_string( &info->monitorname ); size+=size_of_relative_string( &info->defaultdatatype ); - string=info->dependentfiles; - if (string) { - for (i=0; (string[i]!=0x0000) || (string[i+1]!=0x0000); i++); - } - - i=i+2; /* to count all chars including the leading zero */ - i=2*i; /* because we need the value in bytes */ - i=i+4; /* the offset pointer size */ - - size+=i; + size+=spoolss_size_string_array(info->dependentfiles); return size; } -uint32 spoolss_size_string_array(uint16 *string) -{ - uint32 i = 0; - - if (string) { - for (i=0; (string[i]!=0x0000) || (string[i+1]!=0x0000); i++); - } - i=i+2; /* to count all chars including the leading zero */ - i=2*i; /* because we need the value in bytes */ - i=i+4; /* the offset pointer size */ - - return i; -} - /******************************************************************* return the size required by a struct in the stream ********************************************************************/ @@ -3140,7 +3125,7 @@ BOOL spoolss_io_q_getprinterdriver2(char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, if(!prs_align(ps)) return False; - if(!prs_uint32("level", ps, depth, &q_u->level)) + if(!prs_uint32("level", ps, depth, &q_u->level)) return False; if(!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) -- cgit From 0fc271ea4aba6b3258e9b962c1634ea441dc5861 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 20 Sep 2000 22:07:56 +0000 Subject: Some code moved back from TNG - updates to LSA stuff. Not yet used but will be needed soon. Jeremy. (This used to be commit f0aa8f9314c837fe39b6d1b0c41d5cfae2e4098f) --- source3/rpc_parse/parse_lsa.c | 88 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 80 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index a8023bc640..f214fd38be 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -32,7 +32,7 @@ static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct ********************************************************************/ void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, - uint32 sid_name_use, char *name, uint32 idx) + uint16 sid_name_use, char *name, uint32 idx) { int len_name = strlen(name); @@ -60,8 +60,11 @@ static BOOL lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, i if(!prs_align(ps)) return False; - if(!prs_uint32("sid_name_use", ps, depth, &trn->sid_name_use)) + 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)) @@ -76,7 +79,7 @@ static BOOL lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, i static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) { - int i, s, n; + int i; prs_debug(ps, depth, desc, "lsa_io_dom_r_ref"); depth++; @@ -97,6 +100,7 @@ static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int dep SMB_ASSERT_ARRAY(r_r->hdr_ref_dom, r_r->num_ref_doms_1); if (r_r->ptr_ref_dom != 0) { + if(!prs_uint32("num_ref_doms_2", ps, depth, &r_r->num_ref_doms_2)) /* 4 - num referenced domains? */ return False; @@ -114,21 +118,21 @@ static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int dep return False; } - for (i = 0, n = 0, s = 0; i < r_r->num_ref_doms_2; i++) { + for (i = 0; i < r_r->num_ref_doms_2; i++) { fstring t; if (r_r->hdr_ref_dom[i].hdr_dom_name.buffer != 0) { slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i); - if(!smb_io_unistr2(t, &r_r->ref_dom[n].uni_dom_name, True, ps, depth)) /* domain name unicode string */ + if(!smb_io_unistr2(t, &r_r->ref_dom[i].uni_dom_name, True, ps, depth)) /* domain name unicode string */ + return False; + if(!prs_align(ps)) return False; - n++; } if (r_r->hdr_ref_dom[i].ptr_dom_sid != 0) { slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i); - if(!smb_io_dom_sid2("", &r_r->ref_dom[s].ref_dom, ps, depth)) /* referenced domain SIDs */ + if(!smb_io_dom_sid2(t, &r_r->ref_dom[i].ref_dom, ps, depth)) /* referenced domain SIDs */ return False; - s++; } } } @@ -188,6 +192,7 @@ static BOOL lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int de 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 False; } return True; @@ -255,6 +260,7 @@ static BOOL lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int if (attr->len != prs_offset(ps) - start) { DEBUG(3,("lsa_io_obj_attr: length %x does not match size %x\n", attr->len, prs_offset(ps) - start)); + return False; } if (attr->ptr_sec_qos != 0 && attr->sec_qos != NULL) { @@ -406,6 +412,72 @@ BOOL lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int de return True; } +/******************************************************************* +makes an LSA_Q_QUERY_SEC_OBJ structure. +********************************************************************/ + +void init_q_query_sec_obj(LSA_Q_QUERY_SEC_OBJ *q_q, const POLICY_HND *hnd, uint32 sec_info) +{ + if (q_q == NULL || hnd == NULL) + return; + + DEBUG(5, ("init_q_query_sec_obj\n")); + + q_q->pol = *hnd; + q_q->sec_info = sec_info; + + return; +} + +/******************************************************************* + Reads or writes an LSA_Q_QUERY_SEC_OBJ structure. +********************************************************************/ + +BOOL lsa_io_q_query_sec_obj(char *desc, LSA_Q_QUERY_SEC_OBJ *q_q, prs_struct *ps, int depth) +{ + if (q_q == NULL) + return False; + + prs_debug(ps, depth, desc, "lsa_io_q_query_sec_obj"); + depth++; + + if (!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + return False; + + if (!prs_uint32("sec_info", ps, depth, &q_q->sec_info)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a LSA_R_QUERY_SEC_OBJ structure. +********************************************************************/ + +BOOL lsa_io_r_query_sec_obj(char *desc, LSA_R_QUERY_SEC_OBJ *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) + return False; + + prs_debug(ps, depth, desc, "lsa_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_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; +} + /******************************************************************* Inits an LSA_Q_QUERY_INFO structure. ********************************************************************/ -- cgit From 233bc000209cf5759e0e49ad83da70b280d51dae Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 25 Sep 2000 21:05:18 +0000 Subject: printer notify code. It only sends notifies to one client. The broadcasting notify code will code soon. J.F. (This used to be commit 4c63c9185887c64e57d901e82a4a16a83522c898) --- source3/rpc_parse/parse_spoolss.c | 119 +++++++++++++++++++++++++++++++++++++- 1 file changed, 118 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 69d9c5bd83..6141c14446 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5734,6 +5734,26 @@ JOB_INFO_2 *add_job2_to_array(uint32 *len, JOB_INFO_2 ***array, (void***)array, (const void*)job, *fn, True); } +/******************************************************************* + * init a structure. + ********************************************************************/ +BOOL make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER *q_u, + const fstring string, uint32 printer, uint32 type) +{ + if (q_u == NULL) + return False; + + init_unistr2(&q_u->string, string, strlen(string)+1); + + q_u->printer=printer; + q_u->type=type; + + q_u->unknown0=0x0; + q_u->unknown1=0x0; + + return True; +} + /******************************************************************* Parse a SPOOL_Q_REPLYOPENPRINTER structure. ********************************************************************/ @@ -5756,7 +5776,9 @@ BOOL spoolss_io_q_replyopenprinter(char *desc, SPOOL_Q_REPLYOPENPRINTER *q_u, pr if(!prs_uint32("type", ps, depth, &q_u->type)) return False; - if(!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + if(!prs_uint32("unknown0", ps, depth, &q_u->unknown0)) + return False; + if(!prs_uint32("unknown1", ps, depth, &q_u->unknown1)) return False; return True; @@ -5782,6 +5804,19 @@ BOOL spoolss_io_r_replyopenprinter(char *desc, SPOOL_R_REPLYOPENPRINTER *r_u, pr return True; } +/******************************************************************* + * init a structure. + ********************************************************************/ +BOOL make_spoolss_q_reply_closeprinter(SPOOL_Q_REPLYCLOSEPRINTER *q_u, POLICY_HND *hnd) +{ + if (q_u == NULL) + return False; + + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + + return True; +} + /******************************************************************* Parse a SPOOL_Q_REPLYCLOSEPRINTER structure. ********************************************************************/ @@ -5818,3 +5853,85 @@ BOOL spoolss_io_r_replycloseprinter(char *desc, SPOOL_R_REPLYCLOSEPRINTER *r_u, return True; } + +/******************************************************************* + * init a structure. + ********************************************************************/ +BOOL make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd, + uint32 change_low, uint32 change_high) +{ + if (q_u == NULL) + return False; + + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + + q_u->change_low=change_low; + q_u->change_high=change_high; + + q_u->unknown0=0x0; + q_u->unknown1=0x0; + + q_u->info_ptr=1; + + q_u->info.version=2; + q_u->info.flags=PRINTER_NOTIFY_INFO_DISCARDED; + q_u->info.count=0; + + return True; +} + +/******************************************************************* + Parse a SPOOL_Q_REPLY_RRPCN structure. +********************************************************************/ +BOOL spoolss_io_q_reply_rrpcn(char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_replycloseprinter"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) + return False; + + if (!prs_uint32("change_low", ps, depth, &q_u->change_low)) + return False; + + if (!prs_uint32("change_high", ps, depth, &q_u->change_high)) + return False; + + if (!prs_uint32("unknown0", ps, depth, &q_u->unknown0)) + return False; + + if (!prs_uint32("unknown1", ps, depth, &q_u->unknown1)) + return False; + + if (!prs_uint32("info_ptr", ps, depth, &q_u->info_ptr)) + return False; + + if(q_u->info_ptr!=0) + if(!smb_io_notify_info(desc, &q_u->info, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Parse a SPOOL_R_REPLY_RRPCN structure. +********************************************************************/ +BOOL spoolss_io_r_reply_rrpcn(char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_replycloseprinter"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("unknown0", ps, depth, &r_u->unknown0)) + return False; + + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; +} -- cgit From 8c93ddf3e0ea80d482cbee7bf233c32fc69955bb Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Wed, 27 Sep 2000 13:02:57 +0000 Subject: samr unknown 0x32 is in fact samr create user. so renamed and tidy up of the server function. J.F. (This used to be commit 0f707ac1fb5685b800d6599b9074ec1d4e65b1c1) --- source3/rpc_parse/parse_samr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 58e65fa0af..72e803d22b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3058,12 +3058,12 @@ BOOL samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc Reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_unknown_32(char *desc, SAMR_Q_UNKNOWN_32 *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_create_user(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_unknown_32"); + prs_debug(ps, depth, desc, "samr_io_q_create_user"); depth++; if(!prs_align(ps)) @@ -3096,7 +3096,7 @@ BOOL samr_io_q_unknown_32(char *desc, SAMR_Q_UNKNOWN_32 *q_u, prs_struct *ps, i Reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_unknown_32(char *desc, SAMR_R_UNKNOWN_32 *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; -- cgit From b06d83c909e0587accf93e090c62395ff8b1bb87 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Thu, 28 Sep 2000 17:35:03 +0000 Subject: fixed samr_create_user(). we now correctly parse the query and the reply. And we create the disabled account. That means we can create user and trust accounts remotely ! ifdef out a return in passdb/smbpass.c. I think I didn't break any security. Jeremy could you check if I didn't make any mistakes ??? J.F. (This used to be commit 416be1b64f366c8b859f25856fce2467ec0446d9) --- source3/rpc_parse/parse_samr.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 72e803d22b..ce26ad454f 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3082,11 +3082,9 @@ BOOL samr_io_q_create_user(char *desc, SAMR_Q_CREATE_USER *q_u, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_uint32("acct_ctrl", ps, depth, &q_u->acct_ctrl)) + if(!prs_uint32("acb_info", ps, depth, &q_u->acb_info)) return False; - if(!prs_uint16("unknown_1", ps, depth, &q_u->unknown_1)) - return False; - if(!prs_uint16("unknown_2", ps, depth, &q_u->unknown_2)) + if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask)) return False; return True; @@ -3109,7 +3107,10 @@ BOOL samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER *r_u, prs_struct *ps, if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) return False; - if(!prs_align(ps)) + + if(!prs_uint32("unknown_0", ps, depth, &r_u->unknown_0)) + return False; + if(!prs_uint32("user_rid", ps, depth, &r_u->user_rid)) return False; if(!prs_uint32("status", ps, depth, &r_u->status)) -- cgit From c5ca95aeb1202c64bf37c8031c83d5c59c990ce3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 3 Oct 2000 18:29:12 +0000 Subject: Fixes from Herb - compiler warnings. Jeremy. (This used to be commit d9d3668fa322cbed36ca3393d8268bf0e5255e8d) --- source3/rpc_parse/parse_creds.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c index c34a7f5ac3..d00a842b1e 100644 --- a/source3/rpc_parse/parse_creds.c +++ b/source3/rpc_parse/parse_creds.c @@ -64,7 +64,7 @@ BOOL creds_io_unix(char *desc, CREDS_UNIX *r_u, prs_struct *ps, int depth) prs_align(ps); prs_string("real_name", ps, depth, r_u->real_name, strlen(r_u->real_name), sizeof(r_u->real_name)); prs_align(ps); - prs_uint32("guest", ps, depth, &(r_u->guest)); + prs_uint32("guest", ps, depth, (uint32 *)&(r_u->guest)); return True; } @@ -120,7 +120,7 @@ BOOL creds_io_unix_sec(char *desc, CREDS_UNIX_SEC *r_u, prs_struct *ps, int dept prs_uint32("uid", ps, depth, &(r_u->uid)); prs_uint32("gid", ps, depth, &(r_u->gid)); - prs_uint32("num_grps", ps, depth, &(r_u->num_grps)); + prs_uint32("num_grps", ps, depth, (uint32 *)&(r_u->num_grps)); if (r_u->num_grps != 0) { r_u->grps = (uint32*)Realloc(r_u->grps, @@ -240,20 +240,20 @@ BOOL creds_io_pwd_info(char *desc, struct pwd_info *pwd, prs_struct *ps, int dep prs_align(ps); - prs_uint32("nullpwd", ps, depth, &(pwd->null_pwd)); + prs_uint32("nullpwd", ps, depth, (uint32 *)&(pwd->null_pwd)); if (pwd->null_pwd) { return True; } - prs_uint32("cleartext", ps, depth, &(pwd->cleartext)); + prs_uint32("cleartext", ps, depth, (uint32 *)&(pwd->cleartext)); if (pwd->cleartext) { prs_string("password", ps, depth, pwd->password, strlen(pwd->password), sizeof(pwd->password)); prs_align(ps); return True; } - prs_uint32("crypted", ps, depth, &(pwd->crypted)); + prs_uint32("crypted", ps, depth, (uint32 *)&(pwd->crypted)); prs_uint8s(False, "smb_lm_pwd", ps, depth, (char*)&pwd->smb_lm_pwd, sizeof(pwd->smb_lm_pwd)); prs_align(ps); @@ -329,7 +329,7 @@ BOOL creds_io_hybrid(char *desc, CREDS_HYBRID *r_u, prs_struct *ps, int depth) prs_align(ps); - prs_uint32("reuse", ps, depth, &(r_u->reuse)); + prs_uint32("reuse", ps, depth, (uint32 *)&(r_u->reuse)); prs_uint32("ptr_ntc", ps, depth, &(r_u->ptr_ntc)); prs_uint32("ptr_uxc", ps, depth, &(r_u->ptr_uxc)); @@ -371,7 +371,7 @@ void copy_unix_creds(CREDS_UNIX *to, const CREDS_UNIX *from) return; } fstrcpy(to->user_name, from->user_name); -}; +} void copy_nt_sec_creds(CREDS_NT_SEC *to, const CREDS_NT_SEC *from) { @@ -395,7 +395,7 @@ void copy_nt_sec_creds(CREDS_NT_SEC *to, const CREDS_NT_SEC *from) to->num_grps = from->num_grps; memcpy(to->grp_rids, from->grp_rids, size); } -}; +} void copy_unix_sec_creds(CREDS_UNIX_SEC *to, const CREDS_UNIX_SEC *from) { @@ -423,7 +423,7 @@ void copy_unix_sec_creds(CREDS_UNIX_SEC *to, const CREDS_UNIX_SEC *from) to->num_grps = from->num_grps; memcpy(to->grps, from->grps, size); } -}; +} void create_ntc_from_cli_state (CREDS_NT *to, const struct cli_state *cli_from) { @@ -446,7 +446,7 @@ void create_ntc_from_cli_state (CREDS_NT *to, const struct cli_state *cli_from) to->user_name, to->domain, to->ntlmssp_flags)); -}; +} void copy_nt_creds(struct ntuser_creds *to, @@ -469,7 +469,7 @@ void copy_nt_creds(struct ntuser_creds *to, DEBUG(10,("copy_nt_creds: user %s domain %s flgs: %x\n", to->user_name, to->domain, to->ntlmssp_flags)); -}; +} void copy_user_creds(struct user_creds *to, const struct user_creds *from) @@ -519,7 +519,7 @@ void copy_user_creds(struct user_creds *to, memcpy(to->usr_sess_key, from->usr_sess_key, sizeof(to->usr_sess_key)); } -}; +} void free_user_creds(struct user_creds *creds) { -- cgit From 23f78fd7b91878176c518471cdca84cad826cba9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 4 Oct 2000 01:03:23 +0000 Subject: Adding Herb's compile warning fixes to HEAD. Jeremy. (This used to be commit d131ad1ce3f6e72e295f865a463f8dcbfa6f8d42) --- source3/rpc_parse/parse_creds.c | 14 +++++++------- source3/rpc_parse/parse_misc.c | 2 +- source3/rpc_parse/parse_prs.c | 2 +- source3/rpc_parse/parse_samr.c | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c index d00a842b1e..05b33d4da7 100644 --- a/source3/rpc_parse/parse_creds.c +++ b/source3/rpc_parse/parse_creds.c @@ -255,22 +255,22 @@ BOOL creds_io_pwd_info(char *desc, struct pwd_info *pwd, prs_struct *ps, int dep } prs_uint32("crypted", ps, depth, (uint32 *)&(pwd->crypted)); - prs_uint8s(False, "smb_lm_pwd", ps, depth, (char*)&pwd->smb_lm_pwd, sizeof(pwd->smb_lm_pwd)); + prs_uint8s(False, "smb_lm_pwd", ps, depth, (unsigned char*)&pwd->smb_lm_pwd, sizeof(pwd->smb_lm_pwd)); prs_align(ps); - prs_uint8s(False, "smb_nt_pwd", ps, depth, (char*)&pwd->smb_nt_pwd, sizeof(pwd->smb_nt_pwd)); + prs_uint8s(False, "smb_nt_pwd", ps, depth, (unsigned char*)&pwd->smb_nt_pwd, sizeof(pwd->smb_nt_pwd)); prs_align(ps); - prs_uint8s(False, "smb_lm_owf", ps, depth, (char*)&pwd->smb_lm_owf, sizeof(pwd->smb_lm_owf)); + prs_uint8s(False, "smb_lm_owf", ps, depth, (unsigned char*)&pwd->smb_lm_owf, sizeof(pwd->smb_lm_owf)); prs_align(ps); prs_uint32("nt_owf_len", ps, depth, &(pwd->nt_owf_len)); if (pwd->nt_owf_len > sizeof(pwd->smb_nt_owf)) { return False; } - prs_uint8s(False, "smb_nt_owf", ps, depth, (char*)&pwd->smb_nt_owf, pwd->nt_owf_len); + prs_uint8s(False, "smb_nt_owf", ps, depth, (unsigned char*)&pwd->smb_nt_owf, pwd->nt_owf_len); prs_align(ps); - prs_uint8s(False, "lm_cli_chal", ps, depth, (char*)&pwd->lm_cli_chal, sizeof(pwd->lm_cli_chal)); + prs_uint8s(False, "lm_cli_chal", ps, depth, (unsigned char*)&pwd->lm_cli_chal, sizeof(pwd->lm_cli_chal)); prs_align(ps); prs_uint32("nt_cli_chal_len", ps, depth, &(pwd->nt_cli_chal_len)); @@ -278,7 +278,7 @@ BOOL creds_io_pwd_info(char *desc, struct pwd_info *pwd, prs_struct *ps, int dep { return False; } - prs_uint8s(False, "nt_cli_chal", ps, depth, (char*)&pwd->nt_cli_chal, pwd->nt_cli_chal_len); + prs_uint8s(False, "nt_cli_chal", ps, depth, (unsigned char*)&pwd->nt_cli_chal, pwd->nt_cli_chal_len); prs_align(ps); return True; @@ -354,7 +354,7 @@ BOOL creds_io_hybrid(char *desc, CREDS_HYBRID *r_u, prs_struct *ps, int depth) } if (r_u->ptr_ssk != 0) { - prs_uint8s(False, "usr_sess_key", ps, depth, (char*)&r_u->usr_sess_key, sizeof(r_u->usr_sess_key)); + prs_uint8s(False, "usr_sess_key", ps, depth, (unsigned char*)&r_u->usr_sess_key, sizeof(r_u->usr_sess_key)); } else { diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 34788068c0..93f47bbc7a 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -620,7 +620,7 @@ BOOL smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) return False; if (UNMARSHALLING(ps)) { - buf3->buffer = prs_alloc_mem(ps, buf3->buf_max_len); + buf3->buffer = (unsigned char *)prs_alloc_mem(ps, buf3->buf_max_len); if (buf3->buffer == NULL) return False; } diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index b9b52a029d..d6e5797aaf 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -592,7 +592,7 @@ BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 * return False; if (UNMARSHALLING(ps)) { - str->buffer = prs_alloc_mem(ps,str->str_str_len); + str->buffer = (unsigned char *)prs_alloc_mem(ps,str->str_str_len); if (str->buffer == NULL) return False; } diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ce26ad454f..c6b219d382 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2074,7 +2074,7 @@ BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *p ********************************************************************/ void init_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, - uint32 num_rids, uint32 *rid, uint8 *type, uint32 status) + uint32 num_rids, uint32 *rid, enum SID_NAME_USE *type, uint32 status) { int i; -- cgit From a4cd5013f58f5d58ee9ef7fe4366b377904d85e3 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Thu, 5 Oct 2000 12:41:31 +0000 Subject: fixing prs_unistr2(). For the special case of an empty (but existing) string. J.F. (This used to be commit 83bfe94771e0afbffbb4a1a741cd9983ef612362) --- source3/rpc_parse/parse_prs.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index d6e5797aaf..401efaadc6 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -617,22 +617,24 @@ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 * return False; if (UNMARSHALLING(ps)) { - str->buffer = (uint16 *)prs_alloc_mem(ps,str->uni_str_len * sizeof(uint16)); + str->buffer = (uint16 *)prs_alloc_mem(ps,str->uni_max_len * sizeof(uint16)); if (str->buffer == NULL) return False; + memset(str->buffer, '\0', str->uni_max_len * sizeof(uint16)); } + /* If the string is empty, we don't have anything to stream */ + if (str->uni_str_len==0) + return True; + p = (char *)str->buffer; /* If we're using big-endian, reverse to get little-endian. */ - if(ps->bigendian_data) - { + if(ps->bigendian_data) { DBG_RW_PSVAL(charmode, name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, p, str->uni_str_len) - } - else - { + } else { DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, ps->io, q, p, str->uni_str_len * sizeof(uint16)) } -- cgit From 75c346e70c83f7386ecd2f10fe155c4a4dfd47de Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Sat, 7 Oct 2000 15:56:36 +0000 Subject: added samr_set_user_info and info_2. cleanup of create_user cleanup of rid/sid mix in samr. now we only have sid. some prs_align() missing in parse_samr.c a small debug change in srv_pipe.c You still can't change a user's password in this commit. Will be availble in the next one. J.F. (This used to be commit b655bc281fa183b1827a946ada1fcf500fb93aea) --- source3/rpc_parse/parse_samr.c | 706 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 680 insertions(+), 26 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index c6b219d382..0bd1c29710 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -318,6 +318,46 @@ BOOL samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO *q_u, prs_st return True; } +/******************************************************************* +Inits a structure. +********************************************************************/ +BOOL init_unk_info1(SAM_UNK_INFO_1 *u_1) +{ + if (u_1 == NULL) + return False; + + memset(u_1->padding, 0, sizeof(u_1->padding)); /* 12 bytes zeros */ + u_1->unknown_1 = 0x80000000; + u_1->unknown_2 = 0x00000000; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL sam_io_unk_info1(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_uint8s(False, "padding", ps, depth, u_1->padding, sizeof(u_1->padding))) + return False; + + if(!prs_uint32("unknown_1", ps, depth, &u_1->unknown_1)) /* 0x8000 0000 */ + return False; + if(!prs_uint32("unknown_2", ps, depth, &u_1->unknown_2)) /* 0x0000 0000 */ + return False; + + if(!prs_align(ps)) + return False; + + return True; +} + /******************************************************************* Inits a structure. ********************************************************************/ @@ -404,6 +444,9 @@ BOOL sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 *u_2, prs_struct *ps, int depth if(!smb_io_unistr2( "uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth)) /* domain name unicode string */ return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2( "uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth)) /* server name unicode string */ return False; @@ -413,6 +456,160 @@ BOOL sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 *u_2, prs_struct *ps, int depth return True; } +/******************************************************************* +Inits a structure. +********************************************************************/ +BOOL init_unk_info3(SAM_UNK_INFO_3 * u_3) +{ + if (u_3 == NULL) + return False; + + u_3->unknown_0 = 0x00000000; + u_3->unknown_1 = 0x80000000; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL sam_io_unk_info3(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(!prs_uint32("unknown_0", ps, depth, &u_3->unknown_0)) /* 0x0000 0000 */ + return False; + if(!prs_uint32("unknown_1", ps, depth, &u_3->unknown_1)) /* 0x8000 0000 */ + return False; + + if(!prs_align(ps)) + return False; + + return True; +} + +/******************************************************************* +Inits a structure. +********************************************************************/ +BOOL init_unk_info6(SAM_UNK_INFO_6 * u_6) +{ + if (u_6 == NULL) + return False; + + u_6->unknown_0 = 0x00000000; + u_6->ptr_0 = 1; + memset(u_6->padding, 0, sizeof(u_6->padding)); /* 12 bytes zeros */ + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL sam_io_unk_info6(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(!prs_uint32("unknown_0", ps, depth, &u_6->unknown_0)) /* 0x0000 0000 */ + return False; + if(!prs_uint32("ptr_0", ps, depth, &u_6->ptr_0)) /* pointer to unknown structure */ + return False; + if(!prs_uint8s(False, "padding", ps, depth, u_6->padding, sizeof(u_6->padding))) /* 12 bytes zeros */ + return False; + + if(!prs_align(ps)) + return False; + + return True; +} + +/******************************************************************* +Inits a structure. +********************************************************************/ +BOOL init_unk_info7(SAM_UNK_INFO_7 *u_7) +{ + if (u_7 == NULL) + return False; + + u_7->unknown_0 = 0x0003; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL sam_io_unk_info7(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("unknown_0", ps, depth, &u_7->unknown_0)) /* 0x0003 */ + return False; + if(!prs_align(ps)) + return False; + + return True; +} + +/******************************************************************* +Inits a structure. +********************************************************************/ +BOOL init_unk_info12(SAM_UNK_INFO_12 * u_12) +{ + if (u_12 == NULL) + return False; + + u_12->unknown_0 = 0xcf1dcc00; + u_12->unknown_1 = 0xfffffffb; + u_12->unknown_2 = 0xcf1dcc00; + u_12->unknown_3 = 0xfffffffb; + + u_12->unknown_4 = 0x8a880000; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL sam_io_unk_info12(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(!prs_uint32("unknown_0", ps, depth, &u_12->unknown_0)) + return False; + if(!prs_uint32("unknown_1", ps, depth, &u_12->unknown_1)) + return False; + if(!prs_uint32("unknown_2", ps, depth, &u_12->unknown_2)) + return False; + if(!prs_uint32("unknown_3", ps, depth, &u_12->unknown_3)) + return False; + if(!prs_uint32("unknown_4", ps, depth, &u_12->unknown_4)) + return False; + + if(!prs_align(ps)) + return False; + + return True; +} + /******************************************************************* Inits a SAMR_R_QUERY_DOMAIN_INFO structure. ********************************************************************/ @@ -451,17 +648,38 @@ BOOL samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_str if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0)) return False; - if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value)) - return False; - if(!prs_align(ps)) - 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 0x01: + if(!sam_io_unk_info1("unk_inf1", &r_u->ctr->info.inf1, 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 0x03: + if(!sam_io_unk_info3("unk_inf3", &r_u->ctr->info.inf3, 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 0x07: + if(!sam_io_unk_info7("unk_inf7", &r_u->ctr->info.inf7, ps, depth)) + return False; + break; + case 0x0c: + if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, ps, depth)) + return False; + break; default: DEBUG(3,("samr_io_r_query_dom_info: unknown switch level 0x%x\n", r_u->switch_value)); @@ -469,6 +687,9 @@ BOOL samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_str } } + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; + return True; } @@ -2178,7 +2399,7 @@ BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *p Reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS *q_u, prs_struct *ps, int depth) { int i; fstring tmp; @@ -2186,7 +2407,7 @@ BOOL samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, i if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_q_unknown_12"); + prs_debug(ps, depth, desc, "samr_io_q_lookup_rids"); depth++; if(!prs_align(ps)) @@ -2214,9 +2435,6 @@ BOOL samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, i return False; } - if(!prs_align(ps)) - return False; - return True; } @@ -2224,13 +2442,13 @@ BOOL samr_io_q_unknown_12(char *desc, SAMR_Q_UNKNOWN_12 *q_u, prs_struct *ps, i Inits a SAMR_R_UNKNOWN_12 structure. ********************************************************************/ -void init_samr_r_unknown_12(SAMR_R_UNKNOWN_12 *r_u, +void init_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u, uint32 num_aliases, fstring *als_name, uint32 *num_als_usrs, uint32 status) { int i; - DEBUG(5,("init_samr_r_unknown_12\n")); + DEBUG(5,("init_samr_r_lookup_rids\n")); if (status == 0x0) { r_u->num_aliases1 = num_aliases; @@ -2266,7 +2484,7 @@ void init_samr_r_unknown_12(SAMR_R_UNKNOWN_12 *r_u, Reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, int depth) { int i; fstring tmp; @@ -2274,7 +2492,7 @@ BOOL samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, i if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_unknown_12"); + prs_debug(ps, depth, desc, "samr_io_r_lookup_rids"); depth++; if(!prs_align(ps)) @@ -2299,6 +2517,8 @@ BOOL samr_io_r_unknown_12(char *desc, SAMR_R_UNKNOWN_12 *r_u, prs_struct *ps, i slprintf(tmp, sizeof(tmp) - 1, "als_str[%02d] ", i); if(!smb_io_unistr2("", &r_u->uni_als_name[i], r_u->hdr_als_name[i].buffer, ps, depth)) return False; + if(!prs_align(ps)) + return False; } } @@ -2559,7 +2779,7 @@ static BOOL sam_io_logon_hrs(char *desc, LOGON_HRS *hrs, prs_struct *ps, int de if(!prs_align(ps)) return False; - if(!prs_uint32 ( "len ", ps, depth, &hrs->len)) + if(!prs_uint32 ("len ", ps, depth, &hrs->len)) return False; if (hrs->len > 64) { @@ -2838,12 +3058,12 @@ void init_sam_user_info21(SAM_USER_INFO_21 *usr, Reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *ps, int depth) +static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *ps, int depth) { if (usr == NULL) return False; - prs_debug(ps, depth, desc, "lsa_io_user_info"); + prs_debug(ps, depth, desc, "sam_io_user_info21"); depth++; if(!prs_align(ps)) @@ -2892,9 +3112,7 @@ static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *p return False; if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid)) /* Group ID */ return False; - if(!prs_uint16("acb_info ", ps, depth, &usr->acb_info)) /* Group ID */ - return False; - if(!prs_align(ps)) + if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info)) /* Group ID */ return False; if(!prs_uint32("unknown_3 ", ps, depth, &usr->unknown_3)) @@ -2915,36 +3133,53 @@ static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *p if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */ return False; + if(!prs_align(ps)) + 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(!prs_align(ps)) + 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(!prs_align(ps)) + 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(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */ return False; + if(!prs_align(ps)) + 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(!prs_align(ps)) + return False; if(!smb_io_unistr2("uni_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth)) /* user description unicode string */ return False; + if(!prs_align(ps)) + 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(!prs_align(ps)) + return False; if(!smb_io_unistr2("uni_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str .buffer, ps, depth)) /* unknown string */ return False; + if(!prs_align(ps)) + 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; + if(!prs_align(ps)) + return False; if(!prs_uint32("unknown_6 ", ps, depth, &usr->unknown_6)) return False; if(!prs_uint32("padding4 ", ps, depth, &usr->padding4)) return False; - if (usr->ptr_logon_hrs) { + if (usr->ptr_logon_hrs) if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth)) return False; - if(!prs_align(ps)) - return False; - } return True; } @@ -3048,6 +3283,9 @@ BOOL samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc } } + if(!prs_align(ps)) + return False; + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; @@ -3279,7 +3517,7 @@ void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, Reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -3290,6 +3528,9 @@ BOOL samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, i if(!prs_align(ps)) return False; + if(!smb_io_pol_hnd("domain_pol", &(q_u->dom_pol), ps, depth)) + return False; + if(!prs_uint32("unknown_0", ps, depth, &q_u->unknown_0)) return False; if(!prs_uint32("rid_alias", ps, depth, &q_u->rid_alias)) @@ -3328,13 +3569,13 @@ BOOL samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, i Inits a SAMR_Q_UNKNOWN_12 structure. ********************************************************************/ -void init_samr_q_unknown_12(SAMR_Q_UNKNOWN_12 *q_u, +void init_samr_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u, POLICY_HND *pol, uint32 rid, uint32 num_gids, uint32 *gid) { int i; - DEBUG(5,("init_samr_r_unknwon_12\n")); + DEBUG(5,("init_samr_q_lookup_rids\n")); memcpy(&q_u->pol, pol, sizeof(*pol)); @@ -3858,4 +4099,417 @@ BOOL samr_io_r_enum_domains(char *desc, SAMR_R_ENUM_DOMAINS * r_u, return True; } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL sam_io_user_info12(char *desc, SAM_USER_INFO_12 *u, prs_struct *ps, int depth) +{ + if (u == NULL) + return False; + + DEBUG(0, ("possible security breach!\n")); + + prs_debug(ps, depth, desc, "samr_io_r_user_info12"); + 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; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL sam_io_user_info23(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_unknown_str", &usr->hdr_unknown_str, 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("unknown_3", ps, depth, &usr->unknown_3)) + 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_uint8s(False, "padding1", ps, depth, usr->padding1, sizeof(usr->padding1))) + return False; + if(!prs_uint32("unknown_5", ps, depth, &usr->unknown_5)) + 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(!prs_align(ps)) + 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(!prs_align(ps)) + 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(!prs_align(ps)) + 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(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */ + return False; + if(!prs_align(ps)) + 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(!prs_align(ps)) + 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(!prs_align(ps)) + 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(!prs_align(ps)) + return False; + if(!smb_io_unistr2("uni_unknown_str", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */ + return False; + if(!prs_align(ps)) + 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; + if(!prs_align(ps)) + return False; + + /* ok, this is only guess-work (as usual) */ + if (usr->unknown_3 != 0x0) { + if(!prs_uint32("unknown_6", ps, depth, &usr->unknown_6)) + return False; + if(!prs_uint32("padding4", ps, depth, &usr->padding4)) + return False; + } else if (UNMARSHALLING(ps)) { + usr->unknown_6 = 0; + usr->padding4 = 0; + } + + 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. +********************************************************************/ +static BOOL sam_io_user_info24(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(!prs_uint16("unk_0", ps, depth, &usr->unk_0)) /* unknown */ + return False; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR *ctr, prs_struct *ps, int depth) +{ + if (ctr == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_userinfo_ctr"); + depth++; + + /* 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; + + switch (ctr->switch_value) { + case 0x10: + if (UNMARSHALLING(ps)) /* reading */ + ctr->info.id10 = (SAM_USER_INFO_10 *)malloc(sizeof(SAM_USER_INFO_10)); + if (ctr->info.id10 == NULL) { + DEBUG(2, ("samr_io_userinfo_ctr: info pointer not initialised\n")); + return False; + } + if(!sam_io_user_info10("", ctr->info.id10, ps, depth)) + return False; + break; + case 0x11: + if (UNMARSHALLING(ps)) /* reading */ + ctr->info.id11 = (SAM_USER_INFO_11 *)malloc(sizeof(SAM_USER_INFO_11)); + if (ctr->info.id11 == NULL) { + DEBUG(2, ("samr_io_userinfo_ctr: info pointer not initialised\n")); + return False; + } + if(!sam_io_user_info11("", ctr->info.id11, ps, depth)) + return False; + break; + case 0x12: + if (UNMARSHALLING(ps)) /* reading */ + ctr->info.id12 = (SAM_USER_INFO_12 *)malloc(sizeof(SAM_USER_INFO_12)); + if (ctr->info.id12 == NULL) { + DEBUG(2, ("samr_io_userinfo_ctr: info pointer not initialised\n")); + return False; + } + if(!sam_io_user_info12("", ctr->info.id12, ps, depth)) + return False; + break; + case 21: + if (UNMARSHALLING(ps)) /* reading */ + ctr->info.id21 = (SAM_USER_INFO_21 *)malloc(sizeof(SAM_USER_INFO_21)); + if (ctr->info.id21 == NULL) { + DEBUG(2, ("samr_io_userinfo_ctr: info pointer not initialised\n")); + return False; + } + if(!sam_io_user_info21("", ctr->info.id21, ps, depth)) + return False; + break; + case 23: + if (UNMARSHALLING(ps)) /* reading */ + ctr->info.id23 = (SAM_USER_INFO_23 *)malloc(sizeof(SAM_USER_INFO_23)); + if (ctr->info.id23 == NULL) { + DEBUG(2, ("samr_io_userinfo_ctr: info pointer not initialised\n")); + return False; + } + if(!sam_io_user_info23("", ctr->info.id23, ps, depth)) + return False; + break; + case 24: + if (UNMARSHALLING(ps)) /* reading */ + ctr->info.id24 = (SAM_USER_INFO_24 *)malloc(sizeof(SAM_USER_INFO_24)); + if (ctr->info.id24 == NULL) { + DEBUG(2, ("samr_io_userinfo_ctr: info pointer not initialised\n")); + return False; + } + if(!sam_io_user_info24("", ctr->info.id24, ps, depth)) + return False; + break; + default: + DEBUG(2, ("samr_io_userinfo_ctr: unknown switch level 0x%x\n", ctr->switch_value)); + return False; + break; + + } + + return True; +} + +/******************************************************************* +frees a structure. +********************************************************************/ +void free_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr) +{ + if (ctr == NULL) + return; + safe_free(ctr->info.id); + ctr->info.id = NULL; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_q_set_userinfo(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; + + 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; +} + +/******************************************************************* +frees a structure. +********************************************************************/ +void free_samr_q_set_userinfo(SAMR_Q_SET_USERINFO * q_u) +{ + if (q_u == NULL) + return; + free_samr_userinfo_ctr(q_u->ctr); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_r_set_userinfo(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_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_q_set_userinfo2(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; +} + +/******************************************************************* +frees a structure. +********************************************************************/ +void free_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 *q_u) +{ + free_samr_userinfo_ctr(q_u->ctr); +} + +/******************************************************************* +makes a SAMR_R_SET_USERINFO2 structure. +********************************************************************/ +BOOL make_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2 *r_u, uint32 status) +{ + if (r_u == NULL) + return False; + + DEBUG(5, ("make_samr_r_set_userinfo2\n")); + + r_u->status = status; /* return status */ + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_r_set_userinfo2(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_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; +} + + #undef OLD_NTDOMAIN -- cgit From 11d999f2bc0c841696bc3ea1ddda48524242482c Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Tue, 10 Oct 2000 13:08:55 +0000 Subject: a netlogon enum trust query doesn't have a function_code at end. a sam_user_info_24 doesn't have a uint16 at end samr_create_user also creates the unix account now samr_set_userinfo changes the password. J.F. (This used to be commit 94f4024481fcd0cb6647af1bd4364033be020641) --- source3/rpc_parse/parse_net.c | 6 ------ source3/rpc_parse/parse_samr.c | 4 +--- 2 files changed, 1 insertion(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 6aa7f5e518..098a5ca98c 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -374,12 +374,6 @@ BOOL net_io_q_trust_dom(char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, i 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; - return True; } diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 0bd1c29710..a2dda316f2 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4248,7 +4248,7 @@ static BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 *usr, prs_struct *ps return False; /* ok, this is only guess-work (as usual) */ - if (usr->unknown_3 != 0x0) { + if (usr->unknown_5 != 0x0) { if(!prs_uint32("unknown_6", ps, depth, &usr->unknown_6)) return False; if(!prs_uint32("padding4", ps, depth, &usr->padding4)) @@ -4282,8 +4282,6 @@ static BOOL sam_io_user_info24(char *desc, SAM_USER_INFO_24 *usr, prs_struct *ps if(!prs_uint8s(False, "password", ps, depth, usr->pass, sizeof(usr->pass))) return False; - if(!prs_uint16("unk_0", ps, depth, &usr->unk_0)) /* unknown */ - return False; return True; } -- cgit From 8719c27726d3412edd0781beb956f48f76a62fb6 Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Wed, 11 Oct 2000 05:31:39 +0000 Subject: changes to sync with 2.2. tree .cvsignore remove config.h - not in this directory include/profile.h profile changes lib/messages.c added message to return debug level libsmb/clierror.c cast to get rid of compiler warning libsmb/smbencrypt.c cast to get rid of compiler warning profile/profile.c add flush profile stats changes for profile struct rpc_parse/parse_samr.c fix for compiler warning rpc_server/srv_samr.c cast to get rid of compiler warning smbd/ipc.c profile stats message.c profile stats smbd/negprot.c profile stats smbd/nttrans.c profile stats smbd/trans2.c profile stats utils/smbcontrol.c new flush stats command (This used to be commit bbb24daa25dca4e4b6b1f8942cd84ee3aa1bed8e) --- source3/rpc_parse/parse_samr.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a2dda316f2..af205441f6 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4368,7 +4368,6 @@ static BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR *ctr, prs_struct * default: DEBUG(2, ("samr_io_userinfo_ctr: unknown switch level 0x%x\n", ctr->switch_value)); return False; - break; } -- cgit From 85643cd72cbc51d163dba98eecd98c7bb029bfc3 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Fri, 13 Oct 2000 14:02:01 +0000 Subject: last part of W2K support. the trust domain list reply on netlogon pipe was wrong, interim hack until we have full trust relationships. changed some unistr2 to parse the ending NULL char. added a prs_align_needed() function. much like a prs_align but with a condition. needed for the unistr2 parsing. J.F. (This used to be commit d8bf81553c17d9ee3419d8150b96119ebb0b8fa9) --- source3/rpc_parse/parse_lsa.c | 8 ++--- source3/rpc_parse/parse_net.c | 29 ++++++++++++++++-- source3/rpc_parse/parse_prs.c | 12 ++++++++ source3/rpc_parse/parse_samr.c | 68 ++++++++++++++++++++++-------------------- 4 files changed, 79 insertions(+), 38 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index f214fd38be..5a266cbbda 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -34,7 +34,7 @@ static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, uint16 sid_name_use, char *name, uint32 idx) { - int len_name = strlen(name); + int len_name = strlen(name)+1; if(len_name == 0) len_name = 1; @@ -359,7 +359,7 @@ void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, if (qos == NULL) r_q->des_access = desired_access; - init_unistr2(&r_q->uni_server_name, server_name, strlen(server_name)); + init_unistr2(&r_q->uni_server_name, server_name, strlen(server_name)+1); init_lsa_obj_attr(&r_q->attr, attributes, qos); } @@ -549,7 +549,7 @@ void init_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, r_e->enum_context = enum_context; if (status == 0) { - int len_domain_name = strlen(domain_name); + int len_domain_name = strlen(domain_name)+1; r_e->num_domains = 1; r_e->ptr_enum_domains = 1; @@ -872,7 +872,7 @@ void init_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, for (i = 0; i < num_names; i++) { char* name = names[i]; - int len = strlen(name); + int len = strlen(name)+1; init_uni_hdr(&q_l->hdr_name[i], len); init_unistr2(&q_l->uni_name[i], name, len); } diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 098a5ca98c..0d8f33f9cb 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -336,13 +336,38 @@ void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, BOOL net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth) { - int i; + 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; @@ -352,7 +377,7 @@ BOOL net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, i if(!prs_uint32("status", ps, depth, &r_t->status)) return False; - +#endif return True; } diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 401efaadc6..659f8e42bd 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -410,6 +410,18 @@ BOOL prs_align(prs_struct *ps) return True; } +/******************************************************************* + Align only if required (for the unistr2 string mainly) + ********************************************************************/ + +BOOL prs_align_needed(prs_struct *ps, uint32 needed) +{ + if (needed==0) + return True; + else + return prs_align(ps); +} + /******************************************************************* Ensure we can read/write to a given offset. ********************************************************************/ diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index af205441f6..6ce20fbefc 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -364,8 +364,8 @@ static BOOL sam_io_unk_info1(char *desc, SAM_UNK_INFO_1 *u_1, prs_struct *ps, in void init_unk_info2(SAM_UNK_INFO_2 *u_2, char *domain, char *server) { - int len_domain = strlen(domain); - int len_server = strlen(server); + int len_domain = strlen(domain)+1; + int len_server = strlen(server)+1; u_2->unknown_0 = 0x00000000; u_2->unknown_1 = 0x80000000; @@ -2025,8 +2025,8 @@ void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *r_u, uint32 switch_leve if(r_u == NULL) return; - alias_len = alias?strlen(alias):0; - alias_desc_len = alias_desc?strlen(alias_desc):0; + alias_len = alias?strlen(alias)+1:0; + alias_desc_len = alias_desc?strlen(alias_desc)+1:0; DEBUG(5,("init_samr_r_query_aliasinfo\n")); @@ -2462,7 +2462,7 @@ void init_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u, SMB_ASSERT_ARRAY(r_u->hdr_als_name, num_aliases); for (i = 0; i < num_aliases; i++) { - int als_len = als_name[i] != NULL ? strlen(als_name[i]) : 0; + int als_len = als_name[i] != NULL ? strlen(als_name[i])+1 : 0; init_uni_hdr(&r_u->hdr_als_name[i], als_len); init_unistr2(&r_u->uni_als_name[i], als_name[i], als_len); r_u->num_als_usrs[i] = num_als_usrs[i]; @@ -2842,7 +2842,7 @@ void init_sam_user_info11(SAM_USER_INFO_11 *usr, DEBUG(5,("init_sam_user_info11\n")); - len_mach_acct = strlen(mach_acct); + len_mach_acct = strlen(mach_acct)+1; memcpy(&usr->expiry,expiry, sizeof(usr->expiry)); /* expiry time or something? */ memset((char *)usr->padding_1, '\0', sizeof(usr->padding_1)); /* 0 - padding 24 bytes */ @@ -2990,16 +2990,16 @@ void init_sam_user_info21(SAM_USER_INFO_21 *usr, uint32 unknown_5, uint32 unknown_6) { - int len_user_name = user_name != NULL ? strlen(user_name ) : 0; - int len_full_name = full_name != NULL ? strlen(full_name ) : 0; - int len_home_dir = home_dir != NULL ? strlen(home_dir ) : 0; - int len_dir_drive = dir_drive != NULL ? strlen(dir_drive ) : 0; - int len_logon_script = logon_script != NULL ? strlen(logon_script) : 0; - int len_profile_path = profile_path != NULL ? strlen(profile_path) : 0; - int len_description = description != NULL ? strlen(description ) : 0; - int len_workstations = workstations != NULL ? strlen(workstations) : 0; - int len_unknown_str = unknown_str != NULL ? strlen(unknown_str ) : 0; - int len_munged_dial = munged_dial != NULL ? strlen(munged_dial ) : 0; + int len_user_name = user_name != NULL ? strlen(user_name )+1 : 0; + int len_full_name = full_name != NULL ? strlen(full_name )+1 : 0; + int len_home_dir = home_dir != NULL ? strlen(home_dir )+1 : 0; + int len_dir_drive = dir_drive != NULL ? strlen(dir_drive )+1 : 0; + int len_logon_script = logon_script != NULL ? strlen(logon_script)+1 : 0; + int len_profile_path = profile_path != NULL ? strlen(profile_path)+1 : 0; + int len_description = description != NULL ? strlen(description )+1 : 0; + int len_workstations = workstations != NULL ? strlen(workstations)+1 : 0; + int len_unknown_str = unknown_str != NULL ? strlen(unknown_str )+1 : 0; + int len_munged_dial = munged_dial != NULL ? strlen(munged_dial )+1 : 0; usr->logon_time = *logon_time; usr->logoff_time = *logoff_time; @@ -3623,7 +3623,7 @@ void init_samr_q_unknown_13(SAMR_Q_UNKNOWN_13 *q_c, ********************************************************************/ void init_samr_q_unknown_38(SAMR_Q_UNKNOWN_38 *q_u, char *srv_name) { - int len_srv_name = strlen(srv_name); + int len_srv_name = strlen(srv_name)+1; DEBUG(5,("init_q_unknown_38\n")); @@ -3785,8 +3785,8 @@ void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, char nt_newpass[516], uchar nt_oldhash[16], char lm_newpass[516], uchar lm_oldhash[16]) { - int len_dest_host = strlen(dest_host); - int len_user_name = strlen(user_name); + int len_dest_host = strlen(dest_host)+1; + int len_user_name = strlen(user_name)+1; DEBUG(5,("init_samr_q_chgpasswd_user\n")); @@ -4003,8 +4003,8 @@ BOOL init_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS * r_u, if(r_u->status == 0) for(i=0;iuni_dom_name[i],domains[i], strlen(domains[i])); - init_sam_entry(&(r_u->sam[i]), strlen(domains[i]), 0); + init_unistr2(&r_u->uni_dom_name[i],domains[i], strlen(domains[i])+1); + init_sam_entry(&(r_u->sam[i]), strlen(domains[i])+1, 0); } else { @@ -4206,49 +4206,51 @@ static BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 *usr, prs_struct *ps /* here begins pointed-to data */ + if(!prs_align_needed(ps, usr->hdr_user_name.buffer)) + 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(!prs_align(ps)) + if(!prs_align_needed(ps, usr->hdr_full_name.buffer)) 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(!prs_align(ps)) + if(!prs_align_needed(ps, usr->hdr_home_dir.buffer)) 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(!prs_align(ps)) + if(!prs_align_needed(ps, usr->hdr_dir_drive.buffer)) 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)) + if(!prs_align_needed(ps, usr->hdr_logon_script.buffer)) 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(!prs_align(ps)) + if(!prs_align_needed(ps, usr->hdr_profile_path.buffer)) 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(!prs_align(ps)) + if(!prs_align_needed(ps, usr->hdr_acct_desc.buffer)) 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(!prs_align(ps)) + if(!prs_align_needed(ps, usr->hdr_workstations.buffer)) 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(!prs_align(ps)) + if(!prs_align_needed(ps, usr->hdr_unknown_str.buffer)) return False; if(!smb_io_unistr2("uni_unknown_str", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */ return False; - if(!prs_align(ps)) + if(!prs_align_needed(ps, usr->hdr_munged_dial.buffer)) 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; - if(!prs_align(ps)) - return False; /* ok, this is only guess-work (as usual) */ if (usr->unknown_5 != 0x0) { + if(!prs_align(ps)) + return False; if(!prs_uint32("unknown_6", ps, depth, &usr->unknown_6)) return False; if(!prs_uint32("padding4", ps, depth, &usr->padding4)) @@ -4259,6 +4261,8 @@ static BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 *usr, prs_struct *ps } if (usr->ptr_logon_hrs) { + if(!prs_align(ps)) + return False; if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth)) return False; } -- cgit From 60661e1d28056222753c37995ed3401acf28e747 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 18 Oct 2000 00:55:02 +0000 Subject: Fixes for io_q_setprinter rpc parsing. (This used to be commit 1b86b9139e87cc4c4a6675ceeda307b91eaa1482) --- source3/rpc_parse/parse_spoolss.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 6141c14446..e331401301 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3419,6 +3419,16 @@ BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps { if (!sec_io_desc_buf(desc, &q_u->secdesc_ctr, ps, depth)) return False; + } else { + uint32 dummy; + + /* Parse a NULL security descriptor. This should really + happen inside the sec_io_desc_buf() function. */ + + prs_debug(ps, depth, "", "sec_io_desc_buf"); + if (!prs_uint32("size", ps, depth + 1, &dummy)) return False; + if (!prs_uint32("ptr", ps, depth + 1, &dummy)) return + False; } if(!prs_uint32("command", ps, depth, &q_u->command)) -- cgit From dc0b638489fbcf256453d821449403d6d8395b41 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 30 Oct 2000 19:45:22 +0000 Subject: Fixed double btyte-swap problems with bigendian architectures. Jeremy. (This used to be commit c96a77957be49418b62e401db49235a11d711217) --- source3/rpc_parse/parse_spoolss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index e331401301..ac10f37646 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -382,7 +382,8 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, x=data->notify_data.data.length+1; if(!prs_uint32("string length", ps, depth, &x )) return False; - if(!prs_uint16s(True,"string",ps,depth,data->notify_data.data.string,x)) + /* These are already in little endian format. Don't byte swap. */ + if(!prs_uint8s(True,"string",ps,depth,(uint8 *)data->notify_data.data.string,x*2)) return False; } if(!prs_align(ps)) -- cgit From d4959bdbdc103be5133993c05c8d7c6ab4f5318a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 30 Oct 2000 21:47:20 +0000 Subject: Only use prs_uint8s on marshalling as we know we're little endian. On unmarshalling use prs_uint16s. Yes this sucks :-). Jeremy. (This used to be commit 3d68257850be66c26074a43d92eb9c3c8ffaf04e) --- source3/rpc_parse/parse_spoolss.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index ac10f37646..eaacb52f5b 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -382,9 +382,14 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, x=data->notify_data.data.length+1; if(!prs_uint32("string length", ps, depth, &x )) return False; - /* These are already in little endian format. Don't byte swap. */ - if(!prs_uint8s(True,"string",ps,depth,(uint8 *)data->notify_data.data.string,x*2)) - return False; + if (MARSHALLING(ps)) { + /* These are already in little endian format. Don't byte swap. */ + if(!prs_uint8s(True,"string",ps,depth,(uint8 *)data->notify_data.data.string,x*2)) + return False; + } else { + if(!prs_uint16s(True,"string",ps,depth,data->notify_data.data.string,x)) + return False; + } } if(!prs_align(ps)) return False; @@ -4775,7 +4780,7 @@ BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, DEBUGADD(8,( "monitorname: %s\n", d->monitorname)); DEBUGADD(8,( "defaultdatatype: %s\n", d->defaultdatatype)); - uniarray_2_dosarray(&(uni->dependentfiles), &(d->dependentfiles) ); + uniarray_2_dosarray(&uni->dependentfiles, &d->dependentfiles ); return True; } @@ -5172,8 +5177,15 @@ BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_ return False; if(!prs_uint32("valuesize", ps, depth, &r_u->valuesize)) return False; - if(!prs_uint16s(False, "value", ps, depth, r_u->value, r_u->valuesize)) - return False; + + if (MARSHALLING(ps)) { + /* "Value is actually a UNICODE string. It's already little-endian so don't reverse. */ + if(!prs_uint8s(False, "value", ps, depth, (uint8 *)r_u->value, r_u->valuesize * 2)) + return False; + } else { + if(!prs_uint16s(False, "value", ps, depth, r_u->value, r_u->valuesize )) + return False; + } if(!prs_align(ps)) return False; -- cgit From 8a190a9e46db3907bd389af68b393adeb6e1ca3d Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 7 Nov 2000 02:54:50 +0000 Subject: Merge of printer security descriptor, info level and printerdata comparison changes from appliance branch. (This used to be commit ae087bdf312806e08848695cad70a943bb3d71b9) --- source3/rpc_parse/parse_sec.c | 157 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 00a1532470..39ead58126 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -277,6 +277,163 @@ size_t sec_desc_size(SEC_DESC *psd) return offset; } +/******************************************************************* + Compares two SEC_ACE structures +********************************************************************/ + +BOOL sec_ace_equal(SEC_ACE *s1, SEC_ACE *s2) +{ + /* Trivial case */ + + if (!s1 && !s2) return True; + + /* Check top level stuff */ + + if (s1->type != s2->type || s1->flags != s2->flags || + s1->info.mask != s2->info.mask) { + return False; + } + + /* Check SID */ + + if (!sid_equal(&s1->sid, &s2->sid)) { + return False; + } + + return True; +} + +/******************************************************************* + Compares two SEC_ACL structures +********************************************************************/ + +BOOL sec_acl_equal(SEC_ACL *s1, SEC_ACL *s2) +{ + int i, j; + + /* Trivial case */ + + if (!s1 && !s2) return True; + + /* Check top level stuff */ + + if (s1->revision != s2->revision || s1->num_aces != s2->num_aces) { + return False; + } + + /* The ACEs could be in any order so check each ACE in s1 against + each ACE in s2. */ + + for (i = 0; i < s1->num_aces; i++) { + BOOL found = False; + + for (j = 0; j < s2->num_aces; j++) { + if (sec_ace_equal(&s1->ace[i], &s2->ace[j])) { + found = True; + break; + } + } + + if (!found) return False; + } + + return True; +} + +/******************************************************************* + Compares two SEC_DESC structures +********************************************************************/ + +BOOL sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2) +{ + /* Trivial case */ + + if (!s1 && !s2) return True; + + /* Check top level stuff */ + + if (s1->revision != s2->revision || s1->type != s2->type) { + return False; + } + + /* Check owner and group */ + + if (!sid_equal(s1->owner_sid, s2->owner_sid) || + !sid_equal(s1->grp_sid, s2->grp_sid)) { + return False; + } + + /* Check ACLs present in one but not the other */ + + if ((s1->dacl && !s2->dacl) || (!s1->dacl && s2->dacl) || + (s1->sacl && !s2->sacl) || (!s1->sacl && s2->sacl)) { + return False; + } + + /* Sigh - we have to do it the hard way by iterating over all + the ACEs in the ACLs */ + + if (!sec_acl_equal(s1->dacl, s2->dacl) || + !sec_acl_equal(s1->sacl, s2->sacl)) { + return False; + } + + return True; +} + +/******************************************************************* + Merge part of security descriptor old_sec in to the empty sections of + security descriptor new_sec. +********************************************************************/ + +SEC_DESC_BUF *sec_desc_merge(SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb) +{ + DOM_SID *owner_sid, *group_sid; + SEC_DESC_BUF *return_sdb; + SEC_ACL *dacl, *sacl; + SEC_DESC *psd = NULL; + uint16 secdesc_type; + size_t secdesc_size; + + /* Copy over owner and group sids. There seems to be no flag for + this so just check the pointer values. */ + + owner_sid = new_sdb->sec->owner_sid ? new_sdb->sec->owner_sid : + old_sdb->sec->owner_sid; + + group_sid = new_sdb->sec->grp_sid ? new_sdb->sec->grp_sid : + old_sdb->sec->grp_sid; + + secdesc_type = new_sdb->sec->type; + + /* Ignore changes to the system ACL. This has the effect of making + changes through the security tab audit button not sticking. + Perhaps in future Samba could implement these settings somehow. */ + + sacl = NULL; + secdesc_type &= ~SEC_DESC_SACL_PRESENT; + + /* Copy across discretionary ACL */ + + if (secdesc_type & SEC_DESC_DACL_PRESENT) { + dacl = new_sdb->sec->dacl; + } else { + dacl = old_sdb->sec->dacl; + secdesc_type |= SEC_DESC_DACL_PRESENT; + } + + /* Create new security descriptor from bits */ + + psd = make_sec_desc(new_sdb->sec->revision, secdesc_type, + owner_sid, group_sid, sacl, dacl, &secdesc_size); + + return_sdb = make_sec_desc_buf(secdesc_size, psd); + + free_sec_desc(&psd); + + return(return_sdb); +} + /******************************************************************* Creates a SEC_DESC structure ********************************************************************/ -- cgit From c1900772ce6fdedc5c380d88f3640107d52e2096 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 10 Nov 2000 19:36:34 +0000 Subject: printing/nt_printing.c: use getpwuid not smbgetpwuid. Canonicalize printernames. printing/printing.c: Insure fix for malloc of zero. rpc_parse/parse_misc.c: Enusre UNISTR's are zero filled. rpc_parse/parse_spoolss.c: Correct INFO_6 - differs between pre-releases of W2K and shipping build. rpc_server/srv_spoolss_nt.c: Canonicalize printernames. Jeremy. (This used to be commit b17e23a8ff2b44540726968355a4b7e26f244f3b) --- source3/rpc_parse/parse_misc.c | 2 ++ source3/rpc_parse/parse_spoolss.c | 11 +++++++++++ 2 files changed, 13 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 93f47bbc7a..859a800771 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -494,6 +494,8 @@ void init_unistr(UNISTR *str, const char *buf) if (str->buffer == NULL) smb_panic("init_unistr: malloc fail\n"); + memset(str->buffer, '\0', len); + /* store the string (null-terminated copy) */ dos_struni2((char *)str->buffer, buf, len); } diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index eaacb52f5b..d77cd938a8 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4340,6 +4340,10 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ if(!prs_uint32("version", ps, depth, &il->version)) return False; +#if 0 + if(!prs_uint32("dummy4", ps, depth, &il->dummy4)) + return False; +#endif if(!prs_uint32("name_ptr", ps, depth, &il->name_ptr)) return False; if(!prs_uint32("environment_ptr", ps, depth, &il->environment_ptr)) @@ -4385,30 +4389,37 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ return False; if(!prs_align(ps)) return False; + if(!smb_io_unistr2("environment", &il->environment, il->environment_ptr, ps, depth)) return False; if(!prs_align(ps)) return False; + if(!smb_io_unistr2("driverpath", &il->driverpath, il->driverpath_ptr, ps, depth)) return False; if(!prs_align(ps)) return False; + if(!smb_io_unistr2("datafile", &il->datafile, il->datafile_ptr, ps, depth)) return False; if(!prs_align(ps)) return False; + if(!smb_io_unistr2("configfile", &il->configfile, il->configfile_ptr, ps, depth)) return False; if(!prs_align(ps)) return False; + if(!smb_io_unistr2("helpfile", &il->helpfile, il->helpfile_ptr, ps, depth)) return False; if(!prs_align(ps)) return False; + if(!smb_io_unistr2("monitorname", &il->monitorname, il->monitorname_ptr, ps, depth)) return False; if(!prs_align(ps)) return False; + if(!smb_io_unistr2("defaultdatatype", &il->defaultdatatype, il->defaultdatatype_ptr, ps, depth)) return False; if(!prs_align(ps)) -- cgit From 6cc6a4f3f36e9ee071dcb01f16ee2bd2eb7de4a0 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 10 Nov 2000 21:24:09 +0000 Subject: rpc_parse/parse_spoolss.c: Updated comment for old version of W2K. tdb/tdbutil.c: With varargs uint16 is cast to (int). Jeremy. (This used to be commit 98764c5df9f363780427a423ead0913f7b2a0905) --- source3/rpc_parse/parse_spoolss.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index d77cd938a8..c4196b0334 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4341,6 +4341,9 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ if(!prs_uint32("version", ps, depth, &il->version)) return False; #if 0 + /* + * Older build versions of W2K seem to need this. JRA. + */ if(!prs_uint32("dummy4", ps, depth, &il->dummy4)) return False; #endif -- cgit From 9fede0dc0dbad51528cd1384023d24549c3f0ba4 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 13 Nov 2000 23:03:34 +0000 Subject: Large commit which restructures the local password storage API. Currently the only backend which works is smbpasswd (tdb, LDAP, and NIS+) are broken, but they were somewhat broken before. :) The following functions implement the storage manipulation interface /*The following definitions come from passdb/pdb_smbpasswd.c */ BOOL pdb_setsampwent (BOOL update); void pdb_endsampwent (void); SAM_ACCOUNT* pdb_getsampwent (void); SAM_ACCOUNT* pdb_getsampwnam (char *username); SAM_ACCOUNT* pdb_getsampwuid (uid_t uid); SAM_ACCOUNT* pdb_getsampwrid (uint32 rid); BOOL pdb_add_sam_account (SAM_ACCOUNT *sampass); BOOL pdb_update_sam_account (SAM_ACCOUNT *sampass, BOOL override); BOOL pdb_delete_sam_account (char* username); There is also a host of pdb_set..() and pdb_get..() functions for manipulating SAM_ACCOUNT struct members. Note that the struct passdb_ops {} has gone away. Also notice that struct smb_passwd (formally in smb.h) has been moved to passdb/pdb_smbpasswd.c and is not accessed outisde of static internal functions in this file. All local password searches should make use of the the SAM_ACCOUNT struct and the previously mentioned functions. I'll write some documentation for this later. The next step is to fix the TDB passdb backend, then work on spliting the backends out into share libraries, and finally get the LDAP backend going. What works and may not: o domain logons from Win9x works o domain logons from WinNT 4 works o user and group enumeration as implemented by Tim works o file and print access works o changing password from Win9x & NT ummm...i'll fix this tonight :) If I broke anything else, just yell and I'll fix it. I think it should be fairly quite. -- jerry (This used to be commit 0b92d0838ebdbe24f34f17e313ecbf61a0301389) --- source3/rpc_parse/parse_net.c | 94 ++++++++++++++++---------------- source3/rpc_parse/parse_samr.c | 121 +++++++++++++++++++++-------------------- 2 files changed, 108 insertions(+), 107 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 0d8f33f9cb..904f3f3612 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1005,64 +1005,62 @@ static BOOL smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int d Init *************************************************************************/ -void init_net_user_info3(NET_USER_INFO_3 *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, - - char *user_name, - char *full_name, - char *logon_script, - char *profile_path, - char *home_dir, - char *dir_drive, - - uint16 logon_count, - uint16 bad_pw_count, - - uint32 user_id, - uint32 group_id, - uint32 num_groups, - DOM_GID *gids, - uint32 user_flgs, - - char *sess_key, - - char *logon_srv, - char *logon_dom, - - DOM_SID *dom_sid, - char *other_sids) +void init_net_user_info3(NET_USER_INFO_3 *usr, SAM_ACCOUNT *sampw, + uint16 logon_count, uint16 bad_pw_count, + uint32 num_groups, DOM_GID *gids, + uint32 user_flgs, char *sess_key, + char *logon_srv, char *logon_dom, + DOM_SID *dom_sid, char *other_sids) { /* only cope with one "other" sid, right now. */ /* need to count the number of space-delimited sids */ int i; int num_other_sids = 0; - - int len_user_name = strlen(user_name ); - int len_full_name = strlen(full_name ); - int len_logon_script = strlen(logon_script); - int len_profile_path = strlen(profile_path); - int len_home_dir = strlen(home_dir ); - int len_dir_drive = strlen(dir_drive ); + + NTTIME logon_time, logoff_time, kickoff_time, + pass_last_set_time, pass_can_change_time, + pass_must_change_time; + + int len_user_name, len_full_name, len_home_dir, + len_dir_drive, len_logon_script, len_profile_path; + + char* user_name = pdb_get_username(sampw); + char* full_name = pdb_get_fullname(sampw); + char* home_dir = pdb_get_homedir(sampw); + char* dir_drive = pdb_get_dirdrive(sampw); + char* logon_script = pdb_get_logon_script(sampw); + char* profile_path = pdb_get_profile_path(sampw); int len_logon_srv = strlen(logon_srv); int len_logon_dom = strlen(logon_dom); - memset(usr, '\0', sizeof(*usr)); + len_user_name = user_name != NULL ? strlen(user_name )+1 : 0; + len_full_name = full_name != NULL ? strlen(full_name )+1 : 0; + len_home_dir = home_dir != NULL ? strlen(home_dir )+1 : 0; + len_dir_drive = dir_drive != NULL ? strlen(dir_drive )+1 : 0; + len_logon_script = logon_script != NULL ? strlen(logon_script)+1 : 0; + len_profile_path = profile_path != NULL ? strlen(profile_path)+1 : 0; + + + ZERO_STRUCTP(usr); usr->ptr_user_info = 1; /* yes, we're bothering to put USER_INFO data here */ - 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; + + /* Create NTTIME structs */ + unix_to_nt_time (&logon_time, pdb_get_logon_time(sampw)); + unix_to_nt_time (&logoff_time, pdb_get_logoff_time(sampw)); + unix_to_nt_time (&kickoff_time, pdb_get_kickoff_time(sampw)); + unix_to_nt_time (&pass_last_set_time, pdb_get_pass_last_set_time(sampw)); + unix_to_nt_time (&pass_can_change_time, pdb_get_pass_can_change_time(sampw)); + unix_to_nt_time (&pass_must_change_time,pdb_get_pass_must_change_time(sampw)); + + 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; init_uni_hdr(&usr->hdr_user_name, len_user_name); init_uni_hdr(&usr->hdr_full_name, len_full_name); @@ -1074,8 +1072,8 @@ void init_net_user_info3(NET_USER_INFO_3 *usr, usr->logon_count = logon_count; usr->bad_pw_count = bad_pw_count; - usr->user_id = user_id; - usr->group_id = group_id; + usr->user_id = pdb_get_user_rid(sampw); + usr->group_id = pdb_get_group_rid(sampw); usr->num_groups = num_groups; usr->buffer_groups = 1; /* indicates fill in groups, below, even if there are none */ usr->user_flgs = user_flgs; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 6ce20fbefc..2208d76090 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2293,7 +2293,6 @@ BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *p /******************************************************************* Inits a SAMR_R_LOOKUP_NAMES structure. ********************************************************************/ - void init_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, uint32 num_rids, uint32 *rid, enum SID_NAME_USE *type, uint32 status) { @@ -2958,55 +2957,56 @@ BOOL sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int unknown_3 = 0x00ff ffff unknown_5 = 0x0002 0000 unknown_6 = 0x0000 04ec - *************************************************************************/ -void init_sam_user_info21(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, - - char *user_name, - char *full_name, - char *home_dir, - char *dir_drive, - char *logon_script, - char *profile_path, - char *description, - char *workstations, - char *unknown_str, - char *munged_dial, - - uint32 user_rid, - uint32 group_rid, - uint16 acb_info, - - uint32 unknown_3, - uint16 logon_divs, - LOGON_HRS *hrs, - uint32 unknown_5, - uint32 unknown_6) -{ - int len_user_name = user_name != NULL ? strlen(user_name )+1 : 0; - int len_full_name = full_name != NULL ? strlen(full_name )+1 : 0; - int len_home_dir = home_dir != NULL ? strlen(home_dir )+1 : 0; - int len_dir_drive = dir_drive != NULL ? strlen(dir_drive )+1 : 0; - int len_logon_script = logon_script != NULL ? strlen(logon_script)+1 : 0; - int len_profile_path = profile_path != NULL ? strlen(profile_path)+1 : 0; - int len_description = description != NULL ? strlen(description )+1 : 0; - int len_workstations = workstations != NULL ? strlen(workstations)+1 : 0; - int len_unknown_str = unknown_str != NULL ? strlen(unknown_str )+1 : 0; - int len_munged_dial = munged_dial != NULL ? strlen(munged_dial )+1 : 0; - - 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; +void init_sam_user_info21(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw) +{ + NTTIME logon_time, logoff_time, kickoff_time, + pass_last_set_time, pass_can_change_time, + pass_must_change_time; + + int len_user_name, len_full_name, len_home_dir, + len_dir_drive, len_logon_script, len_profile_path, + len_description, len_workstations, len_unknown_str, + len_munged_dial; + + char* user_name = pdb_get_username(pw); + char* full_name = pdb_get_fullname(pw); + char* home_dir = pdb_get_homedir(pw); + char* dir_drive = pdb_get_dirdrive(pw); + char* logon_script = pdb_get_logon_script(pw); + char* profile_path = pdb_get_profile_path(pw); + char* description = pdb_get_acct_desc(pw); + char* workstations = pdb_get_workstations(pw); + char* munged_dial = pdb_get_munged_dial(pw); + + len_user_name = user_name != NULL ? strlen(user_name )+1 : 0; + len_full_name = full_name != NULL ? strlen(full_name )+1 : 0; + len_home_dir = home_dir != NULL ? strlen(home_dir )+1 : 0; + len_dir_drive = dir_drive != NULL ? strlen(dir_drive )+1 : 0; + len_logon_script = logon_script != NULL ? strlen(logon_script)+1 : 0; + len_profile_path = profile_path != NULL ? strlen(profile_path)+1 : 0; + len_description = description != NULL ? strlen(description )+1 : 0; + len_workstations = workstations != NULL ? strlen(workstations)+1 : 0; + len_unknown_str = 0; + len_munged_dial = munged_dial != NULL ? strlen(munged_dial )+1 : 0; + + + /* 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)); + unix_to_nt_time (&pass_must_change_time,pdb_get_pass_must_change_time(pw)); + + /* 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; init_uni_hdr(&usr->hdr_user_name, len_user_name); init_uni_hdr(&usr->hdr_full_name, len_full_name); @@ -3022,14 +3022,14 @@ void init_sam_user_info21(SAM_USER_INFO_21 *usr, memset((char *)usr->nt_pwd, '\0', sizeof(usr->nt_pwd)); memset((char *)usr->lm_pwd, '\0', sizeof(usr->lm_pwd)); - usr->user_rid = user_rid; - usr->group_rid = group_rid; - usr->acb_info = acb_info; - usr->unknown_3 = unknown_3; /* 0x00ff ffff */ + usr->user_rid = pdb_get_user_rid(pw); + usr->group_rid = pdb_get_group_rid(pw); + usr->acb_info = pdb_get_acct_ctrl(pw); + usr->unknown_3 = pdb_get_unknown3(pw); - usr->logon_divs = logon_divs; /* should be 168 (hours/week) */ - usr->ptr_logon_hrs = hrs ? 1 : 0; - usr->unknown_5 = unknown_5; /* 0x0002 0000 */ + usr->logon_divs = pdb_get_logon_divs(pw); + usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0; + usr->unknown_5 = pdb_get_unknown5(pw); /* 0x0002 0000 */ memset((char *)usr->padding1, '\0', sizeof(usr->padding1)); @@ -3041,14 +3041,17 @@ void init_sam_user_info21(SAM_USER_INFO_21 *usr, init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path); init_unistr2(&usr->uni_acct_desc, description, len_description); init_unistr2(&usr->uni_workstations, workstations, len_workstations); - init_unistr2(&usr->uni_unknown_str, unknown_str, len_unknown_str); + init_unistr2(&usr->uni_unknown_str, NULL, len_unknown_str); init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial); - usr->unknown_6 = unknown_6; /* 0x0000 04ec */ + usr->unknown_6 = pdb_get_unknown6(pw); usr->padding4 = 0; - if (hrs) - memcpy(&(usr->logon_hrs), hrs, sizeof(usr->logon_hrs)); + if (pdb_get_hours(pw)) + { + usr->logon_hrs.len = pdb_get_hours_len(pw); + memcpy(&(usr->logon_hrs.hours), pdb_get_hours(pw), MAX_HOURS_LEN); + } else memset(&(usr->logon_hrs), 0xff, sizeof(usr->logon_hrs)); } -- cgit From 475fb713a9427b54c747a4e71a011c7db29d5e13 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 17 Nov 2000 02:22:35 +0000 Subject: Fix for memory leak when adding driver. Jeremy. (This used to be commit eeab4e0290f9df84025e91c85d27b21e0c02781f) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index c4196b0334..61206d4e70 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5338,7 +5338,7 @@ BOOL convert_specific_param(NT_PRINTER_PARAM **param, const UNISTR2 *value, *param=(NT_PRINTER_PARAM *)malloc(sizeof(NT_PRINTER_PARAM)); if(*param == NULL) return False; - ZERO_STRUCTP(*param); + memset((char *)*param, '\0', sizeof(NT_PRINTER_PARAM)); DEBUGADD(6,("Allocated a new PARAM struct\n")); } unistr2_to_ascii((*param)->value, value, sizeof((*param)->value)-1); -- cgit From 2bd3a436fd6ed218bced476b502d24f317511fb2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 21 Nov 2000 00:30:15 +0000 Subject: Fix for updating of print queues changed from a local box. Essentially, this makes sure that the change messages sent to ourselves are handled synchronously w.r.t. other smb packets incoming. Jeremy. (This used to be commit 78a13074455618308d048d1c69f62e660988eb90) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 61206d4e70..fb6ce219e0 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5922,7 +5922,7 @@ BOOL make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd, ********************************************************************/ BOOL spoolss_io_q_reply_rrpcn(char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, "spoolss_io_q_replycloseprinter"); + prs_debug(ps, depth, desc, "spoolss_io_q_reply_rrpcn"); depth++; if(!prs_align(ps)) -- cgit From 6003be4856d3cecc444e5b1d6daa25843b4ca2dc Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 22 Nov 2000 01:26:09 +0000 Subject: ADDPRINTERDRIVER info level 6 fix - this is dynamic depending on a field in the struct - that's why it was so hard to find. Jeremy. (This used to be commit 0ab6eb01b0d15e5eb744333d2bd79c27451f50e3) --- source3/rpc_parse/parse_spoolss.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index fb6ce219e0..e3d9f896f5 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4340,13 +4340,15 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ if(!prs_uint32("version", ps, depth, &il->version)) return False; -#if 0 - /* - * Older build versions of W2K seem to need this. JRA. - */ - if(!prs_uint32("dummy4", ps, depth, &il->dummy4)) - return False; -#endif + if (il->version != 0) { + /* + * If version != 0 then there are an extra 4 bytes. + * JohnR and I have verified this at Roseville... JRA. + */ + if(!prs_uint32("dummy4", ps, depth, &il->dummy4)) + return False; + } + if(!prs_uint32("name_ptr", ps, depth, &il->name_ptr)) return False; if(!prs_uint32("environment_ptr", ps, depth, &il->environment_ptr)) -- cgit From af85ca538cc1f04f089c85dd5814f4c66036bc79 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 22 Nov 2000 19:51:41 +0000 Subject: o fixed logon script problems (wrong len in reply to net_sam_logon for a few strings). I was the one who broke it obviously. o changed a few more defaults in the smbpasswd backend with respect to times. Now the logon time becomes '0' and the pass_can_change_time is set ot the same as pass_last_set_time o change Get_Pwnam() call in local_lookup_name to sys_getpwnam() as it did not seem necessary to try case permutations in the username. Tim, I think this was your code, so you might want to double check me. -- jerry (This used to be commit 37a665002c5cd7908c13d306f61af272a899dbc8) --- source3/rpc_parse/parse_net.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 904f3f3612..1080995aa4 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1034,12 +1034,12 @@ void init_net_user_info3(NET_USER_INFO_3 *usr, SAM_ACCOUNT *sampw, int len_logon_srv = strlen(logon_srv); int len_logon_dom = strlen(logon_dom); - len_user_name = user_name != NULL ? strlen(user_name )+1 : 0; - len_full_name = full_name != NULL ? strlen(full_name )+1 : 0; - len_home_dir = home_dir != NULL ? strlen(home_dir )+1 : 0; - len_dir_drive = dir_drive != NULL ? strlen(dir_drive )+1 : 0; - len_logon_script = logon_script != NULL ? strlen(logon_script)+1 : 0; - len_profile_path = profile_path != NULL ? strlen(profile_path)+1 : 0; + len_user_name = strlen(user_name ); + len_full_name = strlen(full_name ); + len_home_dir = strlen(home_dir ); + len_dir_drive = strlen(dir_drive ); + len_logon_script = strlen(logon_script); + len_profile_path = strlen(profile_path); ZERO_STRUCTP(usr); -- cgit From 0e84103a54e27d8fce4c1eb5c947d46878c6ae5e Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Wed, 29 Nov 2000 14:39:06 +0000 Subject: alignment issues. I hate that job ... J.F. (This used to be commit 97e3b293569cebd91b5f2b37a7578e2e2779ceb0) --- source3/rpc_parse/parse_samr.c | 49 ++++++++++++++++++++---------------------- source3/rpc_parse/parse_srv.c | 14 ++++++++++-- 2 files changed, 35 insertions(+), 28 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 2208d76090..c36ca06aae 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3136,53 +3136,55 @@ static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *ps if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */ return False; - if(!prs_align(ps)) + if(!prs_align_needed(ps, usr->hdr_full_name.buffer)) 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(!prs_align(ps)) + if(!prs_align_needed(ps, usr->hdr_home_dir.buffer)) 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(!prs_align(ps)) + if(!prs_align_needed(ps, usr->hdr_dir_drive.buffer)) 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)) + if(!prs_align_needed(ps, usr->hdr_logon_script.buffer)) 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(!prs_align(ps)) + if(!prs_align_needed(ps, usr->hdr_profile_path.buffer)) 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(!prs_align(ps)) + if(!prs_align_needed(ps, usr->hdr_acct_desc.buffer)) return False; if(!smb_io_unistr2("uni_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth)) /* user description unicode string */ return False; - if(!prs_align(ps)) + if(!prs_align_needed(ps, usr->hdr_workstations.buffer)) 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(!prs_align(ps)) + if(!prs_align_needed(ps, usr->hdr_unknown_str.buffer)) return False; - if(!smb_io_unistr2("uni_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str .buffer, ps, depth)) /* unknown string */ + if(!smb_io_unistr2("uni_user_comment", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */ return False; - if(!prs_align(ps)) + if(!prs_align_needed(ps, usr->hdr_munged_dial.buffer)) 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 */ + 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; - if(!prs_align(ps)) - return False; - if(!prs_uint32("unknown_6 ", ps, depth, &usr->unknown_6)) - return False; - if(!prs_uint32("padding4 ", ps, depth, &usr->padding4)) - return False; + if (usr->ptr_logon_hrs) { + + if(!prs_align(ps)) + return False; + if(!prs_uint32("unknown_6 ", ps, depth, &usr->unknown_6)) + return False; + if(!prs_uint32("padding4 ", ps, depth, &usr->padding4)) + return False; - if (usr->ptr_logon_hrs) if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth)) return False; + } return True; } @@ -4251,25 +4253,20 @@ static BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 *usr, prs_struct *ps return False; /* ok, this is only guess-work (as usual) */ - if (usr->unknown_5 != 0x0) { + if (usr->ptr_logon_hrs) { if(!prs_align(ps)) return False; if(!prs_uint32("unknown_6", ps, depth, &usr->unknown_6)) return False; if(!prs_uint32("padding4", ps, depth, &usr->padding4)) return False; + if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth)) + return False; } else if (UNMARSHALLING(ps)) { usr->unknown_6 = 0; usr->padding4 = 0; } - if (usr->ptr_logon_hrs) { - if(!prs_align(ps)) - return False; - if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth)) - return False; - } - return True; } diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 6eeae80cfc..be7401ffc5 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -54,9 +54,11 @@ static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *p if(!prs_align(ps)) return False; - if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth)) return False; + + if(!prs_align(ps)) + return False; if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth)) return False; @@ -131,13 +133,21 @@ static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2_STR *sh2, prs_struct *p if(!prs_align(ps)) return False; - if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth)) return False; + + if(!prs_align(ps)) + return False; if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth)) return False; + + if(!prs_align(ps)) + return False; if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth)) return False; + + if(!prs_align(ps)) + return False; if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth)) return False; -- cgit From 0e494d7ec6793968337c753fc312b6e56efa2114 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 4 Dec 2000 01:58:22 +0000 Subject: no longer pass the type to make_sec_desc(), instead the type is derived from the other arguments (This used to be commit 9ec4b1fa48fbae937fdf78db06005a7b0cd52d89) --- source3/rpc_parse/parse_sec.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 39ead58126..2d4f745380 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -419,12 +419,11 @@ SEC_DESC_BUF *sec_desc_merge(SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb) dacl = new_sdb->sec->dacl; } else { dacl = old_sdb->sec->dacl; - secdesc_type |= SEC_DESC_DACL_PRESENT; } /* Create new security descriptor from bits */ - psd = make_sec_desc(new_sdb->sec->revision, secdesc_type, + psd = make_sec_desc(new_sdb->sec->revision, owner_sid, group_sid, sacl, dacl, &secdesc_size); return_sdb = make_sec_desc_buf(secdesc_size, psd); @@ -438,7 +437,7 @@ SEC_DESC_BUF *sec_desc_merge(SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb) Creates a SEC_DESC structure ********************************************************************/ -SEC_DESC *make_sec_desc(uint16 revision, uint16 type, +SEC_DESC *make_sec_desc(uint16 revision, DOM_SID *owner_sid, DOM_SID *grp_sid, SEC_ACL *sacl, SEC_ACL *dacl, size_t *sd_size) { @@ -453,7 +452,10 @@ SEC_DESC *make_sec_desc(uint16 revision, uint16 type, ZERO_STRUCTP(dst); dst->revision = revision; - dst->type = type; + dst->type = SEC_DESC_SELF_RELATIVE; + + if (sacl) dst->type |= SEC_DESC_SACL_PRESENT; + if (dacl) dst->type |= SEC_DESC_DACL_PRESENT; dst->off_owner_sid = 0; dst->off_grp_sid = 0; @@ -535,7 +537,7 @@ SEC_DESC *dup_sec_desc( SEC_DESC *src) if(src == NULL) return NULL; - return make_sec_desc( src->revision, src->type, + return make_sec_desc( src->revision, src->owner_sid, src->grp_sid, src->sacl, src->dacl, &dummy); } @@ -568,7 +570,7 @@ void free_sec_desc(SEC_DESC **ppsd) SEC_DESC *make_standard_sec_desc(DOM_SID *owner_sid, DOM_SID *grp_sid, SEC_ACL *dacl, size_t *sd_size) { - return make_sec_desc(SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE|SEC_DESC_DACL_PRESENT, + return make_sec_desc(SEC_DESC_REVISION, owner_sid, grp_sid, NULL, dacl, sd_size); } -- cgit From 3478427f2e5ab634d61e6863f41bba84cce8d05e Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 8 Dec 2000 03:34:00 +0000 Subject: Port of lsa_lookup_sids() and lsa_lookup_names() rpc client functions from TNG branch. Re-instated lsa_lookup_sids and lsa_lookup_names functions in rpcclient. This requires most samba binaries to link in another handful of object files due to uncessary coupling between modules. )-: (This used to be commit 817819d0cc3ecf642be5a1656be3b71bed260ee4) --- source3/rpc_parse/parse_lsa.c | 64 ++++++++++++++++++++---------------------- source3/rpc_parse/parse_misc.c | 8 +++--- 2 files changed, 35 insertions(+), 37 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 5a266cbbda..a53c07366e 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -147,7 +147,7 @@ static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int dep void init_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff, uint32 unknown) { - DEBUG(5,("init_lsa_sec_qos\n")); + DEBUG(5, ("init_lsa_sec_qos\n")); qos->len = 0x0c; /* length of quality of service block, in bytes */ qos->sec_imp_level = imp_lev; @@ -205,7 +205,7 @@ static BOOL lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int de void init_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos) { - DEBUG(5,("make_lsa_obj_attr\n")); + DEBUG(5, ("init_lsa_obj_attr\n")); attr->len = 0x18; /* length of object attribute block, in bytes */ attr->ptr_root_dir = 0; @@ -281,7 +281,8 @@ void init_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name, uint32 desired_access, LSA_SEC_QOS *qos) { - DEBUG(5,("make_open_pol: attr:%d da:%d\n", attributes, desired_access)); + DEBUG(5, ("init_open_pol: attr:%d da:%d\n", attributes, + desired_access)); r_q->ptr = 1; /* undocumented pointer */ @@ -296,10 +297,10 @@ void init_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name, Reads or writes an LSA_Q_OPEN_POL structure. ********************************************************************/ -BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int depth) +BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, + int depth) { - if (r_q == NULL) - return False; + if (r_q == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_q_open_pol"); depth++; @@ -308,7 +309,7 @@ BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int dept return False; if(!prs_uint16("system_name", ps, depth, &r_q->system_name)) return False; - if(!prs_align( ps )) + if(!prs_align(ps)) return False; if(!lsa_io_obj_attr("", &r_q->attr, ps, depth)) @@ -352,7 +353,8 @@ void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, uint32 desired_access, LSA_SEC_QOS *qos) { - DEBUG(5,("make_open_pol2: attr:%d da:%d\n", attributes, desired_access)); + DEBUG(5, ("init_open_pol2: attr:%d da:%d\n", attributes, + desired_access)); r_q->ptr = 1; /* undocumented pointer */ @@ -484,7 +486,7 @@ BOOL lsa_io_r_query_sec_obj(char *desc, LSA_R_QUERY_SEC_OBJ *r_u, prs_struct *ps void init_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class) { - DEBUG(5,("make_q_query\n")); + DEBUG(5, ("init_q_query\n")); memcpy(&q_q->pol, hnd, sizeof(q_q->pol)); @@ -544,7 +546,7 @@ void init_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context, char *domain_name, DOM_SID *domain_sid, uint32 status) { - DEBUG(5,("make_r_enum_trust_dom\n")); + DEBUG(5, ("init_r_enum_trust_dom\n")); r_e->enum_context = enum_context; @@ -646,26 +648,21 @@ BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth Inits a LSA_SID_ENUM structure. ********************************************************************/ -void init_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID **sids) +void init_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID *sids) { - int i, i2; + int i; - DEBUG(5,("make_lsa_sid_enum\n")); + DEBUG(5, ("init_lsa_sid_enum\n")); sen->num_entries = num_entries; - sen->ptr_sid_enum = (num_entries != 0) ? 1 : 0; + sen->ptr_sid_enum = num_entries != 0; sen->num_entries2 = num_entries; SMB_ASSERT_ARRAY(sen->sid, sen->num_entries); - for (i = 0, i2 = 0; i < num_entries; i++) { - if (sids[i] != NULL) { - sen->ptr_sid[i] = 1; - init_dom_sid2(&sen->sid[i2], sids[i]); - i2++; - } else { - sen->ptr_sid[i] = 0; - } + for (i = 0; i < num_entries; i++) { + sen->ptr_sid[i] = 1; + init_dom_sid2(&sen->sid[i], &sids[i]); } } @@ -720,12 +717,12 @@ static BOOL lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, ********************************************************************/ void init_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd, - int num_sids, DOM_SID **sids, - uint16 level) + int num_sids, DOM_SID *sids, uint16 level) { - DEBUG(5,("make_r_enum_trust_dom\n")); + DEBUG(5, ("init_q_lookup_sids\n")); + + q_l->pol = *hnd; - memcpy(&q_l->pol, hnd, sizeof(q_l->pol)); init_lsa_sid_enum(&q_l->sids, num_sids, sids); q_l->names.num_entries = 0; @@ -739,7 +736,8 @@ void init_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd, Reads or writes a LSA_Q_LOOKUP_SIDS structure. ********************************************************************/ -BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, int depth) +BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, + prs_struct *ps, int depth) { if (q_s == NULL) return False; @@ -857,22 +855,22 @@ makes a structure. ********************************************************************/ void init_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, - int num_names, char **names) + int num_names, char **names) { int i; DEBUG(5,("init_q_lookup_names\n")); - memcpy(&q_l->pol, hnd, sizeof(q_l->pol)); - + q_l->pol = *hnd; q_l->num_entries = num_names; q_l->num_entries2 = num_names; SMB_ASSERT_ARRAY(q_l->uni_name, q_l->num_entries); for (i = 0; i < num_names; i++) { - char* name = names[i]; - int len = strlen(name)+1; + char *name = names[i]; + int len = strlen(name); + init_uni_hdr(&q_l->hdr_name[i], len); init_unistr2(&q_l->uni_name[i], name, len); } @@ -993,7 +991,7 @@ BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, void init_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd) { - DEBUG(5,("make_lsa_q_close\n")); + DEBUG(5, ("init_lsa_q_close\n")); memcpy(&q_c->pol, hnd, sizeof(q_c->pol)); } diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 859a800771..dd6784a8e7 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -321,7 +321,7 @@ void init_uni_hdr(UNIHDR *hdr, int len) { hdr->uni_str_len = 2 * len; hdr->uni_max_len = 2 * len; - hdr->buffer = len != 0 ? 1 : 0; + hdr->buffer = len != 0; } /******************************************************************* @@ -867,7 +867,8 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len) { ZERO_STRUCTP(str); - /* set up string lengths. */ + /* Set up string lengths. */ + str->uni_max_len = (uint32)len; str->undoc = 0; str->uni_str_len = (uint32)len; @@ -880,8 +881,7 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len) len *= sizeof(uint16); str->buffer = (uint16 *)talloc(parse_misc_talloc, len); - if ((str->buffer == NULL) && (len > 0)) - { + if ((str->buffer == NULL) && (len > 0)) { smb_panic("init_unistr2: malloc fail\n"); return; } -- cgit From 4d56f4f3103a5cc549504af133d29ebb30fb59c6 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 11 Dec 2000 06:34:12 +0000 Subject: return NULL instead of return False in char *prs_mem_get(); (This used to be commit 71e5e802b78b22af9be7d3e84e869f311937e542) --- source3/rpc_parse/parse_prs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 659f8e42bd..e800c20290 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -442,7 +442,7 @@ char *prs_mem_get(prs_struct *ps, uint32 extra_size) * Writing - grow the buffer if needed. */ if(!prs_grow(ps, extra_size)) - return False; + return NULL; } return &ps->data_p[ps->data_offset]; } -- cgit From 20ac3fc77e9423ab13a2cc1a2ef3d266f5b233e0 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 12 Dec 2000 02:45:11 +0000 Subject: Merged in Tim's changes : Removed static limit of MAX_LOOKUP_SIDS in rpc server and client lsa_lookup_names() and lsa_lookup_sids(). Jeremy. (This used to be commit 9e9c71c8b3194b7cd02fea0b6a000d4f2940d905) --- source3/rpc_parse/parse_lsa.c | 142 ++++++++++++++++++++++++++++++------------ 1 file changed, 101 insertions(+), 41 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index a53c07366e..6a2e504f79 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -297,10 +297,10 @@ void init_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name, Reads or writes an LSA_Q_OPEN_POL structure. ********************************************************************/ -BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, - int depth) +BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int depth) { - if (r_q == NULL) return False; + if (r_q == NULL) + return False; prs_debug(ps, depth, desc, "lsa_io_q_open_pol"); depth++; @@ -309,7 +309,7 @@ BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, return False; if(!prs_uint16("system_name", ps, depth, &r_q->system_name)) return False; - if(!prs_align(ps)) + if(!prs_align( ps )) return False; if(!lsa_io_obj_attr("", &r_q->attr, ps, depth)) @@ -353,7 +353,7 @@ void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, uint32 desired_access, LSA_SEC_QOS *qos) { - DEBUG(5, ("init_open_pol2: attr:%d da:%d\n", attributes, + DEBUG(5, ("init_q_open_pol2: attr:%d da:%d\n", attributes, desired_access)); r_q->ptr = 1; /* undocumented pointer */ @@ -648,21 +648,43 @@ BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth Inits a LSA_SID_ENUM structure. ********************************************************************/ -void init_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID *sids) +void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, + int num_entries, DOM_SID **sids) { - int i; + int i, i2; DEBUG(5, ("init_lsa_sid_enum\n")); sen->num_entries = num_entries; - sen->ptr_sid_enum = num_entries != 0; + sen->ptr_sid_enum = (num_entries != 0); sen->num_entries2 = num_entries; - SMB_ASSERT_ARRAY(sen->sid, sen->num_entries); + /* Allocate memory for sids and sid pointers */ + + if (num_entries == 0) return; + + if ((sen->ptr_sid = (uint32 *)talloc(mem_ctx, num_entries * + sizeof(uint32))) == NULL) { + DEBUG(3, ("init_lsa_sid_enum(): out of memory for ptr_sid\n")); + return; + } + + if ((sen->sid = (DOM_SID2 *)talloc(mem_ctx, num_entries * + sizeof(DOM_SID2))) == 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]); + for (i = 0, i2 = 0; i < num_entries; i++) { + if (sids[i] != NULL) { + sen->ptr_sid[i] = 1; + init_dom_sid2(&sen->sid[i2], sids[i]); + i2++; + } else { + sen->ptr_sid[i] = 0; + } } } @@ -670,13 +692,12 @@ void init_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID *sids) Reads or writes a LSA_SID_ENUM structure. ********************************************************************/ -static BOOL lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, - prs_struct *ps, int depth) +static BOOL lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, + prs_struct *ps, int depth) { int i; - if (sen == NULL) - return False; + if (sen == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_sid_enum"); depth++; @@ -691,22 +712,40 @@ static BOOL lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, if(!prs_uint32("num_entries2", ps, depth, &sen->num_entries2)) return False; - SMB_ASSERT_ARRAY(sen->ptr_sid, sen->num_entries); + /* Mallocate memory if we're unpacking from the wire */ + + if (UNMARSHALLING(ps)) { + if ((sen->ptr_sid = (uint32 *)malloc( + sen->num_entries * sizeof(uint32))) == NULL) { + DEBUG(3, ("init_lsa_sid_enum(): out of memory for " + "ptr_sid\n")); + return False; + } + + if ((sen->sid = (DOM_SID2 *)malloc( + sen->num_entries * sizeof(DOM_SID2))) == 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])) /* domain SID pointers to be looked up. */ + if(!prs_uint32(temp, ps, depth, &sen->ptr_sid[i])) { return False; + } } - SMB_ASSERT_ARRAY(sen->sid, sen->num_entries); - 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)) /* domain SIDs to be looked up. */ + if(!smb_io_dom_sid2(temp, &sen->sid[i], ps, depth)) { return False; + } } return True; @@ -716,19 +755,17 @@ static BOOL lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, Inits an LSA_R_ENUM_TRUST_DOM structure. ********************************************************************/ -void init_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd, - int num_sids, DOM_SID *sids, uint16 level) +void init_q_lookup_sids(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_SIDS *q_l, + POLICY_HND *hnd, int num_sids, DOM_SID **sids, + uint16 level) { - DEBUG(5, ("init_q_lookup_sids\n")); - - q_l->pol = *hnd; - - init_lsa_sid_enum(&q_l->sids, num_sids, sids); + DEBUG(5, ("init_r_enum_trust_dom\n")); - q_l->names.num_entries = 0; - q_l->names.ptr_trans_names = 0; - q_l->names.num_entries2 = 0; + 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.value = level; } @@ -736,8 +773,7 @@ void init_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd, Reads or writes a LSA_Q_LOOKUP_SIDS structure. ********************************************************************/ -BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, - prs_struct *ps, int depth) +BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, int depth) { if (q_s == NULL) return False; @@ -787,9 +823,23 @@ static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, return False; if (trn->ptr_trans_names != 0) { - if(!prs_uint32("num_entries2 ", ps, depth, &trn->num_entries2)) + if(!prs_uint32("num_entries2 ", ps, depth, + &trn->num_entries2)) return False; - SMB_ASSERT_ARRAY(trn->name, trn->num_entries); + + if (UNMARSHALLING(ps)) { + if ((trn->name = (LSA_TRANS_NAME *) + malloc(trn->num_entries * + sizeof(LSA_TRANS_NAME))) == NULL) { + return False; + } + + if ((trn->uni_name = (UNISTR2 *) + malloc(trn->num_entries * + sizeof(UNISTR2))) == NULL) { + return False; + } + } for (i = 0; i < trn->num_entries2; i++) { fstring t; @@ -808,6 +858,16 @@ static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, if(!prs_align(ps)) return False; } + + /* Free memory if we've sent it */ + + if (MARSHALLING(ps)) { + safe_free(trn->name); + safe_free(trn->uni_name); + + trn->name = NULL; + trn->uni_name = NULL; + } } return True; @@ -855,22 +915,22 @@ makes a structure. ********************************************************************/ void init_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, - int num_names, char **names) + int num_names, char **names) { int i; - DEBUG(5,("init_q_lookup_names\n")); + DEBUG(5, ("init_q_lookup_names\n")); + + memcpy(&q_l->pol, hnd, sizeof(q_l->pol)); - q_l->pol = *hnd; q_l->num_entries = num_names; q_l->num_entries2 = num_names; SMB_ASSERT_ARRAY(q_l->uni_name, q_l->num_entries); for (i = 0; i < num_names; i++) { - char *name = names[i]; - int len = strlen(name); - + char* name = names[i]; + int len = strlen(name)+1; init_uni_hdr(&q_l->hdr_name[i], len); init_unistr2(&q_l->uni_name[i], name, len); } -- cgit From e43671cd57dff9a92d5a196e89a552712a30abee Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 13 Dec 2000 11:53:37 +0000 Subject: Wrong length for unistr2 in init_q_lookup_names() Removed some more static arrays and replaced with tallocated memory blocks. (This used to be commit 1db0f31ae00bf9c91eb7d02c96bf766d04c7bdef) --- source3/rpc_parse/parse_lsa.c | 57 +++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 24 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 6a2e504f79..4b0e6e4106 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -649,9 +649,9 @@ BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth ********************************************************************/ void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, - int num_entries, DOM_SID **sids) + int num_entries, DOM_SID *sids) { - int i, i2; + int i; DEBUG(5, ("init_lsa_sid_enum\n")); @@ -677,14 +677,9 @@ void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, /* Copy across SIDs and SID pointers */ - for (i = 0, i2 = 0; i < num_entries; i++) { - if (sids[i] != NULL) { - sen->ptr_sid[i] = 1; - init_dom_sid2(&sen->sid[i2], sids[i]); - i2++; - } else { - sen->ptr_sid[i] = 0; - } + for (i = 0; i < num_entries; i++) { + sen->ptr_sid[i] = 1; + init_dom_sid2(&sen->sid[i], &sids[i]); } } @@ -756,7 +751,7 @@ static BOOL lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, ********************************************************************/ void init_q_lookup_sids(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_SIDS *q_l, - POLICY_HND *hnd, int num_sids, DOM_SID **sids, + POLICY_HND *hnd, int num_sids, DOM_SID *sids, uint16 level) { DEBUG(5, ("init_r_enum_trust_dom\n")); @@ -914,31 +909,39 @@ BOOL lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, in makes a structure. ********************************************************************/ -void init_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd, - int num_names, char **names) +void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, + POLICY_HND *hnd, int num_names, char **names) { int i; DEBUG(5, ("init_q_lookup_names\n")); - memcpy(&q_l->pol, hnd, sizeof(q_l->pol)); + ZERO_STRUCTP(q_l); + q_l->pol = *hnd; q_l->num_entries = num_names; q_l->num_entries2 = num_names; + q_l->lookup_level = 1; - SMB_ASSERT_ARRAY(q_l->uni_name, q_l->num_entries); + if ((q_l->uni_name = (UNISTR2 *)talloc( + mem_ctx, num_names * sizeof(UNISTR2))) == NULL) { + DEBUG(3, ("init_q_lookup_names(): out of memory\n")); + return; + } + + if ((q_l->hdr_name = (UNIHDR *)talloc( + mem_ctx, num_names * sizeof(UNIHDR))) == NULL) { + DEBUG(3, ("init_q_lookup_names(): out of memory\n")); + return; + } for (i = 0; i < num_names; i++) { char* name = names[i]; - int len = strlen(name)+1; + int len = strlen(name); + init_uni_hdr(&q_l->hdr_name[i], len); init_unistr2(&q_l->uni_name[i], name, len); } - - q_l->num_trans_entries = 0; - q_l->ptr_trans_sids = 0; - q_l->lookup_level = 1; - q_l->mapped_count = 0; } /******************************************************************* @@ -966,8 +969,6 @@ BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, if(!prs_uint32("num_entries2 ", ps, depth, &q_r->num_entries2)) return False; - SMB_ASSERT_ARRAY(q_r->uni_name, q_r->num_entries); - for (i = 0; i < q_r->num_entries; i++) { if(!smb_io_unihdr("hdr_name", &q_r->hdr_name[i], ps, depth)) /* pointer names */ return False; @@ -996,7 +997,8 @@ BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth) +BOOL lsa_io_r_lookup_names(TALLOC_CTX *mem_ctx, char *desc, + LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth) { int i; @@ -1030,6 +1032,13 @@ BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, return False; } + if ((r_r->dom_rid = (DOM_RID2 *) + talloc(mem_ctx, r_r->num_entries2 * sizeof(DOM_RID2))) + == NULL) { + DEBUG(3, ("lsa_io_r_lookup_names(): out of memory\n")); + return False; + } + for (i = 0; i < r_r->num_entries2; i++) if(!smb_io_dom_rid2("", &r_r->dom_rid[i], ps, depth)) /* domain RIDs being looked up */ return False; -- cgit From 1fc3e43f9b9b431e8499d2ebd7f557b9bf2ff14c Mon Sep 17 00:00:00 2001 From: David O'Neill Date: Thu, 14 Dec 2000 19:31:24 +0000 Subject: Changes from APPLIANCE_HEAD: - add some debugs for comparing two security descriptors. (source/rpc_parse/parse_sec.c) (This used to be commit 505a8a2277f2bc761bd2b170fafbcb3afd982d92) --- source3/rpc_parse/parse_sec.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 2d4f745380..eac00d8372 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -348,11 +348,14 @@ BOOL sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2) { /* Trivial case */ - if (!s1 && !s2) return True; + if (!s1 && !s2) { + goto done; + } /* Check top level stuff */ if (s1->revision != s2->revision || s1->type != s2->type) { + DEBUG(10, ("sec_desc_equal(): revision/type not equal\n")); return False; } @@ -360,6 +363,7 @@ BOOL sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2) if (!sid_equal(s1->owner_sid, s2->owner_sid) || !sid_equal(s1->grp_sid, s2->grp_sid)) { + DEBUG(10, ("sec_desc_equal(): owner/group not equal\n")); return False; } @@ -367,6 +371,7 @@ BOOL sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2) if ((s1->dacl && !s2->dacl) || (!s1->dacl && s2->dacl) || (s1->sacl && !s2->sacl) || (!s1->sacl && s2->sacl)) { + DEBUG(10, ("sec_desc_equal(): dacl/sacl not equal\n")); return False; } @@ -375,9 +380,12 @@ BOOL sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2) if (!sec_acl_equal(s1->dacl, s2->dacl) || !sec_acl_equal(s1->sacl, s2->sacl)) { + DEBUG(10, ("sec_desc_equal(): dacl/dacl list not equal\n")); return False; } + done: + DEBUG(10, ("sec_equal(): secdescs are identical\n")); return True; } -- cgit From 369f5fd1d7a6e6298bc3cbe01e3aaed0106f6cf4 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 15 Dec 2000 01:02:11 +0000 Subject: Fixed memory leaks in lsa_XX calls. Fixed memory leaks in smbcacls. Merged in fixes from appliance-head and 2.2. Fixed multiple connection.tdb open problem. Jeremy. (This used to be commit 0a40bc83e14c69a09948ec09bb6fc5026c4f4c14) --- source3/rpc_parse/parse_lsa.c | 43 +++++++++++++++++++++++++++++------------- source3/rpc_parse/parse_misc.c | 8 ++++---- 2 files changed, 34 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 4b0e6e4106..41219854d1 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -710,14 +710,14 @@ static BOOL lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, /* Mallocate memory if we're unpacking from the wire */ if (UNMARSHALLING(ps)) { - if ((sen->ptr_sid = (uint32 *)malloc( + if ((sen->ptr_sid = (uint32 *)prs_alloc_mem( ps, sen->num_entries * sizeof(uint32))) == NULL) { DEBUG(3, ("init_lsa_sid_enum(): out of memory for " "ptr_sid\n")); return False; } - if ((sen->sid = (DOM_SID2 *)malloc( + if ((sen->sid = (DOM_SID2 *)prs_alloc_mem( ps, sen->num_entries * sizeof(DOM_SID2))) == NULL) { DEBUG(3, ("init_lsa_sid_enum(): out of memory for " "sids\n")); @@ -824,13 +824,13 @@ static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, if (UNMARSHALLING(ps)) { if ((trn->name = (LSA_TRANS_NAME *) - malloc(trn->num_entries * + prs_alloc_mem(ps, trn->num_entries * sizeof(LSA_TRANS_NAME))) == NULL) { return False; } if ((trn->uni_name = (UNISTR2 *) - malloc(trn->num_entries * + prs_alloc_mem(ps, trn->num_entries * sizeof(UNISTR2))) == NULL) { return False; } @@ -964,23 +964,40 @@ BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, 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 = (UNIHDR *)prs_alloc_mem(ps, + q_r->num_entries * sizeof(UNIHDR))) == NULL) + return False; + if ((q_r->uni_name = (UNISTR2 *)prs_alloc_mem(ps, + q_r->num_entries * sizeof(UNISTR2))) == 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(!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(!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)) @@ -997,8 +1014,7 @@ BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_lookup_names(TALLOC_CTX *mem_ctx, char *desc, - LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth) +BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth) { int i; @@ -1032,11 +1048,12 @@ BOOL lsa_io_r_lookup_names(TALLOC_CTX *mem_ctx, char *desc, return False; } - if ((r_r->dom_rid = (DOM_RID2 *) - talloc(mem_ctx, r_r->num_entries2 * sizeof(DOM_RID2))) - == NULL) { - DEBUG(3, ("lsa_io_r_lookup_names(): out of memory\n")); - return False; + if (UNMARSHALLING(ps)) { + if ((r_r->dom_rid = (DOM_RID2 *)prs_alloc_mem(ps, r_r->num_entries2 * sizeof(DOM_RID2))) + == NULL) { + DEBUG(3, ("lsa_io_r_lookup_names(): out of memory\n")); + return False; + } } for (i = 0; i < r_r->num_entries2; i++) diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index dd6784a8e7..859a800771 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -321,7 +321,7 @@ void init_uni_hdr(UNIHDR *hdr, int len) { hdr->uni_str_len = 2 * len; hdr->uni_max_len = 2 * len; - hdr->buffer = len != 0; + hdr->buffer = len != 0 ? 1 : 0; } /******************************************************************* @@ -867,8 +867,7 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len) { ZERO_STRUCTP(str); - /* Set up string lengths. */ - + /* set up string lengths. */ str->uni_max_len = (uint32)len; str->undoc = 0; str->uni_str_len = (uint32)len; @@ -881,7 +880,8 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len) len *= sizeof(uint16); str->buffer = (uint16 *)talloc(parse_misc_talloc, len); - if ((str->buffer == NULL) && (len > 0)) { + if ((str->buffer == NULL) && (len > 0)) + { smb_panic("init_unistr2: malloc fail\n"); return; } -- cgit From 89af6fd745a6f49668bae5b5c2d239d3671fb299 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Fri, 15 Dec 2000 09:31:56 +0000 Subject: lib/util_unistr.c: rewrote unistr2_to_ascii() to correct a bug seen on SGI boxes. rpc_parse/parse_misc.c: rpc_parse/parse_prs.c: rewrote of BUFFER5 handling to NOT byteswap when it was already in network byte order. rpc_parse/parse_samr.c: cleanup of samr_io_q_lookup_domain(), remove the over-parsing by 2 bytes. rpc_server/srv_lsa.c: UNISTR2 strings need to be NULL terminated to pleased W2K. rpc_server/srv_spoolss_nt.c: use snprintf instead of safe_strcpy as we want the string truncated at 32 chars. That should fix SUN and SGI box not able to act as printserver and the problem with joining from a W2K wks. J.F. (This used to be commit 69fe739303b105f2c488f266f13977da1b6b201d) --- source3/rpc_parse/parse_misc.c | 17 +++++++---------- source3/rpc_parse/parse_prs.c | 41 +++++++++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_samr.c | 25 ++++++++++++++----------- 3 files changed, 62 insertions(+), 21 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 859a800771..0a2f49d4dd 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -647,17 +647,14 @@ BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) if (buf5 == NULL) return False; - prs_align(ps); - prs_uint32("buf_len", ps, depth, &(buf5->buf_len)); + if(!prs_align(ps)) + return False; + if(!prs_uint32("buf_len", ps, depth, &buf5->buf_len)) + return False; - /* reading: alloc the buffer first */ - if ( UNMARSHALLING(ps) ) { - buf5->buffer=(uint16 *)prs_alloc_mem(ps, sizeof(uint16)*buf5->buf_len ); - if (buf5->buffer == NULL) - return False; - } - - prs_uint16s(True, "buffer", ps, depth, buf5->buffer, buf5->buf_len); + + if(!prs_buffer5(True, "buffer" , ps, depth, buf5)) + return False; return True; } diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index e800c20290..5621a2c210 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -562,6 +562,47 @@ BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *d return True; } +/****************************************************************** + Stream an array of unicode string, length/buffer specified separately, + in uint16 chars. We use DBG_RW_PCVAL, not DBG_RW_PSVAL here + as the unicode string is already in little-endian format. + ********************************************************************/ + +BOOL prs_buffer5(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER5 *str) +{ + char *p; + char *q = prs_mem_get(ps, str->buf_len * sizeof(uint16)); + if (q == NULL) + return False; + + if (UNMARSHALLING(ps)) { + str->buffer = (uint16 *)prs_alloc_mem(ps,str->buf_len * sizeof(uint16)); + if (str->buffer == NULL) + return False; + memset(str->buffer, '\0', str->buf_len * sizeof(uint16)); + } + + /* If the string is empty, we don't have anything to stream */ + if (str->buf_len==0) + return True; + + p = (char *)str->buffer; + + /* If we're using big-endian, reverse to get little-endian. */ + if(ps->bigendian_data) { + DBG_RW_PSVAL(charmode, name, depth, ps->data_offset, + ps->io, ps->bigendian_data, q, p, + str->buf_len) + } else { + DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, + ps->io, q, p, str->buf_len * sizeof(uint16)) + } + + ps->data_offset += (str->buf_len * sizeof(uint16)); + + return True; +} + /****************************************************************** Stream a "not" unicode string, length/buffer specified separately, in byte chars. String is in little-endian format. diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index c36ca06aae..aa08606a57 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3890,22 +3890,25 @@ BOOL samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER *r_u, prs_struct **********************************************************************/ BOOL samr_io_q_lookup_domain(char* desc, SAMR_Q_LOOKUP_DOMAIN* q_u, prs_struct *ps, int depth) { - if (q_u == NULL) - return False; + if (q_u == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_q_lookup_domain"); - depth++; + prs_debug(ps, depth, desc, "samr_io_q_lookup_domain"); + depth++; + + if(!prs_align(ps)) + return False; - prs_align(ps); + if(!smb_io_pol_hnd("connect_pol", &q_u->connect_pol, ps, depth)) + return False; - smb_io_pol_hnd("connect_pol", &(q_u->connect_pol), ps, depth); + if(!smb_io_unihdr("hdr_domain", &q_u->hdr_domain, ps, depth)) + return False; - smb_io_unihdr("hdr_domain", &(q_u->hdr_domain), ps, depth); - smb_io_unistr2("uni_domain", &(q_u->uni_domain), - q_u->hdr_domain.buffer, ps, depth); - prs_align(ps); + if(!smb_io_unistr2("uni_domain", &q_u->uni_domain, q_u->hdr_domain.buffer, ps, depth)) + return False; - return True; + return True; } /******************************************************************* -- cgit From 99c2693c620cd222da5561d526aa328bec426b77 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 15 Dec 2000 21:29:06 +0000 Subject: Added lock backouts on fail. When chaining together long lines of bloody "if" statements, which should logically be separated, and one of them allocates memory, remember to *free* it *WHETHER OR NOT THE IF STATEMENTS SUCCEEDED* !!!! Yes I do consider this a bug in the coding style of Tridge, Rusty, Tim et al. :-). I'm just pissed 'cos this took 4 hours to track down even with an insure error report stating me in the face and also Ben Woodward looking over the code with me :-). Jeremy. (This used to be commit 506b5e34c3ba16768dbc82ba21044787de160c45) --- source3/rpc_parse/parse_srv.c | 41 ++--------------------------------------- 1 file changed, 2 insertions(+), 39 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index be7401ffc5..69cc1e7bda 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -291,7 +291,7 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct int i; if (UNMARSHALLING(ps)) { - if (!(info1 = malloc(num_entries * sizeof(SRV_SHARE_INFO_1)))) + if (!(info1 = prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_1)))) return False; memset(info1, '\0', num_entries * sizeof(SRV_SHARE_INFO_1)); ctr->share.info1 = info1; @@ -317,7 +317,7 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct int i; if (UNMARSHALLING(ps)) { - if (!(info2 = malloc(num_entries * sizeof(SRV_SHARE_INFO_2)))) + if (!(info2 = prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_2)))) return False; memset(info2, '\0', num_entries * sizeof(SRV_SHARE_INFO_2)); ctr->share.info2 = info2; @@ -345,43 +345,6 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct return True; } -/******************************************************************* - Frees a SRV_SHARE_INFO_CTR structure. -********************************************************************/ - -void free_srv_share_info_ctr(SRV_SHARE_INFO_CTR *ctr) -{ - if(!ctr) - return; - if(ctr->share.info) - free(ctr->share.info); - memset(ctr, '\0', sizeof(SRV_SHARE_INFO_CTR)); -} - -/******************************************************************* - Frees a SRV_Q_NET_SHARE_ENUM structure. -********************************************************************/ - -void free_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n) -{ - if(!q_n) - return; - free_srv_share_info_ctr(&q_n->ctr); - memset(q_n, '\0', sizeof(SRV_Q_NET_SHARE_ENUM)); -} - -/******************************************************************* - Frees a SRV_R_NET_SHARE_ENUM structure. -********************************************************************/ - -void free_srv_r_net_share_enum(SRV_R_NET_SHARE_ENUM *r_n) -{ - if(!r_n) - return; - free_srv_share_info_ctr(&r_n->ctr); - memset(r_n, '\0', sizeof(SRV_R_NET_SHARE_ENUM)); -} - /******************************************************************* Inits a SRV_Q_NET_SHARE_ENUM structure. ********************************************************************/ -- cgit From fb82ab78fe556656eec605d532e0dabb2f815573 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 15 Dec 2000 23:02:01 +0000 Subject: Never free anything in the rpc_parse/prs_XXX functions. Do it in the enclosing function. lib/util_unistr.c: Check lengths *before* reading source - prevent uninitialised memory reads. Jeremy. (This used to be commit ce4f461965c872fbfc9fe5f6b98aed58bb3dd67a) --- source3/rpc_parse/parse_lsa.c | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 41219854d1..2c15166f26 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -853,16 +853,6 @@ static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, if(!prs_align(ps)) return False; } - - /* Free memory if we've sent it */ - - if (MARSHALLING(ps)) { - safe_free(trn->name); - safe_free(trn->uni_name); - - trn->name = NULL; - trn->uni_name = NULL; - } } return True; -- cgit From 452102deb4b8aecb45569239685ec73e2e9282ec Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 18 Dec 2000 06:02:31 +0000 Subject: Merged Tim's fixes from appliance-head. Jeremy. (This used to be commit 26f873540c2299600cb80eb059fcdaf70ec82473) --- source3/rpc_parse/parse_sec.c | 47 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index eac00d8372..e2ca2202e1 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -317,7 +317,15 @@ BOOL sec_acl_equal(SEC_ACL *s1, SEC_ACL *s2) /* Check top level stuff */ - if (s1->revision != s2->revision || s1->num_aces != s2->num_aces) { + if (s1->revision != s2->revision) { + DEBUG(10, ("sec_acl_equal(): revision differs (%d != %d)\n", + s1->revision, s2->revision)); + return False; + } + + if (s1->num_aces != s2->num_aces) { + DEBUG(10, ("sec_acl_equal(): num_aces differs (%d != %d)\n", + s1->revision, s2->revision)); return False; } @@ -354,16 +362,39 @@ BOOL sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2) /* Check top level stuff */ - if (s1->revision != s2->revision || s1->type != s2->type) { - DEBUG(10, ("sec_desc_equal(): revision/type not equal\n")); + if (s1->revision != s2->revision) { + DEBUG(10, ("sec_desc_equal(): revision differs (%d != %d)\n", + s1->revision, s2->revision)); + return False; + } + + if (s1->type!= s2->type) { + DEBUG(10, ("sec_desc_equal(): type differs (%d != %d)\n", + s1->type, s2->type)); return False; } /* Check owner and group */ - if (!sid_equal(s1->owner_sid, s2->owner_sid) || - !sid_equal(s1->grp_sid, s2->grp_sid)) { - DEBUG(10, ("sec_desc_equal(): owner/group not equal\n")); + if (!sid_equal(s1->owner_sid, s2->owner_sid)) { + fstring str1, str2; + + sid_to_string(str1, s1->owner_sid); + sid_to_string(str2, s2->owner_sid); + + DEBUG(10, ("sec_desc_equal(): owner differs (%s != %s)\n", + str1, str2)); + return False; + } + + if (!sid_equal(s1->grp_sid, s2->grp_sid)) { + fstring str1, str2; + + sid_to_string(str1, s1->grp_sid); + sid_to_string(str2, s2->grp_sid); + + DEBUG(10, ("sec_desc_equal(): group differs (%s != %s)\n", + str1, str2)); return False; } @@ -371,7 +402,7 @@ BOOL sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2) if ((s1->dacl && !s2->dacl) || (!s1->dacl && s2->dacl) || (s1->sacl && !s2->sacl) || (!s1->sacl && s2->sacl)) { - DEBUG(10, ("sec_desc_equal(): dacl/sacl not equal\n")); + DEBUG(10, ("sec_desc_equal(): dacl or sacl not present\n")); return False; } @@ -380,7 +411,7 @@ BOOL sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2) if (!sec_acl_equal(s1->dacl, s2->dacl) || !sec_acl_equal(s1->sacl, s2->sacl)) { - DEBUG(10, ("sec_desc_equal(): dacl/dacl list not equal\n")); + DEBUG(10, ("sec_desc_equal(): dacl/sacl list not equal\n")); return False; } -- cgit From b578b4da5d3170e57957fa3ddfb40c60d5935847 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 18 Dec 2000 07:24:48 +0000 Subject: Cast prs_alloc_mem to correct type. Jeremy. (This used to be commit e0931cda809e4bb48bd97cad6d7ab5fb6dc53eb2) --- source3/rpc_parse/parse_srv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 69cc1e7bda..c572d881d6 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -291,7 +291,7 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct int i; if (UNMARSHALLING(ps)) { - if (!(info1 = prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_1)))) + if (!(info1 = (SRV_SHARE_INFO_1 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_1)))) return False; memset(info1, '\0', num_entries * sizeof(SRV_SHARE_INFO_1)); ctr->share.info1 = info1; @@ -317,7 +317,7 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct int i; if (UNMARSHALLING(ps)) { - if (!(info2 = prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_2)))) + if (!(info2 = (SRV_SHARE_INFO_2 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_2)))) return False; memset(info2, '\0', num_entries * sizeof(SRV_SHARE_INFO_2)); ctr->share.info2 = info2; -- cgit From 3380ffae9c231a34406dd694c9ab03bb0b6d8070 Mon Sep 17 00:00:00 2001 From: David O'Neill Date: Thu, 11 Jan 2001 20:41:19 +0000 Subject: Changes from APPLIANCE_HEAD: testsuite/printing/psec.c - Use lock directory from smb.conf parameter when peeking at the ntdrivers.tdb file. source/rpc_parse/parse_sec.c - fix typo in debug message source/script/installbin.sh - create private directory as part of 'make install'. source/nsswitch/winbindd_cache.c source/nsswitch/winbindd_idmap.c source/passdb/secrets.c source/smbd/connection.c - always convert tdb key to unix code-page when generating. source/printing/nt_printing.c - always convert tdb key to unix code-page when generating. - don't prepend path to a filename that is NULL in add_a_printer_driver_3(). source/rpc_server/srv_spoolss_nt.c - always convert tdb key to unix code-page when generating. - don't prepend server name to a path/filename that is NULL in the fill_printer_driver_info functions. source/printing/printing.c - always convert tdb key to unix code-page when generating. - move access check for print_queue_purge() outside of job delete loop. source/smbd/unix_acls.c - fix for setting ACLs (this got missed earlier) source/lib/messages.c - trivial sync with appliance_head (This used to be commit 376601d17d53ef7bfaafa576bd770e554516e808) --- source3/rpc_parse/parse_sec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index e2ca2202e1..c2c8ad120c 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -416,7 +416,7 @@ BOOL sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2) } done: - DEBUG(10, ("sec_equal(): secdescs are identical\n")); + DEBUG(10, ("sec_desc_equal(): secdescs are identical\n")); return True; } -- cgit From e29c028a44b7b31f3bfee760d65ad6d876e47c16 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 11 Jan 2001 22:54:12 +0000 Subject: General clean up. Merged routines for parsing enum_trust_dom rpc call. (This used to be commit 54b34517ce5e51ac697eff4befdd313222b4fecd) --- source3/rpc_parse/parse_lsa.c | 247 +++++++++++++++++++----------------------- 1 file changed, 111 insertions(+), 136 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 2c15166f26..d304c0231e 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -32,7 +32,7 @@ static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct ********************************************************************/ void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, - uint16 sid_name_use, char *name, uint32 idx) + uint16 sid_name_use, char *name, uint32 idx) { int len_name = strlen(name)+1; @@ -49,11 +49,9 @@ void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, Reads or writes a LSA_TRANS_NAME structure. ********************************************************************/ -static BOOL lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, int depth) +static BOOL lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, + int depth) { - if (trn == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_trans_name"); depth++; @@ -77,16 +75,14 @@ static BOOL lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, i Reads or writes a DOM_R_REF structure. ********************************************************************/ -static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) +static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, + int depth) { int i; prs_debug(ps, depth, desc, "lsa_io_dom_r_ref"); depth++; - if (r_r == NULL) - return False; - if(!prs_align(ps)) return False; @@ -145,7 +141,7 @@ static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int dep ********************************************************************/ void init_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff, - uint32 unknown) + uint32 unknown) { DEBUG(5, ("init_lsa_sec_qos\n")); @@ -160,13 +156,11 @@ void init_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff, Reads or writes an LSA_SEC_QOS structure. ********************************************************************/ -static BOOL lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int depth) +static BOOL lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, + int depth) { uint32 start; - if (qos == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_obj_qos"); depth++; @@ -198,7 +192,6 @@ static BOOL lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int de return True; } - /******************************************************************* Inits an LSA_OBJ_ATTR structure. ********************************************************************/ @@ -226,13 +219,11 @@ void init_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos) Reads or writes an LSA_OBJ_ATTR structure. ********************************************************************/ -static BOOL lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int depth) +static BOOL lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, + int depth) { uint32 start; - if (attr == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_obj_attr"); depth++; @@ -277,9 +268,8 @@ static BOOL lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int ********************************************************************/ void init_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name, - uint32 attributes, - uint32 desired_access, - LSA_SEC_QOS *qos) + uint32 attributes, uint32 desired_access, + LSA_SEC_QOS *qos) { DEBUG(5, ("init_open_pol: attr:%d da:%d\n", attributes, desired_access)); @@ -297,11 +287,9 @@ void init_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name, Reads or writes an LSA_Q_OPEN_POL structure. ********************************************************************/ -BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int depth) +BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, + int depth) { - if (r_q == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_q_open_pol"); depth++; @@ -327,11 +315,9 @@ BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int dept Reads or writes an LSA_R_OPEN_POL structure. ********************************************************************/ -BOOL lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int depth) +BOOL lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, + int depth) { - if (r_p == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_r_open_pol"); depth++; @@ -349,8 +335,7 @@ BOOL lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int dept ********************************************************************/ void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, - uint32 attributes, - uint32 desired_access, + uint32 attributes, uint32 desired_access, LSA_SEC_QOS *qos) { DEBUG(5, ("init_q_open_pol2: attr:%d da:%d\n", attributes, @@ -361,7 +346,9 @@ void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, if (qos == NULL) r_q->des_access = desired_access; - init_unistr2(&r_q->uni_server_name, server_name, strlen(server_name)+1); + init_unistr2(&r_q->uni_server_name, server_name, + strlen(server_name) + 1); + init_lsa_obj_attr(&r_q->attr, attributes, qos); } @@ -369,11 +356,9 @@ void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, Reads or writes an LSA_Q_OPEN_POL2 structure. ********************************************************************/ -BOOL lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, int depth) +BOOL lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, + int depth) { - if (r_q == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_q_open_pol2"); depth++; @@ -397,11 +382,9 @@ BOOL lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, int de Reads or writes an LSA_R_OPEN_POL2 structure. ********************************************************************/ -BOOL lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int depth) +BOOL lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, + int depth) { - if (r_p == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_r_open_pol2"); depth++; @@ -418,11 +401,9 @@ BOOL lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int de makes an LSA_Q_QUERY_SEC_OBJ structure. ********************************************************************/ -void init_q_query_sec_obj(LSA_Q_QUERY_SEC_OBJ *q_q, const POLICY_HND *hnd, uint32 sec_info) +void init_q_query_sec_obj(LSA_Q_QUERY_SEC_OBJ *q_q, const POLICY_HND *hnd, + uint32 sec_info) { - if (q_q == NULL || hnd == NULL) - return; - DEBUG(5, ("init_q_query_sec_obj\n")); q_q->pol = *hnd; @@ -435,11 +416,9 @@ void init_q_query_sec_obj(LSA_Q_QUERY_SEC_OBJ *q_q, const POLICY_HND *hnd, uint3 Reads or writes an LSA_Q_QUERY_SEC_OBJ structure. ********************************************************************/ -BOOL lsa_io_q_query_sec_obj(char *desc, LSA_Q_QUERY_SEC_OBJ *q_q, prs_struct *ps, int depth) +BOOL lsa_io_q_query_sec_obj(char *desc, LSA_Q_QUERY_SEC_OBJ *q_q, + prs_struct *ps, int depth) { - if (q_q == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_q_query_sec_obj"); depth++; @@ -449,18 +428,16 @@ BOOL lsa_io_q_query_sec_obj(char *desc, LSA_Q_QUERY_SEC_OBJ *q_q, prs_struct *ps if (!prs_uint32("sec_info", ps, depth, &q_q->sec_info)) return False; - return True; + return True; } /******************************************************************* Reads or writes a LSA_R_QUERY_SEC_OBJ structure. ********************************************************************/ -BOOL lsa_io_r_query_sec_obj(char *desc, LSA_R_QUERY_SEC_OBJ *r_u, prs_struct *ps, int depth) +BOOL lsa_io_r_query_sec_obj(char *desc, LSA_R_QUERY_SEC_OBJ *r_u, + prs_struct *ps, int depth) { - if (r_u == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_r_query_sec_obj"); depth++; @@ -473,11 +450,12 @@ BOOL lsa_io_r_query_sec_obj(char *desc, LSA_R_QUERY_SEC_OBJ *r_u, prs_struct *ps if (r_u->ptr != 0) { if (!sec_io_desc_buf("sec", &r_u->buf, ps, depth)) return False; - } + } + if (!prs_uint32("status", ps, depth, &r_u->status)) return False; - return True; + return True; } /******************************************************************* @@ -497,11 +475,9 @@ void init_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class) Reads or writes an LSA_Q_QUERY_INFO structure. ********************************************************************/ -BOOL lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int depth) +BOOL lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, + int depth) { - if (q_q == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_q_query"); depth++; @@ -514,19 +490,31 @@ BOOL lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int depth 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(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct *ps, int depth) +BOOL lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, + prs_struct *ps, int depth) { - if (q_e == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_q_enum_trust_dom"); depth++; - if(!smb_io_pol_hnd("", &q_e->pol, ps, depth)) return False; @@ -538,45 +526,13 @@ BOOL lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct * return True; } -/******************************************************************* - Inits an LSA_R_ENUM_TRUST_DOM structure. -********************************************************************/ - -void init_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, - uint32 enum_context, char *domain_name, DOM_SID *domain_sid, - uint32 status) -{ - DEBUG(5, ("init_r_enum_trust_dom\n")); - - r_e->enum_context = enum_context; - - if (status == 0) { - int len_domain_name = strlen(domain_name)+1; - - r_e->num_domains = 1; - r_e->ptr_enum_domains = 1; - r_e->num_domains2 = 1; - - init_uni_hdr2(&r_e->hdr_domain_name, len_domain_name); - init_unistr2 (&r_e->uni_domain_name, domain_name, len_domain_name); - init_dom_sid2(&r_e->other_domain_sid, domain_sid); - } else { - r_e->num_domains = 0; - r_e->ptr_enum_domains = 0; - } - - r_e->status = status; -} - /******************************************************************* Reads or writes an LSA_R_ENUM_TRUST_DOM structure. ********************************************************************/ -BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth) +BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, + prs_struct *ps, int depth) { - if (r_e == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_r_enum_trust_dom"); depth++; @@ -587,15 +543,41 @@ BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct if(!prs_uint32("ptr_enum_domains", ps, depth, &r_e->ptr_enum_domains)) return False; - if (r_e->ptr_enum_domains != 0) { + if (r_e->ptr_enum_domains) { + int i, num_domains; + if(!prs_uint32("num_domains2", ps, depth, &r_e->num_domains2)) return False; - if(!smb_io_unihdr2 ("", &r_e->hdr_domain_name, ps, depth)) + + num_domains = r_e->num_domains2; + + if (!(r_e->hdr_domain_name = (UNIHDR2 *) + malloc(sizeof(UNIHDR2) * num_domains))) return False; - if(!smb_io_unistr2 ("", &r_e->uni_domain_name, r_e->hdr_domain_name.buffer, ps, depth)) + + if (!(r_e->uni_domain_name = (UNISTR2 *) + malloc(sizeof(UNISTR2) * num_domains))) return False; - if(!smb_io_dom_sid2("", &r_e->other_domain_sid, ps, depth)) + + if (!(r_e->domain_sid = (DOM_SID *) + malloc(sizeof(DOM_SID) * num_domains))) return False; + + for (i = 0; i < num_domains; i++) { + if(!smb_io_unihdr2 ("", &r_e->hdr_domain_name[i], ps, + depth)) + return False; + } + + for (i = 0; i < num_domains; i++) { + if(!smb_io_unistr2 ("", &r_e->uni_domain_name[i], + r_e->hdr_domain_name[i].buffer, + ps, depth)) + return False; + if(!smb_io_dom_sid2("", &r_e->domain_sid[i], ps, + depth)) + return False; + } } if(!prs_uint32("status", ps, depth, &r_e->status)) @@ -604,15 +586,27 @@ BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct return True; } +void lsa_free_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM * r_e) +{ + safe_free(r_e->uni_domain_name); + safe_free(r_e->hdr_domain_name); + safe_free(r_e->domain_sid); + + r_e->uni_domain_name = NULL; + r_e->hdr_domain_name = NULL; + r_e->domain_sid = NULL; + + r_e->num_domains = 0; + r_e->ptr_enum_domains = 0; +} + /******************************************************************* Reads or writes an LSA_Q_QUERY_INFO structure. ********************************************************************/ -BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth) +BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, + int depth) { - if (r_q == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_r_query"); depth++; @@ -687,13 +681,11 @@ void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, Reads or writes a LSA_SID_ENUM structure. ********************************************************************/ -static BOOL lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, - prs_struct *ps, int depth) +static BOOL lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, + int depth) { int i; - if (sen == NULL) return False; - prs_debug(ps, depth, desc, "lsa_io_sid_enum"); depth++; @@ -768,11 +760,9 @@ void init_q_lookup_sids(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_SIDS *q_l, Reads or writes a LSA_Q_LOOKUP_SIDS structure. ********************************************************************/ -BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, int depth) +BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, + int depth) { - if (q_s == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids"); depth++; @@ -803,9 +793,6 @@ static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, { int i; - if (trn == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_trans_names"); depth++; @@ -862,11 +849,9 @@ static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, Reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, int depth) +BOOL lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, + prs_struct *ps, int depth) { - if (r_s == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_r_lookup_sids"); depth++; @@ -938,13 +923,11 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, reads or writes a structure. ********************************************************************/ -BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth) +BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, + prs_struct *ps, int depth) { int i; - if (q_r == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_q_lookup_names"); depth++; @@ -1004,13 +987,11 @@ BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth) +BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, + prs_struct *ps, int depth) { int i; - if (r_r == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_r_lookup_names"); depth++; @@ -1078,9 +1059,6 @@ void init_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd) BOOL lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth) { - if (q_c == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_q_close"); depth++; @@ -1096,9 +1074,6 @@ BOOL lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth) BOOL lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth) { - if (r_c == NULL) - return False; - prs_debug(ps, depth, desc, "lsa_io_r_close"); depth++; -- cgit From 6b4dcfff3a43e64f428770f0548598faebaaf0de Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 11 Jan 2001 22:55:13 +0000 Subject: General clean up. Merge of access_mask fixes for some unknown fields from tng. (This used to be commit c292f4aa31c2d3b4b5b274ef8aded569bdf06fdd) --- source3/rpc_parse/parse_samr.c | 51 ++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 27 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index aa08606a57..bb02ad9669 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -22,12 +22,10 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - #include "includes.h" extern int DEBUGLEVEL; - /******************************************************************* Inits a SAMR_Q_CLOSE_HND structure. ********************************************************************/ @@ -93,14 +91,14 @@ BOOL samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND *r_u, prs_struct *ps, int Reads or writes a structure. ********************************************************************/ -void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, - POLICY_HND *connect_pol, uint32 rid, - DOM_SID *sid) +void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, + POLICY_HND *connect_pol, + uint32 access_mask, DOM_SID *sid) { DEBUG(5,("samr_init_q_open_domain\n")); - memcpy(&q_u->connect_pol, connect_pol, sizeof(q_u->connect_pol)); - q_u->rid = rid; + q_u->pol = *connect_pol; + q_u->access_mask = access_mask; init_dom_sid2(&q_u->dom_sid, sid); } @@ -119,12 +117,12 @@ BOOL samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN *q_u, prs_struct *ps, if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("connect_pol", &q_u->connect_pol, ps, depth)) + if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("rid", ps, depth, &q_u->rid)) + if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask)) return False; if(!smb_io_dom_sid2("sid", &q_u->dom_sid, ps, depth)) @@ -2552,23 +2550,22 @@ BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, Inits a SAMR_Q_OPEN_USER struct. ********************************************************************/ -void init_samr_q_open_user(SAMR_Q_OPEN_USER *q_u, - POLICY_HND *pol, - uint32 unk_0, uint32 rid) +void init_samr_q_open_user(SAMR_Q_OPEN_USER *q_u, POLICY_HND *pol, + uint32 access_mask, uint32 rid) { - DEBUG(5,("samr_init_q_open_user\n")); + DEBUG(5,("init_samr_q_open_user\n")); - memcpy(&q_u->domain_pol, pol, sizeof(q_u->domain_pol)); - - q_u->unknown_0 = unk_0; - q_u->user_rid = rid; + 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(char *desc, SAMR_Q_OPEN_USER *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER *q_u, + prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -2584,7 +2581,7 @@ BOOL samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER *q_u, prs_struct *ps, int if(!prs_align(ps)) return False; - if(!prs_uint32("unknown_0", ps, depth, &q_u->unknown_0)) + 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; @@ -3233,7 +3230,8 @@ void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO *r_u, Reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, + prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -3366,19 +3364,18 @@ BOOL samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER *r_u, prs_struct *ps, Inits a SAMR_Q_CONNECT structure. ********************************************************************/ -void init_samr_q_connect(SAMR_Q_CONNECT *q_u, - char *srv_name, uint32 unknown_0) +void init_samr_q_connect(SAMR_Q_CONNECT *q_u, char *srv_name, + uint32 access_mask) { int len_srv_name = strlen(srv_name); DEBUG(5,("init_q_connect\n")); /* make PDC server name \\server */ - q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0; - init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name+1); + q_u->ptr_srv_name = len_srv_name > 0; + init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1); - /* example values: 0x0000 0002 */ - q_u->unknown_0 = unknown_0; + q_u->access_mask = access_mask; } /******************************************************************* @@ -3404,7 +3401,7 @@ BOOL samr_io_q_connect(char *desc, SAMR_Q_CONNECT *q_u, prs_struct *ps, int dep if(!prs_align(ps)) return False; - if(!prs_uint32("unknown_0 ", ps, depth, &q_u->unknown_0)) + if(!prs_uint32("access_mask ", ps, depth, &q_u->access_mask)) return False; return True; -- cgit From 13d99e3ea90cf15296630bea2b2bb38e9485fc4e Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 11 Jan 2001 23:49:51 +0000 Subject: RPC server fixes for RPC client changes merged from TNG. (This used to be commit 793153ebde08db217a18882c5eec945b7b14de69) --- source3/rpc_parse/parse_lsa.c | 44 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index d304c0231e..6cef8c9920 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -526,6 +526,46 @@ BOOL lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, return True; } +/******************************************************************* + Inits an LSA_R_ENUM_TRUST_DOM structure. +********************************************************************/ + +void init_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context, + char *domain_name, DOM_SID *domain_sid, + uint32 status) +{ + DEBUG(5, ("init_r_enum_trust_dom\n")); + + r_e->enum_context = enum_context; + + if (status == 0) { + int len_domain_name = strlen(domain_name) + 1; + + r_e->num_domains = 1; + r_e->ptr_enum_domains = 1; + r_e->num_domains2 = 1; + + if (!(r_e->hdr_domain_name = (UNIHDR2 *) + malloc(sizeof(UNIHDR2)))) return; + + if (!(r_e->uni_domain_name = (UNISTR2 *) + malloc(sizeof(UNISTR2)))) return; + + if (!(r_e->domain_sid = (DOM_SID2 *) + malloc(sizeof(DOM_SID2)))) return; + + init_uni_hdr2(&r_e->hdr_domain_name[0], len_domain_name); + init_unistr2 (&r_e->uni_domain_name[0], domain_name, + len_domain_name); + init_dom_sid2(&r_e->domain_sid[0], domain_sid); + } else { + r_e->num_domains = 0; + r_e->ptr_enum_domains = 0; + } + + r_e->status = status; +} + /******************************************************************* Reads or writes an LSA_R_ENUM_TRUST_DOM structure. ********************************************************************/ @@ -559,8 +599,8 @@ BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, malloc(sizeof(UNISTR2) * num_domains))) return False; - if (!(r_e->domain_sid = (DOM_SID *) - malloc(sizeof(DOM_SID) * num_domains))) + if (!(r_e->domain_sid = (DOM_SID2 *) + malloc(sizeof(DOM_SID2) * num_domains))) return False; for (i = 0; i < num_domains; i++) { -- cgit From ee49ddbd8ff7fd856ae9185a585dfc457c9e8cb5 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 12 Jan 2001 19:45:50 +0000 Subject: Printer name unistr is null terminated in make_spoolss_q_open_printer_ex() (This used to be commit a125eba0aac2bc6b37322a1e38e46eaac7e20d3a) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index e3d9f896f5..a6f46285eb 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -703,7 +703,7 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, { DEBUG(5,("make_spoolss_q_open_printer_ex\n")); q_u->printername_ptr = (printername!=NULL)?1:0; - init_unistr2(&q_u->printername, printername, strlen(printername)); + init_unistr2(&q_u->printername, printername, strlen(printername)+1); q_u->printer_default.datatype_ptr = 0; /* -- cgit From 27922c0430bf28dca910d2a2903cf410a4187643 Mon Sep 17 00:00:00 2001 From: David O'Neill Date: Mon, 15 Jan 2001 18:36:50 +0000 Subject: Changes from APPLIANCE_HEAD: source/rpc_parse/parse_lsa.c - off by one unistr length bug in init_lsa_trans_name() source/lib/util_sid.c - resolve more BUILTIN sid values to names. source/nsswitch/wb_client.c - fix typo in debug message - set errno on error so we don't get bogus value from last failure. source/rpc_server/srv_spoolss_nt.c - add debug to track number of open printer handles for ease of tracking handle leaks in the future. source/rpc_server/srv_lsa.c - fix off-by-one string bug. This was preventing NT from displaying names for well-know SIDs in printer permissions dialog. (This used to be commit 59229b9025cff54cbdd05e374616ffbf9c6fee33) --- source3/rpc_parse/parse_lsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 6cef8c9920..97aae2d65b 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -34,7 +34,7 @@ static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, uint16 sid_name_use, char *name, uint32 idx) { - int len_name = strlen(name)+1; + int len_name = strlen(name); if(len_name == 0) len_name = 1; -- cgit From 22363b9d7893998169ac7a777df466940fd0a000 Mon Sep 17 00:00:00 2001 From: David O'Neill Date: Wed, 17 Jan 2001 22:55:02 +0000 Subject: Changes from APPLIANCE_HEAD: source/include/proto.h source/include/rpc_spoolss.h source/rpc_parse/parse_spoolss.c source/rpc_server/srv_spoolss.c source/rpc_server/srv_spoolss_nt.c - speedups in printer queue enumeration - still room for improvement. The construct_dev_mode() still creates and destroys a printer info_2 structure every time it is called. - fixed job->devmode memory leak - converted printer job notification routines to use tallocated memory rather than a fixed 2K buffer. This reduces the memory requirements of a 4500 job queue enumeration from 90MB to about 16MB. (This used to be commit 7853b27bc1765d48d5f06837f8aca71a3a0d1e5d) --- source3/rpc_parse/parse_spoolss.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index a6f46285eb..868d90ae74 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -22,7 +22,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - #include "includes.h" extern int DEBUGLEVEL; @@ -384,9 +383,31 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, return False; if (MARSHALLING(ps)) { /* These are already in little endian format. Don't byte swap. */ - if(!prs_uint8s(True,"string",ps,depth,(uint8 *)data->notify_data.data.string,x*2)) - return False; + if (x == 1) { + + /* No memory allocated for this string + therefore following the data.string + pointer is a bad idea. Use a pointer to + the uint32 length union member to + provide a source for a unicode NULL */ + + if(!prs_uint8s(True,"string",ps,depth, (uint8 *)&data->notify_data.data.length,x*2)) + return False; + } else { + if(!prs_uint8s(True,"string",ps,depth,(uint8 *)data->notify_data.data.string,x*2)) + return False; + } } else { + + /* Tallocate memory for string */ + + DEBUG(0, ("** tallocating memory\n")); + + data->notify_data.data.string = (uint16 *) + talloc(ps->mem_ctx, x * 2); + if (!data->notify_data.data.string) + return False; + if(!prs_uint16s(True,"string",ps,depth,data->notify_data.data.string,x)) return False; } @@ -5753,10 +5774,7 @@ static JOB_INFO_2 *job2_dup(const JOB_INFO_2* from) void free_job_info_2(JOB_INFO_2 *job) { if (job!=NULL) - { free_devmode(job->devmode); - free(job); - } } void free_job2_array(uint32 num_entries, JOB_INFO_2 **entries) -- cgit From cf90dbd158de152221f294c478cd4f7ba44cdb5c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 25 Jan 2001 02:35:50 +0000 Subject: Fixed "object picker can't determine if object in domain" bug seen from W2K clients. Did this by importing Samba-TNG code that correctly handles LSA lookups. *MANY* thanks to Luke, Sander, Elrond and the rest of the TNG gang ! Jeremy (This used to be commit f76dc952f70862a6a390e9f35edd651867842a01) --- source3/rpc_parse/parse_lsa.c | 136 ++++++++++++++++++++++++++++++++++++++++- source3/rpc_parse/parse_misc.c | 60 ------------------ 2 files changed, 134 insertions(+), 62 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 97aae2d65b..00fda669a0 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -640,6 +640,124 @@ void lsa_free_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM * r_e) r_e->ptr_enum_domains = 0; } +/******************************************************************* +reads or writes a dom query structure. +********************************************************************/ + +static BOOL lsa_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth) +{ + if (d_q == NULL) + return False; + + prs_debug(ps, depth, desc, "lsa_io_dom_query"); + 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 structure. +********************************************************************/ + +static BOOL lsa_io_dom_query_2(char *desc, DOM_QUERY_2 *d_q, prs_struct *ps, int depth) +{ + uint32 ptr = 1; + + 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, &ptr)) + return False; + if (!prs_uint32("count1", ps, depth, &d_q->count1)) + return False; + if (!prs_uint32("count2", ps, depth, &d_q->count2)) + return False; + + if (UNMARSHALLING(ps)) { + d_q->auditsettings = (uint32)talloc(ps->mem_ctx, d_q->count2 * sizeof(uint32)); + } + + if (d_q->auditsettings == NULL) { + DEBUG(1, ("lsa_io_dom_query_2: NULL auditsettings!\n")); + return False; + } + + 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(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) +{ + return lsa_io_dom_query("", d_q, ps, depth); +} + +/******************************************************************* + Reads or writes a dom query structure. +********************************************************************/ + +BOOL lsa_io_dom_query_5(char *desc, DOM_QUERY_5 *d_q, prs_struct *ps, int depth) +{ + return lsa_io_dom_query("", d_q, ps, depth); +} + +/******************************************************************* + Reads or writes a dom query structure. +********************************************************************/ + +static BOOL lsa_io_dom_query_6(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 an LSA_Q_QUERY_INFO structure. ********************************************************************/ @@ -657,13 +775,24 @@ BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, if(!prs_uint16("info_class", ps, depth, &r_q->info_class)) return False; + if(!prs_align(ps)) + return False; + switch (r_q->info_class) { + case 2: + if(!lsa_io_dom_query_2("", &r_q->dom.id2, ps, depth)) + return False; + break; case 3: - if(!smb_io_dom_query_3("", &r_q->dom.id3, ps, depth)) + if(!lsa_io_dom_query_3("", &r_q->dom.id3, ps, depth)) return False; break; case 5: - if(!smb_io_dom_query_5("", &r_q->dom.id3, ps, depth)) + if(!lsa_io_dom_query_5("", &r_q->dom.id5, ps, depth)) + return False; + break; + case 6: + if(!lsa_io_dom_query_6("", &r_q->dom.id6, ps, depth)) return False; break; default: @@ -672,6 +801,9 @@ BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, } } + if(!prs_align(ps)) + return False; + if(!prs_uint32("status", ps, depth, &r_q->status)) return False; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 0a2f49d4dd..329683d23a 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1420,66 +1420,6 @@ BOOL smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth) return True; } -/******************************************************************* - Reads or writes a dom query structure. -********************************************************************/ - -static BOOL smb_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth) -{ - if (d_q == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_dom_query"); - 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. -********************************************************************/ - -BOOL smb_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) -{ - return smb_io_dom_query("", d_q, ps, depth); -} - -/******************************************************************* - Reads or writes a dom query structure. -********************************************************************/ - -BOOL smb_io_dom_query_5(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) -{ - return smb_io_dom_query("", d_q, ps, depth); -} - - /******************************************************************* Reads or writes a UNISTR3 structure. ********************************************************************/ -- cgit From 9ec19336e519ef3543eb9d3eafb24585657a2e8d Mon Sep 17 00:00:00 2001 From: David O'Neill Date: Mon, 29 Jan 2001 21:32:45 +0000 Subject: Changes from SAMBA_2_2: - fix typo in cast from talloc (This used to be commit f24aa0b51f06b8181b46bb1d2e73d91e5159fe1c) --- source3/rpc_parse/parse_lsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 00fda669a0..8654453bcf 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -708,7 +708,7 @@ static BOOL lsa_io_dom_query_2(char *desc, DOM_QUERY_2 *d_q, prs_struct *ps, int return False; if (UNMARSHALLING(ps)) { - d_q->auditsettings = (uint32)talloc(ps->mem_ctx, d_q->count2 * sizeof(uint32)); + d_q->auditsettings = (uint32 *)talloc(ps->mem_ctx, d_q->count2 * sizeof(uint32)); } if (d_q->auditsettings == NULL) { -- cgit From 92e347379a989f2700aed3fc1c4ce1a269dd020b Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 31 Jan 2001 17:16:09 +0000 Subject: Fixed duplicate free_sec_acl() call in free_sec_desc() function. From "Richard Bollinger" (This used to be commit 5b38513cef0cfeff09f54f855f9ace292050375c) --- source3/rpc_parse/parse_sec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index c2c8ad120c..1e83b175cc 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -595,7 +595,7 @@ void free_sec_desc(SEC_DESC **ppsd) psd = *ppsd; free_sec_acl(&psd->dacl); - free_sec_acl(&psd->dacl); + free_sec_acl(&psd->sacl); free(psd->owner_sid); free(psd->grp_sid); free(psd); -- cgit From 94fc44a93c46cece9b9fa947bff62087dbcd89fa Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 12 Feb 2001 16:18:02 +0000 Subject: Merge of JohnR's changes to appliance-head, JF's changes to 2.2, updated the POSIX_ACL code to be in sync. Jeremy. (This used to be commit c0517d6f4e3079feca1309fd1ea7b21e83f0de02) --- source3/rpc_parse/parse_spoolss.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 868d90ae74..0961cda195 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4361,17 +4361,20 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ if(!prs_uint32("version", ps, depth, &il->version)) return False; - if (il->version != 0) { - /* - * If version != 0 then there are an extra 4 bytes. - * JohnR and I have verified this at Roseville... JRA. - */ - if(!prs_uint32("dummy4", ps, depth, &il->dummy4)) - return False; - } if(!prs_uint32("name_ptr", ps, depth, &il->name_ptr)) - return False; + return False; + /* + * If name_ptr is NULL then the next 4 bytes are the name_ptr. A driver + * with a NULL name just isn't a driver For example: "HP LaserJet 4si" + * from W2K CDROM (which uses unidriver). JohnR 010205 + */ + if (!il->name_ptr) { + DEBUG(5,("spool_io_printer_driver_info_level_6: name_ptr is NULL! Get next value\n")); + if(!prs_uint32("name_ptr", ps, depth, &il->name_ptr)) + return False; + } + if(!prs_uint32("environment_ptr", ps, depth, &il->environment_ptr)) return False; if(!prs_uint32("driverpath_ptr", ps, depth, &il->driverpath_ptr)) -- cgit From 14ac22b4b6aba2f25df9a679f078dce5f319b054 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 13 Feb 2001 00:32:07 +0000 Subject: Fixup missing tests on code imported from tng. Jeremy. (This used to be commit 41d46a495b9e223d05bfc00e76612149531ec69a) --- source3/rpc_parse/parse_samr.c | 198 ++++++++++++++++++++++------------------- 1 file changed, 105 insertions(+), 93 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index bb02ad9669..462c9ed199 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3914,20 +3914,19 @@ makes a SAMR_R_LOOKUP_DOMAIN structure. BOOL init_samr_r_lookup_domain(SAMR_R_LOOKUP_DOMAIN * r_u, DOM_SID *dom_sid, uint32 status) { - if (r_u == NULL) - return False; + if (r_u == NULL) + return False; - DEBUG(5, ("make_samr_r_lookup_domain\n")); + DEBUG(5, ("make_samr_r_lookup_domain\n")); - r_u->status = status; - r_u->ptr_sid = 0; - if (status == 0x0) - { - r_u->ptr_sid = 1; + r_u->status = status; + r_u->ptr_sid = 0; + if (status == 0x0) { + r_u->ptr_sid = 1; init_dom_sid2(&r_u->dom_sid, dom_sid); } - return True; + return True; } /******************************************************************* @@ -3936,25 +3935,29 @@ reads or writes a structure. BOOL samr_io_r_lookup_domain(char *desc, SAMR_R_LOOKUP_DOMAIN * r_u, prs_struct *ps, int depth) { - if (r_u == NULL) - return False; + if (r_u == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_r_lookup_domain"); - depth++; + prs_debug(ps, depth, desc, "samr_io_r_lookup_domain"); + depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("ptr", ps, depth, &(r_u->ptr_sid)); + if(!prs_uint32("ptr", ps, depth, &r_u->ptr_sid)) + return False; - if (r_u->ptr_sid != 0) - { - smb_io_dom_sid2("sid", &(r_u->dom_sid), ps, depth); - prs_align(ps); - } + 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; + } - prs_uint32("status", ps, depth, &(r_u->status)); + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; - return True; + return True; } /******************************************************************* @@ -3963,22 +3966,27 @@ reads or writes a structure. BOOL samr_io_q_enum_domains(char *desc, SAMR_Q_ENUM_DOMAINS * q_e, prs_struct *ps, int depth) { - if (q_e == NULL) - return False; + if (q_e == NULL) + return False; - prs_debug(ps, depth, desc, "samr_io_q_enum_domains"); - depth++; + prs_debug(ps, depth, desc, "samr_io_q_enum_domains"); + depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_pol_hnd("pol", &(q_e->pol), ps, depth); + if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) + return False; - prs_uint32("start_idx", ps, depth, &(q_e->start_idx)); - prs_uint32("max_size ", ps, depth, &(q_e->max_size)); + 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; - prs_align(ps); + if(!prs_align(ps)) + return False; - return True; + return True; } /******************************************************************* @@ -4041,67 +4049,71 @@ reads or writes a structure. BOOL samr_io_r_enum_domains(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++; - - prs_align(ps); - - prs_uint32("next_idx ", ps, depth, &(r_u->next_idx)); - prs_uint32("ptr_entries1", ps, depth, &(r_u->ptr_entries1)); - - if (r_u->ptr_entries1 != 0) - { - prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2)); - prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2)); - prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3)); - - if (UNMARSHALLING(ps)) - { - r_u->sam = (SAM_ENTRY*) malloc(sizeof(SAM_ENTRY)* - r_u->num_entries2); - r_u->uni_dom_name = (UNISTR2*) malloc(sizeof(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, "domains[%d]", i); - sam_io_sam_entry(tmp, &(r_u->sam[i]), ps, depth); - } - - for (i = 0; i < r_u->num_entries2; i++) - { - fstring tmp; - slprintf(tmp, sizeof(tmp) - 1, "domains[%d]", i); - smb_io_unistr2(tmp, &(r_u->uni_dom_name[i]), - r_u->sam[i].hdr_name.buffer, ps, - depth); - prs_align(ps); - } - - prs_align(ps); - - } - - prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4)); - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; + 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->sam = (SAM_ENTRY*) malloc(sizeof(SAM_ENTRY)* r_u->num_entries2); + r_u->uni_dom_name = (UNISTR2*) malloc(sizeof(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, "domains[%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, "domains[%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_align(ps)) + return False; + + } + + if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4)) + return False; + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; } /******************************************************************* -- cgit From 3c270604c1627cd1f2d95f394f0006de49d4a05d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 21 Feb 2001 06:03:16 +0000 Subject: but it is needed for linking ... (This used to be commit e7108a18b2ba5754d402d72492cbcfded2713472) --- source3/rpc_parse/parse_samr_new.c | 1275 ++++++++++++++++++++++++++++++++++++ 1 file changed, 1275 insertions(+) create mode 100644 source3/rpc_parse/parse_samr_new.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr_new.c b/source3/rpc_parse/parse_samr_new.c new file mode 100644 index 0000000000..7a52551be8 --- /dev/null +++ b/source3/rpc_parse/parse_samr_new.c @@ -0,0 +1,1275 @@ +#define NEW_NTDOMAIN 1 +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * 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 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +/******************************************************************* +makes a SAMR_Q_CONNECT structure. +********************************************************************/ +BOOL init_samr_q_connect(SAMR_Q_CONNECT * q_u, char *srv_name, + uint32 access_mask) +{ + int len_srv_name = strlen(srv_name); + + DEBUG(5, ("init_samr_q_connect\n")); + + /* make PDC server name \\server */ + + q_u->ptr_srv_name = len_srv_name ? 1 : 0; + init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1); + + /* example values: 0x0000 0002 */ + + q_u->access_mask = access_mask; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_q_connect(char *desc, SAMR_Q_CONNECT * q_u, prs_struct *ps, + int depth) +{ + prs_debug(ps, depth, desc, "samr_io_q_connect"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name); + smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, + depth); + + prs_align(ps); + + prs_uint32("access_mask", ps, depth, &q_u->access_mask); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_r_connect(char *desc, SAMR_R_CONNECT * r_u, prs_struct *ps, + int depth) +{ + prs_debug(ps, depth, desc, "samr_io_r_connect"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth); + prs_uint32("status", ps, depth, &r_u->status); + + return True; +} + +/******************************************************************* +makes a SAMR_Q_CLOSE_HND structure. +********************************************************************/ +BOOL 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; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_q_close_hnd(char *desc, SAMR_Q_CLOSE_HND * q_u, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_q_close_hnd"); + depth++; + + prs_align(ps); + + return smb_io_pol_hnd("pol", &q_u->pol, ps, depth); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND * r_u, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_r_close_hnd"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &r_u->pol, ps, depth); + prs_uint32("status", ps, depth, &r_u->status); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN * q_u, + POLICY_HND *connect_pol, uint32 access_mask, + DOM_SID *sid) +{ + DEBUG(5, ("init_samr_q_open_domain\n")); + + q_u->connect_pol = *connect_pol; + q_u->access_mask = access_mask; + + init_dom_sid2(&q_u->dom_sid, sid); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN * q_u, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_q_open_domain"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("connect_pol", &q_u->connect_pol, ps, depth); + + prs_uint32("access_mask", ps, depth, &q_u->access_mask); + + smb_io_dom_sid2("sid", &q_u->dom_sid, ps, depth); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN * r_u, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_r_open_domain"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("domain_pol", &r_u->domain_pol, ps, depth); + + prs_uint32("status", ps, depth, &r_u->status); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL init_samr_q_open_user(SAMR_Q_OPEN_USER * q_u, POLICY_HND *pol, + uint32 access_mask, uint32 rid) +{ + DEBUG(5, ("init_samr_q_open_user\n")); + + q_u->domain_pol = *pol; + q_u->access_mask = access_mask; + q_u->user_rid = rid; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER * q_u, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_q_open_user"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth); + + prs_uint32("access_mask", ps, depth, &q_u->access_mask); + prs_uint32("user_rid ", ps, depth, &q_u->user_rid); + + prs_align(ps); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER * r_u, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_r_open_user"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth); + + prs_uint32("status", ps, depth, &r_u->status); + + return True; +} + +/******************************************************************* +makes a SAMR_Q_QUERY_USERINFO structure. +********************************************************************/ +BOOL init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO * q_u, + POLICY_HND *hnd, uint16 switch_value) +{ + DEBUG(5, ("init_samr_q_query_userinfo\n")); + + q_u->pol = *hnd; + q_u->switch_value = switch_value; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_q_query_userinfo(char *desc, SAMR_Q_QUERY_USERINFO * q_u, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_q_query_userinfo"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &q_u->pol, ps, depth); + + prs_uint16("switch_value", ps, depth, &q_u->switch_value); /* 0x0015 or 0x0011 */ + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO * r_u, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_r_query_userinfo"); + depth++; + + prs_align(ps); + + prs_uint32("ptr", ps, depth, &r_u->ptr); + + if (r_u->ptr != 0) { + samr_io_userinfo_ctr("ctr", r_u->ctr, ps, depth); + } + + prs_uint32("status", ps, depth, &r_u->status); + + if (!ps->io) { + /* writing */ + if (r_u->ctr != NULL) { + free_samr_userinfo_ctr(r_u->ctr); + } + } + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR * ctr, + prs_struct *ps, int depth) +{ + BOOL ret; + + prs_debug(ps, depth, desc, "samr_io_userinfo_ctr"); + depth++; + + /* lkclXXXX DO NOT ALIGN BEFORE READING SWITCH VALUE! */ + + prs_uint16("switch_value", ps, depth, &(ctr->switch_value)); + prs_align(ps); + + ret = False; + + switch (ctr->switch_value) + { + case 0x10: + { + if (UNMARSHALLING(ps)) + { + /* reading */ + ctr->info.id10 = (SAM_USER_INFO_10 *) + malloc(sizeof(SAM_USER_INFO_10)); + } + if (ctr->info.id10 == NULL) + { + DEBUG(2, + ("samr_io_userinfo_ctr: info pointer not initialised\n")); + return False; + } + ret = sam_io_user_info10("", ctr->info.id10, ps, + depth); + break; + } + case 0x11: + { + if (UNMARSHALLING(ps)) + { + /* reading */ + ctr->info.id11 = (SAM_USER_INFO_11 *) + malloc(sizeof(SAM_USER_INFO_11)); + } + if (ctr->info.id11 == NULL) + { + DEBUG(2, + ("samr_io_userinfo_ctr: info pointer not initialised\n")); + return False; + } + ret = sam_io_user_info11("", ctr->info.id11, ps, + depth); + break; + } + case 0x12: + { + if (UNMARSHALLING(ps)) + { + /* reading */ + ctr->info.id12 = (SAM_USER_INFO_12 *) + malloc(sizeof(SAM_USER_INFO_12)); + } + if (ctr->info.id12 == NULL) + { + DEBUG(2, + ("samr_io_userinfo_ctr: info pointer not initialised\n")); + return False; + } + ret = sam_io_user_info12("", ctr->info.id12, ps, + depth); + break; + } + case 21: + { +#if 0 + if (UNMARSHALLING(ps)) + { + /* reading */ + ctr->info.id21 = (SAM_USER_INFO_21 *) + malloc(sizeof(SAM_USER_INFO_21)); + } +#endif + 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)) + { + /* reading */ + ctr->info.id23 = (SAM_USER_INFO_23 *) + malloc(sizeof(SAM_USER_INFO_23)); + } + 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)) + { + /* reading */ + ctr->info.id24 = (SAM_USER_INFO_24 *) + malloc(sizeof(SAM_USER_INFO_24)); + } + 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; + } + default: + { + DEBUG(2, ("samr_io_userinfo_ctr: unknown switch " + "level 0x%x\n", ctr->switch_value)); + ret = False; + break; + } + + } + + prs_align(ps); + + return ret; +} + +/******************************************************************* +frees a structure. +********************************************************************/ +void free_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr) +{ + if (!ctr) return; + + safe_free(ctr->info.id); + ctr->info.id = NULL; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL sam_io_user_info10(char *desc, SAM_USER_INFO_10 * usr, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_r_user_info10"); + depth++; + + prs_align(ps); + + prs_uint32("acb_info", ps, depth, &(usr->acb_info)); + + return True; +} + +/******************************************************************* +makes a SAM_USER_INFO_11 structure. +********************************************************************/ +BOOL init_sam_user_info11(SAM_USER_INFO_11 * usr, + NTTIME * expiry, + char *mach_acct, + uint32 rid_user, uint32 rid_group, uint16 acct_ctrl) +{ + int len_mach_acct; + + DEBUG(5, ("init_sam_user_info11\n")); + + len_mach_acct = strlen(mach_acct); + + memcpy(&(usr->expiry), expiry, sizeof(usr->expiry)); /* expiry time or something? */ + ZERO_STRUCT(usr->padding_1); /* 0 - padding 24 bytes */ + + init_uni_hdr(&(usr->hdr_mach_acct), len_mach_acct); /* unicode header for machine account */ + 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, len_mach_acct); /* unicode string for machine account */ + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL sam_io_user_info11(char *desc, SAM_USER_INFO_11 * usr, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_r_unknown_11"); + depth++; + + prs_align(ps); + + prs_uint8s(False, "padding_0", ps, depth, usr->padding_0, + sizeof(usr->padding_0)); + + smb_io_time("time", &(usr->expiry), ps, depth); + + prs_uint8s(False, "padding_1", ps, depth, usr->padding_1, + sizeof(usr->padding_1)); + + smb_io_unihdr("unihdr", &(usr->hdr_mach_acct), ps, depth); + prs_uint32("padding_2", ps, depth, &(usr->padding_2)); + + prs_uint32("ptr_1 ", ps, depth, &(usr->ptr_1)); + prs_uint8s(False, "padding_3", ps, depth, usr->padding_3, + sizeof(usr->padding_3)); + prs_uint32("padding_4", ps, depth, &(usr->padding_4)); + + prs_uint32("ptr_2 ", ps, depth, &(usr->ptr_2)); + prs_uint32("padding_5", ps, depth, &(usr->padding_5)); + + prs_uint32("ptr_3 ", ps, depth, &(usr->ptr_3)); + prs_uint8s(False, "padding_6", ps, depth, usr->padding_6, + sizeof(usr->padding_6)); + + prs_uint32("rid_user ", ps, depth, &(usr->rid_user)); + prs_uint32("rid_group", ps, depth, &(usr->rid_group)); + prs_uint16("acct_ctrl", ps, depth, &(usr->acct_ctrl)); + prs_uint16("unknown_3", ps, depth, &(usr->unknown_3)); + prs_uint16("unknown_4", ps, depth, &(usr->unknown_4)); + prs_uint16("unknown_5", ps, depth, &(usr->unknown_5)); + + prs_uint8s(False, "padding_7", ps, depth, usr->padding_7, + sizeof(usr->padding_7)); + prs_uint32("padding_8", ps, depth, &(usr->padding_8)); + + smb_io_unistr2("unistr2", &(usr->uni_mach_acct), True, ps, depth); + prs_align(ps); + + prs_uint8s(False, "padding_9", ps, depth, usr->padding_9, + sizeof(usr->padding_9)); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL sam_io_user_info12(char *desc, SAM_USER_INFO_12 * u, + prs_struct *ps, int depth) +{ + DEBUG(0, ("possible security breach!\n")); + + prs_debug(ps, depth, desc, "samr_io_r_user_info12"); + depth++; + + prs_align(ps); + + prs_uint8s(False, "lm_pwd", ps, depth, u->lm_pwd, sizeof(u->lm_pwd)); + prs_uint8s(False, "nt_pwd", ps, depth, u->nt_pwd, sizeof(u->nt_pwd)); + + prs_uint8("lm_pwd_active", ps, depth, &u->lm_pwd_active); + prs_uint8("nt_pwd_active", ps, depth, &u->nt_pwd_active); + prs_align(ps); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 * usr, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "sam_io_user_info21"); + depth++; + + prs_align(ps); + + smb_io_time("logon_time ", &(usr->logon_time), ps, depth); + smb_io_time("logoff_time ", &(usr->logoff_time), ps, depth); + smb_io_time("pass_last_set_time ", &(usr->pass_last_set_time), ps, + depth); + smb_io_time("kickoff_time ", &(usr->kickoff_time), ps, depth); + smb_io_time("pass_can_change_time ", &(usr->pass_can_change_time), ps, + depth); + smb_io_time("pass_must_change_time", &(usr->pass_must_change_time), + ps, depth); + + smb_io_unihdr("hdr_user_name ", &(usr->hdr_user_name), ps, depth); /* username unicode string header */ + smb_io_unihdr("hdr_full_name ", &(usr->hdr_full_name), ps, depth); /* user's full name unicode string header */ + smb_io_unihdr("hdr_home_dir ", &(usr->hdr_home_dir), ps, depth); /* home directory unicode string header */ + smb_io_unihdr("hdr_dir_drive ", &(usr->hdr_dir_drive), ps, depth); /* home directory drive */ + smb_io_unihdr("hdr_logon_script", &(usr->hdr_logon_script), ps, depth); /* logon script unicode string header */ + smb_io_unihdr("hdr_profile_path", &(usr->hdr_profile_path), ps, depth); /* profile path unicode string header */ + smb_io_unihdr("hdr_acct_desc ", &(usr->hdr_acct_desc), ps, depth); /* account desc */ + smb_io_unihdr("hdr_workstations", &(usr->hdr_workstations), ps, depth); /* wkstas user can log on from */ + smb_io_unihdr("hdr_unknown_str ", &(usr->hdr_unknown_str), ps, depth); /* unknown string */ + smb_io_unihdr("hdr_munged_dial ", &(usr->hdr_munged_dial), ps, depth); /* wkstas user can log on from */ + + prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, + sizeof(usr->lm_pwd)); + prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, + sizeof(usr->nt_pwd)); + + prs_uint32("user_rid ", ps, depth, &(usr->user_rid)); /* User ID */ + prs_uint32("group_rid ", ps, depth, &(usr->group_rid)); /* Group ID */ + prs_uint32("acb_info ", ps, depth, &(usr->acb_info)); + + prs_uint32("unknown_3 ", ps, depth, &(usr->unknown_3)); + prs_uint16("logon_divs ", ps, depth, &(usr->logon_divs)); /* logon divisions per week */ + prs_align(ps); + prs_uint32("ptr_logon_hrs ", ps, depth, &(usr->ptr_logon_hrs)); + prs_uint32("unknown_5 ", ps, depth, &(usr->unknown_5)); + + prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, + sizeof(usr->padding1)); + + /* here begins pointed-to data */ + + smb_io_unistr2("uni_user_name ", &(usr->uni_user_name), + usr->hdr_user_name.buffer, ps, depth); /* username unicode string */ + prs_align(ps); + smb_io_unistr2("uni_full_name ", &(usr->uni_full_name), + usr->hdr_full_name.buffer, ps, depth); /* user's full name unicode string */ + prs_align(ps); + smb_io_unistr2("uni_home_dir ", &(usr->uni_home_dir), + usr->hdr_home_dir.buffer, ps, depth); /* home directory unicode string */ + prs_align(ps); + smb_io_unistr2("uni_dir_drive ", &(usr->uni_dir_drive), + usr->hdr_dir_drive.buffer, ps, depth); /* home directory drive unicode string */ + prs_align(ps); + smb_io_unistr2("uni_logon_script", &(usr->uni_logon_script), + usr->hdr_logon_script.buffer, ps, depth); /* logon script unicode string */ + prs_align(ps); + smb_io_unistr2("uni_profile_path", &(usr->uni_profile_path), + usr->hdr_profile_path.buffer, ps, depth); /* profile path unicode string */ + prs_align(ps); + smb_io_unistr2("uni_acct_desc ", &(usr->uni_acct_desc), + usr->hdr_acct_desc.buffer, ps, depth); /* user desc unicode string */ + prs_align(ps); + smb_io_unistr2("uni_workstations", &(usr->uni_workstations), + usr->hdr_workstations.buffer, ps, depth); /* worksations user can log on from */ + prs_align(ps); + smb_io_unistr2("uni_unknown_str ", &(usr->uni_unknown_str), + usr->hdr_unknown_str.buffer, ps, depth); /* unknown string */ + prs_align(ps); + smb_io_unistr2("uni_munged_dial ", &(usr->uni_munged_dial), + usr->hdr_munged_dial.buffer, ps, depth); /* worksations user can log on from */ + prs_align(ps); + + /* ok, this is only guess-work (as usual) */ + if (usr->unknown_3 != 0x0) + { + prs_uint32("unknown_6 ", ps, depth, &(usr->unknown_6)); + prs_uint32("padding4 ", ps, depth, &(usr->padding4)); + } + else if (UNMARSHALLING(ps)) + { + usr->unknown_6 = 0; + usr->padding4 = 0; + } + + if (usr->ptr_logon_hrs) + { + sam_io_logon_hrs("logon_hrs", &(usr->logon_hrs), ps, depth); + prs_align(ps); + } + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 * usr, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "sam_io_user_info23"); + depth++; + + prs_align(ps); + + smb_io_time("logon_time ", &(usr->logon_time), ps, depth); + smb_io_time("logoff_time ", &(usr->logoff_time), ps, depth); + smb_io_time("kickoff_time ", &(usr->kickoff_time), ps, depth); + smb_io_time("pass_last_set_time ", &(usr->pass_last_set_time), ps, + depth); + smb_io_time("pass_can_change_time ", &(usr->pass_can_change_time), ps, + depth); + smb_io_time("pass_must_change_time", &(usr->pass_must_change_time), + ps, depth); + + smb_io_unihdr("hdr_user_name ", &(usr->hdr_user_name), ps, depth); /* username unicode string header */ + smb_io_unihdr("hdr_full_name ", &(usr->hdr_full_name), ps, depth); /* user's full name unicode string header */ + smb_io_unihdr("hdr_home_dir ", &(usr->hdr_home_dir), ps, depth); /* home directory unicode string header */ + smb_io_unihdr("hdr_dir_drive ", &(usr->hdr_dir_drive), ps, depth); /* home directory drive */ + smb_io_unihdr("hdr_logon_script", &(usr->hdr_logon_script), ps, depth); /* logon script unicode string header */ + smb_io_unihdr("hdr_profile_path", &(usr->hdr_profile_path), ps, depth); /* profile path unicode string header */ + smb_io_unihdr("hdr_acct_desc ", &(usr->hdr_acct_desc), ps, depth); /* account desc */ + smb_io_unihdr("hdr_workstations", &(usr->hdr_workstations), ps, depth); /* wkstas user can log on from */ + smb_io_unihdr("hdr_unknown_str ", &(usr->hdr_unknown_str), ps, depth); /* unknown string */ + smb_io_unihdr("hdr_munged_dial ", &(usr->hdr_munged_dial), ps, depth); /* wkstas user can log on from */ + + prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, + sizeof(usr->lm_pwd)); + prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, + sizeof(usr->nt_pwd)); + + prs_uint32("user_rid ", ps, depth, &(usr->user_rid)); /* User ID */ + prs_uint32("group_rid ", ps, depth, &(usr->group_rid)); /* Group ID */ + prs_uint32("acb_info ", ps, depth, &(usr->acb_info)); + + prs_uint32("unknown_3 ", ps, depth, &(usr->unknown_3)); + prs_uint16("logon_divs ", ps, depth, &(usr->logon_divs)); /* logon divisions per week */ + prs_align(ps); + prs_uint32("ptr_logon_hrs ", ps, depth, &(usr->ptr_logon_hrs)); + prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, + sizeof(usr->padding1)); + prs_uint32("unknown_5 ", ps, depth, &(usr->unknown_5)); + + prs_uint8s(False, "password ", ps, depth, usr->pass, + sizeof(usr->pass)); + + /* here begins pointed-to data */ + + smb_io_unistr2("uni_user_name ", &(usr->uni_user_name), + usr->hdr_user_name.buffer, ps, depth); /* username unicode string */ + prs_align(ps); + smb_io_unistr2("uni_full_name ", &(usr->uni_full_name), + usr->hdr_full_name.buffer, ps, depth); /* user's full name unicode string */ + prs_align(ps); + smb_io_unistr2("uni_home_dir ", &(usr->uni_home_dir), + usr->hdr_home_dir.buffer, ps, depth); /* home directory unicode string */ + prs_align(ps); + smb_io_unistr2("uni_dir_drive ", &(usr->uni_dir_drive), + usr->hdr_dir_drive.buffer, ps, depth); /* home directory drive unicode string */ + prs_align(ps); + smb_io_unistr2("uni_logon_script", &(usr->uni_logon_script), + usr->hdr_logon_script.buffer, ps, depth); /* logon script unicode string */ + prs_align(ps); + smb_io_unistr2("uni_profile_path", &(usr->uni_profile_path), + usr->hdr_profile_path.buffer, ps, depth); /* profile path unicode string */ + prs_align(ps); + smb_io_unistr2("uni_acct_desc ", &(usr->uni_acct_desc), + usr->hdr_acct_desc.buffer, ps, depth); /* user desc unicode string */ + prs_align(ps); + smb_io_unistr2("uni_workstations", &(usr->uni_workstations), + usr->hdr_workstations.buffer, ps, depth); /* worksations user can log on from */ + prs_align(ps); + smb_io_unistr2("uni_unknown_str ", &(usr->uni_unknown_str), + usr->hdr_unknown_str.buffer, ps, depth); /* unknown string */ + prs_align(ps); + smb_io_unistr2("uni_munged_dial ", &(usr->uni_munged_dial), + usr->hdr_munged_dial.buffer, ps, depth); /* worksations user can log on from */ + prs_align(ps); + + /* ok, this is only guess-work (as usual) */ + if (usr->unknown_3 != 0x0) + { + prs_uint32("unknown_6 ", ps, depth, &(usr->unknown_6)); + prs_uint32("padding4 ", ps, depth, &(usr->padding4)); + } + else if (UNMARSHALLING(ps)) + { + usr->unknown_6 = 0; + usr->padding4 = 0; + } + + if (usr->ptr_logon_hrs) + { + sam_io_logon_hrs("logon_hrs", &(usr->logon_hrs), ps, depth); + prs_align(ps); + } + + return True; +} + +/************************************************************************* + make_sam_user_infoa + + unknown_3 = 0x09f8 27fa + unknown_5 = 0x0001 0000 + unknown_6 = 0x0000 04ec + + *************************************************************************/ +BOOL init_sam_user_info24(SAM_USER_INFO_24 * usr, + const char newpass[516], uint16 passlen) +{ + DEBUG(10, ("init_sam_user_info24: passlen: %d\n", passlen)); + memcpy(usr->pass, newpass, sizeof(usr->pass)); + usr->unk_0 = passlen; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL sam_io_user_info24(char *desc, SAM_USER_INFO_24 * usr, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "sam_io_user_info24"); + depth++; + + prs_align(ps); + + prs_uint8s(False, "password", ps, depth, usr->pass, + sizeof(usr->pass)); + prs_uint16("unk_0", ps, depth, &(usr->unk_0)); /* unknown */ + prs_align(ps); + + return True; +} + +/******************************************************************* +reads or writes a LOGON_HRS structure. +********************************************************************/ +BOOL sam_io_logon_hrs(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++; + + prs_align(ps); + + prs_uint32("len ", ps, depth, &hrs->len); + + if (hrs->len > sizeof(hrs->hours)) + { + DEBUG(3, ("sam_io_logon_hrs: truncating length from %d\n", + hrs->len)); + hrs->len = sizeof(hrs->hours); + } + + prs_uint8s(False, "hours", ps, depth, hrs->hours, hrs->len); + + return True; +} + +/******************************************************************* +makes a SAMR_Q_QUERY_GROUPINFO structure. +********************************************************************/ +BOOL 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; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_q_query_groupinfo(char *desc, SAMR_Q_QUERY_GROUPINFO * q_e, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_q_query_groupinfo"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &q_e->pol, ps, depth); + prs_uint16("switch_level", ps, depth, &q_e->switch_level); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_r_query_groupinfo(char *desc, SAMR_R_QUERY_GROUPINFO * r_u, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_r_query_groupinfo"); + depth++; + + prs_align(ps); + + prs_uint32("ptr", ps, depth, &r_u->ptr); + + if (r_u->ptr != 0) { + samr_group_info_ctr("ctr", r_u->ctr, ps, depth); + } + + prs_uint32("status", ps, depth, &r_u->status); + + return True; +} + +/******************************************************************* +makes a SAMR_Q_QUERY_USERGROUPS structure. +********************************************************************/ +BOOL 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; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS * q_u, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_q_query_usergroups"); + depth++; + + prs_align(ps); + + return smb_io_pol_hnd("pol", &q_u->pol, ps, depth); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS * r_u, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_r_query_usergroups"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0); + + if (r_u->ptr_0 != 0) { + prs_uint32("num_entries ", ps, depth, &r_u->num_entries); + prs_uint32("ptr_1 ", ps, depth, &r_u->ptr_1); + + if (r_u->num_entries != 0 && r_u->ptr_1 != 0) + { + samr_io_gids("gids", &r_u->num_entries2, &r_u->gid, + ps, depth); + } + } + prs_uint32("status", ps, depth, &r_u->status); + + return True; +} + +/******************************************************************* +makes a SAMR_Q_QUERY_GROUPMEM structure. +********************************************************************/ +BOOL 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; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_q_query_groupmem(char *desc, SAMR_Q_QUERY_GROUPMEM * q_u, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_q_query_groupmem"); + depth++; + + prs_align(ps); + + return smb_io_pol_hnd("group_pol", &q_u->group_pol, ps, depth); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM * r_u, + prs_struct *ps, int depth) +{ + uint32 i; + + if (UNMARSHALLING(ps)) { + ZERO_STRUCTP(r_u); + } + + prs_debug(ps, depth, desc, "samr_io_r_query_groupmem"); + depth++; + + prs_align(ps); + + prs_uint32("ptr", ps, depth, &r_u->ptr); + prs_uint32("num_entries ", ps, depth, &r_u->num_entries); + + if (r_u->ptr != 0) + { + prs_uint32("ptr_rids ", ps, depth, &r_u->ptr_rids); + prs_uint32("ptr_attrs", ps, depth, &r_u->ptr_attrs); + + if (r_u->ptr_rids != 0) { + prs_uint32("num_rids", ps, depth, &r_u->num_rids); + if (r_u->num_rids != 0) { + + r_u->rid = (uint32 *) + talloc(ps->mem_ctx, + sizeof(r_u->rid [0]) * + r_u->num_rids); + } + + for (i = 0; i < r_u->num_rids; i++) { + prs_uint32("", ps, depth, &r_u->rid[i]); + } + } + + if (r_u->ptr_attrs != 0) { + prs_uint32("num_attrs", ps, depth, &r_u->num_attrs); + + if (r_u->num_attrs != 0) { + r_u->attr = (uint32 *) + talloc(ps->mem_ctx, + sizeof(r_u->attr[0]) * + r_u->num_attrs); + } + + for (i = 0; i < r_u->num_attrs; i++) { + prs_uint32("", ps, depth, &r_u->attr[i]); + } + } + } + + prs_uint32("status", ps, depth, &(r_u->status)); + + if (!ps->io) { + /* storing. memory no longer needed */ + samr_free_r_query_groupmem(r_u); + } + + return True; +} + +/******************************************************************* +frees a structure. +********************************************************************/ +void samr_free_r_query_groupmem(SAMR_R_QUERY_GROUPMEM * r_u) +{ + safe_free(r_u->rid); + r_u->rid = NULL; + + safe_free(r_u->attr); + r_u->attr = NULL; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_group_info_ctr(char *desc, GROUP_INFO_CTR * ctr, prs_struct *ps, + int depth) +{ + prs_debug(ps, depth, desc, "samr_group_info_ctr"); + depth++; + + prs_uint16("switch_value1", ps, depth, &(ctr->switch_value1)); + prs_uint16("switch_value2", ps, depth, &(ctr->switch_value2)); + + switch (ctr->switch_value1) + { + case 1: + { + samr_io_group_info1("group_info1", + &(ctr->group.info1), ps, depth); + break; + } + case 4: + { + samr_io_group_info4("group_info4", + &(ctr->group.info4), ps, depth); + break; + } + default: + { + DEBUG(4, + ("samr_group_info_ctr: unsupported switch level\n")); + break; + } + } + + prs_align(ps); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_gids(char *desc, uint32 *num_gids, DOM_GID ** gid, + prs_struct *ps, int depth) +{ + uint32 i; + + prs_debug(ps, depth, desc, "samr_io_gids"); + depth++; + + prs_align(ps); + + prs_uint32("num_gids", ps, depth, num_gids); + + if ((*num_gids) != 0) + { + if (UNMARSHALLING(ps)) + { + (*gid) = (DOM_GID *) + talloc(ps->mem_ctx, sizeof(DOM_GID) * + (*num_gids)); + } + + if ((*gid) == NULL) + { + return False; + } + + for (i = 0; i < (*num_gids); i++) + { + smb_io_gid("gids", &(*gid)[i], ps, depth); + } + } + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_group_info1(char *desc, GROUP_INFO1 * gr1, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_group_info1"); + depth++; + + prs_align(ps); + + smb_io_unihdr("hdr_acct_name", &(gr1->hdr_acct_name), ps, depth); + + prs_uint32("unknown_1", ps, depth, &(gr1->unknown_1)); + prs_uint32("num_members", ps, depth, &(gr1->num_members)); + + smb_io_unihdr("hdr_acct_desc", &(gr1->hdr_acct_desc), ps, depth); + + smb_io_unistr2("uni_acct_name", &(gr1->uni_acct_name), + gr1->hdr_acct_name.buffer, ps, depth); + prs_align(ps); + + smb_io_unistr2("uni_acct_desc", &(gr1->uni_acct_desc), + gr1->hdr_acct_desc.buffer, ps, depth); + prs_align(ps); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_group_info4(char *desc, GROUP_INFO4 * gr4, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_group_info4"); + depth++; + + prs_align(ps); + + smb_io_unihdr("hdr_acct_desc", &(gr4->hdr_acct_desc), ps, depth); + smb_io_unistr2("uni_acct_desc", &(gr4->uni_acct_desc), + gr4->hdr_acct_desc.buffer, ps, depth); + prs_align(ps); + + return True; +} + +/******************************************************************* +makes a SAMR_Q_QUERY_USERGROUPS structure. +********************************************************************/ +BOOL 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; + + return True; +} + +/******************************************************************* +makes a SAMR_Q_OPEN_GROUP structure. +********************************************************************/ +BOOL 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; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_q_open_group(char *desc, SAMR_Q_OPEN_GROUP * q_u, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_q_open_group"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth); + + prs_uint32("access_mask", ps, depth, &(q_u->access_mask)); + prs_uint32("rid_group", ps, depth, &(q_u->rid_group)); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP * r_u, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "samr_io_r_open_group"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("pol", &r_u->group_pol, ps, depth); + + prs_uint32("status", ps, depth, &(r_u->status)); + + return True; +} + +#undef NEW_NTDOMAIN -- cgit From 3699948e97bc2a8d108bb4343d382b4c9ead5533 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 24 Feb 2001 00:42:41 +0000 Subject: This patch (donated by Marc Jacobsen of HP) should make Sun and HP very happy :-). Probably Veritas too... :-). It allows Samba as a domain member to authenticate against an AS/U server such as the older HP PDC product or PD Netlink. It does this by trying a netlogon with info level 3 and then falling back to info level 2 if the PDC returns invalid info level. Jeremy. (This used to be commit bda1d6d4a4b3d2cfc260549280a2ce3e57fd0f86) --- source3/rpc_parse/parse_net.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 1080995aa4..bde8c01240 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1130,10 +1130,14 @@ void free_user_info3(NET_USER_INFO_3 *usr) } /******************************************************************* - Reads or writes a structure. + 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. ********************************************************************/ -static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth) +static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth, uint16 validation_level) { int i; @@ -1143,6 +1147,9 @@ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, prs_debug(ps, depth, desc, "lsa_io_lsa_user_info"); depth++; + if (UNMARSHALLING(ps)) + ZERO_STRUCTP(usr); + if(!prs_align(ps)) return False; @@ -1207,10 +1214,17 @@ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, if(!prs_uint8s (False, "padding ", ps, depth, usr->padding, 40)) /* unused padding bytes? */ return False; - 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; + 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; + } + } if(!smb_io_unistr2("unistr2", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */ return False; @@ -1260,7 +1274,7 @@ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, if(!prs_uint32("num_other_groups", ps, depth, &usr->num_other_groups)) return False; - if (UNMARSHALLING(ps)) { + if (UNMARSHALLING(ps) && usr->num_other_groups > 0) { usr->other_gids = (DOM_GID *)prs_alloc_mem(ps, sizeof(DOM_GID)*usr->num_other_groups); if (usr->other_gids == NULL) return False; @@ -1326,7 +1340,7 @@ BOOL net_io_r_sam_logon(char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, int de return False; if (r_l->switch_value != 0) { - if(!net_io_user_info3("", r_l->user, ps, depth)) + if(!net_io_user_info3("", r_l->user, ps, depth, r_l->switch_value)) return False; } -- cgit From 683ccef0bdfc6a1460087cc3eed2b7ac643d0227 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 26 Feb 2001 08:10:51 +0000 Subject: Started conversion of lsa server code to canonical format (as srv_reg and srv_samr have been). Jeremy. (This used to be commit f434cda9774b4864321b37b0f8f42e6e8dee8d5b) --- source3/rpc_parse/parse_lsa.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 8654453bcf..a33c759473 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1257,3 +1257,42 @@ BOOL lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth) return True; } + +/******************************************************************* + Reads or writes an LSA_Q_OPEN_SECRET structure. +********************************************************************/ + +BOOL lsa_io_q_open_secret(char *desc, LSA_Q_OPEN_SECRET *q_c, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_q_open_secret"); + depth++; + + /* Don't bother to read or write at present... */ + return True; +} + +/******************************************************************* + Reads or writes an LSA_R_OPEN_SECRET structure. +********************************************************************/ + +BOOL lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_c, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_r_open_secret"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("dummy1", ps, depth, &r_c->dummy1)) + return False; + if(!prs_uint32("dummy2", ps, depth, &r_c->dummy2)) + return False; + if(!prs_uint32("dummy3", ps, depth, &r_c->dummy3)) + return False; + if(!prs_uint32("dummy4", ps, depth, &r_c->dummy4)) + return False; + if(!prs_uint32("status", ps, depth, &r_c->status)) + return False; + + return True; +} -- cgit From de187df10c3d34ef87b3618fc8fc0e14b466b2f8 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 26 Feb 2001 22:05:41 +0000 Subject: Split srvsvc pipe into interface and implementation modules. Jeremy. (This used to be commit e14c88ddf466f17a710724fb4fc273d37a244d77) --- source3/rpc_parse/parse_srv.c | 53 ++++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 13 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index c572d881d6..1721b6f187 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -796,14 +796,23 @@ static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth) { - if (ctr == NULL) - return False; + SRV_SESS_INFO_CTR *ctr = *pp_ctr; prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr"); depth++; + if(UNMARSHALLING(ps)) { + ctr = *pp_ctr = (SRV_SESS_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_SESS_INFO_CTR)); + if (ctr == NULL) + return False; + ZERO_STRUCTP(ctr); + } + + if (ctr == NULL) + return False; + if(!prs_align(ps)) return False; @@ -890,7 +899,7 @@ BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps return False; if (q_n->sess_level != -1) { - if(!srv_io_srv_sess_ctr("sess_ctr", q_n->ctr, ps, depth)) + if(!srv_io_srv_sess_ctr("sess_ctr", &q_n->ctr, ps, depth)) return False; } @@ -922,7 +931,7 @@ BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps return False; if (r_n->sess_level != -1) { - if(!srv_io_srv_sess_ctr("sess_ctr", r_n->ctr, ps, depth)) + if(!srv_io_srv_sess_ctr("sess_ctr", &r_n->ctr, ps, depth)) return False; } @@ -1153,14 +1162,23 @@ static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth) { - if (ctr == NULL) - return False; + SRV_CONN_INFO_CTR *ctr = *pp_ctr; prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr"); depth++; + if (UNMARSHALLING(ps)) { + ctr = *pp_ctr = (SRV_CONN_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_CONN_INFO_CTR)); + if (ctr == NULL) + return False; + ZERO_STRUCTP(ctr); + } + + if (ctr == NULL) + return False; + if(!prs_align(ps)) return False; @@ -1247,7 +1265,7 @@ BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps return False; if (q_n->conn_level != -1) { - if(!srv_io_srv_conn_ctr("conn_ctr", q_n->ctr, ps, depth)) + if(!srv_io_srv_conn_ctr("conn_ctr", &q_n->ctr, ps, depth)) return False; } @@ -1279,7 +1297,7 @@ BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *p return False; if (r_n->conn_level != -1) { - if(!srv_io_srv_conn_ctr("conn_ctr", r_n->ctr, ps, depth)) + if(!srv_io_srv_conn_ctr("conn_ctr", &r_n->ctr, ps, depth)) return False; } @@ -1427,8 +1445,17 @@ static BOOL srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR **pp_ctr, prs_struct *ps, int depth) { + SRV_FILE_INFO_CTR *ctr = *pp_ctr; + + if (UNMARSHALLING(ps)) { + ctr = *pp_ctr = (SRV_FILE_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_FILE_INFO_CTR)); + if (ctr == NULL) + return False; + ZERO_STRUCTP(ctr); + } + if (ctr == NULL) return False; @@ -1517,7 +1544,7 @@ BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps return False; if (q_n->file_level != -1) { - if(!srv_io_srv_file_ctr("file_ctr", q_n->ctr, ps, depth)) + if(!srv_io_srv_file_ctr("file_ctr", &q_n->ctr, ps, depth)) return False; } @@ -1549,7 +1576,7 @@ BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps return False; if (r_n->file_level != 0) { - if(!srv_io_srv_file_ctr("file_ctr", r_n->ctr, ps, depth)) + if(!srv_io_srv_file_ctr("file_ctr", &r_n->ctr, ps, depth)) return False; } -- cgit From ef2de912f2c0b095ea19986b3dce6b1b8a0ea8b5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 27 Feb 2001 02:09:50 +0000 Subject: Separated dfs pipe into implementation and interface modules. rpc_parse/parse_dfs.c: Had to add buffer overrun checking ! HOW DID THIS GET IN HERE ! rpc_parse/parse_prs.c: Ensure prs_alloc_mem does a memset of zero before returning. Jeremy. (This used to be commit c9a6a17025f4a6850cd2b9a9ddb48bdeec8b3ffe) --- source3/rpc_parse/parse_dfs.c | 668 ++++++++++++++++++++++++------------------ source3/rpc_parse/parse_prs.c | 9 +- 2 files changed, 388 insertions(+), 289 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index 31ca53a850..e1d88ab509 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -5,6 +5,7 @@ * Copyright (C) Andrew Tridgell 1992-2000, * Copyright (C) Luke Kenneth Casson Leighton 1996-2000, * Copyright (C) Shirish Kalele 2000. + * Copyright (C) Jeremy Allison 2001. * * 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 @@ -27,198 +28,259 @@ extern int DEBUGLEVEL; +/************************************************************* + Read/write a DFS_Q_DFS_EXIST structure - dummy... + ************************************************************/ + +BOOL dfs_io_q_dfs_exist(char *desc, DFS_Q_DFS_EXIST *q_d, prs_struct *ps, int depth) +{ + if(q_d == NULL) + return False; + + prs_debug(ps, depth, desc, "dfs_io_q_dfs_exist"); + + return True; +} + /************************************************************* Read/write a DFS_R_DFS_EXIST structure ************************************************************/ -BOOL dfs_io_r_dfs_exist(char *desc, DFS_R_DFS_EXIST *q_d, prs_struct *ps, - int depth) + +BOOL dfs_io_r_dfs_exist(char *desc, DFS_R_DFS_EXIST *q_d, prs_struct *ps, int depth) { - if(q_d == NULL) return False; + if(q_d == NULL) + return False; - prs_debug(ps, depth, desc, "dfs_io_r_dfs_exist"); - depth++; + prs_debug(ps, depth, desc, "dfs_io_r_dfs_exist"); + depth++; + + if(!prs_align(ps)) + return False; - prs_align(ps); + if(!prs_uint32("exist flag", ps, 0, &q_d->status)) + return False; - prs_uint32("exist flag", ps, 0, &(q_d->dfs_exist_flag)); - return True; + return True; } /******************************************************************* Make a DFS_Q_DFS_REMOVE structure *******************************************************************/ + BOOL make_dfs_q_dfs_remove(DFS_Q_DFS_REMOVE *q_d, char *entrypath, char *servername, char *sharename) { - DEBUG(5,("make_dfs_q_dfs_remove\n")); - init_unistr2(&(q_d->DfsEntryPath), entrypath, strlen(entrypath)+1); - init_unistr2(&(q_d->ServerName), servername, strlen(servername)+1); - init_unistr2(&(q_d->ShareName), sharename, strlen(sharename)+1); - q_d->ptr_ServerName = q_d->ptr_ShareName = 1; - return True; + DEBUG(5,("make_dfs_q_dfs_remove\n")); + init_unistr2(&q_d->DfsEntryPath, entrypath, strlen(entrypath)+1); + init_unistr2(&q_d->ServerName, servername, strlen(servername)+1); + init_unistr2(&q_d->ShareName, sharename, strlen(sharename)+1); + q_d->ptr_ServerName = q_d->ptr_ShareName = 1; + return True; } /******************************************************************* Read/write a DFS_Q_DFS_REMOVE structure *******************************************************************/ -BOOL dfs_io_q_dfs_remove(char *desc, DFS_Q_DFS_REMOVE *q_d, prs_struct *ps, - int depth) + +BOOL dfs_io_q_dfs_remove(char *desc, DFS_Q_DFS_REMOVE *q_d, prs_struct *ps, int depth) { - if(q_d == NULL) return False; + if(q_d == NULL) + return False; - prs_debug(ps, depth, desc, "dfs_io_q_dfs_remove"); - depth++; + prs_debug(ps, depth, desc, "dfs_io_q_dfs_remove"); + depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_unistr2("DfsEntryPath",&(q_d->DfsEntryPath), 1, ps, depth); - prs_align(ps); - - prs_uint32("ptr_ServerName", ps, depth, &(q_d->ptr_ServerName)); - if(q_d->ptr_ServerName) - smb_io_unistr2("ServerName",&(q_d->ServerName), q_d->ptr_ServerName, - ps, depth); - prs_align(ps); - - prs_uint32("ptr_ShareName", ps, depth, &(q_d->ptr_ShareName)); - if(q_d->ptr_ShareName) - smb_io_unistr2("ShareName",&(q_d->ShareName), q_d->ptr_ShareName, - ps, depth); - prs_align(ps); - - return True; + if(!smb_io_unistr2("DfsEntryPath",&q_d->DfsEntryPath, 1, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_ServerName", ps, depth, &q_d->ptr_ServerName)) + return False; + if(q_d->ptr_ServerName) + if (!smb_io_unistr2("ServerName",&q_d->ServerName, q_d->ptr_ServerName, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_ShareName", ps, depth, &q_d->ptr_ShareName)) + return False; + if(q_d->ptr_ShareName) + if (!smb_io_unistr2("ShareName",&q_d->ShareName, q_d->ptr_ShareName, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + return True; } /******************************************************************* Read/write a DFS_R_DFS_REMOVE structure *******************************************************************/ -BOOL dfs_io_r_dfs_remove(char *desc, DFS_R_DFS_REMOVE *r_d, prs_struct *ps, - int depth) + +BOOL dfs_io_r_dfs_remove(char *desc, DFS_R_DFS_REMOVE *r_d, prs_struct *ps, int depth) { - if(r_d == NULL) return False; + if(r_d == NULL) + return False; - prs_debug(ps, depth, desc, "dfs_io_r_dfs_remove"); - depth++; + prs_debug(ps, depth, desc, "dfs_io_r_dfs_remove"); + depth++; - prs_uint32("status", ps, depth, &(r_d->status)); + if(!prs_uint32("status", ps, depth, &r_d->status)) + return False; - return True; + return True; } /******************************************************************* Make a DFS_Q_DFS_ADD structure *******************************************************************/ + BOOL make_dfs_q_dfs_add(DFS_Q_DFS_ADD *q_d, char *entrypath, char *servername, char *sharename, char *comment, uint32 flags) { - DEBUG(5,("make_dfs_q_dfs_add\n")); - q_d->ptr_DfsEntryPath = q_d->ptr_ServerName = q_d->ptr_ShareName = 1; - init_unistr2(&(q_d->DfsEntryPath), entrypath, strlen(entrypath)+1); - init_unistr2(&(q_d->ServerName), servername, strlen(servername)+1); - init_unistr2(&(q_d->ShareName), sharename, strlen(sharename)+1); - if(comment != NULL) - { - init_unistr2(&(q_d->Comment), comment, strlen(comment)+1); - q_d->ptr_Comment = 1; - } - else - { - q_d->ptr_Comment = 0; - } - - q_d->Flags = flags; - return True; + DEBUG(5,("make_dfs_q_dfs_add\n")); + q_d->ptr_DfsEntryPath = q_d->ptr_ServerName = q_d->ptr_ShareName = 1; + init_unistr2(&q_d->DfsEntryPath, entrypath, strlen(entrypath)+1); + init_unistr2(&q_d->ServerName, servername, strlen(servername)+1); + init_unistr2(&q_d->ShareName, sharename, strlen(sharename)+1); + if(comment != NULL) { + init_unistr2(&q_d->Comment, comment, strlen(comment)+1); + q_d->ptr_Comment = 1; + } else { + q_d->ptr_Comment = 0; + } + + q_d->Flags = flags; + return True; } /************************************************************ Read/write a DFS_Q_DFS_ADD structure ************************************************************/ -BOOL dfs_io_q_dfs_add(char *desc, DFS_Q_DFS_ADD *q_d, prs_struct *ps, - int depth) + +BOOL dfs_io_q_dfs_add(char *desc, DFS_Q_DFS_ADD *q_d, prs_struct *ps, int depth) { - if(q_d == NULL) return False; + if(q_d == NULL) + return False; - prs_debug(ps, depth, desc, "dfs_io_q_dfs_add"); - depth++; + prs_debug(ps, depth, desc, "dfs_io_q_dfs_add"); + depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - smb_io_unistr2("DfsEntryPath",&(q_d->DfsEntryPath), 1, ps, depth); - prs_align(ps); - - smb_io_unistr2("ServerName",&(q_d->ServerName), 1, ps, depth); - prs_align(ps); - - prs_uint32("ptr_ShareName", ps, depth, &(q_d->ptr_ShareName)); - smb_io_unistr2("ShareName",&(q_d->ShareName), 1, ps, depth); - prs_align(ps); - - prs_uint32("ptr_Comment", ps, depth, &(q_d->ptr_Comment)); - smb_io_unistr2("",&(q_d->Comment), q_d->ptr_Comment , ps, depth); - prs_align(ps); - - prs_uint32("Flags", ps, depth, &(q_d->Flags)); - return True; + if(!smb_io_unistr2("DfsEntryPath",&q_d->DfsEntryPath, 1, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + if(!smb_io_unistr2("ServerName",&q_d->ServerName, 1, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_ShareName", ps, depth, &q_d->ptr_ShareName)) + return False; + if(!smb_io_unistr2("ShareName",&q_d->ShareName, 1, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_Comment", ps, depth, &q_d->ptr_Comment)) + return False; + if(!smb_io_unistr2("",&q_d->Comment, q_d->ptr_Comment , ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + if(!prs_uint32("Flags", ps, depth, &q_d->Flags)) + return True; + + return True; } /************************************************************ Read/write a DFS_R_DFS_ADD structure ************************************************************/ -BOOL dfs_io_r_dfs_add(char *desc, DFS_R_DFS_ADD *r_d, prs_struct *ps, - int depth) + +BOOL dfs_io_r_dfs_add(char *desc, DFS_R_DFS_ADD *r_d, prs_struct *ps, int depth) { - if(r_d == NULL) return False; + if(r_d == NULL) + return False; - prs_debug(ps, depth, desc, "dfs_io_r_dfs_add"); - depth++; + prs_debug(ps, depth, desc, "dfs_io_r_dfs_add"); + depth++; - prs_uint32("status", ps, depth, &(r_d->status)); + if(!prs_uint32("status", ps, depth, &r_d->status)) + return False; - return True; + return True; } /************************************************************ Read/write a DFS_Q_GET_INFO structure ************************************************************/ -BOOL dfs_io_q_dfs_get_info(char* desc, DFS_Q_DFS_GET_INFO* q_i, - prs_struct* ps, int depth) + +BOOL dfs_io_q_dfs_get_info(char* desc, DFS_Q_DFS_GET_INFO* q_i, prs_struct* ps, int depth) { - if(q_i == NULL) return False; + if(q_i == NULL) + return False; + + prs_debug(ps, depth, desc, "dfs_io_q_dfs_get_info"); + depth++; + + if(!smb_io_unistr2("",&q_i->uni_path, 1, ps, depth)) + return False; - prs_debug(ps, depth, desc, "dfs_io_q_dfs_get_info"); - depth++; + if(!prs_align(ps)) + return False; - smb_io_unistr2("",&(q_i->uni_path), 1, ps, depth); - prs_align(ps); + if(!prs_uint32("ptr_server", ps, depth, &q_i->ptr_server)) + return False; - prs_uint32("ptr_server", ps, depth, &(q_i->ptr_server)); - if(q_i->ptr_server) - smb_io_unistr2("",&(q_i->uni_server), q_i->ptr_server, ps, depth); - prs_align(ps); + if(q_i->ptr_server) + if (!smb_io_unistr2("",&q_i->uni_server, q_i->ptr_server, ps, depth)) + return False; + if(!prs_align(ps)) + return False; - prs_uint32("ptr_share", ps, depth, &(q_i->ptr_share)); - if(q_i->ptr_share) - smb_io_unistr2("", &(q_i->uni_share), q_i->ptr_share, ps, depth); - prs_align(ps); + if(!prs_uint32("ptr_share", ps, depth, &q_i->ptr_share)) + return False; + if(q_i->ptr_share) + if(!smb_io_unistr2("", &q_i->uni_share, q_i->ptr_share, ps, depth)) + return False; + if(!prs_align(ps)) + return False; - prs_uint32("level", ps, depth, &(q_i->level)); - return True; + if(!prs_uint32("level", ps, depth, &q_i->level)) + return False; + return True; } /************************************************************ Read/write a DFS_R_GET_INFO structure ************************************************************/ -BOOL dfs_io_r_dfs_get_info(char* desc, DFS_R_DFS_GET_INFO* r_i, - prs_struct* ps, int depth) + +BOOL dfs_io_r_dfs_get_info(char* desc, DFS_R_DFS_GET_INFO* r_i, prs_struct* ps, int depth) { - if(r_i == NULL) return False; + if(r_i == NULL) + return False; - prs_uint32("level", ps, depth, &(r_i->level)); - prs_uint32("ptr_ctr", ps, depth, &(r_i->ptr_ctr)); - - dfs_io_dfs_info_ctr("", &(r_i->ctr), 1, r_i->level, ps, depth); - prs_uint32("status", ps, depth, &(r_i->status)); - return True; + if(!prs_uint32("level", ps, depth, &r_i->level)) + return False; + if(!prs_uint32("ptr_ctr", ps, depth, &r_i->ptr_ctr)) + return False; + + if(!dfs_io_dfs_info_ctr("", &r_i->ctr, 1, r_i->level, ps, depth)) + return False; + if(!prs_uint32("status", ps, depth, &r_i->status)) + return False; + return True; } /************************************************************ @@ -226,204 +288,236 @@ BOOL dfs_io_r_dfs_get_info(char* desc, DFS_R_DFS_GET_INFO* r_i, ************************************************************/ BOOL make_dfs_q_dfs_enum(DFS_Q_DFS_ENUM *q_d, uint32 level, DFS_INFO_CTR *ctr) { - q_d->level = level; - q_d->maxpreflen = -1; - q_d->ptr_buffer = 1; - q_d->level2 = level; + q_d->level = level; + q_d->maxpreflen = -1; + q_d->ptr_buffer = 1; + q_d->level2 = level; - q_d->ptr_num_entries = 1; - q_d->num_entries = 0; - q_d->num_entries2 = 0; - q_d->reshnd.ptr_hnd = 1; - q_d->reshnd.handle = 0; - return True; + q_d->ptr_num_entries = 1; + q_d->num_entries = 0; + q_d->num_entries2 = 0; + q_d->reshnd.ptr_hnd = 1; + q_d->reshnd.handle = 0; + return True; } /************************************************************ Read or write the DFS_Q_DFS_ENUM structure ************************************************************/ -BOOL dfs_io_q_dfs_enum(char *desc, DFS_Q_DFS_ENUM *q_d, prs_struct *ps, - int depth) + +BOOL dfs_io_q_dfs_enum(char *desc, DFS_Q_DFS_ENUM *q_d, prs_struct *ps, int depth) { - if(q_d == NULL) return False; + if(q_d == NULL) + return False; - prs_debug(ps, depth, desc, "dfs_io_q_dfs_enum"); - depth++; + prs_debug(ps, depth, desc, "dfs_io_q_dfs_enum"); + depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint32("level", ps, depth, &(q_d->level)); - prs_uint32("maxpreflen", ps, depth, &(q_d->maxpreflen)); - prs_uint32("ptr_buffer", ps, depth, &(q_d->ptr_buffer)); - prs_uint32("level2", ps, depth, &(q_d->level2)); - prs_uint32("level3", ps, depth, &(q_d->level2)); + if(!prs_uint32("level", ps, depth, &q_d->level)) + return False; + if(!prs_uint32("maxpreflen", ps, depth, &q_d->maxpreflen)) + return False; + if(!prs_uint32("ptr_buffer", ps, depth, &q_d->ptr_buffer)) + return False; + if(!prs_uint32("level2", ps, depth, &q_d->level2)) + return False; + if(!prs_uint32("level3", ps, depth, &q_d->level2)) + return False; - prs_uint32("ptr_num_entries", ps, depth, &(q_d->ptr_num_entries)); - prs_uint32("num_entries", ps, depth, &(q_d->num_entries)); - prs_uint32("num_entries2", ps, depth, &(q_d->num_entries2)); - smb_io_enum_hnd("resume_hnd",&(q_d->reshnd), ps, depth); - return True; + if(!prs_uint32("ptr_num_entries", ps, depth, &q_d->ptr_num_entries)) + return False; + if(!prs_uint32("num_entries", ps, depth, &q_d->num_entries)) + return False; + if(!prs_uint32("num_entries2", ps, depth, &q_d->num_entries2)) + return False; + if(!smb_io_enum_hnd("resume_hnd",&q_d->reshnd, ps, depth)) + return False; + return True; } /************************************************************ Read/write a DFS_INFO_CTR structure ************************************************************/ -BOOL dfs_io_dfs_info_ctr(char* desc, DFS_INFO_CTR* ctr, uint32 num_entries, - uint32 level, - prs_struct* ps, int depth) + +BOOL dfs_io_dfs_info_ctr(char* desc, DFS_INFO_CTR* ctr, uint32 num_entries, uint32 level, prs_struct* ps, int depth) { - switch(level) - { - case 1: - { - int i=0; - - depth++; - /* should depend on whether marshalling or unmarshalling! */ - if(UNMARSHALLING(ps)) - ctr->dfs.info1 = (DFS_INFO_1 *)malloc(sizeof(DFS_INFO_1)*num_entries); - - for(i=0;idfs.info1[i].ptr_entrypath)); - } - for(i=0;idfs.info1[i].entrypath), - ctr->dfs.info1[i].ptr_entrypath, - ps, depth); - prs_align(ps); - } - depth--; - break; - } - case 2: - { int i=0; - depth++; - if(UNMARSHALLING(ps)) - ctr->dfs.info2 = (DFS_INFO_2 *)calloc(num_entries, sizeof(DFS_INFO_2)); - - for(i=0;idfs.info2[i].ptr_entrypath)); - prs_uint32("ptr_comment", ps, depth, - &(ctr->dfs.info2[i].ptr_comment)); - prs_uint32("state", ps, depth, &(ctr->dfs.info2[i].state)); - prs_uint32("num_storages", ps, depth, - &(ctr->dfs.info2[i].num_storages)); - } - for(i=0;idfs.info2[i].entrypath), - ctr->dfs.info2[i].ptr_entrypath, ps, depth); - prs_align(ps); - smb_io_unistr2("",&(ctr->dfs.info2[i].comment), - ctr->dfs.info2[i].ptr_comment, ps, depth); - prs_align(ps); - } - depth--; - break; - } - case 3: - { - int i=0; - depth++; - if(UNMARSHALLING(ps)) - ctr->dfs.info3 = (DFS_INFO_3 *)calloc(num_entries, sizeof(DFS_INFO_3)); - - for(i=0;idfs.info3[i].ptr_entrypath)); - prs_uint32("ptr_comment", ps, depth, - &(ctr->dfs.info3[i].ptr_comment)); - prs_uint32("state", ps, depth, &(ctr->dfs.info3[i].state)); - prs_uint32("num_storages", ps, depth, - &(ctr->dfs.info3[i].num_storages)); - prs_uint32("ptr_storages", ps, depth, - &(ctr->dfs.info3[i].ptr_storages)); - } - for(i=0;idfs.info3[i].entrypath), - ctr->dfs.info3[i].ptr_entrypath, ps, depth); - prs_align(ps); - smb_io_unistr2("", &(ctr->dfs.info3[i].comment), - ctr->dfs.info3[i].ptr_comment, ps, depth); - prs_align(ps); - prs_uint32("num_storage_infos", ps, depth, - &(ctr->dfs.info3[i].num_storage_infos)); - if(!dfs_io_dfs_storage_info("storage_info", - &(ctr->dfs.info3[i]), - ps, depth)) - return False; - } - } - } - return True; + + switch(level) { + case 1: + depth++; + /* should depend on whether marshalling or unmarshalling! */ + if(UNMARSHALLING(ps)) { + ctr->dfs.info1 = (DFS_INFO_1 *)prs_alloc_mem(ps, sizeof(DFS_INFO_1)*num_entries); + if (!ctr->dfs.info1) + return False; + } + + for(i=0;idfs.info1[i].ptr_entrypath)) + return False; + } + for(i=0;idfs.info1[i].entrypath, ctr->dfs.info1[i].ptr_entrypath, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + } + depth--; + break; + case 2: + depth++; + if(UNMARSHALLING(ps)) { + ctr->dfs.info2 = (DFS_INFO_2 *)prs_alloc_mem(ps, num_entries*sizeof(DFS_INFO_2)); + if (!ctr->dfs.info2) + return False; + } + + for(i=0;idfs.info2[i].ptr_entrypath)) + return False; + if(!prs_uint32("ptr_comment", ps, depth, &ctr->dfs.info2[i].ptr_comment)) + return False; + if(!prs_uint32("state", ps, depth, &ctr->dfs.info2[i].state)) + return False; + if(!prs_uint32("num_storages", ps, depth, &ctr->dfs.info2[i].num_storages)) + return False; + } + for(i=0;idfs.info2[i].entrypath, ctr->dfs.info2[i].ptr_entrypath, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("",&ctr->dfs.info2[i].comment, ctr->dfs.info2[i].ptr_comment, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + } + depth--; + break; + case 3: + depth++; + if(UNMARSHALLING(ps)) { + ctr->dfs.info3 = (DFS_INFO_3 *)prs_alloc_mem(ps, num_entries*sizeof(DFS_INFO_3)); + if (!ctr->dfs.info3) + return False; + } + + for(i=0;idfs.info3[i].ptr_entrypath)) + return False; + if(!prs_uint32("ptr_comment", ps, depth, &ctr->dfs.info3[i].ptr_comment)) + return False; + if(!prs_uint32("state", ps, depth, &ctr->dfs.info3[i].state)); + return False; + if(!prs_uint32("num_storages", ps, depth, &ctr->dfs.info3[i].num_storages)) + return False; + if(!prs_uint32("ptr_storages", ps, depth, &ctr->dfs.info3[i].ptr_storages)) + return False; + } + for(i=0;idfs.info3[i].entrypath, ctr->dfs.info3[i].ptr_entrypath, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("", &ctr->dfs.info3[i].comment, ctr->dfs.info3[i].ptr_comment, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!prs_uint32("num_storage_infos", ps, depth, &ctr->dfs.info3[i].num_storage_infos)) + return False; + + if(!dfs_io_dfs_storage_info("storage_info", &ctr->dfs.info3[i], ps, depth)) + return False; + } + } + + return True; } + /************************************************************ Read/write a DFS_R_DFS_ENUM structure ************************************************************/ + BOOL dfs_io_r_dfs_enum(char *desc, DFS_R_DFS_ENUM *q_d, prs_struct *ps, int depth) { - DFS_INFO_CTR *ctr; - if(q_d == NULL) return False; - ctr = q_d->ctr; - if(ctr == NULL) return False; - - prs_debug(ps, depth, desc, "dfs_io_r_dfs_enum"); - depth++; - - prs_align(ps); - - prs_uint32("ptr_buffer", ps, depth, &(q_d->ptr_buffer)); - prs_uint32("level", ps, depth, &(q_d->level)); - prs_uint32("level2", ps, depth, &(ctr->switch_value)); - prs_uint32("ptr_num_entries", ps, depth, &(q_d->ptr_num_entries)); - if(q_d->ptr_num_entries) - prs_uint32("num_entries", ps, depth, &(q_d->num_entries)); - prs_uint32("ptr_num_entries2", ps, depth, &(q_d->ptr_num_entries2)); - if(q_d->ptr_num_entries2) - prs_uint32("num_entries2", ps, depth, &(ctr->num_entries)); - - dfs_io_dfs_info_ctr("", ctr, q_d->num_entries, q_d->level, ps, depth); - - smb_io_enum_hnd("resume_hnd", &(q_d->reshnd), ps, depth); - prs_uint32("status", ps, depth, &(q_d->status)); - return True; + DFS_INFO_CTR *ctr; + if(q_d == NULL) + return False; + ctr = q_d->ctr; + if(ctr == NULL) + return False; + + prs_debug(ps, depth, desc, "dfs_io_r_dfs_enum"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_buffer", ps, depth, &q_d->ptr_buffer)) + return False; + if(!prs_uint32("level", ps, depth, &q_d->level)) + return False; + if(!prs_uint32("level2", ps, depth, &ctr->switch_value)) + return False; + if(!prs_uint32("ptr_num_entries", ps, depth, &q_d->ptr_num_entries)) + return False; + if(q_d->ptr_num_entries) + if(!prs_uint32("num_entries", ps, depth, &q_d->num_entries)) + return False; + if(!prs_uint32("ptr_num_entries2", ps, depth, &q_d->ptr_num_entries2)) + return False; + if(q_d->ptr_num_entries2) + if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries)) + return False; + + if(!dfs_io_dfs_info_ctr("", ctr, q_d->num_entries, q_d->level, ps, depth)) + return False; + + if(!smb_io_enum_hnd("resume_hnd", &q_d->reshnd, ps, depth)) + return False; + if(!prs_uint32("status", ps, depth, &q_d->status)) + return False; + return True; } -BOOL dfs_io_dfs_storage_info(char *desc, DFS_INFO_3* info3, - prs_struct *ps, int depth) +BOOL dfs_io_dfs_storage_info(char *desc, DFS_INFO_3* info3, prs_struct *ps, int depth) { - int i=0; - if(info3 == NULL) return False; + int i=0; + if(info3 == NULL) + return False; - prs_debug(ps, depth, desc, "smb_io_dfs_storage_info"); - depth++; - - if(UNMARSHALLING(ps)) - info3->storages = (DFS_STORAGE_INFO *)calloc(info3->num_storage_infos, sizeof(DFS_STORAGE_INFO)); - - for(i=0;inum_storage_infos;i++) - { - prs_uint32("storage_state", ps, depth, &(info3->storages[i].state)); - prs_uint32("ptr_servername", ps, depth, - &(info3->storages[i].ptr_servername)); - prs_uint32("ptr_sharename", ps, depth, - &(info3->storages[i].ptr_sharename)); - } - for(i=0;inum_storage_infos;i++) - { - smb_io_unistr2("servername", &(info3->storages[i].servername), - info3->storages[i].ptr_servername, ps, depth); - prs_align(ps); - smb_io_unistr2("sharename", &(info3->storages[i].sharename), - info3->storages[i].ptr_sharename, ps, depth); - prs_align(ps); - } - return True; + prs_debug(ps, depth, desc, "smb_io_dfs_storage_info"); + depth++; + + if(UNMARSHALLING(ps)) { + info3->storages = (DFS_STORAGE_INFO *)prs_alloc_mem(ps, info3->num_storage_infos*sizeof(DFS_STORAGE_INFO)); + if (!info3->storages) + return False; + } + + for(i=0;inum_storage_infos;i++) { + if(!prs_uint32("storage_state", ps, depth, &info3->storages[i].state)) + return False; + if(!prs_uint32("ptr_servername", ps, depth, &info3->storages[i].ptr_servername)) + return False; + if(!prs_uint32("ptr_sharename", ps, depth, &info3->storages[i].ptr_sharename)) + return False; + } + + for(i=0;inum_storage_infos;i++) { + if(!smb_io_unistr2("servername", &info3->storages[i].servername, info3->storages[i].ptr_servername, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("sharename", &info3->storages[i].sharename, info3->storages[i].ptr_sharename, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + } + + return True; } diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 5621a2c210..6f23058c1d 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -125,12 +125,17 @@ void prs_mem_free(prs_struct *ps) } /******************************************************************* - Allocate memory when unmarshalling... + Allocate memory when unmarshalling... Always zero clears. ********************************************************************/ char *prs_alloc_mem(prs_struct *ps, size_t size) { - return talloc(ps->mem_ctx, size); + char *ret = talloc(ps->mem_ctx, size); + + if (ret) + memset(ret, '\0', size); + + return ret; } /******************************************************************* -- cgit From 538fbb7ad0fab7c36259038ab4a7e937b4d85c36 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 27 Feb 2001 02:18:37 +0000 Subject: As prs_alloc_mem now zeros memory, remove superfluous memsets after it. Jeremy. (This used to be commit 94fdffb3557fa68d634d6c402751f5bcb1f6a656) --- source3/rpc_parse/parse_prs.c | 2 -- source3/rpc_parse/parse_sec.c | 6 ------ source3/rpc_parse/parse_srv.c | 5 ----- 3 files changed, 13 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 6f23058c1d..56d03daf18 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -584,7 +584,6 @@ BOOL prs_buffer5(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER5 * str->buffer = (uint16 *)prs_alloc_mem(ps,str->buf_len * sizeof(uint16)); if (str->buffer == NULL) return False; - memset(str->buffer, '\0', str->buf_len * sizeof(uint16)); } /* If the string is empty, we don't have anything to stream */ @@ -678,7 +677,6 @@ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 * str->buffer = (uint16 *)prs_alloc_mem(ps,str->uni_max_len * sizeof(uint16)); if (str->buffer == NULL) return False; - memset(str->buffer, '\0', str->uni_max_len * sizeof(uint16)); } /* If the string is empty, we don't have anything to stream */ diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 1e83b175cc..fa0be04cba 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -206,7 +206,6 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) */ if((psa = (SEC_ACL *)malloc(sizeof(SEC_ACL))) == NULL) return False; - ZERO_STRUCTP(psa); *ppsa = psa; } @@ -231,7 +230,6 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) /* reading */ if((psa->ace = malloc(sizeof(psa->ace[0]) * psa->num_aces)) == NULL) return False; - ZERO_STRUCTP(psa->ace); } for (i = 0; i < psa->num_aces; i++) { @@ -633,7 +631,6 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if(UNMARSHALLING(ps)) { if((psd = (SEC_DESC *)malloc(sizeof(SEC_DESC))) == NULL) return False; - ZERO_STRUCTP(psd); *ppsd = psd; } else { /* Marshalling - just ignore. */ @@ -678,7 +675,6 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) /* reading */ if((psd->owner_sid = malloc(sizeof(*psd->owner_sid))) == NULL) return False; - ZERO_STRUCTP(psd->owner_sid); } if(!smb_io_dom_sid("owner_sid ", psd->owner_sid , ps, depth)) @@ -697,7 +693,6 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) return False; if((psd->grp_sid = malloc(sizeof(*psd->grp_sid))) == NULL) return False; - ZERO_STRUCTP(psd->grp_sid); } if(!smb_io_dom_sid("grp_sid", psd->grp_sid, ps, depth)) @@ -810,7 +805,6 @@ BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth if (UNMARSHALLING(ps) && psdb == NULL) { if((psdb = (SEC_DESC_BUF *)malloc(sizeof(SEC_DESC_BUF))) == NULL) return False; - ZERO_STRUCTP(psdb); *ppsdb = psdb; } diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 1721b6f187..3db3161ed5 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -293,7 +293,6 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct if (UNMARSHALLING(ps)) { if (!(info1 = (SRV_SHARE_INFO_1 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_1)))) return False; - memset(info1, '\0', num_entries * sizeof(SRV_SHARE_INFO_1)); ctr->share.info1 = info1; } @@ -319,7 +318,6 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct if (UNMARSHALLING(ps)) { if (!(info2 = (SRV_SHARE_INFO_2 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_2)))) return False; - memset(info2, '\0', num_entries * sizeof(SRV_SHARE_INFO_2)); ctr->share.info2 = info2; } @@ -807,7 +805,6 @@ static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_stru ctr = *pp_ctr = (SRV_SESS_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_SESS_INFO_CTR)); if (ctr == NULL) return False; - ZERO_STRUCTP(ctr); } if (ctr == NULL) @@ -1173,7 +1170,6 @@ static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_stru ctr = *pp_ctr = (SRV_CONN_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_CONN_INFO_CTR)); if (ctr == NULL) return False; - ZERO_STRUCTP(ctr); } if (ctr == NULL) @@ -1453,7 +1449,6 @@ static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR **pp_ctr, prs_stru ctr = *pp_ctr = (SRV_FILE_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_FILE_INFO_CTR)); if (ctr == NULL) return False; - ZERO_STRUCTP(ctr); } if (ctr == NULL) -- cgit From 5265ce7837a185977f71bcb39a41b57492e24964 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 27 Feb 2001 19:22:02 +0000 Subject: Added total memory allocated counter to talloc, so we can tell if a talloc pool is getting bloated. Also added a talloc_zero function to return zeroed memory. Added debug in rpc_server/srv_pipe_hnd.c so we know when a talloc pool is being freed. Syncup with srv_pipe_hnd.c from 2.2 so we are freeing memory at the same time. Jeremy. (This used to be commit d3a56c6042acf037bbd53de88d7636a5803ead20) --- source3/rpc_parse/parse_lsa.c | 10 ++-- source3/rpc_parse/parse_misc.c | 103 +++++++++++++++++++++++--------------- source3/rpc_parse/parse_spoolss.c | 4 +- 3 files changed, 71 insertions(+), 46 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index a33c759473..d86df0ee11 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -708,7 +708,7 @@ static BOOL lsa_io_dom_query_2(char *desc, DOM_QUERY_2 *d_q, prs_struct *ps, int return False; if (UNMARSHALLING(ps)) { - d_q->auditsettings = (uint32 *)talloc(ps->mem_ctx, d_q->count2 * sizeof(uint32)); + d_q->auditsettings = (uint32 *)talloc_zero(ps->mem_ctx, d_q->count2 * sizeof(uint32)); } if (d_q->auditsettings == NULL) { @@ -829,13 +829,13 @@ void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, if (num_entries == 0) return; - if ((sen->ptr_sid = (uint32 *)talloc(mem_ctx, num_entries * + if ((sen->ptr_sid = (uint32 *)talloc_zero(mem_ctx, num_entries * sizeof(uint32))) == NULL) { DEBUG(3, ("init_lsa_sid_enum(): out of memory for ptr_sid\n")); return; } - if ((sen->sid = (DOM_SID2 *)talloc(mem_ctx, num_entries * + if ((sen->sid = (DOM_SID2 *)talloc_zero(mem_ctx, num_entries * sizeof(DOM_SID2))) == NULL) { DEBUG(3, ("init_lsa_sid_enum(): out of memory for sids\n")); return; @@ -1070,13 +1070,13 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, q_l->num_entries2 = num_names; q_l->lookup_level = 1; - if ((q_l->uni_name = (UNISTR2 *)talloc( + if ((q_l->uni_name = (UNISTR2 *)talloc_zero( mem_ctx, num_names * sizeof(UNISTR2))) == NULL) { DEBUG(3, ("init_q_lookup_names(): out of memory\n")); return; } - if ((q_l->hdr_name = (UNIHDR *)talloc( + if ((q_l->hdr_name = (UNIHDR *)talloc_zero( mem_ctx, num_names * sizeof(UNIHDR))) == NULL) { DEBUG(3, ("init_q_lookup_names(): out of memory\n")); return; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 329683d23a..0a65c09493 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -26,18 +26,66 @@ extern int DEBUGLEVEL; -static TALLOC_CTX *parse_misc_talloc = NULL; +/**************************************************************************** + A temporary TALLOC context for things like unistrs, that is valid for + the life of a complete RPC call. +****************************************************************************/ -/******************************************************************* a +static TALLOC_CTX *current_rpc_talloc = NULL; + +TALLOC_CTX *get_current_rpc_talloc(void) +{ + return current_rpc_talloc; +} + +void set_current_rpc_talloc( TALLOC_CTX *ctx) +{ + current_rpc_talloc = ctx; +} + +static TALLOC_CTX *main_loop_talloc = NULL; + +/******************************************************************* free up temporary memory - called from the main loop ********************************************************************/ -void parse_talloc_free(void) +void main_loop_talloc_free(void) { - if (!parse_misc_talloc) + if (!main_loop_talloc) return; - talloc_destroy(parse_misc_talloc); - parse_misc_talloc = NULL; + talloc_destroy(main_loop_talloc); + main_loop_talloc = NULL; +} + +/******************************************************************* + Get a talloc context that is freed in the main loop... +********************************************************************/ + +TALLOC_CTX *main_loop_talloc_get(void) +{ + if (!main_loop_talloc) { + main_loop_talloc = talloc_init(); + if (!main_loop_talloc) + smb_panic("main_loop_talloc: malloc fail\n"); + } + + return main_loop_talloc; +} + +/******************************************************************* + Try and get a talloc context. Get the rpc one if possible, else + get the main loop one. The main loop one is more dangerous as it + goes away between packets, the rpc one will stay around for as long + as a current RPC lasts. +********************************************************************/ + +TALLOC_CTX *get_talloc_ctx(void) +{ + TALLOC_CTX *tc = get_current_rpc_talloc(); + + if (tc) + return tc; + return main_loop_talloc_get(); } /******************************************************************* @@ -483,19 +531,14 @@ void init_unistr(UNISTR *str, const char *buf) len = strlen(buf) + 1; - if (!parse_misc_talloc) - parse_misc_talloc = talloc_init(); - if (len < MAX_UNISTRLEN) len = MAX_UNISTRLEN; len *= sizeof(uint16); - str->buffer = (uint16 *)talloc(parse_misc_talloc, len); + str->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len); if (str->buffer == NULL) smb_panic("init_unistr: malloc fail\n"); - memset(str->buffer, '\0', len); - /* store the string (null-terminated copy) */ dos_struni2((char *)str->buffer, buf, len); } @@ -527,15 +570,12 @@ BOOL smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) static void create_buffer3(BUFFER3 *str, size_t len) { - if (!parse_misc_talloc) - parse_misc_talloc = talloc_init(); - if (len < MAX_BUFFERLEN) len = MAX_BUFFERLEN; - str->buffer = talloc(parse_misc_talloc, len); + str->buffer = talloc_zero(get_talloc_ctx(), len); if (str->buffer == NULL) - smb_panic("create_buffer3: malloc fail\n"); + smb_panic("create_buffer3: talloc fail\n"); } @@ -673,14 +713,11 @@ void init_buffer2(BUFFER2 *str, uint8 *buf, int len) str->buf_len = buf != NULL ? len : 0; if (buf != NULL) { - if (!parse_misc_talloc) - parse_misc_talloc = talloc_init(); - if (len < MAX_BUFFERLEN) len = MAX_BUFFERLEN; - str->buffer = talloc(parse_misc_talloc, len); + str->buffer = talloc_zero(get_talloc_ctx(), len); if (str->buffer == NULL) - smb_panic("init_buffer2: malloc fail\n"); + smb_panic("init_buffer2: talloc fail\n"); memcpy(str->buffer, buf, MIN(str->buf_len, len)); } } @@ -767,17 +804,14 @@ void copy_unistr2(UNISTR2 *str, UNISTR2 *from) if (str->buffer == NULL) { size_t len = from->uni_max_len * sizeof(uint16); - if (!parse_misc_talloc) - parse_misc_talloc = talloc_init(); - if (len < MAX_UNISTRLEN) len = MAX_UNISTRLEN; len *= sizeof(uint16); - str->buffer = (uint16 *)talloc(parse_misc_talloc, len); + str->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len); if ((str->buffer == NULL) && (len > 0 )) { - smb_panic("copy_unistr2: malloc fail\n"); + smb_panic("copy_unistr2: talloc fail\n"); return; } } @@ -801,12 +835,9 @@ void init_string2(STRING2 *str, char *buf, int len) /* store the string */ if(len != 0) { - if (!parse_misc_talloc) - parse_misc_talloc = talloc_init(); - if (len < MAX_STRINGLEN) alloc_len = MAX_STRINGLEN; - str->buffer = talloc(parse_misc_talloc, alloc_len); + str->buffer = talloc_zero(get_talloc_ctx(), alloc_len); if (str->buffer == NULL) smb_panic("init_string2: malloc fail\n"); memcpy(str->buffer, buf, len); @@ -869,14 +900,11 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len) str->undoc = 0; str->uni_str_len = (uint32)len; - if (!parse_misc_talloc) - parse_misc_talloc = talloc_init(); - if (len < MAX_UNISTRLEN) len = MAX_UNISTRLEN; len *= sizeof(uint16); - str->buffer = (uint16 *)talloc(parse_misc_talloc, len); + str->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len); if ((str->buffer == NULL) && (len > 0)) { smb_panic("init_unistr2: malloc fail\n"); @@ -917,11 +945,8 @@ void init_unistr2_from_unistr (UNISTR2 *to, UNISTR *from) to->undoc = 0; to->uni_str_len = i; - if (!parse_misc_talloc) - parse_misc_talloc = talloc_init(); - /* allocate the space and copy the string buffer */ - to->buffer = (uint16 *)talloc(parse_misc_talloc, sizeof(uint16)*(to->uni_str_len)); + to->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), sizeof(uint16)*(to->uni_str_len)); if (to->buffer == NULL) smb_panic("init_unistr2_from_unistr: malloc fail\n"); memcpy(to->buffer, from->buffer, to->uni_max_len*sizeof(uint16)); diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 0961cda195..bb8c818421 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -401,10 +401,10 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, /* Tallocate memory for string */ - DEBUG(0, ("** tallocating memory\n")); + DEBUG(10, ("** tallocating memory\n")); data->notify_data.data.string = (uint16 *) - talloc(ps->mem_ctx, x * 2); + talloc_zero(ps->mem_ctx, x * 2); if (!data->notify_data.data.string) return False; -- cgit From 0f2799aaf1e33aa474a12b9389728d57af926cb3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 28 Feb 2001 00:51:02 +0000 Subject: Move to talloc control of SPOOL_XXX structs. Move to talloc control of security descriptors and pointers. Syncup with 2.2 tree. Jeremy. (This used to be commit 14d5997dc841e78a619e865288486d50c245896d) --- source3/rpc_parse/parse_sec.c | 151 ++++------ source3/rpc_parse/parse_spoolss.c | 619 ++++++++++++++++++-------------------- 2 files changed, 339 insertions(+), 431 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index fa0be04cba..e5d3a6ce43 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -123,22 +123,19 @@ BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth) Create a SEC_ACL structure. ********************************************************************/ -SEC_ACL *make_sec_acl(uint16 revision, int num_aces, SEC_ACE *ace_list) +SEC_ACL *make_sec_acl(TALLOC_CTX *ctx, uint16 revision, int num_aces, SEC_ACE *ace_list) { SEC_ACL *dst; int i; - if((dst = (SEC_ACL *)malloc(sizeof(SEC_ACL))) == NULL) + if((dst = (SEC_ACL *)talloc_zero(ctx,sizeof(SEC_ACL))) == NULL) return NULL; - ZERO_STRUCTP(dst); - dst->revision = revision; dst->num_aces = num_aces; dst->size = 8; - if((dst->ace = (SEC_ACE *)malloc( sizeof(SEC_ACE) * num_aces )) == NULL) { - free_sec_acl(&dst); + if((dst->ace = (SEC_ACE *)talloc(ctx, sizeof(SEC_ACE) * num_aces )) == NULL) { return NULL; } @@ -154,31 +151,12 @@ SEC_ACL *make_sec_acl(uint16 revision, int num_aces, SEC_ACE *ace_list) Duplicate a SEC_ACL structure. ********************************************************************/ -SEC_ACL *dup_sec_acl( SEC_ACL *src) +SEC_ACL *dup_sec_acl(TALLOC_CTX *ctx, SEC_ACL *src) { if(src == NULL) return NULL; - return make_sec_acl( src->revision, src->num_aces, src->ace); -} - -/******************************************************************* - Delete a SEC_ACL structure. -********************************************************************/ - -void free_sec_acl(SEC_ACL **ppsa) -{ - SEC_ACL *psa; - - if(ppsa == NULL || *ppsa == NULL) - return; - - psa = *ppsa; - if (psa->ace != NULL) - free(psa->ace); - - free(psa); - *ppsa = NULL; + return make_sec_acl(ctx, src->revision, src->num_aces, src->ace); } /******************************************************************* @@ -204,7 +182,7 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) /* * This is a read and we must allocate the stuct to read into. */ - if((psa = (SEC_ACL *)malloc(sizeof(SEC_ACL))) == NULL) + if((psa = (SEC_ACL *)prs_alloc_mem(ps, sizeof(SEC_ACL))) == NULL) return False; *ppsa = psa; } @@ -228,7 +206,7 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) if (UNMARSHALLING(ps) && psa->num_aces != 0) { /* reading */ - if((psa->ace = malloc(sizeof(psa->ace[0]) * psa->num_aces)) == NULL) + if((psa->ace = (SEC_ACE *)prs_alloc_mem(ps,sizeof(psa->ace[0]) * psa->num_aces)) == NULL) return False; } @@ -423,7 +401,7 @@ BOOL sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2) security descriptor new_sec. ********************************************************************/ -SEC_DESC_BUF *sec_desc_merge(SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb) +SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb) { DOM_SID *owner_sid, *group_sid; SEC_DESC_BUF *return_sdb; @@ -460,21 +438,37 @@ SEC_DESC_BUF *sec_desc_merge(SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb) /* Create new security descriptor from bits */ - psd = make_sec_desc(new_sdb->sec->revision, + psd = make_sec_desc(ctx, new_sdb->sec->revision, owner_sid, group_sid, sacl, dacl, &secdesc_size); - return_sdb = make_sec_desc_buf(secdesc_size, psd); - - free_sec_desc(&psd); + return_sdb = make_sec_desc_buf(ctx, secdesc_size, psd); return(return_sdb); } +/******************************************************************* + Tallocs a duplicate SID. +********************************************************************/ + +static DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, DOM_SID *src) +{ + DOM_SID *dst; + + if(!src) + return NULL; + + if((dst = talloc_zero(ctx, sizeof(DOM_SID))) != NULL) { + sid_copy( dst, src); + } + + return dst; +} + /******************************************************************* Creates a SEC_DESC structure ********************************************************************/ -SEC_DESC *make_sec_desc(uint16 revision, +SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, DOM_SID *owner_sid, DOM_SID *grp_sid, SEC_ACL *sacl, SEC_ACL *dacl, size_t *sd_size) { @@ -483,11 +477,9 @@ SEC_DESC *make_sec_desc(uint16 revision, *sd_size = 0; - if(( dst = (SEC_DESC *)malloc(sizeof(SEC_DESC))) == NULL) + if(( dst = (SEC_DESC *)talloc_zero(ctx, sizeof(SEC_DESC))) == NULL) return NULL; - ZERO_STRUCTP(dst); - dst->revision = revision; dst->type = SEC_DESC_SELF_RELATIVE; @@ -499,16 +491,16 @@ SEC_DESC *make_sec_desc(uint16 revision, dst->off_sacl = 0; dst->off_dacl = 0; - if(owner_sid && ((dst->owner_sid = sid_dup(owner_sid)) == NULL)) + if(owner_sid && ((dst->owner_sid = sid_dup_talloc(ctx,owner_sid)) == NULL)) goto error_exit; - if(grp_sid && ((dst->grp_sid = sid_dup(grp_sid)) == NULL)) + if(grp_sid && ((dst->grp_sid = sid_dup_talloc(ctx,grp_sid)) == NULL)) goto error_exit; - if(sacl && ((dst->sacl = dup_sec_acl(sacl)) == NULL)) + if(sacl && ((dst->sacl = dup_sec_acl(ctx, sacl)) == NULL)) goto error_exit; - if(dacl && ((dst->dacl = dup_sec_acl(dacl)) == NULL)) + if(dacl && ((dst->dacl = dup_sec_acl(ctx, dacl)) == NULL)) goto error_exit; offset = 0; @@ -559,7 +551,6 @@ SEC_DESC *make_sec_desc(uint16 revision, error_exit: *sd_size = 0; - free_sec_desc(&dst); return NULL; } @@ -567,47 +558,26 @@ error_exit: Duplicate a SEC_DESC structure. ********************************************************************/ -SEC_DESC *dup_sec_desc( SEC_DESC *src) +SEC_DESC *dup_sec_desc( TALLOC_CTX *ctx, SEC_DESC *src) { size_t dummy; if(src == NULL) return NULL; - return make_sec_desc( src->revision, + return make_sec_desc( ctx, src->revision, src->owner_sid, src->grp_sid, src->sacl, src->dacl, &dummy); } -/******************************************************************* - Deletes a SEC_DESC structure -********************************************************************/ - -void free_sec_desc(SEC_DESC **ppsd) -{ - SEC_DESC *psd; - - if(ppsd == NULL || *ppsd == NULL) - return; - - psd = *ppsd; - - free_sec_acl(&psd->dacl); - free_sec_acl(&psd->sacl); - free(psd->owner_sid); - free(psd->grp_sid); - free(psd); - *ppsd = NULL; -} - /******************************************************************* Creates a SEC_DESC structure with typical defaults. ********************************************************************/ -SEC_DESC *make_standard_sec_desc(DOM_SID *owner_sid, DOM_SID *grp_sid, +SEC_DESC *make_standard_sec_desc(TALLOC_CTX *ctx, DOM_SID *owner_sid, DOM_SID *grp_sid, SEC_ACL *dacl, size_t *sd_size) { - return make_sec_desc(SEC_DESC_REVISION, + return make_sec_desc(ctx, SEC_DESC_REVISION, owner_sid, grp_sid, NULL, dacl, sd_size); } @@ -629,7 +599,7 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if (psd == NULL) { if(UNMARSHALLING(ps)) { - if((psd = (SEC_DESC *)malloc(sizeof(SEC_DESC))) == NULL) + if((psd = (SEC_DESC *)prs_alloc_mem(ps,sizeof(SEC_DESC))) == NULL) return False; *ppsd = psd; } else { @@ -673,7 +643,7 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if(!prs_set_offset(ps, old_offset + psd->off_owner_sid)) return False; /* reading */ - if((psd->owner_sid = malloc(sizeof(*psd->owner_sid))) == NULL) + if((psd->owner_sid = (DOM_SID *)prs_alloc_mem(ps,sizeof(*psd->owner_sid))) == NULL) return False; } @@ -691,7 +661,7 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) /* reading */ if(!prs_set_offset(ps, old_offset + psd->off_grp_sid)) return False; - if((psd->grp_sid = malloc(sizeof(*psd->grp_sid))) == NULL) + if((psd->grp_sid = (DOM_SID *)prs_alloc_mem(ps,sizeof(*psd->grp_sid))) == NULL) return False; } @@ -734,24 +704,23 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) Creates a SEC_DESC_BUF structure. ********************************************************************/ -SEC_DESC_BUF *make_sec_desc_buf(size_t len, SEC_DESC *sec_desc) +SEC_DESC_BUF *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, SEC_DESC *sec_desc) { SEC_DESC_BUF *dst; - if((dst = (SEC_DESC_BUF *)malloc(sizeof(SEC_DESC_BUF))) == NULL) + if((dst = (SEC_DESC_BUF *)talloc_zero(ctx, sizeof(SEC_DESC_BUF))) == NULL) return NULL; - ZERO_STRUCTP(dst); - /* max buffer size (allocated size) */ dst->max_len = (uint32)len; dst->len = (uint32)len; - - if(sec_desc && ((dst->sec = dup_sec_desc(sec_desc)) == NULL)) { - free_sec_desc_buf(&dst); + + if(sec_desc && ((dst->sec = dup_sec_desc(ctx, sec_desc)) == NULL)) { return NULL; } + dst->ptr = 0x1; + return dst; } @@ -759,32 +728,14 @@ SEC_DESC_BUF *make_sec_desc_buf(size_t len, SEC_DESC *sec_desc) Duplicates a SEC_DESC_BUF structure. ********************************************************************/ -SEC_DESC_BUF *dup_sec_desc_buf(SEC_DESC_BUF *src) +SEC_DESC_BUF *dup_sec_desc_buf(TALLOC_CTX *ctx, SEC_DESC_BUF *src) { if(src == NULL) return NULL; - return make_sec_desc_buf( src->len, src->sec); -} - -/******************************************************************* - Deletes a SEC_DESC_BUF structure. -********************************************************************/ - -void free_sec_desc_buf(SEC_DESC_BUF **ppsdb) -{ - SEC_DESC_BUF *psdb; - - if(ppsdb == NULL || *ppsdb == NULL) - return; - - psdb = *ppsdb; - free_sec_desc(&psdb->sec); - free(psdb); - *ppsdb = NULL; + return make_sec_desc_buf( ctx, src->len, src->sec); } - /******************************************************************* Reads or writes a SEC_DESC_BUF structure. ********************************************************************/ @@ -803,7 +754,7 @@ BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth psdb = *ppsdb; if (UNMARSHALLING(ps) && psdb == NULL) { - if((psdb = (SEC_DESC_BUF *)malloc(sizeof(SEC_DESC_BUF))) == NULL) + if((psdb = (SEC_DESC_BUF *)prs_alloc_mem(ps,sizeof(SEC_DESC_BUF))) == NULL) return False; *ppsdb = psdb; } @@ -817,7 +768,7 @@ BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth if(!prs_uint32_pre("max_len", ps, depth, &psdb->max_len, &off_max_len)) return False; - if(!prs_uint32 ("undoc ", ps, depth, &psdb->undoc)) + if(!prs_uint32 ("ptr ", ps, depth, &psdb->ptr)) return False; if(!prs_uint32_pre("len ", ps, depth, &psdb->len, &off_len)) diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index bb8c818421..fb4150b2ce 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -25,25 +25,28 @@ #include "includes.h" extern int DEBUGLEVEL; + /******************************************************************* return the length of a UNISTR string. ********************************************************************/ + static uint32 str_len_uni(UNISTR *source) { uint32 i=0; - if (!source->buffer) return 0; + if (!source->buffer) + return 0; + + while (source->buffer[i]) + i++; - while (source->buffer[i]!=0x0000) - { - i++; - } return i; } /******************************************************************* This should be moved in a more generic lib. ********************************************************************/ + static BOOL spoolss_io_system_time(char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) { if(!prs_uint16("year", ps, depth, &(systime->year))) @@ -68,6 +71,7 @@ static BOOL spoolss_io_system_time(char *desc, prs_struct *ps, int depth, SYSTEM /******************************************************************* ********************************************************************/ + BOOL make_systemtime(SYSTEMTIME *systime, struct tm *unixtime) { systime->year=unixtime->tm_year+1900; @@ -85,6 +89,7 @@ BOOL make_systemtime(SYSTEMTIME *systime, struct tm *unixtime) /******************************************************************* reads or writes an DOC_INFO structure. ********************************************************************/ + static BOOL smb_io_doc_info_1(char *desc, DOC_INFO_1 *info_1, prs_struct *ps, int depth) { if (info_1 == NULL) return False; @@ -115,6 +120,7 @@ static BOOL smb_io_doc_info_1(char *desc, DOC_INFO_1 *info_1, prs_struct *ps, in /******************************************************************* reads or writes an DOC_INFO structure. ********************************************************************/ + static BOOL smb_io_doc_info(char *desc, DOC_INFO *info, prs_struct *ps, int depth) { uint32 useless_ptr=0; @@ -163,6 +169,7 @@ static BOOL smb_io_doc_info(char *desc, DOC_INFO *info, prs_struct *ps, int dept /******************************************************************* reads or writes an DOC_INFO_CONTAINER structure. ********************************************************************/ + static BOOL smb_io_doc_info_container(char *desc, DOC_INFO_CONTAINER *cont, prs_struct *ps, int depth) { if (cont == NULL) return False; @@ -185,6 +192,7 @@ static BOOL smb_io_doc_info_container(char *desc, DOC_INFO_CONTAINER *cont, prs_ /******************************************************************* reads or writes an NOTIFY OPTION TYPE structure. ********************************************************************/ + static BOOL smb_io_notify_option_type(char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_notify_option_type"); @@ -212,6 +220,7 @@ static BOOL smb_io_notify_option_type(char *desc, SPOOL_NOTIFY_OPTION_TYPE *type /******************************************************************* reads or writes an NOTIFY OPTION TYPE DATA. ********************************************************************/ + static BOOL smb_io_notify_option_type_data(char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) { int i; @@ -242,6 +251,7 @@ static BOOL smb_io_notify_option_type_data(char *desc, SPOOL_NOTIFY_OPTION_TYPE /******************************************************************* reads or writes an NOTIFY OPTION structure. ********************************************************************/ + static BOOL smb_io_notify_option_type_ctr(char *desc, SPOOL_NOTIFY_OPTION_TYPE_CTR *ctr , prs_struct *ps, int depth) { int i; @@ -254,7 +264,7 @@ static BOOL smb_io_notify_option_type_ctr(char *desc, SPOOL_NOTIFY_OPTION_TYPE_C /* reading */ if (UNMARSHALLING(ps)) - if((ctr->type=(SPOOL_NOTIFY_OPTION_TYPE *)malloc(ctr->count*sizeof(SPOOL_NOTIFY_OPTION_TYPE))) == NULL) + if((ctr->type=(SPOOL_NOTIFY_OPTION_TYPE *)prs_alloc_mem(ps,ctr->count*sizeof(SPOOL_NOTIFY_OPTION_TYPE))) == NULL) return False; /* the option type struct */ @@ -273,6 +283,7 @@ static BOOL smb_io_notify_option_type_ctr(char *desc, SPOOL_NOTIFY_OPTION_TYPE_C /******************************************************************* reads or writes an NOTIFY OPTION structure. ********************************************************************/ + static BOOL smb_io_notify_option(char *desc, SPOOL_NOTIFY_OPTION *option, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_notify_option"); @@ -303,6 +314,7 @@ static BOOL smb_io_notify_option(char *desc, SPOOL_NOTIFY_OPTION *option, prs_st /******************************************************************* reads or writes an NOTIFY INFO DATA structure. ********************************************************************/ + static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) { uint32 useless_ptr=0xADDE0FF0; @@ -362,6 +374,7 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs /******************************************************************* reads or writes an NOTIFY INFO DATA structure. ********************************************************************/ + BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) { @@ -401,10 +414,7 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, /* Tallocate memory for string */ - DEBUG(10, ("** tallocating memory\n")); - - data->notify_data.data.string = (uint16 *) - talloc_zero(ps->mem_ctx, x * 2); + data->notify_data.data.string = (uint16 *)prs_alloc_mem(ps, x * 2); if (!data->notify_data.data.string) return False; @@ -421,6 +431,7 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, /******************************************************************* reads or writes an NOTIFY INFO structure. ********************************************************************/ + static BOOL smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, prs_struct *ps, int depth) { int i; @@ -454,16 +465,16 @@ static BOOL smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, prs_struct * return True; } - /******************************************************************* ********************************************************************/ + static BOOL spool_io_user_level_1(char *desc, SPOOL_USER_1 *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); depth++; /* reading */ - if (ps->io) + if (UNMARSHALLING(ps)) ZERO_STRUCTP(q_u); if (!prs_align(ps)) @@ -495,6 +506,7 @@ static BOOL spool_io_user_level_1(char *desc, SPOOL_USER_1 *q_u, prs_struct *ps, /******************************************************************* ********************************************************************/ + static BOOL spool_io_user_level(char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, int depth) { if (q_u==NULL) @@ -526,6 +538,7 @@ static BOOL spool_io_user_level(char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, * read or write a DEVICEMODE struct. * on reading allocate memory for the private member ********************************************************************/ + static BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) { prs_debug(ps, depth, desc, "spoolss_io_devmode"); @@ -615,7 +628,7 @@ static BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE if (devmode->driverextra!=0) { if (UNMARSHALLING(ps)) { - devmode->private=(uint8 *)malloc(devmode->driverextra*sizeof(uint8)); + devmode->private=(uint8 *)prs_alloc_mem(ps, devmode->driverextra*sizeof(uint8)); if(devmode->private == NULL) return False; DEBUG(7,("spoolss_io_devmode: allocated memory [%d] for private\n",devmode->driverextra)); @@ -629,18 +642,10 @@ static BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE return True; } -void free_spoolss_devmode(DEVICEMODE *devmode) -{ - if (devmode == NULL) - return; - - safe_free(devmode->private); - safe_free(devmode); -} - /******************************************************************* Read or write a DEVICEMODE container ********************************************************************/ + static BOOL spoolss_io_devmode_cont(char *desc, DEVMODE_CTR *dm_c, prs_struct *ps, int depth) { if (dm_c==NULL) @@ -668,10 +673,9 @@ static BOOL spoolss_io_devmode_cont(char *desc, DEVMODE_CTR *dm_c, prs_struct *p /* so we have a DEVICEMODE to follow */ if (UNMARSHALLING(ps)) { DEBUG(9,("Allocating memory for spoolss_io_devmode\n")); - dm_c->devmode=(DEVICEMODE *)malloc(sizeof(DEVICEMODE)); + dm_c->devmode=(DEVICEMODE *)prs_alloc_mem(ps,sizeof(DEVICEMODE)); if(dm_c->devmode == NULL) return False; - ZERO_STRUCTP(dm_c->devmode); } /* this is bad code, shouldn't be there */ @@ -686,6 +690,7 @@ static BOOL spoolss_io_devmode_cont(char *desc, DEVMODE_CTR *dm_c, prs_struct *p /******************************************************************* ********************************************************************/ + static BOOL spoolss_io_printer_default(char *desc, PRINTER_DEFAULT *pd, prs_struct *ps, int depth) { if (pd==NULL) @@ -715,6 +720,7 @@ static BOOL spoolss_io_printer_default(char *desc, PRINTER_DEFAULT *pd, prs_stru /******************************************************************* * init a structure. ********************************************************************/ + BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, const fstring printername, const fstring datatype, @@ -754,7 +760,8 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, /******************************************************************* * init a structure. ********************************************************************/ -BOOL make_spoolss_q_addprinterex(SPOOL_Q_ADDPRINTEREX *q_u, const char *srv_name, + +BOOL make_spoolss_q_addprinterex(TALLOC_CTX *ctx, SPOOL_Q_ADDPRINTEREX *q_u, const char *srv_name, const char* clientname, const char* user_name, uint32 level, PRINTER_INFO_2 *info) { @@ -771,7 +778,7 @@ BOOL make_spoolss_q_addprinterex(SPOOL_Q_ADDPRINTEREX *q_u, const char *srv_name { case 2: /* init q_u->info.info2 from *info */ - if (!make_spool_printer_info_2( &q_u->info.info_2, info)) + if (!make_spool_printer_info_2( ctx, &q_u->info.info_2, info)) { DEBUG(0,("make_spoolss_q_addprinterex: Unable to fill SPOOL_Q_ADDPRINTEREX struct!\n")); return False; @@ -800,60 +807,25 @@ BOOL make_spoolss_q_addprinterex(SPOOL_Q_ADDPRINTEREX *q_u, const char *srv_name return True; } - -/******************************************************************* - free dynamically allocated members - ********************************************************************/ -void free_spoolss_q_addprinterex(SPOOL_Q_ADDPRINTEREX *q_u) -{ - switch (q_u->info.level) - { - case 1: - if (q_u->info.info_1 != NULL) - { - free(q_u->info.info_1); - q_u->info.info_1 = NULL; - } - break; - case 2: - if (q_u->info.info_2 != NULL) - { - free(q_u->info.info_2); - q_u->info.info_2 = NULL; - } - break; - case 3: - if (q_u->info.info_3 != NULL) - { - free(q_u->info.info_3); - q_u->info.info_3 = NULL; - } - break; - } - - return; - -} /******************************************************************* create a SPOOL_PRINTER_INFO_2 stuct from a PRINTER_INFO_2 struct *******************************************************************/ -BOOL make_spool_printer_info_2(SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2, + +BOOL make_spool_printer_info_2(TALLOC_CTX *ctx, SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2, PRINTER_INFO_2 *info) { SPOOL_PRINTER_INFO_LEVEL_2 *inf; /* allocate the necessary memory */ - inf = (SPOOL_PRINTER_INFO_LEVEL_2*)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2)); + inf = (SPOOL_PRINTER_INFO_LEVEL_2*)talloc_zero(ctx,sizeof(SPOOL_PRINTER_INFO_LEVEL_2)); if (spool_info2 == NULL) { - DEBUG(0,("make_spool_printer_info_2: Unable to malloc SPOOL_PRINTER_INFO_LEVEL_2 sruct!\n")); + DEBUG(0,("make_spool_printer_info_2: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_2 sruct!\n")); return False; } - ZERO_STRUCTP(inf); - inf->servername_ptr = (info->servername.buffer!=NULL)?1:0; inf->printername_ptr = (info->printername.buffer!=NULL)?1:0; inf->sharename_ptr = (info->sharename.buffer!=NULL)?1:0; @@ -897,6 +869,7 @@ BOOL make_spool_printer_info_2(SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2, * read a structure. * called from spoolss_q_open_printer_ex (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -927,16 +900,12 @@ BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_ return True; } -void free_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u) -{ - free_spoolss_devmode(q_u->printer_default.devmode_cont.devmode); -} - /******************************************************************* * write a structure. * called from static spoolss_r_open_printer_ex (srv_spoolss.c) * called from spoolss_open_printer_ex (cli_spoolss.c) ********************************************************************/ + BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -959,6 +928,7 @@ BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_ /******************************************************************* * make a structure. ********************************************************************/ + BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, const POLICY_HND *handle, UNISTR2 *valuename, uint32 size) @@ -974,11 +944,11 @@ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, return True; } - /******************************************************************* * read a structure. * called from spoolss_q_getprinterdata (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_q_getprinterdata(char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -989,15 +959,15 @@ BOOL spoolss_io_q_getprinterdata(char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_st if (!prs_align(ps)) return False; - if (!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + if (!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; if (!prs_align(ps)) return False; - if (!smb_io_unistr2("valuename", &(q_u->valuename),True,ps,depth)) + if (!smb_io_unistr2("valuename", &q_u->valuename,True,ps,depth)) return False; if (!prs_align(ps)) return False; - if (!prs_uint32("size", ps, depth, &(q_u->size))) + if (!prs_uint32("size", ps, depth, &q_u->size)) return False; return True; @@ -1007,6 +977,7 @@ BOOL spoolss_io_q_getprinterdata(char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_st * read a structure. * called from spoolss_q_deleteprinterdata (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_q_deleteprinterdata(char *desc, SPOOL_Q_DELETEPRINTERDATA *q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -1017,11 +988,11 @@ BOOL spoolss_io_q_deleteprinterdata(char *desc, SPOOL_Q_DELETEPRINTERDATA *q_u, if (!prs_align(ps)) return False; - if (!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + if (!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; if (!prs_align(ps)) return False; - if (!smb_io_unistr2("valuename", &(q_u->valuename),True,ps,depth)) + if (!smb_io_unistr2("valuename", &q_u->valuename,True,ps,depth)) return False; return True; @@ -1031,6 +1002,7 @@ BOOL spoolss_io_q_deleteprinterdata(char *desc, SPOOL_Q_DELETEPRINTERDATA *q_u, * write a structure. * called from spoolss_r_deleteprinterdata (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_r_deleteprinterdata(char *desc, SPOOL_R_DELETEPRINTERDATA *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterdata"); @@ -1045,6 +1017,7 @@ BOOL spoolss_io_r_deleteprinterdata(char *desc, SPOOL_R_DELETEPRINTERDATA *r_u, * write a structure. * called from spoolss_r_getprinterdata (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -1077,13 +1050,14 @@ BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_st /******************************************************************* * make a structure. ********************************************************************/ + BOOL make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER *q_u, POLICY_HND *hnd) { if (q_u == NULL) return False; DEBUG(5,("make_spoolss_q_closeprinter\n")); - memcpy(&(q_u->handle), hnd, sizeof(q_u->handle)); + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); return True; } @@ -1093,6 +1067,7 @@ BOOL make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER *q_u, POLICY_HND *hnd) * called from static spoolss_q_abortprinter (srv_spoolss.c) * called from spoolss_abortprinter (cli_spoolss.c) ********************************************************************/ + BOOL spoolss_io_q_abortprinter(char *desc, SPOOL_Q_ABORTPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1113,6 +1088,7 @@ BOOL spoolss_io_q_abortprinter(char *desc, SPOOL_Q_ABORTPRINTER *q_u, prs_struct * write a structure. * called from spoolss_r_abortprinter (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_r_abortprinter(char *desc, SPOOL_R_ABORTPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_abortprinter"); @@ -1128,6 +1104,7 @@ BOOL spoolss_io_r_abortprinter(char *desc, SPOOL_R_ABORTPRINTER *r_u, prs_struct * called from static spoolss_q_deleteprinter (srv_spoolss.c) * called from spoolss_deleteprinter (cli_spoolss.c) ********************************************************************/ + BOOL spoolss_io_q_deleteprinter(char *desc, SPOOL_Q_DELETEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1149,6 +1126,7 @@ BOOL spoolss_io_q_deleteprinter(char *desc, SPOOL_Q_DELETEPRINTER *q_u, prs_stru * called from static spoolss_r_deleteprinter (srv_spoolss.c) * called from spoolss_deleteprinter (cli_spoolss.c) ********************************************************************/ + BOOL spoolss_io_r_deleteprinter(char *desc, SPOOL_R_DELETEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinter"); @@ -1165,12 +1143,12 @@ BOOL spoolss_io_r_deleteprinter(char *desc, SPOOL_R_DELETEPRINTER *r_u, prs_stru return True; } - /******************************************************************* * read a structure. * called from static spoolss_q_closeprinter (srv_spoolss.c) * called from spoolss_closeprinter (cli_spoolss.c) ********************************************************************/ + BOOL spoolss_io_q_closeprinter(char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1192,6 +1170,7 @@ BOOL spoolss_io_q_closeprinter(char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct * called from static spoolss_r_closeprinter (srv_spoolss.c) * called from spoolss_closeprinter (cli_spoolss.c) ********************************************************************/ + BOOL spoolss_io_r_closeprinter(char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_closeprinter"); @@ -1212,6 +1191,7 @@ BOOL spoolss_io_r_closeprinter(char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct * read a structure. * called from spoolss_q_startdocprinter (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_q_startdocprinter(char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1222,10 +1202,10 @@ BOOL spoolss_io_q_startdocprinter(char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_ if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("printer handle",&(q_u->handle),ps,depth)) + if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; - if(!smb_io_doc_info_container("",&(q_u->doc_info_container), ps, depth)) + if(!smb_io_doc_info_container("",&q_u->doc_info_container, ps, depth)) return False; return True; @@ -1235,6 +1215,7 @@ BOOL spoolss_io_q_startdocprinter(char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_ * write a structure. * called from spoolss_r_startdocprinter (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_r_startdocprinter(char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_startdocprinter"); @@ -1251,6 +1232,7 @@ BOOL spoolss_io_r_startdocprinter(char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_ * read a structure. * called from spoolss_q_enddocprinter (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_q_enddocprinter(char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1271,6 +1253,7 @@ BOOL spoolss_io_q_enddocprinter(char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_stru * write a structure. * called from spoolss_r_enddocprinter (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_r_enddocprinter(char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enddocprinter"); @@ -1285,6 +1268,7 @@ BOOL spoolss_io_r_enddocprinter(char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_stru * read a structure. * called from spoolss_q_startpageprinter (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_q_startpageprinter(char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1305,6 +1289,7 @@ BOOL spoolss_io_q_startpageprinter(char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, pr * write a structure. * called from spoolss_r_startpageprinter (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_r_startpageprinter(char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_startpageprinter"); @@ -1319,6 +1304,7 @@ BOOL spoolss_io_r_startpageprinter(char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, pr * read a structure. * called from spoolss_q_endpageprinter (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_q_endpageprinter(char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1339,6 +1325,7 @@ BOOL spoolss_io_q_endpageprinter(char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_st * write a structure. * called from spoolss_r_endpageprinter (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_r_endpageprinter(char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_endpageprinter"); @@ -1353,6 +1340,7 @@ BOOL spoolss_io_r_endpageprinter(char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_st * read a structure. * called from spoolss_q_writeprinter (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1370,7 +1358,8 @@ BOOL spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct if (q_u->buffer_size!=0) { - q_u->buffer=(uint8 *)malloc(q_u->buffer_size*sizeof(uint8)); + if (UNMARSHALLING(ps)) + q_u->buffer=(uint8 *)prs_alloc_mem(ps,q_u->buffer_size*sizeof(uint8)); if(q_u->buffer == NULL) return False; if(!prs_uint8s(True, "buffer", ps, depth, q_u->buffer, q_u->buffer_size)) @@ -1388,6 +1377,7 @@ BOOL spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct * write a structure. * called from spoolss_r_writeprinter (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_r_writeprinter(char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_writeprinter"); @@ -1404,6 +1394,7 @@ BOOL spoolss_io_r_writeprinter(char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct * read a structure. * called from spoolss_q_rffpcnex (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_rffpcnex"); @@ -1435,7 +1426,7 @@ BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, in if (q_u->option_ptr!=0) { if (UNMARSHALLING(ps)) - if((q_u->option=(SPOOL_NOTIFY_OPTION *)malloc(sizeof(SPOOL_NOTIFY_OPTION))) == NULL) + if((q_u->option=(SPOOL_NOTIFY_OPTION *)prs_alloc_mem(ps,sizeof(SPOOL_NOTIFY_OPTION))) == NULL) return False; if(!smb_io_notify_option("notify option", q_u->option, ps, depth)) @@ -1449,6 +1440,7 @@ BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, in * write a structure. * called from spoolss_r_rffpcnex (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_rffpcnex"); @@ -1464,6 +1456,7 @@ BOOL spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, in * read a structure. * called from spoolss_q_rfnpcnex (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_rfnpcnex"); @@ -1484,7 +1477,7 @@ BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, in if (q_u->option_ptr!=0) { if (UNMARSHALLING(ps)) - if((q_u->option=(SPOOL_NOTIFY_OPTION *)malloc(sizeof(SPOOL_NOTIFY_OPTION))) == NULL) + if((q_u->option=(SPOOL_NOTIFY_OPTION *)prs_alloc_mem(ps,sizeof(SPOOL_NOTIFY_OPTION))) == NULL) return False; if(!smb_io_notify_option("notify option", q_u->option, ps, depth)) @@ -1498,6 +1491,7 @@ BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, in * write a structure. * called from spoolss_r_rfnpcnex (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_r_rfnpcnex(char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_rfnpcnex"); @@ -1523,6 +1517,7 @@ BOOL spoolss_io_r_rfnpcnex(char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, in /******************************************************************* * return the length of a uint16 (obvious, but the code is clean) ********************************************************************/ + static uint32 size_of_uint16(uint16 *value) { return (sizeof(*value)); @@ -1531,13 +1526,16 @@ static uint32 size_of_uint16(uint16 *value) /******************************************************************* * return the length of a uint32 (obvious, but the code is clean) ********************************************************************/ + static uint32 size_of_uint32(uint32 *value) { return (sizeof(*value)); } + /******************************************************************* * return the length of a NTTIME (obvious, but the code is clean) ********************************************************************/ + static uint32 size_of_nttime(NTTIME *value) { return (sizeof(*value)); @@ -1548,6 +1546,7 @@ static uint32 size_of_nttime(NTTIME *value) * - the leading zero * - the relative pointer size ********************************************************************/ + static uint32 size_of_relative_string(UNISTR *string) { uint32 size=0; @@ -1565,6 +1564,7 @@ static uint32 size_of_relative_string(UNISTR *string) /******************************************************************* * return the length of a uint32 (obvious, but the code is clean) ********************************************************************/ + static uint32 size_of_device_mode(DEVICEMODE *devmode) { if (devmode==NULL) @@ -1576,6 +1576,7 @@ static uint32 size_of_device_mode(DEVICEMODE *devmode) /******************************************************************* * return the length of a uint32 (obvious, but the code is clean) ********************************************************************/ + static uint32 size_of_systemtime(SYSTEMTIME *systime) { if (systime==NULL) @@ -1588,6 +1589,7 @@ static uint32 size_of_systemtime(SYSTEMTIME *systime) * write a UNICODE string. * used by all the RPC structs passing a buffer ********************************************************************/ + static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) { if (uni == NULL) @@ -1609,7 +1611,6 @@ static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int d return True; } - /******************************************************************* * write a UNICODE string and its relative pointer. * used by all the RPC structs passing a buffer @@ -1629,6 +1630,7 @@ static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int d * first get in touch with me: jfm@samba.org * ********************************************************************/ + static BOOL new_smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *string) { prs_struct *ps=&buffer->prs; @@ -1677,11 +1679,11 @@ static BOOL new_smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR return True; } - /******************************************************************* * write a array of UNICODE strings and its relative pointer. * used by 2 RPC structs ********************************************************************/ + static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16 **string) { UNISTR chaine; @@ -1709,6 +1711,8 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui while (*q!=0) q++; + /* Yes this should be malloc not talloc. Don't change. */ + chaine.buffer = malloc((q-p+1)*sizeof(uint16)); if (chaine.buffer == NULL) return False; @@ -1740,13 +1744,17 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui /* write its offset */ if (!prs_uint32("offset", ps, depth, &relative_offset)) return False; - } - else { + + } else { + + /* UNMARSHALLING */ + uint32 old_offset; uint16 *chaine2=NULL; int l_chaine=0; int l_chaine2=0; - + size_t realloc_size = 0; + *string=NULL; /* read the offset */ @@ -1768,7 +1776,11 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui an extra NULL for termination */ if (l_chaine > 0) { - if((chaine2=(uint16 *)Realloc(chaine2, (l_chaine2+l_chaine+2)*sizeof(uint16))) == NULL) + realloc_size = (l_chaine2+l_chaine+2)*sizeof(uint16); + + /* Yes this should be realloc - it's freed below. JRA */ + + if((chaine2=(uint16 *)Realloc(chaine2, realloc_size)) == NULL) return False; memcpy(chaine2+l_chaine2, chaine.buffer, (l_chaine+1)*sizeof(uint16)); l_chaine2+=l_chaine+1; @@ -1781,8 +1793,9 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui if (chaine2) { chaine2[l_chaine2] = '\0'; + *string=(uint16 *)talloc_memdup(prs_get_mem_context(ps),chaine2,realloc_size); + free(chaine2); } - *string=chaine2; if(!prs_set_offset(ps, old_offset)) return False; @@ -1790,12 +1803,11 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui return True; } - /******************************************************************* Parse a DEVMODE structure and its relative pointer. ********************************************************************/ -static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, - SEC_DESC **secdesc) + +static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, SEC_DESC **secdesc) { prs_struct *ps= &buffer->prs; @@ -1855,6 +1867,7 @@ static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, /******************************************************************* Parse a DEVMODE structure and its relative pointer. ********************************************************************/ + static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEVICEMODE **devmode) { prs_struct *ps=&buffer->prs; @@ -1904,7 +1917,7 @@ static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEV return False; /* read the string */ - if((*devmode=(DEVICEMODE *)malloc(sizeof(DEVICEMODE))) == NULL) + if((*devmode=(DEVICEMODE *)prs_alloc_mem(ps,sizeof(DEVICEMODE))) == NULL) return False; if (!spoolss_io_devmode(desc, ps, depth, *devmode)) return False; @@ -1915,10 +1928,10 @@ static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEV return True; } - /******************************************************************* Parse a PRINTER_INFO_0 structure. ********************************************************************/ + BOOL new_smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2019,6 +2032,7 @@ BOOL new_smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *i /******************************************************************* Parse a PRINTER_INFO_1 structure. ********************************************************************/ + BOOL new_smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2043,6 +2057,7 @@ BOOL new_smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *i /******************************************************************* Parse a PRINTER_INFO_2 structure. ********************************************************************/ + BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2113,6 +2128,7 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i /******************************************************************* Parse a PRINTER_INFO_3 structure. ********************************************************************/ + BOOL new_smb_io_printer_info_3(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2133,6 +2149,7 @@ BOOL new_smb_io_printer_info_3(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *i /******************************************************************* Parse a PORT_INFO_1 structure. ********************************************************************/ + BOOL new_smb_io_port_info_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2151,6 +2168,7 @@ BOOL new_smb_io_port_info_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, i /******************************************************************* Parse a PORT_INFO_2 structure. ********************************************************************/ + BOOL new_smb_io_port_info_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2177,6 +2195,7 @@ BOOL new_smb_io_port_info_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, i /******************************************************************* Parse a DRIVER_INFO_1 structure. ********************************************************************/ + BOOL new_smb_io_printer_driver_info_1(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2192,10 +2211,10 @@ BOOL new_smb_io_printer_driver_info_1(char *desc, NEW_BUFFER *buffer, DRIVER_INF return True; } - /******************************************************************* Parse a DRIVER_INFO_2 structure. ********************************************************************/ + BOOL new_smb_io_printer_driver_info_2(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2221,10 +2240,10 @@ BOOL new_smb_io_printer_driver_info_2(char *desc, NEW_BUFFER *buffer, DRIVER_INF return True; } - /******************************************************************* Parse a DRIVER_INFO_3 structure. ********************************************************************/ + BOOL new_smb_io_printer_driver_info_3(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_3 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2263,6 +2282,7 @@ BOOL new_smb_io_printer_driver_info_3(char *desc, NEW_BUFFER *buffer, DRIVER_INF /******************************************************************* Parse a DRIVER_INFO_6 structure. ********************************************************************/ + BOOL new_smb_io_printer_driver_info_6(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_6 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2324,10 +2344,10 @@ BOOL new_smb_io_printer_driver_info_6(char *desc, NEW_BUFFER *buffer, DRIVER_INF return True; } - /******************************************************************* Parse a JOB_INFO_1 structure. ********************************************************************/ + BOOL new_smb_io_job_info_1(char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2370,6 +2390,7 @@ BOOL new_smb_io_job_info_1(char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int /******************************************************************* Parse a JOB_INFO_2 structure. ********************************************************************/ + BOOL new_smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int depth) { uint pipo=0; @@ -2436,6 +2457,7 @@ BOOL new_smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int /******************************************************************* ********************************************************************/ + BOOL new_smb_io_form_1(char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2470,14 +2492,20 @@ BOOL new_smb_io_form_1(char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth) /******************************************************************* Read/write a BUFFER struct. ********************************************************************/ -static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUFFER *buffer) + +static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUFFER **pp_buffer) { - if (buffer == NULL) - return False; + NEW_BUFFER *buffer = *pp_buffer; prs_debug(ps, depth, desc, "new_spoolss_io_buffer"); depth++; + if (UNMARSHALLING(ps)) + buffer = *pp_buffer = (NEW_BUFFER *)prs_alloc_mem(ps, sizeof(NEW_BUFFER)); + + if (buffer == NULL) + return False; + if (!prs_uint32("ptr", ps, depth, &buffer->ptr)) return False; @@ -2527,7 +2555,10 @@ static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUF /******************************************************************* move a BUFFER from the query to the reply. + As the data pointers in NEW_BUFFER are malloc'ed, not talloc'ed, + this is ok. This is an OPTIMIZATION and is not strictly neccessary. ********************************************************************/ + void new_spoolss_move_buffer(NEW_BUFFER *src, NEW_BUFFER **dest) { prs_switch_type(&src->prs, MARSHALL); @@ -2538,54 +2569,19 @@ void new_spoolss_move_buffer(NEW_BUFFER *src, NEW_BUFFER **dest) *dest=src; } -/******************************************************************* - create a BUFFER struct. -********************************************************************/ -BOOL new_spoolss_allocate_buffer(NEW_BUFFER **buffer) -{ - if (buffer==NULL) - return False; - - if((*buffer=(NEW_BUFFER *)malloc(sizeof(NEW_BUFFER))) == NULL) { - DEBUG(0,("new_spoolss_allocate_buffer: malloc fail for size %u.\n", - (unsigned int)sizeof(NEW_BUFFER) )); - return False; - } - - (*buffer)->ptr=0x0; - (*buffer)->size=0; - (*buffer)->string_at_end=0; - return True; -} - -/******************************************************************* - Destroy a BUFFER struct. -********************************************************************/ -void new_spoolss_free_buffer(NEW_BUFFER *buffer) -{ - if (buffer==NULL) - return; - - prs_mem_free(&buffer->prs); - buffer->ptr=0x0; - buffer->size=0; - buffer->string_at_end=0; - - free(buffer); -} - /******************************************************************* Get the size of a BUFFER struct. ********************************************************************/ + uint32 new_get_buffer_size(NEW_BUFFER *buffer) { return (buffer->size); } - /******************************************************************* Parse a DRIVER_DIRECTORY_1 structure. ********************************************************************/ + BOOL new_smb_io_driverdir_1(char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2604,6 +2600,7 @@ BOOL new_smb_io_driverdir_1(char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 * /******************************************************************* Parse a PORT_INFO_1 structure. ********************************************************************/ + BOOL new_smb_io_port_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2622,6 +2619,7 @@ BOOL new_smb_io_port_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int de /******************************************************************* Parse a PORT_INFO_2 structure. ********************************************************************/ + BOOL new_smb_io_port_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2645,9 +2643,9 @@ BOOL new_smb_io_port_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int de return True; } - /******************************************************************* ********************************************************************/ + BOOL smb_io_printprocessor_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2665,6 +2663,7 @@ BOOL smb_io_printprocessor_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR /******************************************************************* ********************************************************************/ + BOOL smb_io_printprocdatatype_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCDATATYPE_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2682,6 +2681,7 @@ BOOL smb_io_printprocdatatype_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCDA /******************************************************************* ********************************************************************/ + BOOL smb_io_printmonitor_info_1(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2699,6 +2699,7 @@ BOOL smb_io_printmonitor_info_1(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_1 * /******************************************************************* ********************************************************************/ + BOOL smb_io_printmonitor_info_2(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2721,6 +2722,7 @@ BOOL smb_io_printmonitor_info_2(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_2 * /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_printer_info_0(PRINTER_INFO_0 *info) { int size=0; @@ -2778,6 +2780,7 @@ uint32 spoolss_size_printer_info_0(PRINTER_INFO_0 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_printer_info_1(PRINTER_INFO_1 *info) { int size=0; @@ -2793,6 +2796,7 @@ uint32 spoolss_size_printer_info_1(PRINTER_INFO_1 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) { uint32 size=0; @@ -2830,6 +2834,7 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_printer_info_3(PRINTER_INFO_3 *info) { /* The 4 is for the self relative pointer.. */ @@ -2840,6 +2845,7 @@ uint32 spoolss_size_printer_info_3(PRINTER_INFO_3 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info) { int size=0; @@ -2851,6 +2857,7 @@ uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info) { int size=0; @@ -2867,6 +2874,7 @@ uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info) /******************************************************************* return the size required by a string array. ********************************************************************/ + uint32 spoolss_size_string_array(uint16 *string) { uint32 i = 0; @@ -2884,6 +2892,7 @@ uint32 spoolss_size_string_array(uint16 *string) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) { int size=0; @@ -2906,6 +2915,7 @@ uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_printer_driver_info_6(DRIVER_INFO_6 *info) { uint32 size=0; @@ -2937,10 +2947,10 @@ uint32 spoolss_size_printer_driver_info_6(DRIVER_INFO_6 *info) return size; } - /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_job_info_1(JOB_INFO_1 *info) { int size=0; @@ -2964,6 +2974,7 @@ uint32 spoolss_size_job_info_1(JOB_INFO_1 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_job_info_2(JOB_INFO_2 *info) { int size=0; @@ -3000,6 +3011,7 @@ uint32 spoolss_size_job_info_2(JOB_INFO_2 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_form_1(FORM_1 *info) { int size=0; @@ -3019,6 +3031,7 @@ uint32 spoolss_size_form_1(FORM_1 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_port_info_1(PORT_INFO_1 *info) { int size=0; @@ -3031,6 +3044,7 @@ uint32 spoolss_size_port_info_1(PORT_INFO_1 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_driverdir_info_1(DRIVER_DIRECTORY_1 *info) { int size=0; @@ -3045,6 +3059,7 @@ uint32 spoolss_size_driverdir_info_1(DRIVER_DIRECTORY_1 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_port_info_2(PORT_INFO_2 *info) { int size=0; @@ -3062,6 +3077,7 @@ uint32 spoolss_size_port_info_2(PORT_INFO_2 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_printprocessor_info_1(PRINTPROCESSOR_1 *info) { int size=0; @@ -3073,6 +3089,7 @@ uint32 spoolss_size_printprocessor_info_1(PRINTPROCESSOR_1 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_printprocdatatype_info_1(PRINTPROCDATATYPE_1 *info) { int size=0; @@ -3084,6 +3101,7 @@ uint32 spoolss_size_printprocdatatype_info_1(PRINTPROCDATATYPE_1 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_printmonitor_info_1(PRINTMONITOR_1 *info) { int size=0; @@ -3095,6 +3113,7 @@ uint32 spoolss_size_printmonitor_info_1(PRINTMONITOR_1 *info) /******************************************************************* return the size required by a struct in the stream ********************************************************************/ + uint32 spoolss_size_printmonitor_info_2(PRINTMONITOR_2 *info) { int size=0; @@ -3108,6 +3127,7 @@ uint32 spoolss_size_printmonitor_info_2(PRINTMONITOR_2 *info) /******************************************************************* * init a structure. ********************************************************************/ + BOOL make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u, const POLICY_HND *hnd, const fstring architecture, @@ -3135,6 +3155,7 @@ BOOL make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u, * read a structure. * called from spoolss_getprinterdriver2 (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_q_getprinterdriver2(char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdriver2"); @@ -3155,7 +3176,7 @@ BOOL spoolss_io_q_getprinterdriver2(char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + if(!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if(!prs_align(ps)) @@ -3176,6 +3197,7 @@ BOOL spoolss_io_q_getprinterdriver2(char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, * read a structure. * called from spoolss_getprinterdriver2 (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriver2"); @@ -3184,7 +3206,7 @@ BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -3204,6 +3226,7 @@ BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, /******************************************************************* * init a structure. ********************************************************************/ + BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, uint32 flags, fstring servername, uint32 level, NEW_BUFFER *buffer, uint32 offered) @@ -3223,6 +3246,7 @@ BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, uint32 flags, /******************************************************************* * init a structure. ********************************************************************/ + BOOL make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS *q_u, fstring servername, uint32 level, NEW_BUFFER *buffer, uint32 offered) @@ -3241,6 +3265,7 @@ BOOL make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS *q_u, * read a structure. * called from spoolss_enumprinters (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinters"); @@ -3262,7 +3287,7 @@ BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -3276,6 +3301,7 @@ BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct /******************************************************************* Parse a SPOOL_R_ENUMPRINTERS structure. ********************************************************************/ + BOOL new_spoolss_io_r_enumprinters(char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "new_spoolss_io_r_enumprinters"); @@ -3284,7 +3310,7 @@ BOOL new_spoolss_io_r_enumprinters(char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_st if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -3307,6 +3333,7 @@ BOOL new_spoolss_io_r_enumprinters(char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_st * called from spoolss_r_enum_printers (srv_spoolss.c) * ********************************************************************/ + BOOL spoolss_io_r_getprinter(char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getprinter"); @@ -3315,7 +3342,7 @@ BOOL spoolss_io_r_getprinter(char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -3334,6 +3361,7 @@ BOOL spoolss_io_r_getprinter(char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps * read a structure. * called from spoolss_getprinter (srv_spoolss.c) ********************************************************************/ + BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_getprinter"); @@ -3347,7 +3375,7 @@ BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -3361,6 +3389,7 @@ BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps /******************************************************************* * init a structure. ********************************************************************/ + BOOL make_spoolss_q_getprinter(SPOOL_Q_GETPRINTER *q_u, const POLICY_HND *hnd, uint32 level, NEW_BUFFER *buffer, uint32 offered) { @@ -3379,6 +3408,7 @@ BOOL make_spoolss_q_getprinter(SPOOL_Q_GETPRINTER *q_u, const POLICY_HND *hnd, u /******************************************************************* ********************************************************************/ + BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setprinter"); @@ -3393,17 +3423,6 @@ BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps return True; } -/******************************************************************* - Delete the dynamic parts of a SPOOL_Q_SETPRINTER struct. -********************************************************************/ - -void free_spoolss_q_setprinter(SPOOL_Q_SETPRINTER *q_u) -{ - free_spool_printer_info_level(&q_u->info); - free_sec_desc_buf( &q_u->secdesc_ctr ); - free_devmode( q_u->devmode_ctr.devmode ); -} - /******************************************************************* Marshall/unmarshall a SPOOL_Q_SETPRINTER struct. ********************************************************************/ @@ -3466,6 +3485,7 @@ BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps /******************************************************************* ********************************************************************/ + BOOL spoolss_io_r_fcpn(char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_fcpn"); @@ -3482,6 +3502,7 @@ BOOL spoolss_io_r_fcpn(char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) /******************************************************************* ********************************************************************/ + BOOL spoolss_io_q_fcpn(char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) { @@ -3500,6 +3521,7 @@ BOOL spoolss_io_q_fcpn(char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) /******************************************************************* ********************************************************************/ + BOOL spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); @@ -3508,7 +3530,7 @@ BOOL spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int de if(!prs_align(ps)) return False; - if(!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + if(!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if(!prs_align(ps)) @@ -3525,6 +3547,7 @@ BOOL spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int de /******************************************************************* ********************************************************************/ + BOOL spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); @@ -3538,7 +3561,7 @@ BOOL spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int de if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + if(!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if(!prs_align(ps)) @@ -3552,6 +3575,7 @@ BOOL spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int de /******************************************************************* ********************************************************************/ + BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumjobs"); @@ -3560,7 +3584,7 @@ BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, in if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -3578,9 +3602,9 @@ BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, in return True; } - /******************************************************************* ********************************************************************/ + BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd, uint32 firstjob, uint32 numofjobs, @@ -3603,6 +3627,7 @@ BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd, /******************************************************************* ********************************************************************/ + BOOL spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumjobs"); @@ -3621,7 +3646,7 @@ BOOL spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, in if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_uint32("offered", ps, depth, &q_u->offered)) @@ -3632,6 +3657,7 @@ BOOL spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, in /******************************************************************* ********************************************************************/ + BOOL spoolss_io_r_schedulejob(char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_schedulejob"); @@ -3648,6 +3674,7 @@ BOOL spoolss_io_r_schedulejob(char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct * /******************************************************************* ********************************************************************/ + BOOL spoolss_io_q_schedulejob(char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_schedulejob"); @@ -3666,6 +3693,7 @@ BOOL spoolss_io_q_schedulejob(char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct * /******************************************************************* ********************************************************************/ + BOOL spoolss_io_r_setjob(char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setjob"); @@ -3682,6 +3710,7 @@ BOOL spoolss_io_r_setjob(char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int de /******************************************************************* ********************************************************************/ + BOOL spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_setjob"); @@ -3709,6 +3738,7 @@ BOOL spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int de /******************************************************************* Parse a SPOOL_R_ENUMPRINTERDRIVERS structure. ********************************************************************/ + BOOL new_spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "new_spoolss_io_r_enumprinterdrivers"); @@ -3717,7 +3747,7 @@ BOOL new_spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -3738,6 +3768,7 @@ BOOL new_spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS /******************************************************************* * init a structure. ********************************************************************/ + BOOL make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, const char *name, const char *environment, @@ -3757,6 +3788,7 @@ BOOL make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, /******************************************************************* Parse a SPOOL_Q_ENUMPRINTERDRIVERS structure. ********************************************************************/ + BOOL spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth) { @@ -3783,7 +3815,7 @@ BOOL spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -3797,6 +3829,7 @@ BOOL spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u /******************************************************************* ********************************************************************/ + BOOL spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, int depth) { @@ -3810,7 +3843,7 @@ BOOL spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -3823,6 +3856,7 @@ BOOL spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, /******************************************************************* ********************************************************************/ + BOOL new_spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "new_spoolss_io_r_enumforms"); @@ -3831,7 +3865,7 @@ BOOL new_spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct * if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -3851,6 +3885,7 @@ BOOL new_spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct * /******************************************************************* ********************************************************************/ + BOOL spoolss_io_q_getform(char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps, int depth) { @@ -3870,7 +3905,7 @@ BOOL spoolss_io_q_getform(char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps, int if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -3883,6 +3918,7 @@ BOOL spoolss_io_q_getform(char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps, int /******************************************************************* ********************************************************************/ + BOOL new_spoolss_io_r_getform(char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "new_spoolss_io_r_getform"); @@ -3891,7 +3927,7 @@ BOOL new_spoolss_io_r_getform(char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps, if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -3905,9 +3941,11 @@ BOOL new_spoolss_io_r_getform(char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps, return True; } + /******************************************************************* Parse a SPOOL_R_ENUMPORTS structure. ********************************************************************/ + BOOL new_spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "new_spoolss_io_r_enumports"); @@ -3916,7 +3954,7 @@ BOOL new_spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct * if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -3936,6 +3974,7 @@ BOOL new_spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct * /******************************************************************* ********************************************************************/ + BOOL spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); @@ -3954,7 +3993,7 @@ BOOL spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -3968,6 +4007,7 @@ BOOL spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, /******************************************************************* Parse a SPOOL_PRINTER_INFO_LEVEL_1 structure. ********************************************************************/ + BOOL spool_io_printer_info_level_1(char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level_1"); @@ -3998,6 +4038,7 @@ BOOL spool_io_printer_info_level_1(char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, p /******************************************************************* Parse a SPOOL_PRINTER_INFO_LEVEL_3 structure. ********************************************************************/ + BOOL spool_io_printer_info_level_3(char *desc, SPOOL_PRINTER_INFO_LEVEL_3 *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level_3"); @@ -4015,6 +4056,7 @@ BOOL spool_io_printer_info_level_3(char *desc, SPOOL_PRINTER_INFO_LEVEL_3 *il, p /******************************************************************* Parse a SPOOL_PRINTER_INFO_LEVEL_2 structure. ********************************************************************/ + BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level_2"); @@ -4096,6 +4138,7 @@ BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, p /******************************************************************* ********************************************************************/ + BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level"); @@ -4128,15 +4171,11 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s case 1: { if (UNMARSHALLING(ps)) { - if ((il->info_1=(SPOOL_PRINTER_INFO_LEVEL_1 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_1))) == NULL) + if ((il->info_1=(SPOOL_PRINTER_INFO_LEVEL_1 *)prs_alloc_mem(ps,sizeof(SPOOL_PRINTER_INFO_LEVEL_1))) == NULL) return False; - ZERO_STRUCTP(il->info_1); } - if (!spool_io_printer_info_level_1("", il->info_1, ps, depth)) { - if (UNMARSHALLING(ps)) - safe_free(il->info_1); + if (!spool_io_printer_info_level_1("", il->info_1, ps, depth)) return False; - } break; } /* @@ -4145,29 +4184,21 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s */ case 2: if (UNMARSHALLING(ps)) { - if ((il->info_2=(SPOOL_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2))) == NULL) + if ((il->info_2=(SPOOL_PRINTER_INFO_LEVEL_2 *)prs_alloc_mem(ps,sizeof(SPOOL_PRINTER_INFO_LEVEL_2))) == NULL) return False; - ZERO_STRUCTP(il->info_2); } - if (!spool_io_printer_info_level_2("", il->info_2, ps, depth)) { - if (UNMARSHALLING(ps)) - safe_free(il->info_2); + if (!spool_io_printer_info_level_2("", il->info_2, ps, depth)) return False; - } break; /* DOCUMENT ME!!! What is level 3 used for? */ case 3: { if (UNMARSHALLING(ps)) { - if ((il->info_3=(SPOOL_PRINTER_INFO_LEVEL_3 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_3))) == NULL) + if ((il->info_3=(SPOOL_PRINTER_INFO_LEVEL_3 *)prs_alloc_mem(ps,sizeof(SPOOL_PRINTER_INFO_LEVEL_3))) == NULL) return False; - ZERO_STRUCTP(il->info_3); } - if (!spool_io_printer_info_level_3("", il->info_3, ps, depth)) { - if (UNMARSHALLING(ps)) - safe_free(il->info_3); + if (!spool_io_printer_info_level_3("", il->info_3, ps, depth)) return False; - } break; } } @@ -4177,6 +4208,7 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s /******************************************************************* ********************************************************************/ + BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_addprinterex"); @@ -4228,6 +4260,7 @@ BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct /******************************************************************* ********************************************************************/ + BOOL spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, prs_struct *ps, int depth) { @@ -4245,6 +4278,7 @@ BOOL spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, /******************************************************************* ********************************************************************/ + BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, prs_struct *ps, int depth) { @@ -4255,10 +4289,9 @@ BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_ /* reading */ if (UNMARSHALLING(ps)) { - il=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *)malloc(sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); + il=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *)prs_alloc_mem(ps,sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); if(il == NULL) return False; - ZERO_STRUCTP(il); *q_u=il; } else { @@ -4320,19 +4353,10 @@ BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_ return True; } -void free_spool_printer_driver_info_level_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u) -{ - SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *il = *q_u; - - if (il == NULL) - return; - - safe_free(il); -} - /******************************************************************* parse a SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure ********************************************************************/ + BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u, prs_struct *ps, int depth) { @@ -4343,10 +4367,9 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ /* reading */ if (UNMARSHALLING(ps)) { - il=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *)malloc(sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6)); + il=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *)prs_alloc_mem(ps,sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6)); if(il == NULL) return False; - ZERO_STRUCTP(il); *q_u=il; } else { @@ -4483,17 +4506,6 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ return True; } -void free_spool_printer_driver_info_level_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u) -{ - SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *il = *q_u; - - if (il == NULL) - return; - - safe_free(il); -} - - /******************************************************************* convert a buffer of UNICODE strings null terminated the buffer is terminated by a NULL @@ -4531,6 +4543,7 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) and null terminated array and size of array at beginning ********************************************************************/ + BOOL smb_io_unibuffer(char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) { if (buffer==NULL) return False; @@ -4549,6 +4562,7 @@ BOOL smb_io_unibuffer(char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) /******************************************************************* ********************************************************************/ + BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level"); @@ -4580,25 +4594,11 @@ BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LE return True; } -void free_spool_printer_driver_info_level(SPOOL_PRINTER_DRIVER_INFO_LEVEL *il) -{ - if (il->ptr==0) - return; - - switch (il->level) { - case 3: - free_spool_printer_driver_info_level_3(&il->info_3); - break; - case 6: - free_spool_printer_driver_info_level_6(&il->info_6); - break; - } -} - /******************************************************************* init a SPOOL_Q_ADDPRINTERDRIVER struct ******************************************************************/ -BOOL make_spoolss_q_addprinterdriver(SPOOL_Q_ADDPRINTERDRIVER *q_u, + +BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *ctx, SPOOL_Q_ADDPRINTERDRIVER *q_u, const char* srv_name, uint32 level, PRINTER_DRIVER_CTR *info) { @@ -4617,8 +4617,8 @@ BOOL make_spoolss_q_addprinterdriver(SPOOL_Q_ADDPRINTERDRIVER *q_u, WinNT and Win2k */ case 3 : q_u->info.info_3=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3*) - malloc(sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); - make_spool_driver_info_3(q_u->info.info_3, info->info3); + talloc_zero(ctx, sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); + make_spool_driver_info_3(ctx,q_u->info.info_3, info->info3); break; /* info level 6 is supported by WinME and Win2k */ @@ -4635,7 +4635,7 @@ info level [%d]\n", level)); return True; } -BOOL make_spool_driver_info_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *spool_drv_info, +BOOL make_spool_driver_info_3(TALLOC_CTX *ctx, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *spool_drv_info, DRIVER_INFO_3 *info3) { uint32 len = 0; @@ -4685,29 +4685,21 @@ BOOL make_spool_driver_info_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *spool_drv_info, } spool_drv_info->dependentfiles_ptr = (info3->dependentfiles!=NULL)?1:0; spool_drv_info->dependentfilessize = len; - make_spool_buffer5(&spool_drv_info->dependentfiles, len, info3->dependentfiles); + if(!make_spool_buffer5(ctx, &spool_drv_info->dependentfiles, len, info3->dependentfiles)) + return False; return True; } -void free_spool_driver_info_3 (SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *info) -{ - if (info != NULL) - { - free_spool_buffer5(&info->dependentfiles); - } - - return; -} - /******************************************************************* make a BUFFER5 struct from a uint16* ******************************************************************/ -BOOL make_spool_buffer5(BUFFER5 *buf5, uint32 len, uint16 *src) + +BOOL make_spool_buffer5(TALLOC_CTX *ctx, BUFFER5 *buf5, uint32 len, uint16 *src) { buf5->buf_len = len; - if((buf5->buffer=(uint16*)malloc(sizeof(uint16)*len)) == NULL) + if((buf5->buffer=(uint16*)talloc(ctx, sizeof(uint16)*len)) == NULL) { DEBUG(0,("make_spool_buffer5: Unable to malloc memory for buffer!\n")); return False; @@ -4718,21 +4710,10 @@ BOOL make_spool_buffer5(BUFFER5 *buf5, uint32 len, uint16 *src) return True; } - -void free_spool_buffer5(BUFFER5 *buf) -{ - if (buf != NULL) - { - free(buf->buffer); - buf->buffer = NULL; - } - - return; -} - /******************************************************************* fill in the prs_struct for a ADDPRINTERDRIVER request PDU ********************************************************************/ + BOOL spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_addprinterdriver"); @@ -4758,16 +4739,8 @@ BOOL spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, pr } /******************************************************************* - Free the dynamic parts of a printer driver. ********************************************************************/ -void free_spoolss_q_addprinterdriver(SPOOL_Q_ADDPRINTERDRIVER *q_u) -{ - free_spool_printer_driver_info_level(&q_u->info); -} - -/******************************************************************* -********************************************************************/ BOOL spoolss_io_r_addprinterdriver(char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addprinterdriver"); @@ -4779,9 +4752,9 @@ BOOL spoolss_io_r_addprinterdriver(char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, pr return True; } - /******************************************************************* ********************************************************************/ + BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, NT_PRINTER_DRIVER_INFO_LEVEL_3 **asc) { @@ -4924,6 +4897,7 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, /******************************************************************* * init a structure. ********************************************************************/ + BOOL make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR *q_u, fstring servername, fstring env_name, uint32 level, NEW_BUFFER *buffer, uint32 offered) @@ -4931,17 +4905,17 @@ BOOL make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR *q_u, init_buf_unistr2(&q_u->name, &q_u->name_ptr, servername); init_buf_unistr2(&q_u->environment, &q_u->environment_ptr, env_name); - q_u->level=level; - q_u->buffer=buffer; - q_u->offered=offered; + q_u->level=level; + q_u->buffer=buffer; + q_u->offered=offered; - return True; + return True; } - /******************************************************************* Parse a SPOOL_Q_GETPRINTERDRIVERDIR structure. ********************************************************************/ + BOOL spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdriverdir"); @@ -4968,7 +4942,7 @@ BOOL spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + if(!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if(!prs_align(ps)) @@ -4983,6 +4957,7 @@ BOOL spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q /******************************************************************* Parse a SPOOL_R_GETPRINTERDRIVERDIR structure. ********************************************************************/ + BOOL spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriverdir"); @@ -4991,7 +4966,7 @@ BOOL spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -5008,6 +4983,7 @@ BOOL spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r /******************************************************************* ********************************************************************/ + BOOL spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocessors"); @@ -5016,7 +4992,7 @@ BOOL spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -5036,6 +5012,7 @@ BOOL spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r /******************************************************************* ********************************************************************/ + BOOL spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprintprocessors"); @@ -5063,7 +5040,7 @@ BOOL spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + if(!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -5077,6 +5054,7 @@ BOOL spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q /******************************************************************* ********************************************************************/ + BOOL spoolss_io_r_enumprintprocdatatypes(char *desc, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocdatatypes"); @@ -5085,7 +5063,7 @@ BOOL spoolss_io_r_enumprintprocdatatypes(char *desc, SPOOL_R_ENUMPRINTPROCDATATY if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -5105,6 +5083,7 @@ BOOL spoolss_io_r_enumprintprocdatatypes(char *desc, SPOOL_R_ENUMPRINTPROCDATATY /******************************************************************* ********************************************************************/ + BOOL spoolss_io_q_enumprintprocdatatypes(char *desc, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprintprocdatatypes"); @@ -5132,7 +5111,7 @@ BOOL spoolss_io_q_enumprintprocdatatypes(char *desc, SPOOL_Q_ENUMPRINTPROCDATATY if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!new_spoolss_io_buffer("buffer", ps, depth, q_u->buffer)) + if(!new_spoolss_io_buffer("buffer", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -5147,6 +5126,7 @@ BOOL spoolss_io_q_enumprintprocdatatypes(char *desc, SPOOL_Q_ENUMPRINTPROCDATATY /******************************************************************* Parse a SPOOL_Q_ENUMPRINTMONITORS structure. ********************************************************************/ + BOOL spoolss_io_q_enumprintmonitors(char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprintmonitors"); @@ -5166,7 +5146,7 @@ BOOL spoolss_io_q_enumprintmonitors(char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + if(!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -5180,6 +5160,7 @@ BOOL spoolss_io_q_enumprintmonitors(char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, /******************************************************************* ********************************************************************/ + BOOL spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprintmonitors"); @@ -5188,7 +5169,7 @@ BOOL spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -5208,6 +5189,7 @@ BOOL spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, /******************************************************************* ********************************************************************/ + BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdata"); @@ -5253,6 +5235,7 @@ BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_ /******************************************************************* ********************************************************************/ + BOOL spoolss_io_q_enumprinterdata(char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdata"); @@ -5274,6 +5257,7 @@ BOOL spoolss_io_q_enumprinterdata(char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_ /******************************************************************* ********************************************************************/ + BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, const POLICY_HND *hnd, uint32 idx, uint32 valuelen, uint32 datalen) @@ -5288,6 +5272,7 @@ BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, /******************************************************************* ********************************************************************/ + BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_setprinterdata"); @@ -5315,7 +5300,8 @@ BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_st case 0x3: case 0x4: case 0x7: - q_u->data=(uint8 *)malloc(q_u->max_len * sizeof(uint8)); + if (UNMARSHALLING(ps)) + q_u->data=(uint8 *)prs_alloc_mem(ps, q_u->max_len * sizeof(uint8)); if(q_u->data == NULL) return False; if(!prs_uint8s(False,"data", ps, depth, q_u->data, q_u->max_len)) @@ -5331,13 +5317,9 @@ BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_st return True; } -void free_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u) -{ - safe_free(q_u->data); -} - /******************************************************************* ********************************************************************/ + BOOL spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setprinterdata"); @@ -5351,9 +5333,9 @@ BOOL spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_st return True; } - /******************************************************************* ********************************************************************/ + BOOL convert_specific_param(NT_PRINTER_PARAM **param, const UNISTR2 *value, uint32 type, const uint8 *data, uint32 len) { @@ -5389,6 +5371,7 @@ BOOL convert_specific_param(NT_PRINTER_PARAM **param, const UNISTR2 *value, /******************************************************************* ********************************************************************/ + static BOOL spoolss_io_addform(char *desc, FORM *f, uint32 ptr, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_addform"); @@ -5424,6 +5407,7 @@ static BOOL spoolss_io_addform(char *desc, FORM *f, uint32 ptr, prs_struct *ps, /******************************************************************* ********************************************************************/ + BOOL spoolss_io_q_deleteform(char *desc, SPOOL_Q_DELETEFORM *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_deleteform"); @@ -5441,6 +5425,7 @@ BOOL spoolss_io_q_deleteform(char *desc, SPOOL_Q_DELETEFORM *q_u, prs_struct *ps /******************************************************************* ********************************************************************/ + BOOL spoolss_io_r_deleteform(char *desc, SPOOL_R_DELETEFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteform"); @@ -5456,6 +5441,7 @@ BOOL spoolss_io_r_deleteform(char *desc, SPOOL_R_DELETEFORM *r_u, prs_struct *ps /******************************************************************* ********************************************************************/ + BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth) { uint32 useless_ptr=0; @@ -5484,6 +5470,7 @@ BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int /******************************************************************* ********************************************************************/ + BOOL spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addform"); @@ -5499,6 +5486,7 @@ BOOL spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int /******************************************************************* ********************************************************************/ + BOOL spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth) { uint32 useless_ptr=0; @@ -5533,6 +5521,7 @@ BOOL spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int /******************************************************************* ********************************************************************/ + BOOL spoolss_io_r_setform(char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setform"); @@ -5549,6 +5538,7 @@ BOOL spoolss_io_r_setform(char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int /******************************************************************* Parse a SPOOL_R_GETJOB structure. ********************************************************************/ + BOOL spoolss_io_r_getjob(char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getjob"); @@ -5557,7 +5547,7 @@ BOOL spoolss_io_r_getjob(char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int de if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, r_u->buffer)) + if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -5575,6 +5565,7 @@ BOOL spoolss_io_r_getjob(char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int de /******************************************************************* Parse a SPOOL_Q_GETJOB structure. ********************************************************************/ + BOOL spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); @@ -5590,7 +5581,7 @@ BOOL spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int de if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!new_spoolss_io_buffer("", ps, depth, q_u->buffer)) + if(!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if(!prs_align(ps)) @@ -5620,8 +5611,6 @@ void free_printer_info_2(PRINTER_INFO_2 *printer) if (printer!=NULL) { free_devmode(printer->devmode); printer->devmode = NULL; - if (printer->secdesc != NULL) - free_sec_desc(&printer->secdesc); safe_free(printer); } } @@ -5629,51 +5618,10 @@ void free_printer_info_2(PRINTER_INFO_2 *printer) void free_printer_info_3(PRINTER_INFO_3 *printer) { if (printer!=NULL) { - if (printer->secdesc != NULL) - free_sec_desc(&printer->secdesc); safe_free(printer); } } -void free_spool_printer_info_1(SPOOL_PRINTER_INFO_LEVEL_1 *printer) -{ - safe_free(printer); -} - -void free_spool_printer_info_2(SPOOL_PRINTER_INFO_LEVEL_2 *printer) -{ - if (printer!=NULL) { - if (printer->secdesc != NULL) - free_sec_desc_buf(&printer->secdesc); - safe_free(printer); - } -} - -void free_spool_printer_info_3(SPOOL_PRINTER_INFO_LEVEL_3 *printer) -{ - safe_free(printer); -} - -void free_spool_printer_info_level(SPOOL_PRINTER_INFO_LEVEL *pil) -{ - if (pil == NULL) - return; - - switch (pil->level) { - case 1: - free_spool_printer_info_1(pil->info_1); - break; - case 2: - free_spool_printer_info_2(pil->info_2); - break; - case 3: - free_spool_printer_info_3(pil->info_3); - break; - default: - break; - } -} - static PRINTER_INFO_2 *prt2_dup(const PRINTER_INFO_2* from) { PRINTER_INFO_2 *copy = (PRINTER_INFO_2 *)malloc(sizeof(PRINTER_INFO_2)); @@ -5797,6 +5745,7 @@ JOB_INFO_2 *add_job2_to_array(uint32 *len, JOB_INFO_2 ***array, /******************************************************************* * init a structure. ********************************************************************/ + BOOL make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER *q_u, const fstring string, uint32 printer, uint32 type) { @@ -5817,6 +5766,7 @@ BOOL make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER *q_u, /******************************************************************* Parse a SPOOL_Q_REPLYOPENPRINTER structure. ********************************************************************/ + BOOL spoolss_io_q_replyopenprinter(char *desc, SPOOL_Q_REPLYOPENPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_replyopenprinter"); @@ -5847,6 +5797,7 @@ BOOL spoolss_io_q_replyopenprinter(char *desc, SPOOL_Q_REPLYOPENPRINTER *q_u, pr /******************************************************************* Parse a SPOOL_R_REPLYOPENPRINTER structure. ********************************************************************/ + BOOL spoolss_io_r_replyopenprinter(char *desc, SPOOL_R_REPLYOPENPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_replyopenprinter"); @@ -5867,6 +5818,7 @@ BOOL spoolss_io_r_replyopenprinter(char *desc, SPOOL_R_REPLYOPENPRINTER *r_u, pr /******************************************************************* * init a structure. ********************************************************************/ + BOOL make_spoolss_q_reply_closeprinter(SPOOL_Q_REPLYCLOSEPRINTER *q_u, POLICY_HND *hnd) { if (q_u == NULL) @@ -5880,6 +5832,7 @@ BOOL make_spoolss_q_reply_closeprinter(SPOOL_Q_REPLYCLOSEPRINTER *q_u, POLICY_HN /******************************************************************* Parse a SPOOL_Q_REPLYCLOSEPRINTER structure. ********************************************************************/ + BOOL spoolss_io_q_replycloseprinter(char *desc, SPOOL_Q_REPLYCLOSEPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_replycloseprinter"); @@ -5897,6 +5850,7 @@ BOOL spoolss_io_q_replycloseprinter(char *desc, SPOOL_Q_REPLYCLOSEPRINTER *q_u, /******************************************************************* Parse a SPOOL_R_REPLYCLOSEPRINTER structure. ********************************************************************/ + BOOL spoolss_io_r_replycloseprinter(char *desc, SPOOL_R_REPLYCLOSEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_replycloseprinter"); @@ -5917,6 +5871,7 @@ BOOL spoolss_io_r_replycloseprinter(char *desc, SPOOL_R_REPLYCLOSEPRINTER *r_u, /******************************************************************* * init a structure. ********************************************************************/ + BOOL make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd, uint32 change_low, uint32 change_high) { @@ -5943,6 +5898,7 @@ BOOL make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd, /******************************************************************* Parse a SPOOL_Q_REPLY_RRPCN structure. ********************************************************************/ + BOOL spoolss_io_q_reply_rrpcn(char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_reply_rrpcn"); @@ -5979,6 +5935,7 @@ BOOL spoolss_io_q_reply_rrpcn(char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct * /******************************************************************* Parse a SPOOL_R_REPLY_RRPCN structure. ********************************************************************/ + BOOL spoolss_io_r_reply_rrpcn(char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_replycloseprinter"); -- cgit From c014d3b709c0c71f6a092069f88854ee3f5387d3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 1 Mar 2001 00:40:25 +0000 Subject: Remove unused code. Jeremy. (This used to be commit 3495d5cc3ba0f380fc78389b9ba17235ccd97ae4) --- source3/rpc_parse/parse_spoolss.c | 120 +------------------------------------- 1 file changed, 3 insertions(+), 117 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index fb4150b2ce..0a4375c1d4 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4701,7 +4701,7 @@ BOOL make_spool_buffer5(TALLOC_CTX *ctx, BUFFER5 *buf5, uint32 len, uint16 *src) buf5->buf_len = len; if((buf5->buffer=(uint16*)talloc(ctx, sizeof(uint16)*len)) == NULL) { - DEBUG(0,("make_spool_buffer5: Unable to malloc memory for buffer!\n")); + DEBUG(0,("make_spool_buffer5: Unable to talloc memory for buffer!\n")); return False; } @@ -5622,124 +5622,10 @@ void free_printer_info_3(PRINTER_INFO_3 *printer) } } -static PRINTER_INFO_2 *prt2_dup(const PRINTER_INFO_2* from) -{ - PRINTER_INFO_2 *copy = (PRINTER_INFO_2 *)malloc(sizeof(PRINTER_INFO_2)); - if (copy != NULL) { - if (from != NULL) - memcpy(copy, from, sizeof(*copy)); - else - ZERO_STRUCTP(copy); - } - return copy; -} - -void free_print2_array(uint32 num_entries, PRINTER_INFO_2 **entries) -{ - void(*fn)(void*) = (void(*)(void*))&free_printer_info_2; - free_void_array(num_entries, (void**)entries, *fn); -} - -PRINTER_INFO_2 *add_print2_to_array(uint32 *len, PRINTER_INFO_2 ***array, - const PRINTER_INFO_2 *prt) -{ - void*(*fn)(const void*) = (void*(*)(const void*))&prt2_dup; - return (PRINTER_INFO_2*)add_copy_to_array(len, - (void***)array, (const void*)prt, *fn, True); -} - -static PRINTER_INFO_1 *prt1_dup(const PRINTER_INFO_1* from) -{ - PRINTER_INFO_1 *copy = (PRINTER_INFO_1 *)malloc(sizeof(PRINTER_INFO_1)); - if (copy != NULL) { - if (from != NULL) - memcpy(copy, from, sizeof(*copy)); - else - ZERO_STRUCTP(copy); - } - return copy; -} - -void free_print1_array(uint32 num_entries, PRINTER_INFO_1 **entries) -{ - void(*fn)(void*) = (void(*)(void*))&free; - free_void_array(num_entries, (void**)entries, *fn); -} - -PRINTER_INFO_1 *add_print1_to_array(uint32 *len, PRINTER_INFO_1 ***array, - const PRINTER_INFO_1 *prt) -{ - void*(*fn)(const void*) = (void*(*)(const void*))&prt1_dup; - return (PRINTER_INFO_1*)add_copy_to_array(len, - (void***)array, (const void*)prt, *fn, True); -} - -static JOB_INFO_1 *job1_dup(const JOB_INFO_1* from) -{ - JOB_INFO_1 *copy = (JOB_INFO_1 *)malloc(sizeof(JOB_INFO_1)); - if (copy != NULL) - { - if (from != NULL) - { - memcpy(copy, from, sizeof(*copy)); - } - else - { - ZERO_STRUCTP(copy); - } - } - return copy; -} - -void free_job1_array(uint32 num_entries, JOB_INFO_1 **entries) -{ - void(*fn)(void*) = (void(*)(void*))&free; - free_void_array(num_entries, (void**)entries, *fn); -} - -JOB_INFO_1 *add_job1_to_array(uint32 *len, JOB_INFO_1 ***array, - const JOB_INFO_1 *job) -{ - void*(*fn)(const void*) = (void*(*)(const void*))&job1_dup; - return (JOB_INFO_1*)add_copy_to_array(len, - (void***)array, (const void*)job, *fn, True); -} - -static JOB_INFO_2 *job2_dup(const JOB_INFO_2* from) -{ - JOB_INFO_2 *copy = (JOB_INFO_2 *)malloc(sizeof(JOB_INFO_2)); - if (copy != NULL) - { - if (from != NULL) - { - memcpy(copy, from, sizeof(*copy)); - } - else - { - ZERO_STRUCTP(copy); - } - } - return copy; -} - void free_job_info_2(JOB_INFO_2 *job) { - if (job!=NULL) - free_devmode(job->devmode); -} - -void free_job2_array(uint32 num_entries, JOB_INFO_2 **entries) -{ - void(*fn)(void*) = (void(*)(void*))&free_job_info_2; - free_void_array(num_entries, (void**)entries, *fn); -} - -JOB_INFO_2 *add_job2_to_array(uint32 *len, JOB_INFO_2 ***array, - const JOB_INFO_2 *job) -{ - void*(*fn)(const void*) = (void*(*)(const void*))&job2_dup; - return (JOB_INFO_2*)add_copy_to_array(len, - (void***)array, (const void*)job, *fn, True); + if (job!=NULL) + free_devmode(job->devmode); } /******************************************************************* -- cgit From 7d853615338e4c81a2204f57a7fc22da725f55fe Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 1 Mar 2001 03:04:13 +0000 Subject: rpc_parse/parse_spoolss.c: Fixed memory leak introduced by restructuring. rpc_server/srv_spoolss_nt.c: Fixed problem with printer snum being read uninitialised. Jeremy. (This used to be commit 1552db715da576b41060f0d31d2c4cdec790c1d4) --- source3/rpc_parse/parse_spoolss.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 0a4375c1d4..3774a91100 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2540,16 +2540,28 @@ static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUF return True; } else { + BOOL ret = False; + /* writing */ - if (buffer->ptr==0) + if (buffer->ptr==0) { + /* We have finished with the data in buffer->prs - free it. */ + prs_mem_free(&buffer->prs); return True; - + } + if (!prs_uint32("size", ps, depth, &buffer->size)) - return False; + goto out; + if (!prs_append_some_prs_data(ps, &buffer->prs, 0, buffer->size)) - return False; + goto out; - return True; + ret = True; + out: + + /* We have finished with the data in buffer->prs - free it. */ + prs_mem_free(&buffer->prs); + + return ret; } } -- cgit From e9f555e4bd0c778e40f9661562806fb52dc421d9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 2 Mar 2001 19:29:02 +0000 Subject: Merged JF's fixes into HEAD. These are for string parsing and SAMR fixes. Jeremy. (This used to be commit c3a1904564175a7a5cf71e88540b96f7daa59730) --- source3/rpc_parse/parse_prs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 56d03daf18..1ec3f72d4c 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -673,16 +673,16 @@ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 * if (q == NULL) return False; + /* If the string is empty, we don't have anything to stream */ + if (str->uni_str_len==0) + return True; + if (UNMARSHALLING(ps)) { str->buffer = (uint16 *)prs_alloc_mem(ps,str->uni_max_len * sizeof(uint16)); if (str->buffer == NULL) return False; } - /* If the string is empty, we don't have anything to stream */ - if (str->uni_str_len==0) - return True; - p = (char *)str->buffer; /* If we're using big-endian, reverse to get little-endian. */ -- cgit From 393bede7db6af546431cd5255e465b7b7b0e7c81 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 7 Mar 2001 23:59:13 +0000 Subject: Sync up handle creation with 2.2 branch. We can now join AS/U domains and authenticate against them. Big/little endian issues fixed. Jeremy. (This used to be commit 0e6a34510ed598eaec7fe71a9c91fda528a4675c) --- source3/rpc_parse/parse_misc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 0a65c09493..81602a1dc4 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1438,8 +1438,19 @@ BOOL smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth) if(!prs_align(ps)) return False; + + if(UNMARSHALLING(ps)) + ZERO_STRUCTP(pol); - if(!prs_uint8s (False, "data", ps, depth, pol->data, POL_HND_SIZE)) + if (!prs_uint32("data1", ps, depth, &pol->data1)) + return False; + if (!prs_uint32("data2", ps, depth, &pol->data2)) + return False; + if (!prs_uint16("data3", ps, depth, &pol->data3)) + return False; + if (!prs_uint16("data4", ps, depth, &pol->data4)) + return False; + if(!prs_uint8s (False, "data5", ps, depth, pol->data5, sizeof(pol->data5))) return False; return True; -- cgit From 00ab9021b0cc5fe2667d383eb9cc2973072cdaaa Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 9 Mar 2001 23:48:58 +0000 Subject: Serious (and I *mean* serious) attempt to fix little/bigendian RPC issues. We were reading the endainness in the RPC header and then never propagating it to the internal parse_structs used to parse the data. Also removed the "align" argument to prs_init as it was *always* set to 4, and if needed can be set differently on a case by case basis. Now ready for AS/U testing when Herb gets it set up :-). Jeremy. (This used to be commit 0cd37c831d79a12a10e479bf4fa89ffe64c1292a) --- source3/rpc_parse/parse_creds.c | 4 ++-- source3/rpc_parse/parse_prs.c | 14 +++++++------- source3/rpc_parse/parse_rpc.c | 4 ++-- source3/rpc_parse/parse_spoolss.c | 14 ++++++++++++-- 4 files changed, 23 insertions(+), 13 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c index 05b33d4da7..7bdbe65880 100644 --- a/source3/rpc_parse/parse_creds.c +++ b/source3/rpc_parse/parse_creds.c @@ -597,7 +597,7 @@ BOOL create_ntuser_creds( prs_struct *ps, usr.ptr_ntc = 0; } - prs_init(ps, 1024, 4, NULL, False); + prs_init(ps, 1024, NULL, MARSHALL); ps->data_offset = 4; return creds_io_cmd("creds", &cmd, ps, 0); @@ -623,7 +623,7 @@ BOOL create_user_creds( prs_struct *ps, cmd.ptr_creds = usr != NULL ? 1 : 0; cmd.cred = usr; - prs_init(ps, 1024, 4, NULL, False); + prs_init(ps, 1024, NULL, MARSHALL); ps->data_offset = 4; return creds_io_cmd("creds", &cmd, ps, 0); diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 1ec3f72d4c..84ccbd5db6 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -67,12 +67,12 @@ void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name) /******************************************************************* Initialise a parse structure - malloc the data if requested. ********************************************************************/ -BOOL prs_init(prs_struct *ps, uint32 size, uint8 align, TALLOC_CTX *ctx, BOOL io) +BOOL prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, BOOL io) { ZERO_STRUCTP(ps); ps->io = io; - ps->bigendian_data = False; - ps->align = align; + ps->bigendian_data = RPC_LITTLE_ENDIAN; + ps->align = RPC_PARSE_ALIGN; ps->is_dynamic = False; ps->data_offset = 0; ps->buffer_size = 0; @@ -387,12 +387,12 @@ BOOL prs_append_data(prs_struct *dst, char *src, uint32 len) } /******************************************************************* - Set the data as big-endian (external interface). + Set the data as X-endian (external interface). ********************************************************************/ -void prs_set_bigendian_data(prs_struct *ps) +void prs_set_endian_data(prs_struct *ps, BOOL endian) { - ps->bigendian_data = True; + ps->bigendian_data = endian; } /******************************************************************* @@ -1010,7 +1010,7 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *me if (!dbuf.dptr) return -1; ZERO_STRUCTP(ps); - prs_init(ps, 0, 4, mem_ctx, UNMARSHALL); + prs_init(ps, 0, mem_ctx, UNMARSHALL); prs_give_memory(ps, dbuf.dptr, dbuf.dsize, True); return 0; diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index c40de10445..9fe893d4be 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -203,7 +203,7 @@ BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) if (ps->io && rpc->pack_type[0] == 0) { DEBUG(10,("smb_io_rpc_hdr: PDU data format is big-endian. Setting flag.\n")); - prs_set_bigendian_data(ps); + prs_set_endian_data(ps, RPC_BIG_ENDIAN); } if(!prs_uint16("frag_len ", ps, depth, &rpc->frag_len)) @@ -239,7 +239,7 @@ static BOOL smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int dep if(!prs_uint8s (False, "data ", ps, depth, ifc->uuid.remaining, sizeof(ifc->uuid.remaining))) return False; - if(!prs_uint32 ( "version", ps, depth, &(ifc->version))) + if(!prs_uint32 ( "version", ps, depth, &ifc->version)) return False; return True; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 3774a91100..0073f22cab 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2515,7 +2515,12 @@ static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUF buffer->string_at_end=0; if (buffer->ptr==0) { - if (!prs_init(&buffer->prs, 0, 4, prs_get_mem_context(ps), UNMARSHALL)) + /* + * JRA. I'm not sure if the data in here is in big-endian format if + * the client is big-endian. Leave as default (little endian) for now. + */ + + if (!prs_init(&buffer->prs, 0, prs_get_mem_context(ps), UNMARSHALL)) return False; return True; } @@ -2523,7 +2528,12 @@ static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUF if (!prs_uint32("size", ps, depth, &buffer->size)) return False; - if (!prs_init(&buffer->prs, buffer->size, 4, prs_get_mem_context(ps), UNMARSHALL)) + /* + * JRA. I'm not sure if the data in here is in big-endian format if + * the client is big-endian. Leave as default (little endian) for now. + */ + + if (!prs_init(&buffer->prs, buffer->size, prs_get_mem_context(ps), UNMARSHALL)) return False; if (!prs_append_some_prs_data(&buffer->prs, ps, prs_offset(ps), buffer->size)) -- cgit From da3053048c3d224a20d6383ac6682d31059cd46c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sun, 11 Mar 2001 00:32:10 +0000 Subject: Merge of new 2.2 code into HEAD (Gerald I hate you :-) :-). Allows new SAMR RPC code to merge with new passdb code. Currently rpcclient doesn't compile. I'm working on it... Jeremy. (This used to be commit 0be41d5158ea4e645e93e8cd30617c038416e549) --- source3/rpc_parse/parse_dfs.c | 2 +- source3/rpc_parse/parse_lsa.c | 17 +- source3/rpc_parse/parse_net.c | 38 +- source3/rpc_parse/parse_samr.c | 7058 +++++++++++++++++++++++-------------- source3/rpc_parse/parse_spoolss.c | 1 + source3/rpc_parse/parse_srv.c | 65 +- 6 files changed, 4572 insertions(+), 2609 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index e1d88ab509..6bae2ae4a6 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -411,7 +411,7 @@ BOOL dfs_io_dfs_info_ctr(char* desc, DFS_INFO_CTR* ctr, uint32 num_entries, uint return False; if(!prs_uint32("ptr_comment", ps, depth, &ctr->dfs.info3[i].ptr_comment)) return False; - if(!prs_uint32("state", ps, depth, &ctr->dfs.info3[i].state)); + if(!prs_uint32("state", ps, depth, &ctr->dfs.info3[i].state)) return False; if(!prs_uint32("num_storages", ps, depth, &ctr->dfs.info3[i].num_storages)) return False; diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index d86df0ee11..98ef3fd0ee 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -591,17 +591,16 @@ BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, num_domains = r_e->num_domains2; - if (!(r_e->hdr_domain_name = (UNIHDR2 *) - malloc(sizeof(UNIHDR2) * num_domains))) - return False; + if (UNMARSHALLING(ps)) { + if (!(r_e->hdr_domain_name = (UNIHDR2 *)prs_alloc_mem(ps,sizeof(UNIHDR2) * num_domains))) + return False; - if (!(r_e->uni_domain_name = (UNISTR2 *) - malloc(sizeof(UNISTR2) * num_domains))) - return False; + if (!(r_e->uni_domain_name = (UNISTR2 *)prs_alloc_mem(ps,sizeof(UNISTR2) * num_domains))) + return False; - if (!(r_e->domain_sid = (DOM_SID2 *) - malloc(sizeof(DOM_SID2) * num_domains))) - return False; + if (!(r_e->domain_sid = (DOM_SID2 *)prs_alloc_mem(ps,sizeof(DOM_SID2) * num_domains))) + return False; + } for (i = 0; i < num_domains; i++) { if(!smb_io_unihdr2 ("", &r_e->hdr_domain_name[i], ps, diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index bde8c01240..f1ff965df2 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -627,7 +627,7 @@ BOOL net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int de Init DOM_SID2 array from a string containing multiple sids *************************************************************************/ -static int init_dom_sid2s(char *sids_str, DOM_SID2 **ppsids) +static int init_dom_sid2s(TALLOC_CTX *ctx, char *sids_str, DOM_SID2 **ppsids) { char *ptr; pstring s2; @@ -647,7 +647,7 @@ static int init_dom_sid2s(char *sids_str, DOM_SID2 **ppsids) ; /* Now allocate space for them. */ - *ppsids = (DOM_SID2 *)malloc(count * sizeof(DOM_SID2)); + *ppsids = (DOM_SID2 *)talloc_zero(ctx, count * sizeof(DOM_SID2)); if (*ppsids == NULL) return 0; @@ -936,14 +936,22 @@ void init_sam_info(DOM_SAM_INFO *sam, Reads or writes a DOM_SAM_INFO structure. ********************************************************************/ -static BOOL net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR **pp_ctr, prs_struct *ps, int depth) { - if (ctr == NULL) - return False; + NET_ID_INFO_CTR *ctr = *pp_ctr; prs_debug(ps, depth, desc, "smb_io_sam_info"); depth++; + if (UNMARSHALLING(ps)) { + ctr = *pp_ctr = (NET_ID_INFO_CTR *)prs_alloc_mem(ps, sizeof(NET_ID_INFO_CTR)); + 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)) @@ -993,8 +1001,8 @@ static BOOL smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int d if(!prs_uint16("logon_level ", ps, depth, &sam->logon_level)) return False; - if (sam->logon_level != 0 && sam->ctr != NULL) { - if(!net_io_id_info_ctr("logon_info", sam->ctr, ps, depth)) + if (sam->logon_level != 0) { + if(!net_io_id_info_ctr("logon_info", &sam->ctr, ps, depth)) return False; } @@ -1005,7 +1013,7 @@ static BOOL smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int d Init *************************************************************************/ -void init_net_user_info3(NET_USER_INFO_3 *usr, SAM_ACCOUNT *sampw, +void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sampw, uint16 logon_count, uint16 bad_pw_count, uint32 num_groups, DOM_GID *gids, uint32 user_flgs, char *sess_key, @@ -1090,7 +1098,7 @@ void init_net_user_info3(NET_USER_INFO_3 *usr, SAM_ACCOUNT *sampw, memset((char *)usr->padding, '\0', sizeof(usr->padding)); - num_other_sids = init_dom_sid2s(other_sids, &usr->other_sids); + num_other_sids = init_dom_sid2s(ctx, other_sids, &usr->other_sids); usr->num_other_sids = num_other_sids; usr->buffer_other_sids = (num_other_sids != 0) ? 1 : 0; @@ -1105,7 +1113,7 @@ void init_net_user_info3(NET_USER_INFO_3 *usr, SAM_ACCOUNT *sampw, usr->num_groups2 = num_groups; if (num_groups > 0) { - usr->gids = (DOM_GID *)malloc(sizeof(DOM_GID) * num_groups); + usr->gids = (DOM_GID *)talloc_zero(ctx,sizeof(DOM_GID) * num_groups); if (usr->gids == NULL) return; for (i = 0; i < num_groups; i++) @@ -1119,16 +1127,6 @@ void init_net_user_info3(NET_USER_INFO_3 *usr, SAM_ACCOUNT *sampw, /* "other" sids are set up above */ } -/******************************************************************* - Delete any memory allocated by init_user_info_3... -********************************************************************/ - -void free_user_info3(NET_USER_INFO_3 *usr) -{ - safe_free(usr->gids); - safe_free(usr->other_sids); -} - /******************************************************************* 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. diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 462c9ed199..5cfa84ff3d 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1,11 +1,12 @@ -#define OLD_NTDOMAIN 1 /* * Unix SMB/Netbios implementation. * Version 1.9. * 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 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 * * 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 @@ -22,26 +23,31 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + #include "includes.h" +#include "rpc_parse.h" +#include "rpc_client.h" +#include "nterr.h" extern int DEBUGLEVEL; /******************************************************************* - Inits a SAMR_Q_CLOSE_HND structure. +inits a SAMR_Q_CLOSE_HND structure. ********************************************************************/ -void init_samr_q_close_hnd(SAMR_Q_CLOSE_HND *q_c, POLICY_HND *hnd) +void init_samr_q_close_hnd(SAMR_Q_CLOSE_HND * q_c, POLICY_HND *hnd) { - DEBUG(5,("init_samr_q_close_hnd\n")); - - memcpy(&q_c->pol, hnd, sizeof(q_c->pol)); + DEBUG(5, ("init_samr_q_close_hnd\n")); + + q_c->pol = *hnd; } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_close_hnd(char *desc, SAMR_Q_CLOSE_HND *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_close_hnd(char *desc, SAMR_Q_CLOSE_HND * q_u, + prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -52,19 +58,15 @@ BOOL samr_io_q_close_hnd(char *desc, SAMR_Q_CLOSE_HND *q_u, prs_struct *ps, int if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - return True; + return smb_io_pol_hnd("pol", &q_u->pol, ps, depth); } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND * r_u, + prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -77,8 +79,6 @@ BOOL samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND *r_u, prs_struct *ps, int if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) return False; - if(!prs_align(ps)) - return False; if(!prs_uint32("status", ps, depth, &r_u->status)) return False; @@ -86,74 +86,93 @@ BOOL samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND *r_u, prs_struct *ps, int return True; } - /******************************************************************* - Reads or writes a structure. +inits a SAMR_Q_LOOKUP_DOMAIN structure. ********************************************************************/ -void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, - POLICY_HND *connect_pol, - uint32 access_mask, DOM_SID *sid) +void init_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN * q_u, + POLICY_HND *pol, char *dom_name) { - DEBUG(5,("samr_init_q_open_domain\n")); + int len_name = strlen(dom_name); - q_u->pol = *connect_pol; - q_u->access_mask = access_mask; - init_dom_sid2(&q_u->dom_sid, sid); + DEBUG(5, ("init_samr_q_lookup_domain\n")); + + q_u->connect_pol = *pol; + + init_uni_hdr(&q_u->hdr_domain, len_name); + init_unistr2(&q_u->uni_domain, dom_name, len_name); } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ - -BOOL samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_lookup_domain(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_open_domain"); + prs_debug(ps, depth, desc, "samr_io_q_lookup_domain"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) - return False; - if(!prs_align(ps)) + if(!smb_io_pol_hnd("connect_pol", &q_u->connect_pol, ps, depth)) return False; - if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask)) + if(!smb_io_unihdr("hdr_domain", &q_u->hdr_domain, ps, depth)) return False; - if(!smb_io_dom_sid2("sid", &q_u->dom_sid, ps, depth)) - return False; - if(!prs_align(ps)) + 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, uint32 status) +{ + DEBUG(5, ("init_samr_r_lookup_domain\n")); + + r_u->status = status; + r_u->ptr_sid = 0; + if (status == 0x0) { + r_u->ptr_sid = 1; + init_dom_sid2(&r_u->dom_sid, dom_sid); + } +} /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_lookup_domain(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_open_domain"); + prs_debug(ps, depth, desc, "samr_io_r_lookup_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_align(ps)) + 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_uint32("status", ps, depth, &r_u->status)) return False; @@ -161,34 +180,39 @@ BOOL samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN *r_u, prs_struct *ps, } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -void init_samr_q_unknown_2c(SAMR_Q_UNKNOWN_2C *q_u, POLICY_HND *user_pol) +void init_samr_q_unknown_2d(SAMR_Q_UNKNOWN_2D * q_u, POLICY_HND *dom_pol, DOM_SID *sid) { - DEBUG(5,("samr_init_q_unknown_2c\n")); + DEBUG(5, ("samr_init_samr_q_unknown_2d\n")); - memcpy(&q_u->user_pol, user_pol, sizeof(q_u->user_pol)); + q_u->dom_pol = *dom_pol; + init_dom_sid2(&q_u->sid, sid); } - /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_unknown_2c(char *desc, SAMR_Q_UNKNOWN_2C *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_unknown_2d(char *desc, SAMR_Q_UNKNOWN_2D * q_u, + prs_struct *ps, int depth) { if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_q_unknown_2c"); + prs_debug(ps, depth, desc, "samr_io_q_unknown_2d"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth)) + 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; @@ -196,282 +220,263 @@ BOOL samr_io_q_unknown_2c(char *desc, SAMR_Q_UNKNOWN_2C *q_u, prs_struct *ps, i } /******************************************************************* - Inits a structure. -********************************************************************/ - -void init_samr_r_unknown_2c(SAMR_R_UNKNOWN_2C *q_u, uint32 status) -{ - DEBUG(5,("samr_init_r_unknown_2c\n")); - - q_u->unknown_0 = 0x00160000; - q_u->unknown_1 = 0x00000000; - q_u->status = status; -} - - -/******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_unknown_2c(char *desc, SAMR_R_UNKNOWN_2C *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_unknown_2d(char *desc, SAMR_R_UNKNOWN_2D * r_u, + prs_struct *ps, int depth) { if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_unknown_2c"); + prs_debug(ps, depth, desc, "samr_io_r_unknown_2d"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32("unknown_0", ps, depth, &r_u->unknown_0)) - return False; - if(!prs_uint32("unknown_1", ps, depth, &r_u->unknown_1)) - return False; - if(!prs_uint32("status ", ps, depth, &r_u->status)) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; } /******************************************************************* - Inits a SAMR_Q_UNKNOWN_3 structure. +reads or writes a structure. ********************************************************************/ -void init_samr_q_unknown_3(SAMR_Q_UNKNOWN_3 *q_u, - POLICY_HND *user_pol, uint16 switch_value) +void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN * q_u, + POLICY_HND *pol, uint32 flags, + DOM_SID *sid) { - DEBUG(5,("samr_init_q_unknown_3\n")); + DEBUG(5, ("samr_init_samr_q_open_domain\n")); - memcpy(&q_u->user_pol, user_pol, sizeof(q_u->user_pol)); - q_u->switch_value = switch_value; + q_u->pol = *pol; + q_u->flags = flags; + init_dom_sid2(&q_u->dom_sid, sid); } - /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_unknown_3(char *desc, SAMR_Q_UNKNOWN_3 *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_open_domain(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_unknown_3"); + prs_debug(ps, depth, desc, "samr_io_q_open_domain"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth)) + if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) return False; - if(!prs_align(ps)) + if(!prs_uint32("flags", ps, depth, &q_u->flags)) return False; - if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) + 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(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_uint32("status", ps, depth, &r_u->status)) + return False; + return True; } /******************************************************************* - Inits a SAMR_Q_QUERY_DOMAIN_INFO structure. +reads or writes a structure. ********************************************************************/ -void init_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO *q_u, - POLICY_HND *domain_pol, uint16 switch_value) +void init_samr_q_get_usrdom_pwinfo(SAMR_Q_GET_USRDOM_PWINFO * q_u, + POLICY_HND *user_pol) { - DEBUG(5,("init_samr_q_query_dom_info\n")); + DEBUG(5, ("samr_init_samr_q_get_usrdom_pwinfo\n")); - memcpy(&q_u->domain_pol, domain_pol, sizeof(q_u->domain_pol)); - q_u->switch_value = switch_value; + q_u->user_pol = *user_pol; } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_get_usrdom_pwinfo(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_query_dom_info"); + prs_debug(ps, depth, desc, "samr_io_q_get_usrdom_pwinfo"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) - return False; - - return True; + return smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth); } /******************************************************************* -Inits a structure. + Init. ********************************************************************/ -BOOL init_unk_info1(SAM_UNK_INFO_1 *u_1) -{ - if (u_1 == NULL) - return False; - memset(u_1->padding, 0, sizeof(u_1->padding)); /* 12 bytes zeros */ - u_1->unknown_1 = 0x80000000; - u_1->unknown_2 = 0x00000000; +void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO *r_u, uint32 status) +{ + DEBUG(5, ("init_samr_r_get_usrdom_pwinfo\n")); + + r_u->unknown_0 = 0x0000; + r_u->unknown_1 = 0x0015; + r_u->unknown_2 = 0x00000000; - return True; + r_u->status = status; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info1(char *desc, SAM_UNK_INFO_1 *u_1, prs_struct *ps, int depth) + +BOOL samr_io_r_get_usrdom_pwinfo(char *desc, SAMR_R_GET_USRDOM_PWINFO * r_u, + prs_struct *ps, int depth) { - if (u_1 == NULL) + if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info1"); + prs_debug(ps, depth, desc, "samr_io_r_get_usrdom_pwinfo"); depth++; - if(!prs_uint8s(False, "padding", ps, depth, u_1->padding, sizeof(u_1->padding))) + if(!prs_align(ps)) return False; - if(!prs_uint32("unknown_1", ps, depth, &u_1->unknown_1)) /* 0x8000 0000 */ + if(!prs_uint16("unknown_0", ps, depth, &r_u->unknown_0)) return False; - if(!prs_uint32("unknown_2", ps, depth, &u_1->unknown_2)) /* 0x0000 0000 */ + if(!prs_uint16("unknown_1", ps, depth, &r_u->unknown_1)) return False; - - if(!prs_align(ps)) + if(!prs_uint32("unknown_2", ps, depth, &r_u->unknown_2)) + return False; + if(!prs_uint32("status ", ps, depth, &r_u->status)) return False; return True; } /******************************************************************* - Inits a structure. +reads or writes a structure. ********************************************************************/ -void init_unk_info2(SAM_UNK_INFO_2 *u_2, char *domain, char *server) +void init_samr_q_query_sec_obj(SAMR_Q_QUERY_SEC_OBJ * q_u, + POLICY_HND *user_pol, uint32 sec_info) { - int len_domain = strlen(domain)+1; - int len_server = strlen(server)+1; - - u_2->unknown_0 = 0x00000000; - u_2->unknown_1 = 0x80000000; - u_2->unknown_2 = 0x00000000; - - u_2->ptr_0 = 1; - init_uni_hdr(&u_2->hdr_domain, len_domain); - init_uni_hdr(&u_2->hdr_server, len_server); - - u_2->seq_num = 0x10000000; - u_2->unknown_3 = 0x00000000; - - u_2->unknown_4 = 0x00000001; - u_2->unknown_5 = 0x00000003; - u_2->unknown_6 = 0x00000001; - u_2->num_domain_usrs = 0x00000008; - u_2->num_domain_grps = 0x00000003; - u_2->num_local_grps = 0x00000003; - - memset(u_2->padding, 0, sizeof(u_2->padding)); /* 12 bytes zeros */ + DEBUG(5, ("samr_init_samr_q_query_sec_obj\n")); - init_unistr2(&u_2->uni_domain, domain, len_domain); - init_unistr2(&u_2->uni_server, server, len_server); + q_u->user_pol = *user_pol; + q_u->sec_info = sec_info; } + /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 *u_2, prs_struct *ps, int depth) +BOOL samr_io_q_query_sec_obj(char *desc, SAMR_Q_QUERY_SEC_OBJ * q_u, + prs_struct *ps, int depth) { - if (u_2 == NULL) + if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info2"); + prs_debug(ps, depth, desc, "samr_io_q_query_sec_obj"); depth++; - if(!prs_uint32("unknown_0", ps, depth, &u_2->unknown_0)) /* 0x0000 0000 */ - return False; - if(!prs_uint32("unknown_1", ps, depth, &u_2->unknown_1)) /* 0x8000 0000 */ - return False; - if(!prs_uint32("unknown_2", ps, depth, &u_2->unknown_2)) /* 0x0000 0000 */ + if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_0", ps, depth, &u_2->ptr_0)) /* pointer to unknown structure */ - return False; - if(!smb_io_unihdr("hdr_domain", &u_2->hdr_domain, ps, depth)) /* domain name unicode header */ + if(!smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth)) return False; - if(!smb_io_unihdr("hdr_server", &u_2->hdr_server, ps, depth)) /* server name unicode header */ + + if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info)) return False; - /* put all the data in here, at the moment, including what the above - pointer is referring to - */ + return True; +} - if(!prs_uint32("seq_num ", ps, depth, &u_2->seq_num )) /* 0x0000 0099 or 0x1000 0000 */ - return False; - if(!prs_uint32("unknown_3 ", ps, depth, &u_2->unknown_3 )) /* 0x0000 0000 */ - return False; - - if(!prs_uint32("unknown_4 ", ps, depth, &u_2->unknown_4 )) /* 0x0000 0001 */ - return False; - if(!prs_uint32("unknown_5 ", ps, depth, &u_2->unknown_5 )) /* 0x0000 0003 */ - 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 )) /* 0x0000 0008 */ - return False; - if(!prs_uint32("num_domain_grps", ps, depth, &u_2->num_domain_grps)) /* 0x0000 0003 */ - return False; - if(!prs_uint32("num_local_grps", ps, depth, &u_2->num_local_grps)) /* 0x0000 0003 */ - return False; +/******************************************************************* +reads or writes a structure. +********************************************************************/ - if(!prs_uint8s(False, "padding", ps, depth, u_2->padding, sizeof(u_2->padding))) /* 12 bytes zeros */ - return False; +void init_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO * q_u, + POLICY_HND *domain_pol, uint16 switch_value) +{ + DEBUG(5, ("samr_init_samr_q_query_dom_info\n")); + + q_u->domain_pol = *domain_pol; + q_u->switch_value = switch_value; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ - if(!smb_io_unistr2( "uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth)) /* domain name unicode string */ +BOOL samr_io_q_query_dom_info(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_dom_info"); + depth++; + if(!prs_align(ps)) return False; - if(!smb_io_unistr2( "uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth)) /* server name unicode string */ + if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth)) return False; - if(!prs_align(ps)) + if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) return False; return True; } + /******************************************************************* -Inits a structure. +inits a structure. ********************************************************************/ -BOOL init_unk_info3(SAM_UNK_INFO_3 * u_3) -{ - if (u_3 == NULL) - return False; +void init_unk_info3(SAM_UNK_INFO_3 * u_3) +{ u_3->unknown_0 = 0x00000000; u_3->unknown_1 = 0x80000000; - - return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info3(char *desc, SAM_UNK_INFO_3 *u_3, prs_struct *ps, int depth) + +static BOOL sam_io_unk_info3(char *desc, SAM_UNK_INFO_3 * u_3, + prs_struct *ps, int depth) { if (u_3 == NULL) return False; @@ -484,31 +489,26 @@ static BOOL sam_io_unk_info3(char *desc, SAM_UNK_INFO_3 *u_3, prs_struct *ps, in if(!prs_uint32("unknown_1", ps, depth, &u_3->unknown_1)) /* 0x8000 0000 */ return False; - if(!prs_align(ps)) - return False; - return True; } /******************************************************************* -Inits a structure. +inits a structure. ********************************************************************/ -BOOL init_unk_info6(SAM_UNK_INFO_6 * u_6) -{ - if (u_6 == NULL) - return False; +void init_unk_info6(SAM_UNK_INFO_6 * u_6) +{ u_6->unknown_0 = 0x00000000; u_6->ptr_0 = 1; memset(u_6->padding, 0, sizeof(u_6->padding)); /* 12 bytes zeros */ - - return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info6(char *desc, SAM_UNK_INFO_6 *u_6, prs_struct *ps, int depth) + +static BOOL sam_io_unk_info6(char *desc, SAM_UNK_INFO_6 * u_6, + prs_struct *ps, int depth) { if (u_6 == NULL) return False; @@ -516,36 +516,31 @@ static BOOL sam_io_unk_info6(char *desc, SAM_UNK_INFO_6 *u_6, prs_struct *ps, in prs_debug(ps, depth, desc, "sam_io_unk_info6"); depth++; - if(!prs_uint32("unknown_0", ps, depth, &u_6->unknown_0)) /* 0x0000 0000 */ + if(!prs_uint32("unknown_0", ps, depth, &u_6->unknown_0)) /* 0x0000 0000 */ return False; - if(!prs_uint32("ptr_0", ps, depth, &u_6->ptr_0)) /* pointer to unknown structure */ + if(!prs_uint32("ptr_0", ps, depth, &u_6->ptr_0)) /* pointer to unknown structure */ return False; if(!prs_uint8s(False, "padding", ps, depth, u_6->padding, sizeof(u_6->padding))) /* 12 bytes zeros */ return False; - if(!prs_align(ps)) - return False; - return True; } /******************************************************************* -Inits a structure. +inits a structure. ********************************************************************/ -BOOL init_unk_info7(SAM_UNK_INFO_7 *u_7) -{ - if (u_7 == NULL) - return False; +void init_unk_info7(SAM_UNK_INFO_7 * u_7) +{ u_7->unknown_0 = 0x0003; - - return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info7(char *desc, SAM_UNK_INFO_7 *u_7, prs_struct *ps, int depth) + +static BOOL sam_io_unk_info7(char *desc, SAM_UNK_INFO_7 * u_7, + prs_struct *ps, int depth) { if (u_7 == NULL) return False; @@ -553,37 +548,32 @@ static BOOL sam_io_unk_info7(char *desc, SAM_UNK_INFO_7 *u_7, prs_struct *ps, in prs_debug(ps, depth, desc, "sam_io_unk_info7"); depth++; - if(!prs_uint16("unknown_0", ps, depth, &u_7->unknown_0)) /* 0x0003 */ - return False; - if(!prs_align(ps)) + if(!prs_uint16("unknown_0", ps, depth, &u_7->unknown_0)) /* 0x0003 */ return False; return True; } /******************************************************************* -Inits a structure. +inits a structure. ********************************************************************/ -BOOL init_unk_info12(SAM_UNK_INFO_12 * u_12) -{ - if (u_12 == NULL) - return False; +void init_unk_info12(SAM_UNK_INFO_12 * u_12) +{ u_12->unknown_0 = 0xcf1dcc00; u_12->unknown_1 = 0xfffffffb; u_12->unknown_2 = 0xcf1dcc00; u_12->unknown_3 = 0xfffffffb; u_12->unknown_4 = 0x8a880000; - - return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ + static BOOL sam_io_unk_info12(char *desc, SAM_UNK_INFO_12 * u_12, - prs_struct *ps, int depth) + prs_struct *ps, int depth) { if (u_12 == NULL) return False; @@ -602,323 +592,247 @@ static BOOL sam_io_unk_info12(char *desc, SAM_UNK_INFO_12 * u_12, if(!prs_uint32("unknown_4", ps, depth, &u_12->unknown_4)) return False; - if(!prs_align(ps)) - return False; - return True; } /******************************************************************* - Inits a SAMR_R_QUERY_DOMAIN_INFO structure. +inits a structure. ********************************************************************/ - -void init_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO *r_u, - uint16 switch_value, SAM_UNK_CTR *ctr, - uint32 status) +void init_unk_info2(SAM_UNK_INFO_2 * u_2, + char *domain, char *server, + uint32 seq_num) { - DEBUG(5,("init_samr_r_query_dom_info\n")); + int len_domain = strlen(domain); + int len_server = strlen(server); - r_u->ptr_0 = 0; - r_u->switch_value = 0; - r_u->status = status; /* return status */ + u_2->unknown_0 = 0x00000000; + u_2->unknown_1 = 0x80000000; + u_2->unknown_2 = 0x00000000; - if (status == 0) { - r_u->switch_value = switch_value; - r_u->ptr_0 = 1; - r_u->ctr = ctr; - } + u_2->ptr_0 = 1; + init_uni_hdr(&u_2->hdr_domain, len_domain); + init_uni_hdr(&u_2->hdr_server, len_server); + + u_2->seq_num = seq_num; + u_2->unknown_3 = 0x00000000; + + u_2->unknown_4 = 0x00000001; + u_2->unknown_5 = 0x00000003; + u_2->unknown_6 = 0x00000001; + u_2->num_domain_usrs = MAX_SAM_ENTRIES; + u_2->num_domain_grps = MAX_SAM_ENTRIES; + u_2->num_local_grps = MAX_SAM_ENTRIES; + + memset(u_2->padding, 0, sizeof(u_2->padding)); /* 12 bytes zeros */ + + init_unistr2(&u_2->uni_domain, domain, len_domain); + init_unistr2(&u_2->uni_server, server, len_server); } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_struct *ps, int depth) +static BOOL sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 * u_2, + prs_struct *ps, int depth) { - if (r_u == NULL) + if (u_2 == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_query_dom_info"); + prs_debug(ps, depth, desc, "sam_io_unk_info2"); depth++; - if(!prs_align(ps)) + if(!prs_uint32("unknown_0", ps, depth, &u_2->unknown_0)) /* 0x0000 0000 */ return False; - - if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0)) + if(!prs_uint32("unknown_1", ps, depth, &u_2->unknown_1)) /* 0x8000 0000 */ 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 0x01: - if(!sam_io_unk_info1("unk_inf1", &r_u->ctr->info.inf1, 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 0x03: - if(!sam_io_unk_info3("unk_inf3", &r_u->ctr->info.inf3, 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 0x07: - if(!sam_io_unk_info7("unk_inf7", &r_u->ctr->info.inf7, ps, depth)) - return False; - break; - case 0x0c: - if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, ps, depth)) - return False; - break; - default: - DEBUG(3,("samr_io_r_query_dom_info: unknown switch level 0x%x\n", - r_u->switch_value)); - return False; - } - } - - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_uint32("unknown_2", ps, depth, &u_2->unknown_2)) /* 0x0000 0000 */ return False; - return True; -} - - -/******************************************************************* - Inits a DOM_SID3 structure. - Calculate length by adding up the size of the components. - ********************************************************************/ - -void init_dom_sid3(DOM_SID3 *sid3, uint16 unk_0, uint16 unk_1, DOM_SID *sid) -{ - sid3->sid = *sid; - sid3->len = 2 + 8 + sid3->sid.num_auths * 4; -} - -/******************************************************************* - Reads or writes a SAM_SID3 structure. - - this one's odd, because the length (in bytes) is specified at the beginning. - the length _includes_ the length of the length, too :-) + if(!prs_uint32("ptr_0", ps, depth, &u_2->ptr_0)) + 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 + */ -static BOOL sam_io_dom_sid3(char *desc, DOM_SID3 *sid3, prs_struct *ps, int depth) -{ - if (sid3 == NULL) + if(!prs_uint32("seq_num ", ps, depth, &u_2->seq_num)) /* 0x0000 0099 or 0x1000 0000 */ + return False; + if(!prs_uint32("unknown_3 ", ps, depth, &u_2->unknown_3)) /* 0x0000 0000 */ return False; - prs_debug(ps, depth, desc, "sam_io_dom_sid3"); - depth++; + if(!prs_uint32("unknown_4 ", ps, depth, &u_2->unknown_4)) /* 0x0000 0001 */ + return False; + if(!prs_uint32("unknown_5 ", ps, depth, &u_2->unknown_5)) /* 0x0000 0003 */ + 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(!prs_uint16("len", ps, depth, &sid3->len)) + if(!prs_uint8s(False, "padding", ps, depth, u_2->padding,sizeof(u_2->padding))) return False; - if(!prs_align(ps)) + + if(!smb_io_unistr2("uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth)) return False; - if(!smb_io_dom_sid("", &sid3->sid, ps, depth)) + if(!smb_io_unistr2("uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth)) return False; return True; } /******************************************************************* - Inits a SAMR_R_UNKNOWN3 structure. - -unknown_2 : 0x0001 -unknown_3 : 0x8004 - -unknown_4,5 : 0x0000 0014 - -unknown_6 : 0x0002 -unknown_7 : 0x5800 or 0x0070 - +inits a structure. ********************************************************************/ -static void init_sam_sid_stuff(SAM_SID_STUFF *stf, - uint16 unknown_2, uint16 unknown_3, - uint32 unknown_4, uint16 unknown_6, uint16 unknown_7, - int num_sid3s, DOM_SID3 sid3[MAX_SAM_SIDS]) +void init_unk_info1(SAM_UNK_INFO_1 * u_1) { - stf->unknown_2 = unknown_2; - stf->unknown_3 = unknown_3; - - memset((char *)stf->padding1, '\0', sizeof(stf->padding1)); - - stf->unknown_4 = unknown_4; - stf->unknown_5 = unknown_4; - - stf->unknown_6 = unknown_6; - stf->unknown_7 = unknown_7; - - stf->num_sids = num_sid3s; - - stf->padding2 = 0x0000; - - memcpy(stf->sid, sid3, sizeof(DOM_SID3) * num_sid3s); + memset(u_1->padding, 0, sizeof(u_1->padding)); /* 12 bytes zeros */ + u_1->unknown_1 = 0x80000000; + u_1->unknown_2 = 0x00000000; } /******************************************************************* - Reads or writes a SAM_SID_STUFF structure. +reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sid_stuff(char *desc, SAM_SID_STUFF *stf, prs_struct *ps, int depth) +static BOOL sam_io_unk_info1(char *desc, SAM_UNK_INFO_1 * u_1, + prs_struct *ps, int depth) { - int i; - - if (stf == NULL) - return False; - - DEBUG(5,("init_sam_sid_stuff\n")); + if (u_1 == NULL) + return False; - if(!prs_uint16("unknown_2", ps, depth, &stf->unknown_2)) - return False; - if(!prs_uint16("unknown_3", ps, depth, &stf->unknown_3)) - return False; + prs_debug(ps, depth, desc, "sam_io_unk_info1"); + depth++; - if(!prs_uint8s(False, "padding1", ps, depth, stf->padding1, sizeof(stf->padding1))) + if(!prs_uint8s(False, "padding", ps, depth, u_1->padding, sizeof(u_1->padding))) return False; - if(!prs_uint32("unknown_4", ps, depth, &stf->unknown_4)) - return False; - if(!prs_uint32("unknown_5", ps, depth, &stf->unknown_5)) - return False; - if(!prs_uint16("unknown_6", ps, depth, &stf->unknown_6)) - return False; - if(!prs_uint16("unknown_7", ps, depth, &stf->unknown_7)) - return False; - - if(!prs_uint32("num_sids ", ps, depth, &stf->num_sids )) + if(!prs_uint32("unknown_1", ps, depth, &u_1->unknown_1)) /* 0x8000 0000 */ return False; - if(!prs_uint16("padding2 ", ps, depth, &stf->padding2 )) + if(!prs_uint32("unknown_2", ps, depth, &u_1->unknown_2)) /* 0x0000 0000 */ return False; - SMB_ASSERT_ARRAY(stf->sid, stf->num_sids); - - for (i = 0; i < stf->num_sids; i++) { - if(!sam_io_dom_sid3("", &(stf->sid[i]), ps, depth)) - return False; - } - return True; } /******************************************************************* - Inits or writes a SAMR_R_UNKNOWN3 structure. +inits a SAMR_R_QUERY_DOMAIN_INFO structure. ********************************************************************/ -void init_samr_r_unknown_3(SAMR_R_UNKNOWN_3 *r_u, - uint16 unknown_2, uint16 unknown_3, - uint32 unknown_4, uint16 unknown_6, uint16 unknown_7, - int num_sid3s, DOM_SID3 sid3[MAX_SAM_SIDS], +void init_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO * r_u, + uint16 switch_value, SAM_UNK_CTR * ctr, uint32 status) { - DEBUG(5,("samr_init_r_unknown_3\n")); + DEBUG(5, ("init_samr_r_query_dom_info\n")); r_u->ptr_0 = 0; - r_u->ptr_1 = 0; + r_u->switch_value = 0; + r_u->status = status; /* return status */ - if (status == 0x0) { + if (status == 0) { + r_u->switch_value = switch_value; r_u->ptr_0 = 1; - r_u->ptr_1 = 1; - init_sam_sid_stuff(&(r_u->sid_stuff), unknown_2, unknown_3, - unknown_4, unknown_6, unknown_7, - num_sid3s, sid3); + r_u->ctr = ctr; } - - r_u->status = status; } /******************************************************************* - Reads or writes a SAMR_R_UNKNOWN_3 structure. - -this one's odd, because the daft buggers use a different mechanism -for writing out the array of sids. they put the number of sids in -only one place: they've calculated the length of each sid and jumped -by that amount. then, retrospectively, the length of the whole buffer -is put at the beginning of the data stream. - -wierd. - +reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_unknown_3(char *desc, SAMR_R_UNKNOWN_3 *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, + prs_struct *ps, int depth) { - int ptr_len0=0; - int ptr_len1=0; - int ptr_sid_stuff = 0; - - if (r_u == NULL) + if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_unknown_3"); + prs_debug(ps, depth, desc, "samr_io_r_query_dom_info"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0)) + if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0)) return False; - if (ps->io) { - /* reading. do the length later */ - if(!prs_uint32("sid_stuff_len0", ps, depth, &r_u->sid_stuff_len0)) + if (r_u->ptr_0 != 0 && r_u->ctr != NULL) { + if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value)) return False; - } else { - /* storing */ - ptr_len0 = prs_offset(ps); - if(!prs_set_offset(ps, ptr_len0 + 4)) + if(!prs_align(ps)) return False; - } - if (r_u->ptr_0 != 0) { - if(!prs_uint32("ptr_1 ", ps, depth, &r_u->ptr_1)) - return False; - if (ps->io) { - /* reading. do the length later */ - if(!prs_uint32("sid_stuff_len1", ps, depth, &r_u->sid_stuff_len1)) + switch (r_u->switch_value) { + case 0x0c: + if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, ps, depth)) + return False; + break; + case 0x07: + if(!sam_io_unk_info7("unk_inf7",&r_u->ctr->info.inf7, ps,depth)) return False; - } else { - /* storing */ - ptr_len1 = prs_offset(ps); - if(!prs_set_offset(ps, ptr_len1 + 4)) + break; + case 0x06: + if(!sam_io_unk_info6("unk_inf6",&r_u->ctr->info.inf6, ps,depth)) return False; - } - - if (r_u->ptr_1 != 0) { - ptr_sid_stuff = prs_offset(ps); - if(!sam_io_sid_stuff("", &r_u->sid_stuff, ps, depth)) + 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_dom_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 (!(ps->io)) { - /* storing not reading. do the length, now. */ + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; +} - if (ptr_sid_stuff != 0) { - int old_len = prs_offset(ps); - uint32 sid_stuff_len = old_len - ptr_sid_stuff; +/******************************************************************* +reads or writes a SAMR_R_QUERY_SEC_OBJ structure. +********************************************************************/ - if(!prs_set_offset(ps, ptr_len0)) - return False; - if(!prs_uint32("sid_stuff_len0", ps, depth, &sid_stuff_len)) - return False; +BOOL samr_io_r_query_sec_obj(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_set_offset(ps, ptr_len1)) - return False; - if(!prs_uint32("sid_stuff_len1", ps, depth, &sid_stuff_len)) - return False; + if(!prs_align(ps)) + return False; - if(!prs_set_offset(ps, old_len)) - 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_uint32("status", ps, depth, &r_u->status)) @@ -928,11 +842,12 @@ BOOL samr_io_r_unknown_3(char *desc, SAMR_R_UNKNOWN_3 *r_u, prs_struct *ps, int } /******************************************************************* - Reads or writes a SAM_STR1 structure. +reads or writes a SAM_STR1 structure. ********************************************************************/ -static BOOL sam_io_sam_str1(char *desc, SAM_STR1 *sam, uint32 acct_buf, - uint32 name_buf, uint32 desc_buf, prs_struct *ps, int depth) +static BOOL sam_io_sam_str1(char *desc, SAM_STR1 * sam, uint32 acct_buf, + uint32 name_buf, uint32 desc_buf, + prs_struct *ps, int depth) { if (sam == NULL) return False; @@ -942,31 +857,35 @@ static BOOL sam_io_sam_str1(char *desc, SAM_STR1 *sam, uint32 acct_buf, if(!prs_align(ps)) return False; - - if(!smb_io_unistr2("unistr2", &sam->uni_acct_name, acct_buf, ps, depth)) /* account name unicode string */ + if (!smb_io_unistr2("name", &sam->uni_acct_name, acct_buf, ps, depth)) return False; - if(!smb_io_unistr2("unistr2", &sam->uni_full_name, name_buf, ps, depth)) /* full name unicode string */ + + if (!smb_io_unistr2("desc", &sam->uni_acct_desc, desc_buf, ps, depth)) return False; - if(!smb_io_unistr2("unistr2", &sam->uni_acct_desc, desc_buf, ps, depth)) /* account description unicode string */ + + if (!smb_io_unistr2("full", &sam->uni_full_name, name_buf, ps, depth)) return False; return True; } /******************************************************************* - Inits a SAM_ENTRY1 structure. +inits a SAM_ENTRY1 structure. ********************************************************************/ -static void init_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, - uint32 len_sam_name, uint32 len_sam_full, uint32 len_sam_desc, - uint32 rid_user, uint16 acb_info) +static void init_sam_entry1(SAM_ENTRY1 * sam, uint32 user_idx, + uint32 len_sam_name, uint32 len_sam_full, + uint32 len_sam_desc, uint32 rid_user, + uint16 acb_info) { - DEBUG(5,("init_sam_entry1\n")); + DEBUG(5, ("init_sam_entry1\n")); + + ZERO_STRUCTP(sam); sam->user_idx = user_idx; sam->rid_user = rid_user; sam->acb_info = acb_info; - sam->pad = 0; + sam->pad = 0; init_uni_hdr(&sam->hdr_acct_name, len_sam_name); init_uni_hdr(&sam->hdr_user_name, len_sam_full); @@ -974,10 +893,11 @@ static void init_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, } /******************************************************************* - Reads or writes a SAM_ENTRY1 structure. +reads or writes a SAM_ENTRY1 structure. ********************************************************************/ -static BOOL sam_io_sam_entry1(char *desc, SAM_ENTRY1 *sam, prs_struct *ps, int depth) +static BOOL sam_io_sam_entry1(char *desc, SAM_ENTRY1 * sam, + prs_struct *ps, int depth) { if (sam == NULL) return False; @@ -998,21 +918,22 @@ static BOOL sam_io_sam_entry1(char *desc, SAM_ENTRY1 *sam, prs_struct *ps, int if(!prs_uint16("pad ", ps, depth, &sam->pad)) return False; - if(!smb_io_unihdr("unihdr", &sam->hdr_acct_name, ps, depth)) /* account name unicode string header */ + if (!smb_io_unihdr("hdr_acct_name", &sam->hdr_acct_name, ps, depth)) return False; - if(!smb_io_unihdr("unihdr", &sam->hdr_user_name, ps, depth)) /* account name unicode string header */ + if (!smb_io_unihdr("hdr_user_desc", &sam->hdr_user_desc, ps, depth)) return False; - if(!smb_io_unihdr("unihdr", &sam->hdr_user_desc, ps, depth)) /* account name unicode string header */ + if (!smb_io_unihdr("hdr_user_name", &sam->hdr_user_name, ps, depth)) return False; return True; } /******************************************************************* - Reads or writes a SAM_STR2 structure. +reads or writes a SAM_STR2 structure. ********************************************************************/ -static BOOL sam_io_sam_str2(char *desc, SAM_STR2 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth) +static BOOL sam_io_sam_str2(char *desc, SAM_STR2 * sam, uint32 acct_buf, + uint32 desc_buf, prs_struct *ps, int depth) { if (sam == NULL) return False; @@ -1023,38 +944,38 @@ static BOOL sam_io_sam_str2(char *desc, SAM_STR2 *sam, uint32 acct_buf, uint32 if(!prs_align(ps)) return False; - if(!smb_io_unistr2("unistr2", &sam->uni_srv_name, acct_buf, ps, depth)) /* account name unicode string */ + 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("unistr2", &sam->uni_srv_desc, desc_buf, ps, depth)) /* account description unicode string */ + 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. +inits a SAM_ENTRY2 structure. ********************************************************************/ - -static void init_sam_entry2(SAM_ENTRY2 *sam, uint32 user_idx, - uint32 len_sam_name, uint32 len_sam_desc, - uint32 rid_user, uint16 acb_info) +static void init_sam_entry2(SAM_ENTRY2 * sam, uint32 user_idx, + uint32 len_sam_name, uint32 len_sam_desc, + uint32 rid_user, uint16 acb_info) { - DEBUG(5,("init_sam_entry2\n")); + DEBUG(5, ("init_sam_entry2\n")); sam->user_idx = user_idx; sam->rid_user = rid_user; sam->acb_info = acb_info; - sam->pad = 0; + sam->pad = 0; init_uni_hdr(&sam->hdr_srv_name, len_sam_name); init_uni_hdr(&sam->hdr_srv_desc, len_sam_desc); } /******************************************************************* - Reads or writes a SAM_ENTRY2 structure. +reads or writes a SAM_ENTRY2 structure. ********************************************************************/ -static BOOL sam_io_sam_entry2(char *desc, SAM_ENTRY2 *sam, prs_struct *ps, int depth) +static BOOL sam_io_sam_entry2(char *desc, SAM_ENTRY2 * sam, + prs_struct *ps, int depth) { if (sam == NULL) return False; @@ -1075,19 +996,20 @@ static BOOL sam_io_sam_entry2(char *desc, SAM_ENTRY2 *sam, prs_struct *ps, int if(!prs_uint16("pad ", ps, depth, &sam->pad)) return False; - if(!smb_io_unihdr("unihdr", &sam->hdr_srv_name, ps, depth)) /* account name unicode string header */ + 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 */ + 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. +reads or writes a SAM_STR3 structure. ********************************************************************/ -static BOOL sam_io_sam_str3(char *desc, SAM_STR3 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth) +static BOOL sam_io_sam_str3(char *desc, SAM_STR3 * sam, uint32 acct_buf, + uint32 desc_buf, prs_struct *ps, int depth) { if (sam == NULL) return False; @@ -1098,37 +1020,38 @@ static BOOL sam_io_sam_str3(char *desc, SAM_STR3 *sam, uint32 acct_buf, uint32 if(!prs_align(ps)) return False; - if(!smb_io_unistr2("unistr2", &sam->uni_grp_name, acct_buf, ps, depth)) /* account name unicode string */ + 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("unistr2", &sam->uni_grp_desc, desc_buf, ps, depth)) /* account description unicode string */ + 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. +inits a SAM_ENTRY3 structure. ********************************************************************/ -static void init_sam_entry3(SAM_ENTRY3 *sam, uint32 grp_idx, - uint32 len_grp_name, uint32 len_grp_desc, uint32 rid_grp) +static void init_sam_entry3(SAM_ENTRY3 * sam, uint32 grp_idx, + uint32 len_grp_name, uint32 len_grp_desc, + uint32 rid_grp) { - DEBUG(5,("init_sam_entry3\n")); + DEBUG(5, ("init_sam_entry3\n")); - ZERO_STRUCTP(sam); sam->grp_idx = grp_idx; sam->rid_grp = rid_grp; - sam->attr = 0x07; /* group rid attributes - gets ignored by nt 4.0 */ + sam->attr = 0x07; /* group rid attributes - gets ignored by nt 4.0 */ init_uni_hdr(&sam->hdr_grp_name, len_grp_name); init_uni_hdr(&sam->hdr_grp_desc, len_grp_desc); } /******************************************************************* - Reads or writes a SAM_ENTRY3 structure. +reads or writes a SAM_ENTRY3 structure. ********************************************************************/ -static BOOL sam_io_sam_entry3(char *desc, SAM_ENTRY3 *sam, prs_struct *ps, int depth) +static BOOL sam_io_sam_entry3(char *desc, SAM_ENTRY3 * sam, + prs_struct *ps, int depth) { if (sam == NULL) return False; @@ -1147,257 +1070,170 @@ static BOOL sam_io_sam_entry3(char *desc, SAM_ENTRY3 *sam, prs_struct *ps, int 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 */ + 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 */ + if(!smb_io_unihdr("unihdr", &sam->hdr_grp_desc, ps, depth)) /* account name unicode string header */ return False; return True; } /******************************************************************* - Inits a SAM_ENTRY structure. +inits a SAM_ENTRY4 structure. ********************************************************************/ -static void init_sam_entry(SAM_ENTRY *sam, uint32 len_sam_name, uint32 rid) +static void init_sam_entry4(SAM_ENTRY4 * sam, uint32 user_idx, + uint32 len_acct_name) { - DEBUG(5,("init_sam_entry\n")); + DEBUG(5, ("init_sam_entry4\n")); - sam->rid = rid; - init_uni_hdr(&sam->hdr_name, len_sam_name); + sam->user_idx = user_idx; + init_str_hdr(&sam->hdr_acct_name, len_acct_name, len_acct_name, + len_acct_name != 0); } /******************************************************************* - Reads or writes a SAM_ENTRY structure. +reads or writes a SAM_ENTRY4 structure. ********************************************************************/ -static BOOL sam_io_sam_entry(char *desc, SAM_ENTRY *sam, prs_struct *ps, int depth) +static BOOL sam_io_sam_entry4(char *desc, SAM_ENTRY4 * sam, + prs_struct *ps, int depth) { if (sam == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_sam_entry"); + prs_debug(ps, depth, desc, "sam_io_sam_entry4"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32("rid", ps, depth, &sam->rid)) + + if(!prs_uint32("user_idx", ps, depth, &sam->user_idx)) return False; - if(!smb_io_unihdr("unihdr", &sam->hdr_name, ps, depth)) /* account name unicode string header */ + if(!smb_io_strhdr("strhdr", &sam->hdr_acct_name, ps, depth)) return False; return True; } - /******************************************************************* - Inits a SAMR_Q_ENUM_DOM_USERS structure. +inits a SAM_ENTRY5 structure. ********************************************************************/ -void init_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_e, POLICY_HND *pol, - uint16 req_num_entries, uint16 unk_0, - uint16 acb_mask, uint16 unk_1, uint32 size) +static void init_sam_entry5(SAM_ENTRY5 * sam, uint32 grp_idx, + uint32 len_grp_name) { - DEBUG(5,("init_q_enum_dom_users\n")); + DEBUG(5, ("init_sam_entry5\n")); - memcpy(&q_e->pol, pol, sizeof(*pol)); - - q_e->req_num_entries = req_num_entries; /* zero indicates lots */ - q_e->unknown_0 = unk_0; /* this gets returned in the response */ - q_e->acb_mask = acb_mask; - q_e->unknown_1 = unk_1; - q_e->max_size = size; + 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 structure. +reads or writes a SAM_ENTRY5 structure. ********************************************************************/ -BOOL samr_io_q_enum_dom_users(char *desc, SAMR_Q_ENUM_DOM_USERS *q_e, prs_struct *ps, int depth) +static BOOL sam_io_sam_entry5(char *desc, SAM_ENTRY5 * sam, + prs_struct *ps, int depth) { - if (q_e == NULL) + if (sam == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_q_enum_dom_users"); + prs_debug(ps, depth, desc, "sam_io_sam_entry5"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint16("req_num_entries", ps, depth, &q_e->req_num_entries)) - return False; - if(!prs_uint16("unknown_0 ", ps, depth, &q_e->unknown_0)) - return False; - - if(!prs_uint16("acb_mask ", ps, depth, &q_e->acb_mask)) - return False; - if(!prs_uint16("unknown_1 ", ps, depth, &q_e->unknown_1)) - return False; - - if(!prs_uint32("max_size ", ps, depth, &q_e->max_size)) + if(!prs_uint32("grp_idx", ps, depth, &sam->grp_idx)) return False; - - if(!prs_align(ps)) + if(!smb_io_strhdr("strhdr", &sam->hdr_grp_name, ps, depth)) return False; return True; } - /******************************************************************* - Inits a SAMR_R_ENUM_DOM_USERS structure. +inits a SAM_ENTRY structure. ********************************************************************/ -void init_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u, - uint16 total_num_entries, uint16 unk_0, - uint32 num_sam_entries, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES], uint32 status) +void init_sam_entry(SAM_ENTRY * sam, uint32 len_sam_name, uint32 rid) { - int i; + DEBUG(10, ("init_sam_entry: %d %d\n", len_sam_name, rid)); - DEBUG(5,("init_samr_r_enum_dom_users\n")); + sam->rid = rid; + init_uni_hdr(&sam->hdr_name, len_sam_name); +} - if (num_sam_entries >= MAX_SAM_ENTRIES) { - num_sam_entries = MAX_SAM_ENTRIES; - DEBUG(5,("limiting number of entries to %d\n", - num_sam_entries)); - } +/******************************************************************* +reads or writes a SAM_ENTRY structure. +********************************************************************/ - r_u->total_num_entries = total_num_entries; - r_u->unknown_0 = unk_0; +static BOOL sam_io_sam_entry(char *desc, SAM_ENTRY * sam, + prs_struct *ps, int depth) +{ + if (sam == NULL) + return False; - if (total_num_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; - - SMB_ASSERT_ARRAY(r_u->sam, num_sam_entries); - SMB_ASSERT_ARRAY(r_u->uni_acct_name, num_sam_entries); - - for (i = 0; i < num_sam_entries; i++) { - init_sam_entry(&(r_u->sam[i]), - pass[i].uni_user_name.uni_str_len, - pass[i].user_rid); - - copy_unistr2(&r_u->uni_acct_name[i], &(pass[i].uni_user_name)); - } - - 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; - } - - r_u->status = status; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct *ps, int depth) -{ - int i; - - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_enum_dom_users"); + prs_debug(ps, depth, desc, "sam_io_sam_entry"); depth++; if(!prs_align(ps)) return False; - - if(!prs_uint16("total_num_entries", ps, depth, &r_u->total_num_entries)) - return False; - if(!prs_uint16("unknown_0 ", ps, depth, &r_u->unknown_0)) - return False; - if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1)) + if(!prs_uint32("rid", ps, depth, &sam->rid)) return False; - - if (r_u->total_num_entries != 0 && 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; - - SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries2); - - for (i = 0; i < r_u->num_entries2; i++) { - if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth)) - return False; - } - - SMB_ASSERT_ARRAY(r_u->uni_acct_name, r_u->num_entries2); - - 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_uint32("status", ps, depth, &r_u->status)) + 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_ALIASES structure. +inits a SAMR_Q_ENUM_DOM_USERS structure. ********************************************************************/ -void init_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_e, POLICY_HND *pol, uint32 size) +void init_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS * q_e, POLICY_HND *pol, + uint32 start_idx, + uint16 acb_mask, uint16 unk_1, uint32 size) { - DEBUG(5,("init_q_enum_dom_aliases\n")); + DEBUG(5, ("init_samr_q_enum_dom_users\n")); - memcpy(&q_e->pol, pol, sizeof(*pol)); + q_e->pol = *pol; - q_e->unknown_0 = 0; + q_e->start_idx = start_idx; /* zero indicates lots */ + q_e->acb_mask = acb_mask; + q_e->unknown_1 = unk_1; q_e->max_size = size; } - /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_enum_dom_aliases(char *desc, SAMR_Q_ENUM_DOM_ALIASES *q_e, prs_struct *ps, int depth) +BOOL samr_io_q_enum_dom_users(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_aliases"); + prs_debug(ps, depth, desc, "samr_io_q_enum_dom_users"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) - return False; - if(!prs_align(ps)) + if(!smb_io_pol_hnd("domain_pol", &q_e->pol, ps, depth)) return False; - if(!prs_uint32("unknown_0", ps, depth, &q_e->unknown_0)) + if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx)) return False; - if(!prs_uint32("max_size ", ps, depth, &q_e->max_size )) + if(!prs_uint16("acb_mask ", ps, depth, &q_e->acb_mask)) + return False; + if(!prs_uint16("unknown_1", ps, depth, &q_e->unknown_1)) return False; - if(!prs_align(ps)) + if(!prs_uint32("max_size ", ps, depth, &q_e->max_size)) return False; return True; @@ -1405,72 +1241,54 @@ BOOL samr_io_q_enum_dom_aliases(char *desc, SAMR_Q_ENUM_DOM_ALIASES *q_e, prs_s /******************************************************************* - Inits a SAMR_R_ENUM_DOM_ALIASES structure. +inits a SAMR_R_ENUM_DOM_USERS structure. ********************************************************************/ -void init_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, - uint32 num_sam_entries, SAM_USER_INFO_21 grps[MAX_SAM_ENTRIES], - uint32 status) +void init_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS * r_u, + uint32 next_idx, uint32 num_sam_entries) { - int i; - - DEBUG(5,("init_samr_r_enum_dom_aliases\n")); - - if (num_sam_entries >= MAX_SAM_ENTRIES) { - num_sam_entries = MAX_SAM_ENTRIES; - DEBUG(5,("limiting number of entries to %d\n", - num_sam_entries)); - } + DEBUG(5, ("init_samr_r_enum_dom_users\n")); - r_u->num_entries = num_sam_entries; + r_u->next_idx = next_idx; - if (num_sam_entries > 0) { - r_u->ptr_entries = 1; - r_u->num_entries2 = num_sam_entries; + 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; - SMB_ASSERT_ARRAY(r_u->sam, num_sam_entries); - - for (i = 0; i < num_sam_entries; i++) { - init_sam_entry(&r_u->sam[i], - grps[i].uni_user_name.uni_str_len, - grps[i].user_rid); - - copy_unistr2(&r_u->uni_grp_name[i], &(grps[i].uni_user_name)); - } - r_u->num_entries4 = num_sam_entries; } else { - r_u->ptr_entries = 0; + r_u->ptr_entries1 = 0; + r_u->num_entries2 = num_sam_entries; + r_u->ptr_entries2 = 1; } - - r_u->status = status; } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS * r_u, + prs_struct *ps, int depth) { - int i; + uint32 i; if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_enum_dom_aliases"); + prs_debug(ps, depth, desc, "samr_io_r_enum_dom_users"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32("num_entries", ps, depth, &r_u->num_entries)) + if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx)) return False; - if(!prs_uint32("ptr_entries", ps, depth, &r_u->ptr_entries)) + if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1)) return False; - if (r_u->num_entries != 0 && r_u->ptr_entries != 0) { + 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)) @@ -1478,55 +1296,66 @@ BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_s if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3)) return False; - SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries); + if (UNMARSHALLING(ps) && (r_u->num_entries2 != 0)) { + r_u->sam = (SAM_ENTRY *)prs_alloc_mem(ps,sizeof(SAM_ENTRY)*r_u->num_entries2); + r_u->uni_acct_name = (UNISTR2 *)prs_alloc_mem(ps,sizeof(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_entries; i++) { + 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_entries; i++) { - if(!smb_io_unistr2("", &r_u->uni_grp_name[i], r_u->sam[i].hdr_name.buffer, ps, depth)) + 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_align(ps)) + return False; + + if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4)) + return False; if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; } - /******************************************************************* - Inits a SAMR_Q_QUERY_DISPINFO structure. +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 size) +void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO * q_e, POLICY_HND *pol, + uint16 switch_level, uint32 start_idx, + uint32 max_entries) { - DEBUG(5,("init_q_query_dispinfo\n")); + DEBUG(5, ("init_samr_q_query_dispinfo\n")); - memcpy(&q_e->pol, pol, sizeof(*pol)); + q_e->domain_pol = *pol; q_e->switch_level = switch_level; q_e->start_idx = start_idx; - q_e->max_entries = 0; - q_e->max_size = size; + q_e->max_entries = max_entries; + q_e->max_size = 0xffff; /* Not especially useful */ } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO *q_e, prs_struct *ps, int depth) +BOOL samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO * q_e, + prs_struct *ps, int depth) { if (q_e == NULL) return False; @@ -1537,19 +1366,14 @@ BOOL samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO *q_e, prs_struc if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) - return False; - if(!prs_align(ps)) + 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 0 - if(!prs_uint16("unknown_0 ", ps, depth, &q_e->unknown_0)) + if(!prs_align(ps)) return False; -#else - prs_align(ps); -#endif + if(!prs_uint32("start_idx ", ps, depth, &q_e->start_idx)) return False; if(!prs_uint32("max_entries ", ps, depth, &q_e->max_entries)) @@ -1557,90 +1381,82 @@ BOOL samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO *q_e, prs_struc if(!prs_uint32("max_size ", ps, depth, &q_e->max_size)) return False; - if(!prs_align(ps)) - return False; - return True; } - /******************************************************************* - Inits a SAM_INFO_2 structure. +inits a SAM_DISPINFO_1 structure. ********************************************************************/ -void init_sam_info_2(SAM_INFO_2 *sam, uint32 acb_mask, - uint32 start_idx, uint32 num_sam_entries, - SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) +void init_sam_dispinfo_1(SAM_DISPINFO_1 * sam, uint32 *num_entries, + uint32 *data_size, uint32 start_idx, + SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) { - int i; - int entries_added; + uint32 len_sam_name, len_sam_full, len_sam_desc; + uint32 max_entries, max_data_size; + uint32 dsize = 0; + uint32 i; - DEBUG(5,("init_sam_info_2\n")); + ZERO_STRUCTP(sam); - if (num_sam_entries >= MAX_SAM_ENTRIES) { - num_sam_entries = MAX_SAM_ENTRIES; - DEBUG(5,("limiting number of entries to %d\n", - num_sam_entries)); - } + max_entries = *num_entries; + max_data_size = *data_size; - for (i = start_idx, entries_added = 0; i < num_sam_entries; i++) { - if ((pass[i].acb_info & acb_mask) == acb_mask) { - init_sam_entry2(&sam->sam[entries_added], - start_idx + entries_added + 1, - pass[i].uni_user_name.uni_str_len, - pass[i].uni_acct_desc.uni_str_len, - pass[i].user_rid, - pass[i].acb_info); + DEBUG(5, ("init_sam_dispinfo_1: max_entries: %d max_dsize: 0x%x\n", + max_entries, max_data_size)); - copy_unistr2(&sam->str[entries_added].uni_srv_name, &pass[i].uni_user_name); - copy_unistr2(&sam->str[entries_added].uni_srv_desc, &pass[i].uni_acct_desc); + for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) { + len_sam_name = pass[i].uni_user_name.uni_str_len; + len_sam_full = pass[i].uni_full_name.uni_str_len; + len_sam_desc = pass[i].uni_acct_desc.uni_str_len; - entries_added++; - } + init_sam_entry1(&sam->sam[i], start_idx + i + 1, + len_sam_name, len_sam_full, len_sam_desc, + pass[i].user_rid, pass[i].acb_info); - sam->num_entries = entries_added; - sam->ptr_entries = 1; - sam->num_entries2 = entries_added; + copy_unistr2(&sam->str[i].uni_acct_name, &pass[i].uni_user_name); + copy_unistr2(&sam->str[i].uni_full_name, &pass[i].uni_full_name); + copy_unistr2(&sam->str[i].uni_acct_desc, &pass[i].uni_acct_desc); + + dsize += sizeof(SAM_ENTRY1); + dsize += len_sam_name + len_sam_full + len_sam_desc; } + + *num_entries = i; + *data_size = dsize; } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_info_2(char *desc, SAM_INFO_2 *sam, prs_struct *ps, int depth) +static BOOL sam_io_sam_dispinfo_1(char *desc, SAM_DISPINFO_1 * sam, + uint32 num_entries, + prs_struct *ps, int depth) { - int i; + uint32 i; if (sam == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_sam_info_2"); + prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_1"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32("num_entries ", ps, depth, &sam->num_entries)) - return False; - if(!prs_uint32("ptr_entries ", ps, depth, &sam->ptr_entries)) - return False; - - if(!prs_uint32("num_entries2 ", ps, depth, &sam->num_entries2)) - return False; + SMB_ASSERT_ARRAY(sam->sam, num_entries); - SMB_ASSERT_ARRAY(sam->sam, sam->num_entries); - - for (i = 0; i < sam->num_entries; i++) { - if(!sam_io_sam_entry2("", &sam->sam[i], ps, depth)) + for (i = 0; i < num_entries; i++) { + if(!sam_io_sam_entry1("", &sam->sam[i], ps, depth)) return False; } - for (i = 0; i < sam->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)) + 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; } @@ -1648,896 +1464,824 @@ static BOOL sam_io_sam_info_2(char *desc, SAM_INFO_2 *sam, prs_struct *ps, int } /******************************************************************* - Inits a SAM_INFO_1 structure. +inits a SAM_DISPINFO_2 structure. ********************************************************************/ -void init_sam_info_1(SAM_INFO_1 *sam, uint32 acb_mask, - uint32 start_idx, uint32 num_sam_entries, - SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) +void init_sam_dispinfo_2(SAM_DISPINFO_2 * sam, uint32 *num_entries, + uint32 *data_size, uint32 start_idx, + SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) { - int i; - int entries_added; + uint32 len_sam_name, len_sam_desc; + uint32 max_entries, max_data_size; + uint32 dsize = 0; + uint32 i; - DEBUG(5,("init_sam_info_1\n")); + DEBUG(5, ("init_sam_dispinfo_2\n")); - if (num_sam_entries >= MAX_SAM_ENTRIES) { - num_sam_entries = MAX_SAM_ENTRIES; - DEBUG(5,("limiting number of entries to %d\n", - num_sam_entries)); - } - DEBUG(5,("num_sam_entries: %u, start_idx: %u\n",num_sam_entries, - num_sam_entries)); - - for (i = 0, entries_added = 0; - i < num_sam_entries; i++) { - if ((pass[i].acb_info & acb_mask) == acb_mask) { - init_sam_entry1(&sam->sam[entries_added], - start_idx + entries_added + 1, - pass[i].uni_user_name.uni_str_len, - pass[i].uni_full_name.uni_str_len, - pass[i].uni_acct_desc.uni_str_len, - pass[i].user_rid, - pass[i].acb_info); - - copy_unistr2(&sam->str[entries_added].uni_acct_name, &pass[i].uni_user_name); - copy_unistr2(&sam->str[entries_added].uni_full_name, &pass[i].uni_full_name); - copy_unistr2(&sam->str[entries_added].uni_acct_desc, &pass[i].uni_acct_desc); - - entries_added++; - } + ZERO_STRUCTP(sam); + + max_entries = *num_entries; + max_data_size = *data_size; + + for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) { + len_sam_name = pass[i].uni_user_name.uni_str_len; + len_sam_desc = pass[i].uni_acct_desc.uni_str_len; + + init_sam_entry2(&sam->sam[i], start_idx + i + 1, + len_sam_name, len_sam_desc, + pass[i].user_rid, pass[i].acb_info); + + copy_unistr2(&sam->str[i].uni_srv_name, + &pass[i].uni_user_name); + copy_unistr2(&sam->str[i].uni_srv_desc, + &pass[i].uni_acct_desc); + + dsize += sizeof(SAM_ENTRY2); + dsize += len_sam_name + len_sam_desc; } - sam->num_entries = entries_added; - sam->ptr_entries = 1; - sam->num_entries2 = entries_added; + *num_entries = i; + *data_size = dsize; } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_info_1(char *desc, SAM_INFO_1 *sam, prs_struct *ps, int depth) +static BOOL sam_io_sam_dispinfo_2(char *desc, SAM_DISPINFO_2 * sam, + uint32 num_entries, + prs_struct *ps, int depth) { - int i; + uint32 i; if (sam == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_sam_info_1"); + prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_2"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32("num_entries ", ps, depth, &sam->num_entries)) - return False; - if(!prs_uint32("ptr_entries ", ps, depth, &sam->ptr_entries)) - return False; - - if(!prs_uint32("num_entries2 ", ps, depth, &sam->num_entries2)) - return False; - - SMB_ASSERT_ARRAY(sam->sam, sam->num_entries); + SMB_ASSERT_ARRAY(sam->sam, num_entries); - for (i = 0; i < sam->num_entries; i++) { - if(!sam_io_sam_entry1("", &sam->sam[i], ps, depth)) + for (i = 0; i < num_entries; i++) { + if(!sam_io_sam_entry2("", &sam->sam[i], ps, depth)) return False; } - for (i = 0; i < sam->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; + 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 SAMR_R_QUERY_DISPINFO structure. +inits a SAM_DISPINFO_3 structure. ********************************************************************/ -void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO *r_u, - uint16 switch_level, SAM_INFO_CTR *ctr, uint32 status) +void init_sam_dispinfo_3(SAM_DISPINFO_3 * sam, uint32 *num_entries, + uint32 *data_size, uint32 start_idx, + DOMAIN_GRP * grp) { - DEBUG(5,("init_samr_r_query_dispinfo\n")); + uint32 len_sam_name, len_sam_desc; + uint32 max_entries, max_data_size; + uint32 dsize = 0; + uint32 i; - if (status == 0x0 || status == 0x105) { - r_u->unknown_0 = 0x0000001; - r_u->unknown_1 = 0x0000001; - } else { - r_u->unknown_0 = 0x0; - r_u->unknown_1 = 0x0; + DEBUG(5, ("init_sam_dispinfo_3\n")); + + ZERO_STRUCTP(sam); + + max_entries = *num_entries; + max_data_size = *data_size; + + for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) { + len_sam_name = strlen(grp[i].name); + len_sam_desc = strlen(grp[i].comment); + + init_sam_entry3(&sam->sam[i], start_idx + i + 1, len_sam_name, len_sam_desc, grp[i].rid); + + init_unistr2(&sam->str[i].uni_grp_name, grp[i].name, len_sam_name); + init_unistr2(&sam->str[i].uni_grp_desc, grp[i].comment, len_sam_desc); + + dsize += sizeof(SAM_ENTRY3); + dsize += (len_sam_name + len_sam_desc) * 2; + dsize += 14; } - r_u->switch_level = switch_level; - r_u->ctr = ctr; - r_u->status = status; + *num_entries = i; + *data_size = dsize; } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct *ps, int depth) +static BOOL sam_io_sam_dispinfo_3(char *desc, SAM_DISPINFO_3 * sam, + uint32 num_entries, + prs_struct *ps, int depth) { - if (r_u == NULL) + uint32 i; + + if (sam == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_query_dispinfo"); + prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_3"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32("unknown_0 ", ps, depth, &r_u->unknown_0)) - return False; - if(!prs_uint32("unknown_1 ", ps, depth, &r_u->unknown_1)) - return False; - if(!prs_uint16("switch_level ", ps, depth, &r_u->switch_level)) - return False; - - if(!prs_align(ps)) - return False; + SMB_ASSERT_ARRAY(sam->sam, num_entries); - switch (r_u->switch_level) { - case 0x1: - if(!sam_io_sam_info_1("users", r_u->ctr->sam.info1, ps, depth)) + for (i = 0; i < num_entries; i++) { + if(!sam_io_sam_entry3("", &sam->sam[i], ps, depth)) return False; - break; - case 0x2: - if(!sam_io_sam_info_2("servers", r_u->ctr->sam.info2, ps, depth)) - return False; - break; - default: - DEBUG(5,("samr_io_r_query_dispinfo: unknown switch value\n")); - break; } - if(!prs_uint32("status", ps, depth, &r_u->status)) - 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 SAMR_Q_ENUM_DOM_GROUPS structure. +inits a SAM_DISPINFO_4 structure. ********************************************************************/ -void init_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol, - uint16 switch_level, uint32 start_idx, uint32 size) +void init_sam_dispinfo_4(SAM_DISPINFO_4 * sam, uint32 *num_entries, + uint32 *data_size, uint32 start_idx, + SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) { - DEBUG(5,("init_q_enum_dom_groups\n")); + fstring sam_name; + uint32 len_sam_name; + uint32 max_entries, max_data_size; + uint32 dsize = 0; + uint32 i; - memcpy(&q_e->pol, pol, sizeof(*pol)); + DEBUG(5, ("init_sam_dispinfo_4\n")); - q_e->switch_level = switch_level; + ZERO_STRUCTP(sam); - q_e->unknown_0 = 0; - q_e->start_idx = start_idx; - q_e->unknown_1 = 0x000007d0; - q_e->max_size = size; + max_entries = *num_entries; + max_data_size = *data_size; + + for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) { + len_sam_name = pass[i].uni_user_name.uni_str_len; + + init_sam_entry4(&sam->sam[i], start_idx + i + 1, + len_sam_name); + + unistr2_to_ascii(sam_name, &pass[i].uni_user_name, + sizeof(sam_name)); + init_string2(&sam->str[i].acct_name, sam_name, + len_sam_name); + + dsize += sizeof(SAM_ENTRY4); + dsize += len_sam_name; + } + + *num_entries = i; + *data_size = dsize; } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_enum_dom_groups(char *desc, SAMR_Q_ENUM_DOM_GROUPS *q_e, prs_struct *ps, int depth) +static BOOL sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 * sam, + uint32 num_entries, + prs_struct *ps, int depth) { - if (q_e == NULL) + uint32 i; + + if (sam == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_q_enum_dom_groups"); + prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_4"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) - return False; - if(!prs_align(ps)) - return False; + SMB_ASSERT_ARRAY(sam->sam, num_entries); - if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level)) - return False; - if(!prs_uint16("unknown_0 ", ps, depth, &q_e->unknown_0)) - return False; - if(!prs_uint32("start_idx ", ps, depth, &q_e->start_idx)) - return False; - if(!prs_uint32("unknown_1 ", ps, depth, &q_e->unknown_1)) - return False; - if(!prs_uint32("max_size ", ps, depth, &q_e->max_size)) - return False; + for (i = 0; i < num_entries; i++) { + if(!sam_io_sam_entry4("", &sam->sam[i], ps, depth)) + return False; + } - if(!prs_align(ps)) - 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; + if(!prs_align(ps)) + return False; + } return True; } - /******************************************************************* - Inits a SAMR_R_ENUM_DOM_GROUPS structure. +inits a SAM_DISPINFO_5 structure. ********************************************************************/ -void init_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u, - uint32 start_idx, uint32 num_sam_entries, - SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES], - uint32 status) +void init_sam_dispinfo_5(SAM_DISPINFO_5 * sam, uint32 *num_entries, + uint32 *data_size, uint32 start_idx, + DOMAIN_GRP * grp) { - int i; - int entries_added; + uint32 len_sam_name; + uint32 max_entries, max_data_size; + uint32 dsize = 0; + uint32 i; - DEBUG(5,("init_samr_r_enum_dom_groups\n")); + DEBUG(5, ("init_sam_dispinfo_5\n")); - if (num_sam_entries >= MAX_SAM_ENTRIES) { - num_sam_entries = MAX_SAM_ENTRIES; - DEBUG(5,("limiting number of entries to %d\n", - num_sam_entries)); - } + ZERO_STRUCTP(sam); - if (status == 0x0) { - for (i = start_idx, entries_added = 0; i < num_sam_entries; i++) { - init_sam_entry3(&r_u->sam[entries_added], - start_idx + entries_added + 1, - pass[i].uni_user_name.uni_str_len, - pass[i].uni_acct_desc.uni_str_len, - pass[i].user_rid); - - copy_unistr2(&r_u->str[entries_added].uni_grp_name, - &pass[i].uni_user_name); - copy_unistr2(&r_u->str[entries_added].uni_grp_desc, - &pass[i].uni_acct_desc); - - entries_added++; - } + max_entries = *num_entries; + max_data_size = *data_size; - if (entries_added > 0) { - r_u->unknown_0 = 0x0000492; - r_u->unknown_1 = 0x000049a; - } else { - r_u->unknown_0 = 0x0; - r_u->unknown_1 = 0x0; - } - r_u->switch_level = 3; - r_u->num_entries = entries_added; - r_u->ptr_entries = 1; - r_u->num_entries2 = entries_added; - } else { - r_u->switch_level = 0; + for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) { + len_sam_name = strlen(grp[i].name); + + init_sam_entry5(&sam->sam[i], start_idx + i + 1, + len_sam_name); + + init_string2(&sam->str[i].grp_name, grp[i].name, + len_sam_name); + + dsize += sizeof(SAM_ENTRY5); + dsize += len_sam_name; } - - r_u->status = status; + + *num_entries = i; + *data_size = dsize; } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_struct *ps, int depth) +static BOOL sam_io_sam_dispinfo_5(char *desc, SAM_DISPINFO_5 * sam, + uint32 num_entries, + prs_struct *ps, int depth) { - int i; + uint32 i; - if (r_u == NULL) + if (sam == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_enum_dom_groups"); + prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_5"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32("unknown_0 ", ps, depth, &r_u->unknown_0)) - return False; - if(!prs_uint32("unknown_1 ", ps, depth, &r_u->unknown_1)) - return False; - if(!prs_uint32("switch_level ", ps, depth, &r_u->switch_level)) - return False; + SMB_ASSERT_ARRAY(sam->sam, num_entries); - if (r_u->switch_level != 0) { - if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries)) - return False; - if(!prs_uint32("ptr_entries ", ps, depth, &r_u->ptr_entries)) + for (i = 0; i < num_entries; i++) { + if(!sam_io_sam_entry5("", &sam->sam[i], ps, depth)) return False; + } - if(!prs_uint32("num_entries2 ", ps, depth, &r_u->num_entries2)) + 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; + if(!prs_align(ps)) return False; - - SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries); - - for (i = 0; i < r_u->num_entries; i++) { - if(!sam_io_sam_entry3("", &r_u->sam[i], ps, depth)) - return False; - } - - for (i = 0; i < r_u->num_entries; i++) { - if(!sam_io_sam_str3 ("", &r_u->str[i], - r_u->sam[i].hdr_grp_name.buffer, - r_u->sam[i].hdr_grp_desc.buffer, - ps, depth)) - return False; - } } - if(!prs_uint32("status", ps, depth, &r_u->status)) - return False; - return True; } /******************************************************************* - Inits a SAMR_Q_QUERY_ALIASINFO structure. +inits a SAMR_R_QUERY_DISPINFO structure. ********************************************************************/ -void init_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO *q_e, - POLICY_HND *pol, - uint16 switch_level) +void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO * r_u, + uint32 num_entries, uint32 data_size, + uint16 switch_level, SAM_DISPINFO_CTR * ctr, + uint32 status) { - DEBUG(5,("init_q_query_aliasinfo\n")); + DEBUG(5, ("init_samr_r_query_dispinfo: level %d\n", switch_level)); - memcpy(&q_e->pol, pol, sizeof(*pol)); + r_u->total_size = data_size; /* not calculated */ + r_u->data_size = data_size; - q_e->switch_level = switch_level; + 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. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_aliasinfo(char *desc, SAMR_Q_QUERY_ALIASINFO *q_e, prs_struct *ps, int depth) +BOOL samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO * r_u, + prs_struct *ps, int depth) { - if (q_e == NULL) + if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_q_query_aliasinfo"); + prs_debug(ps, depth, desc, "samr_io_r_query_dispinfo"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) + 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_uint16("switch_level", ps, depth, &q_e->switch_level)) + 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; - return True; -} - -/******************************************************************* - Inits a SAMR_R_QUERY_ALIASINFO structure. -********************************************************************/ - -void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *r_u, uint32 switch_level, - char* alias, char* alias_desc) - -{ - int alias_desc_len, alias_len; - - if(r_u == NULL) - return; - - alias_len = alias?strlen(alias)+1:0; - alias_desc_len = alias_desc?strlen(alias_desc)+1:0; + if (r_u->ptr_entries==0) { + if(!prs_align(ps)) + return False; + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; - DEBUG(5,("init_samr_r_query_aliasinfo\n")); + return True; + } - r_u->switch_value = switch_level; + if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2)) + return False; - if(r_u->status == 0) - { - switch(switch_level) - { - case 1: - { - r_u->ptr = 1; - init_uni_hdr(&r_u->alias.info1.hdr_alias_name, alias_len); - init_unistr2(&r_u->alias.info1.uni_alias_name, alias, alias_len); - r_u->alias.info1.switch_value_1 = switch_level; - init_uni_hdr(&r_u->alias.info1.hdr_alias_desc, alias_desc_len); - init_unistr2(&r_u->alias.info1.uni_alias_desc, alias_desc, alias_desc_len); - break; - } - case 3: - { - r_u->ptr = 1; - init_uni_hdr(&r_u->alias.info3.hdr_acct_desc, alias_desc_len); - init_unistr2(&r_u->alias.info3.uni_acct_desc, alias_desc, alias_desc_len); - break; - } + 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: - { - r_u->status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS; - } + DEBUG(0,("samr_io_r_query_dispinfo: unknown switch value\n")); + break; } - } -} + + if(!prs_align(ps)) + return False; + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; - + return True; +} /******************************************************************* - Reads or writes a structure. +inits a SAMR_Q_OPEN_GROUP structure. ********************************************************************/ -BOOL samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO *r_u, prs_struct *ps, int depth) +void init_samr_q_open_group(SAMR_Q_OPEN_GROUP * q_c, + POLICY_HND *hnd, + uint32 access_mask, uint32 rid) { - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr ", ps, depth, &r_u->ptr)) - return False; - - if (r_u->ptr != 0) { - if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value)) - return False; - if(!prs_align(ps)) - return False; - - if (r_u->switch_value != 0) { - switch (r_u->switch_value) { - case 1: - smb_io_unihdr("",&r_u->alias.info1.hdr_alias_name, ps, depth); - prs_uint32("switch_value_1", ps, depth, &r_u->alias.info1.switch_value_1); - smb_io_unihdr("",&r_u->alias.info1.hdr_alias_desc, ps, depth); - - smb_io_unistr2("", &r_u->alias.info1.uni_alias_name, - r_u->alias.info1.hdr_alias_name.buffer, ps, depth); - smb_io_unistr2("", &r_u->alias.info1.uni_alias_desc, - r_u->alias.info1.hdr_alias_desc.buffer, ps, depth); - break; - case 3: - if(!smb_io_unihdr ("", &r_u->alias.info3.hdr_acct_desc, ps, depth)) - return False; - if(!smb_io_unistr2("", &r_u->alias.info3.uni_acct_desc, - r_u->alias.info3.hdr_acct_desc.buffer, ps, depth)) - return False; - break; - default: - DEBUG(4,("samr_io_r_query_aliasinfo: unsupported switch level\n")); - break; - } - } - } + DEBUG(5, ("init_samr_q_open_group\n")); - if(!prs_align(ps)) - return False; - - if(!prs_uint32("status", ps, depth, &r_u->status)) - return False; - - return True; + q_c->domain_pol = *hnd; + q_c->access_mask = access_mask; + q_c->rid_group = rid; } /******************************************************************* - Reads or writes a SAMR_Q_LOOKUP_IDS structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_lookup_ids(char *desc, SAMR_Q_LOOKUP_IDS *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_open_group(char *desc, SAMR_Q_OPEN_GROUP * q_u, + prs_struct *ps, int depth) { - fstring tmp; - int i; - if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_q_lookup_ids"); + prs_debug(ps, depth, desc, "samr_io_q_open_group"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &(q_u->pol), ps, depth)) - return False; - if(!prs_align(ps)) + if(!smb_io_pol_hnd("domain_pol", &q_u->domain_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)) + if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask)) return False; - if(!prs_uint32("num_sids2", ps, depth, &q_u->num_sids2)) + if(!prs_uint32("rid_group", ps, depth, &q_u->rid_group)) return False; - SMB_ASSERT_ARRAY(q_u->ptr_sid, q_u->num_sids2); + return True; +} - 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; - } +/******************************************************************* +reads or writes a structure. +********************************************************************/ - 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; - } - } +BOOL samr_io_r_open_group(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_uint32("status", ps, depth, &r_u->status)) + return False; + return True; } /******************************************************************* - Inits a SAMR_R_LOOKUP_IDS structure. +inits a GROUP_INFO1 structure. ********************************************************************/ -void init_samr_r_lookup_ids(SAMR_R_LOOKUP_IDS *r_u, - uint32 num_rids, uint32 *rid, uint32 status) +void init_samr_group_info1(GROUP_INFO1 * gr1, + char *acct_name, char *acct_desc, + uint32 num_members) { - int i; + int desc_len = acct_desc != NULL ? strlen(acct_desc) : 0; + int acct_len = acct_name != NULL ? strlen(acct_name) : 0; - DEBUG(5,("init_samr_r_lookup_ids\n")); + DEBUG(5, ("init_samr_group_info1\n")); - if (status == 0x0) { - r_u->num_entries = num_rids; - r_u->ptr = 1; - r_u->num_entries2 = num_rids; + init_uni_hdr(&gr1->hdr_acct_name, acct_len); - SMB_ASSERT_ARRAY(r_u->rid, num_rids); + gr1->unknown_1 = 0x3; + gr1->num_members = num_members; - for (i = 0; i < num_rids; i++) { - r_u->rid[i] = rid[i]; - } - } else { - r_u->num_entries = 0; - r_u->ptr = 0; - r_u->num_entries2 = 0; - } + init_uni_hdr(&gr1->hdr_acct_desc, desc_len); - r_u->status = status; + init_unistr2(&gr1->uni_acct_name, acct_name, acct_len); + init_unistr2(&gr1->uni_acct_desc, acct_desc, desc_len); } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_lookup_ids(char *desc, SAMR_R_LOOKUP_IDS *r_u, prs_struct *ps, int depth) +BOOL samr_io_group_info1(char *desc, GROUP_INFO1 * gr1, + prs_struct *ps, int depth) { - fstring tmp; - int i; - - if (r_u == NULL) + if (gr1 == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_lookup_ids"); + prs_debug(ps, depth, desc, "samr_io_group_info1"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32("num_entries", ps, depth, &r_u->num_entries)) + if(!smb_io_unihdr("hdr_acct_name", &gr1->hdr_acct_name, ps, depth)) return False; - if(!prs_uint32("ptr ", ps, depth, &r_u->ptr)) + + if(!prs_uint32("unknown_1", ps, depth, &gr1->unknown_1)) return False; - if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2)) + if(!prs_uint32("num_members", ps, depth, &gr1->num_members)) return False; - if (r_u->num_entries != 0) { - SMB_ASSERT_ARRAY(r_u->rid, r_u->num_entries2); + if(!smb_io_unihdr("hdr_acct_desc", &gr1->hdr_acct_desc, ps, depth)) + return False; - for (i = 0; i < r_u->num_entries2; i++) { - slprintf(tmp, sizeof(tmp)-1, "rid[%02d]", i); - if(!prs_uint32(tmp, ps, depth, &r_u->rid[i])) - return False; - } - } + if(!smb_io_unistr2("uni_acct_name", &gr1->uni_acct_name, + gr1->hdr_acct_name.buffer, ps, depth)) + return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!smb_io_unistr2("uni_acct_desc", &gr1->uni_acct_desc, + gr1->hdr_acct_desc.buffer, ps, depth)) return False; return True; } /******************************************************************* - Reads or writes a structure. +inits a GROUP_INFO4 structure. ********************************************************************/ -BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *ps, int depth) +void init_samr_group_info4(GROUP_INFO4 * gr4, char *acct_desc) { - int i; + int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - if (q_u == NULL) - return False; + DEBUG(5, ("init_samr_group_info4\n")); - prs_debug(ps, depth, desc, "samr_io_q_lookup_names"); - depth++; + init_uni_hdr(&gr4->hdr_acct_desc, acct_len); + init_unistr2(&gr4->uni_acct_desc, acct_desc, acct_len); +} - prs_align(ps); +/******************************************************************* +reads or writes a structure. +********************************************************************/ - if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) +BOOL samr_io_group_info4(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_align(ps)) return False; - if(!prs_uint32("num_names1", ps, depth, &q_u->num_names1)) - return False; - if(!prs_uint32("flags ", ps, depth, &q_u->flags)) + if(!smb_io_unihdr("hdr_acct_desc", &gr4->hdr_acct_desc, ps, depth)) return False; - if(!prs_uint32("ptr ", ps, depth, &q_u->ptr)) + if(!smb_io_unistr2("uni_acct_desc", &gr4->uni_acct_desc, + gr4->hdr_acct_desc.buffer, ps, depth)) return False; - if(!prs_uint32("num_names2", ps, depth, &q_u->num_names2)) + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +static BOOL samr_group_info_ctr(char *desc, GROUP_INFO_CTR * ctr, + prs_struct *ps, int depth) +{ + if (ctr == NULL) return False; - SMB_ASSERT_ARRAY(q_u->hdr_name, q_u->num_names2); + prs_debug(ps, depth, desc, "samr_group_info_ctr"); + depth++; - for (i = 0; i < q_u->num_names2; i++) { - if(!smb_io_unihdr ("", &q_u->hdr_name[i], ps, depth)) + if(!prs_uint16("switch_value1", ps, depth, &ctr->switch_value1)) + return False; + if(!prs_uint16("switch_value2", ps, depth, &ctr->switch_value2)) + return False; + + switch (ctr->switch_value1) { + case 1: + if(!samr_io_group_info1("group_info1", + &ctr->group.info1, 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)) + break; + case 4: + if(!samr_io_group_info4("group_info4", + &ctr->group.info4, ps, depth)) return False; + break; + default: + DEBUG(0,("samr_group_info_ctr: unsupported switch level\n")); + break; } return True; } - /******************************************************************* - Inits a SAMR_R_LOOKUP_NAMES structure. +inits a SAMR_Q_CREATE_DOM_GROUP structure. ********************************************************************/ -void init_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, - uint32 num_rids, uint32 *rid, enum SID_NAME_USE *type, uint32 status) -{ - int i; - - DEBUG(5,("init_samr_r_lookup_names\n")); - - if (status == 0x0) { - 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; +void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e, + POLICY_HND *pol, char *acct_desc, + uint32 access_mask) +{ + int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - SMB_ASSERT_ARRAY(r_u->rid, num_rids); + DEBUG(5, ("init_samr_q_create_dom_group\n")); - for (i = 0; i < num_rids; i++) { - r_u->rid [i] = rid [i]; - r_u->type[i] = type[i]; - } - } else { - r_u->num_types1 = 0; - r_u->ptr_types = 0; - r_u->num_types2 = 0; + q_e->pol = *pol; - r_u->num_rids1 = 0; - r_u->ptr_rids = 0; - r_u->num_rids2 = 0; - } + init_uni_hdr(&q_e->hdr_acct_desc, acct_len); + init_unistr2(&q_e->uni_acct_desc, acct_desc, acct_len); - r_u->status = status; + q_e->access_mask = access_mask; } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *ps, int depth) +BOOL samr_io_q_create_dom_group(char *desc, SAMR_Q_CREATE_DOM_GROUP * q_e, + prs_struct *ps, int depth) { - int i; - fstring tmp; - - if (r_u == NULL) + if (q_e == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_lookup_names"); + prs_debug(ps, depth, desc, "samr_io_q_create_dom_group"); depth++; 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 )) + if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) 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; - } - - 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->rid[i])) - return False; - } - } - - if(!prs_uint32("num_types1", ps, depth, &r_u->num_types1)) + if(!smb_io_unihdr("hdr_acct_desc", &q_e->hdr_acct_desc, ps, depth)) return False; - if(!prs_uint32("ptr_types ", ps, depth, &r_u->ptr_types)) + if(!smb_io_unistr2("uni_acct_desc", &q_e->uni_acct_desc, + q_e->hdr_acct_desc.buffer, ps, depth)) 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; - } - - 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_uint32("status", ps, depth, &r_u->status)) + 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. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS *q_u, prs_struct *ps, int depth) +BOOL samr_io_r_create_dom_group(char *desc, SAMR_R_CREATE_DOM_GROUP * r_u, + prs_struct *ps, int depth) { - int i; - fstring tmp; - - if (q_u == NULL) + if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_q_lookup_rids"); + prs_debug(ps, depth, desc, "samr_io_r_create_dom_group"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) - return False; - if(!prs_align(ps)) + if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) return False; - if(!prs_uint32("num_gids1", ps, depth, &q_u->num_gids1)) - return False; - if(!prs_uint32("rid ", ps, depth, &q_u->rid)) - return False; - if(!prs_uint32("ptr ", ps, depth, &q_u->ptr)) + if(!prs_uint32("rid ", ps, depth, &r_u->rid)) return False; - if(!prs_uint32("num_gids2", ps, depth, &q_u->num_gids2)) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; - SMB_ASSERT_ARRAY(q_u->gid, q_u->num_gids2); - - for (i = 0; i < q_u->num_gids2; i++) { - slprintf(tmp, sizeof(tmp) - 1, "gid[%02d] ", i); - if(!prs_uint32(tmp, ps, depth, &q_u->gid[i])) - return False; - } - return True; } /******************************************************************* - Inits a SAMR_R_UNKNOWN_12 structure. +inits a SAMR_Q_DELETE_DOM_GROUP structure. ********************************************************************/ -void init_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u, - uint32 num_aliases, fstring *als_name, uint32 *num_als_usrs, - uint32 status) +void init_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP * q_c, + POLICY_HND *hnd) { - int i; + DEBUG(5, ("init_samr_q_delete_dom_group\n")); - DEBUG(5,("init_samr_r_lookup_rids\n")); + q_c->group_pol = *hnd; +} - if (status == 0x0) { - r_u->num_aliases1 = num_aliases; - r_u->ptr_aliases = 1; - r_u->num_aliases2 = num_aliases; +/******************************************************************* +reads or writes a structure. +********************************************************************/ - r_u->num_als_usrs1 = num_aliases; - r_u->ptr_als_usrs = 1; - r_u->num_als_usrs2 = num_aliases; +BOOL samr_io_q_delete_dom_group(char *desc, SAMR_Q_DELETE_DOM_GROUP * q_u, + prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; - SMB_ASSERT_ARRAY(r_u->hdr_als_name, num_aliases); + prs_debug(ps, depth, desc, "samr_io_q_delete_dom_group"); + depth++; - for (i = 0; i < num_aliases; i++) { - int als_len = als_name[i] != NULL ? strlen(als_name[i])+1 : 0; - init_uni_hdr(&r_u->hdr_als_name[i], als_len); - init_unistr2(&r_u->uni_als_name[i], als_name[i], als_len); - r_u->num_als_usrs[i] = num_als_usrs[i]; - } - } else { - r_u->num_aliases1 = num_aliases; - r_u->ptr_aliases = 0; - r_u->num_aliases2 = num_aliases; + if(!prs_align(ps)) + return False; - r_u->num_als_usrs1 = num_aliases; - r_u->ptr_als_usrs = 0; - r_u->num_als_usrs2 = num_aliases; - } + if(!smb_io_pol_hnd("group_pol", &q_u->group_pol, ps, depth)) + return False; - r_u->status = status; + return True; } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_delete_dom_group(char *desc, SAMR_R_DELETE_DOM_GROUP * r_u, + prs_struct *ps, int depth) { - int i; - fstring tmp; - if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_lookup_rids"); + prs_debug(ps, depth, desc, "samr_io_r_delete_dom_group"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32("num_aliases1", ps, depth, &r_u->num_aliases1)) - return False; - if(!prs_uint32("ptr_aliases ", ps, depth, &r_u->ptr_aliases )) - return False; - if(!prs_uint32("num_aliases2", ps, depth, &r_u->num_aliases2)) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; - if (r_u->ptr_aliases != 0 && r_u->num_aliases1 != 0) { - SMB_ASSERT_ARRAY(r_u->hdr_als_name, r_u->num_aliases2); + return True; +} - for (i = 0; i < r_u->num_aliases2; i++) { - slprintf(tmp, sizeof(tmp) - 1, "als_hdr[%02d] ", i); - if(!smb_io_unihdr ("", &r_u->hdr_als_name[i], ps, depth)) - return False; - } - for (i = 0; i < r_u->num_aliases2; i++) { - slprintf(tmp, sizeof(tmp) - 1, "als_str[%02d] ", i); - if(!smb_io_unistr2("", &r_u->uni_als_name[i], r_u->hdr_als_name[i].buffer, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - } - } +/******************************************************************* +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(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(!prs_uint32("num_als_usrs1", ps, depth, &r_u->num_als_usrs1)) + if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) return False; - if(!prs_uint32("ptr_als_usrs ", ps, depth, &r_u->ptr_als_usrs)) + + if(!prs_uint32("rid", ps, depth, &q_e->rid)) return False; - if(!prs_uint32("num_als_usrs2", ps, depth, &r_u->num_als_usrs2)) + + return True; +} + +/******************************************************************* +inits a SAMR_R_DEL_GROUPMEM structure. +********************************************************************/ + +void init_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM * r_u, POLICY_HND *pol, + uint32 status) +{ + DEBUG(5, ("init_samr_r_del_groupmem\n")); + + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_r_del_groupmem(char *desc, SAMR_R_DEL_GROUPMEM * r_u, + prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; - if (r_u->ptr_als_usrs != 0 && r_u->num_als_usrs1 != 0) { - SMB_ASSERT_ARRAY(r_u->num_als_usrs, r_u->num_als_usrs2); + prs_debug(ps, depth, desc, "samr_io_r_del_groupmem"); + depth++; - for (i = 0; i < r_u->num_als_usrs2; i++) { - slprintf(tmp, sizeof(tmp) - 1, "als_usrs[%02d] ", i); - if(!prs_uint32(tmp, ps, depth, &r_u->num_als_usrs[i])) - return False; - } - } + if(!prs_align(ps)) + return False; if(!prs_uint32("status", ps, depth, &r_u->status)) return False; @@ -2545,73 +2289,75 @@ BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, return True; } - /******************************************************************* - Inits a SAMR_Q_OPEN_USER struct. +inits a SAMR_Q_ADD_GROUPMEM structure. ********************************************************************/ -void init_samr_q_open_user(SAMR_Q_OPEN_USER *q_u, POLICY_HND *pol, - uint32 access_mask, uint32 rid) +void init_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM * q_e, + POLICY_HND *pol, uint32 rid) { - DEBUG(5,("init_samr_q_open_user\n")); + DEBUG(5, ("init_samr_q_add_groupmem\n")); - q_u->domain_pol = *pol; - q_u->access_mask = access_mask; - q_u->user_rid = rid; + q_e->pol = *pol; + q_e->rid = rid; + q_e->unknown = 0x0005; } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER *q_u, - prs_struct *ps, int depth) +BOOL samr_io_q_add_groupmem(char *desc, SAMR_Q_ADD_GROUPMEM * q_e, + prs_struct *ps, int depth) { - if (q_u == NULL) + if (q_e == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_q_open_user"); + prs_debug(ps, depth, desc, "samr_io_q_add_groupmem"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth)) - return False; - if(!prs_align(ps)) + if(!smb_io_pol_hnd("pol", &q_e->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)) + if(!prs_uint32("rid ", ps, depth, &q_e->rid)) return False; - - if(!prs_align(ps)) + if(!prs_uint32("unknown", ps, depth, &q_e->unknown)) return False; return True; } /******************************************************************* - Reads or writes a structure. +inits a SAMR_R_ADD_GROUPMEM structure. +********************************************************************/ + +void init_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM * r_u, POLICY_HND *pol, + uint32 status) +{ + DEBUG(5, ("init_samr_r_add_groupmem\n")); + + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_add_groupmem(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_open_user"); + prs_debug(ps, depth, desc, "samr_io_r_add_groupmem"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) return False; @@ -2619,102 +2365,70 @@ BOOL samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER *r_u, prs_struct *ps, int } /******************************************************************* - Inits a SAMR_Q_QUERY_USERGROUPS structure. +inits a SAMR_Q_SET_GROUPINFO structure. ********************************************************************/ -void init_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u, - POLICY_HND *hnd) +void init_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO * q_e, + POLICY_HND *pol, GROUP_INFO_CTR * ctr) { - DEBUG(5,("init_samr_q_query_usergroups\n")); + DEBUG(5, ("init_samr_q_set_groupinfo\n")); - memcpy(&q_u->pol, hnd, sizeof(q_u->pol)); + q_e->pol = *pol; + q_e->ctr = ctr; } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_set_groupinfo(char *desc, SAMR_Q_SET_GROUPINFO * q_e, + prs_struct *ps, int depth) { - if (q_u == NULL) + if (q_e == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_q_query_usergroups"); + prs_debug(ps, depth, desc, "samr_io_q_set_groupinfo"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) + if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) return False; - if(!prs_align(ps)) + + if(!samr_group_info_ctr("ctr", q_e->ctr, ps, depth)) return False; return True; } /******************************************************************* - Inits a SAMR_R_QUERY_USERGROUPS structure. +inits a SAMR_R_SET_GROUPINFO structure. ********************************************************************/ -void init_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u, - uint32 num_gids, DOM_GID *gid, uint32 status) +void init_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO * r_u, uint32 status) { - DEBUG(5,("init_samr_r_query_usergroups\n")); - - if (status == 0x0) { - r_u->ptr_0 = 1; - r_u->num_entries = num_gids; - r_u->ptr_1 = 1; - 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; - } + DEBUG(5, ("init_samr_r_set_groupinfo\n")); r_u->status = status; } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_set_groupinfo(char *desc, SAMR_R_SET_GROUPINFO * r_u, + prs_struct *ps, int depth) { - int i; - if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_query_usergroups"); + prs_debug(ps, depth, desc, "samr_io_r_set_groupinfo"); 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) { - if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2)) - return False; - - for (i = 0; i < r_u->num_entries2; i++) { - if(!smb_io_gid("", &r_u->gid[i], ps, depth)) - return False; - } - } - } - if(!prs_uint32("status", ps, depth, &r_u->status)) return False; @@ -2722,223 +2436,2540 @@ BOOL samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_s } /******************************************************************* - Inits a SAMR_Q_QUERY_USERINFO structure. +inits a SAMR_Q_QUERY_GROUPINFO structure. ********************************************************************/ -void init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO *q_u, - POLICY_HND *hnd, uint16 switch_value) +void init_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO * q_e, + POLICY_HND *pol, uint16 switch_level) { - DEBUG(5,("init_samr_q_query_userinfo\n")); + DEBUG(5, ("init_samr_q_query_groupinfo\n")); - memcpy(&q_u->pol, hnd, sizeof(q_u->pol)); - q_u->switch_value = switch_value; + q_e->pol = *pol; + + q_e->switch_level = switch_level; } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_userinfo(char *desc, SAMR_Q_QUERY_USERINFO *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_query_groupinfo(char *desc, SAMR_Q_QUERY_GROUPINFO * q_e, + prs_struct *ps, int depth) { - if (q_u == NULL) + if (q_e == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_q_query_userinfo"); + prs_debug(ps, depth, desc, "samr_io_q_query_groupinfo"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) - return False; - if(!prs_align(ps)) + if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) return False; - if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) /* 0x0015 or 0x0011 */ + if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level)) return False; return True; } /******************************************************************* - Reads or writes a LOGON_HRS structure. +inits a SAMR_R_QUERY_GROUPINFO structure. ********************************************************************/ -static BOOL sam_io_logon_hrs(char *desc, LOGON_HRS *hrs, prs_struct *ps, int depth) +void init_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO * r_u, + GROUP_INFO_CTR * ctr, uint32 status) { - if (hrs == NULL) + DEBUG(5, ("init_samr_r_query_groupinfo\n")); + + r_u->ptr = (status == 0x0 && ctr != NULL) ? 1 : 0; + r_u->ctr = ctr; + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_r_query_groupinfo(char *desc, SAMR_R_QUERY_GROUPINFO * r_u, + prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_logon_hrs"); + prs_debug(ps, depth, desc, "samr_io_r_query_groupinfo"); depth++; if(!prs_align(ps)) return False; - - if(!prs_uint32 ("len ", ps, depth, &hrs->len)) + + if(!prs_uint32("ptr", ps, depth, &r_u->ptr)) return False; - if (hrs->len > 64) { - DEBUG(5,("sam_io_logon_hrs: truncating length\n")); - hrs->len = 64; + if (r_u->ptr != 0) { + if(!samr_group_info_ctr("ctr", r_u->ctr, ps, depth)) + return False; } - if(!prs_uint8s (False, "hours", ps, depth, hrs->hours, hrs->len)) + if(!prs_align(ps)) + return False; + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; } /******************************************************************* - Inits a SAM_USER_INFO_10 structure. +inits a SAMR_Q_QUERY_GROUPMEM structure. ********************************************************************/ -void init_sam_user_info10(SAM_USER_INFO_10 *usr, - uint32 acb_info) +void init_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM * q_c, POLICY_HND *hnd) { - DEBUG(5,("init_sam_user_info10\n")); + DEBUG(5, ("init_samr_q_query_groupmem\n")); - usr->acb_info = acb_info; + q_c->group_pol = *hnd; } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL sam_io_user_info10(char *desc, SAM_USER_INFO_10 *usr, prs_struct *ps, int depth) +BOOL samr_io_q_query_groupmem(char *desc, SAMR_Q_QUERY_GROUPMEM * q_u, + prs_struct *ps, int depth) { - if (usr == NULL) + if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_user_info10"); + prs_debug(ps, depth, desc, "samr_io_q_query_groupmem"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32("acb_info", ps, depth, &usr->acb_info)) + if(!smb_io_pol_hnd("group_pol", &q_u->group_pol, ps, depth)) return False; return True; } /******************************************************************* - Inits a SAM_USER_INFO_11 structure. +inits a SAMR_R_QUERY_GROUPMEM structure. ********************************************************************/ -void init_sam_user_info11(SAM_USER_INFO_11 *usr, - NTTIME *expiry, - char *mach_acct, - uint32 rid_user, - uint32 rid_group, - uint16 acct_ctrl) - +void init_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM * r_u, + uint32 num_entries, uint32 *rid, + uint32 *attr, uint32 status) { - int len_mach_acct; + DEBUG(5, ("init_samr_r_query_groupmem\n")); - DEBUG(5,("init_sam_user_info11\n")); - - len_mach_acct = strlen(mach_acct)+1; - - memcpy(&usr->expiry,expiry, sizeof(usr->expiry)); /* expiry time or something? */ - memset((char *)usr->padding_1, '\0', sizeof(usr->padding_1)); /* 0 - padding 24 bytes */ - - init_uni_hdr(&usr->hdr_mach_acct, len_mach_acct); /* unicode header for machine account */ - usr->padding_2 = 0; /* 0 - padding 4 bytes */ - - usr->ptr_1 = 1; /* pointer */ - memset((char *)usr->padding_3, '\0', sizeof(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 */ - memset((char *)usr->padding_6, '\0', sizeof(usr->padding_6)); /* 0 - padding 32 bytes */ - - usr->rid_user = rid_user; - usr->rid_group = rid_group; + if (status == 0x0) { + r_u->ptr = 1; + r_u->num_entries = num_entries; - usr->acct_ctrl = acct_ctrl; - usr->unknown_3 = 0x0000; + r_u->ptr_attrs = attr != NULL ? 1 : 0; + r_u->ptr_rids = rid != NULL ? 1 : 0; - usr->unknown_4 = 0x003f; /* 0x003f - 16 bit unknown */ - usr->unknown_5 = 0x003c; /* 0x003c - 16 bit unknown */ + r_u->num_rids = num_entries; + r_u->rid = rid; - memset((char *)usr->padding_7, '\0', sizeof(usr->padding_7)); /* 0 - padding 16 bytes */ - usr->padding_8 = 0; /* 0 - padding 4 bytes */ - - init_unistr2(&usr->uni_mach_acct, mach_acct, len_mach_acct); /* unicode string for machine account */ + r_u->num_attrs = num_entries; + r_u->attr = attr; + } else { + r_u->ptr = 0; + r_u->num_entries = 0; + } - memset((char *)usr->padding_9, '\0', sizeof(usr->padding_9)); /* 0 - padding 48 bytes */ + r_u->status = status; } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int depth) +BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM * r_u, + prs_struct *ps, int depth) { - if (usr == NULL) + uint32 i; + + if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_unknown_24"); + 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_uint8s (False, "padding_0", ps, depth, usr->padding_0, sizeof(usr->padding_0))) + if(!prs_uint32("ptr", ps, depth, &r_u->ptr)) return False; - - if(!smb_io_time("time", &(usr->expiry), ps, depth)) + if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries)) return False; - if(!prs_uint8s (False, "padding_1", ps, depth, usr->padding_1, sizeof(usr->padding_1))) - 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(!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 (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 = (uint32 *)prs_alloc_mem(ps,sizeof(r_u->rid[0])*r_u->num_rids); + if (r_u->rid == NULL) + 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; + for (i = 0; i < r_u->num_rids; i++) { + if(!prs_uint32("", ps, depth, &r_u->rid[i])) + 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 (r_u->ptr_attrs != 0) { + if(!prs_uint32("num_attrs", ps, depth, &r_u->num_attrs)) + 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 (UNMARSHALLING(ps) && r_u->num_attrs != 0) { + r_u->attr = (uint32 *)prs_alloc_mem(ps,sizeof(r_u->attr[0])*r_u->num_attrs); + if (r_u->attr == NULL) + 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; + for (i = 0; i < r_u->num_attrs; i++) { + if(!prs_uint32("", ps, depth, &r_u->attr[i])) + 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)) + if(!prs_uint32("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(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, + uint32 status) +{ + DEBUG(5, ("init_samr_r_query_usergroups\n")); + + if (status == 0) { + 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(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) = (DOM_GID *)prs_alloc_mem(ps,sizeof(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(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_uint32("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(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(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->sam = (SAM_ENTRY *)prs_alloc_mem(ps,sizeof(SAM_ENTRY)*r_u->num_entries2); + r_u->uni_dom_name = (UNISTR2 *)prs_alloc_mem(ps,sizeof(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_uint32("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(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(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->sam = (SAM_ENTRY *)prs_alloc_mem(ps,sizeof(SAM_ENTRY)*r_u->num_entries2); + r_u->uni_grp_name = (UNISTR2 *)prs_alloc_mem(ps,sizeof(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_uint32("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(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(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 = (SAM_ENTRY *)prs_alloc_mem(ps,sizeof(SAM_ENTRY)*r_u->num_entries2); + r_u->uni_grp_name = (UNISTR2 *)prs_alloc_mem(ps,sizeof(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_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; +} + +/******************************************************************* +inits a ALIAS_INFO3 structure. +********************************************************************/ + +void init_samr_alias_info3(ALIAS_INFO3 * al3, char *acct_desc) +{ + int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; + + DEBUG(5, ("init_samr_alias_info3\n")); + + init_uni_hdr(&al3->hdr_acct_desc, acct_len); + init_unistr2(&al3->uni_acct_desc, acct_desc, acct_len); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_alias_info3(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(!smb_io_unihdr("hdr_acct_desc", &al3->hdr_acct_desc, ps, depth)) + return False; + if(!smb_io_unistr2("uni_acct_desc", &al3->uni_acct_desc, + al3->hdr_acct_desc.buffer, ps, depth)) + return False; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_alias_info_ctr(char *desc, ALIAS_INFO_CTR * ctr, + prs_struct *ps, int depth) +{ + if (ctr == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_alias_info_ctr"); + depth++; + + if(!prs_uint16("switch_value1", ps, depth, &ctr->switch_value1)) + return False; + if(!prs_uint16("switch_value2", ps, depth, &ctr->switch_value2)) + return False; + + switch (ctr->switch_value1) { + 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, uint16 switch_level) +{ + DEBUG(5, ("init_samr_q_query_aliasinfo\n")); + + q_e->pol = *pol; + q_e->switch_level = switch_level; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_q_query_aliasinfo(char *desc, SAMR_Q_QUERY_ALIASINFO * q_e, + prs_struct *ps, int depth) +{ + if (q_e == NULL) + 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", &(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_ALIASINFO structure. +********************************************************************/ + +void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO * r_u, + ALIAS_INFO_CTR * ctr, uint32 status) +{ + DEBUG(5, ("init_samr_r_query_aliasinfo\n")); + + r_u->ptr = (status == 0x0 && ctr != NULL) ? 1 : 0; + r_u->ctr = *ctr; + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO * r_u, + prs_struct *ps, int depth) +{ + if (r_u == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo"); + 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_alias_info_ctr("ctr", &r_u->ctr, ps, depth)) + return False; + } + + if(!prs_align(ps)) + return False; + if(!prs_uint32("status", ps, depth, &r_u->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(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", &q_u->ctr, ps, depth)) + return False; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_r_set_aliasinfo(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_uint32("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(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 = (uint32 *)prs_alloc_mem(ps,sizeof(q_u->ptr_sid[0])*q_u->num_sids2); + if (q_u->ptr_sid == NULL) + return False; + + q_u->sid = (DOM_SID2 *)prs_alloc_mem(ps, sizeof(q_u->sid[0]) * 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, + uint32 status) +{ + DEBUG(5, ("init_samr_r_query_useraliases\n")); + + if (status == 0x0) { + 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(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) = (uint32 *)prs_alloc_mem(ps,sizeof(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(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_uint32("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 unknown_0, uint32 rid) +{ + DEBUG(5, ("init_samr_q_open_alias\n")); + + q_u->dom_pol = *pol; + + /* example values: 0x0000 0008 */ + q_u->unknown_0 = unknown_0; + + q_u->rid_alias = rid; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_q_open_alias(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("unknown_0", ps, depth, &q_u->unknown_0)) + 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(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_uint32("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; + q_u->rid = (uint32 *)talloc_zero(ctx, num_rids * sizeof(q_u->rid[0])); + if (q_u->rid == NULL) { + q_u->num_rids1 = 0; + q_u->num_rids2 = 0; + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_q_lookup_rids(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 = (uint32 *)prs_alloc_mem(ps, sizeof(q_u->rid[0])*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(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 = (UNIHDR *) prs_alloc_mem(ps, r_u->num_names2 * sizeof(r_u->hdr_name[0])); + if (r_u->hdr_name == NULL) + return False; + + r_u->uni_name = (UNISTR2 *)prs_alloc_mem(ps, r_u->num_names2 * sizeof(r_u->uni_name[0])); + 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 = (uint32 *)prs_alloc_mem(ps, r_u->num_types2 * sizeof(r_u->type[0])); + 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_uint32("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(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(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_uint32("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, char *acct_desc) +{ + int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; + + DEBUG(5, ("init_samr_q_create_dom_alias\n")); + + q_u->dom_pol = *hnd; + + init_uni_hdr(&q_u->hdr_acct_desc, acct_len); + init_unistr2(&q_u->uni_acct_desc, acct_desc, acct_len); + + q_u->access_mask = 0x001f000f; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_q_create_dom_alias(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(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_uint32("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(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(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_uint32("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(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(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_uint32("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(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, + uint32 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(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(!prs_uint32("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(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, + uint32 status) +{ + DEBUG(5, ("init_samr_r_query_aliasmem\n")); + + if (status == 0) { + 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(char *desc, SAMR_R_QUERY_ALIASMEM * r_u, + prs_struct *ps, int depth) +{ + uint32 i; + uint32 ptr_sid[MAX_LOOKUP_SIDS]; + + 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) { + SMB_ASSERT_ARRAY(ptr_sid, r_u->num_sids); + + if (r_u->num_sids != 0) { + if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1)) + return False; + + for (i = 0; i < r_u->num_sids1; i++) { + ptr_sid[i] = 1; + if(!prs_uint32("", ps, depth, &ptr_sid[i])) + return False; + } + + for (i = 0; i < r_u->num_sids1; i++) { + if (ptr_sid[i] != 0) { + if(!smb_io_dom_sid2("", &r_u->sid[i], ps, depth)) + return False; + } + } + } + } + + if(!prs_align(ps)) + return False; + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; +} + +/******************************************************************* +inits a SAMR_Q_LOOKUP_NAMES structure. +********************************************************************/ + +void init_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES * q_u, + POLICY_HND *pol, uint32 flags, + uint32 num_names, 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; + + for (i = 0; i < num_names; i++) { + int len_name = name[i] != NULL ? strlen(name[i]) : 0; + init_uni_hdr(&q_u->hdr_name[i], len_name); /* unicode header for user_name */ + init_unistr2(&q_u->uni_name[i], name[i], len_name); /* unicode string for machine account */ + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_q_lookup_names(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; + + SMB_ASSERT_ARRAY(q_u->hdr_name, q_u->num_names2); + + 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. +********************************************************************/ + +void init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, + uint32 num_rids, + uint32 *rid, uint32 *type, + uint32 status) +{ + DEBUG(5, ("init_samr_r_lookup_names\n")); + + if ((status == 0) && (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; + + r_u->rids = (uint32 *)talloc_zero(ctx, sizeof(uint32)*num_rids); + r_u->types = (uint32 *)talloc_zero(ctx, sizeof(uint32)*num_rids); + + if (!r_u->rids || !r_u->types) + goto empty; + + for (i = 0; i < num_rids; i++) { + r_u->rids[i] = rid[i]; + r_u->types[i] = type[i]; + } + } else { + + empty: + 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; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_r_lookup_names(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->rids = (uint32 *)prs_alloc_mem(ps, sizeof(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->types = (uint32 *)prs_alloc_mem(ps, sizeof(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_uint32("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(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(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(!prs_uint32("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(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(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_uint32("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, + char *name, + uint32 acb_info, uint32 access_mask) +{ + int len_name; + len_name = strlen(name); + + DEBUG(5, ("samr_init_samr_q_create_user\n")); + + q_u->domain_pol = *pol; + + init_uni_hdr(&q_u->hdr_name, len_name); + init_unistr2(&q_u->uni_name, name, len_name); + + q_u->acb_info = acb_info; + q_u->access_mask = access_mask; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_q_create_user(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(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("unknown_0", ps, depth, &r_u->unknown_0)) + return False; + if(!prs_uint32("user_rid ", ps, depth, &r_u->user_rid)) + return False; + if(!prs_uint32("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, + 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(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(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("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_12 structure. +********************************************************************/ + +void init_sam_user_info12(SAM_USER_INFO_12 * usr, + uint8 lm_pwd[16], uint8 nt_pwd[16]) +{ + DEBUG(5, ("init_sam_user_info12\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_info12(char *desc, SAM_USER_INFO_12 * u, + prs_struct *ps, int depth) +{ + if (u == NULL) + return False; + + DEBUG(0, ("possible security breach!\n")); + + prs_debug(ps, depth, desc, "samr_io_r_user_info12"); + 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_10 structure. +********************************************************************/ + +void init_sam_user_info10(SAM_USER_INFO_10 * usr, uint32 acb_info) +{ + DEBUG(5, ("init_sam_user_info10\n")); + + usr->acb_info = acb_info; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +static BOOL sam_io_user_info10(char *desc, SAM_USER_INFO_10 * usr, + prs_struct *ps, int depth) +{ + if (usr == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_r_user_info10"); + 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_11 structure. +********************************************************************/ + +void init_sam_user_info11(SAM_USER_INFO_11 * usr, + NTTIME * expiry, + char *mach_acct, + uint32 rid_user, uint32 rid_group, uint16 acct_ctrl) +{ + int len_mach_acct; + + DEBUG(5, ("init_sam_user_info11\n")); + + len_mach_acct = strlen(mach_acct); + + memcpy(&(usr->expiry), expiry, sizeof(usr->expiry)); /* expiry time or something? */ + ZERO_STRUCT(usr->padding_1); /* 0 - padding 24 bytes */ + + init_uni_hdr(&usr->hdr_mach_acct, len_mach_acct); /* unicode header for machine account */ + 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, len_mach_acct); /* unicode string for machine account */ +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +static BOOL sam_io_user_info11(char *desc, SAM_USER_INFO_11 * usr, + prs_struct *ps, int depth) +{ + if (usr == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_r_unknown_11"); + 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; @@ -2948,64 +4979,185 @@ BOOL sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int return True; } -/************************************************************************* - init_sam_user_info21 +/************************************************************************* + init_sam_user_infoa + + unknown_3 = 0x09f8 27fa + unknown_5 = 0x0001 0000 + unknown_6 = 0x0000 04ec + + *************************************************************************/ + +void init_sam_user_info24(SAM_USER_INFO_24 * usr, + char newpass[516], uint16 passlen) +{ + DEBUG(10, ("init_sam_user_info24: passlen: %d\n", passlen)); + memcpy(usr->pass, newpass, sizeof(usr->pass)); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +static BOOL sam_io_user_info24(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; + + return True; +} + +/************************************************************************* + init_sam_user_info23 + + unknown_3 = 0x09f8 27fa + unknown_5 = 0x0001 0000 + 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 unknown_3, + uint16 logon_divs, + LOGON_HRS * hrs, + uint32 unknown_5, + char newpass[516], uint32 unknown_6) +{ + int len_user_name = user_name != NULL ? user_name->uni_str_len : 0; + int len_full_name = full_name != NULL ? full_name->uni_str_len : 0; + int len_home_dir = home_dir != NULL ? home_dir->uni_str_len : 0; + int len_dir_drive = dir_drive != NULL ? dir_drive->uni_str_len : 0; + int len_logon_script = log_scr != NULL ? log_scr->uni_str_len : 0; + int len_profile_path = prof_path != NULL ? prof_path->uni_str_len : 0; + int len_description = desc != NULL ? desc->uni_str_len : 0; + int len_workstations = wkstas != NULL ? wkstas->uni_str_len : 0; + int len_unknown_str = unk_str != NULL ? unk_str->uni_str_len : 0; + int len_munged_dial = mung_dial != NULL ? mung_dial->uni_str_len : 0; + + 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 */ + + init_uni_hdr(&usr->hdr_user_name, len_user_name); /* NULL */ + init_uni_hdr(&usr->hdr_full_name, len_full_name); + init_uni_hdr(&usr->hdr_home_dir, len_home_dir); + init_uni_hdr(&usr->hdr_dir_drive, len_dir_drive); + init_uni_hdr(&usr->hdr_logon_script, len_logon_script); + init_uni_hdr(&usr->hdr_profile_path, len_profile_path); + init_uni_hdr(&usr->hdr_acct_desc, len_description); + init_uni_hdr(&usr->hdr_workstations, len_workstations); + init_uni_hdr(&usr->hdr_unknown_str, len_unknown_str); + init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); + + 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->unknown_3 = unknown_3; /* 09f8 27fa */ + + usr->logon_divs = logon_divs; /* should be 168 (hours/week) */ + usr->ptr_logon_hrs = hrs ? 1 : 0; + + ZERO_STRUCT(usr->padding1); + + usr->unknown_5 = unknown_5; /* 0x0001 0000 */ + + memcpy(usr->pass, newpass, sizeof(usr->pass)); - unknown_3 = 0x00ff ffff - unknown_5 = 0x0002 0000 - unknown_6 = 0x0000 04ec - *************************************************************************/ + copy_unistr2(&usr->uni_user_name, user_name); + copy_unistr2(&usr->uni_full_name, full_name); + copy_unistr2(&usr->uni_home_dir, home_dir); + copy_unistr2(&usr->uni_dir_drive, dir_drive); + copy_unistr2(&usr->uni_logon_script, log_scr); + copy_unistr2(&usr->uni_profile_path, prof_path); + copy_unistr2(&usr->uni_acct_desc, desc); + copy_unistr2(&usr->uni_workstations, wkstas); + copy_unistr2(&usr->uni_unknown_str, unk_str); + copy_unistr2(&usr->uni_munged_dial, mung_dial); -void init_sam_user_info21(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw) -{ - NTTIME logon_time, logoff_time, kickoff_time, - pass_last_set_time, pass_can_change_time, - pass_must_change_time; + usr->unknown_6 = unknown_6; /* 0x0000 04ec */ + usr->padding4 = 0; - int len_user_name, len_full_name, len_home_dir, - len_dir_drive, len_logon_script, len_profile_path, - len_description, len_workstations, len_unknown_str, - len_munged_dial; - - char* user_name = pdb_get_username(pw); - char* full_name = pdb_get_fullname(pw); - char* home_dir = pdb_get_homedir(pw); - char* dir_drive = pdb_get_dirdrive(pw); - char* logon_script = pdb_get_logon_script(pw); - char* profile_path = pdb_get_profile_path(pw); - char* description = pdb_get_acct_desc(pw); - char* workstations = pdb_get_workstations(pw); - char* munged_dial = pdb_get_munged_dial(pw); + memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs)); +} - len_user_name = user_name != NULL ? strlen(user_name )+1 : 0; - len_full_name = full_name != NULL ? strlen(full_name )+1 : 0; - len_home_dir = home_dir != NULL ? strlen(home_dir )+1 : 0; - len_dir_drive = dir_drive != NULL ? strlen(dir_drive )+1 : 0; - len_logon_script = logon_script != NULL ? strlen(logon_script)+1 : 0; - len_profile_path = profile_path != NULL ? strlen(profile_path)+1 : 0; - len_description = description != NULL ? strlen(description )+1 : 0; - len_workstations = workstations != NULL ? strlen(workstations)+1 : 0; - len_unknown_str = 0; - len_munged_dial = munged_dial != NULL ? strlen(munged_dial )+1 : 0; +/************************************************************************* + init_sam_user_info23 + unknown_3 = 0x09f8 27fa + unknown_5 = 0x0001 0000 + unknown_6 = 0x0000 04ec - /* 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)); - unix_to_nt_time (&pass_must_change_time,pdb_get_pass_must_change_time(pw)); - - /* 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; + *************************************************************************/ - init_uni_hdr(&usr->hdr_user_name, len_user_name); +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, char *desc, char *wkstas, + char *unk_str, char *mung_dial, uint32 user_rid, /* 0x0000 0000 */ + uint32 group_rid, uint32 acb_info, + uint32 unknown_3, uint16 logon_divs, + LOGON_HRS * hrs, uint32 unknown_5, + char newpass[516], uint32 unknown_6) +{ + int len_user_name = user_name != NULL ? strlen(user_name) : 0; + int len_full_name = full_name != NULL ? strlen(full_name) : 0; + int len_home_dir = home_dir != NULL ? strlen(home_dir) : 0; + int len_dir_drive = dir_drive != NULL ? strlen(dir_drive) : 0; + int len_logon_script = log_scr != NULL ? strlen(log_scr) : 0; + int len_profile_path = prof_path != NULL ? strlen(prof_path) : 0; + int len_description = desc != NULL ? strlen(desc) : 0; + int len_workstations = wkstas != NULL ? strlen(wkstas) : 0; + int len_unknown_str = unk_str != NULL ? strlen(unk_str) : 0; + int len_munged_dial = mung_dial != NULL ? strlen(mung_dial) : 0; + + 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 */ + + init_uni_hdr(&usr->hdr_user_name, len_user_name); /* NULL */ init_uni_hdr(&usr->hdr_full_name, len_full_name); init_uni_hdr(&usr->hdr_home_dir, len_home_dir); init_uni_hdr(&usr->hdr_dir_drive, len_dir_drive); @@ -3016,861 +5168,883 @@ void init_sam_user_info21(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw) init_uni_hdr(&usr->hdr_unknown_str, len_unknown_str); init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); - memset((char *)usr->nt_pwd, '\0', sizeof(usr->nt_pwd)); - memset((char *)usr->lm_pwd, '\0', sizeof(usr->lm_pwd)); + ZERO_STRUCT(usr->nt_pwd); + ZERO_STRUCT(usr->lm_pwd); - usr->user_rid = pdb_get_user_rid(pw); - usr->group_rid = pdb_get_group_rid(pw); - usr->acb_info = pdb_get_acct_ctrl(pw); - usr->unknown_3 = pdb_get_unknown3(pw); + usr->user_rid = user_rid; /* 0x0000 0000 */ + usr->group_rid = group_rid; + usr->acb_info = acb_info; + usr->unknown_3 = unknown_3; /* 09f8 27fa */ - usr->logon_divs = pdb_get_logon_divs(pw); - usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0; - usr->unknown_5 = pdb_get_unknown5(pw); /* 0x0002 0000 */ + usr->logon_divs = logon_divs; /* should be 168 (hours/week) */ + usr->ptr_logon_hrs = hrs ? 1 : 0; - memset((char *)usr->padding1, '\0', sizeof(usr->padding1)); + ZERO_STRUCT(usr->padding1); - init_unistr2(&usr->uni_user_name, user_name, len_user_name); + usr->unknown_5 = unknown_5; /* 0x0001 0000 */ + + memcpy(usr->pass, newpass, sizeof(usr->pass)); + + init_unistr2(&usr->uni_user_name, user_name, len_user_name); /* NULL */ init_unistr2(&usr->uni_full_name, full_name, len_full_name); init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); - init_unistr2(&usr->uni_logon_script, logon_script, len_logon_script); - init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path); - init_unistr2(&usr->uni_acct_desc, description, len_description); - init_unistr2(&usr->uni_workstations, workstations, len_workstations); - init_unistr2(&usr->uni_unknown_str, NULL, len_unknown_str); - init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial); - - usr->unknown_6 = pdb_get_unknown6(pw); + init_unistr2(&usr->uni_logon_script, log_scr, len_logon_script); + init_unistr2(&usr->uni_profile_path, prof_path, len_profile_path); + init_unistr2(&usr->uni_acct_desc, desc, len_description); + init_unistr2(&usr->uni_workstations, wkstas, len_workstations); + init_unistr2(&usr->uni_unknown_str, unk_str, len_unknown_str); + init_unistr2(&usr->uni_munged_dial, mung_dial, len_munged_dial); + + usr->unknown_6 = unknown_6; /* 0x0000 04ec */ usr->padding4 = 0; - if (pdb_get_hours(pw)) - { - usr->logon_hrs.len = pdb_get_hours_len(pw); - memcpy(&(usr->logon_hrs.hours), pdb_get_hours(pw), MAX_HOURS_LEN); - } - else - memset(&(usr->logon_hrs), 0xff, sizeof(usr->logon_hrs)); + memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs)); } - /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *ps, int depth) +static BOOL sam_io_user_info23(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_info21"); + 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)) + if(!smb_io_time("logoff_time ", &usr->logoff_time, ps, depth)) return False; - if(!smb_io_time("kickoff_time ", &usr->kickoff_time, ps, depth)) + 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)) + 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)) + 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)) + 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 */ + 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 */ + 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 */ + 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 */ + 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 */ + 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 */ + 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 description */ + 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)) /* workstations user can log on from */ + if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* wkstas user can log on from */ return False; - if(!smb_io_unihdr("hdr_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */ + if(!smb_io_unihdr("hdr_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */ return False; - if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* workstations user can log on from */ + 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))) + 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))) + 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 */ + 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 */ + if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid)) /* Group ID */ return False; - if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info)) /* Group ID */ + if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info)) return False; if(!prs_uint32("unknown_3 ", ps, depth, &usr->unknown_3)) return False; - if(!prs_uint16("logon_divs ", ps, depth, &usr->logon_divs)) /* logon divisions per week */ + 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_uint8s(False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1))) + return False; if(!prs_uint32("unknown_5 ", ps, depth, &usr->unknown_5)) return False; - if(!prs_uint8s (False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1))) + 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(!prs_align_needed(ps, usr->hdr_full_name.buffer)) - 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(!prs_align_needed(ps, usr->hdr_home_dir.buffer)) - 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(!prs_align_needed(ps, usr->hdr_dir_drive.buffer)) - 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_needed(ps, usr->hdr_logon_script.buffer)) - return False; - if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */ + if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */ return False; - if(!prs_align_needed(ps, usr->hdr_profile_path.buffer)) - return False; - if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */ + + 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(!prs_align_needed(ps, usr->hdr_acct_desc.buffer)) + + 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_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth)) /* user description unicode string */ + + 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_needed(ps, usr->hdr_workstations.buffer)) + + 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_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) /* worksations user can log on from */ + + 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(!prs_align_needed(ps, usr->hdr_unknown_str.buffer)) + + 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_user_comment", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */ + + if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) /* worksations user can log on from */ return False; - if(!prs_align_needed(ps, usr->hdr_munged_dial.buffer)) + + if(!smb_io_unistr2("uni_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.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)) /* worksations user can log on from */ + + 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(!prs_align(ps)) - return False; if(!prs_uint32("unknown_6 ", ps, depth, &usr->unknown_6)) return False; if(!prs_uint32("padding4 ", ps, depth, &usr->padding4)) return False; - if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth)) return False; + } else if (UNMARSHALLING(ps)) { + usr->unknown_6 = 0; + usr->padding4 = 0; } return True; } -/******************************************************************* - Inits a SAMR_R_QUERY_USERINFO structure. -********************************************************************/ -void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO *r_u, - uint16 switch_value, void *info, uint32 status) -{ - DEBUG(5,("init_samr_r_query_userinfo\n")); +/************************************************************************* + init_sam_user_info21W - r_u->ptr = 0; - r_u->switch_value = 0; + unknown_3 = 0x00ff ffff + unknown_5 = 0x0002 0000 + unknown_6 = 0x0000 04ec - if (status == 0) { - r_u->switch_value = switch_value; + *************************************************************************/ - switch (switch_value) { - case 0x10: - r_u->ptr = 1; - r_u->info.id10 = (SAM_USER_INFO_10*)info; - break; +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 unknown_3, + uint16 logon_divs, + LOGON_HRS * hrs, + uint32 unknown_5, uint32 unknown_6) +{ + int len_user_name = user_name != NULL ? user_name->uni_str_len : 0; + int len_full_name = full_name != NULL ? full_name->uni_str_len : 0; + int len_home_dir = home_dir != NULL ? home_dir->uni_str_len : 0; + int len_dir_drive = dir_drive != NULL ? dir_drive->uni_str_len : 0; + int len_logon_script = log_scr != NULL ? log_scr->uni_str_len : 0; + int len_profile_path = prof_path != NULL ? prof_path->uni_str_len : 0; + int len_description = desc != NULL ? desc->uni_str_len : 0; + int len_workstations = wkstas != NULL ? wkstas->uni_str_len : 0; + int len_unknown_str = unk_str != NULL ? unk_str->uni_str_len : 0; + int len_munged_dial = mung_dial != NULL ? mung_dial->uni_str_len : 0; + + 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; - case 0x11: - r_u->ptr = 1; - r_u->info.id11 = (SAM_USER_INFO_11*)info; - break; + init_uni_hdr(&usr->hdr_user_name, len_user_name); + init_uni_hdr(&usr->hdr_full_name, len_full_name); + init_uni_hdr(&usr->hdr_home_dir, len_home_dir); + init_uni_hdr(&usr->hdr_dir_drive, len_dir_drive); + init_uni_hdr(&usr->hdr_logon_script, len_logon_script); + init_uni_hdr(&usr->hdr_profile_path, len_profile_path); + init_uni_hdr(&usr->hdr_acct_desc, len_description); + init_uni_hdr(&usr->hdr_workstations, len_workstations); + init_uni_hdr(&usr->hdr_unknown_str, len_unknown_str); + init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); - case 21: - r_u->ptr = 1; - r_u->info.id21 = (SAM_USER_INFO_21*)info; - break; + memcpy(usr->lm_pwd, lm_pwd, sizeof(usr->lm_pwd)); + memcpy(usr->nt_pwd, nt_pwd, sizeof(usr->nt_pwd)); - default: - DEBUG(4,("init_samr_r_query_aliasinfo: unsupported switch level\n")); - break; - } - } + usr->user_rid = user_rid; + usr->group_rid = group_rid; + usr->acb_info = acb_info; + usr->unknown_3 = unknown_3; /* 0x00ff ffff */ + + usr->logon_divs = logon_divs; /* should be 168 (hours/week) */ + usr->ptr_logon_hrs = hrs ? 1 : 0; + usr->unknown_5 = unknown_5; /* 0x0002 0000 */ + + ZERO_STRUCT(usr->padding1); + + copy_unistr2(&usr->uni_user_name, user_name); + copy_unistr2(&usr->uni_full_name, full_name); + copy_unistr2(&usr->uni_home_dir, home_dir); + copy_unistr2(&usr->uni_dir_drive, dir_drive); + copy_unistr2(&usr->uni_logon_script, log_scr); + copy_unistr2(&usr->uni_profile_path, prof_path); + copy_unistr2(&usr->uni_acct_desc, desc); + copy_unistr2(&usr->uni_workstations, wkstas); + copy_unistr2(&usr->uni_unknown_str, unk_str); + copy_unistr2(&usr->uni_munged_dial, mung_dial); + + usr->unknown_6 = unknown_6; /* 0x0000 04ec */ + usr->padding4 = 0; - r_u->status = status; /* return status */ + memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs)); } -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL samr_io_r_query_userinfo(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++; +/************************************************************************* + init_sam_user_info21 - if(!prs_align(ps)) - return False; + unknown_3 = 0x00ff ffff + unknown_5 = 0x0002 0000 + unknown_6 = 0x0000 04ec - if(!prs_uint32("ptr ", ps, depth, &r_u->ptr)) - return False; - if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value)) - return False; - if(!prs_align(ps)) - return False; + *************************************************************************/ - if (r_u->ptr != 0 && r_u->switch_value != 0) { - switch (r_u->switch_value) { - case 0x10: - if (r_u->info.id10 != NULL) { - if(!sam_io_user_info10("", r_u->info.id10, ps, depth)) - return False; - } else { - DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); - return False; - } - break; -/* - case 0x11: - if (r_u->info.id11 != NULL) { - if(!sam_io_user_info11("", r_u->info.id11, ps, depth)) - return False; - } else { - DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); - return False; - } - break; -*/ - case 21: - if (r_u->info.id21 != NULL) { - if(!sam_io_user_info21("", r_u->info.id21, ps, depth)) - return False; - } else { - DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n")); - return False; - } - break; - default: - DEBUG(2,("samr_io_r_query_userinfo: unknown switch level\n")); - break; - } - } +void init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw) +{ + NTTIME logon_time, logoff_time, kickoff_time, + pass_last_set_time, pass_can_change_time, + pass_must_change_time; - if(!prs_align(ps)) - return False; + int len_user_name, len_full_name, len_home_dir, + len_dir_drive, len_logon_script, len_profile_path, + len_description, len_workstations, len_unknown_str, + len_munged_dial; + + char* user_name = pdb_get_username(pw); + char* full_name = pdb_get_fullname(pw); + char* home_dir = pdb_get_homedir(pw); + char* dir_drive = pdb_get_dirdrive(pw); + char* logon_script = pdb_get_logon_script(pw); + char* profile_path = pdb_get_profile_path(pw); + char* description = pdb_get_acct_desc(pw); + char* workstations = pdb_get_workstations(pw); + char* munged_dial = pdb_get_munged_dial(pw); - if(!prs_uint32("status", ps, depth, &r_u->status)) - return False; + len_user_name = user_name != NULL ? strlen(user_name )+1 : 0; + len_full_name = full_name != NULL ? strlen(full_name )+1 : 0; + len_home_dir = home_dir != NULL ? strlen(home_dir )+1 : 0; + len_dir_drive = dir_drive != NULL ? strlen(dir_drive )+1 : 0; + len_logon_script = logon_script != NULL ? strlen(logon_script)+1 : 0; + len_profile_path = profile_path != NULL ? strlen(profile_path)+1 : 0; + len_description = description != NULL ? strlen(description )+1 : 0; + len_workstations = workstations != NULL ? strlen(workstations)+1 : 0; + len_unknown_str = 0; + len_munged_dial = munged_dial != NULL ? strlen(munged_dial )+1 : 0; - return True; -} -/******************************************************************* - Reads or writes a structure. -********************************************************************/ + /* 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)); + unix_to_nt_time (&pass_must_change_time,pdb_get_pass_must_change_time(pw)); + + /* 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; -BOOL samr_io_q_create_user(char *desc, SAMR_Q_CREATE_USER *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; + init_uni_hdr(&usr->hdr_user_name, len_user_name); + init_uni_hdr(&usr->hdr_full_name, len_full_name); + init_uni_hdr(&usr->hdr_home_dir, len_home_dir); + init_uni_hdr(&usr->hdr_dir_drive, len_dir_drive); + init_uni_hdr(&usr->hdr_logon_script, len_logon_script); + init_uni_hdr(&usr->hdr_profile_path, len_profile_path); + init_uni_hdr(&usr->hdr_acct_desc, len_description); + init_uni_hdr(&usr->hdr_workstations, len_workstations); + init_uni_hdr(&usr->hdr_unknown_str, len_unknown_str); + init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); - prs_debug(ps, depth, desc, "samr_io_q_create_user"); - depth++; + ZERO_STRUCT(usr->nt_pwd); + ZERO_STRUCT(usr->lm_pwd); - if(!prs_align(ps)) - return False; + usr->user_rid = pdb_get_user_rid(pw); + usr->group_rid = pdb_get_group_rid(pw); + usr->acb_info = pdb_get_acct_ctrl(pw); + usr->unknown_3 = pdb_get_unknown3(pw); - if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) - return False; - if(!prs_align(ps)) - return False; + usr->logon_divs = pdb_get_logon_divs(pw); + usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0; + usr->unknown_5 = pdb_get_unknown5(pw); /* 0x0002 0000 */ - if(!smb_io_unihdr ("", &q_u->hdr_mach_acct, ps, depth)) - return False; - if(!smb_io_unistr2("", &q_u->uni_mach_acct, q_u->hdr_mach_acct.buffer, ps, depth)) - return False; + ZERO_STRUCT(usr->padding1); - if(!prs_align(ps)) - return False; + init_unistr2(&usr->uni_user_name, user_name, len_user_name); + init_unistr2(&usr->uni_full_name, full_name, len_full_name); + init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); + init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); + init_unistr2(&usr->uni_logon_script, logon_script, len_logon_script); + init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path); + init_unistr2(&usr->uni_acct_desc, description, len_description); + init_unistr2(&usr->uni_workstations, workstations, len_workstations); + init_unistr2(&usr->uni_unknown_str, NULL, len_unknown_str); + init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial); - 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; + usr->unknown_6 = pdb_get_unknown6(pw); + usr->padding4 = 0; - return True; + if (pdb_get_hours(pw)) { + usr->logon_hrs.len = pdb_get_hours_len(pw); + memcpy(&usr->logon_hrs.hours, pdb_get_hours(pw), MAX_HOURS_LEN); + } else + memset(&usr->logon_hrs, 0xff, sizeof(usr->logon_hrs)); } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER *r_u, prs_struct *ps, int depth) +static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 * usr, + prs_struct *ps, int depth) { - if (r_u == NULL) + if (usr == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_unknown_32"); + prs_debug(ps, depth, desc, "sam_io_user_info21"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) + if(!smb_io_time("logon_time ", &usr->logon_time, ps, depth)) return False; - - if(!prs_uint32("unknown_0", ps, depth, &r_u->unknown_0)) + if(!smb_io_time("logoff_time ", &usr->logoff_time, ps, depth)) return False; - if(!prs_uint32("user_rid", ps, depth, &r_u->user_rid)) + if(!smb_io_time("pass_last_set_time ", &usr->pass_last_set_time, ps,depth)) return False; - - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!smb_io_time("kickoff_time ", &usr->kickoff_time, ps, depth)) 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) -{ - int len_srv_name = strlen(srv_name); - - DEBUG(5,("init_q_connect\n")); - - /* make PDC server name \\server */ - q_u->ptr_srv_name = len_srv_name > 0; - init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1); - - q_u->access_mask = access_mask; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL samr_io_q_connect(char *desc, SAMR_Q_CONNECT *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) + if(!smb_io_time("pass_can_change_time ", &usr->pass_can_change_time, ps,depth)) return False; - - prs_debug(ps, depth, desc, "samr_io_q_connect"); - depth++; - - if(!prs_align(ps)) + if(!smb_io_time("pass_must_change_time", &usr->pass_must_change_time, ps, depth)) return False; - if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name)) + if(!smb_io_unihdr("hdr_user_name ", &usr->hdr_user_name, ps, depth)) /* username unicode string header */ return False; - if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth)) + if(!smb_io_unihdr("hdr_full_name ", &usr->hdr_full_name, ps, depth)) /* user's full name unicode string header */ return False; - - if(!prs_align(ps)) + if(!smb_io_unihdr("hdr_home_dir ", &usr->hdr_home_dir, ps, depth)) /* home directory unicode string header */ return False; - - if(!prs_uint32("access_mask ", ps, depth, &q_u->access_mask)) + if(!smb_io_unihdr("hdr_dir_drive ", &usr->hdr_dir_drive, ps, depth)) /* home directory drive */ return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL samr_io_r_connect(char *desc, SAMR_R_CONNECT *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) + if(!smb_io_unihdr("hdr_logon_script", &usr->hdr_logon_script, ps, depth)) /* logon script unicode string header */ return False; - - prs_debug(ps, depth, desc, "samr_io_r_connect"); - depth++; - - if(!prs_align(ps)) + if(!smb_io_unihdr("hdr_profile_path", &usr->hdr_profile_path, ps, depth)) /* profile path unicode string header */ return False; - - if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth)) + if(!smb_io_unihdr("hdr_acct_desc ", &usr->hdr_acct_desc, ps, depth)) /* account desc */ return False; - if(!prs_align(ps)) + if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* wkstas user can log on from */ return False; - - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!smb_io_unihdr("hdr_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */ 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_q_connect_anon\n")); - - q_u->ptr = 1; - q_u->unknown_0 = 0x5c; /* server name (?!!) */ - q_u->unknown_1 = 0x01; - q_u->unknown_2 = 0x20; -} - - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL samr_io_q_connect_anon(char *desc, SAMR_Q_CONNECT_ANON *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) + if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */ return False; - prs_debug(ps, depth, desc, "samr_io_q_connect_anon"); - depth++; - - if(!prs_align(ps)) + if(!prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, sizeof(usr->lm_pwd))) return False; - - if(!prs_uint32("ptr ", ps, depth, &q_u->ptr)) + if(!prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, sizeof(usr->nt_pwd))) return False; - if(!prs_uint16("unknown_0", ps, depth, &q_u->unknown_0)) + + if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid)) /* User ID */ return False; - if(!prs_uint16("unknown_1", ps, depth, &q_u->unknown_1)) + if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid)) /* Group ID */ return False; - if(!prs_uint32("unknown_2", ps, depth, &q_u->unknown_2)) + if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info)) return False; - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL samr_io_r_connect_anon(char *desc, SAMR_R_CONNECT_ANON *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) + if(!prs_uint32("unknown_3 ", ps, depth, &usr->unknown_3)) + return False; + if(!prs_uint16("logon_divs ", ps, depth, &usr->logon_divs)) /* logon divisions per week */ 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)) + if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs)) return False; - if(!prs_align(ps)) + if(!prs_uint32("unknown_5 ", ps, depth, &usr->unknown_5)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1))) return False; - return True; -} - -/******************************************************************* - Inits a SAMR_Q_OPEN_ALIAS structure. -********************************************************************/ -void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, - uint32 unknown_0, uint32 rid) -{ - DEBUG(5,("init_q_open_alias\n")); - - /* example values: 0x0000 0008 */ - q_u->unknown_0 = unknown_0; - - q_u->rid_alias = rid; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ + /* here begins pointed-to data */ -BOOL samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) + if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name,usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */ return False; - - prs_debug(ps, depth, desc, "samr_io_q_open_alias"); - depth++; - - if(!prs_align(ps)) + 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_pol_hnd("domain_pol", &(q_u->dom_pol), ps, depth)) + 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(!prs_uint32("unknown_0", ps, depth, &q_u->unknown_0)) + 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_uint32("rid_alias", ps, depth, &q_u->rid_alias)) + if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */ return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) + if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */ return False; - - prs_debug(ps, depth, desc, "samr_io_r_open_alias"); - depth++; - - if(!prs_align(ps)) + 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_pol_hnd("pol", &r_u->pol, ps, depth)) + if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) /* worksations user can log on from */ return False; - if(!prs_align(ps)) + if(!smb_io_unistr2("uni_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */ return False; - - if(!prs_uint32("status", ps, depth, &r_u->status)) + 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; + /* ok, this is only guess-work (as usual) */ + if (usr->ptr_logon_hrs) { + if(!prs_align(ps)) + return False; + if(!prs_uint32("unknown_6 ", ps, depth, &usr->unknown_6)) + return False; + if(!prs_uint32("padding4 ", ps, depth, &usr->padding4)) + return False; + if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth)) + return False; + } else if (UNMARSHALLING(ps)) { + usr->unknown_6 = 0; + usr->padding4 = 0; + } + return True; } /******************************************************************* - Inits a SAMR_Q_UNKNOWN_12 structure. +inits a SAM_USERINFO_CTR structure. ********************************************************************/ -void init_samr_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u, - POLICY_HND *pol, uint32 rid, - uint32 num_gids, uint32 *gid) +uint32 make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr, + uint16 switch_value, + SAM_USER_INFO_21 * usr) { - int i; + DEBUG(5, ("init_samr_userinfo_ctr\n")); + + ctr->switch_value = switch_value; + ctr->info.id = NULL; - DEBUG(5,("init_samr_q_lookup_rids\n")); + switch (switch_value) { + case 0x10: + ctr->info.id10 = (SAM_USER_INFO_10 *)talloc_zero(ctx,sizeof(SAM_USER_INFO_10)); + if (ctr->info.id10 == NULL) + return NT_STATUS_NO_MEMORY; - memcpy(&q_u->pol, pol, sizeof(*pol)); + init_sam_user_info10(ctr->info.id10, usr->acb_info); + break; +#if 0 +/* whoops - got this wrong. i think. or don't understand what's happening. */ + case 0x11: + { + NTTIME expire; + info = (void *)&id11; + + expire.low = 0xffffffff; + expire.high = 0x7fffffff; + + ctr->info.id = (SAM_USER_INFO_11 *) talloc_zero(ctx,sizeof(*ctr->info.id11)); + init_sam_user_info11(ctr->info.id11, &expire, + "BROOKFIELDS$", /* name */ + 0x03ef, /* user rid */ + 0x201, /* group rid */ + 0x0080); /* acb info */ - q_u->num_gids1 = num_gids; - q_u->rid = rid; - q_u->ptr = 0; - q_u->num_gids2 = num_gids; + break; + } +#endif + case 0x12: + ctr->info.id12 = (SAM_USER_INFO_12 *)talloc_zero(ctx,sizeof(SAM_USER_INFO_12)); + if (ctr->info.id12 == NULL) + return NT_STATUS_NO_MEMORY; - for (i = 0; i < num_gids; i++) { - q_u->gid[i] = gid[i]; + init_sam_user_info12(ctr->info.id12, usr->lm_pwd, usr->nt_pwd); + break; + case 21: + { + SAM_USER_INFO_21 *cusr; + cusr = (SAM_USER_INFO_21 *)talloc_zero(ctx,sizeof(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_NOPROBLEMO; } /******************************************************************* - Inits a SAMR_Q_UNKNOWN_21 structure. +inits a SAM_USERINFO_CTR structure. ********************************************************************/ -void init_samr_q_unknown_21(SAMR_Q_UNKNOWN_21 *q_c, - POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) +void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, uchar * sess_key, + uint16 switch_value, void *info) { - DEBUG(5,("init_samr_q_unknown_21\n")); + DEBUG(5, ("init_samr_userinfo_ctr\n")); - memcpy(&q_c->group_pol, hnd, sizeof(q_c->group_pol)); - q_c->unknown_1 = unk_1; - q_c->unknown_2 = unk_2; -} + ctr->switch_value = switch_value; + ctr->info.id = info; + switch (switch_value) { + case 0x18: + SamOEMhash(ctr->info.id24->pass, sess_key, 1); + dump_data(100, (char *)sess_key, 16); + dump_data(100, (char *)ctr->info.id24->pass, 516); + break; + case 0x17: + SamOEMhash(ctr->info.id23->pass, sess_key, 1); + dump_data(100, (char *)sess_key, 16); + dump_data(100, (char *)ctr->info.id23->pass, 516); + break; + default: + DEBUG(4,("init_samr_userinfo_ctr: unsupported switch level\n")); + } +} /******************************************************************* - Inits a SAMR_Q_UNKNOWN_13 structure. +reads or writes a structure. ********************************************************************/ -void init_samr_q_unknown_13(SAMR_Q_UNKNOWN_13 *q_c, - POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) +static BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR **ppctr, + prs_struct *ps, int depth) { - DEBUG(5,("init_samr_q_unknown_13\n")); - - memcpy(&q_c->alias_pol, hnd, sizeof(q_c->alias_pol)); - q_c->unknown_1 = unk_1; - q_c->unknown_2 = unk_2; -} + BOOL ret; + SAM_USERINFO_CTR *ctr; -/******************************************************************* - Inits a SAMR_Q_UNKNOWN_38 structure. -********************************************************************/ -void init_samr_q_unknown_38(SAMR_Q_UNKNOWN_38 *q_u, char *srv_name) -{ - int len_srv_name = strlen(srv_name)+1; + prs_debug(ps, depth, desc, "samr_io_userinfo_ctr"); + depth++; - DEBUG(5,("init_q_unknown_38\n")); + if (UNMARSHALLING(ps)) { + ctr = (SAM_USERINFO_CTR *)prs_alloc_mem(ps,sizeof(SAM_USERINFO_CTR)); + if (ctr == NULL) + return False; + *ppctr = ctr; + } else { + ctr = *ppctr; + } - q_u->ptr = 1; - init_uni_hdr(&q_u->hdr_srv_name, len_srv_name); - init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name); + /* 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; -/******************************************************************* - Reads or writes a structure. -********************************************************************/ + ret = False; -BOOL samr_io_q_unknown_38(char *desc, SAMR_Q_UNKNOWN_38 *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; + switch (ctr->switch_value) { + case 0x10: + if (UNMARSHALLING(ps)) + ctr->info.id10 = (SAM_USER_INFO_10 *)prs_alloc_mem(ps,sizeof(SAM_USER_INFO_10)); + if (ctr->info.id10 == NULL) { + DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n")); + return False; + } + ret = sam_io_user_info10("", ctr->info.id10, ps, depth); + break; + case 0x11: + if (UNMARSHALLING(ps)) + ctr->info.id11 = (SAM_USER_INFO_11 *)prs_alloc_mem(ps,sizeof(SAM_USER_INFO_11)); - prs_debug(ps, depth, desc, "samr_io_q_unknown_38"); - depth++; + if (ctr->info.id11 == NULL) { + DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n")); + return False; + } + ret = sam_io_user_info11("", ctr->info.id11, ps, depth); + break; + case 0x12: + if (UNMARSHALLING(ps)) + ctr->info.id12 = (SAM_USER_INFO_12 *)prs_alloc_mem(ps,sizeof(SAM_USER_INFO_12)); - if(!prs_align(ps)) - return False; + if (ctr->info.id12 == NULL) { + DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n")); + return False; + } + ret = sam_io_user_info12("", ctr->info.id12, ps, depth); + break; + case 21: + if (UNMARSHALLING(ps)) + ctr->info.id21 = (SAM_USER_INFO_21 *)prs_alloc_mem(ps,sizeof(SAM_USER_INFO_21)); - if(!prs_uint32("ptr", ps, depth, &q_u->ptr)) - return False; + 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 = (SAM_USER_INFO_23 *)prs_alloc_mem(ps,sizeof(SAM_USER_INFO_23)); - if (q_u->ptr != 0) { - if(!smb_io_unihdr ("", &q_u->hdr_srv_name, ps, depth)) + if (ctr->info.id23 == NULL) { + DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n")); return False; - if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->hdr_srv_name.buffer, ps, depth)) + } + ret = sam_io_user_info23("", ctr->info.id23, ps, depth); + break; + case 24: + if (UNMARSHALLING(ps)) + ctr->info.id24 = (SAM_USER_INFO_24 *)prs_alloc_mem(ps,sizeof(SAM_USER_INFO_24)); + + 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; + default: + DEBUG(2, ("samr_io_userinfo_ctr: unknown switch level 0x%x\n", ctr->switch_value)); + ret = False; + break; } - return True; + return ret; } /******************************************************************* - Inits a SAMR_R_UNKNOWN_38 structure. +inits a SAMR_R_QUERY_USERINFO structure. ********************************************************************/ -void init_samr_r_unknown_38(SAMR_R_UNKNOWN_38 *r_u) +void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO * r_u, + SAM_USERINFO_CTR * ctr, uint32 status) { - DEBUG(5,("init_r_unknown_38\n")); + DEBUG(5, ("init_samr_r_query_userinfo\n")); + + r_u->ptr = 0; + r_u->ctr = NULL; + + if (status == 0) { + r_u->ptr = 1; + r_u->ctr = ctr; + } - r_u->unk_0 = 0; - r_u->unk_1 = 0; - r_u->unk_2 = 0; - r_u->unk_3 = 0; + r_u->status = status; /* return status */ } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_unknown_38(char *desc, SAMR_R_UNKNOWN_38 *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_query_userinfo(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_unknown_38"); + prs_debug(ps, depth, desc, "samr_io_r_query_userinfo"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint16("unk_0", ps, depth, &r_u->unk_0)) - return False; - if(!prs_align(ps)) - return False; - if(!prs_uint16("unk_1", ps, depth, &r_u->unk_1)) - return False; - if(!prs_align(ps)) - return False; - if(!prs_uint16("unk_2", ps, depth, &r_u->unk_2)) + 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_uint16("unk_3", ps, depth, &r_u->unk_3)) - return False; - if(!prs_align(ps)) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; } /******************************************************************* -make a SAMR_ENC_PASSWD structure. +inits a SAMR_Q_SET_USERINFO structure. ********************************************************************/ -void init_enc_passwd(SAMR_ENC_PASSWD *pwd, char pass[512]) +void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO * q_u, + POLICY_HND *hnd, unsigned char sess_key[16], + uint16 switch_value, void *info) { - pwd->ptr = 1; - memcpy(pwd->pass, pass, sizeof(pwd->pass)); + 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 SAMR_ENC_PASSWD structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD *pwd, prs_struct *ps, int depth) +BOOL samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO * q_u, + prs_struct *ps, int depth) { - if (pwd == NULL) + if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_enc_passwd"); + prs_debug(ps, depth, desc, "samr_io_q_set_userinfo"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32("ptr", ps, depth, &pwd->ptr)) + smb_io_pol_hnd("pol", &(q_u->pol), ps, depth); + + if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) return False; - if(!prs_uint8s(False, "pwd", ps, depth, pwd->pass, sizeof(pwd->pass))) + if(!samr_io_userinfo_ctr("ctr", &q_u->ctr, ps, depth)) return False; return True; } /******************************************************************* - Inits a SAMR_ENC_HASH structure. +inits a SAMR_R_SET_USERINFO structure. ********************************************************************/ -void init_enc_hash(SAMR_ENC_HASH *hsh, uchar hash[16]) +void init_samr_r_set_userinfo(SAMR_R_SET_USERINFO * r_u, uint32 status) { - hsh->ptr = 1; - memcpy(hsh->hash, hash, sizeof(hsh->hash)); + DEBUG(5, ("init_samr_r_set_userinfo\n")); + + r_u->status = status; /* return status */ } /******************************************************************* - Reads or writes a SAMR_ENC_HASH structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_enc_hash(char *desc, SAMR_ENC_HASH *hsh, prs_struct *ps, int depth) +BOOL samr_io_r_set_userinfo(char *desc, SAMR_R_SET_USERINFO * r_u, + prs_struct *ps, int depth) { - if (hsh == NULL) + if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_enc_hash"); + prs_debug(ps, depth, desc, "samr_io_r_set_userinfo"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32("ptr ", ps, depth, &hsh->ptr)) - return False; - if(!prs_uint8s(False, "hash", ps, depth, hsh->hash, sizeof(hsh->hash))) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; return True; } /******************************************************************* - Inits a SAMR_R_UNKNOWN_38 structure. +inits a SAMR_Q_SET_USERINFO2 structure. ********************************************************************/ -void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, - char *dest_host, char *user_name, - char nt_newpass[516], uchar nt_oldhash[16], - char lm_newpass[516], uchar lm_oldhash[16]) +void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u, + POLICY_HND *hnd, unsigned char sess_key[16], + uint16 switch_value, SAM_USERINFO_CTR * ctr) { - int len_dest_host = strlen(dest_host)+1; - int len_user_name = strlen(user_name)+1; - - DEBUG(5,("init_samr_q_chgpasswd_user\n")); - - q_u->ptr_0 = 1; - init_uni_hdr(&q_u->hdr_dest_host, len_dest_host); - init_unistr2(&q_u->uni_dest_host, dest_host, len_dest_host); - init_uni_hdr(&q_u->hdr_user_name, len_user_name); - init_unistr2(&q_u->uni_user_name, user_name, len_user_name); - - init_enc_passwd(&q_u->nt_newpass, nt_newpass); - init_enc_hash(&q_u->nt_oldhash, nt_oldhash); - - q_u->unknown = 0x01; + DEBUG(5, ("init_samr_q_set_userinfo2\n")); - init_enc_passwd(&q_u->lm_newpass, lm_newpass); - init_enc_hash (&q_u->lm_oldhash, lm_oldhash); + q_u->pol = *hnd; + q_u->switch_value = switch_value; + q_u->ctr = ctr; + + if (q_u->ctr != NULL) + q_u->ctr->switch_value = switch_value; + + switch (switch_value) { + case 0x12: + SamOEMhash(ctr->info.id12->lm_pwd, sess_key, 0); + SamOEMhash(ctr->info.id12->nt_pwd, sess_key, 0); + dump_data(100, (char *)sess_key, 16); + dump_data(100, (char *)ctr->info.id12->lm_pwd, 16); + dump_data(100, (char *)ctr->info.id12->nt_pwd, 16); + break; + } } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_set_userinfo2(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_chgpasswd_user"); + prs_debug(ps, depth, desc, "samr_io_q_set_userinfo2"); 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(!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)) + if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) return False; - if(!samr_io_enc_passwd("lm_newpass", &q_u->lm_newpass, ps, depth)) + if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) return False; - if(!samr_io_enc_hash("lm_oldhash", &q_u->lm_oldhash, ps, depth)) + if(!samr_io_userinfo_ctr("ctr", &q_u->ctr, ps, depth)) return False; return True; } /******************************************************************* - Inits a SAMR_R_CHGPASSWD_USER structure. +inits a SAMR_R_SET_USERINFO2 structure. ********************************************************************/ -void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER *r_u, uint32 status) +void init_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2 * r_u, uint32 status) { - DEBUG(5,("init_r_chgpasswd_user\n")); + DEBUG(5, ("init_samr_r_set_userinfo2\n")); - r_u->status = status; + r_u->status = status; /* return status */ } /******************************************************************* - Reads or writes a structure. +reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_set_userinfo2(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_chgpasswd_user"); + prs_debug(ps, depth, desc, "samr_io_r_set_userinfo2"); depth++; if(!prs_align(ps)) @@ -3882,234 +6056,73 @@ BOOL samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER *r_u, prs_struct return True; } -/********************************************************************** - Reads or writes a structure - **********************************************************************/ -BOOL samr_io_q_lookup_domain(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; -} - /******************************************************************* -makes a SAMR_R_LOOKUP_DOMAIN structure. +inits a SAMR_Q_CONNECT structure. ********************************************************************/ -BOOL init_samr_r_lookup_domain(SAMR_R_LOOKUP_DOMAIN * r_u, - DOM_SID *dom_sid, uint32 status) + +void init_samr_q_connect(SAMR_Q_CONNECT * q_u, + char *srv_name, uint32 access_mask) { - if (r_u == NULL) - return False; + int len_srv_name = strlen(srv_name); - DEBUG(5, ("make_samr_r_lookup_domain\n")); + DEBUG(5, ("init_samr_q_connect\n")); - r_u->status = status; - r_u->ptr_sid = 0; - if (status == 0x0) { - r_u->ptr_sid = 1; - init_dom_sid2(&r_u->dom_sid, dom_sid); - } + /* make PDC server name \\server */ + q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0; + init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1); - return True; + /* example values: 0x0000 0002 */ + q_u->access_mask = access_mask; } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_lookup_domain(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_uint32("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_enum_domains(char *desc, SAMR_Q_ENUM_DOMAINS * q_e, - prs_struct *ps, int depth) +BOOL samr_io_q_connect(char *desc, SAMR_Q_CONNECT * q_u, + prs_struct *ps, int depth) { - if (q_e == NULL) + if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_q_enum_domains"); + prs_debug(ps, depth, desc, "samr_io_q_connect"); 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)) + if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name)) return False; - if(!prs_uint32("max_size ", ps, depth, &q_e->max_size)) + 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; -} - -/******************************************************************* -makes a SAMR_R_ENUM_DOMAINS structure. -********************************************************************/ -BOOL init_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS * r_u, - uint32 next_idx, fstring* domains, uint32 num_sam_entries) -{ - int i=0; - - if (r_u == NULL) - return False; - - DEBUG(5, ("init_samr_r_enum_domains\n")); - - r_u->next_idx = next_idx; - - r_u->uni_dom_name = (UNISTR2*) malloc(sizeof(UNISTR2) * num_sam_entries); - r_u->sam = (SAM_ENTRY*) malloc(sizeof(SAM_ENTRY) * num_sam_entries); - if(r_u->uni_dom_name == NULL || r_u->sam == NULL) - { - free(r_u->uni_dom_name); - free(r_u->sam); - r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED; - } - - if(r_u->status == 0) - for(i=0;iuni_dom_name[i],domains[i], strlen(domains[i])+1); - init_sam_entry(&(r_u->sam[i]), strlen(domains[i])+1, 0); - } - else - { - num_sam_entries = 0; - } - - 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; - } - - return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_enum_domains(char *desc, SAMR_R_ENUM_DOMAINS * r_u, - prs_struct *ps, int depth) -{ - uint32 i; +BOOL samr_io_r_connect(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_enum_domains"); + prs_debug(ps, depth, desc, "samr_io_r_connect"); 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)) + if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth)) 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->sam = (SAM_ENTRY*) malloc(sizeof(SAM_ENTRY)* r_u->num_entries2); - r_u->uni_dom_name = (UNISTR2*) malloc(sizeof(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, "domains[%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, "domains[%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_align(ps)) - return False; - - } - - if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4)) - return False; if(!prs_uint32("status", ps, depth, &r_u->status)) return False; @@ -4117,29 +6130,42 @@ BOOL samr_io_r_enum_domains(char *desc, SAMR_R_ENUM_DOMAINS * r_u, } /******************************************************************* -reads or writes a structure. +inits a SAMR_Q_CONNECT_ANON structure. ********************************************************************/ -static BOOL sam_io_user_info12(char *desc, SAM_USER_INFO_12 *u, prs_struct *ps, int depth) + +void init_samr_q_connect_anon(SAMR_Q_CONNECT_ANON * q_u) { - if (u == NULL) - return False; + DEBUG(5, ("init_samr_q_connect_anon\n")); - DEBUG(0, ("possible security breach!\n")); + q_u->ptr = 1; + q_u->unknown_0 = 0x5c; /* server name (?!!) */ + q_u->unknown_1 = 0x01; + q_u->access_mask = 0x20; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_q_connect_anon(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_r_user_info12"); + prs_debug(ps, depth, desc, "samr_io_q_connect_anon"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint8s(False, "lm_pwd", ps, depth, u->lm_pwd, sizeof(u->lm_pwd))) + if(!prs_uint32("ptr ", ps, depth, &q_u->ptr)) return False; - if(!prs_uint8s(False, "nt_pwd", ps, depth, u->nt_pwd, sizeof(u->nt_pwd))) + if(!prs_uint16("unknown_0", ps, depth, &q_u->unknown_0)) return False; - - if(!prs_uint8("lm_pwd_active", ps, depth, &u->lm_pwd_active)) + if(!prs_uint16("unknown_1", ps, depth, &q_u->unknown_1)) return False; - if(!prs_uint8("nt_pwd_active", ps, depth, &u->nt_pwd_active)) + if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask)) return False; return True; @@ -4148,156 +6174,68 @@ static BOOL sam_io_user_info12(char *desc, SAM_USER_INFO_12 *u, prs_struct *ps, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 *usr, prs_struct *ps, int depth) + +BOOL samr_io_r_connect_anon(char *desc, SAMR_R_CONNECT_ANON * r_u, + prs_struct *ps, int depth) { - if (usr == NULL) + if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_user_info23"); + prs_debug(ps, depth, desc, "samr_io_r_connect_anon"); 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_unknown_str", &usr->hdr_unknown_str, 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)) + if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth)) return False; - if(!prs_uint32("unknown_3", ps, depth, &usr->unknown_3)) - 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_uint8s(False, "padding1", ps, depth, usr->padding1, sizeof(usr->padding1))) - return False; - if(!prs_uint32("unknown_5", ps, depth, &usr->unknown_5)) + if(!prs_uint32("status", ps, depth, &r_u->status)) return False; - if(!prs_uint8s(False, "password", ps, depth, usr->pass, sizeof(usr->pass))) - return False; + return True; +} - /* here begins pointed-to data */ +/******************************************************************* +inits a SAMR_Q_GET_DOM_PWINFO structure. +********************************************************************/ - if(!prs_align_needed(ps, usr->hdr_user_name.buffer)) - 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(!prs_align_needed(ps, usr->hdr_full_name.buffer)) - 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(!prs_align_needed(ps, usr->hdr_home_dir.buffer)) - 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(!prs_align_needed(ps, usr->hdr_dir_drive.buffer)) - 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_needed(ps, usr->hdr_logon_script.buffer)) - 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(!prs_align_needed(ps, usr->hdr_profile_path.buffer)) - 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(!prs_align_needed(ps, usr->hdr_acct_desc.buffer)) - 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(!prs_align_needed(ps, usr->hdr_workstations.buffer)) - 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(!prs_align_needed(ps, usr->hdr_unknown_str.buffer)) - return False; - if(!smb_io_unistr2("uni_unknown_str", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */ - return False; - if(!prs_align_needed(ps, usr->hdr_munged_dial.buffer)) - 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; +void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO * q_u, + char *srv_name) +{ + int len_srv_name = strlen(srv_name); - /* ok, this is only guess-work (as usual) */ - if (usr->ptr_logon_hrs) { - if(!prs_align(ps)) - return False; - if(!prs_uint32("unknown_6", ps, depth, &usr->unknown_6)) - return False; - if(!prs_uint32("padding4", ps, depth, &usr->padding4)) - return False; - if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth)) - return False; - } else if (UNMARSHALLING(ps)) { - usr->unknown_6 = 0; - usr->padding4 = 0; - } + DEBUG(5, ("init_samr_q_get_dom_pwinfo\n")); - return True; + q_u->ptr = 1; + init_uni_hdr(&q_u->hdr_srv_name, len_srv_name); + init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name); } /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info24(char *desc, SAM_USER_INFO_24 *usr, prs_struct *ps, int depth) + +BOOL samr_io_q_get_dom_pwinfo(char *desc, SAMR_Q_GET_DOM_PWINFO * q_u, + prs_struct *ps, int depth) { - if (usr == NULL) + if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_user_info24"); + prs_debug(ps, depth, desc, "samr_io_q_get_dom_pwinfo"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint8s(False, "password", ps, depth, usr->pass, sizeof(usr->pass))) + 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; } @@ -4305,214 +6243,223 @@ static BOOL sam_io_user_info24(char *desc, SAM_USER_INFO_24 *usr, prs_struct *ps /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR *ctr, prs_struct *ps, int depth) + +BOOL samr_io_r_get_dom_pwinfo(char *desc, SAMR_R_GET_DOM_PWINFO * r_u, + prs_struct *ps, int depth) { - if (ctr == NULL) + if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_userinfo_ctr"); + prs_debug(ps, depth, desc, "samr_io_r_get_dom_pwinfo"); depth++; - /* lkclXXXX DO NOT ALIGN BEFORE READING SWITCH VALUE! */ + if(!prs_align(ps)) + return False; - if(!prs_uint16("switch_value", ps, depth, &ctr->switch_value)) + if(!prs_uint16("unk_0", ps, depth, &r_u->unk_0)) + return False; + if(!prs_align(ps)) + return False; + if(!prs_uint16("unk_1", ps, depth, &r_u->unk_1)) + return False; + if(!prs_align(ps)) + return False; + if(!prs_uint16("unk_2", ps, depth, &r_u->unk_2)) return False; if(!prs_align(ps)) return False; - switch (ctr->switch_value) { - case 0x10: - if (UNMARSHALLING(ps)) /* reading */ - ctr->info.id10 = (SAM_USER_INFO_10 *)malloc(sizeof(SAM_USER_INFO_10)); - if (ctr->info.id10 == NULL) { - DEBUG(2, ("samr_io_userinfo_ctr: info pointer not initialised\n")); - return False; - } - if(!sam_io_user_info10("", ctr->info.id10, ps, depth)) - return False; - break; - case 0x11: - if (UNMARSHALLING(ps)) /* reading */ - ctr->info.id11 = (SAM_USER_INFO_11 *)malloc(sizeof(SAM_USER_INFO_11)); - if (ctr->info.id11 == NULL) { - DEBUG(2, ("samr_io_userinfo_ctr: info pointer not initialised\n")); - return False; - } - if(!sam_io_user_info11("", ctr->info.id11, ps, depth)) - return False; - break; - case 0x12: - if (UNMARSHALLING(ps)) /* reading */ - ctr->info.id12 = (SAM_USER_INFO_12 *)malloc(sizeof(SAM_USER_INFO_12)); - if (ctr->info.id12 == NULL) { - DEBUG(2, ("samr_io_userinfo_ctr: info pointer not initialised\n")); - return False; - } - if(!sam_io_user_info12("", ctr->info.id12, ps, depth)) - return False; - break; - case 21: - if (UNMARSHALLING(ps)) /* reading */ - ctr->info.id21 = (SAM_USER_INFO_21 *)malloc(sizeof(SAM_USER_INFO_21)); - if (ctr->info.id21 == NULL) { - DEBUG(2, ("samr_io_userinfo_ctr: info pointer not initialised\n")); - return False; - } - if(!sam_io_user_info21("", ctr->info.id21, ps, depth)) - return False; - break; - case 23: - if (UNMARSHALLING(ps)) /* reading */ - ctr->info.id23 = (SAM_USER_INFO_23 *)malloc(sizeof(SAM_USER_INFO_23)); - if (ctr->info.id23 == NULL) { - DEBUG(2, ("samr_io_userinfo_ctr: info pointer not initialised\n")); - return False; - } - if(!sam_io_user_info23("", ctr->info.id23, ps, depth)) - return False; - break; - case 24: - if (UNMARSHALLING(ps)) /* reading */ - ctr->info.id24 = (SAM_USER_INFO_24 *)malloc(sizeof(SAM_USER_INFO_24)); - if (ctr->info.id24 == NULL) { - DEBUG(2, ("samr_io_userinfo_ctr: info pointer not initialised\n")); - return False; - } - if(!sam_io_user_info24("", ctr->info.id24, ps, depth)) - return False; - break; - default: - DEBUG(2, ("samr_io_userinfo_ctr: unknown switch level 0x%x\n", ctr->switch_value)); - return False; - - } + if(!prs_uint32("status", ps, depth, &r_u->status)) + return False; return True; } /******************************************************************* -frees a structure. +make a SAMR_ENC_PASSWD structure. ********************************************************************/ -void free_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr) + +void init_enc_passwd(SAMR_ENC_PASSWD * pwd, char pass[512]) { - if (ctr == NULL) - return; - safe_free(ctr->info.id); - ctr->info.id = NULL; + ZERO_STRUCTP(pwd); + + if (pass == NULL) { + pwd->ptr = 0; + } else { + pwd->ptr = 1; + memcpy(pwd->pass, pass, sizeof(pwd->pass)); + } } /******************************************************************* -reads or writes a structure. +reads or writes a SAMR_ENC_PASSWD structure. ********************************************************************/ -BOOL samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO *q_u, prs_struct *ps, int depth) + +BOOL samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD * pwd, + prs_struct *ps, int depth) { - if (q_u == NULL) + if (pwd == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_q_set_userinfo"); + prs_debug(ps, depth, desc, "samr_io_enc_passwd"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) + if(!prs_uint32("ptr", ps, depth, &pwd->ptr)) 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; + if (pwd->ptr != 0) { + if(!prs_uint8s(False, "pwd", ps, depth, pwd->pass, sizeof(pwd->pass))) + return False; + } return True; } /******************************************************************* -frees a structure. +inits a SAMR_ENC_HASH structure. ********************************************************************/ -void free_samr_q_set_userinfo(SAMR_Q_SET_USERINFO * q_u) + +void init_enc_hash(SAMR_ENC_HASH * hsh, uchar hash[16]) { - if (q_u == NULL) - return; - free_samr_userinfo_ctr(q_u->ctr); + ZERO_STRUCTP(hsh); + + if (hash == NULL) { + hsh->ptr = 0; + } else { + hsh->ptr = 1; + memcpy(hsh->hash, hash, sizeof(hsh->hash)); + } } /******************************************************************* -reads or writes a structure. +reads or writes a SAMR_ENC_HASH structure. ********************************************************************/ -BOOL samr_io_r_set_userinfo(char *desc, SAMR_R_SET_USERINFO *r_u, prs_struct *ps, int depth) + +BOOL samr_io_enc_hash(char *desc, SAMR_ENC_HASH * hsh, + prs_struct *ps, int depth) { - if (r_u == NULL) + if (hsh == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_set_userinfo"); + prs_debug(ps, depth, desc, "samr_io_enc_hash"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + 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_R_GET_DOM_PWINFO structure. +********************************************************************/ + +void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u, + char *dest_host, char *user_name, + char nt_newpass[516], + uchar nt_oldhash[16], + char lm_newpass[516], + uchar lm_oldhash[16]) +{ + int len_dest_host = strlen(dest_host); + int len_user_name = strlen(user_name); + + DEBUG(5, ("init_samr_q_chgpasswd_user\n")); + + q_u->ptr_0 = 1; + init_uni_hdr(&q_u->hdr_dest_host, len_dest_host); + init_unistr2(&q_u->uni_dest_host, dest_host, len_dest_host); + init_uni_hdr(&q_u->hdr_user_name, len_user_name); + init_unistr2(&q_u->uni_user_name, user_name, len_user_name); + + init_enc_passwd(&q_u->nt_newpass, nt_newpass); + init_enc_hash(&q_u->nt_oldhash, nt_oldhash); + + q_u->unknown = 0x01; + + init_enc_passwd(&q_u->lm_newpass, lm_newpass); + init_enc_hash(&q_u->lm_oldhash, lm_oldhash); +} + /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_userinfo2(char *desc, SAMR_Q_SET_USERINFO2 *q_u, prs_struct *ps, int depth) + +BOOL samr_io_q_chgpasswd_user(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_set_userinfo2"); + prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) + if(!prs_uint32("ptr_0", ps, depth, &q_u->ptr_0)) return False; - if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) + 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(!samr_io_userinfo_ctr("ctr", q_u->ctr, ps, depth)) + + 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; } /******************************************************************* -frees a structure. +inits a SAMR_R_CHGPASSWD_USER structure. ********************************************************************/ -void free_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 *q_u) -{ - free_samr_userinfo_ctr(q_u->ctr); -} -/******************************************************************* -makes a SAMR_R_SET_USERINFO2 structure. -********************************************************************/ -BOOL make_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2 *r_u, uint32 status) +void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER * r_u, uint32 status) { - if (r_u == NULL) - return False; - - DEBUG(5, ("make_samr_r_set_userinfo2\n")); - - r_u->status = status; /* return status */ + DEBUG(5, ("init_r_chgpasswd_user\n")); - return True; + r_u->status = status; } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_userinfo2(char *desc, SAMR_R_SET_USERINFO2 *r_u, prs_struct *ps, int depth) + +BOOL samr_io_r_chgpasswd_user(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_set_userinfo2"); + prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user"); depth++; if(!prs_align(ps)) @@ -4523,6 +6470,3 @@ BOOL samr_io_r_set_userinfo2(char *desc, SAMR_R_SET_USERINFO2 *r_u, prs_struct * return True; } - - -#undef OLD_NTDOMAIN diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 0073f22cab..7a4f0b57ef 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5387,6 +5387,7 @@ BOOL convert_specific_param(NT_PRINTER_PARAM **param, const UNISTR2 *value, } DEBUGADD(6,("\tvalue:[%s], len:[%d]\n",(*param)->value, (*param)->data_len)); + dump_data(10, (char *)(*param)->data, (*param)->data_len); return True; } diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 3db3161ed5..55a0cd95e5 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -426,28 +426,6 @@ BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct * return True; } -/******************************************************************* - Frees a SRV_Q_NET_SHARE_GET_INFO structure. -********************************************************************/ - -void free_srv_q_net_share_get_info(SRV_Q_NET_SHARE_GET_INFO *q_n) -{ - if(!q_n) - return; - memset(q_n, '\0', sizeof(SRV_Q_NET_SHARE_GET_INFO)); -} - -/******************************************************************* - Frees a SRV_R_NET_SHARE_GET_INFO structure. -********************************************************************/ - -void free_srv_r_net_share_get_info(SRV_R_NET_SHARE_GET_INFO *r_n) -{ - if(!r_n) - return; - memset(r_n, '\0', sizeof(SRV_R_NET_SHARE_GET_INFO)); -} - /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -1585,6 +1563,45 @@ BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps return True; } +/******************************************************************* + Inits a SRV_INFO_100 structure. + ********************************************************************/ + +void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, char *name) +{ + DEBUG(5,("init_srv_info_100\n")); + + sv100->platform_id = platform_id; + init_buf_unistr2(&sv100->uni_name, &sv100->ptr_name, name); +} + +/******************************************************************* + Reads or writes a SRV_INFO_101 structure. + ********************************************************************/ + +static BOOL srv_io_info_100(char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth) +{ + if (sv100 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_info_100"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("platform_id ", ps, depth, &sv100->platform_id)) + return False; + if(!prs_uint32("ptr_name ", ps, depth, &sv100->ptr_name)) + return False; + + if(!smb_io_unistr2("uni_name ", &sv100->uni_name, True, ps, depth)) + return False; + + return True; +} + + /******************************************************************* Inits a SRV_INFO_101 structure. ********************************************************************/ @@ -1754,6 +1771,10 @@ static BOOL srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int d if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL) { switch (ctr->switch_value) { + case 100: + if(!srv_io_info_100("sv100", &ctr->srv.sv100, ps, depth)) + return False; + break; case 101: if(!srv_io_info_101("sv101", &ctr->srv.sv101, ps, depth)) return False; -- cgit From d47ee4bffcc849a4f8193986a992c26c1466384c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sun, 11 Mar 2001 00:38:02 +0000 Subject: No longer used... Jeremy. (This used to be commit d23b9be1ba15bedac046319e8f15e60b481d057b) --- source3/rpc_parse/parse_samr_new.c | 1275 ------------------------------------ 1 file changed, 1275 deletions(-) delete mode 100644 source3/rpc_parse/parse_samr_new.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr_new.c b/source3/rpc_parse/parse_samr_new.c deleted file mode 100644 index 7a52551be8..0000000000 --- a/source3/rpc_parse/parse_samr_new.c +++ /dev/null @@ -1,1275 +0,0 @@ -#define NEW_NTDOMAIN 1 -/* - * Unix SMB/Netbios implementation. - * Version 1.9. - * 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 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include - -/******************************************************************* -makes a SAMR_Q_CONNECT structure. -********************************************************************/ -BOOL init_samr_q_connect(SAMR_Q_CONNECT * q_u, char *srv_name, - uint32 access_mask) -{ - int len_srv_name = strlen(srv_name); - - DEBUG(5, ("init_samr_q_connect\n")); - - /* make PDC server name \\server */ - - q_u->ptr_srv_name = len_srv_name ? 1 : 0; - init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1); - - /* example values: 0x0000 0002 */ - - q_u->access_mask = access_mask; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_connect(char *desc, SAMR_Q_CONNECT * q_u, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "samr_io_q_connect"); - depth++; - - prs_align(ps); - - prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name); - smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, - depth); - - prs_align(ps); - - prs_uint32("access_mask", ps, depth, &q_u->access_mask); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_connect(char *desc, SAMR_R_CONNECT * r_u, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "samr_io_r_connect"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth); - prs_uint32("status", ps, depth, &r_u->status); - - return True; -} - -/******************************************************************* -makes a SAMR_Q_CLOSE_HND structure. -********************************************************************/ -BOOL 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; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_close_hnd(char *desc, SAMR_Q_CLOSE_HND * q_u, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_q_close_hnd"); - depth++; - - prs_align(ps); - - return smb_io_pol_hnd("pol", &q_u->pol, ps, depth); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND * r_u, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_r_close_hnd"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("pol", &r_u->pol, ps, depth); - prs_uint32("status", ps, depth, &r_u->status); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN * q_u, - POLICY_HND *connect_pol, uint32 access_mask, - DOM_SID *sid) -{ - DEBUG(5, ("init_samr_q_open_domain\n")); - - q_u->connect_pol = *connect_pol; - q_u->access_mask = access_mask; - - init_dom_sid2(&q_u->dom_sid, sid); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN * q_u, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_q_open_domain"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("connect_pol", &q_u->connect_pol, ps, depth); - - prs_uint32("access_mask", ps, depth, &q_u->access_mask); - - smb_io_dom_sid2("sid", &q_u->dom_sid, ps, depth); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN * r_u, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_r_open_domain"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("domain_pol", &r_u->domain_pol, ps, depth); - - prs_uint32("status", ps, depth, &r_u->status); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL init_samr_q_open_user(SAMR_Q_OPEN_USER * q_u, POLICY_HND *pol, - uint32 access_mask, uint32 rid) -{ - DEBUG(5, ("init_samr_q_open_user\n")); - - q_u->domain_pol = *pol; - q_u->access_mask = access_mask; - q_u->user_rid = rid; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER * q_u, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_q_open_user"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth); - - prs_uint32("access_mask", ps, depth, &q_u->access_mask); - prs_uint32("user_rid ", ps, depth, &q_u->user_rid); - - prs_align(ps); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER * r_u, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_r_open_user"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth); - - prs_uint32("status", ps, depth, &r_u->status); - - return True; -} - -/******************************************************************* -makes a SAMR_Q_QUERY_USERINFO structure. -********************************************************************/ -BOOL init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO * q_u, - POLICY_HND *hnd, uint16 switch_value) -{ - DEBUG(5, ("init_samr_q_query_userinfo\n")); - - q_u->pol = *hnd; - q_u->switch_value = switch_value; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_query_userinfo(char *desc, SAMR_Q_QUERY_USERINFO * q_u, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_q_query_userinfo"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("pol", &q_u->pol, ps, depth); - - prs_uint16("switch_value", ps, depth, &q_u->switch_value); /* 0x0015 or 0x0011 */ - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO * r_u, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_r_query_userinfo"); - depth++; - - prs_align(ps); - - prs_uint32("ptr", ps, depth, &r_u->ptr); - - if (r_u->ptr != 0) { - samr_io_userinfo_ctr("ctr", r_u->ctr, ps, depth); - } - - prs_uint32("status", ps, depth, &r_u->status); - - if (!ps->io) { - /* writing */ - if (r_u->ctr != NULL) { - free_samr_userinfo_ctr(r_u->ctr); - } - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR * ctr, - prs_struct *ps, int depth) -{ - BOOL ret; - - prs_debug(ps, depth, desc, "samr_io_userinfo_ctr"); - depth++; - - /* lkclXXXX DO NOT ALIGN BEFORE READING SWITCH VALUE! */ - - prs_uint16("switch_value", ps, depth, &(ctr->switch_value)); - prs_align(ps); - - ret = False; - - switch (ctr->switch_value) - { - case 0x10: - { - if (UNMARSHALLING(ps)) - { - /* reading */ - ctr->info.id10 = (SAM_USER_INFO_10 *) - malloc(sizeof(SAM_USER_INFO_10)); - } - if (ctr->info.id10 == NULL) - { - DEBUG(2, - ("samr_io_userinfo_ctr: info pointer not initialised\n")); - return False; - } - ret = sam_io_user_info10("", ctr->info.id10, ps, - depth); - break; - } - case 0x11: - { - if (UNMARSHALLING(ps)) - { - /* reading */ - ctr->info.id11 = (SAM_USER_INFO_11 *) - malloc(sizeof(SAM_USER_INFO_11)); - } - if (ctr->info.id11 == NULL) - { - DEBUG(2, - ("samr_io_userinfo_ctr: info pointer not initialised\n")); - return False; - } - ret = sam_io_user_info11("", ctr->info.id11, ps, - depth); - break; - } - case 0x12: - { - if (UNMARSHALLING(ps)) - { - /* reading */ - ctr->info.id12 = (SAM_USER_INFO_12 *) - malloc(sizeof(SAM_USER_INFO_12)); - } - if (ctr->info.id12 == NULL) - { - DEBUG(2, - ("samr_io_userinfo_ctr: info pointer not initialised\n")); - return False; - } - ret = sam_io_user_info12("", ctr->info.id12, ps, - depth); - break; - } - case 21: - { -#if 0 - if (UNMARSHALLING(ps)) - { - /* reading */ - ctr->info.id21 = (SAM_USER_INFO_21 *) - malloc(sizeof(SAM_USER_INFO_21)); - } -#endif - 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)) - { - /* reading */ - ctr->info.id23 = (SAM_USER_INFO_23 *) - malloc(sizeof(SAM_USER_INFO_23)); - } - 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)) - { - /* reading */ - ctr->info.id24 = (SAM_USER_INFO_24 *) - malloc(sizeof(SAM_USER_INFO_24)); - } - 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; - } - default: - { - DEBUG(2, ("samr_io_userinfo_ctr: unknown switch " - "level 0x%x\n", ctr->switch_value)); - ret = False; - break; - } - - } - - prs_align(ps); - - return ret; -} - -/******************************************************************* -frees a structure. -********************************************************************/ -void free_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr) -{ - if (!ctr) return; - - safe_free(ctr->info.id); - ctr->info.id = NULL; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL sam_io_user_info10(char *desc, SAM_USER_INFO_10 * usr, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_r_user_info10"); - depth++; - - prs_align(ps); - - prs_uint32("acb_info", ps, depth, &(usr->acb_info)); - - return True; -} - -/******************************************************************* -makes a SAM_USER_INFO_11 structure. -********************************************************************/ -BOOL init_sam_user_info11(SAM_USER_INFO_11 * usr, - NTTIME * expiry, - char *mach_acct, - uint32 rid_user, uint32 rid_group, uint16 acct_ctrl) -{ - int len_mach_acct; - - DEBUG(5, ("init_sam_user_info11\n")); - - len_mach_acct = strlen(mach_acct); - - memcpy(&(usr->expiry), expiry, sizeof(usr->expiry)); /* expiry time or something? */ - ZERO_STRUCT(usr->padding_1); /* 0 - padding 24 bytes */ - - init_uni_hdr(&(usr->hdr_mach_acct), len_mach_acct); /* unicode header for machine account */ - 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, len_mach_acct); /* unicode string for machine account */ - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL sam_io_user_info11(char *desc, SAM_USER_INFO_11 * usr, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_r_unknown_11"); - depth++; - - prs_align(ps); - - prs_uint8s(False, "padding_0", ps, depth, usr->padding_0, - sizeof(usr->padding_0)); - - smb_io_time("time", &(usr->expiry), ps, depth); - - prs_uint8s(False, "padding_1", ps, depth, usr->padding_1, - sizeof(usr->padding_1)); - - smb_io_unihdr("unihdr", &(usr->hdr_mach_acct), ps, depth); - prs_uint32("padding_2", ps, depth, &(usr->padding_2)); - - prs_uint32("ptr_1 ", ps, depth, &(usr->ptr_1)); - prs_uint8s(False, "padding_3", ps, depth, usr->padding_3, - sizeof(usr->padding_3)); - prs_uint32("padding_4", ps, depth, &(usr->padding_4)); - - prs_uint32("ptr_2 ", ps, depth, &(usr->ptr_2)); - prs_uint32("padding_5", ps, depth, &(usr->padding_5)); - - prs_uint32("ptr_3 ", ps, depth, &(usr->ptr_3)); - prs_uint8s(False, "padding_6", ps, depth, usr->padding_6, - sizeof(usr->padding_6)); - - prs_uint32("rid_user ", ps, depth, &(usr->rid_user)); - prs_uint32("rid_group", ps, depth, &(usr->rid_group)); - prs_uint16("acct_ctrl", ps, depth, &(usr->acct_ctrl)); - prs_uint16("unknown_3", ps, depth, &(usr->unknown_3)); - prs_uint16("unknown_4", ps, depth, &(usr->unknown_4)); - prs_uint16("unknown_5", ps, depth, &(usr->unknown_5)); - - prs_uint8s(False, "padding_7", ps, depth, usr->padding_7, - sizeof(usr->padding_7)); - prs_uint32("padding_8", ps, depth, &(usr->padding_8)); - - smb_io_unistr2("unistr2", &(usr->uni_mach_acct), True, ps, depth); - prs_align(ps); - - prs_uint8s(False, "padding_9", ps, depth, usr->padding_9, - sizeof(usr->padding_9)); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL sam_io_user_info12(char *desc, SAM_USER_INFO_12 * u, - prs_struct *ps, int depth) -{ - DEBUG(0, ("possible security breach!\n")); - - prs_debug(ps, depth, desc, "samr_io_r_user_info12"); - depth++; - - prs_align(ps); - - prs_uint8s(False, "lm_pwd", ps, depth, u->lm_pwd, sizeof(u->lm_pwd)); - prs_uint8s(False, "nt_pwd", ps, depth, u->nt_pwd, sizeof(u->nt_pwd)); - - prs_uint8("lm_pwd_active", ps, depth, &u->lm_pwd_active); - prs_uint8("nt_pwd_active", ps, depth, &u->nt_pwd_active); - prs_align(ps); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 * usr, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "sam_io_user_info21"); - depth++; - - prs_align(ps); - - smb_io_time("logon_time ", &(usr->logon_time), ps, depth); - smb_io_time("logoff_time ", &(usr->logoff_time), ps, depth); - smb_io_time("pass_last_set_time ", &(usr->pass_last_set_time), ps, - depth); - smb_io_time("kickoff_time ", &(usr->kickoff_time), ps, depth); - smb_io_time("pass_can_change_time ", &(usr->pass_can_change_time), ps, - depth); - smb_io_time("pass_must_change_time", &(usr->pass_must_change_time), - ps, depth); - - smb_io_unihdr("hdr_user_name ", &(usr->hdr_user_name), ps, depth); /* username unicode string header */ - smb_io_unihdr("hdr_full_name ", &(usr->hdr_full_name), ps, depth); /* user's full name unicode string header */ - smb_io_unihdr("hdr_home_dir ", &(usr->hdr_home_dir), ps, depth); /* home directory unicode string header */ - smb_io_unihdr("hdr_dir_drive ", &(usr->hdr_dir_drive), ps, depth); /* home directory drive */ - smb_io_unihdr("hdr_logon_script", &(usr->hdr_logon_script), ps, depth); /* logon script unicode string header */ - smb_io_unihdr("hdr_profile_path", &(usr->hdr_profile_path), ps, depth); /* profile path unicode string header */ - smb_io_unihdr("hdr_acct_desc ", &(usr->hdr_acct_desc), ps, depth); /* account desc */ - smb_io_unihdr("hdr_workstations", &(usr->hdr_workstations), ps, depth); /* wkstas user can log on from */ - smb_io_unihdr("hdr_unknown_str ", &(usr->hdr_unknown_str), ps, depth); /* unknown string */ - smb_io_unihdr("hdr_munged_dial ", &(usr->hdr_munged_dial), ps, depth); /* wkstas user can log on from */ - - prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, - sizeof(usr->lm_pwd)); - prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, - sizeof(usr->nt_pwd)); - - prs_uint32("user_rid ", ps, depth, &(usr->user_rid)); /* User ID */ - prs_uint32("group_rid ", ps, depth, &(usr->group_rid)); /* Group ID */ - prs_uint32("acb_info ", ps, depth, &(usr->acb_info)); - - prs_uint32("unknown_3 ", ps, depth, &(usr->unknown_3)); - prs_uint16("logon_divs ", ps, depth, &(usr->logon_divs)); /* logon divisions per week */ - prs_align(ps); - prs_uint32("ptr_logon_hrs ", ps, depth, &(usr->ptr_logon_hrs)); - prs_uint32("unknown_5 ", ps, depth, &(usr->unknown_5)); - - prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, - sizeof(usr->padding1)); - - /* here begins pointed-to data */ - - smb_io_unistr2("uni_user_name ", &(usr->uni_user_name), - usr->hdr_user_name.buffer, ps, depth); /* username unicode string */ - prs_align(ps); - smb_io_unistr2("uni_full_name ", &(usr->uni_full_name), - usr->hdr_full_name.buffer, ps, depth); /* user's full name unicode string */ - prs_align(ps); - smb_io_unistr2("uni_home_dir ", &(usr->uni_home_dir), - usr->hdr_home_dir.buffer, ps, depth); /* home directory unicode string */ - prs_align(ps); - smb_io_unistr2("uni_dir_drive ", &(usr->uni_dir_drive), - usr->hdr_dir_drive.buffer, ps, depth); /* home directory drive unicode string */ - prs_align(ps); - smb_io_unistr2("uni_logon_script", &(usr->uni_logon_script), - usr->hdr_logon_script.buffer, ps, depth); /* logon script unicode string */ - prs_align(ps); - smb_io_unistr2("uni_profile_path", &(usr->uni_profile_path), - usr->hdr_profile_path.buffer, ps, depth); /* profile path unicode string */ - prs_align(ps); - smb_io_unistr2("uni_acct_desc ", &(usr->uni_acct_desc), - usr->hdr_acct_desc.buffer, ps, depth); /* user desc unicode string */ - prs_align(ps); - smb_io_unistr2("uni_workstations", &(usr->uni_workstations), - usr->hdr_workstations.buffer, ps, depth); /* worksations user can log on from */ - prs_align(ps); - smb_io_unistr2("uni_unknown_str ", &(usr->uni_unknown_str), - usr->hdr_unknown_str.buffer, ps, depth); /* unknown string */ - prs_align(ps); - smb_io_unistr2("uni_munged_dial ", &(usr->uni_munged_dial), - usr->hdr_munged_dial.buffer, ps, depth); /* worksations user can log on from */ - prs_align(ps); - - /* ok, this is only guess-work (as usual) */ - if (usr->unknown_3 != 0x0) - { - prs_uint32("unknown_6 ", ps, depth, &(usr->unknown_6)); - prs_uint32("padding4 ", ps, depth, &(usr->padding4)); - } - else if (UNMARSHALLING(ps)) - { - usr->unknown_6 = 0; - usr->padding4 = 0; - } - - if (usr->ptr_logon_hrs) - { - sam_io_logon_hrs("logon_hrs", &(usr->logon_hrs), ps, depth); - prs_align(ps); - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 * usr, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "sam_io_user_info23"); - depth++; - - prs_align(ps); - - smb_io_time("logon_time ", &(usr->logon_time), ps, depth); - smb_io_time("logoff_time ", &(usr->logoff_time), ps, depth); - smb_io_time("kickoff_time ", &(usr->kickoff_time), ps, depth); - smb_io_time("pass_last_set_time ", &(usr->pass_last_set_time), ps, - depth); - smb_io_time("pass_can_change_time ", &(usr->pass_can_change_time), ps, - depth); - smb_io_time("pass_must_change_time", &(usr->pass_must_change_time), - ps, depth); - - smb_io_unihdr("hdr_user_name ", &(usr->hdr_user_name), ps, depth); /* username unicode string header */ - smb_io_unihdr("hdr_full_name ", &(usr->hdr_full_name), ps, depth); /* user's full name unicode string header */ - smb_io_unihdr("hdr_home_dir ", &(usr->hdr_home_dir), ps, depth); /* home directory unicode string header */ - smb_io_unihdr("hdr_dir_drive ", &(usr->hdr_dir_drive), ps, depth); /* home directory drive */ - smb_io_unihdr("hdr_logon_script", &(usr->hdr_logon_script), ps, depth); /* logon script unicode string header */ - smb_io_unihdr("hdr_profile_path", &(usr->hdr_profile_path), ps, depth); /* profile path unicode string header */ - smb_io_unihdr("hdr_acct_desc ", &(usr->hdr_acct_desc), ps, depth); /* account desc */ - smb_io_unihdr("hdr_workstations", &(usr->hdr_workstations), ps, depth); /* wkstas user can log on from */ - smb_io_unihdr("hdr_unknown_str ", &(usr->hdr_unknown_str), ps, depth); /* unknown string */ - smb_io_unihdr("hdr_munged_dial ", &(usr->hdr_munged_dial), ps, depth); /* wkstas user can log on from */ - - prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, - sizeof(usr->lm_pwd)); - prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, - sizeof(usr->nt_pwd)); - - prs_uint32("user_rid ", ps, depth, &(usr->user_rid)); /* User ID */ - prs_uint32("group_rid ", ps, depth, &(usr->group_rid)); /* Group ID */ - prs_uint32("acb_info ", ps, depth, &(usr->acb_info)); - - prs_uint32("unknown_3 ", ps, depth, &(usr->unknown_3)); - prs_uint16("logon_divs ", ps, depth, &(usr->logon_divs)); /* logon divisions per week */ - prs_align(ps); - prs_uint32("ptr_logon_hrs ", ps, depth, &(usr->ptr_logon_hrs)); - prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, - sizeof(usr->padding1)); - prs_uint32("unknown_5 ", ps, depth, &(usr->unknown_5)); - - prs_uint8s(False, "password ", ps, depth, usr->pass, - sizeof(usr->pass)); - - /* here begins pointed-to data */ - - smb_io_unistr2("uni_user_name ", &(usr->uni_user_name), - usr->hdr_user_name.buffer, ps, depth); /* username unicode string */ - prs_align(ps); - smb_io_unistr2("uni_full_name ", &(usr->uni_full_name), - usr->hdr_full_name.buffer, ps, depth); /* user's full name unicode string */ - prs_align(ps); - smb_io_unistr2("uni_home_dir ", &(usr->uni_home_dir), - usr->hdr_home_dir.buffer, ps, depth); /* home directory unicode string */ - prs_align(ps); - smb_io_unistr2("uni_dir_drive ", &(usr->uni_dir_drive), - usr->hdr_dir_drive.buffer, ps, depth); /* home directory drive unicode string */ - prs_align(ps); - smb_io_unistr2("uni_logon_script", &(usr->uni_logon_script), - usr->hdr_logon_script.buffer, ps, depth); /* logon script unicode string */ - prs_align(ps); - smb_io_unistr2("uni_profile_path", &(usr->uni_profile_path), - usr->hdr_profile_path.buffer, ps, depth); /* profile path unicode string */ - prs_align(ps); - smb_io_unistr2("uni_acct_desc ", &(usr->uni_acct_desc), - usr->hdr_acct_desc.buffer, ps, depth); /* user desc unicode string */ - prs_align(ps); - smb_io_unistr2("uni_workstations", &(usr->uni_workstations), - usr->hdr_workstations.buffer, ps, depth); /* worksations user can log on from */ - prs_align(ps); - smb_io_unistr2("uni_unknown_str ", &(usr->uni_unknown_str), - usr->hdr_unknown_str.buffer, ps, depth); /* unknown string */ - prs_align(ps); - smb_io_unistr2("uni_munged_dial ", &(usr->uni_munged_dial), - usr->hdr_munged_dial.buffer, ps, depth); /* worksations user can log on from */ - prs_align(ps); - - /* ok, this is only guess-work (as usual) */ - if (usr->unknown_3 != 0x0) - { - prs_uint32("unknown_6 ", ps, depth, &(usr->unknown_6)); - prs_uint32("padding4 ", ps, depth, &(usr->padding4)); - } - else if (UNMARSHALLING(ps)) - { - usr->unknown_6 = 0; - usr->padding4 = 0; - } - - if (usr->ptr_logon_hrs) - { - sam_io_logon_hrs("logon_hrs", &(usr->logon_hrs), ps, depth); - prs_align(ps); - } - - return True; -} - -/************************************************************************* - make_sam_user_infoa - - unknown_3 = 0x09f8 27fa - unknown_5 = 0x0001 0000 - unknown_6 = 0x0000 04ec - - *************************************************************************/ -BOOL init_sam_user_info24(SAM_USER_INFO_24 * usr, - const char newpass[516], uint16 passlen) -{ - DEBUG(10, ("init_sam_user_info24: passlen: %d\n", passlen)); - memcpy(usr->pass, newpass, sizeof(usr->pass)); - usr->unk_0 = passlen; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL sam_io_user_info24(char *desc, SAM_USER_INFO_24 * usr, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "sam_io_user_info24"); - depth++; - - prs_align(ps); - - prs_uint8s(False, "password", ps, depth, usr->pass, - sizeof(usr->pass)); - prs_uint16("unk_0", ps, depth, &(usr->unk_0)); /* unknown */ - prs_align(ps); - - return True; -} - -/******************************************************************* -reads or writes a LOGON_HRS structure. -********************************************************************/ -BOOL sam_io_logon_hrs(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++; - - prs_align(ps); - - prs_uint32("len ", ps, depth, &hrs->len); - - if (hrs->len > sizeof(hrs->hours)) - { - DEBUG(3, ("sam_io_logon_hrs: truncating length from %d\n", - hrs->len)); - hrs->len = sizeof(hrs->hours); - } - - prs_uint8s(False, "hours", ps, depth, hrs->hours, hrs->len); - - return True; -} - -/******************************************************************* -makes a SAMR_Q_QUERY_GROUPINFO structure. -********************************************************************/ -BOOL 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; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_query_groupinfo(char *desc, SAMR_Q_QUERY_GROUPINFO * q_e, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_q_query_groupinfo"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("pol", &q_e->pol, ps, depth); - prs_uint16("switch_level", ps, depth, &q_e->switch_level); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_query_groupinfo(char *desc, SAMR_R_QUERY_GROUPINFO * r_u, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_r_query_groupinfo"); - depth++; - - prs_align(ps); - - prs_uint32("ptr", ps, depth, &r_u->ptr); - - if (r_u->ptr != 0) { - samr_group_info_ctr("ctr", r_u->ctr, ps, depth); - } - - prs_uint32("status", ps, depth, &r_u->status); - - return True; -} - -/******************************************************************* -makes a SAMR_Q_QUERY_USERGROUPS structure. -********************************************************************/ -BOOL 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; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS * q_u, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_q_query_usergroups"); - depth++; - - prs_align(ps); - - return smb_io_pol_hnd("pol", &q_u->pol, ps, depth); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS * r_u, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_r_query_usergroups"); - depth++; - - prs_align(ps); - - prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0); - - if (r_u->ptr_0 != 0) { - prs_uint32("num_entries ", ps, depth, &r_u->num_entries); - prs_uint32("ptr_1 ", ps, depth, &r_u->ptr_1); - - if (r_u->num_entries != 0 && r_u->ptr_1 != 0) - { - samr_io_gids("gids", &r_u->num_entries2, &r_u->gid, - ps, depth); - } - } - prs_uint32("status", ps, depth, &r_u->status); - - return True; -} - -/******************************************************************* -makes a SAMR_Q_QUERY_GROUPMEM structure. -********************************************************************/ -BOOL 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; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_query_groupmem(char *desc, SAMR_Q_QUERY_GROUPMEM * q_u, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_q_query_groupmem"); - depth++; - - prs_align(ps); - - return smb_io_pol_hnd("group_pol", &q_u->group_pol, ps, depth); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM * r_u, - prs_struct *ps, int depth) -{ - uint32 i; - - if (UNMARSHALLING(ps)) { - ZERO_STRUCTP(r_u); - } - - prs_debug(ps, depth, desc, "samr_io_r_query_groupmem"); - depth++; - - prs_align(ps); - - prs_uint32("ptr", ps, depth, &r_u->ptr); - prs_uint32("num_entries ", ps, depth, &r_u->num_entries); - - if (r_u->ptr != 0) - { - prs_uint32("ptr_rids ", ps, depth, &r_u->ptr_rids); - prs_uint32("ptr_attrs", ps, depth, &r_u->ptr_attrs); - - if (r_u->ptr_rids != 0) { - prs_uint32("num_rids", ps, depth, &r_u->num_rids); - if (r_u->num_rids != 0) { - - r_u->rid = (uint32 *) - talloc(ps->mem_ctx, - sizeof(r_u->rid [0]) * - r_u->num_rids); - } - - for (i = 0; i < r_u->num_rids; i++) { - prs_uint32("", ps, depth, &r_u->rid[i]); - } - } - - if (r_u->ptr_attrs != 0) { - prs_uint32("num_attrs", ps, depth, &r_u->num_attrs); - - if (r_u->num_attrs != 0) { - r_u->attr = (uint32 *) - talloc(ps->mem_ctx, - sizeof(r_u->attr[0]) * - r_u->num_attrs); - } - - for (i = 0; i < r_u->num_attrs; i++) { - prs_uint32("", ps, depth, &r_u->attr[i]); - } - } - } - - prs_uint32("status", ps, depth, &(r_u->status)); - - if (!ps->io) { - /* storing. memory no longer needed */ - samr_free_r_query_groupmem(r_u); - } - - return True; -} - -/******************************************************************* -frees a structure. -********************************************************************/ -void samr_free_r_query_groupmem(SAMR_R_QUERY_GROUPMEM * r_u) -{ - safe_free(r_u->rid); - r_u->rid = NULL; - - safe_free(r_u->attr); - r_u->attr = NULL; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_group_info_ctr(char *desc, GROUP_INFO_CTR * ctr, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "samr_group_info_ctr"); - depth++; - - prs_uint16("switch_value1", ps, depth, &(ctr->switch_value1)); - prs_uint16("switch_value2", ps, depth, &(ctr->switch_value2)); - - switch (ctr->switch_value1) - { - case 1: - { - samr_io_group_info1("group_info1", - &(ctr->group.info1), ps, depth); - break; - } - case 4: - { - samr_io_group_info4("group_info4", - &(ctr->group.info4), ps, depth); - break; - } - default: - { - DEBUG(4, - ("samr_group_info_ctr: unsupported switch level\n")); - break; - } - } - - prs_align(ps); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_gids(char *desc, uint32 *num_gids, DOM_GID ** gid, - prs_struct *ps, int depth) -{ - uint32 i; - - prs_debug(ps, depth, desc, "samr_io_gids"); - depth++; - - prs_align(ps); - - prs_uint32("num_gids", ps, depth, num_gids); - - if ((*num_gids) != 0) - { - if (UNMARSHALLING(ps)) - { - (*gid) = (DOM_GID *) - talloc(ps->mem_ctx, sizeof(DOM_GID) * - (*num_gids)); - } - - if ((*gid) == NULL) - { - return False; - } - - for (i = 0; i < (*num_gids); i++) - { - smb_io_gid("gids", &(*gid)[i], ps, depth); - } - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_group_info1(char *desc, GROUP_INFO1 * gr1, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_group_info1"); - depth++; - - prs_align(ps); - - smb_io_unihdr("hdr_acct_name", &(gr1->hdr_acct_name), ps, depth); - - prs_uint32("unknown_1", ps, depth, &(gr1->unknown_1)); - prs_uint32("num_members", ps, depth, &(gr1->num_members)); - - smb_io_unihdr("hdr_acct_desc", &(gr1->hdr_acct_desc), ps, depth); - - smb_io_unistr2("uni_acct_name", &(gr1->uni_acct_name), - gr1->hdr_acct_name.buffer, ps, depth); - prs_align(ps); - - smb_io_unistr2("uni_acct_desc", &(gr1->uni_acct_desc), - gr1->hdr_acct_desc.buffer, ps, depth); - prs_align(ps); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_group_info4(char *desc, GROUP_INFO4 * gr4, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_group_info4"); - depth++; - - prs_align(ps); - - smb_io_unihdr("hdr_acct_desc", &(gr4->hdr_acct_desc), ps, depth); - smb_io_unistr2("uni_acct_desc", &(gr4->uni_acct_desc), - gr4->hdr_acct_desc.buffer, ps, depth); - prs_align(ps); - - return True; -} - -/******************************************************************* -makes a SAMR_Q_QUERY_USERGROUPS structure. -********************************************************************/ -BOOL 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; - - return True; -} - -/******************************************************************* -makes a SAMR_Q_OPEN_GROUP structure. -********************************************************************/ -BOOL 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; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_q_open_group(char *desc, SAMR_Q_OPEN_GROUP * q_u, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_q_open_group"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth); - - prs_uint32("access_mask", ps, depth, &(q_u->access_mask)); - prs_uint32("rid_group", ps, depth, &(q_u->rid_group)); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP * r_u, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "samr_io_r_open_group"); - depth++; - - prs_align(ps); - - smb_io_pol_hnd("pol", &r_u->group_pol, ps, depth); - - prs_uint32("status", ps, depth, &(r_u->status)); - - return True; -} - -#undef NEW_NTDOMAIN -- cgit From ea35aae3bfad9c73a6768abcd76726b26b6c4f9a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 12 Mar 2001 21:09:55 +0000 Subject: We copy the RPC header directly from the incoming client - remember to set little-endian flag on marshalling. AS/U now correctly tries to join our domain ! Jeremy. (This used to be commit 0185f8159dbd30820d1ec9ce2aec8eb1cddcfc0b) --- source3/rpc_parse/parse_rpc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 9fe893d4be..f330c5947e 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -187,6 +187,11 @@ BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) return False; if(!prs_uint8 ("flags ", ps, depth, &rpc->flags)) return False; + + /* We always marshall in little endian format. */ + if (MARSHALLING(ps)) + rpc->pack_type[0] = 0x10; + if(!prs_uint8("pack_type0", ps, depth, &rpc->pack_type[0])) return False; if(!prs_uint8("pack_type1", ps, depth, &rpc->pack_type[1])) @@ -201,7 +206,7 @@ BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) * format. Set the flag in the prs_struct to specify reverse-endainness. */ - if (ps->io && rpc->pack_type[0] == 0) { + if (UNMARSHALLING(ps) && rpc->pack_type[0] == 0) { DEBUG(10,("smb_io_rpc_hdr: PDU data format is big-endian. Setting flag.\n")); prs_set_endian_data(ps, RPC_BIG_ENDIAN); } -- cgit From 63107eceb9d679ddc9bf2c66bd18c7958332a8f9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 13 Mar 2001 19:15:48 +0000 Subject: We were mismarshalling a netlogon reply for bad password to W2K. Jeremy. (This used to be commit 017a6a9868eb5237a715a0d7bf4784863f40a2f4) --- source3/rpc_parse/parse_net.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index f1ff965df2..fbbc09182e 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1337,10 +1337,15 @@ BOOL net_io_r_sam_logon(char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, int de 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)) + return False; +#else if (r_l->switch_value != 0) { if(!net_io_user_info3("", r_l->user, ps, depth, r_l->switch_value)) return False; } +#endif if(!prs_uint32("auth_resp ", ps, depth, &r_l->auth_resp)) /* 1 - Authoritative response; 0 - Non-Auth? */ return False; -- cgit From 13a584b05acab8d0bb0257712664a3c6a90e3f97 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 13 Mar 2001 20:13:20 +0000 Subject: rpc_parse/parse_samr.c: Removed unneeded deubg. rpc_server/srv_netlog_nt.c: Ensure we marshall a bad password return correctly to a w2k client. Jeremy. (This used to be commit 500c7bc0fed16713401643bdede67cc0c8044d52) --- source3/rpc_parse/parse_samr.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 5cfa84ff3d..6600ecca86 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4799,8 +4799,6 @@ static BOOL sam_io_user_info12(char *desc, SAM_USER_INFO_12 * u, if (u == NULL) return False; - DEBUG(0, ("possible security breach!\n")); - prs_debug(ps, depth, desc, "samr_io_r_user_info12"); depth++; -- cgit From a9dda48d653810b8f20b3b72f07cc060e2b2e3cd Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 15 Mar 2001 07:11:18 +0000 Subject: renamed one of the enumprinterdrivers parsing functions for consistency sake. (This used to be commit cbce0c935099231af51a34460c6b331822fde213) --- source3/rpc_parse/parse_spoolss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 7a4f0b57ef..c6da6ca6fe 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3761,9 +3761,9 @@ BOOL spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int de Parse a SPOOL_R_ENUMPRINTERDRIVERS structure. ********************************************************************/ -BOOL new_spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, "new_spoolss_io_r_enumprinterdrivers"); + prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdrivers"); depth++; if (!prs_align(ps)) -- cgit From c09fe5e1579cf6ea487d8d5a853c5cbef43a6c51 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 15 Mar 2001 22:08:26 +0000 Subject: whoops...forgot one (This used to be commit f37ba49c28b617c5750344eff0b221512445908e) --- source3/rpc_parse/parse_spoolss.c | 50 ++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 19 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index c6da6ca6fe..24d0fa2538 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -760,12 +760,17 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, /******************************************************************* * init a structure. ********************************************************************/ - -BOOL make_spoolss_q_addprinterex(TALLOC_CTX *ctx, SPOOL_Q_ADDPRINTEREX *q_u, const char *srv_name, - const char* clientname, const char* user_name, - uint32 level, PRINTER_INFO_2 *info) +BOOL make_spoolss_q_addprinterex( + SPOOL_Q_ADDPRINTEREX *q_u, + const char *srv_name, + const char* clientname, + const char* user_name, + uint32 level, + PRINTER_INFO_CTR *ctr) { DEBUG(5,("make_spoolss_q_addprinterex\n")); + + if (!ctr) return False; q_u->server_name_ptr = (srv_name!=NULL)?1:0; init_unistr2(&q_u->server_name, srv_name, strlen(srv_name)); @@ -773,12 +778,12 @@ BOOL make_spoolss_q_addprinterex(TALLOC_CTX *ctx, SPOOL_Q_ADDPRINTEREX *q_u, con q_u->level = level; q_u->info.level = level; - q_u->info.info_ptr = (info!=NULL)?1:0; + q_u->info.info_ptr = (ctr->printers_2!=NULL)?1:0; switch (level) { case 2: /* init q_u->info.info2 from *info */ - if (!make_spool_printer_info_2( ctx, &q_u->info.info_2, info)) + if (!make_spool_printer_info_2(&q_u->info.info_2, ctr->printers_2)) { DEBUG(0,("make_spoolss_q_addprinterex: Unable to fill SPOOL_Q_ADDPRINTEREX struct!\n")); return False; @@ -812,14 +817,16 @@ BOOL make_spoolss_q_addprinterex(TALLOC_CTX *ctx, SPOOL_Q_ADDPRINTEREX *q_u, con create a SPOOL_PRINTER_INFO_2 stuct from a PRINTER_INFO_2 struct *******************************************************************/ -BOOL make_spool_printer_info_2(TALLOC_CTX *ctx, SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2, - PRINTER_INFO_2 *info) +BOOL make_spool_printer_info_2( + SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2, + PRINTER_INFO_2 *info +) { SPOOL_PRINTER_INFO_LEVEL_2 *inf; /* allocate the necessary memory */ - inf = (SPOOL_PRINTER_INFO_LEVEL_2*)talloc_zero(ctx,sizeof(SPOOL_PRINTER_INFO_LEVEL_2)); + inf = (SPOOL_PRINTER_INFO_LEVEL_2*)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2)); if (spool_info2 == NULL) { DEBUG(0,("make_spool_printer_info_2: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_2 sruct!\n")); @@ -4620,9 +4627,11 @@ BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LE init a SPOOL_Q_ADDPRINTERDRIVER struct ******************************************************************/ -BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *ctx, SPOOL_Q_ADDPRINTERDRIVER *q_u, - const char* srv_name, uint32 level, - PRINTER_DRIVER_CTR *info) +BOOL make_spoolss_q_addprinterdriver( + SPOOL_Q_ADDPRINTERDRIVER *q_u, + const char* srv_name, + uint32 level, + PRINTER_DRIVER_CTR *info) { DEBUG(5,("make_spoolss_q_addprinterdriver\n")); @@ -4639,8 +4648,9 @@ BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *ctx, SPOOL_Q_ADDPRINTERDRIVER * WinNT and Win2k */ case 3 : q_u->info.info_3=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3*) - talloc_zero(ctx, sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); - make_spool_driver_info_3(ctx,q_u->info.info_3, info->info3); + malloc(sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); + memset (q_u->info.info_3, 0x0, sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); + make_spool_driver_info_3(q_u->info.info_3, info->info3); break; /* info level 6 is supported by WinME and Win2k */ @@ -4657,8 +4667,10 @@ info level [%d]\n", level)); return True; } -BOOL make_spool_driver_info_3(TALLOC_CTX *ctx, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *spool_drv_info, - DRIVER_INFO_3 *info3) +BOOL make_spool_driver_info_3( + SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *spool_drv_info, + DRIVER_INFO_3 *info3 +) { uint32 len = 0; uint16 *ptr = info3->dependentfiles; @@ -4707,7 +4719,7 @@ BOOL make_spool_driver_info_3(TALLOC_CTX *ctx, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 } spool_drv_info->dependentfiles_ptr = (info3->dependentfiles!=NULL)?1:0; spool_drv_info->dependentfilessize = len; - if(!make_spool_buffer5(ctx, &spool_drv_info->dependentfiles, len, info3->dependentfiles)) + if(!make_spool_buffer5(&spool_drv_info->dependentfiles, len, info3->dependentfiles)) return False; return True; @@ -4717,11 +4729,11 @@ BOOL make_spool_driver_info_3(TALLOC_CTX *ctx, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 make a BUFFER5 struct from a uint16* ******************************************************************/ -BOOL make_spool_buffer5(TALLOC_CTX *ctx, BUFFER5 *buf5, uint32 len, uint16 *src) +BOOL make_spool_buffer5(BUFFER5 *buf5, uint32 len, uint16 *src) { buf5->buf_len = len; - if((buf5->buffer=(uint16*)talloc(ctx, sizeof(uint16)*len)) == NULL) + if((buf5->buffer=(uint16*)malloc(sizeof(uint16)*len)) == NULL) { DEBUG(0,("make_spool_buffer5: Unable to talloc memory for buffer!\n")); return False; -- cgit From 65d35749b721b76ae826a9423bdefd2f673f35c6 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 16 Mar 2001 05:55:30 +0000 Subject: Added Michael Sweet's CUPS patch to call directly into the CUPS backend. Parameterises the printing functions so other backends can be plugged directly in (this is a good thing :-). Jeremy. (This used to be commit c0345bbaed5d1aac777f1a33ff84ad1899f2ed6d) --- source3/rpc_parse/parse_reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index e757245f7c..a7602434e5 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -5,7 +5,7 @@ * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997. - * Copyright (C) Hewlett-Packard Company 1999. + * Copyright (C) Marc Jacobsen 1999. * * 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 -- cgit From 344fb49fbf4df55492bfa9cc1aee2d8210c32ca6 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 19 Mar 2001 18:14:09 +0000 Subject: reverted the rename of new_spoolss_io_r_enumprinterdrivers() (This used to be commit fd6bfe03f4454272bdce59c78ae7148a72caaf18) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 24d0fa2538..d6987b46aa 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3768,7 +3768,7 @@ BOOL spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int de Parse a SPOOL_R_ENUMPRINTERDRIVERS structure. ********************************************************************/ -BOOL spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) +BOOL new_spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdrivers"); depth++; -- cgit From 25d975e5500243dff4918fe04416695cd3e79a72 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 27 Mar 2001 18:19:01 +0000 Subject: merge from 2.2. (This used to be commit 817258f1174d27d74e8b21ffb5f1384db2238007) --- source3/rpc_parse/parse_spoolss.c | 80 +++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 40 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index d6987b46aa..53fd586f85 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2500,11 +2500,11 @@ BOOL new_smb_io_form_1(char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth) Read/write a BUFFER struct. ********************************************************************/ -static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUFFER **pp_buffer) +static BOOL spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUFFER **pp_buffer) { NEW_BUFFER *buffer = *pp_buffer; - prs_debug(ps, depth, desc, "new_spoolss_io_buffer"); + prs_debug(ps, depth, desc, "spoolss_io_buffer"); depth++; if (UNMARSHALLING(ps)) @@ -2588,7 +2588,7 @@ static BOOL new_spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUF this is ok. This is an OPTIMIZATION and is not strictly neccessary. ********************************************************************/ -void new_spoolss_move_buffer(NEW_BUFFER *src, NEW_BUFFER **dest) +void spoolss_move_buffer(NEW_BUFFER *src, NEW_BUFFER **dest) { prs_switch_type(&src->prs, MARSHALL); if(!prs_set_offset(&src->prs, 0)) @@ -3205,7 +3205,7 @@ BOOL spoolss_io_q_getprinterdriver2(char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if(!spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if(!prs_align(ps)) @@ -3235,7 +3235,7 @@ BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -3316,7 +3316,7 @@ BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -3331,15 +3331,15 @@ BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct Parse a SPOOL_R_ENUMPRINTERS structure. ********************************************************************/ -BOOL new_spoolss_io_r_enumprinters(char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprinters(char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, "new_spoolss_io_r_enumprinters"); + prs_debug(ps, depth, desc, "spoolss_io_r_enumprinters"); depth++; if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -3371,7 +3371,7 @@ BOOL spoolss_io_r_getprinter(char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -3404,7 +3404,7 @@ BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -3559,7 +3559,7 @@ BOOL spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int de if(!prs_align(ps)) return False; - if(!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if(!spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if(!prs_align(ps)) @@ -3590,7 +3590,7 @@ BOOL spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int de if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if(!spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if(!prs_align(ps)) @@ -3613,7 +3613,7 @@ BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, in if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -3675,7 +3675,7 @@ BOOL spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, in if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_uint32("offered", ps, depth, &q_u->offered)) @@ -3768,7 +3768,7 @@ BOOL spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int de Parse a SPOOL_R_ENUMPRINTERDRIVERS structure. ********************************************************************/ -BOOL new_spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdrivers"); depth++; @@ -3776,7 +3776,7 @@ BOOL new_spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -3844,7 +3844,7 @@ BOOL spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -3872,7 +3872,7 @@ BOOL spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -3886,15 +3886,15 @@ BOOL spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, /******************************************************************* ********************************************************************/ -BOOL new_spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, "new_spoolss_io_r_enumforms"); + prs_debug(ps, depth, desc, "spoolss_io_r_enumforms"); depth++; if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -3934,7 +3934,7 @@ BOOL spoolss_io_q_getform(char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps, int if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -3948,15 +3948,15 @@ BOOL spoolss_io_q_getform(char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps, int /******************************************************************* ********************************************************************/ -BOOL new_spoolss_io_r_getform(char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getform(char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, "new_spoolss_io_r_getform"); + prs_debug(ps, depth, desc, "spoolss_io_r_getform"); depth++; if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -3975,15 +3975,15 @@ BOOL new_spoolss_io_r_getform(char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps, Parse a SPOOL_R_ENUMPORTS structure. ********************************************************************/ -BOOL new_spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, "new_spoolss_io_r_enumports"); + prs_debug(ps, depth, desc, "spoolss_io_r_enumports"); depth++; if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -4022,7 +4022,7 @@ BOOL spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -4976,7 +4976,7 @@ BOOL spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if(!spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if(!prs_align(ps)) @@ -5000,7 +5000,7 @@ BOOL spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -5026,7 +5026,7 @@ BOOL spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -5074,7 +5074,7 @@ BOOL spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if(!spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -5097,7 +5097,7 @@ BOOL spoolss_io_r_enumprintprocdatatypes(char *desc, SPOOL_R_ENUMPRINTPROCDATATY if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -5145,7 +5145,7 @@ BOOL spoolss_io_q_enumprintprocdatatypes(char *desc, SPOOL_Q_ENUMPRINTPROCDATATY if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!new_spoolss_io_buffer("buffer", ps, depth, &q_u->buffer)) + if(!spoolss_io_buffer("buffer", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -5180,7 +5180,7 @@ BOOL spoolss_io_q_enumprintmonitors(char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if(!spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -5203,7 +5203,7 @@ BOOL spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -5582,7 +5582,7 @@ BOOL spoolss_io_r_getjob(char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int de if (!prs_align(ps)) return False; - if (!new_spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -5616,7 +5616,7 @@ BOOL spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int de if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!new_spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if(!spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; if(!prs_align(ps)) -- cgit From 738a83a14f1eba8fceeec41ab81c7e9da944ccda Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 28 Mar 2001 16:08:00 +0000 Subject: rename of 16 new_smb_io functions to smb_io_* for consistency sake (merge from 2.2) (This used to be commit ea963a648b889da9e47661c61c7fafe13b277e75) --- source3/rpc_parse/parse_spoolss.c | 232 +++++++++++++++++++------------------- 1 file changed, 116 insertions(+), 116 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 53fd586f85..11ccfa447f 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1638,7 +1638,7 @@ static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int d * ********************************************************************/ -static BOOL new_smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *string) +static BOOL smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *string) { prs_struct *ps=&buffer->prs; @@ -1691,7 +1691,7 @@ static BOOL new_smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR * used by 2 RPC structs ********************************************************************/ -static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16 **string) +static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16 **string) { UNISTR chaine; @@ -1814,11 +1814,11 @@ static BOOL new_smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, ui Parse a DEVMODE structure and its relative pointer. ********************************************************************/ -static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, SEC_DESC **secdesc) +static BOOL smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, SEC_DESC **secdesc) { prs_struct *ps= &buffer->prs; - prs_debug(ps, depth, desc, "new_smb_io_relsecdesc"); + prs_debug(ps, depth, desc, "smb_io_relsecdesc"); depth++; if (MARSHALLING(ps)) { @@ -1875,11 +1875,11 @@ static BOOL new_smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, SEC Parse a DEVMODE structure and its relative pointer. ********************************************************************/ -static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEVICEMODE **devmode) +static BOOL smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEVICEMODE **devmode) { prs_struct *ps=&buffer->prs; - prs_debug(ps, depth, desc, "new_smb_io_reldevmode"); + prs_debug(ps, depth, desc, "smb_io_reldevmode"); depth++; if (MARSHALLING(ps)) { @@ -1939,7 +1939,7 @@ static BOOL new_smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEV Parse a PRINTER_INFO_0 structure. ********************************************************************/ -BOOL new_smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *info, int depth) +BOOL smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -1948,9 +1948,9 @@ BOOL new_smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *i buffer->struct_start=prs_offset(ps); - if (!new_smb_io_relstr("printername", buffer, depth, &info->printername)) + if (!smb_io_relstr("printername", buffer, depth, &info->printername)) return False; - if (!new_smb_io_relstr("servername", buffer, depth, &info->servername)) + if (!smb_io_relstr("servername", buffer, depth, &info->servername)) return False; if(!prs_uint32("cjobs", ps, depth, &info->cjobs)) @@ -2040,22 +2040,22 @@ BOOL new_smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *i Parse a PRINTER_INFO_1 structure. ********************************************************************/ -BOOL new_smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info, int depth) +BOOL smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; - prs_debug(ps, depth, desc, "new_smb_io_printer_info_1"); + prs_debug(ps, depth, desc, "smb_io_printer_info_1"); depth++; buffer->struct_start=prs_offset(ps); if (!prs_uint32("flags", ps, depth, &info->flags)) return False; - if (!new_smb_io_relstr("description", buffer, depth, &info->description)) + if (!smb_io_relstr("description", buffer, depth, &info->description)) return False; - if (!new_smb_io_relstr("name", buffer, depth, &info->name)) + if (!smb_io_relstr("name", buffer, depth, &info->name)) return False; - if (!new_smb_io_relstr("comment", buffer, depth, &info->comment)) + if (!smb_io_relstr("comment", buffer, depth, &info->comment)) return False; return True; @@ -2065,44 +2065,44 @@ BOOL new_smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *i Parse a PRINTER_INFO_2 structure. ********************************************************************/ -BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) +BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; - prs_debug(ps, depth, desc, "new_smb_io_printer_info_2"); + prs_debug(ps, depth, desc, "smb_io_printer_info_2"); depth++; buffer->struct_start=prs_offset(ps); - if (!new_smb_io_relstr("servername", buffer, depth, &info->servername)) + if (!smb_io_relstr("servername", buffer, depth, &info->servername)) return False; - if (!new_smb_io_relstr("printername", buffer, depth, &info->printername)) + if (!smb_io_relstr("printername", buffer, depth, &info->printername)) return False; - if (!new_smb_io_relstr("sharename", buffer, depth, &info->sharename)) + if (!smb_io_relstr("sharename", buffer, depth, &info->sharename)) return False; - if (!new_smb_io_relstr("portname", buffer, depth, &info->portname)) + if (!smb_io_relstr("portname", buffer, depth, &info->portname)) return False; - if (!new_smb_io_relstr("drivername", buffer, depth, &info->drivername)) + if (!smb_io_relstr("drivername", buffer, depth, &info->drivername)) return False; - if (!new_smb_io_relstr("comment", buffer, depth, &info->comment)) + if (!smb_io_relstr("comment", buffer, depth, &info->comment)) return False; - if (!new_smb_io_relstr("location", buffer, depth, &info->location)) + if (!smb_io_relstr("location", buffer, depth, &info->location)) return False; /* NT parses the DEVMODE at the end of the struct */ - if (!new_smb_io_reldevmode("devmode", buffer, depth, &info->devmode)) + if (!smb_io_reldevmode("devmode", buffer, depth, &info->devmode)) return False; - if (!new_smb_io_relstr("sepfile", buffer, depth, &info->sepfile)) + if (!smb_io_relstr("sepfile", buffer, depth, &info->sepfile)) return False; - if (!new_smb_io_relstr("printprocessor", buffer, depth, &info->printprocessor)) + if (!smb_io_relstr("printprocessor", buffer, depth, &info->printprocessor)) return False; - if (!new_smb_io_relstr("datatype", buffer, depth, &info->datatype)) + if (!smb_io_relstr("datatype", buffer, depth, &info->datatype)) return False; - if (!new_smb_io_relstr("parameters", buffer, depth, &info->parameters)) + if (!smb_io_relstr("parameters", buffer, depth, &info->parameters)) return False; - if (!new_smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc)) + if (!smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc)) return False; if (!prs_uint32("attributes", ps, depth, &info->attributes)) @@ -2136,11 +2136,11 @@ BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *i Parse a PRINTER_INFO_3 structure. ********************************************************************/ -BOOL new_smb_io_printer_info_3(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *info, int depth) +BOOL smb_io_printer_info_3(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *info, int depth) { prs_struct *ps=&buffer->prs; - prs_debug(ps, depth, desc, "new_smb_io_printer_info_3"); + prs_debug(ps, depth, desc, "smb_io_printer_info_3"); depth++; buffer->struct_start=prs_offset(ps); @@ -2157,16 +2157,16 @@ BOOL new_smb_io_printer_info_3(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *i Parse a PORT_INFO_1 structure. ********************************************************************/ -BOOL new_smb_io_port_info_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) +BOOL smb_io_port_info_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; - prs_debug(ps, depth, desc, "new_smb_io_port_info_1"); + prs_debug(ps, depth, desc, "smb_io_port_info_1"); depth++; buffer->struct_start=prs_offset(ps); - if (!new_smb_io_relstr("port_name", buffer, depth, &info->port_name)) + if (!smb_io_relstr("port_name", buffer, depth, &info->port_name)) return False; return True; @@ -2176,20 +2176,20 @@ BOOL new_smb_io_port_info_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, i Parse a PORT_INFO_2 structure. ********************************************************************/ -BOOL new_smb_io_port_info_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) +BOOL smb_io_port_info_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; - prs_debug(ps, depth, desc, "new_smb_io_port_info_2"); + prs_debug(ps, depth, desc, "smb_io_port_info_2"); depth++; buffer->struct_start=prs_offset(ps); - if (!new_smb_io_relstr("port_name", buffer, depth, &info->port_name)) + if (!smb_io_relstr("port_name", buffer, depth, &info->port_name)) return False; - if (!new_smb_io_relstr("monitor_name", buffer, depth, &info->monitor_name)) + if (!smb_io_relstr("monitor_name", buffer, depth, &info->monitor_name)) return False; - if (!new_smb_io_relstr("description", buffer, depth, &info->description)) + if (!smb_io_relstr("description", buffer, depth, &info->description)) return False; if (!prs_uint32("port_type", ps, depth, &info->port_type)) return False; @@ -2203,16 +2203,16 @@ BOOL new_smb_io_port_info_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, i Parse a DRIVER_INFO_1 structure. ********************************************************************/ -BOOL new_smb_io_printer_driver_info_1(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_1 *info, int depth) +BOOL smb_io_printer_driver_info_1(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; - prs_debug(ps, depth, desc, "new_smb_io_printer_driver_info_1"); + prs_debug(ps, depth, desc, "smb_io_printer_driver_info_1"); depth++; buffer->struct_start=prs_offset(ps); - if (!new_smb_io_relstr("name", buffer, depth, &info->name)) + if (!smb_io_relstr("name", buffer, depth, &info->name)) return False; return True; @@ -2222,26 +2222,26 @@ BOOL new_smb_io_printer_driver_info_1(char *desc, NEW_BUFFER *buffer, DRIVER_INF Parse a DRIVER_INFO_2 structure. ********************************************************************/ -BOOL new_smb_io_printer_driver_info_2(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) +BOOL smb_io_printer_driver_info_2(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; - prs_debug(ps, depth, desc, "new_smb_io_printer_driver_info_2"); + prs_debug(ps, depth, desc, "smb_io_printer_driver_info_2"); depth++; buffer->struct_start=prs_offset(ps); if (!prs_uint32("version", ps, depth, &info->version)) return False; - if (!new_smb_io_relstr("name", buffer, depth, &info->name)) + if (!smb_io_relstr("name", buffer, depth, &info->name)) return False; - if (!new_smb_io_relstr("architecture", buffer, depth, &info->architecture)) + if (!smb_io_relstr("architecture", buffer, depth, &info->architecture)) return False; - if (!new_smb_io_relstr("driverpath", buffer, depth, &info->driverpath)) + if (!smb_io_relstr("driverpath", buffer, depth, &info->driverpath)) return False; - if (!new_smb_io_relstr("datafile", buffer, depth, &info->datafile)) + if (!smb_io_relstr("datafile", buffer, depth, &info->datafile)) return False; - if (!new_smb_io_relstr("configfile", buffer, depth, &info->configfile)) + if (!smb_io_relstr("configfile", buffer, depth, &info->configfile)) return False; return True; @@ -2251,36 +2251,36 @@ BOOL new_smb_io_printer_driver_info_2(char *desc, NEW_BUFFER *buffer, DRIVER_INF Parse a DRIVER_INFO_3 structure. ********************************************************************/ -BOOL new_smb_io_printer_driver_info_3(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_3 *info, int depth) +BOOL smb_io_printer_driver_info_3(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_3 *info, int depth) { prs_struct *ps=&buffer->prs; - prs_debug(ps, depth, desc, "new_smb_io_printer_driver_info_3"); + prs_debug(ps, depth, desc, "smb_io_printer_driver_info_3"); depth++; buffer->struct_start=prs_offset(ps); if (!prs_uint32("version", ps, depth, &info->version)) return False; - if (!new_smb_io_relstr("name", buffer, depth, &info->name)) + if (!smb_io_relstr("name", buffer, depth, &info->name)) return False; - if (!new_smb_io_relstr("architecture", buffer, depth, &info->architecture)) + if (!smb_io_relstr("architecture", buffer, depth, &info->architecture)) return False; - if (!new_smb_io_relstr("driverpath", buffer, depth, &info->driverpath)) + if (!smb_io_relstr("driverpath", buffer, depth, &info->driverpath)) return False; - if (!new_smb_io_relstr("datafile", buffer, depth, &info->datafile)) + if (!smb_io_relstr("datafile", buffer, depth, &info->datafile)) return False; - if (!new_smb_io_relstr("configfile", buffer, depth, &info->configfile)) + if (!smb_io_relstr("configfile", buffer, depth, &info->configfile)) return False; - if (!new_smb_io_relstr("helpfile", buffer, depth, &info->helpfile)) + if (!smb_io_relstr("helpfile", buffer, depth, &info->helpfile)) return False; - if (!new_smb_io_relarraystr("dependentfiles", buffer, depth, &info->dependentfiles)) + if (!smb_io_relarraystr("dependentfiles", buffer, depth, &info->dependentfiles)) return False; - if (!new_smb_io_relstr("monitorname", buffer, depth, &info->monitorname)) + if (!smb_io_relstr("monitorname", buffer, depth, &info->monitorname)) return False; - if (!new_smb_io_relstr("defaultdatatype", buffer, depth, &info->defaultdatatype)) + if (!smb_io_relstr("defaultdatatype", buffer, depth, &info->defaultdatatype)) return False; return True; @@ -2290,39 +2290,39 @@ BOOL new_smb_io_printer_driver_info_3(char *desc, NEW_BUFFER *buffer, DRIVER_INF Parse a DRIVER_INFO_6 structure. ********************************************************************/ -BOOL new_smb_io_printer_driver_info_6(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_6 *info, int depth) +BOOL smb_io_printer_driver_info_6(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_6 *info, int depth) { prs_struct *ps=&buffer->prs; - prs_debug(ps, depth, desc, "new_smb_io_printer_driver_info_6"); + prs_debug(ps, depth, desc, "smb_io_printer_driver_info_6"); depth++; buffer->struct_start=prs_offset(ps); if (!prs_uint32("version", ps, depth, &info->version)) return False; - if (!new_smb_io_relstr("name", buffer, depth, &info->name)) + if (!smb_io_relstr("name", buffer, depth, &info->name)) return False; - if (!new_smb_io_relstr("architecture", buffer, depth, &info->architecture)) + if (!smb_io_relstr("architecture", buffer, depth, &info->architecture)) return False; - if (!new_smb_io_relstr("driverpath", buffer, depth, &info->driverpath)) + if (!smb_io_relstr("driverpath", buffer, depth, &info->driverpath)) return False; - if (!new_smb_io_relstr("datafile", buffer, depth, &info->datafile)) + if (!smb_io_relstr("datafile", buffer, depth, &info->datafile)) return False; - if (!new_smb_io_relstr("configfile", buffer, depth, &info->configfile)) + if (!smb_io_relstr("configfile", buffer, depth, &info->configfile)) return False; - if (!new_smb_io_relstr("helpfile", buffer, depth, &info->helpfile)) + if (!smb_io_relstr("helpfile", buffer, depth, &info->helpfile)) return False; - if (!new_smb_io_relarraystr("dependentfiles", buffer, depth, &info->dependentfiles)) + if (!smb_io_relarraystr("dependentfiles", buffer, depth, &info->dependentfiles)) return False; - if (!new_smb_io_relstr("monitorname", buffer, depth, &info->monitorname)) + if (!smb_io_relstr("monitorname", buffer, depth, &info->monitorname)) return False; - if (!new_smb_io_relstr("defaultdatatype", buffer, depth, &info->defaultdatatype)) + if (!smb_io_relstr("defaultdatatype", buffer, depth, &info->defaultdatatype)) return False; - if (!new_smb_io_relarraystr("previousdrivernames", buffer, depth, &info->previousdrivernames)) + if (!smb_io_relarraystr("previousdrivernames", buffer, depth, &info->previousdrivernames)) return False; if (!prs_uint32("date.low", ps, depth, &info->driver_date.low)) @@ -2339,13 +2339,13 @@ BOOL new_smb_io_printer_driver_info_6(char *desc, NEW_BUFFER *buffer, DRIVER_INF if (!prs_uint32("driver_version_high", ps, depth, &info->driver_version_high)) return False; - if (!new_smb_io_relstr("mfgname", buffer, depth, &info->mfgname)) + if (!smb_io_relstr("mfgname", buffer, depth, &info->mfgname)) return False; - if (!new_smb_io_relstr("oem_url", buffer, depth, &info->oem_url)) + if (!smb_io_relstr("oem_url", buffer, depth, &info->oem_url)) return False; - if (!new_smb_io_relstr("hardware_id", buffer, depth, &info->hardware_id)) + if (!smb_io_relstr("hardware_id", buffer, depth, &info->hardware_id)) return False; - if (!new_smb_io_relstr("provider", buffer, depth, &info->provider)) + if (!smb_io_relstr("provider", buffer, depth, &info->provider)) return False; return True; @@ -2355,28 +2355,28 @@ BOOL new_smb_io_printer_driver_info_6(char *desc, NEW_BUFFER *buffer, DRIVER_INF Parse a JOB_INFO_1 structure. ********************************************************************/ -BOOL new_smb_io_job_info_1(char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int depth) +BOOL smb_io_job_info_1(char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; - prs_debug(ps, depth, desc, "new_smb_io_job_info_1"); + prs_debug(ps, depth, desc, "smb_io_job_info_1"); depth++; buffer->struct_start=prs_offset(ps); if (!prs_uint32("jobid", ps, depth, &info->jobid)) return False; - if (!new_smb_io_relstr("printername", buffer, depth, &info->printername)) + if (!smb_io_relstr("printername", buffer, depth, &info->printername)) return False; - if (!new_smb_io_relstr("machinename", buffer, depth, &info->machinename)) + if (!smb_io_relstr("machinename", buffer, depth, &info->machinename)) return False; - if (!new_smb_io_relstr("username", buffer, depth, &info->username)) + if (!smb_io_relstr("username", buffer, depth, &info->username)) return False; - if (!new_smb_io_relstr("document", buffer, depth, &info->document)) + if (!smb_io_relstr("document", buffer, depth, &info->document)) return False; - if (!new_smb_io_relstr("datatype", buffer, depth, &info->datatype)) + if (!smb_io_relstr("datatype", buffer, depth, &info->datatype)) return False; - if (!new_smb_io_relstr("text_status", buffer, depth, &info->text_status)) + if (!smb_io_relstr("text_status", buffer, depth, &info->text_status)) return False; if (!prs_uint32("status", ps, depth, &info->status)) return False; @@ -2398,40 +2398,40 @@ BOOL new_smb_io_job_info_1(char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int Parse a JOB_INFO_2 structure. ********************************************************************/ -BOOL new_smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int depth) +BOOL smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int depth) { uint pipo=0; prs_struct *ps=&buffer->prs; - prs_debug(ps, depth, desc, "new_smb_io_job_info_2"); + prs_debug(ps, depth, desc, "smb_io_job_info_2"); depth++; buffer->struct_start=prs_offset(ps); if (!prs_uint32("jobid",ps, depth, &info->jobid)) return False; - if (!new_smb_io_relstr("printername", buffer, depth, &info->printername)) + if (!smb_io_relstr("printername", buffer, depth, &info->printername)) return False; - if (!new_smb_io_relstr("machinename", buffer, depth, &info->machinename)) + if (!smb_io_relstr("machinename", buffer, depth, &info->machinename)) return False; - if (!new_smb_io_relstr("username", buffer, depth, &info->username)) + if (!smb_io_relstr("username", buffer, depth, &info->username)) return False; - if (!new_smb_io_relstr("document", buffer, depth, &info->document)) + if (!smb_io_relstr("document", buffer, depth, &info->document)) return False; - if (!new_smb_io_relstr("notifyname", buffer, depth, &info->notifyname)) + if (!smb_io_relstr("notifyname", buffer, depth, &info->notifyname)) return False; - if (!new_smb_io_relstr("datatype", buffer, depth, &info->datatype)) + if (!smb_io_relstr("datatype", buffer, depth, &info->datatype)) return False; - if (!new_smb_io_relstr("printprocessor", buffer, depth, &info->printprocessor)) + if (!smb_io_relstr("printprocessor", buffer, depth, &info->printprocessor)) return False; - if (!new_smb_io_relstr("parameters", buffer, depth, &info->parameters)) + if (!smb_io_relstr("parameters", buffer, depth, &info->parameters)) return False; - if (!new_smb_io_relstr("drivername", buffer, depth, &info->drivername)) + if (!smb_io_relstr("drivername", buffer, depth, &info->drivername)) return False; - if (!new_smb_io_reldevmode("devmode", buffer, depth, &info->devmode)) + if (!smb_io_reldevmode("devmode", buffer, depth, &info->devmode)) return False; - if (!new_smb_io_relstr("text_status", buffer, depth, &info->text_status)) + if (!smb_io_relstr("text_status", buffer, depth, &info->text_status)) return False; /* SEC_DESC sec_desc;*/ @@ -2465,11 +2465,11 @@ BOOL new_smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int /******************************************************************* ********************************************************************/ -BOOL new_smb_io_form_1(char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth) +BOOL smb_io_form_1(char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth) { prs_struct *ps=&buffer->prs; - prs_debug(ps, depth, desc, "new_smb_io_form_1"); + prs_debug(ps, depth, desc, "smb_io_form_1"); depth++; buffer->struct_start=prs_offset(ps); @@ -2477,7 +2477,7 @@ BOOL new_smb_io_form_1(char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth) if (!prs_uint32("flag", ps, depth, &info->flag)) return False; - if (!new_smb_io_relstr("name", buffer, depth, &info->name)) + if (!smb_io_relstr("name", buffer, depth, &info->name)) return False; if (!prs_uint32("width", ps, depth, &info->width)) @@ -2611,11 +2611,11 @@ uint32 new_get_buffer_size(NEW_BUFFER *buffer) Parse a DRIVER_DIRECTORY_1 structure. ********************************************************************/ -BOOL new_smb_io_driverdir_1(char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 *info, int depth) +BOOL smb_io_driverdir_1(char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 *info, int depth) { prs_struct *ps=&buffer->prs; - prs_debug(ps, depth, desc, "new_smb_io_driverdir_1"); + prs_debug(ps, depth, desc, "smb_io_driverdir_1"); depth++; buffer->struct_start=prs_offset(ps); @@ -2630,16 +2630,16 @@ BOOL new_smb_io_driverdir_1(char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 * Parse a PORT_INFO_1 structure. ********************************************************************/ -BOOL new_smb_io_port_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) +BOOL smb_io_port_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; - prs_debug(ps, depth, desc, "new_smb_io_port_1"); + prs_debug(ps, depth, desc, "smb_io_port_1"); depth++; buffer->struct_start=prs_offset(ps); - if(!new_smb_io_relstr("port_name", buffer, depth, &info->port_name)) + if(!smb_io_relstr("port_name", buffer, depth, &info->port_name)) return False; return True; @@ -2649,20 +2649,20 @@ BOOL new_smb_io_port_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int de Parse a PORT_INFO_2 structure. ********************************************************************/ -BOOL new_smb_io_port_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) +BOOL smb_io_port_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; - prs_debug(ps, depth, desc, "new_smb_io_port_2"); + prs_debug(ps, depth, desc, "smb_io_port_2"); depth++; buffer->struct_start=prs_offset(ps); - if(!new_smb_io_relstr("port_name", buffer, depth, &info->port_name)) + if(!smb_io_relstr("port_name", buffer, depth, &info->port_name)) return False; - if(!new_smb_io_relstr("monitor_name", buffer, depth, &info->monitor_name)) + if(!smb_io_relstr("monitor_name", buffer, depth, &info->monitor_name)) return False; - if(!new_smb_io_relstr("description", buffer, depth, &info->description)) + if(!smb_io_relstr("description", buffer, depth, &info->description)) return False; if(!prs_uint32("port_type", ps, depth, &info->port_type)) return False; @@ -2684,7 +2684,7 @@ BOOL smb_io_printprocessor_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR buffer->struct_start=prs_offset(ps); - if (new_smb_io_relstr("name", buffer, depth, &info->name)) + if (smb_io_relstr("name", buffer, depth, &info->name)) return False; return True; @@ -2702,7 +2702,7 @@ BOOL smb_io_printprocdatatype_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCDA buffer->struct_start=prs_offset(ps); - if (new_smb_io_relstr("name", buffer, depth, &info->name)) + if (smb_io_relstr("name", buffer, depth, &info->name)) return False; return True; @@ -2720,7 +2720,7 @@ BOOL smb_io_printmonitor_info_1(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_1 * buffer->struct_start=prs_offset(ps); - if (!new_smb_io_relstr("name", buffer, depth, &info->name)) + if (!smb_io_relstr("name", buffer, depth, &info->name)) return False; return True; @@ -2738,11 +2738,11 @@ BOOL smb_io_printmonitor_info_2(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_2 * buffer->struct_start=prs_offset(ps); - if (!new_smb_io_relstr("name", buffer, depth, &info->name)) + if (!smb_io_relstr("name", buffer, depth, &info->name)) return False; - if (!new_smb_io_relstr("environment", buffer, depth, &info->environment)) + if (!smb_io_relstr("environment", buffer, depth, &info->environment)) return False; - if (!new_smb_io_relstr("dll_name", buffer, depth, &info->dll_name)) + if (!smb_io_relstr("dll_name", buffer, depth, &info->dll_name)) return False; return True; -- cgit From 92368833faf51fd56e95a2d646eaae1d697f8e81 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 31 Mar 2001 19:06:45 +0000 Subject: configure configure.in include/config.h.in lib/replace.c: Added test and replacement for setlinebuf which apparantly doesn't exist on HPUX 11. include/byteorder.h: rpc_parse/parse_prs.c: Ding Dong the witch is dead ! :-). Ok, I'm happy 'cos I've finally deleted all the *HORRIBLE* DBG_RW_XXX and RW_XXX macros from include/byteorder.h. They were macros that included macros that had conditional macros included. No one understood them (they were the cause of most of the bigendian issue bugs). Finally, I went into parse_prs.c and inlined all of that stuff with regular function calls. They're understandable, they're easy to edit and they don't include macros ! JF - please look at the one comment I added (JF PLEASE CHECK). I have tested this partly with IRIX (a bigendian system) running with AS/U on a Solaris box in SGI's lab, and I've also confirmed these new changes work with W2K (vmware) but there may be the odd bug lurking. Herb, if you could re-checkout and test again with this code that would help. Extra. Fixed bug spotted by the sharp eyes of JF - big endian unicode packet would cause a early truncate of string parsing as we were checking for a char * 0, not a uint16 * 0. Jeremy. (This used to be commit 13765eca71e54aa5d048ce36cd8066b8406777c8) --- source3/rpc_parse/parse_prs.c | 302 ++++++++++++++++++++++++++++++------------ 1 file changed, 218 insertions(+), 84 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 84ccbd5db6..8311528874 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -477,12 +477,18 @@ void prs_force_dynamic(prs_struct *ps) BOOL prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8) { - char *q = prs_mem_get(ps, sizeof(uint8)); + char *q = prs_mem_get(ps, 1); if (q == NULL) return False; - DBG_RW_CVAL(name, depth, ps->data_offset, ps->io, q, *data8) - ps->data_offset += sizeof(uint8); + if (UNMARSHALLING(ps)) + *data8 = CVAL(q,0); + else + SCVAL(q,0,*data8); + + DEBUG(5,("%s%04x %s: %02x\n", tab_depth(depth), ps->data_offset, name, *data8)); + + ps->data_offset += 1; return True; } @@ -497,7 +503,20 @@ BOOL prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16) if (q == NULL) return False; - DBG_RW_SVAL(name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, *data16) + if (UNMARSHALLING(ps)) { + if (ps->bigendian_data) + *data16 = RSVAL(q,0); + else + *data16 = SVAL(q,0); + } else { + if (ps->bigendian_data) + RSSVAL(q,0,*data16); + else + SSVAL(q,0,*data16); + } + + DEBUG(5,("%s%04x %s: %04x\n", tab_depth(depth), ps->data_offset, name, *data16)); + ps->data_offset += sizeof(uint16); return True; @@ -513,7 +532,20 @@ BOOL prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) if (q == NULL) return False; - DBG_RW_IVAL(name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, *data32) + if (UNMARSHALLING(ps)) { + if (ps->bigendian_data) + *data32 = RIVAL(q,0); + else + *data32 = IVAL(q,0); + } else { + if (ps->bigendian_data) + RSIVAL(q,0,*data32); + else + SIVAL(q,0,*data32); + } + + DEBUG(5,("%s%04x %s: %08x\n", tab_depth(depth), ps->data_offset, name, *data32)); + ps->data_offset += sizeof(uint32); return True; @@ -525,12 +557,29 @@ BOOL prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *data8s, int len) { - char *q = prs_mem_get(ps, len * sizeof(uint8)); + int i; + char *q = prs_mem_get(ps, len); if (q == NULL) return False; - DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, ps->io, q, data8s, len) - ps->data_offset += (len * sizeof(uint8)); + if (UNMARSHALLING(ps)) { + for (i = 0; i < len; i++) + data8s[i] = CVAL(q,i); + } else { + for (i = 0; i < len; i++) + SCVAL(q, i, data8s[i]); + } + + DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset ,name)); + if (charmode) + print_asc(5, (unsigned char*)data8s, len); + else { + for (i = 0; i < len; i++) + DEBUG(5,("%02x ", data8s[i])); + } + DEBUG(5,("\n")); + + ps->data_offset += len; return True; } @@ -541,11 +590,92 @@ BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *dat BOOL prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len) { + int i; char *q = prs_mem_get(ps, len * sizeof(uint16)); if (q == NULL) return False; - DBG_RW_PSVAL(charmode, name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, data16s, len) + if (UNMARSHALLING(ps)) { + if (ps->bigendian_data) { + for (i = 0; i < len; i++) + data16s[i] = RSVAL(q, 2*i); + } else { + for (i = 0; i < len; i++) + data16s[i] = SVAL(q, 2*i); + } + } else { + if (ps->bigendian_data) { + for (i = 0; i < len; i++) + RSSVAL(q, 2*i, data16s[i]); + } else { + for (i = 0; i < len; i++) + SSVAL(q, 2*i, data16s[i]); + } + } + + DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + if (charmode) + print_asc(5, (unsigned char*)data16s, 2*len); + else { + for (i = 0; i < len; i++) + DEBUG(5,("%04x ", data16s[i])); + } + DEBUG(5,("\n")); + + ps->data_offset += (len * sizeof(uint16)); + + return True; +} + +/****************************************************************** + Start using a function for streaming unicode chars. If unmarshalling, + output must be little-endian, if marshalling, input must be little-endian. + ********************************************************************/ + +static void dbg_rw_punival(BOOL charmode, char *name, int depth, prs_struct *ps, + char *in_buf, char *out_buf, int len) +{ + int i; + + if (UNMARSHALLING(ps)) { + if (ps->bigendian_data) { + for (i = 0; i < len; i++) + SSVAL(out_buf,2*i,RSVAL(in_buf, 2*i)); + } else { + for (i = 0; i < len; i++) + SSVAL(out_buf, 2*i, SVAL(in_buf, 2*i)); + } + } else { + if (ps->bigendian_data) { + for (i = 0; i < len; i++) + RSSVAL(in_buf, 2*i, SVAL(out_buf,2*i)); + } else { + for (i = 0; i < len; i++) + SSVAL(in_buf, 2*i, SVAL(out_buf,2*i)); + } + } + + DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + if (charmode) + print_asc(5, (unsigned char*)out_buf, 2*len); + else { + for (i = 0; i < len; i++) + DEBUG(5,("%04x ", out_buf[i])); + } + DEBUG(5,("\n")); +} + +/****************************************************************** + Stream a unistr. Always little endian. + ********************************************************************/ + +BOOL prs_uint16uni(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len) +{ + char *q = prs_mem_get(ps, len * sizeof(uint16)); + if (q == NULL) + return False; + + dbg_rw_punival(charmode, name, depth, ps, q, (char *)data16s, len); ps->data_offset += (len * sizeof(uint16)); return True; @@ -557,11 +687,38 @@ BOOL prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *d BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *data32s, int len) { + int i; char *q = prs_mem_get(ps, len * sizeof(uint32)); if (q == NULL) return False; - DBG_RW_PIVAL(charmode, name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, data32s, len) + if (UNMARSHALLING(ps)) { + if (ps->bigendian_data) { + for (i = 0; i < len; i++) + data32s[i] = RIVAL(q, 4*i); + } else { + for (i = 0; i < len; i++) + data32s[i] = IVAL(q, 4*i); + } + } else { + if (ps->bigendian_data) { + for (i = 0; i < len; i++) + RSIVAL(q, 4*i, data32s[i]); + } else { + for (i = 0; i < len; i++) + SIVAL(q, 4*i, data32s[i]); + } + } + + DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + if (charmode) + print_asc(5, (unsigned char*)data32s, 4*len); + else { + for (i = 0; i < len; i++) + DEBUG(5,("%08x ", data32s[i])); + } + DEBUG(5,("\n")); + ps->data_offset += (len * sizeof(uint32)); return True; @@ -569,8 +726,7 @@ BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *d /****************************************************************** Stream an array of unicode string, length/buffer specified separately, - in uint16 chars. We use DBG_RW_PCVAL, not DBG_RW_PSVAL here - as the unicode string is already in little-endian format. + in uint16 chars. The unicode string is already in little-endian format. ********************************************************************/ BOOL prs_buffer5(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER5 *str) @@ -592,15 +748,7 @@ BOOL prs_buffer5(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER5 * p = (char *)str->buffer; - /* If we're using big-endian, reverse to get little-endian. */ - if(ps->bigendian_data) { - DBG_RW_PSVAL(charmode, name, depth, ps->data_offset, - ps->io, ps->bigendian_data, q, p, - str->buf_len) - } else { - DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, - ps->io, q, p, str->buf_len * sizeof(uint16)) - } + dbg_rw_punival(charmode, name, depth, ps, q, p, str->buf_len); ps->data_offset += (str->buf_len * sizeof(uint16)); @@ -627,11 +775,7 @@ BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 * p = (char *)str->buffer; - /* If we're using big-endian, reverse to get little-endian. */ - if(ps->bigendian_data) - DBG_RW_PSVAL(charmode, name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, p, str->buf_len/2) - else - DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, ps->io, q, p, str->buf_len) + dbg_rw_punival(charmode, name, depth, ps, q, p, str->buf_len/2); ps->data_offset += str->buf_len; return True; @@ -644,7 +788,8 @@ BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 * BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 *str) { - char *q = prs_mem_get(ps, str->str_str_len * sizeof(uint8)); + int i; + char *q = prs_mem_get(ps, str->str_str_len); if (q == NULL) return False; @@ -654,16 +799,31 @@ BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 * return False; } - DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, ps->io, q, str->buffer, str->str_max_len) - ps->data_offset += (str->str_str_len * sizeof(uint8)); + if (UNMARSHALLING(ps)) { + for (i = 0; i < str->str_str_len; i++) + str->buffer[i] = CVAL(q,i); + } else { + for (i = 0; i < str->str_str_len; i++) + SCVAL(q, i, str->buffer[i]); + } + + DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + if (charmode) + print_asc(5, (unsigned char*)str->buffer, str->str_str_len); + else { + for (i = 0; i < str->str_str_len; i++) + DEBUG(5,("%02x ", str->buffer[i])); + } + DEBUG(5,("\n")); + + ps->data_offset += str->str_str_len; return True; } /****************************************************************** Stream a unicode string, length/buffer specified separately, - in uint16 chars. We use DBG_RW_PCVAL, not DBG_RW_PSVAL here - as the unicode string is already in little-endian format. + in uint16 chars. The unicode string is already in little-endian format. ********************************************************************/ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *str) @@ -685,27 +845,16 @@ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 * p = (char *)str->buffer; - /* If we're using big-endian, reverse to get little-endian. */ - if(ps->bigendian_data) { - DBG_RW_PSVAL(charmode, name, depth, ps->data_offset, - ps->io, ps->bigendian_data, q, p, - str->uni_str_len) - } else { - DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, - ps->io, q, p, str->uni_str_len * sizeof(uint16)) - } + dbg_rw_punival(charmode, name, depth, ps, q, p, str->uni_str_len); ps->data_offset += (str->uni_str_len * sizeof(uint16)); return True; } - - /****************************************************************** Stream a unicode string, length/buffer specified separately, - in uint16 chars. We use DBG_RW_PCVAL, not DBG_RW_PSVAL here - as the unicode string is already in little-endian format. + in uint16 chars. The unicode string is already in little-endian format. ********************************************************************/ BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int depth) @@ -723,11 +872,7 @@ BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int de p = (char *)str->str.buffer; - /* If we're using big-endian, reverse to get little-endian. */ - if(ps->bigendian_data) - DBG_RW_PSVAL(charmode, name, depth, ps->data_offset, ps->io, ps->bigendian_data, q, p, str->uni_str_len) - else - DBG_RW_PCVAL(charmode, name, depth, ps->data_offset, ps->io, q, p, str->uni_str_len * sizeof(uint16)) + dbg_rw_punival(charmode, name, depth, ps, q, p, str->uni_str_len); ps->data_offset += (str->uni_str_len * sizeof(uint16)); return True; @@ -744,7 +889,6 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) unsigned char *p = (unsigned char *)str->buffer; uint8 *start; char *q; - char zero=0; uint32 max_len; uint16* ptr; @@ -763,18 +907,18 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) { if(ps->bigendian_data) { - RW_SVAL(ps->io, ps->bigendian_data, q, *p, 0); + /* swap bytes - p is little endian, q is big endian. */ + q[0] = (char)p[1]; + q[1] = (char)p[0]; p += 2; q += 2; } else { - RW_CVAL(ps->io, q, *p, 0); - p++; - q++; - RW_CVAL(ps->io, q, *p, 0); - p++; - q++; + q[0] = (char)p[0]; + q[1] = (char)p[1]; + p += 2; + q += 2; } } @@ -784,10 +928,9 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) * so parse it now */ - RW_CVAL(ps->io, q, zero, 0); - q++; - RW_CVAL(ps->io, q, zero, 0); - q++; + q[0] = 0; + q[1] = 0; + q += 2; len++; @@ -820,29 +963,21 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) /* the (len < alloc_len) test is to prevent us from overwriting memory that is not ours...if we get that far, we have a non-null terminated string in the buffer and have messed up somewhere */ - while ((len < alloc_len) && (*q != '\0')) + while ((len < alloc_len) && (*(uint16 *)q != 0)) { if(ps->bigendian_data) { - RW_SVAL(ps->io, ps->bigendian_data, q, *p, 0); + /* swap bytes - q is big endian, p is little endian. */ + p[0] = (unsigned char)q[1]; + p[1] = (unsigned char)q[0]; p += 2; q += 2; } else { -#if WORDS_BIGENDIAN - RW_CVAL(ps->io, q+1, *p, 0); - p++; - RW_CVAL(ps->io, q, *p, 0); - p++; - q+=2; -#else - RW_CVAL(ps->io, q, *p, 0); - p++; - q++; - RW_CVAL(ps->io, q, *p, 0); - p++; - q++; -#endif /* WORDS_BIGENDIAN */ + p[0] = (unsigned char)q[0]; + p[1] = (unsigned char)q[1]; + p += 2; + q += 2; } len++; @@ -871,7 +1006,6 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, int len, int max_buf_size) { char *q; - uint8 *start; int i; len = MIN(len, (max_buf_size-1)); @@ -880,23 +1014,23 @@ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, int len, int m if (q == NULL) return False; - start = (uint8*)q; - for(i = 0; i < len; i++) { - RW_CVAL(ps->io, q, str[i],0); - q++; + if (UNMARSHALLING(ps)) + str[i] = q[i]; + else + q[i] = str[i]; } /* The terminating null. */ str[i] = '\0'; if (MARSHALLING(ps)) { - RW_CVAL(ps->io, q, str[i], 0); + q[i] = '\0'; } ps->data_offset += len+1; - dump_data(5+depth, (char *)start, len); + dump_data(5+depth, q, len); return True; } -- cgit From 9f793948bd34e79be1adecfe41c53cb7ec2636fa Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 2 Apr 2001 22:27:40 +0000 Subject: include/ntdomain.h: rpc_server/srv_lsa_hnd.c: Remove back pointer from policy handle list as the pipe that opened the handle may have been closed. We were dereferencing into something that had been closed. rpc_parse/parse_spoolss.c: Sync up with Gerald's changes in 2.2. lib/replace.c: Don't do proto on setlinebuf as it differs between systems. Jeremy. (This used to be commit 887ef3e12dc56b89b2284d42b16a81f03e15110b) --- source3/rpc_parse/parse_spoolss.c | 199 ++++++++++++++++++++++++++------------ 1 file changed, 136 insertions(+), 63 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 11ccfa447f..bf178b4ab8 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -407,7 +407,7 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, if(!prs_uint8s(True,"string",ps,depth, (uint8 *)&data->notify_data.data.length,x*2)) return False; } else { - if(!prs_uint8s(True,"string",ps,depth,(uint8 *)data->notify_data.data.string,x*2)) + if(!prs_uint16uni(True,"string",ps,depth,data->notify_data.data.string,x)) return False; } } else { @@ -418,7 +418,7 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, if (!data->notify_data.data.string) return False; - if(!prs_uint16s(True,"string",ps,depth,data->notify_data.data.string,x)) + if(!prs_uint16uni(True,"string",ps,depth,data->notify_data.data.string,x)) return False; } } @@ -550,7 +550,7 @@ static BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE return False; } - if (!prs_uint16s(True,"devicename", ps, depth, devmode->devicename.buffer, 32)) + if (!prs_uint16uni(True,"devicename", ps, depth, devmode->devicename.buffer, 32)) return False; if (!prs_uint16("specversion", ps, depth, &devmode->specversion)) return False; @@ -595,7 +595,7 @@ static BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE return False; } - if (!prs_uint16s(True, "formname", ps, depth, devmode->formname.buffer, 32)) + if (!prs_uint16uni(True, "formname", ps, depth, devmode->formname.buffer, 32)) return False; if (!prs_uint16("logpixels", ps, depth, &devmode->logpixels)) return False; @@ -783,7 +783,7 @@ BOOL make_spoolss_q_addprinterex( { case 2: /* init q_u->info.info2 from *info */ - if (!make_spool_printer_info_2(&q_u->info.info_2, ctr->printers_2)) + if (!make_spoolss_printer_info_2(&q_u->info.info_2, ctr->printers_2)) { DEBUG(0,("make_spoolss_q_addprinterex: Unable to fill SPOOL_Q_ADDPRINTEREX struct!\n")); return False; @@ -817,7 +817,7 @@ BOOL make_spoolss_q_addprinterex( create a SPOOL_PRINTER_INFO_2 stuct from a PRINTER_INFO_2 struct *******************************************************************/ -BOOL make_spool_printer_info_2( +BOOL make_spoolss_printer_info_2( SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2, PRINTER_INFO_2 *info ) @@ -827,9 +827,9 @@ BOOL make_spool_printer_info_2( /* allocate the necessary memory */ inf = (SPOOL_PRINTER_INFO_LEVEL_2*)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2)); - if (spool_info2 == NULL) + if (!spool_info2) { - DEBUG(0,("make_spool_printer_info_2: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_2 sruct!\n")); + DEBUG(0,("make_spoolss_printer_info_2: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_2 sruct!\n")); return False; } @@ -865,7 +865,7 @@ BOOL make_spool_printer_info_2( init_unistr2_from_unistr(&inf->datatype, &info->datatype); init_unistr2_from_unistr(&inf->parameters, &info->parameters); init_unistr2_from_unistr(&inf->datatype, &info->datatype); - inf->secdesc = NULL; + inf->secdesc = inf->secdesc; *spool_info2 = inf; @@ -3419,8 +3419,13 @@ BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps * init a structure. ********************************************************************/ -BOOL make_spoolss_q_getprinter(SPOOL_Q_GETPRINTER *q_u, const POLICY_HND *hnd, uint32 level, - NEW_BUFFER *buffer, uint32 offered) +BOOL make_spoolss_q_getprinter( + SPOOL_Q_GETPRINTER *q_u, + const POLICY_HND *hnd, + uint32 level, + NEW_BUFFER *buffer, + uint32 offered +) { if (q_u == NULL) { @@ -3435,6 +3440,73 @@ BOOL make_spoolss_q_getprinter(SPOOL_Q_GETPRINTER *q_u, const POLICY_HND *hnd, u return True; } +/******************************************************************* + * init a structure. + ********************************************************************/ +BOOL make_spoolss_q_setprinter( + SPOOL_Q_SETPRINTER *q_u, + const POLICY_HND *hnd, + uint32 level, + PRINTER_INFO_CTR *info, + uint32 command +) +{ + SEC_DESC *secdesc; + DEVICEMODE *devmode; + + if (q_u == NULL) + { + return False; + } + + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + + q_u->level = level; + q_u->info.level = level; + q_u->info.info_ptr = (info != NULL) ? 1 : 0; + switch (level) + { + case 2: + secdesc = info->printers_2->secdesc; + devmode = info->printers_2->devmode; + + /* FIXMEE!! HACK ALERT!!! --jerry */ + info->printers_2->devmode = NULL; + info->printers_2->secdesc = NULL; + + make_spoolss_printer_info_2 (&q_u->info.info_2, info->printers_2); +#if 0 /* JERRY TEST */ + q_u->secdesc_ctr = (SEC_DESC_BUF*)malloc(sizeof(SEC_DESC_BUF)); + if (!q_u->secdesc_ctr) + return False; + q_u->secdesc_ctr->ptr = (secdesc != NULL) ? 1: 0; + q_u->secdesc_ctr->max_len = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0; + q_u->secdesc_ctr->len = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0; + q_u->secdesc_ctr->sec = secdesc; + + q_u->devmode_ctr.devmode_ptr = (devmode != NULL) ? 1 : 0; + q_u->devmode_ctr.size = sizeof(DEVICEMODE) + (3*sizeof(uint32)); + q_u->devmode_ctr.devmode = devmode; +#else + q_u->secdesc_ctr = NULL; + + q_u->devmode_ctr.devmode_ptr = 0; + q_u->devmode_ctr.size = 0; + q_u->devmode_ctr.devmode = NULL; +#endif + break; + default: + DEBUG(0,("make_spoolss_q_setprinter: Unknown info level [%d]\n", level)); + break; + } + + + q_u->command = command; + + return True; +} + + /******************************************************************* ********************************************************************/ @@ -4644,31 +4716,26 @@ BOOL make_spoolss_q_addprinterdriver( q_u->info.ptr = (info!=NULL)?1:0; switch (level) { - /* info level 3 is supported by Windows 95/98, - WinNT and Win2k */ - case 3 : - q_u->info.info_3=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3*) - malloc(sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); - memset (q_u->info.info_3, 0x0, sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); - make_spool_driver_info_3(q_u->info.info_3, info->info3); - break; + /* info level 3 is supported by Windows 95/98, WinNT and Win2k */ + case 3 : + make_spoolss_driver_info_3(&q_u->info.info_3, info->info3); + break; - /* info level 6 is supported by WinME and Win2k */ - case 6: - /* WRITEME!! will add later --jerry */ - break; - default: - DEBUG(0,("make_spoolss_q_addprinterdriver: Unknown \ -info level [%d]\n", level)); - break; - + /* info level 6 is supported by WinME and Win2k */ + case 6: + /* WRITEME!! will add later --jerry */ + break; + + default: + DEBUG(0,("make_spoolss_q_addprinterdriver: Unknown info level [%d]\n", level)); + break; } return True; } -BOOL make_spool_driver_info_3( - SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *spool_drv_info, +BOOL make_spoolss_driver_info_3( + SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **spool_drv_info, DRIVER_INFO_3 *info3 ) { @@ -4676,25 +4743,32 @@ BOOL make_spool_driver_info_3( uint16 *ptr = info3->dependentfiles; BOOL done = False; BOOL null_char = False; - - spool_drv_info->cversion = info3->version; - spool_drv_info->name_ptr = (info3->name.buffer!=NULL)?1:0; - spool_drv_info->environment_ptr = (info3->architecture.buffer!=NULL)?1:0; - spool_drv_info->driverpath_ptr = (info3->driverpath.buffer!=NULL)?1:0; - spool_drv_info->datafile_ptr = (info3->datafile.buffer!=NULL)?1:0; - spool_drv_info->configfile_ptr = (info3->configfile.buffer!=NULL)?1:0; - spool_drv_info->helpfile_ptr = (info3->helpfile.buffer!=NULL)?1:0; - spool_drv_info->monitorname_ptr = (info3->monitorname.buffer!=NULL)?1:0; - spool_drv_info->defaultdatatype_ptr = (info3->defaultdatatype.buffer!=NULL)?1:0; - - init_unistr2_from_unistr(&spool_drv_info->name, &info3->name); - init_unistr2_from_unistr(&spool_drv_info->environment, &info3->architecture); - init_unistr2_from_unistr(&spool_drv_info->driverpath, &info3->driverpath); - init_unistr2_from_unistr(&spool_drv_info->datafile, &info3->datafile); - init_unistr2_from_unistr(&spool_drv_info->configfile, &info3->configfile); - init_unistr2_from_unistr(&spool_drv_info->helpfile, &info3->helpfile); - init_unistr2_from_unistr(&spool_drv_info->monitorname, &info3->monitorname); - init_unistr2_from_unistr(&spool_drv_info->defaultdatatype, &info3->defaultdatatype); + SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *inf; + + inf = (SPOOL_PRINTER_DRIVER_INFO_LEVEL_3*) + malloc(sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); + if (!inf) + return False; + memset (inf, 0x0, sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); + + inf->cversion = info3->version; + inf->name_ptr = (info3->name.buffer!=NULL)?1:0; + inf->environment_ptr = (info3->architecture.buffer!=NULL)?1:0; + inf->driverpath_ptr = (info3->driverpath.buffer!=NULL)?1:0; + inf->datafile_ptr = (info3->datafile.buffer!=NULL)?1:0; + inf->configfile_ptr = (info3->configfile.buffer!=NULL)?1:0; + inf->helpfile_ptr = (info3->helpfile.buffer!=NULL)?1:0; + inf->monitorname_ptr = (info3->monitorname.buffer!=NULL)?1:0; + inf->defaultdatatype_ptr = (info3->defaultdatatype.buffer!=NULL)?1:0; + + init_unistr2_from_unistr(&inf->name, &info3->name); + init_unistr2_from_unistr(&inf->environment, &info3->architecture); + init_unistr2_from_unistr(&inf->driverpath, &info3->driverpath); + init_unistr2_from_unistr(&inf->datafile, &info3->datafile); + init_unistr2_from_unistr(&inf->configfile, &info3->configfile); + init_unistr2_from_unistr(&inf->helpfile, &info3->helpfile); + init_unistr2_from_unistr(&inf->monitorname, &info3->monitorname); + init_unistr2_from_unistr(&inf->defaultdatatype, &info3->defaultdatatype); while (!done) { @@ -4717,25 +4791,30 @@ BOOL make_spool_driver_info_3( len++; ptr++; } - spool_drv_info->dependentfiles_ptr = (info3->dependentfiles!=NULL)?1:0; - spool_drv_info->dependentfilessize = len; - if(!make_spool_buffer5(&spool_drv_info->dependentfiles, len, info3->dependentfiles)) + inf->dependentfiles_ptr = (info3->dependentfiles != NULL) ? 1 : 0; + inf->dependentfilessize = len; + if(!make_spoolss_buffer5(&inf->dependentfiles, len, info3->dependentfiles)) + { + safe_free (inf); return False; + } + + *spool_drv_info = inf; return True; -} +} /******************************************************************* make a BUFFER5 struct from a uint16* ******************************************************************/ -BOOL make_spool_buffer5(BUFFER5 *buf5, uint32 len, uint16 *src) +BOOL make_spoolss_buffer5(BUFFER5 *buf5, uint32 len, uint16 *src) { buf5->buf_len = len; if((buf5->buffer=(uint16*)malloc(sizeof(uint16)*len)) == NULL) { - DEBUG(0,("make_spool_buffer5: Unable to talloc memory for buffer!\n")); + DEBUG(0,("make_spoolss_buffer5: Unable to malloc memory for buffer!\n")); return False; } @@ -5234,14 +5313,8 @@ BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_ if(!prs_uint32("valuesize", ps, depth, &r_u->valuesize)) return False; - if (MARSHALLING(ps)) { - /* "Value is actually a UNICODE string. It's already little-endian so don't reverse. */ - if(!prs_uint8s(False, "value", ps, depth, (uint8 *)r_u->value, r_u->valuesize * 2)) - return False; - } else { - if(!prs_uint16s(False, "value", ps, depth, r_u->value, r_u->valuesize )) - return False; - } + if(!prs_uint16uni(False, "value", ps, depth, r_u->value, r_u->valuesize )) + return False; if(!prs_align(ps)) return False; -- cgit From 852242a1b53069e5e6c8861f8243fe4a5016001a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 4 Apr 2001 23:42:17 +0000 Subject: I know we're supposed to be feature frozen, but I couldn't resist this... :-). I worked out and added the per-share get/set RPCs for security descriptors. Currently this code returns Everyone, full access on get and permission denied on set, but backending this with a tdb and checking it on tconX (to give full NT semantics for security on shares) is now an excersise for the reader... :-). Jeremy. (This used to be commit 3bfd155ba78798c50588904d4ea3389f50f8abb6) --- source3/rpc_parse/parse_srv.c | 247 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 243 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 55a0cd95e5..dd70c5521c 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -211,6 +211,132 @@ static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int d return True; } +/******************************************************************* + Inits a SH_INFO_502 structure +********************************************************************/ + +void init_srv_share_info502(SH_INFO_502 *sh502, + char *net_name, uint32 type, char *remark, + uint32 perms, uint32 max_uses, uint32 num_uses, + char *path, char *passwd, SEC_DESC *psd, size_t sd_size) +{ + DEBUG(5,("init_srv_share_info502: %s %8x %s\n", net_name, type, remark)); + + ZERO_STRUCTP(sh502); + + sh502->ptr_netname = (net_name != NULL) ? 1 : 0; + sh502->type = type; + sh502->ptr_remark = (remark != NULL) ? 1 : 0; + sh502->perms = perms; + sh502->max_uses = max_uses; + sh502->num_uses = num_uses; + sh502->type = type; + sh502->ptr_path = (path != NULL) ? 1 : 0; + sh502->ptr_passwd = (passwd != NULL) ? 1 : 0; + sh502->sd_size = (uint32)sd_size; + sh502->ptr_sd = (psd != NULL) ? 1 : 0; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info502(char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth) +{ + if (sh502 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info502"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_netname", ps, depth, &sh502->ptr_netname)) + return False; + if(!prs_uint32("type ", ps, depth, &sh502->type)) + return False; + if(!prs_uint32("ptr_remark ", ps, depth, &sh502->ptr_remark)) + return False; + if(!prs_uint32("perms ", ps, depth, &sh502->perms)) + return False; + if(!prs_uint32("max_uses ", ps, depth, &sh502->max_uses)) + return False; + if(!prs_uint32("num_uses ", ps, depth, &sh502->num_uses)) + return False; + if(!prs_uint32("ptr_path ", ps, depth, &sh502->ptr_path)) + return False; + if(!prs_uint32("ptr_passwd ", ps, depth, &sh502->ptr_passwd)) + return False; + if(!prs_uint32("sd_size ", ps, depth, &sh502->sd_size)) + return False; + if(!prs_uint32("ptr_sd ", ps, depth, &sh502->ptr_sd)) + return False; + + return True; +} + +/******************************************************************* + Inits a SH_INFO_502_STR structure +********************************************************************/ + +void init_srv_share_info502_str(SH_INFO_502_STR *sh502, + char *net_name, char *remark, + char *path, char *passwd, SEC_DESC *psd, size_t sd_size) +{ + DEBUG(5,("init_srv_share_info502_str\n")); + + init_unistr2(&sh502->uni_netname, net_name, strlen(net_name)+1); + init_unistr2(&sh502->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh502->uni_path, path, strlen(path)+1); + init_unistr2(&sh502->uni_passwd, passwd, strlen(passwd)+1); + sh502->sd = psd; + sh502->sd_size = sd_size; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info502_str(char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth) +{ + if (sh502 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info502_str"); + depth++; + + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("", &sh502->uni_netname, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("", &sh502->uni_remark, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("", &sh502->uni_path, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("", &sh502->uni_passwd, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("sd_size ", ps, depth, &sh502->sd_size)) + return False; + if (!sec_io_desc(desc, &sh502->sd, ps, depth)) + return False; + + return True; +} + /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -334,6 +460,31 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct break; } + case 502: + { + SRV_SHARE_INFO_502 *info502 = ctr->share.info502; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps)) { + if (!(info502 = (SRV_SHARE_INFO_502 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_502)))) + return False; + ctr->share.info502 = info502; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info502("", &info502[i].info_502, ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info502_str("", &info502[i].info_502_str, ps, depth)) + return False; + } + + break; + } + default: DEBUG(5,("%s no share info at switch_value %d\n", tab_depth(depth), ctr->switch_value)); @@ -462,12 +613,12 @@ BOOL srv_io_q_net_share_get_info(char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_ Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth) +static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n) { if (r_n == NULL) return False; - prs_debug(ps, depth, desc, "srv_io_r_net_share_get_info"); + prs_debug(ps, depth, desc, "srv_io_srv_share_info"); depth++; if(!prs_align(ps)) @@ -497,9 +648,15 @@ BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_ return False; break; + case 502: + if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth)) + return False; + + if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth)) + return False; + break; case 1005: - if(!srv_io_share_info1005("", &r_n->share.info1005, - ps, depth)) + if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth)) return False; default: DEBUG(5,("%s no share info at switch_value %d\n", @@ -508,6 +665,27 @@ BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_ } } + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_share_get_info"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!srv_io_srv_share_info("info ", ps, depth, &r_n->info)) + return False; + if(!prs_align(ps)) return False; @@ -517,6 +695,67 @@ BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_ return True; } +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_share_set_info(char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_share_set_info"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("info_level", ps, depth, &q_n->info_level)) + return False; + + if(!prs_align(ps)) + return False; + + if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_share_set_info"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) + return False; + if(!prs_uint32("status ", ps, depth, &q_n->status)) + return False; + + return True; +} + /******************************************************************* Inits a SESS_INFO_0_STR structure ********************************************************************/ -- cgit From 3874261774ef9b56461602b4aea3cf4e7b9cc5a0 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 6 Apr 2001 17:41:47 +0000 Subject: Added stub function for NET_SHARE_ADD. Once this is implemented to call a hook function (same for NET_SHARE_DELETE and NET_SHARE_SET) we will be able to manage the shares section in smb.conf via NT server manager........ This should enhance the friendliness of Samba in NT-only shops by an order of magnitude. Jeremy. (This used to be commit a2cd5f2ba11164a17622b96374ab43070f9ed691) --- source3/rpc_parse/parse_srv.c | 58 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index dd70c5521c..fd38594b0d 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -756,6 +756,64 @@ BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *q_n, prs_ return True; } +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_share_add(char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_share_add"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("info_level", ps, depth, &q_n->info_level)) + return False; + + if(!prs_align(ps)) + return False; + + if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_share_add"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) + return False; + if(!prs_uint32("status ", ps, depth, &q_n->status)) + return False; + + return True; +} + /******************************************************************* Inits a SESS_INFO_0_STR structure ********************************************************************/ -- cgit From 97cf9d3a3de4d005477ee07423b7d9c34d6d1761 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 6 Apr 2001 18:25:17 +0000 Subject: Implemented stub function for NET_SHARE_DELETE. Now to implement the real internals to support server manager. Jeremy (This used to be commit 3512ba1f655d5588db87f1afa1d12f599ad7b74a) --- source3/rpc_parse/parse_srv.c | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index fd38594b0d..b9479a7105 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -814,6 +814,53 @@ BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps return True; } +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_share_del(char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_share_del"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_share_del(char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_share_del"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("status ", ps, depth, &q_n->status)) + return False; + + return True; +} + /******************************************************************* Inits a SESS_INFO_0_STR structure ********************************************************************/ -- cgit From f9a15ce1a69f905e94db7650f0a4805720cd9c88 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sun, 8 Apr 2001 20:22:39 +0000 Subject: Got "medieval on our ass" about adding the -1 to slprintf. Jeremy. (This used to be commit 94747b4639ed9b19f7d0fb896e43aa392a84989a) --- source3/rpc_parse/parse_prs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 8311528874..6bab18ba9d 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -36,9 +36,9 @@ void prs_dump(char *name, int v, prs_struct *ps) if (DEBUGLEVEL < 50) return; for (i=1;i<100;i++) { if (v != -1) { - slprintf(fname,sizeof(fname), "/tmp/%s_%d.%d.prs", name, v, i); + slprintf(fname,sizeof(fname)-1, "/tmp/%s_%d.%d.prs", name, v, i); } else { - slprintf(fname,sizeof(fname), "/tmp/%s.%d.prs", name, i); + slprintf(fname,sizeof(fname)-1, "/tmp/%s.%d.prs", name, i); } fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0644); if (fd != -1 || errno != EEXIST) break; -- cgit From 2b9e23855e6e4a20021bb7a1bb0df082efe4eac5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Apr 2001 08:00:19 +0000 Subject: Set SD's for share. Added level 1501. Map GENERIC file bits to specific bits. Jeremy. (This used to be commit 04976c32f319531e16d890797b45a76dab64f370) --- source3/rpc_parse/parse_srv.c | 49 +++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index b9479a7105..61d2ff7ba2 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -340,22 +340,45 @@ static BOOL srv_io_share_info502_str(char *desc, SH_INFO_502_STR *sh502, prs_str /******************************************************************* Reads or writes a structure. ********************************************************************/ + static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth) { - if(sh1005 == NULL) - return False; + if(sh1005 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1005"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("dfs_root_flag", ps, depth, &sh1005->dfs_root_flag)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1501(char* desc, SRV_SHARE_INFO_1501* sh1501, + prs_struct* ps, int depth) +{ + if(sh1501 == NULL) + return False; - prs_debug(ps, depth, desc, "srv_io_share_info1005"); - depth++; + prs_debug(ps, depth, desc, "srv_io_share_info1501"); + depth++; - if(!prs_align(ps)) - return False; + if(!prs_align(ps)) + return False; - if(!prs_uint32("dfs_root_flag", ps, depth, &sh1005->dfs_root_flag)) - return False; + if (!sec_io_desc_buf(desc, &sh1501->sdb, ps, depth)) + return False; - return True; + return True; } /******************************************************************* @@ -656,8 +679,12 @@ static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHA return False; break; case 1005: - if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth)) - return False; + if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth)) + return False; + break; + case 1501: + if (!srv_io_share_info1501("", &r_n->share.info1501, ps, depth)) + return False; default: DEBUG(5,("%s no share info at switch_value %d\n", tab_depth(depth), r_n->switch_value)); -- cgit From 2ef68c7e92d4661664f0410509f7cb551e74a198 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 13 Apr 2001 19:12:06 +0000 Subject: Merge of Andrew's changes in 2.2. Jeremy. (This used to be commit fc76681812b1469208ad6c8847afdfc68bc6db49) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index bf178b4ab8..ff3e53273a 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2400,7 +2400,7 @@ BOOL smb_io_job_info_1(char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int dep BOOL smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int depth) { - uint pipo=0; + uint32 pipo=0; prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "smb_io_job_info_2"); -- cgit From 3e4c6d130c3c533831ac6a52e2403132b79f4b28 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 23 Apr 2001 23:31:09 +0000 Subject: Fix "proc num out of range" error. Missing rpc call. Jeremy. (This used to be commit 6248fb22926d72fddaecad5af117af1bdd08fda3) --- source3/rpc_parse/parse_net.c | 56 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index fbbc09182e..50cad248e0 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -485,6 +485,62 @@ BOOL net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int dept } +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL net_io_q_auth(char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth) +{ + int old_align; + 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; + /* client challenge is _not_ aligned */ + old_align = ps->align; + ps->align = 0; + if(!smb_io_chal("", &q_a->clnt_chal, ps, depth)) { + /* client-calculated credentials */ + ps->align = old_align; + return False; + } + ps->align = old_align; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL net_io_r_auth(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_uint32("status", ps, depth, &r_a->status)) + return False; + + return True; +} + +/******************************************************************* /******************************************************************* Inits a NET_Q_AUTH_2 struct. ********************************************************************/ -- cgit From b8a2c65a181c9580debefcf34743b4fef7880ebe Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 27 Apr 2001 17:32:46 +0000 Subject: Added Herb's comment fix. Jeremy. (This used to be commit f4f4aae675f55d3319aca8489621afc92aaf8de1) --- source3/rpc_parse/parse_net.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 50cad248e0..1e9df37e3a 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -540,7 +540,6 @@ BOOL net_io_r_auth(char *desc, NET_R_AUTH *r_a, prs_struct *ps, int depth) return True; } -/******************************************************************* /******************************************************************* Inits a NET_Q_AUTH_2 struct. ********************************************************************/ -- cgit From e40449fa720d0934abd06cd0b0b05d0ca0f4e257 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 28 Apr 2001 00:32:56 +0000 Subject: rpcclient merge from 2.2 (including Jeremy's non-void return fix) (This used to be commit 0a6ceed279cc8111008b21f75c6791efbd993f4b) --- source3/rpc_parse/parse_spoolss.c | 44 ++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index ff3e53273a..b18656b482 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -761,6 +761,7 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, * init a structure. ********************************************************************/ BOOL make_spoolss_q_addprinterex( + TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u, const char *srv_name, const char* clientname, @@ -783,7 +784,7 @@ BOOL make_spoolss_q_addprinterex( { case 2: /* init q_u->info.info2 from *info */ - if (!make_spoolss_printer_info_2(&q_u->info.info_2, ctr->printers_2)) + if (!make_spoolss_printer_info_2(mem_ctx, &q_u->info.info_2, ctr->printers_2)) { DEBUG(0,("make_spoolss_q_addprinterex: Unable to fill SPOOL_Q_ADDPRINTEREX struct!\n")); return False; @@ -818,6 +819,7 @@ create a SPOOL_PRINTER_INFO_2 stuct from a PRINTER_INFO_2 struct *******************************************************************/ BOOL make_spoolss_printer_info_2( + TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2, PRINTER_INFO_2 *info ) @@ -826,8 +828,7 @@ BOOL make_spoolss_printer_info_2( SPOOL_PRINTER_INFO_LEVEL_2 *inf; /* allocate the necessary memory */ - inf = (SPOOL_PRINTER_INFO_LEVEL_2*)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2)); - if (!spool_info2) + if (!(inf=(SPOOL_PRINTER_INFO_LEVEL_2*)talloc(mem_ctx, sizeof(SPOOL_PRINTER_INFO_LEVEL_2)))) { DEBUG(0,("make_spoolss_printer_info_2: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_2 sruct!\n")); return False; @@ -3256,9 +3257,14 @@ BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, uint32 flags, - fstring servername, uint32 level, - NEW_BUFFER *buffer, uint32 offered) +BOOL make_spoolss_q_enumprinters( + SPOOL_Q_ENUMPRINTERS *q_u, + uint32 flags, + fstring servername, + uint32 level, + NEW_BUFFER *buffer, + uint32 offered +) { q_u->flags=flags; @@ -3420,6 +3426,7 @@ BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps ********************************************************************/ BOOL make_spoolss_q_getprinter( + TALLOC_CTX *mem_ctx, SPOOL_Q_GETPRINTER *q_u, const POLICY_HND *hnd, uint32 level, @@ -3444,6 +3451,7 @@ BOOL make_spoolss_q_getprinter( * init a structure. ********************************************************************/ BOOL make_spoolss_q_setprinter( + TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, const POLICY_HND *hnd, uint32 level, @@ -3474,7 +3482,7 @@ BOOL make_spoolss_q_setprinter( info->printers_2->devmode = NULL; info->printers_2->secdesc = NULL; - make_spoolss_printer_info_2 (&q_u->info.info_2, info->printers_2); + make_spoolss_printer_info_2 (mem_ctx, &q_u->info.info_2, info->printers_2); #if 0 /* JERRY TEST */ q_u->secdesc_ctr = (SEC_DESC_BUF*)malloc(sizeof(SEC_DESC_BUF)); if (!q_u->secdesc_ctr) @@ -4700,6 +4708,7 @@ BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LE ******************************************************************/ BOOL make_spoolss_q_addprinterdriver( + TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTERDRIVER *q_u, const char* srv_name, uint32 level, @@ -4718,7 +4727,7 @@ BOOL make_spoolss_q_addprinterdriver( { /* info level 3 is supported by Windows 95/98, WinNT and Win2k */ case 3 : - make_spoolss_driver_info_3(&q_u->info.info_3, info->info3); + make_spoolss_driver_info_3(mem_ctx, &q_u->info.info_3, info->info3); break; /* info level 6 is supported by WinME and Win2k */ @@ -4735,6 +4744,7 @@ BOOL make_spoolss_q_addprinterdriver( } BOOL make_spoolss_driver_info_3( + TALLOC_CTX *mem_ctx, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **spool_drv_info, DRIVER_INFO_3 *info3 ) @@ -4745,11 +4755,8 @@ BOOL make_spoolss_driver_info_3( BOOL null_char = False; SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *inf; - inf = (SPOOL_PRINTER_DRIVER_INFO_LEVEL_3*) - malloc(sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); - if (!inf) + if (!(inf=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3*)talloc_zero(mem_ctx, sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)))) return False; - memset (inf, 0x0, sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); inf->cversion = info3->version; inf->name_ptr = (info3->name.buffer!=NULL)?1:0; @@ -4793,7 +4800,7 @@ BOOL make_spoolss_driver_info_3( } inf->dependentfiles_ptr = (info3->dependentfiles != NULL) ? 1 : 0; inf->dependentfilessize = len; - if(!make_spoolss_buffer5(&inf->dependentfiles, len, info3->dependentfiles)) + if(!make_spoolss_buffer5(mem_ctx, &inf->dependentfiles, len, info3->dependentfiles)) { safe_free (inf); return False; @@ -4808,18 +4815,21 @@ BOOL make_spoolss_driver_info_3( make a BUFFER5 struct from a uint16* ******************************************************************/ -BOOL make_spoolss_buffer5(BUFFER5 *buf5, uint32 len, uint16 *src) +BOOL make_spoolss_buffer5( + TALLOC_CTX *mem_ctx, + BUFFER5 *buf5, + uint32 len, + uint16 *src +) { buf5->buf_len = len; - if((buf5->buffer=(uint16*)malloc(sizeof(uint16)*len)) == NULL) + if((buf5->buffer=(uint16*)talloc_memdup(mem_ctx, src, sizeof(uint16)*len)) == NULL) { DEBUG(0,("make_spoolss_buffer5: Unable to malloc memory for buffer!\n")); return False; } - memcpy(buf5->buffer, src, sizeof(uint16)*len); - return True; } -- cgit From 3a44e2364b546adb9e9c166e0b8ae6a0b4894b70 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 28 Apr 2001 01:07:27 +0000 Subject: few cleanups to bring in line with 2.2 (This used to be commit 0feaac00a1847af41464d4ce35821ff851cded9c) --- source3/rpc_parse/parse_samr.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 6600ecca86..7d023d54fc 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -26,7 +26,6 @@ #include "includes.h" #include "rpc_parse.h" -#include "rpc_client.h" #include "nterr.h" extern int DEBUGLEVEL; -- cgit From 8bd2a11c86ddc3bbb2bec32415e027d87df639af Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 1 May 2001 01:01:19 +0000 Subject: Added code from "Nigel Williams" (yes, the same famous Nigel Williams who did NIS/GINA !) to implement add/modify/delete shares for Win2k. Needs testing as I made a few mods to the original code. Jeremy. (This used to be commit 9b3dd801765fad28c0f9d58e5af2537cfccdd4ee) --- source3/rpc_parse/parse_misc.c | 31 ++++++ source3/rpc_parse/parse_srv.c | 224 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 236 insertions(+), 19 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 81602a1dc4..4b118dd2b4 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1456,6 +1456,37 @@ BOOL smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth) return True; } +/******************************************************************* + Create a UNISTR3. +********************************************************************/ + +void init_unistr3(UNISTR3 *str, const char *buf) +{ + size_t len; + + if (buf == NULL) { + str->uni_str_len=0; + str->str.buffer = NULL; + return; + } + + len = strlen(buf) + 1; + + str->uni_str_len=len; + + if (len < MAX_UNISTRLEN) + len = MAX_UNISTRLEN; + + len *= sizeof(uint16); + + str->str.buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len); + if (str->str.buffer == NULL) + smb_panic("init_unistr3: malloc fail\n"); + + /* store the string (null-terminated copy) */ + dos_struni2((char *)str->str.buffer, buf, len); +} + /******************************************************************* Reads or writes a UNISTR3 structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 61d2ff7ba2..4abd93b159 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -280,18 +280,27 @@ static BOOL srv_io_share_info502(char *desc, SH_INFO_502 *sh502, prs_struct *ps, Inits a SH_INFO_502_STR structure ********************************************************************/ -void init_srv_share_info502_str(SH_INFO_502_STR *sh502, +void init_srv_share_info502_str(SH_INFO_502_STR *sh502str, + SH_INFO_502 *ptrs, char *net_name, char *remark, char *path, char *passwd, SEC_DESC *psd, size_t sd_size) { DEBUG(5,("init_srv_share_info502_str\n")); - init_unistr2(&sh502->uni_netname, net_name, strlen(net_name)+1); - init_unistr2(&sh502->uni_remark, remark, strlen(remark)+1); - init_unistr2(&sh502->uni_path, path, strlen(path)+1); - init_unistr2(&sh502->uni_passwd, passwd, strlen(passwd)+1); - sh502->sd = psd; - sh502->sd_size = sd_size; + sh502str->ptrs = ptrs; + + if(sh502str->ptrs->ptr_netname) + init_unistr2(&sh502str->uni_netname, net_name, strlen(net_name)+1); + if(sh502str->ptrs->ptr_remark) + init_unistr2(&sh502str->uni_remark, remark, strlen(remark)+1); + if(sh502str->ptrs->ptr_path) + init_unistr2(&sh502str->uni_path, path, strlen(path)+1); + if(sh502str->ptrs->ptr_passwd) + init_unistr2(&sh502str->uni_passwd, passwd, strlen(passwd)+1); + if(sh502str->ptrs->ptr_sd) { + sh502str->sd = psd; + sh502str->sd_size = sd_size; + } } /******************************************************************* @@ -308,31 +317,45 @@ static BOOL srv_io_share_info502_str(char *desc, SH_INFO_502_STR *sh502, prs_str if(!prs_align(ps)) return False; - if(!smb_io_unistr2("", &sh502->uni_netname, True, ps, depth)) - return False; + + if(sh502->ptrs->ptr_netname) { + if(!smb_io_unistr2("", &sh502->uni_netname, True, ps, depth)) + return False; + } if(!prs_align(ps)) return False; - if(!smb_io_unistr2("", &sh502->uni_remark, True, ps, depth)) - return False; + + if(sh502->ptrs->ptr_remark) { + if(!smb_io_unistr2("", &sh502->uni_remark, True, ps, depth)) + return False; + } if(!prs_align(ps)) return False; - if(!smb_io_unistr2("", &sh502->uni_path, True, ps, depth)) - return False; + + if(sh502->ptrs->ptr_path) { + if(!smb_io_unistr2("", &sh502->uni_path, True, ps, depth)) + return False; + } if(!prs_align(ps)) return False; - if(!smb_io_unistr2("", &sh502->uni_passwd, True, ps, depth)) - return False; + + if(sh502->ptrs->ptr_passwd) { + if(!smb_io_unistr2("", &sh502->uni_passwd, True, ps, depth)) + return False; + } if(!prs_align(ps)) return False; - if(!prs_uint32("sd_size ", ps, depth, &sh502->sd_size)) - return False; - if (!sec_io_desc(desc, &sh502->sd, ps, depth)) - return False; + if(sh502->ptrs->ptr_sd) { + if(!prs_uint32("sd_size ", ps, depth, &sh502->sd_size)) + return False; + if (!sec_io_desc(desc, &sh502->sd, ps, depth)) + return False; + } return True; } @@ -501,6 +524,7 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct } for (i = 0; i < num_entries; i++) { + info502[i].info_502_str.ptrs = &info502[i].info_502; if(!srv_io_share_info502_str("", &info502[i].info_502_str, ps, depth)) return False; } @@ -675,6 +699,9 @@ static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHA if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth)) return False; + /*allow access to pointers in the str part. */ + r_n->share.info502.info_502_str.ptrs = &r_n->share.info502.info_502; + if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth)) return False; break; @@ -2374,3 +2401,162 @@ BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct * return True; } + +/******************************************************************* + Reads or writes a structure. + ********************************************************************/ + +BOOL srv_io_q_net_disk_enum(char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_disk_enum"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("level", ps, depth, &q_n->disk_enum_ctr.level)) + return False; + + if(!prs_uint32("entries_read", ps, depth, &q_n->disk_enum_ctr.entries_read)) + return False; + + if(!prs_uint32("buffer", ps, depth, &q_n->disk_enum_ctr.disk_info_ptr)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) + return False; + if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. + ********************************************************************/ + +BOOL srv_io_r_net_disk_enum(char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth) +{ + int i; + + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_disk_enum"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("entries_read", ps, depth, &r_n->disk_enum_ctr.entries_read)) + return False; + if(!prs_uint32("ptr_disk_info", ps, depth, &r_n->disk_enum_ctr.disk_info_ptr)) + return False; + + /*this may be max, unknown, actual?*/ + + if(!prs_uint32("max_elements", ps, depth, &r_n->disk_enum_ctr.entries_read)) + return False; + if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.unknown)) + return False; + if(!prs_uint32("actual_elements", ps, depth, &r_n->disk_enum_ctr.entries_read)) + return False; + + for(i=0; i < r_n->disk_enum_ctr.entries_read; i++) { + + if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.disk_info[i].unknown)) + return False; + + if(!smb_io_unistr3("disk_name", &r_n->disk_enum_ctr.disk_info[i].disk_name, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + } + + if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) + return False; + + if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) + return False; + + if(!prs_uint32("status", ps, depth, &r_n->status)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. + ********************************************************************/ + +BOOL srv_io_q_net_name_validate(char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_name_validate"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("type", ps, depth, &q_n->type)) + return False; + + if(!prs_uint32("flags", ps, depth, &q_n->flags)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. + ********************************************************************/ + +BOOL srv_io_r_net_name_validate(char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_name_validate"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("status", ps, depth, &r_n->status)) + return False; + + return True; +} -- cgit From 5d58cf895c7537615c1834e6d3d7db746e5ceb8b Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 4 May 2001 07:33:10 +0000 Subject: Renamed unknown field to access mask in open alias parsing functions. (This used to be commit d384cae5707889f34ac19ccd80737ab6eb5fdb98) --- source3/rpc_parse/parse_samr.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 7d023d54fc..7d8c4f2533 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3594,15 +3594,12 @@ inits a SAMR_Q_OPEN_ALIAS structure. ********************************************************************/ void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS * q_u, POLICY_HND *pol, - uint32 unknown_0, uint32 rid) + uint32 access_mask, uint32 rid) { DEBUG(5, ("init_samr_q_open_alias\n")); q_u->dom_pol = *pol; - - /* example values: 0x0000 0008 */ - q_u->unknown_0 = unknown_0; - + q_u->access_mask = access_mask; q_u->rid_alias = rid; } @@ -3625,7 +3622,7 @@ BOOL samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS * q_u, if(!smb_io_pol_hnd("domain_pol", &q_u->dom_pol, ps, depth)) return False; - if(!prs_uint32("unknown_0", ps, depth, &q_u->unknown_0)) + 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; -- cgit From 706a1188c52a4387a0cd875b0c9ae74dd86f103c Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 8 May 2001 03:50:42 +0000 Subject: iinit_samr_q_lookup_rids() didn't actually copy the rids into the parse structure. (This used to be commit 139e767e78adafa4d4469d2d63415d46267f2fc9) --- source3/rpc_parse/parse_samr.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 7d8c4f2533..03226d522f 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3675,6 +3675,8 @@ void init_samr_q_lookup_rids(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_RIDS * q_u, 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])); } } -- cgit From 12ef6bc03eb67d2f9327ec4ddb342617c8cc510d Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 8 May 2001 04:00:01 +0000 Subject: Fixed typo in comment. (This used to be commit a8c49d1e608b178bcc53725d4a26cebb799fc6eb) --- source3/rpc_parse/parse_lsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 98ef3fd0ee..9a7ae0f060 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -758,7 +758,7 @@ static BOOL lsa_io_dom_query_6(char *desc, DOM_QUERY_6 *d_q, prs_struct *ps, int } /******************************************************************* - Reads or writes an LSA_Q_QUERY_INFO structure. + Reads or writes an LSA_R_QUERY_INFO structure. ********************************************************************/ BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, -- cgit From b6a6b4b02ef923ce71a8be8258ccee1cbb439c6f Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Tue, 8 May 2001 16:33:18 +0000 Subject: fixes to the group mapping code. Not ready yet. J.F. (This used to be commit 62a7a567fdea230b77cc97a3f74d868542c34700) --- source3/rpc_parse/parse_samr.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 03226d522f..0d60880615 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2047,29 +2047,32 @@ BOOL samr_io_group_info4(char *desc, GROUP_INFO4 * gr4, reads or writes a structure. ********************************************************************/ -static BOOL samr_group_info_ctr(char *desc, GROUP_INFO_CTR * ctr, +static BOOL samr_group_info_ctr(char *desc, GROUP_INFO_CTR **ctr, prs_struct *ps, int depth) { - if (ctr == NULL) + if (UNMARSHALLING(ps)) + *ctr = (GROUP_INFO_CTR *)prs_alloc_mem(ps,sizeof(GROUP_INFO_CTR)); + + 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)) + if(!prs_uint16("switch_value1", ps, depth, &(*ctr)->switch_value1)) return False; - if(!prs_uint16("switch_value2", ps, depth, &ctr->switch_value2)) + if(!prs_uint16("switch_value2", ps, depth, &(*ctr)->switch_value2)) return False; - switch (ctr->switch_value1) { + switch ((*ctr)->switch_value1) { case 1: if(!samr_io_group_info1("group_info1", - &ctr->group.info1, ps, depth)) + &(*ctr)->group.info1, ps, depth)) return False; break; case 4: if(!samr_io_group_info4("group_info4", - &ctr->group.info4, ps, depth)) + &(*ctr)->group.info4, ps, depth)) return False; break; default: @@ -2395,7 +2398,7 @@ BOOL samr_io_q_set_groupinfo(char *desc, SAMR_Q_SET_GROUPINFO * q_e, if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) return False; - if(!samr_group_info_ctr("ctr", q_e->ctr, ps, depth)) + if(!samr_group_info_ctr("ctr", &q_e->ctr, ps, depth)) return False; return True; @@ -2507,7 +2510,7 @@ BOOL samr_io_r_query_groupinfo(char *desc, SAMR_R_QUERY_GROUPINFO * r_u, return False; if (r_u->ptr != 0) { - if(!samr_group_info_ctr("ctr", r_u->ctr, ps, depth)) + if(!samr_group_info_ctr("ctr", &r_u->ctr, ps, depth)) return False; } -- cgit From 989ece4b265d7ea8379aa9c1899c59aadf8bd120 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 9 May 2001 05:05:01 +0000 Subject: So the samr_io_userinfo_ctr was requiring a SAM_USERINFO_CTR to be passed in as well as tallocating space for one itself. I've deleted code so the passed in container is used to store the SAM user info. This may have broken some server side SAM stuff which probably isn't used anyway. )-: (This used to be commit fc44cec0de68c92001c4313b4f0ee9f69ba6b9b5) --- source3/rpc_parse/parse_samr.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 0d60880615..6479b07048 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5745,15 +5745,20 @@ void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, uchar * sess_key, reads or writes a structure. ********************************************************************/ -static BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR **ppctr, +static BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR *ctr, prs_struct *ps, int depth) { BOOL ret; - SAM_USERINFO_CTR *ctr; prs_debug(ps, depth, desc, "samr_io_userinfo_ctr"); depth++; +#if 0 + /* I think this is broken as the caller should pass in a + sam_userinfo_ctr not have it allocated. This may break some of + the setuser calls so this is a clue to the person who may be + trying to debug the problem. (-: -tpot */ + if (UNMARSHALLING(ps)) { ctr = (SAM_USERINFO_CTR *)prs_alloc_mem(ps,sizeof(SAM_USERINFO_CTR)); if (ctr == NULL) @@ -5762,6 +5767,7 @@ static BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR **ppctr, } else { ctr = *ppctr; } +#endif /* lkclXXXX DO NOT ALIGN BEFORE READING SWITCH VALUE! */ @@ -5881,7 +5887,7 @@ BOOL samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO * r_u, return False; if (r_u->ptr != 0) { - if(!samr_io_userinfo_ctr("ctr", &r_u->ctr, ps, depth)) + if(!samr_io_userinfo_ctr("ctr", r_u->ctr, ps, depth)) return False; } @@ -5928,7 +5934,7 @@ BOOL samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO * q_u, if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) return False; - if(!samr_io_userinfo_ctr("ctr", &q_u->ctr, ps, depth)) + if(!samr_io_userinfo_ctr("ctr", q_u->ctr, ps, depth)) return False; return True; @@ -6016,7 +6022,7 @@ BOOL samr_io_q_set_userinfo2(char *desc, SAMR_Q_SET_USERINFO2 * q_u, if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) return False; - if(!samr_io_userinfo_ctr("ctr", &q_u->ctr, ps, depth)) +if(!samr_io_userinfo_ctr("ctr", q_u->ctr, ps, depth)) return False; return True; -- cgit From f179319ceeb795db57c3d22f2593609174e795e2 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 10 May 2001 00:03:36 +0000 Subject: Reverted samr_io_userinfo_ctr() patch because it broke too much other stuff. (-: (This used to be commit 5bbd946d592fde9ac6bf1c66268ef608d5988363) --- source3/rpc_parse/parse_samr.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 6479b07048..0d60880615 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5745,20 +5745,15 @@ void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, uchar * sess_key, reads or writes a structure. ********************************************************************/ -static BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR *ctr, +static BOOL samr_io_userinfo_ctr(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 0 - /* I think this is broken as the caller should pass in a - sam_userinfo_ctr not have it allocated. This may break some of - the setuser calls so this is a clue to the person who may be - trying to debug the problem. (-: -tpot */ - if (UNMARSHALLING(ps)) { ctr = (SAM_USERINFO_CTR *)prs_alloc_mem(ps,sizeof(SAM_USERINFO_CTR)); if (ctr == NULL) @@ -5767,7 +5762,6 @@ static BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR *ctr, } else { ctr = *ppctr; } -#endif /* lkclXXXX DO NOT ALIGN BEFORE READING SWITCH VALUE! */ @@ -5887,7 +5881,7 @@ BOOL samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO * r_u, return False; if (r_u->ptr != 0) { - if(!samr_io_userinfo_ctr("ctr", r_u->ctr, ps, depth)) + if(!samr_io_userinfo_ctr("ctr", &r_u->ctr, ps, depth)) return False; } @@ -5934,7 +5928,7 @@ BOOL samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO * q_u, if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) return False; - if(!samr_io_userinfo_ctr("ctr", q_u->ctr, ps, depth)) + if(!samr_io_userinfo_ctr("ctr", &q_u->ctr, ps, depth)) return False; return True; @@ -6022,7 +6016,7 @@ BOOL samr_io_q_set_userinfo2(char *desc, SAMR_Q_SET_USERINFO2 * q_u, if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) return False; -if(!samr_io_userinfo_ctr("ctr", q_u->ctr, ps, depth)) + if(!samr_io_userinfo_ctr("ctr", &q_u->ctr, ps, depth)) return False; return True; -- cgit From 013b454d1a2858b6f3b48e7b73f549ec7540d189 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 17 May 2001 18:57:25 +0000 Subject: merge from 2.2 DeletePrinterDriver() server side stud coming in separate commit after I get it working in 2.2. (This used to be commit 09506ac0e64b84d73e3b8fdd4942fa52dba6060f) --- source3/rpc_parse/parse_spoolss.c | 77 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b18656b482..84decdaf2d 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -908,6 +908,31 @@ BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_ return True; } +/******************************************************************* + * init a structure. + ********************************************************************/ +BOOL make_spoolss_q_deleteprinterdriver( + TALLOC_CTX *mem_ctx, + SPOOL_Q_DELETEPRINTERDRIVER *q_u, + const char *server, + const char* arch, + const char* driver +) +{ + DEBUG(5,("make_spoolss_q_deleteprinterdriver\n")); + + q_u->server_ptr = (server!=NULL)?1:0; + + /* these must be NULL terminated or else NT4 will + complain about invalid parameters --jerry */ + init_unistr2(&q_u->server, server, strlen(server)+1); + init_unistr2(&q_u->arch, arch, strlen(arch)+1); + init_unistr2(&q_u->driver, driver, strlen(driver)+1); + + + return True; +} + /******************************************************************* * write a structure. * called from static spoolss_r_open_printer_ex (srv_spoolss.c) @@ -1151,6 +1176,58 @@ BOOL spoolss_io_r_deleteprinter(char *desc, SPOOL_R_DELETEPRINTER *r_u, prs_stru return True; } + +/******************************************************************* + * read a structure. + * called from api_spoolss_deleteprinterdriver (srv_spoolss.c) + * called from spoolss_deleteprinterdriver (cli_spoolss.c) + ********************************************************************/ + +BOOL spoolss_io_q_deleteprinterdriver(char *desc, SPOOL_Q_DELETEPRINTERDRIVER *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_deleteprinterdriver"); + 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(!smb_io_unistr2("arch", &q_u->arch, True, ps, depth)) + return False; + if(!smb_io_unistr2("driver", &q_u->driver, True, ps, depth)) + return False; + + + return True; +} + + +/******************************************************************* + * write a structure. + ********************************************************************/ +BOOL spoolss_io_r_deleteprinterdriver(char *desc, SPOOL_R_DELETEPRINTERDRIVER *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterdriver"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; +} + + + /******************************************************************* * read a structure. * called from static spoolss_q_closeprinter (srv_spoolss.c) -- cgit From 69ffa0f16daa56dd802ae3dc48d1f29fbf91fba8 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 24 May 2001 07:58:49 +0000 Subject: Added a init function for net_q_logon_ctrl2 so we can make this call from rpcclient. Added init and i/o functions for net_{q,r}_logon_ctrl functions so we can call from rpcclient and respond to this call from smbd. (This used to be commit 8ba30031a4fd900b9b87cf5d04c2f2bf6c436718) --- source3/rpc_parse/parse_net.c | 145 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 133 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 1e9df37e3a..85de667b00 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -188,9 +188,6 @@ static BOOL net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, BOOL net_io_q_logon_ctrl2(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++; @@ -216,15 +213,32 @@ BOOL net_io_q_logon_ctrl2(char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, in return True; } +/******************************************************************* + Inits an NET_Q_LOGON_CTRL2 structure. +********************************************************************/ + +void init_net_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, char *srv_name, + uint32 query_level) +{ + DEBUG(5,("init_q_logon_ctrl2\n")); + + q_l->function_code = 0x01; + q_l->query_level = query_level; + q_l->switch_value = 0x01; + + init_unistr2(&q_l->uni_server_name, srv_name, strlen(srv_name) + 1); +} + /******************************************************************* Inits an NET_R_LOGON_CTRL2 structure. ********************************************************************/ -void init_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level, - uint32 flags, uint32 pdc_status, uint32 logon_attempts, - uint32 tc_status, char *trusted_domain_name) +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, + char *trusted_domain_name) { - DEBUG(5,("make_r_logon_ctrl2\n")); + DEBUG(5,("init_r_logon_ctrl2\n")); r_l->switch_value = query_level; /* should only be 0x1 */ @@ -300,6 +314,113 @@ BOOL net_io_r_logon_ctrl2(char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, in return True; } +/******************************************************************* + Reads or writes an NET_Q_LOGON_CTRL structure. +********************************************************************/ + +BOOL net_io_q_logon_ctrl(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, 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, strlen(srv_name) + 1); +} + +/******************************************************************* + 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 = 0; + 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(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_uint32("status ", ps, depth, &r_l->status)) + return False; + + return True; +} + /******************************************************************* Inits an NET_R_TRUST_DOM_LIST structure. ********************************************************************/ @@ -309,7 +430,7 @@ void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, { int i = 0; - DEBUG(5,("make_r_trust_dom\n")); + 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; @@ -410,7 +531,7 @@ void init_q_req_chal(NET_Q_REQ_CHAL *q_c, char *logon_srv, char *logon_clnt, DOM_CHAL *clnt_chal) { - DEBUG(5,("make_q_req_chal: %d\n", __LINE__)); + DEBUG(5,("init_q_req_chal: %d\n", __LINE__)); q_c->undoc_buffer = 1; /* don't know what this buffer is */ @@ -419,7 +540,7 @@ void init_q_req_chal(NET_Q_REQ_CHAL *q_c, memcpy(q_c->clnt_chal.data, clnt_chal->data, sizeof(clnt_chal->data)); - DEBUG(5,("make_q_req_chal: %d\n", __LINE__)); + DEBUG(5,("init_q_req_chal: %d\n", __LINE__)); } /******************************************************************* @@ -624,7 +745,7 @@ BOOL net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth) void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char *logon_srv, char *acct_name, uint16 sec_chan, char *comp_name, DOM_CRED *cred, char nt_cypher[16]) { - DEBUG(5,("make_q_srv_pwset\n")); + DEBUG(5,("init_q_srv_pwset\n")); init_clnt_info(&q_s->clnt_id, logon_srv, acct_name, sec_chan, comp_name, cred); @@ -736,7 +857,7 @@ void init_id_info1(NET_ID_INFO_1 *id, char *domain_name, unsigned char lm_owf[16]; unsigned char nt_owf[16]; - DEBUG(5,("make_id_info1: %d\n", __LINE__)); + DEBUG(5,("init_id_info1: %d\n", __LINE__)); id->ptr_id_info1 = 1; -- cgit From e07b85ab195509cd1bd83e813ecf464f5629c566 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 1 Jun 2001 11:26:20 +0000 Subject: Added *.po to .cvsignore files. (This used to be commit 870e9e4e89dcf910c595cabb28f69ad070942072) --- source3/rpc_parse/.cvsignore | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/.cvsignore b/source3/rpc_parse/.cvsignore index e69de29bb2..ad4b35d213 100644 --- a/source3/rpc_parse/.cvsignore +++ b/source3/rpc_parse/.cvsignore @@ -0,0 +1 @@ +*.po \ No newline at end of file -- cgit From b627b65d2b347ea9b08977ecf52bd35457993918 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 6 Jun 2001 07:15:34 +0000 Subject: Converted init_samr_q_lookup_names() and samr_io_q_lookup_names() to use tallocated memory instead of dodgy static arrays. (This used to be commit 35d27941141ecdc3bfe18651e5225a94d818e8c1) --- source3/rpc_parse/parse_samr.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 0d60880615..56ed41128d 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4291,7 +4291,7 @@ BOOL samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM * r_u, inits a SAMR_Q_LOOKUP_NAMES structure. ********************************************************************/ -void init_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES * q_u, +void init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, POLICY_HND *pol, uint32 flags, uint32 num_names, char **name) { @@ -4306,6 +4306,9 @@ void init_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES * q_u, q_u->ptr = 0; q_u->num_names2 = num_names; + q_u->hdr_name = (UNIHDR *)talloc_zero(ctx, num_names * sizeof(UNIHDR)); + q_u->uni_name = (UNISTR2 *)talloc_zero(ctx, num_names * sizeof(UNISTR2)); + for (i = 0; i < num_names; i++) { int len_name = name[i] != NULL ? strlen(name[i]) : 0; init_uni_hdr(&q_u->hdr_name[i], len_name); /* unicode header for user_name */ @@ -4346,7 +4349,14 @@ BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES * q_u, if(!prs_uint32("num_names2", ps, depth, &q_u->num_names2)) return False; - SMB_ASSERT_ARRAY(q_u->hdr_name, q_u->num_names2); + if (UNMARSHALLING(ps) && (q_u->num_names2 != 0)) { + q_u->hdr_name = (UNIHDR *)prs_alloc_mem(ps, sizeof(UNIHDR) * + q_u->num_names2); + q_u->uni_name = (UNISTR2 *)prs_alloc_mem(ps, sizeof(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)) -- cgit From 5eee0f1968391ff0aa42ad09e1687ef4a9da88e3 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 13 Jun 2001 06:37:02 +0000 Subject: Added some msdfs client routines. (This used to be commit 13df2304b309a2bd14d4441db0e72e75b8742262) --- source3/rpc_parse/parse_dfs.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index 6bae2ae4a6..0c7ea54315 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -28,6 +28,15 @@ extern int DEBUGLEVEL; +/******************************************************************* +Make a DFS_Q_DFS_QUERY structure +*******************************************************************/ + +void init_dfs_q_dfs_exist(DFS_Q_DFS_EXIST *q_d) +{ + q_d->dummy = 0; +} + /************************************************************* Read/write a DFS_Q_DFS_EXIST structure - dummy... ************************************************************/ @@ -67,10 +76,10 @@ BOOL dfs_io_r_dfs_exist(char *desc, DFS_R_DFS_EXIST *q_d, prs_struct *ps, int de Make a DFS_Q_DFS_REMOVE structure *******************************************************************/ -BOOL make_dfs_q_dfs_remove(DFS_Q_DFS_REMOVE *q_d, char *entrypath, +BOOL init_dfs_q_dfs_remove(DFS_Q_DFS_REMOVE *q_d, char *entrypath, char *servername, char *sharename) { - DEBUG(5,("make_dfs_q_dfs_remove\n")); + DEBUG(5,("init_dfs_q_dfs_remove\n")); init_unistr2(&q_d->DfsEntryPath, entrypath, strlen(entrypath)+1); init_unistr2(&q_d->ServerName, servername, strlen(servername)+1); init_unistr2(&q_d->ShareName, sharename, strlen(sharename)+1); @@ -140,10 +149,10 @@ BOOL dfs_io_r_dfs_remove(char *desc, DFS_R_DFS_REMOVE *r_d, prs_struct *ps, int Make a DFS_Q_DFS_ADD structure *******************************************************************/ -BOOL make_dfs_q_dfs_add(DFS_Q_DFS_ADD *q_d, char *entrypath, char *servername, +BOOL init_dfs_q_dfs_add(DFS_Q_DFS_ADD *q_d, char *entrypath, char *servername, char *sharename, char *comment, uint32 flags) { - DEBUG(5,("make_dfs_q_dfs_add\n")); + DEBUG(5,("init_dfs_q_dfs_add\n")); q_d->ptr_DfsEntryPath = q_d->ptr_ServerName = q_d->ptr_ShareName = 1; init_unistr2(&q_d->DfsEntryPath, entrypath, strlen(entrypath)+1); init_unistr2(&q_d->ServerName, servername, strlen(servername)+1); @@ -222,6 +231,19 @@ BOOL dfs_io_r_dfs_add(char *desc, DFS_R_DFS_ADD *r_d, prs_struct *ps, int depth) return True; } +BOOL init_dfs_q_dfs_get_info(DFS_Q_DFS_GET_INFO *q_d, char *entrypath, + char *servername, char *sharename, + uint32 info_level) +{ + DEBUG(5,("init_dfs_q2_get_info\n")); + init_unistr2(&q_d->uni_path, entrypath, strlen(entrypath)+1); + init_unistr2(&q_d->uni_server, servername, strlen(servername)+1); + init_unistr2(&q_d->uni_share, sharename, strlen(sharename)+1); + q_d->level = info_level; + q_d->ptr_server = q_d->ptr_share = 1; + return True; +} + /************************************************************ Read/write a DFS_Q_GET_INFO structure ************************************************************/ @@ -286,7 +308,7 @@ BOOL dfs_io_r_dfs_get_info(char* desc, DFS_R_DFS_GET_INFO* r_i, prs_struct* ps, /************************************************************ Make a DFS_Q_DFS_ENUM structure ************************************************************/ -BOOL make_dfs_q_dfs_enum(DFS_Q_DFS_ENUM *q_d, uint32 level, DFS_INFO_CTR *ctr) +BOOL init_dfs_q_dfs_enum(DFS_Q_DFS_ENUM *q_d, uint32 level, DFS_INFO_CTR *ctr) { q_d->level = level; q_d->maxpreflen = -1; -- cgit From b7e382bfb29295047d8976ab534c82d0af345e42 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 15 Jun 2001 05:09:40 +0000 Subject: Add password length field to SAM_USER_INFO24 structure and fix init and parse function. (This used to be commit d2eafa7483a53958b6c930ca05da6e6a6c21b785) --- source3/rpc_parse/parse_samr.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 56ed41128d..3695a83c67 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5002,6 +5002,7 @@ void init_sam_user_info24(SAM_USER_INFO_24 * usr, { DEBUG(10, ("init_sam_user_info24: passlen: %d\n", passlen)); memcpy(usr->pass, newpass, sizeof(usr->pass)); + usr->passlen = passlen; } /******************************************************************* @@ -5020,7 +5021,14 @@ static BOOL sam_io_user_info24(char *desc, SAM_USER_INFO_24 * usr, if(!prs_align(ps)) return False; - if(!prs_uint8s(False, "password", ps, depth, usr->pass, sizeof(usr->pass))) + if(!prs_uint8s(False, "password", ps, depth, usr->pass, + sizeof(usr->pass))) + return False; + + if (!prs_uint16("passlen", ps, depth, &usr->passlen)) + return False; + + if(!prs_align(ps)) return False; return True; -- cgit From cf30d3bc91d7e62aef862cec7b7bebfcf04c8213 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 15 Jun 2001 19:48:03 +0000 Subject: Fixed typo spotted by "Jim McDonough" .... Jeremy. (This used to be commit a600c96e596375bf27c15026c032944a066e7290) --- source3/rpc_parse/parse_samr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 3695a83c67..e32a087a65 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4354,7 +4354,7 @@ BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES * q_u, q_u->num_names2); q_u->uni_name = (UNISTR2 *)prs_alloc_mem(ps, sizeof(UNISTR2) * q_u->num_names2); - if (!q_u->hdr_name || q_u->uni_name) + if (!q_u->hdr_name || !q_u->uni_name) return False; } -- cgit From 438e89b187fe985cddb0c6f59a1f3cd0c185d331 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 15 Jun 2001 20:08:12 +0000 Subject: Jim McDonough's parse patches for Win9x get SD calls. Jeremy. (This used to be commit bc366f31537408380860906cc041de232b27b714) --- source3/rpc_parse/parse_srv.c | 87 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 4abd93b159..ae6f99c56e 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -2560,3 +2560,90 @@ BOOL srv_io_r_net_name_validate(char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_st return True; } + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_file_query_secdesc(char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_file_query_secdesc"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth)) + return False; + + if(!prs_uint32("unknown1", ps, depth, &q_n->unknown1)) + return False; + + if(!prs_uint32("unknown2", ps, depth, &q_n->unknown2)) + return False; + + if(!prs_uint32("unknown3", ps, depth, &q_n->unknown3)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_file_query_secdesc(char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_file_query_secdesc"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_response", ps, depth, &r_n->ptr_response)) + return False; + + if(!prs_uint32("size_response", ps, depth, &r_n->size_response)) + return False; + + if(!prs_uint32("ptr_secdesc", ps, depth, &r_n->ptr_secdesc)) + return False; + + if(!prs_uint32("size_secdesc", ps, depth, &r_n->size_secdesc)) + return False; + + if(!sec_io_desc("sec_desc", &r_n->sec_desc, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("status", ps, depth, &r_n->status)) + return False; + + return True; +} -- cgit From af604fe7694f3e1d1acdecfab366dfe31cfee9ef Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 16 Jun 2001 00:32:13 +0000 Subject: Modified version of Jim's 0x27 and 0x28 Win9x Secdesc patch. Jeremy. (This used to be commit 5690ec77c87475f1fd2e854cda594eb996d6fd04) --- source3/rpc_parse/parse_srv.c | 75 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index ae6f99c56e..9661b4edf1 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -2647,3 +2647,78 @@ BOOL srv_io_r_net_file_query_secdesc(char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r return True; } + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_file_set_secdesc(char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_file_set_secdesc"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth)) + return False; + + if(!prs_uint32("sec_info", ps, depth, &q_n->sec_info)) + return False; + + if(!prs_uint32("size_set", ps, depth, &q_n->size_set)) + return False; + + if(!prs_uint32("ptr_secdesc", ps, depth, &q_n->ptr_secdesc)) + return False; + + if(!prs_uint32("size_secdesc", ps, depth, &q_n->size_secdesc)) + return False; + + if(!sec_io_desc("sec_desc", &q_n->sec_desc, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_file_set_secdesc(char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_file_set_secdesc"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("status", ps, depth, &r_n->status)) + return False; + + return True; +} -- cgit From 92033860636abf665ddd968d991bd789aabeec9a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 19 Jun 2001 19:56:06 +0000 Subject: INFO_24 sometimes has a 2 byte length, sometimes doesn't. Safer to not depend on it... Jeremy. (This used to be commit 0fe11c329f7b379299be65795031e4f1b14e0bec) --- source3/rpc_parse/parse_samr.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index e32a087a65..6e94b62d40 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4997,12 +4997,10 @@ static BOOL sam_io_user_info11(char *desc, SAM_USER_INFO_11 * usr, *************************************************************************/ -void init_sam_user_info24(SAM_USER_INFO_24 * usr, - char newpass[516], uint16 passlen) +void init_sam_user_info24(SAM_USER_INFO_24 * usr, char newpass[516]) { - DEBUG(10, ("init_sam_user_info24: passlen: %d\n", passlen)); + DEBUG(10, ("init_sam_user_info24:\n")); memcpy(usr->pass, newpass, sizeof(usr->pass)); - usr->passlen = passlen; } /******************************************************************* @@ -5025,9 +5023,6 @@ static BOOL sam_io_user_info24(char *desc, SAM_USER_INFO_24 * usr, sizeof(usr->pass))) return False; - if (!prs_uint16("passlen", ps, depth, &usr->passlen)) - return False; - if(!prs_align(ps)) return False; -- cgit From 3f1254bee1b3cc8cce1e17be6f0250090f579417 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 20 Jun 2001 19:55:59 +0000 Subject: Fixed W2K SP2 joining a Samba PDC hosted domain. Jermey. (This used to be commit 05a2911403a0710d994a618e72743205a3b0b87a) --- source3/rpc_parse/parse_net.c | 4 +- source3/rpc_parse/parse_samr.c | 138 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 136 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 85de667b00..c0d9544ba8 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -883,9 +883,9 @@ void init_id_info1(NET_ID_INFO_1 *id, char *domain_name, memcpy(key, sess_key, 8); memcpy(lm_owf, lm_cypher, 16); - SamOEMhash(lm_owf, key, False); + SamOEMhash(lm_owf, key, 16); memcpy(nt_owf, nt_cypher, 16); - SamOEMhash(nt_owf, key, False); + SamOEMhash(nt_owf, key, 16); #ifdef DEBUG_PASSWORD DEBUG(100,("encrypt of lm owf password:")); diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 6e94b62d40..395931edd9 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5340,6 +5340,126 @@ static BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 * usr, 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(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_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_unknown_str ", &usr->hdr_unknown_str, 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_uint32s(False, "unknown_6 ", ps, depth, usr->unknown_6, 6)) + 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_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.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; + +#if 0 /* JRA - unknown... */ + /* ok, this is only guess-work (as usual) */ + if (usr->ptr_logon_hrs) { + if(!prs_uint32("unknown_6 ", ps, depth, &usr->unknown_6)) + return False; + if(!prs_uint32("padding4 ", ps, depth, &usr->padding4)) + return False; + if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth)) + return False; + } else if (UNMARSHALLING(ps)) { + usr->unknown_6 = 0; + usr->padding4 = 0; + } +#endif + + return True; +} + /************************************************************************* init_sam_user_info21W @@ -5740,12 +5860,12 @@ void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, uchar * sess_key, switch (switch_value) { case 0x18: - SamOEMhash(ctr->info.id24->pass, sess_key, 1); + SamOEMhash(ctr->info.id24->pass, sess_key, 516); dump_data(100, (char *)sess_key, 16); dump_data(100, (char *)ctr->info.id24->pass, 516); break; case 0x17: - SamOEMhash(ctr->info.id23->pass, sess_key, 1); + SamOEMhash(ctr->info.id23->pass, sess_key, 516); dump_data(100, (char *)sess_key, 16); dump_data(100, (char *)ctr->info.id23->pass, 516); break; @@ -5845,6 +5965,16 @@ static BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR **ppctr, } ret = sam_io_user_info24("", ctr->info.id24, ps, depth); break; + case 25: + if (UNMARSHALLING(ps)) + ctr->info.id25 = (SAM_USER_INFO_25 *)prs_alloc_mem(ps,sizeof(SAM_USER_INFO_25)); + + 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; default: DEBUG(2, ("samr_io_userinfo_ctr: unknown switch level 0x%x\n", ctr->switch_value)); ret = False; @@ -5999,8 +6129,8 @@ void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u, switch (switch_value) { case 0x12: - SamOEMhash(ctr->info.id12->lm_pwd, sess_key, 0); - SamOEMhash(ctr->info.id12->nt_pwd, sess_key, 0); + SamOEMhash(ctr->info.id12->lm_pwd, sess_key, 16); + SamOEMhash(ctr->info.id12->nt_pwd, sess_key, 16); dump_data(100, (char *)sess_key, 16); dump_data(100, (char *)ctr->info.id12->lm_pwd, 16); dump_data(100, (char *)ctr->info.id12->nt_pwd, 16); -- cgit From 3a6019b0eb8a71e8f7fb04fbce384f4478ebe2dd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 21 Jun 2001 17:46:14 +0000 Subject: Merging Gerry's spoolss changes. Jeremy. (This used to be commit 6b4a70cd8285c1e4d452e3af7df070b4c446ff54) --- source3/rpc_parse/parse_spoolss.c | 65 +++++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 84decdaf2d..a1f75fa1f3 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5255,6 +5255,57 @@ BOOL spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q /******************************************************************* ********************************************************************/ +BOOL spoolss_io_q_addprintprocessor(char *desc, SPOOL_Q_ADDPRINTPROCESSOR *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_addprintprocessor"); + 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 (!smb_io_unistr2("environment", &q_u->environment, True, ps, depth)) + return False; + + if (!prs_align(ps)) + return False; + if (!smb_io_unistr2("path", &q_u->path, True, ps, depth)) + return False; + + if (!prs_align(ps)) + return False; + if (!smb_io_unistr2("name", &q_u->name, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +BOOL spoolss_io_r_addprintprocessor(char *desc, SPOOL_R_ADDPRINTPROCESSOR *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_addprintproicessor"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("status", ps, depth, &r_u->status)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + BOOL spoolss_io_r_enumprintprocdatatypes(char *desc, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocdatatypes"); @@ -5494,12 +5545,14 @@ BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_st case 0x3: case 0x4: case 0x7: - if (UNMARSHALLING(ps)) - q_u->data=(uint8 *)prs_alloc_mem(ps, q_u->max_len * sizeof(uint8)); - if(q_u->data == NULL) - return False; - if(!prs_uint8s(False,"data", ps, depth, q_u->data, q_u->max_len)) - return False; + if (q_u->max_len) { + if (UNMARSHALLING(ps)) + q_u->data=(uint8 *)prs_alloc_mem(ps, q_u->max_len * sizeof(uint8)); + if(q_u->data == NULL) + return False; + if(!prs_uint8s(False,"data", ps, depth, q_u->data, q_u->max_len)) + return False; + } if(!prs_align(ps)) return False; break; -- cgit From 9a89a5b4fadfe95ffad299a2bd08f7dfaaec707f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 22 Jun 2001 02:37:52 +0000 Subject: Removed unused (and potentially crash-causing) free function. Jeremy. (This used to be commit 54ea00fa870f258b885b18e8684caa8488948607) --- source3/rpc_parse/parse_lsa.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 9a7ae0f060..18ed6943ec 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -625,20 +625,6 @@ BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, return True; } -void lsa_free_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM * r_e) -{ - safe_free(r_e->uni_domain_name); - safe_free(r_e->hdr_domain_name); - safe_free(r_e->domain_sid); - - r_e->uni_domain_name = NULL; - r_e->hdr_domain_name = NULL; - r_e->domain_sid = NULL; - - r_e->num_domains = 0; - r_e->ptr_enum_domains = 0; -} - /******************************************************************* reads or writes a dom query structure. ********************************************************************/ -- cgit From 3281f6f076a13b78f3a688775993c9139526d6a3 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 22 Jun 2001 14:18:27 +0000 Subject: sync this function with 2.2 (single check for NULL parameter) (This used to be commit 3ab50e648d682080308d2db6bdb71eef0e303988) --- source3/rpc_parse/parse_net.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index c0d9544ba8..d7253a53fd 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -188,6 +188,9 @@ static BOOL net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, BOOL net_io_q_logon_ctrl2(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++; -- cgit From 6e0605c3ab266749a411fe50301020fac52eea98 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 25 Jun 2001 06:13:27 +0000 Subject: Cosmetic fixups found while playing with the server manager. Added support for NET_SRV_SET_INFO rpc call which is made when double-clicking on a computer in the server manager and changing the description. We always return NT_STATUS_NOPROBLEMO as NT doesn't seem to decode any error messages passed back. Maybe the changed comment string could be stored in a tdb and regurgitated instead of the "server string" smb.conf parameter? (This used to be commit d936ffedd90fe442f990c9ac2e172877f28d7230) --- source3/rpc_parse/parse_srv.c | 73 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 9661b4edf1..6d24617f36 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1,4 +1,3 @@ - /* * Unix SMB/Netbios implementation. * Version 1.9. @@ -2258,6 +2257,57 @@ void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv, srv->status = status; } +/******************************************************************* + Inits a SRV_R_NET_SRV_SET_INFO structure. + ********************************************************************/ + +void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv, + uint32 switch_value, uint32 status) +{ + DEBUG(5,("init_srv_r_net_srv_set_info\n")); + + srv->switch_value = switch_value; + srv->status = status; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_srv_set_info(char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) + return False; + + if (UNMARSHALLING(ps)) { + q_n->ctr = (SRV_INFO_CTR *) + prs_alloc_mem(ps, sizeof(SRV_INFO_CTR)); + + if (!q_n->ctr) + return False; + } + + if(!srv_io_info_ctr("ctr", q_n->ctr, ps, depth)) + return False; + + return True; +} + /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -2282,6 +2332,27 @@ BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_stru return True; } +/******************************************************************* + Reads or writes a structure. + ********************************************************************/ + +BOOL srv_io_r_net_srv_set_info(char *desc, SRV_R_NET_SRV_SET_INFO *r_n, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "srv_io_r_net_srv_set_info"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value)) + return False; + + if(!prs_uint32("status ", ps, depth, &r_n->status)) + return False; + + return True; +} /******************************************************************* Reads or writes a structure. -- cgit From 742609a21d4354d12ffee275acccd854e29520bd Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 26 Jun 2001 06:11:40 +0000 Subject: Fixed bug introduced by changeover of security descriptor code from malloc() to talloc(). Previously, creating an ACL containing zero ACEs would return a non-NULL pointer to zero bytes of memory. The talloc() code would return a NULL pointer making the ACL a NULL ACL instead of an empty one. The difference is a NULL ACL allows all access and an empty ACL denies all access. We solve this by calling talloc(ctx, sizeof(SEC_ACE) * num_aces + 1). Heh. (This used to be commit 89eaaafe7d266788609fab6951fd912c441b3a26) --- source3/rpc_parse/parse_sec.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index e5d3a6ce43..7cc4d054fa 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -135,7 +135,14 @@ SEC_ACL *make_sec_acl(TALLOC_CTX *ctx, uint16 revision, int num_aces, SEC_ACE *a dst->num_aces = num_aces; dst->size = 8; - if((dst->ace = (SEC_ACE *)talloc(ctx, sizeof(SEC_ACE) * num_aces )) == NULL) { + /* Now we need to return a non-NULL address for the ace list even + if the number of aces required is zero. This is because there + is a distinct difference between a NULL ace and an ace with zero + entries in it. This is achieved by always making the number of + bytes allocated by talloc() positive. Heh. */ + + if((dst->ace = (SEC_ACE *)talloc(ctx, sizeof(SEC_ACE) * num_aces + 1)) + == NULL) { return NULL; } -- cgit From 96ff4b8ee260079038cd87bf0aa35fcfe498666b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 26 Jun 2001 06:31:55 +0000 Subject: Ensure we always have a valid pointer on unmarshalling an SD with zero ace entries. Jeremy. (This used to be commit 274c0f5028d41175222dfaaf446e3ed8f5687a5f) --- source3/rpc_parse/parse_sec.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 7cc4d054fa..b202c2a356 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -211,9 +211,13 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) if(!prs_uint32("num_aces ", ps, depth, &psa->num_aces)) return False; - if (UNMARSHALLING(ps) && psa->num_aces != 0) { - /* reading */ - if((psa->ace = (SEC_ACE *)prs_alloc_mem(ps,sizeof(psa->ace[0]) * psa->num_aces)) == NULL) + if (UNMARSHALLING(ps)) { + /* + * Even if the num_aces is zero, allocate memory as there's a difference + * between a non-present DACL (allow all access) and a DACL with no ACE's + * (allow no access). + */ + if((psa->ace = (SEC_ACE *)prs_alloc_mem(ps,sizeof(psa->ace[0]) * (psa->num_aces+1))) == NULL) return False; } -- cgit From c2cfcb34e1fdef24ac7979bb0f77340d27fc6926 Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Tue, 26 Jun 2001 20:23:45 +0000 Subject: SGI compiler fixes. Jeremy (This used to be commit 45bf995bf62aa6cc176d57e2f954cc2d379717ef) --- source3/rpc_parse/parse_spoolss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index a1f75fa1f3..2b81a7708c 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3568,13 +3568,13 @@ BOOL make_spoolss_q_setprinter( q_u->secdesc_ctr->max_len = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0; q_u->secdesc_ctr->len = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0; q_u->secdesc_ctr->sec = secdesc; - + q_u->devmode_ctr.devmode_ptr = (devmode != NULL) ? 1 : 0; q_u->devmode_ctr.size = sizeof(DEVICEMODE) + (3*sizeof(uint32)); q_u->devmode_ctr.devmode = devmode; #else q_u->secdesc_ctr = NULL; - + q_u->devmode_ctr.devmode_ptr = 0; q_u->devmode_ctr.size = 0; q_u->devmode_ctr.devmode = NULL; -- cgit From 00ecce9630680d21effdef11fbd6afbe0eab8196 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 29 Jun 2001 07:55:41 +0000 Subject: Removed another silly static array. (This used to be commit 008628fb8ac9f92d984218f37fffdfa3cb9e3d62) --- source3/rpc_parse/parse_samr.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 395931edd9..c4fd679003 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -23,7 +23,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - #include "includes.h" #include "rpc_parse.h" #include "nterr.h" @@ -1435,16 +1434,28 @@ static BOOL sam_io_sam_dispinfo_1(char *desc, SAM_DISPINFO_1 * sam, { uint32 i; - if (sam == NULL) - return False; - prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_1"); depth++; if(!prs_align(ps)) return False; - SMB_ASSERT_ARRAY(sam->sam, num_entries); + if (UNMARSHALLING(ps) && num_entries > 0) { + + if ((sam->sam = (SAM_ENTRY1 *) + prs_alloc_mem(ps, sizeof(SAM_ENTRY1) * + num_entries)) == NULL) { + DEBUG(0, ("out of memory allocating SAM_ENTRY1\n")); + return False; + } + + if ((sam->str = (SAM_STR1 *) + prs_alloc_mem(ps, sizeof(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)) -- cgit From 2cddd5fe8ca05cd642428b4a7e2356f05cee6386 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 29 Jun 2001 18:41:31 +0000 Subject: From JF.... hi jeremy, can you commit the following patch against HEAD. I can't do it right now Thanks Tim for me. He changed the SAM_DISPINFO_1 array without checking if he didn't break the server code. And he did. So on my way I cleaned info_1, 2, .. 5 it may break winbind. I leave to tim the pleasure to fix it ;-) jf. I added some talloc changes and checks for alloc fails. Jeremy. (This used to be commit 001e9b7b540f04c80ba65c879aaa41acddc86f3e) --- source3/rpc_parse/parse_samr.c | 120 +++++++++++++++++++++++++++++++---------- 1 file changed, 93 insertions(+), 27 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index c4fd679003..b173b34403 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1386,7 +1386,7 @@ BOOL samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO * q_e, inits a SAM_DISPINFO_1 structure. ********************************************************************/ -void init_sam_dispinfo_1(SAM_DISPINFO_1 * sam, uint32 *num_entries, +uint32 init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 *num_entries, uint32 *data_size, uint32 start_idx, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) { @@ -1403,7 +1403,19 @@ void init_sam_dispinfo_1(SAM_DISPINFO_1 * sam, uint32 *num_entries, DEBUG(5, ("init_sam_dispinfo_1: max_entries: %d max_dsize: 0x%x\n", max_entries, max_data_size)); + sam->sam=(SAM_ENTRY1 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY1)); + if (!sam->sam) + return NT_STATUS_NO_MEMORY; + + sam->str=(SAM_STR1 *)talloc(ctx, max_entries*sizeof(SAM_STR1)); + if (!sam->str) + return NT_STATUS_NO_MEMORY; + + ZERO_STRUCTP(sam->sam); + ZERO_STRUCTP(sam->str); + for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) { + DEBUG(5, ("init_sam_dispinfo_1: entry: %d\n",i)); len_sam_name = pass[i].uni_user_name.uni_str_len; len_sam_full = pass[i].uni_full_name.uni_str_len; len_sam_desc = pass[i].uni_acct_desc.uni_str_len; @@ -1412,6 +1424,10 @@ void init_sam_dispinfo_1(SAM_DISPINFO_1 * sam, uint32 *num_entries, len_sam_name, len_sam_full, len_sam_desc, pass[i].user_rid, pass[i].acb_info); + ZERO_STRUCTP(&sam->str[i].uni_acct_name); + ZERO_STRUCTP(&sam->str[i].uni_full_name); + ZERO_STRUCTP(&sam->str[i].uni_acct_desc); + copy_unistr2(&sam->str[i].uni_acct_name, &pass[i].uni_user_name); copy_unistr2(&sam->str[i].uni_full_name, &pass[i].uni_full_name); copy_unistr2(&sam->str[i].uni_acct_desc, &pass[i].uni_acct_desc); @@ -1422,6 +1438,8 @@ void init_sam_dispinfo_1(SAM_DISPINFO_1 * sam, uint32 *num_entries, *num_entries = i; *data_size = dsize; + + return NT_STATUS_NO_PROBLEMO; } /******************************************************************* @@ -1477,7 +1495,7 @@ static BOOL sam_io_sam_dispinfo_1(char *desc, SAM_DISPINFO_1 * sam, inits a SAM_DISPINFO_2 structure. ********************************************************************/ -void init_sam_dispinfo_2(SAM_DISPINFO_2 * sam, uint32 *num_entries, +uint32 init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 *num_entries, uint32 *data_size, uint32 start_idx, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) { @@ -1493,6 +1511,15 @@ void init_sam_dispinfo_2(SAM_DISPINFO_2 * sam, uint32 *num_entries, max_entries = *num_entries; max_data_size = *data_size; + if (!(sam->sam=(SAM_ENTRY2 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY2)))) + return NT_STATUS_NO_MEMORY; + + if (!(sam->str=(SAM_STR2 *)talloc(ctx, max_entries*sizeof(SAM_STR2)))) + return NT_STATUS_NO_MEMORY; + + ZERO_STRUCTP(sam->sam); + ZERO_STRUCTP(sam->str); + for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) { len_sam_name = pass[i].uni_user_name.uni_str_len; len_sam_desc = pass[i].uni_acct_desc.uni_str_len; @@ -1501,10 +1528,11 @@ void init_sam_dispinfo_2(SAM_DISPINFO_2 * sam, uint32 *num_entries, len_sam_name, len_sam_desc, pass[i].user_rid, pass[i].acb_info); - copy_unistr2(&sam->str[i].uni_srv_name, - &pass[i].uni_user_name); - copy_unistr2(&sam->str[i].uni_srv_desc, - &pass[i].uni_acct_desc); + ZERO_STRUCTP(&sam->str[i].uni_srv_name); + ZERO_STRUCTP(&sam->str[i].uni_srv_desc); + + copy_unistr2(&sam->str[i].uni_srv_name, &pass[i].uni_user_name); + copy_unistr2(&sam->str[i].uni_srv_desc, &pass[i].uni_acct_desc); dsize += sizeof(SAM_ENTRY2); dsize += len_sam_name + len_sam_desc; @@ -1512,6 +1540,8 @@ void init_sam_dispinfo_2(SAM_DISPINFO_2 * sam, uint32 *num_entries, *num_entries = i; *data_size = dsize; + + return NT_STATUS_NO_PROBLEMO; } /******************************************************************* @@ -1554,7 +1584,7 @@ static BOOL sam_io_sam_dispinfo_2(char *desc, SAM_DISPINFO_2 * sam, inits a SAM_DISPINFO_3 structure. ********************************************************************/ -void init_sam_dispinfo_3(SAM_DISPINFO_3 * sam, uint32 *num_entries, +uint32 init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 *num_entries, uint32 *data_size, uint32 start_idx, DOMAIN_GRP * grp) { @@ -1570,6 +1600,15 @@ void init_sam_dispinfo_3(SAM_DISPINFO_3 * sam, uint32 *num_entries, max_entries = *num_entries; max_data_size = *data_size; + if (!(sam->sam=(SAM_ENTRY3 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY3)))) + return NT_STATUS_NO_MEMORY; + + if (!(sam->str=(SAM_STR3 *)talloc(ctx, max_entries*sizeof(SAM_STR3)))) + return NT_STATUS_NO_MEMORY; + + ZERO_STRUCTP(sam->sam); + ZERO_STRUCTP(sam->str); + for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) { len_sam_name = strlen(grp[i].name); len_sam_desc = strlen(grp[i].comment); @@ -1586,6 +1625,8 @@ void init_sam_dispinfo_3(SAM_DISPINFO_3 * sam, uint32 *num_entries, *num_entries = i; *data_size = dsize; + + return NT_STATUS_NO_PROBLEMO; } /******************************************************************* @@ -1628,7 +1669,7 @@ static BOOL sam_io_sam_dispinfo_3(char *desc, SAM_DISPINFO_3 * sam, inits a SAM_DISPINFO_4 structure. ********************************************************************/ -void init_sam_dispinfo_4(SAM_DISPINFO_4 * sam, uint32 *num_entries, +uint32 init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 *num_entries, uint32 *data_size, uint32 start_idx, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) { @@ -1645,16 +1686,22 @@ void init_sam_dispinfo_4(SAM_DISPINFO_4 * sam, uint32 *num_entries, max_entries = *num_entries; max_data_size = *data_size; + if (!(sam->sam=(SAM_ENTRY4 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY4)))) + return NT_STATUS_NO_MEMORY; + + if (!(sam->str=(SAM_STR4 *)talloc(ctx, max_entries*sizeof(SAM_STR4)))) + return NT_STATUS_NO_MEMORY; + + ZERO_STRUCTP(sam->sam); + ZERO_STRUCTP(sam->str); + for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) { len_sam_name = pass[i].uni_user_name.uni_str_len; - init_sam_entry4(&sam->sam[i], start_idx + i + 1, - len_sam_name); - - unistr2_to_ascii(sam_name, &pass[i].uni_user_name, - sizeof(sam_name)); - init_string2(&sam->str[i].acct_name, sam_name, - len_sam_name); + init_sam_entry4(&sam->sam[i], start_idx + i + 1, len_sam_name); + + unistr2_to_ascii(sam_name, &pass[i].uni_user_name, sizeof(sam_name)); + init_string2(&sam->str[i].acct_name, sam_name, len_sam_name); dsize += sizeof(SAM_ENTRY4); dsize += len_sam_name; @@ -1662,6 +1709,8 @@ void init_sam_dispinfo_4(SAM_DISPINFO_4 * sam, uint32 *num_entries, *num_entries = i; *data_size = dsize; + + return NT_STATUS_NO_PROBLEMO; } /******************************************************************* @@ -1705,7 +1754,7 @@ static BOOL sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 * sam, inits a SAM_DISPINFO_5 structure. ********************************************************************/ -void init_sam_dispinfo_5(SAM_DISPINFO_5 * sam, uint32 *num_entries, +uint32 init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 *num_entries, uint32 *data_size, uint32 start_idx, DOMAIN_GRP * grp) { @@ -1721,14 +1770,20 @@ void init_sam_dispinfo_5(SAM_DISPINFO_5 * sam, uint32 *num_entries, max_entries = *num_entries; max_data_size = *data_size; + if (!(sam->sam=(SAM_ENTRY5 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY5)))) + return NT_STATUS_NO_MEMORY; + + if (!(sam->str=(SAM_STR5 *)talloc(ctx, max_entries*sizeof(SAM_STR5)))) + return NT_STATUS_NO_MEMORY; + + ZERO_STRUCTP(sam->sam); + ZERO_STRUCTP(sam->str); + for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) { len_sam_name = strlen(grp[i].name); - init_sam_entry5(&sam->sam[i], start_idx + i + 1, - len_sam_name); - - init_string2(&sam->str[i].grp_name, grp[i].name, - len_sam_name); + init_sam_entry5(&sam->sam[i], start_idx + i + 1, len_sam_name); + init_string2(&sam->str[i].grp_name, grp[i].name, len_sam_name); dsize += sizeof(SAM_ENTRY5); dsize += len_sam_name; @@ -1736,6 +1791,8 @@ void init_sam_dispinfo_5(SAM_DISPINFO_5 * sam, uint32 *num_entries, *num_entries = i; *data_size = dsize; + + return NT_STATUS_NO_PROBLEMO; } /******************************************************************* @@ -4302,7 +4359,7 @@ BOOL samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM * r_u, inits a SAMR_Q_LOOKUP_NAMES structure. ********************************************************************/ -void init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, +uint32 init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, POLICY_HND *pol, uint32 flags, uint32 num_names, char **name) { @@ -4317,14 +4374,19 @@ void init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, q_u->ptr = 0; q_u->num_names2 = num_names; - q_u->hdr_name = (UNIHDR *)talloc_zero(ctx, num_names * sizeof(UNIHDR)); - q_u->uni_name = (UNISTR2 *)talloc_zero(ctx, num_names * sizeof(UNISTR2)); + if (!(q_u->hdr_name = (UNIHDR *)talloc_zero(ctx, num_names * sizeof(UNIHDR)))) + return NT_STATUS_NO_MEMORY; + + if (!(q_u->uni_name = (UNISTR2 *)talloc_zero(ctx, num_names * sizeof(UNISTR2)))) + return NT_STATUS_NO_MEMORY; for (i = 0; i < num_names; i++) { int len_name = name[i] != NULL ? strlen(name[i]) : 0; init_uni_hdr(&q_u->hdr_name[i], len_name); /* unicode header for user_name */ init_unistr2(&q_u->uni_name[i], name[i], len_name); /* unicode string for machine account */ } + + return NT_STATUS_NO_PROBLEMO; } /******************************************************************* @@ -4386,7 +4448,7 @@ BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES * q_u, inits a SAMR_R_LOOKUP_NAMES structure. ********************************************************************/ -void init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, +uint32 init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, uint32 num_rids, uint32 *rid, uint32 *type, uint32 status) @@ -4404,8 +4466,10 @@ void init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, r_u->ptr_rids = 1; r_u->num_rids2 = num_rids; - r_u->rids = (uint32 *)talloc_zero(ctx, sizeof(uint32)*num_rids); - r_u->types = (uint32 *)talloc_zero(ctx, sizeof(uint32)*num_rids); + if (!(r_u->rids = (uint32 *)talloc_zero(ctx, sizeof(uint32)*num_rids))) + return NT_STATUS_NO_MEMORY; + if (!(r_u->types = (uint32 *)talloc_zero(ctx, sizeof(uint32)*num_rids))) + return NT_STATUS_NO_MEMORY; if (!r_u->rids || !r_u->types) goto empty; @@ -4430,6 +4494,8 @@ void init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, } r_u->status = status; + + return NT_STATUS_NO_PROBLEMO; } /******************************************************************* -- cgit From 8d0b9cf534bc2a219ff4fc47ab139efa994cd7d6 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 29 Jun 2001 23:12:55 +0000 Subject: Added LsaGetConnectedCredentials patch from Manoj Naik . Jeremy. (This used to be commit 7079300da6dbd950e55dc5871851250d5a3717ff) --- source3/rpc_parse/parse_lsa.c | 70 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 18ed6943ec..5abcfb9eef 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1281,3 +1281,73 @@ BOOL lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_c, prs_struct *ps, in return True; } + +/******************************************************************* + Reads or writes an LSA_Q_UNK_GET_CONNUSER structure. +********************************************************************/ + +BOOL lsa_io_q_unk_get_connuser(char *desc, LSA_Q_UNK_GET_CONNUSER *q_c, 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, &q_c->ptr_srvname)) + return False; + + if(!smb_io_unistr2("uni2_srvname", &q_c->uni2_srvname, q_c->ptr_srvname, ps, depth)) /* server name to be looked up */ + return False; + + if(!prs_uint32("unk1", ps, depth, &q_c->unk1)) + return False; + if(!prs_uint32("unk2", ps, depth, &q_c->unk2)) + return False; + if(!prs_uint32("unk3", ps, depth, &q_c->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(char *desc, LSA_R_UNK_GET_CONNUSER *r_c, 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, &r_c->ptr_user_name)) + return False; + if(!smb_io_unihdr("hdr_user_name", &r_c->hdr_user_name, ps, depth)) + return False; + if(!smb_io_unistr2("uni2_user_name", &r_c->uni2_user_name, r_c->ptr_user_name, ps, depth)) + return False; + + if (!prs_align(ps)) + return False; + + if(!prs_uint32("unk1", ps, depth, &r_c->unk1)) + return False; + + if(!prs_uint32("ptr_dom_name", ps, depth, &r_c->ptr_dom_name)) + return False; + if(!smb_io_unihdr("hdr_dom_name", &r_c->hdr_dom_name, ps, depth)) + return False; + if(!smb_io_unistr2("uni2_dom_name", &r_c->uni2_dom_name, r_c->ptr_dom_name, ps, depth)) + return False; + + if (!prs_align(ps)) + return False; + + if(!prs_uint32("status", ps, depth, &r_c->status)) + return False; + + return True; +} -- cgit From 3d90180af46f8d306c12ffff12c8d57ce1b4cd8b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 2 Jul 2001 21:23:13 +0000 Subject: Fixed auto-alloc of dispinfo code when unmarshalling. Jeremy. (This used to be commit d4872c94c2e6b63be0fb12e5dd2d0459fda54959) --- source3/rpc_parse/parse_samr.c | 68 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index b173b34403..ec5af24d6a 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1563,7 +1563,22 @@ static BOOL sam_io_sam_dispinfo_2(char *desc, SAM_DISPINFO_2 * sam, if(!prs_align(ps)) return False; - SMB_ASSERT_ARRAY(sam->sam, num_entries); + if (UNMARSHALLING(ps) && num_entries > 0) { + + if ((sam->sam = (SAM_ENTRY2 *) + prs_alloc_mem(ps, sizeof(SAM_ENTRY2) * + num_entries)) == NULL) { + DEBUG(0, ("out of memory allocating SAM_ENTRY2\n")); + return False; + } + + if ((sam->str = (SAM_STR2 *) + prs_alloc_mem(ps, sizeof(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)) @@ -1648,7 +1663,22 @@ static BOOL sam_io_sam_dispinfo_3(char *desc, SAM_DISPINFO_3 * sam, if(!prs_align(ps)) return False; - SMB_ASSERT_ARRAY(sam->sam, num_entries); + if (UNMARSHALLING(ps) && num_entries > 0) { + + if ((sam->sam = (SAM_ENTRY3 *) + prs_alloc_mem(ps, sizeof(SAM_ENTRY3) * + num_entries)) == NULL) { + DEBUG(0, ("out of memory allocating SAM_ENTRY3\n")); + return False; + } + + if ((sam->str = (SAM_STR3 *) + prs_alloc_mem(ps, sizeof(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)) @@ -1732,7 +1762,22 @@ static BOOL sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 * sam, if(!prs_align(ps)) return False; - SMB_ASSERT_ARRAY(sam->sam, num_entries); + if (UNMARSHALLING(ps) && num_entries > 0) { + + if ((sam->sam = (SAM_ENTRY4 *) + prs_alloc_mem(ps, sizeof(SAM_ENTRY4) * + num_entries)) == NULL) { + DEBUG(0, ("out of memory allocating SAM_ENTRY4\n")); + return False; + } + + if ((sam->str = (SAM_STR4 *) + prs_alloc_mem(ps, sizeof(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)) @@ -1814,7 +1859,22 @@ static BOOL sam_io_sam_dispinfo_5(char *desc, SAM_DISPINFO_5 * sam, if(!prs_align(ps)) return False; - SMB_ASSERT_ARRAY(sam->sam, num_entries); + if (UNMARSHALLING(ps) && num_entries > 0) { + + if ((sam->sam = (SAM_ENTRY5 *) + prs_alloc_mem(ps, sizeof(SAM_ENTRY5) * + num_entries)) == NULL) { + DEBUG(0, ("out of memory allocating SAM_ENTRY5\n")); + return False; + } + + if ((sam->str = (SAM_STR5 *) + prs_alloc_mem(ps, sizeof(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)) -- cgit From 6780f050e1d909cdfcdeeb7be32fa5beed3bd437 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 2 Jul 2001 21:56:20 +0000 Subject: Missing prs_align() was causing Win9x nexus tools to fail. security_info_sent was being miss-parsed. Jeremy. (This used to be commit 1685e41da04f1fbbab036e194ce1b1e7ba9fef86) --- source3/rpc_parse/parse_srv.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 6d24617f36..637b834266 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -2755,6 +2755,9 @@ BOOL srv_io_q_net_file_set_secdesc(char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth)) return False; + if(!prs_align(ps)) + return False; + if(!prs_uint32("sec_info", ps, depth, &q_n->sec_info)) return False; -- cgit From 87fbb7092b8f8b2f0db0f361c3d625e19de57cd9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 4 Jul 2001 07:15:53 +0000 Subject: The big character set handling changeover! This commit gets rid of all our old codepage handling and replaces it with iconv. All internal strings in Samba are now in "unix" charset, which may be multi-byte. See internals.doc and my posting to samba-technical for a more complete explanation. (This used to be commit debb471267960e56005a741817ebd227ecfc512a) --- source3/rpc_parse/parse_misc.c | 15 ++++++--------- source3/rpc_parse/parse_rpc.c | 7 ++++--- source3/rpc_parse/parse_spoolss.c | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 4b118dd2b4..216a6e2eca 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -539,8 +539,7 @@ void init_unistr(UNISTR *str, const char *buf) if (str->buffer == NULL) smb_panic("init_unistr: malloc fail\n"); - /* store the string (null-terminated copy) */ - dos_struni2((char *)str->buffer, buf, len); + rpcstr_push(str->buffer, buf, len, STR_TERMINATE); } /******************************************************************* @@ -605,12 +604,12 @@ void init_buffer3_str(BUFFER3 *str, char *buf, int len) /* set up string lengths. */ str->buf_max_len = len * 2; - str->buf_len = len * 2; + str->buf_len = len * 2; create_buffer3(str, str->buf_max_len); - /* store the string (null-terminated 8 bit chars into 16 bit chars) */ - dos_struni2((char *)str->buffer, buf, str->buf_max_len); + rpcstr_push(str->buffer, buf, str->buf_max_len, STR_TERMINATE); + } /******************************************************************* @@ -911,8 +910,7 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len) return; } - /* store the string (null-terminated 8 bit chars into 16 bit chars) */ - dos_struni2((char *)str->buffer, buf, len); + rpcstr_push((char *)str->buffer, buf, len, STR_TERMINATE); } /******************************************************************* @@ -1483,8 +1481,7 @@ void init_unistr3(UNISTR3 *str, const char *buf) if (str->str.buffer == NULL) smb_panic("init_unistr3: malloc fail\n"); - /* store the string (null-terminated copy) */ - dos_struni2((char *)str->str.buffer, buf, len); + rpcstr_push((char *)str->str.buffer, buf, len, STR_TERMINATE); } /******************************************************************* diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index f330c5947e..a60bad0aa2 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -877,14 +877,15 @@ void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, memcpy(rsp->nt_resp, nt_resp, 24); if (neg_flags & NTLMSSP_NEGOTIATE_UNICODE) { - dos_struni2(rsp->domain, domain, sizeof(rsp->domain)); - dos_struni2(rsp->user, user, sizeof(rsp->user)); - dos_struni2(rsp->wks, wks, sizeof(rsp->wks)); + rpcstr_push(rsp->domain, domain, sizeof(rsp->domain), 0); + rpcstr_push(rsp->user, user, sizeof(rsp->user), 0); + rpcstr_push(rsp->wks, wks, sizeof(rsp->wks), 0); } else { fstrcpy(rsp->domain, domain); fstrcpy(rsp->user, user); fstrcpy(rsp->wks, wks); } + rsp->sess_key[0] = 0; } diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 2b81a7708c..b303bf108e 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4713,7 +4713,7 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) *ar = NULL; while (src < ((char *)buf5->buffer) + buf5->buf_len*2) { - unistr_to_dos(f, src, sizeof(f)-1); + rpcstr_pull(f, src, sizeof(f)-1, -1, 0); src = skip_unibuf(src, 2*buf5->buf_len - PTR_DIFF(src,buf5->buffer)); *ar = (fstring *)Realloc(*ar, sizeof(fstring)*(n+2)); fstrcpy((*ar)[n], f); -- cgit From df68e652d6411f11d9cb00aefb15c8a62ef1f149 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 6 Jul 2001 17:40:16 +0000 Subject: Added JF's fix for max_entries being 0. Jeremy. (This used to be commit 5059fbbb76ffa24658a878080a36e355df4894f5) --- source3/rpc_parse/parse_samr.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ec5af24d6a..a7d758ea1b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1403,6 +1403,9 @@ uint32 init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 *num_ent DEBUG(5, ("init_sam_dispinfo_1: max_entries: %d max_dsize: 0x%x\n", max_entries, max_data_size)); + if (max_entries==0) + return NT_STATUS_NO_PROBLEMO; + sam->sam=(SAM_ENTRY1 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY1)); if (!sam->sam) return NT_STATUS_NO_MEMORY; @@ -1511,6 +1514,9 @@ uint32 init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 *num_ent max_entries = *num_entries; max_data_size = *data_size; + if (max_entries==0) + return NT_STATUS_NO_PROBLEMO; + if (!(sam->sam=(SAM_ENTRY2 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY2)))) return NT_STATUS_NO_MEMORY; @@ -1615,6 +1621,9 @@ uint32 init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 *num_ent max_entries = *num_entries; max_data_size = *data_size; + if (max_entries==0) + return NT_STATUS_NO_PROBLEMO; + if (!(sam->sam=(SAM_ENTRY3 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY3)))) return NT_STATUS_NO_MEMORY; @@ -1716,6 +1725,9 @@ uint32 init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 *num_ent max_entries = *num_entries; max_data_size = *data_size; + if (max_entries==0) + return NT_STATUS_NO_PROBLEMO; + if (!(sam->sam=(SAM_ENTRY4 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY4)))) return NT_STATUS_NO_MEMORY; @@ -1815,6 +1827,9 @@ uint32 init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 *num_ent max_entries = *num_entries; max_data_size = *data_size; + if (max_entries==0) + return NT_STATUS_NO_PROBLEMO; + if (!(sam->sam=(SAM_ENTRY5 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY5)))) return NT_STATUS_NO_MEMORY; -- cgit From db77d64a2020ddcde5039dbd1572c7ba78abc8ec Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 9 Jul 2001 18:21:03 +0000 Subject: when converting ascii to unicode, if the ascii string is NULL, don't convert it, rpcstr_push doesn't like it. (This used to be commit a8006e6f3eb1e06f4d48727de31e1229d6eef58a) --- source3/rpc_parse/parse_misc.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 216a6e2eca..857f964e31 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -910,6 +910,13 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len) return; } + /* + * don't move this test above ! The UNISTR2 must be initialized !!! + * jfm, 7/7/2001. + */ + if (buf==NULL) + return; + rpcstr_push((char *)str->buffer, buf, len, STR_TERMINATE); } -- cgit From 62d399f3cf588b8b2f31672111ac67034009ee78 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 9 Jul 2001 18:25:40 +0000 Subject: add query user info level 20 (for RAS) add query dominfo level 5 some cleanup, don't free talloced memory. implement delete domain and local groups. J.F. (This used to be commit 3f14dda2a21850edfd540be2624867e5f70a382c) --- source3/rpc_parse/parse_samr.c | 84 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a7d758ea1b..76ec35e9c7 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -593,6 +593,40 @@ static BOOL sam_io_unk_info12(char *desc, SAM_UNK_INFO_12 * u_12, return True; } +/******************************************************************* +inits a structure. +********************************************************************/ +void init_unk_info5(SAM_UNK_INFO_5 * u_5,char *server) +{ + int len_server = strlen(server); + + init_uni_hdr(&u_5->hdr_server, len_server); + + init_unistr2(&u_5->uni_server, server, len_server); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +static BOOL sam_io_unk_info5(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_server", &u_5->hdr_server, ps, depth)) + return False; + + if(!smb_io_unistr2("uni_server", &u_5->uni_server, u_5->hdr_server.buffer, ps, depth)) + return False; + + return True; +} + /******************************************************************* inits a structure. ********************************************************************/ @@ -781,6 +815,10 @@ BOOL samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, 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 0x03: if(!sam_io_unk_info3("unk_inf3",&r_u->ctr->info.inf3, ps,depth)) return False; @@ -5930,6 +5968,42 @@ static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 * usr, return True; } +void init_sam_user_info20A(SAM_USER_INFO_20 *usr, SAM_ACCOUNT *pw) +{ + int len_munged_dial; + char* munged_dial = pdb_get_munged_dial(pw); + + len_munged_dial = munged_dial != NULL ? strlen(munged_dial )+1 : 0; + init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); + init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial); + +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +static BOOL sam_io_user_info20(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. ********************************************************************/ @@ -6087,6 +6161,16 @@ static BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR **ppctr, } ret = sam_io_user_info12("", ctr->info.id12, ps, depth); break; + case 20: + if (UNMARSHALLING(ps)) + ctr->info.id20 = (SAM_USER_INFO_20 *)prs_alloc_mem(ps,sizeof(SAM_USER_INFO_20)); + + 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 = (SAM_USER_INFO_21 *)prs_alloc_mem(ps,sizeof(SAM_USER_INFO_21)); -- cgit From 0a33cb45c1a30143d3587b102b0cde31158d7788 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 9 Jul 2001 18:32:54 +0000 Subject: implement: LSA_ENUM_PRIVS LSA_PRIV_GET_DISPNAME LSA_ENUM_ACCOUNTS LSA_OPENACCOUNT LSA_ENUMPRIVSACCOUNT LSA_GETSYSTEMACCOUNT It's a work in progress. nobody should expect it to work J.F. (This used to be commit 3056357cd8d4b2460f73ba8a8931a143f07fa2a6) --- source3/rpc_parse/parse_lsa.c | 476 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 476 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 5abcfb9eef..d07c91e137 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1282,6 +1282,263 @@ BOOL lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_c, prs_struct *ps, in return True; } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL lsa_io_q_enum_privs(char *desc, LSA_Q_ENUM_PRIVS *q_q, prs_struct *ps, int depth) +{ + if (q_q == NULL) + return False; + + prs_debug(ps, depth, desc, "lsa_io_q_enum_privs"); + depth++; + + if (!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + return False; + + if(!prs_uint32("enum_context ", ps, depth, &q_q->enum_context)) + return False; + if(!prs_uint32("pref_max_length", ps, depth, &q_q->pref_max_length)) + return False; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL lsa_io_priv_entries(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 *r_u, uint32 enum_context, + uint32 count, LSA_PRIV_ENTRY *entries) +{ + DEBUG(5, ("init_lsa_r_enum_privs\n")); + + r_u->enum_context=enum_context; + r_u->count=count; + + if (entries!=NULL) { + r_u->ptr=1; + r_u->count1=count; + r_u->privs=entries; + } else { + r_u->ptr=0; + r_u->count1=0; + r_u->privs=NULL; + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL lsa_io_r_enum_privs(char *desc, LSA_R_ENUM_PRIVS *r_q, prs_struct *ps, int depth) +{ + if (r_q == 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, &r_q->enum_context)) + return False; + if(!prs_uint32("count", ps, depth, &r_q->count)) + return False; + if(!prs_uint32("ptr", ps, depth, &r_q->ptr)) + return False; + + if (r_q->ptr) { + if(!prs_uint32("count1", ps, depth, &r_q->count1)) + return False; + + if (!lsa_io_priv_entries("", r_q->privs, r_q->count1, ps, depth)) + return False; + } + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("status", ps, depth, &r_q->status)) + return False; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL lsa_io_q_priv_get_dispname(char *desc, LSA_Q_PRIV_GET_DISPNAME *q_q, prs_struct *ps, int depth) +{ + if (q_q == 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("", &q_q->pol, ps, depth)) + return False; + + if (!smb_io_unihdr("hdr_name", &q_q->hdr_name, ps, depth)) + return False; + + if (!smb_io_unistr2("name", &q_q->name, q_q->hdr_name.buffer, ps, depth)) + return False; + + if(!prs_uint16("lang_id ", ps, depth, &q_q->lang_id)) + return False; + if(!prs_uint16("lang_id_sys", ps, depth, &q_q->lang_id_sys)) + return False; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL lsa_io_r_priv_get_dispname(char *desc, LSA_R_PRIV_GET_DISPNAME *r_q, prs_struct *ps, int depth) +{ + if (r_q == 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, &r_q->ptr_info)) + return False; + + if (r_q->ptr_info){ + if (!smb_io_unihdr("hdr_name", &r_q->hdr_desc, ps, depth)) + return False; + + if (!smb_io_unistr2("desc", &r_q->desc, r_q->hdr_desc.buffer, ps, depth)) + return False; + } +/* + if(!prs_align(ps)) + return False; +*/ + if(!prs_uint16("lang_id", ps, depth, &r_q->lang_id)) + return False; + + if(!prs_align(ps)) + return False; + if(!prs_uint32("status", ps, depth, &r_q->status)) + return False; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL lsa_io_q_enum_accounts(char *desc, LSA_Q_ENUM_ACCOUNTS *q_q, prs_struct *ps, int depth) +{ + if (q_q == NULL) + return False; + + prs_debug(ps, depth, desc, "lsa_io_q_enum_accounts"); + depth++; + + if (!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + return False; + + if(!prs_uint32("enum_context ", ps, depth, &q_q->enum_context)) + return False; + if(!prs_uint32("pref_max_length", ps, depth, &q_q->pref_max_length)) + return False; + + return True; +} + +/******************************************************************* + Inits an LSA_R_ENUM_PRIVS structure. +********************************************************************/ + +void init_lsa_r_enum_accounts(LSA_R_ENUM_ACCOUNTS *r_u, uint32 enum_context) +{ + DEBUG(5, ("init_lsa_r_enum_accounts\n")); + + r_u->enum_context=enum_context; + if (r_u->enum_context!=0) { + r_u->sids.num_entries=enum_context; + r_u->sids.ptr_sid_enum=1; + r_u->sids.num_entries2=enum_context; + } else { + r_u->sids.num_entries=0; + r_u->sids.ptr_sid_enum=0; + r_u->sids.num_entries2=0; + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL lsa_io_r_enum_accounts(char *desc, LSA_R_ENUM_ACCOUNTS *r_q, prs_struct *ps, int depth) +{ + if (r_q == 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, &r_q->enum_context)) + return False; + + if (!lsa_io_sid_enum("sids", &r_q->sids, ps, depth)) + return False; + + if (!prs_align(ps)) + return False; + + if(!prs_uint32("status", ps, depth, &r_q->status)) + return False; + + return True; +} + + /******************************************************************* Reads or writes an LSA_Q_UNK_GET_CONNUSER structure. ********************************************************************/ @@ -1351,3 +1608,222 @@ BOOL lsa_io_r_unk_get_connuser(char *desc, LSA_R_UNK_GET_CONNUSER *r_c, prs_stru return True; } + +/******************************************************************* + Reads or writes an LSA_Q_OPENACCOUNT structure. +********************************************************************/ + +BOOL lsa_io_q_open_account(char *desc, LSA_Q_OPENACCOUNT *r_c, 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", &r_c->pol, ps, depth)) + return False; + + if(!smb_io_dom_sid2("", &r_c->sid, ps, depth)) /* domain SID */ + return False; + + if(!prs_uint32("access", ps, depth, &r_c->access)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes an LSA_R_OPENACCOUNT structure. +********************************************************************/ + +BOOL lsa_io_r_open_account(char *desc, LSA_R_OPENACCOUNT *r_c, 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", &r_c->pol, ps, depth)) + return False; + + if(!prs_uint32("status", ps, depth, &r_c->status)) + return False; + + return True; +} + + +/******************************************************************* + Reads or writes an LSA_Q_ENUMPRIVSACCOUNT structure. +********************************************************************/ + +BOOL lsa_io_q_enum_privsaccount(char *desc, LSA_Q_ENUMPRIVSACCOUNT *r_c, 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", &r_c->pol, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes an LUID structure. +********************************************************************/ + +BOOL lsa_io_luid(char *desc, LUID *r_c, 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, &r_c->low)) + return False; + + if(!prs_uint32("high", ps, depth, &r_c->high)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes an LUID_ATTR structure. +********************************************************************/ + +BOOL lsa_io_luid_attr(char *desc, LUID_ATTR *r_c, 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, &r_c->luid, ps, depth)) + return False; + + if(!prs_uint32("attr", ps, depth, &r_c->attr)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes an PRIVILEGE_SET structure. +********************************************************************/ + +BOOL lsa_io_privilege_set(char *desc, PRIVILEGE_SET *r_c, prs_struct *ps, int depth) +{ + uint32 i; + + prs_debug(ps, depth, desc, "lsa_io_privilege_set"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("count", ps, depth, &r_c->count)) + return False; + if(!prs_uint32("control", ps, depth, &r_c->control)) + return False; + + for (i=0; icount; i++) { + if (!lsa_io_luid_attr(desc, &r_c->set[i], ps, depth)) + return False; + } + + return True; +} + +void init_lsa_r_enum_privsaccount(LSA_R_ENUMPRIVSACCOUNT *r_u, LUID_ATTR *set, uint32 count, uint32 control) +{ + r_u->ptr=1; + r_u->count=count; + r_u->set.set=set; + r_u->set.count=count; + r_u->set.control=control; +} + +/******************************************************************* + Reads or writes an LSA_R_ENUMPRIVSACCOUNT structure. +********************************************************************/ + +BOOL lsa_io_r_enum_privsaccount(char *desc, LSA_R_ENUMPRIVSACCOUNT *r_c, 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, &r_c->ptr)) + return False; + + if (r_c->ptr!=0) { + if(!prs_uint32("count", ps, depth, &r_c->count)) + return False; + + /* malloc memory if unmarshalling here */ + + if(!lsa_io_privilege_set(desc, &r_c->set, ps, depth)) + return False; + } + + if(!prs_uint32("status", ps, depth, &r_c->status)) + return False; + + return True; +} + + + +/******************************************************************* + Reads or writes an LSA_Q_GETSYSTEMACCOUNTstructure. +********************************************************************/ + +BOOL lsa_io_q_getsystemaccount(char *desc, LSA_Q_GETSYSTEMACCOUNT *r_c, 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", &r_c->pol, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes an LSA_R_GETSYSTEMACCOUNTstructure. +********************************************************************/ + +BOOL lsa_io_r_getsystemaccount(char *desc, LSA_R_GETSYSTEMACCOUNT *r_c, 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, &r_c->access)) + return False; + + if(!prs_uint32("status", ps, depth, &r_c->status)) + return False; + + return True; +} + + + + + -- cgit From e4b6f641e8590b385672e12f4a2829c69e2d33aa Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 10 Jul 2001 17:02:02 +0000 Subject: This fixes security=domain, which has been broke since the big charset changeover. For my own sainity I have created a new function to fill out both the header and buffer for a string in an RPC struct. This DOES NOT take a length argument, only the actual string to be placed. The RPC code is currently littered with code that does init_uni_hdr() followed immidiatly by init_unistr2(), and often the length argument is wrong. (It was for the code I changed, even before the charset stuff). Another bug where we made strings AT LEAST MAX_UNICODE_LEN long hid this bug. This works for loopback connections to Samba, and can't be any more broke than it was before :-). (We had double and revese conversions, fun...). In particular this makes us multibyte complient. In any case, if there are no objections I will slowly convert other bits of code to the same system. (This used to be commit cf1d1cd9d6362f6e32ed9c2f6d2f6f25c47705ad) --- source3/rpc_parse/parse_misc.c | 54 ++++++++++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_net.c | 15 ++++-------- 2 files changed, 58 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 857f964e31..d4754f5e9a 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -5,6 +5,7 @@ * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997. + * Copyright (C) Andrew Bartlett 2001. * * 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 @@ -920,6 +921,59 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len) rpcstr_push((char *)str->buffer, buf, len, STR_TERMINATE); } +/******************************************************************* + Inits a UNIHDR and UNISTR2 structure at one time. +********************************************************************/ + +void init_unistr2_and_hdr(UNISTR2 *str, UNIHDR *hdr, const char *buf ) +{ + size_t convbuf_len_bytes, len_bytes; + int len; + + uint16 *conversion_buffer; + + if (buf == NULL) { + str->buffer = NULL; + hdr->uni_str_len = 0; + hdr->uni_max_len = 0; + hdr->buffer = 0; + return; + } + + convbuf_len_bytes = (sizeof(uint16)*(strlen(buf) + 1)); + /* Our strings cannot expand from internal to unicode by more + than a factor of 2 */ + + conversion_buffer = malloc(convbuf_len_bytes); + if (conversion_buffer == NULL) + smb_panic("init_unistr: malloc fail\n"); + + /* Check this */ + + len_bytes = rpcstr_push(conversion_buffer, buf, convbuf_len_bytes, STR_TERMINATE); + + len = len_bytes/sizeof(uint16); + + if (len > MAX_UNISTRLEN) { + len = MAX_UNISTRLEN; + } + + str->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len*sizeof(uint16)); + if (str->buffer == NULL) + smb_panic("init_unistr: talloc fail\n"); + + hdr->uni_str_len = len; + hdr->uni_max_len = len; + + hdr->buffer = 1; + + str->uni_str_len = len; + str->uni_max_len = len; + memcpy(str->buffer, conversion_buffer, len*sizeof(uint16)); + + free(conversion_buffer); +} + /******************************************************************* Inits a UNISTR2 structure from a UNISTR ********************************************************************/ diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index d7253a53fd..35890c2f27 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -5,6 +5,7 @@ * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997. + * Copyright (C) Andrew Bartlett 2001. * * 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 @@ -983,9 +984,6 @@ void init_id_info2(NET_ID_INFO_2 *id, char *domain_name, unsigned char *lm_chal_resp, unsigned char *nt_chal_resp) { - int len_domain_name = strlen(domain_name); - int len_user_name = strlen(user_name ); - int len_wksta_name = strlen(wksta_name ); int nt_chal_resp_len = ((nt_chal_resp != NULL) ? 24 : 0); int lm_chal_resp_len = ((lm_chal_resp != NULL) ? 24 : 0); unsigned char lm_owf[24]; @@ -995,14 +993,9 @@ void init_id_info2(NET_ID_INFO_2 *id, char *domain_name, id->ptr_id_info2 = 1; - init_uni_hdr(&id->hdr_domain_name, len_domain_name); - id->param_ctrl = param_ctrl; init_logon_id(&id->logon_id, log_id_low, log_id_high); - init_uni_hdr(&id->hdr_user_name, len_user_name); - init_uni_hdr(&id->hdr_wksta_name, len_wksta_name); - if (nt_chal_resp) { /* oops. can only send what-ever-it-is direct */ memcpy(nt_owf, nt_chal_resp, 24); @@ -1018,9 +1011,9 @@ void init_id_info2(NET_ID_INFO_2 *id, char *domain_name, init_str_hdr(&id->hdr_nt_chal_resp, 24, nt_chal_resp_len, (nt_chal_resp != NULL) ? 1 : 0); init_str_hdr(&id->hdr_lm_chal_resp, 24, lm_chal_resp_len, (lm_chal_resp != NULL) ? 1 : 0); - init_unistr2(&id->uni_domain_name, domain_name, len_domain_name); - init_unistr2(&id->uni_user_name, user_name, len_user_name); - init_unistr2(&id->uni_wksta_name, wksta_name, len_wksta_name); + init_unistr2_and_hdr(&id->uni_domain_name, &id->hdr_domain_name, domain_name); + init_unistr2_and_hdr(&id->uni_user_name, &id->hdr_user_name, user_name); + init_unistr2_and_hdr(&id->uni_wksta_name, &id->hdr_wksta_name, wksta_name); init_string2(&id->nt_chal_resp, (char *)nt_chal_resp, nt_chal_resp_len); init_string2(&id->lm_chal_resp, (char *)lm_chal_resp, lm_chal_resp_len); -- cgit From 7265d4638805a0eb391237c5cba0f39f4d0feb11 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 11 Jul 2001 04:27:03 +0000 Subject: This backs out my last change, which broke some of the finer points of RPC coding :-). I'll be more carfull in this area in future. This does not back out the cli_login change, so domain logons still work, but only for english. Andrew Bartlett (This used to be commit bd3c2a0cddc71daa4165e1a0916208d0c650d55a) --- source3/rpc_parse/parse_misc.c | 54 ------------------------------------------ source3/rpc_parse/parse_net.c | 15 ++++++++---- 2 files changed, 11 insertions(+), 58 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index d4754f5e9a..857f964e31 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -5,7 +5,6 @@ * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997. - * Copyright (C) Andrew Bartlett 2001. * * 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 @@ -921,59 +920,6 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len) rpcstr_push((char *)str->buffer, buf, len, STR_TERMINATE); } -/******************************************************************* - Inits a UNIHDR and UNISTR2 structure at one time. -********************************************************************/ - -void init_unistr2_and_hdr(UNISTR2 *str, UNIHDR *hdr, const char *buf ) -{ - size_t convbuf_len_bytes, len_bytes; - int len; - - uint16 *conversion_buffer; - - if (buf == NULL) { - str->buffer = NULL; - hdr->uni_str_len = 0; - hdr->uni_max_len = 0; - hdr->buffer = 0; - return; - } - - convbuf_len_bytes = (sizeof(uint16)*(strlen(buf) + 1)); - /* Our strings cannot expand from internal to unicode by more - than a factor of 2 */ - - conversion_buffer = malloc(convbuf_len_bytes); - if (conversion_buffer == NULL) - smb_panic("init_unistr: malloc fail\n"); - - /* Check this */ - - len_bytes = rpcstr_push(conversion_buffer, buf, convbuf_len_bytes, STR_TERMINATE); - - len = len_bytes/sizeof(uint16); - - if (len > MAX_UNISTRLEN) { - len = MAX_UNISTRLEN; - } - - str->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len*sizeof(uint16)); - if (str->buffer == NULL) - smb_panic("init_unistr: talloc fail\n"); - - hdr->uni_str_len = len; - hdr->uni_max_len = len; - - hdr->buffer = 1; - - str->uni_str_len = len; - str->uni_max_len = len; - memcpy(str->buffer, conversion_buffer, len*sizeof(uint16)); - - free(conversion_buffer); -} - /******************************************************************* Inits a UNISTR2 structure from a UNISTR ********************************************************************/ diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 35890c2f27..d7253a53fd 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -5,7 +5,6 @@ * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997. - * Copyright (C) Andrew Bartlett 2001. * * 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 @@ -984,6 +983,9 @@ void init_id_info2(NET_ID_INFO_2 *id, char *domain_name, unsigned char *lm_chal_resp, unsigned char *nt_chal_resp) { + int len_domain_name = strlen(domain_name); + int len_user_name = strlen(user_name ); + int len_wksta_name = strlen(wksta_name ); int nt_chal_resp_len = ((nt_chal_resp != NULL) ? 24 : 0); int lm_chal_resp_len = ((lm_chal_resp != NULL) ? 24 : 0); unsigned char lm_owf[24]; @@ -993,9 +995,14 @@ void init_id_info2(NET_ID_INFO_2 *id, char *domain_name, id->ptr_id_info2 = 1; + init_uni_hdr(&id->hdr_domain_name, len_domain_name); + id->param_ctrl = param_ctrl; init_logon_id(&id->logon_id, log_id_low, log_id_high); + init_uni_hdr(&id->hdr_user_name, len_user_name); + init_uni_hdr(&id->hdr_wksta_name, len_wksta_name); + if (nt_chal_resp) { /* oops. can only send what-ever-it-is direct */ memcpy(nt_owf, nt_chal_resp, 24); @@ -1011,9 +1018,9 @@ void init_id_info2(NET_ID_INFO_2 *id, char *domain_name, init_str_hdr(&id->hdr_nt_chal_resp, 24, nt_chal_resp_len, (nt_chal_resp != NULL) ? 1 : 0); init_str_hdr(&id->hdr_lm_chal_resp, 24, lm_chal_resp_len, (lm_chal_resp != NULL) ? 1 : 0); - init_unistr2_and_hdr(&id->uni_domain_name, &id->hdr_domain_name, domain_name); - init_unistr2_and_hdr(&id->uni_user_name, &id->hdr_user_name, user_name); - init_unistr2_and_hdr(&id->uni_wksta_name, &id->hdr_wksta_name, wksta_name); + init_unistr2(&id->uni_domain_name, domain_name, len_domain_name); + init_unistr2(&id->uni_user_name, user_name, len_user_name); + init_unistr2(&id->uni_wksta_name, wksta_name, len_wksta_name); init_string2(&id->nt_chal_resp, (char *)nt_chal_resp, nt_chal_resp_len); init_string2(&id->lm_chal_resp, (char *)lm_chal_resp, lm_chal_resp_len); -- cgit From 648528196ca136469d82b83cd2ba89b1b30290ae Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 25 Jul 2001 06:42:05 +0000 Subject: Held a shoot-out between NT_STATUS_NO_PROBLEMO and NT_STATUS_NOPROBLEMO. According to the incorruptible judges find and grep, the latter won. Mmm - procrastination. (-: (This used to be commit 2e339403605177b15d5185a8fdd1b06f3f043168) --- source3/rpc_parse/parse_samr.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 76ec35e9c7..7b86b15e87 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1442,7 +1442,7 @@ uint32 init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 *num_ent max_entries, max_data_size)); if (max_entries==0) - return NT_STATUS_NO_PROBLEMO; + return NT_STATUS_NOPROBLEMO; sam->sam=(SAM_ENTRY1 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY1)); if (!sam->sam) @@ -1480,7 +1480,7 @@ uint32 init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 *num_ent *num_entries = i; *data_size = dsize; - return NT_STATUS_NO_PROBLEMO; + return NT_STATUS_NOPROBLEMO; } /******************************************************************* @@ -1553,7 +1553,7 @@ uint32 init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 *num_ent max_data_size = *data_size; if (max_entries==0) - return NT_STATUS_NO_PROBLEMO; + return NT_STATUS_NOPROBLEMO; if (!(sam->sam=(SAM_ENTRY2 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY2)))) return NT_STATUS_NO_MEMORY; @@ -1585,7 +1585,7 @@ uint32 init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 *num_ent *num_entries = i; *data_size = dsize; - return NT_STATUS_NO_PROBLEMO; + return NT_STATUS_NOPROBLEMO; } /******************************************************************* @@ -1660,7 +1660,7 @@ uint32 init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 *num_ent max_data_size = *data_size; if (max_entries==0) - return NT_STATUS_NO_PROBLEMO; + return NT_STATUS_NOPROBLEMO; if (!(sam->sam=(SAM_ENTRY3 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY3)))) return NT_STATUS_NO_MEMORY; @@ -1688,7 +1688,7 @@ uint32 init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 *num_ent *num_entries = i; *data_size = dsize; - return NT_STATUS_NO_PROBLEMO; + return NT_STATUS_NOPROBLEMO; } /******************************************************************* @@ -1764,7 +1764,7 @@ uint32 init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 *num_ent max_data_size = *data_size; if (max_entries==0) - return NT_STATUS_NO_PROBLEMO; + return NT_STATUS_NOPROBLEMO; if (!(sam->sam=(SAM_ENTRY4 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY4)))) return NT_STATUS_NO_MEMORY; @@ -1790,7 +1790,7 @@ uint32 init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 *num_ent *num_entries = i; *data_size = dsize; - return NT_STATUS_NO_PROBLEMO; + return NT_STATUS_NOPROBLEMO; } /******************************************************************* @@ -1866,7 +1866,7 @@ uint32 init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 *num_ent max_data_size = *data_size; if (max_entries==0) - return NT_STATUS_NO_PROBLEMO; + return NT_STATUS_NOPROBLEMO; if (!(sam->sam=(SAM_ENTRY5 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY5)))) return NT_STATUS_NO_MEMORY; @@ -1890,7 +1890,7 @@ uint32 init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 *num_ent *num_entries = i; *data_size = dsize; - return NT_STATUS_NO_PROBLEMO; + return NT_STATUS_NOPROBLEMO; } /******************************************************************* @@ -4499,7 +4499,7 @@ uint32 init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, init_unistr2(&q_u->uni_name[i], name[i], len_name); /* unicode string for machine account */ } - return NT_STATUS_NO_PROBLEMO; + return NT_STATUS_NOPROBLEMO; } /******************************************************************* @@ -4608,7 +4608,7 @@ uint32 init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, r_u->status = status; - return NT_STATUS_NO_PROBLEMO; + return NT_STATUS_NOPROBLEMO; } /******************************************************************* -- cgit From 65bf96ed06845ea0ba78600d86751def7c3b4068 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 2 Aug 2001 23:48:51 +0000 Subject: Allow smbpasswd to join a W2K hosted AD domain. Jeremy. (This used to be commit c51cfc7f0d3ad1614ca1e0330c8707f7b263b8e6) --- source3/rpc_parse/parse_samr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 7b86b15e87..c3417eee6c 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5187,10 +5187,11 @@ static BOOL sam_io_user_info11(char *desc, SAM_USER_INFO_11 * usr, *************************************************************************/ -void init_sam_user_info24(SAM_USER_INFO_24 * usr, char newpass[516]) +void init_sam_user_info24(SAM_USER_INFO_24 * usr, char newpass[516], uint16 pw_len) { DEBUG(10, ("init_sam_user_info24:\n")); memcpy(usr->pass, newpass, sizeof(usr->pass)); + usr->pw_len = pw_len; } /******************************************************************* @@ -6474,6 +6475,10 @@ BOOL samr_io_q_connect(char *desc, SAMR_Q_CONNECT * q_u, if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth)) return False; + if (MARSHALLING(ps) && (usr->pw_len != 0)) { + if (!prs_uint16("pw_len", ps, depth, &usr->pw_len)) + return False; + } if(!prs_align(ps)) return False; if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask)) -- cgit From 8dad2a1310c6dc908934ac836377cbfed8f7a010 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 3 Aug 2001 03:43:24 +0000 Subject: Fix for smbpasswd set_userinfo24 was in the wrong place! (This used to be commit c9cbe3237e01983a5063e5680ad71c7579009f28) --- source3/rpc_parse/parse_samr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index c3417eee6c..6964c58a97 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5214,6 +5214,10 @@ static BOOL sam_io_user_info24(char *desc, SAM_USER_INFO_24 * usr, sizeof(usr->pass))) return False; + if (MARSHALLING(ps) && (usr->pw_len != 0)) { + if (!prs_uint16("pw_len", ps, depth, &usr->pw_len)) + return False; + } if(!prs_align(ps)) return False; @@ -6475,10 +6479,6 @@ BOOL samr_io_q_connect(char *desc, SAMR_Q_CONNECT * q_u, if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth)) return False; - if (MARSHALLING(ps) && (usr->pw_len != 0)) { - if (!prs_uint16("pw_len", ps, depth, &usr->pw_len)) - return False; - } if(!prs_align(ps)) return False; if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask)) -- cgit From 986372901e85a79343ba32f590a4a3e7658d2565 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 3 Aug 2001 13:09:23 +0000 Subject: This is my 'Authentication Rewrite' version 1.01, mostly as submitted to samba-technical a few weeks ago. The idea here is to standardize the checking of user names and passwords, thereby ensuring that all authtentications pass the same standards. The interface currently implemented in as nt_status = check_password(user_info, server_info) where user_info contains (mostly) the authentication data, and server_info contains things like the user-id they got, and their resolved user name. The current ugliness with the way the structures are created will be killed the next revision, when they will be created and malloced by creator functions. This patch also includes the first implementation of NTLMv2 in HEAD, but which needs some more testing. We also add a hack to allow plaintext passwords to be compared with smbpasswd, not the system password database. Finally, this patch probably reintroduces the PAM accounts bug we had in 2.2.0, I'll fix that once this hits the tree. (I've just finished testing it on a wide variety of platforms, so I want to get this patch in). (This used to be commit b30b6202f31d339b48d51c0d38174cafd1cfcd42) --- source3/rpc_parse/parse_misc.c | 2 +- source3/rpc_parse/parse_net.c | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 857f964e31..1a30d3d7a1 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -823,7 +823,7 @@ void copy_unistr2(UNISTR2 *str, UNISTR2 *from) Creates a STRING2 structure. ********************************************************************/ -void init_string2(STRING2 *str, char *buf, int len) +void init_string2(STRING2 *str, const char *buf, int len) { int alloc_len = 0; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index d7253a53fd..7bc277247d 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -976,20 +976,19 @@ 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, char *domain_name, - uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, - char *user_name, char *wksta_name, - unsigned char lm_challenge[8], - unsigned char *lm_chal_resp, - unsigned char *nt_chal_resp) +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, int lm_chal_resp_len, + const uchar * nt_chal_resp, int nt_chal_resp_len) { int len_domain_name = strlen(domain_name); int len_user_name = strlen(user_name ); int len_wksta_name = strlen(wksta_name ); - int nt_chal_resp_len = ((nt_chal_resp != NULL) ? 24 : 0); - int lm_chal_resp_len = ((lm_chal_resp != NULL) ? 24 : 0); unsigned char lm_owf[24]; - unsigned char nt_owf[24]; + unsigned char nt_owf[128]; DEBUG(5,("init_id_info2: %d\n", __LINE__)); @@ -1015,15 +1014,16 @@ void init_id_info2(NET_ID_INFO_2 *id, char *domain_name, } memcpy(id->lm_chal, lm_challenge, sizeof(id->lm_chal)); - init_str_hdr(&id->hdr_nt_chal_resp, 24, nt_chal_resp_len, (nt_chal_resp != NULL) ? 1 : 0); - init_str_hdr(&id->hdr_lm_chal_resp, 24, lm_chal_resp_len, (lm_chal_resp != NULL) ? 1 : 0); + init_str_hdr(&id->hdr_nt_chal_resp, sizeof(lm_owf), nt_chal_resp_len, (nt_chal_resp != NULL) ? 1 : 0); + init_str_hdr(&id->hdr_lm_chal_resp, sizeof(nt_owf), lm_chal_resp_len, (lm_chal_resp != NULL) ? 1 : 0); init_unistr2(&id->uni_domain_name, domain_name, len_domain_name); init_unistr2(&id->uni_user_name, user_name, len_user_name); init_unistr2(&id->uni_wksta_name, wksta_name, len_wksta_name); - init_string2(&id->nt_chal_resp, (char *)nt_chal_resp, nt_chal_resp_len); - init_string2(&id->lm_chal_resp, (char *)lm_chal_resp, lm_chal_resp_len); + init_string2(&id->nt_chal_resp, (const char *)nt_chal_resp, nt_chal_resp_len); + init_string2(&id->lm_chal_resp, (const char *)lm_chal_resp, lm_chal_resp_len); + } /******************************************************************* -- cgit From a2bac4d2caa0a6533798abc194e4cc837d816d39 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 7 Aug 2001 00:01:41 +0000 Subject: A collection of fixes/cleanups to the security descriptor code by matt_zinkevicius@hp.com (This used to be commit ce22267ec840aaa3cc8f9b88a62b45c723a06b01) --- source3/rpc_parse/parse_sec.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index b202c2a356..3d79c12cdb 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -22,7 +22,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - #include "includes.h" extern int DEBUGLEVEL; @@ -138,14 +137,15 @@ SEC_ACL *make_sec_acl(TALLOC_CTX *ctx, uint16 revision, int num_aces, SEC_ACE *a /* Now we need to return a non-NULL address for the ace list even if the number of aces required is zero. This is because there is a distinct difference between a NULL ace and an ace with zero - entries in it. This is achieved by always making the number of - bytes allocated by talloc() positive. Heh. */ + entries in it. This is achieved by checking that num_aces is a + positive number. */ - if((dst->ace = (SEC_ACE *)talloc(ctx, sizeof(SEC_ACE) * num_aces + 1)) - == NULL) { + if ((num_aces) && + ((dst->ace = (SEC_ACE *)talloc(ctx, sizeof(SEC_ACE) * num_aces)) + == NULL)) { return NULL; } - + for (i = 0; i < num_aces; i++) { dst->ace[i] = ace_list[i]; /* Structure copy. */ dst->size += ace_list[i].size; @@ -298,9 +298,10 @@ BOOL sec_acl_equal(SEC_ACL *s1, SEC_ACL *s2) { int i, j; - /* Trivial case */ + /* Trivial cases */ if (!s1 && !s2) return True; + if (!s1 || !s2) return False; /* Check top level stuff */ @@ -544,7 +545,7 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, offset = SD_HEADER_SIZE; dst->off_sacl = offset; - offset += ((sacl->size + 3) & ~3); + offset += ((dst->sacl->size + 3) & ~3); } if (dst->dacl != NULL) { @@ -553,7 +554,7 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, offset = SD_HEADER_SIZE; dst->off_dacl = offset; - offset += ((dacl->size + 3) & ~3); + offset += ((dst->dacl->size + 3) & ~3); } *sd_size = (size_t)((offset == 0) ? SD_HEADER_SIZE : offset); -- cgit From acc149c427e780b35ebe3028722ed0c42c4c3854 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 10 Aug 2001 09:52:10 +0000 Subject: - avoid possible mem leaks in rpcclient/cmd_*.c (talloc_destroy not performed) - ported two rpc back from TNG (WINREG: shutdown and abort shutdown) - some optimizations and changed some DEBUG statement in loadparm.c - changed rpcclient a bit moved from non reentrant next_token_nr to next_token - in cmd_reg.c not sure if getopt will work ok on all platforms only setting optind=0 (This used to be commit fd54412ce9c3504a547e232602d6129e08dd9d4d) --- source3/rpc_parse/parse_reg.c | 217 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 211 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index a7602434e5..23d47cf9b5 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -5,7 +5,8 @@ * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997. - * Copyright (C) Marc Jacobsen 1999. + * Copyright (C) Marc Jacobsen 1999. + * Copyright (C) Simo Sorce 2000. * * 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 @@ -32,7 +33,7 @@ extern int DEBUGLEVEL; Inits a structure. ********************************************************************/ -void init_reg_q_open_hklm(REG_Q_OPEN_HKLM *q_o, +void init_reg_q_open_hkcr(REG_Q_OPEN_HKCR *q_o, uint16 unknown_0, uint32 level) { q_o->ptr = 1; @@ -45,12 +46,12 @@ void init_reg_q_open_hklm(REG_Q_OPEN_HKLM *q_o, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_open_hklm(char *desc, REG_Q_OPEN_HKLM *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_open_hkcr(char *desc, REG_Q_OPEN_HKCR *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; - prs_debug(ps, depth, desc, "reg_io_q_open_hklm"); + prs_debug(ps, depth, desc, "reg_io_q_open_hkcr"); depth++; if(!prs_align(ps)) @@ -76,12 +77,12 @@ BOOL reg_io_q_open_hklm(char *desc, REG_Q_OPEN_HKLM *r_q, prs_struct *ps, int d reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_open_hklm(char *desc, REG_R_OPEN_HKLM *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_open_hkcr(char *desc, REG_R_OPEN_HKCR *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; - prs_debug(ps, depth, desc, "reg_io_r_open_hklm"); + prs_debug(ps, depth, desc, "reg_io_r_open_hkcr"); depth++; if(!prs_align(ps)) @@ -96,6 +97,75 @@ BOOL reg_io_r_open_hklm(char *desc, REG_R_OPEN_HKLM *r_r, prs_struct *ps, int d return True; } +/******************************************************************* + Inits a structure. +********************************************************************/ + +void init_reg_q_open_hklm(REG_Q_OPEN_HKLM * q_o, + uint16 unknown_0, uint32 access_mask) +{ + q_o->ptr = 1; + q_o->unknown_0 = unknown_0; + q_o->unknown_1 = 0x0; /* random - changes */ + q_o->access_mask = access_mask; + +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL reg_io_q_open_hklm(char *desc, REG_Q_OPEN_HKLM * r_q, prs_struct *ps, + int depth) +{ + if (r_q == NULL) + return False; + + prs_debug(ps, depth, desc, "reg_io_q_open_hklm"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("ptr ", ps, depth, &(r_q->ptr))) + return False; + if (r_q->ptr != 0) + { + if (!prs_uint16("unknown_0", ps, depth, &(r_q->unknown_0))) + return False; + if (!prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1))) + return False; + if (!prs_uint32("access_mask", ps, depth, &(r_q->access_mask))) + return False; + } + + return True; +} + + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL reg_io_r_open_hklm(char *desc, REG_R_OPEN_HKLM * r_r, prs_struct *ps, + int depth) +{ + if (r_r == NULL) + return False; + + prs_debug(ps, depth, desc, "reg_io_r_open_hklm"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!smb_io_pol_hnd("", &(r_r->pol), ps, depth)) + return False; + + if (!prs_uint32("status", ps, depth, &(r_r->status))) + return False; + + return True; +} + /******************************************************************* Inits a structure. @@ -1478,3 +1548,138 @@ BOOL reg_io_r_open_entry(char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int return True; } + +/******************************************************************* +Inits a structure. +********************************************************************/ +void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, + const char *msg, uint32 timeout, uint16 flags) +{ + int msg_len; + msg_len = strlen(msg); + + q_s->ptr_0 = 1; + q_s->ptr_1 = 1; + q_s->ptr_2 = 1; + + init_uni_hdr(&(q_s->hdr_msg), msg_len); + init_unistr2(&(q_s->uni_msg), msg, msg_len); + + q_s->timeout = timeout; + q_s->flags = flags; + +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL reg_io_q_shutdown(char *desc, REG_Q_SHUTDOWN * q_s, prs_struct *ps, + int depth) +{ + if (q_s == NULL) + return False; + + prs_debug(ps, depth, desc, "reg_io_q_shutdown"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("ptr_0", ps, depth, &(q_s->ptr_0))) + return False; + if (!prs_uint32("ptr_1", ps, depth, &(q_s->ptr_1))) + return False; + if (!prs_uint32("ptr_2", ps, depth, &(q_s->ptr_2))) + return False; + + if (!smb_io_unihdr("hdr_msg", &(q_s->hdr_msg), ps, depth)) + return False; + if (!smb_io_unistr2("uni_msg", &(q_s->uni_msg), q_s->hdr_msg.buffer, ps, depth)) + return False; + if (!prs_align(ps)) + return False; + + if (!prs_uint32("timeout", ps, depth, &(q_s->timeout))) + return False; + if (!prs_uint16("flags ", ps, depth, &(q_s->flags))) + return False; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL reg_io_r_shutdown(char *desc, REG_R_SHUTDOWN * r_s, prs_struct *ps, + int depth) +{ + if (r_s == NULL) + return False; + + prs_debug(ps, depth, desc, "reg_io_r_shutdown"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("status", ps, depth, &(r_s->status))) + return False; + + return True; +} + +/******************************************************************* +Inits a structure. +********************************************************************/ +void init_reg_q_abort_shutdown(REG_Q_ABORT_SHUTDOWN * q_s) +{ + + q_s->ptr_server = 0; + +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL reg_io_q_abort_shutdown(char *desc, REG_Q_ABORT_SHUTDOWN * q_s, + prs_struct *ps, int depth) +{ + if (q_s == NULL) + return False; + + prs_debug(ps, depth, desc, "reg_io_q_abort_shutdown"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("ptr_server", ps, depth, &(q_s->ptr_server))) + return False; + if (q_s->ptr_server != 0) + if (!prs_uint16("server", ps, depth, &(q_s->server))) + return False; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL reg_io_r_abort_shutdown(char *desc, REG_R_ABORT_SHUTDOWN * r_s, + prs_struct *ps, int depth) +{ + if (r_s == NULL) + return False; + + prs_debug(ps, depth, desc, "reg_io_r_abort_shutdown"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("status", ps, depth, &(r_s->status))) + return False; + + return True; +} + -- cgit From 4b2016305b7c43c61198f25175531d149db5e989 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 10 Aug 2001 19:38:53 +0000 Subject: Merge in the NT drivers changes from 2.2. Jeremy. (This used to be commit a3781ad38ff6c70238e7e9b83324477e5c9780d5) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b303bf108e..b568995752 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -539,7 +539,7 @@ static BOOL spool_io_user_level(char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, * on reading allocate memory for the private member ********************************************************************/ -static BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) +BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) { prs_debug(ps, depth, desc, "spoolss_io_devmode"); depth++; -- cgit From 2e783a47076bd0994b6ce86df7ec967bc1c2da63 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 12 Aug 2001 17:30:01 +0000 Subject: this is a big global fix for the ptr = Realloc(ptr, size) bug. many possible mem leaks, and segfaults fixed. someone should port this fix to 2.2 also. (This used to be commit fa8e55b8b465114ce209344965c1ca0333b84db9) --- source3/rpc_parse/parse_creds.c | 20 ++++++++++++-------- source3/rpc_parse/parse_spoolss.c | 33 ++++++++++++++++++++++++--------- 2 files changed, 36 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c index 7bdbe65880..ae8ba23a56 100644 --- a/source3/rpc_parse/parse_creds.c +++ b/source3/rpc_parse/parse_creds.c @@ -90,8 +90,7 @@ BOOL make_creds_unix_sec(CREDS_UNIX_SEC *r_u, r_u->uid = uid; r_u->gid = gid; r_u->num_grps = num_grps; - r_u->grps = (uint32*)Realloc(NULL, sizeof(r_u->grps[0]) * - r_u->num_grps); + r_u->grps = (uint32*)malloc(sizeof(r_u->grps[0]) * r_u->num_grps); if (r_u->grps == NULL && num_grps != 0) { return False; @@ -123,14 +122,17 @@ BOOL creds_io_unix_sec(char *desc, CREDS_UNIX_SEC *r_u, prs_struct *ps, int dept prs_uint32("num_grps", ps, depth, (uint32 *)&(r_u->num_grps)); if (r_u->num_grps != 0) { - r_u->grps = (uint32*)Realloc(r_u->grps, + uint32 *tgr; + + tgr = (uint32*)Realloc(r_u->grps, sizeof(r_u->grps[0]) * r_u->num_grps); - if (r_u->grps == NULL) + if (tgr == NULL) { creds_free_unix_sec(r_u); return False; } + else r_u->grps = tgr; } for (i = 0; i < r_u->num_grps; i++) { @@ -165,8 +167,7 @@ BOOL make_creds_nt_sec(CREDS_NT_SEC *r_u, sid_copy(&r_u->sid, sid); r_u->num_grps = num_grps; - r_u->grp_rids = (uint32*)Realloc(NULL, sizeof(r_u->grp_rids[0]) * - r_u->num_grps); + r_u->grp_rids = (uint32*)malloc(sizeof(r_u->grp_rids[0]) * r_u->num_grps); if (r_u->grp_rids == NULL && num_grps != 0) { @@ -199,14 +200,17 @@ BOOL creds_io_nt_sec(char *desc, CREDS_NT_SEC *r_u, prs_struct *ps, int depth) prs_uint32("num_grps", ps, depth, &(r_u->num_grps)); if (r_u->num_grps != 0) { - r_u->grp_rids = (uint32*)Realloc(r_u->grp_rids, + uint32 *tgrid; + + tgrid = (uint32*)Realloc(r_u->grp_rids, sizeof(r_u->grp_rids[0]) * r_u->num_grps); - if (r_u->grp_rids == NULL) + if (tgrid == NULL) { creds_free_nt_sec(r_u); return False; } + else r_u->grp_rids = tgrid; } for (i = 0; i < r_u->num_grps; i++) { diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b568995752..dd2c4a541a 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1861,12 +1861,17 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16 an extra NULL for termination */ if (l_chaine > 0) { + uint16 *tc2; + realloc_size = (l_chaine2+l_chaine+2)*sizeof(uint16); /* Yes this should be realloc - it's freed below. JRA */ - if((chaine2=(uint16 *)Realloc(chaine2, realloc_size)) == NULL) + if((tc2=(uint16 *)Realloc(chaine2, realloc_size)) == NULL) { + if (chaine2) free(chaine2); return False; + } + else chaine2 = tc2; memcpy(chaine2+l_chaine2, chaine.buffer, (l_chaine+1)*sizeof(uint16)); l_chaine2+=l_chaine+1; } @@ -4703,7 +4708,7 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ ********************************************************************/ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) { - fstring f; + fstring f, *tar; int n = 0; char *src; @@ -4715,7 +4720,9 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) while (src < ((char *)buf5->buffer) + buf5->buf_len*2) { rpcstr_pull(f, src, sizeof(f)-1, -1, 0); src = skip_unibuf(src, 2*buf5->buf_len - PTR_DIFF(src,buf5->buffer)); - *ar = (fstring *)Realloc(*ar, sizeof(fstring)*(n+2)); + tar = (fstring *)Realloc(*ar, sizeof(fstring)*(n+2)); + if (!tar) return False; + else *ar = tar; fstrcpy((*ar)[n], f); n++; } @@ -4993,9 +5000,11 @@ BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, DEBUGADD(8,( "monitorname: %s\n", d->monitorname)); DEBUGADD(8,( "defaultdatatype: %s\n", d->defaultdatatype)); - uniarray_2_dosarray(&uni->dependentfiles, &d->dependentfiles ); - - return True; + if (uniarray_2_dosarray(&uni->dependentfiles, &d->dependentfiles )) + return True; + + free(*asc); + return False; } /******************************************************************* @@ -5038,10 +5047,16 @@ BOOL uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni, DEBUGADD(8,( "monitorname: %s\n", d->monitorname)); DEBUGADD(8,( "defaultdatatype: %s\n", d->defaultdatatype)); - uniarray_2_dosarray(&uni->dependentfiles, &d->dependentfiles ); - uniarray_2_dosarray(&uni->previousnames, &d->previousnames ); - + if (!uniarray_2_dosarray(&uni->dependentfiles, &d->dependentfiles )) + goto error; + if (!uniarray_2_dosarray(&uni->previousnames, &d->previousnames )) + goto error; + return True; + +error: + free(*asc); + return False; } BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, -- cgit From 3ec862e6dbf1be85367856d02949b208cd5cc6cd Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 22 Aug 2001 01:18:48 +0000 Subject: merge from 2.2 (This used to be commit fe4ffa8dda165b0d1197f022f59db0a284cbef79) --- source3/rpc_parse/parse_net.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 7bc277247d..e8f0c02a52 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1261,7 +1261,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam usr->user_id = pdb_get_user_rid(sampw); usr->group_id = pdb_get_group_rid(sampw); - usr->num_groups = num_groups; + usr->num_groups = num_groups+1; usr->buffer_groups = 1; /* indicates fill in groups, below, even if there are none */ usr->user_flgs = user_flgs; @@ -1289,16 +1289,21 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); - usr->num_groups2 = num_groups; + /* always have at least one group == the user's primary group */ + usr->num_groups2 = num_groups+1; - if (num_groups > 0) { - usr->gids = (DOM_GID *)talloc_zero(ctx,sizeof(DOM_GID) * num_groups); - if (usr->gids == NULL) - return; - for (i = 0; i < num_groups; i++) - usr->gids[i] = gids[i]; - } + usr->gids = (DOM_GID *)talloc_zero(ctx,sizeof(DOM_GID) * (num_groups+1)); + if (usr->gids == NULL) + return; + /* primary group **MUST** go first. NT4's winmsd.exe will give + "The Network statistics are currently not available. 9-5" + What the heck is this? -- jerry */ + usr->gids[0].g_rid = usr->group_id; + usr->gids[0].attr = 0x07; + for (i = 0; i < num_groups; i++) + usr->gids[i+1] = gids[i]; + init_unistr2(&usr->uni_logon_srv, logon_srv, len_logon_srv); init_unistr2(&usr->uni_logon_dom, logon_dom, len_logon_dom); -- cgit From 659774bffdf926f461dfe497160c1aabc8773c4d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 24 Aug 2001 07:32:51 +0000 Subject: Fixed malloc -> talloc problems pointed out by Simo. Jeremy (This used to be commit 0f5b187387fb536a6866d9109eff82411798f79e) --- source3/rpc_parse/parse_lsa.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index d07c91e137..2c588912fe 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -530,7 +530,7 @@ BOOL lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, Inits an LSA_R_ENUM_TRUST_DOM structure. ********************************************************************/ -void init_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context, +void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context, char *domain_name, DOM_SID *domain_sid, uint32 status) { @@ -545,14 +545,14 @@ void init_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context, r_e->ptr_enum_domains = 1; r_e->num_domains2 = 1; - if (!(r_e->hdr_domain_name = (UNIHDR2 *) - malloc(sizeof(UNIHDR2)))) return; + if (!(r_e->hdr_domain_name = (UNIHDR2 *)talloc(ctx,sizeof(UNIHDR2)))) + return; - if (!(r_e->uni_domain_name = (UNISTR2 *) - malloc(sizeof(UNISTR2)))) return; + if (!(r_e->uni_domain_name = (UNISTR2 *)talloc(ctx,sizeof(UNISTR2)))) + return; - if (!(r_e->domain_sid = (DOM_SID2 *) - malloc(sizeof(DOM_SID2)))) return; + if (!(r_e->domain_sid = (DOM_SID2 *)talloc(ctx,sizeof(DOM_SID2)))) + return; init_uni_hdr2(&r_e->hdr_domain_name[0], len_domain_name); init_unistr2 (&r_e->uni_domain_name[0], domain_name, -- cgit From b031af348c7dcc8c74bf49945211c466b8eca079 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 27 Aug 2001 19:46:22 +0000 Subject: converted another bunch of stuff to NTSTATUS (This used to be commit 1d36250e338ae0ff9fbbf86019809205dd97d05e) --- source3/rpc_parse/parse_lsa.c | 2 +- source3/rpc_parse/parse_reg.c | 6 ++-- source3/rpc_parse/parse_samr.c | 80 +++++++++++++++++++++--------------------- source3/rpc_parse/parse_srv.c | 4 +-- source3/rpc_parse/parse_wks.c | 4 +-- 5 files changed, 48 insertions(+), 48 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 2c588912fe..9bfb6746bb 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -532,7 +532,7 @@ BOOL lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context, char *domain_name, DOM_SID *domain_sid, - uint32 status) + NTSTATUS status) { DEBUG(5, ("init_r_enum_trust_dom\n")); diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 23d47cf9b5..3a6f7ba819 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -891,7 +891,7 @@ makes a structure. ********************************************************************/ void init_reg_r_get_key_sec(REG_R_GET_KEY_SEC *r_i, POLICY_HND *pol, uint32 buf_len, uint8 *buf, - uint32 status) + NTSTATUS status) { r_i->ptr = 1; init_buf_hdr(&r_i->hdr_sec, buf_len, buf_len); @@ -1028,7 +1028,7 @@ BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) ********************************************************************/ BOOL init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r, - BUFFER2* buf, uint32 type, uint32 status) + BUFFER2* buf, uint32 type, NTSTATUS status) { if(r_r == NULL) return False; @@ -1519,7 +1519,7 @@ BOOL reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int ********************************************************************/ void init_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r, - POLICY_HND *pol, uint32 status) + POLICY_HND *pol, NTSTATUS status) { memcpy(&r_r->pol, pol, sizeof(r_r->pol)); r_r->status = status; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 6964c58a97..f39104fed0 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -133,7 +133,7 @@ inits a SAMR_R_LOOKUP_DOMAIN structure. ********************************************************************/ void init_samr_r_lookup_domain(SAMR_R_LOOKUP_DOMAIN * r_u, - DOM_SID *dom_sid, uint32 status) + DOM_SID *dom_sid, NTSTATUS status) { DEBUG(5, ("init_samr_r_lookup_domain\n")); @@ -342,7 +342,7 @@ BOOL samr_io_q_get_usrdom_pwinfo(char *desc, SAMR_Q_GET_USRDOM_PWINFO * q_u, Init. ********************************************************************/ -void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO *r_u, uint32 status) +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")); @@ -762,7 +762,7 @@ inits a SAMR_R_QUERY_DOMAIN_INFO structure. void init_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO * r_u, uint16 switch_value, SAM_UNK_CTR * ctr, - uint32 status) + NTSTATUS status) { DEBUG(5, ("init_samr_r_query_dom_info\n")); @@ -1424,7 +1424,7 @@ BOOL samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO * q_e, inits a SAM_DISPINFO_1 structure. ********************************************************************/ -uint32 init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 *num_entries, +NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 *num_entries, uint32 *data_size, uint32 start_idx, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) { @@ -1442,7 +1442,7 @@ uint32 init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 *num_ent max_entries, max_data_size)); if (max_entries==0) - return NT_STATUS_NOPROBLEMO; + return NT_STATUS_OK; sam->sam=(SAM_ENTRY1 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY1)); if (!sam->sam) @@ -1480,7 +1480,7 @@ uint32 init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 *num_ent *num_entries = i; *data_size = dsize; - return NT_STATUS_NOPROBLEMO; + return NT_STATUS_OK; } /******************************************************************* @@ -1536,7 +1536,7 @@ static BOOL sam_io_sam_dispinfo_1(char *desc, SAM_DISPINFO_1 * sam, inits a SAM_DISPINFO_2 structure. ********************************************************************/ -uint32 init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 *num_entries, +NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 *num_entries, uint32 *data_size, uint32 start_idx, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) { @@ -1553,7 +1553,7 @@ uint32 init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 *num_ent max_data_size = *data_size; if (max_entries==0) - return NT_STATUS_NOPROBLEMO; + return NT_STATUS_OK; if (!(sam->sam=(SAM_ENTRY2 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY2)))) return NT_STATUS_NO_MEMORY; @@ -1585,7 +1585,7 @@ uint32 init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 *num_ent *num_entries = i; *data_size = dsize; - return NT_STATUS_NOPROBLEMO; + return NT_STATUS_OK; } /******************************************************************* @@ -1643,7 +1643,7 @@ static BOOL sam_io_sam_dispinfo_2(char *desc, SAM_DISPINFO_2 * sam, inits a SAM_DISPINFO_3 structure. ********************************************************************/ -uint32 init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 *num_entries, +NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 *num_entries, uint32 *data_size, uint32 start_idx, DOMAIN_GRP * grp) { @@ -1660,7 +1660,7 @@ uint32 init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 *num_ent max_data_size = *data_size; if (max_entries==0) - return NT_STATUS_NOPROBLEMO; + return NT_STATUS_OK; if (!(sam->sam=(SAM_ENTRY3 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY3)))) return NT_STATUS_NO_MEMORY; @@ -1688,7 +1688,7 @@ uint32 init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 *num_ent *num_entries = i; *data_size = dsize; - return NT_STATUS_NOPROBLEMO; + return NT_STATUS_OK; } /******************************************************************* @@ -1746,7 +1746,7 @@ static BOOL sam_io_sam_dispinfo_3(char *desc, SAM_DISPINFO_3 * sam, inits a SAM_DISPINFO_4 structure. ********************************************************************/ -uint32 init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 *num_entries, +NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 *num_entries, uint32 *data_size, uint32 start_idx, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) { @@ -1764,7 +1764,7 @@ uint32 init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 *num_ent max_data_size = *data_size; if (max_entries==0) - return NT_STATUS_NOPROBLEMO; + return NT_STATUS_OK; if (!(sam->sam=(SAM_ENTRY4 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY4)))) return NT_STATUS_NO_MEMORY; @@ -1790,7 +1790,7 @@ uint32 init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 *num_ent *num_entries = i; *data_size = dsize; - return NT_STATUS_NOPROBLEMO; + return NT_STATUS_OK; } /******************************************************************* @@ -1849,7 +1849,7 @@ static BOOL sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 * sam, inits a SAM_DISPINFO_5 structure. ********************************************************************/ -uint32 init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 *num_entries, +NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 *num_entries, uint32 *data_size, uint32 start_idx, DOMAIN_GRP * grp) { @@ -1866,7 +1866,7 @@ uint32 init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 *num_ent max_data_size = *data_size; if (max_entries==0) - return NT_STATUS_NOPROBLEMO; + return NT_STATUS_OK; if (!(sam->sam=(SAM_ENTRY5 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY5)))) return NT_STATUS_NO_MEMORY; @@ -1890,7 +1890,7 @@ uint32 init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 *num_ent *num_entries = i; *data_size = dsize; - return NT_STATUS_NOPROBLEMO; + return NT_STATUS_OK; } /******************************************************************* @@ -1952,7 +1952,7 @@ inits a SAMR_R_QUERY_DISPINFO structure. void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO * r_u, uint32 num_entries, uint32 data_size, uint16 switch_level, SAM_DISPINFO_CTR * ctr, - uint32 status) + NTSTATUS status) { DEBUG(5, ("init_samr_r_query_dispinfo: level %d\n", switch_level)); @@ -2443,7 +2443,7 @@ inits a SAMR_R_DEL_GROUPMEM structure. ********************************************************************/ void init_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM * r_u, POLICY_HND *pol, - uint32 status) + NTSTATUS status) { DEBUG(5, ("init_samr_r_del_groupmem\n")); @@ -2518,7 +2518,7 @@ inits a SAMR_R_ADD_GROUPMEM structure. ********************************************************************/ void init_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM * r_u, POLICY_HND *pol, - uint32 status) + NTSTATUS status) { DEBUG(5, ("init_samr_r_add_groupmem\n")); @@ -2589,7 +2589,7 @@ BOOL samr_io_q_set_groupinfo(char *desc, SAMR_Q_SET_GROUPINFO * q_e, inits a SAMR_R_SET_GROUPINFO structure. ********************************************************************/ -void init_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO * r_u, uint32 status) +void init_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO * r_u, NTSTATUS status) { DEBUG(5, ("init_samr_r_set_groupinfo\n")); @@ -2662,7 +2662,7 @@ inits a SAMR_R_QUERY_GROUPINFO structure. ********************************************************************/ void init_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO * r_u, - GROUP_INFO_CTR * ctr, uint32 status) + GROUP_INFO_CTR * ctr, NTSTATUS status) { DEBUG(5, ("init_samr_r_query_groupinfo\n")); @@ -2742,7 +2742,7 @@ 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, uint32 status) + uint32 *attr, NTSTATUS status) { DEBUG(5, ("init_samr_r_query_groupmem\n")); @@ -2876,7 +2876,7 @@ 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, - uint32 status) + NTSTATUS status) { DEBUG(5, ("init_samr_r_query_usergroups\n")); @@ -3495,7 +3495,7 @@ inits a SAMR_R_QUERY_ALIASINFO structure. ********************************************************************/ void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO * r_u, - ALIAS_INFO_CTR * ctr, uint32 status) + ALIAS_INFO_CTR * ctr, NTSTATUS status) { DEBUG(5, ("init_samr_r_query_aliasinfo\n")); @@ -3681,7 +3681,7 @@ inits a SAMR_R_QUERY_USERALIASES structure. void init_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES * r_u, uint32 num_rids, uint32 *rid, - uint32 status) + NTSTATUS status) { DEBUG(5, ("init_samr_r_query_useraliases\n")); @@ -4327,7 +4327,7 @@ inits a SAMR_R_DELETE_DOM_ALIAS structure. ********************************************************************/ void init_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS * r_u, - uint32 status) + NTSTATUS status) { DEBUG(5, ("init_samr_r_delete_dom_alias\n")); @@ -4396,7 +4396,7 @@ 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, - uint32 status) + NTSTATUS status) { DEBUG(5, ("init_samr_r_query_aliasmem\n")); @@ -4472,7 +4472,7 @@ BOOL samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM * r_u, inits a SAMR_Q_LOOKUP_NAMES structure. ********************************************************************/ -uint32 init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, +NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, POLICY_HND *pol, uint32 flags, uint32 num_names, char **name) { @@ -4499,7 +4499,7 @@ uint32 init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, init_unistr2(&q_u->uni_name[i], name[i], len_name); /* unicode string for machine account */ } - return NT_STATUS_NOPROBLEMO; + return NT_STATUS_OK; } /******************************************************************* @@ -4561,10 +4561,10 @@ BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES * q_u, inits a SAMR_R_LOOKUP_NAMES structure. ********************************************************************/ -uint32 init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, +NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, uint32 num_rids, uint32 *rid, uint32 *type, - uint32 status) + NTSTATUS status) { DEBUG(5, ("init_samr_r_lookup_names\n")); @@ -4608,7 +4608,7 @@ uint32 init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, r_u->status = status; - return NT_STATUS_NOPROBLEMO; + return NT_STATUS_OK; } /******************************************************************* @@ -6013,7 +6013,7 @@ static BOOL sam_io_user_info20(char *desc, SAM_USER_INFO_20 *usr, inits a SAM_USERINFO_CTR structure. ********************************************************************/ -uint32 make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr, +NTSTATUS make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr, uint16 switch_value, SAM_USER_INFO_21 * usr) { @@ -6074,7 +6074,7 @@ uint32 make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr, return NT_STATUS_INVALID_INFO_CLASS; } - return NT_STATUS_NOPROBLEMO; + return NT_STATUS_OK; } /******************************************************************* @@ -6230,7 +6230,7 @@ inits a SAMR_R_QUERY_USERINFO structure. ********************************************************************/ void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO * r_u, - SAM_USERINFO_CTR * ctr, uint32 status) + SAM_USERINFO_CTR * ctr, NTSTATUS status) { DEBUG(5, ("init_samr_r_query_userinfo\n")); @@ -6322,7 +6322,7 @@ BOOL samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO * q_u, inits a SAMR_R_SET_USERINFO structure. ********************************************************************/ -void init_samr_r_set_userinfo(SAMR_R_SET_USERINFO * r_u, uint32 status) +void init_samr_r_set_userinfo(SAMR_R_SET_USERINFO * r_u, NTSTATUS status) { DEBUG(5, ("init_samr_r_set_userinfo\n")); @@ -6410,7 +6410,7 @@ BOOL samr_io_q_set_userinfo2(char *desc, SAMR_Q_SET_USERINFO2 * q_u, inits a SAMR_R_SET_USERINFO2 structure. ********************************************************************/ -void init_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2 * r_u, uint32 status) +void init_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2 * r_u, NTSTATUS status) { DEBUG(5, ("init_samr_r_set_userinfo2\n")); @@ -6825,7 +6825,7 @@ BOOL samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER * q_u, inits a SAMR_R_CHGPASSWD_USER structure. ********************************************************************/ -void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER * r_u, uint32 status) +void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER * r_u, NTSTATUS status) { DEBUG(5, ("init_r_chgpasswd_user\n")); diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 637b834266..d695eb136c 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -2240,7 +2240,7 @@ BOOL srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_stru ********************************************************************/ void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv, - uint32 switch_value, SRV_INFO_CTR *ctr, uint32 status) + uint32 switch_value, SRV_INFO_CTR *ctr, NTSTATUS status) { DEBUG(5,("init_srv_r_net_srv_get_info\n")); @@ -2262,7 +2262,7 @@ void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv, ********************************************************************/ void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv, - uint32 switch_value, uint32 status) + uint32 switch_value, NTSTATUS status) { DEBUG(5,("init_srv_r_net_srv_set_info\n")); diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c index 7357e3d2f3..f35bef83bd 100644 --- a/source3/rpc_parse/parse_wks.c +++ b/source3/rpc_parse/parse_wks.c @@ -135,8 +135,8 @@ static BOOL wks_io_wks_info_100(char *desc, WKS_INFO_100 *inf, prs_struct *ps, i ********************************************************************/ void init_wks_r_query_info(WKS_R_QUERY_INFO *r_u, - uint32 switch_value, WKS_INFO_100 *wks100, - int status) + uint32 switch_value, WKS_INFO_100 *wks100, + NTSTATUS status) { DEBUG(5,("init_wks_r_unknown_0: %d\n", __LINE__)); -- cgit From d5c9172adadb83283e437578be7bad4368ad9f20 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 28 Aug 2001 06:43:43 +0000 Subject: Merge of sam sync code from TNG. Reverse-engineered the sam replication protocol from staring at hex dumps for a while. It's pretty similar to the sam sync protocol with a couple of different delta header types. I wasn't able to figure out the format of the privilege stuff - needs more time and a whiteboard. (-: The impressive bit is that the sam sync stuff from tng basically just worked thanks mainly to Luke Leighton's efforts in this area. (This used to be commit 3a60cb44f22d5f3f8c78a56ed8f5ea4794cd7ab3) --- source3/rpc_parse/parse_misc.c | 64 ++++ source3/rpc_parse/parse_net.c | 834 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 898 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 1a30d3d7a1..2a6560f8ce 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1528,4 +1528,68 @@ BOOL prs_uint64(char *name, prs_struct *ps, int depth, UINT64_S *data64) prs_uint32(name, ps, depth+1, &data64->high); } +/******************************************************************* +reads or writes a BUFHDR2 structure. +********************************************************************/ +BOOL smb_io_bufhdr2(char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "smb_io_bufhdr2"); + depth++; + + prs_align(ps); + prs_uint32("info_level", ps, depth, &(hdr->info_level)); + prs_uint32("length ", ps, depth, &(hdr->length )); + prs_uint32("buffer ", ps, depth, &(hdr->buffer )); + + return True; +} + +/******************************************************************* +reads or writes a BUFFER4 structure. +********************************************************************/ +BOOL smb_io_buffer4(char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "smb_io_buffer4"); + depth++; + + prs_align(ps); + prs_uint32("buf_len", ps, depth, &(buf4->buf_len)); + + if (buf4->buf_len > MAX_BUFFERLEN) + { + buf4->buf_len = MAX_BUFFERLEN; + } + + prs_uint8s(True, "buffer", ps, depth, buf4->buffer, buf4->buf_len); + + return True; +} + +/******************************************************************* +creates a UNIHDR structure. +********************************************************************/ + +BOOL make_uni_hdr(UNIHDR *hdr, int len) +{ + if (hdr == NULL) + { + return False; + } + hdr->uni_str_len = 2 * len; + hdr->uni_max_len = 2 * len; + hdr->buffer = len != 0 ? 1 : 0; + + return True; +} +/******************************************************************* +creates a BUFHDR2 structure. +********************************************************************/ +BOOL make_bufhdr2(BUFHDR2 *hdr, uint32 info_level, uint32 length, uint32 buffer) +{ + hdr->info_level = info_level; + hdr->length = length; + hdr->buffer = buffer; + + return True; +} diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index e8f0c02a52..37bf6755b7 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1589,3 +1589,837 @@ BOOL net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int 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, + uint32 database_id) +{ + DEBUG(5, ("init_q_sam_sync\n")); + + init_unistr2(&q_s->uni_srv_name, srv_name, strlen(srv_name) + 1); + init_unistr2(&q_s->uni_cli_name, cli_name, strlen(cli_name) + 1); + + if (cli_creds) { + 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->restart_state = 0; + q_s->sync_context = 0; + q_s->max_size = 0xffff; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL net_io_q_sam_sync(char *desc, NET_Q_SAM_SYNC * q_s, prs_struct *ps, + int depth) +{ + prs_debug(ps, depth, desc, "net_io_q_sam_sync"); + depth++; + + smb_io_unistr2("", &(q_s->uni_srv_name), True, ps, depth); + smb_io_unistr2("", &(q_s->uni_cli_name), True, ps, depth); + + smb_io_cred("", &(q_s->cli_creds), ps, depth); + smb_io_cred("", &(q_s->ret_creds), ps, depth); + + prs_uint32("database_id ", ps, depth, &(q_s->database_id)); + prs_uint32("restart_state", ps, depth, &(q_s->restart_state)); + prs_uint32("sync_context ", ps, depth, &(q_s->sync_context)); + + prs_uint32("max_size", ps, depth, &(q_s->max_size)); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL net_io_sam_delta_hdr(char *desc, SAM_DELTA_HDR * delta, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "net_io_sam_delta_hdr"); + depth++; + + prs_uint16("type", ps, depth, &(delta->type)); + prs_uint16("type2", ps, depth, &(delta->type2)); + prs_uint32("target_rid", ps, depth, &(delta->target_rid)); + + prs_uint32("type3", ps, depth, &(delta->type3)); + + /* Not sure why we need this but it seems to be necessary to get + sam deltas working. */ + + if (delta->type != 0x16) + prs_uint32("ptr_delta", ps, depth, &(delta->ptr_delta)); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL net_io_sam_delta_hdr2(char *desc, SAM_DELTA_HDR *delta, + prs_struct *ps, int depth) +{ + uint32 unk; + + prs_debug(ps, depth, desc, "net_io_sam_delta_stamp"); + depth++; + + prs_uint16("type", ps, depth, &(delta->type)); + prs_uint16("type2", ps, depth, &(delta->type2)); + prs_uint32("rid", ps, depth, &unk); + + + prs_uint32("unknown_ptr", ps, depth, &unk); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL net_io_sam_delta_stamp(char *desc, SAM_DELTA_STAMP *info, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "net_io_sam_delta_stamp"); + depth++; + + prs_uint32("seqnum", ps, depth, &info->seqnum); + prs_uint32("dom_mod_count_ptr", ps, depth, &info->dom_mod_count_ptr); + if (info->dom_mod_count_ptr) + prs_uint64("dom_mod_count", ps, depth, &info->dom_mod_count); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL net_io_sam_domain_info(char *desc, SAM_DOMAIN_INFO * info, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "net_io_sam_domain_info"); + depth++; + + smb_io_unihdr("hdr_dom_name", &(info->hdr_dom_name), ps, depth); + smb_io_unihdr("hdr_oem_info", &(info->hdr_oem_info), ps, depth); + + prs_uint64("force_logoff", ps, depth, &info->force_logoff); + prs_uint16("min_pwd_len", ps, depth, &(info->min_pwd_len)); + prs_uint16("pwd_history_len", ps, depth, &info->pwd_history_len); + prs_uint64("max_pwd_age", ps, depth, &info->max_pwd_age); + prs_uint64("min_pwd_age", ps, depth, &info->min_pwd_age); + prs_uint64("dom_mod_count", ps, depth, &info->dom_mod_count); + smb_io_time("creation_time", &info->creation_time, ps, depth); + + smb_io_bufhdr2("hdr_sec_desc", &(info->hdr_sec_desc), ps, depth); + smb_io_unihdr("hdr_unknown", &(info->hdr_unknown), ps, depth); + ps->data_offset += 40; + + smb_io_unistr2("uni_dom_name", &(info->uni_dom_name), + info->hdr_dom_name.buffer, ps, depth); + smb_io_unistr2("buf_oem_info", &(info->buf_oem_info), + info->hdr_oem_info.buffer, ps, depth); + + smb_io_buffer4("buf_sec_desc", &(info->buf_sec_desc), + info->hdr_sec_desc.buffer, ps, depth); + smb_io_unistr2("buf_unknown", &(info->buf_unknown), + info->hdr_unknown.buffer, ps, depth); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL net_io_sam_group_info(char *desc, SAM_GROUP_INFO * info, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "net_io_sam_group_info"); + depth++; + + smb_io_unihdr("hdr_grp_name", &(info->hdr_grp_name), ps, depth); + smb_io_gid("gid", &(info->gid), ps, depth); + smb_io_unihdr("hdr_grp_desc", &(info->hdr_grp_desc), ps, depth); + smb_io_bufhdr2("hdr_sec_desc", &(info->hdr_sec_desc), ps, depth); + ps->data_offset += 48; + + smb_io_unistr2("uni_grp_name", &(info->uni_grp_name), + info->hdr_grp_name.buffer, ps, depth); + smb_io_unistr2("uni_grp_desc", &(info->uni_grp_desc), + info->hdr_grp_desc.buffer, ps, depth); + smb_io_buffer4("buf_sec_desc", &(info->buf_sec_desc), + info->hdr_sec_desc.buffer, ps, depth); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL net_io_sam_passwd_info(char *desc, SAM_PWD * pwd, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "net_io_sam_passwd_info"); + depth++; + + prs_uint32("unk_0 ", ps, depth, &(pwd->unk_0)); + + smb_io_unihdr("hdr_lm_pwd", &(pwd->hdr_lm_pwd), ps, depth); + prs_uint8s(False, "buf_lm_pwd", ps, depth, pwd->buf_lm_pwd, 16); + + smb_io_unihdr("hdr_nt_pwd", &(pwd->hdr_nt_pwd), ps, depth); + prs_uint8s(False, "buf_nt_pwd", ps, depth, pwd->buf_nt_pwd, 16); + + smb_io_unihdr("", &(pwd->hdr_empty_lm), ps, depth); + smb_io_unihdr("", &(pwd->hdr_empty_nt), ps, depth); + + return True; +} + +/******************************************************************* +makes a SAM_ACCOUNT_INFO structure. +********************************************************************/ +BOOL make_sam_account_info(SAM_ACCOUNT_INFO * info, + const UNISTR2 *user_name, + const UNISTR2 *full_name, + uint32 user_rid, uint32 group_rid, + const UNISTR2 *home_dir, + const UNISTR2 *dir_drive, + const UNISTR2 *log_scr, + const UNISTR2 *desc, + uint32 acb_info, + const UNISTR2 *prof_path, + const UNISTR2 *wkstas, + const UNISTR2 *unk_str, const UNISTR2 *mung_dial) +{ + int len_user_name = user_name != NULL ? user_name->uni_str_len : 0; + int len_full_name = full_name != NULL ? full_name->uni_str_len : 0; + int len_home_dir = home_dir != NULL ? home_dir->uni_str_len : 0; + int len_dir_drive = dir_drive != NULL ? dir_drive->uni_str_len : 0; + int len_logon_script = log_scr != NULL ? log_scr->uni_str_len : 0; + int len_profile_path = prof_path != NULL ? prof_path->uni_str_len : 0; + int len_description = desc != NULL ? desc->uni_str_len : 0; + int len_workstations = wkstas != NULL ? wkstas->uni_str_len : 0; + int len_unknown_str = unk_str != NULL ? unk_str->uni_str_len : 0; + int len_munged_dial = mung_dial != NULL ? mung_dial->uni_str_len : 0; + + DEBUG(5, ("make_sam_account_info\n")); + + make_uni_hdr(&(info->hdr_acct_name), len_user_name); + make_uni_hdr(&(info->hdr_full_name), len_full_name); + make_uni_hdr(&(info->hdr_home_dir), len_home_dir); + make_uni_hdr(&(info->hdr_dir_drive), len_dir_drive); + make_uni_hdr(&(info->hdr_logon_script), len_logon_script); + make_uni_hdr(&(info->hdr_profile), len_profile_path); + make_uni_hdr(&(info->hdr_acct_desc), len_description); + make_uni_hdr(&(info->hdr_workstations), len_workstations); + make_uni_hdr(&(info->hdr_comment), len_unknown_str); + make_uni_hdr(&(info->hdr_parameters), len_munged_dial); + + /* not present */ + make_bufhdr2(&(info->hdr_sec_desc), 0, 0, 0); + + info->user_rid = user_rid; + info->group_rid = group_rid; + + init_nt_time(&(info->logon_time)); + init_nt_time(&(info->logoff_time)); + init_nt_time(&(info->pwd_last_set_time)); + init_nt_time(&(info->acct_expiry_time)); + + info->logon_divs = 0xA8; + info->ptr_logon_hrs = 0; /* Don't care right now */ + + info->bad_pwd_count = 0; + info->logon_count = 0; + info->acb_info = acb_info; + info->nt_pwd_present = 0; + info->lm_pwd_present = 0; + info->pwd_expired = 0; + info->country = 0; + info->codepage = 0; + + info->unknown1 = 0x4EC; + info->unknown2 = 0; + + copy_unistr2(&(info->uni_acct_name), user_name); + copy_unistr2(&(info->uni_full_name), full_name); + copy_unistr2(&(info->uni_home_dir), home_dir); + copy_unistr2(&(info->uni_dir_drive), dir_drive); + copy_unistr2(&(info->uni_logon_script), log_scr); + copy_unistr2(&(info->uni_profile), prof_path); + copy_unistr2(&(info->uni_acct_desc), desc); + copy_unistr2(&(info->uni_workstations), wkstas); + copy_unistr2(&(info->uni_comment), unk_str); + copy_unistr2(&(info->uni_parameters), mung_dial); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL net_io_sam_account_info(char *desc, uint8 sess_key[16], + 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++; + + smb_io_unihdr("hdr_acct_name", &(info->hdr_acct_name), ps, depth); + smb_io_unihdr("hdr_full_name", &(info->hdr_full_name), ps, depth); + + prs_uint32("user_rid ", ps, depth, &(info->user_rid)); + prs_uint32("group_rid", ps, depth, &(info->group_rid)); + + smb_io_unihdr("hdr_home_dir ", &(info->hdr_home_dir), ps, depth); + smb_io_unihdr("hdr_dir_drive", &(info->hdr_dir_drive), ps, depth); + smb_io_unihdr("hdr_logon_script", &(info->hdr_logon_script), ps, + depth); + smb_io_unihdr("hdr_acct_desc", &(info->hdr_acct_desc), ps, depth); + smb_io_unihdr("hdr_workstations", &(info->hdr_workstations), ps, + depth); + + smb_io_time("logon_time", &(info->logon_time), ps, depth); + smb_io_time("logoff_time", &(info->logoff_time), ps, depth); + + prs_uint32("logon_divs ", ps, depth, &(info->logon_divs)); + prs_uint32("ptr_logon_hrs", ps, depth, &(info->ptr_logon_hrs)); + + prs_uint16("bad_pwd_count", ps, depth, &(info->bad_pwd_count)); + prs_uint16("logon_count", ps, depth, &(info->logon_count)); + smb_io_time("pwd_last_set_time", &(info->pwd_last_set_time), ps, + depth); + smb_io_time("acct_expiry_time", &(info->acct_expiry_time), ps, depth); + + prs_uint32("acb_info", ps, depth, &(info->acb_info)); + prs_uint8s(False, "nt_pwd", ps, depth, info->nt_pwd, 16); + prs_uint8s(False, "lm_pwd", ps, depth, info->lm_pwd, 16); + prs_uint8("lm_pwd_present", ps, depth, &(info->lm_pwd_present)); + prs_uint8("nt_pwd_present", ps, depth, &(info->nt_pwd_present)); + prs_uint8("pwd_expired", ps, depth, &(info->pwd_expired)); + + smb_io_unihdr("hdr_comment", &(info->hdr_comment), ps, depth); + smb_io_unihdr("hdr_parameters", &(info->hdr_parameters), ps, depth); + prs_uint16("country", ps, depth, &(info->country)); + prs_uint16("codepage", ps, depth, &(info->codepage)); + + smb_io_bufhdr2("hdr_priv_data", &(hdr_priv_data), ps, depth); + smb_io_bufhdr2("hdr_sec_desc", &(info->hdr_sec_desc), ps, depth); + smb_io_unihdr("hdr_profile", &(info->hdr_profile), ps, depth); + + for (i = 0; i < 3; i++) + { + smb_io_unihdr("hdr_reserved", &(info->hdr_reserved[i]), ps, + depth); + } + + for (i = 0; i < 4; i++) + { + prs_uint32("dw_reserved", ps, depth, &(info->dw_reserved[i])); + } + + smb_io_unistr2("uni_acct_name", &(info->uni_acct_name), + info->hdr_acct_name.buffer, ps, depth); + prs_align(ps); + smb_io_unistr2("uni_full_name", &(info->uni_full_name), + info->hdr_full_name.buffer, ps, depth); + prs_align(ps); + smb_io_unistr2("uni_home_dir ", &(info->uni_home_dir), + info->hdr_home_dir.buffer, ps, depth); + prs_align(ps); + smb_io_unistr2("uni_dir_drive", &(info->uni_dir_drive), + info->hdr_dir_drive.buffer, ps, depth); + prs_align(ps); + smb_io_unistr2("uni_logon_script", &(info->uni_logon_script), + info->hdr_logon_script.buffer, ps, depth); + prs_align(ps); + smb_io_unistr2("uni_acct_desc", &(info->uni_acct_desc), + info->hdr_acct_desc.buffer, ps, depth); + prs_align(ps); + smb_io_unistr2("uni_workstations", &(info->uni_workstations), + info->hdr_workstations.buffer, ps, depth); + prs_align(ps); + + prs_uint32("unknown1", ps, depth, &(info->unknown1)); + prs_uint32("unknown2", ps, depth, &(info->unknown2)); + + smb_io_buffer4("buf_logon_hrs", &(info->buf_logon_hrs), + info->ptr_logon_hrs, ps, depth); + prs_align(ps); + smb_io_unistr2("uni_comment", &(info->uni_comment), + info->hdr_comment.buffer, ps, depth); + prs_align(ps); + smb_io_unistr2("uni_parameters", &(info->uni_parameters), + info->hdr_parameters.buffer, ps, depth); + prs_align(ps); + if (hdr_priv_data.buffer != 0) + { + int old_offset = 0; + uint32 len = 0x44; + prs_uint32("pwd_len", ps, depth, &len); + old_offset = ps->data_offset; + if (len == 0x44) + { + if (ps->io) + { + /* reading */ +// FIXME prs_hash1(ps, ps->offset, sess_key); + } + net_io_sam_passwd_info("pass", &(info->pass), ps, + depth); + if (!ps->io) + { + /* writing */ +// FIXME TOO prs_hash1(ps, old_offset, sess_key); + } + } + ps->data_offset = old_offset + len; + } + smb_io_buffer4("buf_sec_desc", &(info->buf_sec_desc), + info->hdr_sec_desc.buffer, ps, depth); + prs_align(ps); + smb_io_unistr2("uni_profile", &(info->uni_profile), + info->hdr_profile.buffer, ps, depth); + prs_align(ps); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL net_io_sam_group_mem_info(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); + prs_uint32("ptr_rids ", ps, depth, &(info->ptr_rids)); + prs_uint32("ptr_attribs", ps, depth, &(info->ptr_attribs)); + prs_uint32("num_members", ps, depth, &(info->num_members)); + ps->data_offset += 16; + + if (info->ptr_rids != 0) + { + prs_uint32("num_members2", ps, depth, &(info->num_members2)); + if (info->num_members2 != info->num_members) + { + /* RPC fault */ + return False; + } + + info->rids = talloc(ps->mem_ctx, sizeof(uint32) * + info->num_members2); + + if (info->rids == NULL) { + DEBUG(0, ("out of memory allocating %d rids\n", + info->num_members2)); + return False; + } + + for (i = 0; i < info->num_members2; i++) + { + slprintf(tmp, sizeof(tmp) - 1, "rids[%02d]", i); + prs_uint32(tmp, ps, depth, &(info->rids[i])); + } + } + + if (info->ptr_attribs != 0) + { + prs_uint32("num_members3", ps, depth, &(info->num_members3)); + if (info->num_members3 != info->num_members) + { + /* RPC fault */ + return False; + } + + info->attribs = talloc(ps->mem_ctx, sizeof(uint32) * + info->num_members3); + + if (info->attribs == NULL) { + DEBUG(0, ("out of memory allocating %d attribs\n", + info->num_members3)); + return False; + } + + for (i = 0; i < info->num_members3; i++) + { + slprintf(tmp, sizeof(tmp) - 1, "attribs[%02d]", i); + prs_uint32(tmp, ps, depth, &(info->attribs[i])); + } + } + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL net_io_sam_alias_info(char *desc, SAM_ALIAS_INFO * info, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "net_io_sam_alias_info"); + depth++; + + smb_io_unihdr("hdr_als_name", &(info->hdr_als_name), ps, depth); + prs_uint32("als_rid", ps, depth, &(info->als_rid)); + smb_io_bufhdr2("hdr_sec_desc", &(info->hdr_sec_desc), ps, depth); + smb_io_unihdr("hdr_als_desc", &(info->hdr_als_desc), ps, depth); + ps->data_offset += 40; + + smb_io_unistr2("uni_als_name", &(info->uni_als_name), + info->hdr_als_name.buffer, ps, depth); + smb_io_buffer4("buf_sec_desc", &(info->buf_sec_desc), + info->hdr_sec_desc.buffer, ps, depth); + smb_io_unistr2("uni_als_desc", &(info->uni_als_desc), + info->hdr_als_name.buffer, ps, depth); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL net_io_sam_alias_mem_info(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); + prs_uint32("num_members", ps, depth, &(info->num_members)); + prs_uint32("ptr_members", ps, depth, &(info->ptr_members)); + ps->data_offset += 16; + + if (info->ptr_members != 0) + { + prs_uint32("num_sids", ps, depth, &(info->num_sids)); + if (info->num_sids != info->num_members) + { + /* RPC fault */ + return False; + } + + info->ptr_sids = talloc(ps->mem_ctx, sizeof(uint32) * + info->num_sids); + + if (info->ptr_sids == NULL) { + DEBUG(0, ("out of memory allocating %d ptr_sids\n", + info->num_sids)); + return False; + } + + for (i = 0; i < info->num_sids; i++) + { + slprintf(tmp, sizeof(tmp) - 1, "ptr_sids[%02d]", i); + prs_uint32(tmp, ps, depth, &(info->ptr_sids[i])); + } + + info->sids = talloc(ps->mem_ctx, sizeof(DOM_SID2) * + info->num_sids); + + if (info->sids == NULL) { + DEBUG(0, ("error allocating %d sids\n", + info->num_sids)); + return False; + } + + for (i = 0; i < info->num_sids; i++) + { + if (info->ptr_sids[i] != 0) + { + slprintf(tmp, sizeof(tmp) - 1, "sids[%02d]", + i); + smb_io_dom_sid2(tmp, &(info->sids[i]), ps, + depth); + } + } + } + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], + 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_SAM_STAMP: + { + net_io_sam_delta_stamp("", &delta->stamp, + ps, depth); + break; + } + + case SAM_DELTA_DOMAIN_INFO: + { + net_io_sam_domain_info("", &delta->domain_info, + ps, depth); + break; + } + case SAM_DELTA_GROUP_INFO: + { + net_io_sam_group_info("", &delta->group_info, + ps, depth); + break; + } + case SAM_DELTA_ACCOUNT_INFO: + { + net_io_sam_account_info("", sess_key, + &delta->account_info, + ps, depth); + break; + } + case SAM_DELTA_GROUP_MEM: + { + net_io_sam_group_mem_info("", &delta->grp_mem_info, + ps, depth); + break; + } + case SAM_DELTA_ALIAS_INFO: + { + net_io_sam_alias_info("", &delta->alias_info, + ps, depth); + break; + } + case SAM_DELTA_ALIAS_MEM: + { + net_io_sam_alias_mem_info("", &delta->als_mem_info, + ps, depth); + break; + } + 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(char *desc, uint8 sess_key[16], + NET_R_SAM_SYNC * r_s, prs_struct *ps, int depth) +{ + uint32 i; + + prs_debug(ps, depth, desc, "net_io_r_sam_sync"); + depth++; + + smb_io_cred("srv_creds", &(r_s->srv_creds), ps, depth); + prs_uint32("sync_context", ps, depth, &(r_s->sync_context)); + + prs_uint32("ptr_deltas", ps, depth, &(r_s->ptr_deltas)); + if (r_s->ptr_deltas != 0) + { + prs_uint32("num_deltas ", ps, depth, &(r_s->num_deltas)); + prs_uint32("ptr_deltas2", ps, depth, &(r_s->ptr_deltas2)); + if (r_s->ptr_deltas2 != 0) + { + prs_uint32("num_deltas2", ps, depth, + &(r_s->num_deltas2)); + + if (r_s->num_deltas2 != r_s->num_deltas) + { + /* RPC fault */ + return False; + } + + if (r_s->num_deltas2 > 0) { + r_s->hdr_deltas = (SAM_DELTA_HDR *) + talloc(ps->mem_ctx, r_s->num_deltas2 * + sizeof(SAM_DELTA_HDR)); + + if (r_s->hdr_deltas == NULL) { + DEBUG(0, ("error tallocating memory " + "for %d delta headers\n", + r_s->num_deltas2)); + return False; + } + } + + for (i = 0; i < r_s->num_deltas2; i++) + { + net_io_sam_delta_hdr("", &r_s->hdr_deltas[i], + ps, depth); + } + + if (r_s->num_deltas2 > 0) { + r_s->deltas = (SAM_DELTA_CTR *) + talloc(ps->mem_ctx, r_s->num_deltas2 * + sizeof(SAM_DELTA_CTR)); + + if (r_s->deltas == NULL) { + DEBUG(0, ("error tallocating memory " + "for %d deltas\n", + r_s->num_deltas2)); + return False; + } + } + + for (i = 0; i < r_s->num_deltas2; i++) + { + net_io_sam_delta_ctr("", sess_key, + &r_s->deltas[i], + r_s->hdr_deltas[i].type3, + ps, depth); + } + } + } + + prs_align(ps); + prs_uint32("status", ps, depth, &(r_s->status)); + + 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_S dom_mod_count) +{ + DEBUG(5, ("init_net_q_sam_deltas\n")); + + init_unistr2(&q_s->uni_srv_name, srv_name, strlen(srv_name) + 1); + init_unistr2(&q_s->uni_cli_name, cli_name, strlen(cli_name) + 1); + + 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.low = dom_mod_count.low; + q_s->dom_mod_count.high = dom_mod_count.high; + q_s->max_size = 0xffff; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL net_io_q_sam_deltas(char *desc, NET_Q_SAM_DELTAS *q_s, prs_struct *ps, + int depth) +{ + prs_debug(ps, depth, desc, "net_io_q_sam_deltas"); + depth++; + + smb_io_unistr2("", &q_s->uni_srv_name, True, ps, depth); + smb_io_unistr2("", &q_s->uni_cli_name, True, ps, depth); + + smb_io_cred("", &q_s->cli_creds, ps, depth); + smb_io_cred("", &q_s->ret_creds, ps, depth); + + prs_uint32("database_id ", ps, depth, &q_s->database_id); + prs_uint64("dom_mod_count", ps, depth, &q_s->dom_mod_count); + prs_uint32("max_size", ps, depth, &q_s->max_size); + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL net_io_r_sam_deltas(char *desc, uint8 sess_key[16], + NET_R_SAM_DELTAS *r_s, prs_struct *ps, int depth) +{ + int i; + + prs_debug(ps, depth, desc, "net_io_r_sam_deltas"); + depth++; + + smb_io_cred("srv_creds", &r_s->srv_creds, ps, depth); + prs_uint64("dom_mod_count", ps, depth, &r_s->dom_mod_count); + + prs_uint32("ptr_deltas", ps, depth, &r_s->ptr_deltas); + prs_uint32("num_deltas", ps, depth, &r_s->num_deltas); + prs_uint32("ptr_deltas2", ps, depth, &r_s->num_deltas2); + + if (r_s->num_deltas2 != 0) + { + prs_uint32("num_deltas2 ", ps, depth, &(r_s->num_deltas2)); + + if (r_s->ptr_deltas != 0) + { + if (r_s->num_deltas > 0) { + r_s->hdr_deltas = (SAM_DELTA_HDR *) + talloc(ps->mem_ctx, r_s->num_deltas * + sizeof(SAM_DELTA_HDR)); + if (r_s->hdr_deltas == NULL) { + DEBUG(0, ("error tallocating memory " + "for %d delta headers\n", + r_s->num_deltas)); + return False; + } + } + + for (i = 0; i < r_s->num_deltas; i++) + { + net_io_sam_delta_hdr("", &r_s->hdr_deltas[i], + ps, depth); + } + + if (r_s->num_deltas > 0) { + r_s->deltas = (SAM_DELTA_CTR *) + talloc(ps->mem_ctx, r_s->num_deltas * + sizeof(SAM_DELTA_CTR)); + + if (r_s->deltas == NULL) { + DEBUG(0, ("error tallocating memory " + "for %d deltas\n", + r_s->num_deltas)); + return False; + } + } + + for (i = 0; i < r_s->num_deltas; i++) + { + net_io_sam_delta_ctr("", sess_key, + &r_s->deltas[i], + r_s->hdr_deltas[i].type2, + ps, depth); + } + } + } + + prs_align(ps); + prs_uint32("status", ps, depth, &(r_s->status)); + + return True; +} -- cgit From b4ed8c836598a68d68aed90fe7d0c1a48d4a7583 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 31 Aug 2001 03:38:48 +0000 Subject: Fix up some compile issues. We can't have C99 comments and add a smattering of const. (This used to be commit af53e774d754d72b01d9840e8b45d27bc394e33d) --- source3/rpc_parse/parse_misc.c | 2 +- source3/rpc_parse/parse_net.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 2a6560f8ce..3015e383fd 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -786,7 +786,7 @@ void init_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf) Copies a UNISTR2 structure. ********************************************************************/ -void copy_unistr2(UNISTR2 *str, UNISTR2 *from) +void copy_unistr2(UNISTR2 *str, const UNISTR2 *from) { /* set up string lengths. add one if string is not null-terminated */ diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 37bf6755b7..7f777c9434 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1977,14 +1977,14 @@ static BOOL net_io_sam_account_info(char *desc, uint8 sess_key[16], if (ps->io) { /* reading */ -// FIXME prs_hash1(ps, ps->offset, sess_key); +/* // FIXME prs_hash1(ps, ps->offset, sess_key); */ } net_io_sam_passwd_info("pass", &(info->pass), ps, depth); if (!ps->io) { /* writing */ -// FIXME TOO prs_hash1(ps, old_offset, sess_key); +/* // FIXME TOO prs_hash1(ps, old_offset, sess_key); */ } } ps->data_offset = old_offset + len; -- cgit From 19fea3242cf6234786b6cbb60631e0071f31ff9f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 4 Sep 2001 07:13:01 +0000 Subject: the next stage in the NTSTATUS/WERROR change. smbd and nmbd now compile, but the client code still needs some work (This used to be commit dcd6e735f709a9231860ceb9682db40ff26c9a66) --- source3/rpc_parse/parse_dfs.c | 10 ++-- source3/rpc_parse/parse_lsa.c | 34 ++++++------ source3/rpc_parse/parse_net.c | 28 +++++----- source3/rpc_parse/parse_prs.c | 61 +++++++++++++++++++++ source3/rpc_parse/parse_reg.c | 38 +++++++------- source3/rpc_parse/parse_rpc.c | 2 +- source3/rpc_parse/parse_samr.c | 108 +++++++++++++++++++------------------- source3/rpc_parse/parse_spoolss.c | 88 +++++++++++++++---------------- source3/rpc_parse/parse_srv.c | 32 +++++------ source3/rpc_parse/parse_wks.c | 2 +- 10 files changed, 232 insertions(+), 171 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index 0c7ea54315..70270e2c36 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -66,7 +66,7 @@ BOOL dfs_io_r_dfs_exist(char *desc, DFS_R_DFS_EXIST *q_d, prs_struct *ps, int de if(!prs_align(ps)) return False; - if(!prs_uint32("exist flag", ps, 0, &q_d->status)) + if(!prs_ntstatus("exist flag", ps, 0, &q_d->status)) return False; return True; @@ -139,7 +139,7 @@ BOOL dfs_io_r_dfs_remove(char *desc, DFS_R_DFS_REMOVE *r_d, prs_struct *ps, int prs_debug(ps, depth, desc, "dfs_io_r_dfs_remove"); depth++; - if(!prs_uint32("status", ps, depth, &r_d->status)) + if(!prs_ntstatus("status", ps, depth, &r_d->status)) return False; return True; @@ -225,7 +225,7 @@ BOOL dfs_io_r_dfs_add(char *desc, DFS_R_DFS_ADD *r_d, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "dfs_io_r_dfs_add"); depth++; - if(!prs_uint32("status", ps, depth, &r_d->status)) + if(!prs_ntstatus("status", ps, depth, &r_d->status)) return False; return True; @@ -300,7 +300,7 @@ BOOL dfs_io_r_dfs_get_info(char* desc, DFS_R_DFS_GET_INFO* r_i, prs_struct* ps, if(!dfs_io_dfs_info_ctr("", &r_i->ctr, 1, r_i->level, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_i->status)) + if(!prs_ntstatus("status", ps, depth, &r_i->status)) return False; return True; } @@ -501,7 +501,7 @@ BOOL dfs_io_r_dfs_enum(char *desc, DFS_R_DFS_ENUM *q_d, prs_struct *ps, int dept if(!smb_io_enum_hnd("resume_hnd", &q_d->reshnd, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &q_d->status)) + if(!prs_ntstatus("status", ps, depth, &q_d->status)) return False; return True; } diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 9bfb6746bb..29da2c6913 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -324,7 +324,7 @@ BOOL lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, if(!smb_io_pol_hnd("", &r_p->pol, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_p->status)) + if(!prs_ntstatus("status", ps, depth, &r_p->status)) return False; return True; @@ -391,7 +391,7 @@ BOOL lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, if(!smb_io_pol_hnd("", &r_p->pol, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_p->status)) + if(!prs_ntstatus("status", ps, depth, &r_p->status)) return False; return True; @@ -452,7 +452,7 @@ BOOL lsa_io_r_query_sec_obj(char *desc, LSA_R_QUERY_SEC_OBJ *r_u, return False; } - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -538,7 +538,7 @@ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 en r_e->enum_context = enum_context; - if (status == 0) { + if (NT_STATUS_IS_OK(status)) { int len_domain_name = strlen(domain_name) + 1; r_e->num_domains = 1; @@ -619,7 +619,7 @@ BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, } } - if(!prs_uint32("status", ps, depth, &r_e->status)) + if(!prs_ntstatus("status", ps, depth, &r_e->status)) return False; return True; @@ -789,7 +789,7 @@ BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_q->status)) + if(!prs_ntstatus("status", ps, depth, &r_q->status)) return False; return True; @@ -1031,7 +1031,7 @@ BOOL lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, if(!prs_uint32("mapped_count", ps, depth, &r_s->mapped_count)) return False; - if(!prs_uint32("status ", ps, depth, &r_s->status)) + if(!prs_ntstatus("status ", ps, depth, &r_s->status)) return False; return True; @@ -1192,7 +1192,7 @@ BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, if(!prs_uint32("mapped_count", ps, depth, &r_r->mapped_count)) return False; - if(!prs_uint32("status ", ps, depth, &r_r->status)) + if(!prs_ntstatus("status ", ps, depth, &r_r->status)) return False; return True; @@ -1237,7 +1237,7 @@ BOOL lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth) if(!smb_io_pol_hnd("", &r_c->pol, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &r_c->status)) return False; return True; @@ -1276,7 +1276,7 @@ BOOL lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_c, prs_struct *ps, in return False; if(!prs_uint32("dummy4", ps, depth, &r_c->dummy4)) return False; - if(!prs_uint32("status", ps, depth, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &r_c->status)) return False; return True; @@ -1391,7 +1391,7 @@ BOOL lsa_io_r_enum_privs(char *desc, LSA_R_ENUM_PRIVS *r_q, prs_struct *ps, int if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_q->status)) + if(!prs_ntstatus("status", ps, depth, &r_q->status)) return False; return True; @@ -1461,7 +1461,7 @@ BOOL lsa_io_r_priv_get_dispname(char *desc, LSA_R_PRIV_GET_DISPNAME *r_q, prs_st if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_q->status)) + if(!prs_ntstatus("status", ps, depth, &r_q->status)) return False; return True; @@ -1532,7 +1532,7 @@ BOOL lsa_io_r_enum_accounts(char *desc, LSA_R_ENUM_ACCOUNTS *r_q, prs_struct *ps if (!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_q->status)) + if(!prs_ntstatus("status", ps, depth, &r_q->status)) return False; return True; @@ -1603,7 +1603,7 @@ BOOL lsa_io_r_unk_get_connuser(char *desc, LSA_R_UNK_GET_CONNUSER *r_c, prs_stru if (!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &r_c->status)) return False; return True; @@ -1648,7 +1648,7 @@ BOOL lsa_io_r_open_account(char *desc, LSA_R_OPENACCOUNT *r_c, prs_struct *ps, if(!smb_io_pol_hnd("pol", &r_c->pol, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &r_c->status)) return False; return True; @@ -1776,7 +1776,7 @@ BOOL lsa_io_r_enum_privsaccount(char *desc, LSA_R_ENUMPRIVSACCOUNT *r_c, prs_str return False; } - if(!prs_uint32("status", ps, depth, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &r_c->status)) return False; return True; @@ -1817,7 +1817,7 @@ BOOL lsa_io_r_getsystemaccount(char *desc, LSA_R_GETSYSTEMACCOUNT *r_c, prs_str if(!prs_uint32("access", ps, depth, &r_c->access)) return False; - if(!prs_uint32("status", ps, depth, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &r_c->status)) return False; return True; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 7f777c9434..bb8b2608b3 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -249,18 +249,18 @@ void init_net_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level, case 1: r_l->ptr = 1; /* undocumented pointer */ init_netinfo_1(&r_l->logon.info1, flags, pdc_status); - r_l->status = 0; + 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 = 0; + 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 = 0; + r_l->status = NT_STATUS_OK; break; default: DEBUG(2,("init_r_logon_ctrl2: unsupported switch value %d\n", @@ -311,7 +311,7 @@ BOOL net_io_r_logon_ctrl2(char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, in } } - if(!prs_uint32("status ", ps, depth, &r_l->status)) + if(!prs_ntstatus("status ", ps, depth, &r_l->status)) return False; return True; @@ -377,7 +377,7 @@ void init_net_r_logon_ctrl(NET_R_LOGON_CTRL *r_l, uint32 query_level, case 1: r_l->ptr = 1; /* undocumented pointer */ init_netinfo_1(&r_l->logon.info1, flags, pdc_status); - r_l->status = 0; + r_l->status = NT_STATUS_OK; break; default: DEBUG(2,("init_r_logon_ctrl: unsupported switch value %d\n", @@ -418,7 +418,7 @@ BOOL net_io_r_logon_ctrl(char *desc, NET_R_LOGON_CTRL *r_l, prs_struct *ps, } } - if(!prs_uint32("status ", ps, depth, &r_l->status)) + if(!prs_ntstatus("status ", ps, depth, &r_l->status)) return False; return True; @@ -451,7 +451,7 @@ void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, r_t->uni_trust_dom_name[i].undoc = 0x1; } - r_t->status = 0; + r_t->status = NT_STATUS_OK; } /******************************************************************* @@ -499,7 +499,7 @@ BOOL net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, i return False; } - if(!prs_uint32("status", ps, depth, &r_t->status)) + if(!prs_ntstatus("status", ps, depth, &r_t->status)) return False; #endif return True; @@ -602,7 +602,7 @@ BOOL net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int dept if(!smb_io_chal("", &r_c->srv_chal, ps, depth)) /* server challenge */ return False; - if(!prs_uint32("status", ps, depth, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &r_c->status)) return False; return True; @@ -658,7 +658,7 @@ BOOL net_io_r_auth(char *desc, NET_R_AUTH *r_a, prs_struct *ps, int depth) if(!smb_io_chal("", &r_a->srv_chal, ps, depth)) /* server challenge */ return False; - if(!prs_uint32("status", ps, depth, &r_a->status)) + if(!prs_ntstatus("status", ps, depth, &r_a->status)) return False; return True; @@ -734,7 +734,7 @@ BOOL net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth) if(!net_io_neg_flags("", &r_a->srv_flgs, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_a->status)) + if(!prs_ntstatus("status", ps, depth, &r_a->status)) return False; return True; @@ -796,7 +796,7 @@ BOOL net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int de if(!smb_io_cred("", &r_s->srv_cred, ps, depth)) /* server challenge */ return False; - if(!prs_uint32("status", ps, depth, &r_s->status)) + if(!prs_ntstatus("status", ps, depth, &r_s->status)) return False; return True; @@ -1534,7 +1534,7 @@ BOOL net_io_r_sam_logon(char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, int de if(!prs_uint32("auth_resp ", ps, depth, &r_l->auth_resp)) /* 1 - Authoritative response; 0 - Non-Auth? */ return False; - if(!prs_uint32("status ", ps, depth, &r_l->status)) + if(!prs_ntstatus("status ", ps, depth, &r_l->status)) return False; if(!prs_align(ps)) @@ -1584,7 +1584,7 @@ BOOL net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int if(!smb_io_cred("", &r_l->srv_creds, ps, depth)) /* server credentials. server time stamp appears to be ignored. */ return False; - if(!prs_uint32("status ", ps, depth, &r_l->status)) + if(!prs_ntstatus("status ", ps, depth, &r_l->status)) return False; return True; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 6bab18ba9d..11fa46069a 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -551,6 +551,67 @@ BOOL prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) return True; } +/******************************************************************* + Stream a NTSTATUS + ********************************************************************/ + +BOOL prs_ntstatus(char *name, prs_struct *ps, int depth, NTSTATUS *status) +{ + char *q = prs_mem_get(ps, sizeof(uint32)); + if (q == NULL) + return False; + + if (UNMARSHALLING(ps)) { + if (ps->bigendian_data) + *status = NT_STATUS(RIVAL(q,0)); + else + *status = NT_STATUS(IVAL(q,0)); + } else { + if (ps->bigendian_data) + RSIVAL(q,0,NT_STATUS_V(*status)); + else + SIVAL(q,0,NT_STATUS_V(*status)); + } + + DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name, + get_nt_error_msg(*status))); + + ps->data_offset += sizeof(uint32); + + return True; +} + +/******************************************************************* + Stream a WERROR + ********************************************************************/ + +BOOL prs_werror(char *name, prs_struct *ps, int depth, WERROR *status) +{ + char *q = prs_mem_get(ps, sizeof(uint32)); + if (q == NULL) + return False; + + if (UNMARSHALLING(ps)) { + if (ps->bigendian_data) + *status = W_ERROR(RIVAL(q,0)); + else + *status = W_ERROR(IVAL(q,0)); + } else { + if (ps->bigendian_data) + RSIVAL(q,0,W_ERROR_V(*status)); + else + SIVAL(q,0,W_ERROR_V(*status)); + } + + DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name, + werror_str(*status))); + + ps->data_offset += sizeof(uint32); + + return True; +} + + /****************************************************************** Stream an array of uint8s. Length is number of uint8s. ********************************************************************/ diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 3a6f7ba819..e7c1b8ecfe 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -91,7 +91,7 @@ BOOL reg_io_r_open_hkcr(char *desc, REG_R_OPEN_HKCR *r_r, prs_struct *ps, int d if(!smb_io_pol_hnd("", &r_r->pol, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_r->status)) + if(!prs_ntstatus("status", ps, depth, &r_r->status)) return False; return True; @@ -160,7 +160,7 @@ BOOL reg_io_r_open_hklm(char *desc, REG_R_OPEN_HKLM * r_r, prs_struct *ps, if (!smb_io_pol_hnd("", &(r_r->pol), ps, depth)) return False; - if (!prs_uint32("status", ps, depth, &(r_r->status))) + if (!prs_ntstatus("status", ps, depth, &(r_r->status))) return False; return True; @@ -212,7 +212,7 @@ BOOL reg_io_r_flush_key(char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, int d if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_r->status)) + if(!prs_ntstatus("status", ps, depth, &r_r->status)) return False; return True; @@ -365,7 +365,7 @@ BOOL reg_io_r_create_key(char *desc, REG_R_CREATE_KEY *r_r, prs_struct *ps, int if(!prs_uint32("unknown", ps, depth, &r_r->unknown)) return False; - if(!prs_uint32("status", ps, depth, &r_r->status)) + if(!prs_ntstatus("status", ps, depth, &r_r->status)) return False; return True; @@ -432,7 +432,7 @@ BOOL reg_io_r_delete_val(char *desc, REG_R_DELETE_VALUE *r_r, prs_struct *ps, i if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_r->status)) + if(!prs_ntstatus("status", ps, depth, &r_r->status)) return False; return True; @@ -497,7 +497,7 @@ BOOL reg_io_r_delete_key(char *desc, REG_R_DELETE_KEY *r_r, prs_struct *ps, int if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_r->status)) + if(!prs_ntstatus("status", ps, depth, &r_r->status)) return False; return True; @@ -586,7 +586,7 @@ BOOL reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int d if(!smb_io_time("mod_time ", &r_r->mod_time, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_r->status)) + if(!prs_ntstatus("status", ps, depth, &r_r->status)) return False; return True; @@ -639,7 +639,7 @@ BOOL reg_io_r_unk_1a(char *desc, REG_R_UNK_1A *r_r, prs_struct *ps, int depth) if(!prs_uint32("unknown", ps, depth, &r_r->unknown)) return False; - if(!prs_uint32("status" , ps, depth, &r_r->status)) + if(!prs_ntstatus("status" , ps, depth, &r_r->status)) return False; return True; @@ -705,7 +705,7 @@ BOOL reg_io_r_open_hku(char *desc, REG_R_OPEN_HKU *r_r, prs_struct *ps, int dep if(!smb_io_pol_hnd("", &r_r->pol, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_r->status)) + if(!prs_ntstatus("status", ps, depth, &r_r->status)) return False; return True; @@ -765,7 +765,7 @@ BOOL reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -830,7 +830,7 @@ BOOL reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, in if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_q->status)) + if(!prs_ntstatus("status", ps, depth, &r_q->status)) return False; return True; @@ -928,7 +928,7 @@ BOOL reg_io_r_get_key_sec(char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, i return False; } - if(!prs_uint32("status", ps, depth, &r_q->status)) + if(!prs_ntstatus("status", ps, depth, &r_q->status)) return False; return True; @@ -1103,7 +1103,7 @@ BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) return False; } - if(!prs_uint32("status", ps, depth, &r_r->status)) + if(!prs_ntstatus("status", ps, depth, &r_r->status)) return False; return True; @@ -1247,7 +1247,7 @@ BOOL reg_io_r_enum_val(char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, int d return False; } - if(!prs_uint32("status", ps, depth, &r_q->status)) + if(!prs_ntstatus("status", ps, depth, &r_q->status)) return False; return True; @@ -1324,7 +1324,7 @@ BOOL reg_io_r_create_val(char *desc, REG_R_CREATE_VALUE *r_q, prs_struct *ps, i if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_q->status)) + if(!prs_ntstatus("status", ps, depth, &r_q->status)) return False; return True; @@ -1457,7 +1457,7 @@ BOOL reg_io_r_enum_key(char *desc, REG_R_ENUM_KEY *r_q, prs_struct *ps, int dep return False; } - if(!prs_uint32("status", ps, depth, &r_q->status)) + if(!prs_ntstatus("status", ps, depth, &r_q->status)) return False; return True; @@ -1543,7 +1543,7 @@ BOOL reg_io_r_open_entry(char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int if(!smb_io_pol_hnd("", &r_r->pol, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_r->status)) + if(!prs_ntstatus("status", ps, depth, &r_r->status)) return False; return True; @@ -1622,7 +1622,7 @@ BOOL reg_io_r_shutdown(char *desc, REG_R_SHUTDOWN * r_s, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &(r_s->status))) + if(!prs_ntstatus("status", ps, depth, &(r_s->status))) return False; return True; @@ -1677,7 +1677,7 @@ BOOL reg_io_r_abort_shutdown(char *desc, REG_R_ABORT_SHUTDOWN * r_s, if (!prs_align(ps)) return False; - if (!prs_uint32("status", ps, depth, &(r_s->status))) + if (!prs_ntstatus("status", ps, depth, &(r_s->status))) return False; return True; diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index a60bad0aa2..e457b48bf9 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -520,7 +520,7 @@ BOOL smb_io_rpc_hdr_fault(char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int de prs_debug(ps, depth, desc, "smb_io_rpc_hdr_fault"); depth++; - if(!prs_uint32("status ", ps, depth, &rpc->status)) + if(!prs_ntstatus("status ", ps, depth, &rpc->status)) return False; if(!prs_uint32("reserved", ps, depth, &rpc->reserved)) return False; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index f39104fed0..82902e5149 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -78,7 +78,7 @@ BOOL samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND * r_u, if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -139,7 +139,7 @@ void init_samr_r_lookup_domain(SAMR_R_LOOKUP_DOMAIN * r_u, r_u->status = status; r_u->ptr_sid = 0; - if (status == 0x0) { + if (NT_STATUS_IS_OK(status)) { r_u->ptr_sid = 1; init_dom_sid2(&r_u->dom_sid, dom_sid); } @@ -171,7 +171,7 @@ BOOL samr_io_r_lookup_domain(char *desc, SAMR_R_LOOKUP_DOMAIN * r_u, return False; } - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -233,7 +233,7 @@ BOOL samr_io_r_unknown_2d(char *desc, SAMR_R_UNKNOWN_2D * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -301,7 +301,7 @@ BOOL samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN * r_u, if(!smb_io_pol_hnd("domain_pol", &r_u->domain_pol, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -375,7 +375,7 @@ BOOL samr_io_r_get_usrdom_pwinfo(char *desc, SAMR_R_GET_USRDOM_PWINFO * r_u, return False; if(!prs_uint32("unknown_2", ps, depth, &r_u->unknown_2)) return False; - if(!prs_uint32("status ", ps, depth, &r_u->status)) + if(!prs_ntstatus("status ", ps, depth, &r_u->status)) return False; return True; @@ -770,7 +770,7 @@ void init_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO * r_u, r_u->switch_value = 0; r_u->status = status; /* return status */ - if (status == 0) { + if (NT_STATUS_IS_OK(status)) { r_u->switch_value = switch_value; r_u->ptr_0 = 1; r_u->ctr = ctr; @@ -842,7 +842,7 @@ BOOL samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -871,7 +871,7 @@ BOOL samr_io_r_query_sec_obj(char *desc, SAMR_R_QUERY_SEC_OBJ * r_u, return False; } - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -1361,7 +1361,7 @@ BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS * r_u, if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -2006,7 +2006,7 @@ BOOL samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO * r_u, if (r_u->ptr_entries==0) { if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -2050,7 +2050,7 @@ BOOL samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -2117,7 +2117,7 @@ BOOL samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP * r_u, if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -2338,7 +2338,7 @@ BOOL samr_io_r_create_dom_group(char *desc, SAMR_R_CREATE_DOM_GROUP * r_u, if(!prs_uint32("rid ", ps, depth, &r_u->rid)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -2394,7 +2394,7 @@ BOOL samr_io_r_delete_dom_group(char *desc, SAMR_R_DELETE_DOM_GROUP * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -2466,7 +2466,7 @@ BOOL samr_io_r_del_groupmem(char *desc, SAMR_R_DEL_GROUPMEM * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -2541,7 +2541,7 @@ BOOL samr_io_r_add_groupmem(char *desc, SAMR_R_ADD_GROUPMEM * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -2612,7 +2612,7 @@ BOOL samr_io_r_set_groupinfo(char *desc, SAMR_R_SET_GROUPINFO * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -2666,7 +2666,7 @@ void init_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO * r_u, { DEBUG(5, ("init_samr_r_query_groupinfo\n")); - r_u->ptr = (status == 0x0 && ctr != NULL) ? 1 : 0; + r_u->ptr = (NT_STATUS_IS_OK(status) && ctr != NULL) ? 1 : 0; r_u->ctr = ctr; r_u->status = status; } @@ -2697,7 +2697,7 @@ BOOL samr_io_r_query_groupinfo(char *desc, SAMR_R_QUERY_GROUPINFO * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -2746,7 +2746,7 @@ void init_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM * r_u, { DEBUG(5, ("init_samr_r_query_groupmem\n")); - if (status == 0x0) { + if (NT_STATUS_IS_OK(status)) { r_u->ptr = 1; r_u->num_entries = num_entries; @@ -2830,7 +2830,7 @@ BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM * r_u, } } - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -2880,7 +2880,7 @@ void init_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS * r_u, { DEBUG(5, ("init_samr_r_query_usergroups\n")); - if (status == 0) { + 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; @@ -2968,7 +2968,7 @@ BOOL samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -3107,7 +3107,7 @@ BOOL samr_io_r_enum_domains(char *desc, SAMR_R_ENUM_DOMAINS * r_u, return False; if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -3241,7 +3241,7 @@ BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS * r_u, return False; if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -3376,7 +3376,7 @@ BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u, return False; if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -3499,7 +3499,7 @@ void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO * r_u, { DEBUG(5, ("init_samr_r_query_aliasinfo\n")); - r_u->ptr = (status == 0x0 && ctr != NULL) ? 1 : 0; + r_u->ptr = (NT_STATUS_IS_OK(status) && ctr != NULL) ? 1 : 0; r_u->ctr = *ctr; r_u->status = status; } @@ -3530,7 +3530,7 @@ BOOL samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -3588,7 +3588,7 @@ BOOL samr_io_r_set_aliasinfo(char *desc, SAMR_R_SET_ALIASINFO * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -3685,7 +3685,7 @@ void init_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES * r_u, { DEBUG(5, ("init_samr_r_query_useraliases\n")); - if (status == 0x0) { + if (NT_STATUS_IS_OK(status)) { r_u->num_entries = num_rids; r_u->ptr = 1; r_u->num_entries2 = num_rids; @@ -3767,7 +3767,7 @@ BOOL samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -3833,7 +3833,7 @@ BOOL samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS * r_u, if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -4027,7 +4027,7 @@ BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS * r_u, } } - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -4084,7 +4084,7 @@ BOOL samr_io_r_delete_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u, if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -4164,7 +4164,7 @@ BOOL samr_io_r_create_dom_alias(char *desc, SAMR_R_CREATE_DOM_ALIAS * r_u, if(!prs_uint32("rid", ps, depth, &r_u->rid)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -4223,7 +4223,7 @@ BOOL samr_io_r_add_aliasmem(char *desc, SAMR_R_ADD_ALIASMEM * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -4282,7 +4282,7 @@ BOOL samr_io_r_del_aliasmem(char *desc, SAMR_R_DEL_ALIASMEM * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -4350,7 +4350,7 @@ BOOL samr_io_r_delete_dom_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -4400,7 +4400,7 @@ void init_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM * r_u, { DEBUG(5, ("init_samr_r_query_aliasmem\n")); - if (status == 0) { + 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; @@ -4462,7 +4462,7 @@ BOOL samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -4568,7 +4568,7 @@ NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, { DEBUG(5, ("init_samr_r_lookup_names\n")); - if ((status == 0) && (num_rids != 0)) { + if (NT_STATUS_IS_OK(status) && (num_rids != 0)) { uint32 i; r_u->num_types1 = num_rids; @@ -4691,7 +4691,7 @@ BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES * r_u, } } - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -4747,7 +4747,7 @@ BOOL samr_io_r_delete_dom_user(char *desc, SAMR_R_DELETE_DOM_USER * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -4814,7 +4814,7 @@ BOOL samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER * r_u, if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -4901,7 +4901,7 @@ BOOL samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER * r_u, return False; if(!prs_uint32("user_rid ", ps, depth, &r_u->user_rid)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -6237,7 +6237,7 @@ void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO * r_u, r_u->ptr = 0; r_u->ctr = NULL; - if (status == 0) { + if (NT_STATUS_IS_OK(status)) { r_u->ptr = 1; r_u->ctr = ctr; } @@ -6271,7 +6271,7 @@ BOOL samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -6345,7 +6345,7 @@ BOOL samr_io_r_set_userinfo(char *desc, SAMR_R_SET_USERINFO * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -6433,7 +6433,7 @@ BOOL samr_io_r_set_userinfo2(char *desc, SAMR_R_SET_USERINFO2 * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -6506,7 +6506,7 @@ BOOL samr_io_r_connect(char *desc, SAMR_R_CONNECT * r_u, if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -6573,7 +6573,7 @@ BOOL samr_io_r_connect_anon(char *desc, SAMR_R_CONNECT_ANON * r_u, if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -6652,7 +6652,7 @@ BOOL samr_io_r_get_dom_pwinfo(char *desc, SAMR_R_GET_DOM_PWINFO * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; @@ -6848,7 +6848,7 @@ BOOL samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index dd2c4a541a..027f8ceaa3 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -952,7 +952,7 @@ BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_ if (!smb_io_pol_hnd("printer handle",&(r_u->handle),ps,depth)) return False; - if (!prs_uint32("status code", ps, depth, &(r_u->status))) + if (!prs_werror("status code", ps, depth, &(r_u->status))) return False; return True; @@ -1040,7 +1040,7 @@ BOOL spoolss_io_r_deleteprinterdata(char *desc, SPOOL_R_DELETEPRINTERDATA *r_u, { prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterdata"); depth++; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -1074,7 +1074,7 @@ BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_st if (!prs_uint32("needed", ps, depth, &r_u->needed)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -1126,7 +1126,7 @@ BOOL spoolss_io_r_abortprinter(char *desc, SPOOL_R_ABORTPRINTER *r_u, prs_struct { prs_debug(ps, depth, desc, "spoolss_io_r_abortprinter"); depth++; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -1170,7 +1170,7 @@ BOOL spoolss_io_r_deleteprinter(char *desc, SPOOL_R_DELETEPRINTER *r_u, prs_stru if (!smb_io_pol_hnd("printer handle",&r_u->handle,ps,depth)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -1220,7 +1220,7 @@ BOOL spoolss_io_r_deleteprinterdriver(char *desc, SPOOL_R_DELETEPRINTERDRIVER *r if (!prs_align(ps)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -1266,7 +1266,7 @@ BOOL spoolss_io_r_closeprinter(char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct if (!smb_io_pol_hnd("printer handle",&r_u->handle,ps,depth)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -1307,7 +1307,7 @@ BOOL spoolss_io_r_startdocprinter(char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_ depth++; if(!prs_uint32("jobid", ps, depth, &r_u->jobid)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -1343,7 +1343,7 @@ BOOL spoolss_io_r_enddocprinter(char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_stru { prs_debug(ps, depth, desc, "spoolss_io_r_enddocprinter"); depth++; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -1379,7 +1379,7 @@ BOOL spoolss_io_r_startpageprinter(char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, pr { prs_debug(ps, depth, desc, "spoolss_io_r_startpageprinter"); depth++; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -1415,7 +1415,7 @@ BOOL spoolss_io_r_endpageprinter(char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_st { prs_debug(ps, depth, desc, "spoolss_io_r_endpageprinter"); depth++; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -1469,7 +1469,7 @@ BOOL spoolss_io_r_writeprinter(char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct depth++; if(!prs_uint32("buffer_written", ps, depth, &r_u->buffer_written)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -1531,7 +1531,7 @@ BOOL spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, in prs_debug(ps, depth, desc, "spoolss_io_r_rffpcnex"); depth++; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -1593,7 +1593,7 @@ BOOL spoolss_io_r_rfnpcnex(char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, in if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -3329,7 +3329,7 @@ BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, return False; if (!prs_uint32("serverminorversion", ps, depth, &r_u->serverminorversion)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -3439,7 +3439,7 @@ BOOL spoolss_io_r_enumprinters(char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct if (!prs_uint32("returned", ps, depth, &r_u->returned)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -3468,7 +3468,7 @@ BOOL spoolss_io_r_getprinter(char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps if (!prs_uint32("needed", ps, depth, &r_u->needed)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -3608,7 +3608,7 @@ BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -3685,7 +3685,7 @@ BOOL spoolss_io_r_fcpn(char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -3730,7 +3730,7 @@ BOOL spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int de if(!prs_uint32("needed", ps, depth, &r_u->needed)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -3787,7 +3787,7 @@ BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, in if (!prs_uint32("returned", ps, depth, &r_u->returned)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -3857,7 +3857,7 @@ BOOL spoolss_io_r_schedulejob(char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct * if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -3893,7 +3893,7 @@ BOOL spoolss_io_r_setjob(char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int de if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -3950,7 +3950,7 @@ BOOL spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u if (!prs_uint32("returned", ps, depth, &r_u->returned)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -4068,7 +4068,7 @@ BOOL spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, if (!prs_uint32("numofforms", ps, depth, &r_u->numofforms)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -4127,7 +4127,7 @@ BOOL spoolss_io_r_getform(char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps, int if (!prs_uint32("size of buffer needed", ps, depth, &r_u->needed)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -4157,7 +4157,7 @@ BOOL spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, if (!prs_uint32("returned", ps, depth, &r_u->returned)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -4294,7 +4294,7 @@ BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, p return False; if(!prs_uint32("untiltime", ps, depth, &il->untiltime)) return False; - if(!prs_uint32("status", ps, depth, &il->status)) + if(!prs_werror("status", ps, depth, &il->status)) return False; if(!prs_uint32("cjobs", ps, depth, &il->cjobs)) return False; @@ -4461,7 +4461,7 @@ BOOL spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, if(!smb_io_pol_hnd("printer handle",&r_u->handle,ps,depth)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -4953,7 +4953,7 @@ BOOL spoolss_io_r_addprinterdriver(char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, pr prs_debug(ps, depth, desc, "spoolss_io_r_addprinterdriver"); depth++; - if(!prs_uint32("status", ps, depth, &q_u->status)) + if(!prs_werror("status", ps, depth, &q_u->status)) return False; return True; @@ -5190,7 +5190,7 @@ BOOL spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r if (!prs_uint32("needed", ps, depth, &r_u->needed)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -5219,7 +5219,7 @@ BOOL spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r if (!prs_uint32("returned", ps, depth, &r_u->returned)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -5312,7 +5312,7 @@ BOOL spoolss_io_r_addprintprocessor(char *desc, SPOOL_R_ADDPRINTPROCESSOR *r_u, if (!prs_align(ps)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -5341,7 +5341,7 @@ BOOL spoolss_io_r_enumprintprocdatatypes(char *desc, SPOOL_R_ENUMPRINTPROCDATATY if (!prs_uint32("returned", ps, depth, &r_u->returned)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -5447,7 +5447,7 @@ BOOL spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, if (!prs_uint32("returned", ps, depth, &r_u->returned)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -5487,7 +5487,7 @@ BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_ if(!prs_uint32("realdatasize", ps, depth, &r_u->realdatasize)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -5589,7 +5589,7 @@ BOOL spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_st if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -5696,7 +5696,7 @@ BOOL spoolss_io_r_deleteform(char *desc, SPOOL_R_DELETEFORM *r_u, prs_struct *ps if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -5741,7 +5741,7 @@ BOOL spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -5792,7 +5792,7 @@ BOOL spoolss_io_r_setform(char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -5819,7 +5819,7 @@ BOOL spoolss_io_r_getjob(char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int de if (!prs_uint32("needed", ps, depth, &r_u->needed)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -5958,7 +5958,7 @@ BOOL spoolss_io_r_replyopenprinter(char *desc, SPOOL_R_REPLYOPENPRINTER *r_u, pr if(!smb_io_pol_hnd("printer handle",&r_u->handle,ps,depth)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -6011,7 +6011,7 @@ BOOL spoolss_io_r_replycloseprinter(char *desc, SPOOL_R_REPLYCLOSEPRINTER *r_u, if(!smb_io_pol_hnd("printer handle",&r_u->handle,ps,depth)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -6096,7 +6096,7 @@ BOOL spoolss_io_r_reply_rrpcn(char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct * if (!prs_uint32("unknown0", ps, depth, &r_u->unknown0)) return False; - if (!prs_uint32("status", ps, depth, &r_u->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index d695eb136c..057367054a 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -617,7 +617,7 @@ BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct * return False; if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) return False; - if(!prs_uint32("status ", ps, depth, &r_n->status)) + if(!prs_ntstatus("status ", ps, depth, &r_n->status)) return False; return True; @@ -742,7 +742,7 @@ BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_ if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_n->status)) + if(!prs_ntstatus("status", ps, depth, &r_n->status)) return False; return True; @@ -803,7 +803,7 @@ BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *q_n, prs_ if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) return False; - if(!prs_uint32("status ", ps, depth, &q_n->status)) + if(!prs_ntstatus("status ", ps, depth, &q_n->status)) return False; return True; @@ -861,7 +861,7 @@ BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) return False; - if(!prs_uint32("status ", ps, depth, &q_n->status)) + if(!prs_ntstatus("status ", ps, depth, &q_n->status)) return False; return True; @@ -908,7 +908,7 @@ BOOL srv_io_r_net_share_del(char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps if(!prs_align(ps)) return False; - if(!prs_uint32("status ", ps, depth, &q_n->status)) + if(!prs_ntstatus("status ", ps, depth, &q_n->status)) return False; return True; @@ -1311,7 +1311,7 @@ BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps return False; if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) return False; - if(!prs_uint32("status ", ps, depth, &r_n->status)) + if(!prs_ntstatus("status ", ps, depth, &r_n->status)) return False; return True; @@ -1676,7 +1676,7 @@ BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *p return False; if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) return False; - if(!prs_uint32("status ", ps, depth, &r_n->status)) + if(!prs_ntstatus("status ", ps, depth, &r_n->status)) return False; return True; @@ -1954,7 +1954,7 @@ BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps return False; if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) return False; - if(!prs_uint32("status ", ps, depth, &r_n->status)) + if(!prs_ntstatus("status ", ps, depth, &r_n->status)) return False; return True; @@ -2246,7 +2246,7 @@ void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv, srv->ctr = ctr; - if (status == 0x0) { + if (NT_STATUS_IS_OK(status)) { srv->ctr->switch_value = switch_value; srv->ctr->ptr_srv_ctr = 1; } else { @@ -2326,7 +2326,7 @@ BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_stru if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth)) return False; - if(!prs_uint32("status ", ps, depth, &r_n->status)) + if(!prs_ntstatus("status ", ps, depth, &r_n->status)) return False; return True; @@ -2348,7 +2348,7 @@ BOOL srv_io_r_net_srv_set_info(char *desc, SRV_R_NET_SRV_SET_INFO *r_n, if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value)) return False; - if(!prs_uint32("status ", ps, depth, &r_n->status)) + if(!prs_ntstatus("status ", ps, depth, &r_n->status)) return False; return True; @@ -2467,7 +2467,7 @@ BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct * if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth)) return False; - if(!prs_uint32("status ", ps, depth, &r_n->status)) + if(!prs_ntstatus("status ", ps, depth, &r_n->status)) return False; return True; @@ -2566,7 +2566,7 @@ BOOL srv_io_r_net_disk_enum(char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) return False; - if(!prs_uint32("status", ps, depth, &r_n->status)) + if(!prs_ntstatus("status", ps, depth, &r_n->status)) return False; return True; @@ -2626,7 +2626,7 @@ BOOL srv_io_r_net_name_validate(char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_st if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_n->status)) + if(!prs_ntstatus("status", ps, depth, &r_n->status)) return False; return True; @@ -2713,7 +2713,7 @@ BOOL srv_io_r_net_file_query_secdesc(char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_n->status)) + if(!prs_ntstatus("status", ps, depth, &r_n->status)) return False; return True; @@ -2791,7 +2791,7 @@ BOOL srv_io_r_net_file_set_secdesc(char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, if(!prs_align(ps)) return False; - if(!prs_uint32("status", ps, depth, &r_n->status)) + if(!prs_ntstatus("status", ps, depth, &r_n->status)) return False; return True; diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c index f35bef83bd..07194e1c31 100644 --- a/source3/rpc_parse/parse_wks.c +++ b/source3/rpc_parse/parse_wks.c @@ -173,7 +173,7 @@ BOOL wks_io_r_query_info(char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int if(!wks_io_wks_info_100("inf", r_u->wks100, ps, depth)) return False; - if(!prs_uint32("status ", ps, depth, &r_u->status)) + if(!prs_ntstatus("status ", ps, depth, &r_u->status)) return False; return True; -- cgit From 8c569f70eec7ea2d24f0611c5c1851d0dc87b379 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 4 Sep 2001 07:24:13 +0000 Subject: Welcome to tpot's exploit world! - put in checks for return values in rpc parsing routines - replace a bunch of stupid &(foo->bar) with &foo->bar - fixed bug in net_io_sam_alias_mem_info where there are zero members in the alias (This used to be commit eecdba2b015ed48d7dd88daea2af466f28cd2ff7) --- source3/rpc_parse/parse_net.c | 666 ++++++++++++++++++++++++++---------------- 1 file changed, 413 insertions(+), 253 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index bb8b2608b3..f7c503a38d 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -142,9 +142,9 @@ static void init_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_statu info->tc_status = tc_status; if (trusted_dc_name != NULL) - init_unistr2(&(info->uni_trusted_dc_name), trusted_dc_name, len_dc_name+1); + init_unistr2(&info->uni_trusted_dc_name, trusted_dc_name, len_dc_name+1); else - init_unistr2(&(info->uni_trusted_dc_name), "", 1); + init_unistr2(&info->uni_trusted_dc_name, "", 1); } /******************************************************************* @@ -259,7 +259,7 @@ void init_net_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level, break; case 3: r_l->ptr = 1; /* undocumented pointer */ - init_netinfo_3(&(r_l->logon.info3), flags, logon_attempts); + init_netinfo_3(&r_l->logon.info3, flags, logon_attempts); r_l->status = NT_STATUS_OK; break; default: @@ -1098,7 +1098,7 @@ void init_sam_info(DOM_SAM_INFO *sam, { DEBUG(5,("init_sam_info: %d\n", __LINE__)); - init_clnt_info2(&(sam->client), logon_srv, comp_name, clnt_cred); + init_clnt_info2(&sam->client, logon_srv, comp_name, clnt_cred); if (rtn_cred != NULL) { sam->ptr_rtn_cred = 1; @@ -1624,17 +1624,25 @@ BOOL net_io_q_sam_sync(char *desc, NET_Q_SAM_SYNC * q_s, prs_struct *ps, prs_debug(ps, depth, desc, "net_io_q_sam_sync"); depth++; - smb_io_unistr2("", &(q_s->uni_srv_name), True, ps, depth); - smb_io_unistr2("", &(q_s->uni_cli_name), True, ps, 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; - smb_io_cred("", &(q_s->cli_creds), ps, depth); - smb_io_cred("", &(q_s->ret_creds), ps, depth); + if (!smb_io_cred("", &q_s->cli_creds, ps, depth)) + return False; + if (!smb_io_cred("", &q_s->ret_creds, ps, depth)) + return False; - prs_uint32("database_id ", ps, depth, &(q_s->database_id)); - prs_uint32("restart_state", ps, depth, &(q_s->restart_state)); - prs_uint32("sync_context ", ps, depth, &(q_s->sync_context)); + 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; - prs_uint32("max_size", ps, depth, &(q_s->max_size)); + if (!prs_uint32("max_size", ps, depth, &q_s->max_size)) + return False; return True; } @@ -1648,38 +1656,23 @@ static BOOL net_io_sam_delta_hdr(char *desc, SAM_DELTA_HDR * delta, prs_debug(ps, depth, desc, "net_io_sam_delta_hdr"); depth++; - prs_uint16("type", ps, depth, &(delta->type)); - prs_uint16("type2", ps, depth, &(delta->type2)); - prs_uint32("target_rid", ps, depth, &(delta->target_rid)); + 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; - prs_uint32("type3", ps, depth, &(delta->type3)); + 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) - prs_uint32("ptr_delta", ps, depth, &(delta->ptr_delta)); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static BOOL net_io_sam_delta_hdr2(char *desc, SAM_DELTA_HDR *delta, - prs_struct *ps, int depth) -{ - uint32 unk; - - prs_debug(ps, depth, desc, "net_io_sam_delta_stamp"); - depth++; - - prs_uint16("type", ps, depth, &(delta->type)); - prs_uint16("type2", ps, depth, &(delta->type2)); - prs_uint32("rid", ps, depth, &unk); - - - prs_uint32("unknown_ptr", ps, depth, &unk); + if (delta->type != 0x16) { + if (!prs_uint32("ptr_delta", ps, depth, &delta->ptr_delta)) + return False; + } return True; } @@ -1693,10 +1686,17 @@ static BOOL net_io_sam_delta_stamp(char *desc, SAM_DELTA_STAMP *info, prs_debug(ps, depth, desc, "net_io_sam_delta_stamp"); depth++; - prs_uint32("seqnum", ps, depth, &info->seqnum); - prs_uint32("dom_mod_count_ptr", ps, depth, &info->dom_mod_count_ptr); - if (info->dom_mod_count_ptr) - prs_uint64("dom_mod_count", ps, depth, &info->dom_mod_count); + 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; } @@ -1710,30 +1710,48 @@ static BOOL net_io_sam_domain_info(char *desc, SAM_DOMAIN_INFO * info, prs_debug(ps, depth, desc, "net_io_sam_domain_info"); depth++; - smb_io_unihdr("hdr_dom_name", &(info->hdr_dom_name), ps, depth); - smb_io_unihdr("hdr_oem_info", &(info->hdr_oem_info), ps, depth); - - prs_uint64("force_logoff", ps, depth, &info->force_logoff); - prs_uint16("min_pwd_len", ps, depth, &(info->min_pwd_len)); - prs_uint16("pwd_history_len", ps, depth, &info->pwd_history_len); - prs_uint64("max_pwd_age", ps, depth, &info->max_pwd_age); - prs_uint64("min_pwd_age", ps, depth, &info->min_pwd_age); - prs_uint64("dom_mod_count", ps, depth, &info->dom_mod_count); - smb_io_time("creation_time", &info->creation_time, ps, depth); - - smb_io_bufhdr2("hdr_sec_desc", &(info->hdr_sec_desc), ps, depth); - smb_io_unihdr("hdr_unknown", &(info->hdr_unknown), ps, depth); - ps->data_offset += 40; - - smb_io_unistr2("uni_dom_name", &(info->uni_dom_name), - info->hdr_dom_name.buffer, ps, depth); - smb_io_unistr2("buf_oem_info", &(info->buf_oem_info), - info->hdr_oem_info.buffer, ps, depth); - - smb_io_buffer4("buf_sec_desc", &(info->buf_sec_desc), - info->hdr_sec_desc.buffer, ps, depth); - smb_io_unistr2("buf_unknown", &(info->buf_unknown), - info->hdr_unknown.buffer, ps, 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 (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth)) + return False; + if (!smb_io_unihdr("hdr_unknown", &info->hdr_unknown, ps, depth)) + return False; + + if (ps->data_offset + 40 > ps->buffer_size) + return False; + ps->data_offset += 40; + + 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_buffer4("buf_sec_desc", &info->buf_sec_desc, + info->hdr_sec_desc.buffer, ps, depth)) + return False; + if (!smb_io_unistr2("buf_unknown", &info->buf_unknown, + info->hdr_unknown.buffer, ps, depth)) + return False; return True; } @@ -1747,18 +1765,28 @@ static BOOL net_io_sam_group_info(char *desc, SAM_GROUP_INFO * info, prs_debug(ps, depth, desc, "net_io_sam_group_info"); depth++; - smb_io_unihdr("hdr_grp_name", &(info->hdr_grp_name), ps, depth); - smb_io_gid("gid", &(info->gid), ps, depth); - smb_io_unihdr("hdr_grp_desc", &(info->hdr_grp_desc), ps, depth); - smb_io_bufhdr2("hdr_sec_desc", &(info->hdr_sec_desc), ps, 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; - smb_io_unistr2("uni_grp_name", &(info->uni_grp_name), - info->hdr_grp_name.buffer, ps, depth); - smb_io_unistr2("uni_grp_desc", &(info->uni_grp_desc), - info->hdr_grp_desc.buffer, ps, depth); - smb_io_buffer4("buf_sec_desc", &(info->buf_sec_desc), - info->hdr_sec_desc.buffer, ps, depth); + 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_buffer4("buf_sec_desc", &info->buf_sec_desc, + info->hdr_sec_desc.buffer, ps, depth)) + return False; return True; } @@ -1772,16 +1800,23 @@ static BOOL net_io_sam_passwd_info(char *desc, SAM_PWD * pwd, prs_debug(ps, depth, desc, "net_io_sam_passwd_info"); depth++; - prs_uint32("unk_0 ", ps, depth, &(pwd->unk_0)); + if (!prs_uint32("unk_0 ", ps, depth, &pwd->unk_0)) + return False; - smb_io_unihdr("hdr_lm_pwd", &(pwd->hdr_lm_pwd), ps, depth); - prs_uint8s(False, "buf_lm_pwd", ps, depth, pwd->buf_lm_pwd, 16); + 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; - smb_io_unihdr("hdr_nt_pwd", &(pwd->hdr_nt_pwd), ps, depth); - prs_uint8s(False, "buf_nt_pwd", ps, depth, pwd->buf_nt_pwd, 16); + 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; - smb_io_unihdr("", &(pwd->hdr_empty_lm), ps, depth); - smb_io_unihdr("", &(pwd->hdr_empty_nt), ps, depth); + 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; } @@ -1815,27 +1850,27 @@ BOOL make_sam_account_info(SAM_ACCOUNT_INFO * info, DEBUG(5, ("make_sam_account_info\n")); - make_uni_hdr(&(info->hdr_acct_name), len_user_name); - make_uni_hdr(&(info->hdr_full_name), len_full_name); - make_uni_hdr(&(info->hdr_home_dir), len_home_dir); - make_uni_hdr(&(info->hdr_dir_drive), len_dir_drive); - make_uni_hdr(&(info->hdr_logon_script), len_logon_script); - make_uni_hdr(&(info->hdr_profile), len_profile_path); - make_uni_hdr(&(info->hdr_acct_desc), len_description); - make_uni_hdr(&(info->hdr_workstations), len_workstations); - make_uni_hdr(&(info->hdr_comment), len_unknown_str); - make_uni_hdr(&(info->hdr_parameters), len_munged_dial); + make_uni_hdr(&info->hdr_acct_name, len_user_name); + make_uni_hdr(&info->hdr_full_name, len_full_name); + make_uni_hdr(&info->hdr_home_dir, len_home_dir); + make_uni_hdr(&info->hdr_dir_drive, len_dir_drive); + make_uni_hdr(&info->hdr_logon_script, len_logon_script); + make_uni_hdr(&info->hdr_profile, len_profile_path); + make_uni_hdr(&info->hdr_acct_desc, len_description); + make_uni_hdr(&info->hdr_workstations, len_workstations); + make_uni_hdr(&info->hdr_comment, len_unknown_str); + make_uni_hdr(&info->hdr_parameters, len_munged_dial); /* not present */ - make_bufhdr2(&(info->hdr_sec_desc), 0, 0, 0); + make_bufhdr2(&info->hdr_sec_desc, 0, 0, 0); info->user_rid = user_rid; info->group_rid = group_rid; - init_nt_time(&(info->logon_time)); - init_nt_time(&(info->logoff_time)); - init_nt_time(&(info->pwd_last_set_time)); - init_nt_time(&(info->acct_expiry_time)); + init_nt_time(&info->logon_time); + init_nt_time(&info->logoff_time); + init_nt_time(&info->pwd_last_set_time); + init_nt_time(&info->acct_expiry_time); info->logon_divs = 0xA8; info->ptr_logon_hrs = 0; /* Don't care right now */ @@ -1852,16 +1887,16 @@ BOOL make_sam_account_info(SAM_ACCOUNT_INFO * info, info->unknown1 = 0x4EC; info->unknown2 = 0; - copy_unistr2(&(info->uni_acct_name), user_name); - copy_unistr2(&(info->uni_full_name), full_name); - copy_unistr2(&(info->uni_home_dir), home_dir); - copy_unistr2(&(info->uni_dir_drive), dir_drive); - copy_unistr2(&(info->uni_logon_script), log_scr); - copy_unistr2(&(info->uni_profile), prof_path); - copy_unistr2(&(info->uni_acct_desc), desc); - copy_unistr2(&(info->uni_workstations), wkstas); - copy_unistr2(&(info->uni_comment), unk_str); - copy_unistr2(&(info->uni_parameters), mung_dial); + copy_unistr2(&info->uni_acct_name, user_name); + copy_unistr2(&info->uni_full_name, full_name); + copy_unistr2(&info->uni_home_dir, home_dir); + copy_unistr2(&info->uni_dir_drive, dir_drive); + copy_unistr2(&info->uni_logon_script, log_scr); + copy_unistr2(&info->uni_profile, prof_path); + copy_unistr2(&info->uni_acct_desc, desc); + copy_unistr2(&info->uni_workstations, wkstas); + copy_unistr2(&info->uni_comment, unk_str); + copy_unistr2(&info->uni_parameters, mung_dial); return True; } @@ -1879,98 +1914,147 @@ static BOOL net_io_sam_account_info(char *desc, uint8 sess_key[16], prs_debug(ps, depth, desc, "net_io_sam_account_info"); depth++; - smb_io_unihdr("hdr_acct_name", &(info->hdr_acct_name), ps, depth); - smb_io_unihdr("hdr_full_name", &(info->hdr_full_name), ps, depth); - - prs_uint32("user_rid ", ps, depth, &(info->user_rid)); - prs_uint32("group_rid", ps, depth, &(info->group_rid)); - - smb_io_unihdr("hdr_home_dir ", &(info->hdr_home_dir), ps, depth); - smb_io_unihdr("hdr_dir_drive", &(info->hdr_dir_drive), ps, depth); - smb_io_unihdr("hdr_logon_script", &(info->hdr_logon_script), ps, - depth); - smb_io_unihdr("hdr_acct_desc", &(info->hdr_acct_desc), ps, depth); - smb_io_unihdr("hdr_workstations", &(info->hdr_workstations), ps, - depth); - - smb_io_time("logon_time", &(info->logon_time), ps, depth); - smb_io_time("logoff_time", &(info->logoff_time), ps, depth); - - prs_uint32("logon_divs ", ps, depth, &(info->logon_divs)); - prs_uint32("ptr_logon_hrs", ps, depth, &(info->ptr_logon_hrs)); - - prs_uint16("bad_pwd_count", ps, depth, &(info->bad_pwd_count)); - prs_uint16("logon_count", ps, depth, &(info->logon_count)); - smb_io_time("pwd_last_set_time", &(info->pwd_last_set_time), ps, - depth); - smb_io_time("acct_expiry_time", &(info->acct_expiry_time), ps, depth); - - prs_uint32("acb_info", ps, depth, &(info->acb_info)); - prs_uint8s(False, "nt_pwd", ps, depth, info->nt_pwd, 16); - prs_uint8s(False, "lm_pwd", ps, depth, info->lm_pwd, 16); - prs_uint8("lm_pwd_present", ps, depth, &(info->lm_pwd_present)); - prs_uint8("nt_pwd_present", ps, depth, &(info->nt_pwd_present)); - prs_uint8("pwd_expired", ps, depth, &(info->pwd_expired)); - - smb_io_unihdr("hdr_comment", &(info->hdr_comment), ps, depth); - smb_io_unihdr("hdr_parameters", &(info->hdr_parameters), ps, depth); - prs_uint16("country", ps, depth, &(info->country)); - prs_uint16("codepage", ps, depth, &(info->codepage)); - - smb_io_bufhdr2("hdr_priv_data", &(hdr_priv_data), ps, depth); - smb_io_bufhdr2("hdr_sec_desc", &(info->hdr_sec_desc), ps, depth); - smb_io_unihdr("hdr_profile", &(info->hdr_profile), ps, 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++) { - smb_io_unihdr("hdr_reserved", &(info->hdr_reserved[i]), ps, - depth); + if (!smb_io_unihdr("hdr_reserved", &info->hdr_reserved[i], + ps, depth)) + return False; } for (i = 0; i < 4; i++) { - prs_uint32("dw_reserved", ps, depth, &(info->dw_reserved[i])); + if (!prs_uint32("dw_reserved", ps, depth, + &info->dw_reserved[i])) + return False; } - smb_io_unistr2("uni_acct_name", &(info->uni_acct_name), - info->hdr_acct_name.buffer, ps, depth); + if (!smb_io_unistr2("uni_acct_name", &info->uni_acct_name, + info->hdr_acct_name.buffer, ps, depth)) + return False; prs_align(ps); - smb_io_unistr2("uni_full_name", &(info->uni_full_name), - info->hdr_full_name.buffer, ps, depth); + if (!smb_io_unistr2("uni_full_name", &info->uni_full_name, + info->hdr_full_name.buffer, ps, depth)) + return False; prs_align(ps); - smb_io_unistr2("uni_home_dir ", &(info->uni_home_dir), - info->hdr_home_dir.buffer, ps, depth); + if (!smb_io_unistr2("uni_home_dir ", &info->uni_home_dir, + info->hdr_home_dir.buffer, ps, depth)) + return False; prs_align(ps); - smb_io_unistr2("uni_dir_drive", &(info->uni_dir_drive), - info->hdr_dir_drive.buffer, ps, depth); + if (!smb_io_unistr2("uni_dir_drive", &info->uni_dir_drive, + info->hdr_dir_drive.buffer, ps, depth)) + return False; prs_align(ps); - smb_io_unistr2("uni_logon_script", &(info->uni_logon_script), - info->hdr_logon_script.buffer, ps, depth); + if (!smb_io_unistr2("uni_logon_script", &info->uni_logon_script, + info->hdr_logon_script.buffer, ps, depth)) + return False; prs_align(ps); - smb_io_unistr2("uni_acct_desc", &(info->uni_acct_desc), - info->hdr_acct_desc.buffer, ps, depth); + if (!smb_io_unistr2("uni_acct_desc", &info->uni_acct_desc, + info->hdr_acct_desc.buffer, ps, depth)) + return False; prs_align(ps); - smb_io_unistr2("uni_workstations", &(info->uni_workstations), - info->hdr_workstations.buffer, ps, depth); + if (!smb_io_unistr2("uni_workstations", &info->uni_workstations, + info->hdr_workstations.buffer, ps, depth)) + return False; prs_align(ps); - prs_uint32("unknown1", ps, depth, &(info->unknown1)); - prs_uint32("unknown2", ps, depth, &(info->unknown2)); + if (!prs_uint32("unknown1", ps, depth, &info->unknown1)) + return False; + if (!prs_uint32("unknown2", ps, depth, &info->unknown2)) + return False; - smb_io_buffer4("buf_logon_hrs", &(info->buf_logon_hrs), - info->ptr_logon_hrs, ps, depth); + if (!smb_io_buffer4("buf_logon_hrs", &info->buf_logon_hrs, + info->ptr_logon_hrs, ps, depth)) + return False; prs_align(ps); - smb_io_unistr2("uni_comment", &(info->uni_comment), - info->hdr_comment.buffer, ps, depth); + if (!smb_io_unistr2("uni_comment", &info->uni_comment, + info->hdr_comment.buffer, ps, depth)) + return False; prs_align(ps); - smb_io_unistr2("uni_parameters", &(info->uni_parameters), - info->hdr_parameters.buffer, ps, depth); + 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; - prs_uint32("pwd_len", ps, depth, &len); + if (!prs_uint32("pwd_len", ps, depth, &len)) + return False; old_offset = ps->data_offset; if (len == 0x44) { @@ -1979,21 +2063,28 @@ static BOOL net_io_sam_account_info(char *desc, uint8 sess_key[16], /* reading */ /* // FIXME prs_hash1(ps, ps->offset, sess_key); */ } - net_io_sam_passwd_info("pass", &(info->pass), ps, - depth); + if (!net_io_sam_passwd_info("pass", &info->pass, + ps, depth)) + return False; + if (!ps->io) { /* writing */ /* // FIXME TOO prs_hash1(ps, old_offset, sess_key); */ } } + if (old_offset + len > ps->buffer_size) + return False; ps->data_offset = old_offset + len; } - smb_io_buffer4("buf_sec_desc", &(info->buf_sec_desc), - info->hdr_sec_desc.buffer, ps, depth); + if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, + info->hdr_sec_desc.buffer, ps, depth)) + return False; prs_align(ps); - smb_io_unistr2("uni_profile", &(info->uni_profile), - info->hdr_profile.buffer, ps, depth); + if (!smb_io_unistr2("uni_profile", &info->uni_profile, + info->hdr_profile.buffer, ps, depth)) + return False; + prs_align(ps); return True; @@ -2012,14 +2103,23 @@ static BOOL net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO * info, depth++; prs_align(ps); - prs_uint32("ptr_rids ", ps, depth, &(info->ptr_rids)); - prs_uint32("ptr_attribs", ps, depth, &(info->ptr_attribs)); - prs_uint32("num_members", ps, depth, &(info->num_members)); + 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) { - prs_uint32("num_members2", ps, depth, &(info->num_members2)); + if (!prs_uint32("num_members2", ps, depth, + &info->num_members2)) + return False; + if (info->num_members2 != info->num_members) { /* RPC fault */ @@ -2038,13 +2138,16 @@ static BOOL net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO * info, for (i = 0; i < info->num_members2; i++) { slprintf(tmp, sizeof(tmp) - 1, "rids[%02d]", i); - prs_uint32(tmp, ps, depth, &(info->rids[i])); + if (!prs_uint32(tmp, ps, depth, &info->rids[i])) + return False; } } if (info->ptr_attribs != 0) { - prs_uint32("num_members3", ps, depth, &(info->num_members3)); + if (!prs_uint32("num_members3", ps, depth, + &info->num_members3)) + return False; if (info->num_members3 != info->num_members) { /* RPC fault */ @@ -2063,7 +2166,8 @@ static BOOL net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO * info, for (i = 0; i < info->num_members3; i++) { slprintf(tmp, sizeof(tmp) - 1, "attribs[%02d]", i); - prs_uint32(tmp, ps, depth, &(info->attribs[i])); + if (!prs_uint32(tmp, ps, depth, &info->attribs[i])) + return False; } } @@ -2079,18 +2183,28 @@ static BOOL net_io_sam_alias_info(char *desc, SAM_ALIAS_INFO * info, prs_debug(ps, depth, desc, "net_io_sam_alias_info"); depth++; - smb_io_unihdr("hdr_als_name", &(info->hdr_als_name), ps, depth); - prs_uint32("als_rid", ps, depth, &(info->als_rid)); - smb_io_bufhdr2("hdr_sec_desc", &(info->hdr_sec_desc), ps, depth); - smb_io_unihdr("hdr_als_desc", &(info->hdr_als_desc), ps, 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; - smb_io_unistr2("uni_als_name", &(info->uni_als_name), - info->hdr_als_name.buffer, ps, depth); - smb_io_buffer4("buf_sec_desc", &(info->buf_sec_desc), - info->hdr_sec_desc.buffer, ps, depth); - smb_io_unistr2("uni_als_desc", &(info->uni_als_desc), - info->hdr_als_name.buffer, ps, depth); + if (!smb_io_unistr2("uni_als_name", &info->uni_als_name, + info->hdr_als_name.buffer, ps, depth)) + return False; + if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, + info->hdr_sec_desc.buffer, ps, depth)) + return False; + if (!smb_io_unistr2("uni_als_desc", &info->uni_als_desc, + info->hdr_als_name.buffer, ps, depth)) + return False; return True; } @@ -2108,13 +2222,19 @@ static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO * info, depth++; prs_align(ps); - prs_uint32("num_members", ps, depth, &(info->num_members)); - prs_uint32("ptr_members", ps, depth, &(info->ptr_members)); - ps->data_offset += 16; + 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 (info->ptr_members != 0) { - prs_uint32("num_sids", ps, depth, &(info->num_sids)); + if (ps->data_offset + 16 > ps->buffer_size) + return False; + ps->data_offset += 16; + + if (!prs_uint32("num_sids", ps, depth, &info->num_sids)) + return False; if (info->num_sids != info->num_members) { /* RPC fault */ @@ -2133,7 +2253,8 @@ static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO * info, for (i = 0; i < info->num_sids; i++) { slprintf(tmp, sizeof(tmp) - 1, "ptr_sids[%02d]", i); - prs_uint32(tmp, ps, depth, &(info->ptr_sids[i])); + if (!prs_uint32(tmp, ps, depth, &info->ptr_sids[i])) + return False; } info->sids = talloc(ps->mem_ctx, sizeof(DOM_SID2) * @@ -2151,8 +2272,9 @@ static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO * info, { slprintf(tmp, sizeof(tmp) - 1, "sids[%02d]", i); - smb_io_dom_sid2(tmp, &(info->sids[i]), ps, - depth); + if (!smb_io_dom_sid2(tmp, &info->sids[i], + ps, depth)) + return False; } } } @@ -2176,46 +2298,55 @@ static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], case SAM_DELTA_SAM_STAMP: { - net_io_sam_delta_stamp("", &delta->stamp, - ps, depth); + if (!net_io_sam_delta_stamp("", &delta->stamp, + ps, depth)) + return False; break; } case SAM_DELTA_DOMAIN_INFO: { - net_io_sam_domain_info("", &delta->domain_info, - ps, depth); + if (!net_io_sam_domain_info("", &delta->domain_info, + ps, depth)) + return False; break; } case SAM_DELTA_GROUP_INFO: { - net_io_sam_group_info("", &delta->group_info, - ps, depth); + if (!net_io_sam_group_info("", &delta->group_info, + ps, depth)) + return False; break; } case SAM_DELTA_ACCOUNT_INFO: { - net_io_sam_account_info("", sess_key, - &delta->account_info, - ps, depth); + if (!net_io_sam_account_info("", sess_key, + &delta->account_info, + ps, depth)) + return False; break; } case SAM_DELTA_GROUP_MEM: { - net_io_sam_group_mem_info("", &delta->grp_mem_info, - ps, depth); + if (!net_io_sam_group_mem_info("", + &delta->grp_mem_info, + ps, depth)) + return False; break; } case SAM_DELTA_ALIAS_INFO: { - net_io_sam_alias_info("", &delta->alias_info, - ps, depth); + if (!net_io_sam_alias_info("", &delta->alias_info, + ps, depth)) + return False; break; } case SAM_DELTA_ALIAS_MEM: { - net_io_sam_alias_mem_info("", &delta->als_mem_info, - ps, depth); + if (!net_io_sam_alias_mem_info("", + &delta->als_mem_info, + ps, depth)) + return False; break; } default: @@ -2241,18 +2372,24 @@ BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16], prs_debug(ps, depth, desc, "net_io_r_sam_sync"); depth++; - smb_io_cred("srv_creds", &(r_s->srv_creds), ps, depth); - prs_uint32("sync_context", ps, depth, &(r_s->sync_context)); + 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; - prs_uint32("ptr_deltas", ps, depth, &(r_s->ptr_deltas)); + if (!prs_uint32("ptr_deltas", ps, depth, &r_s->ptr_deltas)) + return False; if (r_s->ptr_deltas != 0) { - prs_uint32("num_deltas ", ps, depth, &(r_s->num_deltas)); - prs_uint32("ptr_deltas2", ps, depth, &(r_s->ptr_deltas2)); + 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) { - prs_uint32("num_deltas2", ps, depth, - &(r_s->num_deltas2)); + if (!prs_uint32("num_deltas2", ps, depth, + &r_s->num_deltas2)) + return False; if (r_s->num_deltas2 != r_s->num_deltas) { @@ -2275,8 +2412,10 @@ BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16], for (i = 0; i < r_s->num_deltas2; i++) { - net_io_sam_delta_hdr("", &r_s->hdr_deltas[i], - ps, depth); + if (!net_io_sam_delta_hdr("", + &r_s->hdr_deltas[i], + ps, depth)) + return False; } if (r_s->num_deltas2 > 0) { @@ -2294,16 +2433,20 @@ BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16], for (i = 0; i < r_s->num_deltas2; i++) { - net_io_sam_delta_ctr("", sess_key, - &r_s->deltas[i], - r_s->hdr_deltas[i].type3, - ps, depth); + if (!net_io_sam_delta_ctr( + "", sess_key, &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); - prs_uint32("status", ps, depth, &(r_s->status)); + if (!prs_uint32("status", ps, depth, &r_s->status)) + return False; return True; } @@ -2340,15 +2483,22 @@ BOOL net_io_q_sam_deltas(char *desc, NET_Q_SAM_DELTAS *q_s, prs_struct *ps, prs_debug(ps, depth, desc, "net_io_q_sam_deltas"); depth++; - smb_io_unistr2("", &q_s->uni_srv_name, True, ps, depth); - smb_io_unistr2("", &q_s->uni_cli_name, True, ps, 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; - smb_io_cred("", &q_s->cli_creds, ps, depth); - smb_io_cred("", &q_s->ret_creds, ps, depth); + if (!smb_io_cred("", &q_s->cli_creds, ps, depth)) + return False; + if (!smb_io_cred("", &q_s->ret_creds, ps, depth)) + return False; - prs_uint32("database_id ", ps, depth, &q_s->database_id); - prs_uint64("dom_mod_count", ps, depth, &q_s->dom_mod_count); - prs_uint32("max_size", ps, depth, &q_s->max_size); + 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; } @@ -2364,16 +2514,22 @@ BOOL net_io_r_sam_deltas(char *desc, uint8 sess_key[16], prs_debug(ps, depth, desc, "net_io_r_sam_deltas"); depth++; - smb_io_cred("srv_creds", &r_s->srv_creds, ps, depth); - prs_uint64("dom_mod_count", ps, depth, &r_s->dom_mod_count); + 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; - prs_uint32("ptr_deltas", ps, depth, &r_s->ptr_deltas); - prs_uint32("num_deltas", ps, depth, &r_s->num_deltas); - prs_uint32("ptr_deltas2", ps, depth, &r_s->num_deltas2); + 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) { - prs_uint32("num_deltas2 ", ps, depth, &(r_s->num_deltas2)); + if (!prs_uint32("num_deltas2 ", ps, depth, &r_s->num_deltas2)) + return False; if (r_s->ptr_deltas != 0) { @@ -2410,16 +2566,20 @@ BOOL net_io_r_sam_deltas(char *desc, uint8 sess_key[16], for (i = 0; i < r_s->num_deltas; i++) { - net_io_sam_delta_ctr("", sess_key, - &r_s->deltas[i], - r_s->hdr_deltas[i].type2, - ps, depth); + if (!net_io_sam_delta_ctr( + "", sess_key, + &r_s->deltas[i], + r_s->hdr_deltas[i].type2, + ps, depth)) + + return False; } } } prs_align(ps); - prs_uint32("status", ps, depth, &(r_s->status)); + if (!prs_uint32("status", ps, depth, &r_s->status)) + return False; return True; } -- cgit From c76dd1404041f42d3a398339cefbeb60f22d2910 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 4 Sep 2001 10:57:29 +0000 Subject: it now all compiles - so try enabling it by default and see what explodes on the build farm (This used to be commit 5bb7e4f0f65edf1db20245f403cbe81833134240) --- source3/rpc_parse/parse_dfs.c | 2 +- source3/rpc_parse/parse_net.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index 70270e2c36..6e30c66ac1 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -66,7 +66,7 @@ BOOL dfs_io_r_dfs_exist(char *desc, DFS_R_DFS_EXIST *q_d, prs_struct *ps, int de if(!prs_align(ps)) return False; - if(!prs_ntstatus("exist flag", ps, 0, &q_d->status)) + if(!prs_uint32("exist flag", ps, 0, &q_d->status)) return False; return True; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index f7c503a38d..e1a451b7ce 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -2445,8 +2445,8 @@ BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16], } prs_align(ps); - if (!prs_uint32("status", ps, depth, &r_s->status)) - return False; + if (!prs_ntstatus("status", ps, depth, &(r_s->status))) + return False; return True; } @@ -2578,7 +2578,7 @@ BOOL net_io_r_sam_deltas(char *desc, uint8 sess_key[16], } prs_align(ps); - if (!prs_uint32("status", ps, depth, &r_s->status)) + if (!prs_ntstatus("status", ps, depth, &r_s->status)) return False; return True; -- cgit From 39d7983a470cc3470dd7126de35697d965817cb6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 12 Sep 2001 03:08:51 +0000 Subject: - enable MSDFS by default, there seems no reason not to have it enabled by default in Samba 3.x - got rid of some unused parameters in Makefile.in - declare DEBUGLEVEL in debug.h rather than in each file (This used to be commit b8651acb9c0d7248a6a2e82c33b1e43633fd83fd) --- source3/rpc_parse/parse_dfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index 6e30c66ac1..2fe72da5a1 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -139,7 +139,7 @@ BOOL dfs_io_r_dfs_remove(char *desc, DFS_R_DFS_REMOVE *r_d, prs_struct *ps, int prs_debug(ps, depth, desc, "dfs_io_r_dfs_remove"); depth++; - if(!prs_ntstatus("status", ps, depth, &r_d->status)) + if(!prs_werror("status", ps, depth, &r_d->status)) return False; return True; @@ -225,7 +225,7 @@ BOOL dfs_io_r_dfs_add(char *desc, DFS_R_DFS_ADD *r_d, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "dfs_io_r_dfs_add"); depth++; - if(!prs_ntstatus("status", ps, depth, &r_d->status)) + if(!prs_werror("status", ps, depth, &r_d->status)) return False; return True; @@ -300,7 +300,7 @@ BOOL dfs_io_r_dfs_get_info(char* desc, DFS_R_DFS_GET_INFO* r_i, prs_struct* ps, if(!dfs_io_dfs_info_ctr("", &r_i->ctr, 1, r_i->level, ps, depth)) return False; - if(!prs_ntstatus("status", ps, depth, &r_i->status)) + if(!prs_werror("status", ps, depth, &r_i->status)) return False; return True; } @@ -501,7 +501,7 @@ BOOL dfs_io_r_dfs_enum(char *desc, DFS_R_DFS_ENUM *q_d, prs_struct *ps, int dept if(!smb_io_enum_hnd("resume_hnd", &q_d->reshnd, ps, depth)) return False; - if(!prs_ntstatus("status", ps, depth, &q_d->status)) + if(!prs_werror("status", ps, depth, &q_d->status)) return False; return True; } -- cgit From c849bd3196ee52d4f9e3e68435c577481b72548f Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 14 Sep 2001 04:35:48 +0000 Subject: Decode 68-byte password blocks using sam replication password key (which is actually the user session key). (This used to be commit 0f041597f8afa378fc3177264f1e52e014e6cf00) --- source3/rpc_parse/parse_net.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index e1a451b7ce..f7dbfb2a57 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -2061,7 +2061,8 @@ static BOOL net_io_sam_account_info(char *desc, uint8 sess_key[16], if (ps->io) { /* reading */ -/* // FIXME prs_hash1(ps, ps->offset, sess_key); */ + if (!prs_hash1(ps, ps->data_offset, sess_key)) + return False; } if (!net_io_sam_passwd_info("pass", &info->pass, ps, depth)) @@ -2070,7 +2071,8 @@ static BOOL net_io_sam_account_info(char *desc, uint8 sess_key[16], if (!ps->io) { /* writing */ -/* // FIXME TOO prs_hash1(ps, old_offset, sess_key); */ + if (!prs_hash1(ps, old_offset, sess_key)) + return False; } } if (old_offset + len > ps->buffer_size) -- cgit From 504eff41b3a357bd500c2faa2a3385584e4949d4 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 14 Sep 2001 04:36:19 +0000 Subject: Merge prs_hash1() function from tng. (This used to be commit 3245714243d15160b9e0e27c413fef65ea91f455) --- source3/rpc_parse/parse_prs.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 11fa46069a..d34465e8b4 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1210,3 +1210,27 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *me return 0; } + +/******************************************************************* + hash a stream. + ********************************************************************/ +BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) +{ + char *q; + + q = prs_data_p(ps); + q = &q[offset]; + +#ifdef DEBUG_PASSWORD + DEBUG(100, ("prs_hash1\n")); + dump_data(100, sess_key, 16); + dump_data(100, q, 68); +#endif + SamOEMhash((uchar *) q, sess_key, 68); + +#ifdef DEBUG_PASSWORD + dump_data(100, q, 68); +#endif + + return True; +} -- cgit From e7db47bffba15bd087c90b3831f05d736b8b20e5 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 17 Sep 2001 10:00:29 +0000 Subject: move to SAFE_FREE() (This used to be commit 94b0fde8a8a4e888cee93ebde79390c7942a2785) --- source3/rpc_parse/parse_creds.c | 12 ++---------- source3/rpc_parse/parse_prs.c | 5 ++--- source3/rpc_parse/parse_spoolss.c | 28 +++++++++++++--------------- 3 files changed, 17 insertions(+), 28 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c index ae8ba23a56..1ad9143009 100644 --- a/source3/rpc_parse/parse_creds.c +++ b/source3/rpc_parse/parse_creds.c @@ -147,11 +147,7 @@ frees a structure. ********************************************************************/ void creds_free_unix_sec(CREDS_UNIX_SEC *r_u) { - if (r_u->grps != NULL) - { - free(r_u->grps); - r_u->grps = NULL; - } + SAFE_FREE(r_u->grps); } /******************************************************************* @@ -225,11 +221,7 @@ frees a structure. ********************************************************************/ void creds_free_nt_sec(CREDS_NT_SEC *r_u) { - if (r_u->grp_rids != NULL) - { - free(r_u->grp_rids); - r_u->grp_rids = NULL; - } + SAFE_FREE(r_u->grp_rids); } /******************************************************************* diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index d34465e8b4..84c9a3abf4 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -116,10 +116,9 @@ BOOL prs_read(prs_struct *ps, int fd, size_t len, int timeout) void prs_mem_free(prs_struct *ps) { - if(ps->is_dynamic && (ps->data_p != NULL)) - free(ps->data_p); + if(ps->is_dynamic) + SAFE_FREE(ps->data_p); ps->is_dynamic = False; - ps->data_p = NULL; ps->buffer_size = 0; ps->data_offset = 0; } diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 027f8ceaa3..6e0bcdb905 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1807,19 +1807,19 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16 buffer->string_at_end -= (q-p+1)*sizeof(uint16); if(!prs_set_offset(ps, buffer->string_at_end)) { - free(chaine.buffer); + SAFE_FREE(chaine.buffer); return False; } /* write the string */ if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) { - free(chaine.buffer); + SAFE_FREE(chaine.buffer); return False; } q++; p=q; - free(chaine.buffer); + SAFE_FREE(chaine.buffer); } if(!prs_set_offset(ps, struct_offset)) @@ -1868,7 +1868,7 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16 /* Yes this should be realloc - it's freed below. JRA */ if((tc2=(uint16 *)Realloc(chaine2, realloc_size)) == NULL) { - if (chaine2) free(chaine2); + SAFE_FREE(chaine2); return False; } else chaine2 = tc2; @@ -1884,7 +1884,7 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16 { chaine2[l_chaine2] = '\0'; *string=(uint16 *)talloc_memdup(prs_get_mem_context(ps),chaine2,realloc_size); - free(chaine2); + SAFE_FREE(chaine2); } if(!prs_set_offset(ps, old_offset)) @@ -4886,7 +4886,7 @@ BOOL make_spoolss_driver_info_3( inf->dependentfilessize = len; if(!make_spoolss_buffer5(mem_ctx, &inf->dependentfiles, len, info3->dependentfiles)) { - safe_free (inf); + SAFE_FREE(inf); return False; } @@ -5003,7 +5003,7 @@ BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, if (uniarray_2_dosarray(&uni->dependentfiles, &d->dependentfiles )) return True; - free(*asc); + SAFE_FREE(*asc); return False; } @@ -5055,7 +5055,7 @@ BOOL uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni, return True; error: - free(*asc); + SAFE_FREE(*asc); return False; } @@ -5859,14 +5859,14 @@ BOOL spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int de void free_devmode(DEVICEMODE *devmode) { if (devmode!=NULL) { - safe_free(devmode->private); - safe_free(devmode); + SAFE_FREE(devmode->private); + SAFE_FREE(devmode); } } void free_printer_info_1(PRINTER_INFO_1 *printer) { - safe_free(printer); + SAFE_FREE(printer); } void free_printer_info_2(PRINTER_INFO_2 *printer) @@ -5874,15 +5874,13 @@ void free_printer_info_2(PRINTER_INFO_2 *printer) if (printer!=NULL) { free_devmode(printer->devmode); printer->devmode = NULL; - safe_free(printer); + SAFE_FREE(printer); } } void free_printer_info_3(PRINTER_INFO_3 *printer) { - if (printer!=NULL) { - safe_free(printer); - } + SAFE_FREE(printer); } void free_job_info_2(JOB_INFO_2 *job) -- cgit From 81ad252fbc3720939dccbda23ef447af071aab14 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 22 Sep 2001 03:44:15 +0000 Subject: These are RIDs not Unix UIDs so make this clear in the feild names. Andrew Bartlett (This used to be commit d1bc778301b31d77fdc3837ec3cff24ce37adcd7) --- source3/rpc_parse/parse_net.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index f7dbfb2a57..eb1ddd36f7 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1259,8 +1259,8 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam usr->logon_count = logon_count; usr->bad_pw_count = bad_pw_count; - usr->user_id = pdb_get_user_rid(sampw); - usr->group_id = pdb_get_group_rid(sampw); + usr->user_rid = pdb_get_user_rid(sampw); + usr->group_rid = pdb_get_group_rid(sampw); usr->num_groups = num_groups+1; usr->buffer_groups = 1; /* indicates fill in groups, below, even if there are none */ usr->user_flgs = user_flgs; @@ -1299,7 +1299,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam /* primary group **MUST** go first. NT4's winmsd.exe will give "The Network statistics are currently not available. 9-5" What the heck is this? -- jerry */ - usr->gids[0].g_rid = usr->group_id; + usr->gids[0].g_rid = usr->group_rid; usr->gids[0].attr = 0x07; for (i = 0; i < num_groups; i++) usr->gids[i+1] = gids[i]; @@ -1372,9 +1372,9 @@ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, if(!prs_uint16("bad_pw_count ", ps, depth, &usr->bad_pw_count)) /* bad password count */ return False; - if(!prs_uint32("user_id ", ps, depth, &usr->user_id)) /* User ID */ + if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid)) /* User RID */ return False; - if(!prs_uint32("group_id ", ps, depth, &usr->group_id)) /* Group ID */ + 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; -- cgit From dc1fc3ee8ec2199bc73bb5d7ec711c6800f61d65 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 2 Oct 2001 04:29:50 +0000 Subject: Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header. (This used to be commit 2d0922b0eabfdc0aaf1d0797482fef47ed7fde8e) --- source3/rpc_parse/parse_creds.c | 4 ---- source3/rpc_parse/parse_dfs.c | 2 -- source3/rpc_parse/parse_lsa.c | 7 ------- source3/rpc_parse/parse_misc.c | 3 --- source3/rpc_parse/parse_net.c | 2 -- source3/rpc_parse/parse_prs.c | 3 --- source3/rpc_parse/parse_reg.c | 5 ----- source3/rpc_parse/parse_rpc.c | 5 ----- source3/rpc_parse/parse_samr.c | 2 -- source3/rpc_parse/parse_sec.c | 2 -- source3/rpc_parse/parse_spoolss.c | 2 -- source3/rpc_parse/parse_srv.c | 3 --- source3/rpc_parse/parse_wks.c | 4 ---- 13 files changed, 44 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c index 1ad9143009..36e08f5746 100644 --- a/source3/rpc_parse/parse_creds.c +++ b/source3/rpc_parse/parse_creds.c @@ -21,12 +21,8 @@ * Foundation, Inc., 675 Mass Ave, Cambgrpsge, MA 02139, USA. */ - #include "includes.h" -extern int DEBUGLEVEL; - - /******************************************************************* makes a CREDS_UNIX structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index 2fe72da5a1..a152e3528e 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -26,8 +26,6 @@ #include "nterr.h" #include "rpc_parse.h" -extern int DEBUGLEVEL; - /******************************************************************* Make a DFS_Q_DFS_QUERY structure *******************************************************************/ diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 29da2c6913..f69f3ebdef 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -23,8 +23,6 @@ #include "includes.h" -extern int DEBUGLEVEL; - static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth); /******************************************************************* @@ -1822,8 +1820,3 @@ BOOL lsa_io_r_getsystemaccount(char *desc, LSA_R_GETSYSTEMACCOUNT *r_c, prs_str return True; } - - - - - diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 3015e383fd..6353c9a8cd 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -21,11 +21,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - #include "includes.h" -extern int DEBUGLEVEL; - /**************************************************************************** A temporary TALLOC context for things like unistrs, that is valid for the life of a complete RPC call. diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index eb1ddd36f7..cfd90241d0 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -23,8 +23,6 @@ #include "includes.h" -extern int DEBUGLEVEL; - /******************************************************************* Reads or writes a structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 84c9a3abf4..7b38e82f5a 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -21,11 +21,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -extern int DEBUGLEVEL; - #include "includes.h" - /******************************************************************* dump a prs to a file ********************************************************************/ diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index e7c1b8ecfe..67d8d89b01 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -23,12 +23,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - #include "includes.h" -extern int DEBUGLEVEL; - - /******************************************************************* Inits a structure. ********************************************************************/ @@ -1682,4 +1678,3 @@ BOOL reg_io_r_abort_shutdown(char *desc, REG_R_ABORT_SHUTDOWN * r_s, return True; } - diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index e457b48bf9..f4a84adee3 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -1,4 +1,3 @@ - /* * Unix SMB/Netbios implementation. * Version 1.9. @@ -23,12 +22,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - #include "includes.h" -extern int DEBUGLEVEL; - - /******************************************************************* interface/version dce/rpc pipe identification ********************************************************************/ diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 82902e5149..c92dbda7ec 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -27,8 +27,6 @@ #include "rpc_parse.h" #include "nterr.h" -extern int DEBUGLEVEL; - /******************************************************************* inits a SAMR_Q_CLOSE_HND structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 3d79c12cdb..98f076c1e3 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -24,8 +24,6 @@ #include "includes.h" -extern int DEBUGLEVEL; - #define SD_HEADER_SIZE 0x14 /******************************************************************* diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 6e0bcdb905..76e06a343a 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -24,8 +24,6 @@ #include "includes.h" -extern int DEBUGLEVEL; - /******************************************************************* return the length of a UNISTR string. ********************************************************************/ diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 057367054a..fa52b24495 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -22,11 +22,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - #include "includes.h" -extern int DEBUGLEVEL; - /******************************************************************* Inits a SH_INFO_1_STR structure ********************************************************************/ diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c index 07194e1c31..ecd4a201ae 100644 --- a/source3/rpc_parse/parse_wks.c +++ b/source3/rpc_parse/parse_wks.c @@ -1,4 +1,3 @@ - /* * Unix SMB/Netbios implementation. * Version 1.9. @@ -22,11 +21,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - #include "includes.h" -extern int DEBUGLEVEL; - /******************************************************************* Init ********************************************************************/ -- cgit From cb4b13a82ba26c70674fe903d89db1d38103dff7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 2 Oct 2001 06:57:18 +0000 Subject: Fixed the bug with member servers in a Samba PDC hosted domain not allowing other access. Problem was max time was being set to 0xffffffff, instead of 0x7fffffff. Jeremy. (This used to be commit 94403d841710391ec26539e4b4157439d5778ff7) --- source3/rpc_parse/parse_misc.c | 1 + source3/rpc_parse/parse_net.c | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 6353c9a8cd..5160a2778f 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1240,6 +1240,7 @@ BOOL smb_io_cred(char *desc, DOM_CRED *cred, prs_struct *ps, int depth) if(!smb_io_chal ("", &cred->challenge, ps, depth)) return False; + if(!smb_io_utime("", &cred->timestamp, ps, depth)) return False; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index cfd90241d0..a3ff179605 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1260,6 +1260,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam usr->user_rid = pdb_get_user_rid(sampw); usr->group_rid = pdb_get_group_rid(sampw); usr->num_groups = num_groups+1; + usr->buffer_groups = 1; /* indicates fill in groups, below, even if there are none */ usr->user_flgs = user_flgs; @@ -1339,17 +1340,17 @@ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, if (usr->ptr_user_info == 0) return True; - if(!smb_io_time("time", &usr->logon_time, ps, depth)) /* logon time */ + if(!smb_io_time("logon time", &usr->logon_time, ps, depth)) /* logon time */ return False; - if(!smb_io_time("time", &usr->logoff_time, ps, depth)) /* logoff time */ + if(!smb_io_time("logoff time", &usr->logoff_time, ps, depth)) /* logoff time */ return False; - if(!smb_io_time("time", &usr->kickoff_time, ps, depth)) /* kickoff time */ + if(!smb_io_time("kickoff time", &usr->kickoff_time, ps, depth)) /* kickoff time */ return False; - if(!smb_io_time("time", &usr->pass_last_set_time, ps, depth)) /* password last set time */ + if(!smb_io_time("last set time", &usr->pass_last_set_time, ps, depth)) /* password last set time */ return False; - if(!smb_io_time("time", &usr->pass_can_change_time , ps, depth)) /* password can change time */ + if(!smb_io_time("can change time", &usr->pass_can_change_time , ps, depth)) /* password can change time */ return False; - if(!smb_io_time("time", &usr->pass_must_change_time, ps, depth)) /* password must change time */ + if(!smb_io_time("must change time", &usr->pass_must_change_time, ps, depth)) /* password must change time */ return False; if(!smb_io_unihdr("unihdr", &usr->hdr_user_name, ps, depth)) /* username unicode string header */ -- cgit From d9d7f023d8d11943ca0375e1573e6ec9921889bc Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 29 Oct 2001 07:35:11 +0000 Subject: This commit is number 4 of 4. In particular this commit focuses on: Actually adding the 'const' to the passdb interface, and the flow-on changes. Also kill off the 'disp_info' stuff, as its no longer used. While these changes have been mildly tested, and are pretty small, any assistance in this is appreciated. ---- These changes introduces a large dose of 'const' to the Samba tree. There are a number of good reasons to do this: - I want to allow the SAM_ACCOUNT structure to move from wasteful pstrings and fstrings to allocated strings. We can't do that if people are modifying these outputs, as they may well make assumptions about getting pstrings and fstrings - I want --with-pam_smbpass to compile with a slightly sane volume of warnings, currently its pretty bad, even in 2.2 where is compiles at all. - Tridge assures me that he no longer opposes 'const religion' based on the ability to #define const the problem away. - Changed Get_Pwnam(x,y) into two variants (so that the const parameter can work correctly): - Get_Pwnam(const x) and Get_Pwnam_Modify(x). - Reworked smbd/chgpasswd.c to work with these mods, passing around a 'struct passwd' rather than the modified username --- This finishes this line of commits off, your tree should now compile again :-) Andrew Bartlett (This used to be commit c95f5aeb9327347674589ae313b75bee3bf8e317) --- source3/rpc_parse/parse_net.c | 12 ++++++------ source3/rpc_parse/parse_samr.c | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index a3ff179605..2ad970a61b 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1209,12 +1209,12 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam int len_user_name, len_full_name, len_home_dir, len_dir_drive, len_logon_script, len_profile_path; - char* user_name = pdb_get_username(sampw); - char* full_name = pdb_get_fullname(sampw); - char* home_dir = pdb_get_homedir(sampw); - char* dir_drive = pdb_get_dirdrive(sampw); - char* logon_script = pdb_get_logon_script(sampw); - char* profile_path = pdb_get_profile_path(sampw); + const char* user_name = pdb_get_username(sampw); + const char* full_name = pdb_get_fullname(sampw); + const char* home_dir = pdb_get_homedir(sampw); + const char* dir_drive = pdb_get_dirdrive(sampw); + const char* logon_script = pdb_get_logon_script(sampw); + const char* profile_path = pdb_get_profile_path(sampw); int len_logon_srv = strlen(logon_srv); int len_logon_dom = strlen(logon_dom); diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index c92dbda7ec..3f489f0a2b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4978,7 +4978,7 @@ inits a SAM_USER_INFO_12 structure. ********************************************************************/ void init_sam_user_info12(SAM_USER_INFO_12 * usr, - uint8 lm_pwd[16], uint8 nt_pwd[16]) + const uint8 lm_pwd[16], const uint8 nt_pwd[16]) { DEBUG(5, ("init_sam_user_info12\n")); @@ -5770,15 +5770,15 @@ void init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw) len_description, len_workstations, len_unknown_str, len_munged_dial; - char* user_name = pdb_get_username(pw); - char* full_name = pdb_get_fullname(pw); - char* home_dir = pdb_get_homedir(pw); - char* dir_drive = pdb_get_dirdrive(pw); - char* logon_script = pdb_get_logon_script(pw); - char* profile_path = pdb_get_profile_path(pw); - char* description = pdb_get_acct_desc(pw); - char* workstations = pdb_get_workstations(pw); - char* munged_dial = pdb_get_munged_dial(pw); + 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_dirdrive(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); len_user_name = user_name != NULL ? strlen(user_name )+1 : 0; len_full_name = full_name != NULL ? strlen(full_name )+1 : 0; @@ -5974,7 +5974,7 @@ static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 * usr, void init_sam_user_info20A(SAM_USER_INFO_20 *usr, SAM_ACCOUNT *pw) { int len_munged_dial; - char* munged_dial = pdb_get_munged_dial(pw); + const char* munged_dial = pdb_get_munged_dial(pw); len_munged_dial = munged_dial != NULL ? strlen(munged_dial )+1 : 0; init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); -- cgit From 560c0c92ad7565337c3db1e23ea60e9c9230b267 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 30 Oct 2001 05:29:37 +0000 Subject: Removed confusing comment. (This used to be commit b496936634a4b676aa2df973e64c91aa0da5d7d5) --- source3/rpc_parse/parse_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 2ad970a61b..fe812868d1 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1489,7 +1489,7 @@ BOOL net_io_q_sam_logon(char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, int de if(!prs_align(ps)) return False; - if(!smb_io_sam_info("", &q_l->sam_id, ps, depth)) /* domain SID */ + if(!smb_io_sam_info("", &q_l->sam_id, ps, depth)) return False; if(!prs_uint16("validation_level", ps, depth, &q_l->validation_level)) -- cgit From eab05eac3998eeb9fb6fb635771370d645b5ff06 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 31 Oct 2001 04:55:43 +0000 Subject: This one's a doozy. A cut&paste bug incorrectly sets the max string length of the lm challenge/response header in the NET_ID_INFO_2 structure included in a network logon request. It seems Windows 2000 is the only OS that cares about this. (This used to be commit 0f6207f45567a8af0a125a838a5ed68ea6c22283) --- source3/rpc_parse/parse_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index fe812868d1..2f0dd1eb62 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1013,7 +1013,7 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, memcpy(id->lm_chal, lm_challenge, sizeof(id->lm_chal)); init_str_hdr(&id->hdr_nt_chal_resp, sizeof(lm_owf), nt_chal_resp_len, (nt_chal_resp != NULL) ? 1 : 0); - init_str_hdr(&id->hdr_lm_chal_resp, sizeof(nt_owf), lm_chal_resp_len, (lm_chal_resp != NULL) ? 1 : 0); + init_str_hdr(&id->hdr_lm_chal_resp, sizeof(lm_owf), lm_chal_resp_len, (lm_chal_resp != NULL) ? 1 : 0); init_unistr2(&id->uni_domain_name, domain_name, len_domain_name); init_unistr2(&id->uni_user_name, user_name, len_user_name); -- cgit From 60f0627afb167faad57385d44f0b587186a7ac2b Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 31 Oct 2001 10:46:25 +0000 Subject: This is a farily large patch (3300 lines) and reworks most of the AuthRewrite code. In particular this assists tpot in some of his work, becouse it provides the connection between the authenticaion and the vuid generation. Major Changes: - Fully malloc'ed structures. - Massive rework of the code so that all structures are made and destroyed using malloc and free, rather than hanging around on the stack. - SAM_ACCOUNT unix uids and gids are now pointers to the same, to allow them to be declared 'invalid' without the chance that people might get ROOT by default. - kill off some of the "DOMAIN\user" lookups. These can be readded at a more appropriate place (probably domain_client_validate.c) in the future. They don't belong in session setups. - Massive introduction of DATA_BLOB structures, particularly for passwords. - Use NTLMSSP flags to tell the backend what its getting, rather than magic lenghths. - Fix winbind back up again, but tpot is redoing this soon anyway. - Abstract much of the work in srv_netlog_nt back into auth helper functions. This is a LARGE change, and any assistance is testing it is appriciated. Domain logons are still broken (as far as I can tell) but other functionality seems intact. Needs testing with a wide variety of MS clients. Andrew Bartlett (This used to be commit f70fb819b2f57bd57232b51808345e2319d52f6c) --- source3/rpc_parse/parse_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 2f0dd1eb62..c546213173 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1193,7 +1193,7 @@ static BOOL smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int d void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sampw, uint16 logon_count, uint16 bad_pw_count, uint32 num_groups, DOM_GID *gids, - uint32 user_flgs, char *sess_key, + uint32 user_flgs, uchar *sess_key, char *logon_srv, char *logon_dom, DOM_SID *dom_sid, char *other_sids) { -- cgit From acb81fe408f0e674088f0952aaba442ddb494b0c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 1 Nov 2001 05:02:41 +0000 Subject: Various post AuthRewrite cleanups, fixups and tidyups. Zero out some of the plaintext passwords for paranoia Fix up some of the other passdb backends with the change to *uid_t rather than uid_t. Make some of the code in srv_netlog_nt.c clearer, is passing an array around, so pass its lenght in is definition, not as a seperate paramater. Use sizeof() rather than magic numbers, it makes things easier to read. Cope with a PAM authenticated user who is not in /etc/passwd - currently by saying NO_SUCH_USER, but this can change in future. Andrew Bartlett (This used to be commit 514c91b16baca639bb04638042bf9894d881172a) --- source3/rpc_parse/parse_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index c546213173..1b0e498f77 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1002,17 +1002,17 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, if (nt_chal_resp) { /* oops. can only send what-ever-it-is direct */ - memcpy(nt_owf, nt_chal_resp, 24); + memcpy(nt_owf, nt_chal_resp, MIN(sizeof(nt_owf), nt_chal_resp_len)); nt_chal_resp = nt_owf; } if (lm_chal_resp) { /* oops. can only send what-ever-it-is direct */ - memcpy(lm_owf, lm_chal_resp, 24); + memcpy(lm_owf, lm_chal_resp, MIN(sizeof(lm_owf), lm_chal_resp_len)); lm_chal_resp = lm_owf; } memcpy(id->lm_chal, lm_challenge, sizeof(id->lm_chal)); - init_str_hdr(&id->hdr_nt_chal_resp, sizeof(lm_owf), nt_chal_resp_len, (nt_chal_resp != NULL) ? 1 : 0); + init_str_hdr(&id->hdr_nt_chal_resp, sizeof(nt_owf), nt_chal_resp_len, (nt_chal_resp != NULL) ? 1 : 0); init_str_hdr(&id->hdr_lm_chal_resp, sizeof(lm_owf), lm_chal_resp_len, (lm_chal_resp != NULL) ? 1 : 0); init_unistr2(&id->uni_domain_name, domain_name, len_domain_name); -- cgit From c3f21fc360b220b4547c43c03ac60f20ecb30654 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 4 Nov 2001 18:13:33 +0000 Subject: get the string lengths right in domain logons Andrew, this fixes domain logons in head. Please look at the change, as I think you may have misunderstood the max_str_len field (which is badly named) (This used to be commit fd3a657b440a61c0c146947bb62d2b83c1689b87) --- source3/rpc_parse/parse_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 1b0e498f77..3e7be9d4cf 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1012,8 +1012,8 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, } memcpy(id->lm_chal, lm_challenge, sizeof(id->lm_chal)); - init_str_hdr(&id->hdr_nt_chal_resp, sizeof(nt_owf), nt_chal_resp_len, (nt_chal_resp != NULL) ? 1 : 0); - init_str_hdr(&id->hdr_lm_chal_resp, sizeof(lm_owf), lm_chal_resp_len, (lm_chal_resp != NULL) ? 1 : 0); + 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, len_domain_name); init_unistr2(&id->uni_user_name, user_name, len_user_name); -- cgit From 7623cec4ad5f8eecae1a3c780a7ca89a6a14b93a Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 5 Nov 2001 06:15:02 +0000 Subject: Wrote some stubs for new win2k only spoolss rpc commands: GetPrinterDataEx() and SetPrinterDataEx(). Not sure what the command number is for the latter is - I haven't seen it on the wire yet. (This used to be commit 87614c74b3d66cf2ca706b33e6cf0a32b4166e7a) --- source3/rpc_parse/parse_spoolss.c | 142 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 76e06a343a..b86c595c64 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -6097,3 +6097,145 @@ BOOL spoolss_io_r_reply_rrpcn(char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct * return True; } + +/******************************************************************* + * read a structure. + * called from spoolss_q_getprinterdataex (srv_spoolss.c) + ********************************************************************/ + +BOOL spoolss_io_q_getprinterdataex(char *desc, SPOOL_Q_GETPRINTERDATAEX *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdataex"); + depth++; + + if (!prs_align(ps)) + return False; + if (!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) + return False; + if (!prs_align(ps)) + return False; + if (!smb_io_unistr2("keyname", &q_u->keyname,True,ps,depth)) + return False; + if (!prs_align(ps)) + return False; + if (!smb_io_unistr2("valuename", &q_u->valuename,True,ps,depth)) + return False; + if (!prs_align(ps)) + return False; + if (!prs_uint32("size", ps, depth, &q_u->size)) + return False; + + return True; +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_getprinterdataex (srv_spoolss.c) + ********************************************************************/ + +BOOL spoolss_io_r_getprinterdataex(char *desc, SPOOL_R_GETPRINTERDATAEX *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) + return False; + + prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdataex"); + depth++; + + if (!prs_align(ps)) + return False; + if (!prs_uint32("type", ps, depth, &r_u->type)) + return False; + if (!prs_uint32("size", ps, depth, &r_u->size)) + return False; + + if (!prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size)) + return False; + + if (!prs_align(ps)) + 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; +} + +/******************************************************************* + * read a structure. + * called from spoolss_q_setprinterdataex (srv_spoolss.c) + ********************************************************************/ + +BOOL spoolss_io_q_setprinterdataex(char *desc, SPOOL_Q_SETPRINTERDATAEX *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_setprinterdataex"); + depth++; + + if(!prs_align(ps)) + return False; + if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) + return False; + if(!smb_io_unistr2("", &q_u->key, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!smb_io_unistr2("", &q_u->value, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("type", ps, depth, &q_u->type)) + return False; + + if(!prs_uint32("max_len", ps, depth, &q_u->max_len)) + return False; + + switch (q_u->type) + { + case 0x1: + case 0x3: + case 0x4: + case 0x7: + if (q_u->max_len) { + if (UNMARSHALLING(ps)) + q_u->data=(uint8 *)prs_alloc_mem(ps, q_u->max_len * sizeof(uint8)); + if(q_u->data == NULL) + return False; + if(!prs_uint8s(False,"data", ps, depth, q_u->data, q_u->max_len)) + return False; + } + if(!prs_align(ps)) + return False; + break; + } + + if(!prs_uint32("real_len", ps, depth, &q_u->real_len)) + return False; + + return True; +} + +/******************************************************************* + * write a structure. + * called from spoolss_q_setprinterdataex (srv_spoolss.c) + ********************************************************************/ + +BOOL spoolss_io_r_setprinterdataex(char *desc, SPOOL_R_SETPRINTERDATAEX *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_setprinterdataex"); + depth++; + + if(!prs_align(ps)) + return False; + if(!prs_werror("status", ps, depth, &r_u->status)) + return False; + + return True; +} -- cgit From fea97ecd7c00022b59982a078add89a1a7e1d377 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Thu, 8 Nov 2001 03:12:22 +0000 Subject: spoolss_io_devmode private data is binary and should be shown in hex, not ascii. (This used to be commit be5d32eb9c58bb1911299d095efcf230d50ed590) --- source3/rpc_parse/parse_spoolss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b86c595c64..5a13403fee 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -633,7 +633,8 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo } DEBUG(7,("spoolss_io_devmode: parsing [%d] bytes of private\n",devmode->driverextra)); - if (!prs_uint8s(True, "private", ps, depth, devmode->private, devmode->driverextra)) + if (!prs_uint8s(False, "private", ps, depth, + devmode->private, devmode->driverextra)) return False; } -- cgit From ea40fa55f0c385dd714300a7dcf89393f831ca79 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Thu, 15 Nov 2001 06:03:22 +0000 Subject: Doxygen demo for Tim. (This used to be commit 5c892badbcad43b8a2e002d1a42483c402f2d3e9) --- source3/rpc_parse/parse_prs.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 7b38e82f5a..89b0db4609 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -61,9 +61,14 @@ void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name) } -/******************************************************************* - Initialise a parse structure - malloc the data if requested. - ********************************************************************/ +/** + * Initialise an expandable parse structure. + * + * @param size Initial buffer size. If >0, a new buffer will be + * created with malloc(). + * + * @return False if allocation fails, otherwise True. + **/ BOOL prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, BOOL io) { ZERO_STRUCTP(ps); -- cgit From 3a50f1fde7ce0f8c17768a07636a21d694736dde Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 15 Nov 2001 20:28:38 +0000 Subject: No longer used. Jeremy. (This used to be commit be7323163bec9367e7457d7b6a4792fd00aa8ef5) --- source3/rpc_parse/parse_creds.c | 622 ---------------------------------------- 1 file changed, 622 deletions(-) delete mode 100644 source3/rpc_parse/parse_creds.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_creds.c b/source3/rpc_parse/parse_creds.c deleted file mode 100644 index 36e08f5746..0000000000 --- a/source3/rpc_parse/parse_creds.c +++ /dev/null @@ -1,622 +0,0 @@ -/* - * Unix SMB/Netbios implementation. - * Version 1.9. - * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1999, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, - * Copyright (C) Paul Ashton 1997-1999. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambgrpsge, MA 02139, USA. - */ - -#include "includes.h" - -/******************************************************************* -makes a CREDS_UNIX structure. -********************************************************************/ -BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name, - const char* requested_name, - const char* real_name, - BOOL guest) -{ - if (r_u == NULL) return False; - - DEBUG(5,("make_creds_unix\n")); - - fstrcpy(r_u->user_name , user_name); - fstrcpy(r_u->requested_name, requested_name); - fstrcpy(r_u->real_name , real_name); - r_u->guest = guest; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL creds_io_unix(char *desc, CREDS_UNIX *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "creds_io_unix"); - depth++; - - prs_align(ps); - prs_string("user_name", ps, depth, r_u->user_name, strlen(r_u->user_name), sizeof(r_u->user_name)); - prs_align(ps); - prs_string("requested_name", ps, depth, r_u->requested_name, strlen(r_u->requested_name), sizeof(r_u->requested_name)); - prs_align(ps); - prs_string("real_name", ps, depth, r_u->real_name, strlen(r_u->real_name), sizeof(r_u->real_name)); - prs_align(ps); - prs_uint32("guest", ps, depth, (uint32 *)&(r_u->guest)); - return True; -} - - -/******************************************************************* -frees a structure. -********************************************************************/ -void creds_free_unix(CREDS_UNIX *r_u) -{ -} - -/******************************************************************* -makes a CREDS_UNIX_SEC structure. -********************************************************************/ -BOOL make_creds_unix_sec(CREDS_UNIX_SEC *r_u, - uint32 uid, uint32 gid, uint32 num_grps, gid_t *grps) -{ - int i; - if (r_u == NULL) return False; - - DEBUG(5,("make_creds_unix_sec\n")); - - r_u->uid = uid; - r_u->gid = gid; - r_u->num_grps = num_grps; - r_u->grps = (uint32*)malloc(sizeof(r_u->grps[0]) * r_u->num_grps); - if (r_u->grps == NULL && num_grps != 0) - { - return False; - } - for (i = 0; i < num_grps; i++) - { - r_u->grps[i] = (gid_t)grps[i]; - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL creds_io_unix_sec(char *desc, CREDS_UNIX_SEC *r_u, prs_struct *ps, int depth) -{ - uint32 i; - - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "creds_io_unix_sec"); - depth++; - - prs_align(ps); - - prs_uint32("uid", ps, depth, &(r_u->uid)); - prs_uint32("gid", ps, depth, &(r_u->gid)); - prs_uint32("num_grps", ps, depth, (uint32 *)&(r_u->num_grps)); - if (r_u->num_grps != 0) - { - uint32 *tgr; - - tgr = (uint32*)Realloc(r_u->grps, - sizeof(r_u->grps[0]) * - r_u->num_grps); - if (tgr == NULL) - { - creds_free_unix_sec(r_u); - return False; - } - else r_u->grps = tgr; - } - for (i = 0; i < r_u->num_grps; i++) - { - prs_uint32("", ps, depth, &(r_u->grps[i])); - } - return True; -} - - -/******************************************************************* -frees a structure. -********************************************************************/ -void creds_free_unix_sec(CREDS_UNIX_SEC *r_u) -{ - SAFE_FREE(r_u->grps); -} - -/******************************************************************* -makes a CREDS_NT_SEC structure. -********************************************************************/ -BOOL make_creds_nt_sec(CREDS_NT_SEC *r_u, - DOM_SID *sid, uint32 num_grps, uint32 *grps) -{ - int i; - if (r_u == NULL) return False; - - DEBUG(5,("make_creds_unix_sec\n")); - - sid_copy(&r_u->sid, sid); - r_u->num_grps = num_grps; - r_u->grp_rids = (uint32*)malloc(sizeof(r_u->grp_rids[0]) * r_u->num_grps); - - if (r_u->grp_rids == NULL && num_grps != 0) - { - return False; - } - for (i = 0; i < num_grps; i++) - { - r_u->grp_rids[i] = grps[i]; - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL creds_io_nt_sec(char *desc, CREDS_NT_SEC *r_u, prs_struct *ps, int depth) -{ - int i; - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "creds_io_nt"); - depth++; - - prs_align(ps); - - smb_io_dom_sid ("sid", &r_u->sid, ps, depth); - prs_align(ps); - - prs_uint32("num_grps", ps, depth, &(r_u->num_grps)); - if (r_u->num_grps != 0) - { - uint32 *tgrid; - - tgrid = (uint32*)Realloc(r_u->grp_rids, - sizeof(r_u->grp_rids[0]) * - r_u->num_grps); - if (tgrid == NULL) - { - creds_free_nt_sec(r_u); - return False; - } - else r_u->grp_rids = tgrid; - } - for (i = 0; i < r_u->num_grps; i++) - { - prs_uint32("", ps, depth, &(r_u->grp_rids[i])); - } - - return True; -} - -/******************************************************************* -frees a structure. -********************************************************************/ -void creds_free_nt_sec(CREDS_NT_SEC *r_u) -{ - SAFE_FREE(r_u->grp_rids); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL creds_io_pwd_info(char *desc, struct pwd_info *pwd, prs_struct *ps, int depth) -{ - if (pwd == NULL) return False; - - prs_debug(ps, depth, desc, "creds_io_pwd_info"); - depth++; - - prs_align(ps); - - prs_uint32("nullpwd", ps, depth, (uint32 *)&(pwd->null_pwd)); - if (pwd->null_pwd) - { - return True; - } - - prs_uint32("cleartext", ps, depth, (uint32 *)&(pwd->cleartext)); - if (pwd->cleartext) - { - prs_string("password", ps, depth, pwd->password, strlen(pwd->password), sizeof(pwd->password)); - prs_align(ps); - return True; - } - prs_uint32("crypted", ps, depth, (uint32 *)&(pwd->crypted)); - - prs_uint8s(False, "smb_lm_pwd", ps, depth, (unsigned char*)&pwd->smb_lm_pwd, sizeof(pwd->smb_lm_pwd)); - prs_align(ps); - prs_uint8s(False, "smb_nt_pwd", ps, depth, (unsigned char*)&pwd->smb_nt_pwd, sizeof(pwd->smb_nt_pwd)); - prs_align(ps); - - prs_uint8s(False, "smb_lm_owf", ps, depth, (unsigned char*)&pwd->smb_lm_owf, sizeof(pwd->smb_lm_owf)); - prs_align(ps); - prs_uint32("nt_owf_len", ps, depth, &(pwd->nt_owf_len)); - if (pwd->nt_owf_len > sizeof(pwd->smb_nt_owf)) - { - return False; - } - prs_uint8s(False, "smb_nt_owf", ps, depth, (unsigned char*)&pwd->smb_nt_owf, pwd->nt_owf_len); - prs_align(ps); - - prs_uint8s(False, "lm_cli_chal", ps, depth, (unsigned char*)&pwd->lm_cli_chal, sizeof(pwd->lm_cli_chal)); - prs_align(ps); - prs_uint32("nt_cli_chal_len", ps, depth, &(pwd->nt_cli_chal_len)); - - if (pwd->nt_cli_chal_len > sizeof(pwd->nt_cli_chal)) - { - return False; - } - prs_uint8s(False, "nt_cli_chal", ps, depth, (unsigned char*)&pwd->nt_cli_chal, pwd->nt_cli_chal_len); - prs_align(ps); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL creds_io_nt(char *desc, CREDS_NT *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "creds_io_nt"); - depth++; - - prs_align(ps); - - /* lkclXXXX CHEAT!!!!!!!! */ - prs_string("user_name", ps, depth, r_u->user_name, strlen(r_u->user_name), sizeof(r_u->user_name)); - prs_align(ps); - prs_string("domain", ps, depth, r_u->domain, strlen(r_u->domain), sizeof(r_u->domain)); - prs_align(ps); - - creds_io_pwd_info("pwd", &r_u->pwd, ps, depth); - prs_align(ps); - - prs_uint32("ntlmssp", ps, depth, &(r_u->ntlmssp_flags)); - - return True; -} - -/******************************************************************* -frees a structure. -********************************************************************/ -void creds_free_nt(CREDS_NT *r_u) -{ -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL creds_io_hybrid(char *desc, CREDS_HYBRID *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "creds_io_hybrid"); - depth++; - - prs_align(ps); - - prs_uint32("reuse", ps, depth, (uint32 *)&(r_u->reuse)); - - prs_uint32("ptr_ntc", ps, depth, &(r_u->ptr_ntc)); - prs_uint32("ptr_uxc", ps, depth, &(r_u->ptr_uxc)); - prs_uint32("ptr_nts", ps, depth, &(r_u->ptr_nts)); - prs_uint32("ptr_uxs", ps, depth, &(r_u->ptr_uxs)); - prs_uint32("ptr_ssk", ps, depth, &(r_u->ptr_ssk)); - if (r_u->ptr_ntc != 0) - { - if (!creds_io_nt ("ntc", &r_u->ntc, ps, depth)) return False; - } - if (r_u->ptr_uxc != 0) - { - if (!creds_io_unix("uxc", &r_u->uxc, ps, depth)) return False; - } - if (r_u->ptr_nts != 0) - { - if (!creds_io_nt_sec ("nts", &r_u->nts, ps, depth)) return False; - } - if (r_u->ptr_uxs != 0) - { - if (!creds_io_unix_sec("uxs", &r_u->uxs, ps, depth)) return False; - } - if (r_u->ptr_ssk != 0) - { - prs_uint8s(False, "usr_sess_key", ps, depth, (unsigned char*)&r_u->usr_sess_key, sizeof(r_u->usr_sess_key)); - } - else - { - memset(r_u->usr_sess_key, 0, sizeof(r_u->usr_sess_key)); - } - return True; -} - -void copy_unix_creds(CREDS_UNIX *to, const CREDS_UNIX *from) -{ - if (from == NULL) - { - to->user_name[0] = 0; - return; - } - fstrcpy(to->user_name, from->user_name); -} - -void copy_nt_sec_creds(CREDS_NT_SEC *to, const CREDS_NT_SEC *from) -{ - if (from == NULL) - { - ZERO_STRUCTP(to); - return; - } - sid_copy(&to->sid, &from->sid); - to->num_grps = 0; - to->grp_rids = NULL; - - if (from->num_grps != 0) - { - size_t size = from->num_grps * sizeof(from->grp_rids[0]); - to->grp_rids = (uint32*)malloc(size); - if (to->grp_rids == NULL) - { - return; - } - to->num_grps = from->num_grps; - memcpy(to->grp_rids, from->grp_rids, size); - } -} - -void copy_unix_sec_creds(CREDS_UNIX_SEC *to, const CREDS_UNIX_SEC *from) -{ - if (from == NULL) - { - to->uid = -1; - to->gid = -1; - to->num_grps = 0; - to->grps = NULL; - return; - } - to->uid = from->uid; - to->gid = from->gid; - to->num_grps = 0; - to->grps = NULL; - - if (from->num_grps != 0) - { - size_t size = from->num_grps * sizeof(from->grps[0]); - to->grps = (uint32*)malloc(size); - if (to->grps == NULL) - { - return; - } - to->num_grps = from->num_grps; - memcpy(to->grps, from->grps, size); - } -} - -void create_ntc_from_cli_state (CREDS_NT *to, const struct cli_state *cli_from) -{ - /* - * NULL credentials -- - * if this gets executed, it is a programming error. - * fall through to copy_nt_creds() - */ - if (cli_from == NULL) - { - copy_nt_creds (to, NULL); - return; - } - - safe_strcpy(to->domain , cli_from->domain , sizeof(cli_from->domain )-1); - safe_strcpy(to->user_name, cli_from->user_name, sizeof(cli_from->user_name)-1); - memcpy(&to->pwd, &cli_from->pwd, sizeof(cli_from->pwd)); - to->ntlmssp_flags = cli_from->ntlmssp_flags; - DEBUG(10,("create_ntc_fromcli_state: user %s domain %s flgs: %x\n", - to->user_name, to->domain, - to->ntlmssp_flags)); - -} - - -void copy_nt_creds(struct ntuser_creds *to, - const struct ntuser_creds *from) -{ - if (from == NULL) - { - DEBUG(10,("copy_nt_creds: null creds\n")); - to->domain[0] = 0; - to->user_name[0] = 0; - pwd_set_nullpwd(&to->pwd); - to->ntlmssp_flags = 0; - - return; - } - safe_strcpy(to->domain , from->domain , sizeof(from->domain )-1); - safe_strcpy(to->user_name, from->user_name, sizeof(from->user_name)-1); - memcpy(&to->pwd, &from->pwd, sizeof(from->pwd)); - to->ntlmssp_flags = from->ntlmssp_flags; - DEBUG(10,("copy_nt_creds: user %s domain %s flgs: %x\n", - to->user_name, to->domain, - to->ntlmssp_flags)); -} - -void copy_user_creds(struct user_creds *to, - const struct user_creds *from) -{ - ZERO_STRUCTP(to); - if (from == NULL) - { - to->ptr_ntc = 0; - to->ptr_uxc = 0; - to->ptr_nts = 0; - to->ptr_uxs = 0; - to->ptr_ssk = 0; - copy_nt_creds(&to->ntc, NULL); - copy_unix_creds(&to->uxc, NULL); - copy_nt_sec_creds(&to->nts, NULL); - copy_unix_sec_creds(&to->uxs, NULL); - to->reuse = False; - return; - } - - to->reuse = from->reuse; - - to->ptr_nts = from->ptr_nts; - to->ptr_uxs = from->ptr_uxs; - to->ptr_ntc = from->ptr_ntc; - to->ptr_uxc = from->ptr_uxc; - to->ptr_ssk = from->ptr_ssk; - - if (to->ptr_ntc != 0) - { - copy_nt_creds(&to->ntc, &from->ntc); - } - if (to->ptr_uxc != 0) - { - copy_unix_creds(&to->uxc, &from->uxc); - } - if (to->ptr_nts != 0) - { - copy_nt_sec_creds(&to->nts, &from->nts); - } - if (to->ptr_uxs != 0) - { - copy_unix_sec_creds(&to->uxs, &from->uxs); - } - if (to->ptr_ssk != 0) - { - memcpy(to->usr_sess_key, from->usr_sess_key, - sizeof(to->usr_sess_key)); - } -} - -void free_user_creds(struct user_creds *creds) -{ - creds_free_unix(&creds->uxc); - creds_free_nt (&creds->ntc); - creds_free_unix_sec(&creds->uxs); - creds_free_nt_sec (&creds->nts); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL creds_io_cmd(char *desc, CREDS_CMD *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "creds_io_cmd"); - depth++; - - prs_align(ps); - - prs_uint16("version", ps, depth, &(r_u->version)); - prs_uint16("command", ps, depth, &(r_u->command)); - prs_uint32("pid ", ps, depth, &(r_u->pid )); - - prs_string("name ", ps, depth, r_u->name, strlen(r_u->name), sizeof(r_u->name)); - prs_align(ps); - - prs_uint32("ptr_creds", ps, depth, &(r_u->ptr_creds)); - if (r_u->ptr_creds != 0) - { - if (!creds_io_hybrid("creds", r_u->cred, ps, depth)) - { - return False; - } - } - - - return True; -} - - -BOOL create_ntuser_creds( prs_struct *ps, - const char* name, - uint16 version, uint16 command, - uint32 pid, - const struct ntuser_creds *ntu, - BOOL reuse) -{ - CREDS_CMD cmd; - struct user_creds usr; - - ZERO_STRUCT(cmd); - ZERO_STRUCT(usr); - - DEBUG(10,("create_user_creds: %s %d %d\n", - name, version, command)); - - usr.reuse = reuse; - - fstrcpy(cmd.name, name); - cmd.version = version; - cmd.command = command; - cmd.pid = pid ; - cmd.ptr_creds = ntu != NULL ? 1 : 0; - cmd.cred = &usr; - - if (ntu != NULL) - { - copy_nt_creds(&usr.ntc, ntu); - usr.ptr_ntc = 1; - } - else - { - usr.ptr_ntc = 0; - } - - prs_init(ps, 1024, NULL, MARSHALL); - - ps->data_offset = 4; - return creds_io_cmd("creds", &cmd, ps, 0); -} - -BOOL create_user_creds( prs_struct *ps, - const char* name, - uint16 version, uint16 command, - uint32 pid, - struct user_creds *usr) -{ - CREDS_CMD cmd; - - ZERO_STRUCT(cmd); - - DEBUG(10,("create_user_creds: %s %d %d\n", - name, version, command)); - - fstrcpy(cmd.name, name); - cmd.version = version; - cmd.command = command; - cmd.pid = pid ; - cmd.ptr_creds = usr != NULL ? 1 : 0; - cmd.cred = usr; - - prs_init(ps, 1024, NULL, MARSHALL); - - ps->data_offset = 4; - return creds_io_cmd("creds", &cmd, ps, 0); -} -- cgit From 186726b7f85f3e84c9ad900262da93471570498e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 15 Nov 2001 21:06:41 +0000 Subject: Tidyups and things I discovered during the merge... Jeremy. (This used to be commit 9c8439f25b90d80adcd7161bfed3664af6256940) --- source3/rpc_parse/parse_reg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 67d8d89b01..181a385592 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -153,10 +153,10 @@ BOOL reg_io_r_open_hklm(char *desc, REG_R_OPEN_HKLM * r_r, prs_struct *ps, if (!prs_align(ps)) return False; - if (!smb_io_pol_hnd("", &(r_r->pol), ps, depth)) + if (!smb_io_pol_hnd("", &r_r->pol, ps, depth)) return False; - if (!prs_ntstatus("status", ps, depth, &(r_r->status))) + if (!prs_ntstatus("status", ps, depth, &r_r->status)) return False; return True; @@ -1618,7 +1618,7 @@ BOOL reg_io_r_shutdown(char *desc, REG_R_SHUTDOWN * r_s, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &(r_s->status))) + if(!prs_ntstatus("status", ps, depth, &r_s->status)) return False; return True; @@ -1673,7 +1673,7 @@ BOOL reg_io_r_abort_shutdown(char *desc, REG_R_ABORT_SHUTDOWN * r_s, if (!prs_align(ps)) return False; - if (!prs_ntstatus("status", ps, depth, &(r_s->status))) + if (!prs_ntstatus("status", ps, depth, &r_s->status)) return False; return True; -- cgit From 02eda2e251e6dcb6e0db5cd9c3cbcfa765f3d630 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 17 Nov 2001 03:19:17 +0000 Subject: Tidyups when I was doing the big merge... Jeremy. (This used to be commit 9148bb9eaa67de60c3b0b4709a9c05a840c20c66) --- source3/rpc_parse/parse_spoolss.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 5a13403fee..6404a83d51 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4711,7 +4711,8 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) int n = 0; char *src; - if (buf5==NULL) return False; + if (buf5==NULL) + return False; src = (char *)buf5->buffer; *ar = NULL; @@ -4720,8 +4721,10 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) rpcstr_pull(f, src, sizeof(f)-1, -1, 0); src = skip_unibuf(src, 2*buf5->buf_len - PTR_DIFF(src,buf5->buffer)); tar = (fstring *)Realloc(*ar, sizeof(fstring)*(n+2)); - if (!tar) return False; - else *ar = tar; + if (!tar) + return False; + else + *ar = tar; fstrcpy((*ar)[n], f); n++; } -- cgit From b03e162127c0420cb2a0e978433d2dd439b0231f Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Wed, 21 Nov 2001 23:25:30 +0000 Subject: samr_querydom_info level 1: found the meaning of the unknow fields. And discovered that our reply is short by 4 bytes since day 1 of this code. Added a decode function to rpcclient too. splitted the STRING2 fields filling while trying to understand the win9x userlist bug. (didn't fix the bug, but the reply looks closer to NT). J.F. (This used to be commit bfbe7f377e5fcb09e87bfc866196dfc51a8fe64d) --- source3/rpc_parse/parse_misc.c | 12 ++++++------ source3/rpc_parse/parse_net.c | 4 ++-- source3/rpc_parse/parse_prs.c | 4 ++-- source3/rpc_parse/parse_samr.c | 41 +++++++++++++++++++++++++++-------------- 4 files changed, 37 insertions(+), 24 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 5160a2778f..4507c29613 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -820,23 +820,23 @@ void copy_unistr2(UNISTR2 *str, const UNISTR2 *from) Creates a STRING2 structure. ********************************************************************/ -void init_string2(STRING2 *str, const char *buf, int len) +void init_string2(STRING2 *str, const char *buf, int max_len, int str_len) { int alloc_len = 0; /* set up string lengths. */ - str->str_max_len = len; + str->str_max_len = max_len; str->undoc = 0; - str->str_str_len = len; + str->str_str_len = str_len; /* store the string */ - if(len != 0) { - if (len < MAX_STRINGLEN) + if(str_len != 0) { + if (str_len < MAX_STRINGLEN) alloc_len = MAX_STRINGLEN; str->buffer = talloc_zero(get_talloc_ctx(), alloc_len); if (str->buffer == NULL) smb_panic("init_string2: malloc fail\n"); - memcpy(str->buffer, buf, len); + memcpy(str->buffer, buf, str_len); } } diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 3e7be9d4cf..e3f7ea5d9a 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1019,8 +1019,8 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, init_unistr2(&id->uni_user_name, user_name, len_user_name); init_unistr2(&id->uni_wksta_name, wksta_name, len_wksta_name); - init_string2(&id->nt_chal_resp, (const char *)nt_chal_resp, nt_chal_resp_len); - init_string2(&id->lm_chal_resp, (const char *)lm_chal_resp, lm_chal_resp_len); + 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); } diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 89b0db4609..f902210b7b 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -851,12 +851,12 @@ BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 * BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 *str) { int i; - char *q = prs_mem_get(ps, str->str_str_len); + char *q = prs_mem_get(ps, str->str_max_len); if (q == NULL) return False; if (UNMARSHALLING(ps)) { - str->buffer = (unsigned char *)prs_alloc_mem(ps,str->str_str_len); + str->buffer = (unsigned char *)prs_alloc_mem(ps,str->str_max_len); if (str->buffer == NULL) return False; } diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 3f489f0a2b..a7fb77d382 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -725,9 +725,18 @@ inits a structure. void init_unk_info1(SAM_UNK_INFO_1 * u_1) { - memset(u_1->padding, 0, sizeof(u_1->padding)); /* 12 bytes zeros */ - u_1->unknown_1 = 0x80000000; - u_1->unknown_2 = 0x00000000; + u_1->min_length_password = 0; + u_1->password_history = 0; + u_1->flag = 0; + + /* password never expire */ + u_1->expire.high = 0x80000000; + u_1->expire.low = 0; + + /* can change the password now */ + u_1->min_passwordage.high = 0; + u_1->min_passwordage.low = 0; + } /******************************************************************* @@ -743,12 +752,15 @@ static BOOL sam_io_unk_info1(char *desc, SAM_UNK_INFO_1 * u_1, prs_debug(ps, depth, desc, "sam_io_unk_info1"); depth++; - if(!prs_uint8s(False, "padding", ps, depth, u_1->padding, sizeof(u_1->padding))) + if(!prs_uint16("min_length_password", ps, depth, &u_1->min_length_password)) return False; - - if(!prs_uint32("unknown_1", ps, depth, &u_1->unknown_1)) /* 0x8000 0000 */ + if(!prs_uint16("password_history", ps, depth, &u_1->password_history)) + return False; + if(!prs_uint32("flag", ps, depth, &u_1->flag)) return False; - if(!prs_uint32("unknown_2", ps, depth, &u_1->unknown_2)) /* 0x0000 0000 */ + 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; @@ -1122,8 +1134,7 @@ static void init_sam_entry4(SAM_ENTRY4 * sam, uint32 user_idx, DEBUG(5, ("init_sam_entry4\n")); sam->user_idx = user_idx; - init_str_hdr(&sam->hdr_acct_name, len_acct_name, len_acct_name, - len_acct_name != 0); + init_str_hdr(&sam->hdr_acct_name, len_acct_name+1, len_acct_name, len_acct_name != 0); } /******************************************************************* @@ -1779,7 +1790,7 @@ NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 *num_e init_sam_entry4(&sam->sam[i], start_idx + i + 1, len_sam_name); unistr2_to_ascii(sam_name, &pass[i].uni_user_name, sizeof(sam_name)); - init_string2(&sam->str[i].acct_name, sam_name, len_sam_name); + init_string2(&sam->str[i].acct_name, sam_name, len_sam_name+1, len_sam_name); dsize += sizeof(SAM_ENTRY4); dsize += len_sam_name; @@ -1836,8 +1847,6 @@ static BOOL sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 * sam, if(!smb_io_string2("acct_name", &sam->str[i].acct_name, sam->sam[i].hdr_acct_name.buffer, ps, depth)) return False; - if(!prs_align(ps)) - return False; } return True; @@ -1879,7 +1888,7 @@ NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 *num_e len_sam_name = strlen(grp[i].name); init_sam_entry5(&sam->sam[i], start_idx + i + 1, len_sam_name); - init_string2(&sam->str[i].grp_name, grp[i].name, len_sam_name); + init_string2(&sam->str[i].grp_name, grp[i].name, len_sam_name+1, len_sam_name); dsize += sizeof(SAM_ENTRY5); dsize += len_sam_name; @@ -1954,7 +1963,11 @@ void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO * r_u, { DEBUG(5, ("init_samr_r_query_dispinfo: level %d\n", switch_level)); - r_u->total_size = data_size; /* not calculated */ + if (switch_level==4) + r_u->total_size = 0; /* not calculated */ + else + r_u->total_size = data_size; /* not calculated */ + r_u->data_size = data_size; r_u->switch_level = switch_level; -- cgit From 116740a5df6294b0a4e244f575108ded87452c18 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 22 Nov 2001 05:56:09 +0000 Subject: merge from 2.2 (This used to be commit 96b3a65a73d403a41bf1b3aba79bd743698344ac) --- source3/rpc_parse/parse_spoolss.c | 219 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 208 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 6404a83d51..b628fa9913 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3209,6 +3209,26 @@ uint32 spoolss_size_printprocdatatype_info_1(PRINTPROCDATATYPE_1 *info) return size; } +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ +uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p) +{ + uint32 size = 0; + uint32 data_len; + + if (!p) + return 0; + + /* uint32(offset) + uint32(length) + length) */ + size += (size_of_uint32(&p->value_len)*2) + p->value_len; + size += (size_of_uint32(&p->data_len)*2) + p->data_len; + + size += size_of_uint32(&p->type); + + return size; +} + /******************************************************************* return the size required by a struct in the stream ********************************************************************/ @@ -4729,10 +4749,13 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) n++; } fstrcpy((*ar)[n], ""); - + return True; } + + + /******************************************************************* read a UNICODE array with null terminated strings and null terminated array @@ -6171,7 +6194,6 @@ BOOL spoolss_io_r_getprinterdataex(char *desc, SPOOL_R_GETPRINTERDATAEX *r_u, pr /******************************************************************* * read a structure. - * called from spoolss_q_setprinterdataex (srv_spoolss.c) ********************************************************************/ BOOL spoolss_io_q_setprinterdataex(char *desc, SPOOL_Q_SETPRINTERDATAEX *q_u, prs_struct *ps, int depth) @@ -6207,14 +6229,14 @@ BOOL spoolss_io_q_setprinterdataex(char *desc, SPOOL_Q_SETPRINTERDATAEX *q_u, pr case 0x3: case 0x4: case 0x7: - if (q_u->max_len) { - if (UNMARSHALLING(ps)) - q_u->data=(uint8 *)prs_alloc_mem(ps, q_u->max_len * sizeof(uint8)); - if(q_u->data == NULL) - return False; - if(!prs_uint8s(False,"data", ps, depth, q_u->data, q_u->max_len)) - return False; - } + if (q_u->max_len) { + if (UNMARSHALLING(ps)) + q_u->data=(uint8 *)prs_alloc_mem(ps, q_u->max_len * sizeof(uint8)); + if(q_u->data == NULL) + return False; + if(!prs_uint8s(False,"data", ps, depth, q_u->data, q_u->max_len)) + return False; + } if(!prs_align(ps)) return False; break; @@ -6228,7 +6250,6 @@ BOOL spoolss_io_q_setprinterdataex(char *desc, SPOOL_Q_SETPRINTERDATAEX *q_u, pr /******************************************************************* * write a structure. - * called from spoolss_q_setprinterdataex (srv_spoolss.c) ********************************************************************/ BOOL spoolss_io_r_setprinterdataex(char *desc, SPOOL_R_SETPRINTERDATAEX *r_u, prs_struct *ps, int depth) @@ -6243,3 +6264,179 @@ BOOL spoolss_io_r_setprinterdataex(char *desc, SPOOL_R_SETPRINTERDATAEX *r_u, pr return True; } + + +/******************************************************************* + * read a structure. + ********************************************************************/ + +BOOL spoolss_io_q_enumprinterkey(char *desc, SPOOL_Q_ENUMPRINTERKEY *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterkey"); + depth++; + + if(!prs_align(ps)) + return False; + if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) + return False; + + if(!smb_io_unistr2("", &q_u->key, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("size", ps, depth, &q_u->size)) + return False; + + return True; +} + +/******************************************************************* + * write a structure. + ********************************************************************/ + +BOOL spoolss_io_r_enumprinterkey(char *desc, SPOOL_R_ENUMPRINTERKEY *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterkey"); + depth++; + + if(!prs_align(ps)) + return False; + + if (!smb_io_buffer5("", &r_u->keys, ps, depth)) + 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; +} + + +/******************************************************************* + * read a structure. + ********************************************************************/ + +BOOL spoolss_io_q_enumprinterdataex(char *desc, SPOOL_Q_ENUMPRINTERDATAEX *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdataex"); + depth++; + + if(!prs_align(ps)) + return False; + if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) + return False; + + if(!smb_io_unistr2("", &q_u->key, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("size", ps, depth, &q_u->size)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ +static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, + PRINTER_ENUM_VALUES_CTR *ctr, int depth) +{ + int i; + uint32 valuename_offset, + data_offset, + current_offset; + + prs_debug(ps, depth, desc, "spoolss_io_printer_enum_values_ctr"); + depth++; + + if (!prs_uint32("size", ps, depth, &ctr->size)) + return False; + + /* offset data begins at 20 bytes per structure * size_of_array. + Don't forget the uint32 at the beginning */ + + current_offset = 4 + (20*ctr->size_of_array); + + /* first loop to write basic enum_value information */ + + for (i=0; isize_of_array; i++) + { + valuename_offset = current_offset; + if (!prs_uint32("valuename_offset", ps, depth, &valuename_offset)) + return False; + + if (!prs_uint32("value_len", ps, depth, &ctr->values[i].value_len)) + return False; + + if (!prs_uint32("type", ps, depth, &ctr->values[i].type)) + return False; + + data_offset = ctr->values[i].value_len + valuename_offset; + if (!prs_uint32("data_offset", ps, depth, &data_offset)) + return False; + + if (!prs_uint32("data_len", ps, depth, &ctr->values[i].data_len)) + return False; + + current_offset = data_offset + ctr->values[i].data_len; + + } + + /* loop #2 for writing the dynamically size objects + while viewing oncversations between Win2k -> Win2k, + 4-byte alignment does not seem to matter here --jerrty */ + + for (i=0; isize_of_array; i++) + { + + if (!prs_unistr("valuename", ps, depth, &ctr->values[i].valuename)) + return False; + + if (!prs_uint8s(False, "data", ps, depth, ctr->values[i].data, ctr->values[i].data_len)) + return False; + } + + + + return True; +} + + +/******************************************************************* + * write a structure. + ********************************************************************/ + +BOOL spoolss_io_r_enumprinterdataex(char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdataex"); + depth++; + + if(!prs_align(ps)) + return False; + + if (!spoolss_io_printer_enum_values_ctr("", ps, &r_u->ctr, depth )) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("needed", ps, depth, &r_u->needed)) + return False; + + if(!prs_uint32("returned", ps, depth, &r_u->returned)) + return False; + + if(!prs_werror("status", ps, depth, &r_u->status)) + return False; + + return True; +} + + -- cgit From 59b2e772e254aa567b18309e578ea9af6b1ab1e4 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 22 Nov 2001 06:44:05 +0000 Subject: remove unused variables (This used to be commit 90ed3d47e16a511161532f75b98db3f4b10ba685) --- source3/rpc_parse/parse_spoolss.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b628fa9913..76214c13f1 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3215,7 +3215,6 @@ return the size required by a struct in the stream uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p) { uint32 size = 0; - uint32 data_len; if (!p) return 0; -- cgit From 2e8ae887857249822b84461fd503105555873508 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Thu, 22 Nov 2001 16:12:43 +0000 Subject: add a command to rpcclient: enumprivs J.F. (This used to be commit fa63cb78e326040f68d858d593ba98e06c26c92e) --- source3/rpc_parse/parse_lsa.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index f69f3ebdef..34feac32a7 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -246,11 +246,14 @@ static BOOL lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, if(!prs_uint32("ptr_sec_qos ", ps, depth, &attr->ptr_sec_qos )) /* security quality of service (pointer) */ return False; + /* code commented out as it's not necessary true (tested with hyena). JFM, 11/22/2001 */ +#if 0 if (attr->len != prs_offset(ps) - start) { DEBUG(3,("lsa_io_obj_attr: length %x does not match size %x\n", attr->len, prs_offset(ps) - start)); return False; } +#endif if (attr->ptr_sec_qos != 0 && attr->sec_qos != NULL) { if(!lsa_io_sec_qos("sec_qos", attr->sec_qos, ps, depth)) @@ -1280,6 +1283,20 @@ BOOL lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_c, prs_struct *ps, in return True; } +/******************************************************************* + Inits an LSA_Q_ENUM_PRIVS structure. +********************************************************************/ + +void init_q_enum_privs(LSA_Q_ENUM_PRIVS *q_q, POLICY_HND *hnd, uint32 enum_context, uint32 pref_max_length) +{ + DEBUG(5, ("init_q_enum_privs\n")); + + memcpy(&q_q->pol, hnd, sizeof(q_q->pol)); + + q_q->enum_context = enum_context; + q_q->pref_max_length = pref_max_length; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -1382,6 +1399,10 @@ BOOL lsa_io_r_enum_privs(char *desc, LSA_R_ENUM_PRIVS *r_q, prs_struct *ps, int if(!prs_uint32("count1", ps, depth, &r_q->count1)) return False; + if (UNMARSHALLING(ps)) + if (!(r_q->privs = (LSA_PRIV_ENTRY *)prs_alloc_mem(ps, sizeof(LSA_PRIV_ENTRY) * r_q->count1))) + return False; + if (!lsa_io_priv_entries("", r_q->privs, r_q->count1, ps, depth)) return False; } -- cgit From 33e20222e03482b20224b0b077beefb4079baa34 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Thu, 22 Nov 2001 16:54:48 +0000 Subject: add another command to rpcclient: getdispname. Show the full description of a privilege. J.F. (This used to be commit 84035ae72f422edadd9fa7e493c3d8176bb6a53d) --- source3/rpc_parse/parse_lsa.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 34feac32a7..767eb5ef19 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1416,6 +1416,21 @@ BOOL lsa_io_r_enum_privs(char *desc, LSA_R_ENUM_PRIVS *r_q, prs_struct *ps, int return True; } +void init_lsa_priv_get_dispname(LSA_Q_PRIV_GET_DISPNAME *trn, POLICY_HND *hnd, char *name, uint16 lang_id, uint16 lang_id_sys) +{ + int len_name = strlen(name); + + if(len_name == 0) + len_name = 1; + + memcpy(&trn->pol, hnd, sizeof(trn->pol)); + + init_uni_hdr(&trn->hdr_name, len_name); + init_unistr2(&trn->name, name, len_name); + trn->lang_id = lang_id; + trn->lang_id_sys = lang_id_sys; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ -- cgit From fbfd27a495afa8673d472957867e58b34499760e Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Thu, 22 Nov 2001 23:50:16 +0000 Subject: added lsa_enum_sids to rpcclient fixed lsa_enum_rpivs server code. This time it works as W2K. fixed smbgroupedit to compile and work. J.F. (This used to be commit 646651018a2736833e49e76f6ca735a4647d9746) --- source3/rpc_parse/parse_lsa.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 767eb5ef19..6d5332794f 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1501,6 +1501,14 @@ BOOL lsa_io_r_priv_get_dispname(char *desc, LSA_R_PRIV_GET_DISPNAME *r_q, prs_st return True; } +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. ********************************************************************/ -- cgit From 2527f5ef52400294c98b4f4345a4f18b981ff22f Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Fri, 23 Nov 2001 15:11:22 +0000 Subject: Changed how the privileges are stored in the group mapping code. It's now an array of uint32. That's not perfect but that's better. Added more privileges too. Changed the local_lookup_rid/name functions in passdb.c to check if the group is mapped. Makes the LSA rpc calls return correct groups Corrected the return code in the LSA server code enum_sids. Only enumerate well known aliases if they are mapped to real unix groups. Won't confuse user seeing groups not available. Added a short/long view to smbgroupedit. now decoding rpc calls to add/remove privileges to sid. J.F. (This used to be commit f29774e58973f421bfa163c45bfae201a140f28c) --- source3/rpc_parse/parse_lsa.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 6d5332794f..10a9efbe49 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -854,6 +854,15 @@ static BOOL lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, 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; -- cgit From ca477a61e7a202ba7df756780149a14c1159a73f Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Sat, 24 Nov 2001 00:13:41 +0000 Subject: added lsaenumprivsaccount and lsalookupprivvalue to rpcclient and more to come ... J.F. (This used to be commit 1748d5a2af1f2dcf718d6f162ed483b001542494) --- source3/rpc_parse/parse_lsa.c | 77 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 10a9efbe49..d7ef923be9 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1660,6 +1660,14 @@ BOOL lsa_io_r_unk_get_connuser(char *desc, LSA_R_UNK_GET_CONNUSER *r_c, prs_stru return True; } +void init_lsa_q_open_account(LSA_Q_OPENACCOUNT *trn, POLICY_HND *hnd, DOM_SID *sid, uint32 access) +{ + memcpy(&trn->pol, hnd, sizeof(trn->pol)); + + init_dom_sid2(&trn->sid, sid); + trn->access = access; +} + /******************************************************************* Reads or writes an LSA_Q_OPENACCOUNT structure. ********************************************************************/ @@ -1675,7 +1683,7 @@ BOOL lsa_io_q_open_account(char *desc, LSA_Q_OPENACCOUNT *r_c, prs_struct *ps, i if(!smb_io_pol_hnd("pol", &r_c->pol, ps, depth)) return False; - if(!smb_io_dom_sid2("", &r_c->sid, ps, depth)) /* domain SID */ + if(!smb_io_dom_sid2("sid", &r_c->sid, ps, depth)) /* domain SID */ return False; if(!prs_uint32("access", ps, depth, &r_c->access)) @@ -1706,6 +1714,12 @@ BOOL lsa_io_r_open_account(char *desc, LSA_R_OPENACCOUNT *r_c, prs_struct *ps, } +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. ********************************************************************/ @@ -1822,6 +1836,12 @@ BOOL lsa_io_r_enum_privsaccount(char *desc, LSA_R_ENUMPRIVSACCOUNT *r_c, prs_str return False; /* malloc memory if unmarshalling here */ + + if (UNMARSHALLING(ps) && r_c->count!=0) { + if (!(r_c->set.set = (LUID_ATTR *)prs_alloc_mem(ps,sizeof(LUID_ATTR) * r_c->count))) + return False; + + } if(!lsa_io_privilege_set(desc, &r_c->set, ps, depth)) return False; @@ -1873,3 +1893,58 @@ BOOL lsa_io_r_getsystemaccount(char *desc, LSA_R_GETSYSTEMACCOUNT *r_c, prs_str return True; } + +void init_lsa_q_lookupprivvalue(LSA_Q_LOOKUPPRIVVALUE *trn, POLICY_HND *hnd, char *name) +{ + int len_name = strlen(name); + memcpy(&trn->pol, hnd, sizeof(trn->pol)); + + if(len_name == 0) + len_name = 1; + + init_uni_hdr(&trn->hdr_right, len_name); + init_unistr2(&trn->uni2_right, name, len_name); +} + +/******************************************************************* + Reads or writes an LSA_Q_LOOKUPPRIVVALUE structure. +********************************************************************/ + +BOOL lsa_io_q_lookupprivvalue(char *desc, LSA_Q_LOOKUPPRIVVALUE *r_c, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_q_lookupprivvalue"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("pol", &r_c->pol, ps, depth)) + return False; + if(!smb_io_unihdr ("hdr_name", &r_c->hdr_right, ps, depth)) + return False; + if(!smb_io_unistr2("uni2_right", &r_c->uni2_right, r_c->hdr_right.buffer, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes an LSA_R_LOOKUPPRIVVALUE structure. +********************************************************************/ + +BOOL lsa_io_r_lookupprivvalue(char *desc, LSA_R_LOOKUPPRIVVALUE *r_c, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_r_lookupprivvalue"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!lsa_io_luid("luid", &r_c->luid, ps, depth)) + return False; + + if(!prs_ntstatus("status", ps, depth, &r_c->status)) + return False; + + return True; +} -- cgit From b47f6a444879eb290c2ff36456a8d782e5680553 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 25 Nov 2001 02:08:43 +0000 Subject: Fix ./configure --enable-developer warnings (shadow of global) (This used to be commit 3f1cfb62e85343a45817651f111f01051fc66b18) --- source3/rpc_parse/parse_lsa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index d7ef923be9..b5f51de697 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1660,12 +1660,12 @@ BOOL lsa_io_r_unk_get_connuser(char *desc, LSA_R_UNK_GET_CONNUSER *r_c, prs_stru return True; } -void init_lsa_q_open_account(LSA_Q_OPENACCOUNT *trn, POLICY_HND *hnd, DOM_SID *sid, uint32 access) +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 = access; + trn->access = desired_access; } /******************************************************************* -- cgit From e158c4123d6d47cc43472365f5e6215a0851e001 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Wed, 28 Nov 2001 00:06:00 +0000 Subject: added samr_set_domain_info and samr_unknown_2E. We now get the full account policy window in usermanager, and the framework to store all those values. I plan to add a TDB file to store them. oh, and found that the last value in a sam_unknown_info_12_inf struct is an uint16 and not a uint32. andrewb: you hardcoded the MAX_PASSWORD_AGE to 21 days. We can now turn it to a value setable in usermanager. J.F. (This used to be commit 99471d25693f6672d433b90a060378f6faad867f) --- source3/rpc_parse/parse_samr.c | 271 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 259 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a7fb77d382..99c0fe30be 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -556,12 +556,12 @@ inits a structure. void init_unk_info12(SAM_UNK_INFO_12 * u_12) { - u_12->unknown_0 = 0xcf1dcc00; - u_12->unknown_1 = 0xfffffffb; - u_12->unknown_2 = 0xcf1dcc00; - u_12->unknown_3 = 0xfffffffb; + u_12->duration.low = 0xcf1dcc00; + u_12->duration.high = 0xfffffffb; + u_12->reset_count.low = 0xcf1dcc00; + u_12->reset_count.high = 0xfffffffb; - u_12->unknown_4 = 0x8a880000; + u_12->bad_attempt_lockout = 0x0000; } /******************************************************************* @@ -577,15 +577,11 @@ static BOOL sam_io_unk_info12(char *desc, SAM_UNK_INFO_12 * u_12, prs_debug(ps, depth, desc, "sam_io_unk_info12"); depth++; - if(!prs_uint32("unknown_0", ps, depth, &u_12->unknown_0)) + if(!smb_io_time("duration", &u_12->duration, ps, depth)) return False; - if(!prs_uint32("unknown_1", ps, depth, &u_12->unknown_1)) + if(!smb_io_time("reset_count", &u_12->reset_count, ps, depth)) return False; - if(!prs_uint32("unknown_2", ps, depth, &u_12->unknown_2)) - return False; - if(!prs_uint32("unknown_3", ps, depth, &u_12->unknown_3)) - return False; - if(!prs_uint32("unknown_4", ps, depth, &u_12->unknown_4)) + if(!prs_uint16("bad_attempt_lockout", ps, depth, &u_12->bad_attempt_lockout)) return False; return True; @@ -6864,3 +6860,254 @@ BOOL samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER * r_u, return True; } + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +void init_samr_q_unknown_2e(SAMR_Q_UNKNOWN_2E *q_u, + POLICY_HND *domain_pol, uint16 switch_value) +{ + DEBUG(5, ("init_samr_q_unknown_2e\n")); + + q_u->domain_pol = *domain_pol; + q_u->switch_value = switch_value; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_q_unknown_2e(char *desc, SAMR_Q_UNKNOWN_2E *q_u, + prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_q_unknown_2e"); + 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_samr_unknown_2e(SAMR_R_UNKNOWN_2E * r_u, + uint16 switch_value, SAM_UNK_CTR * ctr, + NTSTATUS status) +{ + DEBUG(5, ("init_samr_r_samr_unknown_2e\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_samr_unknown_2e(char *desc, SAMR_R_UNKNOWN_2E * 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_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 0x0c: + if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, 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 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_samr_unknown_2e: 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(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 ((q_u->ctr = (SAM_UNK_CTR *)prs_alloc_mem(ps, sizeof(SAM_UNK_CTR))) == 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(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; +} -- cgit From 3a193f1597741fb630c50290101daf8231337298 Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Wed, 28 Nov 2001 19:49:43 +0000 Subject: add .po32 files to ignore list (This used to be commit 5f625f2877fc5132be3030fc6ea9df4d59ecff05) --- source3/rpc_parse/.cvsignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/.cvsignore b/source3/rpc_parse/.cvsignore index ad4b35d213..5f2a5c4cf7 100644 --- a/source3/rpc_parse/.cvsignore +++ b/source3/rpc_parse/.cvsignore @@ -1 +1,2 @@ -*.po \ No newline at end of file +*.po +*.po32 -- cgit From bd8e916cb520d89a14a1cd13b2b261253729ac9b Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 28 Nov 2001 21:51:11 +0000 Subject: merge from APPLIANCE_HEAD (This used to be commit c60aa6c06f376684b6d6d9a2c14305ca9f4657ef) --- source3/rpc_parse/parse_spoolss.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 76214c13f1..a376b19c98 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4922,13 +4922,7 @@ BOOL make_spoolss_driver_info_3( /******************************************************************* make a BUFFER5 struct from a uint16* ******************************************************************/ - -BOOL make_spoolss_buffer5( - TALLOC_CTX *mem_ctx, - BUFFER5 *buf5, - uint32 len, - uint16 *src -) +BOOL make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src) { buf5->buf_len = len; -- cgit From fac01bda8bb4f52b930496c362f55aca5b112240 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Thu, 29 Nov 2001 16:05:05 +0000 Subject: Changed again how the privilege list is handled in the group mapping code. This time it's a PRIVILEGE_SET struct instead of a simple uint32 array. It makes much more sense. Also added a uint32 systemaccount to the GROUP_MAP struct as some privilege showing in USRMGR.EXE are not real privs but a bitmask flag. I guess it's an heritage from NT 3.0 ! I could setup an NT 3.1 box to verify, but I'm too lazy (yes I still have my CDs). Added 3 more LSA calls: SetSystemAccount, AddPrivileges and RemovePrivileges, we can manage all this privilege from UserManager. Time to change the NT_USER_TOKEN struct and add checks in all the rpc functions. Fun, fun, fun. J.F. (This used to be commit 3f0a9ef2b8c626cfa2878394bb7b642342342bf3) --- source3/rpc_parse/parse_lsa.c | 152 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index b5f51de697..90fa8d8fff 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1814,6 +1814,7 @@ void init_lsa_r_enum_privsaccount(LSA_R_ENUMPRIVSACCOUNT *r_u, LUID_ATTR *set, u r_u->set.set=set; r_u->set.count=count; r_u->set.control=control; + DEBUG(10,("init_lsa_r_enum_privsaccount: %d %d privileges\n", r_u->count, r_u->set.count)); } /******************************************************************* @@ -1894,6 +1895,47 @@ BOOL lsa_io_r_getsystemaccount(char *desc, LSA_R_GETSYSTEMACCOUNT *r_c, prs_str return True; } + +/******************************************************************* + Reads or writes an LSA_Q_SETSYSTEMACCOUNT structure. +********************************************************************/ + +BOOL lsa_io_q_setsystemaccount(char *desc, LSA_Q_SETSYSTEMACCOUNT *r_c, 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", &r_c->pol, ps, depth)) + return False; + + if(!prs_uint32("access", ps, depth, &r_c->access)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes an LSA_R_SETSYSTEMACCOUNT structure. +********************************************************************/ + +BOOL lsa_io_r_setsystemaccount(char *desc, LSA_R_SETSYSTEMACCOUNT *r_c, 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, &r_c->status)) + return False; + + return True; +} + + void init_lsa_q_lookupprivvalue(LSA_Q_LOOKUPPRIVVALUE *trn, POLICY_HND *hnd, char *name) { int len_name = strlen(name); @@ -1948,3 +1990,113 @@ BOOL lsa_io_r_lookupprivvalue(char *desc, LSA_R_LOOKUPPRIVVALUE *r_c, prs_struc return True; } + + +/******************************************************************* + Reads or writes an LSA_Q_ADDPRIVS structure. +********************************************************************/ + +BOOL lsa_io_q_addprivs(char *desc, LSA_Q_ADDPRIVS *r_c, 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", &r_c->pol, ps, depth)) + return False; + + if(!prs_uint32("count", ps, depth, &r_c->count)) + return False; + + if (UNMARSHALLING(ps) && r_c->count!=0) { + if (!(r_c->set.set = (LUID_ATTR *)prs_alloc_mem(ps,sizeof(LUID_ATTR) * r_c->count))) + return False; + } + + if(!lsa_io_privilege_set(desc, &r_c->set, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes an LSA_R_ADDPRIVS structure. +********************************************************************/ + +BOOL lsa_io_r_addprivs(char *desc, LSA_R_ADDPRIVS *r_c, 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, &r_c->status)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes an LSA_Q_REMOVEPRIVS structure. +********************************************************************/ + +BOOL lsa_io_q_removeprivs(char *desc, LSA_Q_REMOVEPRIVS *r_c, 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", &r_c->pol, ps, depth)) + return False; + + if(!prs_uint32("allrights", ps, depth, &r_c->allrights)) + return False; + + if(!prs_uint32("ptr", ps, depth, &r_c->ptr)) + return False; + + /* + * JFM: I'm not sure at all if the count is inside the ptr + * never seen one with ptr=0 + */ + + if (r_c->ptr!=0) { + if(!prs_uint32("count", ps, depth, &r_c->count)) + return False; + + if (UNMARSHALLING(ps) && r_c->count!=0) { + if (!(r_c->set.set = (LUID_ATTR *)prs_alloc_mem(ps,sizeof(LUID_ATTR) * r_c->count))) + return False; + } + + if(!lsa_io_privilege_set(desc, &r_c->set, ps, depth)) + return False; + } + + return True; +} + +/******************************************************************* + Reads or writes an LSA_R_REMOVEPRIVS structure. +********************************************************************/ + +BOOL lsa_io_r_removeprivs(char *desc, LSA_R_REMOVEPRIVS *r_c, 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, &r_c->status)) + return False; + + return True; +} + + -- cgit From 6d9adfe73c04132ff162d05b0c309395c4a54485 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 30 Nov 2001 01:04:15 +0000 Subject: Renamed sid field in SEC_ACE to trustee to be more in line with MS's definitions. (This used to be commit 9712d3f15a47155f558d0034ef71fd06afb11301) --- source3/rpc_parse/parse_sec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 98f076c1e3..0e6f9e2879 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -68,8 +68,8 @@ void init_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 f t->size = sid_size(sid) + 8; t->info = mask; - ZERO_STRUCTP(&t->sid); - sid_copy(&t->sid, sid); + ZERO_STRUCTP(&t->trustee); + sid_copy(&t->trustee, sid); } /******************************************************************* @@ -107,7 +107,7 @@ BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth) if(!prs_align(ps)) return False; - if(!smb_io_dom_sid("sid ", &psa->sid , ps, depth)) + if(!smb_io_dom_sid("trustee ", &psa->trustee , ps, depth)) return False; if(!prs_uint16_post("size ", ps, depth, &psa->size, offset_ace_size, old_offset)) @@ -281,7 +281,7 @@ BOOL sec_ace_equal(SEC_ACE *s1, SEC_ACE *s2) /* Check SID */ - if (!sid_equal(&s1->sid, &s2->sid)) { + if (!sid_equal(&s1->trustee, &s2->trustee)) { return False; } -- cgit From b6b84cf7099c3b2cee777cf9514b3e6665a4025f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 3 Dec 2001 08:16:51 +0000 Subject: const religion (This used to be commit 359ca8f246c46b1700418fe0226458023f808d67) --- source3/rpc_parse/parse_lsa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 90fa8d8fff..6aa696369a 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1052,7 +1052,7 @@ makes a structure. ********************************************************************/ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, - POLICY_HND *hnd, int num_names, char **names) + POLICY_HND *hnd, int num_names, const char **names) { int i; @@ -1078,7 +1078,7 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, } for (i = 0; i < num_names; i++) { - char* name = names[i]; + const char *name = names[i]; int len = strlen(name); init_uni_hdr(&q_l->hdr_name[i], len); -- cgit From cdf9b42754b7e97faa7fc4eb1ec69e32c0bfd1a0 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 3 Dec 2001 17:14:23 +0000 Subject: added a tdb to store the account policy informations. You can change them with either usermanager->policies->account or from a command prompt on NT/W2K: net accounts /domain we can add a rpc accounts to the net command. As the net_rpc.c is still empty, I did not start. How should I add command to it ? Should I take the rpcclient/cmd_xxx functions and call them from there ? alse changed the SAM_UNK_INFO_3 parser, it's an NTTIME. This one is more for jeremy ;-) J.F. (This used to be commit bc28a8eebd9245ce3004ae4b1a359db51f77bf21) --- source3/rpc_parse/parse_samr.c | 50 +++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 22 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 99c0fe30be..dfc58839e5 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -345,8 +345,15 @@ void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO *r_u, NTSTATUS statu DEBUG(5, ("init_samr_r_get_usrdom_pwinfo\n")); r_u->unknown_0 = 0x0000; - r_u->unknown_1 = 0x0015; - r_u->unknown_2 = 0x00000000; + + /* + * used to be + * r_u->unknown_1 = 0x0015; + * but for trusts. + */ + r_u->unknown_1 = 0x01D1; + + r_u->unknown_2 = 0x00000000; r_u->status = status; } @@ -461,10 +468,10 @@ BOOL samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO * q_u, inits a structure. ********************************************************************/ -void init_unk_info3(SAM_UNK_INFO_3 * u_3) +void init_unk_info3(SAM_UNK_INFO_3 *u_3, NTTIME nt_logout) { - u_3->unknown_0 = 0x00000000; - u_3->unknown_1 = 0x80000000; + u_3->logout.low = nt_logout.low; + u_3->logout.high = nt_logout.high; } /******************************************************************* @@ -480,9 +487,7 @@ static BOOL sam_io_unk_info3(char *desc, SAM_UNK_INFO_3 * u_3, prs_debug(ps, depth, desc, "sam_io_unk_info3"); depth++; - if(!prs_uint32("unknown_0", ps, depth, &u_3->unknown_0)) /* 0x0000 0000 */ - return False; - if(!prs_uint32("unknown_1", ps, depth, &u_3->unknown_1)) /* 0x8000 0000 */ + if(!smb_io_time("logout", &u_3->logout, ps, depth)) return False; return True; @@ -554,14 +559,14 @@ static BOOL sam_io_unk_info7(char *desc, SAM_UNK_INFO_7 * u_7, inits a structure. ********************************************************************/ -void init_unk_info12(SAM_UNK_INFO_12 * u_12) +void init_unk_info12(SAM_UNK_INFO_12 * u_12, NTTIME nt_lock_duration, NTTIME nt_reset_time, uint16 lockout) { - u_12->duration.low = 0xcf1dcc00; - u_12->duration.high = 0xfffffffb; - u_12->reset_count.low = 0xcf1dcc00; - u_12->reset_count.high = 0xfffffffb; + u_12->duration.low = nt_lock_duration.low; + u_12->duration.high = nt_lock_duration.high; + u_12->reset_count.low = nt_reset_time.low; + u_12->reset_count.high = nt_reset_time.high; - u_12->bad_attempt_lockout = 0x0000; + u_12->bad_attempt_lockout = lockout; } /******************************************************************* @@ -719,19 +724,20 @@ static BOOL sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 * u_2, inits a structure. ********************************************************************/ -void init_unk_info1(SAM_UNK_INFO_1 * u_1) +void init_unk_info1(SAM_UNK_INFO_1 *u_1, uint16 min_pass_len, uint16 pass_hist, + uint32 flag, NTTIME nt_expire, NTTIME nt_min_age) { - u_1->min_length_password = 0; - u_1->password_history = 0; - u_1->flag = 0; + u_1->min_length_password = min_pass_len; + u_1->password_history = pass_hist; + u_1->flag = flag; /* password never expire */ - u_1->expire.high = 0x80000000; - u_1->expire.low = 0; + u_1->expire.high = nt_expire.high; + u_1->expire.low = nt_expire.low; /* can change the password now */ - u_1->min_passwordage.high = 0; - u_1->min_passwordage.low = 0; + u_1->min_passwordage.high = nt_min_age.high; + u_1->min_passwordage.low = nt_min_age.low; } -- cgit From d67041a532ae2ab6f52647f0fd218dfe10a841c1 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 5 Dec 2001 00:22:24 +0000 Subject: Const religion for some of the RPC code. (This used to be commit 64bf8f81c49744fc0653db655e457981f3bcbac2) --- source3/rpc_parse/parse_misc.c | 2 +- source3/rpc_parse/parse_samr.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 4507c29613..52e4b4b07c 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -293,7 +293,7 @@ void init_dom_sid(DOM_SID *sid, char *str_sid) Inits a DOM_SID2 structure. ********************************************************************/ -void init_dom_sid2(DOM_SID2 *sid2, DOM_SID *sid) +void init_dom_sid2(DOM_SID2 *sid2, const DOM_SID *sid) { sid2->sid = *sid; sid2->num_auths = sid2->sid.num_auths; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index dfc58839e5..6f47cd64e6 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -243,7 +243,7 @@ reads or writes a structure. void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN * q_u, POLICY_HND *pol, uint32 flags, - DOM_SID *sid) + const DOM_SID *sid) { DEBUG(5, ("samr_init_samr_q_open_domain\n")); @@ -4840,7 +4840,7 @@ reads or writes a structure. void init_samr_q_create_user(SAMR_Q_CREATE_USER * q_u, POLICY_HND *pol, - char *name, + const char *name, uint32 acb_info, uint32 access_mask) { int len_name; -- cgit From 8ba00d147bbdb705b411e182433632c81a036188 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 5 Dec 2001 11:00:26 +0000 Subject: OK. Smbpasswd -j is DEAD. This moves the rest of the functionality into the 'net rpc join' code. Futhermore, this moves that entire area over to the libsmb codebase, rather than the crufty old rpc_client stuff. I have also fixed up the smbpasswd -a -m bug in the process. We also have a new 'net rpc changetrustpw' that can be called from a cron-job to regularly change the trust account password, for sites that run winbind but not smbd. With a little more work, we can kill rpc_client from smbd entirly! (It is mostly the domain auth stuff - which I can rework - and the spoolss stuff that sombody else will need to look over). Andrew Bartlett (This used to be commit 575897e879fc175ba702adf245384033342c903d) --- source3/rpc_parse/parse_net.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index e3f7ea5d9a..5c8da80c01 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -743,10 +743,15 @@ BOOL net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth) Inits a NET_Q_SRV_PWSET. ********************************************************************/ -void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char *logon_srv, char *acct_name, - uint16 sec_chan, char *comp_name, DOM_CRED *cred, char nt_cypher[16]) +void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char *logon_srv, char *sess_key, char *acct_name, + uint16 sec_chan, char *comp_name, DOM_CRED *cred, char 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, sess_key, 1); init_clnt_info(&q_s->clnt_id, logon_srv, acct_name, sec_chan, comp_name, cred); -- cgit From e0066d2dd4d9a657d1fbcb474e66a304a64e2a31 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Thu, 6 Dec 2001 13:09:15 +0000 Subject: again an intrusive patch: - removed the ugly as hell sam_logon_in_ssb variable, I changed a bit the definition of standard_sub_basic() to cope with that. - removed the smb.conf: 'domain admin group' and 'domain guest group' parameters ! We're not playing anymore with the user's group RIDs ! - in get_domain_user_groups(), if the user's gid is a group, put it first in the group RID list. I just have to write an HOWTO now ;-) J.F. (This used to be commit fef52c4b96c987115fb1818c00c2352c67790e50) --- source3/rpc_parse/parse_net.c | 46 +++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 26 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 5c8da80c01..926c73f016 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1264,7 +1264,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam usr->user_rid = pdb_get_user_rid(sampw); usr->group_rid = pdb_get_group_rid(sampw); - usr->num_groups = num_groups+1; + usr->num_groups = num_groups; usr->buffer_groups = 1; /* indicates fill in groups, below, even if there are none */ usr->user_flgs = user_flgs; @@ -1293,20 +1293,14 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); - /* always have at least one group == the user's primary group */ - usr->num_groups2 = num_groups+1; + usr->num_groups2 = num_groups; - usr->gids = (DOM_GID *)talloc_zero(ctx,sizeof(DOM_GID) * (num_groups+1)); + usr->gids = (DOM_GID *)talloc_zero(ctx,sizeof(DOM_GID) * (num_groups)); if (usr->gids == NULL) return; - /* primary group **MUST** go first. NT4's winmsd.exe will give - "The Network statistics are currently not available. 9-5" - What the heck is this? -- jerry */ - usr->gids[0].g_rid = usr->group_rid; - usr->gids[0].attr = 0x07; for (i = 0; i < num_groups; i++) - usr->gids[i+1] = gids[i]; + usr->gids[i] = gids[i]; init_unistr2(&usr->uni_logon_srv, logon_srv, len_logon_srv); init_unistr2(&usr->uni_logon_dom, logon_dom, len_logon_dom); @@ -1358,17 +1352,17 @@ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, if(!smb_io_time("must change time", &usr->pass_must_change_time, ps, depth)) /* password must change time */ return False; - if(!smb_io_unihdr("unihdr", &usr->hdr_user_name, ps, depth)) /* username unicode string header */ + if(!smb_io_unihdr("hdr_user_name", &usr->hdr_user_name, ps, depth)) /* username unicode string header */ return False; - if(!smb_io_unihdr("unihdr", &usr->hdr_full_name, ps, depth)) /* user's full name unicode string header */ + 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("unihdr", &usr->hdr_logon_script, ps, depth)) /* logon script unicode string header */ + if(!smb_io_unihdr("hdr_logon_script", &usr->hdr_logon_script, ps, depth)) /* logon script unicode string header */ return False; - if(!smb_io_unihdr("unihdr", &usr->hdr_profile_path, ps, depth)) /* profile path unicode string header */ + if(!smb_io_unihdr("hdr_profile_path", &usr->hdr_profile_path, ps, depth)) /* profile path unicode string header */ return False; - if(!smb_io_unihdr("unihdr", &usr->hdr_home_dir, ps, depth)) /* home directory unicode string header */ + if(!smb_io_unihdr("hdr_home_dir", &usr->hdr_home_dir, ps, depth)) /* home directory unicode string header */ return False; - if(!smb_io_unihdr("unihdr", &usr->hdr_dir_drive, ps, depth)) /* home directory drive unicode string header */ + 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 */ @@ -1390,9 +1384,9 @@ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, if(!prs_uint8s(False, "user_sess_key", ps, depth, usr->user_sess_key, 16)) /* unused user session key */ return False; - if(!smb_io_unihdr("unihdr", &usr->hdr_logon_srv, ps, depth)) /* logon server unicode string header */ + if(!smb_io_unihdr("hdr_logon_srv", &usr->hdr_logon_srv, ps, depth)) /* logon server unicode string header */ return False; - if(!smb_io_unihdr("unihdr", &usr->hdr_logon_dom, ps, depth)) /* logon domain unicode string header */ + 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 */ @@ -1412,17 +1406,17 @@ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, } } - if(!smb_io_unistr2("unistr2", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */ + 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("unistr2", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth)) /* user's full name unicode string */ + 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("unistr2", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */ + 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("unistr2", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */ + 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("unistr2", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth)) /* home directory unicode string */ + 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("unistr2", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth)) /* home directory drive unicode string */ + 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)) @@ -1441,9 +1435,9 @@ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, return False; } - if(!smb_io_unistr2("unistr2", &usr->uni_logon_srv, usr->hdr_logon_srv.buffer, ps, depth)) /* logon server unicode string */ + 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("unistr2", &usr->uni_logon_dom, usr->hdr_logon_srv.buffer, ps, depth)) /* logon domain unicode string */ + if(!smb_io_unistr2("uni_logon_dom", &usr->uni_logon_dom, usr->hdr_logon_srv.buffer, ps, depth)) /* logon domain unicode string */ return False; if(!smb_io_dom_sid2("", &usr->dom_sid, ps, depth)) /* domain SID */ -- cgit From 4f53486d78102d8080293eeafd7b4ed701d81a2e Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 10 Dec 2001 05:03:17 +0000 Subject: Added client and server code for the GetPrintProcessorDirectory SPOOLSS rpc. This was supposed to fix a printer driver download bug but it didn't but it seemed a shame to trash all this code so I'm commiting it #ifdef'ed out in case someone needs it one day. (This used to be commit bef43656471741c6c10b12e7516c15de9ae76394) --- source3/rpc_parse/parse_spoolss.c | 141 +++++++++++++++++++++++++++++++++++++- 1 file changed, 139 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index a376b19c98..b4d6343946 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4,8 +4,9 @@ * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-2000, * Copyright (C) Luke Kenneth Casson Leighton 1996-2000, - * Copyright (C) Jean Franois Micouleau 1998-2000. - * Copyright (C) Gerald Carter 2000 + * Copyright (C) Jean Franois Micouleau 1998-2000, + * Copyright (C) Gerald Carter 2000, + * Copyright (C) Tim Potter 2001. * * 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 @@ -3171,6 +3172,21 @@ uint32 spoolss_size_driverdir_info_1(DRIVER_DIRECTORY_1 *info) return the size required by a struct in the stream ********************************************************************/ +uint32 spoolss_size_printprocessordirectory_info_1(PRINTPROCESSOR_DIRECTORY_1 *info) +{ + int size=0; + + size=str_len_uni(&info->name); /* the string length */ + size=size+1; /* add the leading zero */ + size=size*2; /* convert in char */ + + return size; +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ + uint32 spoolss_size_port_info_2(PORT_INFO_2 *info) { int size=0; @@ -6433,3 +6449,124 @@ BOOL spoolss_io_r_enumprinterdataex(char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, } +/******************************************************************* + * write a structure. + ********************************************************************/ + +/* + uint32 GetPrintProcessorDirectory( + [in] unistr2 *name, + [in] unistr2 *environment, + [in] uint32 level, + [in,out] NEW_BUFFER buffer, + [in] uint32 offered, + [out] uint32 needed, + [out] uint32 returned + ); + +*/ + +BOOL make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, const char *name, char *environment, int level, NEW_BUFFER *buffer, uint32 offered) +{ + DEBUG(5,("make_spoolss_q_getprintprocessordirectory\n")); + + init_unistr2(&q_u->name, name, strlen(name)+1); + init_unistr2(&q_u->environment, environment, strlen(environment)+1); + + q_u->level = level; + + q_u->buffer = buffer; + q_u->offered = offered; + + return True; +} + +BOOL spoolss_io_q_getprintprocessordirectory(char *desc, SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, prs_struct *ps, int depth) +{ + uint32 ptr; + + prs_debug(ps, depth, desc, "spoolss_io_q_getprintprocessordirectory"); + depth++; + + if(!prs_align(ps)) + return False; + + if (!prs_uint32("ptr", ps, depth, &ptr)) + return False; + + if (ptr) { + if(!smb_io_unistr2("name", &q_u->name, True, ps, depth)) + return False; + } + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("ptr", ps, depth, &ptr)) + return False; + + if (ptr) { + if(!smb_io_unistr2("environment", &q_u->environment, True, + ps, depth)) + return False; + } + + if (!prs_align(ps)) + return False; + + if(!prs_uint32("level", ps, depth, &q_u->level)) + return False; + + if(!spoolss_io_buffer("", ps, depth, &q_u->buffer)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("offered", ps, depth, &q_u->offered)) + return False; + + return True; +} + +/******************************************************************* + * write a structure. + ********************************************************************/ + +BOOL spoolss_io_r_getprintprocessordirectory(char *desc, SPOOL_R_GETPRINTPROCESSORDIRECTORY *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_getprintprocessordirectory"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!spoolss_io_buffer("", ps, depth, &r_u->buffer)) + return False; + + if(!prs_align(ps)) + 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 smb_io_printprocessordirectory_1(char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR_DIRECTORY_1 *info, int depth) +{ + prs_struct *ps=&buffer->prs; + + prs_debug(ps, depth, desc, "smb_io_printprocessordirectory_1"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if (!smb_io_unistr(desc, &info->name, ps, depth)) + return False; + + return True; +} -- cgit From 0ff1a9568b4bc0220cf90ea78f2657a92682307d Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 10 Dec 2001 15:03:16 +0000 Subject: added info level 3 to samrgetgroupinfo. I don't know what the value is. It's just to keep usermanager happy ;-) clean up a bit samr_query_aliasinfo to return the group description added: samr_del_aliasmem, samr_del_groupmem and samr_del_domuser with the correct scripts, you can now entirely manage the users from usermanager ! Closer to full PDC every day ;-) J.F. (This used to be commit 0a727afc669704cda9b44d44dbac9e989e906ae3) --- source3/rpc_parse/parse_samr.c | 50 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 6f47cd64e6..0c6bcdafb8 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -352,6 +352,7 @@ void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO *r_u, NTSTATUS statu * but for trusts. */ r_u->unknown_1 = 0x01D1; + r_u->unknown_1 = 0x0015; r_u->unknown_2 = 0x00000000; @@ -2198,6 +2199,38 @@ BOOL samr_io_group_info1(char *desc, GROUP_INFO1 * gr1, return True; } +/******************************************************************* +inits a GROUP_INFO3 structure. +********************************************************************/ + +void init_samr_group_info3(GROUP_INFO3 *gr3) +{ + DEBUG(5, ("init_samr_group_info3\n")); + + gr3->unknown_1 = 0x3; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_group_info3(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("unknown_1", ps, depth, &gr3->unknown_1)) + return False; + + return True; +} + /******************************************************************* inits a GROUP_INFO4 structure. ********************************************************************/ @@ -2255,18 +2288,18 @@ static BOOL samr_group_info_ctr(char *desc, GROUP_INFO_CTR **ctr, if(!prs_uint16("switch_value1", ps, depth, &(*ctr)->switch_value1)) return False; - if(!prs_uint16("switch_value2", ps, depth, &(*ctr)->switch_value2)) - return False; switch ((*ctr)->switch_value1) { case 1: - if(!samr_io_group_info1("group_info1", - &(*ctr)->group.info1, ps, depth)) + if(!samr_io_group_info1("group_info1", &(*ctr)->group.info1, 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)) + if(!samr_io_group_info4("group_info4", &(*ctr)->group.info4, ps, depth)) return False; break; default: @@ -2407,6 +2440,9 @@ BOOL samr_io_r_delete_dom_group(char *desc, SAMR_R_DELETE_DOM_GROUP * r_u, 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; @@ -4760,6 +4796,8 @@ BOOL samr_io_r_delete_dom_user(char *desc, SAMR_R_DELETE_DOM_USER * r_u, 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; -- cgit From c75d9409aaac374fa4a39470bcdd4c2f273dc656 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Wed, 12 Dec 2001 09:43:56 +0000 Subject: a ugly decoder for SAM_DELTA_DOM_INFO (0x0d) a correct decoder for SAM_PRIVS_INFO (0x10) this code is totally useless right now, it's just fun to decode those and will save tpot some time. J.F. (This used to be commit 314b675ed9ebacba9db25938c43cfa304462ebe2) --- source3/rpc_parse/parse_net.c | 242 +++++++++++++++++++++++++++++++++++------- 1 file changed, 203 insertions(+), 39 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 926c73f016..3062c5c073 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -2282,6 +2282,184 @@ static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO * info, return True; } +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL net_io_sam_dom_info(char *desc, SAM_DELTA_DOM *info, + prs_struct *ps, int depth) +{ + int i; + + prs_debug(ps, depth, desc, "net_io_sam_dom_info"); + depth++; + + if(!prs_align(ps)) + 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("unknown3", ps, depth, &info->unknown3)) + return False; + if (!prs_uint32("unknown4", ps, depth, &info->unknown4)) + return False; + if (!prs_uint32("count1", ps, depth, &info->count1)) + return False; + if (!prs_uint32("ptr1", ps, depth, &info->ptr1)) + return False; + + if (!prs_uint16("count2", ps, depth, &info->count2)) + return False; + if (!prs_uint16("count3", ps, depth, &info->count3)) + return False; + + if (!prs_uint32("ptr2", ps, depth, &info->ptr2)) + return False; + if (!prs_uint32("ptr3", ps, depth, &info->ptr3)) + return False; + + if (!prs_uint32("unknown4b", ps, depth, &info->unknown4b)) + return False; + if (!prs_uint32("unknown5", ps, depth, &info->unknown5)) + 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 (!prs_uint32("unknown9", ps, depth, &info->unknown9)) + return False; + if (!prs_uint32("unknown10", ps, depth, &info->unknown10)) + return False; + if (!prs_uint32("unknown11", ps, depth, &info->unknown11)) + return False; + if (!prs_uint32("unknown12", ps, depth, &info->unknown12)) + return False; + + if (!prs_uint32("unknown13", ps, depth, &info->unknown13)) + return False; + if (!prs_uint32("unknown14", ps, depth, &info->unknown14)) + return False; + if (!prs_uint32("unknown15", ps, depth, &info->unknown15)) + return False; + if (!prs_uint32("unknown16", ps, depth, &info->unknown16)) + return False; + if (!prs_uint32("unknown17", ps, depth, &info->unknown17)) + return False; + + for (i=0; icount2; i++) + if (!prs_uint32("unknown18", ps, depth, &info->unknown18)) + return False; + + if (!prs_uint32("unknown19", ps, depth, &info->unknown19)) + return False; + + for (i=0; icount1; i++) + if (!prs_uint32("unknown20", ps, depth, &info->unknown20)) + return False; + + if (!prs_uint32("ptr4", ps, depth, &info->ptr4)) + 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; + + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL net_io_sam_privs_info(char *desc, SAM_DELTA_PRIVS *info, + prs_struct *ps, int depth) +{ + int i; + + prs_debug(ps, depth, desc, "net_io_sam_privs_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(!prs_uint32("priv_count", ps, depth, &info->priv_count)) + return False; + if(!prs_uint32("reserved1", ps, depth, &info->reserved1)) + return False; + + if(!prs_uint32("ptr1", ps, depth, &info->ptr1)) + return False; + if(!prs_uint32("ptr2", ps, depth, &info->ptr2)) + 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("unknown3", ps, depth, &info->unknown3)) + return False; + if(!prs_uint32("unknown4", ps, depth, &info->unknown4)) + return False; + if(!prs_uint32("unknown5", ps, depth, &info->unknown5)) + 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(!prs_uint32("unknown9", ps, depth, &info->unknown9)) + 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("unknown10", ps, depth, &info->unknown10)) + return False; + + if(!prs_uint32("attribute_count", ps, depth, &info->attribute_count)) + return False; + + info->attributes = talloc(ps->mem_ctx, sizeof(uint32) * info->attribute_count); + + for (i=0; iattribute_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; + + info->hdr_privslist = talloc(ps->mem_ctx, sizeof(UNIHDR) * info->privlist_count); + info->uni_privslist = talloc(ps->mem_ctx, sizeof(UNISTR2) * info->privlist_count); + + for (i=0; iprivlist_count; i++) + if(!smb_io_unihdr("hdr_privslist", &info->hdr_privslist[i], ps, depth)) + return False; + + for (i=0; iprivlist_count; i++) + if (!smb_io_unistr2("uni_privslist", &info->uni_privslist[i], True, ps, depth)) + return False; + + return True; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -2292,70 +2470,56 @@ static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], prs_debug(ps, depth, desc, "net_io_sam_delta_ctr"); depth++; - switch (type) - { + switch (type) { /* Seen in sam deltas */ - case SAM_DELTA_SAM_STAMP: - { - if (!net_io_sam_delta_stamp("", &delta->stamp, - ps, depth)) + if (!net_io_sam_delta_stamp("", &delta->stamp, ps, depth)) return False; break; - } case SAM_DELTA_DOMAIN_INFO: - { - if (!net_io_sam_domain_info("", &delta->domain_info, - ps, depth)) + 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)) + 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("", sess_key, - &delta->account_info, - ps, depth)) + if (!net_io_sam_account_info("", sess_key, &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)) + 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)) + if (!net_io_sam_alias_info("", &delta->alias_info, ps, depth)) return False; break; - } + + case SAM_DELTA_DOM_INFO: + if (!net_io_sam_dom_info("", &delta->dom_info, ps, depth)) + return False; + break; + case SAM_DELTA_ALIAS_MEM: - { - if (!net_io_sam_alias_mem_info("", - &delta->als_mem_info, - ps, depth)) + 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; + default: - { - DEBUG(0, - ("Replication error: Unknown delta type 0x%x\n", - type)); + DEBUG(0, ("Replication error: Unknown delta type 0x%x\n", type)); break; - } } return True; -- cgit From 1c95d1d16b570b13ae8214f7659e0720500df4fd Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Wed, 12 Dec 2001 11:38:57 +0000 Subject: decoded SAM_DELTA 0x0e and 0x12. One is an entry for the trusted domains The other is an entry for the trusting domains They are pretty basic, I'll improve them. J.F. (This used to be commit 8d359e62138aa327cb00875dc446234ce4be6f02) --- source3/rpc_parse/parse_net.c | 144 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 3062c5c073..9890527552 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -2369,6 +2369,140 @@ static BOOL net_io_sam_dom_info(char *desc, SAM_DELTA_DOM *info, if(!smb_io_dom_sid2("domain_sid", &info->domain_sid, ps, depth)) return False; + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL net_io_sam_unk0e_info(char *desc, SAM_DELTA_UNK0E *info, + prs_struct *ps, int depth) +{ + int i; + + prs_debug(ps, depth, desc, "net_io_sam_unk0e_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; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +static BOOL net_io_sam_unk12_info(char *desc, SAM_DELTA_UNK12 *info, + prs_struct *ps, int depth) +{ + int i; + + prs_debug(ps, depth, desc, "net_io_sam_unk12_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; } @@ -2517,6 +2651,16 @@ static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], return False; break; + case SAM_DELTA_UNK0E_INFO: + if (!net_io_sam_unk0e_info("", &delta->unk0e_info, ps, depth)) + return False; + break; + + case SAM_DELTA_UNK12_INFO: + if (!net_io_sam_unk12_info("", &delta->unk12_info, ps, depth)) + return False; + break; + default: DEBUG(0, ("Replication error: Unknown delta type 0x%x\n", type)); break; -- cgit From 037b40f01f8ec42250b33de08680d4f6a06eac64 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 13 Dec 2001 17:18:15 +0000 Subject: merge from 2.2 (This used to be commit 5b4b3323a3fbabbb3c7db5eb3b11999bbde470b1) --- source3/rpc_parse/parse_spoolss.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b4d6343946..c2d462ad40 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -6316,6 +6316,9 @@ BOOL spoolss_io_r_enumprinterkey(char *desc, SPOOL_R_ENUMPRINTERKEY *r_u, prs_st if (!smb_io_buffer5("", &r_u->keys, ps, depth)) return False; + if(!prs_align(ps)) + return False; + if(!prs_uint32("needed", ps, depth, &r_u->needed)) return False; -- cgit From 9f59fc64b8c1772b6a73d1649013d2187c298868 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Thu, 13 Dec 2001 18:09:29 +0000 Subject: update the ldap support code. it compiles. Ignacio you can update your howto ;-) samsync: a small patch to try chaning challenges. J.F. (This used to be commit c99bc305599698f2291efbfe20024355cb2bcde0) --- source3/rpc_parse/parse_net.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 9890527552..bb123330ee 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1592,18 +1592,21 @@ BOOL net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int 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, - uint32 database_id) + const char *cli_name, DOM_CRED *cli_creds, + DOM_CRED *ret_creds, uint32 database_id) { DEBUG(5, ("init_q_sam_sync\n")); init_unistr2(&q_s->uni_srv_name, srv_name, strlen(srv_name) + 1); init_unistr2(&q_s->uni_cli_name, cli_name, strlen(cli_name) + 1); - if (cli_creds) { + if (cli_creds) memcpy(&q_s->cli_creds, cli_creds, sizeof(q_s->cli_creds)); - memset(&q_s->ret_creds, 0, sizeof(q_s->ret_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; -- cgit From 0be611c8dcab438674362773495417bd846e11f2 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 17 Dec 2001 01:53:02 +0000 Subject: Replaced some hardcoded hex numbers with constants. Made a note about NOTIFY_OPTION_TYPE and NOTIFY_OPTION_TYPE_DATA - they are actually one structure. The latter is just the deferred referrant of the former. (This used to be commit b596c0b171b1fd0e25e52944c880e8a90bc10a2e) --- source3/rpc_parse/parse_spoolss.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index c2d462ad40..f6d629f857 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -192,6 +192,10 @@ static BOOL smb_io_doc_info_container(char *desc, DOC_INFO_CONTAINER *cont, prs_ reads or writes an NOTIFY OPTION TYPE structure. ********************************************************************/ +/* NOTIFY_OPTION_TYPE and NOTIFY_OPTION_TYPE_DATA are really one + structure. The _TYPE structure is really the deferred referrants (i.e + the notify fields array) of the _TYPE structure. -tpot */ + static BOOL smb_io_notify_option_type(char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_notify_option_type"); @@ -5590,10 +5594,10 @@ BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_st switch (q_u->type) { - case 0x1: - case 0x3: - case 0x4: - case 0x7: + case REG_SZ: + case REG_BINARY: + case REG_DWORD: + case REG_MULTI_SZ: if (q_u->max_len) { if (UNMARSHALLING(ps)) q_u->data=(uint8 *)prs_alloc_mem(ps, q_u->max_len * sizeof(uint8)); -- cgit From 6e76486505287124eb62e32c4387a9608364a568 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 17 Dec 2001 23:03:23 +0000 Subject: there is no unknown field in LSA_SEC_QOS some cleanup of the lsa_open_policy and lsa_open_policy2 parser. the length fields are not correct but that's what NT send. We don't anymore underflow or overflow the decoding. added the domain admins group to the default SD. we are now checking the desired access flag in the lsa_open_policy_X() calls and in most functions also. J.F. (This used to be commit a217c4e4ff4d13122703d22258792fe5e8e9f02f) --- source3/rpc_parse/parse_lsa.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 6aa696369a..12b0ec2e16 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -138,8 +138,7 @@ static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, Inits an LSA_SEC_QOS structure. ********************************************************************/ -void init_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff, - uint32 unknown) +void init_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff) { DEBUG(5, ("init_lsa_sec_qos\n")); @@ -147,7 +146,6 @@ void init_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff, qos->sec_imp_level = imp_lev; qos->sec_ctxt_mode = ctxt; qos->effective_only = eff; - qos->unknown = unknown; } /******************************************************************* @@ -178,13 +176,10 @@ static BOOL lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, return False; if(!prs_uint8 ("effective_only", ps, depth, &qos->effective_only)) return False; - if(!prs_uint32("unknown ", ps, depth, &qos->unknown)) - 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 False; } return True; @@ -255,7 +250,11 @@ static BOOL lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, } #endif - if (attr->ptr_sec_qos != 0 && attr->sec_qos != NULL) { + if (attr->ptr_sec_qos != 0) { + if (UNMARSHALLING(ps)) + if (!(attr->sec_qos = (LSA_SEC_QOS *)prs_alloc_mem(ps,sizeof(LSA_SEC_QOS)))) + return False; + if(!lsa_io_sec_qos("sec_qos", attr->sec_qos, ps, depth)) return False; } @@ -277,8 +276,7 @@ void init_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name, r_q->ptr = 1; /* undocumented pointer */ - if (qos == NULL) - r_q->des_access = desired_access; + r_q->des_access = desired_access; r_q->system_name = system_name; init_lsa_obj_attr(&r_q->attr, attributes, qos); @@ -304,10 +302,8 @@ BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, if(!lsa_io_obj_attr("", &r_q->attr, ps, depth)) return False; - if (r_q->attr.ptr_sec_qos == 0) { - if(!prs_uint32("des_access", ps, depth, &r_q->des_access)) - return False; - } + if(!prs_uint32("des_access", ps, depth, &r_q->des_access)) + return False; return True; } @@ -344,8 +340,7 @@ void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, r_q->ptr = 1; /* undocumented pointer */ - if (qos == NULL) - r_q->des_access = desired_access; + r_q->des_access = desired_access; init_unistr2(&r_q->uni_server_name, server_name, strlen(server_name) + 1); @@ -371,10 +366,8 @@ BOOL lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, if(!lsa_io_obj_attr("", &r_q->attr, ps, depth)) return False; - if (r_q->attr.ptr_sec_qos == 0) { - if(!prs_uint32("des_access", ps, depth, &r_q->des_access)) - return False; - } + if(!prs_uint32("des_access", ps, depth, &r_q->des_access)) + return False; return True; } @@ -1608,6 +1601,9 @@ BOOL lsa_io_q_unk_get_connuser(char *desc, LSA_Q_UNK_GET_CONNUSER *q_c, prs_stru if(!smb_io_unistr2("uni2_srvname", &q_c->uni2_srvname, q_c->ptr_srvname, ps, depth)) /* server name to be looked up */ return False; + if (!prs_align(ps)) + return False; + if(!prs_uint32("unk1", ps, depth, &q_c->unk1)) return False; if(!prs_uint32("unk2", ps, depth, &q_c->unk2)) -- cgit From a94ff206c6a55777e1aaeeb32ca9d0842f0196b9 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Tue, 18 Dec 2001 00:30:25 +0000 Subject: fixing bug I introduced. J.F. (This used to be commit 49764852c516a22fba84d6289c93bed0e5da1c7e) --- source3/rpc_parse/parse_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index bb123330ee..b584673f38 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1296,7 +1296,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam usr->num_groups2 = num_groups; usr->gids = (DOM_GID *)talloc_zero(ctx,sizeof(DOM_GID) * (num_groups)); - if (usr->gids == NULL) + if (usr->gids == NULL && num_groups>0) return; for (i = 0; i < num_groups; i++) -- cgit From ea274ac97ff5c46c5f910c38b463d6a553dea9e6 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Wed, 19 Dec 2001 00:15:29 +0000 Subject: added info level 1 to samr_query_alias() (This used to be commit 589aa4fe226ee5bdae0a244631193714b0b556ac) --- source3/rpc_parse/parse_samr.c | 61 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 0c6bcdafb8..bfca495893 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3431,6 +3431,63 @@ BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u, return True; } +/******************************************************************* +inits a ALIAS_INFO1 structure. +********************************************************************/ + +void init_samr_alias_info1(ALIAS_INFO1 * al1, char *acct_name, uint32 num_member, char *acct_desc) +{ + int acct_len_name = acct_name != NULL ? strlen(acct_name) : 0; + int acct_len_desc = acct_desc != NULL ? strlen(acct_desc) : 0; + + DEBUG(5, ("init_samr_alias_info1\n")); + + init_uni_hdr(&al1->hdr_acct_name, acct_len_name); + init_unistr2(&al1->uni_acct_name, acct_name, acct_len_name); + + al1->num_member=num_member; + + init_uni_hdr(&al1->hdr_acct_desc, acct_len_desc); + init_unistr2(&al1->uni_acct_desc, acct_desc, acct_len_desc); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_alias_info1(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(!smb_io_unihdr("hdr_acct_name", &al1->hdr_acct_name, ps, depth)) + return False; + if(!prs_uint32("num_member", ps, depth, &al1->num_member)) + return False; + if(!smb_io_unihdr("hdr_acct_desc", &al1->hdr_acct_desc, ps, depth)) + return False; + + if(!smb_io_unistr2("uni_acct_name", &al1->uni_acct_name, + al1->hdr_acct_name.buffer, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!smb_io_unistr2("uni_acct_desc", &al1->uni_acct_desc, + al1->hdr_acct_desc.buffer, ps, depth)) + return False; + + return True; +} + /******************************************************************* inits a ALIAS_INFO3 structure. ********************************************************************/ @@ -3489,6 +3546,10 @@ BOOL samr_alias_info_ctr(char *desc, ALIAS_INFO_CTR * ctr, return False; switch (ctr->switch_value1) { + case 1: + if(!samr_io_alias_info1("alias_info1", &ctr->alias.info1, ps, depth)) + return False; + break; case 3: if(!samr_io_alias_info3("alias_info3", &ctr->alias.info3, ps, depth)) return False; -- cgit From f7e4e37c63044c378a1ea624304b331c9c443fc9 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 20 Dec 2001 15:09:23 +0000 Subject: merge from 2.2 (This used to be commit 72d3b160229ce9ab8497579ee79668738a70a81f) --- source3/rpc_parse/parse_spoolss.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index f6d629f857..14e22c4195 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -6368,6 +6368,7 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, uint32 valuename_offset, data_offset, current_offset; + const uint32 basic_unit = 20; /* size of static portion of enum_values */ prs_debug(ps, depth, desc, "spoolss_io_printer_enum_values_ctr"); depth++; @@ -6375,10 +6376,9 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, if (!prs_uint32("size", ps, depth, &ctr->size)) return False; - /* offset data begins at 20 bytes per structure * size_of_array. - Don't forget the uint32 at the beginning */ + /* offset data begins at 20 bytes per structure * size_of_array. */ - current_offset = 4 + (20*ctr->size_of_array); + current_offset = basic_unit * ctr->size_of_array; /* first loop to write basic enum_value information */ @@ -6401,13 +6401,13 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, if (!prs_uint32("data_len", ps, depth, &ctr->values[i].data_len)) return False; - current_offset = data_offset + ctr->values[i].data_len; + current_offset = data_offset + ctr->values[i].data_len - basic_unit; } /* loop #2 for writing the dynamically size objects - while viewing oncversations between Win2k -> Win2k, - 4-byte alignment does not seem to matter here --jerrty */ + while viewing conversations between Win2k -> Win2k, + 4-byte alignment does not seem to matter here --jerry */ for (i=0; isize_of_array; i++) { -- cgit From 595dd015071395bae2ffc61573c72bb9f6a77553 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Fri, 21 Dec 2001 13:36:14 +0000 Subject: re-done all of samr_query_disp_info() instead of enumerating the whole user db or group db every time, we store a in memory copy linked to the handle. that's much faster for large enumeration where the db can't fit in a single rpc packet. And as it's a copy, it's constant between enumeration. still some stuff to clean. But now I can fix the W95 userlist bug, as I've finally found it. J.F. (This used to be commit 3ab45215369e8e93d750f4687e9c1f7d47782590) --- source3/rpc_parse/parse_samr.c | 201 ++++++++++++++++------------------------- 1 file changed, 76 insertions(+), 125 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index bfca495893..fdc2d560e1 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -934,7 +934,6 @@ static void init_sam_entry1(SAM_ENTRY1 * sam, uint32 user_idx, sam->user_idx = user_idx; sam->rid_user = rid_user; sam->acb_info = acb_info; - sam->pad = 0; init_uni_hdr(&sam->hdr_acct_name, len_sam_name); init_uni_hdr(&sam->hdr_user_name, len_sam_full); @@ -964,7 +963,8 @@ static BOOL sam_io_sam_entry1(char *desc, SAM_ENTRY1 * sam, return False; if(!prs_uint16("acb_info ", ps, depth, &sam->acb_info)) return False; - if(!prs_uint16("pad ", ps, depth, &sam->pad)) + + if(!prs_align(ps)) return False; if (!smb_io_unihdr("hdr_acct_name", &sam->hdr_acct_name, ps, depth)) @@ -1013,7 +1013,6 @@ static void init_sam_entry2(SAM_ENTRY2 * sam, uint32 user_idx, sam->user_idx = user_idx; sam->rid_user = rid_user; sam->acb_info = acb_info; - sam->pad = 0; init_uni_hdr(&sam->hdr_srv_name, len_sam_name); init_uni_hdr(&sam->hdr_srv_desc, len_sam_desc); @@ -1042,7 +1041,8 @@ static BOOL sam_io_sam_entry2(char *desc, SAM_ENTRY2 * sam, return False; if(!prs_uint16("acb_info ", ps, depth, &sam->acb_info)) return False; - if(!prs_uint16("pad ", ps, depth, &sam->pad)) + + if(!prs_align(ps)) return False; if(!smb_io_unihdr("unihdr", &sam->hdr_srv_name, ps, depth)) /* account name unicode string header */ @@ -1436,62 +1436,53 @@ BOOL samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO * q_e, inits a SAM_DISPINFO_1 structure. ********************************************************************/ -NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 *num_entries, - uint32 *data_size, uint32 start_idx, - SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) +NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_entries, + uint32 start_idx, DISP_USER_INFO *disp_user_info) { uint32 len_sam_name, len_sam_full, len_sam_desc; - uint32 max_entries, max_data_size; - uint32 dsize = 0; uint32 i; + SAM_ACCOUNT *pwd = NULL; ZERO_STRUCTP(sam); - max_entries = *num_entries; - max_data_size = *data_size; - - DEBUG(5, ("init_sam_dispinfo_1: max_entries: %d max_dsize: 0x%x\n", - max_entries, max_data_size)); + DEBUG(10, ("init_sam_dispinfo_1: num_entries: %d\n", num_entries)); - if (max_entries==0) + if (num_entries==0) return NT_STATUS_OK; - sam->sam=(SAM_ENTRY1 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY1)); + sam->sam=(SAM_ENTRY1 *)talloc(ctx, num_entries*sizeof(SAM_ENTRY1)); if (!sam->sam) return NT_STATUS_NO_MEMORY; - sam->str=(SAM_STR1 *)talloc(ctx, max_entries*sizeof(SAM_STR1)); + sam->str=(SAM_STR1 *)talloc(ctx, num_entries*sizeof(SAM_STR1)); if (!sam->str) return NT_STATUS_NO_MEMORY; ZERO_STRUCTP(sam->sam); ZERO_STRUCTP(sam->str); - for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) { - DEBUG(5, ("init_sam_dispinfo_1: entry: %d\n",i)); - len_sam_name = pass[i].uni_user_name.uni_str_len; - len_sam_full = pass[i].uni_full_name.uni_str_len; - len_sam_desc = pass[i].uni_acct_desc.uni_str_len; + for (i = 0; i < num_entries ; i++) { + DEBUG(11, ("init_sam_dispinfo_1: entry: %d\n",i)); + + pwd=disp_user_info[i+start_idx].sam; + + len_sam_name = strlen(pdb_get_username(pwd)); + len_sam_full = strlen(pdb_get_fullname(pwd)); + len_sam_desc = strlen(pdb_get_acct_desc(pwd)); init_sam_entry1(&sam->sam[i], start_idx + i + 1, len_sam_name, len_sam_full, len_sam_desc, - pass[i].user_rid, pass[i].acb_info); + pdb_get_user_rid(pwd), pdb_get_acct_ctrl(pwd)); ZERO_STRUCTP(&sam->str[i].uni_acct_name); ZERO_STRUCTP(&sam->str[i].uni_full_name); ZERO_STRUCTP(&sam->str[i].uni_acct_desc); - copy_unistr2(&sam->str[i].uni_acct_name, &pass[i].uni_user_name); - copy_unistr2(&sam->str[i].uni_full_name, &pass[i].uni_full_name); - copy_unistr2(&sam->str[i].uni_acct_desc, &pass[i].uni_acct_desc); - - dsize += sizeof(SAM_ENTRY1); - dsize += len_sam_name + len_sam_full + len_sam_desc; + init_unistr2(&sam->str[i].uni_acct_name, pdb_get_username(pwd), len_sam_name); + init_unistr2(&sam->str[i].uni_full_name, pdb_get_fullname(pwd), len_sam_full); + init_unistr2(&sam->str[i].uni_acct_desc, pdb_get_acct_desc(pwd), len_sam_desc); } - *num_entries = i; - *data_size = dsize; - return NT_STATUS_OK; } @@ -1548,55 +1539,47 @@ static BOOL sam_io_sam_dispinfo_1(char *desc, SAM_DISPINFO_1 * sam, inits a SAM_DISPINFO_2 structure. ********************************************************************/ -NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 *num_entries, - uint32 *data_size, uint32 start_idx, - SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) +NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_entries, + uint32 start_idx, DISP_USER_INFO *disp_user_info) { uint32 len_sam_name, len_sam_desc; - uint32 max_entries, max_data_size; - uint32 dsize = 0; uint32 i; - DEBUG(5, ("init_sam_dispinfo_2\n")); - + SAM_ACCOUNT *pwd = NULL; ZERO_STRUCTP(sam); - max_entries = *num_entries; - max_data_size = *data_size; + DEBUG(10, ("init_sam_dispinfo_2: num_entries: %d\n", num_entries)); - if (max_entries==0) + if (num_entries==0) return NT_STATUS_OK; - if (!(sam->sam=(SAM_ENTRY2 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY2)))) + if (!(sam->sam=(SAM_ENTRY2 *)talloc(ctx, num_entries*sizeof(SAM_ENTRY2)))) return NT_STATUS_NO_MEMORY; - if (!(sam->str=(SAM_STR2 *)talloc(ctx, max_entries*sizeof(SAM_STR2)))) + if (!(sam->str=(SAM_STR2 *)talloc(ctx, num_entries*sizeof(SAM_STR2)))) return NT_STATUS_NO_MEMORY; ZERO_STRUCTP(sam->sam); ZERO_STRUCTP(sam->str); - for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) { - len_sam_name = pass[i].uni_user_name.uni_str_len; - len_sam_desc = pass[i].uni_acct_desc.uni_str_len; + for (i = 0; i < num_entries; i++) { + DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i)); + pwd=disp_user_info[i+start_idx].sam; + + len_sam_name = strlen(pdb_get_username(pwd)); + len_sam_desc = strlen(pdb_get_acct_desc(pwd)); init_sam_entry2(&sam->sam[i], start_idx + i + 1, len_sam_name, len_sam_desc, - pass[i].user_rid, pass[i].acb_info); + pdb_get_user_rid(pwd), pdb_get_acct_ctrl(pwd)); ZERO_STRUCTP(&sam->str[i].uni_srv_name); ZERO_STRUCTP(&sam->str[i].uni_srv_desc); - copy_unistr2(&sam->str[i].uni_srv_name, &pass[i].uni_user_name); - copy_unistr2(&sam->str[i].uni_srv_desc, &pass[i].uni_acct_desc); - - dsize += sizeof(SAM_ENTRY2); - dsize += len_sam_name + len_sam_desc; + init_unistr2(&sam->str[i].uni_srv_name, pdb_get_username(pwd), len_sam_name); + init_unistr2(&sam->str[i].uni_srv_desc, pdb_get_acct_desc(pwd), len_sam_desc); } - *num_entries = i; - *data_size = dsize; - return NT_STATUS_OK; } @@ -1655,35 +1638,33 @@ static BOOL sam_io_sam_dispinfo_2(char *desc, SAM_DISPINFO_2 * sam, inits a SAM_DISPINFO_3 structure. ********************************************************************/ -NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 *num_entries, - uint32 *data_size, uint32 start_idx, - DOMAIN_GRP * grp) +NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_entries, + uint32 start_idx, DISP_GROUP_INFO *disp_group_info) { uint32 len_sam_name, len_sam_desc; - uint32 max_entries, max_data_size; - uint32 dsize = 0; uint32 i; - DEBUG(5, ("init_sam_dispinfo_3\n")); - + DOMAIN_GRP *grp; ZERO_STRUCTP(sam); - max_entries = *num_entries; - max_data_size = *data_size; + DEBUG(5, ("init_sam_dispinfo_3: num_entries: %d\n", num_entries)); - if (max_entries==0) + if (num_entries==0) return NT_STATUS_OK; - if (!(sam->sam=(SAM_ENTRY3 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY3)))) + if (!(sam->sam=(SAM_ENTRY3 *)talloc(ctx, num_entries*sizeof(SAM_ENTRY3)))) return NT_STATUS_NO_MEMORY; - if (!(sam->str=(SAM_STR3 *)talloc(ctx, max_entries*sizeof(SAM_STR3)))) + if (!(sam->str=(SAM_STR3 *)talloc(ctx, num_entries*sizeof(SAM_STR3)))) return NT_STATUS_NO_MEMORY; ZERO_STRUCTP(sam->sam); ZERO_STRUCTP(sam->str); - for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) { + for (i = 0; i < num_entries; i++) { + DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i)); + grp=disp_group_info[i+start_idx].grp; + len_sam_name = strlen(grp[i].name); len_sam_desc = strlen(grp[i].comment); @@ -1691,15 +1672,8 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 *num_e init_unistr2(&sam->str[i].uni_grp_name, grp[i].name, len_sam_name); init_unistr2(&sam->str[i].uni_grp_desc, grp[i].comment, len_sam_desc); - - dsize += sizeof(SAM_ENTRY3); - dsize += (len_sam_name + len_sam_desc) * 2; - dsize += 14; } - *num_entries = i; - *data_size = dsize; - return NT_STATUS_OK; } @@ -1758,50 +1732,40 @@ static BOOL sam_io_sam_dispinfo_3(char *desc, SAM_DISPINFO_3 * sam, inits a SAM_DISPINFO_4 structure. ********************************************************************/ -NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 *num_entries, - uint32 *data_size, uint32 start_idx, - SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES]) +NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 num_entries, + uint32 start_idx, DISP_USER_INFO *disp_user_info) { - fstring sam_name; uint32 len_sam_name; - uint32 max_entries, max_data_size; - uint32 dsize = 0; uint32 i; - DEBUG(5, ("init_sam_dispinfo_4\n")); - + SAM_ACCOUNT *pwd = NULL; ZERO_STRUCTP(sam); - max_entries = *num_entries; - max_data_size = *data_size; + DEBUG(5, ("init_sam_dispinfo_4: num_entries: %d\n", num_entries)); - if (max_entries==0) + if (num_entries==0) return NT_STATUS_OK; - if (!(sam->sam=(SAM_ENTRY4 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY4)))) + if (!(sam->sam=(SAM_ENTRY4 *)talloc(ctx, num_entries*sizeof(SAM_ENTRY4)))) return NT_STATUS_NO_MEMORY; - if (!(sam->str=(SAM_STR4 *)talloc(ctx, max_entries*sizeof(SAM_STR4)))) + if (!(sam->str=(SAM_STR4 *)talloc(ctx, num_entries*sizeof(SAM_STR4)))) return NT_STATUS_NO_MEMORY; ZERO_STRUCTP(sam->sam); ZERO_STRUCTP(sam->str); - for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) { - len_sam_name = pass[i].uni_user_name.uni_str_len; + for (i = 0; i < num_entries; i++) { + DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i)); + pwd=disp_user_info[i+start_idx].sam; + + len_sam_name = strlen(pdb_get_username(pwd)); init_sam_entry4(&sam->sam[i], start_idx + i + 1, len_sam_name); - unistr2_to_ascii(sam_name, &pass[i].uni_user_name, sizeof(sam_name)); - init_string2(&sam->str[i].acct_name, sam_name, len_sam_name+1, len_sam_name); - - dsize += sizeof(SAM_ENTRY4); - dsize += len_sam_name; + init_string2(&sam->str[i].acct_name, pdb_get_username(pwd), len_sam_name+1, len_sam_name); } - *num_entries = i; - *data_size = dsize; - return NT_STATUS_OK; } @@ -1859,46 +1823,38 @@ static BOOL sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 * sam, inits a SAM_DISPINFO_5 structure. ********************************************************************/ -NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 *num_entries, - uint32 *data_size, uint32 start_idx, - DOMAIN_GRP * grp) +NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 num_entries, + uint32 start_idx, DISP_GROUP_INFO *disp_group_info) { uint32 len_sam_name; - uint32 max_entries, max_data_size; - uint32 dsize = 0; uint32 i; - DEBUG(5, ("init_sam_dispinfo_5\n")); - + DOMAIN_GRP *grp; ZERO_STRUCTP(sam); - max_entries = *num_entries; - max_data_size = *data_size; + DEBUG(5, ("init_sam_dispinfo_5: num_entries: %d\n", num_entries)); - if (max_entries==0) + if (num_entries==0) return NT_STATUS_OK; - if (!(sam->sam=(SAM_ENTRY5 *)talloc(ctx, max_entries*sizeof(SAM_ENTRY5)))) + if (!(sam->sam=(SAM_ENTRY5 *)talloc(ctx, num_entries*sizeof(SAM_ENTRY5)))) return NT_STATUS_NO_MEMORY; - if (!(sam->str=(SAM_STR5 *)talloc(ctx, max_entries*sizeof(SAM_STR5)))) + if (!(sam->str=(SAM_STR5 *)talloc(ctx, num_entries*sizeof(SAM_STR5)))) return NT_STATUS_NO_MEMORY; ZERO_STRUCTP(sam->sam); ZERO_STRUCTP(sam->str); - for (i = 0; (i < max_entries) && (dsize < max_data_size); i++) { + for (i = 0; i < num_entries; i++) { + DEBUG(11, ("init_sam_dispinfo_5: entry: %d\n",i)); + grp=disp_group_info[i+start_idx].grp; + len_sam_name = strlen(grp[i].name); init_sam_entry5(&sam->sam[i], start_idx + i + 1, len_sam_name); init_string2(&sam->str[i].grp_name, grp[i].name, len_sam_name+1, len_sam_name); - - dsize += sizeof(SAM_ENTRY5); - dsize += len_sam_name; } - - *num_entries = i; - *data_size = dsize; return NT_STATUS_OK; } @@ -1948,8 +1904,6 @@ static BOOL sam_io_sam_dispinfo_5(char *desc, SAM_DISPINFO_5 * sam, if(!smb_io_string2("grp_name", &sam->str[i].grp_name, sam->sam[i].hdr_grp_name.buffer, ps, depth)) return False; - if(!prs_align(ps)) - return False; } return True; @@ -1960,16 +1914,13 @@ inits a SAMR_R_QUERY_DISPINFO structure. ********************************************************************/ void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO * r_u, - uint32 num_entries, uint32 data_size, + 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)); - if (switch_level==4) - r_u->total_size = 0; /* not calculated */ - else - r_u->total_size = data_size; /* not calculated */ + r_u->total_size = total_size; r_u->data_size = data_size; -- cgit From 0e550b2c11bde9a05167b237fb9910e2beccd14c Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Fri, 21 Dec 2001 22:34:49 +0000 Subject: doesn't keep track of the struct's size we enumerate. W2K doesn't calculate them and always reply a size of 32 bytes whereas NT4 did the maths. Anyway, it looks like the clients don't complain. in query_dom_info() at level 2, return the real number of users and groups. That's the fix to the W95/98 userlist bug ! as W95/98 does a query_dom_info(2) followed by a query_disp_info(4) on the SAME context handle (err we call it an lsa policy handle ! plain wrong name), I was tempted to keep the snapshoot in memory, to prevent 2 full user db enumerations in a row and just have one shared. But if some client does the 2 calls on two different handles, we would have 2 copies in memory not free'ed before the samr_close(). We still have too many fixed constant and too many magic values in that code. And btw, I really hates how the sequence number is generated ! J.F. (This used to be commit c0178e1a03f8225e5b350feb8fcbfb02f43327b4) --- source3/rpc_parse/parse_samr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index fdc2d560e1..10640b0c76 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -632,7 +632,7 @@ inits a structure. ********************************************************************/ void init_unk_info2(SAM_UNK_INFO_2 * u_2, char *domain, char *server, - uint32 seq_num) + uint32 seq_num, uint32 num_users, uint32 num_groups, uint32 num_alias) { int len_domain = strlen(domain); int len_server = strlen(server); @@ -651,9 +651,9 @@ void init_unk_info2(SAM_UNK_INFO_2 * u_2, u_2->unknown_4 = 0x00000001; u_2->unknown_5 = 0x00000003; u_2->unknown_6 = 0x00000001; - u_2->num_domain_usrs = MAX_SAM_ENTRIES; - u_2->num_domain_grps = MAX_SAM_ENTRIES; - u_2->num_local_grps = MAX_SAM_ENTRIES; + u_2->num_domain_usrs = num_users; + u_2->num_domain_grps = num_groups; + u_2->num_local_grps = num_alias; memset(u_2->padding, 0, sizeof(u_2->padding)); /* 12 bytes zeros */ -- cgit From 1acf4f67a26a8c51f250bef40630052fb2d4baff Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Fri, 21 Dec 2001 22:54:53 +0000 Subject: added a copyright notice. J.F. (This used to be commit 87928c4d91940447191af4fe83a2be7ac3477361) --- source3/rpc_parse/parse_samr.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 10640b0c76..f207d32e55 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -7,6 +7,7 @@ * Copyright (C) Paul Ashton 1997-2000, * Copyright (C) Elrond 2000, * Copyright (C) Jeremy Allison 2001 + * Copyright (C) Jean Franois Micouleau 1998-2001. * * 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 -- cgit From 85c5b3c315ee3899ad13b5f9dcbd61cdec6d30a5 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 31 Dec 2001 12:41:24 +0000 Subject: Give the main loop talloc context a name (using mbp's new talloc naming system). Andrew Bartlett (This used to be commit f0c301a12eb142add488a2da55591269dfc15f77) --- source3/rpc_parse/parse_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 52e4b4b07c..d2e2e3cf26 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -61,7 +61,7 @@ void main_loop_talloc_free(void) TALLOC_CTX *main_loop_talloc_get(void) { if (!main_loop_talloc) { - main_loop_talloc = talloc_init(); + main_loop_talloc = talloc_init_named("main loop talloc (mainly parse_misc)"); if (!main_loop_talloc) smb_panic("main_loop_talloc: malloc fail\n"); } -- cgit From 84ecd95dba6cf03070432b3cc37d511d310d1325 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 31 Dec 2001 14:05:22 +0000 Subject: more irix -64 portability fixes (This used to be commit 65e857b36e170e3ecd78bf6695ae73342e9c04cd) --- source3/rpc_parse/parse_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index b584673f38..c113daefab 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -744,7 +744,7 @@ BOOL net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth) ********************************************************************/ void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char *logon_srv, char *sess_key, char *acct_name, - uint16 sec_chan, char *comp_name, DOM_CRED *cred, char hashed_mach_pwd[16]) + uint16 sec_chan, char *comp_name, DOM_CRED *cred, uchar hashed_mach_pwd[16]) { unsigned char nt_cypher[16]; -- cgit From 4f3a2be2b9b566a33c5205142666e7e697d8f93f Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Wed, 2 Jan 2002 07:48:07 +0000 Subject: Add prs_dump_before to dump everything from the start of the prs buffer up to the current position, and use this to dump pipe buffers just before parsing. (This used to be commit 92a3ab274e6cf09a8ba39b91f8bbacba6de40b37) --- source3/rpc_parse/parse_prs.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index f902210b7b..8bb9f1c70a 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -23,10 +23,29 @@ #include "includes.h" -/******************************************************************* -dump a prs to a file - ********************************************************************/ +/** + * Dump a prs to a file: from the current location through to the end. + **/ void prs_dump(char *name, int v, prs_struct *ps) +{ + prs_dump_region(name, v, ps, ps->data_offset, ps->buffer_size); +} + + +/** + * Dump from the start of the prs to the current location. + **/ +void prs_dump_before(char *name, int v, prs_struct *ps) +{ + prs_dump_region(name, v, ps, 0, ps->data_offset); +} + + +/** + * Dump everything from the start of the prs up to the current location. + **/ +void prs_dump_region(char *name, int v, prs_struct *ps, + int from_off, int to_off) { int fd, i; pstring fname; @@ -41,7 +60,7 @@ void prs_dump(char *name, int v, prs_struct *ps) if (fd != -1 || errno != EEXIST) break; } if (fd != -1) { - write(fd, ps->data_p + ps->data_offset, ps->buffer_size - ps->data_offset); + write(fd, ps->data_p + from_off, to_off - from_off); close(fd); DEBUG(0,("created %s\n", fname)); } -- cgit From 17729f5dc5aa4a19fd2cdfed12f86da3e9d07ecc Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 7 Jan 2002 06:13:40 +0000 Subject: Sed error. The status value in the PRINTER_INFO_2 structure isn't a WERROR but a plain old uint32. (This used to be commit 690cc12bad2a037684a43b0dcb48be8eb03aa7bc) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 14e22c4195..66252c1a19 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4332,7 +4332,7 @@ BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, p return False; if(!prs_uint32("untiltime", ps, depth, &il->untiltime)) return False; - if(!prs_werror("status", ps, depth, &il->status)) + if(!prs_uint32("status", ps, depth, &il->status)) return False; if(!prs_uint32("cjobs", ps, depth, &il->cjobs)) return False; -- cgit From c9d350a736ca71f838cf19386b04e972200ee595 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 12 Jan 2002 02:37:54 +0000 Subject: Added PRINTER_INFO_4/PRINTER_INFO_5, we're seeing level 5 requested on the wire... so. Jeremy. (This used to be commit b63b76297835ab8227b98925fa8120ffce1a37d9) --- source3/rpc_parse/parse_spoolss.c | 91 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 66252c1a19..1006a1bbee 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2240,6 +2240,54 @@ BOOL smb_io_printer_info_3(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *info, return True; } +/******************************************************************* + Parse a PRINTER_INFO_4 structure. +********************************************************************/ + +BOOL smb_io_printer_info_4(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_4 *info, int depth) +{ + prs_struct *ps=&buffer->prs; + + prs_debug(ps, depth, desc, "smb_io_printer_info_4"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if (!smb_io_relstr("printername", buffer, depth, &info->printername)) + return False; + if (!smb_io_relstr("servername", buffer, depth, &info->servername)) + return False; + if (!prs_uint32("attributes", ps, depth, &info->attributes)) + return False; + return True; +} + +/******************************************************************* + Parse a PRINTER_INFO_5 structure. +********************************************************************/ + +BOOL smb_io_printer_info_5(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_5 *info, int depth) +{ + prs_struct *ps=&buffer->prs; + + prs_debug(ps, depth, desc, "smb_io_printer_info_5"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if (!smb_io_relstr("printername", buffer, depth, &info->printername)) + return False; + if (!smb_io_relstr("portname", buffer, depth, &info->portname)) + return False; + if (!prs_uint32("attributes", ps, depth, &info->attributes)) + return False; + if (!prs_uint32("device_not_selected_timeout", ps, depth, &info->device_not_selected_timeout)) + return False; + if (!prs_uint32("transmission_retry_timeout", ps, depth, &info->transmission_retry_timeout)) + return False; + return True; +} + /******************************************************************* Parse a PORT_INFO_1 structure. ********************************************************************/ @@ -2947,6 +2995,39 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) return size; } +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ + +uint32 spoolss_size_printer_info_4(PRINTER_INFO_4 *info) +{ + uint32 size=0; + + size+=size_of_relative_string( &info->printername ); + size+=size_of_relative_string( &info->servername ); + + size+=size_of_uint32( &info->attributes ); + return size; +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ + +uint32 spoolss_size_printer_info_5(PRINTER_INFO_5 *info) +{ + uint32 size=0; + + size+=size_of_relative_string( &info->printername ); + size+=size_of_relative_string( &info->portname ); + + size+=size_of_uint32( &info->attributes ); + size+=size_of_uint32( &info->device_not_selected_timeout ); + size+=size_of_uint32( &info->transmission_retry_timeout ); + return size; +} + + /******************************************************************* return the size required by a struct in the stream ********************************************************************/ @@ -5921,6 +6002,16 @@ void free_printer_info_3(PRINTER_INFO_3 *printer) SAFE_FREE(printer); } +void free_printer_info_4(PRINTER_INFO_4 *printer) +{ + SAFE_FREE(printer); +} + +void free_printer_info_5(PRINTER_INFO_5 *printer) +{ + SAFE_FREE(printer); +} + void free_job_info_2(JOB_INFO_2 *job) { if (job!=NULL) -- cgit From 37834a48e8b944936c9eb067203f457136fb3a2c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 18 Jan 2002 00:19:45 +0000 Subject: Always clear malloced memory for parse structs. Jeremy. (This used to be commit 6deb4caca5b45f87be84032fe0588db8d73b901a) --- source3/rpc_parse/parse_prs.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 8bb9f1c70a..7b4a5f3181 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -106,6 +106,7 @@ BOOL prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, BOOL io) DEBUG(0,("prs_init: malloc fail for %u bytes.\n", (unsigned int)size)); return False; } + memset(ps->data_p, '\0', (size_t)size); ps->is_dynamic = True; /* We own this memory. */ } -- cgit From 2a3673994d9574068b5fce5d694b1183b9c67395 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 18 Jan 2002 00:36:16 +0000 Subject: Added prs_mem_clear(). Clear memory on buffer reallocation. That way we're not returning what the client gave us. Jeremy. (This used to be commit 9a969069f132019cdd8a11be2b00356a3f09b64d) --- source3/rpc_parse/parse_prs.c | 15 ++++++++++++--- source3/rpc_parse/parse_spoolss.c | 15 +++++++-------- 2 files changed, 19 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 7b4a5f3181..725e2e01a5 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -145,6 +145,15 @@ void prs_mem_free(prs_struct *ps) ps->data_offset = 0; } +/******************************************************************* + Clear the memory in a parse structure. + ********************************************************************/ + +void prs_mem_clear(prs_struct *ps) +{ + memset(ps->data_p, '\0', (size_t)ps->buffer_size); +} + /******************************************************************* Allocate memory when unmarshalling... Always zero clears. ********************************************************************/ @@ -261,7 +270,7 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) DEBUG(0,("prs_grow: Malloc failure for size %u.\n", (unsigned int)new_size)); return False; } - memset(new_data, '\0', new_size ); + memset(new_data, '\0', (size_t)new_size ); } else { /* * If the current buffer size is bigger than the space needed, just @@ -275,7 +284,7 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) return False; } - memset(&new_data[ps->buffer_size], '\0', new_size - ps->buffer_size); + memset(&new_data[ps->buffer_size], '\0', (size_t)(new_size - ps->buffer_size)); } ps->buffer_size = new_size; ps->data_p = new_data; @@ -306,7 +315,7 @@ BOOL prs_force_grow(prs_struct *ps, uint32 extra_space) return False; } - memset(&new_data[ps->buffer_size], '\0', new_size - ps->buffer_size); + memset(&new_data[ps->buffer_size], '\0', (size_t)(new_size - ps->buffer_size)); ps->buffer_size = new_size; ps->data_p = new_data; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 1006a1bbee..458aed1fce 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -764,6 +764,7 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, /******************************************************************* * init a structure. ********************************************************************/ + BOOL make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u, @@ -784,12 +785,10 @@ BOOL make_spoolss_q_addprinterex( q_u->info.level = level; q_u->info.info_ptr = (ctr->printers_2!=NULL)?1:0; - switch (level) - { + switch (level) { case 2: /* init q_u->info.info2 from *info */ - if (!make_spoolss_printer_info_2(mem_ctx, &q_u->info.info_2, ctr->printers_2)) - { + if (!make_spoolss_printer_info_2(mem_ctx, &q_u->info.info_2, ctr->printers_2)) { DEBUG(0,("make_spoolss_q_addprinterex: Unable to fill SPOOL_Q_ADDPRINTEREX struct!\n")); return False; } @@ -832,8 +831,7 @@ BOOL make_spoolss_printer_info_2( SPOOL_PRINTER_INFO_LEVEL_2 *inf; /* allocate the necessary memory */ - if (!(inf=(SPOOL_PRINTER_INFO_LEVEL_2*)talloc(mem_ctx, sizeof(SPOOL_PRINTER_INFO_LEVEL_2)))) - { + if (!(inf=(SPOOL_PRINTER_INFO_LEVEL_2*)talloc(mem_ctx, sizeof(SPOOL_PRINTER_INFO_LEVEL_2)))) { DEBUG(0,("make_spoolss_printer_info_2: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_2 sruct!\n")); return False; } @@ -2721,6 +2719,7 @@ static BOOL spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUFFER move a BUFFER from the query to the reply. As the data pointers in NEW_BUFFER are malloc'ed, not talloc'ed, this is ok. This is an OPTIMIZATION and is not strictly neccessary. + Clears the memory to zero also. ********************************************************************/ void spoolss_move_buffer(NEW_BUFFER *src, NEW_BUFFER **dest) @@ -2728,8 +2727,8 @@ void spoolss_move_buffer(NEW_BUFFER *src, NEW_BUFFER **dest) prs_switch_type(&src->prs, MARSHALL); if(!prs_set_offset(&src->prs, 0)) return; - prs_force_dynamic(&(src->prs)); - + prs_force_dynamic(&src->prs); + prs_mem_clear(&src->prs); *dest=src; } -- cgit From 93a8358910d2b8788ffea33c04244ffd5ffecabf Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 20 Jan 2002 01:24:59 +0000 Subject: This patch makes the 'winbind use default domain' code interact better with smbd, and also makes it much cleaner inside winbindd. It is mostly my code, with a few changes and testing performed by Alexander Bokovoy . ab has tested it in security=domain and security=ads, but more testing is always appricatiated. The idea is that we no longer cart around a 'domain\user' string, we keep them seperate until the last moment - when we push that string into a pwent on onto the socket. This removes the need to be constantly parsing that string - the domain prefix is almost always already provided, (only a couple of functions actually changed arguments in all this). Some consequential changes to the RPC client code, to stop it concatonating the two strings (it now passes them both back as params). I havn't changed the cache code, however the usernames will no longer have a double domain prefix in the key string. The actual structures are unchanged - but the meaning of 'username' in the 'rid' will have changed. (The cache is invalidated at startup, so on-disk formats are not an issue here). Andrew Bartlett (This used to be commit e870f0e727952aeb8599cf93ad2650ae56eca033) --- source3/rpc_parse/parse_lsa.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 12b0ec2e16..04acc75d7e 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1045,7 +1045,7 @@ 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) + POLICY_HND *hnd, int num_names, const char **dom_names, const char **names) { int i; @@ -1072,10 +1072,20 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, for (i = 0; i < num_names; i++) { const char *name = names[i]; - int len = strlen(name); + const char *dom_name = dom_names[i]; + char *full_name; + int len; + + full_name = talloc_asprintf(mem_ctx, "%s\\%s", dom_name, name); + if (!full_name) { + DEBUG(0, ("init_q_lookup_names(): out of memory doing talloc_asprintf\n")); + return; + } + + len = strlen(full_name); init_uni_hdr(&q_l->hdr_name[i], len); - init_unistr2(&q_l->uni_name[i], name, len); + init_unistr2(&q_l->uni_name[i], full_name, len); } } -- cgit From 5b0dca4998837231b931aa9a4a546079454d780e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 26 Jan 2002 01:20:38 +0000 Subject: Fixed ADDPRINTEREX to take a devmode and a security descriptor... Jeremy. (This used to be commit 27f65b3aad13ecd33bbb84048d70e3dde212f278) --- source3/rpc_parse/parse_spoolss.c | 50 +++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 21 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 458aed1fce..c7e6f97a5d 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -778,6 +778,8 @@ BOOL make_spoolss_q_addprinterex( if (!ctr) return False; + ZERO_STRUCTP(q_u); + q_u->server_name_ptr = (srv_name!=NULL)?1:0; init_unistr2(&q_u->server_name, srv_name, strlen(srv_name)); @@ -797,8 +799,6 @@ BOOL make_spoolss_q_addprinterex( break; } - q_u->unk0 = q_u->unk1 = q_u->unk2 = q_u->unk3 = 0; - q_u->user_switch=1; q_u->user_ctr.level=1; @@ -868,7 +868,6 @@ BOOL make_spoolss_printer_info_2( init_unistr2_from_unistr(&inf->datatype, &info->datatype); init_unistr2_from_unistr(&inf->parameters, &info->parameters); init_unistr2_from_unistr(&inf->datatype, &info->datatype); - inf->secdesc = inf->secdesc; *spool_info2 = inf; @@ -4520,6 +4519,8 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth) { + uint32 ptr_sec_desc = 0; + prs_debug(ps, depth, desc, "spoolss_io_q_addprinterex"); depth++; @@ -4539,26 +4540,33 @@ BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct if(!spool_io_printer_info_level("", &q_u->info, ps, depth)) return False; - /* the 4 unknown are all 0 */ - - /* - * en fait ils sont pas inconnu - * par recoupement avec rpcSetPrinter - * c'est le devicemode - * et le security descriptor. - */ - - if(!prs_align(ps)) - return False; - if(!prs_uint32("unk0", ps, depth, &q_u->unk0)) - return False; - if(!prs_uint32("unk1", ps, depth, &q_u->unk1)) - return False; - if(!prs_uint32("unk2", ps, depth, &q_u->unk2)) - return False; - if(!prs_uint32("unk3", ps, depth, &q_u->unk3)) + if (!spoolss_io_devmode_cont(desc, &q_u->devmode_ctr, ps, depth)) return False; + switch (q_u->level) { + case 2: + ptr_sec_desc = q_u->info.info_2->secdesc_ptr; + break; + case 3: + ptr_sec_desc = q_u->info.info_3->secdesc_ptr; + break; + } + if (ptr_sec_desc) { + if (!sec_io_desc_buf(desc, &q_u->secdesc_ctr, ps, depth)) + return False; + } else { + uint32 dummy; + + /* Parse a NULL security descriptor. This should really + happen inside the sec_io_desc_buf() function. */ + + prs_debug(ps, depth, "", "sec_io_desc_buf"); + if (!prs_uint32("size", ps, depth + 1, &dummy)) + return False; + if (!prs_uint32("ptr", ps, depth + 1, &dummy)) + return False; + } + if(!prs_uint32("user_switch", ps, depth, &q_u->user_switch)) return False; if(!spool_io_user_level("", &q_u->user_ctr, ps, depth)) -- cgit From 29ad4a76cd629ba28087926080558f57417aa00c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 26 Jan 2002 05:52:20 +0000 Subject: Try to move towards slightly sane linking for Samba by removing some pdb_...() calls from rpc_parse/parse_net.c - instead these values are passed as a paramater. Unfortunetly some there is still some samr work to be done before this is actually useful. Andrew Bartlett (This used to be commit 4fc9e16ad7a77cf2e37b27640c0dec2052e9cda0) --- source3/rpc_parse/parse_net.c | 49 ++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index c113daefab..28fb175bb7 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1192,10 +1192,32 @@ static BOOL smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int d } /************************************************************************* - Init + 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, SAM_ACCOUNT *sampw, +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, DOM_GID *gids, uint32 user_flgs, uchar *sess_key, @@ -1214,13 +1236,6 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam int len_user_name, len_full_name, len_home_dir, len_dir_drive, len_logon_script, len_profile_path; - const char* user_name = pdb_get_username(sampw); - const char* full_name = pdb_get_fullname(sampw); - const char* home_dir = pdb_get_homedir(sampw); - const char* dir_drive = pdb_get_dirdrive(sampw); - const char* logon_script = pdb_get_logon_script(sampw); - const char* profile_path = pdb_get_profile_path(sampw); - int len_logon_srv = strlen(logon_srv); int len_logon_dom = strlen(logon_dom); @@ -1238,12 +1253,12 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam /* Create NTTIME structs */ - unix_to_nt_time (&logon_time, pdb_get_logon_time(sampw)); - unix_to_nt_time (&logoff_time, pdb_get_logoff_time(sampw)); - unix_to_nt_time (&kickoff_time, pdb_get_kickoff_time(sampw)); - unix_to_nt_time (&pass_last_set_time, pdb_get_pass_last_set_time(sampw)); - unix_to_nt_time (&pass_can_change_time, pdb_get_pass_can_change_time(sampw)); - unix_to_nt_time (&pass_must_change_time,pdb_get_pass_must_change_time(sampw)); + 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; @@ -1262,8 +1277,8 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam usr->logon_count = logon_count; usr->bad_pw_count = bad_pw_count; - usr->user_rid = pdb_get_user_rid(sampw); - usr->group_rid = pdb_get_group_rid(sampw); + 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 */ -- cgit From 33cf9ba4b7c08341d9e4fe056c85a0f27ec40793 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 26 Jan 2002 09:58:11 +0000 Subject: We may as well not use these temporary variables - they are only used once and just make it harder to debug (gcc stips optomises them away). (This used to be commit 100d2705ddfa1fde73a0bb06e8e097b2b1cbf36a) --- source3/rpc_parse/parse_lsa.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 04acc75d7e..ae6068e3d6 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1071,12 +1071,10 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, } for (i = 0; i < num_names; i++) { - const char *name = names[i]; - const char *dom_name = dom_names[i]; char *full_name; int len; - full_name = talloc_asprintf(mem_ctx, "%s\\%s", dom_name, name); + full_name = talloc_asprintf(mem_ctx, "%s\\%s", dom_names[i], names[i]); if (!full_name) { DEBUG(0, ("init_q_lookup_names(): out of memory doing talloc_asprintf\n")); return; -- cgit From ba8c1c6e459aef204aa93e9cf7e717209335a06b Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 26 Jan 2002 11:48:42 +0000 Subject: Back out some of the less well thought out ideas from last weeks work on winbind default domains, particulary now I understand whats going on a lot better. This ensures that the RPC client code does as little 'magic' as possible - this is up to the application/user. (Where - for to name->sid code - it was all along). This leaves the change that allows the sid->name code to return domains and usernames in seperate paramaters. Andrew Bartlett (This used to be commit 5dfba2cf536f761b0aee314ed9e30dc53900b691) --- source3/rpc_parse/parse_lsa.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index ae6068e3d6..a70d1e98a9 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1045,7 +1045,7 @@ 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 **dom_names, const char **names) + POLICY_HND *hnd, int num_names, const char **names) { int i; @@ -1071,19 +1071,11 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, } for (i = 0; i < num_names; i++) { - char *full_name; int len; - - full_name = talloc_asprintf(mem_ctx, "%s\\%s", dom_names[i], names[i]); - if (!full_name) { - DEBUG(0, ("init_q_lookup_names(): out of memory doing talloc_asprintf\n")); - return; - } - - len = strlen(full_name); + len = strlen(names[i]); init_uni_hdr(&q_l->hdr_name[i], len); - init_unistr2(&q_l->uni_name[i], full_name, len); + init_unistr2(&q_l->uni_name[i], names[i], len); } } -- cgit From cd68afe31256ad60748b34f7318a180cfc2127cc Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 30 Jan 2002 06:08:46 +0000 Subject: Removed version number from file header. Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa) --- source3/rpc_parse/parse_dfs.c | 3 +-- source3/rpc_parse/parse_lsa.c | 3 +-- source3/rpc_parse/parse_misc.c | 3 +-- source3/rpc_parse/parse_net.c | 3 +-- source3/rpc_parse/parse_prs.c | 3 +-- source3/rpc_parse/parse_reg.c | 3 +-- source3/rpc_parse/parse_rpc.c | 3 +-- source3/rpc_parse/parse_samr.c | 3 +-- source3/rpc_parse/parse_sec.c | 3 +-- source3/rpc_parse/parse_spoolss.c | 3 +-- source3/rpc_parse/parse_srv.c | 3 +-- source3/rpc_parse/parse_wks.c | 3 +-- 12 files changed, 12 insertions(+), 24 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index a152e3528e..6c83963d7a 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -1,6 +1,5 @@ /* - * Unix SMB/Netbios implementation. - * Version 1.9. + * Unix SMB/CIFS implementation. * MSDfs RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-2000, * Copyright (C) Luke Kenneth Casson Leighton 1996-2000, diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index a70d1e98a9..fd82325be7 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1,6 +1,5 @@ /* - * Unix SMB/Netbios implementation. - * Version 1.9. + * Unix SMB/CIFS implementation. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index d2e2e3cf26..b716231569 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1,6 +1,5 @@ /* - * Unix SMB/Netbios implementation. - * Version 1.9. + * Unix SMB/CIFS implementation. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 28fb175bb7..5865bd9f9b 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1,6 +1,5 @@ /* - * Unix SMB/Netbios implementation. - * Version 1.9. + * Unix SMB/CIFS implementation. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 725e2e01a5..2deefd362a 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1,6 +1,5 @@ /* - Unix SMB/Netbios implementation. - Version 1.9. + Unix SMB/CIFS implementation. Samba memory buffer functions Copyright (C) Andrew Tridgell 1992-1997 Copyright (C) Luke Kenneth Casson Leighton 1996-1997 diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 181a385592..1b8d1cd5c8 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1,6 +1,5 @@ /* - * Unix SMB/Netbios implementation. - * Version 1.9. + * Unix SMB/CIFS implementation. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index f4a84adee3..ee15d7cded 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -1,6 +1,5 @@ /* - * Unix SMB/Netbios implementation. - * Version 1.9. + * Unix SMB/CIFS implementation. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index f207d32e55..41a12c6b77 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1,6 +1,5 @@ /* - * Unix SMB/Netbios implementation. - * Version 1.9. + * Unix SMB/CIFS implementation. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-2000, * Copyright (C) Luke Kenneth Casson Leighton 1996-2000, diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 0e6f9e2879..8237ccf95d 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -1,6 +1,5 @@ /* - * Unix SMB/Netbios implementation. - * Version 1.9. + * Unix SMB/CIFS implementation. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1998, * Copyright (C) Jeremy R. Allison 1995-1998 diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index c7e6f97a5d..aa5981f7e9 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1,6 +1,5 @@ /* - * Unix SMB/Netbios implementation. - * Version 1.9. + * Unix SMB/CIFS implementation. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-2000, * Copyright (C) Luke Kenneth Casson Leighton 1996-2000, diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index fa52b24495..c440309559 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1,6 +1,5 @@ /* - * Unix SMB/Netbios implementation. - * Version 1.9. + * Unix SMB/CIFS implementation. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c index ecd4a201ae..3846c2e3b6 100644 --- a/source3/rpc_parse/parse_wks.c +++ b/source3/rpc_parse/parse_wks.c @@ -1,6 +1,5 @@ /* - * Unix SMB/Netbios implementation. - * Version 1.9. + * Unix SMB/CIFS implementation. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, -- cgit From a630f289f54954426b3ee4d8b5faae51632233f4 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 31 Jan 2002 11:42:16 +0000 Subject: Added make functions for SPOOL_Q_{ADD,SET,DELETE}FORM. I'm pretty sure that the useless_ptr in spoolss_io_q_setform() needs to be initialised to 1 otherwise the form isn't marshalled at all. JF, can you verify this? If so then this probably applies to the io functions for setform and deleteform. (This used to be commit 1803778451a344c6c8d116eac5eaac777e5cf4fe) --- source3/rpc_parse/parse_spoolss.c | 43 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index aa5981f7e9..2ed436fd85 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5832,7 +5832,7 @@ BOOL spoolss_io_r_deleteform(char *desc, SPOOL_R_DELETEFORM *r_u, prs_struct *ps BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth) { - uint32 useless_ptr=0; + uint32 useless_ptr=1; prs_debug(ps, depth, desc, "spoolss_io_q_addform"); depth++; @@ -6674,3 +6674,44 @@ BOOL smb_io_printprocessordirectory_1(char *desc, NEW_BUFFER *buffer, PRINTPROCE return True; } + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_addform(SPOOL_Q_ADDFORM *q_u, POLICY_HND *handle, + int level, FORM *form) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + q_u->level = level; + q_u->level2 = level; + memcpy(&q_u->form, form, sizeof(FORM)); + + return True; +} + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle, + int level, FORM *form) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + q_u->level = level; + q_u->level2 = level; + memcpy(&q_u->form, form, sizeof(FORM)); + + return True; +} + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, char *form) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + init_unistr2(&q_u->name, form, strlen(form) + 1); + return True; +} -- cgit From bb117fdca700a34564c1fcfbe607d0e28d2462d0 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 25 Feb 2002 06:43:31 +0000 Subject: Implemented client side functions for SPOOLSS addform, getform, setform and enumforms. (This used to be commit e69222f0816878e3211e3dedb049de50ca90fed0) --- source3/rpc_parse/parse_spoolss.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 2ed436fd85..b929369ec9 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5877,7 +5877,7 @@ BOOL spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int BOOL spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth) { - uint32 useless_ptr=0; + uint32 useless_ptr=1; prs_debug(ps, depth, desc, "spoolss_io_q_setform"); depth++; @@ -6695,12 +6695,13 @@ BOOL make_spoolss_q_addform(SPOOL_Q_ADDFORM *q_u, POLICY_HND *handle, ********************************************************************/ BOOL make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle, - int level, FORM *form) + int level, char *form_name, FORM *form) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); q_u->level = level; q_u->level2 = level; memcpy(&q_u->form, form, sizeof(FORM)); + init_unistr2(&q_u->name, form_name, strlen(form_name) + 1); return True; } @@ -6715,3 +6716,36 @@ BOOL make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, char init_unistr2(&q_u->name, form, strlen(form) + 1); return True; } + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_getform(SPOOL_Q_GETFORM *q_u, POLICY_HND *handle, + char *formname, uint32 level, NEW_BUFFER *buffer, + uint32 offered) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + q_u->level = level; + init_unistr2(&q_u->formname, formname, strlen(formname) + 1); + q_u->buffer=buffer; + q_u->offered=offered; + + return True; +} + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_enumforms(SPOOL_Q_ENUMFORMS *q_u, POLICY_HND *handle, + uint32 level, NEW_BUFFER *buffer, + uint32 offered) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + q_u->level = level; + q_u->buffer=buffer; + q_u->offered=offered; + + return True; +} -- cgit From 8071fb8c05be5549e7fb424da2b563c0b2025c68 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 27 Feb 2002 22:02:05 +0000 Subject: Patch for Domain users not showing up from "Ivan Zhakov" . Jeremy. (This used to be commit 3f9063167f3fc9ae7e7fd753d76ece23c1d97800) --- source3/rpc_parse/parse_samr.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 41a12c6b77..32d107c36c 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1644,7 +1644,6 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_en uint32 len_sam_name, len_sam_desc; uint32 i; - DOMAIN_GRP *grp; ZERO_STRUCTP(sam); DEBUG(5, ("init_sam_dispinfo_3: num_entries: %d\n", num_entries)); @@ -1662,16 +1661,17 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_en ZERO_STRUCTP(sam->str); for (i = 0; i < num_entries; i++) { + DOMAIN_GRP *grp = disp_group_info[i+start_idx].grp; + DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i)); - grp=disp_group_info[i+start_idx].grp; - len_sam_name = strlen(grp[i].name); - len_sam_desc = strlen(grp[i].comment); + len_sam_name = strlen(grp->name); + len_sam_desc = strlen(grp->comment); - init_sam_entry3(&sam->sam[i], start_idx + i + 1, len_sam_name, len_sam_desc, grp[i].rid); + init_sam_entry3(&sam->sam[i], start_idx + i + 1, len_sam_name, len_sam_desc, grp->rid); - init_unistr2(&sam->str[i].uni_grp_name, grp[i].name, len_sam_name); - init_unistr2(&sam->str[i].uni_grp_desc, grp[i].comment, len_sam_desc); + init_unistr2(&sam->str[i].uni_grp_name, grp->name, len_sam_name); + init_unistr2(&sam->str[i].uni_grp_desc, grp->comment, len_sam_desc); } return NT_STATUS_OK; @@ -1829,7 +1829,6 @@ NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 num_en uint32 len_sam_name; uint32 i; - DOMAIN_GRP *grp; ZERO_STRUCTP(sam); DEBUG(5, ("init_sam_dispinfo_5: num_entries: %d\n", num_entries)); @@ -1847,13 +1846,14 @@ NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 num_en ZERO_STRUCTP(sam->str); for (i = 0; i < num_entries; i++) { + DOMAIN_GRP *grp = disp_group_info[i+start_idx].grp; + DEBUG(11, ("init_sam_dispinfo_5: entry: %d\n",i)); - grp=disp_group_info[i+start_idx].grp; - len_sam_name = strlen(grp[i].name); + len_sam_name = strlen(grp->name); init_sam_entry5(&sam->sam[i], start_idx + i + 1, len_sam_name); - init_string2(&sam->str[i].grp_name, grp[i].name, len_sam_name+1, len_sam_name); + init_string2(&sam->str[i].grp_name, grp->name, len_sam_name+1, len_sam_name); } return NT_STATUS_OK; -- cgit From 90b6838751e3eb46394f8a60612a97acbf761538 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 2 Mar 2002 04:44:24 +0000 Subject: And a little more const. (This used to be commit 044391b5973f6070abf6ac185c74ffd713e933c5) --- source3/rpc_parse/parse_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 5865bd9f9b..afbdf6dc57 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -528,8 +528,8 @@ BOOL net_io_q_trust_dom(char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, i ********************************************************************/ void init_q_req_chal(NET_Q_REQ_CHAL *q_c, - char *logon_srv, char *logon_clnt, - DOM_CHAL *clnt_chal) + const char *logon_srv, const char *logon_clnt, + DOM_CHAL *clnt_chal) { DEBUG(5,("init_q_req_chal: %d\n", __LINE__)); @@ -666,7 +666,7 @@ BOOL net_io_r_auth(char *desc, NET_R_AUTH *r_a, prs_struct *ps, int depth) ********************************************************************/ void init_q_auth_2(NET_Q_AUTH_2 *q_a, - char *logon_srv, char *acct_name, uint16 sec_chan, char *comp_name, + const char *logon_srv, const char *acct_name, uint16 sec_chan, const char *comp_name, DOM_CHAL *clnt_chal, uint32 clnt_flgs) { DEBUG(5,("init_q_auth_2: %d\n", __LINE__)); -- cgit From f4f43fc9401a5c681ec7cd18564dbad3a1d8cd08 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 2 Mar 2002 09:15:56 +0000 Subject: more const (This used to be commit f0b16b7b515296d0e687e084564fe0718f189dc8) --- source3/rpc_parse/parse_misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index b716231569..73f285e320 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1154,8 +1154,8 @@ static BOOL smb_io_clnt_srv(char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int d Inits a DOM_LOG_INFO structure. ********************************************************************/ -void init_log_info(DOM_LOG_INFO *log, char *logon_srv, char *acct_name, - uint16 sec_chan, char *comp_name) +void init_log_info(DOM_LOG_INFO *log, const char *logon_srv, const char *acct_name, + uint16 sec_chan, const char *comp_name) { DEBUG(5,("make_log_info %d\n", __LINE__)); -- cgit From aa785249438587f32e129972c82096839f7ed798 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 5 Mar 2002 02:12:00 +0000 Subject: Fix the NTSTATUS -> WERROR for srvsvc pipe. Jeremy. (This used to be commit 2b85d3570c2b149049482c3878c50cf8f5bfca61) --- source3/rpc_parse/parse_srv.c | 74 ++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 36 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index c440309559..2e59389012 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1,5 +1,6 @@ /* - * Unix SMB/CIFS implementation. + * Unix SMB/Netbios implementation. + * Version 1.9. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, @@ -118,33 +119,34 @@ void init_srv_share_info2_str(SH_INFO_2_STR *sh2, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) +static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) { if (sh2 == NULL) return False; + if (UNMARSHALLING(ps)) + ZERO_STRUCTP(sh2); + prs_debug(ps, depth, desc, "srv_io_share_info2_str"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth)) - return False; + if (sh->ptr_netname) + if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth)) + return False; - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth)) - return False; + if (sh->ptr_remark) + if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth)) + return False; - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth)) - return False; + if (sh->ptr_netname) + if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth)) + return False; - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth)) - return False; + if (sh->ptr_passwd) + if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth)) + return False; return True; } @@ -494,7 +496,7 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct } for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info2_str("", &info2[i].info_2_str, ps, depth)) + if(!srv_io_share_info2_str("", &info2[i].info_2, &info2[i].info_2_str, ps, depth)) return False; } @@ -613,7 +615,7 @@ BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct * return False; if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) return False; - if(!prs_ntstatus("status ", ps, depth, &r_n->status)) + if(!prs_werror("status ", ps, depth, &r_n->status)) return False; return True; @@ -686,7 +688,7 @@ static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHA if(!srv_io_share_info2("", &r_n->share.info2.info_2, ps, depth)) return False; - if(!srv_io_share_info2_str("", &r_n->share.info2.info_2_str, ps, depth)) + if(!srv_io_share_info2_str("", &r_n->share.info2.info_2, &r_n->share.info2.info_2_str, ps, depth)) return False; break; @@ -738,7 +740,7 @@ BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_ if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_n->status)) + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; @@ -799,7 +801,7 @@ BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *q_n, prs_ if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) return False; - if(!prs_ntstatus("status ", ps, depth, &q_n->status)) + if(!prs_werror("status ", ps, depth, &q_n->status)) return False; return True; @@ -857,7 +859,7 @@ BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) return False; - if(!prs_ntstatus("status ", ps, depth, &q_n->status)) + if(!prs_werror("status ", ps, depth, &q_n->status)) return False; return True; @@ -904,7 +906,7 @@ BOOL srv_io_r_net_share_del(char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps if(!prs_align(ps)) return False; - if(!prs_ntstatus("status ", ps, depth, &q_n->status)) + if(!prs_werror("status ", ps, depth, &q_n->status)) return False; return True; @@ -1307,7 +1309,7 @@ BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps return False; if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) return False; - if(!prs_ntstatus("status ", ps, depth, &r_n->status)) + if(!prs_werror("status ", ps, depth, &r_n->status)) return False; return True; @@ -1672,7 +1674,7 @@ BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *p return False; if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) return False; - if(!prs_ntstatus("status ", ps, depth, &r_n->status)) + if(!prs_werror("status ", ps, depth, &r_n->status)) return False; return True; @@ -1950,7 +1952,7 @@ BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps return False; if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) return False; - if(!prs_ntstatus("status ", ps, depth, &r_n->status)) + if(!prs_werror("status ", ps, depth, &r_n->status)) return False; return True; @@ -2236,13 +2238,13 @@ BOOL srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_stru ********************************************************************/ void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv, - uint32 switch_value, SRV_INFO_CTR *ctr, NTSTATUS status) + uint32 switch_value, SRV_INFO_CTR *ctr, WERROR status) { DEBUG(5,("init_srv_r_net_srv_get_info\n")); srv->ctr = ctr; - if (NT_STATUS_IS_OK(status)) { + if (W_ERROR_IS_OK(status)) { srv->ctr->switch_value = switch_value; srv->ctr->ptr_srv_ctr = 1; } else { @@ -2258,7 +2260,7 @@ void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv, ********************************************************************/ void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv, - uint32 switch_value, NTSTATUS status) + uint32 switch_value, WERROR status) { DEBUG(5,("init_srv_r_net_srv_set_info\n")); @@ -2322,7 +2324,7 @@ BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_stru if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth)) return False; - if(!prs_ntstatus("status ", ps, depth, &r_n->status)) + if(!prs_werror("status ", ps, depth, &r_n->status)) return False; return True; @@ -2344,7 +2346,7 @@ BOOL srv_io_r_net_srv_set_info(char *desc, SRV_R_NET_SRV_SET_INFO *r_n, if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value)) return False; - if(!prs_ntstatus("status ", ps, depth, &r_n->status)) + if(!prs_werror("status ", ps, depth, &r_n->status)) return False; return True; @@ -2463,7 +2465,7 @@ BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct * if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth)) return False; - if(!prs_ntstatus("status ", ps, depth, &r_n->status)) + if(!prs_werror("status ", ps, depth, &r_n->status)) return False; return True; @@ -2562,7 +2564,7 @@ BOOL srv_io_r_net_disk_enum(char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) return False; - if(!prs_ntstatus("status", ps, depth, &r_n->status)) + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; @@ -2622,7 +2624,7 @@ BOOL srv_io_r_net_name_validate(char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_st if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_n->status)) + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; @@ -2709,7 +2711,7 @@ BOOL srv_io_r_net_file_query_secdesc(char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_n->status)) + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; @@ -2787,7 +2789,7 @@ BOOL srv_io_r_net_file_set_secdesc(char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_n->status)) + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; -- cgit From cfbbf736777aca366e388882a389a214b87ca612 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 10 Mar 2002 01:54:44 +0000 Subject: yipee! Finally put in the patch from Alexey Kotovich that adds the security decsriptor code for ADS workstation accounts thanks for your patience Cat, and thanks to Andrew Bartlett for extensive reviews and suggestions about this code. (This used to be commit 6891393b5db868246fe52ff62b3dc6aa5ca6f726) --- source3/rpc_parse/parse_sec.c | 266 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 243 insertions(+), 23 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 8237ccf95d..4f093b2422 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -23,8 +23,6 @@ #include "includes.h" -#define SD_HEADER_SIZE 0x14 - /******************************************************************* Sets up a SEC_ACCESS structure. ********************************************************************/ @@ -55,6 +53,35 @@ BOOL sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) return True; } +/******************************************************************* + Check if ACE has OBJECT type. +********************************************************************/ + +BOOL sec_ace_object(uint8 type) +{ + if (type == SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT || + type == SEC_ACE_TYPE_ACCESS_DENIED_OBJECT || + type == SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT || + type == SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT) { + return True; + } + return False; +} + +/******************************************************************* + copy a SEC_ACE structure. +********************************************************************/ +void sec_ace_copy(SEC_ACE *ace_dest, SEC_ACE *ace_src) +{ + ace_dest->type = ace_src->type; + ace_dest->flags = ace_src->flags; + ace_dest->size = ace_src->size; + ace_dest->info.mask = ace_src->info.mask; + ace_dest->obj_flags = ace_src->obj_flags; + memcpy(&ace_dest->obj_guid, &ace_src->obj_guid, GUID_SIZE); + memcpy(&ace_dest->inh_guid, &ace_src->inh_guid, GUID_SIZE); + sid_copy(&ace_dest->trustee, &ace_src->trustee); +} /******************************************************************* Sets up a SEC_ACE structure. @@ -106,15 +133,104 @@ BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth) if(!prs_align(ps)) return False; - if(!smb_io_dom_sid("trustee ", &psa->trustee , ps, depth)) - return False; + /* check whether object access is present */ + if (!sec_ace_object(psa->type)) { + if (!smb_io_dom_sid("trustee ", &psa->trustee , ps, depth)) + return False; + } else { + if (!prs_uint32("obj_flags", ps, depth, &psa->obj_flags)) + return False; + + if (psa->obj_flags & SEC_ACE_OBJECT_PRESENT) + if (!prs_uint8s(False, "obj_guid", ps, depth, psa->obj_guid.info, GUID_SIZE)) + return False; + + if (psa->obj_flags & SEC_ACE_OBJECT_INHERITED_PRESENT) + if (!prs_uint8s(False, "inh_guid", ps, depth, psa->inh_guid.info, GUID_SIZE)) + return False; + + if(!smb_io_dom_sid("trustee ", &psa->trustee , ps, depth)) + return False; + } if(!prs_uint16_post("size ", ps, depth, &psa->size, offset_ace_size, old_offset)) return False; - return True; } +/******************************************************************* + adds new SID with its permissions to ACE list +********************************************************************/ + +NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, size_t *num, DOM_SID *sid, uint32 mask) +{ + int i = 0; + + if (!ctx || !new || !old || !sid || !num) return NT_STATUS_INVALID_PARAMETER; + + *num += 1; + + if((new[0] = (SEC_ACE *) talloc_zero(ctx, *num * sizeof(SEC_ACE))) == 0) + return NT_STATUS_NO_MEMORY; + + for (i = 0; i < *num - 1; i ++) + sec_ace_copy(&(*new)[i], &old[i]); + + (*new)[i].type = 0; + (*new)[i].flags = 0; + (*new)[i].size = SEC_ACE_HEADER_SIZE + sid_size(sid); + (*new)[i].info.mask = mask; + sid_copy(&(*new)[i].trustee, sid); + return NT_STATUS_OK; +} + +/******************************************************************* + modify SID's permissions at ACL +********************************************************************/ + +NTSTATUS sec_ace_mod_sid(SEC_ACE *ace, size_t num, DOM_SID *sid, uint32 mask) +{ + int i = 0; + + if (!ace || !sid) return NT_STATUS_INVALID_PARAMETER; + + for (i = 0; i < num; i ++) { + if (sid_compare(&ace[i].trustee, sid) == 0) { + ace[i].info.mask = mask; + return NT_STATUS_OK; + } + } + return NT_STATUS_NOT_FOUND; +} + +/******************************************************************* + delete SID from ACL +********************************************************************/ + +NTSTATUS sec_ace_del_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, size_t *num, DOM_SID *sid) +{ + int i = 0; + int n_del = 0; + + if (!ctx || !new || !old || !sid || !num) return NT_STATUS_INVALID_PARAMETER; + + if((new[0] = (SEC_ACE *) talloc_zero(ctx, *num * sizeof(SEC_ACE))) == 0) + return NT_STATUS_NO_MEMORY; + + for (i = 0; i < *num; i ++) { + if (sid_compare(&old[i].trustee, sid) != 0) + sec_ace_copy(&(*new)[i], &old[i]); + else + n_del ++; + } + if (n_del == 0) + return NT_STATUS_NOT_FOUND; + else { + *num -= n_del; + return NT_STATUS_OK; + } +} + /******************************************************************* Create a SEC_ACL structure. ********************************************************************/ @@ -129,7 +245,7 @@ SEC_ACL *make_sec_acl(TALLOC_CTX *ctx, uint16 revision, int num_aces, SEC_ACE *a dst->revision = revision; dst->num_aces = num_aces; - dst->size = 8; + dst->size = SEC_ACL_HEADER_SIZE; /* Now we need to return a non-NULL address for the ace list even if the number of aces required is zero. This is because there @@ -244,7 +360,7 @@ size_t sec_desc_size(SEC_DESC *psd) if (!psd) return 0; - offset = SD_HEADER_SIZE; + offset = SEC_DESC_HEADER_SIZE; if (psd->owner_sid != NULL) offset += ((sid_size(psd->owner_sid) + 3) & ~3); @@ -482,7 +598,9 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, SEC_ACL *sacl, SEC_ACL *dacl, size_t *sd_size) { SEC_DESC *dst; - uint32 offset; + uint32 offset = 0; + uint32 offset_sid = SEC_DESC_HEADER_SIZE; + uint32 offset_acl = 0; *sd_size = 0; @@ -511,50 +629,58 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, if(dacl && ((dst->dacl = dup_sec_acl(ctx, dacl)) == NULL)) goto error_exit; - + offset = 0; /* * Work out the linearization sizes. */ - if (dst->owner_sid != NULL) { if (offset == 0) - offset = SD_HEADER_SIZE; + offset = SEC_DESC_HEADER_SIZE; - dst->off_owner_sid = offset; offset += ((sid_size(dst->owner_sid) + 3) & ~3); } if (dst->grp_sid != NULL) { if (offset == 0) - offset = SD_HEADER_SIZE; + offset = SEC_DESC_HEADER_SIZE; - dst->off_grp_sid = offset; offset += ((sid_size(dst->grp_sid) + 3) & ~3); } if (dst->sacl != NULL) { - if (offset == 0) - offset = SD_HEADER_SIZE; + offset_acl = SEC_DESC_HEADER_SIZE; - dst->off_sacl = offset; - offset += ((dst->sacl->size + 3) & ~3); + dst->off_sacl = offset_acl; + offset_acl += ((dst->sacl->size + 3) & ~3); + offset += dst->sacl->size; + offset_sid += dst->sacl->size; } if (dst->dacl != NULL) { - if (offset == 0) - offset = SD_HEADER_SIZE; + if (offset_acl == 0) + offset_acl = SEC_DESC_HEADER_SIZE; - dst->off_dacl = offset; - offset += ((dst->dacl->size + 3) & ~3); + dst->off_dacl = offset_acl; + offset_acl += ((dst->dacl->size + 3) & ~3); + offset += dst->dacl->size; + offset_sid += dst->dacl->size; } - *sd_size = (size_t)((offset == 0) ? SD_HEADER_SIZE : offset); + *sd_size = (size_t)((offset == 0) ? SEC_DESC_HEADER_SIZE : offset); + + dst->off_owner_sid = offset_sid; + + if (dst->owner_sid != NULL) + dst->off_grp_sid = offset_sid + sid_size(dst->owner_sid); + else + dst->off_grp_sid = offset_sid; + return dst; error_exit: @@ -599,6 +725,8 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) { uint32 old_offset; uint32 max_offset = 0; /* after we're done, move offset to end */ + uint32 tmp_offset = 0; + SEC_DESC *psd; if (ppsd == NULL) @@ -656,10 +784,15 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) return False; } + tmp_offset = ps->data_offset; + ps->data_offset = psd->off_owner_sid; + if(!smb_io_dom_sid("owner_sid ", psd->owner_sid , ps, depth)) return False; if(!prs_align(ps)) return False; + + ps->data_offset = tmp_offset; } max_offset = MAX(max_offset, prs_offset(ps)); @@ -674,10 +807,15 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) return False; } + tmp_offset = ps->data_offset; + ps->data_offset = psd->off_grp_sid; + if(!smb_io_dom_sid("grp_sid", psd->grp_sid, ps, depth)) return False; if(!prs_align(ps)) return False; + + ps->data_offset = tmp_offset; } max_offset = MAX(max_offset, prs_offset(ps)); @@ -803,3 +941,85 @@ BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth return True; } + +/******************************************************************* + adds new SID with its permissions to SEC_DESC +********************************************************************/ + +NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32 mask, size_t *sd_size) +{ + SEC_DESC *sd = 0; + SEC_ACL *dacl = 0; + SEC_ACE *ace = 0; + NTSTATUS status; + + *sd_size = 0; + + if (!ctx || !psd || !sid || !sd_size) return NT_STATUS_INVALID_PARAMETER; + + status = sec_ace_add_sid(ctx, &ace, psd[0]->dacl->ace, &psd[0]->dacl->num_aces, sid, mask); + + if (!NT_STATUS_IS_OK(status)) + return status; + + if (!(dacl = make_sec_acl(ctx, psd[0]->dacl->revision, psd[0]->dacl->num_aces, ace))) + return NT_STATUS_UNSUCCESSFUL; + + if (!(sd = make_sec_desc(ctx, psd[0]->revision, psd[0]->owner_sid, + psd[0]->grp_sid, psd[0]->sacl, dacl, sd_size))) + return NT_STATUS_UNSUCCESSFUL; + + *psd = sd; + sd = 0; + return NT_STATUS_OK; +} + +/******************************************************************* + modify SID's permissions at SEC_DESC +********************************************************************/ + +NTSTATUS sec_desc_mod_sid(SEC_DESC *sd, DOM_SID *sid, uint32 mask) +{ + NTSTATUS status; + + if (!sd || !sid) return NT_STATUS_INVALID_PARAMETER; + + status = sec_ace_mod_sid(sd->dacl->ace, sd->dacl->num_aces, sid, mask); + + if (!NT_STATUS_IS_OK(status)) + return status; + + return NT_STATUS_OK; +} + +/******************************************************************* + delete SID from SEC_DESC +********************************************************************/ + +NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t *sd_size) +{ + SEC_DESC *sd = 0; + SEC_ACL *dacl = 0; + SEC_ACE *ace = 0; + NTSTATUS status; + + *sd_size = 0; + + if (!ctx || !psd[0] || !sid || !sd_size) return NT_STATUS_INVALID_PARAMETER; + + status = sec_ace_del_sid(ctx, &ace, psd[0]->dacl->ace, &psd[0]->dacl->num_aces, sid); + + if (!NT_STATUS_IS_OK(status)) + return status; + + if (!(dacl = make_sec_acl(ctx, psd[0]->dacl->revision, psd[0]->dacl->num_aces, ace))) + return NT_STATUS_UNSUCCESSFUL; + + if (!(sd = make_sec_desc(ctx, psd[0]->revision, psd[0]->owner_sid, + psd[0]->grp_sid, psd[0]->sacl, dacl, sd_size))) + return NT_STATUS_UNSUCCESSFUL; + + *psd = sd; + sd = 0; + return NT_STATUS_OK; +} -- cgit From aad2072e07481da2f24ffb91454881c026840500 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 14 Mar 2002 02:48:03 +0000 Subject: Remove studly gaps from prs_werror() calls so the same debug text is logged. This makes it much easier to use grep on log files when searching for errors. (This used to be commit ab1ebd377931166f2ecded784a0182102d4c1ca2) --- source3/rpc_parse/parse_spoolss.c | 2 +- source3/rpc_parse/parse_srv.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b929369ec9..a37893db9b 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -952,7 +952,7 @@ BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_ if (!smb_io_pol_hnd("printer handle",&(r_u->handle),ps,depth)) return False; - if (!prs_werror("status code", ps, depth, &(r_u->status))) + if (!prs_werror("status", ps, depth, &(r_u->status))) return False; return True; diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 2e59389012..39f44318d6 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -615,7 +615,7 @@ BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct * return False; if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) return False; - if(!prs_werror("status ", ps, depth, &r_n->status)) + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; @@ -801,7 +801,7 @@ BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *q_n, prs_ if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) return False; - if(!prs_werror("status ", ps, depth, &q_n->status)) + if(!prs_werror("status", ps, depth, &q_n->status)) return False; return True; @@ -859,7 +859,7 @@ BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) return False; - if(!prs_werror("status ", ps, depth, &q_n->status)) + if(!prs_werror("status", ps, depth, &q_n->status)) return False; return True; @@ -906,7 +906,7 @@ BOOL srv_io_r_net_share_del(char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps if(!prs_align(ps)) return False; - if(!prs_werror("status ", ps, depth, &q_n->status)) + if(!prs_werror("status", ps, depth, &q_n->status)) return False; return True; @@ -1309,7 +1309,7 @@ BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps return False; if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) return False; - if(!prs_werror("status ", ps, depth, &r_n->status)) + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; @@ -1674,7 +1674,7 @@ BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *p return False; if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) return False; - if(!prs_werror("status ", ps, depth, &r_n->status)) + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; @@ -1952,7 +1952,7 @@ BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps return False; if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) return False; - if(!prs_werror("status ", ps, depth, &r_n->status)) + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; @@ -2324,7 +2324,7 @@ BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_stru if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth)) return False; - if(!prs_werror("status ", ps, depth, &r_n->status)) + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; @@ -2346,7 +2346,7 @@ BOOL srv_io_r_net_srv_set_info(char *desc, SRV_R_NET_SRV_SET_INFO *r_n, if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value)) return False; - if(!prs_werror("status ", ps, depth, &r_n->status)) + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; @@ -2465,7 +2465,7 @@ BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct * if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth)) return False; - if(!prs_werror("status ", ps, depth, &r_n->status)) + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; -- cgit From 65c007b583e2107f5ad1ba6733d3e578a143863e Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 15 Mar 2002 08:14:10 +0000 Subject: syncing up printing code with SAMBA_2_2 (already done some merges in the reverse). * add in new printer change notify code from SAMBA_2_2 * add in se_map_standard() from 2.2 in _spoolss_open_printer_ex() * sync up the _print_queue_struct in smb.h (why did someone change the user/file names in fs_user/fs_file (or vice-versa) ? ) * sync up some cli_spoolss_XXX functions (This used to be commit 5760315c1de4033fdc22684c940f18010010924f) --- source3/rpc_parse/parse_spoolss.c | 273 ++++++++++++++++++++++++++++++++------ 1 file changed, 232 insertions(+), 41 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index a37893db9b..17af8394d8 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -47,21 +47,21 @@ This should be moved in a more generic lib. static BOOL spoolss_io_system_time(char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) { - if(!prs_uint16("year", ps, depth, &(systime->year))) + if(!prs_uint16("year", ps, depth, &systime->year)) return False; - if(!prs_uint16("month", ps, depth, &(systime->month))) + if(!prs_uint16("month", ps, depth, &systime->month)) return False; - if(!prs_uint16("dayofweek", ps, depth, &(systime->dayofweek))) + if(!prs_uint16("dayofweek", ps, depth, &systime->dayofweek)) return False; - if(!prs_uint16("day", ps, depth, &(systime->day))) + if(!prs_uint16("day", ps, depth, &systime->day)) return False; - if(!prs_uint16("hour", ps, depth, &(systime->hour))) + if(!prs_uint16("hour", ps, depth, &systime->hour)) return False; - if(!prs_uint16("minute", ps, depth, &(systime->minute))) + if(!prs_uint16("minute", ps, depth, &systime->minute)) return False; - if(!prs_uint16("second", ps, depth, &(systime->second))) + if(!prs_uint16("second", ps, depth, &systime->second)) return False; - if(!prs_uint16("milliseconds", ps, depth, &(systime->milliseconds))) + if(!prs_uint16("milliseconds", ps, depth, &systime->milliseconds)) return False; return True; @@ -424,8 +424,13 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, return False; } } +#if 0 /* JERRY */ + + /* Win2k does not seem to put this parse align here */ + if(!prs_align(ps)) return False; +#endif return True; } @@ -820,11 +825,8 @@ BOOL make_spoolss_q_addprinterex( create a SPOOL_PRINTER_INFO_2 stuct from a PRINTER_INFO_2 struct *******************************************************************/ -BOOL make_spoolss_printer_info_2( - TALLOC_CTX *mem_ctx, - SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2, - PRINTER_INFO_2 *info -) +BOOL make_spoolss_printer_info_2(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2, + PRINTER_INFO_2 *info) { SPOOL_PRINTER_INFO_LEVEL_2 *inf; @@ -952,7 +954,7 @@ BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_ if (!smb_io_pol_hnd("printer handle",&(r_u->handle),ps,depth)) return False; - if (!prs_werror("status", ps, depth, &(r_u->status))) + if (!prs_werror("status code", ps, depth, &(r_u->status))) return False; return True; @@ -3648,40 +3650,28 @@ BOOL make_spoolss_q_getprinter( /******************************************************************* * init a structure. ********************************************************************/ -BOOL make_spoolss_q_setprinter( - TALLOC_CTX *mem_ctx, - SPOOL_Q_SETPRINTER *q_u, - const POLICY_HND *hnd, - uint32 level, - PRINTER_INFO_CTR *info, - uint32 command -) +BOOL make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, + const POLICY_HND *hnd, uint32 level, PRINTER_INFO_CTR *info, + uint32 command) { SEC_DESC *secdesc; DEVICEMODE *devmode; if (q_u == NULL) - { return False; - } memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); q_u->level = level; q_u->info.level = level; q_u->info.info_ptr = (info != NULL) ? 1 : 0; - switch (level) - { + switch (level) { case 2: secdesc = info->printers_2->secdesc; devmode = info->printers_2->devmode; - /* FIXMEE!! HACK ALERT!!! --jerry */ - info->printers_2->devmode = NULL; - info->printers_2->secdesc = NULL; - make_spoolss_printer_info_2 (mem_ctx, &q_u->info.info_2, info->printers_2); -#if 0 /* JERRY TEST */ +#if 1 /* JERRY TEST */ q_u->secdesc_ctr = (SEC_DESC_BUF*)malloc(sizeof(SEC_DESC_BUF)); if (!q_u->secdesc_ctr) return False; @@ -3691,7 +3681,7 @@ BOOL make_spoolss_q_setprinter( q_u->secdesc_ctr->sec = secdesc; q_u->devmode_ctr.devmode_ptr = (devmode != NULL) ? 1 : 0; - q_u->devmode_ctr.size = sizeof(DEVICEMODE) + (3*sizeof(uint32)); + q_u->devmode_ctr.size = (devmode != NULL) ? sizeof(DEVICEMODE) + (3*sizeof(uint32)) : 0; q_u->devmode_ctr.devmode = devmode; #else q_u->secdesc_ctr = NULL; @@ -3773,13 +3763,14 @@ BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps if (!sec_io_desc_buf(desc, &q_u->secdesc_ctr, ps, depth)) return False; } else { - uint32 dummy; + uint32 dummy = 0; /* Parse a NULL security descriptor. This should really happen inside the sec_io_desc_buf() function. */ prs_debug(ps, depth, "", "sec_io_desc_buf"); - if (!prs_uint32("size", ps, depth + 1, &dummy)) return False; + if (!prs_uint32("size", ps, depth + 1, &dummy)) + return False; if (!prs_uint32("ptr", ps, depth + 1, &dummy)) return False; } @@ -5655,6 +5646,24 @@ BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, return True; } +/******************************************************************* +********************************************************************/ +BOOL make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, TALLOC_CTX *ctx, const POLICY_HND *hnd, + char* value, char* data) +{ + UNISTR2 tmp; + + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + q_u->type = REG_SZ; + init_unistr2(&q_u->value, value, strlen(value)+1); + + init_unistr2(&tmp, data, strlen(data)+1); + q_u->max_len = q_u->real_len = tmp.uni_max_len*2; + q_u->data = talloc(ctx, q_u->real_len); + memcpy(q_u->data, tmp.buffer, q_u->real_len); + + return True; +} /******************************************************************* ********************************************************************/ @@ -5722,7 +5731,43 @@ BOOL spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_st /******************************************************************* ********************************************************************/ +BOOL spoolss_io_q_resetprinter(char *desc, SPOOL_Q_RESETPRINTER *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_resetprinter"); + depth++; + + if (!prs_align(ps)) + return False; + if (!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) + return False; + if (!prs_uint32("unknown1", ps, depth, &q_u->unknown1)) + return False; + + if (!spoolss_io_devmode_cont(desc, &q_u->devmode_ctr, ps, depth)) + return False; + + return True; +} + + +/******************************************************************* +********************************************************************/ +BOOL spoolss_io_r_resetprinter(char *desc, SPOOL_R_RESETPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_resetprinter"); + depth++; + + if(!prs_align(ps)) + return False; + if(!prs_werror("status", ps, depth, &r_u->status)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ BOOL convert_specific_param(NT_PRINTER_PARAM **param, const UNISTR2 *value, uint32 type, const uint8 *data, uint32 len) { @@ -5832,7 +5877,7 @@ BOOL spoolss_io_r_deleteform(char *desc, SPOOL_R_DELETEFORM *r_u, prs_struct *ps BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth) { - uint32 useless_ptr=1; + uint32 useless_ptr=0; prs_debug(ps, depth, desc, "spoolss_io_q_addform"); depth++; @@ -5877,7 +5922,7 @@ BOOL spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int BOOL spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth) { - uint32 useless_ptr=1; + uint32 useless_ptr=0; prs_debug(ps, depth, desc, "spoolss_io_q_setform"); depth++; @@ -6097,6 +6142,73 @@ BOOL spoolss_io_r_replyopenprinter(char *desc, SPOOL_R_REPLYOPENPRINTER *r_u, pr return True; } +/******************************************************************* + * init a structure. + ********************************************************************/ +BOOL make_spoolss_q_routerreplyprinter(SPOOL_Q_ROUTERREPLYPRINTER *q_u, POLICY_HND *hnd, + uint32 condition, uint32 change_id) +{ + + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + + q_u->condition = condition; + q_u->change_id = change_id; + + /* magic values */ + q_u->unknown1 = 0x1; + memset(q_u->unknown2, 0x0, 5); + q_u->unknown2[0] = 0x1; + + return True; +} + +/******************************************************************* + Parse a SPOOL_Q_ROUTERREPLYPRINTER structure. +********************************************************************/ +BOOL spoolss_io_q_routerreplyprinter (char *desc, SPOOL_Q_ROUTERREPLYPRINTER *q_u, prs_struct *ps, int depth) +{ + + prs_debug(ps, depth, desc, "spoolss_io_q_routerreplyprinter"); + depth++; + + if (!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) + return False; + + if (!prs_uint32("condition", ps, depth, &q_u->condition)) + return False; + + if (!prs_uint32("unknown1", ps, depth, &q_u->unknown1)) + return False; + + if (!prs_uint32("change_id", ps, depth, &q_u->change_id)) + return False; + + if (!prs_uint8s(False, "private", ps, depth, q_u->unknown2, 5)) + return False; + + return True; +} + +/******************************************************************* + Parse a SPOOL_R_ROUTERREPLYPRINTER structure. +********************************************************************/ +BOOL spoolss_io_r_routerreplyprinter (char *desc, SPOOL_R_ROUTERREPLYPRINTER *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_routerreplyprinter"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_werror("status", ps, depth, &r_u->status)) + return False; + + return True; +} + /******************************************************************* * init a structure. ********************************************************************/ @@ -6150,12 +6262,79 @@ BOOL spoolss_io_r_replycloseprinter(char *desc, SPOOL_R_REPLYCLOSEPRINTER *r_u, return True; } +#if 0 /* JERRY - not currently used but could be :-) */ + +/******************************************************************* + Deep copy a SPOOL_NOTIFY_INFO_DATA structure + ******************************************************************/ +static BOOL copy_spool_notify_info_data(SPOOL_NOTIFY_INFO_DATA *dst, + SPOOL_NOTIFY_INFO_DATA *src, int n) +{ + int i; + + memcpy(dst, src, sizeof(SPOOL_NOTIFY_INFO_DATA)*n); + + for (i=0; isize != POINTER) + continue; + len = src->notify_data.data.length; + s = malloc(sizeof(uint16)*len); + if (s == NULL) { + DEBUG(0,("copy_spool_notify_info_data: malloc() failed!\n")); + return False; + } + + memcpy(s, src->notify_data.data.string, len*2); + dst->notify_data.data.string = s; + } + + return True; +} + +/******************************************************************* + Deep copy a SPOOL_NOTIFY_INFO structure + ******************************************************************/ +static BOOL copy_spool_notify_info(SPOOL_NOTIFY_INFO *dst, SPOOL_NOTIFY_INFO *src) +{ + if (!dst) { + DEBUG(0,("copy_spool_notify_info: NULL destination pointer!\n")); + return False; + } + + dst->version = src->version; + dst->flags = src->flags; + dst->count = src->count; + + if (dst->count) + { + dst->data = malloc(dst->count * sizeof(SPOOL_NOTIFY_INFO_DATA)); + + DEBUG(10,("copy_spool_notify_info: allocating space for [%d] PRINTER_NOTIFY_INFO_DATA entries\n", + dst->count)); + + if (dst->data == NULL) { + DEBUG(0,("copy_spool_notify_info: malloc() failed for [%d] entries!\n", + dst->count)); + return False; + } + + return (copy_spool_notify_info_data(dst->data, src->data, src->count)); + } + + return True; +} +#endif /* JERRY */ + /******************************************************************* * init a structure. ********************************************************************/ BOOL make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd, - uint32 change_low, uint32 change_high) + uint32 change_low, uint32 change_high, + SPOOL_NOTIFY_INFO *info) { if (q_u == NULL) return False; @@ -6168,11 +6347,23 @@ BOOL make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd, q_u->unknown0=0x0; q_u->unknown1=0x0; - q_u->info_ptr=1; + q_u->info_ptr=0xaddee11e; q_u->info.version=2; + + if (info->count) { + DEBUG(10,("make_spoolss_q_reply_rrpcn: [%d] PRINTER_NOTIFY_INFO_DATA\n", + info->count)); + q_u->info.version = info->version; + q_u->info.flags = info->flags; + q_u->info.count = info->count; + /* pointer field - be careful! */ + q_u->info.data = info->data; + } + else { q_u->info.flags=PRINTER_NOTIFY_INFO_DISCARDED; q_u->info.count=0; + } return True; } @@ -6220,7 +6411,7 @@ BOOL spoolss_io_q_reply_rrpcn(char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct * BOOL spoolss_io_r_reply_rrpcn(char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, "spoolss_io_r_replycloseprinter"); + prs_debug(ps, depth, desc, "spoolss_io_r_reply_rrpcn"); depth++; if (!prs_align(ps)) @@ -6473,7 +6664,8 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, if (!prs_uint32("size", ps, depth, &ctr->size)) return False; - /* offset data begins at 20 bytes per structure * size_of_array. */ + /* offset data begins at 20 bytes per structure * size_of_array. + Don't forget the uint32 at the beginning */ current_offset = basic_unit * ctr->size_of_array; @@ -6499,7 +6691,6 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, return False; current_offset = data_offset + ctr->values[i].data_len - basic_unit; - } /* loop #2 for writing the dynamically size objects -- cgit From ab13654dc9ac23872e4d1384e1c54e336f113009 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sun, 17 Mar 2002 04:36:35 +0000 Subject: Renamed get_nt_error_msg() to nt_errstr(). (This used to be commit 1f007d3ed41c1b71a89fa6be7d173e67e927c302) --- source3/rpc_parse/parse_prs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 2deefd362a..5d06cf7a7e 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -603,7 +603,7 @@ BOOL prs_ntstatus(char *name, prs_struct *ps, int depth, NTSTATUS *status) } DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name, - get_nt_error_msg(*status))); + nt_errstr(*status))); ps->data_offset += sizeof(uint32); -- cgit From a4cce223d6873400b053872a6e3b2eb8621eea45 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sun, 17 Mar 2002 06:04:15 +0000 Subject: Added dos_errstr() function. Not all errors in list yet. (This used to be commit ddb5753e36b8c5efb48ce5c82c16d970fb8e76b6) --- source3/rpc_parse/parse_prs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 5d06cf7a7e..6d65d5cc7f 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -633,7 +633,7 @@ BOOL prs_werror(char *name, prs_struct *ps, int depth, WERROR *status) } DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name, - werror_str(*status))); + dos_errstr(*status))); ps->data_offset += sizeof(uint32); -- cgit From 3fe771654b28898cb5fabb9ab305c3a10145c49d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 20 Mar 2002 00:49:44 +0000 Subject: Fix for debug typo. (This used to be commit 5b43519219991fe14c8ce1993c16557bf5ceccb4) --- source3/rpc_parse/parse_samr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 32d107c36c..4edc0678af 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5610,7 +5610,7 @@ static BOOL sam_io_user_info25(char *desc, SAM_USER_INFO_25 * usr, prs_struct *p if (usr == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_user_info23"); + prs_debug(ps, depth, desc, "sam_io_user_info25"); depth++; if(!prs_align(ps)) -- cgit From 826f3fb86b954b29b4f152d8785860a227798975 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 20 Mar 2002 03:37:27 +0000 Subject: resetprinter merge from SAMBA_2_2 (This used to be commit 88d8897e21749f177952b264031aa386bbbeaaeb) --- source3/rpc_parse/parse_spoolss.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 17af8394d8..97e2020a3e 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4,7 +4,7 @@ * Copyright (C) Andrew Tridgell 1992-2000, * Copyright (C) Luke Kenneth Casson Leighton 1996-2000, * Copyright (C) Jean Franois Micouleau 1998-2000, - * Copyright (C) Gerald Carter 2000, + * Copyright (C) Gerald Carter 2000-2002 * Copyright (C) Tim Potter 2001. * * This program is free software; you can redistribute it and/or modify @@ -4913,12 +4913,9 @@ BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LE init a SPOOL_Q_ADDPRINTERDRIVER struct ******************************************************************/ -BOOL make_spoolss_q_addprinterdriver( - TALLOC_CTX *mem_ctx, - SPOOL_Q_ADDPRINTERDRIVER *q_u, - const char* srv_name, - uint32 level, - PRINTER_DRIVER_CTR *info) +BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx, + SPOOL_Q_ADDPRINTERDRIVER *q_u, const char* srv_name, + uint32 level, PRINTER_DRIVER_CTR *info) { DEBUG(5,("make_spoolss_q_addprinterdriver\n")); @@ -4949,11 +4946,9 @@ BOOL make_spoolss_q_addprinterdriver( return True; } -BOOL make_spoolss_driver_info_3( - TALLOC_CTX *mem_ctx, +BOOL make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **spool_drv_info, - DRIVER_INFO_3 *info3 -) + DRIVER_INFO_3 *info3) { uint32 len = 0; uint16 *ptr = info3->dependentfiles; @@ -5741,8 +5736,13 @@ BOOL spoolss_io_q_resetprinter(char *desc, SPOOL_Q_RESETPRINTER *q_u, prs_struct if (!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) return False; - if (!prs_uint32("unknown1", ps, depth, &q_u->unknown1)) + if (!prs_uint32("datatype_ptr", ps, depth, &q_u->datatype_ptr)) + return False; + + if (q_u->datatype_ptr) { + if (!smb_io_unistr2("datatype", &q_u->datatype, q_u->datatype_ptr?True:False, ps, depth)) return False; + } if (!spoolss_io_devmode_cont(desc, &q_u->devmode_ctr, ps, depth)) return False; -- cgit From ce236d1dbf2673e2ff921683554cee41fca33249 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 22 Mar 2002 06:24:38 +0000 Subject: Stomped on some header file version numbers that have crept back in. (This used to be commit e66bdf1229ba84f64c19e817e2c4081dbbf0bee8) --- source3/rpc_parse/parse_srv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 39f44318d6..f94c51bfa0 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1,6 +1,5 @@ /* - * Unix SMB/Netbios implementation. - * Version 1.9. + * Unix SMB/CIFS implementation. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, -- cgit From 737423f06ea08c38592b408faa12a55a95b9d696 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 26 Mar 2002 03:15:30 +0000 Subject: OpenPrinter() merge from 2.2 (This used to be commit 619397cc90549d4602ecddc25ee50eb247c913ee) --- source3/rpc_parse/parse_spoolss.c | 95 +++++++++++++++++++++++++++++++-------- 1 file changed, 76 insertions(+), 19 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 97e2020a3e..5c2dd6b48f 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -880,12 +880,12 @@ BOOL make_spoolss_printer_info_2(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_2 * called from spoolss_q_open_printer_ex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_open_printer(char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "spoolss_io_q_open_printer_ex"); + prs_debug(ps, depth, desc, "spoolss_io_q_open_printer"); depth++; if (!prs_align(ps)) @@ -902,35 +902,66 @@ BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_ if (!spoolss_io_printer_default("", &q_u->printer_default, ps, depth)) return False; - if (!prs_uint32("user_switch", ps, depth, &q_u->user_switch)) + return True; +} + +/******************************************************************* + * write a structure. + * called from static spoolss_r_open_printer_ex (srv_spoolss.c) + * called from spoolss_open_printer_ex (cli_spoolss.c) + ********************************************************************/ + +BOOL spoolss_io_r_open_printer(char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_r_open_printer"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!smb_io_pol_hnd("printer handle",&(r_u->handle),ps,depth)) return False; - if (!spool_io_user_level("", &q_u->user_ctr, ps, depth)) + + if (!prs_werror("status code", ps, depth, &(r_u->status))) return False; return True; } + /******************************************************************* - * init a structure. + * read a structure. + * called from spoolss_q_open_printer_ex (srv_spoolss.c) ********************************************************************/ -BOOL make_spoolss_q_deleteprinterdriver( - TALLOC_CTX *mem_ctx, - SPOOL_Q_DELETEPRINTERDRIVER *q_u, - const char *server, - const char* arch, - const char* driver -) + +BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_struct *ps, int depth) { - DEBUG(5,("make_spoolss_q_deleteprinterdriver\n")); + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_open_printer_ex"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("printername_ptr", ps, depth, &q_u->printername_ptr)) + return False; + if (!smb_io_unistr2("", &q_u->printername, q_u->printername_ptr, ps,depth)) + return False; - q_u->server_ptr = (server!=NULL)?1:0; + if (!prs_align(ps)) + return False; - /* these must be NULL terminated or else NT4 will - complain about invalid parameters --jerry */ - init_unistr2(&q_u->server, server, strlen(server)+1); - init_unistr2(&q_u->arch, arch, strlen(arch)+1); - init_unistr2(&q_u->driver, driver, strlen(driver)+1); + if (!spoolss_io_printer_default("", &q_u->printer_default, ps, depth)) + return False; + if (!prs_uint32("user_switch", ps, depth, &q_u->user_switch)) + return False; + if (!spool_io_user_level("", &q_u->user_ctr, ps, depth)) + return False; return True; } @@ -960,6 +991,32 @@ BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_ return True; } +/******************************************************************* + * init a structure. + ********************************************************************/ +BOOL make_spoolss_q_deleteprinterdriver( + TALLOC_CTX *mem_ctx, + SPOOL_Q_DELETEPRINTERDRIVER *q_u, + const char *server, + const char* arch, + const char* driver +) +{ + DEBUG(5,("make_spoolss_q_deleteprinterdriver\n")); + + q_u->server_ptr = (server!=NULL)?1:0; + + /* these must be NULL terminated or else NT4 will + complain about invalid parameters --jerry */ + init_unistr2(&q_u->server, server, strlen(server)+1); + init_unistr2(&q_u->arch, arch, strlen(arch)+1); + init_unistr2(&q_u->driver, driver, strlen(driver)+1); + + + return True; +} + + /******************************************************************* * make a structure. ********************************************************************/ -- cgit From adc57a79d99cfb6e0f5a1ba94275bb40eeb95bb7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 4 Apr 2002 02:39:57 +0000 Subject: Fixed the handle leak in the connection management code (this code is crap and should be rewritten, just not now... :-). Jeremy. (This used to be commit 5de792e7e9c2ad1422ac146caba632baa3f4e5c5) --- source3/rpc_parse/parse_lsa.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index fd82325be7..91b54b9c83 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2094,4 +2094,10 @@ BOOL lsa_io_r_removeprivs(char *desc, LSA_R_REMOVEPRIVS *r_c, prs_struct *ps, in 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 ); +} -- cgit From b408c4c5c0412eeb04d78ab943b65af096f4174f Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 9 Apr 2002 03:36:12 +0000 Subject: The useless_ptr must be non-zero for addform and setform client functions to work. Note about setprinter level 1 not existing. (This used to be commit 6367bfc4781a678923f1fba4681c9b7fc6bb9710) --- source3/rpc_parse/parse_spoolss.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 5c2dd6b48f..6da0c5636c 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3723,6 +3723,9 @@ BOOL make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, q_u->info.level = level; q_u->info.info_ptr = (info != NULL) ? 1 : 0; switch (level) { + + /* There's no such thing as a setprinter level 1 */ + case 2: secdesc = info->printers_2->secdesc; devmode = info->printers_2->devmode; @@ -5934,7 +5937,7 @@ BOOL spoolss_io_r_deleteform(char *desc, SPOOL_R_DELETEFORM *r_u, prs_struct *ps BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth) { - uint32 useless_ptr=0; + uint32 useless_ptr=1; prs_debug(ps, depth, desc, "spoolss_io_q_addform"); depth++; @@ -5979,7 +5982,7 @@ BOOL spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int BOOL spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth) { - uint32 useless_ptr=0; + uint32 useless_ptr=1; prs_debug(ps, depth, desc, "spoolss_io_q_setform"); depth++; -- cgit From 4ad0ff29bf44e2506311f672bf912e7a2d39048a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 10 Apr 2002 01:04:13 +0000 Subject: Added Shirish's client side caching policy change. Jeremy. (This used to be commit 16015c07eab2e57fa3771051e3e08fde21757cfa) --- source3/rpc_parse/parse_srv.c | 114 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index f94c51bfa0..9c9d5f1e9c 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -207,6 +207,87 @@ static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int d return True; } +/******************************************************************* + Inits a SH_INFO_2 structure +*******************************************************************/ + +void init_srv_share_info501(SH_INFO_501 *sh501, char *net_name, uint32 type, char *remark, uint32 csc_policy) +{ + DEBUG(5,("init_srv_share_info501: %s %8x %s %08x\n", net_name, type, + remark, csc_policy)); + + ZERO_STRUCTP(sh501); + + sh501->ptr_netname = (net_name != NULL) ? 1 : 0; + sh501->type = type; + sh501->ptr_remark = (remark != NULL) ? 1 : 0; + sh501->csc_policy = csc_policy; +} + +/******************************************************************* + Reads of writes a structure. +*******************************************************************/ + +static BOOL srv_io_share_info501(char *desc, SH_INFO_501 *sh501, prs_struct *ps, int depth) +{ + if (sh501 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info501"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("ptr_netname", ps, depth, &sh501->ptr_netname)) + return False; + if (!prs_uint32("type ", ps, depth, &sh501->type)) + return False; + if (!prs_uint32("ptr_remark ", ps, depth, &sh501->ptr_remark)) + return False; + if (!prs_uint32("csc_policy ", ps, depth, &sh501->csc_policy)) + return False; + + return True; +} + +/******************************************************************** + Inits a SH_INFO_501_STR structure +********************************************************************/ + +void init_srv_share_info501_str(SH_INFO_501_STR *sh501, char *net_name, char *remark) +{ + DEBUG(5,("init_srv_share_info501_str\n")); + + init_unistr2(&sh501->uni_netname, net_name, strlen(net_name)+1); + init_unistr2(&sh501->uni_remark, remark, strlen(remark)+1); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info501_str(char *desc, SH_INFO_501_STR *sh501, prs_struct *ps, int depth) +{ + if (sh501 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info501_str"); + depth++; + + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("", &sh501->uni_netname, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("", &sh501->uni_remark, True, ps, depth)) + return False; + + return True; +} + /******************************************************************* Inits a SH_INFO_502 structure ********************************************************************/ @@ -502,6 +583,32 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct break; } + case 501: + { + SRV_SHARE_INFO_501 *info501 = ctr->share.info501; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps)) { + if (!(info501 = (SRV_SHARE_INFO_501 *) prs_alloc_mem(ps, num_entries * + sizeof (SRV_SHARE_INFO_501)))) + return False; + ctr->share.info501 = info501; + } + + for (i = 0; i < num_entries; i++) { + if (!srv_io_share_info501("", &info501[i].info_501, ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + if (!srv_io_share_info501_str("", &info501[i].info_501_str, ps, depth)) + return False; + } + + break; + } + case 502: { SRV_SHARE_INFO_502 *info502 = ctr->share.info502; @@ -691,6 +798,13 @@ static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHA return False; break; + case 501: + if (!srv_io_share_info501("", &r_n->share.info501.info_501, ps, depth)) + return False; + if (!srv_io_share_info501_str("", &r_n->share.info501.info_501_str, ps, depth)) + return False; + break; + case 502: if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth)) return False; -- cgit From b99d3f27df6c8148ecb007473b1a4ba69ece9cf4 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 10 Apr 2002 07:21:03 +0000 Subject: Fixed missing alignment in spoolss_io_q_enumjobs() function. (This used to be commit e878cdc9f59084f39c022f2faa140369f76e94ec) --- source3/rpc_parse/parse_spoolss.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 6da0c5636c..a995375cfe 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4007,6 +4007,9 @@ BOOL spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, in if (!spoolss_io_buffer("", ps, depth, &q_u->buffer)) return False; + if(!prs_align(ps)) + return False; + if (!prs_uint32("offered", ps, depth, &q_u->offered)) return False; -- cgit From b40e73e2ca520eaeb3f3751fab31be669f287938 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 11 Apr 2002 01:48:38 +0000 Subject: specversion merge from SAMBA_2_2 (This used to be commit d87aa35d482824df7b5a2e87240ae43c113cc730) --- source3/rpc_parse/parse_spoolss.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index a995375cfe..1cbb97c337 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -616,6 +616,21 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo return False; if (!prs_uint32("displayfrequency", ps, depth, &devmode->displayfrequency)) return False; + + /* + * Conditional parsing. Assume that the DeviceMode has been + * zero'd by the caller. + */ + switch(devmode->specversion) { + + /* Used by spooler when issuing OpenPrinter() calls. NT 3.5x? */ + case 0x0320: + break; + + /* See the comments on the DEVMODE in the msdn GDI documentation */ + /* (WINVER >= 0x0400) */ + case 0x0400: + case 0x0401: if (!prs_uint32("icmmethod", ps, depth, &devmode->icmmethod)) return False; if (!prs_uint32("icmintent", ps, depth, &devmode->icmintent)) @@ -628,10 +643,22 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo return False; if (!prs_uint32("reserved2", ps, depth, &devmode->reserved2)) return False; + + /* (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400) */ + if (devmode->specversion == 0x401) { if (!prs_uint32("panningwidth", ps, depth, &devmode->panningwidth)) return False; if (!prs_uint32("panningheight", ps, depth, &devmode->panningheight)) return False; + } + break; + + /* log an error if we see something else */ + default: + DEBUG(0,("spoolss_io_devmode: Unknown specversion [0x%x]!\n", devmode->specversion)); + DEBUG(0,("spoolss_io_devmode: Please report to samba-technical@samba.org\n")); + break; + } if (devmode->driverextra!=0) { if (UNMARSHALLING(ps)) { -- cgit From 440a0099ea30fbf47ad2be2f014a4a1df1eaf783 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 11 Apr 2002 18:52:09 +0000 Subject: HP2500C driver writes devmode with private data that ends on a 2 byte boundary. We then miss-parse the desired_access. Also added other fixes to ensure we align after private data (discussed with Gerry). Jeremy. (This used to be commit 4369a58765f382e118e5393c805336484671cbf9) --- source3/rpc_parse/parse_spoolss.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 1cbb97c337..b74ee3c5c5 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -746,6 +746,9 @@ static BOOL spoolss_io_printer_default(char *desc, PRINTER_DEFAULT *pd, prs_stru if (!spoolss_io_devmode_cont("", &pd->devmode_cont, ps, depth)) return False; + if (!prs_align(ps)) + return False; + if (!prs_uint32("access_required", ps, depth, &pd->access_required)) return False; @@ -3832,6 +3835,9 @@ BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps if (!spoolss_io_devmode_cont(desc, &q_u->devmode_ctr, ps, depth)) return False; + if(!prs_align(ps)) + return False; + switch (q_u->level) { case 2: @@ -4623,6 +4629,9 @@ BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct if (!spoolss_io_devmode_cont(desc, &q_u->devmode_ctr, ps, depth)) return False; + if(!prs_align(ps)) + return False; + switch (q_u->level) { case 2: ptr_sec_desc = q_u->info.info_2->secdesc_ptr; -- cgit From 07e6ff5fcfe337bb65a7c3a4493a92a7761cf2ed Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 14 Apr 2002 09:44:16 +0000 Subject: Partly based on the work by mimir (Rafal Szczesniak ) this patch allows samba to correctly enumerate its trusted domains - by exaimining the keys in the secrets.tdb file. This patch has been tested with both NT4 and rpcclient/wbinfo, and adds some extra functionality to talloc and rpc_parse to allow it to deal with already unicode strings. Finally, this cleans up some const warnings that were in net_rpc.c by pushing another dash of const into the rpc client code. Andrew Bartlett (This used to be commit 0bdd94cb992b40942aaf2e5e0efd2868b4686296) --- source3/rpc_parse/parse_lsa.c | 76 +++++++++++++++++++++++++++--------------- source3/rpc_parse/parse_misc.c | 45 +++++++++++++++++++++++++ source3/rpc_parse/parse_samr.c | 2 +- 3 files changed, 96 insertions(+), 27 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 91b54b9c83..415737ebfb 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -4,6 +4,7 @@ * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997. + * Copyright (C) Andrew Bartlett 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 @@ -523,40 +524,63 @@ BOOL lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, Inits an LSA_R_ENUM_TRUST_DOM structure. ********************************************************************/ -void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context, - char *domain_name, DOM_SID *domain_sid, - NTSTATUS status) +void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context, + uint32 requested_num_domains, uint32 num_domains, TRUSTDOM **td) { + int i; + DEBUG(5, ("init_r_enum_trust_dom\n")); r_e->enum_context = enum_context; - - if (NT_STATUS_IS_OK(status)) { - int len_domain_name = strlen(domain_name) + 1; - - r_e->num_domains = 1; - r_e->ptr_enum_domains = 1; - r_e->num_domains2 = 1; - - if (!(r_e->hdr_domain_name = (UNIHDR2 *)talloc(ctx,sizeof(UNIHDR2)))) - return; + r_e->num_domains = 0; + r_e->ptr_enum_domains = 0; + r_e->num_domains2 = 0; + + if (num_domains == 0) { + r_e->status = NT_STATUS_NO_MORE_ENTRIES; - if (!(r_e->uni_domain_name = (UNISTR2 *)talloc(ctx,sizeof(UNISTR2)))) + } else { + /* + * allocating empty arrays of unicode headers, strings + * and sids of enumerated trusted domains + */ + if (!(r_e->hdr_domain_name = (UNIHDR2 *)talloc(ctx,sizeof(UNIHDR2) * num_domains))) { + r_e->status = NT_STATUS_NO_MEMORY; return; + } + + if (!(r_e->uni_domain_name = (UNISTR2 *)talloc(ctx,sizeof(UNISTR2) * num_domains))) { + r_e->status = NT_STATUS_NO_MEMORY; + return; + } - if (!(r_e->domain_sid = (DOM_SID2 *)talloc(ctx,sizeof(DOM_SID2)))) + if (!(r_e->domain_sid = (DOM_SID2 *)talloc(ctx,sizeof(DOM_SID2) * num_domains))) { + r_e->status = NT_STATUS_NO_MEMORY; return; + } + + r_e->num_domains = num_domains; + r_e->num_domains2 = num_domains; + + for (i = 0; i < num_domains; i++) { + + /* don't know what actually is this for */ + r_e->ptr_enum_domains = 1; + + init_uni_hdr2(&r_e->hdr_domain_name[i], strlen_w((td[i])->name)); + init_dom_sid2(&r_e->domain_sid[i], &(td[i])->sid); + + init_unistr2_w(ctx, &r_e->uni_domain_name[i], (td[i])->name); + + }; + + if (num_domains < requested_num_domains) { + r_e->status = NT_STATUS_NO_MORE_ENTRIES; + } else { + r_e->status = NT_STATUS_OK; + } + } - init_uni_hdr2(&r_e->hdr_domain_name[0], len_domain_name); - init_unistr2 (&r_e->uni_domain_name[0], domain_name, - len_domain_name); - init_dom_sid2(&r_e->domain_sid[0], domain_sid); - } else { - r_e->num_domains = 0; - r_e->ptr_enum_domains = 0; - } - - r_e->status = status; } /******************************************************************* @@ -603,7 +627,7 @@ BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, for (i = 0; i < num_domains; i++) { if(!smb_io_unistr2 ("", &r_e->uni_domain_name[i], - r_e->hdr_domain_name[i].buffer, + r_e->hdr_domain_name[i].buffer, ps, depth)) return False; if(!smb_io_dom_sid2("", &r_e->domain_sid[i], ps, diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 73f285e320..f326681c64 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -916,6 +916,51 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len) rpcstr_push((char *)str->buffer, buf, len, STR_TERMINATE); } +/** + * Inits a UNISTR2 structure. + * @param ctx talloc context to allocate string on + * @param str pointer to string to create + * @param buf UCS2 null-terminated buffer to init from +*/ + +void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) +{ + uint32 len = strlen_w(buf); + uint32 max_len = len; + uint32 alloc_len; + + ZERO_STRUCTP(str); + + /* set up string lengths. */ + str->uni_max_len = len; + str->undoc = 0; + str->uni_str_len = len; + + if (max_len < MAX_UNISTRLEN) + max_len = MAX_UNISTRLEN; + + alloc_len = (max_len + 1) * sizeof(uint16); + + str->buffer = (uint16 *)talloc_zero(ctx, alloc_len); + if ((str->buffer == NULL) && (alloc_len > 0)) + { + smb_panic("init_unistr2_w: malloc fail\n"); + return; + } + + /* + * don't move this test above ! The UNISTR2 must be initialized !!! + * jfm, 7/7/2001. + */ + if (buf==NULL) + return; + + /* Yes, this is a strncpy( foo, bar, strlen(bar)) - but as + long as the buffer above is talloc()ed correctly then this + is the correct thing to do */ + strncpy_w(str->buffer, buf, len + 1); +} + /******************************************************************* Inits a UNISTR2 structure from a UNISTR ********************************************************************/ diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 4edc0678af..b8a558665f 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4535,7 +4535,7 @@ 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, char **name) + uint32 num_names, const char **name) { uint32 i; -- cgit From dde9187728936df5825cf19bda74fce1185ffb21 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 22 Apr 2002 18:47:36 +0000 Subject: merge from SAMBA_2_2 (This used to be commit 5e381abbbfaa15f3ebd89cba3cd9bb6de8e4ff4e) --- source3/rpc_parse/parse_spoolss.c | 61 ++++++++++++--------------------------- 1 file changed, 19 insertions(+), 42 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b74ee3c5c5..e9f0ca858a 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -628,7 +628,6 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo break; /* See the comments on the DEVMODE in the msdn GDI documentation */ - /* (WINVER >= 0x0400) */ case 0x0400: case 0x0401: if (!prs_uint32("icmmethod", ps, depth, &devmode->icmmethod)) @@ -643,14 +642,10 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo return False; if (!prs_uint32("reserved2", ps, depth, &devmode->reserved2)) return False; - - /* (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400) */ - if (devmode->specversion == 0x401) { if (!prs_uint32("panningwidth", ps, depth, &devmode->panningwidth)) return False; if (!prs_uint32("panningheight", ps, depth, &devmode->panningheight)) return False; - } break; /* log an error if we see something else */ @@ -1726,12 +1721,19 @@ static uint32 size_of_relative_string(UNISTR *string) uint32 size=0; size=str_len_uni(string); /* the string length */ - size=size+1; /* add the leading zero */ + size=size+1; /* add the trailing zero */ size=size*2; /* convert in char */ - /* Ensure size is 4 byte multiple (prs_align is being called...). */ - size += ((4 - (size & 3)) & 3); size=size+4; /* add the size of the ptr */ +#if 0 /* JERRY */ + /* + * Do not include alignment as Win2k does not align relative + * strings within a buffer --jerry + */ + /* Ensure size is 4 byte multiple (prs_align is being called...). */ + /* size += ((4 - (size & 3)) & 3); */ +#endif + return size; } @@ -1759,32 +1761,6 @@ static uint32 size_of_systemtime(SYSTEMTIME *systime) return (sizeof(SYSTEMTIME) +4); } -/******************************************************************* - * write a UNICODE string. - * used by all the RPC structs passing a buffer - ********************************************************************/ - -static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) -{ - if (uni == NULL) - return False; - - prs_debug(ps, depth, desc, "spoolss_smb_io_unistr"); - depth++; - - /* there should be no align here as it can mess up - parsing a NEW_BUFFER->prs */ -#if 0 /* JERRY */ - if (!prs_align(ps)) - return False; -#endif - - if (!prs_unistr("unistr", ps, depth, uni)) - return False; - - return True; -} - /******************************************************************* * write a UNICODE string and its relative pointer. * used by all the RPC structs passing a buffer @@ -1816,8 +1792,14 @@ static BOOL smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *str buffer->string_at_end -= (size_of_relative_string(string) - 4); if(!prs_set_offset(ps, buffer->string_at_end)) return False; +#if 0 /* JERRY */ + /* + * Win2k does not align strings in a buffer + * Tested against WinNT 4.0 SP 6a & 2k SP2 --jerry + */ if (!prs_align(ps)) return False; +#endif buffer->string_at_end = prs_offset(ps); /* write the string */ @@ -1844,7 +1826,7 @@ static BOOL smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *str return False; /* read the string */ - if (!spoolss_smb_io_unistr(desc, string, ps, depth)) + if (!smb_io_unistr(desc, string, ps, depth)) return False; if(!prs_set_offset(ps, old_offset)) @@ -1901,7 +1883,7 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16 } /* write the string */ - if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) { + if (!smb_io_unistr(desc, &chaine, ps, depth)) { SAFE_FREE(chaine.buffer); return False; } @@ -1940,7 +1922,7 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16 return False; do { - if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) + if (!smb_io_unistr(desc, &chaine, ps, depth)) return False; l_chaine=str_len_uni(&chaine); @@ -5032,11 +5014,6 @@ BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx, make_spoolss_driver_info_3(mem_ctx, &q_u->info.info_3, info->info3); break; - /* info level 6 is supported by WinME and Win2k */ - case 6: - /* WRITEME!! will add later --jerry */ - break; - default: DEBUG(0,("make_spoolss_q_addprinterdriver: Unknown info level [%d]\n", level)); break; -- cgit From 2699f9b9df3f974a34e40761141361e997638b6c Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 22 Apr 2002 18:48:45 +0000 Subject: printing merge from HEAD (This used to be commit d3aed37dd87d425f51bcdc4e5151f0b0fe8f9c6b) --- source3/rpc_parse/parse_spoolss.c | 61 ++++++++++++--------------------------- 1 file changed, 19 insertions(+), 42 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b74ee3c5c5..e9f0ca858a 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -628,7 +628,6 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo break; /* See the comments on the DEVMODE in the msdn GDI documentation */ - /* (WINVER >= 0x0400) */ case 0x0400: case 0x0401: if (!prs_uint32("icmmethod", ps, depth, &devmode->icmmethod)) @@ -643,14 +642,10 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo return False; if (!prs_uint32("reserved2", ps, depth, &devmode->reserved2)) return False; - - /* (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400) */ - if (devmode->specversion == 0x401) { if (!prs_uint32("panningwidth", ps, depth, &devmode->panningwidth)) return False; if (!prs_uint32("panningheight", ps, depth, &devmode->panningheight)) return False; - } break; /* log an error if we see something else */ @@ -1726,12 +1721,19 @@ static uint32 size_of_relative_string(UNISTR *string) uint32 size=0; size=str_len_uni(string); /* the string length */ - size=size+1; /* add the leading zero */ + size=size+1; /* add the trailing zero */ size=size*2; /* convert in char */ - /* Ensure size is 4 byte multiple (prs_align is being called...). */ - size += ((4 - (size & 3)) & 3); size=size+4; /* add the size of the ptr */ +#if 0 /* JERRY */ + /* + * Do not include alignment as Win2k does not align relative + * strings within a buffer --jerry + */ + /* Ensure size is 4 byte multiple (prs_align is being called...). */ + /* size += ((4 - (size & 3)) & 3); */ +#endif + return size; } @@ -1759,32 +1761,6 @@ static uint32 size_of_systemtime(SYSTEMTIME *systime) return (sizeof(SYSTEMTIME) +4); } -/******************************************************************* - * write a UNICODE string. - * used by all the RPC structs passing a buffer - ********************************************************************/ - -static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) -{ - if (uni == NULL) - return False; - - prs_debug(ps, depth, desc, "spoolss_smb_io_unistr"); - depth++; - - /* there should be no align here as it can mess up - parsing a NEW_BUFFER->prs */ -#if 0 /* JERRY */ - if (!prs_align(ps)) - return False; -#endif - - if (!prs_unistr("unistr", ps, depth, uni)) - return False; - - return True; -} - /******************************************************************* * write a UNICODE string and its relative pointer. * used by all the RPC structs passing a buffer @@ -1816,8 +1792,14 @@ static BOOL smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *str buffer->string_at_end -= (size_of_relative_string(string) - 4); if(!prs_set_offset(ps, buffer->string_at_end)) return False; +#if 0 /* JERRY */ + /* + * Win2k does not align strings in a buffer + * Tested against WinNT 4.0 SP 6a & 2k SP2 --jerry + */ if (!prs_align(ps)) return False; +#endif buffer->string_at_end = prs_offset(ps); /* write the string */ @@ -1844,7 +1826,7 @@ static BOOL smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *str return False; /* read the string */ - if (!spoolss_smb_io_unistr(desc, string, ps, depth)) + if (!smb_io_unistr(desc, string, ps, depth)) return False; if(!prs_set_offset(ps, old_offset)) @@ -1901,7 +1883,7 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16 } /* write the string */ - if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) { + if (!smb_io_unistr(desc, &chaine, ps, depth)) { SAFE_FREE(chaine.buffer); return False; } @@ -1940,7 +1922,7 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16 return False; do { - if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) + if (!smb_io_unistr(desc, &chaine, ps, depth)) return False; l_chaine=str_len_uni(&chaine); @@ -5032,11 +5014,6 @@ BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx, make_spoolss_driver_info_3(mem_ctx, &q_u->info.info_3, info->info3); break; - /* info level 6 is supported by WinME and Win2k */ - case 6: - /* WRITEME!! will add later --jerry */ - break; - default: DEBUG(0,("make_spoolss_q_addprinterdriver: Unknown info level [%d]\n", level)); break; -- cgit From 07bb869958111edff7a71b262b45f75f590e32e4 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 29 Apr 2002 21:34:02 +0000 Subject: don't set the owner and group sid offset is there are no owner or group owner. J.F. (This used to be commit 68e9211f5df0480cb88d7d21140c4954da47e7ae) --- source3/rpc_parse/parse_sec.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 4f093b2422..c501f90479 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -674,12 +674,13 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, *sd_size = (size_t)((offset == 0) ? SEC_DESC_HEADER_SIZE : offset); - dst->off_owner_sid = offset_sid; - - if (dst->owner_sid != NULL) + if (dst->owner_sid != NULL) { + dst->off_owner_sid = offset_sid; dst->off_grp_sid = offset_sid + sid_size(dst->owner_sid); + } else - dst->off_grp_sid = offset_sid; + if (dst->grp_sid != NULL) + dst->off_grp_sid = offset_sid; return dst; -- cgit From 3a4065acf78f2dfb38a9901378da3d4d5228f331 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 7 May 2002 05:57:34 +0000 Subject: Grr - the removal of the nnecessary prs_align() from relative unicode strings didn't make it across into HEAD. (This used to be commit 4d715cb6829795b0fc0fe035ccb70ce0d1920c31) --- source3/rpc_parse/parse_misc.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index f326681c64..1883a55121 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -551,8 +551,6 @@ BOOL smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "smb_io_unistr"); depth++; - if(!prs_align(ps)) - return False; if(!prs_unistr("unistr", ps, depth, uni)) return False; -- cgit From 26b0e0b478da99f4296c99c6e55ced26b44e591b Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 8 May 2002 05:48:32 +0000 Subject: Added client side spoolss rpc commands for startpageprinter, endpageprinter, setjob and getjob. (This used to be commit d091a9d300c70b708218067d355c8282a6f14ab6) --- source3/rpc_parse/parse_spoolss.c | 60 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index e9f0ca858a..f297e88bba 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7016,3 +7016,63 @@ BOOL make_spoolss_q_enumforms(SPOOL_Q_ENUMFORMS *q_u, POLICY_HND *handle, return True; } + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_setjob(SPOOL_Q_SETJOB *q_u, POLICY_HND *handle, + uint32 jobid, uint32 level, uint32 command) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + q_u->jobid = jobid; + q_u->level = level; + + /* Hmm - the SPOOL_Q_SETJOB structure has a JOB_INFO ctr in it but + the server side code has it marked as unused. */ + + q_u->command = command; + + return True; +} + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_getjob(SPOOL_Q_GETJOB *q_u, POLICY_HND *handle, + uint32 jobid, uint32 level, NEW_BUFFER *buffer, + uint32 offered) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + q_u->jobid = jobid; + q_u->level = level; + q_u->buffer = buffer; + q_u->offered = offered; + + return True; +} + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_startpageprinter(SPOOL_Q_STARTPAGEPRINTER *q_u, + POLICY_HND *handle) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + + return True; +} + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_endpageprinter(SPOOL_Q_ENDPAGEPRINTER *q_u, + POLICY_HND *handle) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + + return True; +} -- cgit From 9992378e5579e8f4c3adfedeb407f3c5aaffbacf Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 10 May 2002 16:19:05 +0000 Subject: devmode parsing merge from SAMBA_2_2 (This used to be commit 59e49a79b485f5ba26dedff8a7d7fe1c8c77f16a) --- source3/rpc_parse/parse_spoolss.c | 103 +++++++++++++++++++++++++++----------- 1 file changed, 74 insertions(+), 29 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index f297e88bba..825ff23838 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -546,8 +546,29 @@ static BOOL spool_io_user_level(char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, * on reading allocate memory for the private member ********************************************************************/ +#define DM_NUM_OPTIONAL_FIELDS 8 + BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) { + uint32 available_space; /* size of the device mode left to parse */ + /* only important on unmarshalling */ + int i = 0; + + struct optional_fields { + fstring name; + uint32* field; + } opt_fields[DM_NUM_OPTIONAL_FIELDS] = { + { "icmmethod", &devmode->icmmethod }, + { "icmintent", &devmode->icmintent }, + { "mediatype", &devmode->mediatype }, + { "dithertype", &devmode->dithertype }, + { "reserved1", &devmode->reserved1 }, + { "reserved2", &devmode->reserved2 }, + { "panningwidth", &devmode->panningwidth }, + { "panningheight", &devmode->panningheight } + }; + + prs_debug(ps, depth, desc, "spoolss_io_devmode"); depth++; @@ -559,8 +580,27 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo if (!prs_uint16uni(True,"devicename", ps, depth, devmode->devicename.buffer, 32)) return False; + if (!prs_uint16("specversion", ps, depth, &devmode->specversion)) return False; + + /* Sanity Check - look for unknown specversions, but don't fail if we see one. + Let the size determine that */ + + switch (devmode->specversion) { + case 0x0320: + case 0x0400: + case 0x0401: + break; + + default: + DEBUG(0,("spoolss_io_devmode: Unknown specversion in devicemode [0x%x]\n", + devmode->specversion)); + DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n")); + break; + } + + if (!prs_uint16("driverversion", ps, depth, &devmode->driverversion)) return False; if (!prs_uint16("size", ps, depth, &devmode->size)) @@ -616,45 +656,50 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo return False; if (!prs_uint32("displayfrequency", ps, depth, &devmode->displayfrequency)) return False; + /* + * every device mode I've ever seen on the wire at least has up + * to the displayfrequency field. --jerry (05-09-2002) + */ + + /* add uint32's + uint16's + two UNICODE strings */ + + available_space = devmode->size - (sizeof(uint32)*6 + sizeof(uint16)*18 + sizeof(uint16)*64); + + /* Sanity check - we only have uint32's left tp parse */ + + if ( available_space && ((available_space % 4) != 0) ) { + DEBUG(0,("spoolss_io_devmode: available_space [%d] no in multiple of 4 bytes (size = %d)!\n", + available_space, devmode->size)); + DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n")); + return False; + } /* * Conditional parsing. Assume that the DeviceMode has been * zero'd by the caller. */ - switch(devmode->specversion) { - /* Used by spooler when issuing OpenPrinter() calls. NT 3.5x? */ - case 0x0320: - break; + while (available_space && (iicmmethod)) - return False; - if (!prs_uint32("icmintent", ps, depth, &devmode->icmintent)) - return False; - if (!prs_uint32("mediatype", ps, depth, &devmode->mediatype)) + if (available_space) { + DEBUG(0,("spoolss_io_devmode: I've parsed all I know and there is still stuff left|\n")); + DEBUG(0,("spoolss_io_devmode: available_space = [%d], devmode_size = [%d]!\n", + available_space, devmode->size)); + DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n")); return False; - if (!prs_uint32("dithertype", ps, depth, &devmode->dithertype)) - return False; - if (!prs_uint32("reserved1", ps, depth, &devmode->reserved1)) - return False; - if (!prs_uint32("reserved2", ps, depth, &devmode->reserved2)) - return False; - if (!prs_uint32("panningwidth", ps, depth, &devmode->panningwidth)) - return False; - if (!prs_uint32("panningheight", ps, depth, &devmode->panningheight)) - return False; - break; - - /* log an error if we see something else */ - default: - DEBUG(0,("spoolss_io_devmode: Unknown specversion [0x%x]!\n", devmode->specversion)); - DEBUG(0,("spoolss_io_devmode: Please report to samba-technical@samba.org\n")); - break; } + +parse_driverextra: if (devmode->driverextra!=0) { if (UNMARSHALLING(ps)) { devmode->private=(uint8 *)prs_alloc_mem(ps, devmode->driverextra*sizeof(uint8)); -- cgit From c6cbca79b43280e3b00b44058e54f694bb218d5a Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 10 May 2002 16:19:53 +0000 Subject: misc merge from SAMBA_2_2 (This used to be commit 0420098c47555224d2425845137e4159698e02c2) --- source3/rpc_parse/parse_spoolss.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 825ff23838..91f430125e 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2117,6 +2117,10 @@ static BOOL smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEVICEM /* read the offset */ if (!prs_uint32("offset", ps, depth, &buffer->string_at_end)) return False; + if (buffer->string_at_end == 0) { + *devmode = NULL; + return True; + } old_offset = prs_offset(ps); if(!prs_set_offset(ps, buffer->string_at_end + buffer->struct_start)) -- cgit From 787b58835cc56c3478d236c1ba01e170536c9348 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 13 May 2002 03:18:19 +0000 Subject: Support for client side startdocprinter. Set useless_ptr = 1 for marshalling smb_io_doc_info() so it actually works. (This used to be commit 8e09e9454685f4638375247fdb4a1e7c6de91704) --- source3/rpc_parse/parse_spoolss.c | 66 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 91f430125e..155fa7b3c9 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4,8 +4,8 @@ * Copyright (C) Andrew Tridgell 1992-2000, * Copyright (C) Luke Kenneth Casson Leighton 1996-2000, * Copyright (C) Jean Franois Micouleau 1998-2000, - * Copyright (C) Gerald Carter 2000-2002 - * Copyright (C) Tim Potter 2001. + * Copyright (C) Gerald Carter 2000-2002, + * Copyright (C) Tim Potter 2001-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 @@ -121,7 +121,7 @@ reads or writes an DOC_INFO structure. static BOOL smb_io_doc_info(char *desc, DOC_INFO *info, prs_struct *ps, int depth) { - uint32 useless_ptr=0; + uint32 useless_ptr=1; if (info == NULL) return False; @@ -7125,3 +7125,63 @@ BOOL make_spoolss_q_endpageprinter(SPOOL_Q_ENDPAGEPRINTER *q_u, return True; } + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_startdocprinter(SPOOL_Q_STARTDOCPRINTER *q_u, + POLICY_HND *handle, uint32 level, + char *docname, char *outputfile, + char *datatype) +{ + DOC_INFO_CONTAINER *ctr = &q_u->doc_info_container; + + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + + ctr->level = level; + + switch (level) { + case 1: + ctr->docinfo.switch_value = level; + + ctr->docinfo.doc_info_1.p_docname = docname ? 1 : 0; + ctr->docinfo.doc_info_1.p_outputfile = outputfile ? 1 : 0; + ctr->docinfo.doc_info_1.p_datatype = datatype ? 1 : 0; + + if (docname) + init_unistr2(&ctr->docinfo.doc_info_1.docname, docname, + strlen(docname) + 1); + + if (outputfile) + init_unistr2(&ctr->docinfo.doc_info_1.outputfile, outputfile, + strlen(outputfile) + 1); + + if (datatype) + init_unistr2(&ctr->docinfo.doc_info_1.datatype, datatype, + strlen(datatype) + 1); + + break; + case 2: + /* DOC_INFO_2 is only used by Windows 9x and since it + doesn't do printing over RPC we don't have to worry + about it. */ + default: + DEBUG(3, ("unsupported info level %d\n", level)); + return False; + } + + return True; +} + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_enddocprinter(SPOOL_Q_ENDDOCPRINTER *q_u, + POLICY_HND *handle) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + + return True; +} -- cgit From d53afaaff1da1967500788f7b1540297f3000972 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 13 May 2002 14:41:55 +0000 Subject: compile fix merge from SAMBA_2_2 (This used to be commit 2676be4e419878fbf74b619949e1d84c6186691c) --- source3/rpc_parse/parse_spoolss.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 155fa7b3c9..997d29be89 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -558,15 +558,26 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo fstring name; uint32* field; } opt_fields[DM_NUM_OPTIONAL_FIELDS] = { - { "icmmethod", &devmode->icmmethod }, - { "icmintent", &devmode->icmintent }, - { "mediatype", &devmode->mediatype }, - { "dithertype", &devmode->dithertype }, - { "reserved1", &devmode->reserved1 }, - { "reserved2", &devmode->reserved2 }, - { "panningwidth", &devmode->panningwidth }, - { "panningheight", &devmode->panningheight } + { "icmmethod", NULL }, + { "icmintent", NULL }, + { "mediatype", NULL }, + { "dithertype", NULL }, + { "reserved1", NULL }, + { "reserved2", NULL }, + { "panningwidth", NULL }, + { "panningheight", NULL } }; + + /* assign at run time to keep non-gcc vompilers happy */ + + opt_fields[0].field = &devmode->icmmethod; + opt_fields[1].field = &devmode->icmintent; + opt_fields[2].field = &devmode->mediatype; + opt_fields[3].field = &devmode->dithertype; + opt_fields[4].field = &devmode->reserved1; + opt_fields[5].field = &devmode->reserved2; + opt_fields[6].field = &devmode->panningwidth; + opt_fields[7].field = &devmode->panningheight; prs_debug(ps, depth, desc, "spoolss_io_devmode"); @@ -667,7 +678,7 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo /* Sanity check - we only have uint32's left tp parse */ - if ( available_space && ((available_space % 4) != 0) ) { + if ( available_space && ((available_space % sizeof(uint32)) != 0) ) { DEBUG(0,("spoolss_io_devmode: available_space [%d] no in multiple of 4 bytes (size = %d)!\n", available_space, devmode->size)); DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n")); @@ -679,7 +690,7 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo * zero'd by the caller. */ - while (available_space && (i 0) && (i < DM_NUM_OPTIONAL_FIELDS)) { if (!prs_uint32(opt_fields[i].name, ps, depth, opt_fields[i].field)) return False; @@ -699,7 +710,6 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo } -parse_driverextra: if (devmode->driverextra!=0) { if (UNMARSHALLING(ps)) { devmode->private=(uint8 *)prs_alloc_mem(ps, devmode->driverextra*sizeof(uint8)); -- cgit From 4deb5612549d927988474c5c84251f6fec7edc78 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 14 May 2002 05:32:45 +0000 Subject: Change make_spoolss_q_{get,set}printerdata() take a char* and length rather than a unistr2. Printer data isn't necessarily in unistr format. Tallocate memory to hold returned data when unmarshalling getprinterdata and enumprinterdata replies. (This used to be commit 89633a1d87d2a437dc1ceab9439f415ee1ec606d) --- source3/rpc_parse/parse_spoolss.c | 42 +++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 997d29be89..a0cf85c550 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1102,15 +1102,15 @@ BOOL make_spoolss_q_deleteprinterdriver( ********************************************************************/ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, - const POLICY_HND *handle, - UNISTR2 *valuename, uint32 size) + const POLICY_HND *handle, + char *valuename, uint32 size) { if (q_u == NULL) return False; DEBUG(5,("make_spoolss_q_getprinterdata\n")); q_u->handle = *handle; - copy_unistr2(&q_u->valuename, valuename); + init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); q_u->size = size; return True; @@ -1205,6 +1205,9 @@ BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_st if (!prs_uint32("size", ps, depth, &r_u->size)) return False; + if (UNMARSHALLING(ps)) + r_u->data = prs_alloc_mem(ps, r_u->size); + if (!prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size)) return False; @@ -5712,6 +5715,16 @@ BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_ if(!prs_uint32("valuesize", ps, depth, &r_u->valuesize)) return False; + if (UNMARSHALLING(ps) && r_u->valuesize) { + + r_u->value = (uint16 *)prs_alloc_mem(ps, r_u->valuesize * 2); + + if (!r_u->value) { + DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata value\n")); + return False; + } + } + if(!prs_uint16uni(False, "value", ps, depth, r_u->value, r_u->valuesize )) return False; @@ -5726,6 +5739,17 @@ BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_ if(!prs_uint32("datasize", ps, depth, &r_u->datasize)) return False; + + if (UNMARSHALLING(ps) && r_u->datasize) { + + r_u->data = (uint8 *)prs_alloc_mem(ps, r_u->datasize); + + if (!r_u->value) { + DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata data\n")); + return False; + } + } + if(!prs_uint8s(False, "data", ps, depth, r_u->data, r_u->datasize)) return False; if(!prs_align(ps)) @@ -5778,19 +5802,15 @@ BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, /******************************************************************* ********************************************************************/ -BOOL make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, TALLOC_CTX *ctx, const POLICY_HND *hnd, - char* value, char* data) +BOOL make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND *hnd, + char* value, char* data, uint32 data_size) { - UNISTR2 tmp; - memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); q_u->type = REG_SZ; init_unistr2(&q_u->value, value, strlen(value)+1); - init_unistr2(&tmp, data, strlen(data)+1); - q_u->max_len = q_u->real_len = tmp.uni_max_len*2; - q_u->data = talloc(ctx, q_u->real_len); - memcpy(q_u->data, tmp.buffer, q_u->real_len); + q_u->max_len = q_u->real_len = data_size; + q_u->data = data; return True; } -- cgit From 3d95426f2c88b4bc3914d8bf894c990039db7ea5 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 14 May 2002 06:37:54 +0000 Subject: Added writeprinter rpc command. (This used to be commit a1934a7a8eda592e283a01014280ddb373564927) --- source3/rpc_parse/parse_spoolss.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index a0cf85c550..10522248f4 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7215,3 +7215,17 @@ BOOL make_spoolss_q_enddocprinter(SPOOL_Q_ENDDOCPRINTER *q_u, return True; } + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_writeprinter(SPOOL_Q_WRITEPRINTER *q_u, + POLICY_HND *handle, uint32 data_size, + char *data) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + q_u->buffer_size = q_u->buffer_size2 = data_size; + q_u->buffer = data; + return True; +} -- cgit From af451af22f745d56bb92f0dbdd270f7fd024ef0d Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 14 May 2002 07:21:57 +0000 Subject: Added deleteprinterdata client rpc. (This used to be commit 217ae50acd8cf088e268e7d2a6a7c192aca9e2f1) --- source3/rpc_parse/parse_spoolss.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 10522248f4..47ddbb7aa1 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1112,7 +1112,6 @@ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, q_u->handle = *handle; init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); q_u->size = size; - return True; } @@ -7229,3 +7228,16 @@ BOOL make_spoolss_q_writeprinter(SPOOL_Q_WRITEPRINTER *q_u, q_u->buffer = data; return True; } + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA *q_u, + POLICY_HND *handle, char *valuename) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); + + return True; +} -- cgit From 3fe27b7f9df7d2bb2f7799fd46b79928f0e614b0 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 17 May 2002 13:49:01 +0000 Subject: A few more trusted domains updates from mimir. I think we may still need to look at our server enumeration code, but other than that, its much better in the tree than out. Andrew Bartlett (This used to be commit d57a1b4629d12a0374cc6d74dfc6f5d4793fcef8) --- source3/rpc_parse/parse_lsa.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 415737ebfb..e2f3abc910 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -525,21 +525,19 @@ BOOL lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, ********************************************************************/ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context, - uint32 requested_num_domains, uint32 num_domains, TRUSTDOM **td) + uint32 req_num_domains, uint32 num_domains, TRUSTDOM **td) { int i; DEBUG(5, ("init_r_enum_trust_dom\n")); r_e->enum_context = enum_context; - r_e->num_domains = 0; + r_e->num_domains = num_domains; r_e->ptr_enum_domains = 0; - r_e->num_domains2 = 0; - - if (num_domains == 0) { - r_e->status = NT_STATUS_NO_MORE_ENTRIES; - - } else { + r_e->num_domains2 = num_domains; + + if (num_domains != 0) { + /* * allocating empty arrays of unicode headers, strings * and sids of enumerated trusted domains @@ -558,10 +556,7 @@ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 en r_e->status = NT_STATUS_NO_MEMORY; return; } - - r_e->num_domains = num_domains; - r_e->num_domains2 = num_domains; - + for (i = 0; i < num_domains; i++) { /* don't know what actually is this for */ @@ -573,12 +568,6 @@ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 en init_unistr2_w(ctx, &r_e->uni_domain_name[i], (td[i])->name); }; - - if (num_domains < requested_num_domains) { - r_e->status = NT_STATUS_NO_MORE_ENTRIES; - } else { - r_e->status = NT_STATUS_OK; - } } } -- cgit From c6926d75ddad2d4a698fe4b433b877d0ea0721a3 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 17 May 2002 14:26:20 +0000 Subject: Add a touch of const (This used to be commit 3e93b216ddba14592a0193664c5d6bcbef898f1a) --- source3/rpc_parse/parse_prs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 6d65d5cc7f..c3e4992263 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -73,7 +73,7 @@ void prs_dump_region(char *name, int v, prs_struct *ps, XXXX side-effect of this function is to increase the debug depth XXXX ********************************************************************/ -void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name) +void prs_debug(prs_struct *ps, int depth, const char *desc, char *fn_name) { DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(depth), ps->data_offset, fn_name, desc)); } -- cgit From caf62523675fd4cc692f66bb9ba9d63a271ba970 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 17 May 2002 14:27:42 +0000 Subject: Make non-static for some later work (pushing the info3 across the winbind pipe for smbd to decode), and fix up the debug. (At least I assume it is wrong, can an expert care to comment?) (This used to be commit e5b4331ffa99d769b062053d6afc4772355fa5b2) --- source3/rpc_parse/parse_net.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index afbdf6dc57..e8a7b8e75d 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1331,14 +1331,15 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, Jacobsen at HP. JRA. ********************************************************************/ -static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth, uint16 validation_level) +BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, + int depth, uint16 validation_level) { int i; if (usr == NULL) return False; - prs_debug(ps, depth, desc, "lsa_io_lsa_user_info"); + prs_debug(ps, depth, desc, "net_io_user_info3"); depth++; if (UNMARSHALLING(ps)) -- cgit From 58e1fe62cc955c6b8449332447a6879c6fab64e7 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 18 May 2002 05:52:52 +0000 Subject: A few things in this commit: cleanup some of the code in net_rpc_join re const warnings and fstrings. Passdb: Make the %u and %U substituions in passdb work. This is done by declaring these paramters to be 'const' and doing the substitution manually. I'm told this is us going full circle, but I can't really see a better way. Finally these things actually seem to work properly... Make the lanman code use the pdb's recorded values for homedir etc rather than the values from lp_*() Add code to set the plaintext password in the passdb, where it can decide how to store/set it. For use with a future 'ldap password change' option, or somthing like that... Add pdb_unix, so as to remove the 'not in passdb' special cases from the local_lookup_*() code. Quite small, as it uses the new 'struct passwd -> SAM_ACCOUNT' code that is now in just one place. (also used by pdb_smbpasswd) Other: Fix up the adding of [homes] at session setup time to actually pass the right string, that is the unix homedir, not the UNC path. Fix up [homes] so that for winbind users is picks the correct name. (bad interactions with the default domain code previously) Change the rpc_server/srv_lsa_nt.c code to match NT when for the SATUS_NONE_MAPPED reply: This was only being triggered on no queries, now it is on the 'no mappings' (ie all mappings failed). Checked against Win2k. Policy Question: Should SID -> unix_user.234/unix_group.364 be considered a mapping or not? Currently it isn't. Andrew Bartlett (This used to be commit c28668068b5a3b3cf3c4317e5fb32ec9957f3e34) --- source3/rpc_parse/parse_samr.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index b8a558665f..66312db52e 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1462,13 +1462,30 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_en ZERO_STRUCTP(sam->str); for (i = 0; i < num_entries ; i++) { + const char *username; + const char *fullname; + const char *acct_desc; + DEBUG(11, ("init_sam_dispinfo_1: entry: %d\n",i)); pwd=disp_user_info[i+start_idx].sam; - len_sam_name = strlen(pdb_get_username(pwd)); - len_sam_full = strlen(pdb_get_fullname(pwd)); - len_sam_desc = strlen(pdb_get_acct_desc(pwd)); + username = pdb_get_username(pwd); + fullname = pdb_get_fullname(pwd); + acct_desc = pdb_get_acct_desc(pwd); + + if (!username) + username = ""; + + if (!fullname) + fullname = ""; + + if (!acct_desc) + acct_desc = ""; + + len_sam_name = strlen(username); + len_sam_full = strlen(fullname); + len_sam_desc = strlen(acct_desc); init_sam_entry1(&sam->sam[i], start_idx + i + 1, len_sam_name, len_sam_full, len_sam_desc, -- cgit From 077566a20054384c5568a3147e2d4e22defb9014 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 20 May 2002 00:55:19 +0000 Subject: No need to pass a fstring in make_spoolss_q_enumprinters() (This used to be commit 1fb8e2b3a07fdc0bb302f02a451ed32a275f0c10) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 47ddbb7aa1..bcfaa1d42f 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3590,7 +3590,7 @@ BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, BOOL make_spoolss_q_enumprinters( SPOOL_Q_ENUMPRINTERS *q_u, uint32 flags, - fstring servername, + char *servername, uint32 level, NEW_BUFFER *buffer, uint32 offered -- cgit From 622ed701a52899b84fbce7e8e4cceab51b039dd2 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 20 May 2002 01:00:56 +0000 Subject: There's probably a pointer to a buffer at the end of a enumprinterdrivers() rpc call which we currently don't parse - just added a comment about it for the moment as not parsing it is harmless. (This used to be commit 2429c4cc796576aa2d816a14b10fdd932b672a02) --- source3/rpc_parse/parse_spoolss.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index bcfaa1d42f..3e3ddb9a01 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4261,6 +4261,10 @@ BOOL spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u if (!prs_uint32("offered", ps, depth, &q_u->offered)) return False; + /* According to MSDN there is another [in] parameter for this rpc + which could be a pointer to a buffer. NT4 puts four zero bytes + here which we currently don't parse. -tpot */ + return True; } -- cgit From c1334b143bb52fbdc31c1aa26d06249ca1f74752 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 20 May 2002 01:31:51 +0000 Subject: OK that last commit was incorrect - this call is parsed properly. I only imagined it wasn't! (This used to be commit bbad6c6678c89a33fb233091f5965ccd1aa589f6) --- source3/rpc_parse/parse_spoolss.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 3e3ddb9a01..bcfaa1d42f 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4261,10 +4261,6 @@ BOOL spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u if (!prs_uint32("offered", ps, depth, &q_u->offered)) return False; - /* According to MSDN there is another [in] parameter for this rpc - which could be a pointer to a buffer. NT4 puts four zero bytes - here which we currently don't parse. -tpot */ - return True; } -- cgit From 5b76d846f87fa138e64e0526925bad5a4a51a263 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 24 May 2002 16:27:54 +0000 Subject: merge from SAMBA_2_2. Tim, please check the prs_align() removed from sec_io_desc() and make sure it doesn't break anything else. I know it is right for the printing needs and I have tested some other general things like viewing acls on directories, but I would feel more comfortable if you would have a look as well. jerry (This used to be commit 83f109c940f30d9b35176540d8bdccbb22ffa3a1) --- source3/rpc_parse/parse_sec.c | 7 +++++++ source3/rpc_parse/parse_spoolss.c | 41 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index c501f90479..a8c956a209 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -749,8 +749,15 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "sec_io_desc"); depth++; +#if 0 /* JERRY */ + /* + * if alignment is needed, should be done by the the + * caller. Not here. This caused me problems when marshalling + * printer info into a buffer. --jerry + */ if(!prs_align(ps)) return False; +#endif /* start of security descriptor stored for back-calc offset purposes */ old_offset = prs_offset(ps); diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index bcfaa1d42f..72d88c8129 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2283,6 +2283,8 @@ BOOL smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info, BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; + uint32 dm_offset, sd_offset, current_offset; + uint32 dummy_value = 0; prs_debug(ps, depth, desc, "smb_io_printer_info_2"); depth++; @@ -2304,8 +2306,9 @@ BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, if (!smb_io_relstr("location", buffer, depth, &info->location)) return False; - /* NT parses the DEVMODE at the end of the struct */ - if (!smb_io_reldevmode("devmode", buffer, depth, &info->devmode)) + /* save current offset and wind forwared by a uint32 */ + dm_offset = prs_offset(ps); + if (!prs_uint32("devmode", ps, depth, &dummy_value)) return False; if (!smb_io_relstr("sepfile", buffer, depth, &info->sepfile)) @@ -2317,9 +2320,31 @@ BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, if (!smb_io_relstr("parameters", buffer, depth, &info->parameters)) return False; + /* save current offset for the sec_desc */ + sd_offset = prs_offset(ps); + if (!prs_uint32("sec_desc", ps, depth, &dummy_value)) + return False; + + + /* save current location so we can pick back up here */ + current_offset = prs_offset(ps); + + /* parse the devmode */ + if (!prs_set_offset(ps, dm_offset)) + return False; + if (!smb_io_reldevmode("devmode", buffer, depth, &info->devmode)) + return False; + + /* parse the sec_desc */ + if (!prs_set_offset(ps, sd_offset)) + return False; if (!smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc)) return False; + /* pick up where we left off */ + if (!prs_set_offset(ps, current_offset)) + return False; + if (!prs_uint32("attributes", ps, depth, &info->attributes)) return False; if (!prs_uint32("priority", ps, depth, &info->priority)) @@ -3095,7 +3120,7 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) uint32 size=0; size += 4; - /* JRA !!!! TESTME - WHAT ABOUT prs_align.... !!! */ + size += sec_desc_size( info->secdesc ); size+=size_of_device_mode( info->devmode ); @@ -3121,6 +3146,16 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) size+=size_of_uint32( &info->status ); size+=size_of_uint32( &info->cjobs ); size+=size_of_uint32( &info->averageppm ); + + /* + * add any adjustments for alignment. This is + * not optimal since we could be calling this + * function from a loop (e.g. enumprinters), but + * it is easier to maintain the calculation here and + * not place the burden on the caller to remember. --jerry + */ + size += size % 4; + return size; } -- cgit From 78b4de02bbffdc92e7ac6b99f9550016b9a87be5 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 28 May 2002 08:41:50 +0000 Subject: When marshalling a netshareenum request the share ctr has to be initialised to an empty value instead of a null pointer otherwise the server service crashes on NT. (This used to be commit c7214baa0540a0c7d23d3023b2c2ff4cde0f9f7f) --- source3/rpc_parse/parse_srv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 9c9d5f1e9c..f469b47923 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -658,7 +658,9 @@ void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); q_n->ctr.info_level = q_n->ctr.switch_value = info_level; - q_n->ctr.ptr_share_info = 0; + q_n->ctr.ptr_share_info = 1; + q_n->ctr.num_entries = 0; + q_n->ctr.ptr_entries = 0; q_n->preferred_len = preferred_len; memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); -- cgit From 568deecbf0bcda46fd9c927ad10b76d748b8c64d Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 29 May 2002 01:43:44 +0000 Subject: Added netremotetod to try and figure out which srvsvc commands are denied when using restrictanonymous. (This used to be commit 0c65978ed07903af808da5f32cc29531aef23225) --- source3/rpc_parse/parse_srv.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index f469b47923..79cf0d9776 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -2909,3 +2909,14 @@ BOOL srv_io_r_net_file_set_secdesc(char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, return True; } + +/******************************************************************* + Inits a structure +********************************************************************/ + +void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, char *server) +{ + q_u->ptr_srv_name = 1; + init_unistr2(&q_u->uni_srv_name, server, strlen(server) + 1); +} + -- cgit From a14fbf6763709f035ed37062cbb6dfbe273c40e3 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Fri, 31 May 2002 00:29:29 +0000 Subject: netfileenum was missing the username filter. (This used to be commit 8fc3dba8bd99c55bef9ac137976dd35134a49342) --- source3/rpc_parse/parse_srv.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 79cf0d9776..78748463ac 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1986,7 +1986,7 @@ void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name); - q_n->file_level = file_level; + q_n->file_level = q_n->ctr->switch_value = file_level; q_n->preferred_len = preferred_len; memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); @@ -2023,6 +2023,13 @@ BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps if(!prs_align(ps)) return False; + if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; if(!prs_uint32("file_level", ps, depth, &q_n->file_level)) return False; -- cgit From e422b271da0c07f5c5cfd41df01bb2910d484abc Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Fri, 31 May 2002 17:02:09 +0000 Subject: Update netfileenum on both client and server sides to do an arbitrary number of files. This was done to better enable net rpc file. Perhaps we can start giving back real info this way, too. (This used to be commit b3fea72ee9abd2441a49c35442c54819e4ba16ba) --- source3/rpc_parse/parse_srv.c | 108 +++++++++++++++++------------------------- 1 file changed, 43 insertions(+), 65 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 78748463ac..788642e4ef 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -5,6 +5,7 @@ * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997. * Copyright (C) Jeremy Allison 1999. + * 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 @@ -1881,91 +1882,67 @@ static BOOL srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth) +static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) { - if (fl3 == NULL) + if (ctr == NULL) return False; - prs_debug(ps, depth, desc, "srv_io_file_3_fl3"); + prs_debug(ps, depth, desc, "srv_io_srv_file_ctr"); depth++; + if (UNMARSHALLING(ps)) { + memset(ctr, '\0', sizeof(SRV_FILE_INFO_CTR)); + } + if(!prs_align(ps)) return False; - if(!prs_uint32("num_entries_read", ps, depth, &fl3->num_entries_read)) + if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) return False; - if(!prs_uint32("ptr_file_fl3", ps, depth, &fl3->ptr_file_info)) + if (ctr->switch_value != 3) { + DEBUG(5,("%s File info %d level not supported\n", + tab_depth(depth), ctr->switch_value)); + } + if(!prs_uint32("ptr_file_info", ps, depth, &ctr->ptr_file_info)) + return False; + if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries)) + return False; + if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries)) + return False; + if (ctr->ptr_entries == 0) + return True; + if(!prs_uint32("num_entries2", ps, depth, + &ctr->num_entries2)) return False; - if (fl3->ptr_file_info != 0) { + switch (ctr->switch_value) { + case 3: { + SRV_FILE_INFO_3 *info3 = ctr->file.info3; + int num_entries = ctr->num_entries; int i; - int num_entries = fl3->num_entries_read; - if (num_entries > MAX_FILE_ENTRIES) { - num_entries = MAX_FILE_ENTRIES; /* report this! */ + if (UNMARSHALLING(ps)) { + if (!(info3 = (SRV_FILE_INFO_3 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_FILE_INFO_3)))) + return False; + ctr->file.info3 = info3; } - if(!prs_uint32("num_entries_read2", ps, depth, &fl3->num_entries_read2)) - return False; - for (i = 0; i < num_entries; i++) { - if(!srv_io_file_info3("", &fl3->info_3[i], ps, depth)) + if(!srv_io_file_info3("", &ctr->file.info3[i].info_3, ps, depth)) return False; } - for (i = 0; i < num_entries; i++) { - if(!srv_io_file_info3_str("", &fl3->info_3_str[i], ps, depth)) + if(!srv_io_file_info3_str("", &ctr->file.info3[i].info_3_str, ps, depth)) return False; } - - if(!prs_align(ps)) - return False; - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR **pp_ctr, prs_struct *ps, int depth) -{ - SRV_FILE_INFO_CTR *ctr = *pp_ctr; - - if (UNMARSHALLING(ps)) { - ctr = *pp_ctr = (SRV_FILE_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_FILE_INFO_CTR)); - if (ctr == NULL) - return False; + break; } - - if (ctr == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_file_ctr"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) - return False; - if(!prs_uint32("ptr_file_ctr", ps, depth, &ctr->ptr_file_ctr)) - return False; - - if (ctr->ptr_file_ctr != 0) { - switch (ctr->switch_value) { - case 3: - if(!srv_io_srv_file_info_3("", &ctr->file.info3, ps, depth)) - return False; - break; - default: - DEBUG(5,("%s no file info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); - break; - } + default: + DEBUG(5,("%s no file info at switch_value %d\n", + tab_depth(depth), ctr->switch_value)); + break; } - + return True; } @@ -1981,13 +1958,14 @@ void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, { DEBUG(5,("init_q_net_file_enum\n")); - q_n->ctr = ctr; - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name); - q_n->file_level = q_n->ctr->switch_value = file_level; + q_n->file_level = q_n->ctr.switch_value = file_level; q_n->preferred_len = preferred_len; + q_n->ctr.ptr_file_info = 1; + q_n->ctr.num_entries = 0; + q_n->ctr.num_entries2 = 0; memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); } -- cgit From f5dc84c4cc3e2ab4f727a0c3d908163ed0e0c1cb Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Fri, 31 May 2002 21:08:51 +0000 Subject: Add fns for netshareadd and netsharedel rpcs (This used to be commit 4e317163858d8a7f65984a8a8507a459ac1515cc) --- source3/rpc_parse/parse_srv.c | 50 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 788642e4ef..3ccf937d2a 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -109,10 +109,14 @@ void init_srv_share_info2_str(SH_INFO_2_STR *sh2, { DEBUG(5,("init_srv_share_info2_str\n")); - init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1); - init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1); - init_unistr2(&sh2->uni_path, path, strlen(path)+1); - init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1); + if (net_name) + init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1); + if (remark) + init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1); + if (path) + init_unistr2(&sh2->uni_path, path, strlen(path)+1); + if (passwd) + init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1); } /******************************************************************* @@ -955,9 +959,34 @@ BOOL srv_io_q_net_share_add(char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info)) return False; + if(!prs_uint32("ptr_err_index", ps, depth, &q_n->ptr_err_index)) + return False; + if (q_n->ptr_err_index) + if (!prs_uint32("err_index", ps, depth, &q_n->err_index)) + return False; + return True; } +void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, char *srvname, + char *netname, uint32 type, char *remark, + uint32 perms, uint32 max_uses, uint32 num_uses, + char *path, char *passwd) +{ + q->ptr_srv_name = 1; + init_unistr2(&q->uni_srv_name, srvname, strlen(srvname) +1); + q->info.switch_value = q->info_level = 2; + + q->info.ptr_share_ctr = 1; + init_srv_share_info2(&q->info.share.info2.info_2, netname, type, + remark, perms, max_uses, num_uses, path, passwd); + init_srv_share_info2_str(&q->info.share.info2.info_2_str, netname, + remark, path, passwd); + q->ptr_err_index = 1; + q->err_index = 0; +} + + /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -981,6 +1010,14 @@ BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps return True; } +void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname, + const char *sharename) +{ + del->ptr_srv_name = 1; + init_unistr2(&del->uni_srv_name, srvname, strlen(srvname) +1 ); + init_unistr2(&del->uni_share_name, sharename, strlen(sharename) + 1); +} + /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -1004,6 +1041,11 @@ BOOL srv_io_q_net_share_del(char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth)) return False; + if(!prs_align(ps)) + return False; + if(!prs_uint32("reserved", ps, depth, &q_n->reserved)) + return False; + return True; } -- cgit From 4caf48a7005407e16fca7ea4414c4a00bddb7c85 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Sat, 1 Jun 2002 01:02:04 +0000 Subject: Add rpc for file close, expand file enum to take username (This used to be commit 4b18a94590a25882f06f88c3c7dd1a08bf990044) --- source3/rpc_parse/parse_srv.c | 71 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 67 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 3ccf937d2a..36afc7c962 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1993,15 +1993,16 @@ static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct * ********************************************************************/ void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, - char *srv_name, char *qual_name, - uint32 file_level, SRV_FILE_INFO_CTR *ctr, - uint32 preferred_len, - ENUM_HND *hnd) + char *srv_name, char *qual_name, char *user_name, + uint32 file_level, SRV_FILE_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd) { DEBUG(5,("init_q_net_file_enum\n")); init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name); + init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name); q_n->file_level = q_n->ctr.switch_value = file_level; q_n->preferred_len = preferred_len; @@ -2100,6 +2101,68 @@ BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps return True; } +/******************************************************************* + Initialize a net file close request +********************************************************************/ +void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, char *server, + uint32 file_id) +{ + q_n->ptr_srv_name = 1; + init_unistr2(&q_n->uni_srv_name, server, strlen(server) + 1); + q_n->file_id = file_id; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ +BOOL srv_io_q_net_file_close(char *desc, SRV_Q_NET_FILE_CLOSE *q_n, + prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_file_close"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("file_id", ps, depth, &q_n->file_id)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_file_close(char *desc, SRV_R_NET_FILE_CLOSE *q_n, + prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_file_close"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status", ps, depth, &q_n->status)) + return False; + + return True; +} + /******************************************************************* Inits a SRV_INFO_100 structure. ********************************************************************/ -- cgit From ee2ef50a74e0ff5d51c559307bd2c0ac3f7e3f7b Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 3 Jun 2002 02:13:46 +0000 Subject: Fixed bogus alignment in unmarshalling of SAMR_GET_DOM_PWINFO reply. (This used to be commit 2e25b5c3099e48869e83a1e03943d3cc2a875f24) --- source3/rpc_parse/parse_samr.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 66312db52e..412dcd6501 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6721,12 +6721,8 @@ BOOL samr_io_r_get_dom_pwinfo(char *desc, SAMR_R_GET_DOM_PWINFO * r_u, if(!prs_uint16("unk_0", ps, depth, &r_u->unk_0)) return False; - if(!prs_align(ps)) - return False; if(!prs_uint16("unk_1", ps, depth, &r_u->unk_1)) return False; - if(!prs_align(ps)) - return False; if(!prs_uint16("unk_2", ps, depth, &r_u->unk_2)) return False; if(!prs_align(ps)) -- cgit From 1ecee79d05bbac201977813c5eab6de63d116885 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Mon, 3 Jun 2002 22:13:41 +0000 Subject: Add user name to netsessenum RPC to stop 1783 messages. Also fix where username was sent as machine name. (This used to be commit 2b4a5b56664cf3c99682b64c0fc5e2ebebb749b7) --- source3/rpc_parse/parse_srv.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 36afc7c962..107661b49b 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1193,7 +1193,7 @@ void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user) DEBUG(5,("init_srv_sess_info1_str\n")); init_unistr2(&ss1->uni_name, name, strlen(name)+1); - init_unistr2(&ss1->uni_user, name, strlen(user)+1); + init_unistr2(&ss1->uni_user, user, strlen(user)+1); } /******************************************************************* @@ -1374,10 +1374,10 @@ static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_stru ********************************************************************/ void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, - char *srv_name, char *qual_name, - uint32 sess_level, SRV_SESS_INFO_CTR *ctr, - uint32 preferred_len, - ENUM_HND *hnd) + char *srv_name, char *qual_name, + char *user_name, uint32 sess_level, + SRV_SESS_INFO_CTR *ctr, uint32 preferred_len, + ENUM_HND *hnd) { q_n->ctr = ctr; @@ -1385,6 +1385,7 @@ void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name); + init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name); q_n->sess_level = sess_level; q_n->preferred_len = preferred_len; @@ -1420,6 +1421,13 @@ BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth)) return False; + if(!prs_align(ps)) + return False; + if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth)) + return False; + if(!prs_align(ps)) return False; -- cgit From de581b91e90702802ecb873d550f8a5228ef41f2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 10 Jun 2002 21:49:18 +0000 Subject: Merge of Jerry's fix from 2.2. Jeremy. (This used to be commit 64af68924b8fc36caac3f978dc0f9deccc41e059) --- source3/rpc_parse/parse_samr.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 412dcd6501..8a741d768d 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6719,13 +6719,16 @@ BOOL samr_io_r_get_dom_pwinfo(char *desc, SAMR_R_GET_DOM_PWINFO * r_u, if(!prs_align(ps)) return False; - if(!prs_uint16("unk_0", ps, depth, &r_u->unk_0)) - return False; - if(!prs_uint16("unk_1", ps, depth, &r_u->unk_1)) + /* + * We need 16 bytes here according to tests. Don't know + * what they are, but the length is important for the singing + */ + + if(!prs_uint32("unk_0", ps, depth, &r_u->unk_0)) return False; - if(!prs_uint16("unk_2", ps, depth, &r_u->unk_2)) + if(!prs_uint32("unk_1", ps, depth, &r_u->unk_1)) return False; - if(!prs_align(ps)) + if(!prs_uint32("unk_2", ps, depth, &r_u->unk_2)) return False; if(!prs_ntstatus("status", ps, depth, &r_u->status)) -- cgit From a98d2b1e1788d3207278340330052fc09245e8d2 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 14 Jun 2002 14:13:41 +0000 Subject: Add a touch of const to this - helps with some yet-to-be-commited changes (This used to be commit a2c791c0bbce1d505e5ef2150384ad5d54ae7117) --- source3/rpc_parse/parse_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index e8a7b8e75d..98266e0fb2 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1218,10 +1218,10 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, time_t unix_pass_must_change_time, uint16 logon_count, uint16 bad_pw_count, - uint32 num_groups, DOM_GID *gids, + uint32 num_groups, const DOM_GID *gids, uint32 user_flgs, uchar *sess_key, - char *logon_srv, char *logon_dom, - DOM_SID *dom_sid, char *other_sids) + const char *logon_srv, const char *logon_dom, + const DOM_SID *dom_sid, char *other_sids) { /* only cope with one "other" sid, right now. */ /* need to count the number of space-delimited sids */ -- cgit From a60e37096d6576dcf749237df99e7c2c96359834 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 18 Jun 2002 09:20:13 +0000 Subject: more debug classess activated (This used to be commit 897e64d2e0c1d04ab93441ccaffe369bf43be46e) --- source3/rpc_parse/parse_dfs.c | 3 +++ source3/rpc_parse/parse_lsa.c | 3 +++ source3/rpc_parse/parse_misc.c | 3 +++ source3/rpc_parse/parse_net.c | 3 +++ source3/rpc_parse/parse_prs.c | 3 +++ source3/rpc_parse/parse_reg.c | 3 +++ source3/rpc_parse/parse_rpc.c | 3 +++ source3/rpc_parse/parse_samr.c | 3 +++ source3/rpc_parse/parse_sec.c | 3 +++ source3/rpc_parse/parse_spoolss.c | 3 +++ source3/rpc_parse/parse_srv.c | 3 +++ source3/rpc_parse/parse_wks.c | 3 +++ 12 files changed, 36 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index 6c83963d7a..38633ac0f7 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -25,6 +25,9 @@ #include "nterr.h" #include "rpc_parse.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* Make a DFS_Q_DFS_QUERY structure *******************************************************************/ diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index e2f3abc910..0cf7ea38f2 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -23,6 +23,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth); /******************************************************************* diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 1883a55121..398ccccab3 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -22,6 +22,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /**************************************************************************** A temporary TALLOC context for things like unistrs, that is valid for the life of a complete RPC call. diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 98266e0fb2..46fdce63ff 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -22,6 +22,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* Reads or writes a structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index c3e4992263..cb84f9bccc 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -22,6 +22,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /** * Dump a prs to a file: from the current location through to the end. **/ diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 1b8d1cd5c8..354ef5c78f 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -24,6 +24,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* Inits a structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index ee15d7cded..41e0b4cb5f 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -23,6 +23,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* interface/version dce/rpc pipe identification ********************************************************************/ diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 8a741d768d..34aa75f1d0 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -27,6 +27,9 @@ #include "rpc_parse.h" #include "nterr.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* inits a SAMR_Q_CLOSE_HND structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index a8c956a209..55e05531cb 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -23,6 +23,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* Sets up a SEC_ACCESS structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 72d88c8129..60b5e60a81 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -24,6 +24,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* return the length of a UNISTR string. ********************************************************************/ diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 107661b49b..3dc054d2b1 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -24,6 +24,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* Inits a SH_INFO_1_STR structure ********************************************************************/ diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c index 3846c2e3b6..7b8fd76b7b 100644 --- a/source3/rpc_parse/parse_wks.c +++ b/source3/rpc_parse/parse_wks.c @@ -22,6 +22,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* Init ********************************************************************/ -- cgit From 900fb62238be30cdc87bfd2bede6fdff611ebae5 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 24 Jun 2002 19:51:23 +0000 Subject: printing merge from SAMBA_2_2. Ther server code looks to be in sync now. Mostly formatting and s/free/SAFE_FREE/g changes with the two exceptions being * John driver init changes * Tim's printer enumeration bug fix (This used to be commit f7536762863811f96364e8acd3716bdb7d665bbf) --- source3/rpc_parse/parse_spoolss.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 60b5e60a81..aa7fcd0010 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -695,6 +695,7 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo while ((available_space > 0) && (i < DM_NUM_OPTIONAL_FIELDS)) { + DEBUG(10, ("spoolss_io_devmode: [%d] bytes left to parse in devmode\n", available_space)); if (!prs_uint32(opt_fields[i].name, ps, depth, opt_fields[i].field)) return False; available_space -= sizeof(uint32); @@ -1115,6 +1116,7 @@ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, q_u->handle = *handle; init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); q_u->size = size; + return True; } -- cgit From 9d6301dfe0e3001086251e3014be772ae63e4dd1 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 24 Jun 2002 23:04:41 +0000 Subject: sync with the sec_desc parsing fix from APP_HEAD. I will probably need to revisit this some. (This used to be commit f471c880db8562231f2d6623124d3e9c31559f4c) --- source3/rpc_parse/parse_sec.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 55e05531cb..07004cda1b 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -365,17 +365,19 @@ size_t sec_desc_size(SEC_DESC *psd) offset = SEC_DESC_HEADER_SIZE; + /* don't align */ + if (psd->owner_sid != NULL) - offset += ((sid_size(psd->owner_sid) + 3) & ~3); + offset += sid_size(psd->owner_sid); if (psd->grp_sid != NULL) - offset += ((sid_size(psd->grp_sid) + 3) & ~3); + offset += sid_size(psd->grp_sid); if (psd->sacl != NULL) - offset += ((psd->sacl->size + 3) & ~3); + offset += psd->sacl->size; if (psd->dacl != NULL) - offset += ((psd->dacl->size + 3) & ~3); + offset += psd->dacl->size; return offset; } @@ -643,7 +645,7 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, if (offset == 0) offset = SEC_DESC_HEADER_SIZE; - offset += ((sid_size(dst->owner_sid) + 3) & ~3); + offset += sid_size(dst->owner_sid); } if (dst->grp_sid != NULL) { @@ -651,7 +653,7 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, if (offset == 0) offset = SEC_DESC_HEADER_SIZE; - offset += ((sid_size(dst->grp_sid) + 3) & ~3); + offset += sid_size(dst->grp_sid); } if (dst->sacl != NULL) { @@ -659,7 +661,7 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, offset_acl = SEC_DESC_HEADER_SIZE; dst->off_sacl = offset_acl; - offset_acl += ((dst->sacl->size + 3) & ~3); + offset_acl += dst->sacl->size; offset += dst->sacl->size; offset_sid += dst->sacl->size; } @@ -670,7 +672,7 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, offset_acl = SEC_DESC_HEADER_SIZE; dst->off_dacl = offset_acl; - offset_acl += ((dst->dacl->size + 3) & ~3); + offset_acl += dst->dacl->size; offset += dst->dacl->size; offset_sid += dst->dacl->size; } @@ -752,7 +754,7 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "sec_io_desc"); depth++; -#if 0 /* JERRY */ +#if 0 /* * if alignment is needed, should be done by the the * caller. Not here. This caused me problems when marshalling @@ -823,9 +825,6 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if(!smb_io_dom_sid("grp_sid", psd->grp_sid, ps, depth)) return False; - if(!prs_align(ps)) - return False; - ps->data_offset = tmp_offset; } @@ -836,8 +835,6 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) return False; if(!sec_io_acl("sacl", &psd->sacl, ps, depth)) return False; - if(!prs_align(ps)) - return False; } max_offset = MAX(max_offset, prs_offset(ps)); @@ -847,8 +844,6 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) return False; if(!sec_io_acl("dacl", &psd->dacl, ps, depth)) return False; - if(!prs_align(ps)) - return False; } max_offset = MAX(max_offset, prs_offset(ps)); -- cgit From caf5a36b68ea1ae15dac19ba51ca86881daeab58 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 26 Jun 2002 17:36:58 +0000 Subject: Added prs_align_uint16 for SD aligns. Jeremy. (This used to be commit 374182a9ba4988cad407e6e6c45057069a3c5793) --- source3/rpc_parse/parse_prs.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index cb84f9bccc..9ce1a650d8 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -447,6 +447,17 @@ BOOL prs_align(prs_struct *ps) return True; } +BOOL prs_align_uint16(prs_struct *ps) +{ + BOOL ret; + uint8 old_align = ps->align; + + ps->align = 2; + ret = prs_align(ps) + ps->align = old_align; + return ret; +} + /******************************************************************* Align only if required (for the unistr2 string mainly) ********************************************************************/ -- cgit From 8dd5ba8cedfc3ea4f341bfee0aeb31fa5e679990 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 26 Jun 2002 17:37:53 +0000 Subject: Typo... Jeremy. (This used to be commit 4ed134426dbf85a4f4e2f7fcef91cd8e8bf31519) --- source3/rpc_parse/parse_prs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 9ce1a650d8..05f38ddd23 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -453,7 +453,7 @@ BOOL prs_align_uint16(prs_struct *ps) uint8 old_align = ps->align; ps->align = 2; - ret = prs_align(ps) + ret = prs_align(ps); ps->align = old_align; return ret; } -- cgit From edb7324a2878d2cab6d779194f082c03430f4ad9 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 26 Jun 2002 19:08:32 +0000 Subject: merge from APP_HEAD (This used to be commit d8cf54399d89b4023102ed8326d35147d91e4168) --- source3/rpc_parse/parse_misc.c | 3 --- source3/rpc_parse/parse_sec.c | 22 +++++++++------------- 2 files changed, 9 insertions(+), 16 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 398ccccab3..01d7698173 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -214,9 +214,6 @@ BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "smb_io_dom_sid"); depth++; - if(!prs_align(ps)) - return False; - if(!prs_uint8 ("sid_rev_num", ps, depth, &sid->sid_rev_num)) return False; if(!prs_uint8 ("num_auths ", ps, depth, &sid->num_auths)) diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 07004cda1b..e97cd261e0 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -1,5 +1,6 @@ /* - * Unix SMB/CIFS implementation. + * Unix SMB/Netbios implementation. + * Version 1.9. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1998, * Copyright (C) Jeremy R. Allison 1995-1998 @@ -46,9 +47,6 @@ BOOL sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "sec_io_access"); depth++; - - if(!prs_align(ps)) - return False; if(!prs_uint32("mask", ps, depth, &(t->mask))) return False; @@ -115,9 +113,6 @@ BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "sec_io_ace"); depth++; - - if(!prs_align(ps)) - return False; old_offset = prs_offset(ps); @@ -296,6 +291,13 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) uint32 offset_acl_size; SEC_ACL *psa; + /* + * Note that the size is always a multiple of 4 bytes due to the + * nature of the data structure. Therefore the prs_align() calls + * have been removed as they through us off when doing two-layer + * marshalling such as in the printing code (NEW_BUFFER). --jerry + */ + if (ppsa == NULL) return False; @@ -312,9 +314,6 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "sec_io_acl"); depth++; - - if(!prs_align(ps)) - return False; old_offset = prs_offset(ps); @@ -344,9 +343,6 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) return False; } - if(!prs_align(ps)) - return False; - if(!prs_uint16_post("size ", ps, depth, &psa->size, offset_acl_size, old_offset)) return False; -- cgit From 8587400d28ae53d25bd10d9dcac60713092720d1 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 27 Jun 2002 01:12:37 +0000 Subject: a null grp_sid should have a 0 offset. Also removed a few more unnecessary prs_align() for sec_desc. (This used to be commit fc3770f281f6344a0589bfe614cd3e559b7259dd) --- source3/rpc_parse/parse_sec.c | 16 ++++++---------- source3/rpc_parse/parse_spoolss.c | 7 ------- 2 files changed, 6 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index e97cd261e0..8ae8264d6d 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -128,9 +128,6 @@ BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth) if(!sec_io_access("info ", &psa->info, ps, depth)) return False; - if(!prs_align(ps)) - return False; - /* check whether object access is present */ if (!sec_ace_object(psa->type)) { if (!smb_io_dom_sid("trustee ", &psa->trustee , ps, depth)) @@ -675,13 +672,13 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, *sd_size = (size_t)((offset == 0) ? SEC_DESC_HEADER_SIZE : offset); - if (dst->owner_sid != NULL) { + if (dst->owner_sid != NULL) dst->off_owner_sid = offset_sid; + + /* sid_size() returns 0 if the sid is NULL so this is ok */ + + if (dst->grp_sid != NULL) dst->off_grp_sid = offset_sid + sid_size(dst->owner_sid); - } - else - if (dst->grp_sid != NULL) - dst->off_grp_sid = offset_sid; return dst; @@ -798,8 +795,6 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if(!smb_io_dom_sid("owner_sid ", psd->owner_sid , ps, depth)) return False; - if(!prs_align(ps)) - return False; ps->data_offset = tmp_offset; } @@ -821,6 +816,7 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if(!smb_io_dom_sid("grp_sid", psd->grp_sid, ps, depth)) return False; + ps->data_offset = tmp_offset; } diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index aa7fcd0010..841d303840 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2367,13 +2367,6 @@ BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, if (!prs_uint32("averageppm", ps, depth, &info->averageppm)) return False; -#if 0 /* JFMTEST */ - if (!prs_uint32_post("secdesc_ptr", ps, depth, NULL, sec_offset, info->secdesc ? prs_offset(ps)-buffer->struct_start : 0 )) - return False; - - if (!sec_io_desc("secdesc", &info->secdesc, ps, depth)) - return False; -#endif return True; } -- cgit From 452eb38df0553886313c9b19a945385d853e19ab Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 28 Jun 2002 00:17:15 +0000 Subject: Proper merge of all the working printing stuff from APPLIANCE_HEAD. Now let's keep this in sync ! Jeremy. (This used to be commit 3603cd4947df2c10df604447dc542932cb9e5d5a) --- source3/rpc_parse/parse_spoolss.c | 147 ++++++++++++++++++++++++++++---------- 1 file changed, 110 insertions(+), 37 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 841d303840..0175406384 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -48,7 +48,7 @@ static uint32 str_len_uni(UNISTR *source) This should be moved in a more generic lib. ********************************************************************/ -static BOOL spoolss_io_system_time(char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) +BOOL spoolss_io_system_time(char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) { if(!prs_uint16("year", ps, depth, &systime->year)) return False; @@ -124,7 +124,7 @@ reads or writes an DOC_INFO structure. static BOOL smb_io_doc_info(char *desc, DOC_INFO *info, prs_struct *ps, int depth) { - uint32 useless_ptr=1; + uint32 useless_ptr=0; if (info == NULL) return False; @@ -324,53 +324,64 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs { uint32 useless_ptr=0xADDE0FF0; - uint32 how_many_words; - BOOL isvalue; - uint32 x; - prs_debug(ps, depth, desc, "smb_io_notify_info_data"); depth++; - how_many_words=data->size; - if (how_many_words==POINTER) { - how_many_words=TWO_VALUE; - } - - isvalue=data->enc_type; - if(!prs_align(ps)) return False; if(!prs_uint16("type", ps, depth, &data->type)) return False; if(!prs_uint16("field", ps, depth, &data->field)) return False; - /*prs_align(ps);*/ - if(!prs_uint32("how many words", ps, depth, &how_many_words)) + if(!prs_uint32("how many words", ps, depth, &data->size)) return False; if(!prs_uint32("id", ps, depth, &data->id)) return False; - if(!prs_uint32("how many words", ps, depth, &how_many_words)) + if(!prs_uint32("how many words", ps, depth, &data->size)) return False; + switch (data->enc_type) { - /*prs_align(ps);*/ + /* One and two value data has two uint32 values */ + + case ONE_VALUE: + case TWO_VALUE: - if (isvalue==True) { if(!prs_uint32("value[0]", ps, depth, &data->notify_data.value[0])) return False; if(!prs_uint32("value[1]", ps, depth, &data->notify_data.value[1])) return False; - /*prs_align(ps);*/ - } else { - /* it's a string */ - /* length in ascii including \0 */ - x=2*(data->notify_data.data.length+1); - if(!prs_uint32("string length", ps, depth, &x )) + break; + + /* Pointers and strings have a string length and a + pointer. For a string the length is expressed as + the number of uint16 characters plus a trailing + \0\0. */ + + case POINTER: + + if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length )) + return False; + if(!prs_uint32("pointer", ps, depth, &useless_ptr)) + return False; + + break; + + case STRING: + + if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length)) return False; + if(!prs_uint32("pointer", ps, depth, &useless_ptr)) return False; - /*prs_align(ps);*/ + + break; + + default: + DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data\n", + data->enc_type)); + break; } return True; @@ -383,22 +394,79 @@ reads or writes an NOTIFY INFO DATA structure. BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) { - uint32 x; - BOOL isvalue; - prs_debug(ps, depth, desc, "smb_io_notify_info_data_strings"); depth++; if(!prs_align(ps)) return False; - isvalue=data->enc_type; + switch(data->enc_type) { + + /* No data for values */ + + case ONE_VALUE: + case TWO_VALUE: + + break; + + /* Strings start with a length in uint16s */ + + case STRING: + + if (UNMARSHALLING(ps)) { + data->notify_data.data.string = + (uint16 *)prs_alloc_mem(ps, data->notify_data.data.length); + + if (!data->notify_data.data.string) + return False; + } + + if (MARSHALLING(ps)) + data->notify_data.data.length /= 2; + + if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length)) + return False; + + if (!prs_uint16uni(True, "string", ps, depth, data->notify_data.data.string, + data->notify_data.data.length)) + return False; + + if (MARSHALLING(ps)) + data->notify_data.data.length *= 2; + + break; + + case POINTER: + + if (UNMARSHALLING(ps)) { + data->notify_data.data.string = + (uint16 *)prs_alloc_mem(ps, data->notify_data.data.length); + + if (!data->notify_data.data.string) + return False; + } + + if(!prs_uint8s(True,"buffer",ps,depth,(uint8*)data->notify_data.data.string,data->notify_data.data.length)) + return False; + + break; + + default: + DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data_strings\n", + data->enc_type)); + break; + } +#if 0 if (isvalue==False) { + /* length of string in unicode include \0 */ x=data->notify_data.data.length+1; + + if (data->field != 16) if(!prs_uint32("string length", ps, depth, &x )) return False; + if (MARSHALLING(ps)) { /* These are already in little endian format. Don't byte swap. */ if (x == 1) { @@ -412,6 +480,10 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, if(!prs_uint8s(True,"string",ps,depth, (uint8 *)&data->notify_data.data.length,x*2)) return False; } else { + + if (data->field == 16) + x /= 2; + if(!prs_uint16uni(True,"string",ps,depth,data->notify_data.data.string,x)) return False; } @@ -427,10 +499,11 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, return False; } } -#if 0 /* JERRY */ - /* Win2k does not seem to put this parse align here */ +#endif +#if 0 /* JERRY */ + /* Win2k does not seem to put this parse align here */ if(!prs_align(ps)) return False; #endif @@ -959,6 +1032,7 @@ BOOL make_spoolss_printer_info_2(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_2 return True; } + /******************************************************************* * read a structure. * called from spoolss_q_open_printer_ex (srv_spoolss.c) @@ -1209,8 +1283,11 @@ BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_st if (!prs_uint32("size", ps, depth, &r_u->size)) return False; - if (UNMARSHALLING(ps)) + if (UNMARSHALLING(ps) && r_u->size) { r_u->data = prs_alloc_mem(ps, r_u->size); + if(r_u->data) + return False; + } if (!prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size)) return False; @@ -5748,9 +5825,7 @@ BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_ return False; if (UNMARSHALLING(ps) && r_u->valuesize) { - r_u->value = (uint16 *)prs_alloc_mem(ps, r_u->valuesize * 2); - if (!r_u->value) { DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata value\n")); return False; @@ -5773,10 +5848,8 @@ BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_ return False; if (UNMARSHALLING(ps) && r_u->datasize) { - r_u->data = (uint8 *)prs_alloc_mem(ps, r_u->datasize); - - if (!r_u->value) { + if (!r_u->data) { DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata data\n")); return False; } -- cgit From 9930b0b0650ae3e38c033c28672398425dd8228c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 1 Jul 2002 09:12:41 +0000 Subject: used findstatic.pl to make some variables static and remove some dead code (This used to be commit 91ad9041e9507d36eb3f40c23c5d4df61f139ef0) --- source3/rpc_parse/parse_lsa.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 0cf7ea38f2..a6aecb7967 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -192,7 +192,7 @@ static BOOL lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, Inits an LSA_OBJ_ATTR structure. ********************************************************************/ -void init_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos) +static void init_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos) { DEBUG(5, ("init_lsa_obj_attr\n")); @@ -729,7 +729,7 @@ static BOOL lsa_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int Reads or writes a dom query structure. ********************************************************************/ -BOOL lsa_io_dom_query_5(char *desc, DOM_QUERY_5 *d_q, prs_struct *ps, int depth) +static BOOL lsa_io_dom_query_5(char *desc, DOM_QUERY_5 *d_q, prs_struct *ps, int depth) { return lsa_io_dom_query("", d_q, ps, depth); } @@ -808,7 +808,7 @@ BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, Inits a LSA_SID_ENUM structure. ********************************************************************/ -void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, +static void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, int num_entries, DOM_SID *sids) { int i; @@ -1753,7 +1753,7 @@ BOOL lsa_io_q_enum_privsaccount(char *desc, LSA_Q_ENUMPRIVSACCOUNT *r_c, prs_str Reads or writes an LUID structure. ********************************************************************/ -BOOL lsa_io_luid(char *desc, LUID *r_c, prs_struct *ps, int depth) +static BOOL lsa_io_luid(char *desc, LUID *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_luid"); depth++; @@ -1774,7 +1774,7 @@ BOOL lsa_io_luid(char *desc, LUID *r_c, prs_struct *ps, int depth) Reads or writes an LUID_ATTR structure. ********************************************************************/ -BOOL lsa_io_luid_attr(char *desc, LUID_ATTR *r_c, prs_struct *ps, int depth) +static BOOL lsa_io_luid_attr(char *desc, LUID_ATTR *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_luid_attr"); depth++; @@ -1795,7 +1795,7 @@ BOOL lsa_io_luid_attr(char *desc, LUID_ATTR *r_c, prs_struct *ps, int depth) Reads or writes an PRIVILEGE_SET structure. ********************************************************************/ -BOOL lsa_io_privilege_set(char *desc, PRIVILEGE_SET *r_c, prs_struct *ps, int depth) +static BOOL lsa_io_privilege_set(char *desc, PRIVILEGE_SET *r_c, prs_struct *ps, int depth) { uint32 i; -- cgit From 5106ead0e041391b9eaa583894cc539e61a0ab5a Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 2 Jul 2002 04:07:32 +0000 Subject: Merge of constant renames from APPLIANCE_HEAD. (This used to be commit daf4c6a013ffa474d768055e73a1cb31ee941e80) --- source3/rpc_parse/parse_spoolss.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 0175406384..34bcda6dc5 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -345,8 +345,8 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs /* One and two value data has two uint32 values */ - case ONE_VALUE: - case TWO_VALUE: + case NOTIFY_ONE_VALUE: + case NOTIFY_TWO_VALUE: if(!prs_uint32("value[0]", ps, depth, &data->notify_data.value[0])) return False; @@ -359,7 +359,7 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs the number of uint16 characters plus a trailing \0\0. */ - case POINTER: + case NOTIFY_POINTER: if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length )) return False; @@ -368,7 +368,7 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs break; - case STRING: + case NOTIFY_STRING: if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length)) return False; @@ -404,14 +404,14 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, /* No data for values */ - case ONE_VALUE: - case TWO_VALUE: + case NOTIFY_ONE_VALUE: + case NOTIFY_TWO_VALUE: break; /* Strings start with a length in uint16s */ - case STRING: + case NOTIFY_STRING: if (UNMARSHALLING(ps)) { data->notify_data.data.string = @@ -436,7 +436,7 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, break; - case POINTER: + case NOTIFY_POINTER: if (UNMARSHALLING(ps)) { data->notify_data.data.string = -- cgit From 9674ec6987a002ebdcfedeac4d66a096a1007bef Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 2 Jul 2002 04:22:59 +0000 Subject: fixed our winreg parsing to handle a diifferent form given to us by WinXP. This fixes setting security decsriptors from XP Professional. (This used to be commit 80c3c68de20a686ced38356fd68f80a53e6f1626) --- source3/rpc_parse/parse_reg.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 354ef5c78f..26d748657c 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1010,13 +1010,15 @@ BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) if(!prs_uint32("ptr_buflen", ps, depth, &(r_q->ptr_buflen))) return False; - if(!prs_uint32("buflen", ps, depth, &(r_q->buflen))) - return False; - if(!prs_uint32("ptr_buflen2", ps, depth, &(r_q->ptr_buflen2))) - return False; - if(!prs_uint32("buflen2", ps, depth, &(r_q->buflen2))) - return False; + if (r_q->ptr_buflen) { + if(!prs_uint32("buflen", ps, depth, &(r_q->buflen))) + return False; + if(!prs_uint32("ptr_buflen2", ps, depth, &(r_q->ptr_buflen2))) + return False; + if(!prs_uint32("buflen2", ps, depth, &(r_q->buflen2))) + return False; + } return True; } -- cgit From 8e52737efc9cf746d7e9fd1f07bc42201dccbfba Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 3 Jul 2002 07:37:54 +0000 Subject: Break up the passdb objects (to allow RPC clients to link without brining in *.o) and implment new enum_dom_users code in the SAMR RPC subsystem. Incresingly, we are using the pdb_get_{user,group}_sid() functions, in the eventual hope that we might one day support muliple domains off a single passdb. To extract the RID, we use sid_peek_check_rid(), and supply an 'expected' domain SID. The id21 -> SAM_ACCOUNT and id23 -> SAM_ACCOUNT code has been moved to srv_samr_util.c, to ease linking in passdb users. Compatiblity code that uses 'get_global_sam_sid()' for the 'expected' sid is in pdb_compat.c Andrew Bartlett (This used to be commit 5a2a6f1ba316489d118a8bdd9551b155226de94f) --- source3/rpc_parse/parse_samr.c | 91 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 80 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 34aa75f1d0..137883cc7e 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1440,7 +1440,8 @@ inits a SAM_DISPINFO_1 structure. ********************************************************************/ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_entries, - uint32 start_idx, DISP_USER_INFO *disp_user_info) + uint32 start_idx, DISP_USER_INFO *disp_user_info, + DOM_SID *domain_sid) { uint32 len_sam_name, len_sam_full, len_sam_desc; uint32 i; @@ -1468,6 +1469,9 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_en const char *username; const char *fullname; const char *acct_desc; + uint32 user_rid; + const DOM_SID *user_sid; + fstring user_sid_string, domain_sid_string; DEBUG(11, ("init_sam_dispinfo_1: entry: %d\n",i)); @@ -1486,14 +1490,25 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_en if (!acct_desc) acct_desc = ""; + user_sid = pdb_get_user_sid(pwd); + + if (!sid_peek_check_rid(domain_sid, user_sid, &user_rid)) { + DEBUG(0, ("init_sam_dispinfo_1: User %s has SID %s, which conflicts with " + "the domain sid %s. Failing operation.\n", + username, + sid_to_string(user_sid_string, user_sid), + sid_to_string(domain_sid_string, domain_sid))); + return NT_STATUS_UNSUCCESSFUL; + } + len_sam_name = strlen(username); len_sam_full = strlen(fullname); len_sam_desc = strlen(acct_desc); init_sam_entry1(&sam->sam[i], start_idx + i + 1, len_sam_name, len_sam_full, len_sam_desc, - pdb_get_user_rid(pwd), pdb_get_acct_ctrl(pwd)); - + user_rid, pdb_get_acct_ctrl(pwd)); + ZERO_STRUCTP(&sam->str[i].uni_acct_name); ZERO_STRUCTP(&sam->str[i].uni_full_name); ZERO_STRUCTP(&sam->str[i].uni_acct_desc); @@ -1560,7 +1575,8 @@ inits a SAM_DISPINFO_2 structure. ********************************************************************/ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_entries, - uint32 start_idx, DISP_USER_INFO *disp_user_info) + uint32 start_idx, DISP_USER_INFO *disp_user_info, + DOM_SID *domain_sid ) { uint32 len_sam_name, len_sam_desc; uint32 i; @@ -1583,20 +1599,39 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_en ZERO_STRUCTP(sam->str); for (i = 0; i < num_entries; i++) { + uint32 user_rid; + const DOM_SID *user_sid; + const char *username; + const char *acct_desc; + fstring user_sid_string, domain_sid_string; + DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i)); pwd=disp_user_info[i+start_idx].sam; - len_sam_name = strlen(pdb_get_username(pwd)); - len_sam_desc = strlen(pdb_get_acct_desc(pwd)); + username = pdb_get_username(pwd); + acct_desc = pdb_get_acct_desc(pwd); + user_sid = pdb_get_user_sid(pwd); + + if (!sid_peek_check_rid(domain_sid, user_sid, &user_rid)) { + DEBUG(0, ("init_sam_dispinfo_2: User %s has SID %s, which conflicts with " + "the domain sid %s. Failing operation.\n", + username, + sid_to_string(user_sid_string, user_sid), + sid_to_string(domain_sid_string, domain_sid))); + return NT_STATUS_UNSUCCESSFUL; + } + + len_sam_name = strlen(username); + len_sam_desc = strlen(acct_desc); init_sam_entry2(&sam->sam[i], start_idx + i + 1, len_sam_name, len_sam_desc, - pdb_get_user_rid(pwd), pdb_get_acct_ctrl(pwd)); + user_rid, pdb_get_acct_ctrl(pwd)); ZERO_STRUCTP(&sam->str[i].uni_srv_name); ZERO_STRUCTP(&sam->str[i].uni_srv_desc); - init_unistr2(&sam->str[i].uni_srv_name, pdb_get_username(pwd), len_sam_name); + init_unistr2(&sam->str[i].uni_srv_name, username, len_sam_name); init_unistr2(&sam->str[i].uni_srv_desc, pdb_get_acct_desc(pwd), len_sam_desc); } @@ -5844,7 +5879,7 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, *************************************************************************/ -void init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw) +NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID *domain_sid) { NTTIME logon_time, logoff_time, kickoff_time, pass_last_set_time, pass_can_change_time, @@ -5865,6 +5900,12 @@ void init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw) const char* workstations = pdb_get_workstations(pw); const char* munged_dial = pdb_get_munged_dial(pw); + uint32 user_rid; + const DOM_SID *user_sid; + + uint32 group_rid; + const DOM_SID *group_sid; + len_user_name = user_name != NULL ? strlen(user_name )+1 : 0; len_full_name = full_name != NULL ? strlen(full_name )+1 : 0; len_home_dir = home_dir != NULL ? strlen(home_dir )+1 : 0; @@ -5907,8 +5948,34 @@ void init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw) ZERO_STRUCT(usr->nt_pwd); ZERO_STRUCT(usr->lm_pwd); - usr->user_rid = pdb_get_user_rid(pw); - usr->group_rid = pdb_get_group_rid(pw); + user_sid = pdb_get_user_sid(pw); + + if (!sid_peek_check_rid(domain_sid, user_sid, &user_rid)) { + fstring user_sid_string; + fstring domain_sid_string; + 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_to_string(user_sid_string, user_sid), + sid_to_string(domain_sid_string, domain_sid))); + return NT_STATUS_UNSUCCESSFUL; + } + + group_sid = pdb_get_group_sid(pw); + + if (!sid_peek_check_rid(domain_sid, group_sid, &group_rid)) { + fstring group_sid_string; + fstring domain_sid_string; + 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_to_string(group_sid_string, group_sid), + sid_to_string(domain_sid_string, domain_sid))); + return NT_STATUS_UNSUCCESSFUL; + } + + usr->user_rid = user_rid; + usr->group_rid = group_rid; usr->acb_info = pdb_get_acct_ctrl(pw); usr->unknown_3 = pdb_get_unknown3(pw); @@ -5937,6 +6004,8 @@ void init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw) memcpy(&usr->logon_hrs.hours, pdb_get_hours(pw), MAX_HOURS_LEN); } else memset(&usr->logon_hrs, 0xff, sizeof(usr->logon_hrs)); + + return NT_STATUS_OK; } /******************************************************************* -- cgit From a3c3960edc63eb242620bbda373cfd9ba8e7ad65 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 3 Jul 2002 19:15:26 +0000 Subject: first cut at implementing support for browsing printer and driver driver via regedt32.exe. The regsitry.tdb is only a framework. It is not intended to store values, only key/subkey structure. The data will be retrieved from nt*tdb (for printers) creating a virtual view of the data. You can currently connect to a Samba box using regedt32.exe (haven't tried regedit.exe). Some basic keys are created in registry.tdb for use. There are two problems.... * something is getting freed in the winreg code that causes heap corruption later on. As long as you don't play with the winreg server functionality, I don't think you'll be bitten by this. * no access controls are currently implemented * I can't browse HKLM because regedt32 greys out the SYSTEM subkey. ok so that was three.... (This used to be commit 542d3c93a998083c07b2afa91a7c927c376caf54) --- source3/rpc_parse/parse_reg.c | 57 ++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 26d748657c..e1913990eb 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -571,7 +571,7 @@ BOOL reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int d return False; if(!prs_uint32("max_subkeylen ", ps, depth, &r_r->max_subkeylen)) return False; - if(!prs_uint32("mak_subkeysize", ps, depth, &r_r->max_subkeysize)) + if(!prs_uint32("reserved ", ps, depth, &r_r->reserved)) return False; if(!prs_uint32("num_values ", ps, depth, &r_r->num_values)) return False; @@ -594,7 +594,7 @@ BOOL reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int d Inits a structure. ********************************************************************/ -void init_reg_q_unk_1a(REG_Q_UNK_1A *q_o, POLICY_HND *hnd) +void init_reg_q_unknown_1a(REG_Q_UNKNOWN_1A *q_o, POLICY_HND *hnd) { memcpy(&q_o->pol, hnd, sizeof(q_o->pol)); } @@ -603,12 +603,12 @@ void init_reg_q_unk_1a(REG_Q_UNK_1A *q_o, POLICY_HND *hnd) reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_unk_1a(char *desc, REG_Q_UNK_1A *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_unknown_1a(char *desc, REG_Q_UNKNOWN_1A *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; - prs_debug(ps, depth, desc, "reg_io_q_unk_1a"); + prs_debug(ps, depth, desc, "reg_io_q_unknown_1a"); depth++; if(!prs_align(ps)) @@ -624,12 +624,12 @@ BOOL reg_io_q_unk_1a(char *desc, REG_Q_UNK_1A *r_q, prs_struct *ps, int depth) reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_unk_1a(char *desc, REG_R_UNK_1A *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_unknown_1a(char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; - prs_debug(ps, depth, desc, "reg_io_r_unk_1a"); + prs_debug(ps, depth, desc, "reg_io_r_unknown_1a"); depth++; if(!prs_align(ps)) @@ -648,12 +648,12 @@ BOOL reg_io_r_unk_1a(char *desc, REG_R_UNK_1A *r_r, prs_struct *ps, int depth) ********************************************************************/ void init_reg_q_open_hku(REG_Q_OPEN_HKU *q_o, - uint16 unknown_0, uint32 level) + uint16 unknown_0, uint32 access_mask) { q_o->ptr = 1; q_o->unknown_0 = unknown_0; q_o->unknown_1 = 0x0; /* random - changes */ - q_o->level = level; + q_o->access_mask = access_mask; } /******************************************************************* @@ -674,11 +674,11 @@ BOOL reg_io_q_open_hku(char *desc, REG_Q_OPEN_HKU *r_q, prs_struct *ps, int dep if(!prs_uint32("ptr ", ps, depth, &r_q->ptr)) return False; if (r_q->ptr != 0) { - if(!prs_uint16("unknown_0", ps, depth, &r_q->unknown_0)) + if(!prs_uint16("unknown_0 ", ps, depth, &r_q->unknown_0)) return False; - if(!prs_uint16("unknown_1", ps, depth, &r_q->unknown_1)) + if(!prs_uint16("unknown_1 ", ps, depth, &r_q->unknown_1)) return False; - if(!prs_uint32("level ", ps, depth, &r_q->level)) + if(!prs_uint32("access_mask ", ps, depth, &r_q->access_mask)) return False; } @@ -729,7 +729,7 @@ BOOL reg_io_q_close(char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth) if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "reg_io_q_unknown_1"); + prs_debug(ps, depth, desc, "reg_io_q_close"); depth++; if(!prs_align(ps)) @@ -752,7 +752,7 @@ BOOL reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "reg_io_r_unknown_1"); + prs_debug(ps, depth, desc, "reg_io_r_close"); depth++; if(!prs_align(ps)) @@ -1353,6 +1353,29 @@ void init_reg_q_enum_key(REG_Q_ENUM_KEY *q_i, POLICY_HND *pol, uint32 key_idx) unix_to_nt_time(&q_i->time, 0); /* current time? */ } +/******************************************************************* +makes a reply structure. +********************************************************************/ + +void init_reg_r_enum_key(REG_R_ENUM_KEY *r_u, char *subkey, uint32 unknown_1, + uint32 unknown_2) +{ + if ( !r_u ) + return; + + r_u->unknown_1 = unknown_1; + r_u->unknown_2 = unknown_2; + r_u->unknown_3 = 0x0; + + r_u->key_name_len = (strlen(subkey)+1) * 2; + if (r_u->key_name_len) + r_u->ptr1 = 0x1; + init_unistr3( &r_u->key_name, subkey ); + + r_u->ptr2 = 0x1; + r_u->ptr3 = 0x1; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -1468,7 +1491,7 @@ makes a structure. ********************************************************************/ void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, - char *key_name, uint32 unk) + char *key_name, uint32 access_desired) { int len_name = strlen(key_name)+1; @@ -1478,7 +1501,7 @@ void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, init_unistr2(&r_q->uni_name, key_name, len_name); r_q->unknown_0 = 0x00000000; - r_q->unknown_1 = unk; + r_q->access_desired = access_desired; } /******************************************************************* @@ -1506,9 +1529,9 @@ BOOL reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int if(!prs_align(ps)) return False; - if(!prs_uint32("unknown_0", ps, depth, &r_q->unknown_0)) + if(!prs_uint32("unknown_0 ", ps, depth, &r_q->unknown_0)) return False; - if(!prs_uint32("unknown_1", ps, depth, &r_q->unknown_1)) + if(!prs_uint32("asccess_desired ", ps, depth, &r_q->access_desired)) return False; return True; -- cgit From e48b3fe83c13aa9b061a880852d8ddd6623c29d6 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 4 Jul 2002 13:11:54 +0000 Subject: More code from "Kai Krueger" , this time starting to make the 'user cannot change password' button work. Needs help from a future SAM backend, but at least this parses the data, and returns an error. Andrew Bartlett (This used to be commit 0c4afe075aa018ec2be10f36fd3f0a5af2a032f1) --- source3/rpc_parse/parse_samr.c | 52 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 137883cc7e..c16232204c 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -390,6 +390,36 @@ BOOL samr_io_r_get_usrdom_pwinfo(char *desc, SAMR_R_GET_USRDOM_PWINFO * r_u, return True; } + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_q_set_sec_obj(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. ********************************************************************/ @@ -864,6 +894,28 @@ BOOL samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, return True; } +/******************************************************************* +reads or writes a SAMR_R_SET_SEC_OBJ structure. +********************************************************************/ + +BOOL samr_io_r_set_sec_obj(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. ********************************************************************/ -- cgit From 26d161ff85a3a551990a6cb44f37ef28bd8dcdd6 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 4 Jul 2002 13:18:56 +0000 Subject: fixed the geyed out registry keys. Stupid typo on my part. Now on to plug in the printing tdbs to the registry view.... jerry (This used to be commit 2a68e4529ad884e8c3800f9006bb1c2b18cfada4) --- source3/rpc_parse/parse_reg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index e1913990eb..1ebc1532f3 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -129,11 +129,11 @@ BOOL reg_io_q_open_hklm(char *desc, REG_Q_OPEN_HKLM * r_q, prs_struct *ps, if (r_q->ptr != 0) { if (!prs_uint16("unknown_0", ps, depth, &(r_q->unknown_0))) - return False; + return False; if (!prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1))) - return False; + return False; if (!prs_uint32("access_mask", ps, depth, &(r_q->access_mask))) - return False; + return False; } return True; -- cgit From 100b8986ea185817c575a3c0f475126f64b520b1 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 8 Jul 2002 18:34:55 +0000 Subject: * basic implementation of SPOOLSS_DELETEPRINTERDATAEX and SPOOLSS_DELETEPRINTERKEY * stub funnctions for SPOOLSS_ADDPRINTERDRIVEREX and SPOOLSS_DELETEPRINTERDRIVEREX (This used to be commit d675974d0c04a68d48d90492005056d96697c96c) --- source3/rpc_parse/parse_spoolss.c | 80 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 34bcda6dc5..b350bf6db3 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1263,6 +1263,48 @@ BOOL spoolss_io_r_deleteprinterdata(char *desc, SPOOL_R_DELETEPRINTERDATA *r_u, return True; } +/******************************************************************* + * read a structure. + * called from spoolss_q_deleteprinterdataex (srv_spoolss.c) + ********************************************************************/ + +BOOL spoolss_io_q_deleteprinterdataex(char *desc, SPOOL_Q_DELETEPRINTERDATAEX *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_deleteprinterdataex"); + depth++; + + if (!prs_align(ps)) + return False; + if (!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) + return False; + + if (!smb_io_unistr2("keyname ", &q_u->keyname, True, ps, depth)) + return False; + if (!smb_io_unistr2("valuename", &q_u->valuename, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_deleteprinterdataex (srv_spoolss.c) + ********************************************************************/ + +BOOL spoolss_io_r_deleteprinterdataex(char *desc, SPOOL_R_DELETEPRINTERDATAEX *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterdataex"); + depth++; + + if(!prs_werror("status", ps, depth, &r_u->status)) + return False; + + return True; +} + /******************************************************************* * write a structure. * called from spoolss_r_getprinterdata (srv_spoolss.c) @@ -6880,6 +6922,44 @@ BOOL spoolss_io_r_enumprinterkey(char *desc, SPOOL_R_ENUMPRINTERKEY *r_u, prs_st return True; } +/******************************************************************* + * read a structure. + ********************************************************************/ + +BOOL spoolss_io_q_deleteprinterkey(char *desc, SPOOL_Q_DELETEPRINTERKEY *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_deleteprinterkey"); + depth++; + + if(!prs_align(ps)) + return False; + if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) + return False; + + if(!smb_io_unistr2("", &q_u->keyname, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + * write a structure. + ********************************************************************/ + +BOOL spoolss_io_r_deleteprinterkey(char *desc, SPOOL_R_DELETEPRINTERKEY *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterkey"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status", ps, depth, &r_u->status)) + return False; + + return True; +} + /******************************************************************* * read a structure. -- cgit From e247cb8239275be517802f80bc82462fbfc1f5c3 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 8 Jul 2002 20:15:47 +0000 Subject: added parsing routines for SPOOLSS_ADDPRINTERDRIVEREX and SPOOLSS_DELETEPRINTERDRIVEREX. Ran them through some testing. I know I'm off by 2 x uint32's in the former RPC. (This used to be commit 55fbfd02ba917b74fd4df7a1aa8cc8c5a91e3e07) --- source3/rpc_parse/parse_spoolss.c | 101 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b350bf6db3..20f4f452a4 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1492,6 +1492,60 @@ BOOL spoolss_io_r_deleteprinterdriver(char *desc, SPOOL_R_DELETEPRINTERDRIVER *r } +/******************************************************************* + * read a structure. + * called from api_spoolss_deleteprinterdriver (srv_spoolss.c) + * called from spoolss_deleteprinterdriver (cli_spoolss.c) + ********************************************************************/ + +BOOL spoolss_io_q_deleteprinterdriverex(char *desc, SPOOL_Q_DELETEPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_deleteprinterdriverex"); + 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(!smb_io_unistr2("arch", &q_u->arch, True, ps, depth)) + return False; + if(!smb_io_unistr2("driver", &q_u->driver, True, ps, depth)) + return False; + if(!prs_uint32("delete_flags ", ps, depth, &q_u->delete_flags)) + return False; + if(!prs_uint32("version ", ps, depth, &q_u->version)) + return False; + + + return True; +} + + +/******************************************************************* + * write a structure. + ********************************************************************/ +BOOL spoolss_io_r_deleteprinterdriverex(char *desc, SPOOL_R_DELETEPRINTERDRIVEREX *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterdriverex"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_werror("status", ps, depth, &r_u->status)) + return False; + + return True; +} + + /******************************************************************* * read a structure. @@ -5359,6 +5413,53 @@ BOOL spoolss_io_r_addprinterdriver(char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, pr return True; } +/******************************************************************* + fill in the prs_struct for a ADDPRINTERDRIVER request PDU + ********************************************************************/ + +BOOL spoolss_io_q_addprinterdriverex(char *desc, SPOOL_Q_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_addprinterdriverex"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("server_name_ptr", ps, depth, &q_u->server_name_ptr)) + return False; + if(!smb_io_unistr2("server_name", &q_u->server_name, q_u->server_name_ptr, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + if(!prs_uint32("info_level", ps, depth, &q_u->level)) + return False; + + if(!spool_io_printer_driver_info_level("", &q_u->info, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + if(!prs_uint32("copy flags", ps, depth, &q_u->copy_flags)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +BOOL spoolss_io_r_addprinterdriverex(char *desc, SPOOL_R_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_addprinterdriverex"); + depth++; + + if(!prs_werror("status", ps, depth, &q_u->status)) + return False; + + return True; +} + /******************************************************************* ********************************************************************/ -- cgit From f7ed521501a334b396a50cf8e1feb236bf4e6e99 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 8 Jul 2002 22:01:51 +0000 Subject: fixup ADDPRINTERDRIVEREX some more. unknown uint32 for now. (This used to be commit b0f178f452a816c6a77b0f5a77fdd8930da98cac) --- source3/rpc_parse/parse_spoolss.c | 45 +++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 20f4f452a4..0bcace8a00 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5034,14 +5034,17 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ if(!prs_align(ps)) return False; + if (!prs_uint32("unknown ", ps, depth, &il->unknown)) + return False; /* parse the main elements the packet */ - if(!prs_uint32("version", ps, depth, &il->version)) + if(!prs_uint32("cversion ", ps, depth, &il->version)) + return False; + + if(!prs_uint32("name ", ps, depth, &il->name_ptr)) return False; - if(!prs_uint32("name_ptr", ps, depth, &il->name_ptr)) - return False; /* * If name_ptr is NULL then the next 4 bytes are the name_ptr. A driver * with a NULL name just isn't a driver For example: "HP LaserJet 4si" @@ -5053,41 +5056,41 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ return False; } - if(!prs_uint32("environment_ptr", ps, depth, &il->environment_ptr)) + if(!prs_uint32("environment", ps, depth, &il->environment_ptr)) return False; - if(!prs_uint32("driverpath_ptr", ps, depth, &il->driverpath_ptr)) + if(!prs_uint32("driverpath ", ps, depth, &il->driverpath_ptr)) return False; - if(!prs_uint32("datafile_ptr", ps, depth, &il->datafile_ptr)) + if(!prs_uint32("datafile ", ps, depth, &il->datafile_ptr)) return False; - if(!prs_uint32("configfile_ptr", ps, depth, &il->configfile_ptr)) + if(!prs_uint32("configfile ", ps, depth, &il->configfile_ptr)) return False; - if(!prs_uint32("helpfile_ptr", ps, depth, &il->helpfile_ptr)) + if(!prs_uint32("helpfile ", ps, depth, &il->helpfile_ptr)) return False; - if(!prs_uint32("monitorname_ptr", ps, depth, &il->monitorname_ptr)) + if(!prs_uint32("monitorname", ps, depth, &il->monitorname_ptr)) return False; - if(!prs_uint32("defaultdatatype_ptr", ps, depth, &il->defaultdatatype_ptr)) + if(!prs_uint32("defaultdatatype", ps, depth, &il->defaultdatatype_ptr)) return False; - if(!prs_uint32("dependentfiles_len", ps, depth, &il->dependentfiles_len)) + if(!prs_uint32("dependentfiles ", ps, depth, &il->dependentfiles_len)) return False; - if(!prs_uint32("dependentfiles_ptr", ps, depth, &il->dependentfiles_ptr)) + if(!prs_uint32("dependentfiles ", ps, depth, &il->dependentfiles_ptr)) return False; - if(!prs_uint32("previousnames_len", ps, depth, &il->previousnames_len)) + if(!prs_uint32("previousnames ", ps, depth, &il->previousnames_len)) return False; - if(!prs_uint32("previousnames_ptr", ps, depth, &il->previousnames_ptr)) + if(!prs_uint32("previousnames ", ps, depth, &il->previousnames_ptr)) return False; - if(!smb_io_time("driverdate", &il->driverdate, ps, depth)) + if(!smb_io_time("driverdate ", &il->driverdate, ps, depth)) return False; - if(!prs_uint32("dummy4", ps, depth, &il->dummy4)) + if(!prs_uint32("dummy4 ", ps, depth, &il->dummy4)) return False; - if(!prs_uint64("driverversion", ps, depth, &il->driverversion)) + if(!prs_uint64("driverversion ", ps, depth, &il->driverversion)) return False; - if(!prs_uint32("mfgname_ptr", ps, depth, &il->mfgname_ptr)) + if(!prs_uint32("mfgname ", ps, depth, &il->mfgname_ptr)) return False; - if(!prs_uint32("oemurl_ptr", ps, depth, &il->oemurl_ptr)) + if(!prs_uint32("oemurl ", ps, depth, &il->oemurl_ptr)) return False; - if(!prs_uint32("hardwareid_ptr", ps, depth, &il->hardwareid_ptr)) + if(!prs_uint32("hardwareid ", ps, depth, &il->hardwareid_ptr)) return False; - if(!prs_uint32("provider_ptr", ps, depth, &il->provider_ptr)) + if(!prs_uint32("provider ", ps, depth, &il->provider_ptr)) return False; /* parse the structures in the packet */ -- cgit From 51eeaa494cf88b3f2438406cd8f716091069134f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 9 Jul 2002 23:23:19 +0000 Subject: 8-byte alignment needed for beginning driver_info_level_6. Verified by looking at NT4 and 2k servers. First time for everything I guess. (This used to be commit f57640720e4758176116bc2e1b578cf0e867f95f) --- source3/rpc_parse/parse_prs.c | 21 +++++++++++++++++++++ source3/rpc_parse/parse_spoolss.c | 37 +++++++++++++++---------------------- 2 files changed, 36 insertions(+), 22 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 05f38ddd23..2ab8c7246e 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -447,6 +447,10 @@ BOOL prs_align(prs_struct *ps) return True; } +/****************************************************************** + Align on a 2 byte boundary + *****************************************************************/ + BOOL prs_align_uint16(prs_struct *ps) { BOOL ret; @@ -455,6 +459,23 @@ BOOL prs_align_uint16(prs_struct *ps) ps->align = 2; ret = prs_align(ps); ps->align = old_align; + + return ret; +} + +/****************************************************************** + Align on a 8 byte boundary + *****************************************************************/ + +BOOL prs_align_uint64(prs_struct *ps) +{ + BOOL ret; + uint8 old_align = ps->align; + + ps->align = 8; + ret = prs_align(ps); + ps->align = old_align; + return ret; } diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 0bcace8a00..c74249878a 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5034,39 +5034,32 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ if(!prs_align(ps)) return False; - if (!prs_uint32("unknown ", ps, depth, &il->unknown)) + /* + * I know this seems weird, but I have no other explanation. + * This is observed behavior on both NT4 and 2K servers. + * --jerry + */ + + if (!prs_align_uint64(ps)) return False; /* parse the main elements the packet */ - if(!prs_uint32("cversion ", ps, depth, &il->version)) + if(!prs_uint32("cversion ", ps, depth, &il->version)) return False; - - if(!prs_uint32("name ", ps, depth, &il->name_ptr)) + if(!prs_uint32("name ", ps, depth, &il->name_ptr)) return False; - - /* - * If name_ptr is NULL then the next 4 bytes are the name_ptr. A driver - * with a NULL name just isn't a driver For example: "HP LaserJet 4si" - * from W2K CDROM (which uses unidriver). JohnR 010205 - */ - if (!il->name_ptr) { - DEBUG(5,("spool_io_printer_driver_info_level_6: name_ptr is NULL! Get next value\n")); - if(!prs_uint32("name_ptr", ps, depth, &il->name_ptr)) - return False; - } - - if(!prs_uint32("environment", ps, depth, &il->environment_ptr)) + if(!prs_uint32("environment ", ps, depth, &il->environment_ptr)) return False; - if(!prs_uint32("driverpath ", ps, depth, &il->driverpath_ptr)) + if(!prs_uint32("driverpath ", ps, depth, &il->driverpath_ptr)) return False; - if(!prs_uint32("datafile ", ps, depth, &il->datafile_ptr)) + if(!prs_uint32("datafile ", ps, depth, &il->datafile_ptr)) return False; - if(!prs_uint32("configfile ", ps, depth, &il->configfile_ptr)) + if(!prs_uint32("configfile ", ps, depth, &il->configfile_ptr)) return False; - if(!prs_uint32("helpfile ", ps, depth, &il->helpfile_ptr)) + if(!prs_uint32("helpfile ", ps, depth, &il->helpfile_ptr)) return False; - if(!prs_uint32("monitorname", ps, depth, &il->monitorname_ptr)) + if(!prs_uint32("monitorname ", ps, depth, &il->monitorname_ptr)) return False; if(!prs_uint32("defaultdatatype", ps, depth, &il->defaultdatatype_ptr)) return False; -- cgit From 0aadcff8ec1caa7e8a8cc9c5738bc8d57be7b24f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 11 Jul 2002 03:27:12 +0000 Subject: all that is left to do is to actually perform the file deletion now. I have the file list. One more commit should do it. (This used to be commit 7207662504f585352b0ceeb99f8998ef58db7f15) --- source3/rpc_parse/parse_spoolss.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index c74249878a..b10a5c4377 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1516,6 +1516,10 @@ BOOL spoolss_io_q_deleteprinterdriverex(char *desc, SPOOL_Q_DELETEPRINTERDRIVERE return False; if(!smb_io_unistr2("driver", &q_u->driver, True, ps, depth)) return False; + + if (!prs_align(ps)) + return False; + if(!prs_uint32("delete_flags ", ps, depth, &q_u->delete_flags)) return False; if(!prs_uint32("version ", ps, depth, &q_u->version)) -- cgit From e40abc248f6456a7dba3a4c4c4274c0e7b77020f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 12 Jul 2002 21:09:24 +0000 Subject: The changes in make_sec_desc to make us match W2K broke the marshalling/unmarshalling of security descriptors. We need to calculate the maximum offset and set the offset back after reading/writing every field in the SEC_DESC. This was *nasty* to find.... Jeremy. (This used to be commit 175d43980e57c25582d8ab859f5730283e82f3b2) --- source3/rpc_parse/parse_sec.c | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 8ae8264d6d..56eaf4c5b5 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -782,64 +782,69 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if (psd->off_owner_sid != 0) { + tmp_offset = ps->data_offset; + if(!prs_set_offset(ps, old_offset + psd->off_owner_sid)) + return False; + if (UNMARSHALLING(ps)) { - if(!prs_set_offset(ps, old_offset + psd->off_owner_sid)) - return False; /* reading */ if((psd->owner_sid = (DOM_SID *)prs_alloc_mem(ps,sizeof(*psd->owner_sid))) == NULL) return False; } - tmp_offset = ps->data_offset; - ps->data_offset = psd->off_owner_sid; - if(!smb_io_dom_sid("owner_sid ", psd->owner_sid , ps, depth)) return False; - ps->data_offset = tmp_offset; - } + max_offset = MAX(max_offset, prs_offset(ps)); - max_offset = MAX(max_offset, prs_offset(ps)); + if (!prs_set_offset(ps,tmp_offset)) + return False; + } if (psd->off_grp_sid != 0) { + tmp_offset = ps->data_offset; + if(!prs_set_offset(ps, old_offset + psd->off_grp_sid)) + return False; + if (UNMARSHALLING(ps)) { /* reading */ - if(!prs_set_offset(ps, old_offset + psd->off_grp_sid)) - return False; if((psd->grp_sid = (DOM_SID *)prs_alloc_mem(ps,sizeof(*psd->grp_sid))) == NULL) return False; } - tmp_offset = ps->data_offset; - ps->data_offset = psd->off_grp_sid; - if(!smb_io_dom_sid("grp_sid", psd->grp_sid, ps, depth)) return False; - ps->data_offset = tmp_offset; - } + max_offset = MAX(max_offset, prs_offset(ps)); - max_offset = MAX(max_offset, prs_offset(ps)); + if (!prs_set_offset(ps,tmp_offset)) + return False; + } if ((psd->type & SEC_DESC_SACL_PRESENT) && psd->off_sacl) { + tmp_offset = ps->data_offset; if(!prs_set_offset(ps, old_offset + psd->off_sacl)) return False; if(!sec_io_acl("sacl", &psd->sacl, ps, depth)) return False; + max_offset = MAX(max_offset, prs_offset(ps)); + if (!prs_set_offset(ps,tmp_offset)) + return False; } - max_offset = MAX(max_offset, prs_offset(ps)); if ((psd->type & SEC_DESC_DACL_PRESENT) && psd->off_dacl != 0) { + tmp_offset = ps->data_offset; if(!prs_set_offset(ps, old_offset + psd->off_dacl)) return False; if(!sec_io_acl("dacl", &psd->dacl, ps, depth)) return False; + max_offset = MAX(max_offset, prs_offset(ps)); + if (!prs_set_offset(ps,tmp_offset)) + return False; } - max_offset = MAX(max_offset, prs_offset(ps)); - if(!prs_set_offset(ps, max_offset)) return False; return True; -- cgit From e90b65284812aaa5ff9e9935ce9bbad7791cbbcd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 15 Jul 2002 10:35:28 +0000 Subject: updated the 3.0 branch from the head branch - ready for alpha18 (This used to be commit 03ac082dcb375b6f3ca3d810a6a6367542bc23ce) --- source3/rpc_parse/parse_dfs.c | 3 + source3/rpc_parse/parse_lsa.c | 78 ++-- source3/rpc_parse/parse_misc.c | 53 ++- source3/rpc_parse/parse_net.c | 14 +- source3/rpc_parse/parse_prs.c | 37 +- source3/rpc_parse/parse_reg.c | 80 ++-- source3/rpc_parse/parse_rpc.c | 3 + source3/rpc_parse/parse_samr.c | 188 ++++++++-- source3/rpc_parse/parse_sec.c | 109 +++--- source3/rpc_parse/parse_spoolss.c | 744 ++++++++++++++++++++++++++++++++------ source3/rpc_parse/parse_srv.c | 272 ++++++++++---- source3/rpc_parse/parse_wks.c | 3 + 12 files changed, 1244 insertions(+), 340 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index 6c83963d7a..38633ac0f7 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -25,6 +25,9 @@ #include "nterr.h" #include "rpc_parse.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* Make a DFS_Q_DFS_QUERY structure *******************************************************************/ diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 91b54b9c83..a6aecb7967 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -4,6 +4,7 @@ * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997. + * Copyright (C) Andrew Bartlett 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 @@ -22,6 +23,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth); /******************************************************************* @@ -188,7 +192,7 @@ static BOOL lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, Inits an LSA_OBJ_ATTR structure. ********************************************************************/ -void init_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos) +static void init_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos) { DEBUG(5, ("init_lsa_obj_attr\n")); @@ -523,40 +527,52 @@ BOOL lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, Inits an LSA_R_ENUM_TRUST_DOM structure. ********************************************************************/ -void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context, - char *domain_name, DOM_SID *domain_sid, - NTSTATUS status) +void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context, + uint32 req_num_domains, uint32 num_domains, TRUSTDOM **td) { + int i; + DEBUG(5, ("init_r_enum_trust_dom\n")); r_e->enum_context = enum_context; + r_e->num_domains = num_domains; + r_e->ptr_enum_domains = 0; + r_e->num_domains2 = num_domains; - if (NT_STATUS_IS_OK(status)) { - int len_domain_name = strlen(domain_name) + 1; - - r_e->num_domains = 1; - r_e->ptr_enum_domains = 1; - r_e->num_domains2 = 1; - - if (!(r_e->hdr_domain_name = (UNIHDR2 *)talloc(ctx,sizeof(UNIHDR2)))) + if (num_domains != 0) { + + /* + * allocating empty arrays of unicode headers, strings + * and sids of enumerated trusted domains + */ + if (!(r_e->hdr_domain_name = (UNIHDR2 *)talloc(ctx,sizeof(UNIHDR2) * num_domains))) { + r_e->status = NT_STATUS_NO_MEMORY; return; - - if (!(r_e->uni_domain_name = (UNISTR2 *)talloc(ctx,sizeof(UNISTR2)))) + } + + if (!(r_e->uni_domain_name = (UNISTR2 *)talloc(ctx,sizeof(UNISTR2) * num_domains))) { + r_e->status = NT_STATUS_NO_MEMORY; return; + } - if (!(r_e->domain_sid = (DOM_SID2 *)talloc(ctx,sizeof(DOM_SID2)))) + if (!(r_e->domain_sid = (DOM_SID2 *)talloc(ctx,sizeof(DOM_SID2) * num_domains))) { + r_e->status = NT_STATUS_NO_MEMORY; return; + } + + for (i = 0; i < num_domains; i++) { + + /* don't know what actually is this for */ + r_e->ptr_enum_domains = 1; + + init_uni_hdr2(&r_e->hdr_domain_name[i], strlen_w((td[i])->name)); + init_dom_sid2(&r_e->domain_sid[i], &(td[i])->sid); + + init_unistr2_w(ctx, &r_e->uni_domain_name[i], (td[i])->name); + + }; + } - init_uni_hdr2(&r_e->hdr_domain_name[0], len_domain_name); - init_unistr2 (&r_e->uni_domain_name[0], domain_name, - len_domain_name); - init_dom_sid2(&r_e->domain_sid[0], domain_sid); - } else { - r_e->num_domains = 0; - r_e->ptr_enum_domains = 0; - } - - r_e->status = status; } /******************************************************************* @@ -603,7 +619,7 @@ BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, for (i = 0; i < num_domains; i++) { if(!smb_io_unistr2 ("", &r_e->uni_domain_name[i], - r_e->hdr_domain_name[i].buffer, + r_e->hdr_domain_name[i].buffer, ps, depth)) return False; if(!smb_io_dom_sid2("", &r_e->domain_sid[i], ps, @@ -713,7 +729,7 @@ static BOOL lsa_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int Reads or writes a dom query structure. ********************************************************************/ -BOOL lsa_io_dom_query_5(char *desc, DOM_QUERY_5 *d_q, prs_struct *ps, int depth) +static BOOL lsa_io_dom_query_5(char *desc, DOM_QUERY_5 *d_q, prs_struct *ps, int depth) { return lsa_io_dom_query("", d_q, ps, depth); } @@ -792,7 +808,7 @@ BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, Inits a LSA_SID_ENUM structure. ********************************************************************/ -void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, +static void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, int num_entries, DOM_SID *sids) { int i; @@ -1737,7 +1753,7 @@ BOOL lsa_io_q_enum_privsaccount(char *desc, LSA_Q_ENUMPRIVSACCOUNT *r_c, prs_str Reads or writes an LUID structure. ********************************************************************/ -BOOL lsa_io_luid(char *desc, LUID *r_c, prs_struct *ps, int depth) +static BOOL lsa_io_luid(char *desc, LUID *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_luid"); depth++; @@ -1758,7 +1774,7 @@ BOOL lsa_io_luid(char *desc, LUID *r_c, prs_struct *ps, int depth) Reads or writes an LUID_ATTR structure. ********************************************************************/ -BOOL lsa_io_luid_attr(char *desc, LUID_ATTR *r_c, prs_struct *ps, int depth) +static BOOL lsa_io_luid_attr(char *desc, LUID_ATTR *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_luid_attr"); depth++; @@ -1779,7 +1795,7 @@ BOOL lsa_io_luid_attr(char *desc, LUID_ATTR *r_c, prs_struct *ps, int depth) Reads or writes an PRIVILEGE_SET structure. ********************************************************************/ -BOOL lsa_io_privilege_set(char *desc, PRIVILEGE_SET *r_c, prs_struct *ps, int depth) +static BOOL lsa_io_privilege_set(char *desc, PRIVILEGE_SET *r_c, prs_struct *ps, int depth) { uint32 i; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 73f285e320..01d7698173 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -22,6 +22,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /**************************************************************************** A temporary TALLOC context for things like unistrs, that is valid for the life of a complete RPC call. @@ -211,9 +214,6 @@ BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "smb_io_dom_sid"); depth++; - if(!prs_align(ps)) - return False; - if(!prs_uint8 ("sid_rev_num", ps, depth, &sid->sid_rev_num)) return False; if(!prs_uint8 ("num_auths ", ps, depth, &sid->num_auths)) @@ -551,8 +551,6 @@ BOOL smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "smb_io_unistr"); depth++; - if(!prs_align(ps)) - return False; if(!prs_unistr("unistr", ps, depth, uni)) return False; @@ -916,6 +914,51 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len) rpcstr_push((char *)str->buffer, buf, len, STR_TERMINATE); } +/** + * Inits a UNISTR2 structure. + * @param ctx talloc context to allocate string on + * @param str pointer to string to create + * @param buf UCS2 null-terminated buffer to init from +*/ + +void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) +{ + uint32 len = strlen_w(buf); + uint32 max_len = len; + uint32 alloc_len; + + ZERO_STRUCTP(str); + + /* set up string lengths. */ + str->uni_max_len = len; + str->undoc = 0; + str->uni_str_len = len; + + if (max_len < MAX_UNISTRLEN) + max_len = MAX_UNISTRLEN; + + alloc_len = (max_len + 1) * sizeof(uint16); + + str->buffer = (uint16 *)talloc_zero(ctx, alloc_len); + if ((str->buffer == NULL) && (alloc_len > 0)) + { + smb_panic("init_unistr2_w: malloc fail\n"); + return; + } + + /* + * don't move this test above ! The UNISTR2 must be initialized !!! + * jfm, 7/7/2001. + */ + if (buf==NULL) + return; + + /* Yes, this is a strncpy( foo, bar, strlen(bar)) - but as + long as the buffer above is talloc()ed correctly then this + is the correct thing to do */ + strncpy_w(str->buffer, buf, len + 1); +} + /******************************************************************* Inits a UNISTR2 structure from a UNISTR ********************************************************************/ diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index afbdf6dc57..46fdce63ff 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -22,6 +22,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -1218,10 +1221,10 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, time_t unix_pass_must_change_time, uint16 logon_count, uint16 bad_pw_count, - uint32 num_groups, DOM_GID *gids, + uint32 num_groups, const DOM_GID *gids, uint32 user_flgs, uchar *sess_key, - char *logon_srv, char *logon_dom, - DOM_SID *dom_sid, char *other_sids) + const char *logon_srv, const char *logon_dom, + const DOM_SID *dom_sid, char *other_sids) { /* only cope with one "other" sid, right now. */ /* need to count the number of space-delimited sids */ @@ -1331,14 +1334,15 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, Jacobsen at HP. JRA. ********************************************************************/ -static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth, uint16 validation_level) +BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, + int depth, uint16 validation_level) { int i; if (usr == NULL) return False; - prs_debug(ps, depth, desc, "lsa_io_lsa_user_info"); + prs_debug(ps, depth, desc, "net_io_user_info3"); depth++; if (UNMARSHALLING(ps)) diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 6d65d5cc7f..2ab8c7246e 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -22,6 +22,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /** * Dump a prs to a file: from the current location through to the end. **/ @@ -73,7 +76,7 @@ void prs_dump_region(char *name, int v, prs_struct *ps, XXXX side-effect of this function is to increase the debug depth XXXX ********************************************************************/ -void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name) +void prs_debug(prs_struct *ps, int depth, const char *desc, char *fn_name) { DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(depth), ps->data_offset, fn_name, desc)); } @@ -444,6 +447,38 @@ BOOL prs_align(prs_struct *ps) return True; } +/****************************************************************** + Align on a 2 byte boundary + *****************************************************************/ + +BOOL prs_align_uint16(prs_struct *ps) +{ + BOOL ret; + uint8 old_align = ps->align; + + ps->align = 2; + ret = prs_align(ps); + ps->align = old_align; + + return ret; +} + +/****************************************************************** + Align on a 8 byte boundary + *****************************************************************/ + +BOOL prs_align_uint64(prs_struct *ps) +{ + BOOL ret; + uint8 old_align = ps->align; + + ps->align = 8; + ret = prs_align(ps); + ps->align = old_align; + + return ret; +} + /******************************************************************* Align only if required (for the unistr2 string mainly) ********************************************************************/ diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 1b8d1cd5c8..1ebc1532f3 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -24,6 +24,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* Inits a structure. ********************************************************************/ @@ -126,11 +129,11 @@ BOOL reg_io_q_open_hklm(char *desc, REG_Q_OPEN_HKLM * r_q, prs_struct *ps, if (r_q->ptr != 0) { if (!prs_uint16("unknown_0", ps, depth, &(r_q->unknown_0))) - return False; + return False; if (!prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1))) - return False; + return False; if (!prs_uint32("access_mask", ps, depth, &(r_q->access_mask))) - return False; + return False; } return True; @@ -568,7 +571,7 @@ BOOL reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int d return False; if(!prs_uint32("max_subkeylen ", ps, depth, &r_r->max_subkeylen)) return False; - if(!prs_uint32("mak_subkeysize", ps, depth, &r_r->max_subkeysize)) + if(!prs_uint32("reserved ", ps, depth, &r_r->reserved)) return False; if(!prs_uint32("num_values ", ps, depth, &r_r->num_values)) return False; @@ -591,7 +594,7 @@ BOOL reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int d Inits a structure. ********************************************************************/ -void init_reg_q_unk_1a(REG_Q_UNK_1A *q_o, POLICY_HND *hnd) +void init_reg_q_unknown_1a(REG_Q_UNKNOWN_1A *q_o, POLICY_HND *hnd) { memcpy(&q_o->pol, hnd, sizeof(q_o->pol)); } @@ -600,12 +603,12 @@ void init_reg_q_unk_1a(REG_Q_UNK_1A *q_o, POLICY_HND *hnd) reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_unk_1a(char *desc, REG_Q_UNK_1A *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_unknown_1a(char *desc, REG_Q_UNKNOWN_1A *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; - prs_debug(ps, depth, desc, "reg_io_q_unk_1a"); + prs_debug(ps, depth, desc, "reg_io_q_unknown_1a"); depth++; if(!prs_align(ps)) @@ -621,12 +624,12 @@ BOOL reg_io_q_unk_1a(char *desc, REG_Q_UNK_1A *r_q, prs_struct *ps, int depth) reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_unk_1a(char *desc, REG_R_UNK_1A *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_unknown_1a(char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; - prs_debug(ps, depth, desc, "reg_io_r_unk_1a"); + prs_debug(ps, depth, desc, "reg_io_r_unknown_1a"); depth++; if(!prs_align(ps)) @@ -645,12 +648,12 @@ BOOL reg_io_r_unk_1a(char *desc, REG_R_UNK_1A *r_r, prs_struct *ps, int depth) ********************************************************************/ void init_reg_q_open_hku(REG_Q_OPEN_HKU *q_o, - uint16 unknown_0, uint32 level) + uint16 unknown_0, uint32 access_mask) { q_o->ptr = 1; q_o->unknown_0 = unknown_0; q_o->unknown_1 = 0x0; /* random - changes */ - q_o->level = level; + q_o->access_mask = access_mask; } /******************************************************************* @@ -671,11 +674,11 @@ BOOL reg_io_q_open_hku(char *desc, REG_Q_OPEN_HKU *r_q, prs_struct *ps, int dep if(!prs_uint32("ptr ", ps, depth, &r_q->ptr)) return False; if (r_q->ptr != 0) { - if(!prs_uint16("unknown_0", ps, depth, &r_q->unknown_0)) + if(!prs_uint16("unknown_0 ", ps, depth, &r_q->unknown_0)) return False; - if(!prs_uint16("unknown_1", ps, depth, &r_q->unknown_1)) + if(!prs_uint16("unknown_1 ", ps, depth, &r_q->unknown_1)) return False; - if(!prs_uint32("level ", ps, depth, &r_q->level)) + if(!prs_uint32("access_mask ", ps, depth, &r_q->access_mask)) return False; } @@ -726,7 +729,7 @@ BOOL reg_io_q_close(char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth) if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "reg_io_q_unknown_1"); + prs_debug(ps, depth, desc, "reg_io_q_close"); depth++; if(!prs_align(ps)) @@ -749,7 +752,7 @@ BOOL reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "reg_io_r_unknown_1"); + prs_debug(ps, depth, desc, "reg_io_r_close"); depth++; if(!prs_align(ps)) @@ -1007,13 +1010,15 @@ BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) if(!prs_uint32("ptr_buflen", ps, depth, &(r_q->ptr_buflen))) return False; - if(!prs_uint32("buflen", ps, depth, &(r_q->buflen))) - return False; - if(!prs_uint32("ptr_buflen2", ps, depth, &(r_q->ptr_buflen2))) - return False; - if(!prs_uint32("buflen2", ps, depth, &(r_q->buflen2))) - return False; + if (r_q->ptr_buflen) { + if(!prs_uint32("buflen", ps, depth, &(r_q->buflen))) + return False; + if(!prs_uint32("ptr_buflen2", ps, depth, &(r_q->ptr_buflen2))) + return False; + if(!prs_uint32("buflen2", ps, depth, &(r_q->buflen2))) + return False; + } return True; } @@ -1348,6 +1353,29 @@ void init_reg_q_enum_key(REG_Q_ENUM_KEY *q_i, POLICY_HND *pol, uint32 key_idx) unix_to_nt_time(&q_i->time, 0); /* current time? */ } +/******************************************************************* +makes a reply structure. +********************************************************************/ + +void init_reg_r_enum_key(REG_R_ENUM_KEY *r_u, char *subkey, uint32 unknown_1, + uint32 unknown_2) +{ + if ( !r_u ) + return; + + r_u->unknown_1 = unknown_1; + r_u->unknown_2 = unknown_2; + r_u->unknown_3 = 0x0; + + r_u->key_name_len = (strlen(subkey)+1) * 2; + if (r_u->key_name_len) + r_u->ptr1 = 0x1; + init_unistr3( &r_u->key_name, subkey ); + + r_u->ptr2 = 0x1; + r_u->ptr3 = 0x1; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -1463,7 +1491,7 @@ makes a structure. ********************************************************************/ void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, - char *key_name, uint32 unk) + char *key_name, uint32 access_desired) { int len_name = strlen(key_name)+1; @@ -1473,7 +1501,7 @@ void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, init_unistr2(&r_q->uni_name, key_name, len_name); r_q->unknown_0 = 0x00000000; - r_q->unknown_1 = unk; + r_q->access_desired = access_desired; } /******************************************************************* @@ -1501,9 +1529,9 @@ BOOL reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int if(!prs_align(ps)) return False; - if(!prs_uint32("unknown_0", ps, depth, &r_q->unknown_0)) + if(!prs_uint32("unknown_0 ", ps, depth, &r_q->unknown_0)) return False; - if(!prs_uint32("unknown_1", ps, depth, &r_q->unknown_1)) + if(!prs_uint32("asccess_desired ", ps, depth, &r_q->access_desired)) return False; return True; diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index ee15d7cded..41e0b4cb5f 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -23,6 +23,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* interface/version dce/rpc pipe identification ********************************************************************/ diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 4edc0678af..c16232204c 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -27,6 +27,9 @@ #include "rpc_parse.h" #include "nterr.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* inits a SAMR_Q_CLOSE_HND structure. ********************************************************************/ @@ -387,6 +390,36 @@ BOOL samr_io_r_get_usrdom_pwinfo(char *desc, SAMR_R_GET_USRDOM_PWINFO * r_u, return True; } + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_q_set_sec_obj(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. ********************************************************************/ @@ -861,6 +894,28 @@ BOOL samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, return True; } +/******************************************************************* +reads or writes a SAMR_R_SET_SEC_OBJ structure. +********************************************************************/ + +BOOL samr_io_r_set_sec_obj(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. ********************************************************************/ @@ -1437,7 +1492,8 @@ inits a SAM_DISPINFO_1 structure. ********************************************************************/ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_entries, - uint32 start_idx, DISP_USER_INFO *disp_user_info) + uint32 start_idx, DISP_USER_INFO *disp_user_info, + DOM_SID *domain_sid) { uint32 len_sam_name, len_sam_full, len_sam_desc; uint32 i; @@ -1462,18 +1518,49 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_en ZERO_STRUCTP(sam->str); for (i = 0; i < num_entries ; i++) { + const char *username; + const char *fullname; + const char *acct_desc; + uint32 user_rid; + const DOM_SID *user_sid; + fstring user_sid_string, domain_sid_string; + DEBUG(11, ("init_sam_dispinfo_1: entry: %d\n",i)); pwd=disp_user_info[i+start_idx].sam; - len_sam_name = strlen(pdb_get_username(pwd)); - len_sam_full = strlen(pdb_get_fullname(pwd)); - len_sam_desc = strlen(pdb_get_acct_desc(pwd)); + username = pdb_get_username(pwd); + fullname = pdb_get_fullname(pwd); + acct_desc = pdb_get_acct_desc(pwd); + + if (!username) + username = ""; + + if (!fullname) + fullname = ""; + + if (!acct_desc) + acct_desc = ""; + + user_sid = pdb_get_user_sid(pwd); + + if (!sid_peek_check_rid(domain_sid, user_sid, &user_rid)) { + DEBUG(0, ("init_sam_dispinfo_1: User %s has SID %s, which conflicts with " + "the domain sid %s. Failing operation.\n", + username, + sid_to_string(user_sid_string, user_sid), + sid_to_string(domain_sid_string, domain_sid))); + return NT_STATUS_UNSUCCESSFUL; + } + + len_sam_name = strlen(username); + len_sam_full = strlen(fullname); + len_sam_desc = strlen(acct_desc); init_sam_entry1(&sam->sam[i], start_idx + i + 1, len_sam_name, len_sam_full, len_sam_desc, - pdb_get_user_rid(pwd), pdb_get_acct_ctrl(pwd)); - + user_rid, pdb_get_acct_ctrl(pwd)); + ZERO_STRUCTP(&sam->str[i].uni_acct_name); ZERO_STRUCTP(&sam->str[i].uni_full_name); ZERO_STRUCTP(&sam->str[i].uni_acct_desc); @@ -1540,7 +1627,8 @@ inits a SAM_DISPINFO_2 structure. ********************************************************************/ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_entries, - uint32 start_idx, DISP_USER_INFO *disp_user_info) + uint32 start_idx, DISP_USER_INFO *disp_user_info, + DOM_SID *domain_sid ) { uint32 len_sam_name, len_sam_desc; uint32 i; @@ -1563,20 +1651,39 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_en ZERO_STRUCTP(sam->str); for (i = 0; i < num_entries; i++) { + uint32 user_rid; + const DOM_SID *user_sid; + const char *username; + const char *acct_desc; + fstring user_sid_string, domain_sid_string; + DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i)); pwd=disp_user_info[i+start_idx].sam; - len_sam_name = strlen(pdb_get_username(pwd)); - len_sam_desc = strlen(pdb_get_acct_desc(pwd)); + username = pdb_get_username(pwd); + acct_desc = pdb_get_acct_desc(pwd); + user_sid = pdb_get_user_sid(pwd); + + if (!sid_peek_check_rid(domain_sid, user_sid, &user_rid)) { + DEBUG(0, ("init_sam_dispinfo_2: User %s has SID %s, which conflicts with " + "the domain sid %s. Failing operation.\n", + username, + sid_to_string(user_sid_string, user_sid), + sid_to_string(domain_sid_string, domain_sid))); + return NT_STATUS_UNSUCCESSFUL; + } + + len_sam_name = strlen(username); + len_sam_desc = strlen(acct_desc); init_sam_entry2(&sam->sam[i], start_idx + i + 1, len_sam_name, len_sam_desc, - pdb_get_user_rid(pwd), pdb_get_acct_ctrl(pwd)); + user_rid, pdb_get_acct_ctrl(pwd)); ZERO_STRUCTP(&sam->str[i].uni_srv_name); ZERO_STRUCTP(&sam->str[i].uni_srv_desc); - init_unistr2(&sam->str[i].uni_srv_name, pdb_get_username(pwd), len_sam_name); + init_unistr2(&sam->str[i].uni_srv_name, username, len_sam_name); init_unistr2(&sam->str[i].uni_srv_desc, pdb_get_acct_desc(pwd), len_sam_desc); } @@ -4535,7 +4642,7 @@ 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, char **name) + uint32 num_names, const char **name) { uint32 i; @@ -5824,7 +5931,7 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, *************************************************************************/ -void init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw) +NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID *domain_sid) { NTTIME logon_time, logoff_time, kickoff_time, pass_last_set_time, pass_can_change_time, @@ -5845,6 +5952,12 @@ void init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw) const char* workstations = pdb_get_workstations(pw); const char* munged_dial = pdb_get_munged_dial(pw); + uint32 user_rid; + const DOM_SID *user_sid; + + uint32 group_rid; + const DOM_SID *group_sid; + len_user_name = user_name != NULL ? strlen(user_name )+1 : 0; len_full_name = full_name != NULL ? strlen(full_name )+1 : 0; len_home_dir = home_dir != NULL ? strlen(home_dir )+1 : 0; @@ -5887,8 +6000,34 @@ void init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw) ZERO_STRUCT(usr->nt_pwd); ZERO_STRUCT(usr->lm_pwd); - usr->user_rid = pdb_get_user_rid(pw); - usr->group_rid = pdb_get_group_rid(pw); + user_sid = pdb_get_user_sid(pw); + + if (!sid_peek_check_rid(domain_sid, user_sid, &user_rid)) { + fstring user_sid_string; + fstring domain_sid_string; + 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_to_string(user_sid_string, user_sid), + sid_to_string(domain_sid_string, domain_sid))); + return NT_STATUS_UNSUCCESSFUL; + } + + group_sid = pdb_get_group_sid(pw); + + if (!sid_peek_check_rid(domain_sid, group_sid, &group_rid)) { + fstring group_sid_string; + fstring domain_sid_string; + 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_to_string(group_sid_string, group_sid), + sid_to_string(domain_sid_string, domain_sid))); + return NT_STATUS_UNSUCCESSFUL; + } + + usr->user_rid = user_rid; + usr->group_rid = group_rid; usr->acb_info = pdb_get_acct_ctrl(pw); usr->unknown_3 = pdb_get_unknown3(pw); @@ -5917,6 +6056,8 @@ void init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw) memcpy(&usr->logon_hrs.hours, pdb_get_hours(pw), MAX_HOURS_LEN); } else memset(&usr->logon_hrs, 0xff, sizeof(usr->logon_hrs)); + + return NT_STATUS_OK; } /******************************************************************* @@ -6702,17 +6843,16 @@ BOOL samr_io_r_get_dom_pwinfo(char *desc, SAMR_R_GET_DOM_PWINFO * r_u, if(!prs_align(ps)) return False; - if(!prs_uint16("unk_0", ps, depth, &r_u->unk_0)) - return False; - if(!prs_align(ps)) - return False; - if(!prs_uint16("unk_1", ps, depth, &r_u->unk_1)) - return False; - if(!prs_align(ps)) + /* + * We need 16 bytes here according to tests. Don't know + * what they are, but the length is important for the singing + */ + + if(!prs_uint32("unk_0", ps, depth, &r_u->unk_0)) return False; - if(!prs_uint16("unk_2", ps, depth, &r_u->unk_2)) + if(!prs_uint32("unk_1", ps, depth, &r_u->unk_1)) return False; - if(!prs_align(ps)) + if(!prs_uint32("unk_2", ps, depth, &r_u->unk_2)) return False; if(!prs_ntstatus("status", ps, depth, &r_u->status)) diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 4f093b2422..56eaf4c5b5 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -1,5 +1,6 @@ /* - * Unix SMB/CIFS implementation. + * Unix SMB/Netbios implementation. + * Version 1.9. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1998, * Copyright (C) Jeremy R. Allison 1995-1998 @@ -23,6 +24,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* Sets up a SEC_ACCESS structure. ********************************************************************/ @@ -43,9 +47,6 @@ BOOL sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "sec_io_access"); depth++; - - if(!prs_align(ps)) - return False; if(!prs_uint32("mask", ps, depth, &(t->mask))) return False; @@ -112,9 +113,6 @@ BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "sec_io_ace"); depth++; - - if(!prs_align(ps)) - return False; old_offset = prs_offset(ps); @@ -130,9 +128,6 @@ BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth) if(!sec_io_access("info ", &psa->info, ps, depth)) return False; - if(!prs_align(ps)) - return False; - /* check whether object access is present */ if (!sec_ace_object(psa->type)) { if (!smb_io_dom_sid("trustee ", &psa->trustee , ps, depth)) @@ -293,6 +288,13 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) uint32 offset_acl_size; SEC_ACL *psa; + /* + * Note that the size is always a multiple of 4 bytes due to the + * nature of the data structure. Therefore the prs_align() calls + * have been removed as they through us off when doing two-layer + * marshalling such as in the printing code (NEW_BUFFER). --jerry + */ + if (ppsa == NULL) return False; @@ -309,9 +311,6 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "sec_io_acl"); depth++; - - if(!prs_align(ps)) - return False; old_offset = prs_offset(ps); @@ -341,9 +340,6 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) return False; } - if(!prs_align(ps)) - return False; - if(!prs_uint16_post("size ", ps, depth, &psa->size, offset_acl_size, old_offset)) return False; @@ -362,17 +358,19 @@ size_t sec_desc_size(SEC_DESC *psd) offset = SEC_DESC_HEADER_SIZE; + /* don't align */ + if (psd->owner_sid != NULL) - offset += ((sid_size(psd->owner_sid) + 3) & ~3); + offset += sid_size(psd->owner_sid); if (psd->grp_sid != NULL) - offset += ((sid_size(psd->grp_sid) + 3) & ~3); + offset += sid_size(psd->grp_sid); if (psd->sacl != NULL) - offset += ((psd->sacl->size + 3) & ~3); + offset += psd->sacl->size; if (psd->dacl != NULL) - offset += ((psd->dacl->size + 3) & ~3); + offset += psd->dacl->size; return offset; } @@ -640,7 +638,7 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, if (offset == 0) offset = SEC_DESC_HEADER_SIZE; - offset += ((sid_size(dst->owner_sid) + 3) & ~3); + offset += sid_size(dst->owner_sid); } if (dst->grp_sid != NULL) { @@ -648,7 +646,7 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, if (offset == 0) offset = SEC_DESC_HEADER_SIZE; - offset += ((sid_size(dst->grp_sid) + 3) & ~3); + offset += sid_size(dst->grp_sid); } if (dst->sacl != NULL) { @@ -656,7 +654,7 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, offset_acl = SEC_DESC_HEADER_SIZE; dst->off_sacl = offset_acl; - offset_acl += ((dst->sacl->size + 3) & ~3); + offset_acl += dst->sacl->size; offset += dst->sacl->size; offset_sid += dst->sacl->size; } @@ -667,19 +665,20 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, offset_acl = SEC_DESC_HEADER_SIZE; dst->off_dacl = offset_acl; - offset_acl += ((dst->dacl->size + 3) & ~3); + offset_acl += dst->dacl->size; offset += dst->dacl->size; offset_sid += dst->dacl->size; } *sd_size = (size_t)((offset == 0) ? SEC_DESC_HEADER_SIZE : offset); - dst->off_owner_sid = offset_sid; - if (dst->owner_sid != NULL) + dst->off_owner_sid = offset_sid; + + /* sid_size() returns 0 if the sid is NULL so this is ok */ + + if (dst->grp_sid != NULL) dst->off_grp_sid = offset_sid + sid_size(dst->owner_sid); - else - dst->off_grp_sid = offset_sid; return dst; @@ -748,8 +747,15 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "sec_io_desc"); depth++; +#if 0 + /* + * if alignment is needed, should be done by the the + * caller. Not here. This caused me problems when marshalling + * printer info into a buffer. --jerry + */ if(!prs_align(ps)) return False; +#endif /* start of security descriptor stored for back-calc offset purposes */ old_offset = prs_offset(ps); @@ -776,72 +782,69 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if (psd->off_owner_sid != 0) { + tmp_offset = ps->data_offset; + if(!prs_set_offset(ps, old_offset + psd->off_owner_sid)) + return False; + if (UNMARSHALLING(ps)) { - if(!prs_set_offset(ps, old_offset + psd->off_owner_sid)) - return False; /* reading */ if((psd->owner_sid = (DOM_SID *)prs_alloc_mem(ps,sizeof(*psd->owner_sid))) == NULL) return False; } - tmp_offset = ps->data_offset; - ps->data_offset = psd->off_owner_sid; - if(!smb_io_dom_sid("owner_sid ", psd->owner_sid , ps, depth)) return False; - if(!prs_align(ps)) - return False; - ps->data_offset = tmp_offset; - } + max_offset = MAX(max_offset, prs_offset(ps)); - max_offset = MAX(max_offset, prs_offset(ps)); + if (!prs_set_offset(ps,tmp_offset)) + return False; + } if (psd->off_grp_sid != 0) { + tmp_offset = ps->data_offset; + if(!prs_set_offset(ps, old_offset + psd->off_grp_sid)) + return False; + if (UNMARSHALLING(ps)) { /* reading */ - if(!prs_set_offset(ps, old_offset + psd->off_grp_sid)) - return False; if((psd->grp_sid = (DOM_SID *)prs_alloc_mem(ps,sizeof(*psd->grp_sid))) == NULL) return False; } - tmp_offset = ps->data_offset; - ps->data_offset = psd->off_grp_sid; - if(!smb_io_dom_sid("grp_sid", psd->grp_sid, ps, depth)) return False; - if(!prs_align(ps)) - return False; + + max_offset = MAX(max_offset, prs_offset(ps)); - ps->data_offset = tmp_offset; + if (!prs_set_offset(ps,tmp_offset)) + return False; } - max_offset = MAX(max_offset, prs_offset(ps)); - if ((psd->type & SEC_DESC_SACL_PRESENT) && psd->off_sacl) { + tmp_offset = ps->data_offset; if(!prs_set_offset(ps, old_offset + psd->off_sacl)) return False; if(!sec_io_acl("sacl", &psd->sacl, ps, depth)) return False; - if(!prs_align(ps)) + max_offset = MAX(max_offset, prs_offset(ps)); + if (!prs_set_offset(ps,tmp_offset)) return False; } - max_offset = MAX(max_offset, prs_offset(ps)); if ((psd->type & SEC_DESC_DACL_PRESENT) && psd->off_dacl != 0) { + tmp_offset = ps->data_offset; if(!prs_set_offset(ps, old_offset + psd->off_dacl)) return False; if(!sec_io_acl("dacl", &psd->dacl, ps, depth)) return False; - if(!prs_align(ps)) + max_offset = MAX(max_offset, prs_offset(ps)); + if (!prs_set_offset(ps,tmp_offset)) return False; } - max_offset = MAX(max_offset, prs_offset(ps)); - if(!prs_set_offset(ps, max_offset)) return False; return True; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index e9f0ca858a..b10a5c4377 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4,8 +4,8 @@ * Copyright (C) Andrew Tridgell 1992-2000, * Copyright (C) Luke Kenneth Casson Leighton 1996-2000, * Copyright (C) Jean Franois Micouleau 1998-2000, - * Copyright (C) Gerald Carter 2000-2002 - * Copyright (C) Tim Potter 2001. + * Copyright (C) Gerald Carter 2000-2002, + * Copyright (C) Tim Potter 2001-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 @@ -24,6 +24,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* return the length of a UNISTR string. ********************************************************************/ @@ -45,7 +48,7 @@ static uint32 str_len_uni(UNISTR *source) This should be moved in a more generic lib. ********************************************************************/ -static BOOL spoolss_io_system_time(char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) +BOOL spoolss_io_system_time(char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) { if(!prs_uint16("year", ps, depth, &systime->year)) return False; @@ -321,53 +324,64 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs { uint32 useless_ptr=0xADDE0FF0; - uint32 how_many_words; - BOOL isvalue; - uint32 x; - prs_debug(ps, depth, desc, "smb_io_notify_info_data"); depth++; - how_many_words=data->size; - if (how_many_words==POINTER) { - how_many_words=TWO_VALUE; - } - - isvalue=data->enc_type; - if(!prs_align(ps)) return False; if(!prs_uint16("type", ps, depth, &data->type)) return False; if(!prs_uint16("field", ps, depth, &data->field)) return False; - /*prs_align(ps);*/ - if(!prs_uint32("how many words", ps, depth, &how_many_words)) + if(!prs_uint32("how many words", ps, depth, &data->size)) return False; if(!prs_uint32("id", ps, depth, &data->id)) return False; - if(!prs_uint32("how many words", ps, depth, &how_many_words)) + if(!prs_uint32("how many words", ps, depth, &data->size)) return False; + switch (data->enc_type) { + + /* One and two value data has two uint32 values */ - /*prs_align(ps);*/ + case NOTIFY_ONE_VALUE: + case NOTIFY_TWO_VALUE: - if (isvalue==True) { if(!prs_uint32("value[0]", ps, depth, &data->notify_data.value[0])) return False; if(!prs_uint32("value[1]", ps, depth, &data->notify_data.value[1])) return False; - /*prs_align(ps);*/ - } else { - /* it's a string */ - /* length in ascii including \0 */ - x=2*(data->notify_data.data.length+1); - if(!prs_uint32("string length", ps, depth, &x )) + break; + + /* Pointers and strings have a string length and a + pointer. For a string the length is expressed as + the number of uint16 characters plus a trailing + \0\0. */ + + case NOTIFY_POINTER: + + if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length )) return False; if(!prs_uint32("pointer", ps, depth, &useless_ptr)) return False; - /*prs_align(ps);*/ + + break; + + case NOTIFY_STRING: + + if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length)) + return False; + + if(!prs_uint32("pointer", ps, depth, &useless_ptr)) + return False; + + break; + + default: + DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data\n", + data->enc_type)); + break; } return True; @@ -380,22 +394,79 @@ reads or writes an NOTIFY INFO DATA structure. BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) { - uint32 x; - BOOL isvalue; - prs_debug(ps, depth, desc, "smb_io_notify_info_data_strings"); depth++; if(!prs_align(ps)) return False; - isvalue=data->enc_type; + switch(data->enc_type) { + + /* No data for values */ + + case NOTIFY_ONE_VALUE: + case NOTIFY_TWO_VALUE: + + break; + + /* Strings start with a length in uint16s */ + + case NOTIFY_STRING: + + if (UNMARSHALLING(ps)) { + data->notify_data.data.string = + (uint16 *)prs_alloc_mem(ps, data->notify_data.data.length); + + if (!data->notify_data.data.string) + return False; + } + + if (MARSHALLING(ps)) + data->notify_data.data.length /= 2; + + if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length)) + return False; + + if (!prs_uint16uni(True, "string", ps, depth, data->notify_data.data.string, + data->notify_data.data.length)) + return False; + + if (MARSHALLING(ps)) + data->notify_data.data.length *= 2; + + break; + + case NOTIFY_POINTER: + + if (UNMARSHALLING(ps)) { + data->notify_data.data.string = + (uint16 *)prs_alloc_mem(ps, data->notify_data.data.length); + + if (!data->notify_data.data.string) + return False; + } + + if(!prs_uint8s(True,"buffer",ps,depth,(uint8*)data->notify_data.data.string,data->notify_data.data.length)) + return False; + + break; + + default: + DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data_strings\n", + data->enc_type)); + break; + } +#if 0 if (isvalue==False) { + /* length of string in unicode include \0 */ x=data->notify_data.data.length+1; + + if (data->field != 16) if(!prs_uint32("string length", ps, depth, &x )) return False; + if (MARSHALLING(ps)) { /* These are already in little endian format. Don't byte swap. */ if (x == 1) { @@ -409,6 +480,10 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, if(!prs_uint8s(True,"string",ps,depth, (uint8 *)&data->notify_data.data.length,x*2)) return False; } else { + + if (data->field == 16) + x /= 2; + if(!prs_uint16uni(True,"string",ps,depth,data->notify_data.data.string,x)) return False; } @@ -424,10 +499,11 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, return False; } } -#if 0 /* JERRY */ - /* Win2k does not seem to put this parse align here */ +#endif +#if 0 /* JERRY */ + /* Win2k does not seem to put this parse align here */ if(!prs_align(ps)) return False; #endif @@ -546,8 +622,40 @@ static BOOL spool_io_user_level(char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, * on reading allocate memory for the private member ********************************************************************/ +#define DM_NUM_OPTIONAL_FIELDS 8 + BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) { + uint32 available_space; /* size of the device mode left to parse */ + /* only important on unmarshalling */ + int i = 0; + + struct optional_fields { + fstring name; + uint32* field; + } opt_fields[DM_NUM_OPTIONAL_FIELDS] = { + { "icmmethod", NULL }, + { "icmintent", NULL }, + { "mediatype", NULL }, + { "dithertype", NULL }, + { "reserved1", NULL }, + { "reserved2", NULL }, + { "panningwidth", NULL }, + { "panningheight", NULL } + }; + + /* assign at run time to keep non-gcc vompilers happy */ + + opt_fields[0].field = &devmode->icmmethod; + opt_fields[1].field = &devmode->icmintent; + opt_fields[2].field = &devmode->mediatype; + opt_fields[3].field = &devmode->dithertype; + opt_fields[4].field = &devmode->reserved1; + opt_fields[5].field = &devmode->reserved2; + opt_fields[6].field = &devmode->panningwidth; + opt_fields[7].field = &devmode->panningheight; + + prs_debug(ps, depth, desc, "spoolss_io_devmode"); depth++; @@ -559,8 +667,27 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo if (!prs_uint16uni(True,"devicename", ps, depth, devmode->devicename.buffer, 32)) return False; + if (!prs_uint16("specversion", ps, depth, &devmode->specversion)) return False; + + /* Sanity Check - look for unknown specversions, but don't fail if we see one. + Let the size determine that */ + + switch (devmode->specversion) { + case 0x0320: + case 0x0400: + case 0x0401: + break; + + default: + DEBUG(0,("spoolss_io_devmode: Unknown specversion in devicemode [0x%x]\n", + devmode->specversion)); + DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n")); + break; + } + + if (!prs_uint16("driverversion", ps, depth, &devmode->driverversion)) return False; if (!prs_uint16("size", ps, depth, &devmode->size)) @@ -616,45 +743,50 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo return False; if (!prs_uint32("displayfrequency", ps, depth, &devmode->displayfrequency)) return False; + /* + * every device mode I've ever seen on the wire at least has up + * to the displayfrequency field. --jerry (05-09-2002) + */ + + /* add uint32's + uint16's + two UNICODE strings */ + + available_space = devmode->size - (sizeof(uint32)*6 + sizeof(uint16)*18 + sizeof(uint16)*64); + + /* Sanity check - we only have uint32's left tp parse */ + + if ( available_space && ((available_space % sizeof(uint32)) != 0) ) { + DEBUG(0,("spoolss_io_devmode: available_space [%d] no in multiple of 4 bytes (size = %d)!\n", + available_space, devmode->size)); + DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n")); + return False; + } /* * Conditional parsing. Assume that the DeviceMode has been * zero'd by the caller. */ - switch(devmode->specversion) { - /* Used by spooler when issuing OpenPrinter() calls. NT 3.5x? */ - case 0x0320: - break; + while ((available_space > 0) && (i < DM_NUM_OPTIONAL_FIELDS)) + { + DEBUG(10, ("spoolss_io_devmode: [%d] bytes left to parse in devmode\n", available_space)); + if (!prs_uint32(opt_fields[i].name, ps, depth, opt_fields[i].field)) + return False; + available_space -= sizeof(uint32); + i++; + } + + /* Sanity Check - we should no available space at this point unless + MS changes the device mode structure */ - /* See the comments on the DEVMODE in the msdn GDI documentation */ - case 0x0400: - case 0x0401: - if (!prs_uint32("icmmethod", ps, depth, &devmode->icmmethod)) - return False; - if (!prs_uint32("icmintent", ps, depth, &devmode->icmintent)) - return False; - if (!prs_uint32("mediatype", ps, depth, &devmode->mediatype)) - return False; - if (!prs_uint32("dithertype", ps, depth, &devmode->dithertype)) - return False; - if (!prs_uint32("reserved1", ps, depth, &devmode->reserved1)) - return False; - if (!prs_uint32("reserved2", ps, depth, &devmode->reserved2)) + if (available_space) { + DEBUG(0,("spoolss_io_devmode: I've parsed all I know and there is still stuff left|\n")); + DEBUG(0,("spoolss_io_devmode: available_space = [%d], devmode_size = [%d]!\n", + available_space, devmode->size)); + DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n")); return False; - if (!prs_uint32("panningwidth", ps, depth, &devmode->panningwidth)) - return False; - if (!prs_uint32("panningheight", ps, depth, &devmode->panningheight)) - return False; - break; - - /* log an error if we see something else */ - default: - DEBUG(0,("spoolss_io_devmode: Unknown specversion [0x%x]!\n", devmode->specversion)); - DEBUG(0,("spoolss_io_devmode: Please report to samba-technical@samba.org\n")); - break; } + if (devmode->driverextra!=0) { if (UNMARSHALLING(ps)) { devmode->private=(uint8 *)prs_alloc_mem(ps, devmode->driverextra*sizeof(uint8)); @@ -900,6 +1032,7 @@ BOOL make_spoolss_printer_info_2(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_2 return True; } + /******************************************************************* * read a structure. * called from spoolss_q_open_printer_ex (srv_spoolss.c) @@ -1047,15 +1180,15 @@ BOOL make_spoolss_q_deleteprinterdriver( ********************************************************************/ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, - const POLICY_HND *handle, - UNISTR2 *valuename, uint32 size) + const POLICY_HND *handle, + char *valuename, uint32 size) { if (q_u == NULL) return False; DEBUG(5,("make_spoolss_q_getprinterdata\n")); q_u->handle = *handle; - copy_unistr2(&q_u->valuename, valuename); + init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); q_u->size = size; return True; @@ -1130,6 +1263,48 @@ BOOL spoolss_io_r_deleteprinterdata(char *desc, SPOOL_R_DELETEPRINTERDATA *r_u, return True; } +/******************************************************************* + * read a structure. + * called from spoolss_q_deleteprinterdataex (srv_spoolss.c) + ********************************************************************/ + +BOOL spoolss_io_q_deleteprinterdataex(char *desc, SPOOL_Q_DELETEPRINTERDATAEX *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_deleteprinterdataex"); + depth++; + + if (!prs_align(ps)) + return False; + if (!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) + return False; + + if (!smb_io_unistr2("keyname ", &q_u->keyname, True, ps, depth)) + return False; + if (!smb_io_unistr2("valuename", &q_u->valuename, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + * write a structure. + * called from spoolss_r_deleteprinterdataex (srv_spoolss.c) + ********************************************************************/ + +BOOL spoolss_io_r_deleteprinterdataex(char *desc, SPOOL_R_DELETEPRINTERDATAEX *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterdataex"); + depth++; + + if(!prs_werror("status", ps, depth, &r_u->status)) + return False; + + return True; +} + /******************************************************************* * write a structure. * called from spoolss_r_getprinterdata (srv_spoolss.c) @@ -1150,6 +1325,12 @@ BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_st if (!prs_uint32("size", ps, depth, &r_u->size)) return False; + if (UNMARSHALLING(ps) && r_u->size) { + r_u->data = prs_alloc_mem(ps, r_u->size); + if(r_u->data) + return False; + } + if (!prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size)) return False; @@ -1311,6 +1492,64 @@ BOOL spoolss_io_r_deleteprinterdriver(char *desc, SPOOL_R_DELETEPRINTERDRIVER *r } +/******************************************************************* + * read a structure. + * called from api_spoolss_deleteprinterdriver (srv_spoolss.c) + * called from spoolss_deleteprinterdriver (cli_spoolss.c) + ********************************************************************/ + +BOOL spoolss_io_q_deleteprinterdriverex(char *desc, SPOOL_Q_DELETEPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_q_deleteprinterdriverex"); + 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(!smb_io_unistr2("arch", &q_u->arch, True, ps, depth)) + return False; + if(!smb_io_unistr2("driver", &q_u->driver, True, ps, depth)) + return False; + + if (!prs_align(ps)) + return False; + + if(!prs_uint32("delete_flags ", ps, depth, &q_u->delete_flags)) + return False; + if(!prs_uint32("version ", ps, depth, &q_u->version)) + return False; + + + return True; +} + + +/******************************************************************* + * write a structure. + ********************************************************************/ +BOOL spoolss_io_r_deleteprinterdriverex(char *desc, SPOOL_R_DELETEPRINTERDRIVEREX *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return False; + + prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterdriverex"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_werror("status", ps, depth, &r_u->status)) + return False; + + return True; +} + + /******************************************************************* * read a structure. @@ -2072,6 +2311,10 @@ static BOOL smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEVICEM /* read the offset */ if (!prs_uint32("offset", ps, depth, &buffer->string_at_end)) return False; + if (buffer->string_at_end == 0) { + *devmode = NULL; + return True; + } old_offset = prs_offset(ps); if(!prs_set_offset(ps, buffer->string_at_end + buffer->struct_start)) @@ -2222,6 +2465,8 @@ BOOL smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info, BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; + uint32 dm_offset, sd_offset, current_offset; + uint32 dummy_value = 0; prs_debug(ps, depth, desc, "smb_io_printer_info_2"); depth++; @@ -2243,8 +2488,9 @@ BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, if (!smb_io_relstr("location", buffer, depth, &info->location)) return False; - /* NT parses the DEVMODE at the end of the struct */ - if (!smb_io_reldevmode("devmode", buffer, depth, &info->devmode)) + /* save current offset and wind forwared by a uint32 */ + dm_offset = prs_offset(ps); + if (!prs_uint32("devmode", ps, depth, &dummy_value)) return False; if (!smb_io_relstr("sepfile", buffer, depth, &info->sepfile)) @@ -2256,9 +2502,31 @@ BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, if (!smb_io_relstr("parameters", buffer, depth, &info->parameters)) return False; + /* save current offset for the sec_desc */ + sd_offset = prs_offset(ps); + if (!prs_uint32("sec_desc", ps, depth, &dummy_value)) + return False; + + + /* save current location so we can pick back up here */ + current_offset = prs_offset(ps); + + /* parse the devmode */ + if (!prs_set_offset(ps, dm_offset)) + return False; + if (!smb_io_reldevmode("devmode", buffer, depth, &info->devmode)) + return False; + + /* parse the sec_desc */ + if (!prs_set_offset(ps, sd_offset)) + return False; if (!smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc)) return False; + /* pick up where we left off */ + if (!prs_set_offset(ps, current_offset)) + return False; + if (!prs_uint32("attributes", ps, depth, &info->attributes)) return False; if (!prs_uint32("priority", ps, depth, &info->priority)) @@ -2276,13 +2544,6 @@ BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, if (!prs_uint32("averageppm", ps, depth, &info->averageppm)) return False; -#if 0 /* JFMTEST */ - if (!prs_uint32_post("secdesc_ptr", ps, depth, NULL, sec_offset, info->secdesc ? prs_offset(ps)-buffer->struct_start : 0 )) - return False; - - if (!sec_io_desc("secdesc", &info->secdesc, ps, depth)) - return False; -#endif return True; } @@ -3034,7 +3295,7 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) uint32 size=0; size += 4; - /* JRA !!!! TESTME - WHAT ABOUT prs_align.... !!! */ + size += sec_desc_size( info->secdesc ); size+=size_of_device_mode( info->devmode ); @@ -3060,6 +3321,16 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) size+=size_of_uint32( &info->status ); size+=size_of_uint32( &info->cjobs ); size+=size_of_uint32( &info->averageppm ); + + /* + * add any adjustments for alignment. This is + * not optimal since we could be calling this + * function from a loop (e.g. enumprinters), but + * it is easier to maintain the calculation here and + * not place the burden on the caller to remember. --jerry + */ + size += size % 4; + return size; } @@ -3529,7 +3800,7 @@ BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, BOOL make_spoolss_q_enumprinters( SPOOL_Q_ENUMPRINTERS *q_u, uint32 flags, - fstring servername, + char *servername, uint32 level, NEW_BUFFER *buffer, uint32 offered @@ -4767,60 +5038,56 @@ BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_ if(!prs_align(ps)) return False; + /* + * I know this seems weird, but I have no other explanation. + * This is observed behavior on both NT4 and 2K servers. + * --jerry + */ + + if (!prs_align_uint64(ps)) + return False; /* parse the main elements the packet */ - if(!prs_uint32("version", ps, depth, &il->version)) + if(!prs_uint32("cversion ", ps, depth, &il->version)) return False; - - if(!prs_uint32("name_ptr", ps, depth, &il->name_ptr)) - return False; - /* - * If name_ptr is NULL then the next 4 bytes are the name_ptr. A driver - * with a NULL name just isn't a driver For example: "HP LaserJet 4si" - * from W2K CDROM (which uses unidriver). JohnR 010205 - */ - if (!il->name_ptr) { - DEBUG(5,("spool_io_printer_driver_info_level_6: name_ptr is NULL! Get next value\n")); - if(!prs_uint32("name_ptr", ps, depth, &il->name_ptr)) - return False; - } - - if(!prs_uint32("environment_ptr", ps, depth, &il->environment_ptr)) + if(!prs_uint32("name ", ps, depth, &il->name_ptr)) return False; - if(!prs_uint32("driverpath_ptr", ps, depth, &il->driverpath_ptr)) + if(!prs_uint32("environment ", ps, depth, &il->environment_ptr)) return False; - if(!prs_uint32("datafile_ptr", ps, depth, &il->datafile_ptr)) + if(!prs_uint32("driverpath ", ps, depth, &il->driverpath_ptr)) return False; - if(!prs_uint32("configfile_ptr", ps, depth, &il->configfile_ptr)) + if(!prs_uint32("datafile ", ps, depth, &il->datafile_ptr)) return False; - if(!prs_uint32("helpfile_ptr", ps, depth, &il->helpfile_ptr)) + if(!prs_uint32("configfile ", ps, depth, &il->configfile_ptr)) return False; - if(!prs_uint32("monitorname_ptr", ps, depth, &il->monitorname_ptr)) + if(!prs_uint32("helpfile ", ps, depth, &il->helpfile_ptr)) return False; - if(!prs_uint32("defaultdatatype_ptr", ps, depth, &il->defaultdatatype_ptr)) + if(!prs_uint32("monitorname ", ps, depth, &il->monitorname_ptr)) return False; - if(!prs_uint32("dependentfiles_len", ps, depth, &il->dependentfiles_len)) + if(!prs_uint32("defaultdatatype", ps, depth, &il->defaultdatatype_ptr)) return False; - if(!prs_uint32("dependentfiles_ptr", ps, depth, &il->dependentfiles_ptr)) + if(!prs_uint32("dependentfiles ", ps, depth, &il->dependentfiles_len)) return False; - if(!prs_uint32("previousnames_len", ps, depth, &il->previousnames_len)) + if(!prs_uint32("dependentfiles ", ps, depth, &il->dependentfiles_ptr)) return False; - if(!prs_uint32("previousnames_ptr", ps, depth, &il->previousnames_ptr)) + if(!prs_uint32("previousnames ", ps, depth, &il->previousnames_len)) return False; - if(!smb_io_time("driverdate", &il->driverdate, ps, depth)) + if(!prs_uint32("previousnames ", ps, depth, &il->previousnames_ptr)) return False; - if(!prs_uint32("dummy4", ps, depth, &il->dummy4)) + if(!smb_io_time("driverdate ", &il->driverdate, ps, depth)) return False; - if(!prs_uint64("driverversion", ps, depth, &il->driverversion)) + if(!prs_uint32("dummy4 ", ps, depth, &il->dummy4)) return False; - if(!prs_uint32("mfgname_ptr", ps, depth, &il->mfgname_ptr)) + if(!prs_uint64("driverversion ", ps, depth, &il->driverversion)) return False; - if(!prs_uint32("oemurl_ptr", ps, depth, &il->oemurl_ptr)) + if(!prs_uint32("mfgname ", ps, depth, &il->mfgname_ptr)) return False; - if(!prs_uint32("hardwareid_ptr", ps, depth, &il->hardwareid_ptr)) + if(!prs_uint32("oemurl ", ps, depth, &il->oemurl_ptr)) return False; - if(!prs_uint32("provider_ptr", ps, depth, &il->provider_ptr)) + if(!prs_uint32("hardwareid ", ps, depth, &il->hardwareid_ptr)) + return False; + if(!prs_uint32("provider ", ps, depth, &il->provider_ptr)) return False; /* parse the structures in the packet */ @@ -5146,6 +5413,53 @@ BOOL spoolss_io_r_addprinterdriver(char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, pr return True; } +/******************************************************************* + fill in the prs_struct for a ADDPRINTERDRIVER request PDU + ********************************************************************/ + +BOOL spoolss_io_q_addprinterdriverex(char *desc, SPOOL_Q_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_addprinterdriverex"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("server_name_ptr", ps, depth, &q_u->server_name_ptr)) + return False; + if(!smb_io_unistr2("server_name", &q_u->server_name, q_u->server_name_ptr, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + if(!prs_uint32("info_level", ps, depth, &q_u->level)) + return False; + + if(!spool_io_printer_driver_info_level("", &q_u->info, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + if(!prs_uint32("copy flags", ps, depth, &q_u->copy_flags)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +BOOL spoolss_io_r_addprinterdriverex(char *desc, SPOOL_R_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_addprinterdriverex"); + depth++; + + if(!prs_werror("status", ps, depth, &q_u->status)) + return False; + + return True; +} + /******************************************************************* ********************************************************************/ @@ -5653,6 +5967,14 @@ BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_ if(!prs_uint32("valuesize", ps, depth, &r_u->valuesize)) return False; + if (UNMARSHALLING(ps) && r_u->valuesize) { + r_u->value = (uint16 *)prs_alloc_mem(ps, r_u->valuesize * 2); + if (!r_u->value) { + DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata value\n")); + return False; + } + } + if(!prs_uint16uni(False, "value", ps, depth, r_u->value, r_u->valuesize )) return False; @@ -5667,6 +5989,15 @@ BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_ if(!prs_uint32("datasize", ps, depth, &r_u->datasize)) return False; + + if (UNMARSHALLING(ps) && r_u->datasize) { + r_u->data = (uint8 *)prs_alloc_mem(ps, r_u->datasize); + if (!r_u->data) { + DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata data\n")); + return False; + } + } + if(!prs_uint8s(False, "data", ps, depth, r_u->data, r_u->datasize)) return False; if(!prs_align(ps)) @@ -5719,19 +6050,15 @@ BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, /******************************************************************* ********************************************************************/ -BOOL make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, TALLOC_CTX *ctx, const POLICY_HND *hnd, - char* value, char* data) +BOOL make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND *hnd, + char* value, char* data, uint32 data_size) { - UNISTR2 tmp; - memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); q_u->type = REG_SZ; init_unistr2(&q_u->value, value, strlen(value)+1); - init_unistr2(&tmp, data, strlen(data)+1); - q_u->max_len = q_u->real_len = tmp.uni_max_len*2; - q_u->data = talloc(ctx, q_u->real_len); - memcpy(q_u->data, tmp.buffer, q_u->real_len); + q_u->max_len = q_u->real_len = data_size; + q_u->data = data; return True; } @@ -6696,6 +7023,44 @@ BOOL spoolss_io_r_enumprinterkey(char *desc, SPOOL_R_ENUMPRINTERKEY *r_u, prs_st return True; } +/******************************************************************* + * read a structure. + ********************************************************************/ + +BOOL spoolss_io_q_deleteprinterkey(char *desc, SPOOL_Q_DELETEPRINTERKEY *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_deleteprinterkey"); + depth++; + + if(!prs_align(ps)) + return False; + if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) + return False; + + if(!smb_io_unistr2("", &q_u->keyname, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + * write a structure. + ********************************************************************/ + +BOOL spoolss_io_r_deleteprinterkey(char *desc, SPOOL_R_DELETEPRINTERKEY *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterkey"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status", ps, depth, &r_u->status)) + return False; + + return True; +} + /******************************************************************* * read a structure. @@ -7016,3 +7381,150 @@ BOOL make_spoolss_q_enumforms(SPOOL_Q_ENUMFORMS *q_u, POLICY_HND *handle, return True; } + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_setjob(SPOOL_Q_SETJOB *q_u, POLICY_HND *handle, + uint32 jobid, uint32 level, uint32 command) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + q_u->jobid = jobid; + q_u->level = level; + + /* Hmm - the SPOOL_Q_SETJOB structure has a JOB_INFO ctr in it but + the server side code has it marked as unused. */ + + q_u->command = command; + + return True; +} + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_getjob(SPOOL_Q_GETJOB *q_u, POLICY_HND *handle, + uint32 jobid, uint32 level, NEW_BUFFER *buffer, + uint32 offered) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + q_u->jobid = jobid; + q_u->level = level; + q_u->buffer = buffer; + q_u->offered = offered; + + return True; +} + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_startpageprinter(SPOOL_Q_STARTPAGEPRINTER *q_u, + POLICY_HND *handle) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + + return True; +} + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_endpageprinter(SPOOL_Q_ENDPAGEPRINTER *q_u, + POLICY_HND *handle) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + + return True; +} + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_startdocprinter(SPOOL_Q_STARTDOCPRINTER *q_u, + POLICY_HND *handle, uint32 level, + char *docname, char *outputfile, + char *datatype) +{ + DOC_INFO_CONTAINER *ctr = &q_u->doc_info_container; + + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + + ctr->level = level; + + switch (level) { + case 1: + ctr->docinfo.switch_value = level; + + ctr->docinfo.doc_info_1.p_docname = docname ? 1 : 0; + ctr->docinfo.doc_info_1.p_outputfile = outputfile ? 1 : 0; + ctr->docinfo.doc_info_1.p_datatype = datatype ? 1 : 0; + + if (docname) + init_unistr2(&ctr->docinfo.doc_info_1.docname, docname, + strlen(docname) + 1); + + if (outputfile) + init_unistr2(&ctr->docinfo.doc_info_1.outputfile, outputfile, + strlen(outputfile) + 1); + + if (datatype) + init_unistr2(&ctr->docinfo.doc_info_1.datatype, datatype, + strlen(datatype) + 1); + + break; + case 2: + /* DOC_INFO_2 is only used by Windows 9x and since it + doesn't do printing over RPC we don't have to worry + about it. */ + default: + DEBUG(3, ("unsupported info level %d\n", level)); + return False; + } + + return True; +} + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_enddocprinter(SPOOL_Q_ENDDOCPRINTER *q_u, + POLICY_HND *handle) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + + return True; +} + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_writeprinter(SPOOL_Q_WRITEPRINTER *q_u, + POLICY_HND *handle, uint32 data_size, + char *data) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + q_u->buffer_size = q_u->buffer_size2 = data_size; + q_u->buffer = data; + return True; +} + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA *q_u, + POLICY_HND *handle, char *valuename) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); + + return True; +} diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 9c9d5f1e9c..3dc054d2b1 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -5,6 +5,7 @@ * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997. * Copyright (C) Jeremy Allison 1999. + * 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 @@ -23,6 +24,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* Inits a SH_INFO_1_STR structure ********************************************************************/ @@ -108,10 +112,14 @@ void init_srv_share_info2_str(SH_INFO_2_STR *sh2, { DEBUG(5,("init_srv_share_info2_str\n")); - init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1); - init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1); - init_unistr2(&sh2->uni_path, path, strlen(path)+1); - init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1); + if (net_name) + init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1); + if (remark) + init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1); + if (path) + init_unistr2(&sh2->uni_path, path, strlen(path)+1); + if (passwd) + init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1); } /******************************************************************* @@ -658,7 +666,9 @@ void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); q_n->ctr.info_level = q_n->ctr.switch_value = info_level; - q_n->ctr.ptr_share_info = 0; + q_n->ctr.ptr_share_info = 1; + q_n->ctr.num_entries = 0; + q_n->ctr.ptr_entries = 0; q_n->preferred_len = preferred_len; memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); @@ -952,9 +962,34 @@ BOOL srv_io_q_net_share_add(char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info)) return False; + if(!prs_uint32("ptr_err_index", ps, depth, &q_n->ptr_err_index)) + return False; + if (q_n->ptr_err_index) + if (!prs_uint32("err_index", ps, depth, &q_n->err_index)) + return False; + return True; } +void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, char *srvname, + char *netname, uint32 type, char *remark, + uint32 perms, uint32 max_uses, uint32 num_uses, + char *path, char *passwd) +{ + q->ptr_srv_name = 1; + init_unistr2(&q->uni_srv_name, srvname, strlen(srvname) +1); + q->info.switch_value = q->info_level = 2; + + q->info.ptr_share_ctr = 1; + init_srv_share_info2(&q->info.share.info2.info_2, netname, type, + remark, perms, max_uses, num_uses, path, passwd); + init_srv_share_info2_str(&q->info.share.info2.info_2_str, netname, + remark, path, passwd); + q->ptr_err_index = 1; + q->err_index = 0; +} + + /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -978,6 +1013,14 @@ BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps return True; } +void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname, + const char *sharename) +{ + del->ptr_srv_name = 1; + init_unistr2(&del->uni_srv_name, srvname, strlen(srvname) +1 ); + init_unistr2(&del->uni_share_name, sharename, strlen(sharename) + 1); +} + /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -1001,6 +1044,11 @@ BOOL srv_io_q_net_share_del(char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth)) return False; + if(!prs_align(ps)) + return False; + if(!prs_uint32("reserved", ps, depth, &q_n->reserved)) + return False; + return True; } @@ -1148,7 +1196,7 @@ void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user) DEBUG(5,("init_srv_sess_info1_str\n")); init_unistr2(&ss1->uni_name, name, strlen(name)+1); - init_unistr2(&ss1->uni_user, name, strlen(user)+1); + init_unistr2(&ss1->uni_user, user, strlen(user)+1); } /******************************************************************* @@ -1329,10 +1377,10 @@ static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_stru ********************************************************************/ void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, - char *srv_name, char *qual_name, - uint32 sess_level, SRV_SESS_INFO_CTR *ctr, - uint32 preferred_len, - ENUM_HND *hnd) + char *srv_name, char *qual_name, + char *user_name, uint32 sess_level, + SRV_SESS_INFO_CTR *ctr, uint32 preferred_len, + ENUM_HND *hnd) { q_n->ctr = ctr; @@ -1340,6 +1388,7 @@ void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name); + init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name); q_n->sess_level = sess_level; q_n->preferred_len = preferred_len; @@ -1375,6 +1424,13 @@ BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth)) return False; + if(!prs_align(ps)) + return False; + if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth)) + return False; + if(!prs_align(ps)) return False; @@ -1879,91 +1935,67 @@ static BOOL srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_file_info_3(char *desc, SRV_FILE_INFO_3 *fl3, prs_struct *ps, int depth) +static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) { - if (fl3 == NULL) + if (ctr == NULL) return False; - prs_debug(ps, depth, desc, "srv_io_file_3_fl3"); + prs_debug(ps, depth, desc, "srv_io_srv_file_ctr"); depth++; + if (UNMARSHALLING(ps)) { + memset(ctr, '\0', sizeof(SRV_FILE_INFO_CTR)); + } + if(!prs_align(ps)) return False; - if(!prs_uint32("num_entries_read", ps, depth, &fl3->num_entries_read)) + if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) return False; - if(!prs_uint32("ptr_file_fl3", ps, depth, &fl3->ptr_file_info)) + if (ctr->switch_value != 3) { + DEBUG(5,("%s File info %d level not supported\n", + tab_depth(depth), ctr->switch_value)); + } + if(!prs_uint32("ptr_file_info", ps, depth, &ctr->ptr_file_info)) + return False; + if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries)) + return False; + if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries)) + return False; + if (ctr->ptr_entries == 0) + return True; + if(!prs_uint32("num_entries2", ps, depth, + &ctr->num_entries2)) return False; - if (fl3->ptr_file_info != 0) { + switch (ctr->switch_value) { + case 3: { + SRV_FILE_INFO_3 *info3 = ctr->file.info3; + int num_entries = ctr->num_entries; int i; - int num_entries = fl3->num_entries_read; - if (num_entries > MAX_FILE_ENTRIES) { - num_entries = MAX_FILE_ENTRIES; /* report this! */ + if (UNMARSHALLING(ps)) { + if (!(info3 = (SRV_FILE_INFO_3 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_FILE_INFO_3)))) + return False; + ctr->file.info3 = info3; } - if(!prs_uint32("num_entries_read2", ps, depth, &fl3->num_entries_read2)) - return False; - for (i = 0; i < num_entries; i++) { - if(!srv_io_file_info3("", &fl3->info_3[i], ps, depth)) + if(!srv_io_file_info3("", &ctr->file.info3[i].info_3, ps, depth)) return False; } - for (i = 0; i < num_entries; i++) { - if(!srv_io_file_info3_str("", &fl3->info_3_str[i], ps, depth)) + if(!srv_io_file_info3_str("", &ctr->file.info3[i].info_3_str, ps, depth)) return False; } - - if(!prs_align(ps)) - return False; - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR **pp_ctr, prs_struct *ps, int depth) -{ - SRV_FILE_INFO_CTR *ctr = *pp_ctr; - - if (UNMARSHALLING(ps)) { - ctr = *pp_ctr = (SRV_FILE_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_FILE_INFO_CTR)); - if (ctr == NULL) - return False; + break; } - - if (ctr == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_file_ctr"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) - return False; - if(!prs_uint32("ptr_file_ctr", ps, depth, &ctr->ptr_file_ctr)) - return False; - - if (ctr->ptr_file_ctr != 0) { - switch (ctr->switch_value) { - case 3: - if(!srv_io_srv_file_info_3("", &ctr->file.info3, ps, depth)) - return False; - break; - default: - DEBUG(5,("%s no file info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); - break; - } + default: + DEBUG(5,("%s no file info at switch_value %d\n", + tab_depth(depth), ctr->switch_value)); + break; } - + return True; } @@ -1972,20 +2004,22 @@ static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR **pp_ctr, prs_stru ********************************************************************/ void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, - char *srv_name, char *qual_name, - uint32 file_level, SRV_FILE_INFO_CTR *ctr, - uint32 preferred_len, - ENUM_HND *hnd) + char *srv_name, char *qual_name, char *user_name, + uint32 file_level, SRV_FILE_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd) { DEBUG(5,("init_q_net_file_enum\n")); - q_n->ctr = ctr; - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name); + init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name); - q_n->file_level = file_level; + q_n->file_level = q_n->ctr.switch_value = file_level; q_n->preferred_len = preferred_len; + q_n->ctr.ptr_file_info = 1; + q_n->ctr.num_entries = 0; + q_n->ctr.num_entries2 = 0; memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); } @@ -2021,6 +2055,13 @@ BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps if(!prs_align(ps)) return False; + if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; if(!prs_uint32("file_level", ps, depth, &q_n->file_level)) return False; @@ -2071,6 +2112,68 @@ BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps return True; } +/******************************************************************* + Initialize a net file close request +********************************************************************/ +void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, char *server, + uint32 file_id) +{ + q_n->ptr_srv_name = 1; + init_unistr2(&q_n->uni_srv_name, server, strlen(server) + 1); + q_n->file_id = file_id; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ +BOOL srv_io_q_net_file_close(char *desc, SRV_Q_NET_FILE_CLOSE *q_n, + prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_file_close"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("file_id", ps, depth, &q_n->file_id)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_file_close(char *desc, SRV_R_NET_FILE_CLOSE *q_n, + prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_file_close"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status", ps, depth, &q_n->status)) + return False; + + return True; +} + /******************************************************************* Inits a SRV_INFO_100 structure. ********************************************************************/ @@ -2907,3 +3010,14 @@ BOOL srv_io_r_net_file_set_secdesc(char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, return True; } + +/******************************************************************* + Inits a structure +********************************************************************/ + +void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, char *server) +{ + q_u->ptr_srv_name = 1; + init_unistr2(&q_u->uni_srv_name, server, strlen(server) + 1); +} + diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c index 3846c2e3b6..7b8fd76b7b 100644 --- a/source3/rpc_parse/parse_wks.c +++ b/source3/rpc_parse/parse_wks.c @@ -22,6 +22,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* Init ********************************************************************/ -- cgit From 159118de5ce0999b96ebe7cd7dc823087b0cccf5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 15 Jul 2002 10:54:35 +0000 Subject: fixed a number of real bugs found by warnings on the 64 bit irix compiler (This used to be commit 04de6bbc8055e5547af41b10e284b722f40e726d) --- source3/rpc_parse/parse_sec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 56eaf4c5b5..cec37348b8 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -157,7 +157,7 @@ BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth) adds new SID with its permissions to ACE list ********************************************************************/ -NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, size_t *num, DOM_SID *sid, uint32 mask) +NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, unsigned *num, DOM_SID *sid, uint32 mask) { int i = 0; @@ -165,7 +165,7 @@ NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, size_t *n *num += 1; - if((new[0] = (SEC_ACE *) talloc_zero(ctx, *num * sizeof(SEC_ACE))) == 0) + if((new[0] = (SEC_ACE *) talloc_zero(ctx, (*num) * sizeof(SEC_ACE))) == 0) return NT_STATUS_NO_MEMORY; for (i = 0; i < *num - 1; i ++) -- cgit From b0b28531c8cd76d3fcd95da08389d8a4d2e631a3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 15 Jul 2002 11:16:26 +0000 Subject: more bug updates from head (This used to be commit 8b769bf5bbbe54b1a39fd85cc24db09c1ab7faab) --- source3/rpc_parse/parse_sec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 56eaf4c5b5..cec37348b8 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -157,7 +157,7 @@ BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth) adds new SID with its permissions to ACE list ********************************************************************/ -NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, size_t *num, DOM_SID *sid, uint32 mask) +NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, unsigned *num, DOM_SID *sid, uint32 mask) { int i = 0; @@ -165,7 +165,7 @@ NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, size_t *n *num += 1; - if((new[0] = (SEC_ACE *) talloc_zero(ctx, *num * sizeof(SEC_ACE))) == 0) + if((new[0] = (SEC_ACE *) talloc_zero(ctx, (*num) * sizeof(SEC_ACE))) == 0) return NT_STATUS_NO_MEMORY; for (i = 0; i < *num - 1; i ++) -- cgit From ea9d3057e9cbd615176a7b98bcd935b6f9b434cb Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 20 Jul 2002 11:58:06 +0000 Subject: Try to fix up warnings - particularly on the IRIX 64 bit compiler (which had a distinction between uchar and char). Lots of const etc. Andrew Bartlett (This used to be commit 8196ee908e10db2119e480fe1b0a71b31a16febc) --- source3/rpc_parse/parse_srv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 3dc054d2b1..7f1915edc7 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -2004,7 +2004,8 @@ static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct * ********************************************************************/ void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, - char *srv_name, char *qual_name, char *user_name, + const char *srv_name, const char *qual_name, + const char *user_name, uint32 file_level, SRV_FILE_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) -- cgit From c0f66c1786cfbbff416a59b38930788cbe86f686 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sun, 21 Jul 2002 04:55:11 +0000 Subject: Name get and set dir drive functions consistently. (This used to be commit 290a304d2c1b70d20129236e20a0ff664179023e) --- source3/rpc_parse/parse_samr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index c16232204c..36ce59b7f2 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5945,7 +5945,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * 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_dirdrive(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); -- cgit From e8177d1104c8f7a1035f5c9c340ae5c9b594a729 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 23 Jul 2002 04:55:06 +0000 Subject: * changed structure of REG_R_ENUM_VALUE structure since the BUFFER2 is not and [in/out] buffer * registry value enumeration is working now for the Print\Forms key. The format of the binary data is not quite right yet but all installed forms are listed (This used to be commit 998eb9c7312c3c9a9ed1e9ec294593503c0304bf) --- source3/rpc_parse/parse_prs.c | 8 +++++--- source3/rpc_parse/parse_reg.c | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 2ab8c7246e..4de6b88e9c 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -893,9 +893,11 @@ BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 * return False; if (UNMARSHALLING(ps)) { - str->buffer = (uint16 *)prs_alloc_mem(ps,str->buf_len); - if (str->buffer == NULL) - return False; + if ( str->buf_len ) { + str->buffer = (uint16 *)prs_alloc_mem(ps,str->buf_len); + if ( str->buffer == NULL ) + return False; + } } p = (char *)str->buffer; diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 1ebc1532f3..3987f20885 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1138,6 +1138,38 @@ void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol, q_i->len_value2 = 0; } +/******************************************************************* +makes a structure. +********************************************************************/ + +void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) +{ + ZERO_STRUCTP(r_u); + + /* value name */ + + init_uni_hdr( &r_u->hdr_name, strlen(val->valuename)+1 ); + init_unistr2( &r_u->uni_name, val->valuename, strlen(val->valuename)+1 ); + + /* type */ + + r_u->ptr_type = 1; + r_u->type = val->type; + + /* data */ + + r_u->ptr_value = 1; + init_buffer2( &r_u->buf_value, val->data.void_ptr, val->size ); + + /* lengths */ + + r_u->ptr1 = 1; + r_u->len_value1 = val->size; + + r_u->ptr2 = 1; + r_u->len_value2 = val->size; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -1158,6 +1190,7 @@ BOOL reg_io_q_enum_val(char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int d if(!prs_uint32("val_index", ps, depth, &q_q->val_index)) return False; + if(!smb_io_unihdr ("hdr_name", &q_q->hdr_name, ps, depth)) return False; if(!smb_io_unistr2("uni_name", &q_q->uni_name, q_q->hdr_name.buffer, ps, depth)) @@ -1228,7 +1261,7 @@ BOOL reg_io_r_enum_val(char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, int d if(!prs_uint32("ptr_value", ps, depth, &r_q->ptr_value)) return False; - if(!smb_io_buffer2("buf_value", r_q->buf_value, r_q->ptr_value, ps, depth)) + if(!smb_io_buffer2("buf_value", &r_q->buf_value, r_q->ptr_value, ps, depth)) return False; if(!prs_align(ps)) return False; -- cgit From c808cc3643f06c72f870d0b14a37c7a46627e2fa Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 24 Jul 2002 06:42:09 +0000 Subject: several changes in this checkin * added REG_OPEN_HKCR for supporting regedit.exe * All data n a REGISTRY_VALUE is stored to a pointer now * fixed REG_INFO to correctly display data when double clicking on and entry in the registry editor * Will now enumerate installed driver_info_3 data * fixed numerous bugs related to pointer offsets, memory issues, etc.. in the registry routines * added a simple caching mechanism to fetch_reg_[keys|values]_specific() All that is left now is to enumerate PrinterData and I will have finished what I started out to do.... (This used to be commit 419d7208e8384e4ad2c4dd328ad5e630971bc76c) --- source3/rpc_parse/parse_reg.c | 174 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 153 insertions(+), 21 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 3987f20885..83b55863eb 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -6,6 +6,7 @@ * Copyright (C) Paul Ashton 1997. * Copyright (C) Marc Jacobsen 1999. * Copyright (C) Simo Sorce 2000. + * Copyright (C) Gerald Carter 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 @@ -27,6 +28,89 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE +/******************************************************************* + Fill in a BUFFER2 for the data given a REGISTRY_VALUE + *******************************************************************/ + +static uint32 reg_init_buffer2( BUFFER2 *buf2, REGISTRY_VALUE *val ) +{ + UNISTR2 unistr; + uint32 real_size = 0; + char *string; + char *list = NULL; + char *list2 = NULL; + + if ( !buf2 || !val ) + return 0; + + real_size = val->size; + + switch (val->type ) + { + case REG_SZ: + string = (char*)val->data_p; + DEBUG(10,("reg_init_buffer2: REG_SZ string => [%s]\n", string)); + + init_unistr2( &unistr, (char*)val->data_p, strlen((char*)val->data_p)+1 ); + init_buffer2( buf2, (char*)unistr.buffer, unistr.uni_str_len*2 ); + real_size = unistr.uni_str_len*2; + break; + + case REG_MULTI_SZ: + string = (char*)val->data_p; + real_size = 0; + while ( string && *string ) + { + DEBUG(10,("reg_init_buffer2: REG_MULTI_SZ string => [%s], size => [%d]\n", string, real_size )); + + init_unistr2( &unistr, string, strlen(string)+1 ); + + list2 = Realloc( list, real_size + unistr.uni_str_len*2 ); + if ( !list2 ) + break; + list = list2; + + memcpy( list+real_size, unistr.buffer, unistr.uni_str_len*2 ); + + real_size += unistr.uni_str_len*2; + + string += strlen(string)+1; + } + + list2 = Realloc( list, real_size + 2 ); + if ( !list2 ) + break; + list = list2; + list[real_size++] = 0x0; + list[real_size++] = 0x0; + + init_buffer2( buf2, (char*)list, real_size ); + + DEBUG(10,("reg_init_buffer2: REG_MULTI_SZ size => [%d]\n", real_size )); + + break; + + case REG_BINARY: + DEBUG(10,("reg_init_buffer2: REG_BINARY size => [%d]\n", val->size )); + + init_buffer2( buf2, val->data_p, val->size ); + break; + + case REG_DWORD: + DEBUG(10,("reg_init_buffer2: REG_DWORD value => [%d]\n", *(uint32*)val->data_p)); + init_buffer2( buf2, val->data_p, val->size ); + break; + + default: + DEBUG(0,("reg_init_buffer2: Unsupported registry data type [%d]\n", val->type)); + break; + } + + SAFE_FREE( list ); + + return real_size; +} + /******************************************************************* Inits a structure. ********************************************************************/ @@ -165,6 +249,8 @@ BOOL reg_io_r_open_hklm(char *desc, REG_R_OPEN_HKLM * r_r, prs_struct *ps, } + + /******************************************************************* Inits a structure. ********************************************************************/ @@ -1023,6 +1109,45 @@ BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) return True; } +/******************************************************************* + Inits a structure. + New version to replace older init_reg_r_info() +********************************************************************/ + +BOOL new_init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r, + REGISTRY_VALUE *val, NTSTATUS status) +{ + uint32 buf_len = 0; + + if(r_r == NULL) + return False; + + if ( !val ) + return False; + + r_r->ptr_type = 1; + r_r->type = val->type; + + /* if include_keyval is not set, don't send the key value, just + the buflen data. probably used by NT5 to allocate buffer space - SK */ + + if ( include_keyval ) { + r_r->ptr_uni_val = 1; + buf_len = reg_init_buffer2( &r_r->uni_val, val ); + + } + + r_r->ptr_max_len = 1; + r_r->buf_max_len = buf_len; + + r_r->ptr_len = 1; + r_r->buf_len = buf_len; + + r_r->status = status; + + return True; +} + /******************************************************************* Inits a structure. ********************************************************************/ @@ -1030,28 +1155,27 @@ BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) BOOL init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r, BUFFER2* buf, uint32 type, NTSTATUS status) { - if(r_r == NULL) - return False; - + if(r_r == NULL) + return False; - r_r->ptr_type = 1; - r_r->type = type; + r_r->ptr_type = 1; + r_r->type = type; - /* if include_keyval is not set, don't send the key value, just - the buflen data. probably used by NT5 to allocate buffer space - SK */ - r_r->ptr_uni_val = include_keyval ? 1:0; - r_r->uni_val = buf; + /* if include_keyval is not set, don't send the key value, just + the buflen data. probably used by NT5 to allocate buffer space - SK */ - r_r->ptr_max_len = 1; - r_r->buf_max_len = r_r->uni_val->buf_max_len; + r_r->ptr_uni_val = include_keyval ? 1:0; + r_r->uni_val = *buf; - r_r->ptr_len = 1; - r_r->buf_len = r_r->uni_val->buf_len; + r_r->ptr_max_len = 1; + r_r->buf_max_len = r_r->uni_val.buf_max_len; - r_r->status = status; + r_r->ptr_len = 1; + r_r->buf_len = r_r->uni_val.buf_len; - return True; - + r_r->status = status; + + return True; } /******************************************************************* @@ -1081,7 +1205,7 @@ BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) return False; if(r_r->ptr_uni_val != 0) { - if(!smb_io_buffer2("uni_val", r_r->uni_val, r_r->ptr_uni_val, ps, depth)) + if(!smb_io_buffer2("uni_val", &r_r->uni_val, r_r->ptr_uni_val, ps, depth)) return False; } @@ -1144,10 +1268,16 @@ makes a structure. void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) { + uint32 real_size; + + DEBUG(8,("init_reg_r_enum_val: Enter\n")); + ZERO_STRUCTP(r_u); /* value name */ + DEBUG(10,("init_reg_r_enum_val: Valuename => [%s]\n", val->valuename)); + init_uni_hdr( &r_u->hdr_name, strlen(val->valuename)+1 ); init_unistr2( &r_u->uni_name, val->valuename, strlen(val->valuename)+1 ); @@ -1156,18 +1286,20 @@ void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) r_u->ptr_type = 1; r_u->type = val->type; - /* data */ + /* REG_SZ & REG_MULTI_SZ must be converted to UNICODE */ r_u->ptr_value = 1; - init_buffer2( &r_u->buf_value, val->data.void_ptr, val->size ); + real_size = reg_init_buffer2( &r_u->buf_value, val ); /* lengths */ r_u->ptr1 = 1; - r_u->len_value1 = val->size; + r_u->len_value1 = real_size; r_u->ptr2 = 1; - r_u->len_value2 = val->size; + r_u->len_value2 = real_size; + + DEBUG(8,("init_reg_r_enum_val: Exit\n")); } /******************************************************************* -- cgit From a23e96316ebf5086a27365d4a9fb63b0e4533f6f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 26 Jul 2002 22:40:06 +0000 Subject: 3 things: * normalize all registry key strings before storing or looking up paths in the registry tdb * return the current buffer size for REG_INFO even when not returning actual data * fix a segfault report by metze on #samba-technical so that the user/group object picker works again (was the "ProductType" key lookup that was failing). (This used to be commit 5640e6cdb213502d95fff33e06eaeed5ce3aeb76) --- source3/rpc_parse/parse_reg.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 83b55863eb..925d8b856e 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1118,7 +1118,8 @@ BOOL new_init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r, REGISTRY_VALUE *val, NTSTATUS status) { uint32 buf_len = 0; - + BUFFER2 buf2; + if(r_r == NULL) return False; @@ -1136,6 +1137,11 @@ BOOL new_init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r, buf_len = reg_init_buffer2( &r_r->uni_val, val ); } + else { + /* dummy buffer used so we can get the size */ + r_r->ptr_uni_val = 0; + buf_len = reg_init_buffer2( &buf2, val ); + } r_r->ptr_max_len = 1; r_r->buf_max_len = buf_len; -- cgit From 7ce66f79ea84d77f186bbf6e7831dc71cc6ec46a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 27 Jul 2002 11:48:55 +0000 Subject: A very long time ago (actually 6 months ago) I promised to commit this code to the Samba tree. Originally written by Nigel Williams" , I've been trying to keep it in some form of shape for the last 6 months. In particular I think some of the code got committed a few months ago, and others have made changes to the CVS version over time. anyway, its finally in - and doesn't appear to have broken anything. Now to try the client-side patches :-) Andrew Bartlett (This used to be commit f9bac7c5c2c4ddf0bf39d596a7b922fbb17c6b16) --- source3/rpc_parse/parse_srv.c | 700 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 634 insertions(+), 66 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 7f1915edc7..531267c308 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -3,9 +3,10 @@ * 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) Jeremy Allison 1999. - * Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2002 + * Copyright (C) Paul Ashton 1997, + * Copyright (C) Jeremy Allison 1999, + * Copyright (C) Nigel Williams 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 @@ -27,6 +28,71 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE +/******************************************************************* + Inits a SH_INFO_0_STR structure +********************************************************************/ + +void init_srv_share_info0_str(SH_INFO_0_STR *sh0, char *net_name) +{ + DEBUG(5,("init_srv_share_info0_str\n")); + + if(net_name) + init_unistr2(&sh0->uni_netname, net_name, strlen(net_name)+1); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info0_str(char *desc, SH_INFO_0_STR *sh0, prs_struct *ps, int depth) +{ + if (sh0 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info0_str"); + depth++; + + if(!prs_align(ps)) + return False; + if(sh0->ptrs->ptr_netname) + if(!smb_io_unistr2("", &sh0->uni_netname, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + makes a SH_INFO_0 structure +********************************************************************/ + +void init_srv_share_info0(SH_INFO_0 *sh0, char *net_name) +{ + DEBUG(5,("init_srv_share_info0: %s\n", net_name)); + + sh0->ptr_netname = (net_name != NULL) ? 1 : 0; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info0(char *desc, SH_INFO_0 *sh0, prs_struct *ps, int depth) +{ + if (sh0 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info0"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_netname", ps, depth, &sh0->ptr_netname)) + return False; + + return True; +} + /******************************************************************* Inits a SH_INFO_1_STR structure ********************************************************************/ @@ -35,8 +101,10 @@ void init_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark) { DEBUG(5,("init_srv_share_info1_str\n")); - init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1); - init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1); + if(net_name) + init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1); + if(remark) + init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1); } /******************************************************************* @@ -47,20 +115,24 @@ static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *p { if (sh1 == NULL) return False; - + prs_debug(ps, depth, desc, "srv_io_share_info1_str"); depth++; - + if(!prs_align(ps)) return False; - if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth)) - return False; + if(sh1->ptrs->ptr_netname) + if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth)) + return False; + if(!prs_align(ps)) return False; - if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth)) - return False; - + + if(sh1->ptrs->ptr_remark) + if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth)) + return False; + return True; } @@ -71,7 +143,7 @@ static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *p void init_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark) { DEBUG(5,("init_srv_share_info1: %s %8x %s\n", net_name, type, remark)); - + sh1->ptr_netname = (net_name != NULL) ? 1 : 0; sh1->type = type; sh1->ptr_remark = (remark != NULL) ? 1 : 0; @@ -139,6 +211,7 @@ static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2 if(!prs_align(ps)) return False; + if (sh->ptr_netname) if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth)) return False; @@ -175,7 +248,6 @@ void init_srv_share_info2(SH_INFO_2 *sh2, sh2->perms = perms; sh2->max_uses = max_uses; sh2->num_uses = num_uses; - sh2->type = type; sh2->ptr_path = (path != NULL) ? 1 : 0; sh2->ptr_passwd = (passwd != NULL) ? 1 : 0; } @@ -215,6 +287,21 @@ static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int d return True; } +/******************************************************************* + Inits a SH_INFO_501_STR structure +********************************************************************/ + +void init_srv_share_info501_str(SH_INFO_501_STR *sh501, + char *net_name, char *remark) +{ + DEBUG(5,("init_srv_share_info501_str\n")); + + if(net_name) + init_unistr2(&sh501->uni_netname, net_name, strlen(net_name)+1); + if(remark) + init_unistr2(&sh501->uni_remark, remark, strlen(remark)+1); +} + /******************************************************************* Inits a SH_INFO_2 structure *******************************************************************/ @@ -259,18 +346,6 @@ static BOOL srv_io_share_info501(char *desc, SH_INFO_501 *sh501, prs_struct *ps, return True; } -/******************************************************************** - Inits a SH_INFO_501_STR structure -********************************************************************/ - -void init_srv_share_info501_str(SH_INFO_501_STR *sh501, char *net_name, char *remark) -{ - DEBUG(5,("init_srv_share_info501_str\n")); - - init_unistr2(&sh501->uni_netname, net_name, strlen(net_name)+1); - init_unistr2(&sh501->uni_remark, remark, strlen(remark)+1); -} - /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -301,7 +376,7 @@ static BOOL srv_io_share_info501_str(char *desc, SH_INFO_501_STR *sh501, prs_str ********************************************************************/ void init_srv_share_info502(SH_INFO_502 *sh502, - char *net_name, uint32 type, char *remark, + const char *net_name, uint32 type, char *remark, uint32 perms, uint32 max_uses, uint32 num_uses, char *path, char *passwd, SEC_DESC *psd, size_t sd_size) { @@ -315,9 +390,9 @@ void init_srv_share_info502(SH_INFO_502 *sh502, sh502->perms = perms; sh502->max_uses = max_uses; sh502->num_uses = num_uses; - sh502->type = type; sh502->ptr_path = (path != NULL) ? 1 : 0; sh502->ptr_passwd = (passwd != NULL) ? 1 : 0; + sh502->reserved = 0; /* actual size within rpc */ sh502->sd_size = (uint32)sd_size; sh502->ptr_sd = (psd != NULL) ? 1 : 0; } @@ -353,7 +428,7 @@ static BOOL srv_io_share_info502(char *desc, SH_INFO_502 *sh502, prs_struct *ps, return False; if(!prs_uint32("ptr_passwd ", ps, depth, &sh502->ptr_passwd)) return False; - if(!prs_uint32("sd_size ", ps, depth, &sh502->sd_size)) + if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &sh502->reserved_offset)) return False; if(!prs_uint32("ptr_sd ", ps, depth, &sh502->ptr_sd)) return False; @@ -366,26 +441,22 @@ static BOOL srv_io_share_info502(char *desc, SH_INFO_502 *sh502, prs_struct *ps, ********************************************************************/ void init_srv_share_info502_str(SH_INFO_502_STR *sh502str, - SH_INFO_502 *ptrs, char *net_name, char *remark, char *path, char *passwd, SEC_DESC *psd, size_t sd_size) { DEBUG(5,("init_srv_share_info502_str\n")); - sh502str->ptrs = ptrs; - - if(sh502str->ptrs->ptr_netname) + if(net_name) init_unistr2(&sh502str->uni_netname, net_name, strlen(net_name)+1); - if(sh502str->ptrs->ptr_remark) + if(remark) init_unistr2(&sh502str->uni_remark, remark, strlen(remark)+1); - if(sh502str->ptrs->ptr_path) + if(path) init_unistr2(&sh502str->uni_path, path, strlen(path)+1); - if(sh502str->ptrs->ptr_passwd) + if(passwd) init_unistr2(&sh502str->uni_passwd, passwd, strlen(passwd)+1); - if(sh502str->ptrs->ptr_sd) { sh502str->sd = psd; + sh502str->reserved = 0; sh502str->sd_size = sd_size; - } } /******************************************************************* @@ -436,21 +507,112 @@ static BOOL srv_io_share_info502_str(char *desc, SH_INFO_502_STR *sh502, prs_str return False; if(sh502->ptrs->ptr_sd) { - if(!prs_uint32("sd_size ", ps, depth, &sh502->sd_size)) + uint32 old_offset; + uint32 reserved_offset; + + if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &reserved_offset)) return False; + + old_offset = prs_offset(ps); + if (!sec_io_desc(desc, &sh502->sd, ps, depth)) return False; + + if(UNMARSHALLING(ps)) { + + sh502->ptrs->sd_size = sh502->sd_size = sec_desc_size(sh502->sd); + + prs_set_offset(ps, old_offset + sh502->reserved); + } + + prs_align(ps); + + if(MARSHALLING(ps)) { + + sh502->ptrs->reserved = sh502->reserved = prs_offset(ps) - old_offset; + } + + if(!prs_uint32_post("reserved ", ps, depth, + &sh502->reserved, reserved_offset, sh502->reserved)) + return False; + if(!prs_uint32_post("reserved ", ps, depth, + &sh502->ptrs->reserved, sh502->ptrs->reserved_offset, sh502->ptrs->reserved)) + return False; } return True; } +/******************************************************************* + Inits a SH_INFO_1004_STR structure +********************************************************************/ + +void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, char *remark) +{ + DEBUG(5,("init_srv_share_info1004_str\n")); + + if(remark) + init_unistr2(&sh1004->uni_remark, remark, strlen(remark)+1); +} + /******************************************************************* Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005, - prs_struct* ps, int depth) +static BOOL srv_io_share_info1004_str(char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth) +{ + if (sh1004 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1004_str"); + depth++; + + if(!prs_align(ps)) + return False; + if(sh1004->ptrs->ptr_remark) + if(!smb_io_unistr2("", &sh1004->uni_remark, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + makes a SH_INFO_1004 structure +********************************************************************/ + +void init_srv_share_info1004(SH_INFO_1004 *sh1004, char *remark) +{ + DEBUG(5,("init_srv_share_info1004: %s\n", remark)); + + sh1004->ptr_remark = (remark != NULL) ? 1 : 0; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1004(char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth) +{ + if (sh1004 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1004"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_remark", ps, depth, &sh1004->ptr_remark)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth) { if(sh1005 == NULL) return False; @@ -471,6 +633,95 @@ static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005, Reads or writes a structure. ********************************************************************/ +static BOOL srv_io_share_info1006(char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth) +{ + if(sh1006 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1006"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("max uses ", ps, depth, &sh1006->max_uses)) + return False; + + return True; +} + +/******************************************************************* + Inits a SH_INFO_1007_STR structure +********************************************************************/ + +void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate_directory_name) +{ + DEBUG(5,("init_srv_share_info1007_str\n")); + + if(alternate_directory_name) + init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, strlen(alternate_directory_name)+1); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1007_str(char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth) +{ + if (sh1007 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1007_str"); + depth++; + + if(!prs_align(ps)) + return False; + if(sh1007->ptrs->ptr_AlternateDirectoryName) + if(!smb_io_unistr2("", &sh1007->uni_AlternateDirectoryName, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + makes a SH_INFO_1007 structure +********************************************************************/ + +void init_srv_share_info1007(SH_INFO_1007 *sh1007, uint32 flags, const char *alternate_directory_name) +{ + DEBUG(5,("init_srv_share_info1007: %s\n", alternate_directory_name)); + + sh1007->flags = flags; + sh1007->ptr_AlternateDirectoryName = (alternate_directory_name != NULL) ? 1 : 0; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1007(char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth) +{ + if (sh1007 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1007"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("flags ", ps, depth, &sh1007->flags)) + return False; + if(!prs_uint32("ptr_Alter..", ps, depth, &sh1007->ptr_AlternateDirectoryName)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + static BOOL srv_io_share_info1501(char* desc, SRV_SHARE_INFO_1501* sh1501, prs_struct* ps, int depth) { @@ -511,9 +762,6 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct if(!prs_uint32("info_level", ps, depth, &ctr->info_level)) return False; - if (ctr->info_level == 0) - return True; - if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) return False; if(!prs_uint32("ptr_share_info", ps, depth, &ctr->ptr_share_info)) @@ -541,6 +789,33 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct return False; switch (ctr->switch_value) { + + case 0: + { + SRV_SHARE_INFO_0 *info0 = ctr->share.info0; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps)) { + if (!(info0 = (SRV_SHARE_INFO_0 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_0)))) + return False; + ctr->share.info0 = info0; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info0("", &info0[i].info_0, ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + info0[i].info_0_str.ptrs = &info0[i].info_0; + if(!srv_io_share_info0_str("", &info0[i].info_0_str, ps, depth)) + return False; + } + + break; + } + case 1: { SRV_SHARE_INFO_1 *info1 = ctr->share.info1; @@ -559,6 +834,7 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct } for (i = 0; i < num_entries; i++) { + info1[i].info_1_str.ptrs = &info1[i].info_1; if(!srv_io_share_info1_str("", &info1[i].info_1_str, ps, depth)) return False; } @@ -632,8 +908,8 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct for (i = 0; i < num_entries; i++) { if(!srv_io_share_info502("", &info502[i].info_502, ps, depth)) return False; - } - + } + for (i = 0; i < num_entries; i++) { info502[i].info_502_str.ptrs = &info502[i].info_502; if(!srv_io_share_info502_str("", &info502[i].info_502_str, ps, depth)) @@ -643,6 +919,118 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct break; } + case 1004: + { + SRV_SHARE_INFO_1004 *info1004 = ctr->share.info1004; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps)) { + if (!(info1004 = (SRV_SHARE_INFO_1004 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1004)))) + return False; + ctr->share.info1004 = info1004; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1004("", &info1004[i].info_1004, ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + info1004[i].info_1004_str.ptrs = &info1004[i].info_1004; + if(!srv_io_share_info1004_str("", &info1004[i].info_1004_str, ps, depth)) + return False; + } + + break; + } + + case 1005: + { + SRV_SHARE_INFO_1005 *info1005 = ctr->share.info1005; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps)) { + if (!(info1005 = (SRV_SHARE_INFO_1005 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1005)))) + return False; + ctr->share.info1005 = info1005; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1005("", &info1005[i], ps, depth)) + return False; + } + + break; + } + + case 1006: + { + SRV_SHARE_INFO_1006 *info1006 = ctr->share.info1006; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps)) { + if (!(info1006 = (SRV_SHARE_INFO_1006 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1006)))) + return False; + ctr->share.info1006 = info1006; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1006("", &info1006[i], ps, depth)) + return False; + } + + break; + } + + case 1007: + { + SRV_SHARE_INFO_1007 *info1007 = ctr->share.info1007; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps)) { + if (!(info1007 = (SRV_SHARE_INFO_1007 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1007)))) + return False; + ctr->share.info1007 = info1007; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1007("", &info1007[i].info_1007, ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + info1007[i].info_1007_str.ptrs = &info1007[i].info_1007; + if(!srv_io_share_info1007_str("", &info1007[i].info_1007_str, ps, depth)) + return False; + } + + break; + } + + case 1501: + { + SRV_SHARE_INFO_1501 *info1501 = ctr->share.info1501; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps)) { + if (!(info1501 = (SRV_SHARE_INFO_1501 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1501)))) + return False; + ctr->share.info1501 = info1501; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1501("", &info1501[i], ps, depth)) + return False; + } + + break; + } + default: DEBUG(5,("%s no share info at switch_value %d\n", tab_depth(depth), ctr->switch_value)); @@ -667,8 +1055,9 @@ void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, q_n->ctr.info_level = q_n->ctr.switch_value = info_level; q_n->ctr.ptr_share_info = 1; - q_n->ctr.num_entries = 0; - q_n->ctr.ptr_entries = 0; + q_n->ctr.num_entries = 0; + q_n->ctr.ptr_entries = 0; + q_n->ctr.num_entries2 = 0; q_n->preferred_len = preferred_len; memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); @@ -729,14 +1118,37 @@ BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct * if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) return False; - if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) - return False; + + if(r_n->total_entries != 0) { + if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) + return False; + } + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; } +/******************************************************************* + initialises a structure. +********************************************************************/ + +BOOL init_srv_q_net_share_get_info(SRV_Q_NET_SHARE_GET_INFO *q_n, const char *srv_name, const char *share_name, uint32 info_level) +{ + + uint32 ptr_share_name; + + DEBUG(5,("init_srv_q_net_share_get_info\n")); + + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); + init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name); + + q_n->info_level = info_level; + + return True; +} + /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -792,10 +1204,24 @@ static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHA if (r_n->ptr_share_ctr != 0) { switch (r_n->switch_value) { + case 0: + if(!srv_io_share_info0("", &r_n->share.info0.info_0, ps, depth)) + return False; + + /* allow access to pointers in the str part. */ + r_n->share.info0.info_0_str.ptrs = &r_n->share.info0.info_0; + + if(!srv_io_share_info0_str("", &r_n->share.info0.info_0_str, ps, depth)) + return False; + + break; case 1: if(!srv_io_share_info1("", &r_n->share.info1.info_1, ps, depth)) return False; + /* allow access to pointers in the str part. */ + r_n->share.info1.info_1_str.ptrs = &r_n->share.info1.info_1; + if(!srv_io_share_info1_str("", &r_n->share.info1.info_1_str, ps, depth)) return False; @@ -819,16 +1245,40 @@ static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHA if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth)) return False; - /*allow access to pointers in the str part. */ + /* allow access to pointers in the str part. */ r_n->share.info502.info_502_str.ptrs = &r_n->share.info502.info_502; if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth)) return False; break; + case 1004: + if(!srv_io_share_info1004("", &r_n->share.info1004.info_1004, ps, depth)) + return False; + + /* allow access to pointers in the str part. */ + r_n->share.info1004.info_1004_str.ptrs = &r_n->share.info1004.info_1004; + + if(!srv_io_share_info1004_str("", &r_n->share.info1004.info_1004_str, ps, depth)) + return False; + break; case 1005: if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth)) return False; break; + case 1006: + if(!srv_io_share_info1006("", &r_n->share.info1006, ps, depth)) + return False; + break; + case 1007: + if(!srv_io_share_info1007("", &r_n->share.info1007.info_1007, ps, depth)) + return False; + + /* allow access to pointers in the str part. */ + r_n->share.info1007.info_1007_str.ptrs = &r_n->share.info1007.info_1007; + + if(!srv_io_share_info1007_str("", &r_n->share.info1007.info_1007_str, ps, depth)) + return False; + break; case 1501: if (!srv_io_share_info1501("", &r_n->share.info1501, ps, depth)) return False; @@ -869,6 +1319,34 @@ BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_ return True; } +/******************************************************************* + intialises a structure. +********************************************************************/ + +BOOL init_srv_q_net_share_set_info(SRV_Q_NET_SHARE_SET_INFO *q_n, + const char *srv_name, + const char *share_name, + uint32 info_level, + const SRV_SHARE_INFO *info) +{ + + uint32 ptr_share_name; + + DEBUG(5,("init_srv_q_net_share_set_info\n")); + + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); + init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name); + + q_n->info_level = info_level; + + q_n->info = *info; + + q_n->ptr_parm_error = 1; + q_n->parm_error = 0; + + return True; +} + /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -904,6 +1382,15 @@ BOOL srv_io_q_net_share_set_info(char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_ if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info)) return False; + if(!prs_align(ps)) + return False; + if(!prs_uint32("ptr_parm_error", ps, depth, &q_n->ptr_parm_error)) + return False; + if(q_n->ptr_parm_error!=0) { + if(!prs_uint32("parm_error", ps, depth, &q_n->parm_error)) + return False; + } + return True; } @@ -911,9 +1398,9 @@ BOOL srv_io_q_net_share_set_info(char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_ Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth) { - if (q_n == NULL) + if (r_n == NULL) return False; prs_debug(ps, depth, desc, "srv_io_r_net_share_set_info"); @@ -922,14 +1409,22 @@ BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *q_n, prs_ if(!prs_align(ps)) return False; - if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) + if(!prs_uint32("ptr_parm_error ", ps, depth, &r_n->ptr_parm_error)) return False; - if(!prs_werror("status", ps, depth, &q_n->status)) + + if(r_n->ptr_parm_error) { + + if(!prs_uint32("parm_error ", ps, depth, &r_n->parm_error)) + return False; + } + + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; } + /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -962,6 +1457,9 @@ BOOL srv_io_q_net_share_add(char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info)) return False; + if(!prs_align(ps)) + return False; + if(!prs_uint32("ptr_err_index", ps, depth, &q_n->ptr_err_index)) return False; if (q_n->ptr_err_index) @@ -994,9 +1492,9 @@ void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, char *srvname, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth) { - if (q_n == NULL) + if (r_n == NULL) return False; prs_debug(ps, depth, desc, "srv_io_r_net_share_add"); @@ -1005,14 +1503,25 @@ BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps if(!prs_align(ps)) return False; - if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) + if(!prs_uint32("ptr_parm_error", ps, depth, &r_n->ptr_parm_error)) return False; - if(!prs_werror("status", ps, depth, &q_n->status)) + + if(r_n->ptr_parm_error) { + + if(!prs_uint32("parm_error", ps, depth, &r_n->parm_error)) + return False; + } + + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; } +/******************************************************************* + initialises a structure. +********************************************************************/ + void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname, const char *sharename) { @@ -1889,8 +2398,8 @@ static BOOL srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct * ********************************************************************/ void init_srv_file_info3(FILE_INFO_3 *fl3, - uint32 id, uint32 perms, uint32 num_locks, - char *path_name, char *user_name) + uint32 id, uint32 perms, uint32 num_locks, + char *path_name, char *user_name) { DEBUG(5,("init_srv_file_info3: %s %s\n", path_name, user_name)); @@ -2296,7 +2805,7 @@ void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name, sv102->disc = disc; sv102->hidden = hidden; sv102->announce = announce; - sv102->ann_delta =ann_delta; + sv102->ann_delta = ann_delta; sv102->licenses = licenses; init_buf_unistr2(&sv102->uni_usr_path, &sv102->ptr_usr_path, usr_path); } @@ -2560,7 +3069,7 @@ BOOL srv_io_r_net_srv_set_info(char *desc, SRV_R_NET_SRV_SET_INFO *r_n, if(!prs_align(ps)) return False; - if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value)) + if(!prs_uint32("switch value ", ps, depth, &r_n->switch_value)) return False; if(!prs_werror("status", ps, depth, &r_n->status)) @@ -2688,6 +3197,31 @@ BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct * return True; } +/******************************************************************* + initialises a structure. + ********************************************************************/ + +BOOL init_srv_q_net_disk_enum(SRV_Q_NET_DISK_ENUM *q_n, + const char *srv_name, + uint32 preferred_len, + ENUM_HND *enum_hnd + ) +{ + + + DEBUG(5,("init_srv_q_net_srv_disk_enum\n")); + + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); + + q_n->disk_enum_ctr.level = 0; + q_n->disk_enum_ctr.disk_info_ptr = 0; + + q_n->preferred_len = preferred_len; + memcpy(&q_n->enum_hnd, enum_hnd, sizeof(*enum_hnd)); + + return True; +} + /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -2738,7 +3272,9 @@ BOOL srv_io_q_net_disk_enum(char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps BOOL srv_io_r_net_disk_enum(char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth) { + int i; + uint32 entries_read, entries_read2, entries_read3; if (r_n == NULL) return False; @@ -2746,23 +3282,36 @@ BOOL srv_io_r_net_disk_enum(char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps prs_debug(ps, depth, desc, "srv_io_r_net_disk_enum"); depth++; + entries_read = entries_read2 = entries_read3 = r_n->disk_enum_ctr.entries_read; + if(!prs_align(ps)) return False; - if(!prs_uint32("entries_read", ps, depth, &r_n->disk_enum_ctr.entries_read)) + if(!prs_uint32("entries_read", ps, depth, &entries_read)) return False; if(!prs_uint32("ptr_disk_info", ps, depth, &r_n->disk_enum_ctr.disk_info_ptr)) return False; /*this may be max, unknown, actual?*/ - if(!prs_uint32("max_elements", ps, depth, &r_n->disk_enum_ctr.entries_read)) + if(!prs_uint32("max_elements", ps, depth, &entries_read2)) return False; if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.unknown)) return False; - if(!prs_uint32("actual_elements", ps, depth, &r_n->disk_enum_ctr.entries_read)) + if(!prs_uint32("actual_elements", ps, depth, &entries_read3)) return False; + r_n->disk_enum_ctr.entries_read = entries_read3; + + if(UNMARSHALLING(ps)) { + + DISK_INFO *dinfo; + + if(!(dinfo = (DISK_INFO *)prs_alloc_mem(ps, sizeof(*dinfo) * entries_read3))) + return False; + r_n->disk_enum_ctr.disk_info = dinfo; + } + for(i=0; i < r_n->disk_enum_ctr.entries_read; i++) { if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.disk_info[i].unknown)) @@ -2787,6 +3336,25 @@ BOOL srv_io_r_net_disk_enum(char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps return True; } +/******************************************************************* + initialises a structure. + ********************************************************************/ + +BOOL init_srv_q_net_name_validate(SRV_Q_NET_NAME_VALIDATE *q_n, const char *srv_name, const char *share_name, int type) +{ + uint32 ptr_share_name; + + DEBUG(5,("init_srv_q_net_name_validate\n")); + + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); + init_buf_unistr2(&q_n->uni_name, &ptr_share_name, share_name); + + q_n->type = type; + q_n->flags = 0; + + return True; +} + /******************************************************************* Reads or writes a structure. ********************************************************************/ -- cgit From d6a3fd8ad4f01b20eda7eff91cfb336b183c08ac Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 29 Jul 2002 18:10:18 +0000 Subject: passing -1 for the src length in rpcstr_pull results in only converting the first character of the unicode string., See convert_string() for why. uniarray_2_dosarray() passes 0 for the src length now which works. (This used to be commit 0793612cca3bba55d5e5e2970308f95839f208b4) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b10a5c4377..bc1691d26b 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5183,7 +5183,7 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) *ar = NULL; while (src < ((char *)buf5->buffer) + buf5->buf_len*2) { - rpcstr_pull(f, src, sizeof(f)-1, -1, 0); + rpcstr_pull(f, src, sizeof(f)-1, 0, 0); src = skip_unibuf(src, 2*buf5->buf_len - PTR_DIFF(src,buf5->buffer)); tar = (fstring *)Realloc(*ar, sizeof(fstring)*(n+2)); if (!tar) -- cgit From c17dc6c55c3a5a2912028a1d6a713f26b3b91c63 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 29 Jul 2002 19:45:15 +0000 Subject: add another registry rpc (opnum 0x14). Have no idea what it's real name is. I'm calling it REG_SAVE_KEY, because 2k preps a regedt32.exe Registry->Save Key with this call. Done in the process of tracking down a PrinterDriverData issue. (This used to be commit 66104a361424f10cc986c597b91afa6f12b3cd8a) --- source3/rpc_parse/parse_reg.c | 60 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 925d8b856e..473e2554b4 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1,4 +1,4 @@ -/* +/* * Unix SMB/CIFS implementation. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1997, @@ -669,7 +669,7 @@ BOOL reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int d return False; if(!smb_io_time("mod_time ", &r_r->mod_time, ps, depth)) return False; - + if(!prs_ntstatus("status", ps, depth, &r_r->status)) return False; @@ -685,6 +685,7 @@ void init_reg_q_unknown_1a(REG_Q_UNKNOWN_1A *q_o, POLICY_HND *hnd) memcpy(&q_o->pol, hnd, sizeof(q_o->pol)); } + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -699,7 +700,7 @@ BOOL reg_io_q_unknown_1a(char *desc, REG_Q_UNKNOWN_1A *r_q, prs_struct *ps, int if(!prs_align(ps)) return False; - + if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) return False; @@ -720,7 +721,7 @@ BOOL reg_io_r_unknown_1a(char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *ps, int if(!prs_align(ps)) return False; - + if(!prs_uint32("unknown", ps, depth, &r_r->unknown)) return False; if(!prs_ntstatus("status" , ps, depth, &r_r->status)) @@ -729,6 +730,57 @@ BOOL reg_io_r_unknown_1a(char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *ps, int return True; } + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL reg_io_q_save_key(char *desc, REG_Q_SAVE_KEY *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) + return False; + + prs_debug(ps, depth, desc, "reg_io_q_save_key"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) + return False; + + if(!smb_io_unihdr ("hdr_file", &r_q->hdr_file, ps, depth)) + return False; + if(!smb_io_unistr2("uni_file", &r_q->uni_file, r_q->hdr_file.buffer, ps, depth)) + return False; + + if(!prs_uint32("unknown", ps, depth, &r_q->unknown)) + return False; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL reg_io_r_save_key(char *desc, REG_R_SAVE_KEY *r_r, prs_struct *ps, int depth) +{ + if (r_r == NULL) + return False; + + prs_debug(ps, depth, desc, "reg_io_r_save_key"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_ntstatus("status" , ps, depth, &r_r->status)) + return False; + + return True; +} + /******************************************************************* Inits a structure. ********************************************************************/ -- cgit From 89d46eeb33c2d8e2b9b5a06ebe3a369675ae3657 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Tue, 30 Jul 2002 17:23:07 +0000 Subject: Add LSA RPC 0x2E, lsa_query_info2. Only level implemented is 0x0c, which is netbios and dns domain info. Also add code to set/fetch the domain GUID from secrets.tdb (although set is not yet called by anyone). (This used to be commit 31d7168530ccce2c5e9e7f96464b47f4d9771a25) --- source3/rpc_parse/parse_lsa.c | 110 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 108 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index a6aecb7967..d0536dab01 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -3,8 +3,9 @@ * 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) Paul Ashton 1997, + * Copyright (C) Andrew Bartlett 2002, + * Copyright (C) Jim McDonough 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 @@ -2117,3 +2118,108 @@ BOOL policy_handle_is_valid(const POLICY_HND *hnd) ZERO_STRUCT(zero_pol); return ((memcmp(&zero_pol, hnd, sizeof(POLICY_HND)) == 0) ? False : True ); } + +/******************************************************************* + Reads or writes an LSA_DNS_DOM_INFO structure. +********************************************************************/ + +BOOL lsa_io_dns_dom_info(char *desc, LSA_DNS_DOM_INFO *info, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_dns_dom_info"); + 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 (!prs_uint8s(False, "dom_guid", ps, depth, info->dom_guid.info, GUID_SIZE)) + 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 an LSA_Q_QUERY_DNSDOMINFO structure. +********************************************************************/ + +BOOL lsa_io_q_query_info2(char *desc, LSA_Q_QUERY_INFO2 *q_c, + 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", &q_c->pol, ps, depth)) + return False; + + if(!prs_uint16("info_class", ps, depth, &q_c->info_class)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes an LSA_R_QUERY_DNSDOMINFO structure. +********************************************************************/ + +BOOL lsa_io_r_query_info2(char *desc, LSA_R_QUERY_INFO2 *r_c, + 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("ptr", ps, depth, &r_c->ptr)) + return False; + if(!prs_uint16("info_class", ps, depth, &r_c->info_class)) + return False; + switch(r_c->info_class) { + case 0x000c: + if (!lsa_io_dns_dom_info("info12", &r_c->info.dns_dom_info, + ps, depth)) + return False; + break; + default: + DEBUG(0,("lsa_io_r_query_info2: unknown info class %d\n", + r_c->info_class)); + return False; + } + + if(!prs_align(ps)) + return False; + if(!prs_ntstatus("status", ps, depth, &r_c->status)) + return False; + + return True; +} -- cgit From 2d67a683b735d50f411a4bee9ee5ec17e9a60015 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 31 Jul 2002 12:05:30 +0000 Subject: Winbind updates! This updates the 'winbind' authentication module and winbind's 'PAM' (actually netlogon) code to allow smbd to cache connections to the DC. This is particulary relevent when we need mutex locks already - there is no parallelism to be gained anyway. The winbind code authenticates the user, and if successful, passes back the 'info3' struct describing the user. smbd then interprets that in exactly the same way as an 'ntdomain' logon. Also, add parinoia to winbind about null termination. Andrew Bartlett (This used to be commit 167f122b670d4ef67d78e6f79a2bae3f6e8d67df) --- source3/rpc_parse/parse_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 46fdce63ff..da49a6531d 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1335,7 +1335,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, ********************************************************************/ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, - int depth, uint16 validation_level) + int depth, uint16 validation_level) { int i; -- cgit From ff2132e1b37cfca8d36fe515dd1a5139459dd719 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 5 Aug 2002 06:28:58 +0000 Subject: Spelling fix. (This used to be commit 28ba237a9e02e284fb541562270db758612e425a) --- source3/rpc_parse/parse_reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 473e2554b4..365ad2dc70 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1754,7 +1754,7 @@ BOOL reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int if(!prs_uint32("unknown_0 ", ps, depth, &r_q->unknown_0)) return False; - if(!prs_uint32("asccess_desired ", ps, depth, &r_q->access_desired)) + if(!prs_uint32("access_desired ", ps, depth, &r_q->access_desired)) return False; return True; -- cgit From 5e42dcfe467d48fa7e8d87b88ae2bb2f54e5d28d Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Tue, 6 Aug 2002 18:02:56 +0000 Subject: Add SAMR 0x3e, which is samr_connect4. Seems to be the same as our existing connect (which I've been told is really connect2), with one extra dword. We've only seen 0x00000002 there... (This used to be commit 266344634944dff30f56453f9d86c490e7ac7a55) --- source3/rpc_parse/parse_samr.c | 62 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 36ce59b7f2..5131f3b4f2 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5,8 +5,10 @@ * 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 Franois Micouleau 1998-2001. + * Copyright (C) Jeremy Allison 2001, + * Copyright (C) Jean Franois Micouleau 1998-2001, + * Copyright (C) Anthony Liguori 2002, + * Copyright (C) Jim McDonough 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 @@ -6716,6 +6718,62 @@ BOOL samr_io_r_connect(char *desc, SAMR_R_CONNECT * r_u, return True; } +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_q_connect4(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(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_CONNECT_ANON structure. ********************************************************************/ -- cgit From 335aa54b466896d6623ec2e61c1ca38442cddb6f Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 8 Aug 2002 04:58:19 +0000 Subject: Merge of incomplete rffpcnex testing code from APPLIANCE_HEAD. (This used to be commit fe43c2ac2d2e1dd3b3a25c807d4dd379c5ac4960) --- source3/rpc_parse/parse_spoolss.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index bc1691d26b..ab8c4e1ab6 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7528,3 +7528,31 @@ BOOL make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA *q_u, return True; } + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle, + uint32 flags, uint32 options, char *localmachine, + uint32 printerlocal, SPOOL_NOTIFY_OPTION *option) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + + q_u->flags = flags; + q_u->options = options; + + q_u->localmachine_ptr = 1; + + init_unistr2(&q_u->localmachine, localmachine, + strlen(localmachine) + 1); + + q_u->printerlocal = printerlocal; + + if (option) + q_u->option_ptr = 1; + + q_u->option = option; + + return True; +} -- cgit From 14d385439d99f0eadca5296aeef800c67038916b Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 8 Aug 2002 20:54:37 +0000 Subject: printing change notification merge from APPLIANCE_HEAD (This used to be commit 11ddfd9cfa550dcd3186c8aaf0cc038ce7f1791f) --- source3/rpc_parse/parse_spoolss.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index ab8c4e1ab6..a1fa758791 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -322,7 +322,7 @@ reads or writes an NOTIFY INFO DATA structure. static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) { - uint32 useless_ptr=0xADDE0FF0; + uint32 useless_ptr=0x0FF0ADDE; prs_debug(ps, depth, desc, "smb_io_notify_info_data"); depth++; @@ -378,6 +378,14 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs break; + case NOTIFY_SECDESC: + if( !prs_uint32( "sd size", ps, depth, &data->notify_data.sd.size ) ) + return False; + if( !prs_uint32( "pointer", ps, depth, &useless_ptr ) ) + return False; + + break; + default: DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data\n", data->enc_type)); @@ -451,6 +459,13 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, break; + case NOTIFY_SECDESC: + if( !prs_uint32("secdesc size ", ps, depth, &data->notify_data.sd.size ) ) + return False; + if ( !sec_io_desc( "sec_desc", &data->notify_data.sd.desc, ps, depth ) ) + return False; + break; + default: DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data_strings\n", data->enc_type)); @@ -6750,7 +6765,7 @@ BOOL make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd, q_u->unknown0=0x0; q_u->unknown1=0x0; - q_u->info_ptr=0xaddee11e; + q_u->info_ptr=0x0FF0ADDE; q_u->info.version=2; -- cgit From 4a822be1d3bb547b87ff3a0f24dca862fa1fa809 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Mon, 12 Aug 2002 08:25:02 +0000 Subject: Add client side support for samr connect4 (0x3e). Seems to have one additional parm compared to samr connect, but I've only seen 0x00000002 in that field... (This used to be commit ed2370b91f7f6a36efdf6b65340a5b29a26e7e7a) --- source3/rpc_parse/parse_samr.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 5131f3b4f2..a6e1351aa1 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6718,6 +6718,28 @@ BOOL samr_io_r_connect(char *desc, SAMR_R_CONNECT * r_u, return True; } +/******************************************************************* +inits a SAMR_Q_CONNECT4 structure. +********************************************************************/ + +void init_samr_q_connect4(SAMR_Q_CONNECT4 * q_u, + char *srv_name, uint32 access_mask) +{ + int len_srv_name = strlen(srv_name); + + DEBUG(5, ("init_samr_q_connect\n")); + + /* make PDC server name \\server */ + q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0; + init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1); + + /* 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. ********************************************************************/ -- cgit From ae6cb0fb31c51c2e0beeda016e75d711a518b140 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Mon, 12 Aug 2002 13:40:59 +0000 Subject: Add lsa 0x2e (queryinfo2) client side (This used to be commit c3b05b21a0340d8ff02a79401399e3d43d9e759a) --- source3/rpc_parse/parse_lsa.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index d0536dab01..375bbd31d7 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2165,6 +2165,19 @@ BOOL lsa_io_dns_dom_info(char *desc, LSA_DNS_DOM_INFO *info, } +/******************************************************************* + Inits an LSA_Q_QUERY_INFO2 structure. +********************************************************************/ + +void init_q_query2(LSA_Q_QUERY_INFO2 *q_q, POLICY_HND *hnd, uint16 info_class) +{ + DEBUG(5, ("init_q_query2\n")); + + memcpy(&q_q->pol, hnd, sizeof(q_q->pol)); + + q_q->info_class = info_class; +} + /******************************************************************* Reads or writes an LSA_Q_QUERY_DNSDOMINFO structure. ********************************************************************/ -- cgit From b28b28ee34fa4e1f2b8c212c488d9611b3192502 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 14 Aug 2002 10:21:53 +0000 Subject: added comment about a new specversion seen from client. Device mode size is still the same though. jerry (This used to be commit fb822e97cb832361062fbb2aa239d949cc83efed) --- source3/rpc_parse/parse_spoolss.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index a1fa758791..79760ff37e 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -690,9 +690,11 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo Let the size determine that */ switch (devmode->specversion) { + /* list of observed spec version's */ case 0x0320: case 0x0400: case 0x0401: + case 0x040d: break; default: -- cgit From 702687a3a4f236e8731f9c95805ccbdd38d13baa Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 15 Aug 2002 02:26:37 +0000 Subject: The unknown_0 field in a CREATE_USER2 reply is the access granted. (This used to be commit 8bca3085836255536794444248e7ff3a2460c045) --- source3/rpc_parse/parse_samr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a6e1351aa1..d363440727 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5069,7 +5069,7 @@ BOOL samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER * r_u, if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth)) return False; - if(!prs_uint32("unknown_0", ps, depth, &r_u->unknown_0)) + if(!prs_uint32("access_granted", ps, depth, &r_u->unknown_0)) return False; if(!prs_uint32("user_rid ", ps, depth, &r_u->user_rid)) return False; -- cgit From 9b38f76ab10a015ade9da2c5c9bafd43e3ef258c Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 15 Aug 2002 19:40:34 +0000 Subject: Rename unknown_0 field in create_user2 reply in the actual struct. (This used to be commit 482d873c26bf02e27ffcd92042b476eda765a5ff) --- source3/rpc_parse/parse_samr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index d363440727..1137993bb6 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5069,7 +5069,7 @@ BOOL samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER * r_u, if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth)) return False; - if(!prs_uint32("access_granted", ps, depth, &r_u->unknown_0)) + 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; -- cgit From 4ed429481c6aa2517b8b1615f95900d7db372cd6 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 16 Aug 2002 15:36:37 +0000 Subject: Fairly large change to printing code. * removed support for PHANTOM_DEVMODE printer data * s/NT_PRINTER_PARAM/REGISTRY_VALUE/g - This was a good bit of work. Everything seems stable, but is not complete. * support for printer data keys other than PrinterDriverData in the store and fetch routines. Still needs to be plugged into the XxxPrinterDataEx() calls. Tested against NT4.0 & 2k. Like I said, it's not done, but doesn't crash so it shouldn't upset anyone (unless you're trying to build a Samba printer server off of HEAD). More work to come. Should settle by Monday. jerry (This used to be commit 7ba7c04c0e961618c82c2112b9627af114c6cc42) --- source3/rpc_parse/parse_spoolss.c | 36 ------------------------------------ 1 file changed, 36 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 79760ff37e..ac41a81a5a 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -6186,42 +6186,6 @@ BOOL spoolss_io_r_resetprinter(char *desc, SPOOL_R_RESETPRINTER *r_u, prs_struct return True; } -/******************************************************************* -********************************************************************/ -BOOL convert_specific_param(NT_PRINTER_PARAM **param, const UNISTR2 *value, - uint32 type, const uint8 *data, uint32 len) -{ - DEBUG(5,("converting a specific param struct\n")); - - if (*param == NULL) - { - *param=(NT_PRINTER_PARAM *)malloc(sizeof(NT_PRINTER_PARAM)); - if(*param == NULL) - return False; - memset((char *)*param, '\0', sizeof(NT_PRINTER_PARAM)); - DEBUGADD(6,("Allocated a new PARAM struct\n")); - } - unistr2_to_ascii((*param)->value, value, sizeof((*param)->value)-1); - (*param)->type = type; - - /* le champ data n'est pas NULL termine */ - /* on stocke donc la longueur */ - - (*param)->data_len=len; - - if (len) { - (*param)->data=(uint8 *)malloc(len * sizeof(uint8)); - if((*param)->data == NULL) - return False; - memcpy((*param)->data, data, len); - } - - DEBUGADD(6,("\tvalue:[%s], len:[%d]\n",(*param)->value, (*param)->data_len)); - dump_data(10, (char *)(*param)->data, (*param)->data_len); - - return True; -} - /******************************************************************* ********************************************************************/ -- cgit From cb36e520b38edf063157024b46d9e58f8a341028 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 17 Aug 2002 13:17:41 +0000 Subject: * the printing code should now be back to the working state it was before the swap from NT_PRINTER_PARAM to REGISTRY_VALUE. * XxxPrinterDataEx() functions have not been expanded to support keys other than SPOOL_PRINTERDATA_KEY yet * fixed apparent long standing bug regarding the dependentfiles list in the DRIVER_INFO struct (This used to be commit d59b0eb1236cf5bb9371030a94eb60d4131c15fb) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index ac41a81a5a..3a7f4b57ae 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5200,7 +5200,7 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) *ar = NULL; while (src < ((char *)buf5->buffer) + buf5->buf_len*2) { - rpcstr_pull(f, src, sizeof(f)-1, 0, 0); + rpcstr_pull(f, src, sizeof(f)-1, -1, STR_TERMINATE); src = skip_unibuf(src, 2*buf5->buf_len - PTR_DIFF(src,buf5->buffer)); tar = (fstring *)Realloc(*ar, sizeof(fstring)*(n+2)); if (!tar) -- cgit From b2edf254eda92f775e7d3d9b6793b4d77f9000b6 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 17 Aug 2002 17:00:51 +0000 Subject: sync 3.0 branch with head (This used to be commit 3928578b52cfc949be5e0ef444fce1558d75f290) --- source3/rpc_parse/parse_lsa.c | 123 ++++++- source3/rpc_parse/parse_net.c | 2 +- source3/rpc_parse/parse_prs.c | 8 +- source3/rpc_parse/parse_reg.c | 269 +++++++++++++-- source3/rpc_parse/parse_samr.c | 88 ++++- source3/rpc_parse/parse_spoolss.c | 87 ++--- source3/rpc_parse/parse_srv.c | 703 ++++++++++++++++++++++++++++++++++---- 7 files changed, 1141 insertions(+), 139 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index a6aecb7967..375bbd31d7 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -3,8 +3,9 @@ * 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) Paul Ashton 1997, + * Copyright (C) Andrew Bartlett 2002, + * Copyright (C) Jim McDonough 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 @@ -2117,3 +2118,121 @@ BOOL policy_handle_is_valid(const POLICY_HND *hnd) ZERO_STRUCT(zero_pol); return ((memcmp(&zero_pol, hnd, sizeof(POLICY_HND)) == 0) ? False : True ); } + +/******************************************************************* + Reads or writes an LSA_DNS_DOM_INFO structure. +********************************************************************/ + +BOOL lsa_io_dns_dom_info(char *desc, LSA_DNS_DOM_INFO *info, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_dns_dom_info"); + 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 (!prs_uint8s(False, "dom_guid", ps, depth, info->dom_guid.info, GUID_SIZE)) + 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; + +} + +/******************************************************************* + Inits an LSA_Q_QUERY_INFO2 structure. +********************************************************************/ + +void init_q_query2(LSA_Q_QUERY_INFO2 *q_q, POLICY_HND *hnd, uint16 info_class) +{ + DEBUG(5, ("init_q_query2\n")); + + memcpy(&q_q->pol, hnd, sizeof(q_q->pol)); + + q_q->info_class = info_class; +} + +/******************************************************************* + Reads or writes an LSA_Q_QUERY_DNSDOMINFO structure. +********************************************************************/ + +BOOL lsa_io_q_query_info2(char *desc, LSA_Q_QUERY_INFO2 *q_c, + 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", &q_c->pol, ps, depth)) + return False; + + if(!prs_uint16("info_class", ps, depth, &q_c->info_class)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes an LSA_R_QUERY_DNSDOMINFO structure. +********************************************************************/ + +BOOL lsa_io_r_query_info2(char *desc, LSA_R_QUERY_INFO2 *r_c, + 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("ptr", ps, depth, &r_c->ptr)) + return False; + if(!prs_uint16("info_class", ps, depth, &r_c->info_class)) + return False; + switch(r_c->info_class) { + case 0x000c: + if (!lsa_io_dns_dom_info("info12", &r_c->info.dns_dom_info, + ps, depth)) + return False; + break; + default: + DEBUG(0,("lsa_io_r_query_info2: unknown info class %d\n", + r_c->info_class)); + return False; + } + + if(!prs_align(ps)) + return False; + if(!prs_ntstatus("status", ps, depth, &r_c->status)) + return False; + + return True; +} diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 46fdce63ff..da49a6531d 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1335,7 +1335,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, ********************************************************************/ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, - int depth, uint16 validation_level) + int depth, uint16 validation_level) { int i; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 2ab8c7246e..4de6b88e9c 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -893,9 +893,11 @@ BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 * return False; if (UNMARSHALLING(ps)) { - str->buffer = (uint16 *)prs_alloc_mem(ps,str->buf_len); - if (str->buffer == NULL) - return False; + if ( str->buf_len ) { + str->buffer = (uint16 *)prs_alloc_mem(ps,str->buf_len); + if ( str->buffer == NULL ) + return False; + } } p = (char *)str->buffer; diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 1ebc1532f3..365ad2dc70 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1,4 +1,4 @@ -/* +/* * Unix SMB/CIFS implementation. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1997, @@ -6,6 +6,7 @@ * Copyright (C) Paul Ashton 1997. * Copyright (C) Marc Jacobsen 1999. * Copyright (C) Simo Sorce 2000. + * Copyright (C) Gerald Carter 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 @@ -27,6 +28,89 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE +/******************************************************************* + Fill in a BUFFER2 for the data given a REGISTRY_VALUE + *******************************************************************/ + +static uint32 reg_init_buffer2( BUFFER2 *buf2, REGISTRY_VALUE *val ) +{ + UNISTR2 unistr; + uint32 real_size = 0; + char *string; + char *list = NULL; + char *list2 = NULL; + + if ( !buf2 || !val ) + return 0; + + real_size = val->size; + + switch (val->type ) + { + case REG_SZ: + string = (char*)val->data_p; + DEBUG(10,("reg_init_buffer2: REG_SZ string => [%s]\n", string)); + + init_unistr2( &unistr, (char*)val->data_p, strlen((char*)val->data_p)+1 ); + init_buffer2( buf2, (char*)unistr.buffer, unistr.uni_str_len*2 ); + real_size = unistr.uni_str_len*2; + break; + + case REG_MULTI_SZ: + string = (char*)val->data_p; + real_size = 0; + while ( string && *string ) + { + DEBUG(10,("reg_init_buffer2: REG_MULTI_SZ string => [%s], size => [%d]\n", string, real_size )); + + init_unistr2( &unistr, string, strlen(string)+1 ); + + list2 = Realloc( list, real_size + unistr.uni_str_len*2 ); + if ( !list2 ) + break; + list = list2; + + memcpy( list+real_size, unistr.buffer, unistr.uni_str_len*2 ); + + real_size += unistr.uni_str_len*2; + + string += strlen(string)+1; + } + + list2 = Realloc( list, real_size + 2 ); + if ( !list2 ) + break; + list = list2; + list[real_size++] = 0x0; + list[real_size++] = 0x0; + + init_buffer2( buf2, (char*)list, real_size ); + + DEBUG(10,("reg_init_buffer2: REG_MULTI_SZ size => [%d]\n", real_size )); + + break; + + case REG_BINARY: + DEBUG(10,("reg_init_buffer2: REG_BINARY size => [%d]\n", val->size )); + + init_buffer2( buf2, val->data_p, val->size ); + break; + + case REG_DWORD: + DEBUG(10,("reg_init_buffer2: REG_DWORD value => [%d]\n", *(uint32*)val->data_p)); + init_buffer2( buf2, val->data_p, val->size ); + break; + + default: + DEBUG(0,("reg_init_buffer2: Unsupported registry data type [%d]\n", val->type)); + break; + } + + SAFE_FREE( list ); + + return real_size; +} + /******************************************************************* Inits a structure. ********************************************************************/ @@ -165,6 +249,8 @@ BOOL reg_io_r_open_hklm(char *desc, REG_R_OPEN_HKLM * r_r, prs_struct *ps, } + + /******************************************************************* Inits a structure. ********************************************************************/ @@ -583,7 +669,7 @@ BOOL reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int d return False; if(!smb_io_time("mod_time ", &r_r->mod_time, ps, depth)) return False; - + if(!prs_ntstatus("status", ps, depth, &r_r->status)) return False; @@ -599,6 +685,7 @@ void init_reg_q_unknown_1a(REG_Q_UNKNOWN_1A *q_o, POLICY_HND *hnd) memcpy(&q_o->pol, hnd, sizeof(q_o->pol)); } + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -613,7 +700,7 @@ BOOL reg_io_q_unknown_1a(char *desc, REG_Q_UNKNOWN_1A *r_q, prs_struct *ps, int if(!prs_align(ps)) return False; - + if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) return False; @@ -634,7 +721,7 @@ BOOL reg_io_r_unknown_1a(char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *ps, int if(!prs_align(ps)) return False; - + if(!prs_uint32("unknown", ps, depth, &r_r->unknown)) return False; if(!prs_ntstatus("status" , ps, depth, &r_r->status)) @@ -643,6 +730,57 @@ BOOL reg_io_r_unknown_1a(char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *ps, int return True; } + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL reg_io_q_save_key(char *desc, REG_Q_SAVE_KEY *r_q, prs_struct *ps, int depth) +{ + if (r_q == NULL) + return False; + + prs_debug(ps, depth, desc, "reg_io_q_save_key"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) + return False; + + if(!smb_io_unihdr ("hdr_file", &r_q->hdr_file, ps, depth)) + return False; + if(!smb_io_unistr2("uni_file", &r_q->uni_file, r_q->hdr_file.buffer, ps, depth)) + return False; + + if(!prs_uint32("unknown", ps, depth, &r_q->unknown)) + return False; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL reg_io_r_save_key(char *desc, REG_R_SAVE_KEY *r_r, prs_struct *ps, int depth) +{ + if (r_r == NULL) + return False; + + prs_debug(ps, depth, desc, "reg_io_r_save_key"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_ntstatus("status" , ps, depth, &r_r->status)) + return False; + + return True; +} + /******************************************************************* Inits a structure. ********************************************************************/ @@ -1023,6 +1161,51 @@ BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) return True; } +/******************************************************************* + Inits a structure. + New version to replace older init_reg_r_info() +********************************************************************/ + +BOOL new_init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r, + REGISTRY_VALUE *val, NTSTATUS status) +{ + uint32 buf_len = 0; + BUFFER2 buf2; + + if(r_r == NULL) + return False; + + if ( !val ) + return False; + + r_r->ptr_type = 1; + r_r->type = val->type; + + /* if include_keyval is not set, don't send the key value, just + the buflen data. probably used by NT5 to allocate buffer space - SK */ + + if ( include_keyval ) { + r_r->ptr_uni_val = 1; + buf_len = reg_init_buffer2( &r_r->uni_val, val ); + + } + else { + /* dummy buffer used so we can get the size */ + r_r->ptr_uni_val = 0; + buf_len = reg_init_buffer2( &buf2, val ); + } + + r_r->ptr_max_len = 1; + r_r->buf_max_len = buf_len; + + r_r->ptr_len = 1; + r_r->buf_len = buf_len; + + r_r->status = status; + + return True; +} + /******************************************************************* Inits a structure. ********************************************************************/ @@ -1030,28 +1213,27 @@ BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) BOOL init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r, BUFFER2* buf, uint32 type, NTSTATUS status) { - if(r_r == NULL) - return False; - + if(r_r == NULL) + return False; - r_r->ptr_type = 1; - r_r->type = type; + r_r->ptr_type = 1; + r_r->type = type; - /* if include_keyval is not set, don't send the key value, just - the buflen data. probably used by NT5 to allocate buffer space - SK */ - r_r->ptr_uni_val = include_keyval ? 1:0; - r_r->uni_val = buf; + /* if include_keyval is not set, don't send the key value, just + the buflen data. probably used by NT5 to allocate buffer space - SK */ - r_r->ptr_max_len = 1; - r_r->buf_max_len = r_r->uni_val->buf_max_len; + r_r->ptr_uni_val = include_keyval ? 1:0; + r_r->uni_val = *buf; - r_r->ptr_len = 1; - r_r->buf_len = r_r->uni_val->buf_len; + r_r->ptr_max_len = 1; + r_r->buf_max_len = r_r->uni_val.buf_max_len; - r_r->status = status; + r_r->ptr_len = 1; + r_r->buf_len = r_r->uni_val.buf_len; - return True; - + r_r->status = status; + + return True; } /******************************************************************* @@ -1081,7 +1263,7 @@ BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) return False; if(r_r->ptr_uni_val != 0) { - if(!smb_io_buffer2("uni_val", r_r->uni_val, r_r->ptr_uni_val, ps, depth)) + if(!smb_io_buffer2("uni_val", &r_r->uni_val, r_r->ptr_uni_val, ps, depth)) return False; } @@ -1138,6 +1320,46 @@ void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol, q_i->len_value2 = 0; } +/******************************************************************* +makes a structure. +********************************************************************/ + +void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) +{ + uint32 real_size; + + DEBUG(8,("init_reg_r_enum_val: Enter\n")); + + ZERO_STRUCTP(r_u); + + /* value name */ + + DEBUG(10,("init_reg_r_enum_val: Valuename => [%s]\n", val->valuename)); + + init_uni_hdr( &r_u->hdr_name, strlen(val->valuename)+1 ); + init_unistr2( &r_u->uni_name, val->valuename, strlen(val->valuename)+1 ); + + /* type */ + + r_u->ptr_type = 1; + r_u->type = val->type; + + /* REG_SZ & REG_MULTI_SZ must be converted to UNICODE */ + + r_u->ptr_value = 1; + real_size = reg_init_buffer2( &r_u->buf_value, val ); + + /* lengths */ + + r_u->ptr1 = 1; + r_u->len_value1 = real_size; + + r_u->ptr2 = 1; + r_u->len_value2 = real_size; + + DEBUG(8,("init_reg_r_enum_val: Exit\n")); +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -1158,6 +1380,7 @@ BOOL reg_io_q_enum_val(char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int d if(!prs_uint32("val_index", ps, depth, &q_q->val_index)) return False; + if(!smb_io_unihdr ("hdr_name", &q_q->hdr_name, ps, depth)) return False; if(!smb_io_unistr2("uni_name", &q_q->uni_name, q_q->hdr_name.buffer, ps, depth)) @@ -1228,7 +1451,7 @@ BOOL reg_io_r_enum_val(char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, int d if(!prs_uint32("ptr_value", ps, depth, &r_q->ptr_value)) return False; - if(!smb_io_buffer2("buf_value", r_q->buf_value, r_q->ptr_value, ps, depth)) + if(!smb_io_buffer2("buf_value", &r_q->buf_value, r_q->ptr_value, ps, depth)) return False; if(!prs_align(ps)) return False; @@ -1531,7 +1754,7 @@ BOOL reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int if(!prs_uint32("unknown_0 ", ps, depth, &r_q->unknown_0)) return False; - if(!prs_uint32("asccess_desired ", ps, depth, &r_q->access_desired)) + if(!prs_uint32("access_desired ", ps, depth, &r_q->access_desired)) return False; return True; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index c16232204c..1137993bb6 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5,8 +5,10 @@ * 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 Franois Micouleau 1998-2001. + * Copyright (C) Jeremy Allison 2001, + * Copyright (C) Jean Franois Micouleau 1998-2001, + * Copyright (C) Anthony Liguori 2002, + * Copyright (C) Jim McDonough 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 @@ -5067,7 +5069,7 @@ BOOL samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER * r_u, if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth)) return False; - if(!prs_uint32("unknown_0", ps, depth, &r_u->unknown_0)) + 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; @@ -5945,7 +5947,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * 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_dirdrive(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); @@ -6716,6 +6718,84 @@ BOOL samr_io_r_connect(char *desc, SAMR_R_CONNECT * r_u, return True; } +/******************************************************************* +inits a SAMR_Q_CONNECT4 structure. +********************************************************************/ + +void init_samr_q_connect4(SAMR_Q_CONNECT4 * q_u, + char *srv_name, uint32 access_mask) +{ + int len_srv_name = strlen(srv_name); + + DEBUG(5, ("init_samr_q_connect\n")); + + /* make PDC server name \\server */ + q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0; + init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1); + + /* 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(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(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_CONNECT_ANON structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b10a5c4377..3a7f4b57ae 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -322,7 +322,7 @@ reads or writes an NOTIFY INFO DATA structure. static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) { - uint32 useless_ptr=0xADDE0FF0; + uint32 useless_ptr=0x0FF0ADDE; prs_debug(ps, depth, desc, "smb_io_notify_info_data"); depth++; @@ -378,6 +378,14 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs break; + case NOTIFY_SECDESC: + if( !prs_uint32( "sd size", ps, depth, &data->notify_data.sd.size ) ) + return False; + if( !prs_uint32( "pointer", ps, depth, &useless_ptr ) ) + return False; + + break; + default: DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data\n", data->enc_type)); @@ -451,6 +459,13 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, break; + case NOTIFY_SECDESC: + if( !prs_uint32("secdesc size ", ps, depth, &data->notify_data.sd.size ) ) + return False; + if ( !sec_io_desc( "sec_desc", &data->notify_data.sd.desc, ps, depth ) ) + return False; + break; + default: DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data_strings\n", data->enc_type)); @@ -675,9 +690,11 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo Let the size determine that */ switch (devmode->specversion) { + /* list of observed spec version's */ case 0x0320: case 0x0400: case 0x0401: + case 0x040d: break; default: @@ -5183,7 +5200,7 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) *ar = NULL; while (src < ((char *)buf5->buffer) + buf5->buf_len*2) { - rpcstr_pull(f, src, sizeof(f)-1, -1, 0); + rpcstr_pull(f, src, sizeof(f)-1, -1, STR_TERMINATE); src = skip_unibuf(src, 2*buf5->buf_len - PTR_DIFF(src,buf5->buffer)); tar = (fstring *)Realloc(*ar, sizeof(fstring)*(n+2)); if (!tar) @@ -6169,42 +6186,6 @@ BOOL spoolss_io_r_resetprinter(char *desc, SPOOL_R_RESETPRINTER *r_u, prs_struct return True; } -/******************************************************************* -********************************************************************/ -BOOL convert_specific_param(NT_PRINTER_PARAM **param, const UNISTR2 *value, - uint32 type, const uint8 *data, uint32 len) -{ - DEBUG(5,("converting a specific param struct\n")); - - if (*param == NULL) - { - *param=(NT_PRINTER_PARAM *)malloc(sizeof(NT_PRINTER_PARAM)); - if(*param == NULL) - return False; - memset((char *)*param, '\0', sizeof(NT_PRINTER_PARAM)); - DEBUGADD(6,("Allocated a new PARAM struct\n")); - } - unistr2_to_ascii((*param)->value, value, sizeof((*param)->value)-1); - (*param)->type = type; - - /* le champ data n'est pas NULL termine */ - /* on stocke donc la longueur */ - - (*param)->data_len=len; - - if (len) { - (*param)->data=(uint8 *)malloc(len * sizeof(uint8)); - if((*param)->data == NULL) - return False; - memcpy((*param)->data, data, len); - } - - DEBUGADD(6,("\tvalue:[%s], len:[%d]\n",(*param)->value, (*param)->data_len)); - dump_data(10, (char *)(*param)->data, (*param)->data_len); - - return True; -} - /******************************************************************* ********************************************************************/ @@ -6750,7 +6731,7 @@ BOOL make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd, q_u->unknown0=0x0; q_u->unknown1=0x0; - q_u->info_ptr=0xaddee11e; + q_u->info_ptr=0x0FF0ADDE; q_u->info.version=2; @@ -7528,3 +7509,31 @@ BOOL make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA *q_u, return True; } + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle, + uint32 flags, uint32 options, char *localmachine, + uint32 printerlocal, SPOOL_NOTIFY_OPTION *option) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + + q_u->flags = flags; + q_u->options = options; + + q_u->localmachine_ptr = 1; + + init_unistr2(&q_u->localmachine, localmachine, + strlen(localmachine) + 1); + + q_u->printerlocal = printerlocal; + + if (option) + q_u->option_ptr = 1; + + q_u->option = option; + + return True; +} diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 3dc054d2b1..531267c308 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -3,9 +3,10 @@ * 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) Jeremy Allison 1999. - * Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2002 + * Copyright (C) Paul Ashton 1997, + * Copyright (C) Jeremy Allison 1999, + * Copyright (C) Nigel Williams 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 @@ -27,6 +28,71 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE +/******************************************************************* + Inits a SH_INFO_0_STR structure +********************************************************************/ + +void init_srv_share_info0_str(SH_INFO_0_STR *sh0, char *net_name) +{ + DEBUG(5,("init_srv_share_info0_str\n")); + + if(net_name) + init_unistr2(&sh0->uni_netname, net_name, strlen(net_name)+1); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info0_str(char *desc, SH_INFO_0_STR *sh0, prs_struct *ps, int depth) +{ + if (sh0 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info0_str"); + depth++; + + if(!prs_align(ps)) + return False; + if(sh0->ptrs->ptr_netname) + if(!smb_io_unistr2("", &sh0->uni_netname, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + makes a SH_INFO_0 structure +********************************************************************/ + +void init_srv_share_info0(SH_INFO_0 *sh0, char *net_name) +{ + DEBUG(5,("init_srv_share_info0: %s\n", net_name)); + + sh0->ptr_netname = (net_name != NULL) ? 1 : 0; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info0(char *desc, SH_INFO_0 *sh0, prs_struct *ps, int depth) +{ + if (sh0 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info0"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_netname", ps, depth, &sh0->ptr_netname)) + return False; + + return True; +} + /******************************************************************* Inits a SH_INFO_1_STR structure ********************************************************************/ @@ -35,8 +101,10 @@ void init_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark) { DEBUG(5,("init_srv_share_info1_str\n")); - init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1); - init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1); + if(net_name) + init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1); + if(remark) + init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1); } /******************************************************************* @@ -47,20 +115,24 @@ static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *p { if (sh1 == NULL) return False; - + prs_debug(ps, depth, desc, "srv_io_share_info1_str"); depth++; - + if(!prs_align(ps)) return False; - if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth)) - return False; + if(sh1->ptrs->ptr_netname) + if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth)) + return False; + if(!prs_align(ps)) return False; - if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth)) - return False; - + + if(sh1->ptrs->ptr_remark) + if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth)) + return False; + return True; } @@ -71,7 +143,7 @@ static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *p void init_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark) { DEBUG(5,("init_srv_share_info1: %s %8x %s\n", net_name, type, remark)); - + sh1->ptr_netname = (net_name != NULL) ? 1 : 0; sh1->type = type; sh1->ptr_remark = (remark != NULL) ? 1 : 0; @@ -139,6 +211,7 @@ static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2 if(!prs_align(ps)) return False; + if (sh->ptr_netname) if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth)) return False; @@ -175,7 +248,6 @@ void init_srv_share_info2(SH_INFO_2 *sh2, sh2->perms = perms; sh2->max_uses = max_uses; sh2->num_uses = num_uses; - sh2->type = type; sh2->ptr_path = (path != NULL) ? 1 : 0; sh2->ptr_passwd = (passwd != NULL) ? 1 : 0; } @@ -215,6 +287,21 @@ static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int d return True; } +/******************************************************************* + Inits a SH_INFO_501_STR structure +********************************************************************/ + +void init_srv_share_info501_str(SH_INFO_501_STR *sh501, + char *net_name, char *remark) +{ + DEBUG(5,("init_srv_share_info501_str\n")); + + if(net_name) + init_unistr2(&sh501->uni_netname, net_name, strlen(net_name)+1); + if(remark) + init_unistr2(&sh501->uni_remark, remark, strlen(remark)+1); +} + /******************************************************************* Inits a SH_INFO_2 structure *******************************************************************/ @@ -259,18 +346,6 @@ static BOOL srv_io_share_info501(char *desc, SH_INFO_501 *sh501, prs_struct *ps, return True; } -/******************************************************************** - Inits a SH_INFO_501_STR structure -********************************************************************/ - -void init_srv_share_info501_str(SH_INFO_501_STR *sh501, char *net_name, char *remark) -{ - DEBUG(5,("init_srv_share_info501_str\n")); - - init_unistr2(&sh501->uni_netname, net_name, strlen(net_name)+1); - init_unistr2(&sh501->uni_remark, remark, strlen(remark)+1); -} - /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -301,7 +376,7 @@ static BOOL srv_io_share_info501_str(char *desc, SH_INFO_501_STR *sh501, prs_str ********************************************************************/ void init_srv_share_info502(SH_INFO_502 *sh502, - char *net_name, uint32 type, char *remark, + const char *net_name, uint32 type, char *remark, uint32 perms, uint32 max_uses, uint32 num_uses, char *path, char *passwd, SEC_DESC *psd, size_t sd_size) { @@ -315,9 +390,9 @@ void init_srv_share_info502(SH_INFO_502 *sh502, sh502->perms = perms; sh502->max_uses = max_uses; sh502->num_uses = num_uses; - sh502->type = type; sh502->ptr_path = (path != NULL) ? 1 : 0; sh502->ptr_passwd = (passwd != NULL) ? 1 : 0; + sh502->reserved = 0; /* actual size within rpc */ sh502->sd_size = (uint32)sd_size; sh502->ptr_sd = (psd != NULL) ? 1 : 0; } @@ -353,7 +428,7 @@ static BOOL srv_io_share_info502(char *desc, SH_INFO_502 *sh502, prs_struct *ps, return False; if(!prs_uint32("ptr_passwd ", ps, depth, &sh502->ptr_passwd)) return False; - if(!prs_uint32("sd_size ", ps, depth, &sh502->sd_size)) + if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &sh502->reserved_offset)) return False; if(!prs_uint32("ptr_sd ", ps, depth, &sh502->ptr_sd)) return False; @@ -366,26 +441,22 @@ static BOOL srv_io_share_info502(char *desc, SH_INFO_502 *sh502, prs_struct *ps, ********************************************************************/ void init_srv_share_info502_str(SH_INFO_502_STR *sh502str, - SH_INFO_502 *ptrs, char *net_name, char *remark, char *path, char *passwd, SEC_DESC *psd, size_t sd_size) { DEBUG(5,("init_srv_share_info502_str\n")); - sh502str->ptrs = ptrs; - - if(sh502str->ptrs->ptr_netname) + if(net_name) init_unistr2(&sh502str->uni_netname, net_name, strlen(net_name)+1); - if(sh502str->ptrs->ptr_remark) + if(remark) init_unistr2(&sh502str->uni_remark, remark, strlen(remark)+1); - if(sh502str->ptrs->ptr_path) + if(path) init_unistr2(&sh502str->uni_path, path, strlen(path)+1); - if(sh502str->ptrs->ptr_passwd) + if(passwd) init_unistr2(&sh502str->uni_passwd, passwd, strlen(passwd)+1); - if(sh502str->ptrs->ptr_sd) { sh502str->sd = psd; + sh502str->reserved = 0; sh502str->sd_size = sd_size; - } } /******************************************************************* @@ -436,21 +507,112 @@ static BOOL srv_io_share_info502_str(char *desc, SH_INFO_502_STR *sh502, prs_str return False; if(sh502->ptrs->ptr_sd) { - if(!prs_uint32("sd_size ", ps, depth, &sh502->sd_size)) + uint32 old_offset; + uint32 reserved_offset; + + if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &reserved_offset)) return False; + + old_offset = prs_offset(ps); + if (!sec_io_desc(desc, &sh502->sd, ps, depth)) return False; + + if(UNMARSHALLING(ps)) { + + sh502->ptrs->sd_size = sh502->sd_size = sec_desc_size(sh502->sd); + + prs_set_offset(ps, old_offset + sh502->reserved); + } + + prs_align(ps); + + if(MARSHALLING(ps)) { + + sh502->ptrs->reserved = sh502->reserved = prs_offset(ps) - old_offset; + } + + if(!prs_uint32_post("reserved ", ps, depth, + &sh502->reserved, reserved_offset, sh502->reserved)) + return False; + if(!prs_uint32_post("reserved ", ps, depth, + &sh502->ptrs->reserved, sh502->ptrs->reserved_offset, sh502->ptrs->reserved)) + return False; } return True; } +/******************************************************************* + Inits a SH_INFO_1004_STR structure +********************************************************************/ + +void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, char *remark) +{ + DEBUG(5,("init_srv_share_info1004_str\n")); + + if(remark) + init_unistr2(&sh1004->uni_remark, remark, strlen(remark)+1); +} + /******************************************************************* Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005, - prs_struct* ps, int depth) +static BOOL srv_io_share_info1004_str(char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth) +{ + if (sh1004 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1004_str"); + depth++; + + if(!prs_align(ps)) + return False; + if(sh1004->ptrs->ptr_remark) + if(!smb_io_unistr2("", &sh1004->uni_remark, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + makes a SH_INFO_1004 structure +********************************************************************/ + +void init_srv_share_info1004(SH_INFO_1004 *sh1004, char *remark) +{ + DEBUG(5,("init_srv_share_info1004: %s\n", remark)); + + sh1004->ptr_remark = (remark != NULL) ? 1 : 0; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1004(char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth) +{ + if (sh1004 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1004"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_remark", ps, depth, &sh1004->ptr_remark)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth) { if(sh1005 == NULL) return False; @@ -471,6 +633,95 @@ static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005, Reads or writes a structure. ********************************************************************/ +static BOOL srv_io_share_info1006(char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth) +{ + if(sh1006 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1006"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("max uses ", ps, depth, &sh1006->max_uses)) + return False; + + return True; +} + +/******************************************************************* + Inits a SH_INFO_1007_STR structure +********************************************************************/ + +void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate_directory_name) +{ + DEBUG(5,("init_srv_share_info1007_str\n")); + + if(alternate_directory_name) + init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, strlen(alternate_directory_name)+1); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1007_str(char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth) +{ + if (sh1007 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1007_str"); + depth++; + + if(!prs_align(ps)) + return False; + if(sh1007->ptrs->ptr_AlternateDirectoryName) + if(!smb_io_unistr2("", &sh1007->uni_AlternateDirectoryName, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + makes a SH_INFO_1007 structure +********************************************************************/ + +void init_srv_share_info1007(SH_INFO_1007 *sh1007, uint32 flags, const char *alternate_directory_name) +{ + DEBUG(5,("init_srv_share_info1007: %s\n", alternate_directory_name)); + + sh1007->flags = flags; + sh1007->ptr_AlternateDirectoryName = (alternate_directory_name != NULL) ? 1 : 0; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1007(char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth) +{ + if (sh1007 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1007"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("flags ", ps, depth, &sh1007->flags)) + return False; + if(!prs_uint32("ptr_Alter..", ps, depth, &sh1007->ptr_AlternateDirectoryName)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + static BOOL srv_io_share_info1501(char* desc, SRV_SHARE_INFO_1501* sh1501, prs_struct* ps, int depth) { @@ -511,9 +762,6 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct if(!prs_uint32("info_level", ps, depth, &ctr->info_level)) return False; - if (ctr->info_level == 0) - return True; - if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) return False; if(!prs_uint32("ptr_share_info", ps, depth, &ctr->ptr_share_info)) @@ -541,6 +789,33 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct return False; switch (ctr->switch_value) { + + case 0: + { + SRV_SHARE_INFO_0 *info0 = ctr->share.info0; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps)) { + if (!(info0 = (SRV_SHARE_INFO_0 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_0)))) + return False; + ctr->share.info0 = info0; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info0("", &info0[i].info_0, ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + info0[i].info_0_str.ptrs = &info0[i].info_0; + if(!srv_io_share_info0_str("", &info0[i].info_0_str, ps, depth)) + return False; + } + + break; + } + case 1: { SRV_SHARE_INFO_1 *info1 = ctr->share.info1; @@ -559,6 +834,7 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct } for (i = 0; i < num_entries; i++) { + info1[i].info_1_str.ptrs = &info1[i].info_1; if(!srv_io_share_info1_str("", &info1[i].info_1_str, ps, depth)) return False; } @@ -632,8 +908,8 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct for (i = 0; i < num_entries; i++) { if(!srv_io_share_info502("", &info502[i].info_502, ps, depth)) return False; - } - + } + for (i = 0; i < num_entries; i++) { info502[i].info_502_str.ptrs = &info502[i].info_502; if(!srv_io_share_info502_str("", &info502[i].info_502_str, ps, depth)) @@ -643,6 +919,118 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct break; } + case 1004: + { + SRV_SHARE_INFO_1004 *info1004 = ctr->share.info1004; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps)) { + if (!(info1004 = (SRV_SHARE_INFO_1004 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1004)))) + return False; + ctr->share.info1004 = info1004; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1004("", &info1004[i].info_1004, ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + info1004[i].info_1004_str.ptrs = &info1004[i].info_1004; + if(!srv_io_share_info1004_str("", &info1004[i].info_1004_str, ps, depth)) + return False; + } + + break; + } + + case 1005: + { + SRV_SHARE_INFO_1005 *info1005 = ctr->share.info1005; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps)) { + if (!(info1005 = (SRV_SHARE_INFO_1005 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1005)))) + return False; + ctr->share.info1005 = info1005; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1005("", &info1005[i], ps, depth)) + return False; + } + + break; + } + + case 1006: + { + SRV_SHARE_INFO_1006 *info1006 = ctr->share.info1006; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps)) { + if (!(info1006 = (SRV_SHARE_INFO_1006 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1006)))) + return False; + ctr->share.info1006 = info1006; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1006("", &info1006[i], ps, depth)) + return False; + } + + break; + } + + case 1007: + { + SRV_SHARE_INFO_1007 *info1007 = ctr->share.info1007; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps)) { + if (!(info1007 = (SRV_SHARE_INFO_1007 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1007)))) + return False; + ctr->share.info1007 = info1007; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1007("", &info1007[i].info_1007, ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + info1007[i].info_1007_str.ptrs = &info1007[i].info_1007; + if(!srv_io_share_info1007_str("", &info1007[i].info_1007_str, ps, depth)) + return False; + } + + break; + } + + case 1501: + { + SRV_SHARE_INFO_1501 *info1501 = ctr->share.info1501; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps)) { + if (!(info1501 = (SRV_SHARE_INFO_1501 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1501)))) + return False; + ctr->share.info1501 = info1501; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1501("", &info1501[i], ps, depth)) + return False; + } + + break; + } + default: DEBUG(5,("%s no share info at switch_value %d\n", tab_depth(depth), ctr->switch_value)); @@ -667,8 +1055,9 @@ void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, q_n->ctr.info_level = q_n->ctr.switch_value = info_level; q_n->ctr.ptr_share_info = 1; - q_n->ctr.num_entries = 0; - q_n->ctr.ptr_entries = 0; + q_n->ctr.num_entries = 0; + q_n->ctr.ptr_entries = 0; + q_n->ctr.num_entries2 = 0; q_n->preferred_len = preferred_len; memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); @@ -729,14 +1118,37 @@ BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct * if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) return False; - if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) - return False; + + if(r_n->total_entries != 0) { + if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) + return False; + } + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; } +/******************************************************************* + initialises a structure. +********************************************************************/ + +BOOL init_srv_q_net_share_get_info(SRV_Q_NET_SHARE_GET_INFO *q_n, const char *srv_name, const char *share_name, uint32 info_level) +{ + + uint32 ptr_share_name; + + DEBUG(5,("init_srv_q_net_share_get_info\n")); + + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); + init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name); + + q_n->info_level = info_level; + + return True; +} + /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -792,10 +1204,24 @@ static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHA if (r_n->ptr_share_ctr != 0) { switch (r_n->switch_value) { + case 0: + if(!srv_io_share_info0("", &r_n->share.info0.info_0, ps, depth)) + return False; + + /* allow access to pointers in the str part. */ + r_n->share.info0.info_0_str.ptrs = &r_n->share.info0.info_0; + + if(!srv_io_share_info0_str("", &r_n->share.info0.info_0_str, ps, depth)) + return False; + + break; case 1: if(!srv_io_share_info1("", &r_n->share.info1.info_1, ps, depth)) return False; + /* allow access to pointers in the str part. */ + r_n->share.info1.info_1_str.ptrs = &r_n->share.info1.info_1; + if(!srv_io_share_info1_str("", &r_n->share.info1.info_1_str, ps, depth)) return False; @@ -819,16 +1245,40 @@ static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHA if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth)) return False; - /*allow access to pointers in the str part. */ + /* allow access to pointers in the str part. */ r_n->share.info502.info_502_str.ptrs = &r_n->share.info502.info_502; if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth)) return False; break; + case 1004: + if(!srv_io_share_info1004("", &r_n->share.info1004.info_1004, ps, depth)) + return False; + + /* allow access to pointers in the str part. */ + r_n->share.info1004.info_1004_str.ptrs = &r_n->share.info1004.info_1004; + + if(!srv_io_share_info1004_str("", &r_n->share.info1004.info_1004_str, ps, depth)) + return False; + break; case 1005: if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth)) return False; break; + case 1006: + if(!srv_io_share_info1006("", &r_n->share.info1006, ps, depth)) + return False; + break; + case 1007: + if(!srv_io_share_info1007("", &r_n->share.info1007.info_1007, ps, depth)) + return False; + + /* allow access to pointers in the str part. */ + r_n->share.info1007.info_1007_str.ptrs = &r_n->share.info1007.info_1007; + + if(!srv_io_share_info1007_str("", &r_n->share.info1007.info_1007_str, ps, depth)) + return False; + break; case 1501: if (!srv_io_share_info1501("", &r_n->share.info1501, ps, depth)) return False; @@ -869,6 +1319,34 @@ BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_ return True; } +/******************************************************************* + intialises a structure. +********************************************************************/ + +BOOL init_srv_q_net_share_set_info(SRV_Q_NET_SHARE_SET_INFO *q_n, + const char *srv_name, + const char *share_name, + uint32 info_level, + const SRV_SHARE_INFO *info) +{ + + uint32 ptr_share_name; + + DEBUG(5,("init_srv_q_net_share_set_info\n")); + + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); + init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name); + + q_n->info_level = info_level; + + q_n->info = *info; + + q_n->ptr_parm_error = 1; + q_n->parm_error = 0; + + return True; +} + /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -904,6 +1382,15 @@ BOOL srv_io_q_net_share_set_info(char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_ if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info)) return False; + if(!prs_align(ps)) + return False; + if(!prs_uint32("ptr_parm_error", ps, depth, &q_n->ptr_parm_error)) + return False; + if(q_n->ptr_parm_error!=0) { + if(!prs_uint32("parm_error", ps, depth, &q_n->parm_error)) + return False; + } + return True; } @@ -911,9 +1398,9 @@ BOOL srv_io_q_net_share_set_info(char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_ Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth) { - if (q_n == NULL) + if (r_n == NULL) return False; prs_debug(ps, depth, desc, "srv_io_r_net_share_set_info"); @@ -922,14 +1409,22 @@ BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *q_n, prs_ if(!prs_align(ps)) return False; - if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) + if(!prs_uint32("ptr_parm_error ", ps, depth, &r_n->ptr_parm_error)) return False; - if(!prs_werror("status", ps, depth, &q_n->status)) + + if(r_n->ptr_parm_error) { + + if(!prs_uint32("parm_error ", ps, depth, &r_n->parm_error)) + return False; + } + + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; } + /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -962,6 +1457,9 @@ BOOL srv_io_q_net_share_add(char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info)) return False; + if(!prs_align(ps)) + return False; + if(!prs_uint32("ptr_err_index", ps, depth, &q_n->ptr_err_index)) return False; if (q_n->ptr_err_index) @@ -994,9 +1492,9 @@ void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, char *srvname, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth) { - if (q_n == NULL) + if (r_n == NULL) return False; prs_debug(ps, depth, desc, "srv_io_r_net_share_add"); @@ -1005,14 +1503,25 @@ BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps if(!prs_align(ps)) return False; - if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) + if(!prs_uint32("ptr_parm_error", ps, depth, &r_n->ptr_parm_error)) return False; - if(!prs_werror("status", ps, depth, &q_n->status)) + + if(r_n->ptr_parm_error) { + + if(!prs_uint32("parm_error", ps, depth, &r_n->parm_error)) + return False; + } + + if(!prs_werror("status", ps, depth, &r_n->status)) return False; return True; } +/******************************************************************* + initialises a structure. +********************************************************************/ + void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname, const char *sharename) { @@ -1889,8 +2398,8 @@ static BOOL srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct * ********************************************************************/ void init_srv_file_info3(FILE_INFO_3 *fl3, - uint32 id, uint32 perms, uint32 num_locks, - char *path_name, char *user_name) + uint32 id, uint32 perms, uint32 num_locks, + char *path_name, char *user_name) { DEBUG(5,("init_srv_file_info3: %s %s\n", path_name, user_name)); @@ -2004,7 +2513,8 @@ static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct * ********************************************************************/ void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, - char *srv_name, char *qual_name, char *user_name, + const char *srv_name, const char *qual_name, + const char *user_name, uint32 file_level, SRV_FILE_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) @@ -2295,7 +2805,7 @@ void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name, sv102->disc = disc; sv102->hidden = hidden; sv102->announce = announce; - sv102->ann_delta =ann_delta; + sv102->ann_delta = ann_delta; sv102->licenses = licenses; init_buf_unistr2(&sv102->uni_usr_path, &sv102->ptr_usr_path, usr_path); } @@ -2559,7 +3069,7 @@ BOOL srv_io_r_net_srv_set_info(char *desc, SRV_R_NET_SRV_SET_INFO *r_n, if(!prs_align(ps)) return False; - if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value)) + if(!prs_uint32("switch value ", ps, depth, &r_n->switch_value)) return False; if(!prs_werror("status", ps, depth, &r_n->status)) @@ -2687,6 +3197,31 @@ BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct * return True; } +/******************************************************************* + initialises a structure. + ********************************************************************/ + +BOOL init_srv_q_net_disk_enum(SRV_Q_NET_DISK_ENUM *q_n, + const char *srv_name, + uint32 preferred_len, + ENUM_HND *enum_hnd + ) +{ + + + DEBUG(5,("init_srv_q_net_srv_disk_enum\n")); + + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); + + q_n->disk_enum_ctr.level = 0; + q_n->disk_enum_ctr.disk_info_ptr = 0; + + q_n->preferred_len = preferred_len; + memcpy(&q_n->enum_hnd, enum_hnd, sizeof(*enum_hnd)); + + return True; +} + /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -2737,7 +3272,9 @@ BOOL srv_io_q_net_disk_enum(char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps BOOL srv_io_r_net_disk_enum(char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth) { + int i; + uint32 entries_read, entries_read2, entries_read3; if (r_n == NULL) return False; @@ -2745,23 +3282,36 @@ BOOL srv_io_r_net_disk_enum(char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps prs_debug(ps, depth, desc, "srv_io_r_net_disk_enum"); depth++; + entries_read = entries_read2 = entries_read3 = r_n->disk_enum_ctr.entries_read; + if(!prs_align(ps)) return False; - if(!prs_uint32("entries_read", ps, depth, &r_n->disk_enum_ctr.entries_read)) + if(!prs_uint32("entries_read", ps, depth, &entries_read)) return False; if(!prs_uint32("ptr_disk_info", ps, depth, &r_n->disk_enum_ctr.disk_info_ptr)) return False; /*this may be max, unknown, actual?*/ - if(!prs_uint32("max_elements", ps, depth, &r_n->disk_enum_ctr.entries_read)) + if(!prs_uint32("max_elements", ps, depth, &entries_read2)) return False; if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.unknown)) return False; - if(!prs_uint32("actual_elements", ps, depth, &r_n->disk_enum_ctr.entries_read)) + if(!prs_uint32("actual_elements", ps, depth, &entries_read3)) return False; + r_n->disk_enum_ctr.entries_read = entries_read3; + + if(UNMARSHALLING(ps)) { + + DISK_INFO *dinfo; + + if(!(dinfo = (DISK_INFO *)prs_alloc_mem(ps, sizeof(*dinfo) * entries_read3))) + return False; + r_n->disk_enum_ctr.disk_info = dinfo; + } + for(i=0; i < r_n->disk_enum_ctr.entries_read; i++) { if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.disk_info[i].unknown)) @@ -2786,6 +3336,25 @@ BOOL srv_io_r_net_disk_enum(char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps return True; } +/******************************************************************* + initialises a structure. + ********************************************************************/ + +BOOL init_srv_q_net_name_validate(SRV_Q_NET_NAME_VALIDATE *q_n, const char *srv_name, const char *share_name, int type) +{ + uint32 ptr_share_name; + + DEBUG(5,("init_srv_q_net_name_validate\n")); + + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); + init_buf_unistr2(&q_n->uni_name, &ptr_share_name, share_name); + + q_n->type = type; + q_n->flags = 0; + + return True; +} + /******************************************************************* Reads or writes a structure. ********************************************************************/ -- cgit From 474c1489699cb36e5831e6546aef496404a45752 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Wed, 21 Aug 2002 23:08:28 +0000 Subject: NETLOGON NetServerAuthenticate3 include and parser file J.F. (This used to be commit 2f68d6f5ec925f07a387f784db6de0cfbaa53278) --- source3/rpc_parse/parse_net.c | 81 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index da49a6531d..7f8d1953d1 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -4,7 +4,8 @@ * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997. - * + * Copyright (C) Jean Franois 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 2 of the License, or @@ -740,6 +741,84 @@ BOOL net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth) 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, + 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(char *desc, NET_Q_AUTH_3 *q_a, prs_struct *ps, int depth) +{ + int old_align; + 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; + /* client challenge is _not_ aligned */ + old_align = ps->align; + ps->align = 0; + if(!smb_io_chal("", &q_a->clnt_chal, ps, depth)) { + /* client-calculated credentials */ + ps->align = old_align; + return False; + } + ps->align = old_align; + 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(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. -- cgit From 2a505d023f95457f63a3975e386b95e8658928f4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 22 Aug 2002 22:48:54 +0000 Subject: added a 'net rpc samdump' command for dumping the whole sam via samsync operations (as a BDC) (This used to be commit e4cb106d2e3e6a41529369545a7a6ce5fe6d8986) --- source3/rpc_parse/parse_net.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 7f8d1953d1..52cbc8e8df 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1690,7 +1690,8 @@ 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) + DOM_CRED *ret_creds, uint32 database_id, + uint32 next_rid) { DEBUG(5, ("init_q_sam_sync\n")); @@ -1706,8 +1707,8 @@ BOOL init_net_q_sam_sync(NET_Q_SAM_SYNC * q_s, const char *srv_name, 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 = 0; + q_s->restart_state = 4; + q_s->sync_context = next_rid; q_s->max_size = 0xffff; return True; @@ -2785,6 +2786,8 @@ BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16], if (!prs_uint32("sync_context", ps, depth, &r_s->sync_context)) return False; + d_printf("Got sync context %u\n", r_s->sync_context); + if (!prs_uint32("ptr_deltas", ps, depth, &r_s->ptr_deltas)) return False; if (r_s->ptr_deltas != 0) -- cgit From 266fd83651bb5b2446e136492b82c836a8be095b Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 22 Aug 2002 23:39:26 +0000 Subject: Added some new delta types discovered by Ronnie from ethereal" - SAM_DELTA_RENAME{USER,GROUP,ALIAS} - SAM_DELTA_DELETE{USER,GROUP} Renamed some of the unknown delta types and their unmarshalling functions: - SAM_DELTA_TRUST_DOMS - SAM_DELTA_SECRET_INFO (This used to be commit 1f29276c2ff450c4ca3705c27fb0be71ddcda4ad) --- source3/rpc_parse/parse_net.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 52cbc8e8df..ecab979ff2 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1779,7 +1779,7 @@ static BOOL net_io_sam_delta_hdr(char *desc, SAM_DELTA_HDR * delta, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_delta_stamp(char *desc, SAM_DELTA_STAMP *info, +static BOOL net_io_sam_delta_mod_count(char *desc, SAM_DELTA_MOD_COUNT *info, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "net_io_sam_delta_stamp"); @@ -2386,12 +2386,12 @@ static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_dom_info(char *desc, SAM_DELTA_DOM *info, +static BOOL net_io_sam_policy_info(char *desc, SAM_DELTA_POLICY *info, prs_struct *ps, int depth) { int i; - prs_debug(ps, depth, desc, "net_io_sam_dom_info"); + prs_debug(ps, depth, desc, "net_io_sam_policy_info"); depth++; if(!prs_align(ps)) @@ -2476,12 +2476,12 @@ static BOOL net_io_sam_dom_info(char *desc, SAM_DELTA_DOM *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_unk0e_info(char *desc, SAM_DELTA_UNK0E *info, +static BOOL net_io_sam_trustdoms_info(char *desc, SAM_DELTA_TRUSTDOMS *info, prs_struct *ps, int depth) { int i; - prs_debug(ps, depth, desc, "net_io_sam_unk0e_info"); + prs_debug(ps, depth, desc, "net_io_sam_trustdoms_info"); depth++; if(!prs_align(ps)) @@ -2524,12 +2524,12 @@ static BOOL net_io_sam_unk0e_info(char *desc, SAM_DELTA_UNK0E *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_unk12_info(char *desc, SAM_DELTA_UNK12 *info, - prs_struct *ps, int depth) +static BOOL net_io_sam_secret_info(char *desc, SAM_DELTA_SECRET *info, + prs_struct *ps, int depth) { int i; - prs_debug(ps, depth, desc, "net_io_sam_unk12_info"); + prs_debug(ps, depth, desc, "net_io_sam_secret_info"); depth++; if(!prs_align(ps)) @@ -2707,8 +2707,8 @@ static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], switch (type) { /* Seen in sam deltas */ - case SAM_DELTA_SAM_STAMP: - if (!net_io_sam_delta_stamp("", &delta->stamp, ps, depth)) + case SAM_DELTA_MODIFIED_COUNT: + if (!net_io_sam_delta_mod_count("", &delta->mod_count, ps, depth)) return False; break; @@ -2737,8 +2737,8 @@ static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], return False; break; - case SAM_DELTA_DOM_INFO: - if (!net_io_sam_dom_info("", &delta->dom_info, ps, depth)) + case SAM_DELTA_POLICY_INFO: + if (!net_io_sam_policy_info("", &delta->policy_info, ps, depth)) return False; break; @@ -2752,16 +2752,23 @@ static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], return False; break; - case SAM_DELTA_UNK0E_INFO: - if (!net_io_sam_unk0e_info("", &delta->unk0e_info, ps, depth)) + case SAM_DELTA_TRUST_DOMS: + if (!net_io_sam_trustdoms_info("", &delta->trustdoms_info, ps, depth)) return False; break; - case SAM_DELTA_UNK12_INFO: - if (!net_io_sam_unk12_info("", &delta->unk12_info, ps, depth)) + case SAM_DELTA_SECRET_INFO: + if (!net_io_sam_secret_info("", &delta->secret_info, ps, depth)) return False; 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; -- cgit From 8462dbb933ec66f5756ee3a76152c32bacf746a4 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Fri, 23 Aug 2002 05:12:06 +0000 Subject: some cleanup while working on the NETLOGON pipe. smb_io_chal() did a prs_align() but a challenge is an array of bytes. and all code calling smb_io_chal() played with the alignment to not align ! I'm confident in my change, but I would *really* like if jeremy could look at that. J.F. (This used to be commit 23501ea971f8cc0799515e0d51ad8619221a31e1) --- source3/rpc_parse/parse_misc.c | 3 --- source3/rpc_parse/parse_net.c | 41 ++++------------------------------------- 2 files changed, 4 insertions(+), 40 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 01d7698173..3dd9c3bc2a 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1255,9 +1255,6 @@ BOOL smb_io_chal(char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "smb_io_chal"); depth++; - - if(!prs_align(ps)) - return False; if(!prs_uint8s (False, "data", ps, depth, chal->data, 8)) return False; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index ecab979ff2..f380862ea7 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -553,8 +553,6 @@ void init_q_req_chal(NET_Q_REQ_CHAL *q_c, BOOL net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int depth) { - int old_align; - if (q_c == NULL) return False; @@ -572,15 +570,8 @@ BOOL net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int dep if(!smb_io_unistr2("", &q_c->uni_logon_clnt, True, ps, depth)) /* logon client unicode string */ return False; - old_align = ps->align; - ps->align = 0; - /* client challenge is _not_ aligned after the unicode strings */ - if(!smb_io_chal("", &q_c->clnt_chal, ps, depth)) { - /* client challenge */ - ps->align = old_align; + if(!smb_io_chal("", &q_c->clnt_chal, ps, depth)) return False; - } - ps->align = old_align; return True; } @@ -616,7 +607,6 @@ BOOL net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int dept BOOL net_io_q_auth(char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth) { - int old_align; if (q_a == NULL) return False; @@ -628,15 +618,8 @@ BOOL net_io_q_auth(char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth) if(!smb_io_log_info ("", &q_a->clnt_id, ps, depth)) /* client identification info */ return False; - /* client challenge is _not_ aligned */ - old_align = ps->align; - ps->align = 0; - if(!smb_io_chal("", &q_a->clnt_chal, ps, depth)) { - /* client-calculated credentials */ - ps->align = old_align; + if(!smb_io_chal("", &q_a->clnt_chal, ps, depth)) return False; - } - ps->align = old_align; return True; } @@ -688,7 +671,6 @@ void init_q_auth_2(NET_Q_AUTH_2 *q_a, BOOL net_io_q_auth_2(char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth) { - int old_align; if (q_a == NULL) return False; @@ -700,15 +682,8 @@ BOOL net_io_q_auth_2(char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth) if(!smb_io_log_info ("", &q_a->clnt_id, ps, depth)) /* client identification info */ return False; - /* client challenge is _not_ aligned */ - old_align = ps->align; - ps->align = 0; - if(!smb_io_chal("", &q_a->clnt_chal, ps, depth)) { - /* client-calculated credentials */ - ps->align = old_align; + if(!smb_io_chal("", &q_a->clnt_chal, ps, depth)) return False; - } - ps->align = old_align; if(!net_io_neg_flags("", &q_a->clnt_flgs, ps, depth)) return False; @@ -764,7 +739,6 @@ void init_q_auth_3(NET_Q_AUTH_3 *q_a, BOOL net_io_q_auth_3(char *desc, NET_Q_AUTH_3 *q_a, prs_struct *ps, int depth) { - int old_align; if (q_a == NULL) return False; @@ -776,15 +750,8 @@ BOOL net_io_q_auth_3(char *desc, NET_Q_AUTH_3 *q_a, prs_struct *ps, int depth) if(!smb_io_log_info ("", &q_a->clnt_id, ps, depth)) /* client identification info */ return False; - /* client challenge is _not_ aligned */ - old_align = ps->align; - ps->align = 0; - if(!smb_io_chal("", &q_a->clnt_chal, ps, depth)) { - /* client-calculated credentials */ - ps->align = old_align; + if(!smb_io_chal("", &q_a->clnt_chal, ps, depth)) return False; - } - ps->align = old_align; if(!net_io_neg_flags("", &q_a->clnt_flgs, ps, depth)) return False; -- cgit From 26e92ae81ca45ec1a950fbfb43c22667c8061183 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 27 Aug 2002 22:36:26 +0000 Subject: fix 2 byte alignment/offset bug that prevented Win2k/XP clients from receiving all the printer data in EnumPrinterDataEx(). (This used to be commit 901769acc3258b6f8f33d36b0d5e3468a30ba1b0) --- source3/rpc_parse/parse_spoolss.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 3a7f4b57ae..b8762b35e2 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3678,7 +3678,7 @@ uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p) /* uint32(offset) + uint32(length) + length) */ size += (size_of_uint32(&p->value_len)*2) + p->value_len; - size += (size_of_uint32(&p->data_len)*2) + p->data_len; + size += (size_of_uint32(&p->data_len)*2) + p->data_len + (p->data_len%2) ; size += size_of_uint32(&p->type); @@ -7086,8 +7086,10 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, if (!prs_uint32("size", ps, depth, &ctr->size)) return False; - /* offset data begins at 20 bytes per structure * size_of_array. - Don't forget the uint32 at the beginning */ + /* + * offset data begins at 20 bytes per structure * size_of_array. + * Don't forget the uint32 at the beginning + * */ current_offset = basic_unit * ctr->size_of_array; @@ -7106,18 +7108,22 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, return False; data_offset = ctr->values[i].value_len + valuename_offset; + if (!prs_uint32("data_offset", ps, depth, &data_offset)) return False; if (!prs_uint32("data_len", ps, depth, &ctr->values[i].data_len)) return False; - current_offset = data_offset + ctr->values[i].data_len - basic_unit; + current_offset = data_offset + ctr->values[i].data_len - basic_unit; + /* account for 2 byte alignment */ + current_offset += (current_offset % 2); } - /* loop #2 for writing the dynamically size objects - while viewing conversations between Win2k -> Win2k, - 4-byte alignment does not seem to matter here --jerry */ + /* + * loop #2 for writing the dynamically size objects; pay + * attention to 2-byte alignment here.... + */ for (i=0; isize_of_array; i++) { @@ -7127,10 +7133,11 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, if (!prs_uint8s(False, "data", ps, depth, ctr->values[i].data, ctr->values[i].data_len)) return False; + + if ( !prs_align_uint16(ps) ) + return False; } - - return True; } -- cgit From 957d9ab384696738fedf4bab9bd49978d3af75e7 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 29 Aug 2002 10:36:05 +0000 Subject: There's more work to be done on samsync. Intermediate commit, now I get all the groups at least. Volker (This used to be commit 23a4f6991e93797afad0043689737a1b20c67f60) --- source3/rpc_parse/parse_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index f380862ea7..149d5a02d9 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1674,7 +1674,7 @@ BOOL init_net_q_sam_sync(NET_Q_SAM_SYNC * q_s, const char *srv_name, memset(&q_s->ret_creds, 0, sizeof(q_s->ret_creds)); q_s->database_id = database_id; - q_s->restart_state = 4; + q_s->restart_state = 0; q_s->sync_context = next_rid; q_s->max_size = 0xffff; -- cgit From 1e8fa8cbb1197808965c627aa288e7db46736e77 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 30 Aug 2002 06:55:27 +0000 Subject: removed a debug line (This used to be commit 5185f495d055cee609872db9e59edbe3220dc5bd) --- source3/rpc_parse/parse_net.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 149d5a02d9..f1d813c3f0 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -2760,8 +2760,6 @@ BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16], if (!prs_uint32("sync_context", ps, depth, &r_s->sync_context)) return False; - d_printf("Got sync context %u\n", r_s->sync_context); - if (!prs_uint32("ptr_deltas", ps, depth, &r_s->ptr_deltas)) return False; if (r_s->ptr_deltas != 0) -- cgit From de3d0310e2622c068d6ae6fb4698752128068924 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 30 Aug 2002 10:47:34 +0000 Subject: merge of phant0m key fix from APP_HEAD (This used to be commit cb13d334a53f27713665570d85607d57eb407f9f) --- source3/rpc_parse/parse_reg.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 365ad2dc70..1387aaf6ea 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -39,6 +39,7 @@ static uint32 reg_init_buffer2( BUFFER2 *buf2, REGISTRY_VALUE *val ) char *string; char *list = NULL; char *list2 = NULL; + int len = 0; if ( !buf2 || !val ) return 0; @@ -48,10 +49,13 @@ static uint32 reg_init_buffer2( BUFFER2 *buf2, REGISTRY_VALUE *val ) switch (val->type ) { case REG_SZ: - string = (char*)val->data_p; + string = (char*)regval_data_p( val ); DEBUG(10,("reg_init_buffer2: REG_SZ string => [%s]\n", string)); - init_unistr2( &unistr, (char*)val->data_p, strlen((char*)val->data_p)+1 ); + if ( string ) + len = strlen(string)+1; + + init_unistr2( &unistr, (char*)val->data_p, len ); init_buffer2( buf2, (char*)unistr.buffer, unistr.uni_str_len*2 ); real_size = unistr.uni_str_len*2; break; -- cgit From 3cbe8922762817d38b6408154994714ca35f3734 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 30 Aug 2002 14:48:33 +0000 Subject: fix up print portion of registry. Merge from APP_HEAD. (This used to be commit ec37633548ed329c05b93499f75883d987b78f1e) --- source3/rpc_parse/parse_reg.c | 74 ++----------------------------------------- 1 file changed, 2 insertions(+), 72 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 1387aaf6ea..f3018cfb37 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -34,83 +34,13 @@ static uint32 reg_init_buffer2( BUFFER2 *buf2, REGISTRY_VALUE *val ) { - UNISTR2 unistr; uint32 real_size = 0; - char *string; - char *list = NULL; - char *list2 = NULL; - int len = 0; if ( !buf2 || !val ) return 0; - real_size = val->size; - - switch (val->type ) - { - case REG_SZ: - string = (char*)regval_data_p( val ); - DEBUG(10,("reg_init_buffer2: REG_SZ string => [%s]\n", string)); - - if ( string ) - len = strlen(string)+1; - - init_unistr2( &unistr, (char*)val->data_p, len ); - init_buffer2( buf2, (char*)unistr.buffer, unistr.uni_str_len*2 ); - real_size = unistr.uni_str_len*2; - break; - - case REG_MULTI_SZ: - string = (char*)val->data_p; - real_size = 0; - while ( string && *string ) - { - DEBUG(10,("reg_init_buffer2: REG_MULTI_SZ string => [%s], size => [%d]\n", string, real_size )); - - init_unistr2( &unistr, string, strlen(string)+1 ); - - list2 = Realloc( list, real_size + unistr.uni_str_len*2 ); - if ( !list2 ) - break; - list = list2; - - memcpy( list+real_size, unistr.buffer, unistr.uni_str_len*2 ); - - real_size += unistr.uni_str_len*2; - - string += strlen(string)+1; - } - - list2 = Realloc( list, real_size + 2 ); - if ( !list2 ) - break; - list = list2; - list[real_size++] = 0x0; - list[real_size++] = 0x0; - - init_buffer2( buf2, (char*)list, real_size ); - - DEBUG(10,("reg_init_buffer2: REG_MULTI_SZ size => [%d]\n", real_size )); - - break; - - case REG_BINARY: - DEBUG(10,("reg_init_buffer2: REG_BINARY size => [%d]\n", val->size )); - - init_buffer2( buf2, val->data_p, val->size ); - break; - - case REG_DWORD: - DEBUG(10,("reg_init_buffer2: REG_DWORD value => [%d]\n", *(uint32*)val->data_p)); - init_buffer2( buf2, val->data_p, val->size ); - break; - - default: - DEBUG(0,("reg_init_buffer2: Unsupported registry data type [%d]\n", val->type)); - break; - } - - SAFE_FREE( list ); + real_size = regval_size(val); + init_buffer2( buf2, (char*)regval_data_p(val), real_size ); return real_size; } -- cgit From 40e9d9a54ef65f6e2f54ce3361108e17c0eb8b8f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 31 Aug 2002 06:38:27 +0000 Subject: Avoid writing unitialised bytes to the wire (and consequent valgrind warnings) by zeroing them out if they don't have meaning. Andrew Bartlett (This used to be commit 52db44b5c01e16923393b0ec9a8d0f530be7bb2d) --- source3/rpc_parse/parse_reg.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index f3018cfb37..2698e82440 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1701,7 +1701,11 @@ BOOL reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int void init_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r, POLICY_HND *pol, NTSTATUS status) { - memcpy(&r_r->pol, pol, sizeof(r_r->pol)); + if (NT_STATUS_IS_OK(status)) { + memcpy(&r_r->pol, pol, sizeof(r_r->pol)); + } else { + ZERO_STRUCT(r_r->pol); + } r_r->status = status; } -- cgit From f76bdfdcaaafc5ad904014257a23726d5d53fd87 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 2 Sep 2002 07:41:12 +0000 Subject: Implemented some more client side spoolss functions: - getprinterdataex(), setprinterdataex(), enumprinterdataex() Pass data type down to setprinterdata() fn instead of hardcoding REG_SZ. Did some trickyness to get enumprinterdataex replies unmarshalled properly. The code seems to have been written to require the number of entries returned before unpacking said entries. Skip to the end of the response and read the number of entries then jump back and process the printer data. (This used to be commit 6a1953f2431cc848abf210bdecd7080738991296) --- source3/rpc_parse/parse_spoolss.c | 103 +++++++++++++++++++++++++++++++++++--- 1 file changed, 96 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b8762b35e2..db3ea5046a 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1211,6 +1211,26 @@ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, return True; } +/******************************************************************* + * make a structure. + ********************************************************************/ + +BOOL make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX *q_u, + const POLICY_HND *handle, + char *keyname, char *valuename, uint32 size) +{ + if (q_u == NULL) return False; + + DEBUG(5,("make_spoolss_q_getprinterdataex\n")); + + q_u->handle = *handle; + init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); + init_unistr2(&q_u->keyname, keyname, strlen(keyname) + 1); + q_u->size = size; + + return True; +} + /******************************************************************* * read a structure. * called from spoolss_q_getprinterdata (srv_spoolss.c) @@ -1344,7 +1364,7 @@ BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_st if (UNMARSHALLING(ps) && r_u->size) { r_u->data = prs_alloc_mem(ps, r_u->size); - if(r_u->data) + if(!r_u->data) return False; } @@ -6065,13 +6085,27 @@ BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, return True; } +/******************************************************************* +********************************************************************/ + +BOOL make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u, + const POLICY_HND *hnd, char *key, + uint32 size) +{ + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + init_unistr2(&q_u->key, key, strlen(key)+1); + q_u->size = size; + + return True; +} + /******************************************************************* ********************************************************************/ BOOL make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND *hnd, - char* value, char* data, uint32 data_size) + char* value, uint32 data_type, char* data, uint32 data_size) { memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - q_u->type = REG_SZ; + q_u->type = data_type; init_unistr2(&q_u->value, value, strlen(value)+1); q_u->max_len = q_u->real_len = data_size; @@ -6079,6 +6113,24 @@ BOOL make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND return True; } + +/******************************************************************* +********************************************************************/ +BOOL make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX *q_u, const POLICY_HND *hnd, + char *key, char* value, uint32 data_type, char* data, + uint32 data_size) +{ + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + q_u->type = data_type; + init_unistr2(&q_u->value, value, strlen(value)+1); + init_unistr2(&q_u->key, key, strlen(key)+1); + + q_u->max_len = q_u->real_len = data_size; + q_u->data = data; + + return True; +} + /******************************************************************* ********************************************************************/ @@ -6863,6 +6915,12 @@ BOOL spoolss_io_r_getprinterdataex(char *desc, SPOOL_R_GETPRINTERDATAEX *r_u, pr if (!prs_uint32("size", ps, depth, &r_u->size)) return False; + if (UNMARSHALLING(ps) && r_u->size) { + r_u->data = prs_alloc_mem(ps, r_u->size); + if(!r_u->data) + return False; + } + if (!prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size)) return False; @@ -7083,9 +7141,6 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, prs_debug(ps, depth, desc, "spoolss_io_printer_enum_values_ctr"); depth++; - if (!prs_uint32("size", ps, depth, &ctr->size)) - return False; - /* * offset data begins at 20 bytes per structure * size_of_array. * Don't forget the uint32 at the beginning @@ -7095,6 +7150,13 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, /* first loop to write basic enum_value information */ + if (UNMARSHALLING(ps)) { + ctr->values = (PRINTER_ENUM_VALUES *)prs_alloc_mem( + ps, ctr->size_of_array * sizeof(PRINTER_ENUM_VALUES)); + if (!ctr->values) + return False; + } + for (i=0; isize_of_array; i++) { valuename_offset = current_offset; @@ -7131,6 +7193,13 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, if (!prs_unistr("valuename", ps, depth, &ctr->values[i].valuename)) return False; + if (UNMARSHALLING(ps)) { + ctr->values[i].data = (uint8 *)prs_alloc_mem( + ps, ctr->values[i].data_len); + if (!ctr->values[i].data) + return False; + } + if (!prs_uint8s(False, "data", ps, depth, ctr->values[i].data, ctr->values[i].data_len)) return False; @@ -7148,15 +7217,21 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, BOOL spoolss_io_r_enumprinterdataex(char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, prs_struct *ps, int depth) { + int data_offset, end_offset; prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdataex"); depth++; if(!prs_align(ps)) return False; - if (!spoolss_io_printer_enum_values_ctr("", ps, &r_u->ctr, depth )) + if (!prs_uint32("size", ps, depth, &r_u->ctr.size)) return False; + data_offset = prs_offset(ps); + + if (!prs_set_offset(ps, data_offset + r_u->ctr.size)) + return False; + if(!prs_align(ps)) return False; @@ -7169,6 +7244,20 @@ BOOL spoolss_io_r_enumprinterdataex(char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, if(!prs_werror("status", ps, depth, &r_u->status)) return False; + r_u->ctr.size_of_array = r_u->returned; + + end_offset = prs_offset(ps); + + if (!prs_set_offset(ps, data_offset)) + return False; + + if (r_u->ctr.size) + if (!spoolss_io_printer_enum_values_ctr("", ps, &r_u->ctr, depth )) + return False; + + if (!prs_set_offset(ps, end_offset)) + return False; + return True; } -- cgit From 386a41695001ff56c7ef1f6f25d94555fb58aed0 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 3 Sep 2002 03:21:53 +0000 Subject: Implemented client function for deleteprinterdataex. (This used to be commit 6d792c683df3a4f97e1a04a57bf4890aab35aecd) --- source3/rpc_parse/parse_spoolss.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index db3ea5046a..29902d395e 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7606,6 +7606,21 @@ BOOL make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA *q_u, return True; } +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX *q_u, + POLICY_HND *handle, char *key, + char *value) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + init_unistr2(&q_u->valuename, value, strlen(value) + 1); + init_unistr2(&q_u->keyname, key, strlen(key) + 1); + + return True; +} + /******************************************************************* * init a structure. ********************************************************************/ -- cgit From 45f9cbe03374e8addeed0720a9d7dad8f6fb9f68 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 4 Sep 2002 04:30:41 +0000 Subject: Fix typo in comment. (This used to be commit 47b8ec632e20aa86c34f6a0a82d886fcc76f3000) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 29902d395e..55c387cdc5 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -659,7 +659,7 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo { "panningheight", NULL } }; - /* assign at run time to keep non-gcc vompilers happy */ + /* assign at run time to keep non-gcc compilers happy */ opt_fields[0].field = &devmode->icmmethod; opt_fields[1].field = &devmode->icmintent; -- cgit From 7b9439363ed4ca85677e7ca4e84ac67f71182842 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 5 Sep 2002 04:25:21 +0000 Subject: A netshareenum reply always contains an enum_hnd. win2k returns zero total entries on an error whereas nt4 must send uninitialised data so we didn't catch this one before. (This used to be commit 88653130bc1e380b7d8dc6c62492f3bbc6f1c707) --- source3/rpc_parse/parse_srv.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 531267c308..672db36a28 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1119,10 +1119,8 @@ BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct * if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) return False; - if(r_n->total_entries != 0) { - if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) - return False; - } + if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) + return False; if(!prs_werror("status", ps, depth, &r_n->status)) return False; -- cgit From 2ec89150f81b3643fa36c7e17ecaab223a97bfcb Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 6 Sep 2002 06:13:16 +0000 Subject: Display debug data we are marshalling/unmarshalling a UNISTR in a similar format to UNISTR2. (This used to be commit 2d227bdce26674affad87ad6d118e77604fb210a) --- source3/rpc_parse/parse_prs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 4de6b88e9c..843be33187 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1061,7 +1061,9 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) len++; - dump_data(5+depth, (char *)start, len * 2); + DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + print_asc(5, (unsigned char*)start, 2*len); + DEBUG(5, ("\n")); } else { /* unmarshalling */ @@ -1114,6 +1116,10 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) /* NULL terminate the UNISTR */ str->buffer[len++] = '\0'; } + + DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + print_asc(5, (unsigned char*)str->buffer, 2*len); + DEBUG(5, ("\n")); } /* set the offset in the prs_struct; 'len' points to the -- cgit From 10297d8cd3bfdef44ea6fdf4d0520fe6c613108c Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 13 Sep 2002 08:53:53 +0000 Subject: wrong alignment size calculation spot by Florian Weimer (This used to be commit eda0e7589f2591edc29e6c1eef44aa21628977be) --- source3/rpc_parse/parse_spoolss.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 55c387cdc5..36b00ff55d 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3366,7 +3366,9 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) * it is easier to maintain the calculation here and * not place the burden on the caller to remember. --jerry */ - size += size % 4; + if ((size % 4) != 0) { + size += 4 - (size % 4); + } return size; } -- cgit From d06d2c876e3f295715e818fa6869d968e32b3dc4 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 22 Sep 2002 10:30:00 +0000 Subject: Change parsing of policy and privs delta to what Ethereal says. Volker (This used to be commit 8c41b5cd1b8b0c2639def9552bd20b8aca39785c) --- source3/rpc_parse/parse_net.c | 136 ++++++++++++++++++++---------------------- 1 file changed, 66 insertions(+), 70 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index f1d813c3f0..e0f710b2d7 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -2357,79 +2357,70 @@ static BOOL net_io_sam_policy_info(char *desc, SAM_DELTA_POLICY *info, prs_struct *ps, int depth) { int i; - prs_debug(ps, depth, desc, "net_io_sam_policy_info"); depth++; if(!prs_align(ps)) return False; - if (!prs_uint32("unknown1", ps, depth, &info->unknown1)) - return False; - if (!prs_uint32("unknown2", ps, depth, &info->unknown2)) + if (!prs_uint32("max_log_size", ps, depth, &info->max_log_size)) return False; - if (!prs_uint32("unknown3", ps, depth, &info->unknown3)) + if (!prs_uint64("audit_retention_period", ps, depth, + &info->audit_retention_period)) return False; - if (!prs_uint32("unknown4", ps, depth, &info->unknown4)) + if (!prs_uint32("auditing_mode", ps, depth, &info->auditing_mode)) return False; - if (!prs_uint32("count1", ps, depth, &info->count1)) + if (!prs_uint32("num_events", ps, depth, &info->num_events)) return False; - if (!prs_uint32("ptr1", ps, depth, &info->ptr1)) + if (!prs_uint32("ptr_events", ps, depth, &info->ptr_events)) return False; - if (!prs_uint16("count2", ps, depth, &info->count2)) - return False; - if (!prs_uint16("count3", ps, depth, &info->count3)) - return False; + if (!smb_io_unihdr("hdr_dom_name", &info->hdr_dom_name, ps, depth)) + return False; - if (!prs_uint32("ptr2", ps, depth, &info->ptr2)) - return False; - if (!prs_uint32("ptr3", ps, depth, &info->ptr3)) + if (!prs_uint32("sid_ptr", ps, depth, &info->sid_ptr)) return False; - if (!prs_uint32("unknown4b", ps, depth, &info->unknown4b)) + if (!prs_uint32("paged_pool_limit", ps, depth, &info->paged_pool_limit)) return False; - if (!prs_uint32("unknown5", ps, depth, &info->unknown5)) + if (!prs_uint32("non_paged_pool_limit", ps, depth, + &info->non_paged_pool_limit)) return False; - if (!prs_uint32("unknown6", ps, depth, &info->unknown6)) + if (!prs_uint32("min_workset_size", ps, depth, &info->min_workset_size)) return False; - if (!prs_uint32("unknown7", ps, depth, &info->unknown7)) + if (!prs_uint32("max_workset_size", ps, depth, &info->max_workset_size)) return False; - if (!prs_uint32("unknown8", ps, depth, &info->unknown8)) + if (!prs_uint32("page_file_limit", ps, depth, &info->page_file_limit)) return False; - if (!prs_uint32("unknown9", ps, depth, &info->unknown9)) + if (!prs_uint64("time_limit", ps, depth, &info->time_limit)) return False; - if (!prs_uint32("unknown10", ps, depth, &info->unknown10)) + if (!smb_io_time("modify_time", &info->modify_time, ps, depth)) return False; - if (!prs_uint32("unknown11", ps, depth, &info->unknown11)) + if (!smb_io_time("create_time", &info->create_time, ps, depth)) return False; - if (!prs_uint32("unknown12", ps, depth, &info->unknown12)) + if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth)) return False; - if (!prs_uint32("unknown13", ps, depth, &info->unknown13)) - return False; - if (!prs_uint32("unknown14", ps, depth, &info->unknown14)) - return False; - if (!prs_uint32("unknown15", ps, depth, &info->unknown15)) - return False; - if (!prs_uint32("unknown16", ps, depth, &info->unknown16)) - return False; - if (!prs_uint32("unknown17", ps, depth, &info->unknown17)) - return False; + for (i=0; i<4; i++) { + UNIHDR dummy; + if (!smb_io_unihdr("dummy", &dummy, ps, depth)) + return False; + } - for (i=0; icount2; i++) - if (!prs_uint32("unknown18", ps, depth, &info->unknown18)) - return False; + for (i=0; i<4; i++) { + uint32 reserved; + if (!prs_uint32("reserved", ps, depth, &reserved)) + return False; + } - if (!prs_uint32("unknown19", ps, depth, &info->unknown19)) + if (!prs_uint32("num_event_audit_options", ps, depth, + &info->num_event_audit_options)) return False; - for (i=0; icount1; i++) - if (!prs_uint32("unknown20", ps, depth, &info->unknown20)) - return False; - - if (!prs_uint32("ptr4", ps, depth, &info->ptr4)) - return False; + for (i=0; inum_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; @@ -2437,6 +2428,11 @@ static BOOL net_io_sam_policy_info(char *desc, SAM_DELTA_POLICY *info, if(!smb_io_dom_sid2("domain_sid", &info->domain_sid, ps, depth)) return False; + if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, + info->hdr_sec_desc.buffer, ps, depth)) + + return False; + return True; } @@ -2589,52 +2585,48 @@ static BOOL net_io_sam_privs_info(char *desc, SAM_DELTA_PRIVS *info, 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(!prs_uint32("priv_count", ps, depth, &info->priv_count)) return False; - if(!prs_uint32("reserved1", ps, depth, &info->reserved1)) + if(!prs_uint32("priv_control", ps, depth, &info->priv_control)) return False; - if(!prs_uint32("ptr1", ps, depth, &info->ptr1)) + if(!prs_uint32("priv_attr_ptr", ps, depth, &info->priv_attr_ptr)) return False; - if(!prs_uint32("ptr2", ps, depth, &info->ptr2)) + if(!prs_uint32("priv_name_ptr", ps, depth, &info->priv_name_ptr)) return False; - if(!prs_uint32("unknown1", ps, depth, &info->unknown1)) + if (!prs_uint32("paged_pool_limit", ps, depth, &info->paged_pool_limit)) return False; - if(!prs_uint32("unknown2", ps, depth, &info->unknown2)) + if (!prs_uint32("non_paged_pool_limit", ps, depth, + &info->non_paged_pool_limit)) return False; - if(!prs_uint32("unknown3", ps, depth, &info->unknown3)) + if (!prs_uint32("min_workset_size", ps, depth, &info->min_workset_size)) return False; - if(!prs_uint32("unknown4", ps, depth, &info->unknown4)) + if (!prs_uint32("max_workset_size", ps, depth, &info->max_workset_size)) return False; - if(!prs_uint32("unknown5", ps, depth, &info->unknown5)) + if (!prs_uint32("page_file_limit", ps, depth, &info->page_file_limit)) return False; - if(!prs_uint32("unknown6", ps, depth, &info->unknown6)) + if (!prs_uint64("time_limit", ps, depth, &info->time_limit)) return False; - if(!prs_uint32("unknown7", ps, depth, &info->unknown7)) + if (!prs_uint32("system_flags", ps, depth, &info->system_flags)) return False; - if(!prs_uint32("unknown8", ps, depth, &info->unknown8)) - return False; - if(!prs_uint32("unknown9", ps, depth, &info->unknown9)) + if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth)) 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<4; i++) { + UNIHDR dummy; + if (!smb_io_unihdr("dummy", &dummy, ps, depth)) + return False; + } - for (i=0; i<12; i++) - if(!prs_uint32("unknown10", ps, depth, &info->unknown10)) - 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; @@ -2659,6 +2651,10 @@ static BOOL net_io_sam_privs_info(char *desc, SAM_DELTA_PRIVS *info, if (!smb_io_unistr2("uni_privslist", &info->uni_privslist[i], True, ps, depth)) return False; + if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, + info->hdr_sec_desc.buffer, ps, depth)) + return False; + return True; } -- cgit From a834a73e341059be154426390304a42e4a011f72 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 25 Sep 2002 15:19:00 +0000 Subject: sync'ing up for 3.0alpha20 release (This used to be commit 65e7b5273bb58802bf0c389b77f7fcae0a1f6139) --- source3/rpc_parse/parse_misc.c | 3 - source3/rpc_parse/parse_net.c | 284 ++++++++++++++++++++++---------------- source3/rpc_parse/parse_prs.c | 8 +- source3/rpc_parse/parse_reg.c | 76 +--------- source3/rpc_parse/parse_spoolss.c | 149 +++++++++++++++++--- source3/rpc_parse/parse_srv.c | 6 +- 6 files changed, 314 insertions(+), 212 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 01d7698173..3dd9c3bc2a 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1255,9 +1255,6 @@ BOOL smb_io_chal(char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "smb_io_chal"); depth++; - - if(!prs_align(ps)) - return False; if(!prs_uint8s (False, "data", ps, depth, chal->data, 8)) return False; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index da49a6531d..e0f710b2d7 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -4,7 +4,8 @@ * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997. - * + * Copyright (C) Jean Franois 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 2 of the License, or @@ -552,8 +553,6 @@ void init_q_req_chal(NET_Q_REQ_CHAL *q_c, BOOL net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int depth) { - int old_align; - if (q_c == NULL) return False; @@ -571,15 +570,8 @@ BOOL net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int dep if(!smb_io_unistr2("", &q_c->uni_logon_clnt, True, ps, depth)) /* logon client unicode string */ return False; - old_align = ps->align; - ps->align = 0; - /* client challenge is _not_ aligned after the unicode strings */ - if(!smb_io_chal("", &q_c->clnt_chal, ps, depth)) { - /* client challenge */ - ps->align = old_align; + if(!smb_io_chal("", &q_c->clnt_chal, ps, depth)) return False; - } - ps->align = old_align; return True; } @@ -615,7 +607,6 @@ BOOL net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int dept BOOL net_io_q_auth(char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth) { - int old_align; if (q_a == NULL) return False; @@ -627,15 +618,8 @@ BOOL net_io_q_auth(char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth) if(!smb_io_log_info ("", &q_a->clnt_id, ps, depth)) /* client identification info */ return False; - /* client challenge is _not_ aligned */ - old_align = ps->align; - ps->align = 0; - if(!smb_io_chal("", &q_a->clnt_chal, ps, depth)) { - /* client-calculated credentials */ - ps->align = old_align; + if(!smb_io_chal("", &q_a->clnt_chal, ps, depth)) return False; - } - ps->align = old_align; return True; } @@ -687,7 +671,6 @@ void init_q_auth_2(NET_Q_AUTH_2 *q_a, BOOL net_io_q_auth_2(char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth) { - int old_align; if (q_a == NULL) return False; @@ -699,15 +682,8 @@ BOOL net_io_q_auth_2(char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth) if(!smb_io_log_info ("", &q_a->clnt_id, ps, depth)) /* client identification info */ return False; - /* client challenge is _not_ aligned */ - old_align = ps->align; - ps->align = 0; - if(!smb_io_chal("", &q_a->clnt_chal, ps, depth)) { - /* client-calculated credentials */ - ps->align = old_align; + if(!smb_io_chal("", &q_a->clnt_chal, ps, depth)) return False; - } - ps->align = old_align; if(!net_io_neg_flags("", &q_a->clnt_flgs, ps, depth)) return False; @@ -740,6 +716,76 @@ BOOL net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth) 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, + 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(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(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. @@ -1611,7 +1657,8 @@ 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) + DOM_CRED *ret_creds, uint32 database_id, + uint32 next_rid) { DEBUG(5, ("init_q_sam_sync\n")); @@ -1628,7 +1675,7 @@ BOOL init_net_q_sam_sync(NET_Q_SAM_SYNC * q_s, const char *srv_name, q_s->database_id = database_id; q_s->restart_state = 0; - q_s->sync_context = 0; + q_s->sync_context = next_rid; q_s->max_size = 0xffff; return True; @@ -1699,7 +1746,7 @@ static BOOL net_io_sam_delta_hdr(char *desc, SAM_DELTA_HDR * delta, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_delta_stamp(char *desc, SAM_DELTA_STAMP *info, +static BOOL net_io_sam_delta_mod_count(char *desc, SAM_DELTA_MOD_COUNT *info, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "net_io_sam_delta_stamp"); @@ -2306,83 +2353,74 @@ static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_dom_info(char *desc, SAM_DELTA_DOM *info, +static BOOL net_io_sam_policy_info(char *desc, SAM_DELTA_POLICY *info, prs_struct *ps, int depth) { int i; - - prs_debug(ps, depth, desc, "net_io_sam_dom_info"); + prs_debug(ps, depth, desc, "net_io_sam_policy_info"); depth++; if(!prs_align(ps)) return False; - if (!prs_uint32("unknown1", ps, depth, &info->unknown1)) - return False; - if (!prs_uint32("unknown2", ps, depth, &info->unknown2)) + if (!prs_uint32("max_log_size", ps, depth, &info->max_log_size)) return False; - if (!prs_uint32("unknown3", ps, depth, &info->unknown3)) + if (!prs_uint64("audit_retention_period", ps, depth, + &info->audit_retention_period)) return False; - if (!prs_uint32("unknown4", ps, depth, &info->unknown4)) + if (!prs_uint32("auditing_mode", ps, depth, &info->auditing_mode)) return False; - if (!prs_uint32("count1", ps, depth, &info->count1)) + if (!prs_uint32("num_events", ps, depth, &info->num_events)) return False; - if (!prs_uint32("ptr1", ps, depth, &info->ptr1)) + if (!prs_uint32("ptr_events", ps, depth, &info->ptr_events)) return False; - if (!prs_uint16("count2", ps, depth, &info->count2)) - return False; - if (!prs_uint16("count3", ps, depth, &info->count3)) - return False; + if (!smb_io_unihdr("hdr_dom_name", &info->hdr_dom_name, ps, depth)) + return False; - if (!prs_uint32("ptr2", ps, depth, &info->ptr2)) - return False; - if (!prs_uint32("ptr3", ps, depth, &info->ptr3)) + if (!prs_uint32("sid_ptr", ps, depth, &info->sid_ptr)) return False; - if (!prs_uint32("unknown4b", ps, depth, &info->unknown4b)) + if (!prs_uint32("paged_pool_limit", ps, depth, &info->paged_pool_limit)) return False; - if (!prs_uint32("unknown5", ps, depth, &info->unknown5)) + if (!prs_uint32("non_paged_pool_limit", ps, depth, + &info->non_paged_pool_limit)) return False; - if (!prs_uint32("unknown6", ps, depth, &info->unknown6)) + if (!prs_uint32("min_workset_size", ps, depth, &info->min_workset_size)) return False; - if (!prs_uint32("unknown7", ps, depth, &info->unknown7)) + if (!prs_uint32("max_workset_size", ps, depth, &info->max_workset_size)) return False; - if (!prs_uint32("unknown8", ps, depth, &info->unknown8)) + if (!prs_uint32("page_file_limit", ps, depth, &info->page_file_limit)) return False; - if (!prs_uint32("unknown9", ps, depth, &info->unknown9)) + if (!prs_uint64("time_limit", ps, depth, &info->time_limit)) return False; - if (!prs_uint32("unknown10", ps, depth, &info->unknown10)) + if (!smb_io_time("modify_time", &info->modify_time, ps, depth)) return False; - if (!prs_uint32("unknown11", ps, depth, &info->unknown11)) + if (!smb_io_time("create_time", &info->create_time, ps, depth)) return False; - if (!prs_uint32("unknown12", ps, depth, &info->unknown12)) + if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth)) return False; - if (!prs_uint32("unknown13", ps, depth, &info->unknown13)) - return False; - if (!prs_uint32("unknown14", ps, depth, &info->unknown14)) - return False; - if (!prs_uint32("unknown15", ps, depth, &info->unknown15)) - return False; - if (!prs_uint32("unknown16", ps, depth, &info->unknown16)) - return False; - if (!prs_uint32("unknown17", ps, depth, &info->unknown17)) - return False; + for (i=0; i<4; i++) { + UNIHDR dummy; + if (!smb_io_unihdr("dummy", &dummy, ps, depth)) + return False; + } - for (i=0; icount2; i++) - if (!prs_uint32("unknown18", ps, depth, &info->unknown18)) - return False; + for (i=0; i<4; i++) { + uint32 reserved; + if (!prs_uint32("reserved", ps, depth, &reserved)) + return False; + } - if (!prs_uint32("unknown19", ps, depth, &info->unknown19)) + if (!prs_uint32("num_event_audit_options", ps, depth, + &info->num_event_audit_options)) return False; - for (i=0; icount1; i++) - if (!prs_uint32("unknown20", ps, depth, &info->unknown20)) - return False; - - if (!prs_uint32("ptr4", ps, depth, &info->ptr4)) - return False; + for (i=0; inum_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; @@ -2390,18 +2428,23 @@ static BOOL net_io_sam_dom_info(char *desc, SAM_DELTA_DOM *info, if(!smb_io_dom_sid2("domain_sid", &info->domain_sid, ps, depth)) return False; + if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, + info->hdr_sec_desc.buffer, ps, depth)) + + return False; + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_unk0e_info(char *desc, SAM_DELTA_UNK0E *info, +static BOOL net_io_sam_trustdoms_info(char *desc, SAM_DELTA_TRUSTDOMS *info, prs_struct *ps, int depth) { int i; - prs_debug(ps, depth, desc, "net_io_sam_unk0e_info"); + prs_debug(ps, depth, desc, "net_io_sam_trustdoms_info"); depth++; if(!prs_align(ps)) @@ -2444,12 +2487,12 @@ static BOOL net_io_sam_unk0e_info(char *desc, SAM_DELTA_UNK0E *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_unk12_info(char *desc, SAM_DELTA_UNK12 *info, - prs_struct *ps, int depth) +static BOOL net_io_sam_secret_info(char *desc, SAM_DELTA_SECRET *info, + prs_struct *ps, int depth) { int i; - prs_debug(ps, depth, desc, "net_io_sam_unk12_info"); + prs_debug(ps, depth, desc, "net_io_sam_secret_info"); depth++; if(!prs_align(ps)) @@ -2542,52 +2585,48 @@ static BOOL net_io_sam_privs_info(char *desc, SAM_DELTA_PRIVS *info, 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(!prs_uint32("priv_count", ps, depth, &info->priv_count)) return False; - if(!prs_uint32("reserved1", ps, depth, &info->reserved1)) + if(!prs_uint32("priv_control", ps, depth, &info->priv_control)) return False; - if(!prs_uint32("ptr1", ps, depth, &info->ptr1)) + if(!prs_uint32("priv_attr_ptr", ps, depth, &info->priv_attr_ptr)) return False; - if(!prs_uint32("ptr2", ps, depth, &info->ptr2)) + if(!prs_uint32("priv_name_ptr", ps, depth, &info->priv_name_ptr)) return False; - if(!prs_uint32("unknown1", ps, depth, &info->unknown1)) + if (!prs_uint32("paged_pool_limit", ps, depth, &info->paged_pool_limit)) return False; - if(!prs_uint32("unknown2", ps, depth, &info->unknown2)) - return False; - if(!prs_uint32("unknown3", ps, depth, &info->unknown3)) + if (!prs_uint32("non_paged_pool_limit", ps, depth, + &info->non_paged_pool_limit)) return False; - if(!prs_uint32("unknown4", ps, depth, &info->unknown4)) + if (!prs_uint32("min_workset_size", ps, depth, &info->min_workset_size)) return False; - if(!prs_uint32("unknown5", ps, depth, &info->unknown5)) + if (!prs_uint32("max_workset_size", ps, depth, &info->max_workset_size)) return False; - if(!prs_uint32("unknown6", ps, depth, &info->unknown6)) + if (!prs_uint32("page_file_limit", ps, depth, &info->page_file_limit)) return False; - if(!prs_uint32("unknown7", ps, depth, &info->unknown7)) + if (!prs_uint64("time_limit", ps, depth, &info->time_limit)) return False; - if(!prs_uint32("unknown8", ps, depth, &info->unknown8)) + if (!prs_uint32("system_flags", ps, depth, &info->system_flags)) return False; - if(!prs_uint32("unknown9", ps, depth, &info->unknown9)) + if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth)) 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<4; i++) { + UNIHDR dummy; + if (!smb_io_unihdr("dummy", &dummy, ps, depth)) + return False; + } - for (i=0; i<12; i++) - if(!prs_uint32("unknown10", ps, depth, &info->unknown10)) - 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; @@ -2612,6 +2651,10 @@ static BOOL net_io_sam_privs_info(char *desc, SAM_DELTA_PRIVS *info, if (!smb_io_unistr2("uni_privslist", &info->uni_privslist[i], True, ps, depth)) return False; + if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, + info->hdr_sec_desc.buffer, ps, depth)) + return False; + return True; } @@ -2627,8 +2670,8 @@ static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], switch (type) { /* Seen in sam deltas */ - case SAM_DELTA_SAM_STAMP: - if (!net_io_sam_delta_stamp("", &delta->stamp, ps, depth)) + case SAM_DELTA_MODIFIED_COUNT: + if (!net_io_sam_delta_mod_count("", &delta->mod_count, ps, depth)) return False; break; @@ -2657,8 +2700,8 @@ static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], return False; break; - case SAM_DELTA_DOM_INFO: - if (!net_io_sam_dom_info("", &delta->dom_info, ps, depth)) + case SAM_DELTA_POLICY_INFO: + if (!net_io_sam_policy_info("", &delta->policy_info, ps, depth)) return False; break; @@ -2672,16 +2715,23 @@ static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], return False; break; - case SAM_DELTA_UNK0E_INFO: - if (!net_io_sam_unk0e_info("", &delta->unk0e_info, ps, depth)) + case SAM_DELTA_TRUST_DOMS: + if (!net_io_sam_trustdoms_info("", &delta->trustdoms_info, ps, depth)) return False; break; - case SAM_DELTA_UNK12_INFO: - if (!net_io_sam_unk12_info("", &delta->unk12_info, ps, depth)) + case SAM_DELTA_SECRET_INFO: + if (!net_io_sam_secret_info("", &delta->secret_info, ps, depth)) return False; 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; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 4de6b88e9c..843be33187 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1061,7 +1061,9 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) len++; - dump_data(5+depth, (char *)start, len * 2); + DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + print_asc(5, (unsigned char*)start, 2*len); + DEBUG(5, ("\n")); } else { /* unmarshalling */ @@ -1114,6 +1116,10 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) /* NULL terminate the UNISTR */ str->buffer[len++] = '\0'; } + + DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + print_asc(5, (unsigned char*)str->buffer, 2*len); + DEBUG(5, ("\n")); } /* set the offset in the prs_struct; 'len' points to the diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 365ad2dc70..2698e82440 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -34,79 +34,13 @@ static uint32 reg_init_buffer2( BUFFER2 *buf2, REGISTRY_VALUE *val ) { - UNISTR2 unistr; uint32 real_size = 0; - char *string; - char *list = NULL; - char *list2 = NULL; if ( !buf2 || !val ) return 0; - real_size = val->size; - - switch (val->type ) - { - case REG_SZ: - string = (char*)val->data_p; - DEBUG(10,("reg_init_buffer2: REG_SZ string => [%s]\n", string)); - - init_unistr2( &unistr, (char*)val->data_p, strlen((char*)val->data_p)+1 ); - init_buffer2( buf2, (char*)unistr.buffer, unistr.uni_str_len*2 ); - real_size = unistr.uni_str_len*2; - break; - - case REG_MULTI_SZ: - string = (char*)val->data_p; - real_size = 0; - while ( string && *string ) - { - DEBUG(10,("reg_init_buffer2: REG_MULTI_SZ string => [%s], size => [%d]\n", string, real_size )); - - init_unistr2( &unistr, string, strlen(string)+1 ); - - list2 = Realloc( list, real_size + unistr.uni_str_len*2 ); - if ( !list2 ) - break; - list = list2; - - memcpy( list+real_size, unistr.buffer, unistr.uni_str_len*2 ); - - real_size += unistr.uni_str_len*2; - - string += strlen(string)+1; - } - - list2 = Realloc( list, real_size + 2 ); - if ( !list2 ) - break; - list = list2; - list[real_size++] = 0x0; - list[real_size++] = 0x0; - - init_buffer2( buf2, (char*)list, real_size ); - - DEBUG(10,("reg_init_buffer2: REG_MULTI_SZ size => [%d]\n", real_size )); - - break; - - case REG_BINARY: - DEBUG(10,("reg_init_buffer2: REG_BINARY size => [%d]\n", val->size )); - - init_buffer2( buf2, val->data_p, val->size ); - break; - - case REG_DWORD: - DEBUG(10,("reg_init_buffer2: REG_DWORD value => [%d]\n", *(uint32*)val->data_p)); - init_buffer2( buf2, val->data_p, val->size ); - break; - - default: - DEBUG(0,("reg_init_buffer2: Unsupported registry data type [%d]\n", val->type)); - break; - } - - SAFE_FREE( list ); + real_size = regval_size(val); + init_buffer2( buf2, (char*)regval_data_p(val), real_size ); return real_size; } @@ -1767,7 +1701,11 @@ BOOL reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int void init_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r, POLICY_HND *pol, NTSTATUS status) { - memcpy(&r_r->pol, pol, sizeof(r_r->pol)); + if (NT_STATUS_IS_OK(status)) { + memcpy(&r_r->pol, pol, sizeof(r_r->pol)); + } else { + ZERO_STRUCT(r_r->pol); + } r_r->status = status; } diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 3a7f4b57ae..36b00ff55d 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -659,7 +659,7 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo { "panningheight", NULL } }; - /* assign at run time to keep non-gcc vompilers happy */ + /* assign at run time to keep non-gcc compilers happy */ opt_fields[0].field = &devmode->icmmethod; opt_fields[1].field = &devmode->icmintent; @@ -1211,6 +1211,26 @@ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, return True; } +/******************************************************************* + * make a structure. + ********************************************************************/ + +BOOL make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX *q_u, + const POLICY_HND *handle, + char *keyname, char *valuename, uint32 size) +{ + if (q_u == NULL) return False; + + DEBUG(5,("make_spoolss_q_getprinterdataex\n")); + + q_u->handle = *handle; + init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); + init_unistr2(&q_u->keyname, keyname, strlen(keyname) + 1); + q_u->size = size; + + return True; +} + /******************************************************************* * read a structure. * called from spoolss_q_getprinterdata (srv_spoolss.c) @@ -1344,7 +1364,7 @@ BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_st if (UNMARSHALLING(ps) && r_u->size) { r_u->data = prs_alloc_mem(ps, r_u->size); - if(r_u->data) + if(!r_u->data) return False; } @@ -3346,7 +3366,9 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) * it is easier to maintain the calculation here and * not place the burden on the caller to remember. --jerry */ - size += size % 4; + if ((size % 4) != 0) { + size += 4 - (size % 4); + } return size; } @@ -3678,7 +3700,7 @@ uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p) /* uint32(offset) + uint32(length) + length) */ size += (size_of_uint32(&p->value_len)*2) + p->value_len; - size += (size_of_uint32(&p->data_len)*2) + p->data_len; + size += (size_of_uint32(&p->data_len)*2) + p->data_len + (p->data_len%2) ; size += size_of_uint32(&p->type); @@ -6065,20 +6087,52 @@ BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, return True; } +/******************************************************************* +********************************************************************/ + +BOOL make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u, + const POLICY_HND *hnd, char *key, + uint32 size) +{ + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + init_unistr2(&q_u->key, key, strlen(key)+1); + q_u->size = size; + + return True; +} + /******************************************************************* ********************************************************************/ BOOL make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND *hnd, - char* value, char* data, uint32 data_size) + char* value, uint32 data_type, char* data, uint32 data_size) +{ + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + q_u->type = data_type; + init_unistr2(&q_u->value, value, strlen(value)+1); + + q_u->max_len = q_u->real_len = data_size; + q_u->data = data; + + return True; +} + +/******************************************************************* +********************************************************************/ +BOOL make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX *q_u, const POLICY_HND *hnd, + char *key, char* value, uint32 data_type, char* data, + uint32 data_size) { memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - q_u->type = REG_SZ; + q_u->type = data_type; init_unistr2(&q_u->value, value, strlen(value)+1); + init_unistr2(&q_u->key, key, strlen(key)+1); q_u->max_len = q_u->real_len = data_size; q_u->data = data; return True; } + /******************************************************************* ********************************************************************/ @@ -6863,6 +6917,12 @@ BOOL spoolss_io_r_getprinterdataex(char *desc, SPOOL_R_GETPRINTERDATAEX *r_u, pr if (!prs_uint32("size", ps, depth, &r_u->size)) return False; + if (UNMARSHALLING(ps) && r_u->size) { + r_u->data = prs_alloc_mem(ps, r_u->size); + if(!r_u->data) + return False; + } + if (!prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size)) return False; @@ -7083,16 +7143,22 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, prs_debug(ps, depth, desc, "spoolss_io_printer_enum_values_ctr"); depth++; - if (!prs_uint32("size", ps, depth, &ctr->size)) - return False; - - /* offset data begins at 20 bytes per structure * size_of_array. - Don't forget the uint32 at the beginning */ + /* + * offset data begins at 20 bytes per structure * size_of_array. + * Don't forget the uint32 at the beginning + * */ current_offset = basic_unit * ctr->size_of_array; /* first loop to write basic enum_value information */ + if (UNMARSHALLING(ps)) { + ctr->values = (PRINTER_ENUM_VALUES *)prs_alloc_mem( + ps, ctr->size_of_array * sizeof(PRINTER_ENUM_VALUES)); + if (!ctr->values) + return False; + } + for (i=0; isize_of_array; i++) { valuename_offset = current_offset; @@ -7106,18 +7172,22 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, return False; data_offset = ctr->values[i].value_len + valuename_offset; + if (!prs_uint32("data_offset", ps, depth, &data_offset)) return False; if (!prs_uint32("data_len", ps, depth, &ctr->values[i].data_len)) return False; - current_offset = data_offset + ctr->values[i].data_len - basic_unit; + current_offset = data_offset + ctr->values[i].data_len - basic_unit; + /* account for 2 byte alignment */ + current_offset += (current_offset % 2); } - /* loop #2 for writing the dynamically size objects - while viewing conversations between Win2k -> Win2k, - 4-byte alignment does not seem to matter here --jerry */ + /* + * loop #2 for writing the dynamically size objects; pay + * attention to 2-byte alignment here.... + */ for (i=0; isize_of_array; i++) { @@ -7125,12 +7195,20 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, if (!prs_unistr("valuename", ps, depth, &ctr->values[i].valuename)) return False; + if (UNMARSHALLING(ps)) { + ctr->values[i].data = (uint8 *)prs_alloc_mem( + ps, ctr->values[i].data_len); + if (!ctr->values[i].data) + return False; + } + if (!prs_uint8s(False, "data", ps, depth, ctr->values[i].data, ctr->values[i].data_len)) return False; + + if ( !prs_align_uint16(ps) ) + return False; } - - return True; } @@ -7141,15 +7219,21 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, BOOL spoolss_io_r_enumprinterdataex(char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, prs_struct *ps, int depth) { + int data_offset, end_offset; prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdataex"); depth++; if(!prs_align(ps)) return False; - if (!spoolss_io_printer_enum_values_ctr("", ps, &r_u->ctr, depth )) + if (!prs_uint32("size", ps, depth, &r_u->ctr.size)) return False; + data_offset = prs_offset(ps); + + if (!prs_set_offset(ps, data_offset + r_u->ctr.size)) + return False; + if(!prs_align(ps)) return False; @@ -7162,6 +7246,20 @@ BOOL spoolss_io_r_enumprinterdataex(char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, if(!prs_werror("status", ps, depth, &r_u->status)) return False; + r_u->ctr.size_of_array = r_u->returned; + + end_offset = prs_offset(ps); + + if (!prs_set_offset(ps, data_offset)) + return False; + + if (r_u->ctr.size) + if (!spoolss_io_printer_enum_values_ctr("", ps, &r_u->ctr, depth )) + return False; + + if (!prs_set_offset(ps, end_offset)) + return False; + return True; } @@ -7510,6 +7608,21 @@ BOOL make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA *q_u, return True; } +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX *q_u, + POLICY_HND *handle, char *key, + char *value) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + init_unistr2(&q_u->valuename, value, strlen(value) + 1); + init_unistr2(&q_u->keyname, key, strlen(key) + 1); + + return True; +} + /******************************************************************* * init a structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 531267c308..672db36a28 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1119,10 +1119,8 @@ BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct * if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) return False; - if(r_n->total_entries != 0) { - if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) - return False; - } + if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) + return False; if(!prs_werror("status", ps, depth, &r_n->status)) return False; -- cgit From ad514000db54b887c5c0f8734415e2b10698b365 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 26 Sep 2002 10:25:34 +0000 Subject: Patch from "Stefan (metze) Metzmacher" to do a *much* better job of working with usrmgr. Previously we were blanking out entires, and all sort of mischif. The new patch (which I've now had a chance to test/modify) also takes care not to expand % values (ie we go \\%L\%U -> \\server\user, we don't want to store \\server\user back) and to correctly notice 'not set' compared to 'null string' etc. Andrew Bartlett (This used to be commit ab878b6cc4132594fc33f78aeebf0d8b7266c150) --- source3/rpc_parse/parse_samr.c | 45 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 1137993bb6..ddf51fcf0b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5470,7 +5470,15 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z 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->unknown_5 = unknown_5; /* 0x0001 0000 */ @@ -5558,7 +5566,14 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z 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->unknown_5 = unknown_5; /* 0x0001 0000 */ @@ -5651,11 +5666,18 @@ static BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 * usr, return False; if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs)) return False; + + if(!prs_uint32("unknown_5 ", ps, depth, &usr->unknown_5)) + return False; + if(!prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1))) return False; - if(!prs_uint32("unknown_5 ", ps, depth, &usr->unknown_5)) + 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; @@ -5905,7 +5927,15 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, usr->ptr_logon_hrs = hrs ? 1 : 0; usr->unknown_5 = unknown_5; /* 0x0002 0000 */ + 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); copy_unistr2(&usr->uni_full_name, full_name); @@ -6037,7 +6067,15 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0; usr->unknown_5 = pdb_get_unknown5(pw); /* 0x0002 0000 */ + 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, len_user_name); init_unistr2(&usr->uni_full_name, full_name, len_full_name); @@ -6132,11 +6170,16 @@ static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 * usr, return False; if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs)) return False; + if(!prs_uint32("unknown_5 ", ps, depth, &usr->unknown_5)) 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 */ -- cgit From d9729d81a993234db850fa733fd4591e1a5ae56e Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 26 Sep 2002 18:37:55 +0000 Subject: syncing up with HEAD again.... (This used to be commit e026b84815ad1a5fa981c24fff197fefa73b4928) --- source3/rpc_parse/parse_samr.c | 45 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 1137993bb6..ddf51fcf0b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5470,7 +5470,15 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z 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->unknown_5 = unknown_5; /* 0x0001 0000 */ @@ -5558,7 +5566,14 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z 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->unknown_5 = unknown_5; /* 0x0001 0000 */ @@ -5651,11 +5666,18 @@ static BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 * usr, return False; if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs)) return False; + + if(!prs_uint32("unknown_5 ", ps, depth, &usr->unknown_5)) + return False; + if(!prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1))) return False; - if(!prs_uint32("unknown_5 ", ps, depth, &usr->unknown_5)) + 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; @@ -5905,7 +5927,15 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, usr->ptr_logon_hrs = hrs ? 1 : 0; usr->unknown_5 = unknown_5; /* 0x0002 0000 */ + 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); copy_unistr2(&usr->uni_full_name, full_name); @@ -6037,7 +6067,15 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0; usr->unknown_5 = pdb_get_unknown5(pw); /* 0x0002 0000 */ + 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, len_user_name); init_unistr2(&usr->uni_full_name, full_name, len_full_name); @@ -6132,11 +6170,16 @@ static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 * usr, return False; if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs)) return False; + if(!prs_uint32("unknown_5 ", ps, depth, &usr->unknown_5)) 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 */ -- cgit From 1ac50efaf775631482ada9f369e4921b27e4105d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 27 Sep 2002 18:49:35 +0000 Subject: HEAD and APP-HEAD spoolss parsing was out of sync. This MUST NOT HAPPEN ! Jeremy. (This used to be commit e42b76337b9a01fee84bc95d6899a724b2fdab29) --- source3/rpc_parse/parse_spoolss.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 36b00ff55d..783dd97ebf 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2503,7 +2503,7 @@ BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, { prs_struct *ps=&buffer->prs; uint32 dm_offset, sd_offset, current_offset; - uint32 dummy_value = 0; + uint32 dummy_value = 0, has_secdesc = 0; prs_debug(ps, depth, desc, "smb_io_printer_info_2"); depth++; @@ -2541,7 +2541,7 @@ BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, /* save current offset for the sec_desc */ sd_offset = prs_offset(ps); - if (!prs_uint32("sec_desc", ps, depth, &dummy_value)) + if (!prs_uint32("sec_desc", ps, depth, &has_secdesc)) return False; @@ -2555,10 +2555,12 @@ BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, return False; /* parse the sec_desc */ - if (!prs_set_offset(ps, sd_offset)) - return False; - if (!smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc)) - return False; + if (has_secdesc) { + if (!prs_set_offset(ps, sd_offset)) + return False; + if (!smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc)) + return False; + } /* pick up where we left off */ if (!prs_set_offset(ps, current_offset)) @@ -3366,9 +3368,8 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) * it is easier to maintain the calculation here and * not place the burden on the caller to remember. --jerry */ - if ((size % 4) != 0) { + if ((size % 4) != 0) size += 4 - (size % 4); - } return size; } @@ -7131,6 +7132,7 @@ BOOL spoolss_io_q_enumprinterdataex(char *desc, SPOOL_Q_ENUMPRINTERDATAEX *q_u, /******************************************************************* ********************************************************************/ + static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, PRINTER_ENUM_VALUES_CTR *ctr, int depth) { @@ -7159,8 +7161,7 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, return False; } - for (i=0; isize_of_array; i++) - { + for (i=0; isize_of_array; i++) { valuename_offset = current_offset; if (!prs_uint32("valuename_offset", ps, depth, &valuename_offset)) return False; @@ -7189,8 +7190,7 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, * attention to 2-byte alignment here.... */ - for (i=0; isize_of_array; i++) - { + for (i=0; isize_of_array; i++) { if (!prs_unistr("valuename", ps, depth, &ctr->values[i].valuename)) return False; @@ -7212,23 +7212,22 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, return True; } - /******************************************************************* * write a structure. ********************************************************************/ BOOL spoolss_io_r_enumprinterdataex(char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, prs_struct *ps, int depth) { - int data_offset, end_offset; + uint32 data_offset, end_offset; prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdataex"); depth++; if(!prs_align(ps)) return False; - + if (!prs_uint32("size", ps, depth, &r_u->ctr.size)) return False; - + data_offset = prs_offset(ps); if (!prs_set_offset(ps, data_offset + r_u->ctr.size)) @@ -7239,7 +7238,7 @@ BOOL spoolss_io_r_enumprinterdataex(char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, if(!prs_uint32("needed", ps, depth, &r_u->needed)) return False; - + if(!prs_uint32("returned", ps, depth, &r_u->returned)) return False; @@ -7259,11 +7258,9 @@ BOOL spoolss_io_r_enumprinterdataex(char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, if (!prs_set_offset(ps, end_offset)) return False; - - return True; + return True; } - /******************************************************************* * write a structure. ********************************************************************/ -- cgit From e72ea543eeb0ff629cab5c7efa68f802073349a6 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 27 Sep 2002 18:49:51 +0000 Subject: HEAD and APP-HEAD spoolss parsing was out of sync. This MUST NOT HAPPEN ! Jeremy. (This used to be commit cb89bcc935a39d9ca1ceb07a4ca85f0bda7f65fe) --- source3/rpc_parse/parse_spoolss.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 36b00ff55d..783dd97ebf 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2503,7 +2503,7 @@ BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, { prs_struct *ps=&buffer->prs; uint32 dm_offset, sd_offset, current_offset; - uint32 dummy_value = 0; + uint32 dummy_value = 0, has_secdesc = 0; prs_debug(ps, depth, desc, "smb_io_printer_info_2"); depth++; @@ -2541,7 +2541,7 @@ BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, /* save current offset for the sec_desc */ sd_offset = prs_offset(ps); - if (!prs_uint32("sec_desc", ps, depth, &dummy_value)) + if (!prs_uint32("sec_desc", ps, depth, &has_secdesc)) return False; @@ -2555,10 +2555,12 @@ BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, return False; /* parse the sec_desc */ - if (!prs_set_offset(ps, sd_offset)) - return False; - if (!smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc)) - return False; + if (has_secdesc) { + if (!prs_set_offset(ps, sd_offset)) + return False; + if (!smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc)) + return False; + } /* pick up where we left off */ if (!prs_set_offset(ps, current_offset)) @@ -3366,9 +3368,8 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) * it is easier to maintain the calculation here and * not place the burden on the caller to remember. --jerry */ - if ((size % 4) != 0) { + if ((size % 4) != 0) size += 4 - (size % 4); - } return size; } @@ -7131,6 +7132,7 @@ BOOL spoolss_io_q_enumprinterdataex(char *desc, SPOOL_Q_ENUMPRINTERDATAEX *q_u, /******************************************************************* ********************************************************************/ + static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, PRINTER_ENUM_VALUES_CTR *ctr, int depth) { @@ -7159,8 +7161,7 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, return False; } - for (i=0; isize_of_array; i++) - { + for (i=0; isize_of_array; i++) { valuename_offset = current_offset; if (!prs_uint32("valuename_offset", ps, depth, &valuename_offset)) return False; @@ -7189,8 +7190,7 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, * attention to 2-byte alignment here.... */ - for (i=0; isize_of_array; i++) - { + for (i=0; isize_of_array; i++) { if (!prs_unistr("valuename", ps, depth, &ctr->values[i].valuename)) return False; @@ -7212,23 +7212,22 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, return True; } - /******************************************************************* * write a structure. ********************************************************************/ BOOL spoolss_io_r_enumprinterdataex(char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, prs_struct *ps, int depth) { - int data_offset, end_offset; + uint32 data_offset, end_offset; prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdataex"); depth++; if(!prs_align(ps)) return False; - + if (!prs_uint32("size", ps, depth, &r_u->ctr.size)) return False; - + data_offset = prs_offset(ps); if (!prs_set_offset(ps, data_offset + r_u->ctr.size)) @@ -7239,7 +7238,7 @@ BOOL spoolss_io_r_enumprinterdataex(char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, if(!prs_uint32("needed", ps, depth, &r_u->needed)) return False; - + if(!prs_uint32("returned", ps, depth, &r_u->returned)) return False; @@ -7259,11 +7258,9 @@ BOOL spoolss_io_r_enumprinterdataex(char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, if (!prs_set_offset(ps, end_offset)) return False; - - return True; + return True; } - /******************************************************************* * write a structure. ********************************************************************/ -- cgit From 83e58265b5595f5268bbcbda1a078a81d6fd5a40 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 4 Oct 2002 03:51:43 +0000 Subject: merge of new client side support the Win2k LSARPC UUID in rpcbind from APP_HEAD (This used to be commit 38c9e4299845fd77cc8629945ce2d259489f7437) --- source3/rpc_parse/parse_rpc.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 41e0b4cb5f..590268bed5 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -75,6 +75,15 @@ interface/version dce/rpc pipe identification }, 0x00 \ } +#define SYNT_LSARPC_V0_WIN2K \ +{ \ + { \ + 0x3919286a, 0xb10c, 0x11d0, \ + { 0x9b, 0xa8, 0x00, 0xc0, \ + 0x4f, 0xd9, 0x2e, 0xf5 } \ + }, 0x00 \ +} + #define SYNT_SAMR_V1 \ { \ { \ @@ -129,18 +138,24 @@ interface/version dce/rpc pipe identification }, 0x03 \ } +/* + * IMPORTANT!! If you update this structure, make sure to + * update the index #defines in smb.h. + */ + struct pipe_id_info pipe_names [] = { - /* client pipe , abstract syntax , server pipe , transfer syntax */ - { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_NETLOGON, SYNT_NETLOGON_V1, PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, - { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, - { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, - { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } + /* client pipe , abstract syntax , server pipe , transfer syntax */ + { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_LSARPC , SYNT_LSARPC_V0_WIN2K , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_NETLOGON, SYNT_NETLOGON_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, + { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, + { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, + { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, + { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, + { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; /******************************************************************* -- cgit From 36ef82a52953384acedbd51f54ded9357fa8ca3e Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 4 Oct 2002 04:10:23 +0000 Subject: merge of new client side support the Win2k LSARPC UUID in rpcbind from APP_HEAD (This used to be commit 1cfd2ee433305e91e87804dd55d10e025d30a69e) --- source3/rpc_parse/parse_rpc.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 41e0b4cb5f..590268bed5 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -75,6 +75,15 @@ interface/version dce/rpc pipe identification }, 0x00 \ } +#define SYNT_LSARPC_V0_WIN2K \ +{ \ + { \ + 0x3919286a, 0xb10c, 0x11d0, \ + { 0x9b, 0xa8, 0x00, 0xc0, \ + 0x4f, 0xd9, 0x2e, 0xf5 } \ + }, 0x00 \ +} + #define SYNT_SAMR_V1 \ { \ { \ @@ -129,18 +138,24 @@ interface/version dce/rpc pipe identification }, 0x03 \ } +/* + * IMPORTANT!! If you update this structure, make sure to + * update the index #defines in smb.h. + */ + struct pipe_id_info pipe_names [] = { - /* client pipe , abstract syntax , server pipe , transfer syntax */ - { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_NETLOGON, SYNT_NETLOGON_V1, PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, - { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, - { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, - { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } + /* client pipe , abstract syntax , server pipe , transfer syntax */ + { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_LSARPC , SYNT_LSARPC_V0_WIN2K , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_NETLOGON, SYNT_NETLOGON_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, + { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, + { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, + { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, + { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, + { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; /******************************************************************* -- cgit From d2ea6d5ae759bd2c842b5836d778b5a52b8af477 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 4 Oct 2002 19:11:36 +0000 Subject: merge of working dsrolegetprimdominfo() client code from APP_HEAD (This used to be commit f70caa25e4ee198151b915cf2bc0a26b2d0e243d) --- source3/rpc_parse/parse_ds.c | 113 ++++++++++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_rpc.c | 4 +- 2 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 source3/rpc_parse/parse_ds.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c new file mode 100644 index 0000000000..ec5ea45cc8 --- /dev/null +++ b/source3/rpc_parse/parse_ds.c @@ -0,0 +1,113 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * Copyright (C) Gerald Carter 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 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "includes.h" + +static BOOL ds_io_dominfobasic( char *desc, prs_struct *ps, int depth, DSROLE_PRIMARY_DOMAIN_INFO_BASIC **basic) +{ + DSROLE_PRIMARY_DOMAIN_INFO_BASIC *p = *basic; + + if ( UNMARSHALLING(ps) ) + p = *basic = (DSROLE_PRIMARY_DOMAIN_INFO_BASIC *)prs_alloc_mem(ps, sizeof(DSROLE_PRIMARY_DOMAIN_INFO_BASIC)); + + if ( !p ) + return False; + + if ( !prs_uint16("machine_role", ps, depth, &p->machine_role) ) + return False; + if ( !prs_uint16("unknown", ps, depth, &p->unknown) ) + 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 ( !prs_uint8s(False, "domain_guid", ps, depth, p->domain_guid.info, GUID_SIZE) ) + return False; + + if ( !smb_io_unistr2( "netbios_domain", &p->netbios_domain, p->netbios_ptr, ps, depth) ) + return False; + if ( !smb_io_unistr2( "dns_domain", &p->dns_domain, p->dnsname_ptr, ps, depth) ) + return False; + if ( !smb_io_unistr2( "forest_domain", &p->forest_domain, p->forestname_ptr, ps, depth) ) + return False; + + return True; + +} + +BOOL ds_io_q_getprimdominfo( 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( 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", ps, depth, &r_u->info.basic ) ) + 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; +} diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 590268bed5..247c83aecd 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -75,7 +75,7 @@ interface/version dce/rpc pipe identification }, 0x00 \ } -#define SYNT_LSARPC_V0_WIN2K \ +#define SYNT_LSARPC_V0_DS \ { \ { \ 0x3919286a, 0xb10c, 0x11d0, \ @@ -147,7 +147,7 @@ struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_LSARPC , SYNT_LSARPC_V0_WIN2K , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_LSARPC , SYNT_LSARPC_V0_DS , PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_NETLOGON, SYNT_NETLOGON_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, -- cgit From 9c1b62c0fd06cc65853269db3c63b169daa90664 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 4 Oct 2002 19:33:41 +0000 Subject: merge of working dsrolegetprimdominfo() client code from APP_HEAD (This used to be commit 028477e35208e76fedbc7c743426fd9be94b7cf0) --- source3/rpc_parse/parse_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 590268bed5..247c83aecd 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -75,7 +75,7 @@ interface/version dce/rpc pipe identification }, 0x00 \ } -#define SYNT_LSARPC_V0_WIN2K \ +#define SYNT_LSARPC_V0_DS \ { \ { \ 0x3919286a, 0xb10c, 0x11d0, \ @@ -147,7 +147,7 @@ struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_LSARPC , SYNT_LSARPC_V0_WIN2K , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_LSARPC , SYNT_LSARPC_V0_DS , PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_NETLOGON, SYNT_NETLOGON_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, -- cgit From 783df79b34cf169ec56642f2b4d30a5287025284 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 5 Oct 2002 13:19:50 +0000 Subject: missing prs_align()'s (This used to be commit 33f4a2fe1c3202a04acbeb8e78515082e6b88dfd) --- source3/rpc_parse/parse_ds.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index ec5ea45cc8..3c70cabc71 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -50,10 +50,19 @@ static BOOL ds_io_dominfobasic( char *desc, prs_struct *ps, int depth, DSROLE_PR 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; -- cgit From 0040de451eedfb731c68f2de00cde1b0dc82fbbe Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 5 Oct 2002 13:20:06 +0000 Subject: missing prs_align()'s (This used to be commit f149a5a54722fe05c8e30cb217cc72cec6f34e18) --- source3/rpc_parse/parse_ds.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index ec5ea45cc8..3c70cabc71 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -50,10 +50,19 @@ static BOOL ds_io_dominfobasic( char *desc, prs_struct *ps, int depth, DSROLE_PR 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; -- cgit From 4ac9ccfde4d36e3b6065c65c92dd02dddb78b4f2 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 12 Oct 2002 03:38:07 +0000 Subject: Nice *big* patch from metze. The actual design change is relitivly small however: It all goes back to jerry's 'BOOL store', added to many of the elements in a SAM_ACCOUNT. This ensured that smb.conf defaults did not get 'fixed' into ldap. This was a great win for admins, and this patch follows in the same way. This patch extends the concept - we don't store values back into LDAP unless they have been changed. So if we read a value, but don't update it, or we read a value, find it's not there and use a default, we will not update ldap with that value. This reduced clutter in our LDAP DB, and makes it easier to change defaults later on. Metze's particular problem was that when we 'write back' an unchanged value, we would clear any muliple values in that feild. Now he can still have his mulitivalued 'uid' feild, without Samba changing it for *every* other operation. This also applies to many other attributes, and helps to eliminate a nasty race condition. (Time between get and set) This patch is big, and needs more testing, but metze has tested usrmgr, and I've fixed some pdbedit bugs, and tested domain joins, so it isn't compleatly flawed ;-). The same system will be introduced into the SAM code shortly, but this fixes bugs that people were coming across in production uses of Samba 3.0/HEAD, hence it's inclusion here. Andrew Bartlett (This used to be commit 7f237bde212eb188df84a5d8adb598a93fba8155) --- source3/rpc_parse/parse_samr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ddf51fcf0b..6b96b79047 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6061,11 +6061,11 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * usr->user_rid = user_rid; usr->group_rid = group_rid; usr->acb_info = pdb_get_acct_ctrl(pw); - usr->unknown_3 = pdb_get_unknown3(pw); + usr->unknown_3 = pdb_get_unknown_3(pw); usr->logon_divs = pdb_get_logon_divs(pw); usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0; - usr->unknown_5 = pdb_get_unknown5(pw); /* 0x0002 0000 */ + usr->unknown_5 = pdb_get_unknown_5(pw); /* 0x0002 0000 */ if (pdb_get_pass_must_change_time(pw) == 0) { usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON; @@ -6088,7 +6088,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * init_unistr2(&usr->uni_unknown_str, NULL, len_unknown_str); init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial); - usr->unknown_6 = pdb_get_unknown6(pw); + usr->unknown_6 = pdb_get_unknown_6(pw); usr->padding4 = 0; if (pdb_get_hours(pw)) { -- cgit From b1aba7b03b1df1dad779c21445a74b56696efdc0 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 17 Oct 2002 06:39:44 +0000 Subject: When unmarshalling a relstr, don't unmarshall the string data if the offset is zero. Previously we were jumping to the start of the parse buffer (i.e offset zero) and reading string data until we hit a terminating NULL. Test case: in a PRINTER_INFO_0 structure, the servername field may be NULL when doing an enumprinters with flags = PRINTER_ENUM_LOCAL. (This used to be commit e62c6bf066c2242aae605ba707c9775b37bcaca3) --- source3/rpc_parse/parse_spoolss.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 783dd97ebf..32f0c3a369 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2097,6 +2097,9 @@ static BOOL smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *str if (!prs_uint32("offset", ps, depth, &(buffer->string_at_end))) return False; + if (buffer->string_at_end == 0) + return True; + old_offset = prs_offset(ps); if(!prs_set_offset(ps, buffer->string_at_end+buffer->struct_start)) return False; -- cgit From 788ca8b1185e3624ca623baade05e86f9114e69f Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 17 Oct 2002 06:44:33 +0000 Subject: Merge NULL relstr fix from HEAD. (This used to be commit 0f2ddfcd95acec964a3a7652968c9469ac486814) --- source3/rpc_parse/parse_spoolss.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 783dd97ebf..32f0c3a369 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2097,6 +2097,9 @@ static BOOL smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *str if (!prs_uint32("offset", ps, depth, &(buffer->string_at_end))) return False; + if (buffer->string_at_end == 0) + return True; + old_offset = prs_offset(ps); if(!prs_set_offset(ps, buffer->string_at_end+buffer->struct_start)) return False; -- cgit From 0c35d7863293090925ee862285d844936dc38a94 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Oct 2002 07:50:48 +0000 Subject: This fixes some bugs for NT4 usrmgr.exe Volker (This used to be commit 32d6bcf3acefc77873a7241cc0c7e26241a65301) --- source3/rpc_parse/parse_samr.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 6b96b79047..08ed28e80a 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6061,7 +6061,17 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * usr->user_rid = user_rid; usr->group_rid = group_rid; usr->acb_info = pdb_get_acct_ctrl(pw); - usr->unknown_3 = pdb_get_unknown_3(pw); + + /* + Look at a user on a real NT4 PDC with usrmgr, press + 'ok'. Then you will see that unknown_3 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->unknown_3 = 0x00ffffff; usr->logon_divs = pdb_get_logon_divs(pw); usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0; -- cgit From 6d7195d1d79c43f5ccc8dc4a9215c02177d5fa89 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 2 Nov 2002 03:47:48 +0000 Subject: Merge passdb from HEAD -> 3.0 The work here includes: - metze' set/changed patch, which avoids making changes to ldap on unmodified attributes. - volker's group mapping in passdb patch - volker's samsync stuff - volkers SAMR changes. - mezte's connection caching patch - my recent changes (fix magic root check, ldap ssl) Andrew Bartlett (This used to be commit 2044d60bbe0043cdbb9aba931115672bde975d2f) --- source3/rpc_parse/parse_samr.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ddf51fcf0b..08ed28e80a 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6061,11 +6061,21 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * usr->user_rid = user_rid; usr->group_rid = group_rid; usr->acb_info = pdb_get_acct_ctrl(pw); - usr->unknown_3 = pdb_get_unknown3(pw); + + /* + Look at a user on a real NT4 PDC with usrmgr, press + 'ok'. Then you will see that unknown_3 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->unknown_3 = 0x00ffffff; usr->logon_divs = pdb_get_logon_divs(pw); usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0; - usr->unknown_5 = pdb_get_unknown5(pw); /* 0x0002 0000 */ + usr->unknown_5 = pdb_get_unknown_5(pw); /* 0x0002 0000 */ if (pdb_get_pass_must_change_time(pw) == 0) { usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON; @@ -6088,7 +6098,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * init_unistr2(&usr->uni_unknown_str, NULL, len_unknown_str); init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial); - usr->unknown_6 = pdb_get_unknown6(pw); + usr->unknown_6 = pdb_get_unknown_6(pw); usr->padding4 = 0; if (pdb_get_hours(pw)) { -- cgit From 904649b6f08996cb61cd045e9c131bbae499ed44 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 6 Nov 2002 23:38:39 +0000 Subject: Client side functions for enumprinterkey. (This used to be commit f56ce473b6964302ba51fc9796ee919738731065) --- source3/rpc_parse/parse_spoolss.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 32f0c3a369..15cd243f89 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7014,6 +7014,20 @@ BOOL spoolss_io_r_setprinterdataex(char *desc, SPOOL_R_SETPRINTERDATAEX *r_u, pr return True; } +/******************************************************************* + * read a structure. + ********************************************************************/ +BOOL make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u, + POLICY_HND *hnd, char *key, uint32 size) +{ + DEBUG(5,("make_spoolss_q_enumprinterkey\n")); + + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + init_unistr2(&q_u->key, key, strlen(key)+1); + q_u->size = size; + + return True; +} /******************************************************************* * read a structure. @@ -7068,6 +7082,21 @@ BOOL spoolss_io_r_enumprinterkey(char *desc, SPOOL_R_ENUMPRINTERKEY *r_u, prs_st return True; } +/******************************************************************* + * read a structure. + ********************************************************************/ + +BOOL make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY *q_u, + POLICY_HND *hnd, char *keyname) +{ + DEBUG(5,("make_spoolss_q_deleteprinterkey\n")); + + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + init_unistr2(&q_u->keyname, keyname, strlen(keyname)+1); + + return True; +} + /******************************************************************* * read a structure. ********************************************************************/ -- cgit From 1ae7b1395f59e5aa8988ffeed2dfe1895eba8187 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 6 Nov 2002 23:43:21 +0000 Subject: For a BUFFER5, don't parse the buffer if the buffer length is zero. (This used to be commit 28871bb6969ca70aabcc622410dd1fc5addcceca) --- source3/rpc_parse/parse_misc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 3dd9c3bc2a..c20fb85582 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -685,9 +685,10 @@ BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) if(!prs_uint32("buf_len", ps, depth, &buf5->buf_len)) return False; - - if(!prs_buffer5(True, "buffer" , ps, depth, buf5)) - return False; + if(buf5->buf_len) { + if(!prs_buffer5(True, "buffer" , ps, depth, buf5)) + return False; + } return True; } -- cgit From 93042487882d8b2407541ad21d2e9bc2b59142e5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 7 Nov 2002 02:15:35 +0000 Subject: Merge of scalable printing code fix... Needs testing. Jeremy. (This used to be commit d030df76439c72825d68410211e62090438cef54) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 32f0c3a369..d8cd7c1729 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7628,7 +7628,7 @@ BOOL make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX *q_u, ********************************************************************/ BOOL make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle, - uint32 flags, uint32 options, char *localmachine, + uint32 flags, uint32 options, const char *localmachine, uint32 printerlocal, SPOOL_NOTIFY_OPTION *option) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); -- cgit From 47955b2f6cd10ac690705d322a8862c23f18072c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 7 Nov 2002 02:38:42 +0000 Subject: Merge of scalable printing code fix... Needs testing. Also tidied up some of Richard's code (I don't think he uses the compiler flags -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual like I do :-) :-). Jeremy. (This used to be commit 10024ed06e9d91f24fdc78d59eef2f76bf395438) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 15cd243f89..91322a8fae 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7657,7 +7657,7 @@ BOOL make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX *q_u, ********************************************************************/ BOOL make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle, - uint32 flags, uint32 options, char *localmachine, + uint32 flags, uint32 options, const char *localmachine, uint32 printerlocal, SPOOL_NOTIFY_OPTION *option) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); -- cgit From 9108f68df330bf2dfa9e6591ab65e98408906d1a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 7 Nov 2002 07:08:04 +0000 Subject: Being tpot's janitor again.... checking in things only checked into HEAD. We are meant to be keeping 3.0 up to date... Jeremy. (This used to be commit a4c8c8f3b767f0cd4c1fa977efe8bfcd3de980d0) --- source3/rpc_parse/parse_misc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 3dd9c3bc2a..c20fb85582 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -685,9 +685,10 @@ BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) if(!prs_uint32("buf_len", ps, depth, &buf5->buf_len)) return False; - - if(!prs_buffer5(True, "buffer" , ps, depth, buf5)) - return False; + if(buf5->buf_len) { + if(!prs_buffer5(True, "buffer" , ps, depth, buf5)) + return False; + } return True; } -- cgit From 397873f0c4350c63a121479a549410364bd9e29a Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Fri, 8 Nov 2002 20:36:31 +0000 Subject: Sync with HEAD to get enumprinterkey api. (This used to be commit f6e21ba4c724f77586ef428f82126d209b0a9607) --- source3/rpc_parse/parse_spoolss.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index d8cd7c1729..91322a8fae 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7014,6 +7014,20 @@ BOOL spoolss_io_r_setprinterdataex(char *desc, SPOOL_R_SETPRINTERDATAEX *r_u, pr return True; } +/******************************************************************* + * read a structure. + ********************************************************************/ +BOOL make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u, + POLICY_HND *hnd, char *key, uint32 size) +{ + DEBUG(5,("make_spoolss_q_enumprinterkey\n")); + + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + init_unistr2(&q_u->key, key, strlen(key)+1); + q_u->size = size; + + return True; +} /******************************************************************* * read a structure. @@ -7068,6 +7082,21 @@ BOOL spoolss_io_r_enumprinterkey(char *desc, SPOOL_R_ENUMPRINTERKEY *r_u, prs_st return True; } +/******************************************************************* + * read a structure. + ********************************************************************/ + +BOOL make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY *q_u, + POLICY_HND *hnd, char *keyname) +{ + DEBUG(5,("make_spoolss_q_deleteprinterkey\n")); + + memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); + init_unistr2(&q_u->keyname, keyname, strlen(keyname)+1); + + return True; +} + /******************************************************************* * read a structure. ********************************************************************/ -- cgit From 250c9801197ea1c949bd94c1c891f81ab118b130 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 12 Nov 2002 23:15:52 +0000 Subject: Removed global_myworkgroup, global_myname, global_myscope. Added liberal dashes of const. This is a rather large check-in, some things may break. It does compile though :-). Jeremy. (This used to be commit 82b8f749a36b42e22186297482aad2abb04fab8a) --- source3/rpc_parse/parse_misc.c | 31 +++++++++++++++---------------- source3/rpc_parse/parse_net.c | 31 +++++++++++++++++-------------- source3/rpc_parse/parse_rpc.c | 4 ++-- source3/rpc_parse/parse_samr.c | 4 ++-- source3/rpc_parse/parse_srv.c | 12 ++++++------ 5 files changed, 42 insertions(+), 40 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index c20fb85582..5dcb49d399 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -244,14 +244,13 @@ BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) identauth >= 2^32 can be detected because it will be specified in hex ********************************************************************/ -void init_dom_sid(DOM_SID *sid, char *str_sid) +void init_dom_sid(DOM_SID *sid, const char *str_sid) { pstring domsid; int identauth; char *p; - if (str_sid == NULL) - { + if (str_sid == NULL) { DEBUG(4,("netlogon domain SID: none\n")); sid->sid_rev_num = 0; sid->num_auths = 0; @@ -592,7 +591,7 @@ void init_buffer3_uint32(BUFFER3 *str, uint32 val) Inits a BUFFER3 structure. ********************************************************************/ -void init_buffer3_str(BUFFER3 *str, char *buf, int len) +void init_buffer3_str(BUFFER3 *str, const char *buf, int len) { ZERO_STRUCTP(str); @@ -610,7 +609,7 @@ void init_buffer3_str(BUFFER3 *str, char *buf, int len) Inits a BUFFER3 structure from a hex string. ********************************************************************/ -void init_buffer3_hex(BUFFER3 *str, char *buf) +void init_buffer3_hex(BUFFER3 *str, const char *buf) { ZERO_STRUCTP(str); create_buffer3(str, strlen(buf)); @@ -697,7 +696,7 @@ BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) Inits a BUFFER2 structure. ********************************************************************/ -void init_buffer2(BUFFER2 *str, uint8 *buf, int len) +void init_buffer2(BUFFER2 *str, const uint8 *buf, int len) { ZERO_STRUCTP(str); @@ -963,7 +962,7 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) /******************************************************************* Inits a UNISTR2 structure from a UNISTR ********************************************************************/ -void init_unistr2_from_unistr (UNISTR2 *to, UNISTR *from) +void init_unistr2_from_unistr (UNISTR2 *to, const UNISTR *from) { uint32 i; @@ -1138,7 +1137,7 @@ void init_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid) Inits a DOM_CLNT_SRV structure. ********************************************************************/ -static void init_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) +static void init_clnt_srv(DOM_CLNT_SRV *log, const char *logon_srv, const char *comp_name) { DEBUG(5,("init_clnt_srv: %d\n", __LINE__)); @@ -1292,16 +1291,16 @@ BOOL smb_io_cred(char *desc, DOM_CRED *cred, prs_struct *ps, int depth) ********************************************************************/ void init_clnt_info2(DOM_CLNT_INFO2 *clnt, - char *logon_srv, char *comp_name, - DOM_CRED *clnt_cred) + const char *logon_srv, const char *comp_name, + const DOM_CRED *clnt_cred) { DEBUG(5,("make_clnt_info: %d\n", __LINE__)); - init_clnt_srv(&(clnt->login), logon_srv, comp_name); + init_clnt_srv(&clnt->login, logon_srv, comp_name); if (clnt_cred != NULL) { clnt->ptr_cred = 1; - memcpy(&(clnt->cred), clnt_cred, sizeof(clnt->cred)); + memcpy(&clnt->cred, clnt_cred, sizeof(clnt->cred)); } else { clnt->ptr_cred = 0; } @@ -1341,9 +1340,9 @@ BOOL smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int dep ********************************************************************/ void init_clnt_info(DOM_CLNT_INFO *clnt, - char *logon_srv, char *acct_name, - uint16 sec_chan, char *comp_name, - DOM_CRED *cred) + const char *logon_srv, const char *acct_name, + uint16 sec_chan, const char *comp_name, + const DOM_CRED *cred) { DEBUG(5,("make_clnt_info\n")); @@ -1413,7 +1412,7 @@ BOOL smb_io_logon_id(char *desc, DOM_LOGON_ID *log, prs_struct *ps, int depth) Inits an OWF_INFO structure. ********************************************************************/ -void init_owf_info(OWF_INFO *hash, uint8 data[16]) +void init_owf_info(OWF_INFO *hash, const uint8 data[16]) { DEBUG(5,("init_owf_info: %d\n", __LINE__)); diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index e0f710b2d7..c140a1fe01 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -134,7 +134,7 @@ static BOOL net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, ********************************************************************/ static void init_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, - uint32 tc_status, char *trusted_dc_name) + uint32 tc_status, const char *trusted_dc_name) { int len_dc_name = strlen(trusted_dc_name); info->flags = flags; @@ -221,7 +221,7 @@ BOOL net_io_q_logon_ctrl2(char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, in Inits an NET_Q_LOGON_CTRL2 structure. ********************************************************************/ -void init_net_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, char *srv_name, +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")); @@ -240,7 +240,7 @@ void init_net_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, char *srv_name, 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, - char *trusted_domain_name) + const char *trusted_domain_name) { DEBUG(5,("init_r_logon_ctrl2\n")); @@ -352,7 +352,7 @@ BOOL net_io_q_logon_ctrl(char *desc, NET_Q_LOGON_CTRL *q_l, prs_struct *ps, Inits an NET_Q_LOGON_CTRL structure. ********************************************************************/ -void init_net_q_logon_ctrl(NET_Q_LOGON_CTRL *q_l, char *srv_name, +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")); @@ -430,7 +430,7 @@ BOOL net_io_r_logon_ctrl(char *desc, NET_R_LOGON_CTRL *r_l, prs_struct *ps, ********************************************************************/ void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, - uint32 num_doms, char *dom_name) + uint32 num_doms, const char *dom_name) { int i = 0; @@ -791,8 +791,10 @@ BOOL net_io_r_auth_3(char *desc, NET_R_AUTH_3 *r_a, prs_struct *ps, int depth) Inits a NET_Q_SRV_PWSET. ********************************************************************/ -void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char *logon_srv, char *sess_key, char *acct_name, - uint16 sec_chan, char *comp_name, DOM_CRED *cred, uchar hashed_mach_pwd[16]) +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, uchar hashed_mach_pwd[16]) { unsigned char nt_cypher[16]; @@ -857,9 +859,9 @@ BOOL net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int de Init DOM_SID2 array from a string containing multiple sids *************************************************************************/ -static int init_dom_sid2s(TALLOC_CTX *ctx, char *sids_str, DOM_SID2 **ppsids) +static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsids) { - char *ptr; + const char *ptr; pstring s2; int count = 0; @@ -898,10 +900,10 @@ static int init_dom_sid2s(TALLOC_CTX *ctx, char *sids_str, DOM_SID2 **ppsids) Inits a NET_ID_INFO_1 structure. ********************************************************************/ -void init_id_info1(NET_ID_INFO_1 *id, char *domain_name, +void init_id_info1(NET_ID_INFO_1 *id, const char *domain_name, uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, - char *user_name, char *wksta_name, - char *sess_key, + const char *user_name, const char *wksta_name, + const char *sess_key, unsigned char lm_cypher[16], unsigned char nt_cypher[16]) { int len_domain_name = strlen(domain_name); @@ -1143,7 +1145,8 @@ static BOOL net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int ********************************************************************/ void init_sam_info(DOM_SAM_INFO *sam, - char *logon_srv, char *comp_name, DOM_CRED *clnt_cred, + const char *logon_srv, const char *comp_name, + DOM_CRED *clnt_cred, DOM_CRED *rtn_cred, uint16 logon_level, NET_ID_INFO_CTR *ctr) { @@ -1270,7 +1273,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, uint32 num_groups, const DOM_GID *gids, uint32 user_flgs, uchar *sess_key, const char *logon_srv, const char *logon_dom, - const DOM_SID *dom_sid, char *other_sids) + const DOM_SID *dom_sid, const char *other_sids) { /* only cope with one "other" sid, right now. */ /* need to count the number of space-delimited sids */ diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 247c83aecd..e8825a2e14 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -697,7 +697,7 @@ BOOL smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps void init_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, uint32 neg_flgs, - fstring myname, fstring domain) + const char *myname, const char *domain) { int len_myname = strlen(myname); int len_domain = strlen(domain); @@ -836,7 +836,7 @@ BOOL smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_st void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, uchar lm_resp[24], uchar nt_resp[24], - char *domain, char *user, char *wks, + const char *domain, const char *user, const char *wks, uint32 neg_flags) { uint32 offset; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 08ed28e80a..d5ca78bda4 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -631,7 +631,7 @@ static BOOL sam_io_unk_info12(char *desc, SAM_UNK_INFO_12 * u_12, /******************************************************************* inits a structure. ********************************************************************/ -void init_unk_info5(SAM_UNK_INFO_5 * u_5,char *server) +void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *server) { int len_server = strlen(server); @@ -666,7 +666,7 @@ static BOOL sam_io_unk_info5(char *desc, SAM_UNK_INFO_5 * u_5, inits a structure. ********************************************************************/ void init_unk_info2(SAM_UNK_INFO_2 * u_2, - char *domain, char *server, + const char *domain, const char *server, uint32 seq_num, uint32 num_users, uint32 num_groups, uint32 num_alias) { int len_domain = strlen(domain); diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 672db36a28..b3d33645b9 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -2686,7 +2686,7 @@ BOOL srv_io_r_net_file_close(char *desc, SRV_R_NET_FILE_CLOSE *q_n, Inits a SRV_INFO_100 structure. ********************************************************************/ -void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, char *name) +void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, const char *name) { DEBUG(5,("init_srv_info_100\n")); @@ -2725,9 +2725,9 @@ static BOOL srv_io_info_100(char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int Inits a SRV_INFO_101 structure. ********************************************************************/ -void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name, +void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, const char *name, uint32 ver_major, uint32 ver_minor, - uint32 srv_type, char *comment) + uint32 srv_type, const char *comment) { DEBUG(5,("init_srv_info_101\n")); @@ -2782,11 +2782,11 @@ static BOOL srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int Inits a SRV_INFO_102 structure. ********************************************************************/ -void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name, - char *comment, uint32 ver_major, uint32 ver_minor, +void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, const char *name, + const char *comment, uint32 ver_major, uint32 ver_minor, uint32 srv_type, uint32 users, uint32 disc, uint32 hidden, uint32 announce, uint32 ann_delta, uint32 licenses, - char *usr_path) + const char *usr_path) { DEBUG(5,("init_srv_info_102\n")); -- cgit From 2f194322d419350f35a48dff750066894d68eccf Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 12 Nov 2002 23:20:50 +0000 Subject: Removed global_myworkgroup, global_myname, global_myscope. Added liberal dashes of const. This is a rather large check-in, some things may break. It does compile though :-). Jeremy. (This used to be commit f755711df8f74f9b8e8c1a2b0d07d02a931eeb89) --- source3/rpc_parse/parse_misc.c | 31 +++++++++++++++---------------- source3/rpc_parse/parse_net.c | 31 +++++++++++++++++-------------- source3/rpc_parse/parse_rpc.c | 4 ++-- source3/rpc_parse/parse_samr.c | 4 ++-- source3/rpc_parse/parse_srv.c | 12 ++++++------ 5 files changed, 42 insertions(+), 40 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index c20fb85582..5dcb49d399 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -244,14 +244,13 @@ BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) identauth >= 2^32 can be detected because it will be specified in hex ********************************************************************/ -void init_dom_sid(DOM_SID *sid, char *str_sid) +void init_dom_sid(DOM_SID *sid, const char *str_sid) { pstring domsid; int identauth; char *p; - if (str_sid == NULL) - { + if (str_sid == NULL) { DEBUG(4,("netlogon domain SID: none\n")); sid->sid_rev_num = 0; sid->num_auths = 0; @@ -592,7 +591,7 @@ void init_buffer3_uint32(BUFFER3 *str, uint32 val) Inits a BUFFER3 structure. ********************************************************************/ -void init_buffer3_str(BUFFER3 *str, char *buf, int len) +void init_buffer3_str(BUFFER3 *str, const char *buf, int len) { ZERO_STRUCTP(str); @@ -610,7 +609,7 @@ void init_buffer3_str(BUFFER3 *str, char *buf, int len) Inits a BUFFER3 structure from a hex string. ********************************************************************/ -void init_buffer3_hex(BUFFER3 *str, char *buf) +void init_buffer3_hex(BUFFER3 *str, const char *buf) { ZERO_STRUCTP(str); create_buffer3(str, strlen(buf)); @@ -697,7 +696,7 @@ BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) Inits a BUFFER2 structure. ********************************************************************/ -void init_buffer2(BUFFER2 *str, uint8 *buf, int len) +void init_buffer2(BUFFER2 *str, const uint8 *buf, int len) { ZERO_STRUCTP(str); @@ -963,7 +962,7 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) /******************************************************************* Inits a UNISTR2 structure from a UNISTR ********************************************************************/ -void init_unistr2_from_unistr (UNISTR2 *to, UNISTR *from) +void init_unistr2_from_unistr (UNISTR2 *to, const UNISTR *from) { uint32 i; @@ -1138,7 +1137,7 @@ void init_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid) Inits a DOM_CLNT_SRV structure. ********************************************************************/ -static void init_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name) +static void init_clnt_srv(DOM_CLNT_SRV *log, const char *logon_srv, const char *comp_name) { DEBUG(5,("init_clnt_srv: %d\n", __LINE__)); @@ -1292,16 +1291,16 @@ BOOL smb_io_cred(char *desc, DOM_CRED *cred, prs_struct *ps, int depth) ********************************************************************/ void init_clnt_info2(DOM_CLNT_INFO2 *clnt, - char *logon_srv, char *comp_name, - DOM_CRED *clnt_cred) + const char *logon_srv, const char *comp_name, + const DOM_CRED *clnt_cred) { DEBUG(5,("make_clnt_info: %d\n", __LINE__)); - init_clnt_srv(&(clnt->login), logon_srv, comp_name); + init_clnt_srv(&clnt->login, logon_srv, comp_name); if (clnt_cred != NULL) { clnt->ptr_cred = 1; - memcpy(&(clnt->cred), clnt_cred, sizeof(clnt->cred)); + memcpy(&clnt->cred, clnt_cred, sizeof(clnt->cred)); } else { clnt->ptr_cred = 0; } @@ -1341,9 +1340,9 @@ BOOL smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int dep ********************************************************************/ void init_clnt_info(DOM_CLNT_INFO *clnt, - char *logon_srv, char *acct_name, - uint16 sec_chan, char *comp_name, - DOM_CRED *cred) + const char *logon_srv, const char *acct_name, + uint16 sec_chan, const char *comp_name, + const DOM_CRED *cred) { DEBUG(5,("make_clnt_info\n")); @@ -1413,7 +1412,7 @@ BOOL smb_io_logon_id(char *desc, DOM_LOGON_ID *log, prs_struct *ps, int depth) Inits an OWF_INFO structure. ********************************************************************/ -void init_owf_info(OWF_INFO *hash, uint8 data[16]) +void init_owf_info(OWF_INFO *hash, const uint8 data[16]) { DEBUG(5,("init_owf_info: %d\n", __LINE__)); diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index e0f710b2d7..c140a1fe01 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -134,7 +134,7 @@ static BOOL net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, ********************************************************************/ static void init_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, - uint32 tc_status, char *trusted_dc_name) + uint32 tc_status, const char *trusted_dc_name) { int len_dc_name = strlen(trusted_dc_name); info->flags = flags; @@ -221,7 +221,7 @@ BOOL net_io_q_logon_ctrl2(char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, in Inits an NET_Q_LOGON_CTRL2 structure. ********************************************************************/ -void init_net_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, char *srv_name, +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")); @@ -240,7 +240,7 @@ void init_net_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, char *srv_name, 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, - char *trusted_domain_name) + const char *trusted_domain_name) { DEBUG(5,("init_r_logon_ctrl2\n")); @@ -352,7 +352,7 @@ BOOL net_io_q_logon_ctrl(char *desc, NET_Q_LOGON_CTRL *q_l, prs_struct *ps, Inits an NET_Q_LOGON_CTRL structure. ********************************************************************/ -void init_net_q_logon_ctrl(NET_Q_LOGON_CTRL *q_l, char *srv_name, +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")); @@ -430,7 +430,7 @@ BOOL net_io_r_logon_ctrl(char *desc, NET_R_LOGON_CTRL *r_l, prs_struct *ps, ********************************************************************/ void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, - uint32 num_doms, char *dom_name) + uint32 num_doms, const char *dom_name) { int i = 0; @@ -791,8 +791,10 @@ BOOL net_io_r_auth_3(char *desc, NET_R_AUTH_3 *r_a, prs_struct *ps, int depth) Inits a NET_Q_SRV_PWSET. ********************************************************************/ -void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char *logon_srv, char *sess_key, char *acct_name, - uint16 sec_chan, char *comp_name, DOM_CRED *cred, uchar hashed_mach_pwd[16]) +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, uchar hashed_mach_pwd[16]) { unsigned char nt_cypher[16]; @@ -857,9 +859,9 @@ BOOL net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int de Init DOM_SID2 array from a string containing multiple sids *************************************************************************/ -static int init_dom_sid2s(TALLOC_CTX *ctx, char *sids_str, DOM_SID2 **ppsids) +static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsids) { - char *ptr; + const char *ptr; pstring s2; int count = 0; @@ -898,10 +900,10 @@ static int init_dom_sid2s(TALLOC_CTX *ctx, char *sids_str, DOM_SID2 **ppsids) Inits a NET_ID_INFO_1 structure. ********************************************************************/ -void init_id_info1(NET_ID_INFO_1 *id, char *domain_name, +void init_id_info1(NET_ID_INFO_1 *id, const char *domain_name, uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high, - char *user_name, char *wksta_name, - char *sess_key, + const char *user_name, const char *wksta_name, + const char *sess_key, unsigned char lm_cypher[16], unsigned char nt_cypher[16]) { int len_domain_name = strlen(domain_name); @@ -1143,7 +1145,8 @@ static BOOL net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int ********************************************************************/ void init_sam_info(DOM_SAM_INFO *sam, - char *logon_srv, char *comp_name, DOM_CRED *clnt_cred, + const char *logon_srv, const char *comp_name, + DOM_CRED *clnt_cred, DOM_CRED *rtn_cred, uint16 logon_level, NET_ID_INFO_CTR *ctr) { @@ -1270,7 +1273,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, uint32 num_groups, const DOM_GID *gids, uint32 user_flgs, uchar *sess_key, const char *logon_srv, const char *logon_dom, - const DOM_SID *dom_sid, char *other_sids) + const DOM_SID *dom_sid, const char *other_sids) { /* only cope with one "other" sid, right now. */ /* need to count the number of space-delimited sids */ diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 247c83aecd..e8825a2e14 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -697,7 +697,7 @@ BOOL smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps void init_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, uint32 neg_flgs, - fstring myname, fstring domain) + const char *myname, const char *domain) { int len_myname = strlen(myname); int len_domain = strlen(domain); @@ -836,7 +836,7 @@ BOOL smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_st void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, uchar lm_resp[24], uchar nt_resp[24], - char *domain, char *user, char *wks, + const char *domain, const char *user, const char *wks, uint32 neg_flags) { uint32 offset; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 08ed28e80a..d5ca78bda4 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -631,7 +631,7 @@ static BOOL sam_io_unk_info12(char *desc, SAM_UNK_INFO_12 * u_12, /******************************************************************* inits a structure. ********************************************************************/ -void init_unk_info5(SAM_UNK_INFO_5 * u_5,char *server) +void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *server) { int len_server = strlen(server); @@ -666,7 +666,7 @@ static BOOL sam_io_unk_info5(char *desc, SAM_UNK_INFO_5 * u_5, inits a structure. ********************************************************************/ void init_unk_info2(SAM_UNK_INFO_2 * u_2, - char *domain, char *server, + const char *domain, const char *server, uint32 seq_num, uint32 num_users, uint32 num_groups, uint32 num_alias) { int len_domain = strlen(domain); diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 672db36a28..b3d33645b9 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -2686,7 +2686,7 @@ BOOL srv_io_r_net_file_close(char *desc, SRV_R_NET_FILE_CLOSE *q_n, Inits a SRV_INFO_100 structure. ********************************************************************/ -void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, char *name) +void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, const char *name) { DEBUG(5,("init_srv_info_100\n")); @@ -2725,9 +2725,9 @@ static BOOL srv_io_info_100(char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int Inits a SRV_INFO_101 structure. ********************************************************************/ -void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, char *name, +void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, const char *name, uint32 ver_major, uint32 ver_minor, - uint32 srv_type, char *comment) + uint32 srv_type, const char *comment) { DEBUG(5,("init_srv_info_101\n")); @@ -2782,11 +2782,11 @@ static BOOL srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int Inits a SRV_INFO_102 structure. ********************************************************************/ -void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, char *name, - char *comment, uint32 ver_major, uint32 ver_minor, +void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, const char *name, + const char *comment, uint32 ver_major, uint32 ver_minor, uint32 srv_type, uint32 users, uint32 disc, uint32 hidden, uint32 announce, uint32 ann_delta, uint32 licenses, - char *usr_path) + const char *usr_path) { DEBUG(5,("init_srv_info_102\n")); -- cgit From de474974ea25df7738dd175126e3f1de0df47ea6 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 23 Nov 2002 02:52:36 +0000 Subject: Lots of fixes for error paths where tdb_fetch() data need freeing. Found via a post from Arcady Chernyak . Jeremy. (This used to be commit 5d5762d1787db4392d2dff16024097c638b2d494) --- source3/rpc_parse/parse_prs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 843be33187..d4a9ec3eda 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1274,7 +1274,8 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *me kbuf.dsize = strlen(keystr)+1; dbuf = tdb_fetch(tdb, kbuf); - if (!dbuf.dptr) return -1; + if (!dbuf.dptr) + return -1; ZERO_STRUCTP(ps); prs_init(ps, 0, mem_ctx, UNMARSHALL); -- cgit From f023d6129b7bf0d972f2bb9ecc025d316e55c8ae Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 23 Nov 2002 02:52:38 +0000 Subject: Lots of fixes for error paths where tdb_fetch() data need freeing. Found via a post from Arcady Chernyak . Jeremy. (This used to be commit 19f86f1f72aca924e9e320e20a175b5d21de45ad) --- source3/rpc_parse/parse_prs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 843be33187..d4a9ec3eda 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1274,7 +1274,8 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *me kbuf.dsize = strlen(keystr)+1; dbuf = tdb_fetch(tdb, kbuf); - if (!dbuf.dptr) return -1; + if (!dbuf.dptr) + return -1; ZERO_STRUCTP(ps); prs_init(ps, 0, mem_ctx, UNMARSHALL); -- cgit From 34c7d4803330248e19c08f9a3b29395369d4199f Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Tue, 3 Dec 2002 19:48:18 +0000 Subject: Support printer info 7, used for publishing (This used to be commit 3c9726454ea6beb8d5d308805caecb86395c7ad2) --- source3/rpc_parse/parse_spoolss.c | 63 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 91322a8fae..b3f136f757 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2658,6 +2658,26 @@ BOOL smb_io_printer_info_5(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_5 *info, return True; } +/******************************************************************* + Parse a PRINTER_INFO_7 structure. +********************************************************************/ + +BOOL smb_io_printer_info_7(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_7 *info, int depth) +{ + prs_struct *ps=&buffer->prs; + + prs_debug(ps, depth, desc, "smb_io_printer_info_7"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if (!smb_io_relstr("guid", buffer, depth, &info->guid)) + return False; + if (!prs_uint32("action", ps, depth, &info->action)) + return False; + return True; +} + /******************************************************************* Parse a PORT_INFO_1 structure. ********************************************************************/ @@ -3425,6 +3445,19 @@ uint32 spoolss_size_printer_info_3(PRINTER_INFO_3 *info) return the size required by a struct in the stream ********************************************************************/ +uint32 spoolss_size_printer_info_7(PRINTER_INFO_7 *info) +{ + uint32 size=0; + + size+=size_of_relative_string( &info->guid ); + size+=size_of_uint32( &info->action ); + return size; +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ + uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info) { int size=0; @@ -4826,6 +4859,24 @@ BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, p return True; } +BOOL spool_io_printer_info_level_7(char *desc, SPOOL_PRINTER_INFO_LEVEL_7 *il, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spool_io_printer_info_level_7"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("guid_ptr", ps, depth, &il->guid_ptr)) + return False; + if(!prs_uint32("action", ps, depth, &il->action)) + return False; + + if(!smb_io_unistr2("servername", &il->guid, il->guid_ptr, ps, depth)) + return False; + return True; +} + /******************************************************************* ********************************************************************/ @@ -4891,6 +4942,13 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s return False; break; } + case 7: + if (UNMARSHALLING(ps)) + if ((il->info_7=(SPOOL_PRINTER_INFO_LEVEL_7 *)prs_alloc_mem(ps,sizeof(SPOOL_PRINTER_INFO_LEVEL_7))) == NULL) + return False; + if (!spool_io_printer_info_level_7("", il->info_7, ps, depth)) + return False; + break; } return True; @@ -6505,6 +6563,11 @@ void free_printer_info_5(PRINTER_INFO_5 *printer) SAFE_FREE(printer); } +void free_printer_info_7(PRINTER_INFO_7 *printer) +{ + SAFE_FREE(printer); +} + void free_job_info_2(JOB_INFO_2 *job) { if (job!=NULL) -- cgit From b32000da509ab42e54f9ca38de66151443cf9018 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Tue, 3 Dec 2002 19:48:27 +0000 Subject: Support printer info 7, used for publishing (This used to be commit 60502d9d4274ddb3756b79593125544683c45908) --- source3/rpc_parse/parse_spoolss.c | 63 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 91322a8fae..b3f136f757 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2658,6 +2658,26 @@ BOOL smb_io_printer_info_5(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_5 *info, return True; } +/******************************************************************* + Parse a PRINTER_INFO_7 structure. +********************************************************************/ + +BOOL smb_io_printer_info_7(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_7 *info, int depth) +{ + prs_struct *ps=&buffer->prs; + + prs_debug(ps, depth, desc, "smb_io_printer_info_7"); + depth++; + + buffer->struct_start=prs_offset(ps); + + if (!smb_io_relstr("guid", buffer, depth, &info->guid)) + return False; + if (!prs_uint32("action", ps, depth, &info->action)) + return False; + return True; +} + /******************************************************************* Parse a PORT_INFO_1 structure. ********************************************************************/ @@ -3425,6 +3445,19 @@ uint32 spoolss_size_printer_info_3(PRINTER_INFO_3 *info) return the size required by a struct in the stream ********************************************************************/ +uint32 spoolss_size_printer_info_7(PRINTER_INFO_7 *info) +{ + uint32 size=0; + + size+=size_of_relative_string( &info->guid ); + size+=size_of_uint32( &info->action ); + return size; +} + +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ + uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info) { int size=0; @@ -4826,6 +4859,24 @@ BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, p return True; } +BOOL spool_io_printer_info_level_7(char *desc, SPOOL_PRINTER_INFO_LEVEL_7 *il, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spool_io_printer_info_level_7"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("guid_ptr", ps, depth, &il->guid_ptr)) + return False; + if(!prs_uint32("action", ps, depth, &il->action)) + return False; + + if(!smb_io_unistr2("servername", &il->guid, il->guid_ptr, ps, depth)) + return False; + return True; +} + /******************************************************************* ********************************************************************/ @@ -4891,6 +4942,13 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s return False; break; } + case 7: + if (UNMARSHALLING(ps)) + if ((il->info_7=(SPOOL_PRINTER_INFO_LEVEL_7 *)prs_alloc_mem(ps,sizeof(SPOOL_PRINTER_INFO_LEVEL_7))) == NULL) + return False; + if (!spool_io_printer_info_level_7("", il->info_7, ps, depth)) + return False; + break; } return True; @@ -6505,6 +6563,11 @@ void free_printer_info_5(PRINTER_INFO_5 *printer) SAFE_FREE(printer); } +void free_printer_info_7(PRINTER_INFO_7 *printer) +{ + SAFE_FREE(printer); +} + void free_job_info_2(JOB_INFO_2 *job) { if (job!=NULL) -- cgit From 24678bf421f8f9a4cca6e8c5a20d4ed392a10120 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 13 Dec 2002 04:41:59 +0000 Subject: Guy Harris points out that the level and ptr fields in a SPOOL_USER_CTR look like they should be transposed. We don't make use of the user level information (what is it used for??) so I haven't changed any code, just added a comment. (This used to be commit bbb0b2ee40acfeb8cd91a55feb1db0c1e2d9ced5) --- source3/rpc_parse/parse_spoolss.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b3f136f757..fb5c642824 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -615,6 +615,10 @@ static BOOL spool_io_user_level(char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, if (!prs_align(ps)) return False; + + /* From looking at many captures in ethereal, it looks like + the level and ptr fields should be transposed. -tpot */ + if (!prs_uint32("level", ps, depth, &q_u->level)) return False; if (!prs_uint32("ptr", ps, depth, &q_u->ptr)) -- cgit From 48461eb42a3435a552c06a01561a78299ade8660 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 20 Dec 2002 01:27:22 +0000 Subject: Merge of comment about apparent spoolss_io_user_info weirdness. (This used to be commit 872c152d35d5b7d1dc8a1d259c668f9bf42fc979) --- source3/rpc_parse/parse_spoolss.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b3f136f757..fb5c642824 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -615,6 +615,10 @@ static BOOL spool_io_user_level(char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, if (!prs_align(ps)) return False; + + /* From looking at many captures in ethereal, it looks like + the level and ptr fields should be transposed. -tpot */ + if (!prs_uint32("level", ps, depth, &q_u->level)) return False; if (!prs_uint32("ptr", ps, depth, &q_u->ptr)) -- cgit From ef8bd7c4f7ae8192ea05db070962ecf0ff3615f3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 20 Dec 2002 20:21:31 +0000 Subject: Forward port the change to talloc_init() to make all talloc contexts named. Ensure we can query them. Jeremy. (This used to be commit 09a218a9f6fb0bd922940467bf8500eb4f1bcf84) --- source3/rpc_parse/parse_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 5dcb49d399..86dd85066d 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -63,7 +63,7 @@ void main_loop_talloc_free(void) TALLOC_CTX *main_loop_talloc_get(void) { if (!main_loop_talloc) { - main_loop_talloc = talloc_init_named("main loop talloc (mainly parse_misc)"); + main_loop_talloc = talloc_init("main loop talloc (mainly parse_misc)"); if (!main_loop_talloc) smb_panic("main_loop_talloc: malloc fail\n"); } -- cgit From 7f23546730e49569d41a5edd0c47bb559c4f812d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 20 Dec 2002 20:23:06 +0000 Subject: Forward port the change to talloc_init() to make all talloc contexts named. Ensure we can query them. Jeremy. (This used to be commit 842e08e52a665ae678eea239759bb2de1a0d7b33) --- source3/rpc_parse/parse_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 5dcb49d399..86dd85066d 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -63,7 +63,7 @@ void main_loop_talloc_free(void) TALLOC_CTX *main_loop_talloc_get(void) { if (!main_loop_talloc) { - main_loop_talloc = talloc_init_named("main loop talloc (mainly parse_misc)"); + main_loop_talloc = talloc_init("main loop talloc (mainly parse_misc)"); if (!main_loop_talloc) smb_panic("main_loop_talloc: malloc fail\n"); } -- cgit From 54af5d0f252739240b933b61dffda445d1ca1337 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 23 Dec 2002 20:22:20 +0000 Subject: the 'padding' field in the query domain info reply is not a padding field at all. It seems to be an optional 12 byte structure of some kind. mkaplan found a situation where the structure was not present at all (depending on ptr_0) (This used to be commit d7f18c60f73a3acb00ec9b1f9c605cc8c9d690a7) --- source3/rpc_parse/parse_samr.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index d5ca78bda4..61b13d1350 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -745,8 +745,14 @@ static BOOL sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 * u_2, if(!prs_uint32("num_local_grps", ps, depth, &u_2->num_local_grps)) return False; - if(!prs_uint8s(False, "padding", ps, depth, u_2->padding,sizeof(u_2->padding))) - return False; + if (u_2->ptr_0) { + /* this was originally marked as 'padding'. It isn't + padding, it is some sort of optional 12 byte + structure. When it is present it contains zeros + !? */ + if(!prs_uint8s(False, "unknown", ps, depth, u_2->padding,sizeof(u_2->padding))) + return False; + } if(!smb_io_unistr2("uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth)) return False; -- cgit From 60667264b71d624ec45f567170b85589992567ed Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 30 Dec 2002 04:41:27 +0000 Subject: the shutdown call does not have a 16 bit flags, but 2 byte representing booleans this commit change the structure and code to reflect this some test revelead I'm right. some other revelead currently the abort shutdown does not work against my test machine even if it returns successfully ... need investigation (This used to be commit c5892b656dedd0367adc33d9606311d1dde99a58) --- source3/rpc_parse/parse_reg.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 2698e82440..7bb8a6e2b4 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1736,8 +1736,8 @@ BOOL reg_io_r_open_entry(char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int /******************************************************************* Inits a structure. ********************************************************************/ -void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, - const char *msg, uint32 timeout, uint16 flags) +void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, const char *msg, + uint32 timeout, BOOL reboot, BOOL force) { int msg_len; msg_len = strlen(msg); @@ -1750,7 +1750,9 @@ void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, init_unistr2(&(q_s->uni_msg), msg, msg_len); q_s->timeout = timeout; - q_s->flags = flags; + + q_s->reboot = reboot ? 1 : 0; + q_s->force = force ? 1 : 0; } @@ -1785,7 +1787,9 @@ BOOL reg_io_q_shutdown(char *desc, REG_Q_SHUTDOWN * q_s, prs_struct *ps, if (!prs_uint32("timeout", ps, depth, &(q_s->timeout))) return False; - if (!prs_uint16("flags ", ps, depth, &(q_s->flags))) + if (!prs_uint8("force ", ps, depth, &(q_s->force))) + return False; + if (!prs_uint8("reboot ", ps, depth, &(q_s->reboot))) return False; return True; -- cgit From bb9c3a01e7b1c0c3fa25dd60a09bf2635ae5daf2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 31 Dec 2002 02:26:15 +0000 Subject: Merge tridge's fix : the 'padding' field in the query domain info reply is not a padding field at all. It seems to be an optional 12 byte structure of some kind. mkaplan found a situation where the structure was not present at all (depending on ptr_0) Jeremy. (This used to be commit 3b453a596323867d4954b688dc3d83201096a447) --- source3/rpc_parse/parse_samr.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index d5ca78bda4..61b13d1350 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -745,8 +745,14 @@ static BOOL sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 * u_2, if(!prs_uint32("num_local_grps", ps, depth, &u_2->num_local_grps)) return False; - if(!prs_uint8s(False, "padding", ps, depth, u_2->padding,sizeof(u_2->padding))) - return False; + if (u_2->ptr_0) { + /* this was originally marked as 'padding'. It isn't + padding, it is some sort of optional 12 byte + structure. When it is present it contains zeros + !? */ + if(!prs_uint8s(False, "unknown", ps, depth, u_2->padding,sizeof(u_2->padding))) + return False; + } if(!smb_io_unistr2("uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth)) return False; -- cgit From 6d66fb308ab85bd9691d541764e683e6040cf724 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 2 Jan 2003 09:07:17 +0000 Subject: BIG patch... This patch makes Samba compile cleanly with -Wwrite-strings. - That is, all string literals are marked as 'const'. These strings are always read only, this just marks them as such for passing to other functions. What is most supprising is that I didn't need to change more than a few lines of code (all in 'net', which got a small cleanup of net.h and extern variables). The rest is just adding a lot of 'const'. As far as I can tell, I have not added any new warnings - apart from making all of tdbutil.c's function const (so they warn for adding that const string to struct). Andrew Bartlett (This used to be commit 92a777d0eaa4fb3a1c7835816f93c6bdd456816d) --- source3/rpc_parse/parse_dfs.c | 24 +-- source3/rpc_parse/parse_ds.c | 6 +- source3/rpc_parse/parse_lsa.c | 126 +++++++------- source3/rpc_parse/parse_misc.c | 68 ++++---- source3/rpc_parse/parse_net.c | 92 +++++------ source3/rpc_parse/parse_prs.c | 44 ++--- source3/rpc_parse/parse_reg.c | 80 ++++----- source3/rpc_parse/parse_rpc.c | 44 ++--- source3/rpc_parse/parse_samr.c | 274 +++++++++++++++---------------- source3/rpc_parse/parse_sec.c | 10 +- source3/rpc_parse/parse_spoolss.c | 337 +++++++++++++++++++------------------- source3/rpc_parse/parse_srv.c | 212 ++++++++++++------------ source3/rpc_parse/parse_wks.c | 6 +- 13 files changed, 662 insertions(+), 661 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index 38633ac0f7..ccd6d429fa 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -41,7 +41,7 @@ void init_dfs_q_dfs_exist(DFS_Q_DFS_EXIST *q_d) Read/write a DFS_Q_DFS_EXIST structure - dummy... ************************************************************/ -BOOL dfs_io_q_dfs_exist(char *desc, DFS_Q_DFS_EXIST *q_d, prs_struct *ps, int depth) +BOOL dfs_io_q_dfs_exist(const char *desc, DFS_Q_DFS_EXIST *q_d, prs_struct *ps, int depth) { if(q_d == NULL) return False; @@ -55,7 +55,7 @@ BOOL dfs_io_q_dfs_exist(char *desc, DFS_Q_DFS_EXIST *q_d, prs_struct *ps, int de Read/write a DFS_R_DFS_EXIST structure ************************************************************/ -BOOL dfs_io_r_dfs_exist(char *desc, DFS_R_DFS_EXIST *q_d, prs_struct *ps, int depth) +BOOL dfs_io_r_dfs_exist(const char *desc, DFS_R_DFS_EXIST *q_d, prs_struct *ps, int depth) { if(q_d == NULL) return False; @@ -91,7 +91,7 @@ BOOL init_dfs_q_dfs_remove(DFS_Q_DFS_REMOVE *q_d, char *entrypath, Read/write a DFS_Q_DFS_REMOVE structure *******************************************************************/ -BOOL dfs_io_q_dfs_remove(char *desc, DFS_Q_DFS_REMOVE *q_d, prs_struct *ps, int depth) +BOOL dfs_io_q_dfs_remove(const char *desc, DFS_Q_DFS_REMOVE *q_d, prs_struct *ps, int depth) { if(q_d == NULL) return False; @@ -131,7 +131,7 @@ BOOL dfs_io_q_dfs_remove(char *desc, DFS_Q_DFS_REMOVE *q_d, prs_struct *ps, int Read/write a DFS_R_DFS_REMOVE structure *******************************************************************/ -BOOL dfs_io_r_dfs_remove(char *desc, DFS_R_DFS_REMOVE *r_d, prs_struct *ps, int depth) +BOOL dfs_io_r_dfs_remove(const char *desc, DFS_R_DFS_REMOVE *r_d, prs_struct *ps, int depth) { if(r_d == NULL) return False; @@ -172,7 +172,7 @@ BOOL init_dfs_q_dfs_add(DFS_Q_DFS_ADD *q_d, char *entrypath, char *servername, Read/write a DFS_Q_DFS_ADD structure ************************************************************/ -BOOL dfs_io_q_dfs_add(char *desc, DFS_Q_DFS_ADD *q_d, prs_struct *ps, int depth) +BOOL dfs_io_q_dfs_add(const char *desc, DFS_Q_DFS_ADD *q_d, prs_struct *ps, int depth) { if(q_d == NULL) return False; @@ -217,7 +217,7 @@ BOOL dfs_io_q_dfs_add(char *desc, DFS_Q_DFS_ADD *q_d, prs_struct *ps, int depth) Read/write a DFS_R_DFS_ADD structure ************************************************************/ -BOOL dfs_io_r_dfs_add(char *desc, DFS_R_DFS_ADD *r_d, prs_struct *ps, int depth) +BOOL dfs_io_r_dfs_add(const char *desc, DFS_R_DFS_ADD *r_d, prs_struct *ps, int depth) { if(r_d == NULL) return False; @@ -248,7 +248,7 @@ BOOL init_dfs_q_dfs_get_info(DFS_Q_DFS_GET_INFO *q_d, char *entrypath, Read/write a DFS_Q_GET_INFO structure ************************************************************/ -BOOL dfs_io_q_dfs_get_info(char* desc, DFS_Q_DFS_GET_INFO* q_i, prs_struct* ps, int depth) +BOOL dfs_io_q_dfs_get_info(const char *desc, DFS_Q_DFS_GET_INFO* q_i, prs_struct* ps, int depth) { if(q_i == NULL) return False; @@ -288,7 +288,7 @@ BOOL dfs_io_q_dfs_get_info(char* desc, DFS_Q_DFS_GET_INFO* q_i, prs_struct* ps, Read/write a DFS_R_GET_INFO structure ************************************************************/ -BOOL dfs_io_r_dfs_get_info(char* desc, DFS_R_DFS_GET_INFO* r_i, prs_struct* ps, int depth) +BOOL dfs_io_r_dfs_get_info(const char *desc, DFS_R_DFS_GET_INFO* r_i, prs_struct* ps, int depth) { if(r_i == NULL) return False; @@ -327,7 +327,7 @@ BOOL init_dfs_q_dfs_enum(DFS_Q_DFS_ENUM *q_d, uint32 level, DFS_INFO_CTR *ctr) Read or write the DFS_Q_DFS_ENUM structure ************************************************************/ -BOOL dfs_io_q_dfs_enum(char *desc, DFS_Q_DFS_ENUM *q_d, prs_struct *ps, int depth) +BOOL dfs_io_q_dfs_enum(const char *desc, DFS_Q_DFS_ENUM *q_d, prs_struct *ps, int depth) { if(q_d == NULL) return False; @@ -364,7 +364,7 @@ BOOL dfs_io_q_dfs_enum(char *desc, DFS_Q_DFS_ENUM *q_d, prs_struct *ps, int dept Read/write a DFS_INFO_CTR structure ************************************************************/ -BOOL dfs_io_dfs_info_ctr(char* desc, DFS_INFO_CTR* ctr, uint32 num_entries, uint32 level, prs_struct* ps, int depth) +BOOL dfs_io_dfs_info_ctr(const char *desc, DFS_INFO_CTR* ctr, uint32 num_entries, uint32 level, prs_struct* ps, int depth) { int i=0; @@ -464,7 +464,7 @@ BOOL dfs_io_dfs_info_ctr(char* desc, DFS_INFO_CTR* ctr, uint32 num_entries, uint Read/write a DFS_R_DFS_ENUM structure ************************************************************/ -BOOL dfs_io_r_dfs_enum(char *desc, DFS_R_DFS_ENUM *q_d, prs_struct *ps, int depth) +BOOL dfs_io_r_dfs_enum(const char *desc, DFS_R_DFS_ENUM *q_d, prs_struct *ps, int depth) { DFS_INFO_CTR *ctr; if(q_d == NULL) @@ -506,7 +506,7 @@ BOOL dfs_io_r_dfs_enum(char *desc, DFS_R_DFS_ENUM *q_d, prs_struct *ps, int dept return True; } -BOOL dfs_io_dfs_storage_info(char *desc, DFS_INFO_3* info3, prs_struct *ps, int depth) +BOOL dfs_io_dfs_storage_info(const char *desc, DFS_INFO_3* info3, prs_struct *ps, int depth) { int i=0; if(info3 == NULL) diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index 3c70cabc71..ab07631831 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -20,7 +20,7 @@ #include "includes.h" -static BOOL ds_io_dominfobasic( char *desc, prs_struct *ps, int depth, DSROLE_PRIMARY_DOMAIN_INFO_BASIC **basic) +static BOOL ds_io_dominfobasic( const char *desc, prs_struct *ps, int depth, DSROLE_PRIMARY_DOMAIN_INFO_BASIC **basic) { DSROLE_PRIMARY_DOMAIN_INFO_BASIC *p = *basic; @@ -68,7 +68,7 @@ static BOOL ds_io_dominfobasic( char *desc, prs_struct *ps, int depth, DSROLE_PR } -BOOL ds_io_q_getprimdominfo( char *desc, DS_Q_GETPRIMDOMINFO *q_u, prs_struct *ps, int depth) +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++; @@ -82,7 +82,7 @@ BOOL ds_io_q_getprimdominfo( char *desc, DS_Q_GETPRIMDOMINFO *q_u, prs_struct *p return True; } -BOOL ds_io_r_getprimdominfo( char *desc, DS_R_GETPRIMDOMINFO *r_u, prs_struct *ps, int depth) +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++; diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 375bbd31d7..56398e7cf0 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -27,14 +27,14 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth); +static BOOL lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *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, char *name, uint32 idx) + uint16 sid_name_use, const char *name, uint32 idx) { int len_name = strlen(name); @@ -51,7 +51,7 @@ void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, Reads or writes a LSA_TRANS_NAME structure. ********************************************************************/ -static BOOL lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, +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"); @@ -77,7 +77,7 @@ static BOOL lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, Reads or writes a DOM_R_REF structure. ********************************************************************/ -static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, +static BOOL lsa_io_dom_r_ref(const char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) { int i; @@ -156,7 +156,7 @@ void init_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff) Reads or writes an LSA_SEC_QOS structure. ********************************************************************/ -static BOOL lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, +static BOOL lsa_io_sec_qos(const char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int depth) { uint32 start; @@ -216,7 +216,7 @@ static void init_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS Reads or writes an LSA_OBJ_ATTR structure. ********************************************************************/ -static BOOL lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, +static BOOL lsa_io_obj_attr(const char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int depth) { uint32 start; @@ -290,7 +290,7 @@ void init_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name, Reads or writes an LSA_Q_OPEN_POL structure. ********************************************************************/ -BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, +BOOL lsa_io_q_open_pol(const char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_open_pol"); @@ -316,7 +316,7 @@ BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, Reads or writes an LSA_R_OPEN_POL structure. ********************************************************************/ -BOOL lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, +BOOL lsa_io_r_open_pol(const char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_open_pol"); @@ -335,7 +335,7 @@ BOOL lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, Inits an LSA_Q_OPEN_POL2 structure. ********************************************************************/ -void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, +void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, const char *server_name, uint32 attributes, uint32 desired_access, LSA_SEC_QOS *qos) { @@ -356,7 +356,7 @@ void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, Reads or writes an LSA_Q_OPEN_POL2 structure. ********************************************************************/ -BOOL lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, +BOOL lsa_io_q_open_pol2(const char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_open_pol2"); @@ -380,7 +380,7 @@ BOOL lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, Reads or writes an LSA_R_OPEN_POL2 structure. ********************************************************************/ -BOOL lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, +BOOL lsa_io_r_open_pol2(const char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_open_pol2"); @@ -414,7 +414,7 @@ void init_q_query_sec_obj(LSA_Q_QUERY_SEC_OBJ *q_q, const POLICY_HND *hnd, Reads or writes an LSA_Q_QUERY_SEC_OBJ structure. ********************************************************************/ -BOOL lsa_io_q_query_sec_obj(char *desc, LSA_Q_QUERY_SEC_OBJ *q_q, +BOOL lsa_io_q_query_sec_obj(const char *desc, LSA_Q_QUERY_SEC_OBJ *q_q, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_query_sec_obj"); @@ -433,7 +433,7 @@ BOOL lsa_io_q_query_sec_obj(char *desc, LSA_Q_QUERY_SEC_OBJ *q_q, Reads or writes a LSA_R_QUERY_SEC_OBJ structure. ********************************************************************/ -BOOL lsa_io_r_query_sec_obj(char *desc, LSA_R_QUERY_SEC_OBJ *r_u, +BOOL lsa_io_r_query_sec_obj(const char *desc, LSA_R_QUERY_SEC_OBJ *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_query_sec_obj"); @@ -473,7 +473,7 @@ void init_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class) Reads or writes an LSA_Q_QUERY_INFO structure. ********************************************************************/ -BOOL lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, +BOOL lsa_io_q_query(const char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_query"); @@ -507,7 +507,7 @@ BOOL init_q_enum_trust_dom(LSA_Q_ENUM_TRUST_DOM * q_e, POLICY_HND *pol, Reads or writes an LSA_Q_ENUM_TRUST_DOM structure. ********************************************************************/ -BOOL lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, +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"); @@ -580,7 +580,7 @@ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 en Reads or writes an LSA_R_ENUM_TRUST_DOM structure. ********************************************************************/ -BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, +BOOL lsa_io_r_enum_trust_dom(const char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_enum_trust_dom"); @@ -639,7 +639,7 @@ BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, reads or writes a dom query structure. ********************************************************************/ -static BOOL lsa_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth) +static BOOL lsa_io_dom_query(const char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth) { if (d_q == NULL) return False; @@ -680,7 +680,7 @@ static BOOL lsa_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int dep reads or writes a structure. ********************************************************************/ -static BOOL lsa_io_dom_query_2(char *desc, DOM_QUERY_2 *d_q, prs_struct *ps, int depth) +static BOOL lsa_io_dom_query_2(const char *desc, DOM_QUERY_2 *d_q, prs_struct *ps, int depth) { uint32 ptr = 1; @@ -721,7 +721,7 @@ static BOOL lsa_io_dom_query_2(char *desc, DOM_QUERY_2 *d_q, prs_struct *ps, int Reads or writes a dom query structure. ********************************************************************/ -static BOOL lsa_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) +static BOOL lsa_io_dom_query_3(const char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) { return lsa_io_dom_query("", d_q, ps, depth); } @@ -730,7 +730,7 @@ static BOOL lsa_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int Reads or writes a dom query structure. ********************************************************************/ -static BOOL lsa_io_dom_query_5(char *desc, DOM_QUERY_5 *d_q, prs_struct *ps, int depth) +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("", d_q, ps, depth); } @@ -739,7 +739,7 @@ static BOOL lsa_io_dom_query_5(char *desc, DOM_QUERY_5 *d_q, prs_struct *ps, int Reads or writes a dom query structure. ********************************************************************/ -static BOOL lsa_io_dom_query_6(char *desc, DOM_QUERY_6 *d_q, prs_struct *ps, int depth) +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; @@ -757,7 +757,7 @@ static BOOL lsa_io_dom_query_6(char *desc, DOM_QUERY_6 *d_q, prs_struct *ps, int Reads or writes an LSA_R_QUERY_INFO structure. ********************************************************************/ -BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, +BOOL lsa_io_r_query(const char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_query"); @@ -848,7 +848,7 @@ static void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, Reads or writes a LSA_SID_ENUM structure. ********************************************************************/ -static BOOL lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, +static BOOL lsa_io_sid_enum(const char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) { int i; @@ -936,7 +936,7 @@ void init_q_lookup_sids(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_SIDS *q_l, Reads or writes a LSA_Q_LOOKUP_SIDS structure. ********************************************************************/ -BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, +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"); @@ -964,7 +964,7 @@ BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, Reads or writes a structure. ********************************************************************/ -static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, +static BOOL lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth) { int i; @@ -1025,7 +1025,7 @@ static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, Reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, +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"); @@ -1099,7 +1099,7 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, reads or writes a structure. ********************************************************************/ -BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, +BOOL lsa_io_q_lookup_names(const char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth) { int i; @@ -1163,7 +1163,7 @@ BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, +BOOL lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth) { int i; @@ -1233,7 +1233,7 @@ void init_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd) Reads or writes an LSA_Q_CLOSE structure. ********************************************************************/ -BOOL lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth) +BOOL lsa_io_q_close(const char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_close"); depth++; @@ -1248,7 +1248,7 @@ BOOL lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth) Reads or writes an LSA_R_CLOSE structure. ********************************************************************/ -BOOL lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_close(const char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_close"); depth++; @@ -1266,7 +1266,7 @@ BOOL lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth) Reads or writes an LSA_Q_OPEN_SECRET structure. ********************************************************************/ -BOOL lsa_io_q_open_secret(char *desc, LSA_Q_OPEN_SECRET *q_c, prs_struct *ps, int depth) +BOOL lsa_io_q_open_secret(const char *desc, LSA_Q_OPEN_SECRET *q_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_open_secret"); depth++; @@ -1279,7 +1279,7 @@ BOOL lsa_io_q_open_secret(char *desc, LSA_Q_OPEN_SECRET *q_c, prs_struct *ps, in Reads or writes an LSA_R_OPEN_SECRET structure. ********************************************************************/ -BOOL lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_open_secret(const char *desc, LSA_R_OPEN_SECRET *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_open_secret"); depth++; @@ -1318,7 +1318,7 @@ void init_q_enum_privs(LSA_Q_ENUM_PRIVS *q_q, POLICY_HND *hnd, uint32 enum_conte /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_q_enum_privs(char *desc, LSA_Q_ENUM_PRIVS *q_q, prs_struct *ps, int depth) +BOOL lsa_io_q_enum_privs(const char *desc, LSA_Q_ENUM_PRIVS *q_q, prs_struct *ps, int depth) { if (q_q == NULL) return False; @@ -1340,7 +1340,7 @@ BOOL lsa_io_q_enum_privs(char *desc, LSA_Q_ENUM_PRIVS *q_q, prs_struct *ps, int /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL lsa_io_priv_entries(char *desc, LSA_PRIV_ENTRY *entries, uint32 count, prs_struct *ps, int depth) +static BOOL lsa_io_priv_entries(const char *desc, LSA_PRIV_ENTRY *entries, uint32 count, prs_struct *ps, int depth) { uint32 i; @@ -1395,7 +1395,7 @@ void init_lsa_r_enum_privs(LSA_R_ENUM_PRIVS *r_u, uint32 enum_context, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_enum_privs(char *desc, LSA_R_ENUM_PRIVS *r_q, prs_struct *ps, int depth) +BOOL lsa_io_r_enum_privs(const char *desc, LSA_R_ENUM_PRIVS *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1434,7 +1434,7 @@ BOOL lsa_io_r_enum_privs(char *desc, LSA_R_ENUM_PRIVS *r_q, prs_struct *ps, int return True; } -void init_lsa_priv_get_dispname(LSA_Q_PRIV_GET_DISPNAME *trn, POLICY_HND *hnd, char *name, uint16 lang_id, uint16 lang_id_sys) +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) { int len_name = strlen(name); @@ -1452,7 +1452,7 @@ void init_lsa_priv_get_dispname(LSA_Q_PRIV_GET_DISPNAME *trn, POLICY_HND *hnd, c /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_q_priv_get_dispname(char *desc, LSA_Q_PRIV_GET_DISPNAME *q_q, prs_struct *ps, int depth) +BOOL lsa_io_q_priv_get_dispname(const char *desc, LSA_Q_PRIV_GET_DISPNAME *q_q, prs_struct *ps, int depth) { if (q_q == NULL) return False; @@ -1483,7 +1483,7 @@ BOOL lsa_io_q_priv_get_dispname(char *desc, LSA_Q_PRIV_GET_DISPNAME *q_q, prs_st /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_priv_get_dispname(char *desc, LSA_R_PRIV_GET_DISPNAME *r_q, prs_struct *ps, int depth) +BOOL lsa_io_r_priv_get_dispname(const char *desc, LSA_R_PRIV_GET_DISPNAME *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1530,7 +1530,7 @@ void init_lsa_q_enum_accounts(LSA_Q_ENUM_ACCOUNTS *trn, POLICY_HND *hnd, uint32 /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_q_enum_accounts(char *desc, LSA_Q_ENUM_ACCOUNTS *q_q, prs_struct *ps, int depth) +BOOL lsa_io_q_enum_accounts(const char *desc, LSA_Q_ENUM_ACCOUNTS *q_q, prs_struct *ps, int depth) { if (q_q == NULL) return False; @@ -1572,7 +1572,7 @@ void init_lsa_r_enum_accounts(LSA_R_ENUM_ACCOUNTS *r_u, uint32 enum_context) /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_enum_accounts(char *desc, LSA_R_ENUM_ACCOUNTS *r_q, prs_struct *ps, int depth) +BOOL lsa_io_r_enum_accounts(const char *desc, LSA_R_ENUM_ACCOUNTS *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1603,7 +1603,7 @@ BOOL lsa_io_r_enum_accounts(char *desc, LSA_R_ENUM_ACCOUNTS *r_q, prs_struct *ps Reads or writes an LSA_Q_UNK_GET_CONNUSER structure. ********************************************************************/ -BOOL lsa_io_q_unk_get_connuser(char *desc, LSA_Q_UNK_GET_CONNUSER *q_c, prs_struct *ps, int depth) +BOOL lsa_io_q_unk_get_connuser(const char *desc, LSA_Q_UNK_GET_CONNUSER *q_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_unk_get_connuser"); depth++; @@ -1635,7 +1635,7 @@ BOOL lsa_io_q_unk_get_connuser(char *desc, LSA_Q_UNK_GET_CONNUSER *q_c, prs_stru Reads or writes an LSA_R_UNK_GET_CONNUSER structure. ********************************************************************/ -BOOL lsa_io_r_unk_get_connuser(char *desc, LSA_R_UNK_GET_CONNUSER *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_unk_get_connuser(const char *desc, LSA_R_UNK_GET_CONNUSER *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_unk_get_connuser"); depth++; @@ -1684,7 +1684,7 @@ void init_lsa_q_open_account(LSA_Q_OPENACCOUNT *trn, POLICY_HND *hnd, DOM_SID *s Reads or writes an LSA_Q_OPENACCOUNT structure. ********************************************************************/ -BOOL lsa_io_q_open_account(char *desc, LSA_Q_OPENACCOUNT *r_c, prs_struct *ps, int depth) +BOOL lsa_io_q_open_account(const char *desc, LSA_Q_OPENACCOUNT *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_open_account"); depth++; @@ -1708,7 +1708,7 @@ BOOL lsa_io_q_open_account(char *desc, LSA_Q_OPENACCOUNT *r_c, prs_struct *ps, i Reads or writes an LSA_R_OPENACCOUNT structure. ********************************************************************/ -BOOL lsa_io_r_open_account(char *desc, LSA_R_OPENACCOUNT *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_open_account(const char *desc, LSA_R_OPENACCOUNT *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_open_account"); depth++; @@ -1736,7 +1736,7 @@ void init_lsa_q_enum_privsaccount(LSA_Q_ENUMPRIVSACCOUNT *trn, POLICY_HND *hnd) Reads or writes an LSA_Q_ENUMPRIVSACCOUNT structure. ********************************************************************/ -BOOL lsa_io_q_enum_privsaccount(char *desc, LSA_Q_ENUMPRIVSACCOUNT *r_c, prs_struct *ps, int depth) +BOOL lsa_io_q_enum_privsaccount(const char *desc, LSA_Q_ENUMPRIVSACCOUNT *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_enum_privsaccount"); depth++; @@ -1754,7 +1754,7 @@ BOOL lsa_io_q_enum_privsaccount(char *desc, LSA_Q_ENUMPRIVSACCOUNT *r_c, prs_str Reads or writes an LUID structure. ********************************************************************/ -static BOOL lsa_io_luid(char *desc, LUID *r_c, prs_struct *ps, int depth) +static BOOL lsa_io_luid(const char *desc, LUID *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_luid"); depth++; @@ -1775,7 +1775,7 @@ static BOOL lsa_io_luid(char *desc, LUID *r_c, prs_struct *ps, int depth) Reads or writes an LUID_ATTR structure. ********************************************************************/ -static BOOL lsa_io_luid_attr(char *desc, LUID_ATTR *r_c, prs_struct *ps, int depth) +static BOOL lsa_io_luid_attr(const char *desc, LUID_ATTR *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_luid_attr"); depth++; @@ -1796,7 +1796,7 @@ static BOOL lsa_io_luid_attr(char *desc, LUID_ATTR *r_c, prs_struct *ps, int dep Reads or writes an PRIVILEGE_SET structure. ********************************************************************/ -static BOOL lsa_io_privilege_set(char *desc, PRIVILEGE_SET *r_c, prs_struct *ps, int depth) +static BOOL lsa_io_privilege_set(const char *desc, PRIVILEGE_SET *r_c, prs_struct *ps, int depth) { uint32 i; @@ -1833,7 +1833,7 @@ void init_lsa_r_enum_privsaccount(LSA_R_ENUMPRIVSACCOUNT *r_u, LUID_ATTR *set, u Reads or writes an LSA_R_ENUMPRIVSACCOUNT structure. ********************************************************************/ -BOOL lsa_io_r_enum_privsaccount(char *desc, LSA_R_ENUMPRIVSACCOUNT *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_enum_privsaccount(const char *desc, LSA_R_ENUMPRIVSACCOUNT *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_enum_privsaccount"); depth++; @@ -1872,7 +1872,7 @@ BOOL lsa_io_r_enum_privsaccount(char *desc, LSA_R_ENUMPRIVSACCOUNT *r_c, prs_str Reads or writes an LSA_Q_GETSYSTEMACCOUNTstructure. ********************************************************************/ -BOOL lsa_io_q_getsystemaccount(char *desc, LSA_Q_GETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) +BOOL lsa_io_q_getsystemaccount(const char *desc, LSA_Q_GETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_getsystemaccount"); depth++; @@ -1890,7 +1890,7 @@ BOOL lsa_io_q_getsystemaccount(char *desc, LSA_Q_GETSYSTEMACCOUNT *r_c, prs_str Reads or writes an LSA_R_GETSYSTEMACCOUNTstructure. ********************************************************************/ -BOOL lsa_io_r_getsystemaccount(char *desc, LSA_R_GETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_getsystemaccount(const char *desc, LSA_R_GETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_getsystemaccount"); depth++; @@ -1912,7 +1912,7 @@ BOOL lsa_io_r_getsystemaccount(char *desc, LSA_R_GETSYSTEMACCOUNT *r_c, prs_str Reads or writes an LSA_Q_SETSYSTEMACCOUNT structure. ********************************************************************/ -BOOL lsa_io_q_setsystemaccount(char *desc, LSA_Q_SETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) +BOOL lsa_io_q_setsystemaccount(const char *desc, LSA_Q_SETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_setsystemaccount"); depth++; @@ -1933,7 +1933,7 @@ BOOL lsa_io_q_setsystemaccount(char *desc, LSA_Q_SETSYSTEMACCOUNT *r_c, prs_str Reads or writes an LSA_R_SETSYSTEMACCOUNT structure. ********************************************************************/ -BOOL lsa_io_r_setsystemaccount(char *desc, LSA_R_SETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_setsystemaccount(const char *desc, LSA_R_SETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_setsystemaccount"); depth++; @@ -1948,7 +1948,7 @@ BOOL lsa_io_r_setsystemaccount(char *desc, LSA_R_SETSYSTEMACCOUNT *r_c, prs_str } -void init_lsa_q_lookupprivvalue(LSA_Q_LOOKUPPRIVVALUE *trn, POLICY_HND *hnd, char *name) +void init_lsa_q_lookupprivvalue(LSA_Q_LOOKUPPRIVVALUE *trn, POLICY_HND *hnd, const char *name) { int len_name = strlen(name); memcpy(&trn->pol, hnd, sizeof(trn->pol)); @@ -1964,7 +1964,7 @@ void init_lsa_q_lookupprivvalue(LSA_Q_LOOKUPPRIVVALUE *trn, POLICY_HND *hnd, cha Reads or writes an LSA_Q_LOOKUPPRIVVALUE structure. ********************************************************************/ -BOOL lsa_io_q_lookupprivvalue(char *desc, LSA_Q_LOOKUPPRIVVALUE *r_c, prs_struct *ps, int depth) +BOOL lsa_io_q_lookupprivvalue(const char *desc, LSA_Q_LOOKUPPRIVVALUE *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_lookupprivvalue"); depth++; @@ -1986,7 +1986,7 @@ BOOL lsa_io_q_lookupprivvalue(char *desc, LSA_Q_LOOKUPPRIVVALUE *r_c, prs_struc Reads or writes an LSA_R_LOOKUPPRIVVALUE structure. ********************************************************************/ -BOOL lsa_io_r_lookupprivvalue(char *desc, LSA_R_LOOKUPPRIVVALUE *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_lookupprivvalue(const char *desc, LSA_R_LOOKUPPRIVVALUE *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_lookupprivvalue"); depth++; @@ -2008,7 +2008,7 @@ BOOL lsa_io_r_lookupprivvalue(char *desc, LSA_R_LOOKUPPRIVVALUE *r_c, prs_struc Reads or writes an LSA_Q_ADDPRIVS structure. ********************************************************************/ -BOOL lsa_io_q_addprivs(char *desc, LSA_Q_ADDPRIVS *r_c, prs_struct *ps, int depth) +BOOL lsa_io_q_addprivs(const char *desc, LSA_Q_ADDPRIVS *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_addprivs"); depth++; @@ -2037,7 +2037,7 @@ BOOL lsa_io_q_addprivs(char *desc, LSA_Q_ADDPRIVS *r_c, prs_struct *ps, int dept Reads or writes an LSA_R_ADDPRIVS structure. ********************************************************************/ -BOOL lsa_io_r_addprivs(char *desc, LSA_R_ADDPRIVS *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_addprivs(const char *desc, LSA_R_ADDPRIVS *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_addprivs"); depth++; @@ -2055,7 +2055,7 @@ BOOL lsa_io_r_addprivs(char *desc, LSA_R_ADDPRIVS *r_c, prs_struct *ps, int dept Reads or writes an LSA_Q_REMOVEPRIVS structure. ********************************************************************/ -BOOL lsa_io_q_removeprivs(char *desc, LSA_Q_REMOVEPRIVS *r_c, prs_struct *ps, int depth) +BOOL lsa_io_q_removeprivs(const char *desc, LSA_Q_REMOVEPRIVS *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_removeprivs"); depth++; @@ -2097,7 +2097,7 @@ BOOL lsa_io_q_removeprivs(char *desc, LSA_Q_REMOVEPRIVS *r_c, prs_struct *ps, in Reads or writes an LSA_R_REMOVEPRIVS structure. ********************************************************************/ -BOOL lsa_io_r_removeprivs(char *desc, LSA_R_REMOVEPRIVS *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_removeprivs(const char *desc, LSA_R_REMOVEPRIVS *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_removeprivs"); depth++; @@ -2123,7 +2123,7 @@ BOOL policy_handle_is_valid(const POLICY_HND *hnd) Reads or writes an LSA_DNS_DOM_INFO structure. ********************************************************************/ -BOOL lsa_io_dns_dom_info(char *desc, LSA_DNS_DOM_INFO *info, +BOOL lsa_io_dns_dom_info(const char *desc, LSA_DNS_DOM_INFO *info, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_dns_dom_info"); @@ -2182,7 +2182,7 @@ void init_q_query2(LSA_Q_QUERY_INFO2 *q_q, POLICY_HND *hnd, uint16 info_class) Reads or writes an LSA_Q_QUERY_DNSDOMINFO structure. ********************************************************************/ -BOOL lsa_io_q_query_info2(char *desc, LSA_Q_QUERY_INFO2 *q_c, +BOOL lsa_io_q_query_info2(const char *desc, LSA_Q_QUERY_INFO2 *q_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_query_info2"); @@ -2204,7 +2204,7 @@ BOOL lsa_io_q_query_info2(char *desc, LSA_Q_QUERY_INFO2 *q_c, Reads or writes an LSA_R_QUERY_DNSDOMINFO structure. ********************************************************************/ -BOOL lsa_io_r_query_info2(char *desc, LSA_R_QUERY_INFO2 *r_c, +BOOL lsa_io_r_query_info2(const char *desc, LSA_R_QUERY_INFO2 *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_query_info2"); diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 86dd85066d..a9157e29b6 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -91,7 +91,7 @@ TALLOC_CTX *get_talloc_ctx(void) Reads or writes a UTIME type. ********************************************************************/ -static BOOL smb_io_utime(char *desc, UTIME *t, prs_struct *ps, int depth) +static BOOL smb_io_utime(const char *desc, UTIME *t, prs_struct *ps, int depth) { if (t == NULL) return False; @@ -112,7 +112,7 @@ static BOOL smb_io_utime(char *desc, UTIME *t, prs_struct *ps, int depth) Reads or writes an NTTIME structure. ********************************************************************/ -BOOL smb_io_time(char *desc, NTTIME *nttime, prs_struct *ps, int depth) +BOOL smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth) { if (nttime == NULL) return False; @@ -135,7 +135,7 @@ BOOL smb_io_time(char *desc, NTTIME *nttime, prs_struct *ps, int depth) Reads or writes a LOOKUP_LEVEL structure. ********************************************************************/ -BOOL smb_io_lookup_level(char *desc, LOOKUP_LEVEL *level, prs_struct *ps, int depth) +BOOL smb_io_lookup_level(const char *desc, LOOKUP_LEVEL *level, prs_struct *ps, int depth) { if (level == NULL) return False; @@ -178,7 +178,7 @@ void init_enum_hnd(ENUM_HND *enh, uint32 hnd) Reads or writes an ENUM_HND structure. ********************************************************************/ -BOOL smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) +BOOL smb_io_enum_hnd(const char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) { if (hnd == NULL) return False; @@ -204,7 +204,7 @@ BOOL smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) Reads or writes a DOM_SID structure. ********************************************************************/ -BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) +BOOL smb_io_dom_sid(const char *desc, DOM_SID *sid, prs_struct *ps, int depth) { int i; @@ -301,7 +301,7 @@ void init_dom_sid2(DOM_SID2 *sid2, const DOM_SID *sid) Reads or writes a DOM_SID2 structure. ********************************************************************/ -BOOL smb_io_dom_sid2(char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) +BOOL smb_io_dom_sid2(const char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) { if (sid == NULL) return False; @@ -336,7 +336,7 @@ void init_str_hdr(STRHDR *hdr, int max_len, int len, uint32 buffer) Reads or writes a STRHDR structure. ********************************************************************/ -BOOL smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth) +BOOL smb_io_strhdr(const char *desc, STRHDR *hdr, prs_struct *ps, int depth) { if (hdr == NULL) return False; @@ -371,7 +371,7 @@ void init_uni_hdr(UNIHDR *hdr, int len) Reads or writes a UNIHDR structure. ********************************************************************/ -BOOL smb_io_unihdr(char *desc, UNIHDR *hdr, prs_struct *ps, int depth) +BOOL smb_io_unihdr(const char *desc, UNIHDR *hdr, prs_struct *ps, int depth) { if (hdr == NULL) return False; @@ -407,7 +407,7 @@ void init_buf_hdr(BUFHDR *hdr, int max_len, int len) uint16 should be stored, or gets the size if reading. ********************************************************************/ -BOOL smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset) +BOOL smb_io_hdrbuf_pre(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset) { (*offset) = prs_offset(ps); if (ps->io) { @@ -433,7 +433,7 @@ BOOL smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint3 Does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ -BOOL smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, +BOOL smb_io_hdrbuf_post(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 ptr_hdrbuf, uint32 max_len, uint32 len) { if (!ps->io) { @@ -458,7 +458,7 @@ BOOL smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, Reads or writes a BUFHDR structure. ********************************************************************/ -BOOL smb_io_hdrbuf(char *desc, BUFHDR *hdr, prs_struct *ps, int depth) +BOOL smb_io_hdrbuf(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth) { if (hdr == NULL) return False; @@ -491,7 +491,7 @@ void init_uni_hdr2(UNIHDR2 *hdr, int len) Reads or writes a UNIHDR2 structure. ********************************************************************/ -BOOL smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) +BOOL smb_io_unihdr2(const char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) { if (hdr2 == NULL) return False; @@ -542,7 +542,7 @@ reads or writes a UNISTR structure. XXXX NOTE: UNISTR structures NEED to be null-terminated. ********************************************************************/ -BOOL smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) +BOOL smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth) { if (uni == NULL) return False; @@ -639,7 +639,7 @@ void init_buffer3_bytes(BUFFER3 *str, uint8 *buf, int len) the uni_str_len member tells you how much of the buffer is really used. ********************************************************************/ -BOOL smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) +BOOL smb_io_buffer3(const char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) { if (buf3 == NULL) return False; @@ -672,7 +672,7 @@ BOOL smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) reads or writes a BUFFER5 structure. the buf_len member tells you how large the buffer is. ********************************************************************/ -BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) +BOOL smb_io_buffer5(const char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_buffer5"); depth++; @@ -721,7 +721,7 @@ void init_buffer2(BUFFER2 *str, const uint8 *buf, int len) the uni_str_len member tells you how much of the buffer is really used. ********************************************************************/ -BOOL smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_buffer2(const char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth) { if (buf2 == NULL) return False; @@ -844,7 +844,7 @@ void init_string2(STRING2 *str, const char *buf, int max_len, int str_len) the str_max_len member tells you how large the buffer is. ********************************************************************/ -BOOL smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_string2(const char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth) { if (str2 == NULL) return False; @@ -1006,7 +1006,7 @@ void init_unistr2_from_unistr (UNISTR2 *to, const UNISTR *from) the uni_max_len member tells you how large the buffer is. ********************************************************************/ -BOOL smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth) { if (uni2 == NULL) return False; @@ -1057,7 +1057,7 @@ void init_dom_rid2(DOM_RID2 *rid2, uint32 rid, uint8 type, uint32 idx) Reads or writes a DOM_RID2 structure. ********************************************************************/ -BOOL smb_io_dom_rid2(char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth) +BOOL smb_io_dom_rid2(const char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth) { if (rid2 == NULL) return False; @@ -1097,7 +1097,7 @@ void init_dom_rid3(DOM_RID3 *rid3, uint32 rid, uint8 type) reads or writes a DOM_RID3 structure. ********************************************************************/ -BOOL smb_io_dom_rid3(char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) +BOOL smb_io_dom_rid3(const char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) { if (rid3 == NULL) return False; @@ -1160,7 +1160,7 @@ static void init_clnt_srv(DOM_CLNT_SRV *log, const char *logon_srv, const char * Inits or writes a DOM_CLNT_SRV structure. ********************************************************************/ -static BOOL smb_io_clnt_srv(char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth) +static BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth) { if (log == NULL) return False; @@ -1216,7 +1216,7 @@ void init_log_info(DOM_LOG_INFO *log, const char *logon_srv, const char *acct_na Reads or writes a DOM_LOG_INFO structure. ********************************************************************/ -BOOL smb_io_log_info(char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth) +BOOL smb_io_log_info(const char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth) { if (log == NULL) return False; @@ -1248,7 +1248,7 @@ BOOL smb_io_log_info(char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth) Reads or writes a DOM_CHAL structure. ********************************************************************/ -BOOL smb_io_chal(char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) +BOOL smb_io_chal(const char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) { if (chal == NULL) return False; @@ -1266,7 +1266,7 @@ BOOL smb_io_chal(char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) Reads or writes a DOM_CRED structure. ********************************************************************/ -BOOL smb_io_cred(char *desc, DOM_CRED *cred, prs_struct *ps, int depth) +BOOL smb_io_cred(const char *desc, DOM_CRED *cred, prs_struct *ps, int depth) { if (cred == NULL) return False; @@ -1310,7 +1310,7 @@ void init_clnt_info2(DOM_CLNT_INFO2 *clnt, Reads or writes a DOM_CLNT_INFO2 structure. ********************************************************************/ -BOOL smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth) +BOOL smb_io_clnt_info2(const char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth) { if (clnt == NULL) return False; @@ -1354,7 +1354,7 @@ void init_clnt_info(DOM_CLNT_INFO *clnt, Reads or writes a DOM_CLNT_INFO structure. ********************************************************************/ -BOOL smb_io_clnt_info(char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int depth) +BOOL smb_io_clnt_info(const char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int depth) { if (clnt == NULL) return False; @@ -1389,7 +1389,7 @@ void init_logon_id(DOM_LOGON_ID *log, uint32 log_id_low, uint32 log_id_high) Reads or writes a DOM_LOGON_ID structure. ********************************************************************/ -BOOL smb_io_logon_id(char *desc, DOM_LOGON_ID *log, prs_struct *ps, int depth) +BOOL smb_io_logon_id(const char *desc, DOM_LOGON_ID *log, prs_struct *ps, int depth) { if (log == NULL) return False; @@ -1426,7 +1426,7 @@ void init_owf_info(OWF_INFO *hash, const uint8 data[16]) Reads or writes an OWF_INFO structure. ********************************************************************/ -BOOL smb_io_owf_info(char *desc, OWF_INFO *hash, prs_struct *ps, int depth) +BOOL smb_io_owf_info(const char *desc, OWF_INFO *hash, prs_struct *ps, int depth) { if (hash == NULL) return False; @@ -1447,7 +1447,7 @@ BOOL smb_io_owf_info(char *desc, OWF_INFO *hash, prs_struct *ps, int depth) Reads or writes a DOM_GID structure. ********************************************************************/ -BOOL smb_io_gid(char *desc, DOM_GID *gid, prs_struct *ps, int depth) +BOOL smb_io_gid(const char *desc, DOM_GID *gid, prs_struct *ps, int depth) { if (gid == NULL) return False; @@ -1470,7 +1470,7 @@ BOOL smb_io_gid(char *desc, DOM_GID *gid, prs_struct *ps, int depth) Reads or writes an POLICY_HND structure. ********************************************************************/ -BOOL smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth) +BOOL smb_io_pol_hnd(const char *desc, POLICY_HND *pol, prs_struct *ps, int depth) { if (pol == NULL) return False; @@ -1532,7 +1532,7 @@ void init_unistr3(UNISTR3 *str, const char *buf) Reads or writes a UNISTR3 structure. ********************************************************************/ -BOOL smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth) +BOOL smb_io_unistr3(const char *desc, UNISTR3 *name, prs_struct *ps, int depth) { if (name == NULL) return False; @@ -1559,7 +1559,7 @@ BOOL smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth) /******************************************************************* Stream a uint64_struct ********************************************************************/ -BOOL prs_uint64(char *name, prs_struct *ps, int depth, UINT64_S *data64) +BOOL prs_uint64(const char *name, prs_struct *ps, int depth, UINT64_S *data64) { return prs_uint32(name, ps, depth+1, &data64->low) && prs_uint32(name, ps, depth+1, &data64->high); @@ -1568,7 +1568,7 @@ BOOL prs_uint64(char *name, prs_struct *ps, int depth, UINT64_S *data64) /******************************************************************* reads or writes a BUFHDR2 structure. ********************************************************************/ -BOOL smb_io_bufhdr2(char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) +BOOL smb_io_bufhdr2(const char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_bufhdr2"); depth++; @@ -1584,7 +1584,7 @@ BOOL smb_io_bufhdr2(char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) /******************************************************************* reads or writes a BUFFER4 structure. ********************************************************************/ -BOOL smb_io_buffer4(char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_buffer4(const char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_buffer4"); depth++; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index c140a1fe01..ac21e6f2dd 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -30,7 +30,7 @@ Reads or writes a structure. ********************************************************************/ -static BOOL net_io_neg_flags(char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth) +static BOOL net_io_neg_flags(const char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth) { if (neg == NULL) return False; @@ -66,7 +66,7 @@ static void init_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_att Reads or writes a NETLOGON_INFO_3 structure. ********************************************************************/ -static BOOL net_io_netinfo_3(char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int depth) +static BOOL net_io_netinfo_3(const char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int depth) { if (info == NULL) return False; @@ -110,7 +110,7 @@ static void init_netinfo_1(NETLOGON_INFO_1 *info, uint32 flags, uint32 pdc_statu Reads or writes a NETLOGON_INFO_1 structure. ********************************************************************/ -static BOOL net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth) +static BOOL net_io_netinfo_1(const char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth) { if (info == NULL) return False; @@ -152,7 +152,7 @@ static void init_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_statu Reads or writes a NETLOGON_INFO_2 structure. ********************************************************************/ -static BOOL net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth) +static BOOL net_io_netinfo_2(const char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth) { if (info == NULL) return False; @@ -187,7 +187,7 @@ static BOOL net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, Reads or writes an NET_Q_LOGON_CTRL2 structure. ********************************************************************/ -BOOL net_io_q_logon_ctrl2(char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, int depth) +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; @@ -278,7 +278,7 @@ void init_net_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level, Reads or writes an NET_R_LOGON_CTRL2 structure. ********************************************************************/ -BOOL net_io_r_logon_ctrl2(char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, int depth) +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; @@ -322,7 +322,7 @@ BOOL net_io_r_logon_ctrl2(char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, in Reads or writes an NET_Q_LOGON_CTRL structure. ********************************************************************/ -BOOL net_io_q_logon_ctrl(char *desc, NET_Q_LOGON_CTRL *q_l, prs_struct *ps, +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"); @@ -395,7 +395,7 @@ void init_net_r_logon_ctrl(NET_R_LOGON_CTRL *r_l, uint32 query_level, Reads or writes an NET_R_LOGON_CTRL structure. ********************************************************************/ -BOOL net_io_r_logon_ctrl(char *desc, NET_R_LOGON_CTRL *r_l, prs_struct *ps, +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"); @@ -459,7 +459,7 @@ void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, Reads or writes an NET_R_TRUST_DOM_LIST structure. ********************************************************************/ -BOOL net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth) +BOOL net_io_r_trust_dom(const char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth) { uint32 value; @@ -511,7 +511,7 @@ BOOL net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, i Reads or writes an NET_Q_TRUST_DOM_LIST structure. ********************************************************************/ -BOOL net_io_q_trust_dom(char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, int depth) +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; @@ -551,7 +551,7 @@ void init_q_req_chal(NET_Q_REQ_CHAL *q_c, Reads or writes an NET_Q_REQ_CHAL structure. ********************************************************************/ -BOOL net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int depth) +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; @@ -580,7 +580,7 @@ BOOL net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int dep Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int depth) +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; @@ -605,7 +605,7 @@ BOOL net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int dept Reads or writes a structure. ********************************************************************/ -BOOL net_io_q_auth(char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth) +BOOL net_io_q_auth(const char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth) { if (q_a == NULL) return False; @@ -628,7 +628,7 @@ BOOL net_io_q_auth(char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth) Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_auth(char *desc, NET_R_AUTH *r_a, prs_struct *ps, int depth) +BOOL net_io_r_auth(const char *desc, NET_R_AUTH *r_a, prs_struct *ps, int depth) { if (r_a == NULL) return False; @@ -669,7 +669,7 @@ void init_q_auth_2(NET_Q_AUTH_2 *q_a, Reads or writes a structure. ********************************************************************/ -BOOL net_io_q_auth_2(char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth) +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; @@ -694,7 +694,7 @@ BOOL net_io_q_auth_2(char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth) Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth) +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; @@ -737,7 +737,7 @@ void init_q_auth_3(NET_Q_AUTH_3 *q_a, Reads or writes a structure. ********************************************************************/ -BOOL net_io_q_auth_3(char *desc, NET_Q_AUTH_3 *q_a, prs_struct *ps, int depth) +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; @@ -762,7 +762,7 @@ BOOL net_io_q_auth_3(char *desc, NET_Q_AUTH_3 *q_a, prs_struct *ps, int depth) Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_auth_3(char *desc, NET_R_AUTH_3 *r_a, prs_struct *ps, int depth) +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; @@ -812,7 +812,7 @@ void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s, Reads or writes a structure. ********************************************************************/ -BOOL net_io_q_srv_pwset(char *desc, NET_Q_SRV_PWSET *q_s, prs_struct *ps, int depth) +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; @@ -835,7 +835,7 @@ BOOL net_io_q_srv_pwset(char *desc, NET_Q_SRV_PWSET *q_s, prs_struct *ps, int de Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int depth) +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; @@ -967,7 +967,7 @@ void init_id_info1(NET_ID_INFO_1 *id, const char *domain_name, Reads or writes an NET_ID_INFO_1 structure. ********************************************************************/ -static BOOL net_io_id_info1(char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth) +static BOOL net_io_id_info1(const char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth) { if (id == NULL) return False; @@ -1083,7 +1083,7 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, Reads or writes an NET_ID_INFO_2 structure. ********************************************************************/ -static BOOL net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int depth) +static BOOL net_io_id_info2(const char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int depth) { if (id == NULL) return False; @@ -1169,7 +1169,7 @@ void init_sam_info(DOM_SAM_INFO *sam, Reads or writes a DOM_SAM_INFO structure. ********************************************************************/ -static BOOL net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR **pp_ctr, prs_struct *ps, int depth) +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; @@ -1212,7 +1212,7 @@ static BOOL net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR **pp_ctr, prs_struct Reads or writes a DOM_SAM_INFO structure. ********************************************************************/ -static BOOL smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int depth) +static BOOL smb_io_sam_info(const char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int depth) { if (sam == NULL) return False; @@ -1544,7 +1544,7 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, Reads or writes a structure. ********************************************************************/ -BOOL net_io_q_sam_logon(char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, int depth) +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; @@ -1568,7 +1568,7 @@ BOOL net_io_q_sam_logon(char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, int de Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_sam_logon(char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, int depth) +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; @@ -1612,7 +1612,7 @@ BOOL net_io_r_sam_logon(char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, int de Reads or writes a structure. ********************************************************************/ -BOOL net_io_q_sam_logoff(char *desc, NET_Q_SAM_LOGOFF *q_l, prs_struct *ps, int depth) +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; @@ -1633,7 +1633,7 @@ BOOL net_io_q_sam_logoff(char *desc, NET_Q_SAM_LOGOFF *q_l, prs_struct *ps, int Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int depth) +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; @@ -1687,7 +1687,7 @@ BOOL init_net_q_sam_sync(NET_Q_SAM_SYNC * q_s, const char *srv_name, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL net_io_q_sam_sync(char *desc, NET_Q_SAM_SYNC * q_s, prs_struct *ps, +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"); @@ -1719,7 +1719,7 @@ BOOL net_io_q_sam_sync(char *desc, NET_Q_SAM_SYNC * q_s, prs_struct *ps, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_delta_hdr(char *desc, SAM_DELTA_HDR * delta, +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"); @@ -1749,7 +1749,7 @@ static BOOL net_io_sam_delta_hdr(char *desc, SAM_DELTA_HDR * delta, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_delta_mod_count(char *desc, SAM_DELTA_MOD_COUNT *info, +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"); @@ -1773,7 +1773,7 @@ static BOOL net_io_sam_delta_mod_count(char *desc, SAM_DELTA_MOD_COUNT *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_domain_info(char *desc, SAM_DOMAIN_INFO * info, +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"); @@ -1828,7 +1828,7 @@ static BOOL net_io_sam_domain_info(char *desc, SAM_DOMAIN_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_group_info(char *desc, SAM_GROUP_INFO * info, +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"); @@ -1863,7 +1863,7 @@ static BOOL net_io_sam_group_info(char *desc, SAM_GROUP_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_passwd_info(char *desc, SAM_PWD * pwd, +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"); @@ -1973,7 +1973,7 @@ BOOL make_sam_account_info(SAM_ACCOUNT_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_account_info(char *desc, uint8 sess_key[16], +static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], SAM_ACCOUNT_INFO * info, prs_struct *ps, int depth) { @@ -2164,7 +2164,7 @@ static BOOL net_io_sam_account_info(char *desc, uint8 sess_key[16], /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO * info, +static BOOL net_io_sam_group_mem_info(const char *desc, SAM_GROUP_MEM_INFO * info, prs_struct *ps, int depth) { uint32 i; @@ -2248,7 +2248,7 @@ static BOOL net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_alias_info(char *desc, SAM_ALIAS_INFO * info, +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"); @@ -2283,7 +2283,7 @@ static BOOL net_io_sam_alias_info(char *desc, SAM_ALIAS_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO * info, +static BOOL net_io_sam_alias_mem_info(const char *desc, SAM_ALIAS_MEM_INFO * info, prs_struct *ps, int depth) { uint32 i; @@ -2356,7 +2356,7 @@ static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_policy_info(char *desc, SAM_DELTA_POLICY *info, +static BOOL net_io_sam_policy_info(const char *desc, SAM_DELTA_POLICY *info, prs_struct *ps, int depth) { int i; @@ -2442,7 +2442,7 @@ static BOOL net_io_sam_policy_info(char *desc, SAM_DELTA_POLICY *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_trustdoms_info(char *desc, SAM_DELTA_TRUSTDOMS *info, +static BOOL net_io_sam_trustdoms_info(const char *desc, SAM_DELTA_TRUSTDOMS *info, prs_struct *ps, int depth) { int i; @@ -2490,7 +2490,7 @@ static BOOL net_io_sam_trustdoms_info(char *desc, SAM_DELTA_TRUSTDOMS *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_secret_info(char *desc, SAM_DELTA_SECRET *info, +static BOOL net_io_sam_secret_info(const char *desc, SAM_DELTA_SECRET *info, prs_struct *ps, int depth) { int i; @@ -2577,7 +2577,7 @@ static BOOL net_io_sam_secret_info(char *desc, SAM_DELTA_SECRET *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_privs_info(char *desc, SAM_DELTA_PRIVS *info, +static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info, prs_struct *ps, int depth) { int i; @@ -2664,7 +2664,7 @@ static BOOL net_io_sam_privs_info(char *desc, SAM_DELTA_PRIVS *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], +static BOOL net_io_sam_delta_ctr(const char *desc, uint8 sess_key[16], SAM_DELTA_CTR * delta, uint16 type, prs_struct *ps, int depth) { @@ -2746,7 +2746,7 @@ static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16], +BOOL net_io_r_sam_sync(const char *desc, uint8 sess_key[16], NET_R_SAM_SYNC * r_s, prs_struct *ps, int depth) { uint32 i; @@ -2859,7 +2859,7 @@ BOOL init_net_q_sam_deltas(NET_Q_SAM_DELTAS *q_s, const char *srv_name, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL net_io_q_sam_deltas(char *desc, NET_Q_SAM_DELTAS *q_s, prs_struct *ps, +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"); @@ -2888,7 +2888,7 @@ BOOL net_io_q_sam_deltas(char *desc, NET_Q_SAM_DELTAS *q_s, prs_struct *ps, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL net_io_r_sam_deltas(char *desc, uint8 sess_key[16], +BOOL net_io_r_sam_deltas(const char *desc, uint8 sess_key[16], NET_R_SAM_DELTAS *r_s, prs_struct *ps, int depth) { int i; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index d4a9ec3eda..63f9527dec 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -76,7 +76,7 @@ void prs_dump_region(char *name, int v, prs_struct *ps, XXXX side-effect of this function is to increase the debug depth XXXX ********************************************************************/ -void prs_debug(prs_struct *ps, int depth, const char *desc, char *fn_name) +void prs_debug(prs_struct *ps, int depth, const char *desc, const char *fn_name) { DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(depth), ps->data_offset, fn_name, desc)); } @@ -539,7 +539,7 @@ void prs_force_dynamic(prs_struct *ps) Stream a uint8. ********************************************************************/ -BOOL prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8) +BOOL prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8) { char *q = prs_mem_get(ps, 1); if (q == NULL) @@ -561,7 +561,7 @@ BOOL prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8) Stream a uint16. ********************************************************************/ -BOOL prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16) +BOOL prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16) { char *q = prs_mem_get(ps, sizeof(uint16)); if (q == NULL) @@ -590,7 +590,7 @@ BOOL prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16) Stream a uint32. ********************************************************************/ -BOOL prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) +BOOL prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32) { char *q = prs_mem_get(ps, sizeof(uint32)); if (q == NULL) @@ -619,7 +619,7 @@ BOOL prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) Stream a NTSTATUS ********************************************************************/ -BOOL prs_ntstatus(char *name, prs_struct *ps, int depth, NTSTATUS *status) +BOOL prs_ntstatus(const char *name, prs_struct *ps, int depth, NTSTATUS *status) { char *q = prs_mem_get(ps, sizeof(uint32)); if (q == NULL) @@ -649,7 +649,7 @@ BOOL prs_ntstatus(char *name, prs_struct *ps, int depth, NTSTATUS *status) Stream a WERROR ********************************************************************/ -BOOL prs_werror(char *name, prs_struct *ps, int depth, WERROR *status) +BOOL prs_werror(const char *name, prs_struct *ps, int depth, WERROR *status) { char *q = prs_mem_get(ps, sizeof(uint32)); if (q == NULL) @@ -680,7 +680,7 @@ BOOL prs_werror(char *name, prs_struct *ps, int depth, WERROR *status) Stream an array of uint8s. Length is number of uint8s. ********************************************************************/ -BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *data8s, int len) +BOOL prs_uint8s(BOOL charmode, const char *name, prs_struct *ps, int depth, uint8 *data8s, int len) { int i; char *q = prs_mem_get(ps, len); @@ -713,7 +713,7 @@ BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *dat Stream an array of uint16s. Length is number of uint16s. ********************************************************************/ -BOOL prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len) +BOOL prs_uint16s(BOOL charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len) { int i; char *q = prs_mem_get(ps, len * sizeof(uint16)); @@ -757,7 +757,7 @@ BOOL prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *d output must be little-endian, if marshalling, input must be little-endian. ********************************************************************/ -static void dbg_rw_punival(BOOL charmode, char *name, int depth, prs_struct *ps, +static void dbg_rw_punival(BOOL charmode, const char *name, int depth, prs_struct *ps, char *in_buf, char *out_buf, int len) { int i; @@ -794,7 +794,7 @@ static void dbg_rw_punival(BOOL charmode, char *name, int depth, prs_struct *ps, Stream a unistr. Always little endian. ********************************************************************/ -BOOL prs_uint16uni(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len) +BOOL prs_uint16uni(BOOL charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len) { char *q = prs_mem_get(ps, len * sizeof(uint16)); if (q == NULL) @@ -810,7 +810,7 @@ BOOL prs_uint16uni(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 Stream an array of uint32s. Length is number of uint32s. ********************************************************************/ -BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *data32s, int len) +BOOL prs_uint32s(BOOL charmode, const char *name, prs_struct *ps, int depth, uint32 *data32s, int len) { int i; char *q = prs_mem_get(ps, len * sizeof(uint32)); @@ -854,7 +854,7 @@ BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *d in uint16 chars. The unicode string is already in little-endian format. ********************************************************************/ -BOOL prs_buffer5(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER5 *str) +BOOL prs_buffer5(BOOL charmode, const char *name, prs_struct *ps, int depth, BUFFER5 *str) { char *p; char *q = prs_mem_get(ps, str->buf_len * sizeof(uint16)); @@ -885,7 +885,7 @@ BOOL prs_buffer5(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER5 * in byte chars. String is in little-endian format. ********************************************************************/ -BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 *str) +BOOL prs_buffer2(BOOL charmode, const char *name, prs_struct *ps, int depth, BUFFER2 *str) { char *p; char *q = prs_mem_get(ps, str->buf_len); @@ -913,7 +913,7 @@ BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 * in uint8 chars. ********************************************************************/ -BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 *str) +BOOL prs_string2(BOOL charmode, const char *name, prs_struct *ps, int depth, STRING2 *str) { int i; char *q = prs_mem_get(ps, str->str_max_len); @@ -953,7 +953,7 @@ BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 * in uint16 chars. The unicode string is already in little-endian format. ********************************************************************/ -BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *str) +BOOL prs_unistr2(BOOL charmode, const char *name, prs_struct *ps, int depth, UNISTR2 *str) { char *p; char *q = prs_mem_get(ps, str->uni_str_len * sizeof(uint16)); @@ -984,7 +984,7 @@ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 * in uint16 chars. The unicode string is already in little-endian format. ********************************************************************/ -BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int depth) +BOOL prs_unistr3(BOOL charmode, const char *name, UNISTR3 *str, prs_struct *ps, int depth) { char *p; char *q = prs_mem_get(ps, str->uni_str_len * sizeof(uint16)); @@ -1010,7 +1010,7 @@ BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int de in little-endian format then do it as a stream of bytes. ********************************************************************/ -BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) +BOOL prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) { int len = 0; unsigned char *p = (unsigned char *)str->buffer; @@ -1136,7 +1136,7 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) not include the null-termination character. ********************************************************************/ -BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, int len, int max_buf_size) +BOOL prs_string(const char *name, prs_struct *ps, int depth, char *str, int len, int max_buf_size) { char *q; int i; @@ -1173,7 +1173,7 @@ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, int len, int m uint16 should be stored, or gets the size if reading. ********************************************************************/ -BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset) +BOOL prs_uint16_pre(const char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset) { *offset = ps->data_offset; if (UNMARSHALLING(ps)) { @@ -1193,7 +1193,7 @@ BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint3 does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ -BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, +BOOL prs_uint16_post(const char *name, prs_struct *ps, int depth, uint16 *data16, uint32 ptr_uint16, uint32 start_offset) { if (MARSHALLING(ps)) { @@ -1220,7 +1220,7 @@ BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 should be stored, or gets the size if reading. ********************************************************************/ -BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset) +BOOL prs_uint32_pre(const char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset) { *offset = ps->data_offset; if (UNMARSHALLING(ps) && (data32 != NULL)) { @@ -1237,7 +1237,7 @@ BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint3 does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ -BOOL prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32, +BOOL prs_uint32_post(const char *name, prs_struct *ps, int depth, uint32 *data32, uint32 ptr_uint32, uint32 data_size) { if (MARSHALLING(ps)) { diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 7bb8a6e2b4..456fad69b4 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -62,7 +62,7 @@ void init_reg_q_open_hkcr(REG_Q_OPEN_HKCR *q_o, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_open_hkcr(char *desc, REG_Q_OPEN_HKCR *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_open_hkcr(const char *desc, REG_Q_OPEN_HKCR *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -93,7 +93,7 @@ BOOL reg_io_q_open_hkcr(char *desc, REG_Q_OPEN_HKCR *r_q, prs_struct *ps, int d reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_open_hkcr(char *desc, REG_R_OPEN_HKCR *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_open_hkcr(const char *desc, REG_R_OPEN_HKCR *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -130,7 +130,7 @@ void init_reg_q_open_hklm(REG_Q_OPEN_HKLM * q_o, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_open_hklm(char *desc, REG_Q_OPEN_HKLM * r_q, prs_struct *ps, +BOOL reg_io_q_open_hklm(const char *desc, REG_Q_OPEN_HKLM * r_q, prs_struct *ps, int depth) { if (r_q == NULL) @@ -161,7 +161,7 @@ BOOL reg_io_q_open_hklm(char *desc, REG_Q_OPEN_HKLM * r_q, prs_struct *ps, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_open_hklm(char *desc, REG_R_OPEN_HKLM * r_r, prs_struct *ps, +BOOL reg_io_r_open_hklm(const char *desc, REG_R_OPEN_HKLM * r_r, prs_struct *ps, int depth) { if (r_r == NULL) @@ -198,7 +198,7 @@ void init_reg_q_flush_key(REG_Q_FLUSH_KEY *q_u, POLICY_HND *pol) reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_flush_key(char *desc, REG_Q_FLUSH_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_flush_key(const char *desc, REG_Q_FLUSH_KEY *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -219,7 +219,7 @@ BOOL reg_io_q_flush_key(char *desc, REG_Q_FLUSH_KEY *r_q, prs_struct *ps, int d reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_flush_key(char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_flush_key(const char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -311,7 +311,7 @@ void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_create_key(char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_create_key(const char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -367,7 +367,7 @@ BOOL reg_io_q_create_key(char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_create_key(char *desc, REG_R_CREATE_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_create_key(const char *desc, REG_R_CREATE_KEY *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -410,7 +410,7 @@ void init_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_delete_val(char *desc, REG_Q_DELETE_VALUE *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_delete_val(const char *desc, REG_Q_DELETE_VALUE *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -439,7 +439,7 @@ BOOL reg_io_q_delete_val(char *desc, REG_Q_DELETE_VALUE *r_q, prs_struct *ps, i reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_delete_val(char *desc, REG_R_DELETE_VALUE *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_delete_val(const char *desc, REG_R_DELETE_VALUE *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -476,7 +476,7 @@ void init_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_delete_key(char *desc, REG_Q_DELETE_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_delete_key(const char *desc, REG_Q_DELETE_KEY *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -504,7 +504,7 @@ BOOL reg_io_q_delete_key(char *desc, REG_Q_DELETE_KEY *r_q, prs_struct *ps, int reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_delete_key(char *desc, REG_R_DELETE_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_delete_key(const char *desc, REG_R_DELETE_KEY *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -539,7 +539,7 @@ void init_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_query_key(char *desc, REG_Q_QUERY_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_query_key(const char *desc, REG_Q_QUERY_KEY *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -568,7 +568,7 @@ BOOL reg_io_q_query_key(char *desc, REG_Q_QUERY_KEY *r_q, prs_struct *ps, int d reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_query_key(const char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -624,7 +624,7 @@ void init_reg_q_unknown_1a(REG_Q_UNKNOWN_1A *q_o, POLICY_HND *hnd) reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_unknown_1a(char *desc, REG_Q_UNKNOWN_1A *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_unknown_1a(const char *desc, REG_Q_UNKNOWN_1A *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -645,7 +645,7 @@ BOOL reg_io_q_unknown_1a(char *desc, REG_Q_UNKNOWN_1A *r_q, prs_struct *ps, int reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_unknown_1a(char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_unknown_1a(const char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -669,7 +669,7 @@ BOOL reg_io_r_unknown_1a(char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *ps, int reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_save_key(char *desc, REG_Q_SAVE_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_save_key(const char *desc, REG_Q_SAVE_KEY *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -698,7 +698,7 @@ BOOL reg_io_q_save_key(char *desc, REG_Q_SAVE_KEY *r_q, prs_struct *ps, int dep reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_save_key(char *desc, REG_R_SAVE_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_save_key(const char *desc, REG_R_SAVE_KEY *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -732,7 +732,7 @@ void init_reg_q_open_hku(REG_Q_OPEN_HKU *q_o, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_open_hku(char *desc, REG_Q_OPEN_HKU *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_open_hku(const char *desc, REG_Q_OPEN_HKU *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -761,7 +761,7 @@ BOOL reg_io_q_open_hku(char *desc, REG_Q_OPEN_HKU *r_q, prs_struct *ps, int dep reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_open_hku(char *desc, REG_R_OPEN_HKU *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_open_hku(const char *desc, REG_R_OPEN_HKU *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -796,7 +796,7 @@ void init_reg_q_close(REG_Q_CLOSE *q_c, POLICY_HND *hnd) reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_close(char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth) +BOOL reg_io_q_close(const char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -819,7 +819,7 @@ BOOL reg_io_q_close(char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth) reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) +BOOL reg_io_r_close(const char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -860,7 +860,7 @@ void init_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, SEC_DESC_BU reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_set_key_sec(const char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -889,7 +889,7 @@ BOOL reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, i reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_set_key_sec(const char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -930,7 +930,7 @@ void init_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_get_key_sec(char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_get_key_sec(const char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -975,7 +975,7 @@ makes a structure. reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_get_key_sec(char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_get_key_sec(const char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1041,7 +1041,7 @@ BOOL init_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char* val_name) reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_info(const char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1174,7 +1174,7 @@ BOOL init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r, reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_info(const char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -1298,7 +1298,7 @@ void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_enum_val(char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int depth) +BOOL reg_io_q_enum_val(const char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int depth) { if (q_q == NULL) return False; @@ -1357,7 +1357,7 @@ BOOL reg_io_q_enum_val(char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int d reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_enum_val(char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1435,7 +1435,7 @@ void init_reg_q_create_val(REG_Q_CREATE_VALUE *q_i, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_create_val(char *desc, REG_Q_CREATE_VALUE *q_q, prs_struct *ps, int depth) +BOOL reg_io_q_create_val(const char *desc, REG_Q_CREATE_VALUE *q_q, prs_struct *ps, int depth) { if (q_q == NULL) return False; @@ -1470,7 +1470,7 @@ BOOL reg_io_q_create_val(char *desc, REG_Q_CREATE_VALUE *q_q, prs_struct *ps, i reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_create_val(char *desc, REG_R_CREATE_VALUE *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_create_val(const char *desc, REG_R_CREATE_VALUE *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1537,7 +1537,7 @@ void init_reg_r_enum_key(REG_R_ENUM_KEY *r_u, char *subkey, uint32 unknown_1, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_enum_key(char *desc, REG_Q_ENUM_KEY *q_q, prs_struct *ps, int depth) +BOOL reg_io_q_enum_key(const char *desc, REG_Q_ENUM_KEY *q_q, prs_struct *ps, int depth) { if (q_q == NULL) return False; @@ -1591,7 +1591,7 @@ BOOL reg_io_q_enum_key(char *desc, REG_Q_ENUM_KEY *q_q, prs_struct *ps, int dep reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_enum_key(char *desc, REG_R_ENUM_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_enum_key(const char *desc, REG_R_ENUM_KEY *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1665,7 +1665,7 @@ void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_open_entry(const char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1713,7 +1713,7 @@ void init_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r, reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_open_entry(char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -1759,7 +1759,7 @@ void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, const char *msg, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_shutdown(char *desc, REG_Q_SHUTDOWN * q_s, prs_struct *ps, +BOOL reg_io_q_shutdown(const char *desc, REG_Q_SHUTDOWN * q_s, prs_struct *ps, int depth) { if (q_s == NULL) @@ -1798,7 +1798,7 @@ BOOL reg_io_q_shutdown(char *desc, REG_Q_SHUTDOWN * q_s, prs_struct *ps, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_shutdown(char *desc, REG_R_SHUTDOWN * r_s, prs_struct *ps, +BOOL reg_io_r_shutdown(const char *desc, REG_R_SHUTDOWN * r_s, prs_struct *ps, int depth) { if (r_s == NULL) @@ -1829,7 +1829,7 @@ void init_reg_q_abort_shutdown(REG_Q_ABORT_SHUTDOWN * q_s) /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_abort_shutdown(char *desc, REG_Q_ABORT_SHUTDOWN * q_s, +BOOL reg_io_q_abort_shutdown(const char *desc, REG_Q_ABORT_SHUTDOWN * q_s, prs_struct *ps, int depth) { if (q_s == NULL) @@ -1853,7 +1853,7 @@ BOOL reg_io_q_abort_shutdown(char *desc, REG_Q_ABORT_SHUTDOWN * q_s, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_abort_shutdown(char *desc, REG_R_ABORT_SHUTDOWN * r_s, +BOOL reg_io_r_abort_shutdown(const char *desc, REG_R_ABORT_SHUTDOWN * r_s, prs_struct *ps, int depth) { if (r_s == NULL) diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index e8825a2e14..fafbbb1965 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -143,7 +143,7 @@ interface/version dce/rpc pipe identification * update the index #defines in smb.h. */ -struct pipe_id_info pipe_names [] = +const struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, @@ -182,7 +182,7 @@ void init_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, Reads or writes an RPC_HDR structure. ********************************************************************/ -BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -236,7 +236,7 @@ BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) Reads or writes an RPC_IFACE structure. ********************************************************************/ -static BOOL smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) +static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) { if (ifc == NULL) return False; @@ -266,7 +266,7 @@ static BOOL smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int dep Inits an RPC_ADDR_STR structure. ********************************************************************/ -static void init_rpc_addr_str(RPC_ADDR_STR *str, char *name) +static void init_rpc_addr_str(RPC_ADDR_STR *str, const char *name) { str->len = strlen(name) + 1; fstrcpy(str->str, name); @@ -276,7 +276,7 @@ static void init_rpc_addr_str(RPC_ADDR_STR *str, char *name) Reads or writes an RPC_ADDR_STR structure. ********************************************************************/ -static BOOL smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) +static BOOL smb_io_rpc_addr_str(const char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) { if (str == NULL) return False; @@ -308,7 +308,7 @@ static void init_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsiz Reads or writes an RPC_HDR_BBA structure. ********************************************************************/ -static BOOL smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) +static BOOL smb_io_rpc_hdr_bba(const char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -351,7 +351,7 @@ void init_rpc_hdr_rb(RPC_HDR_RB *rpc, Reads or writes an RPC_HDR_RB structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -397,7 +397,7 @@ static void init_rpc_results(RPC_RESULTS *res, lkclXXXX only one reason at the moment! ********************************************************************/ -static BOOL smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) +static BOOL smb_io_rpc_results(const char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) { if (res == NULL) return False; @@ -430,7 +430,7 @@ static BOOL smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int void init_rpc_hdr_ba(RPC_HDR_BA *rpc, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, - char *pipe_addr, + const char *pipe_addr, uint8 num_results, uint16 result, uint16 reason, RPC_IFACE *transfer) { @@ -446,7 +446,7 @@ void init_rpc_hdr_ba(RPC_HDR_BA *rpc, Reads or writes an RPC_HDR_BA structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_ba(const char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -480,7 +480,7 @@ void init_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum) Reads or writes an RPC_HDR_REQ structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_req(const char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -501,7 +501,7 @@ BOOL smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) Reads or writes an RPC_HDR_RESP structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_resp(const char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -524,7 +524,7 @@ BOOL smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int dept Reads or writes an RPC_HDR_FAULT structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_fault(char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -564,7 +564,7 @@ void init_rpc_hdr_autha(RPC_HDR_AUTHA *rai, Reads or writes an RPC_HDR_AUTHA structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_autha(const char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) { if (rai == NULL) return False; @@ -622,7 +622,7 @@ void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, Reads or writes an RPC_HDR_AUTH structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) { if (rai == NULL) return False; @@ -653,7 +653,7 @@ BOOL smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int dept ********************************************************************/ BOOL rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav, - char *signature, uint32 msg_type) + const char *signature, uint32 msg_type) { return (strequal(rav->signature, signature) && rav->msg_type == msg_type); } @@ -663,7 +663,7 @@ BOOL rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav, ********************************************************************/ void init_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, - char *signature, uint32 msg_type) + const char *signature, uint32 msg_type) { fstrcpy(rav->signature, signature); /* "NTLMSSP" */ rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */ @@ -673,7 +673,7 @@ void init_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, Reads or writes an RPC_AUTH_VERIFIER structure. ********************************************************************/ -BOOL smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) { if (rav == NULL) return False; @@ -717,7 +717,7 @@ void init_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, *** lkclXXXX HACK ALERT! *** ********************************************************************/ -BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_neg(const char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) { uint32 start_offset = prs_offset(ps); if (neg == NULL) @@ -804,7 +804,7 @@ void init_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, Reads or writes an RPC_AUTH_NTLMSSP_CHAL structure. ********************************************************************/ -BOOL smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_chal(const char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth) { if (chl == NULL) return False; @@ -908,7 +908,7 @@ void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, *** lkclXXXX the actual offset is at the start of the auth verifier *** ********************************************************************/ -BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_resp(const char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) { if (rsp == NULL) return False; @@ -1082,7 +1082,7 @@ void init_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, Reads or writes an RPC_AUTH_NTLMSSP_CHK structure. ********************************************************************/ -BOOL smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_chk(const char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth) { if (chk == NULL) return False; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 61b13d1350..918cdbcd1d 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -47,7 +47,7 @@ void init_samr_q_close_hnd(SAMR_Q_CLOSE_HND * q_c, POLICY_HND *hnd) reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_close_hnd(char *desc, SAMR_Q_CLOSE_HND * q_u, +BOOL samr_io_q_close_hnd(const char *desc, SAMR_Q_CLOSE_HND * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -66,7 +66,7 @@ BOOL samr_io_q_close_hnd(char *desc, SAMR_Q_CLOSE_HND * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND * r_u, +BOOL samr_io_r_close_hnd(const char *desc, SAMR_R_CLOSE_HND * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -107,7 +107,7 @@ void init_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN * q_u, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_lookup_domain(char *desc, SAMR_Q_LOOKUP_DOMAIN * q_u, +BOOL samr_io_q_lookup_domain(const char *desc, SAMR_Q_LOOKUP_DOMAIN * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -152,7 +152,7 @@ void init_samr_r_lookup_domain(SAMR_R_LOOKUP_DOMAIN * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_lookup_domain(char *desc, SAMR_R_LOOKUP_DOMAIN * r_u, +BOOL samr_io_r_lookup_domain(const char *desc, SAMR_R_LOOKUP_DOMAIN * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -196,7 +196,7 @@ void init_samr_q_unknown_2d(SAMR_Q_UNKNOWN_2D * q_u, POLICY_HND *dom_pol, DOM_SI reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_unknown_2d(char *desc, SAMR_Q_UNKNOWN_2D * q_u, +BOOL samr_io_q_unknown_2d(const char *desc, SAMR_Q_UNKNOWN_2D * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -224,7 +224,7 @@ BOOL samr_io_q_unknown_2d(char *desc, SAMR_Q_UNKNOWN_2D * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_unknown_2d(char *desc, SAMR_R_UNKNOWN_2D * r_u, +BOOL samr_io_r_unknown_2d(const char *desc, SAMR_R_UNKNOWN_2D * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -261,7 +261,7 @@ void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN * q_u, +BOOL samr_io_q_open_domain(const char *desc, SAMR_Q_OPEN_DOMAIN * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -289,7 +289,7 @@ BOOL samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN * r_u, +BOOL samr_io_r_open_domain(const char *desc, SAMR_R_OPEN_DOMAIN * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -326,7 +326,7 @@ void init_samr_q_get_usrdom_pwinfo(SAMR_Q_GET_USRDOM_PWINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_get_usrdom_pwinfo(char *desc, SAMR_Q_GET_USRDOM_PWINFO * q_u, +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) @@ -368,7 +368,7 @@ void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO *r_u, NTSTATUS statu reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_get_usrdom_pwinfo(char *desc, SAMR_R_GET_USRDOM_PWINFO * r_u, +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) @@ -397,7 +397,7 @@ BOOL samr_io_r_get_usrdom_pwinfo(char *desc, SAMR_R_GET_USRDOM_PWINFO * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_sec_obj(char *desc, SAMR_Q_SET_SEC_OBJ * q_u, +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) @@ -440,7 +440,7 @@ void init_samr_q_query_sec_obj(SAMR_Q_QUERY_SEC_OBJ * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_sec_obj(char *desc, SAMR_Q_QUERY_SEC_OBJ * q_u, +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) @@ -478,7 +478,7 @@ void init_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO * q_u, +BOOL samr_io_q_query_dom_info(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -514,7 +514,7 @@ void init_unk_info3(SAM_UNK_INFO_3 *u_3, NTTIME nt_logout) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info3(char *desc, SAM_UNK_INFO_3 * u_3, +static BOOL sam_io_unk_info3(const char *desc, SAM_UNK_INFO_3 * u_3, prs_struct *ps, int depth) { if (u_3 == NULL) @@ -544,7 +544,7 @@ void init_unk_info6(SAM_UNK_INFO_6 * u_6) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info6(char *desc, SAM_UNK_INFO_6 * u_6, +static BOOL sam_io_unk_info6(const char *desc, SAM_UNK_INFO_6 * u_6, prs_struct *ps, int depth) { if (u_6 == NULL) @@ -576,7 +576,7 @@ void init_unk_info7(SAM_UNK_INFO_7 * u_7) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info7(char *desc, SAM_UNK_INFO_7 * u_7, +static BOOL sam_io_unk_info7(const char *desc, SAM_UNK_INFO_7 * u_7, prs_struct *ps, int depth) { if (u_7 == NULL) @@ -609,7 +609,7 @@ void init_unk_info12(SAM_UNK_INFO_12 * u_12, NTTIME nt_lock_duration, NTTIME nt_ reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info12(char *desc, SAM_UNK_INFO_12 * u_12, +static BOOL sam_io_unk_info12(const char *desc, SAM_UNK_INFO_12 * u_12, prs_struct *ps, int depth) { if (u_12 == NULL) @@ -644,7 +644,7 @@ void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *server) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info5(char *desc, SAM_UNK_INFO_5 * u_5, +static BOOL sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5, prs_struct *ps, int depth) { if (u_5 == NULL) @@ -700,7 +700,7 @@ void init_unk_info2(SAM_UNK_INFO_2 * u_2, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 * u_2, +static BOOL sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2, prs_struct *ps, int depth) { if (u_2 == NULL) @@ -787,7 +787,7 @@ void init_unk_info1(SAM_UNK_INFO_1 *u_1, uint16 min_pass_len, uint16 pass_hist, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info1(char *desc, SAM_UNK_INFO_1 * u_1, +static BOOL sam_io_unk_info1(const char *desc, SAM_UNK_INFO_1 * u_1, prs_struct *ps, int depth) { if (u_1 == NULL) @@ -835,7 +835,7 @@ void init_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, +BOOL samr_io_r_query_dom_info(const char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -906,7 +906,7 @@ BOOL samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, reads or writes a SAMR_R_SET_SEC_OBJ structure. ********************************************************************/ -BOOL samr_io_r_set_sec_obj(char *desc, SAMR_R_SET_SEC_OBJ * r_u, +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) @@ -928,7 +928,7 @@ BOOL samr_io_r_set_sec_obj(char *desc, SAMR_R_SET_SEC_OBJ * r_u, reads or writes a SAMR_R_QUERY_SEC_OBJ structure. ********************************************************************/ -BOOL samr_io_r_query_sec_obj(char *desc, SAMR_R_QUERY_SEC_OBJ * r_u, +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) @@ -957,7 +957,7 @@ BOOL samr_io_r_query_sec_obj(char *desc, SAMR_R_QUERY_SEC_OBJ * r_u, reads or writes a SAM_STR1 structure. ********************************************************************/ -static BOOL sam_io_sam_str1(char *desc, SAM_STR1 * sam, uint32 acct_buf, +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) { @@ -1007,7 +1007,7 @@ static void init_sam_entry1(SAM_ENTRY1 * sam, uint32 user_idx, reads or writes a SAM_ENTRY1 structure. ********************************************************************/ -static BOOL sam_io_sam_entry1(char *desc, SAM_ENTRY1 * sam, +static BOOL sam_io_sam_entry1(const char *desc, SAM_ENTRY1 * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1044,7 +1044,7 @@ static BOOL sam_io_sam_entry1(char *desc, SAM_ENTRY1 * sam, reads or writes a SAM_STR2 structure. ********************************************************************/ -static BOOL sam_io_sam_str2(char *desc, SAM_STR2 * sam, uint32 acct_buf, +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) @@ -1085,7 +1085,7 @@ static void init_sam_entry2(SAM_ENTRY2 * sam, uint32 user_idx, reads or writes a SAM_ENTRY2 structure. ********************************************************************/ -static BOOL sam_io_sam_entry2(char *desc, SAM_ENTRY2 * sam, +static BOOL sam_io_sam_entry2(const char *desc, SAM_ENTRY2 * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1120,7 +1120,7 @@ static BOOL sam_io_sam_entry2(char *desc, SAM_ENTRY2 * sam, reads or writes a SAM_STR3 structure. ********************************************************************/ -static BOOL sam_io_sam_str3(char *desc, SAM_STR3 * sam, uint32 acct_buf, +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) @@ -1162,7 +1162,7 @@ static void init_sam_entry3(SAM_ENTRY3 * sam, uint32 grp_idx, reads or writes a SAM_ENTRY3 structure. ********************************************************************/ -static BOOL sam_io_sam_entry3(char *desc, SAM_ENTRY3 * sam, +static BOOL sam_io_sam_entry3(const char *desc, SAM_ENTRY3 * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1207,7 +1207,7 @@ static void init_sam_entry4(SAM_ENTRY4 * sam, uint32 user_idx, reads or writes a SAM_ENTRY4 structure. ********************************************************************/ -static BOOL sam_io_sam_entry4(char *desc, SAM_ENTRY4 * sam, +static BOOL sam_io_sam_entry4(const char *desc, SAM_ENTRY4 * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1245,7 +1245,7 @@ static void init_sam_entry5(SAM_ENTRY5 * sam, uint32 grp_idx, reads or writes a SAM_ENTRY5 structure. ********************************************************************/ -static BOOL sam_io_sam_entry5(char *desc, SAM_ENTRY5 * sam, +static BOOL sam_io_sam_entry5(const char *desc, SAM_ENTRY5 * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1281,7 +1281,7 @@ void init_sam_entry(SAM_ENTRY * sam, uint32 len_sam_name, uint32 rid) reads or writes a SAM_ENTRY structure. ********************************************************************/ -static BOOL sam_io_sam_entry(char *desc, SAM_ENTRY * sam, +static BOOL sam_io_sam_entry(const char *desc, SAM_ENTRY * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1322,7 +1322,7 @@ void init_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS * q_e, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_enum_dom_users(char *desc, SAMR_Q_ENUM_DOM_USERS * q_e, +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) @@ -1380,7 +1380,7 @@ void init_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS * r_u, +BOOL samr_io_r_enum_dom_users(const char *desc, SAMR_R_ENUM_DOM_USERS * r_u, prs_struct *ps, int depth) { uint32 i; @@ -1465,7 +1465,7 @@ void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO * q_e, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO * q_e, +BOOL samr_io_q_query_dispinfo(const char *desc, SAMR_Q_QUERY_DISPINFO * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -1585,7 +1585,7 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_en reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_1(char *desc, SAM_DISPINFO_1 * sam, +static BOOL sam_io_sam_dispinfo_1(const char *desc, SAM_DISPINFO_1 * sam, uint32 num_entries, prs_struct *ps, int depth) { @@ -1702,7 +1702,7 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_en reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_2(char *desc, SAM_DISPINFO_2 * sam, +static BOOL sam_io_sam_dispinfo_2(const char *desc, SAM_DISPINFO_2 * sam, uint32 num_entries, prs_struct *ps, int depth) { @@ -1796,7 +1796,7 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_en reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_3(char *desc, SAM_DISPINFO_3 * sam, +static BOOL sam_io_sam_dispinfo_3(const char *desc, SAM_DISPINFO_3 * sam, uint32 num_entries, prs_struct *ps, int depth) { @@ -1888,7 +1888,7 @@ NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 num_en reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 * sam, +static BOOL sam_io_sam_dispinfo_4(const char *desc, SAM_DISPINFO_4 * sam, uint32 num_entries, prs_struct *ps, int depth) { @@ -1978,7 +1978,7 @@ NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 num_en reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_5(char *desc, SAM_DISPINFO_5 * sam, +static BOOL sam_io_sam_dispinfo_5(const char *desc, SAM_DISPINFO_5 * sam, uint32 num_entries, prs_struct *ps, int depth) { @@ -2057,7 +2057,7 @@ void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO * r_u, +BOOL samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2155,7 +2155,7 @@ void init_samr_q_open_group(SAMR_Q_OPEN_GROUP * q_c, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_open_group(char *desc, SAMR_Q_OPEN_GROUP * q_u, +BOOL samr_io_q_open_group(const char *desc, SAMR_Q_OPEN_GROUP * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -2182,7 +2182,7 @@ BOOL samr_io_q_open_group(char *desc, SAMR_Q_OPEN_GROUP * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP * r_u, +BOOL samr_io_r_open_group(const char *desc, SAMR_R_OPEN_GROUP * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2231,7 +2231,7 @@ void init_samr_group_info1(GROUP_INFO1 * gr1, reads or writes a structure. ********************************************************************/ -BOOL samr_io_group_info1(char *desc, GROUP_INFO1 * gr1, +BOOL samr_io_group_info1(const char *desc, GROUP_INFO1 * gr1, prs_struct *ps, int depth) { if (gr1 == NULL) @@ -2280,7 +2280,7 @@ void init_samr_group_info3(GROUP_INFO3 *gr3) reads or writes a structure. ********************************************************************/ -BOOL samr_io_group_info3(char *desc, GROUP_INFO3 *gr3, prs_struct *ps, int depth) +BOOL samr_io_group_info3(const char *desc, GROUP_INFO3 *gr3, prs_struct *ps, int depth) { if (gr3 == NULL) return False; @@ -2315,7 +2315,7 @@ void init_samr_group_info4(GROUP_INFO4 * gr4, char *acct_desc) reads or writes a structure. ********************************************************************/ -BOOL samr_io_group_info4(char *desc, GROUP_INFO4 * gr4, +BOOL samr_io_group_info4(const char *desc, GROUP_INFO4 * gr4, prs_struct *ps, int depth) { if (gr4 == NULL) @@ -2340,7 +2340,7 @@ BOOL samr_io_group_info4(char *desc, GROUP_INFO4 * gr4, reads or writes a structure. ********************************************************************/ -static BOOL samr_group_info_ctr(char *desc, GROUP_INFO_CTR **ctr, +static BOOL samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr, prs_struct *ps, int depth) { if (UNMARSHALLING(ps)) @@ -2400,7 +2400,7 @@ void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_create_dom_group(char *desc, SAMR_Q_CREATE_DOM_GROUP * q_e, +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) @@ -2433,7 +2433,7 @@ BOOL samr_io_q_create_dom_group(char *desc, SAMR_Q_CREATE_DOM_GROUP * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_create_dom_group(char *desc, SAMR_R_CREATE_DOM_GROUP * r_u, +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) @@ -2472,7 +2472,7 @@ void init_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP * q_c, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_delete_dom_group(char *desc, SAMR_Q_DELETE_DOM_GROUP * q_u, +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) @@ -2494,7 +2494,7 @@ BOOL samr_io_q_delete_dom_group(char *desc, SAMR_Q_DELETE_DOM_GROUP * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_delete_dom_group(char *desc, SAMR_R_DELETE_DOM_GROUP * r_u, +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) @@ -2532,7 +2532,7 @@ void init_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_del_groupmem(char *desc, SAMR_Q_DEL_GROUPMEM * q_e, +BOOL samr_io_q_del_groupmem(const char *desc, SAMR_Q_DEL_GROUPMEM * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -2569,7 +2569,7 @@ void init_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM * r_u, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_del_groupmem(char *desc, SAMR_R_DEL_GROUPMEM * r_u, +BOOL samr_io_r_del_groupmem(const char *desc, SAMR_R_DEL_GROUPMEM * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2605,7 +2605,7 @@ void init_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_add_groupmem(char *desc, SAMR_Q_ADD_GROUPMEM * q_e, +BOOL samr_io_q_add_groupmem(const char *desc, SAMR_Q_ADD_GROUPMEM * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -2644,7 +2644,7 @@ void init_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM * r_u, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_add_groupmem(char *desc, SAMR_R_ADD_GROUPMEM * r_u, +BOOL samr_io_r_add_groupmem(const char *desc, SAMR_R_ADD_GROUPMEM * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2679,7 +2679,7 @@ void init_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_groupinfo(char *desc, SAMR_Q_SET_GROUPINFO * q_e, +BOOL samr_io_q_set_groupinfo(const char *desc, SAMR_Q_SET_GROUPINFO * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -2715,7 +2715,7 @@ void init_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO * r_u, NTSTATUS status) reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_groupinfo(char *desc, SAMR_R_SET_GROUPINFO * r_u, +BOOL samr_io_r_set_groupinfo(const char *desc, SAMR_R_SET_GROUPINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2751,7 +2751,7 @@ void init_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_groupinfo(char *desc, SAMR_Q_QUERY_GROUPINFO * q_e, +BOOL samr_io_q_query_groupinfo(const char *desc, SAMR_Q_QUERY_GROUPINFO * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -2790,7 +2790,7 @@ void init_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_groupinfo(char *desc, SAMR_R_QUERY_GROUPINFO * r_u, +BOOL samr_io_r_query_groupinfo(const char *desc, SAMR_R_QUERY_GROUPINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2833,7 +2833,7 @@ void init_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM * q_c, POLICY_HND *hnd) reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_groupmem(char *desc, SAMR_Q_QUERY_GROUPMEM * q_u, +BOOL samr_io_q_query_groupmem(const char *desc, SAMR_Q_QUERY_GROUPMEM * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -2885,7 +2885,7 @@ void init_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM * r_u, +BOOL samr_io_r_query_groupmem(const char *desc, SAMR_R_QUERY_GROUPMEM * r_u, prs_struct *ps, int depth) { uint32 i; @@ -2967,7 +2967,7 @@ void init_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS * q_u, +BOOL samr_io_q_query_usergroups(const char *desc, SAMR_Q_QUERY_USERGROUPS * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -3016,7 +3016,7 @@ void init_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_gids(char *desc, uint32 *num_gids, DOM_GID ** gid, +BOOL samr_io_gids(const char *desc, uint32 *num_gids, DOM_GID ** gid, prs_struct *ps, int depth) { uint32 i; @@ -3054,7 +3054,7 @@ BOOL samr_io_gids(char *desc, uint32 *num_gids, DOM_GID ** gid, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS * r_u, +BOOL samr_io_r_query_usergroups(const char *desc, SAMR_R_QUERY_USERGROUPS * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -3109,7 +3109,7 @@ void init_samr_q_enum_domains(SAMR_Q_ENUM_DOMAINS * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_enum_domains(char *desc, SAMR_Q_ENUM_DOMAINS * q_e, +BOOL samr_io_q_enum_domains(const char *desc, SAMR_Q_ENUM_DOMAINS * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -3161,7 +3161,7 @@ void init_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_enum_domains(char *desc, SAMR_R_ENUM_DOMAINS * r_u, +BOOL samr_io_r_enum_domains(const char *desc, SAMR_R_ENUM_DOMAINS * r_u, prs_struct *ps, int depth) { uint32 i; @@ -3248,7 +3248,7 @@ void init_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_enum_dom_groups(char *desc, SAMR_Q_ENUM_DOM_GROUPS * q_e, +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) @@ -3300,7 +3300,7 @@ void init_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS * r_u, +BOOL samr_io_r_enum_dom_groups(const char *desc, SAMR_R_ENUM_DOM_GROUPS * r_u, prs_struct *ps, int depth) { uint32 i; @@ -3383,7 +3383,7 @@ void init_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_enum_dom_aliases(char *desc, SAMR_Q_ENUM_DOM_ALIASES * q_e, +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) @@ -3434,7 +3434,7 @@ void init_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, uint32 next_idx, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u, +BOOL samr_io_r_enum_dom_aliases(const char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u, prs_struct *ps, int depth) { uint32 i; @@ -3521,7 +3521,7 @@ void init_samr_alias_info1(ALIAS_INFO1 * al1, char *acct_name, uint32 num_member reads or writes a structure. ********************************************************************/ -BOOL samr_io_alias_info1(char *desc, ALIAS_INFO1 * al1, +BOOL samr_io_alias_info1(const char *desc, ALIAS_INFO1 * al1, prs_struct *ps, int depth) { if (al1 == NULL) @@ -3572,7 +3572,7 @@ void init_samr_alias_info3(ALIAS_INFO3 * al3, char *acct_desc) reads or writes a structure. ********************************************************************/ -BOOL samr_io_alias_info3(char *desc, ALIAS_INFO3 * al3, +BOOL samr_io_alias_info3(const char *desc, ALIAS_INFO3 * al3, prs_struct *ps, int depth) { if (al3 == NULL) @@ -3597,7 +3597,7 @@ BOOL samr_io_alias_info3(char *desc, ALIAS_INFO3 * al3, reads or writes a structure. ********************************************************************/ -BOOL samr_alias_info_ctr(char *desc, ALIAS_INFO_CTR * ctr, +BOOL samr_alias_info_ctr(const char *desc, ALIAS_INFO_CTR * ctr, prs_struct *ps, int depth) { if (ctr == NULL) @@ -3645,7 +3645,7 @@ void init_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_aliasinfo(char *desc, SAMR_Q_QUERY_ALIASINFO * q_e, +BOOL samr_io_q_query_aliasinfo(const char *desc, SAMR_Q_QUERY_ALIASINFO * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -3684,7 +3684,7 @@ void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO * r_u, +BOOL samr_io_r_query_aliasinfo(const char *desc, SAMR_R_QUERY_ALIASINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -3729,7 +3729,7 @@ void init_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_aliasinfo(char *desc, SAMR_Q_SET_ALIASINFO * q_u, +BOOL samr_io_q_set_aliasinfo(const char *desc, SAMR_Q_SET_ALIASINFO * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -3753,7 +3753,7 @@ BOOL samr_io_q_set_aliasinfo(char *desc, SAMR_Q_SET_ALIASINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_aliasinfo(char *desc, SAMR_R_SET_ALIASINFO * r_u, +BOOL samr_io_r_set_aliasinfo(const char *desc, SAMR_R_SET_ALIASINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -3795,7 +3795,7 @@ void init_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES * q_u, reads or writes a SAMR_Q_QUERY_USERALIASES structure. ********************************************************************/ -BOOL samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES * q_u, +BOOL samr_io_q_query_useraliases(const char *desc, SAMR_Q_QUERY_USERALIASES * q_u, prs_struct *ps, int depth) { fstring tmp; @@ -3880,7 +3880,7 @@ void init_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_rids(char *desc, uint32 *num_rids, uint32 **rid, +BOOL samr_io_rids(const char *desc, uint32 *num_rids, uint32 **rid, prs_struct *ps, int depth) { fstring tmp; @@ -3919,7 +3919,7 @@ BOOL samr_io_rids(char *desc, uint32 *num_rids, uint32 **rid, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES * r_u, +BOOL samr_io_r_query_useraliases(const char *desc, SAMR_R_QUERY_USERALIASES * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -3967,7 +3967,7 @@ void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS * q_u, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS * q_u, +BOOL samr_io_q_open_alias(const char *desc, SAMR_Q_OPEN_ALIAS * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -3994,7 +3994,7 @@ BOOL samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS * r_u, +BOOL samr_io_r_open_alias(const char *desc, SAMR_R_OPEN_ALIAS * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -4044,7 +4044,7 @@ void init_samr_q_lookup_rids(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_RIDS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS * q_u, +BOOL samr_io_q_lookup_rids(const char *desc, SAMR_Q_LOOKUP_RIDS * q_u, prs_struct *ps, int depth) { uint32 i; @@ -4130,7 +4130,7 @@ void init_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS * r_u, +BOOL samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u, prs_struct *ps, int depth) { uint32 i; @@ -4224,7 +4224,7 @@ void init_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS * q_u, POLICY_HND *hnd) reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_delete_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u, +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) @@ -4246,7 +4246,7 @@ BOOL samr_io_q_delete_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_delete_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u, +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) @@ -4289,7 +4289,7 @@ void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_create_dom_alias(char *desc, SAMR_Q_CREATE_DOM_ALIAS * q_u, +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) @@ -4322,7 +4322,7 @@ BOOL samr_io_q_create_dom_alias(char *desc, SAMR_Q_CREATE_DOM_ALIAS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_create_dom_alias(char *desc, SAMR_R_CREATE_DOM_ALIAS * r_u, +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) @@ -4363,7 +4363,7 @@ void init_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM * q_u, POLICY_HND *hnd, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM * q_u, +BOOL samr_io_q_add_aliasmem(const char *desc, SAMR_Q_ADD_ALIASMEM * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -4387,7 +4387,7 @@ BOOL samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_add_aliasmem(char *desc, SAMR_R_ADD_ALIASMEM * r_u, +BOOL samr_io_r_add_aliasmem(const char *desc, SAMR_R_ADD_ALIASMEM * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -4422,7 +4422,7 @@ void init_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM * q_u, POLICY_HND *hnd, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_del_aliasmem(char *desc, SAMR_Q_DEL_ALIASMEM * q_u, +BOOL samr_io_q_del_aliasmem(const char *desc, SAMR_Q_DEL_ALIASMEM * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -4446,7 +4446,7 @@ BOOL samr_io_q_del_aliasmem(char *desc, SAMR_Q_DEL_ALIASMEM * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_del_aliasmem(char *desc, SAMR_R_DEL_ALIASMEM * r_u, +BOOL samr_io_r_del_aliasmem(const char *desc, SAMR_R_DEL_ALIASMEM * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -4480,7 +4480,7 @@ void init_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS * q_c, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_delete_dom_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u, +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) @@ -4514,7 +4514,7 @@ void init_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_delete_dom_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u, +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) @@ -4548,7 +4548,7 @@ void init_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM * q_c, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_aliasmem(char *desc, SAMR_Q_QUERY_ALIASMEM * q_u, +BOOL samr_io_q_query_aliasmem(const char *desc, SAMR_Q_QUERY_ALIASMEM * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -4594,7 +4594,7 @@ void init_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM * r_u, +BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, prs_struct *ps, int depth) { uint32 i; @@ -4682,7 +4682,7 @@ NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES * q_u, +BOOL samr_io_q_lookup_names(const char *desc, SAMR_Q_LOOKUP_NAMES * q_u, prs_struct *ps, int depth) { uint32 i; @@ -4791,7 +4791,7 @@ NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES * r_u, +BOOL samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u, prs_struct *ps, int depth) { uint32 i; @@ -4889,7 +4889,7 @@ void init_samr_q_delete_dom_user(SAMR_Q_DELETE_DOM_USER * q_c, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_delete_dom_user(char *desc, SAMR_Q_DELETE_DOM_USER * q_u, +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) @@ -4911,7 +4911,7 @@ BOOL samr_io_q_delete_dom_user(char *desc, SAMR_Q_DELETE_DOM_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_delete_dom_user(char *desc, SAMR_R_DELETE_DOM_USER * r_u, +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) @@ -4950,7 +4950,7 @@ void init_samr_q_open_user(SAMR_Q_OPEN_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER * q_u, +BOOL samr_io_q_open_user(const char *desc, SAMR_Q_OPEN_USER * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -4977,7 +4977,7 @@ BOOL samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER * r_u, +BOOL samr_io_r_open_user(const char *desc, SAMR_R_OPEN_USER * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -5026,7 +5026,7 @@ void init_samr_q_create_user(SAMR_Q_CREATE_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_create_user(char *desc, SAMR_Q_CREATE_USER * q_u, +BOOL samr_io_q_create_user(const char *desc, SAMR_Q_CREATE_USER * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -5060,7 +5060,7 @@ BOOL samr_io_q_create_user(char *desc, SAMR_Q_CREATE_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER * r_u, +BOOL samr_io_r_create_user(const char *desc, SAMR_R_CREATE_USER * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -5102,7 +5102,7 @@ void init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_userinfo(char *desc, SAMR_Q_QUERY_USERINFO * q_u, +BOOL samr_io_q_query_userinfo(const char *desc, SAMR_Q_QUERY_USERINFO * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -5127,7 +5127,7 @@ BOOL samr_io_q_query_userinfo(char *desc, SAMR_Q_QUERY_USERINFO * q_u, reads or writes a LOGON_HRS structure. ********************************************************************/ -static BOOL sam_io_logon_hrs(char *desc, LOGON_HRS * hrs, +static BOOL sam_io_logon_hrs(const char *desc, LOGON_HRS * hrs, prs_struct *ps, int depth) { if (hrs == NULL) @@ -5172,7 +5172,7 @@ void init_sam_user_info12(SAM_USER_INFO_12 * usr, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info12(char *desc, SAM_USER_INFO_12 * u, +static BOOL sam_io_user_info12(const char *desc, SAM_USER_INFO_12 * u, prs_struct *ps, int depth) { if (u == NULL) @@ -5212,7 +5212,7 @@ void init_sam_user_info10(SAM_USER_INFO_10 * usr, uint32 acb_info) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info10(char *desc, SAM_USER_INFO_10 * usr, +static BOOL sam_io_user_info10(const char *desc, SAM_USER_INFO_10 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -5280,7 +5280,7 @@ void init_sam_user_info11(SAM_USER_INFO_11 * usr, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info11(char *desc, SAM_USER_INFO_11 * usr, +static BOOL sam_io_user_info11(const char *desc, SAM_USER_INFO_11 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -5376,7 +5376,7 @@ void init_sam_user_info24(SAM_USER_INFO_24 * usr, char newpass[516], uint16 pw_l reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info24(char *desc, SAM_USER_INFO_24 * usr, +static BOOL sam_io_user_info24(const char *desc, SAM_USER_INFO_24 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -5525,7 +5525,7 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z char *user_name, /* NULL */ char *full_name, char *home_dir, char *dir_drive, char *log_scr, - char *prof_path, char *desc, char *wkstas, + 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 unknown_3, uint16 logon_divs, @@ -5606,7 +5606,7 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 * usr, +static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -5742,7 +5742,7 @@ static BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 * usr, way than normal... And there are definately other problems. JRA. ********************************************************************/ -static BOOL sam_io_user_info25(char *desc, SAM_USER_INFO_25 * usr, prs_struct *ps, int depth) +static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_struct *ps, int depth) { if (usr == NULL) return False; @@ -6120,7 +6120,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 * usr, +static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -6253,7 +6253,7 @@ void init_sam_user_info20A(SAM_USER_INFO_20 *usr, SAM_ACCOUNT *pw) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info20(char *desc, SAM_USER_INFO_20 *usr, +static BOOL sam_io_user_info20(const char *desc, SAM_USER_INFO_20 *usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -6374,7 +6374,7 @@ void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, uchar * sess_key, reads or writes a structure. ********************************************************************/ -static BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR **ppctr, +static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, prs_struct *ps, int depth) { BOOL ret; @@ -6514,7 +6514,7 @@ void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO * r_u, +BOOL samr_io_r_query_userinfo(const char *desc, SAMR_R_QUERY_USERINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -6561,7 +6561,7 @@ void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO * q_u, +BOOL samr_io_q_set_userinfo(const char *desc, SAMR_Q_SET_USERINFO * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -6598,7 +6598,7 @@ void init_samr_r_set_userinfo(SAMR_R_SET_USERINFO * r_u, NTSTATUS status) reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_userinfo(char *desc, SAMR_R_SET_USERINFO * r_u, +BOOL samr_io_r_set_userinfo(const char *desc, SAMR_R_SET_USERINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -6648,7 +6648,7 @@ void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_userinfo2(char *desc, SAMR_Q_SET_USERINFO2 * q_u, +BOOL samr_io_q_set_userinfo2(const char *desc, SAMR_Q_SET_USERINFO2 * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -6686,7 +6686,7 @@ void init_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2 * r_u, NTSTATUS status) reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_userinfo2(char *desc, SAMR_R_SET_USERINFO2 * r_u, +BOOL samr_io_r_set_userinfo2(const char *desc, SAMR_R_SET_USERINFO2 * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -6727,7 +6727,7 @@ void init_samr_q_connect(SAMR_Q_CONNECT * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_connect(char *desc, SAMR_Q_CONNECT * q_u, +BOOL samr_io_q_connect(const char *desc, SAMR_Q_CONNECT * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -6756,7 +6756,7 @@ BOOL samr_io_q_connect(char *desc, SAMR_Q_CONNECT * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_connect(char *desc, SAMR_R_CONNECT * r_u, +BOOL samr_io_r_connect(const char *desc, SAMR_R_CONNECT * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -6803,7 +6803,7 @@ void init_samr_q_connect4(SAMR_Q_CONNECT4 * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_connect4(char *desc, SAMR_Q_CONNECT4 * q_u, +BOOL samr_io_q_connect4(const char *desc, SAMR_Q_CONNECT4 * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -6834,7 +6834,7 @@ BOOL samr_io_q_connect4(char *desc, SAMR_Q_CONNECT4 * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_connect4(char *desc, SAMR_R_CONNECT4 * r_u, +BOOL samr_io_r_connect4(const char *desc, SAMR_R_CONNECT4 * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -6873,7 +6873,7 @@ void init_samr_q_connect_anon(SAMR_Q_CONNECT_ANON * q_u) reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_connect_anon(char *desc, SAMR_Q_CONNECT_ANON * q_u, +BOOL samr_io_q_connect_anon(const char *desc, SAMR_Q_CONNECT_ANON * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -6901,7 +6901,7 @@ BOOL samr_io_q_connect_anon(char *desc, SAMR_Q_CONNECT_ANON * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_connect_anon(char *desc, SAMR_R_CONNECT_ANON * r_u, +BOOL samr_io_r_connect_anon(const char *desc, SAMR_R_CONNECT_ANON * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -6942,7 +6942,7 @@ void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_get_dom_pwinfo(char *desc, SAMR_Q_GET_DOM_PWINFO * q_u, +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) @@ -6970,7 +6970,7 @@ BOOL samr_io_q_get_dom_pwinfo(char *desc, SAMR_Q_GET_DOM_PWINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_get_dom_pwinfo(char *desc, SAMR_R_GET_DOM_PWINFO * r_u, +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) @@ -7020,7 +7020,7 @@ void init_enc_passwd(SAMR_ENC_PASSWD * pwd, char pass[512]) reads or writes a SAMR_ENC_PASSWD structure. ********************************************************************/ -BOOL samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD * pwd, +BOOL samr_io_enc_passwd(const char *desc, SAMR_ENC_PASSWD * pwd, prs_struct *ps, int depth) { if (pwd == NULL) @@ -7063,7 +7063,7 @@ void init_enc_hash(SAMR_ENC_HASH * hsh, uchar hash[16]) reads or writes a SAMR_ENC_HASH structure. ********************************************************************/ -BOOL samr_io_enc_hash(char *desc, SAMR_ENC_HASH * hsh, +BOOL samr_io_enc_hash(const char *desc, SAMR_ENC_HASH * hsh, prs_struct *ps, int depth) { if (hsh == NULL) @@ -7120,7 +7120,7 @@ void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER * q_u, +BOOL samr_io_q_chgpasswd_user(const char *desc, SAMR_Q_CHGPASSWD_USER * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -7178,7 +7178,7 @@ void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER * r_u, NTSTATUS status) reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER * r_u, +BOOL samr_io_r_chgpasswd_user(const char *desc, SAMR_R_CHGPASSWD_USER * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -7213,7 +7213,7 @@ void init_samr_q_unknown_2e(SAMR_Q_UNKNOWN_2E *q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_unknown_2e(char *desc, SAMR_Q_UNKNOWN_2E *q_u, +BOOL samr_io_q_unknown_2e(const char *desc, SAMR_Q_UNKNOWN_2E *q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -7259,7 +7259,7 @@ void init_samr_r_samr_unknown_2e(SAMR_R_UNKNOWN_2E * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_samr_unknown_2e(char *desc, SAMR_R_UNKNOWN_2E * r_u, +BOOL samr_io_r_samr_unknown_2e(const char *desc, SAMR_R_UNKNOWN_2E * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -7348,7 +7348,7 @@ void init_samr_q_set_domain_info(SAMR_Q_SET_DOMAIN_INFO *q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_domain_info(char *desc, SAMR_Q_SET_DOMAIN_INFO *q_u, +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) @@ -7429,7 +7429,7 @@ void init_samr_r_set_domain_info(SAMR_R_SET_DOMAIN_INFO * r_u, NTSTATUS status) reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_domain_info(char *desc, SAMR_R_SET_DOMAIN_INFO * r_u, +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) diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index cec37348b8..a49a34139e 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -40,7 +40,7 @@ void init_sec_access(SEC_ACCESS *t, uint32 mask) Reads or writes a SEC_ACCESS structure. ********************************************************************/ -BOOL sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) +BOOL sec_io_access(const char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) { if (t == NULL) return False; @@ -103,7 +103,7 @@ void init_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 f Reads or writes a SEC_ACE structure. ********************************************************************/ -BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth) +BOOL sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth) { uint32 old_offset; uint32 offset_ace_size; @@ -281,7 +281,7 @@ SEC_ACL *dup_sec_acl(TALLOC_CTX *ctx, SEC_ACL *src) for you as it reads them. ********************************************************************/ -BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) +BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) { int i; uint32 old_offset; @@ -720,7 +720,7 @@ SEC_DESC *make_standard_sec_desc(TALLOC_CTX *ctx, DOM_SID *owner_sid, DOM_SID *g If reading and the *ppsd = NULL, allocates the structure. ********************************************************************/ -BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) +BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) { uint32 old_offset; uint32 max_offset = 0; /* after we're done, move offset to end */ @@ -890,7 +890,7 @@ SEC_DESC_BUF *dup_sec_desc_buf(TALLOC_CTX *ctx, SEC_DESC_BUF *src) Reads or writes a SEC_DESC_BUF structure. ********************************************************************/ -BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth) +BOOL sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth) { uint32 off_len; uint32 off_max_len; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index fb5c642824..cb3b2efd9d 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -48,7 +48,7 @@ static uint32 str_len_uni(UNISTR *source) This should be moved in a more generic lib. ********************************************************************/ -BOOL spoolss_io_system_time(char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) +BOOL spoolss_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) { if(!prs_uint16("year", ps, depth, &systime->year)) return False; @@ -91,7 +91,7 @@ BOOL make_systemtime(SYSTEMTIME *systime, struct tm *unixtime) reads or writes an DOC_INFO structure. ********************************************************************/ -static BOOL smb_io_doc_info_1(char *desc, DOC_INFO_1 *info_1, prs_struct *ps, int depth) +static BOOL smb_io_doc_info_1(const char *desc, DOC_INFO_1 *info_1, prs_struct *ps, int depth) { if (info_1 == NULL) return False; @@ -122,7 +122,7 @@ static BOOL smb_io_doc_info_1(char *desc, DOC_INFO_1 *info_1, prs_struct *ps, in reads or writes an DOC_INFO structure. ********************************************************************/ -static BOOL smb_io_doc_info(char *desc, DOC_INFO *info, prs_struct *ps, int depth) +static BOOL smb_io_doc_info(const char *desc, DOC_INFO *info, prs_struct *ps, int depth) { uint32 useless_ptr=0; @@ -171,7 +171,7 @@ static BOOL smb_io_doc_info(char *desc, DOC_INFO *info, prs_struct *ps, int dept reads or writes an DOC_INFO_CONTAINER structure. ********************************************************************/ -static BOOL smb_io_doc_info_container(char *desc, DOC_INFO_CONTAINER *cont, prs_struct *ps, int depth) +static BOOL smb_io_doc_info_container(const char *desc, DOC_INFO_CONTAINER *cont, prs_struct *ps, int depth) { if (cont == NULL) return False; @@ -198,7 +198,7 @@ reads or writes an NOTIFY OPTION TYPE structure. structure. The _TYPE structure is really the deferred referrants (i.e the notify fields array) of the _TYPE structure. -tpot */ -static BOOL smb_io_notify_option_type(char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) +static BOOL smb_io_notify_option_type(const char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_notify_option_type"); depth++; @@ -226,7 +226,7 @@ static BOOL smb_io_notify_option_type(char *desc, SPOOL_NOTIFY_OPTION_TYPE *type reads or writes an NOTIFY OPTION TYPE DATA. ********************************************************************/ -static BOOL smb_io_notify_option_type_data(char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) +static BOOL smb_io_notify_option_type_data(const char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) { int i; @@ -257,7 +257,7 @@ static BOOL smb_io_notify_option_type_data(char *desc, SPOOL_NOTIFY_OPTION_TYPE reads or writes an NOTIFY OPTION structure. ********************************************************************/ -static BOOL smb_io_notify_option_type_ctr(char *desc, SPOOL_NOTIFY_OPTION_TYPE_CTR *ctr , prs_struct *ps, int depth) +static BOOL smb_io_notify_option_type_ctr(const char *desc, SPOOL_NOTIFY_OPTION_TYPE_CTR *ctr , prs_struct *ps, int depth) { int i; @@ -289,7 +289,7 @@ static BOOL smb_io_notify_option_type_ctr(char *desc, SPOOL_NOTIFY_OPTION_TYPE_C reads or writes an NOTIFY OPTION structure. ********************************************************************/ -static BOOL smb_io_notify_option(char *desc, SPOOL_NOTIFY_OPTION *option, prs_struct *ps, int depth) +static BOOL smb_io_notify_option(const char *desc, SPOOL_NOTIFY_OPTION *option, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_notify_option"); depth++; @@ -320,7 +320,7 @@ static BOOL smb_io_notify_option(char *desc, SPOOL_NOTIFY_OPTION *option, prs_st reads or writes an NOTIFY INFO DATA structure. ********************************************************************/ -static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) +static BOOL smb_io_notify_info_data(const char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) { uint32 useless_ptr=0x0FF0ADDE; @@ -399,7 +399,7 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs reads or writes an NOTIFY INFO DATA structure. ********************************************************************/ -BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, +BOOL smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_notify_info_data_strings"); @@ -530,7 +530,7 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, reads or writes an NOTIFY INFO structure. ********************************************************************/ -static BOOL smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, prs_struct *ps, int depth) +static BOOL smb_io_notify_info(const char *desc, SPOOL_NOTIFY_INFO *info, prs_struct *ps, int depth) { int i; @@ -566,7 +566,7 @@ static BOOL smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, prs_struct * /******************************************************************* ********************************************************************/ -static BOOL spool_io_user_level_1(char *desc, SPOOL_USER_1 *q_u, prs_struct *ps, int depth) +static BOOL spool_io_user_level_1(const char *desc, SPOOL_USER_1 *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); depth++; @@ -605,7 +605,7 @@ static BOOL spool_io_user_level_1(char *desc, SPOOL_USER_1 *q_u, prs_struct *ps, /******************************************************************* ********************************************************************/ -static BOOL spool_io_user_level(char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, int depth) +static BOOL spool_io_user_level(const char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, int depth) { if (q_u==NULL) return False; @@ -643,7 +643,7 @@ static BOOL spool_io_user_level(char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, #define DM_NUM_OPTIONAL_FIELDS 8 -BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) +BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) { uint32 available_space; /* size of the device mode left to parse */ /* only important on unmarshalling */ @@ -829,7 +829,7 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo Read or write a DEVICEMODE container ********************************************************************/ -static BOOL spoolss_io_devmode_cont(char *desc, DEVMODE_CTR *dm_c, prs_struct *ps, int depth) +static BOOL spoolss_io_devmode_cont(const char *desc, DEVMODE_CTR *dm_c, prs_struct *ps, int depth) { if (dm_c==NULL) return False; @@ -874,7 +874,7 @@ static BOOL spoolss_io_devmode_cont(char *desc, DEVMODE_CTR *dm_c, prs_struct *p /******************************************************************* ********************************************************************/ -static BOOL spoolss_io_printer_default(char *desc, PRINTER_DEFAULT *pd, prs_struct *ps, int depth) +static BOOL spoolss_io_printer_default(const char *desc, PRINTER_DEFAULT *pd, prs_struct *ps, int depth) { if (pd==NULL) return False; @@ -1059,7 +1059,7 @@ BOOL make_spoolss_printer_info_2(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_2 * called from spoolss_q_open_printer_ex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_open_printer(char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_open_printer(const char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1090,7 +1090,7 @@ BOOL spoolss_io_q_open_printer(char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct * called from spoolss_open_printer_ex (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_open_printer(char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_open_printer(const char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -1115,7 +1115,7 @@ BOOL spoolss_io_r_open_printer(char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct * called from spoolss_q_open_printer_ex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_open_printer_ex(const char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1151,7 +1151,7 @@ BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_ * called from spoolss_open_printer_ex (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_open_printer_ex(const char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -1240,7 +1240,7 @@ BOOL make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX *q_u, * called from spoolss_q_getprinterdata (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_getprinterdata(char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getprinterdata(const char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1269,7 +1269,7 @@ BOOL spoolss_io_q_getprinterdata(char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_st * called from spoolss_q_deleteprinterdata (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_deleteprinterdata(char *desc, SPOOL_Q_DELETEPRINTERDATA *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_deleteprinterdata(const char *desc, SPOOL_Q_DELETEPRINTERDATA *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1294,7 +1294,7 @@ BOOL spoolss_io_q_deleteprinterdata(char *desc, SPOOL_Q_DELETEPRINTERDATA *q_u, * called from spoolss_r_deleteprinterdata (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_deleteprinterdata(char *desc, SPOOL_R_DELETEPRINTERDATA *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_deleteprinterdata(const char *desc, SPOOL_R_DELETEPRINTERDATA *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterdata"); depth++; @@ -1309,7 +1309,7 @@ BOOL spoolss_io_r_deleteprinterdata(char *desc, SPOOL_R_DELETEPRINTERDATA *r_u, * called from spoolss_q_deleteprinterdataex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_deleteprinterdataex(char *desc, SPOOL_Q_DELETEPRINTERDATAEX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_deleteprinterdataex(const char *desc, SPOOL_Q_DELETEPRINTERDATAEX *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1335,7 +1335,7 @@ BOOL spoolss_io_q_deleteprinterdataex(char *desc, SPOOL_Q_DELETEPRINTERDATAEX *q * called from spoolss_r_deleteprinterdataex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_deleteprinterdataex(char *desc, SPOOL_R_DELETEPRINTERDATAEX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_deleteprinterdataex(const char *desc, SPOOL_R_DELETEPRINTERDATAEX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterdataex"); depth++; @@ -1351,7 +1351,7 @@ BOOL spoolss_io_r_deleteprinterdataex(char *desc, SPOOL_R_DELETEPRINTERDATAEX *r * called from spoolss_r_getprinterdata (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -1407,7 +1407,7 @@ BOOL make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER *q_u, POLICY_HND *hnd) * called from spoolss_abortprinter (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_abortprinter(char *desc, SPOOL_Q_ABORTPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_abortprinter(const char *desc, SPOOL_Q_ABORTPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1428,7 +1428,7 @@ BOOL spoolss_io_q_abortprinter(char *desc, SPOOL_Q_ABORTPRINTER *q_u, prs_struct * called from spoolss_r_abortprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_abortprinter(char *desc, SPOOL_R_ABORTPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_abortprinter(const char *desc, SPOOL_R_ABORTPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_abortprinter"); depth++; @@ -1444,7 +1444,7 @@ BOOL spoolss_io_r_abortprinter(char *desc, SPOOL_R_ABORTPRINTER *r_u, prs_struct * called from spoolss_deleteprinter (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_deleteprinter(char *desc, SPOOL_Q_DELETEPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_deleteprinter(const char *desc, SPOOL_Q_DELETEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1466,7 +1466,7 @@ BOOL spoolss_io_q_deleteprinter(char *desc, SPOOL_Q_DELETEPRINTER *q_u, prs_stru * called from spoolss_deleteprinter (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_deleteprinter(char *desc, SPOOL_R_DELETEPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_deleteprinter(const char *desc, SPOOL_R_DELETEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinter"); depth++; @@ -1489,7 +1489,7 @@ BOOL spoolss_io_r_deleteprinter(char *desc, SPOOL_R_DELETEPRINTER *r_u, prs_stru * called from spoolss_deleteprinterdriver (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_deleteprinterdriver(char *desc, SPOOL_Q_DELETEPRINTERDRIVER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_deleteprinterdriver(const char *desc, SPOOL_Q_DELETEPRINTERDRIVER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1516,7 +1516,7 @@ BOOL spoolss_io_q_deleteprinterdriver(char *desc, SPOOL_Q_DELETEPRINTERDRIVER *q /******************************************************************* * write a structure. ********************************************************************/ -BOOL spoolss_io_r_deleteprinterdriver(char *desc, SPOOL_R_DELETEPRINTERDRIVER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_deleteprinterdriver(const char *desc, SPOOL_R_DELETEPRINTERDRIVER *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -1539,7 +1539,7 @@ BOOL spoolss_io_r_deleteprinterdriver(char *desc, SPOOL_R_DELETEPRINTERDRIVER *r * called from spoolss_deleteprinterdriver (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_deleteprinterdriverex(char *desc, SPOOL_Q_DELETEPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_deleteprinterdriverex(const char *desc, SPOOL_Q_DELETEPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1574,7 +1574,7 @@ BOOL spoolss_io_q_deleteprinterdriverex(char *desc, SPOOL_Q_DELETEPRINTERDRIVERE /******************************************************************* * write a structure. ********************************************************************/ -BOOL spoolss_io_r_deleteprinterdriverex(char *desc, SPOOL_R_DELETEPRINTERDRIVEREX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_deleteprinterdriverex(const char *desc, SPOOL_R_DELETEPRINTERDRIVEREX *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -1598,7 +1598,7 @@ BOOL spoolss_io_r_deleteprinterdriverex(char *desc, SPOOL_R_DELETEPRINTERDRIVERE * called from spoolss_closeprinter (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_closeprinter(char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_closeprinter(const char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1620,7 +1620,7 @@ BOOL spoolss_io_q_closeprinter(char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct * called from spoolss_closeprinter (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_closeprinter(char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_closeprinter(const char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_closeprinter"); depth++; @@ -1641,7 +1641,7 @@ BOOL spoolss_io_r_closeprinter(char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct * called from spoolss_q_startdocprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_startdocprinter(char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_startdocprinter(const char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1665,7 +1665,7 @@ BOOL spoolss_io_q_startdocprinter(char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_ * called from spoolss_r_startdocprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_startdocprinter(char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_startdocprinter(const char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_startdocprinter"); depth++; @@ -1682,7 +1682,7 @@ BOOL spoolss_io_r_startdocprinter(char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_ * called from spoolss_q_enddocprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_enddocprinter(char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enddocprinter(const char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1703,7 +1703,7 @@ BOOL spoolss_io_q_enddocprinter(char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_stru * called from spoolss_r_enddocprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_enddocprinter(char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enddocprinter(const char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enddocprinter"); depth++; @@ -1718,7 +1718,7 @@ BOOL spoolss_io_r_enddocprinter(char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_stru * called from spoolss_q_startpageprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_startpageprinter(char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_startpageprinter(const char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1739,7 +1739,7 @@ BOOL spoolss_io_q_startpageprinter(char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, pr * called from spoolss_r_startpageprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_startpageprinter(char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_startpageprinter(const char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_startpageprinter"); depth++; @@ -1754,7 +1754,7 @@ BOOL spoolss_io_r_startpageprinter(char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, pr * called from spoolss_q_endpageprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_endpageprinter(char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_endpageprinter(const char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1775,7 +1775,7 @@ BOOL spoolss_io_q_endpageprinter(char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_st * called from spoolss_r_endpageprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_endpageprinter(char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_endpageprinter(const char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_endpageprinter"); depth++; @@ -1790,7 +1790,7 @@ BOOL spoolss_io_r_endpageprinter(char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_st * called from spoolss_q_writeprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_writeprinter(const char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1827,7 +1827,7 @@ BOOL spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct * called from spoolss_r_writeprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_writeprinter(char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_writeprinter(const char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_writeprinter"); depth++; @@ -1844,7 +1844,7 @@ BOOL spoolss_io_r_writeprinter(char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct * called from spoolss_q_rffpcnex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_rffpcnex(const char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_rffpcnex"); depth++; @@ -1890,7 +1890,7 @@ BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, in * called from spoolss_r_rffpcnex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_rffpcnex(const char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_rffpcnex"); depth++; @@ -1906,7 +1906,7 @@ BOOL spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, in * called from spoolss_q_rfnpcnex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_rfnpcnex(const char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_rfnpcnex"); depth++; @@ -1941,7 +1941,7 @@ BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, in * called from spoolss_r_rfnpcnex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_rfnpcnex(char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_rfnpcnex(const char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_rfnpcnex"); depth++; @@ -2061,7 +2061,7 @@ static uint32 size_of_systemtime(SYSTEMTIME *systime) * ********************************************************************/ -static BOOL smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *string) +static BOOL smb_io_relstr(const char *desc, NEW_BUFFER *buffer, int depth, UNISTR *string) { prs_struct *ps=&buffer->prs; @@ -2123,7 +2123,7 @@ static BOOL smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *str * used by 2 RPC structs ********************************************************************/ -static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16 **string) +static BOOL smb_io_relarraystr(const char *desc, NEW_BUFFER *buffer, int depth, uint16 **string) { UNISTR chaine; @@ -2251,7 +2251,7 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16 Parse a DEVMODE structure and its relative pointer. ********************************************************************/ -static BOOL smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, SEC_DESC **secdesc) +static BOOL smb_io_relsecdesc(const char *desc, NEW_BUFFER *buffer, int depth, SEC_DESC **secdesc) { prs_struct *ps= &buffer->prs; @@ -2312,7 +2312,7 @@ static BOOL smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, SEC_DES Parse a DEVMODE structure and its relative pointer. ********************************************************************/ -static BOOL smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEVICEMODE **devmode) +static BOOL smb_io_reldevmode(const char *desc, NEW_BUFFER *buffer, int depth, DEVICEMODE **devmode) { prs_struct *ps=&buffer->prs; @@ -2380,7 +2380,7 @@ static BOOL smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEVICEM Parse a PRINTER_INFO_0 structure. ********************************************************************/ -BOOL smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *info, int depth) +BOOL smb_io_printer_info_0(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2481,7 +2481,7 @@ BOOL smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *info, Parse a PRINTER_INFO_1 structure. ********************************************************************/ -BOOL smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info, int depth) +BOOL smb_io_printer_info_1(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2506,7 +2506,7 @@ BOOL smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info, Parse a PRINTER_INFO_2 structure. ********************************************************************/ -BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) +BOOL smb_io_printer_info_2(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; uint32 dm_offset, sd_offset, current_offset; @@ -2597,7 +2597,7 @@ BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, Parse a PRINTER_INFO_3 structure. ********************************************************************/ -BOOL smb_io_printer_info_3(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *info, int depth) +BOOL smb_io_printer_info_3(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2618,7 +2618,7 @@ BOOL smb_io_printer_info_3(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *info, Parse a PRINTER_INFO_4 structure. ********************************************************************/ -BOOL smb_io_printer_info_4(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_4 *info, int depth) +BOOL smb_io_printer_info_4(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_4 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2640,7 +2640,7 @@ BOOL smb_io_printer_info_4(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_4 *info, Parse a PRINTER_INFO_5 structure. ********************************************************************/ -BOOL smb_io_printer_info_5(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_5 *info, int depth) +BOOL smb_io_printer_info_5(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_5 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2666,7 +2666,7 @@ BOOL smb_io_printer_info_5(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_5 *info, Parse a PRINTER_INFO_7 structure. ********************************************************************/ -BOOL smb_io_printer_info_7(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_7 *info, int depth) +BOOL smb_io_printer_info_7(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_7 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2686,7 +2686,7 @@ BOOL smb_io_printer_info_7(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_7 *info, Parse a PORT_INFO_1 structure. ********************************************************************/ -BOOL smb_io_port_info_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) +BOOL smb_io_port_info_1(const char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2705,7 +2705,7 @@ BOOL smb_io_port_info_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int d Parse a PORT_INFO_2 structure. ********************************************************************/ -BOOL smb_io_port_info_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) +BOOL smb_io_port_info_2(const char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2732,7 +2732,7 @@ BOOL smb_io_port_info_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int d Parse a DRIVER_INFO_1 structure. ********************************************************************/ -BOOL smb_io_printer_driver_info_1(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_1 *info, int depth) +BOOL smb_io_printer_driver_info_1(const char *desc, NEW_BUFFER *buffer, DRIVER_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2751,7 +2751,7 @@ BOOL smb_io_printer_driver_info_1(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_1 Parse a DRIVER_INFO_2 structure. ********************************************************************/ -BOOL smb_io_printer_driver_info_2(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) +BOOL smb_io_printer_driver_info_2(const char *desc, NEW_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2780,7 +2780,7 @@ BOOL smb_io_printer_driver_info_2(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_2 Parse a DRIVER_INFO_3 structure. ********************************************************************/ -BOOL smb_io_printer_driver_info_3(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_3 *info, int depth) +BOOL smb_io_printer_driver_info_3(const char *desc, NEW_BUFFER *buffer, DRIVER_INFO_3 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2819,7 +2819,7 @@ BOOL smb_io_printer_driver_info_3(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_3 Parse a DRIVER_INFO_6 structure. ********************************************************************/ -BOOL smb_io_printer_driver_info_6(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_6 *info, int depth) +BOOL smb_io_printer_driver_info_6(const char *desc, NEW_BUFFER *buffer, DRIVER_INFO_6 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2884,7 +2884,7 @@ BOOL smb_io_printer_driver_info_6(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_6 Parse a JOB_INFO_1 structure. ********************************************************************/ -BOOL smb_io_job_info_1(char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int depth) +BOOL smb_io_job_info_1(const char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2927,7 +2927,7 @@ BOOL smb_io_job_info_1(char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int dep Parse a JOB_INFO_2 structure. ********************************************************************/ -BOOL smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int depth) +BOOL smb_io_job_info_2(const char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int depth) { uint32 pipo=0; prs_struct *ps=&buffer->prs; @@ -2994,7 +2994,7 @@ BOOL smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int dep /******************************************************************* ********************************************************************/ -BOOL smb_io_form_1(char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth) +BOOL smb_io_form_1(const char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3029,7 +3029,7 @@ BOOL smb_io_form_1(char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth) Read/write a BUFFER struct. ********************************************************************/ -static BOOL spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUFFER **pp_buffer) +static BOOL spoolss_io_buffer(const char *desc, prs_struct *ps, int depth, NEW_BUFFER **pp_buffer) { NEW_BUFFER *buffer = *pp_buffer; @@ -3141,7 +3141,7 @@ uint32 new_get_buffer_size(NEW_BUFFER *buffer) Parse a DRIVER_DIRECTORY_1 structure. ********************************************************************/ -BOOL smb_io_driverdir_1(char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 *info, int depth) +BOOL smb_io_driverdir_1(const char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3160,7 +3160,7 @@ BOOL smb_io_driverdir_1(char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 *info Parse a PORT_INFO_1 structure. ********************************************************************/ -BOOL smb_io_port_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) +BOOL smb_io_port_1(const char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3179,7 +3179,7 @@ BOOL smb_io_port_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) Parse a PORT_INFO_2 structure. ********************************************************************/ -BOOL smb_io_port_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) +BOOL smb_io_port_2(const char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3205,7 +3205,7 @@ BOOL smb_io_port_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) /******************************************************************* ********************************************************************/ -BOOL smb_io_printprocessor_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR_1 *info, int depth) +BOOL smb_io_printprocessor_info_1(const char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3223,7 +3223,7 @@ BOOL smb_io_printprocessor_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR /******************************************************************* ********************************************************************/ -BOOL smb_io_printprocdatatype_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCDATATYPE_1 *info, int depth) +BOOL smb_io_printprocdatatype_info_1(const char *desc, NEW_BUFFER *buffer, PRINTPROCDATATYPE_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3241,7 +3241,7 @@ BOOL smb_io_printprocdatatype_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCDA /******************************************************************* ********************************************************************/ -BOOL smb_io_printmonitor_info_1(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_1 *info, int depth) +BOOL smb_io_printmonitor_info_1(const char *desc, NEW_BUFFER *buffer, PRINTMONITOR_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3259,7 +3259,7 @@ BOOL smb_io_printmonitor_info_1(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_1 * /******************************************************************* ********************************************************************/ -BOOL smb_io_printmonitor_info_2(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_2 *info, int depth) +BOOL smb_io_printmonitor_info_2(const char *desc, NEW_BUFFER *buffer, PRINTMONITOR_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3806,7 +3806,7 @@ BOOL make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u, * called from spoolss_getprinterdriver2 (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_getprinterdriver2(char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getprinterdriver2(const char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdriver2"); depth++; @@ -3848,7 +3848,7 @@ BOOL spoolss_io_q_getprinterdriver2(char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, * called from spoolss_getprinterdriver2 (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getprinterdriver2(const char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriver2"); depth++; @@ -3921,7 +3921,7 @@ BOOL make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS *q_u, * called from spoolss_enumprinters (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprinters(const char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinters"); depth++; @@ -3957,7 +3957,7 @@ BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct Parse a SPOOL_R_ENUMPRINTERS structure. ********************************************************************/ -BOOL spoolss_io_r_enumprinters(char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprinters(const char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprinters"); depth++; @@ -3989,7 +3989,7 @@ BOOL spoolss_io_r_enumprinters(char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct * ********************************************************************/ -BOOL spoolss_io_r_getprinter(char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getprinter(const char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getprinter"); depth++; @@ -4017,7 +4017,7 @@ BOOL spoolss_io_r_getprinter(char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps * called from spoolss_getprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getprinter(const char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_getprinter"); depth++; @@ -4129,7 +4129,7 @@ BOOL make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_setprinter(const char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setprinter"); depth++; @@ -4147,7 +4147,7 @@ BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps Marshall/unmarshall a SPOOL_Q_SETPRINTER struct. ********************************************************************/ -BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_setprinter(const char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth) { uint32 ptr_sec_desc = 0; @@ -4210,7 +4210,7 @@ BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_fcpn(char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_fcpn(const char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_fcpn"); depth++; @@ -4227,7 +4227,7 @@ BOOL spoolss_io_r_fcpn(char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_fcpn(char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_fcpn(const char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_fcpn"); @@ -4246,7 +4246,7 @@ BOOL spoolss_io_q_fcpn(char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_addjob(const char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); depth++; @@ -4272,7 +4272,7 @@ BOOL spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int de /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_addjob(const char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); depth++; @@ -4300,7 +4300,7 @@ BOOL spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int de /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumjobs(const char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumjobs"); depth++; @@ -4352,7 +4352,7 @@ BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumjobs(const char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumjobs"); depth++; @@ -4385,7 +4385,7 @@ BOOL spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, in /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_schedulejob(char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_schedulejob(const char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_schedulejob"); depth++; @@ -4402,7 +4402,7 @@ BOOL spoolss_io_r_schedulejob(char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct * /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_schedulejob(char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_schedulejob(const char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_schedulejob"); depth++; @@ -4421,7 +4421,7 @@ BOOL spoolss_io_q_schedulejob(char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct * /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_setjob(char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_setjob(const char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setjob"); depth++; @@ -4438,7 +4438,7 @@ BOOL spoolss_io_r_setjob(char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int de /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_setjob(const char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_setjob"); depth++; @@ -4466,7 +4466,7 @@ BOOL spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int de Parse a SPOOL_R_ENUMPRINTERDRIVERS structure. ********************************************************************/ -BOOL spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprinterdrivers(const char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdrivers"); depth++; @@ -4516,7 +4516,7 @@ BOOL make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, Parse a SPOOL_Q_ENUMPRINTERDRIVERS structure. ********************************************************************/ -BOOL spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprinterdrivers(const char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdrivers"); @@ -4557,7 +4557,7 @@ BOOL spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumforms(const char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumforms"); @@ -4584,7 +4584,7 @@ BOOL spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumforms(const char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumforms"); depth++; @@ -4613,7 +4613,7 @@ BOOL spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_getform(char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getform(const char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_getform"); @@ -4646,7 +4646,7 @@ BOOL spoolss_io_q_getform(char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps, int /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_getform(char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getform(const char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getform"); depth++; @@ -4673,7 +4673,7 @@ BOOL spoolss_io_r_getform(char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps, int Parse a SPOOL_R_ENUMPORTS structure. ********************************************************************/ -BOOL spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumports(const char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumports"); depth++; @@ -4702,7 +4702,7 @@ BOOL spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumports(const char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); depth++; @@ -4735,7 +4735,7 @@ BOOL spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, Parse a SPOOL_PRINTER_INFO_LEVEL_1 structure. ********************************************************************/ -BOOL spool_io_printer_info_level_1(char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, prs_struct *ps, int depth) +BOOL spool_io_printer_info_level_1(const char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level_1"); depth++; @@ -4766,7 +4766,7 @@ BOOL spool_io_printer_info_level_1(char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, p Parse a SPOOL_PRINTER_INFO_LEVEL_3 structure. ********************************************************************/ -BOOL spool_io_printer_info_level_3(char *desc, SPOOL_PRINTER_INFO_LEVEL_3 *il, prs_struct *ps, int depth) +BOOL spool_io_printer_info_level_3(const char *desc, SPOOL_PRINTER_INFO_LEVEL_3 *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level_3"); depth++; @@ -4784,7 +4784,7 @@ BOOL spool_io_printer_info_level_3(char *desc, SPOOL_PRINTER_INFO_LEVEL_3 *il, p Parse a SPOOL_PRINTER_INFO_LEVEL_2 structure. ********************************************************************/ -BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, prs_struct *ps, int depth) +BOOL spool_io_printer_info_level_2(const char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level_2"); depth++; @@ -4863,7 +4863,7 @@ BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, p return True; } -BOOL spool_io_printer_info_level_7(char *desc, SPOOL_PRINTER_INFO_LEVEL_7 *il, prs_struct *ps, int depth) +BOOL spool_io_printer_info_level_7(const char *desc, SPOOL_PRINTER_INFO_LEVEL_7 *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level_7"); depth++; @@ -4884,7 +4884,7 @@ BOOL spool_io_printer_info_level_7(char *desc, SPOOL_PRINTER_INFO_LEVEL_7 *il, p /******************************************************************* ********************************************************************/ -BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth) +BOOL spool_io_printer_info_level(const char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level"); depth++; @@ -4961,7 +4961,7 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_addprinterex(const char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth) { uint32 ptr_sec_desc = 0; @@ -5025,7 +5025,7 @@ BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, +BOOL spoolss_io_r_addprinterex(const char *desc, SPOOL_R_ADDPRINTEREX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addprinterex"); @@ -5043,7 +5043,7 @@ BOOL spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, /******************************************************************* ********************************************************************/ -BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, +BOOL spool_io_printer_driver_info_level_3(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, prs_struct *ps, int depth) { SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *il; @@ -5121,7 +5121,7 @@ BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_ parse a SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure ********************************************************************/ -BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u, +BOOL spool_io_printer_driver_info_level_6(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u, prs_struct *ps, int depth) { SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *il; @@ -5312,7 +5312,7 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) and size of array at beginning ********************************************************************/ -BOOL smb_io_unibuffer(char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) +BOOL smb_io_unibuffer(const char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) { if (buffer==NULL) return False; @@ -5331,7 +5331,7 @@ BOOL smb_io_unibuffer(char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) /******************************************************************* ********************************************************************/ -BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth) +BOOL spool_io_printer_driver_info_level(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level"); depth++; @@ -5480,7 +5480,7 @@ BOOL make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 fill in the prs_struct for a ADDPRINTERDRIVER request PDU ********************************************************************/ -BOOL spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_addprinterdriver(const char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_addprinterdriver"); depth++; @@ -5507,7 +5507,7 @@ BOOL spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, pr /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addprinterdriver(char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_addprinterdriver(const char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addprinterdriver"); depth++; @@ -5522,7 +5522,7 @@ BOOL spoolss_io_r_addprinterdriver(char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, pr fill in the prs_struct for a ADDPRINTERDRIVER request PDU ********************************************************************/ -BOOL spoolss_io_q_addprinterdriverex(char *desc, SPOOL_Q_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_addprinterdriverex(const char *desc, SPOOL_Q_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_addprinterdriverex"); depth++; @@ -5554,7 +5554,7 @@ BOOL spoolss_io_q_addprinterdriverex(char *desc, SPOOL_Q_ADDPRINTERDRIVEREX *q_u /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addprinterdriverex(char *desc, SPOOL_R_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_addprinterdriverex(const char *desc, SPOOL_R_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addprinterdriverex"); depth++; @@ -5737,7 +5737,7 @@ BOOL make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR *q_u, Parse a SPOOL_Q_GETPRINTERDRIVERDIR structure. ********************************************************************/ -BOOL spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getprinterdriverdir(const char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdriverdir"); depth++; @@ -5779,7 +5779,7 @@ BOOL spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q Parse a SPOOL_R_GETPRINTERDRIVERDIR structure. ********************************************************************/ -BOOL spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getprinterdriverdir(const char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriverdir"); depth++; @@ -5805,7 +5805,7 @@ BOOL spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprintprocessors(const char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocessors"); depth++; @@ -5834,7 +5834,7 @@ BOOL spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprintprocessors(const char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprintprocessors"); depth++; @@ -5876,7 +5876,7 @@ BOOL spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_addprintprocessor(char *desc, SPOOL_Q_ADDPRINTPROCESSOR *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_addprintprocessor(const char *desc, SPOOL_Q_ADDPRINTPROCESSOR *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_addprintprocessor"); depth++; @@ -5910,7 +5910,7 @@ BOOL spoolss_io_q_addprintprocessor(char *desc, SPOOL_Q_ADDPRINTPROCESSOR *q_u, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addprintprocessor(char *desc, SPOOL_R_ADDPRINTPROCESSOR *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_addprintprocessor(const char *desc, SPOOL_R_ADDPRINTPROCESSOR *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addprintproicessor"); depth++; @@ -5927,7 +5927,7 @@ BOOL spoolss_io_r_addprintprocessor(char *desc, SPOOL_R_ADDPRINTPROCESSOR *r_u, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumprintprocdatatypes(char *desc, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprintprocdatatypes(const char *desc, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocdatatypes"); depth++; @@ -5956,7 +5956,7 @@ BOOL spoolss_io_r_enumprintprocdatatypes(char *desc, SPOOL_R_ENUMPRINTPROCDATATY /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumprintprocdatatypes(char *desc, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprintprocdatatypes(const char *desc, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprintprocdatatypes"); depth++; @@ -5999,7 +5999,7 @@ BOOL spoolss_io_q_enumprintprocdatatypes(char *desc, SPOOL_Q_ENUMPRINTPROCDATATY Parse a SPOOL_Q_ENUMPRINTMONITORS structure. ********************************************************************/ -BOOL spoolss_io_q_enumprintmonitors(char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprintmonitors(const char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprintmonitors"); depth++; @@ -6033,7 +6033,7 @@ BOOL spoolss_io_q_enumprintmonitors(char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprintmonitors(const char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprintmonitors"); depth++; @@ -6062,7 +6062,7 @@ BOOL spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprinterdata(const char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdata"); depth++; @@ -6119,7 +6119,7 @@ BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_ /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumprinterdata(char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprinterdata(const char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdata"); depth++; @@ -6157,7 +6157,7 @@ BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, ********************************************************************/ BOOL make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u, - const POLICY_HND *hnd, char *key, + const POLICY_HND *hnd, const char *key, uint32 size) { memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); @@ -6202,7 +6202,7 @@ BOOL make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX *q_u, const POLICY /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_setprinterdata(const char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_setprinterdata"); depth++; @@ -6251,7 +6251,7 @@ BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_st /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_setprinterdata(const char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setprinterdata"); depth++; @@ -6266,7 +6266,7 @@ BOOL spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_st /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_resetprinter(char *desc, SPOOL_Q_RESETPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_resetprinter(const char *desc, SPOOL_Q_RESETPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_resetprinter"); depth++; @@ -6293,7 +6293,7 @@ BOOL spoolss_io_q_resetprinter(char *desc, SPOOL_Q_RESETPRINTER *q_u, prs_struct /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_resetprinter(char *desc, SPOOL_R_RESETPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_resetprinter(const char *desc, SPOOL_R_RESETPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_resetprinter"); depth++; @@ -6309,7 +6309,7 @@ BOOL spoolss_io_r_resetprinter(char *desc, SPOOL_R_RESETPRINTER *r_u, prs_struct /******************************************************************* ********************************************************************/ -static BOOL spoolss_io_addform(char *desc, FORM *f, uint32 ptr, prs_struct *ps, int depth) +static BOOL spoolss_io_addform(const char *desc, FORM *f, uint32 ptr, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_addform"); depth++; @@ -6345,7 +6345,7 @@ static BOOL spoolss_io_addform(char *desc, FORM *f, uint32 ptr, prs_struct *ps, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_deleteform(char *desc, SPOOL_Q_DELETEFORM *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_deleteform(const char *desc, SPOOL_Q_DELETEFORM *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_deleteform"); depth++; @@ -6363,7 +6363,7 @@ BOOL spoolss_io_q_deleteform(char *desc, SPOOL_Q_DELETEFORM *q_u, prs_struct *ps /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_deleteform(char *desc, SPOOL_R_DELETEFORM *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_deleteform(const char *desc, SPOOL_R_DELETEFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteform"); depth++; @@ -6379,7 +6379,7 @@ BOOL spoolss_io_r_deleteform(char *desc, SPOOL_R_DELETEFORM *r_u, prs_struct *ps /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_addform(const char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth) { uint32 useless_ptr=1; prs_debug(ps, depth, desc, "spoolss_io_q_addform"); @@ -6408,7 +6408,7 @@ BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_addform(const char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addform"); depth++; @@ -6424,7 +6424,7 @@ BOOL spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_setform(const char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth) { uint32 useless_ptr=1; prs_debug(ps, depth, desc, "spoolss_io_q_setform"); @@ -6459,7 +6459,7 @@ BOOL spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_setform(char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_setform(const char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setform"); depth++; @@ -6476,7 +6476,7 @@ BOOL spoolss_io_r_setform(char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int Parse a SPOOL_R_GETJOB structure. ********************************************************************/ -BOOL spoolss_io_r_getjob(char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getjob(const char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getjob"); depth++; @@ -6503,7 +6503,7 @@ BOOL spoolss_io_r_getjob(char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int de Parse a SPOOL_Q_GETJOB structure. ********************************************************************/ -BOOL spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getjob(const char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); depth++; @@ -6603,7 +6603,7 @@ BOOL make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER *q_u, Parse a SPOOL_Q_REPLYOPENPRINTER structure. ********************************************************************/ -BOOL spoolss_io_q_replyopenprinter(char *desc, SPOOL_Q_REPLYOPENPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_replyopenprinter(const char *desc, SPOOL_Q_REPLYOPENPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_replyopenprinter"); depth++; @@ -6634,7 +6634,7 @@ BOOL spoolss_io_q_replyopenprinter(char *desc, SPOOL_Q_REPLYOPENPRINTER *q_u, pr Parse a SPOOL_R_REPLYOPENPRINTER structure. ********************************************************************/ -BOOL spoolss_io_r_replyopenprinter(char *desc, SPOOL_R_REPLYOPENPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_replyopenprinter(const char *desc, SPOOL_R_REPLYOPENPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_replyopenprinter"); depth++; @@ -6674,7 +6674,7 @@ BOOL make_spoolss_q_routerreplyprinter(SPOOL_Q_ROUTERREPLYPRINTER *q_u, POLICY_H /******************************************************************* Parse a SPOOL_Q_ROUTERREPLYPRINTER structure. ********************************************************************/ -BOOL spoolss_io_q_routerreplyprinter (char *desc, SPOOL_Q_ROUTERREPLYPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_routerreplyprinter (const char *desc, SPOOL_Q_ROUTERREPLYPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_routerreplyprinter"); @@ -6704,7 +6704,7 @@ BOOL spoolss_io_q_routerreplyprinter (char *desc, SPOOL_Q_ROUTERREPLYPRINTER *q_ /******************************************************************* Parse a SPOOL_R_ROUTERREPLYPRINTER structure. ********************************************************************/ -BOOL spoolss_io_r_routerreplyprinter (char *desc, SPOOL_R_ROUTERREPLYPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_routerreplyprinter (const char *desc, SPOOL_R_ROUTERREPLYPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_routerreplyprinter"); depth++; @@ -6736,7 +6736,7 @@ BOOL make_spoolss_q_reply_closeprinter(SPOOL_Q_REPLYCLOSEPRINTER *q_u, POLICY_HN Parse a SPOOL_Q_REPLYCLOSEPRINTER structure. ********************************************************************/ -BOOL spoolss_io_q_replycloseprinter(char *desc, SPOOL_Q_REPLYCLOSEPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_replycloseprinter(const char *desc, SPOOL_Q_REPLYCLOSEPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_replycloseprinter"); depth++; @@ -6754,7 +6754,7 @@ BOOL spoolss_io_q_replycloseprinter(char *desc, SPOOL_Q_REPLYCLOSEPRINTER *q_u, Parse a SPOOL_R_REPLYCLOSEPRINTER structure. ********************************************************************/ -BOOL spoolss_io_r_replycloseprinter(char *desc, SPOOL_R_REPLYCLOSEPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_replycloseprinter(const char *desc, SPOOL_R_REPLYCLOSEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_replycloseprinter"); depth++; @@ -6881,7 +6881,7 @@ BOOL make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd, Parse a SPOOL_Q_REPLY_RRPCN structure. ********************************************************************/ -BOOL spoolss_io_q_reply_rrpcn(char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_reply_rrpcn(const char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_reply_rrpcn"); depth++; @@ -6918,7 +6918,7 @@ BOOL spoolss_io_q_reply_rrpcn(char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct * Parse a SPOOL_R_REPLY_RRPCN structure. ********************************************************************/ -BOOL spoolss_io_r_reply_rrpcn(char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_reply_rrpcn(const char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_reply_rrpcn"); depth++; @@ -6940,7 +6940,7 @@ BOOL spoolss_io_r_reply_rrpcn(char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct * * called from spoolss_q_getprinterdataex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_getprinterdataex(char *desc, SPOOL_Q_GETPRINTERDATAEX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getprinterdataex(const char *desc, SPOOL_Q_GETPRINTERDATAEX *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -6973,7 +6973,7 @@ BOOL spoolss_io_q_getprinterdataex(char *desc, SPOOL_Q_GETPRINTERDATAEX *q_u, pr * called from spoolss_r_getprinterdataex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_getprinterdataex(char *desc, SPOOL_R_GETPRINTERDATAEX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getprinterdataex(const char *desc, SPOOL_R_GETPRINTERDATAEX *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -7012,7 +7012,7 @@ BOOL spoolss_io_r_getprinterdataex(char *desc, SPOOL_R_GETPRINTERDATAEX *r_u, pr * read a structure. ********************************************************************/ -BOOL spoolss_io_q_setprinterdataex(char *desc, SPOOL_Q_SETPRINTERDATAEX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_setprinterdataex(const char *desc, SPOOL_Q_SETPRINTERDATAEX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_setprinterdataex"); depth++; @@ -7068,7 +7068,7 @@ BOOL spoolss_io_q_setprinterdataex(char *desc, SPOOL_Q_SETPRINTERDATAEX *q_u, pr * write a structure. ********************************************************************/ -BOOL spoolss_io_r_setprinterdataex(char *desc, SPOOL_R_SETPRINTERDATAEX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_setprinterdataex(const char *desc, SPOOL_R_SETPRINTERDATAEX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setprinterdataex"); depth++; @@ -7085,7 +7085,8 @@ BOOL spoolss_io_r_setprinterdataex(char *desc, SPOOL_R_SETPRINTERDATAEX *r_u, pr * read a structure. ********************************************************************/ BOOL make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u, - POLICY_HND *hnd, char *key, uint32 size) + POLICY_HND *hnd, const char *key, + uint32 size) { DEBUG(5,("make_spoolss_q_enumprinterkey\n")); @@ -7100,7 +7101,7 @@ BOOL make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u, * read a structure. ********************************************************************/ -BOOL spoolss_io_q_enumprinterkey(char *desc, SPOOL_Q_ENUMPRINTERKEY *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprinterkey(const char *desc, SPOOL_Q_ENUMPRINTERKEY *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterkey"); depth++; @@ -7126,7 +7127,7 @@ BOOL spoolss_io_q_enumprinterkey(char *desc, SPOOL_Q_ENUMPRINTERKEY *q_u, prs_st * write a structure. ********************************************************************/ -BOOL spoolss_io_r_enumprinterkey(char *desc, SPOOL_R_ENUMPRINTERKEY *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprinterkey(const char *desc, SPOOL_R_ENUMPRINTERKEY *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterkey"); depth++; @@ -7168,7 +7169,7 @@ BOOL make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY *q_u, * read a structure. ********************************************************************/ -BOOL spoolss_io_q_deleteprinterkey(char *desc, SPOOL_Q_DELETEPRINTERKEY *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_deleteprinterkey(const char *desc, SPOOL_Q_DELETEPRINTERKEY *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_deleteprinterkey"); depth++; @@ -7188,7 +7189,7 @@ BOOL spoolss_io_q_deleteprinterkey(char *desc, SPOOL_Q_DELETEPRINTERKEY *q_u, pr * write a structure. ********************************************************************/ -BOOL spoolss_io_r_deleteprinterkey(char *desc, SPOOL_R_DELETEPRINTERKEY *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_deleteprinterkey(const char *desc, SPOOL_R_DELETEPRINTERKEY *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterkey"); depth++; @@ -7207,7 +7208,7 @@ BOOL spoolss_io_r_deleteprinterkey(char *desc, SPOOL_R_DELETEPRINTERKEY *r_u, pr * read a structure. ********************************************************************/ -BOOL spoolss_io_q_enumprinterdataex(char *desc, SPOOL_Q_ENUMPRINTERDATAEX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprinterdataex(const char *desc, SPOOL_Q_ENUMPRINTERDATAEX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdataex"); depth++; @@ -7232,7 +7233,7 @@ BOOL spoolss_io_q_enumprinterdataex(char *desc, SPOOL_Q_ENUMPRINTERDATAEX *q_u, /******************************************************************* ********************************************************************/ -static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, +static BOOL spoolss_io_printer_enum_values_ctr(const char *desc, prs_struct *ps, PRINTER_ENUM_VALUES_CTR *ctr, int depth) { int i; @@ -7315,7 +7316,7 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, * write a structure. ********************************************************************/ -BOOL spoolss_io_r_enumprinterdataex(char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprinterdataex(const char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, prs_struct *ps, int depth) { uint32 data_offset, end_offset; prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdataex"); @@ -7392,7 +7393,7 @@ BOOL make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTOR return True; } -BOOL spoolss_io_q_getprintprocessordirectory(char *desc, SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getprintprocessordirectory(const char *desc, SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, prs_struct *ps, int depth) { uint32 ptr; @@ -7444,7 +7445,7 @@ BOOL spoolss_io_q_getprintprocessordirectory(char *desc, SPOOL_Q_GETPRINTPROCESS * write a structure. ********************************************************************/ -BOOL spoolss_io_r_getprintprocessordirectory(char *desc, SPOOL_R_GETPRINTPROCESSORDIRECTORY *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getprintprocessordirectory(const char *desc, SPOOL_R_GETPRINTPROCESSORDIRECTORY *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getprintprocessordirectory"); depth++; @@ -7467,7 +7468,7 @@ BOOL spoolss_io_r_getprintprocessordirectory(char *desc, SPOOL_R_GETPRINTPROCESS return True; } -BOOL smb_io_printprocessordirectory_1(char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR_DIRECTORY_1 *info, int depth) +BOOL smb_io_printprocessordirectory_1(const char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR_DIRECTORY_1 *info, int depth) { prs_struct *ps=&buffer->prs; diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index b3d33645b9..bfa1a13be9 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -32,7 +32,7 @@ Inits a SH_INFO_0_STR structure ********************************************************************/ -void init_srv_share_info0_str(SH_INFO_0_STR *sh0, char *net_name) +void init_srv_share_info0_str(SH_INFO_0_STR *sh0, const char *net_name) { DEBUG(5,("init_srv_share_info0_str\n")); @@ -44,7 +44,7 @@ void init_srv_share_info0_str(SH_INFO_0_STR *sh0, char *net_name) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info0_str(char *desc, SH_INFO_0_STR *sh0, prs_struct *ps, int depth) +static BOOL srv_io_share_info0_str(const char *desc, SH_INFO_0_STR *sh0, prs_struct *ps, int depth) { if (sh0 == NULL) return False; @@ -65,7 +65,7 @@ static BOOL srv_io_share_info0_str(char *desc, SH_INFO_0_STR *sh0, prs_struct *p makes a SH_INFO_0 structure ********************************************************************/ -void init_srv_share_info0(SH_INFO_0 *sh0, char *net_name) +void init_srv_share_info0(SH_INFO_0 *sh0, const char *net_name) { DEBUG(5,("init_srv_share_info0: %s\n", net_name)); @@ -76,7 +76,7 @@ void init_srv_share_info0(SH_INFO_0 *sh0, char *net_name) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info0(char *desc, SH_INFO_0 *sh0, prs_struct *ps, int depth) +static BOOL srv_io_share_info0(const char *desc, SH_INFO_0 *sh0, prs_struct *ps, int depth) { if (sh0 == NULL) return False; @@ -97,7 +97,7 @@ static BOOL srv_io_share_info0(char *desc, SH_INFO_0 *sh0, prs_struct *ps, int d Inits a SH_INFO_1_STR structure ********************************************************************/ -void init_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark) +void init_srv_share_info1_str(SH_INFO_1_STR *sh1, const char *net_name, const char *remark) { DEBUG(5,("init_srv_share_info1_str\n")); @@ -111,7 +111,7 @@ void init_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth) +static BOOL srv_io_share_info1_str(const char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth) { if (sh1 == NULL) return False; @@ -140,7 +140,7 @@ static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *p makes a SH_INFO_1 structure ********************************************************************/ -void init_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark) +void init_srv_share_info1(SH_INFO_1 *sh1, const char *net_name, uint32 type, const char *remark) { DEBUG(5,("init_srv_share_info1: %s %8x %s\n", net_name, type, remark)); @@ -153,7 +153,7 @@ void init_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *rem Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) +static BOOL srv_io_share_info1(const char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) { if (sh1 == NULL) return False; @@ -179,8 +179,8 @@ static BOOL srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int d ********************************************************************/ void init_srv_share_info2_str(SH_INFO_2_STR *sh2, - char *net_name, char *remark, - char *path, char *passwd) + const char *net_name, const char *remark, + const char *path, const char *passwd) { DEBUG(5,("init_srv_share_info2_str\n")); @@ -198,7 +198,7 @@ void init_srv_share_info2_str(SH_INFO_2_STR *sh2, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) +static BOOL srv_io_share_info2_str(const char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) { if (sh2 == NULL) return False; @@ -236,9 +236,9 @@ static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2 ********************************************************************/ void init_srv_share_info2(SH_INFO_2 *sh2, - char *net_name, uint32 type, char *remark, + const char *net_name, uint32 type, const char *remark, uint32 perms, uint32 max_uses, uint32 num_uses, - char *path, char *passwd) + const char *path, const char *passwd) { DEBUG(5,("init_srv_share_info2: %s %8x %s\n", net_name, type, remark)); @@ -256,7 +256,7 @@ void init_srv_share_info2(SH_INFO_2 *sh2, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) +static BOOL srv_io_share_info2(const char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) { if (sh2 == NULL) return False; @@ -292,7 +292,7 @@ static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int d ********************************************************************/ void init_srv_share_info501_str(SH_INFO_501_STR *sh501, - char *net_name, char *remark) + const char *net_name, const char *remark) { DEBUG(5,("init_srv_share_info501_str\n")); @@ -306,7 +306,7 @@ void init_srv_share_info501_str(SH_INFO_501_STR *sh501, Inits a SH_INFO_2 structure *******************************************************************/ -void init_srv_share_info501(SH_INFO_501 *sh501, char *net_name, uint32 type, char *remark, uint32 csc_policy) +void init_srv_share_info501(SH_INFO_501 *sh501, const char *net_name, uint32 type, const char *remark, uint32 csc_policy) { DEBUG(5,("init_srv_share_info501: %s %8x %s %08x\n", net_name, type, remark, csc_policy)); @@ -323,7 +323,7 @@ void init_srv_share_info501(SH_INFO_501 *sh501, char *net_name, uint32 type, cha Reads of writes a structure. *******************************************************************/ -static BOOL srv_io_share_info501(char *desc, SH_INFO_501 *sh501, prs_struct *ps, int depth) +static BOOL srv_io_share_info501(const char *desc, SH_INFO_501 *sh501, prs_struct *ps, int depth) { if (sh501 == NULL) return False; @@ -350,7 +350,7 @@ static BOOL srv_io_share_info501(char *desc, SH_INFO_501 *sh501, prs_struct *ps, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info501_str(char *desc, SH_INFO_501_STR *sh501, prs_struct *ps, int depth) +static BOOL srv_io_share_info501_str(const char *desc, SH_INFO_501_STR *sh501, prs_struct *ps, int depth) { if (sh501 == NULL) return False; @@ -376,9 +376,9 @@ static BOOL srv_io_share_info501_str(char *desc, SH_INFO_501_STR *sh501, prs_str ********************************************************************/ void init_srv_share_info502(SH_INFO_502 *sh502, - const char *net_name, uint32 type, char *remark, + const char *net_name, uint32 type, const char *remark, uint32 perms, uint32 max_uses, uint32 num_uses, - char *path, char *passwd, SEC_DESC *psd, size_t sd_size) + const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size) { DEBUG(5,("init_srv_share_info502: %s %8x %s\n", net_name, type, remark)); @@ -401,7 +401,7 @@ void init_srv_share_info502(SH_INFO_502 *sh502, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info502(char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth) +static BOOL srv_io_share_info502(const char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth) { if (sh502 == NULL) return False; @@ -441,8 +441,8 @@ static BOOL srv_io_share_info502(char *desc, SH_INFO_502 *sh502, prs_struct *ps, ********************************************************************/ void init_srv_share_info502_str(SH_INFO_502_STR *sh502str, - char *net_name, char *remark, - char *path, char *passwd, SEC_DESC *psd, size_t sd_size) + const char *net_name, const char *remark, + const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size) { DEBUG(5,("init_srv_share_info502_str\n")); @@ -463,7 +463,7 @@ void init_srv_share_info502_str(SH_INFO_502_STR *sh502str, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info502_str(char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth) +static BOOL srv_io_share_info502_str(const char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth) { if (sh502 == NULL) return False; @@ -547,7 +547,7 @@ static BOOL srv_io_share_info502_str(char *desc, SH_INFO_502_STR *sh502, prs_str Inits a SH_INFO_1004_STR structure ********************************************************************/ -void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, char *remark) +void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, const char *remark) { DEBUG(5,("init_srv_share_info1004_str\n")); @@ -559,7 +559,7 @@ void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, char *remark) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1004_str(char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth) +static BOOL srv_io_share_info1004_str(const char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth) { if (sh1004 == NULL) return False; @@ -580,7 +580,7 @@ static BOOL srv_io_share_info1004_str(char *desc, SH_INFO_1004_STR *sh1004, prs_ makes a SH_INFO_1004 structure ********************************************************************/ -void init_srv_share_info1004(SH_INFO_1004 *sh1004, char *remark) +void init_srv_share_info1004(SH_INFO_1004 *sh1004, const char *remark) { DEBUG(5,("init_srv_share_info1004: %s\n", remark)); @@ -591,7 +591,7 @@ void init_srv_share_info1004(SH_INFO_1004 *sh1004, char *remark) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1004(char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth) +static BOOL srv_io_share_info1004(const char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth) { if (sh1004 == NULL) return False; @@ -612,7 +612,7 @@ static BOOL srv_io_share_info1004(char *desc, SH_INFO_1004 *sh1004, prs_struct * Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth) +static BOOL srv_io_share_info1005(const char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth) { if(sh1005 == NULL) return False; @@ -633,7 +633,7 @@ static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005, prs_s Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1006(char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth) +static BOOL srv_io_share_info1006(const char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth) { if(sh1006 == NULL) return False; @@ -666,7 +666,7 @@ void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1007_str(char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth) +static BOOL srv_io_share_info1007_str(const char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth) { if (sh1007 == NULL) return False; @@ -699,7 +699,7 @@ void init_srv_share_info1007(SH_INFO_1007 *sh1007, uint32 flags, const char *alt Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1007(char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth) +static BOOL srv_io_share_info1007(const char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth) { if (sh1007 == NULL) return False; @@ -722,7 +722,7 @@ static BOOL srv_io_share_info1007(char *desc, SH_INFO_1007 *sh1007, prs_struct * Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1501(char* desc, SRV_SHARE_INFO_1501* sh1501, +static BOOL srv_io_share_info1501(const char* desc, SRV_SHARE_INFO_1501* sh1501, prs_struct* ps, int depth) { if(sh1501 == NULL) @@ -744,7 +744,7 @@ static BOOL srv_io_share_info1501(char* desc, SRV_SHARE_INFO_1501* sh1501, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return False; @@ -1045,7 +1045,7 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct ********************************************************************/ void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, - char *srv_name, uint32 info_level, + const char *srv_name, uint32 info_level, uint32 preferred_len, ENUM_HND *hnd) { @@ -1067,7 +1067,7 @@ void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_share_enum(const char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1102,7 +1102,7 @@ BOOL srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct * Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_share_enum(const char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -1151,7 +1151,7 @@ BOOL init_srv_q_net_share_get_info(SRV_Q_NET_SHARE_GET_INFO *q_n, const char *sr Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_share_get_info(char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_share_get_info(const char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1183,7 +1183,7 @@ BOOL srv_io_q_net_share_get_info(char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_ Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n) +static BOOL srv_io_srv_share_info(const char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n) { if (r_n == NULL) return False; @@ -1294,7 +1294,7 @@ static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHA Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_share_get_info(const char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -1349,7 +1349,7 @@ BOOL init_srv_q_net_share_set_info(SRV_Q_NET_SHARE_SET_INFO *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_share_set_info(char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_share_set_info(const char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1396,7 +1396,7 @@ BOOL srv_io_q_net_share_set_info(char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_ Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_share_set_info(const char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -1427,7 +1427,7 @@ BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_ Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_share_add(char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_share_add(const char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1467,10 +1467,10 @@ BOOL srv_io_q_net_share_add(char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps return True; } -void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, char *srvname, - char *netname, uint32 type, char *remark, +void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname, + const char *netname, uint32 type, const char *remark, uint32 perms, uint32 max_uses, uint32 num_uses, - char *path, char *passwd) + const char *path, const char *passwd) { q->ptr_srv_name = 1; init_unistr2(&q->uni_srv_name, srvname, strlen(srvname) +1); @@ -1490,7 +1490,7 @@ void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, char *srvname, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_share_add(const char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -1532,7 +1532,7 @@ void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_share_del(char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_share_del(const char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1563,7 +1563,7 @@ BOOL srv_io_q_net_share_del(char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_del(char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_share_del(const char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1584,7 +1584,7 @@ BOOL srv_io_r_net_share_del(char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps Inits a SESS_INFO_0_STR structure ********************************************************************/ -void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name) +void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, const char *name) { DEBUG(5,("init_srv_sess_info0_str\n")); @@ -1595,7 +1595,7 @@ void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth) +static BOOL srv_io_sess_info0_str(const char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return False; @@ -1616,7 +1616,7 @@ static BOOL srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct Inits a SESS_INFO_0 structure ********************************************************************/ -void init_srv_sess_info0(SESS_INFO_0 *ss0, char *name) +void init_srv_sess_info0(SESS_INFO_0 *ss0, const char *name) { DEBUG(5,("init_srv_sess_info0: %s\n", name)); @@ -1627,7 +1627,7 @@ void init_srv_sess_info0(SESS_INFO_0 *ss0, char *name) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth) +static BOOL srv_io_sess_info0(const char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return False; @@ -1648,7 +1648,7 @@ static BOOL srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth) +static BOOL srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return False; @@ -1698,7 +1698,7 @@ static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct Inits a SESS_INFO_1_STR structure ********************************************************************/ -void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user) +void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, const char *name, const char *user) { DEBUG(5,("init_srv_sess_info1_str\n")); @@ -1710,7 +1710,7 @@ void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth) +static BOOL srv_io_sess_info1_str(const char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -1734,7 +1734,7 @@ static BOOL srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct * ********************************************************************/ void init_srv_sess_info1(SESS_INFO_1 *ss1, - char *name, char *user, + const char *name, const char *user, uint32 num_opens, uint32 open_time, uint32 idle_time, uint32 user_flags) { @@ -1753,7 +1753,7 @@ void init_srv_sess_info1(SESS_INFO_1 *ss1, reads or writes a structure. ********************************************************************/ -static BOOL srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth) +static BOOL srv_io_sess_info1(const char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -1785,7 +1785,7 @@ static BOOL srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth) +static BOOL srv_io_srv_sess_info_1(const char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -1835,7 +1835,7 @@ static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth) { SRV_SESS_INFO_CTR *ctr = *pp_ctr; @@ -1884,8 +1884,8 @@ static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_stru ********************************************************************/ void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, - char *srv_name, char *qual_name, - char *user_name, uint32 sess_level, + const char *srv_name, const char *qual_name, + const char *user_name, uint32 sess_level, SRV_SESS_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) { @@ -1907,7 +1907,7 @@ void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1962,7 +1962,7 @@ BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_sess_enum(const char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -2006,7 +2006,7 @@ void init_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth) +static BOOL srv_io_conn_info0(const char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return False; @@ -2027,7 +2027,7 @@ static BOOL srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth) +static BOOL srv_io_srv_conn_info_0(const char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return False; @@ -2070,7 +2070,7 @@ static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct Inits a CONN_INFO_1_STR structure ********************************************************************/ -void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name) +void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, const char *usr_name, const char *net_name) { DEBUG(5,("init_srv_conn_info1_str\n")); @@ -2082,7 +2082,7 @@ void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_nam Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth) +static BOOL srv_io_conn_info1_str(const char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -2108,7 +2108,7 @@ static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct * void init_srv_conn_info1(CONN_INFO_1 *ss1, uint32 id, uint32 type, uint32 num_opens, uint32 num_users, uint32 open_time, - char *usr_name, char *net_name) + const char *usr_name, const char *net_name) { DEBUG(5,("init_srv_conn_info1: %s %s\n", usr_name, net_name)); @@ -2126,7 +2126,7 @@ void init_srv_conn_info1(CONN_INFO_1 *ss1, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth) +static BOOL srv_io_conn_info1(const char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -2160,7 +2160,7 @@ static BOOL srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth) +static BOOL srv_io_srv_conn_info_1(const char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -2208,7 +2208,7 @@ static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_conn_ctr(const char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth) { SRV_CONN_INFO_CTR *ctr = *pp_ctr; @@ -2257,7 +2257,7 @@ static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_stru ********************************************************************/ void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, - char *srv_name, char *qual_name, + const char *srv_name, const char *qual_name, uint32 conn_level, SRV_CONN_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) @@ -2279,7 +2279,7 @@ void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_conn_enum(const char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -2327,7 +2327,7 @@ BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -2360,7 +2360,7 @@ BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *p Inits a FILE_INFO_3_STR structure ********************************************************************/ -void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name) +void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, const char *user_name, const char *path_name) { DEBUG(5,("init_srv_file_info3_str\n")); @@ -2372,7 +2372,7 @@ void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_n Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth) +static BOOL srv_io_file_info3_str(const char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth) { if (sh1 == NULL) return False; @@ -2397,7 +2397,7 @@ static BOOL srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct * void init_srv_file_info3(FILE_INFO_3 *fl3, uint32 id, uint32 perms, uint32 num_locks, - char *path_name, char *user_name) + const char *path_name, const char *user_name) { DEBUG(5,("init_srv_file_info3: %s %s\n", path_name, user_name)); @@ -2413,7 +2413,7 @@ void init_srv_file_info3(FILE_INFO_3 *fl3, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) +static BOOL srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) { if (fl3 == NULL) return False; @@ -2442,7 +2442,7 @@ static BOOL srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return False; @@ -2536,7 +2536,7 @@ void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -2591,7 +2591,7 @@ BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -2623,7 +2623,7 @@ BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps /******************************************************************* Initialize a net file close request ********************************************************************/ -void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, char *server, +void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, const char *server, uint32 file_id) { q_n->ptr_srv_name = 1; @@ -2634,7 +2634,7 @@ void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, char *server, /******************************************************************* Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_file_close(char *desc, SRV_Q_NET_FILE_CLOSE *q_n, +BOOL srv_io_q_net_file_close(const char *desc, SRV_Q_NET_FILE_CLOSE *q_n, prs_struct *ps, int depth) { if (q_n == NULL) @@ -2664,7 +2664,7 @@ BOOL srv_io_q_net_file_close(char *desc, SRV_Q_NET_FILE_CLOSE *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_file_close(char *desc, SRV_R_NET_FILE_CLOSE *q_n, +BOOL srv_io_r_net_file_close(const char *desc, SRV_R_NET_FILE_CLOSE *q_n, prs_struct *ps, int depth) { if (q_n == NULL) @@ -2698,7 +2698,7 @@ void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, const char *name Reads or writes a SRV_INFO_101 structure. ********************************************************************/ -static BOOL srv_io_info_100(char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth) +static BOOL srv_io_info_100(const char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth) { if (sv100 == NULL) return False; @@ -2743,7 +2743,7 @@ void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, const char *name Reads or writes a SRV_INFO_101 structure. ********************************************************************/ -static BOOL srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth) +static BOOL srv_io_info_101(const char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth) { if (sv101 == NULL) return False; @@ -2813,7 +2813,7 @@ void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, const char *name Reads or writes a SRV_INFO_102 structure. ********************************************************************/ -static BOOL srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth) +static BOOL srv_io_info_102(const char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth) { if (sv102 == NULL) return False; @@ -2872,7 +2872,7 @@ static BOOL srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int Reads or writes a SRV_INFO_102 structure. ********************************************************************/ -static BOOL srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL srv_io_info_ctr(const char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return False; @@ -2919,7 +2919,7 @@ static BOOL srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int d ********************************************************************/ void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv, - char *server_name, uint32 switch_value) + const char *server_name, uint32 switch_value) { DEBUG(5,("init_srv_q_net_srv_get_info\n")); @@ -2932,7 +2932,7 @@ void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_srv_get_info(const char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -2996,7 +2996,7 @@ void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_srv_set_info(char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, +BOOL srv_io_q_net_srv_set_info(const char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info"); @@ -3034,7 +3034,7 @@ BOOL srv_io_q_net_srv_set_info(char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_srv_get_info(const char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -3058,7 +3058,7 @@ BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_stru Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_srv_set_info(char *desc, SRV_R_NET_SRV_SET_INFO *r_n, +BOOL srv_io_r_net_srv_set_info(const char *desc, SRV_R_NET_SRV_SET_INFO *r_n, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "srv_io_r_net_srv_set_info"); @@ -3080,7 +3080,7 @@ BOOL srv_io_r_net_srv_set_info(char *desc, SRV_R_NET_SRV_SET_INFO *r_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_remote_tod(const char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -3103,7 +3103,7 @@ BOOL srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct * Reads or writes a TIME_OF_DAY_INFO structure. ********************************************************************/ -static BOOL srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth) +static BOOL srv_io_time_of_day_info(const char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth) { if (tod == NULL) return False; @@ -3172,7 +3172,7 @@ void init_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_remote_tod(const char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -3224,7 +3224,7 @@ BOOL init_srv_q_net_disk_enum(SRV_Q_NET_DISK_ENUM *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_disk_enum(char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_disk_enum(const char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -3268,7 +3268,7 @@ BOOL srv_io_q_net_disk_enum(char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_disk_enum(char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth) { int i; @@ -3357,7 +3357,7 @@ BOOL init_srv_q_net_name_validate(SRV_Q_NET_NAME_VALIDATE *q_n, const char *srv_ Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_name_validate(char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_name_validate(const char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -3396,7 +3396,7 @@ BOOL srv_io_q_net_name_validate(char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_st Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_name_validate(char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_name_validate(const char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -3417,7 +3417,7 @@ BOOL srv_io_r_net_name_validate(char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_st Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_file_query_secdesc(char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_file_query_secdesc(const char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -3465,7 +3465,7 @@ BOOL srv_io_q_net_file_query_secdesc(char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_file_query_secdesc(char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_file_query_secdesc(const char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -3504,7 +3504,7 @@ BOOL srv_io_r_net_file_query_secdesc(char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_file_set_secdesc(char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_file_set_secdesc(const char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -3561,7 +3561,7 @@ BOOL srv_io_q_net_file_set_secdesc(char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_file_set_secdesc(char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -3582,7 +3582,7 @@ BOOL srv_io_r_net_file_set_secdesc(char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, Inits a structure ********************************************************************/ -void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, char *server) +void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server) { q_u->ptr_srv_name = 1; init_unistr2(&q_u->uni_srv_name, server, strlen(server) + 1); diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c index 7b8fd76b7b..b6de058652 100644 --- a/source3/rpc_parse/parse_wks.c +++ b/source3/rpc_parse/parse_wks.c @@ -42,7 +42,7 @@ void init_wks_q_query_info(WKS_Q_QUERY_INFO *q_u, Reads or writes a WKS_Q_QUERY_INFO structure. ********************************************************************/ -BOOL wks_io_q_query_info(char *desc, WKS_Q_QUERY_INFO *q_u, prs_struct *ps, int depth) +BOOL wks_io_q_query_info(const char *desc, WKS_Q_QUERY_INFO *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -90,7 +90,7 @@ void init_wks_info_100(WKS_INFO_100 *inf, Reads or writes a WKS_INFO_100 structure. ********************************************************************/ -static BOOL wks_io_wks_info_100(char *desc, WKS_INFO_100 *inf, prs_struct *ps, int depth) +static BOOL wks_io_wks_info_100(const char *desc, WKS_INFO_100 *inf, prs_struct *ps, int depth) { if (inf == NULL) return False; @@ -150,7 +150,7 @@ void init_wks_r_query_info(WKS_R_QUERY_INFO *r_u, Reads or writes a structure. ********************************************************************/ -BOOL wks_io_r_query_info(char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int depth) +BOOL wks_io_r_query_info(const char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; -- cgit From 634c54310c92c48dd4eceec602e230a021bdcfc5 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 3 Jan 2003 08:28:12 +0000 Subject: Merge from HEAD - make Samba compile with -Wwrite-strings without additional warnings. (Adds a lot of const). Andrew Bartlett (This used to be commit 3a7458f9472432ef12c43008414925fd1ce8ea0c) --- source3/rpc_parse/parse_dfs.c | 24 +-- source3/rpc_parse/parse_ds.c | 6 +- source3/rpc_parse/parse_lsa.c | 126 +++++++------- source3/rpc_parse/parse_misc.c | 68 ++++---- source3/rpc_parse/parse_net.c | 92 +++++------ source3/rpc_parse/parse_prs.c | 44 ++--- source3/rpc_parse/parse_reg.c | 80 ++++----- source3/rpc_parse/parse_rpc.c | 44 ++--- source3/rpc_parse/parse_samr.c | 274 +++++++++++++++---------------- source3/rpc_parse/parse_sec.c | 10 +- source3/rpc_parse/parse_spoolss.c | 337 +++++++++++++++++++------------------- source3/rpc_parse/parse_srv.c | 212 ++++++++++++------------ source3/rpc_parse/parse_wks.c | 6 +- 13 files changed, 662 insertions(+), 661 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index 38633ac0f7..ccd6d429fa 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -41,7 +41,7 @@ void init_dfs_q_dfs_exist(DFS_Q_DFS_EXIST *q_d) Read/write a DFS_Q_DFS_EXIST structure - dummy... ************************************************************/ -BOOL dfs_io_q_dfs_exist(char *desc, DFS_Q_DFS_EXIST *q_d, prs_struct *ps, int depth) +BOOL dfs_io_q_dfs_exist(const char *desc, DFS_Q_DFS_EXIST *q_d, prs_struct *ps, int depth) { if(q_d == NULL) return False; @@ -55,7 +55,7 @@ BOOL dfs_io_q_dfs_exist(char *desc, DFS_Q_DFS_EXIST *q_d, prs_struct *ps, int de Read/write a DFS_R_DFS_EXIST structure ************************************************************/ -BOOL dfs_io_r_dfs_exist(char *desc, DFS_R_DFS_EXIST *q_d, prs_struct *ps, int depth) +BOOL dfs_io_r_dfs_exist(const char *desc, DFS_R_DFS_EXIST *q_d, prs_struct *ps, int depth) { if(q_d == NULL) return False; @@ -91,7 +91,7 @@ BOOL init_dfs_q_dfs_remove(DFS_Q_DFS_REMOVE *q_d, char *entrypath, Read/write a DFS_Q_DFS_REMOVE structure *******************************************************************/ -BOOL dfs_io_q_dfs_remove(char *desc, DFS_Q_DFS_REMOVE *q_d, prs_struct *ps, int depth) +BOOL dfs_io_q_dfs_remove(const char *desc, DFS_Q_DFS_REMOVE *q_d, prs_struct *ps, int depth) { if(q_d == NULL) return False; @@ -131,7 +131,7 @@ BOOL dfs_io_q_dfs_remove(char *desc, DFS_Q_DFS_REMOVE *q_d, prs_struct *ps, int Read/write a DFS_R_DFS_REMOVE structure *******************************************************************/ -BOOL dfs_io_r_dfs_remove(char *desc, DFS_R_DFS_REMOVE *r_d, prs_struct *ps, int depth) +BOOL dfs_io_r_dfs_remove(const char *desc, DFS_R_DFS_REMOVE *r_d, prs_struct *ps, int depth) { if(r_d == NULL) return False; @@ -172,7 +172,7 @@ BOOL init_dfs_q_dfs_add(DFS_Q_DFS_ADD *q_d, char *entrypath, char *servername, Read/write a DFS_Q_DFS_ADD structure ************************************************************/ -BOOL dfs_io_q_dfs_add(char *desc, DFS_Q_DFS_ADD *q_d, prs_struct *ps, int depth) +BOOL dfs_io_q_dfs_add(const char *desc, DFS_Q_DFS_ADD *q_d, prs_struct *ps, int depth) { if(q_d == NULL) return False; @@ -217,7 +217,7 @@ BOOL dfs_io_q_dfs_add(char *desc, DFS_Q_DFS_ADD *q_d, prs_struct *ps, int depth) Read/write a DFS_R_DFS_ADD structure ************************************************************/ -BOOL dfs_io_r_dfs_add(char *desc, DFS_R_DFS_ADD *r_d, prs_struct *ps, int depth) +BOOL dfs_io_r_dfs_add(const char *desc, DFS_R_DFS_ADD *r_d, prs_struct *ps, int depth) { if(r_d == NULL) return False; @@ -248,7 +248,7 @@ BOOL init_dfs_q_dfs_get_info(DFS_Q_DFS_GET_INFO *q_d, char *entrypath, Read/write a DFS_Q_GET_INFO structure ************************************************************/ -BOOL dfs_io_q_dfs_get_info(char* desc, DFS_Q_DFS_GET_INFO* q_i, prs_struct* ps, int depth) +BOOL dfs_io_q_dfs_get_info(const char *desc, DFS_Q_DFS_GET_INFO* q_i, prs_struct* ps, int depth) { if(q_i == NULL) return False; @@ -288,7 +288,7 @@ BOOL dfs_io_q_dfs_get_info(char* desc, DFS_Q_DFS_GET_INFO* q_i, prs_struct* ps, Read/write a DFS_R_GET_INFO structure ************************************************************/ -BOOL dfs_io_r_dfs_get_info(char* desc, DFS_R_DFS_GET_INFO* r_i, prs_struct* ps, int depth) +BOOL dfs_io_r_dfs_get_info(const char *desc, DFS_R_DFS_GET_INFO* r_i, prs_struct* ps, int depth) { if(r_i == NULL) return False; @@ -327,7 +327,7 @@ BOOL init_dfs_q_dfs_enum(DFS_Q_DFS_ENUM *q_d, uint32 level, DFS_INFO_CTR *ctr) Read or write the DFS_Q_DFS_ENUM structure ************************************************************/ -BOOL dfs_io_q_dfs_enum(char *desc, DFS_Q_DFS_ENUM *q_d, prs_struct *ps, int depth) +BOOL dfs_io_q_dfs_enum(const char *desc, DFS_Q_DFS_ENUM *q_d, prs_struct *ps, int depth) { if(q_d == NULL) return False; @@ -364,7 +364,7 @@ BOOL dfs_io_q_dfs_enum(char *desc, DFS_Q_DFS_ENUM *q_d, prs_struct *ps, int dept Read/write a DFS_INFO_CTR structure ************************************************************/ -BOOL dfs_io_dfs_info_ctr(char* desc, DFS_INFO_CTR* ctr, uint32 num_entries, uint32 level, prs_struct* ps, int depth) +BOOL dfs_io_dfs_info_ctr(const char *desc, DFS_INFO_CTR* ctr, uint32 num_entries, uint32 level, prs_struct* ps, int depth) { int i=0; @@ -464,7 +464,7 @@ BOOL dfs_io_dfs_info_ctr(char* desc, DFS_INFO_CTR* ctr, uint32 num_entries, uint Read/write a DFS_R_DFS_ENUM structure ************************************************************/ -BOOL dfs_io_r_dfs_enum(char *desc, DFS_R_DFS_ENUM *q_d, prs_struct *ps, int depth) +BOOL dfs_io_r_dfs_enum(const char *desc, DFS_R_DFS_ENUM *q_d, prs_struct *ps, int depth) { DFS_INFO_CTR *ctr; if(q_d == NULL) @@ -506,7 +506,7 @@ BOOL dfs_io_r_dfs_enum(char *desc, DFS_R_DFS_ENUM *q_d, prs_struct *ps, int dept return True; } -BOOL dfs_io_dfs_storage_info(char *desc, DFS_INFO_3* info3, prs_struct *ps, int depth) +BOOL dfs_io_dfs_storage_info(const char *desc, DFS_INFO_3* info3, prs_struct *ps, int depth) { int i=0; if(info3 == NULL) diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index 3c70cabc71..ab07631831 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -20,7 +20,7 @@ #include "includes.h" -static BOOL ds_io_dominfobasic( char *desc, prs_struct *ps, int depth, DSROLE_PRIMARY_DOMAIN_INFO_BASIC **basic) +static BOOL ds_io_dominfobasic( const char *desc, prs_struct *ps, int depth, DSROLE_PRIMARY_DOMAIN_INFO_BASIC **basic) { DSROLE_PRIMARY_DOMAIN_INFO_BASIC *p = *basic; @@ -68,7 +68,7 @@ static BOOL ds_io_dominfobasic( char *desc, prs_struct *ps, int depth, DSROLE_PR } -BOOL ds_io_q_getprimdominfo( char *desc, DS_Q_GETPRIMDOMINFO *q_u, prs_struct *ps, int depth) +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++; @@ -82,7 +82,7 @@ BOOL ds_io_q_getprimdominfo( char *desc, DS_Q_GETPRIMDOMINFO *q_u, prs_struct *p return True; } -BOOL ds_io_r_getprimdominfo( char *desc, DS_R_GETPRIMDOMINFO *r_u, prs_struct *ps, int depth) +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++; diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 375bbd31d7..56398e7cf0 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -27,14 +27,14 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth); +static BOOL lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *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, char *name, uint32 idx) + uint16 sid_name_use, const char *name, uint32 idx) { int len_name = strlen(name); @@ -51,7 +51,7 @@ void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, Reads or writes a LSA_TRANS_NAME structure. ********************************************************************/ -static BOOL lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, +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"); @@ -77,7 +77,7 @@ static BOOL lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, Reads or writes a DOM_R_REF structure. ********************************************************************/ -static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, +static BOOL lsa_io_dom_r_ref(const char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) { int i; @@ -156,7 +156,7 @@ void init_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff) Reads or writes an LSA_SEC_QOS structure. ********************************************************************/ -static BOOL lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, +static BOOL lsa_io_sec_qos(const char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int depth) { uint32 start; @@ -216,7 +216,7 @@ static void init_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS Reads or writes an LSA_OBJ_ATTR structure. ********************************************************************/ -static BOOL lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, +static BOOL lsa_io_obj_attr(const char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int depth) { uint32 start; @@ -290,7 +290,7 @@ void init_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name, Reads or writes an LSA_Q_OPEN_POL structure. ********************************************************************/ -BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, +BOOL lsa_io_q_open_pol(const char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_open_pol"); @@ -316,7 +316,7 @@ BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, Reads or writes an LSA_R_OPEN_POL structure. ********************************************************************/ -BOOL lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, +BOOL lsa_io_r_open_pol(const char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_open_pol"); @@ -335,7 +335,7 @@ BOOL lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, Inits an LSA_Q_OPEN_POL2 structure. ********************************************************************/ -void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, +void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, const char *server_name, uint32 attributes, uint32 desired_access, LSA_SEC_QOS *qos) { @@ -356,7 +356,7 @@ void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name, Reads or writes an LSA_Q_OPEN_POL2 structure. ********************************************************************/ -BOOL lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, +BOOL lsa_io_q_open_pol2(const char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_open_pol2"); @@ -380,7 +380,7 @@ BOOL lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, Reads or writes an LSA_R_OPEN_POL2 structure. ********************************************************************/ -BOOL lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, +BOOL lsa_io_r_open_pol2(const char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_open_pol2"); @@ -414,7 +414,7 @@ void init_q_query_sec_obj(LSA_Q_QUERY_SEC_OBJ *q_q, const POLICY_HND *hnd, Reads or writes an LSA_Q_QUERY_SEC_OBJ structure. ********************************************************************/ -BOOL lsa_io_q_query_sec_obj(char *desc, LSA_Q_QUERY_SEC_OBJ *q_q, +BOOL lsa_io_q_query_sec_obj(const char *desc, LSA_Q_QUERY_SEC_OBJ *q_q, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_query_sec_obj"); @@ -433,7 +433,7 @@ BOOL lsa_io_q_query_sec_obj(char *desc, LSA_Q_QUERY_SEC_OBJ *q_q, Reads or writes a LSA_R_QUERY_SEC_OBJ structure. ********************************************************************/ -BOOL lsa_io_r_query_sec_obj(char *desc, LSA_R_QUERY_SEC_OBJ *r_u, +BOOL lsa_io_r_query_sec_obj(const char *desc, LSA_R_QUERY_SEC_OBJ *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_query_sec_obj"); @@ -473,7 +473,7 @@ void init_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class) Reads or writes an LSA_Q_QUERY_INFO structure. ********************************************************************/ -BOOL lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, +BOOL lsa_io_q_query(const char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_query"); @@ -507,7 +507,7 @@ BOOL init_q_enum_trust_dom(LSA_Q_ENUM_TRUST_DOM * q_e, POLICY_HND *pol, Reads or writes an LSA_Q_ENUM_TRUST_DOM structure. ********************************************************************/ -BOOL lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, +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"); @@ -580,7 +580,7 @@ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 en Reads or writes an LSA_R_ENUM_TRUST_DOM structure. ********************************************************************/ -BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, +BOOL lsa_io_r_enum_trust_dom(const char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_enum_trust_dom"); @@ -639,7 +639,7 @@ BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, reads or writes a dom query structure. ********************************************************************/ -static BOOL lsa_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth) +static BOOL lsa_io_dom_query(const char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth) { if (d_q == NULL) return False; @@ -680,7 +680,7 @@ static BOOL lsa_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int dep reads or writes a structure. ********************************************************************/ -static BOOL lsa_io_dom_query_2(char *desc, DOM_QUERY_2 *d_q, prs_struct *ps, int depth) +static BOOL lsa_io_dom_query_2(const char *desc, DOM_QUERY_2 *d_q, prs_struct *ps, int depth) { uint32 ptr = 1; @@ -721,7 +721,7 @@ static BOOL lsa_io_dom_query_2(char *desc, DOM_QUERY_2 *d_q, prs_struct *ps, int Reads or writes a dom query structure. ********************************************************************/ -static BOOL lsa_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) +static BOOL lsa_io_dom_query_3(const char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) { return lsa_io_dom_query("", d_q, ps, depth); } @@ -730,7 +730,7 @@ static BOOL lsa_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int Reads or writes a dom query structure. ********************************************************************/ -static BOOL lsa_io_dom_query_5(char *desc, DOM_QUERY_5 *d_q, prs_struct *ps, int depth) +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("", d_q, ps, depth); } @@ -739,7 +739,7 @@ static BOOL lsa_io_dom_query_5(char *desc, DOM_QUERY_5 *d_q, prs_struct *ps, int Reads or writes a dom query structure. ********************************************************************/ -static BOOL lsa_io_dom_query_6(char *desc, DOM_QUERY_6 *d_q, prs_struct *ps, int depth) +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; @@ -757,7 +757,7 @@ static BOOL lsa_io_dom_query_6(char *desc, DOM_QUERY_6 *d_q, prs_struct *ps, int Reads or writes an LSA_R_QUERY_INFO structure. ********************************************************************/ -BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, +BOOL lsa_io_r_query(const char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_query"); @@ -848,7 +848,7 @@ static void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, Reads or writes a LSA_SID_ENUM structure. ********************************************************************/ -static BOOL lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen, prs_struct *ps, +static BOOL lsa_io_sid_enum(const char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) { int i; @@ -936,7 +936,7 @@ void init_q_lookup_sids(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_SIDS *q_l, Reads or writes a LSA_Q_LOOKUP_SIDS structure. ********************************************************************/ -BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, +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"); @@ -964,7 +964,7 @@ BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, Reads or writes a structure. ********************************************************************/ -static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, +static BOOL lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth) { int i; @@ -1025,7 +1025,7 @@ static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, Reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, +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"); @@ -1099,7 +1099,7 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, reads or writes a structure. ********************************************************************/ -BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, +BOOL lsa_io_q_lookup_names(const char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth) { int i; @@ -1163,7 +1163,7 @@ BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, +BOOL lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth) { int i; @@ -1233,7 +1233,7 @@ void init_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd) Reads or writes an LSA_Q_CLOSE structure. ********************************************************************/ -BOOL lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth) +BOOL lsa_io_q_close(const char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_close"); depth++; @@ -1248,7 +1248,7 @@ BOOL lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth) Reads or writes an LSA_R_CLOSE structure. ********************************************************************/ -BOOL lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_close(const char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_close"); depth++; @@ -1266,7 +1266,7 @@ BOOL lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth) Reads or writes an LSA_Q_OPEN_SECRET structure. ********************************************************************/ -BOOL lsa_io_q_open_secret(char *desc, LSA_Q_OPEN_SECRET *q_c, prs_struct *ps, int depth) +BOOL lsa_io_q_open_secret(const char *desc, LSA_Q_OPEN_SECRET *q_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_open_secret"); depth++; @@ -1279,7 +1279,7 @@ BOOL lsa_io_q_open_secret(char *desc, LSA_Q_OPEN_SECRET *q_c, prs_struct *ps, in Reads or writes an LSA_R_OPEN_SECRET structure. ********************************************************************/ -BOOL lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_open_secret(const char *desc, LSA_R_OPEN_SECRET *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_open_secret"); depth++; @@ -1318,7 +1318,7 @@ void init_q_enum_privs(LSA_Q_ENUM_PRIVS *q_q, POLICY_HND *hnd, uint32 enum_conte /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_q_enum_privs(char *desc, LSA_Q_ENUM_PRIVS *q_q, prs_struct *ps, int depth) +BOOL lsa_io_q_enum_privs(const char *desc, LSA_Q_ENUM_PRIVS *q_q, prs_struct *ps, int depth) { if (q_q == NULL) return False; @@ -1340,7 +1340,7 @@ BOOL lsa_io_q_enum_privs(char *desc, LSA_Q_ENUM_PRIVS *q_q, prs_struct *ps, int /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL lsa_io_priv_entries(char *desc, LSA_PRIV_ENTRY *entries, uint32 count, prs_struct *ps, int depth) +static BOOL lsa_io_priv_entries(const char *desc, LSA_PRIV_ENTRY *entries, uint32 count, prs_struct *ps, int depth) { uint32 i; @@ -1395,7 +1395,7 @@ void init_lsa_r_enum_privs(LSA_R_ENUM_PRIVS *r_u, uint32 enum_context, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_enum_privs(char *desc, LSA_R_ENUM_PRIVS *r_q, prs_struct *ps, int depth) +BOOL lsa_io_r_enum_privs(const char *desc, LSA_R_ENUM_PRIVS *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1434,7 +1434,7 @@ BOOL lsa_io_r_enum_privs(char *desc, LSA_R_ENUM_PRIVS *r_q, prs_struct *ps, int return True; } -void init_lsa_priv_get_dispname(LSA_Q_PRIV_GET_DISPNAME *trn, POLICY_HND *hnd, char *name, uint16 lang_id, uint16 lang_id_sys) +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) { int len_name = strlen(name); @@ -1452,7 +1452,7 @@ void init_lsa_priv_get_dispname(LSA_Q_PRIV_GET_DISPNAME *trn, POLICY_HND *hnd, c /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_q_priv_get_dispname(char *desc, LSA_Q_PRIV_GET_DISPNAME *q_q, prs_struct *ps, int depth) +BOOL lsa_io_q_priv_get_dispname(const char *desc, LSA_Q_PRIV_GET_DISPNAME *q_q, prs_struct *ps, int depth) { if (q_q == NULL) return False; @@ -1483,7 +1483,7 @@ BOOL lsa_io_q_priv_get_dispname(char *desc, LSA_Q_PRIV_GET_DISPNAME *q_q, prs_st /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_priv_get_dispname(char *desc, LSA_R_PRIV_GET_DISPNAME *r_q, prs_struct *ps, int depth) +BOOL lsa_io_r_priv_get_dispname(const char *desc, LSA_R_PRIV_GET_DISPNAME *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1530,7 +1530,7 @@ void init_lsa_q_enum_accounts(LSA_Q_ENUM_ACCOUNTS *trn, POLICY_HND *hnd, uint32 /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_q_enum_accounts(char *desc, LSA_Q_ENUM_ACCOUNTS *q_q, prs_struct *ps, int depth) +BOOL lsa_io_q_enum_accounts(const char *desc, LSA_Q_ENUM_ACCOUNTS *q_q, prs_struct *ps, int depth) { if (q_q == NULL) return False; @@ -1572,7 +1572,7 @@ void init_lsa_r_enum_accounts(LSA_R_ENUM_ACCOUNTS *r_u, uint32 enum_context) /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_enum_accounts(char *desc, LSA_R_ENUM_ACCOUNTS *r_q, prs_struct *ps, int depth) +BOOL lsa_io_r_enum_accounts(const char *desc, LSA_R_ENUM_ACCOUNTS *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1603,7 +1603,7 @@ BOOL lsa_io_r_enum_accounts(char *desc, LSA_R_ENUM_ACCOUNTS *r_q, prs_struct *ps Reads or writes an LSA_Q_UNK_GET_CONNUSER structure. ********************************************************************/ -BOOL lsa_io_q_unk_get_connuser(char *desc, LSA_Q_UNK_GET_CONNUSER *q_c, prs_struct *ps, int depth) +BOOL lsa_io_q_unk_get_connuser(const char *desc, LSA_Q_UNK_GET_CONNUSER *q_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_unk_get_connuser"); depth++; @@ -1635,7 +1635,7 @@ BOOL lsa_io_q_unk_get_connuser(char *desc, LSA_Q_UNK_GET_CONNUSER *q_c, prs_stru Reads or writes an LSA_R_UNK_GET_CONNUSER structure. ********************************************************************/ -BOOL lsa_io_r_unk_get_connuser(char *desc, LSA_R_UNK_GET_CONNUSER *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_unk_get_connuser(const char *desc, LSA_R_UNK_GET_CONNUSER *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_unk_get_connuser"); depth++; @@ -1684,7 +1684,7 @@ void init_lsa_q_open_account(LSA_Q_OPENACCOUNT *trn, POLICY_HND *hnd, DOM_SID *s Reads or writes an LSA_Q_OPENACCOUNT structure. ********************************************************************/ -BOOL lsa_io_q_open_account(char *desc, LSA_Q_OPENACCOUNT *r_c, prs_struct *ps, int depth) +BOOL lsa_io_q_open_account(const char *desc, LSA_Q_OPENACCOUNT *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_open_account"); depth++; @@ -1708,7 +1708,7 @@ BOOL lsa_io_q_open_account(char *desc, LSA_Q_OPENACCOUNT *r_c, prs_struct *ps, i Reads or writes an LSA_R_OPENACCOUNT structure. ********************************************************************/ -BOOL lsa_io_r_open_account(char *desc, LSA_R_OPENACCOUNT *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_open_account(const char *desc, LSA_R_OPENACCOUNT *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_open_account"); depth++; @@ -1736,7 +1736,7 @@ void init_lsa_q_enum_privsaccount(LSA_Q_ENUMPRIVSACCOUNT *trn, POLICY_HND *hnd) Reads or writes an LSA_Q_ENUMPRIVSACCOUNT structure. ********************************************************************/ -BOOL lsa_io_q_enum_privsaccount(char *desc, LSA_Q_ENUMPRIVSACCOUNT *r_c, prs_struct *ps, int depth) +BOOL lsa_io_q_enum_privsaccount(const char *desc, LSA_Q_ENUMPRIVSACCOUNT *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_enum_privsaccount"); depth++; @@ -1754,7 +1754,7 @@ BOOL lsa_io_q_enum_privsaccount(char *desc, LSA_Q_ENUMPRIVSACCOUNT *r_c, prs_str Reads or writes an LUID structure. ********************************************************************/ -static BOOL lsa_io_luid(char *desc, LUID *r_c, prs_struct *ps, int depth) +static BOOL lsa_io_luid(const char *desc, LUID *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_luid"); depth++; @@ -1775,7 +1775,7 @@ static BOOL lsa_io_luid(char *desc, LUID *r_c, prs_struct *ps, int depth) Reads or writes an LUID_ATTR structure. ********************************************************************/ -static BOOL lsa_io_luid_attr(char *desc, LUID_ATTR *r_c, prs_struct *ps, int depth) +static BOOL lsa_io_luid_attr(const char *desc, LUID_ATTR *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_luid_attr"); depth++; @@ -1796,7 +1796,7 @@ static BOOL lsa_io_luid_attr(char *desc, LUID_ATTR *r_c, prs_struct *ps, int dep Reads or writes an PRIVILEGE_SET structure. ********************************************************************/ -static BOOL lsa_io_privilege_set(char *desc, PRIVILEGE_SET *r_c, prs_struct *ps, int depth) +static BOOL lsa_io_privilege_set(const char *desc, PRIVILEGE_SET *r_c, prs_struct *ps, int depth) { uint32 i; @@ -1833,7 +1833,7 @@ void init_lsa_r_enum_privsaccount(LSA_R_ENUMPRIVSACCOUNT *r_u, LUID_ATTR *set, u Reads or writes an LSA_R_ENUMPRIVSACCOUNT structure. ********************************************************************/ -BOOL lsa_io_r_enum_privsaccount(char *desc, LSA_R_ENUMPRIVSACCOUNT *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_enum_privsaccount(const char *desc, LSA_R_ENUMPRIVSACCOUNT *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_enum_privsaccount"); depth++; @@ -1872,7 +1872,7 @@ BOOL lsa_io_r_enum_privsaccount(char *desc, LSA_R_ENUMPRIVSACCOUNT *r_c, prs_str Reads or writes an LSA_Q_GETSYSTEMACCOUNTstructure. ********************************************************************/ -BOOL lsa_io_q_getsystemaccount(char *desc, LSA_Q_GETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) +BOOL lsa_io_q_getsystemaccount(const char *desc, LSA_Q_GETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_getsystemaccount"); depth++; @@ -1890,7 +1890,7 @@ BOOL lsa_io_q_getsystemaccount(char *desc, LSA_Q_GETSYSTEMACCOUNT *r_c, prs_str Reads or writes an LSA_R_GETSYSTEMACCOUNTstructure. ********************************************************************/ -BOOL lsa_io_r_getsystemaccount(char *desc, LSA_R_GETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_getsystemaccount(const char *desc, LSA_R_GETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_getsystemaccount"); depth++; @@ -1912,7 +1912,7 @@ BOOL lsa_io_r_getsystemaccount(char *desc, LSA_R_GETSYSTEMACCOUNT *r_c, prs_str Reads or writes an LSA_Q_SETSYSTEMACCOUNT structure. ********************************************************************/ -BOOL lsa_io_q_setsystemaccount(char *desc, LSA_Q_SETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) +BOOL lsa_io_q_setsystemaccount(const char *desc, LSA_Q_SETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_setsystemaccount"); depth++; @@ -1933,7 +1933,7 @@ BOOL lsa_io_q_setsystemaccount(char *desc, LSA_Q_SETSYSTEMACCOUNT *r_c, prs_str Reads or writes an LSA_R_SETSYSTEMACCOUNT structure. ********************************************************************/ -BOOL lsa_io_r_setsystemaccount(char *desc, LSA_R_SETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_setsystemaccount(const char *desc, LSA_R_SETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_setsystemaccount"); depth++; @@ -1948,7 +1948,7 @@ BOOL lsa_io_r_setsystemaccount(char *desc, LSA_R_SETSYSTEMACCOUNT *r_c, prs_str } -void init_lsa_q_lookupprivvalue(LSA_Q_LOOKUPPRIVVALUE *trn, POLICY_HND *hnd, char *name) +void init_lsa_q_lookupprivvalue(LSA_Q_LOOKUPPRIVVALUE *trn, POLICY_HND *hnd, const char *name) { int len_name = strlen(name); memcpy(&trn->pol, hnd, sizeof(trn->pol)); @@ -1964,7 +1964,7 @@ void init_lsa_q_lookupprivvalue(LSA_Q_LOOKUPPRIVVALUE *trn, POLICY_HND *hnd, cha Reads or writes an LSA_Q_LOOKUPPRIVVALUE structure. ********************************************************************/ -BOOL lsa_io_q_lookupprivvalue(char *desc, LSA_Q_LOOKUPPRIVVALUE *r_c, prs_struct *ps, int depth) +BOOL lsa_io_q_lookupprivvalue(const char *desc, LSA_Q_LOOKUPPRIVVALUE *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_lookupprivvalue"); depth++; @@ -1986,7 +1986,7 @@ BOOL lsa_io_q_lookupprivvalue(char *desc, LSA_Q_LOOKUPPRIVVALUE *r_c, prs_struc Reads or writes an LSA_R_LOOKUPPRIVVALUE structure. ********************************************************************/ -BOOL lsa_io_r_lookupprivvalue(char *desc, LSA_R_LOOKUPPRIVVALUE *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_lookupprivvalue(const char *desc, LSA_R_LOOKUPPRIVVALUE *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_lookupprivvalue"); depth++; @@ -2008,7 +2008,7 @@ BOOL lsa_io_r_lookupprivvalue(char *desc, LSA_R_LOOKUPPRIVVALUE *r_c, prs_struc Reads or writes an LSA_Q_ADDPRIVS structure. ********************************************************************/ -BOOL lsa_io_q_addprivs(char *desc, LSA_Q_ADDPRIVS *r_c, prs_struct *ps, int depth) +BOOL lsa_io_q_addprivs(const char *desc, LSA_Q_ADDPRIVS *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_addprivs"); depth++; @@ -2037,7 +2037,7 @@ BOOL lsa_io_q_addprivs(char *desc, LSA_Q_ADDPRIVS *r_c, prs_struct *ps, int dept Reads or writes an LSA_R_ADDPRIVS structure. ********************************************************************/ -BOOL lsa_io_r_addprivs(char *desc, LSA_R_ADDPRIVS *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_addprivs(const char *desc, LSA_R_ADDPRIVS *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_addprivs"); depth++; @@ -2055,7 +2055,7 @@ BOOL lsa_io_r_addprivs(char *desc, LSA_R_ADDPRIVS *r_c, prs_struct *ps, int dept Reads or writes an LSA_Q_REMOVEPRIVS structure. ********************************************************************/ -BOOL lsa_io_q_removeprivs(char *desc, LSA_Q_REMOVEPRIVS *r_c, prs_struct *ps, int depth) +BOOL lsa_io_q_removeprivs(const char *desc, LSA_Q_REMOVEPRIVS *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_removeprivs"); depth++; @@ -2097,7 +2097,7 @@ BOOL lsa_io_q_removeprivs(char *desc, LSA_Q_REMOVEPRIVS *r_c, prs_struct *ps, in Reads or writes an LSA_R_REMOVEPRIVS structure. ********************************************************************/ -BOOL lsa_io_r_removeprivs(char *desc, LSA_R_REMOVEPRIVS *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_removeprivs(const char *desc, LSA_R_REMOVEPRIVS *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_removeprivs"); depth++; @@ -2123,7 +2123,7 @@ BOOL policy_handle_is_valid(const POLICY_HND *hnd) Reads or writes an LSA_DNS_DOM_INFO structure. ********************************************************************/ -BOOL lsa_io_dns_dom_info(char *desc, LSA_DNS_DOM_INFO *info, +BOOL lsa_io_dns_dom_info(const char *desc, LSA_DNS_DOM_INFO *info, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_dns_dom_info"); @@ -2182,7 +2182,7 @@ void init_q_query2(LSA_Q_QUERY_INFO2 *q_q, POLICY_HND *hnd, uint16 info_class) Reads or writes an LSA_Q_QUERY_DNSDOMINFO structure. ********************************************************************/ -BOOL lsa_io_q_query_info2(char *desc, LSA_Q_QUERY_INFO2 *q_c, +BOOL lsa_io_q_query_info2(const char *desc, LSA_Q_QUERY_INFO2 *q_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_query_info2"); @@ -2204,7 +2204,7 @@ BOOL lsa_io_q_query_info2(char *desc, LSA_Q_QUERY_INFO2 *q_c, Reads or writes an LSA_R_QUERY_DNSDOMINFO structure. ********************************************************************/ -BOOL lsa_io_r_query_info2(char *desc, LSA_R_QUERY_INFO2 *r_c, +BOOL lsa_io_r_query_info2(const char *desc, LSA_R_QUERY_INFO2 *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_query_info2"); diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 86dd85066d..a9157e29b6 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -91,7 +91,7 @@ TALLOC_CTX *get_talloc_ctx(void) Reads or writes a UTIME type. ********************************************************************/ -static BOOL smb_io_utime(char *desc, UTIME *t, prs_struct *ps, int depth) +static BOOL smb_io_utime(const char *desc, UTIME *t, prs_struct *ps, int depth) { if (t == NULL) return False; @@ -112,7 +112,7 @@ static BOOL smb_io_utime(char *desc, UTIME *t, prs_struct *ps, int depth) Reads or writes an NTTIME structure. ********************************************************************/ -BOOL smb_io_time(char *desc, NTTIME *nttime, prs_struct *ps, int depth) +BOOL smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth) { if (nttime == NULL) return False; @@ -135,7 +135,7 @@ BOOL smb_io_time(char *desc, NTTIME *nttime, prs_struct *ps, int depth) Reads or writes a LOOKUP_LEVEL structure. ********************************************************************/ -BOOL smb_io_lookup_level(char *desc, LOOKUP_LEVEL *level, prs_struct *ps, int depth) +BOOL smb_io_lookup_level(const char *desc, LOOKUP_LEVEL *level, prs_struct *ps, int depth) { if (level == NULL) return False; @@ -178,7 +178,7 @@ void init_enum_hnd(ENUM_HND *enh, uint32 hnd) Reads or writes an ENUM_HND structure. ********************************************************************/ -BOOL smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) +BOOL smb_io_enum_hnd(const char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) { if (hnd == NULL) return False; @@ -204,7 +204,7 @@ BOOL smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) Reads or writes a DOM_SID structure. ********************************************************************/ -BOOL smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth) +BOOL smb_io_dom_sid(const char *desc, DOM_SID *sid, prs_struct *ps, int depth) { int i; @@ -301,7 +301,7 @@ void init_dom_sid2(DOM_SID2 *sid2, const DOM_SID *sid) Reads or writes a DOM_SID2 structure. ********************************************************************/ -BOOL smb_io_dom_sid2(char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) +BOOL smb_io_dom_sid2(const char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) { if (sid == NULL) return False; @@ -336,7 +336,7 @@ void init_str_hdr(STRHDR *hdr, int max_len, int len, uint32 buffer) Reads or writes a STRHDR structure. ********************************************************************/ -BOOL smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth) +BOOL smb_io_strhdr(const char *desc, STRHDR *hdr, prs_struct *ps, int depth) { if (hdr == NULL) return False; @@ -371,7 +371,7 @@ void init_uni_hdr(UNIHDR *hdr, int len) Reads or writes a UNIHDR structure. ********************************************************************/ -BOOL smb_io_unihdr(char *desc, UNIHDR *hdr, prs_struct *ps, int depth) +BOOL smb_io_unihdr(const char *desc, UNIHDR *hdr, prs_struct *ps, int depth) { if (hdr == NULL) return False; @@ -407,7 +407,7 @@ void init_buf_hdr(BUFHDR *hdr, int max_len, int len) uint16 should be stored, or gets the size if reading. ********************************************************************/ -BOOL smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset) +BOOL smb_io_hdrbuf_pre(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset) { (*offset) = prs_offset(ps); if (ps->io) { @@ -433,7 +433,7 @@ BOOL smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint3 Does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ -BOOL smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, +BOOL smb_io_hdrbuf_post(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 ptr_hdrbuf, uint32 max_len, uint32 len) { if (!ps->io) { @@ -458,7 +458,7 @@ BOOL smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, Reads or writes a BUFHDR structure. ********************************************************************/ -BOOL smb_io_hdrbuf(char *desc, BUFHDR *hdr, prs_struct *ps, int depth) +BOOL smb_io_hdrbuf(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth) { if (hdr == NULL) return False; @@ -491,7 +491,7 @@ void init_uni_hdr2(UNIHDR2 *hdr, int len) Reads or writes a UNIHDR2 structure. ********************************************************************/ -BOOL smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) +BOOL smb_io_unihdr2(const char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) { if (hdr2 == NULL) return False; @@ -542,7 +542,7 @@ reads or writes a UNISTR structure. XXXX NOTE: UNISTR structures NEED to be null-terminated. ********************************************************************/ -BOOL smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth) +BOOL smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth) { if (uni == NULL) return False; @@ -639,7 +639,7 @@ void init_buffer3_bytes(BUFFER3 *str, uint8 *buf, int len) the uni_str_len member tells you how much of the buffer is really used. ********************************************************************/ -BOOL smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) +BOOL smb_io_buffer3(const char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) { if (buf3 == NULL) return False; @@ -672,7 +672,7 @@ BOOL smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) reads or writes a BUFFER5 structure. the buf_len member tells you how large the buffer is. ********************************************************************/ -BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) +BOOL smb_io_buffer5(const char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_buffer5"); depth++; @@ -721,7 +721,7 @@ void init_buffer2(BUFFER2 *str, const uint8 *buf, int len) the uni_str_len member tells you how much of the buffer is really used. ********************************************************************/ -BOOL smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_buffer2(const char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth) { if (buf2 == NULL) return False; @@ -844,7 +844,7 @@ void init_string2(STRING2 *str, const char *buf, int max_len, int str_len) the str_max_len member tells you how large the buffer is. ********************************************************************/ -BOOL smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_string2(const char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth) { if (str2 == NULL) return False; @@ -1006,7 +1006,7 @@ void init_unistr2_from_unistr (UNISTR2 *to, const UNISTR *from) the uni_max_len member tells you how large the buffer is. ********************************************************************/ -BOOL smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth) { if (uni2 == NULL) return False; @@ -1057,7 +1057,7 @@ void init_dom_rid2(DOM_RID2 *rid2, uint32 rid, uint8 type, uint32 idx) Reads or writes a DOM_RID2 structure. ********************************************************************/ -BOOL smb_io_dom_rid2(char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth) +BOOL smb_io_dom_rid2(const char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth) { if (rid2 == NULL) return False; @@ -1097,7 +1097,7 @@ void init_dom_rid3(DOM_RID3 *rid3, uint32 rid, uint8 type) reads or writes a DOM_RID3 structure. ********************************************************************/ -BOOL smb_io_dom_rid3(char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) +BOOL smb_io_dom_rid3(const char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) { if (rid3 == NULL) return False; @@ -1160,7 +1160,7 @@ static void init_clnt_srv(DOM_CLNT_SRV *log, const char *logon_srv, const char * Inits or writes a DOM_CLNT_SRV structure. ********************************************************************/ -static BOOL smb_io_clnt_srv(char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth) +static BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth) { if (log == NULL) return False; @@ -1216,7 +1216,7 @@ void init_log_info(DOM_LOG_INFO *log, const char *logon_srv, const char *acct_na Reads or writes a DOM_LOG_INFO structure. ********************************************************************/ -BOOL smb_io_log_info(char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth) +BOOL smb_io_log_info(const char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth) { if (log == NULL) return False; @@ -1248,7 +1248,7 @@ BOOL smb_io_log_info(char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth) Reads or writes a DOM_CHAL structure. ********************************************************************/ -BOOL smb_io_chal(char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) +BOOL smb_io_chal(const char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) { if (chal == NULL) return False; @@ -1266,7 +1266,7 @@ BOOL smb_io_chal(char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) Reads or writes a DOM_CRED structure. ********************************************************************/ -BOOL smb_io_cred(char *desc, DOM_CRED *cred, prs_struct *ps, int depth) +BOOL smb_io_cred(const char *desc, DOM_CRED *cred, prs_struct *ps, int depth) { if (cred == NULL) return False; @@ -1310,7 +1310,7 @@ void init_clnt_info2(DOM_CLNT_INFO2 *clnt, Reads or writes a DOM_CLNT_INFO2 structure. ********************************************************************/ -BOOL smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth) +BOOL smb_io_clnt_info2(const char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth) { if (clnt == NULL) return False; @@ -1354,7 +1354,7 @@ void init_clnt_info(DOM_CLNT_INFO *clnt, Reads or writes a DOM_CLNT_INFO structure. ********************************************************************/ -BOOL smb_io_clnt_info(char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int depth) +BOOL smb_io_clnt_info(const char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int depth) { if (clnt == NULL) return False; @@ -1389,7 +1389,7 @@ void init_logon_id(DOM_LOGON_ID *log, uint32 log_id_low, uint32 log_id_high) Reads or writes a DOM_LOGON_ID structure. ********************************************************************/ -BOOL smb_io_logon_id(char *desc, DOM_LOGON_ID *log, prs_struct *ps, int depth) +BOOL smb_io_logon_id(const char *desc, DOM_LOGON_ID *log, prs_struct *ps, int depth) { if (log == NULL) return False; @@ -1426,7 +1426,7 @@ void init_owf_info(OWF_INFO *hash, const uint8 data[16]) Reads or writes an OWF_INFO structure. ********************************************************************/ -BOOL smb_io_owf_info(char *desc, OWF_INFO *hash, prs_struct *ps, int depth) +BOOL smb_io_owf_info(const char *desc, OWF_INFO *hash, prs_struct *ps, int depth) { if (hash == NULL) return False; @@ -1447,7 +1447,7 @@ BOOL smb_io_owf_info(char *desc, OWF_INFO *hash, prs_struct *ps, int depth) Reads or writes a DOM_GID structure. ********************************************************************/ -BOOL smb_io_gid(char *desc, DOM_GID *gid, prs_struct *ps, int depth) +BOOL smb_io_gid(const char *desc, DOM_GID *gid, prs_struct *ps, int depth) { if (gid == NULL) return False; @@ -1470,7 +1470,7 @@ BOOL smb_io_gid(char *desc, DOM_GID *gid, prs_struct *ps, int depth) Reads or writes an POLICY_HND structure. ********************************************************************/ -BOOL smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth) +BOOL smb_io_pol_hnd(const char *desc, POLICY_HND *pol, prs_struct *ps, int depth) { if (pol == NULL) return False; @@ -1532,7 +1532,7 @@ void init_unistr3(UNISTR3 *str, const char *buf) Reads or writes a UNISTR3 structure. ********************************************************************/ -BOOL smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth) +BOOL smb_io_unistr3(const char *desc, UNISTR3 *name, prs_struct *ps, int depth) { if (name == NULL) return False; @@ -1559,7 +1559,7 @@ BOOL smb_io_unistr3(char *desc, UNISTR3 *name, prs_struct *ps, int depth) /******************************************************************* Stream a uint64_struct ********************************************************************/ -BOOL prs_uint64(char *name, prs_struct *ps, int depth, UINT64_S *data64) +BOOL prs_uint64(const char *name, prs_struct *ps, int depth, UINT64_S *data64) { return prs_uint32(name, ps, depth+1, &data64->low) && prs_uint32(name, ps, depth+1, &data64->high); @@ -1568,7 +1568,7 @@ BOOL prs_uint64(char *name, prs_struct *ps, int depth, UINT64_S *data64) /******************************************************************* reads or writes a BUFHDR2 structure. ********************************************************************/ -BOOL smb_io_bufhdr2(char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) +BOOL smb_io_bufhdr2(const char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_bufhdr2"); depth++; @@ -1584,7 +1584,7 @@ BOOL smb_io_bufhdr2(char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) /******************************************************************* reads or writes a BUFFER4 structure. ********************************************************************/ -BOOL smb_io_buffer4(char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_buffer4(const char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_buffer4"); depth++; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index c140a1fe01..ac21e6f2dd 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -30,7 +30,7 @@ Reads or writes a structure. ********************************************************************/ -static BOOL net_io_neg_flags(char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth) +static BOOL net_io_neg_flags(const char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth) { if (neg == NULL) return False; @@ -66,7 +66,7 @@ static void init_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_att Reads or writes a NETLOGON_INFO_3 structure. ********************************************************************/ -static BOOL net_io_netinfo_3(char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int depth) +static BOOL net_io_netinfo_3(const char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int depth) { if (info == NULL) return False; @@ -110,7 +110,7 @@ static void init_netinfo_1(NETLOGON_INFO_1 *info, uint32 flags, uint32 pdc_statu Reads or writes a NETLOGON_INFO_1 structure. ********************************************************************/ -static BOOL net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth) +static BOOL net_io_netinfo_1(const char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth) { if (info == NULL) return False; @@ -152,7 +152,7 @@ static void init_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_statu Reads or writes a NETLOGON_INFO_2 structure. ********************************************************************/ -static BOOL net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth) +static BOOL net_io_netinfo_2(const char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth) { if (info == NULL) return False; @@ -187,7 +187,7 @@ static BOOL net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, Reads or writes an NET_Q_LOGON_CTRL2 structure. ********************************************************************/ -BOOL net_io_q_logon_ctrl2(char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, int depth) +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; @@ -278,7 +278,7 @@ void init_net_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level, Reads or writes an NET_R_LOGON_CTRL2 structure. ********************************************************************/ -BOOL net_io_r_logon_ctrl2(char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, int depth) +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; @@ -322,7 +322,7 @@ BOOL net_io_r_logon_ctrl2(char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, in Reads or writes an NET_Q_LOGON_CTRL structure. ********************************************************************/ -BOOL net_io_q_logon_ctrl(char *desc, NET_Q_LOGON_CTRL *q_l, prs_struct *ps, +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"); @@ -395,7 +395,7 @@ void init_net_r_logon_ctrl(NET_R_LOGON_CTRL *r_l, uint32 query_level, Reads or writes an NET_R_LOGON_CTRL structure. ********************************************************************/ -BOOL net_io_r_logon_ctrl(char *desc, NET_R_LOGON_CTRL *r_l, prs_struct *ps, +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"); @@ -459,7 +459,7 @@ void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, Reads or writes an NET_R_TRUST_DOM_LIST structure. ********************************************************************/ -BOOL net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth) +BOOL net_io_r_trust_dom(const char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth) { uint32 value; @@ -511,7 +511,7 @@ BOOL net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, i Reads or writes an NET_Q_TRUST_DOM_LIST structure. ********************************************************************/ -BOOL net_io_q_trust_dom(char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, int depth) +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; @@ -551,7 +551,7 @@ void init_q_req_chal(NET_Q_REQ_CHAL *q_c, Reads or writes an NET_Q_REQ_CHAL structure. ********************************************************************/ -BOOL net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int depth) +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; @@ -580,7 +580,7 @@ BOOL net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int dep Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int depth) +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; @@ -605,7 +605,7 @@ BOOL net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int dept Reads or writes a structure. ********************************************************************/ -BOOL net_io_q_auth(char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth) +BOOL net_io_q_auth(const char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth) { if (q_a == NULL) return False; @@ -628,7 +628,7 @@ BOOL net_io_q_auth(char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth) Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_auth(char *desc, NET_R_AUTH *r_a, prs_struct *ps, int depth) +BOOL net_io_r_auth(const char *desc, NET_R_AUTH *r_a, prs_struct *ps, int depth) { if (r_a == NULL) return False; @@ -669,7 +669,7 @@ void init_q_auth_2(NET_Q_AUTH_2 *q_a, Reads or writes a structure. ********************************************************************/ -BOOL net_io_q_auth_2(char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth) +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; @@ -694,7 +694,7 @@ BOOL net_io_q_auth_2(char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth) Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth) +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; @@ -737,7 +737,7 @@ void init_q_auth_3(NET_Q_AUTH_3 *q_a, Reads or writes a structure. ********************************************************************/ -BOOL net_io_q_auth_3(char *desc, NET_Q_AUTH_3 *q_a, prs_struct *ps, int depth) +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; @@ -762,7 +762,7 @@ BOOL net_io_q_auth_3(char *desc, NET_Q_AUTH_3 *q_a, prs_struct *ps, int depth) Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_auth_3(char *desc, NET_R_AUTH_3 *r_a, prs_struct *ps, int depth) +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; @@ -812,7 +812,7 @@ void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s, Reads or writes a structure. ********************************************************************/ -BOOL net_io_q_srv_pwset(char *desc, NET_Q_SRV_PWSET *q_s, prs_struct *ps, int depth) +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; @@ -835,7 +835,7 @@ BOOL net_io_q_srv_pwset(char *desc, NET_Q_SRV_PWSET *q_s, prs_struct *ps, int de Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int depth) +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; @@ -967,7 +967,7 @@ void init_id_info1(NET_ID_INFO_1 *id, const char *domain_name, Reads or writes an NET_ID_INFO_1 structure. ********************************************************************/ -static BOOL net_io_id_info1(char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth) +static BOOL net_io_id_info1(const char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth) { if (id == NULL) return False; @@ -1083,7 +1083,7 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, Reads or writes an NET_ID_INFO_2 structure. ********************************************************************/ -static BOOL net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int depth) +static BOOL net_io_id_info2(const char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int depth) { if (id == NULL) return False; @@ -1169,7 +1169,7 @@ void init_sam_info(DOM_SAM_INFO *sam, Reads or writes a DOM_SAM_INFO structure. ********************************************************************/ -static BOOL net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR **pp_ctr, prs_struct *ps, int depth) +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; @@ -1212,7 +1212,7 @@ static BOOL net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR **pp_ctr, prs_struct Reads or writes a DOM_SAM_INFO structure. ********************************************************************/ -static BOOL smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int depth) +static BOOL smb_io_sam_info(const char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int depth) { if (sam == NULL) return False; @@ -1544,7 +1544,7 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, Reads or writes a structure. ********************************************************************/ -BOOL net_io_q_sam_logon(char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, int depth) +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; @@ -1568,7 +1568,7 @@ BOOL net_io_q_sam_logon(char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, int de Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_sam_logon(char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, int depth) +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; @@ -1612,7 +1612,7 @@ BOOL net_io_r_sam_logon(char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, int de Reads or writes a structure. ********************************************************************/ -BOOL net_io_q_sam_logoff(char *desc, NET_Q_SAM_LOGOFF *q_l, prs_struct *ps, int depth) +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; @@ -1633,7 +1633,7 @@ BOOL net_io_q_sam_logoff(char *desc, NET_Q_SAM_LOGOFF *q_l, prs_struct *ps, int Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int depth) +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; @@ -1687,7 +1687,7 @@ BOOL init_net_q_sam_sync(NET_Q_SAM_SYNC * q_s, const char *srv_name, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL net_io_q_sam_sync(char *desc, NET_Q_SAM_SYNC * q_s, prs_struct *ps, +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"); @@ -1719,7 +1719,7 @@ BOOL net_io_q_sam_sync(char *desc, NET_Q_SAM_SYNC * q_s, prs_struct *ps, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_delta_hdr(char *desc, SAM_DELTA_HDR * delta, +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"); @@ -1749,7 +1749,7 @@ static BOOL net_io_sam_delta_hdr(char *desc, SAM_DELTA_HDR * delta, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_delta_mod_count(char *desc, SAM_DELTA_MOD_COUNT *info, +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"); @@ -1773,7 +1773,7 @@ static BOOL net_io_sam_delta_mod_count(char *desc, SAM_DELTA_MOD_COUNT *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_domain_info(char *desc, SAM_DOMAIN_INFO * info, +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"); @@ -1828,7 +1828,7 @@ static BOOL net_io_sam_domain_info(char *desc, SAM_DOMAIN_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_group_info(char *desc, SAM_GROUP_INFO * info, +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"); @@ -1863,7 +1863,7 @@ static BOOL net_io_sam_group_info(char *desc, SAM_GROUP_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_passwd_info(char *desc, SAM_PWD * pwd, +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"); @@ -1973,7 +1973,7 @@ BOOL make_sam_account_info(SAM_ACCOUNT_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_account_info(char *desc, uint8 sess_key[16], +static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], SAM_ACCOUNT_INFO * info, prs_struct *ps, int depth) { @@ -2164,7 +2164,7 @@ static BOOL net_io_sam_account_info(char *desc, uint8 sess_key[16], /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO * info, +static BOOL net_io_sam_group_mem_info(const char *desc, SAM_GROUP_MEM_INFO * info, prs_struct *ps, int depth) { uint32 i; @@ -2248,7 +2248,7 @@ static BOOL net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_alias_info(char *desc, SAM_ALIAS_INFO * info, +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"); @@ -2283,7 +2283,7 @@ static BOOL net_io_sam_alias_info(char *desc, SAM_ALIAS_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO * info, +static BOOL net_io_sam_alias_mem_info(const char *desc, SAM_ALIAS_MEM_INFO * info, prs_struct *ps, int depth) { uint32 i; @@ -2356,7 +2356,7 @@ static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_policy_info(char *desc, SAM_DELTA_POLICY *info, +static BOOL net_io_sam_policy_info(const char *desc, SAM_DELTA_POLICY *info, prs_struct *ps, int depth) { int i; @@ -2442,7 +2442,7 @@ static BOOL net_io_sam_policy_info(char *desc, SAM_DELTA_POLICY *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_trustdoms_info(char *desc, SAM_DELTA_TRUSTDOMS *info, +static BOOL net_io_sam_trustdoms_info(const char *desc, SAM_DELTA_TRUSTDOMS *info, prs_struct *ps, int depth) { int i; @@ -2490,7 +2490,7 @@ static BOOL net_io_sam_trustdoms_info(char *desc, SAM_DELTA_TRUSTDOMS *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_secret_info(char *desc, SAM_DELTA_SECRET *info, +static BOOL net_io_sam_secret_info(const char *desc, SAM_DELTA_SECRET *info, prs_struct *ps, int depth) { int i; @@ -2577,7 +2577,7 @@ static BOOL net_io_sam_secret_info(char *desc, SAM_DELTA_SECRET *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_privs_info(char *desc, SAM_DELTA_PRIVS *info, +static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info, prs_struct *ps, int depth) { int i; @@ -2664,7 +2664,7 @@ static BOOL net_io_sam_privs_info(char *desc, SAM_DELTA_PRIVS *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], +static BOOL net_io_sam_delta_ctr(const char *desc, uint8 sess_key[16], SAM_DELTA_CTR * delta, uint16 type, prs_struct *ps, int depth) { @@ -2746,7 +2746,7 @@ static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16], /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16], +BOOL net_io_r_sam_sync(const char *desc, uint8 sess_key[16], NET_R_SAM_SYNC * r_s, prs_struct *ps, int depth) { uint32 i; @@ -2859,7 +2859,7 @@ BOOL init_net_q_sam_deltas(NET_Q_SAM_DELTAS *q_s, const char *srv_name, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL net_io_q_sam_deltas(char *desc, NET_Q_SAM_DELTAS *q_s, prs_struct *ps, +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"); @@ -2888,7 +2888,7 @@ BOOL net_io_q_sam_deltas(char *desc, NET_Q_SAM_DELTAS *q_s, prs_struct *ps, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL net_io_r_sam_deltas(char *desc, uint8 sess_key[16], +BOOL net_io_r_sam_deltas(const char *desc, uint8 sess_key[16], NET_R_SAM_DELTAS *r_s, prs_struct *ps, int depth) { int i; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index d4a9ec3eda..63f9527dec 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -76,7 +76,7 @@ void prs_dump_region(char *name, int v, prs_struct *ps, XXXX side-effect of this function is to increase the debug depth XXXX ********************************************************************/ -void prs_debug(prs_struct *ps, int depth, const char *desc, char *fn_name) +void prs_debug(prs_struct *ps, int depth, const char *desc, const char *fn_name) { DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(depth), ps->data_offset, fn_name, desc)); } @@ -539,7 +539,7 @@ void prs_force_dynamic(prs_struct *ps) Stream a uint8. ********************************************************************/ -BOOL prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8) +BOOL prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8) { char *q = prs_mem_get(ps, 1); if (q == NULL) @@ -561,7 +561,7 @@ BOOL prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8) Stream a uint16. ********************************************************************/ -BOOL prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16) +BOOL prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16) { char *q = prs_mem_get(ps, sizeof(uint16)); if (q == NULL) @@ -590,7 +590,7 @@ BOOL prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16) Stream a uint32. ********************************************************************/ -BOOL prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) +BOOL prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32) { char *q = prs_mem_get(ps, sizeof(uint32)); if (q == NULL) @@ -619,7 +619,7 @@ BOOL prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32) Stream a NTSTATUS ********************************************************************/ -BOOL prs_ntstatus(char *name, prs_struct *ps, int depth, NTSTATUS *status) +BOOL prs_ntstatus(const char *name, prs_struct *ps, int depth, NTSTATUS *status) { char *q = prs_mem_get(ps, sizeof(uint32)); if (q == NULL) @@ -649,7 +649,7 @@ BOOL prs_ntstatus(char *name, prs_struct *ps, int depth, NTSTATUS *status) Stream a WERROR ********************************************************************/ -BOOL prs_werror(char *name, prs_struct *ps, int depth, WERROR *status) +BOOL prs_werror(const char *name, prs_struct *ps, int depth, WERROR *status) { char *q = prs_mem_get(ps, sizeof(uint32)); if (q == NULL) @@ -680,7 +680,7 @@ BOOL prs_werror(char *name, prs_struct *ps, int depth, WERROR *status) Stream an array of uint8s. Length is number of uint8s. ********************************************************************/ -BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *data8s, int len) +BOOL prs_uint8s(BOOL charmode, const char *name, prs_struct *ps, int depth, uint8 *data8s, int len) { int i; char *q = prs_mem_get(ps, len); @@ -713,7 +713,7 @@ BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *dat Stream an array of uint16s. Length is number of uint16s. ********************************************************************/ -BOOL prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len) +BOOL prs_uint16s(BOOL charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len) { int i; char *q = prs_mem_get(ps, len * sizeof(uint16)); @@ -757,7 +757,7 @@ BOOL prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *d output must be little-endian, if marshalling, input must be little-endian. ********************************************************************/ -static void dbg_rw_punival(BOOL charmode, char *name, int depth, prs_struct *ps, +static void dbg_rw_punival(BOOL charmode, const char *name, int depth, prs_struct *ps, char *in_buf, char *out_buf, int len) { int i; @@ -794,7 +794,7 @@ static void dbg_rw_punival(BOOL charmode, char *name, int depth, prs_struct *ps, Stream a unistr. Always little endian. ********************************************************************/ -BOOL prs_uint16uni(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len) +BOOL prs_uint16uni(BOOL charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len) { char *q = prs_mem_get(ps, len * sizeof(uint16)); if (q == NULL) @@ -810,7 +810,7 @@ BOOL prs_uint16uni(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 Stream an array of uint32s. Length is number of uint32s. ********************************************************************/ -BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *data32s, int len) +BOOL prs_uint32s(BOOL charmode, const char *name, prs_struct *ps, int depth, uint32 *data32s, int len) { int i; char *q = prs_mem_get(ps, len * sizeof(uint32)); @@ -854,7 +854,7 @@ BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *d in uint16 chars. The unicode string is already in little-endian format. ********************************************************************/ -BOOL prs_buffer5(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER5 *str) +BOOL prs_buffer5(BOOL charmode, const char *name, prs_struct *ps, int depth, BUFFER5 *str) { char *p; char *q = prs_mem_get(ps, str->buf_len * sizeof(uint16)); @@ -885,7 +885,7 @@ BOOL prs_buffer5(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER5 * in byte chars. String is in little-endian format. ********************************************************************/ -BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 *str) +BOOL prs_buffer2(BOOL charmode, const char *name, prs_struct *ps, int depth, BUFFER2 *str) { char *p; char *q = prs_mem_get(ps, str->buf_len); @@ -913,7 +913,7 @@ BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 * in uint8 chars. ********************************************************************/ -BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 *str) +BOOL prs_string2(BOOL charmode, const char *name, prs_struct *ps, int depth, STRING2 *str) { int i; char *q = prs_mem_get(ps, str->str_max_len); @@ -953,7 +953,7 @@ BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 * in uint16 chars. The unicode string is already in little-endian format. ********************************************************************/ -BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *str) +BOOL prs_unistr2(BOOL charmode, const char *name, prs_struct *ps, int depth, UNISTR2 *str) { char *p; char *q = prs_mem_get(ps, str->uni_str_len * sizeof(uint16)); @@ -984,7 +984,7 @@ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 * in uint16 chars. The unicode string is already in little-endian format. ********************************************************************/ -BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int depth) +BOOL prs_unistr3(BOOL charmode, const char *name, UNISTR3 *str, prs_struct *ps, int depth) { char *p; char *q = prs_mem_get(ps, str->uni_str_len * sizeof(uint16)); @@ -1010,7 +1010,7 @@ BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int de in little-endian format then do it as a stream of bytes. ********************************************************************/ -BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) +BOOL prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) { int len = 0; unsigned char *p = (unsigned char *)str->buffer; @@ -1136,7 +1136,7 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str) not include the null-termination character. ********************************************************************/ -BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, int len, int max_buf_size) +BOOL prs_string(const char *name, prs_struct *ps, int depth, char *str, int len, int max_buf_size) { char *q; int i; @@ -1173,7 +1173,7 @@ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, int len, int m uint16 should be stored, or gets the size if reading. ********************************************************************/ -BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset) +BOOL prs_uint16_pre(const char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset) { *offset = ps->data_offset; if (UNMARSHALLING(ps)) { @@ -1193,7 +1193,7 @@ BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint3 does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ -BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, +BOOL prs_uint16_post(const char *name, prs_struct *ps, int depth, uint16 *data16, uint32 ptr_uint16, uint32 start_offset) { if (MARSHALLING(ps)) { @@ -1220,7 +1220,7 @@ BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 should be stored, or gets the size if reading. ********************************************************************/ -BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset) +BOOL prs_uint32_pre(const char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset) { *offset = ps->data_offset; if (UNMARSHALLING(ps) && (data32 != NULL)) { @@ -1237,7 +1237,7 @@ BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint3 does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ -BOOL prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32, +BOOL prs_uint32_post(const char *name, prs_struct *ps, int depth, uint32 *data32, uint32 ptr_uint32, uint32 data_size) { if (MARSHALLING(ps)) { diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 2698e82440..712d38da2b 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -62,7 +62,7 @@ void init_reg_q_open_hkcr(REG_Q_OPEN_HKCR *q_o, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_open_hkcr(char *desc, REG_Q_OPEN_HKCR *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_open_hkcr(const char *desc, REG_Q_OPEN_HKCR *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -93,7 +93,7 @@ BOOL reg_io_q_open_hkcr(char *desc, REG_Q_OPEN_HKCR *r_q, prs_struct *ps, int d reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_open_hkcr(char *desc, REG_R_OPEN_HKCR *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_open_hkcr(const char *desc, REG_R_OPEN_HKCR *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -130,7 +130,7 @@ void init_reg_q_open_hklm(REG_Q_OPEN_HKLM * q_o, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_open_hklm(char *desc, REG_Q_OPEN_HKLM * r_q, prs_struct *ps, +BOOL reg_io_q_open_hklm(const char *desc, REG_Q_OPEN_HKLM * r_q, prs_struct *ps, int depth) { if (r_q == NULL) @@ -161,7 +161,7 @@ BOOL reg_io_q_open_hklm(char *desc, REG_Q_OPEN_HKLM * r_q, prs_struct *ps, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_open_hklm(char *desc, REG_R_OPEN_HKLM * r_r, prs_struct *ps, +BOOL reg_io_r_open_hklm(const char *desc, REG_R_OPEN_HKLM * r_r, prs_struct *ps, int depth) { if (r_r == NULL) @@ -198,7 +198,7 @@ void init_reg_q_flush_key(REG_Q_FLUSH_KEY *q_u, POLICY_HND *pol) reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_flush_key(char *desc, REG_Q_FLUSH_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_flush_key(const char *desc, REG_Q_FLUSH_KEY *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -219,7 +219,7 @@ BOOL reg_io_q_flush_key(char *desc, REG_Q_FLUSH_KEY *r_q, prs_struct *ps, int d reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_flush_key(char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_flush_key(const char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -311,7 +311,7 @@ void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_create_key(char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_create_key(const char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -367,7 +367,7 @@ BOOL reg_io_q_create_key(char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_create_key(char *desc, REG_R_CREATE_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_create_key(const char *desc, REG_R_CREATE_KEY *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -410,7 +410,7 @@ void init_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_delete_val(char *desc, REG_Q_DELETE_VALUE *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_delete_val(const char *desc, REG_Q_DELETE_VALUE *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -439,7 +439,7 @@ BOOL reg_io_q_delete_val(char *desc, REG_Q_DELETE_VALUE *r_q, prs_struct *ps, i reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_delete_val(char *desc, REG_R_DELETE_VALUE *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_delete_val(const char *desc, REG_R_DELETE_VALUE *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -476,7 +476,7 @@ void init_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_delete_key(char *desc, REG_Q_DELETE_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_delete_key(const char *desc, REG_Q_DELETE_KEY *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -504,7 +504,7 @@ BOOL reg_io_q_delete_key(char *desc, REG_Q_DELETE_KEY *r_q, prs_struct *ps, int reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_delete_key(char *desc, REG_R_DELETE_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_delete_key(const char *desc, REG_R_DELETE_KEY *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -539,7 +539,7 @@ void init_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_query_key(char *desc, REG_Q_QUERY_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_query_key(const char *desc, REG_Q_QUERY_KEY *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -568,7 +568,7 @@ BOOL reg_io_q_query_key(char *desc, REG_Q_QUERY_KEY *r_q, prs_struct *ps, int d reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_query_key(const char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -624,7 +624,7 @@ void init_reg_q_unknown_1a(REG_Q_UNKNOWN_1A *q_o, POLICY_HND *hnd) reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_unknown_1a(char *desc, REG_Q_UNKNOWN_1A *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_unknown_1a(const char *desc, REG_Q_UNKNOWN_1A *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -645,7 +645,7 @@ BOOL reg_io_q_unknown_1a(char *desc, REG_Q_UNKNOWN_1A *r_q, prs_struct *ps, int reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_unknown_1a(char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_unknown_1a(const char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -669,7 +669,7 @@ BOOL reg_io_r_unknown_1a(char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *ps, int reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_save_key(char *desc, REG_Q_SAVE_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_save_key(const char *desc, REG_Q_SAVE_KEY *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -698,7 +698,7 @@ BOOL reg_io_q_save_key(char *desc, REG_Q_SAVE_KEY *r_q, prs_struct *ps, int dep reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_save_key(char *desc, REG_R_SAVE_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_save_key(const char *desc, REG_R_SAVE_KEY *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -732,7 +732,7 @@ void init_reg_q_open_hku(REG_Q_OPEN_HKU *q_o, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_open_hku(char *desc, REG_Q_OPEN_HKU *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_open_hku(const char *desc, REG_Q_OPEN_HKU *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -761,7 +761,7 @@ BOOL reg_io_q_open_hku(char *desc, REG_Q_OPEN_HKU *r_q, prs_struct *ps, int dep reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_open_hku(char *desc, REG_R_OPEN_HKU *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_open_hku(const char *desc, REG_R_OPEN_HKU *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -796,7 +796,7 @@ void init_reg_q_close(REG_Q_CLOSE *q_c, POLICY_HND *hnd) reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_close(char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth) +BOOL reg_io_q_close(const char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -819,7 +819,7 @@ BOOL reg_io_q_close(char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth) reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) +BOOL reg_io_r_close(const char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -860,7 +860,7 @@ void init_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, SEC_DESC_BU reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_set_key_sec(const char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -889,7 +889,7 @@ BOOL reg_io_q_set_key_sec(char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, i reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_set_key_sec(const char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -930,7 +930,7 @@ void init_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_get_key_sec(char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_get_key_sec(const char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -975,7 +975,7 @@ makes a structure. reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_get_key_sec(char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_get_key_sec(const char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1041,7 +1041,7 @@ BOOL init_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char* val_name) reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_info(const char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1174,7 +1174,7 @@ BOOL init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r, reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_info(const char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -1298,7 +1298,7 @@ void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_enum_val(char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int depth) +BOOL reg_io_q_enum_val(const char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int depth) { if (q_q == NULL) return False; @@ -1357,7 +1357,7 @@ BOOL reg_io_q_enum_val(char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int d reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_enum_val(char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1435,7 +1435,7 @@ void init_reg_q_create_val(REG_Q_CREATE_VALUE *q_i, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_create_val(char *desc, REG_Q_CREATE_VALUE *q_q, prs_struct *ps, int depth) +BOOL reg_io_q_create_val(const char *desc, REG_Q_CREATE_VALUE *q_q, prs_struct *ps, int depth) { if (q_q == NULL) return False; @@ -1470,7 +1470,7 @@ BOOL reg_io_q_create_val(char *desc, REG_Q_CREATE_VALUE *q_q, prs_struct *ps, i reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_create_val(char *desc, REG_R_CREATE_VALUE *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_create_val(const char *desc, REG_R_CREATE_VALUE *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1537,7 +1537,7 @@ void init_reg_r_enum_key(REG_R_ENUM_KEY *r_u, char *subkey, uint32 unknown_1, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_enum_key(char *desc, REG_Q_ENUM_KEY *q_q, prs_struct *ps, int depth) +BOOL reg_io_q_enum_key(const char *desc, REG_Q_ENUM_KEY *q_q, prs_struct *ps, int depth) { if (q_q == NULL) return False; @@ -1591,7 +1591,7 @@ BOOL reg_io_q_enum_key(char *desc, REG_Q_ENUM_KEY *q_q, prs_struct *ps, int dep reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_enum_key(char *desc, REG_R_ENUM_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_enum_key(const char *desc, REG_R_ENUM_KEY *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1665,7 +1665,7 @@ void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_open_entry(const char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int depth) { if (r_q == NULL) return False; @@ -1713,7 +1713,7 @@ void init_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r, reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_open_entry(char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int depth) { if (r_r == NULL) return False; @@ -1757,7 +1757,7 @@ void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_shutdown(char *desc, REG_Q_SHUTDOWN * q_s, prs_struct *ps, +BOOL reg_io_q_shutdown(const char *desc, REG_Q_SHUTDOWN * q_s, prs_struct *ps, int depth) { if (q_s == NULL) @@ -1794,7 +1794,7 @@ BOOL reg_io_q_shutdown(char *desc, REG_Q_SHUTDOWN * q_s, prs_struct *ps, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_shutdown(char *desc, REG_R_SHUTDOWN * r_s, prs_struct *ps, +BOOL reg_io_r_shutdown(const char *desc, REG_R_SHUTDOWN * r_s, prs_struct *ps, int depth) { if (r_s == NULL) @@ -1825,7 +1825,7 @@ void init_reg_q_abort_shutdown(REG_Q_ABORT_SHUTDOWN * q_s) /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_abort_shutdown(char *desc, REG_Q_ABORT_SHUTDOWN * q_s, +BOOL reg_io_q_abort_shutdown(const char *desc, REG_Q_ABORT_SHUTDOWN * q_s, prs_struct *ps, int depth) { if (q_s == NULL) @@ -1849,7 +1849,7 @@ BOOL reg_io_q_abort_shutdown(char *desc, REG_Q_ABORT_SHUTDOWN * q_s, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_abort_shutdown(char *desc, REG_R_ABORT_SHUTDOWN * r_s, +BOOL reg_io_r_abort_shutdown(const char *desc, REG_R_ABORT_SHUTDOWN * r_s, prs_struct *ps, int depth) { if (r_s == NULL) diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index e8825a2e14..fafbbb1965 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -143,7 +143,7 @@ interface/version dce/rpc pipe identification * update the index #defines in smb.h. */ -struct pipe_id_info pipe_names [] = +const struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, @@ -182,7 +182,7 @@ void init_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, Reads or writes an RPC_HDR structure. ********************************************************************/ -BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -236,7 +236,7 @@ BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) Reads or writes an RPC_IFACE structure. ********************************************************************/ -static BOOL smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) +static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) { if (ifc == NULL) return False; @@ -266,7 +266,7 @@ static BOOL smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int dep Inits an RPC_ADDR_STR structure. ********************************************************************/ -static void init_rpc_addr_str(RPC_ADDR_STR *str, char *name) +static void init_rpc_addr_str(RPC_ADDR_STR *str, const char *name) { str->len = strlen(name) + 1; fstrcpy(str->str, name); @@ -276,7 +276,7 @@ static void init_rpc_addr_str(RPC_ADDR_STR *str, char *name) Reads or writes an RPC_ADDR_STR structure. ********************************************************************/ -static BOOL smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) +static BOOL smb_io_rpc_addr_str(const char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) { if (str == NULL) return False; @@ -308,7 +308,7 @@ static void init_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsiz Reads or writes an RPC_HDR_BBA structure. ********************************************************************/ -static BOOL smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) +static BOOL smb_io_rpc_hdr_bba(const char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -351,7 +351,7 @@ void init_rpc_hdr_rb(RPC_HDR_RB *rpc, Reads or writes an RPC_HDR_RB structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -397,7 +397,7 @@ static void init_rpc_results(RPC_RESULTS *res, lkclXXXX only one reason at the moment! ********************************************************************/ -static BOOL smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) +static BOOL smb_io_rpc_results(const char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) { if (res == NULL) return False; @@ -430,7 +430,7 @@ static BOOL smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int void init_rpc_hdr_ba(RPC_HDR_BA *rpc, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, - char *pipe_addr, + const char *pipe_addr, uint8 num_results, uint16 result, uint16 reason, RPC_IFACE *transfer) { @@ -446,7 +446,7 @@ void init_rpc_hdr_ba(RPC_HDR_BA *rpc, Reads or writes an RPC_HDR_BA structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_ba(const char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -480,7 +480,7 @@ void init_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum) Reads or writes an RPC_HDR_REQ structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_req(const char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -501,7 +501,7 @@ BOOL smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) Reads or writes an RPC_HDR_RESP structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_resp(const char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -524,7 +524,7 @@ BOOL smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int dept Reads or writes an RPC_HDR_FAULT structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_fault(char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -564,7 +564,7 @@ void init_rpc_hdr_autha(RPC_HDR_AUTHA *rai, Reads or writes an RPC_HDR_AUTHA structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_autha(const char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) { if (rai == NULL) return False; @@ -622,7 +622,7 @@ void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, Reads or writes an RPC_HDR_AUTH structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) { if (rai == NULL) return False; @@ -653,7 +653,7 @@ BOOL smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int dept ********************************************************************/ BOOL rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav, - char *signature, uint32 msg_type) + const char *signature, uint32 msg_type) { return (strequal(rav->signature, signature) && rav->msg_type == msg_type); } @@ -663,7 +663,7 @@ BOOL rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav, ********************************************************************/ void init_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, - char *signature, uint32 msg_type) + const char *signature, uint32 msg_type) { fstrcpy(rav->signature, signature); /* "NTLMSSP" */ rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */ @@ -673,7 +673,7 @@ void init_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, Reads or writes an RPC_AUTH_VERIFIER structure. ********************************************************************/ -BOOL smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) { if (rav == NULL) return False; @@ -717,7 +717,7 @@ void init_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, *** lkclXXXX HACK ALERT! *** ********************************************************************/ -BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_neg(const char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) { uint32 start_offset = prs_offset(ps); if (neg == NULL) @@ -804,7 +804,7 @@ void init_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, Reads or writes an RPC_AUTH_NTLMSSP_CHAL structure. ********************************************************************/ -BOOL smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_chal(const char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth) { if (chl == NULL) return False; @@ -908,7 +908,7 @@ void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, *** lkclXXXX the actual offset is at the start of the auth verifier *** ********************************************************************/ -BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_resp(const char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) { if (rsp == NULL) return False; @@ -1082,7 +1082,7 @@ void init_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, Reads or writes an RPC_AUTH_NTLMSSP_CHK structure. ********************************************************************/ -BOOL smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_chk(const char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth) { if (chk == NULL) return False; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 61b13d1350..918cdbcd1d 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -47,7 +47,7 @@ void init_samr_q_close_hnd(SAMR_Q_CLOSE_HND * q_c, POLICY_HND *hnd) reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_close_hnd(char *desc, SAMR_Q_CLOSE_HND * q_u, +BOOL samr_io_q_close_hnd(const char *desc, SAMR_Q_CLOSE_HND * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -66,7 +66,7 @@ BOOL samr_io_q_close_hnd(char *desc, SAMR_Q_CLOSE_HND * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND * r_u, +BOOL samr_io_r_close_hnd(const char *desc, SAMR_R_CLOSE_HND * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -107,7 +107,7 @@ void init_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN * q_u, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_lookup_domain(char *desc, SAMR_Q_LOOKUP_DOMAIN * q_u, +BOOL samr_io_q_lookup_domain(const char *desc, SAMR_Q_LOOKUP_DOMAIN * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -152,7 +152,7 @@ void init_samr_r_lookup_domain(SAMR_R_LOOKUP_DOMAIN * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_lookup_domain(char *desc, SAMR_R_LOOKUP_DOMAIN * r_u, +BOOL samr_io_r_lookup_domain(const char *desc, SAMR_R_LOOKUP_DOMAIN * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -196,7 +196,7 @@ void init_samr_q_unknown_2d(SAMR_Q_UNKNOWN_2D * q_u, POLICY_HND *dom_pol, DOM_SI reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_unknown_2d(char *desc, SAMR_Q_UNKNOWN_2D * q_u, +BOOL samr_io_q_unknown_2d(const char *desc, SAMR_Q_UNKNOWN_2D * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -224,7 +224,7 @@ BOOL samr_io_q_unknown_2d(char *desc, SAMR_Q_UNKNOWN_2D * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_unknown_2d(char *desc, SAMR_R_UNKNOWN_2D * r_u, +BOOL samr_io_r_unknown_2d(const char *desc, SAMR_R_UNKNOWN_2D * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -261,7 +261,7 @@ void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN * q_u, +BOOL samr_io_q_open_domain(const char *desc, SAMR_Q_OPEN_DOMAIN * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -289,7 +289,7 @@ BOOL samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN * r_u, +BOOL samr_io_r_open_domain(const char *desc, SAMR_R_OPEN_DOMAIN * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -326,7 +326,7 @@ void init_samr_q_get_usrdom_pwinfo(SAMR_Q_GET_USRDOM_PWINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_get_usrdom_pwinfo(char *desc, SAMR_Q_GET_USRDOM_PWINFO * q_u, +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) @@ -368,7 +368,7 @@ void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO *r_u, NTSTATUS statu reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_get_usrdom_pwinfo(char *desc, SAMR_R_GET_USRDOM_PWINFO * r_u, +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) @@ -397,7 +397,7 @@ BOOL samr_io_r_get_usrdom_pwinfo(char *desc, SAMR_R_GET_USRDOM_PWINFO * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_sec_obj(char *desc, SAMR_Q_SET_SEC_OBJ * q_u, +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) @@ -440,7 +440,7 @@ void init_samr_q_query_sec_obj(SAMR_Q_QUERY_SEC_OBJ * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_sec_obj(char *desc, SAMR_Q_QUERY_SEC_OBJ * q_u, +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) @@ -478,7 +478,7 @@ void init_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO * q_u, +BOOL samr_io_q_query_dom_info(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -514,7 +514,7 @@ void init_unk_info3(SAM_UNK_INFO_3 *u_3, NTTIME nt_logout) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info3(char *desc, SAM_UNK_INFO_3 * u_3, +static BOOL sam_io_unk_info3(const char *desc, SAM_UNK_INFO_3 * u_3, prs_struct *ps, int depth) { if (u_3 == NULL) @@ -544,7 +544,7 @@ void init_unk_info6(SAM_UNK_INFO_6 * u_6) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info6(char *desc, SAM_UNK_INFO_6 * u_6, +static BOOL sam_io_unk_info6(const char *desc, SAM_UNK_INFO_6 * u_6, prs_struct *ps, int depth) { if (u_6 == NULL) @@ -576,7 +576,7 @@ void init_unk_info7(SAM_UNK_INFO_7 * u_7) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info7(char *desc, SAM_UNK_INFO_7 * u_7, +static BOOL sam_io_unk_info7(const char *desc, SAM_UNK_INFO_7 * u_7, prs_struct *ps, int depth) { if (u_7 == NULL) @@ -609,7 +609,7 @@ void init_unk_info12(SAM_UNK_INFO_12 * u_12, NTTIME nt_lock_duration, NTTIME nt_ reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info12(char *desc, SAM_UNK_INFO_12 * u_12, +static BOOL sam_io_unk_info12(const char *desc, SAM_UNK_INFO_12 * u_12, prs_struct *ps, int depth) { if (u_12 == NULL) @@ -644,7 +644,7 @@ void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *server) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info5(char *desc, SAM_UNK_INFO_5 * u_5, +static BOOL sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5, prs_struct *ps, int depth) { if (u_5 == NULL) @@ -700,7 +700,7 @@ void init_unk_info2(SAM_UNK_INFO_2 * u_2, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 * u_2, +static BOOL sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2, prs_struct *ps, int depth) { if (u_2 == NULL) @@ -787,7 +787,7 @@ void init_unk_info1(SAM_UNK_INFO_1 *u_1, uint16 min_pass_len, uint16 pass_hist, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info1(char *desc, SAM_UNK_INFO_1 * u_1, +static BOOL sam_io_unk_info1(const char *desc, SAM_UNK_INFO_1 * u_1, prs_struct *ps, int depth) { if (u_1 == NULL) @@ -835,7 +835,7 @@ void init_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, +BOOL samr_io_r_query_dom_info(const char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -906,7 +906,7 @@ BOOL samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, reads or writes a SAMR_R_SET_SEC_OBJ structure. ********************************************************************/ -BOOL samr_io_r_set_sec_obj(char *desc, SAMR_R_SET_SEC_OBJ * r_u, +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) @@ -928,7 +928,7 @@ BOOL samr_io_r_set_sec_obj(char *desc, SAMR_R_SET_SEC_OBJ * r_u, reads or writes a SAMR_R_QUERY_SEC_OBJ structure. ********************************************************************/ -BOOL samr_io_r_query_sec_obj(char *desc, SAMR_R_QUERY_SEC_OBJ * r_u, +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) @@ -957,7 +957,7 @@ BOOL samr_io_r_query_sec_obj(char *desc, SAMR_R_QUERY_SEC_OBJ * r_u, reads or writes a SAM_STR1 structure. ********************************************************************/ -static BOOL sam_io_sam_str1(char *desc, SAM_STR1 * sam, uint32 acct_buf, +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) { @@ -1007,7 +1007,7 @@ static void init_sam_entry1(SAM_ENTRY1 * sam, uint32 user_idx, reads or writes a SAM_ENTRY1 structure. ********************************************************************/ -static BOOL sam_io_sam_entry1(char *desc, SAM_ENTRY1 * sam, +static BOOL sam_io_sam_entry1(const char *desc, SAM_ENTRY1 * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1044,7 +1044,7 @@ static BOOL sam_io_sam_entry1(char *desc, SAM_ENTRY1 * sam, reads or writes a SAM_STR2 structure. ********************************************************************/ -static BOOL sam_io_sam_str2(char *desc, SAM_STR2 * sam, uint32 acct_buf, +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) @@ -1085,7 +1085,7 @@ static void init_sam_entry2(SAM_ENTRY2 * sam, uint32 user_idx, reads or writes a SAM_ENTRY2 structure. ********************************************************************/ -static BOOL sam_io_sam_entry2(char *desc, SAM_ENTRY2 * sam, +static BOOL sam_io_sam_entry2(const char *desc, SAM_ENTRY2 * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1120,7 +1120,7 @@ static BOOL sam_io_sam_entry2(char *desc, SAM_ENTRY2 * sam, reads or writes a SAM_STR3 structure. ********************************************************************/ -static BOOL sam_io_sam_str3(char *desc, SAM_STR3 * sam, uint32 acct_buf, +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) @@ -1162,7 +1162,7 @@ static void init_sam_entry3(SAM_ENTRY3 * sam, uint32 grp_idx, reads or writes a SAM_ENTRY3 structure. ********************************************************************/ -static BOOL sam_io_sam_entry3(char *desc, SAM_ENTRY3 * sam, +static BOOL sam_io_sam_entry3(const char *desc, SAM_ENTRY3 * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1207,7 +1207,7 @@ static void init_sam_entry4(SAM_ENTRY4 * sam, uint32 user_idx, reads or writes a SAM_ENTRY4 structure. ********************************************************************/ -static BOOL sam_io_sam_entry4(char *desc, SAM_ENTRY4 * sam, +static BOOL sam_io_sam_entry4(const char *desc, SAM_ENTRY4 * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1245,7 +1245,7 @@ static void init_sam_entry5(SAM_ENTRY5 * sam, uint32 grp_idx, reads or writes a SAM_ENTRY5 structure. ********************************************************************/ -static BOOL sam_io_sam_entry5(char *desc, SAM_ENTRY5 * sam, +static BOOL sam_io_sam_entry5(const char *desc, SAM_ENTRY5 * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1281,7 +1281,7 @@ void init_sam_entry(SAM_ENTRY * sam, uint32 len_sam_name, uint32 rid) reads or writes a SAM_ENTRY structure. ********************************************************************/ -static BOOL sam_io_sam_entry(char *desc, SAM_ENTRY * sam, +static BOOL sam_io_sam_entry(const char *desc, SAM_ENTRY * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1322,7 +1322,7 @@ void init_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS * q_e, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_enum_dom_users(char *desc, SAMR_Q_ENUM_DOM_USERS * q_e, +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) @@ -1380,7 +1380,7 @@ void init_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS * r_u, +BOOL samr_io_r_enum_dom_users(const char *desc, SAMR_R_ENUM_DOM_USERS * r_u, prs_struct *ps, int depth) { uint32 i; @@ -1465,7 +1465,7 @@ void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO * q_e, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO * q_e, +BOOL samr_io_q_query_dispinfo(const char *desc, SAMR_Q_QUERY_DISPINFO * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -1585,7 +1585,7 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_en reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_1(char *desc, SAM_DISPINFO_1 * sam, +static BOOL sam_io_sam_dispinfo_1(const char *desc, SAM_DISPINFO_1 * sam, uint32 num_entries, prs_struct *ps, int depth) { @@ -1702,7 +1702,7 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_en reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_2(char *desc, SAM_DISPINFO_2 * sam, +static BOOL sam_io_sam_dispinfo_2(const char *desc, SAM_DISPINFO_2 * sam, uint32 num_entries, prs_struct *ps, int depth) { @@ -1796,7 +1796,7 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_en reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_3(char *desc, SAM_DISPINFO_3 * sam, +static BOOL sam_io_sam_dispinfo_3(const char *desc, SAM_DISPINFO_3 * sam, uint32 num_entries, prs_struct *ps, int depth) { @@ -1888,7 +1888,7 @@ NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 num_en reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 * sam, +static BOOL sam_io_sam_dispinfo_4(const char *desc, SAM_DISPINFO_4 * sam, uint32 num_entries, prs_struct *ps, int depth) { @@ -1978,7 +1978,7 @@ NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 num_en reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_5(char *desc, SAM_DISPINFO_5 * sam, +static BOOL sam_io_sam_dispinfo_5(const char *desc, SAM_DISPINFO_5 * sam, uint32 num_entries, prs_struct *ps, int depth) { @@ -2057,7 +2057,7 @@ void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO * r_u, +BOOL samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2155,7 +2155,7 @@ void init_samr_q_open_group(SAMR_Q_OPEN_GROUP * q_c, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_open_group(char *desc, SAMR_Q_OPEN_GROUP * q_u, +BOOL samr_io_q_open_group(const char *desc, SAMR_Q_OPEN_GROUP * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -2182,7 +2182,7 @@ BOOL samr_io_q_open_group(char *desc, SAMR_Q_OPEN_GROUP * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP * r_u, +BOOL samr_io_r_open_group(const char *desc, SAMR_R_OPEN_GROUP * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2231,7 +2231,7 @@ void init_samr_group_info1(GROUP_INFO1 * gr1, reads or writes a structure. ********************************************************************/ -BOOL samr_io_group_info1(char *desc, GROUP_INFO1 * gr1, +BOOL samr_io_group_info1(const char *desc, GROUP_INFO1 * gr1, prs_struct *ps, int depth) { if (gr1 == NULL) @@ -2280,7 +2280,7 @@ void init_samr_group_info3(GROUP_INFO3 *gr3) reads or writes a structure. ********************************************************************/ -BOOL samr_io_group_info3(char *desc, GROUP_INFO3 *gr3, prs_struct *ps, int depth) +BOOL samr_io_group_info3(const char *desc, GROUP_INFO3 *gr3, prs_struct *ps, int depth) { if (gr3 == NULL) return False; @@ -2315,7 +2315,7 @@ void init_samr_group_info4(GROUP_INFO4 * gr4, char *acct_desc) reads or writes a structure. ********************************************************************/ -BOOL samr_io_group_info4(char *desc, GROUP_INFO4 * gr4, +BOOL samr_io_group_info4(const char *desc, GROUP_INFO4 * gr4, prs_struct *ps, int depth) { if (gr4 == NULL) @@ -2340,7 +2340,7 @@ BOOL samr_io_group_info4(char *desc, GROUP_INFO4 * gr4, reads or writes a structure. ********************************************************************/ -static BOOL samr_group_info_ctr(char *desc, GROUP_INFO_CTR **ctr, +static BOOL samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr, prs_struct *ps, int depth) { if (UNMARSHALLING(ps)) @@ -2400,7 +2400,7 @@ void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_create_dom_group(char *desc, SAMR_Q_CREATE_DOM_GROUP * q_e, +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) @@ -2433,7 +2433,7 @@ BOOL samr_io_q_create_dom_group(char *desc, SAMR_Q_CREATE_DOM_GROUP * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_create_dom_group(char *desc, SAMR_R_CREATE_DOM_GROUP * r_u, +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) @@ -2472,7 +2472,7 @@ void init_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP * q_c, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_delete_dom_group(char *desc, SAMR_Q_DELETE_DOM_GROUP * q_u, +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) @@ -2494,7 +2494,7 @@ BOOL samr_io_q_delete_dom_group(char *desc, SAMR_Q_DELETE_DOM_GROUP * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_delete_dom_group(char *desc, SAMR_R_DELETE_DOM_GROUP * r_u, +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) @@ -2532,7 +2532,7 @@ void init_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_del_groupmem(char *desc, SAMR_Q_DEL_GROUPMEM * q_e, +BOOL samr_io_q_del_groupmem(const char *desc, SAMR_Q_DEL_GROUPMEM * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -2569,7 +2569,7 @@ void init_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM * r_u, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_del_groupmem(char *desc, SAMR_R_DEL_GROUPMEM * r_u, +BOOL samr_io_r_del_groupmem(const char *desc, SAMR_R_DEL_GROUPMEM * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2605,7 +2605,7 @@ void init_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_add_groupmem(char *desc, SAMR_Q_ADD_GROUPMEM * q_e, +BOOL samr_io_q_add_groupmem(const char *desc, SAMR_Q_ADD_GROUPMEM * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -2644,7 +2644,7 @@ void init_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM * r_u, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_add_groupmem(char *desc, SAMR_R_ADD_GROUPMEM * r_u, +BOOL samr_io_r_add_groupmem(const char *desc, SAMR_R_ADD_GROUPMEM * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2679,7 +2679,7 @@ void init_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_groupinfo(char *desc, SAMR_Q_SET_GROUPINFO * q_e, +BOOL samr_io_q_set_groupinfo(const char *desc, SAMR_Q_SET_GROUPINFO * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -2715,7 +2715,7 @@ void init_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO * r_u, NTSTATUS status) reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_groupinfo(char *desc, SAMR_R_SET_GROUPINFO * r_u, +BOOL samr_io_r_set_groupinfo(const char *desc, SAMR_R_SET_GROUPINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2751,7 +2751,7 @@ void init_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_groupinfo(char *desc, SAMR_Q_QUERY_GROUPINFO * q_e, +BOOL samr_io_q_query_groupinfo(const char *desc, SAMR_Q_QUERY_GROUPINFO * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -2790,7 +2790,7 @@ void init_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_groupinfo(char *desc, SAMR_R_QUERY_GROUPINFO * r_u, +BOOL samr_io_r_query_groupinfo(const char *desc, SAMR_R_QUERY_GROUPINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2833,7 +2833,7 @@ void init_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM * q_c, POLICY_HND *hnd) reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_groupmem(char *desc, SAMR_Q_QUERY_GROUPMEM * q_u, +BOOL samr_io_q_query_groupmem(const char *desc, SAMR_Q_QUERY_GROUPMEM * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -2885,7 +2885,7 @@ void init_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM * r_u, +BOOL samr_io_r_query_groupmem(const char *desc, SAMR_R_QUERY_GROUPMEM * r_u, prs_struct *ps, int depth) { uint32 i; @@ -2967,7 +2967,7 @@ void init_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS * q_u, +BOOL samr_io_q_query_usergroups(const char *desc, SAMR_Q_QUERY_USERGROUPS * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -3016,7 +3016,7 @@ void init_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_gids(char *desc, uint32 *num_gids, DOM_GID ** gid, +BOOL samr_io_gids(const char *desc, uint32 *num_gids, DOM_GID ** gid, prs_struct *ps, int depth) { uint32 i; @@ -3054,7 +3054,7 @@ BOOL samr_io_gids(char *desc, uint32 *num_gids, DOM_GID ** gid, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS * r_u, +BOOL samr_io_r_query_usergroups(const char *desc, SAMR_R_QUERY_USERGROUPS * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -3109,7 +3109,7 @@ void init_samr_q_enum_domains(SAMR_Q_ENUM_DOMAINS * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_enum_domains(char *desc, SAMR_Q_ENUM_DOMAINS * q_e, +BOOL samr_io_q_enum_domains(const char *desc, SAMR_Q_ENUM_DOMAINS * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -3161,7 +3161,7 @@ void init_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_enum_domains(char *desc, SAMR_R_ENUM_DOMAINS * r_u, +BOOL samr_io_r_enum_domains(const char *desc, SAMR_R_ENUM_DOMAINS * r_u, prs_struct *ps, int depth) { uint32 i; @@ -3248,7 +3248,7 @@ void init_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_enum_dom_groups(char *desc, SAMR_Q_ENUM_DOM_GROUPS * q_e, +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) @@ -3300,7 +3300,7 @@ void init_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS * r_u, +BOOL samr_io_r_enum_dom_groups(const char *desc, SAMR_R_ENUM_DOM_GROUPS * r_u, prs_struct *ps, int depth) { uint32 i; @@ -3383,7 +3383,7 @@ void init_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_enum_dom_aliases(char *desc, SAMR_Q_ENUM_DOM_ALIASES * q_e, +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) @@ -3434,7 +3434,7 @@ void init_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, uint32 next_idx, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u, +BOOL samr_io_r_enum_dom_aliases(const char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u, prs_struct *ps, int depth) { uint32 i; @@ -3521,7 +3521,7 @@ void init_samr_alias_info1(ALIAS_INFO1 * al1, char *acct_name, uint32 num_member reads or writes a structure. ********************************************************************/ -BOOL samr_io_alias_info1(char *desc, ALIAS_INFO1 * al1, +BOOL samr_io_alias_info1(const char *desc, ALIAS_INFO1 * al1, prs_struct *ps, int depth) { if (al1 == NULL) @@ -3572,7 +3572,7 @@ void init_samr_alias_info3(ALIAS_INFO3 * al3, char *acct_desc) reads or writes a structure. ********************************************************************/ -BOOL samr_io_alias_info3(char *desc, ALIAS_INFO3 * al3, +BOOL samr_io_alias_info3(const char *desc, ALIAS_INFO3 * al3, prs_struct *ps, int depth) { if (al3 == NULL) @@ -3597,7 +3597,7 @@ BOOL samr_io_alias_info3(char *desc, ALIAS_INFO3 * al3, reads or writes a structure. ********************************************************************/ -BOOL samr_alias_info_ctr(char *desc, ALIAS_INFO_CTR * ctr, +BOOL samr_alias_info_ctr(const char *desc, ALIAS_INFO_CTR * ctr, prs_struct *ps, int depth) { if (ctr == NULL) @@ -3645,7 +3645,7 @@ void init_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_aliasinfo(char *desc, SAMR_Q_QUERY_ALIASINFO * q_e, +BOOL samr_io_q_query_aliasinfo(const char *desc, SAMR_Q_QUERY_ALIASINFO * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -3684,7 +3684,7 @@ void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO * r_u, +BOOL samr_io_r_query_aliasinfo(const char *desc, SAMR_R_QUERY_ALIASINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -3729,7 +3729,7 @@ void init_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_aliasinfo(char *desc, SAMR_Q_SET_ALIASINFO * q_u, +BOOL samr_io_q_set_aliasinfo(const char *desc, SAMR_Q_SET_ALIASINFO * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -3753,7 +3753,7 @@ BOOL samr_io_q_set_aliasinfo(char *desc, SAMR_Q_SET_ALIASINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_aliasinfo(char *desc, SAMR_R_SET_ALIASINFO * r_u, +BOOL samr_io_r_set_aliasinfo(const char *desc, SAMR_R_SET_ALIASINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -3795,7 +3795,7 @@ void init_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES * q_u, reads or writes a SAMR_Q_QUERY_USERALIASES structure. ********************************************************************/ -BOOL samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES * q_u, +BOOL samr_io_q_query_useraliases(const char *desc, SAMR_Q_QUERY_USERALIASES * q_u, prs_struct *ps, int depth) { fstring tmp; @@ -3880,7 +3880,7 @@ void init_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_rids(char *desc, uint32 *num_rids, uint32 **rid, +BOOL samr_io_rids(const char *desc, uint32 *num_rids, uint32 **rid, prs_struct *ps, int depth) { fstring tmp; @@ -3919,7 +3919,7 @@ BOOL samr_io_rids(char *desc, uint32 *num_rids, uint32 **rid, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES * r_u, +BOOL samr_io_r_query_useraliases(const char *desc, SAMR_R_QUERY_USERALIASES * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -3967,7 +3967,7 @@ void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS * q_u, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS * q_u, +BOOL samr_io_q_open_alias(const char *desc, SAMR_Q_OPEN_ALIAS * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -3994,7 +3994,7 @@ BOOL samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS * r_u, +BOOL samr_io_r_open_alias(const char *desc, SAMR_R_OPEN_ALIAS * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -4044,7 +4044,7 @@ void init_samr_q_lookup_rids(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_RIDS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS * q_u, +BOOL samr_io_q_lookup_rids(const char *desc, SAMR_Q_LOOKUP_RIDS * q_u, prs_struct *ps, int depth) { uint32 i; @@ -4130,7 +4130,7 @@ void init_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS * r_u, +BOOL samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u, prs_struct *ps, int depth) { uint32 i; @@ -4224,7 +4224,7 @@ void init_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS * q_u, POLICY_HND *hnd) reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_delete_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u, +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) @@ -4246,7 +4246,7 @@ BOOL samr_io_q_delete_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_delete_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u, +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) @@ -4289,7 +4289,7 @@ void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_create_dom_alias(char *desc, SAMR_Q_CREATE_DOM_ALIAS * q_u, +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) @@ -4322,7 +4322,7 @@ BOOL samr_io_q_create_dom_alias(char *desc, SAMR_Q_CREATE_DOM_ALIAS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_create_dom_alias(char *desc, SAMR_R_CREATE_DOM_ALIAS * r_u, +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) @@ -4363,7 +4363,7 @@ void init_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM * q_u, POLICY_HND *hnd, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM * q_u, +BOOL samr_io_q_add_aliasmem(const char *desc, SAMR_Q_ADD_ALIASMEM * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -4387,7 +4387,7 @@ BOOL samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_add_aliasmem(char *desc, SAMR_R_ADD_ALIASMEM * r_u, +BOOL samr_io_r_add_aliasmem(const char *desc, SAMR_R_ADD_ALIASMEM * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -4422,7 +4422,7 @@ void init_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM * q_u, POLICY_HND *hnd, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_del_aliasmem(char *desc, SAMR_Q_DEL_ALIASMEM * q_u, +BOOL samr_io_q_del_aliasmem(const char *desc, SAMR_Q_DEL_ALIASMEM * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -4446,7 +4446,7 @@ BOOL samr_io_q_del_aliasmem(char *desc, SAMR_Q_DEL_ALIASMEM * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_del_aliasmem(char *desc, SAMR_R_DEL_ALIASMEM * r_u, +BOOL samr_io_r_del_aliasmem(const char *desc, SAMR_R_DEL_ALIASMEM * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -4480,7 +4480,7 @@ void init_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS * q_c, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_delete_dom_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u, +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) @@ -4514,7 +4514,7 @@ void init_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_delete_dom_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u, +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) @@ -4548,7 +4548,7 @@ void init_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM * q_c, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_aliasmem(char *desc, SAMR_Q_QUERY_ALIASMEM * q_u, +BOOL samr_io_q_query_aliasmem(const char *desc, SAMR_Q_QUERY_ALIASMEM * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -4594,7 +4594,7 @@ void init_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM * r_u, +BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, prs_struct *ps, int depth) { uint32 i; @@ -4682,7 +4682,7 @@ NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES * q_u, +BOOL samr_io_q_lookup_names(const char *desc, SAMR_Q_LOOKUP_NAMES * q_u, prs_struct *ps, int depth) { uint32 i; @@ -4791,7 +4791,7 @@ NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES * r_u, +BOOL samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u, prs_struct *ps, int depth) { uint32 i; @@ -4889,7 +4889,7 @@ void init_samr_q_delete_dom_user(SAMR_Q_DELETE_DOM_USER * q_c, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_delete_dom_user(char *desc, SAMR_Q_DELETE_DOM_USER * q_u, +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) @@ -4911,7 +4911,7 @@ BOOL samr_io_q_delete_dom_user(char *desc, SAMR_Q_DELETE_DOM_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_delete_dom_user(char *desc, SAMR_R_DELETE_DOM_USER * r_u, +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) @@ -4950,7 +4950,7 @@ void init_samr_q_open_user(SAMR_Q_OPEN_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER * q_u, +BOOL samr_io_q_open_user(const char *desc, SAMR_Q_OPEN_USER * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -4977,7 +4977,7 @@ BOOL samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER * r_u, +BOOL samr_io_r_open_user(const char *desc, SAMR_R_OPEN_USER * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -5026,7 +5026,7 @@ void init_samr_q_create_user(SAMR_Q_CREATE_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_create_user(char *desc, SAMR_Q_CREATE_USER * q_u, +BOOL samr_io_q_create_user(const char *desc, SAMR_Q_CREATE_USER * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -5060,7 +5060,7 @@ BOOL samr_io_q_create_user(char *desc, SAMR_Q_CREATE_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER * r_u, +BOOL samr_io_r_create_user(const char *desc, SAMR_R_CREATE_USER * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -5102,7 +5102,7 @@ void init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_userinfo(char *desc, SAMR_Q_QUERY_USERINFO * q_u, +BOOL samr_io_q_query_userinfo(const char *desc, SAMR_Q_QUERY_USERINFO * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -5127,7 +5127,7 @@ BOOL samr_io_q_query_userinfo(char *desc, SAMR_Q_QUERY_USERINFO * q_u, reads or writes a LOGON_HRS structure. ********************************************************************/ -static BOOL sam_io_logon_hrs(char *desc, LOGON_HRS * hrs, +static BOOL sam_io_logon_hrs(const char *desc, LOGON_HRS * hrs, prs_struct *ps, int depth) { if (hrs == NULL) @@ -5172,7 +5172,7 @@ void init_sam_user_info12(SAM_USER_INFO_12 * usr, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info12(char *desc, SAM_USER_INFO_12 * u, +static BOOL sam_io_user_info12(const char *desc, SAM_USER_INFO_12 * u, prs_struct *ps, int depth) { if (u == NULL) @@ -5212,7 +5212,7 @@ void init_sam_user_info10(SAM_USER_INFO_10 * usr, uint32 acb_info) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info10(char *desc, SAM_USER_INFO_10 * usr, +static BOOL sam_io_user_info10(const char *desc, SAM_USER_INFO_10 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -5280,7 +5280,7 @@ void init_sam_user_info11(SAM_USER_INFO_11 * usr, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info11(char *desc, SAM_USER_INFO_11 * usr, +static BOOL sam_io_user_info11(const char *desc, SAM_USER_INFO_11 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -5376,7 +5376,7 @@ void init_sam_user_info24(SAM_USER_INFO_24 * usr, char newpass[516], uint16 pw_l reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info24(char *desc, SAM_USER_INFO_24 * usr, +static BOOL sam_io_user_info24(const char *desc, SAM_USER_INFO_24 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -5525,7 +5525,7 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z char *user_name, /* NULL */ char *full_name, char *home_dir, char *dir_drive, char *log_scr, - char *prof_path, char *desc, char *wkstas, + 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 unknown_3, uint16 logon_divs, @@ -5606,7 +5606,7 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 * usr, +static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -5742,7 +5742,7 @@ static BOOL sam_io_user_info23(char *desc, SAM_USER_INFO_23 * usr, way than normal... And there are definately other problems. JRA. ********************************************************************/ -static BOOL sam_io_user_info25(char *desc, SAM_USER_INFO_25 * usr, prs_struct *ps, int depth) +static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_struct *ps, int depth) { if (usr == NULL) return False; @@ -6120,7 +6120,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 * usr, +static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -6253,7 +6253,7 @@ void init_sam_user_info20A(SAM_USER_INFO_20 *usr, SAM_ACCOUNT *pw) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info20(char *desc, SAM_USER_INFO_20 *usr, +static BOOL sam_io_user_info20(const char *desc, SAM_USER_INFO_20 *usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -6374,7 +6374,7 @@ void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, uchar * sess_key, reads or writes a structure. ********************************************************************/ -static BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR **ppctr, +static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, prs_struct *ps, int depth) { BOOL ret; @@ -6514,7 +6514,7 @@ void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO * r_u, +BOOL samr_io_r_query_userinfo(const char *desc, SAMR_R_QUERY_USERINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -6561,7 +6561,7 @@ void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO * q_u, +BOOL samr_io_q_set_userinfo(const char *desc, SAMR_Q_SET_USERINFO * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -6598,7 +6598,7 @@ void init_samr_r_set_userinfo(SAMR_R_SET_USERINFO * r_u, NTSTATUS status) reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_userinfo(char *desc, SAMR_R_SET_USERINFO * r_u, +BOOL samr_io_r_set_userinfo(const char *desc, SAMR_R_SET_USERINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -6648,7 +6648,7 @@ void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_userinfo2(char *desc, SAMR_Q_SET_USERINFO2 * q_u, +BOOL samr_io_q_set_userinfo2(const char *desc, SAMR_Q_SET_USERINFO2 * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -6686,7 +6686,7 @@ void init_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2 * r_u, NTSTATUS status) reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_userinfo2(char *desc, SAMR_R_SET_USERINFO2 * r_u, +BOOL samr_io_r_set_userinfo2(const char *desc, SAMR_R_SET_USERINFO2 * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -6727,7 +6727,7 @@ void init_samr_q_connect(SAMR_Q_CONNECT * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_connect(char *desc, SAMR_Q_CONNECT * q_u, +BOOL samr_io_q_connect(const char *desc, SAMR_Q_CONNECT * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -6756,7 +6756,7 @@ BOOL samr_io_q_connect(char *desc, SAMR_Q_CONNECT * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_connect(char *desc, SAMR_R_CONNECT * r_u, +BOOL samr_io_r_connect(const char *desc, SAMR_R_CONNECT * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -6803,7 +6803,7 @@ void init_samr_q_connect4(SAMR_Q_CONNECT4 * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_connect4(char *desc, SAMR_Q_CONNECT4 * q_u, +BOOL samr_io_q_connect4(const char *desc, SAMR_Q_CONNECT4 * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -6834,7 +6834,7 @@ BOOL samr_io_q_connect4(char *desc, SAMR_Q_CONNECT4 * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_connect4(char *desc, SAMR_R_CONNECT4 * r_u, +BOOL samr_io_r_connect4(const char *desc, SAMR_R_CONNECT4 * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -6873,7 +6873,7 @@ void init_samr_q_connect_anon(SAMR_Q_CONNECT_ANON * q_u) reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_connect_anon(char *desc, SAMR_Q_CONNECT_ANON * q_u, +BOOL samr_io_q_connect_anon(const char *desc, SAMR_Q_CONNECT_ANON * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -6901,7 +6901,7 @@ BOOL samr_io_q_connect_anon(char *desc, SAMR_Q_CONNECT_ANON * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_connect_anon(char *desc, SAMR_R_CONNECT_ANON * r_u, +BOOL samr_io_r_connect_anon(const char *desc, SAMR_R_CONNECT_ANON * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -6942,7 +6942,7 @@ void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_get_dom_pwinfo(char *desc, SAMR_Q_GET_DOM_PWINFO * q_u, +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) @@ -6970,7 +6970,7 @@ BOOL samr_io_q_get_dom_pwinfo(char *desc, SAMR_Q_GET_DOM_PWINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_get_dom_pwinfo(char *desc, SAMR_R_GET_DOM_PWINFO * r_u, +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) @@ -7020,7 +7020,7 @@ void init_enc_passwd(SAMR_ENC_PASSWD * pwd, char pass[512]) reads or writes a SAMR_ENC_PASSWD structure. ********************************************************************/ -BOOL samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD * pwd, +BOOL samr_io_enc_passwd(const char *desc, SAMR_ENC_PASSWD * pwd, prs_struct *ps, int depth) { if (pwd == NULL) @@ -7063,7 +7063,7 @@ void init_enc_hash(SAMR_ENC_HASH * hsh, uchar hash[16]) reads or writes a SAMR_ENC_HASH structure. ********************************************************************/ -BOOL samr_io_enc_hash(char *desc, SAMR_ENC_HASH * hsh, +BOOL samr_io_enc_hash(const char *desc, SAMR_ENC_HASH * hsh, prs_struct *ps, int depth) { if (hsh == NULL) @@ -7120,7 +7120,7 @@ void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER * q_u, +BOOL samr_io_q_chgpasswd_user(const char *desc, SAMR_Q_CHGPASSWD_USER * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -7178,7 +7178,7 @@ void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER * r_u, NTSTATUS status) reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER * r_u, +BOOL samr_io_r_chgpasswd_user(const char *desc, SAMR_R_CHGPASSWD_USER * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -7213,7 +7213,7 @@ void init_samr_q_unknown_2e(SAMR_Q_UNKNOWN_2E *q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_unknown_2e(char *desc, SAMR_Q_UNKNOWN_2E *q_u, +BOOL samr_io_q_unknown_2e(const char *desc, SAMR_Q_UNKNOWN_2E *q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -7259,7 +7259,7 @@ void init_samr_r_samr_unknown_2e(SAMR_R_UNKNOWN_2E * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_samr_unknown_2e(char *desc, SAMR_R_UNKNOWN_2E * r_u, +BOOL samr_io_r_samr_unknown_2e(const char *desc, SAMR_R_UNKNOWN_2E * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -7348,7 +7348,7 @@ void init_samr_q_set_domain_info(SAMR_Q_SET_DOMAIN_INFO *q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_domain_info(char *desc, SAMR_Q_SET_DOMAIN_INFO *q_u, +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) @@ -7429,7 +7429,7 @@ void init_samr_r_set_domain_info(SAMR_R_SET_DOMAIN_INFO * r_u, NTSTATUS status) reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_domain_info(char *desc, SAMR_R_SET_DOMAIN_INFO * r_u, +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) diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index cec37348b8..a49a34139e 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -40,7 +40,7 @@ void init_sec_access(SEC_ACCESS *t, uint32 mask) Reads or writes a SEC_ACCESS structure. ********************************************************************/ -BOOL sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) +BOOL sec_io_access(const char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) { if (t == NULL) return False; @@ -103,7 +103,7 @@ void init_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 f Reads or writes a SEC_ACE structure. ********************************************************************/ -BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth) +BOOL sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth) { uint32 old_offset; uint32 offset_ace_size; @@ -281,7 +281,7 @@ SEC_ACL *dup_sec_acl(TALLOC_CTX *ctx, SEC_ACL *src) for you as it reads them. ********************************************************************/ -BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) +BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) { int i; uint32 old_offset; @@ -720,7 +720,7 @@ SEC_DESC *make_standard_sec_desc(TALLOC_CTX *ctx, DOM_SID *owner_sid, DOM_SID *g If reading and the *ppsd = NULL, allocates the structure. ********************************************************************/ -BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) +BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) { uint32 old_offset; uint32 max_offset = 0; /* after we're done, move offset to end */ @@ -890,7 +890,7 @@ SEC_DESC_BUF *dup_sec_desc_buf(TALLOC_CTX *ctx, SEC_DESC_BUF *src) Reads or writes a SEC_DESC_BUF structure. ********************************************************************/ -BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth) +BOOL sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth) { uint32 off_len; uint32 off_max_len; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index fb5c642824..cb3b2efd9d 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -48,7 +48,7 @@ static uint32 str_len_uni(UNISTR *source) This should be moved in a more generic lib. ********************************************************************/ -BOOL spoolss_io_system_time(char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) +BOOL spoolss_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) { if(!prs_uint16("year", ps, depth, &systime->year)) return False; @@ -91,7 +91,7 @@ BOOL make_systemtime(SYSTEMTIME *systime, struct tm *unixtime) reads or writes an DOC_INFO structure. ********************************************************************/ -static BOOL smb_io_doc_info_1(char *desc, DOC_INFO_1 *info_1, prs_struct *ps, int depth) +static BOOL smb_io_doc_info_1(const char *desc, DOC_INFO_1 *info_1, prs_struct *ps, int depth) { if (info_1 == NULL) return False; @@ -122,7 +122,7 @@ static BOOL smb_io_doc_info_1(char *desc, DOC_INFO_1 *info_1, prs_struct *ps, in reads or writes an DOC_INFO structure. ********************************************************************/ -static BOOL smb_io_doc_info(char *desc, DOC_INFO *info, prs_struct *ps, int depth) +static BOOL smb_io_doc_info(const char *desc, DOC_INFO *info, prs_struct *ps, int depth) { uint32 useless_ptr=0; @@ -171,7 +171,7 @@ static BOOL smb_io_doc_info(char *desc, DOC_INFO *info, prs_struct *ps, int dept reads or writes an DOC_INFO_CONTAINER structure. ********************************************************************/ -static BOOL smb_io_doc_info_container(char *desc, DOC_INFO_CONTAINER *cont, prs_struct *ps, int depth) +static BOOL smb_io_doc_info_container(const char *desc, DOC_INFO_CONTAINER *cont, prs_struct *ps, int depth) { if (cont == NULL) return False; @@ -198,7 +198,7 @@ reads or writes an NOTIFY OPTION TYPE structure. structure. The _TYPE structure is really the deferred referrants (i.e the notify fields array) of the _TYPE structure. -tpot */ -static BOOL smb_io_notify_option_type(char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) +static BOOL smb_io_notify_option_type(const char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_notify_option_type"); depth++; @@ -226,7 +226,7 @@ static BOOL smb_io_notify_option_type(char *desc, SPOOL_NOTIFY_OPTION_TYPE *type reads or writes an NOTIFY OPTION TYPE DATA. ********************************************************************/ -static BOOL smb_io_notify_option_type_data(char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) +static BOOL smb_io_notify_option_type_data(const char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) { int i; @@ -257,7 +257,7 @@ static BOOL smb_io_notify_option_type_data(char *desc, SPOOL_NOTIFY_OPTION_TYPE reads or writes an NOTIFY OPTION structure. ********************************************************************/ -static BOOL smb_io_notify_option_type_ctr(char *desc, SPOOL_NOTIFY_OPTION_TYPE_CTR *ctr , prs_struct *ps, int depth) +static BOOL smb_io_notify_option_type_ctr(const char *desc, SPOOL_NOTIFY_OPTION_TYPE_CTR *ctr , prs_struct *ps, int depth) { int i; @@ -289,7 +289,7 @@ static BOOL smb_io_notify_option_type_ctr(char *desc, SPOOL_NOTIFY_OPTION_TYPE_C reads or writes an NOTIFY OPTION structure. ********************************************************************/ -static BOOL smb_io_notify_option(char *desc, SPOOL_NOTIFY_OPTION *option, prs_struct *ps, int depth) +static BOOL smb_io_notify_option(const char *desc, SPOOL_NOTIFY_OPTION *option, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_notify_option"); depth++; @@ -320,7 +320,7 @@ static BOOL smb_io_notify_option(char *desc, SPOOL_NOTIFY_OPTION *option, prs_st reads or writes an NOTIFY INFO DATA structure. ********************************************************************/ -static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) +static BOOL smb_io_notify_info_data(const char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) { uint32 useless_ptr=0x0FF0ADDE; @@ -399,7 +399,7 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs reads or writes an NOTIFY INFO DATA structure. ********************************************************************/ -BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, +BOOL smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_notify_info_data_strings"); @@ -530,7 +530,7 @@ BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, reads or writes an NOTIFY INFO structure. ********************************************************************/ -static BOOL smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, prs_struct *ps, int depth) +static BOOL smb_io_notify_info(const char *desc, SPOOL_NOTIFY_INFO *info, prs_struct *ps, int depth) { int i; @@ -566,7 +566,7 @@ static BOOL smb_io_notify_info(char *desc, SPOOL_NOTIFY_INFO *info, prs_struct * /******************************************************************* ********************************************************************/ -static BOOL spool_io_user_level_1(char *desc, SPOOL_USER_1 *q_u, prs_struct *ps, int depth) +static BOOL spool_io_user_level_1(const char *desc, SPOOL_USER_1 *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); depth++; @@ -605,7 +605,7 @@ static BOOL spool_io_user_level_1(char *desc, SPOOL_USER_1 *q_u, prs_struct *ps, /******************************************************************* ********************************************************************/ -static BOOL spool_io_user_level(char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, int depth) +static BOOL spool_io_user_level(const char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, int depth) { if (q_u==NULL) return False; @@ -643,7 +643,7 @@ static BOOL spool_io_user_level(char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, #define DM_NUM_OPTIONAL_FIELDS 8 -BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) +BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) { uint32 available_space; /* size of the device mode left to parse */ /* only important on unmarshalling */ @@ -829,7 +829,7 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo Read or write a DEVICEMODE container ********************************************************************/ -static BOOL spoolss_io_devmode_cont(char *desc, DEVMODE_CTR *dm_c, prs_struct *ps, int depth) +static BOOL spoolss_io_devmode_cont(const char *desc, DEVMODE_CTR *dm_c, prs_struct *ps, int depth) { if (dm_c==NULL) return False; @@ -874,7 +874,7 @@ static BOOL spoolss_io_devmode_cont(char *desc, DEVMODE_CTR *dm_c, prs_struct *p /******************************************************************* ********************************************************************/ -static BOOL spoolss_io_printer_default(char *desc, PRINTER_DEFAULT *pd, prs_struct *ps, int depth) +static BOOL spoolss_io_printer_default(const char *desc, PRINTER_DEFAULT *pd, prs_struct *ps, int depth) { if (pd==NULL) return False; @@ -1059,7 +1059,7 @@ BOOL make_spoolss_printer_info_2(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_2 * called from spoolss_q_open_printer_ex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_open_printer(char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_open_printer(const char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1090,7 +1090,7 @@ BOOL spoolss_io_q_open_printer(char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct * called from spoolss_open_printer_ex (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_open_printer(char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_open_printer(const char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -1115,7 +1115,7 @@ BOOL spoolss_io_r_open_printer(char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct * called from spoolss_q_open_printer_ex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_open_printer_ex(const char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1151,7 +1151,7 @@ BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_ * called from spoolss_open_printer_ex (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_open_printer_ex(const char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -1240,7 +1240,7 @@ BOOL make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX *q_u, * called from spoolss_q_getprinterdata (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_getprinterdata(char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getprinterdata(const char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1269,7 +1269,7 @@ BOOL spoolss_io_q_getprinterdata(char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_st * called from spoolss_q_deleteprinterdata (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_deleteprinterdata(char *desc, SPOOL_Q_DELETEPRINTERDATA *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_deleteprinterdata(const char *desc, SPOOL_Q_DELETEPRINTERDATA *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1294,7 +1294,7 @@ BOOL spoolss_io_q_deleteprinterdata(char *desc, SPOOL_Q_DELETEPRINTERDATA *q_u, * called from spoolss_r_deleteprinterdata (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_deleteprinterdata(char *desc, SPOOL_R_DELETEPRINTERDATA *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_deleteprinterdata(const char *desc, SPOOL_R_DELETEPRINTERDATA *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterdata"); depth++; @@ -1309,7 +1309,7 @@ BOOL spoolss_io_r_deleteprinterdata(char *desc, SPOOL_R_DELETEPRINTERDATA *r_u, * called from spoolss_q_deleteprinterdataex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_deleteprinterdataex(char *desc, SPOOL_Q_DELETEPRINTERDATAEX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_deleteprinterdataex(const char *desc, SPOOL_Q_DELETEPRINTERDATAEX *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1335,7 +1335,7 @@ BOOL spoolss_io_q_deleteprinterdataex(char *desc, SPOOL_Q_DELETEPRINTERDATAEX *q * called from spoolss_r_deleteprinterdataex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_deleteprinterdataex(char *desc, SPOOL_R_DELETEPRINTERDATAEX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_deleteprinterdataex(const char *desc, SPOOL_R_DELETEPRINTERDATAEX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterdataex"); depth++; @@ -1351,7 +1351,7 @@ BOOL spoolss_io_r_deleteprinterdataex(char *desc, SPOOL_R_DELETEPRINTERDATAEX *r * called from spoolss_r_getprinterdata (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_getprinterdata(char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -1407,7 +1407,7 @@ BOOL make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER *q_u, POLICY_HND *hnd) * called from spoolss_abortprinter (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_abortprinter(char *desc, SPOOL_Q_ABORTPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_abortprinter(const char *desc, SPOOL_Q_ABORTPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1428,7 +1428,7 @@ BOOL spoolss_io_q_abortprinter(char *desc, SPOOL_Q_ABORTPRINTER *q_u, prs_struct * called from spoolss_r_abortprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_abortprinter(char *desc, SPOOL_R_ABORTPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_abortprinter(const char *desc, SPOOL_R_ABORTPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_abortprinter"); depth++; @@ -1444,7 +1444,7 @@ BOOL spoolss_io_r_abortprinter(char *desc, SPOOL_R_ABORTPRINTER *r_u, prs_struct * called from spoolss_deleteprinter (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_deleteprinter(char *desc, SPOOL_Q_DELETEPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_deleteprinter(const char *desc, SPOOL_Q_DELETEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1466,7 +1466,7 @@ BOOL spoolss_io_q_deleteprinter(char *desc, SPOOL_Q_DELETEPRINTER *q_u, prs_stru * called from spoolss_deleteprinter (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_deleteprinter(char *desc, SPOOL_R_DELETEPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_deleteprinter(const char *desc, SPOOL_R_DELETEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinter"); depth++; @@ -1489,7 +1489,7 @@ BOOL spoolss_io_r_deleteprinter(char *desc, SPOOL_R_DELETEPRINTER *r_u, prs_stru * called from spoolss_deleteprinterdriver (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_deleteprinterdriver(char *desc, SPOOL_Q_DELETEPRINTERDRIVER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_deleteprinterdriver(const char *desc, SPOOL_Q_DELETEPRINTERDRIVER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1516,7 +1516,7 @@ BOOL spoolss_io_q_deleteprinterdriver(char *desc, SPOOL_Q_DELETEPRINTERDRIVER *q /******************************************************************* * write a structure. ********************************************************************/ -BOOL spoolss_io_r_deleteprinterdriver(char *desc, SPOOL_R_DELETEPRINTERDRIVER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_deleteprinterdriver(const char *desc, SPOOL_R_DELETEPRINTERDRIVER *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -1539,7 +1539,7 @@ BOOL spoolss_io_r_deleteprinterdriver(char *desc, SPOOL_R_DELETEPRINTERDRIVER *r * called from spoolss_deleteprinterdriver (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_deleteprinterdriverex(char *desc, SPOOL_Q_DELETEPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_deleteprinterdriverex(const char *desc, SPOOL_Q_DELETEPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1574,7 +1574,7 @@ BOOL spoolss_io_q_deleteprinterdriverex(char *desc, SPOOL_Q_DELETEPRINTERDRIVERE /******************************************************************* * write a structure. ********************************************************************/ -BOOL spoolss_io_r_deleteprinterdriverex(char *desc, SPOOL_R_DELETEPRINTERDRIVEREX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_deleteprinterdriverex(const char *desc, SPOOL_R_DELETEPRINTERDRIVEREX *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -1598,7 +1598,7 @@ BOOL spoolss_io_r_deleteprinterdriverex(char *desc, SPOOL_R_DELETEPRINTERDRIVERE * called from spoolss_closeprinter (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_closeprinter(char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_closeprinter(const char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1620,7 +1620,7 @@ BOOL spoolss_io_q_closeprinter(char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct * called from spoolss_closeprinter (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_closeprinter(char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_closeprinter(const char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_closeprinter"); depth++; @@ -1641,7 +1641,7 @@ BOOL spoolss_io_r_closeprinter(char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct * called from spoolss_q_startdocprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_startdocprinter(char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_startdocprinter(const char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1665,7 +1665,7 @@ BOOL spoolss_io_q_startdocprinter(char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_ * called from spoolss_r_startdocprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_startdocprinter(char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_startdocprinter(const char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_startdocprinter"); depth++; @@ -1682,7 +1682,7 @@ BOOL spoolss_io_r_startdocprinter(char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_ * called from spoolss_q_enddocprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_enddocprinter(char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enddocprinter(const char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1703,7 +1703,7 @@ BOOL spoolss_io_q_enddocprinter(char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_stru * called from spoolss_r_enddocprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_enddocprinter(char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enddocprinter(const char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enddocprinter"); depth++; @@ -1718,7 +1718,7 @@ BOOL spoolss_io_r_enddocprinter(char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_stru * called from spoolss_q_startpageprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_startpageprinter(char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_startpageprinter(const char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1739,7 +1739,7 @@ BOOL spoolss_io_q_startpageprinter(char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, pr * called from spoolss_r_startpageprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_startpageprinter(char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_startpageprinter(const char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_startpageprinter"); depth++; @@ -1754,7 +1754,7 @@ BOOL spoolss_io_r_startpageprinter(char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, pr * called from spoolss_q_endpageprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_endpageprinter(char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_endpageprinter(const char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1775,7 +1775,7 @@ BOOL spoolss_io_q_endpageprinter(char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_st * called from spoolss_r_endpageprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_endpageprinter(char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_endpageprinter(const char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_endpageprinter"); depth++; @@ -1790,7 +1790,7 @@ BOOL spoolss_io_r_endpageprinter(char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_st * called from spoolss_q_writeprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_writeprinter(const char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1827,7 +1827,7 @@ BOOL spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct * called from spoolss_r_writeprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_writeprinter(char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_writeprinter(const char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_writeprinter"); depth++; @@ -1844,7 +1844,7 @@ BOOL spoolss_io_r_writeprinter(char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct * called from spoolss_q_rffpcnex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_rffpcnex(const char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_rffpcnex"); depth++; @@ -1890,7 +1890,7 @@ BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, in * called from spoolss_r_rffpcnex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_rffpcnex(const char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_rffpcnex"); depth++; @@ -1906,7 +1906,7 @@ BOOL spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, in * called from spoolss_q_rfnpcnex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_rfnpcnex(const char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_rfnpcnex"); depth++; @@ -1941,7 +1941,7 @@ BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, in * called from spoolss_r_rfnpcnex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_rfnpcnex(char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_rfnpcnex(const char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_rfnpcnex"); depth++; @@ -2061,7 +2061,7 @@ static uint32 size_of_systemtime(SYSTEMTIME *systime) * ********************************************************************/ -static BOOL smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *string) +static BOOL smb_io_relstr(const char *desc, NEW_BUFFER *buffer, int depth, UNISTR *string) { prs_struct *ps=&buffer->prs; @@ -2123,7 +2123,7 @@ static BOOL smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *str * used by 2 RPC structs ********************************************************************/ -static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16 **string) +static BOOL smb_io_relarraystr(const char *desc, NEW_BUFFER *buffer, int depth, uint16 **string) { UNISTR chaine; @@ -2251,7 +2251,7 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16 Parse a DEVMODE structure and its relative pointer. ********************************************************************/ -static BOOL smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, SEC_DESC **secdesc) +static BOOL smb_io_relsecdesc(const char *desc, NEW_BUFFER *buffer, int depth, SEC_DESC **secdesc) { prs_struct *ps= &buffer->prs; @@ -2312,7 +2312,7 @@ static BOOL smb_io_relsecdesc(char *desc, NEW_BUFFER *buffer, int depth, SEC_DES Parse a DEVMODE structure and its relative pointer. ********************************************************************/ -static BOOL smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEVICEMODE **devmode) +static BOOL smb_io_reldevmode(const char *desc, NEW_BUFFER *buffer, int depth, DEVICEMODE **devmode) { prs_struct *ps=&buffer->prs; @@ -2380,7 +2380,7 @@ static BOOL smb_io_reldevmode(char *desc, NEW_BUFFER *buffer, int depth, DEVICEM Parse a PRINTER_INFO_0 structure. ********************************************************************/ -BOOL smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *info, int depth) +BOOL smb_io_printer_info_0(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2481,7 +2481,7 @@ BOOL smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *info, Parse a PRINTER_INFO_1 structure. ********************************************************************/ -BOOL smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info, int depth) +BOOL smb_io_printer_info_1(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2506,7 +2506,7 @@ BOOL smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info, Parse a PRINTER_INFO_2 structure. ********************************************************************/ -BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) +BOOL smb_io_printer_info_2(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; uint32 dm_offset, sd_offset, current_offset; @@ -2597,7 +2597,7 @@ BOOL smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, Parse a PRINTER_INFO_3 structure. ********************************************************************/ -BOOL smb_io_printer_info_3(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *info, int depth) +BOOL smb_io_printer_info_3(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2618,7 +2618,7 @@ BOOL smb_io_printer_info_3(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *info, Parse a PRINTER_INFO_4 structure. ********************************************************************/ -BOOL smb_io_printer_info_4(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_4 *info, int depth) +BOOL smb_io_printer_info_4(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_4 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2640,7 +2640,7 @@ BOOL smb_io_printer_info_4(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_4 *info, Parse a PRINTER_INFO_5 structure. ********************************************************************/ -BOOL smb_io_printer_info_5(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_5 *info, int depth) +BOOL smb_io_printer_info_5(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_5 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2666,7 +2666,7 @@ BOOL smb_io_printer_info_5(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_5 *info, Parse a PRINTER_INFO_7 structure. ********************************************************************/ -BOOL smb_io_printer_info_7(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_7 *info, int depth) +BOOL smb_io_printer_info_7(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_7 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2686,7 +2686,7 @@ BOOL smb_io_printer_info_7(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_7 *info, Parse a PORT_INFO_1 structure. ********************************************************************/ -BOOL smb_io_port_info_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) +BOOL smb_io_port_info_1(const char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2705,7 +2705,7 @@ BOOL smb_io_port_info_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int d Parse a PORT_INFO_2 structure. ********************************************************************/ -BOOL smb_io_port_info_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) +BOOL smb_io_port_info_2(const char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2732,7 +2732,7 @@ BOOL smb_io_port_info_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int d Parse a DRIVER_INFO_1 structure. ********************************************************************/ -BOOL smb_io_printer_driver_info_1(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_1 *info, int depth) +BOOL smb_io_printer_driver_info_1(const char *desc, NEW_BUFFER *buffer, DRIVER_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2751,7 +2751,7 @@ BOOL smb_io_printer_driver_info_1(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_1 Parse a DRIVER_INFO_2 structure. ********************************************************************/ -BOOL smb_io_printer_driver_info_2(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) +BOOL smb_io_printer_driver_info_2(const char *desc, NEW_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2780,7 +2780,7 @@ BOOL smb_io_printer_driver_info_2(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_2 Parse a DRIVER_INFO_3 structure. ********************************************************************/ -BOOL smb_io_printer_driver_info_3(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_3 *info, int depth) +BOOL smb_io_printer_driver_info_3(const char *desc, NEW_BUFFER *buffer, DRIVER_INFO_3 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2819,7 +2819,7 @@ BOOL smb_io_printer_driver_info_3(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_3 Parse a DRIVER_INFO_6 structure. ********************************************************************/ -BOOL smb_io_printer_driver_info_6(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_6 *info, int depth) +BOOL smb_io_printer_driver_info_6(const char *desc, NEW_BUFFER *buffer, DRIVER_INFO_6 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2884,7 +2884,7 @@ BOOL smb_io_printer_driver_info_6(char *desc, NEW_BUFFER *buffer, DRIVER_INFO_6 Parse a JOB_INFO_1 structure. ********************************************************************/ -BOOL smb_io_job_info_1(char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int depth) +BOOL smb_io_job_info_1(const char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2927,7 +2927,7 @@ BOOL smb_io_job_info_1(char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int dep Parse a JOB_INFO_2 structure. ********************************************************************/ -BOOL smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int depth) +BOOL smb_io_job_info_2(const char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int depth) { uint32 pipo=0; prs_struct *ps=&buffer->prs; @@ -2994,7 +2994,7 @@ BOOL smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int dep /******************************************************************* ********************************************************************/ -BOOL smb_io_form_1(char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth) +BOOL smb_io_form_1(const char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3029,7 +3029,7 @@ BOOL smb_io_form_1(char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth) Read/write a BUFFER struct. ********************************************************************/ -static BOOL spoolss_io_buffer(char *desc, prs_struct *ps, int depth, NEW_BUFFER **pp_buffer) +static BOOL spoolss_io_buffer(const char *desc, prs_struct *ps, int depth, NEW_BUFFER **pp_buffer) { NEW_BUFFER *buffer = *pp_buffer; @@ -3141,7 +3141,7 @@ uint32 new_get_buffer_size(NEW_BUFFER *buffer) Parse a DRIVER_DIRECTORY_1 structure. ********************************************************************/ -BOOL smb_io_driverdir_1(char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 *info, int depth) +BOOL smb_io_driverdir_1(const char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3160,7 +3160,7 @@ BOOL smb_io_driverdir_1(char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 *info Parse a PORT_INFO_1 structure. ********************************************************************/ -BOOL smb_io_port_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) +BOOL smb_io_port_1(const char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3179,7 +3179,7 @@ BOOL smb_io_port_1(char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) Parse a PORT_INFO_2 structure. ********************************************************************/ -BOOL smb_io_port_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) +BOOL smb_io_port_2(const char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3205,7 +3205,7 @@ BOOL smb_io_port_2(char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) /******************************************************************* ********************************************************************/ -BOOL smb_io_printprocessor_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR_1 *info, int depth) +BOOL smb_io_printprocessor_info_1(const char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3223,7 +3223,7 @@ BOOL smb_io_printprocessor_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR /******************************************************************* ********************************************************************/ -BOOL smb_io_printprocdatatype_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCDATATYPE_1 *info, int depth) +BOOL smb_io_printprocdatatype_info_1(const char *desc, NEW_BUFFER *buffer, PRINTPROCDATATYPE_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3241,7 +3241,7 @@ BOOL smb_io_printprocdatatype_info_1(char *desc, NEW_BUFFER *buffer, PRINTPROCDA /******************************************************************* ********************************************************************/ -BOOL smb_io_printmonitor_info_1(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_1 *info, int depth) +BOOL smb_io_printmonitor_info_1(const char *desc, NEW_BUFFER *buffer, PRINTMONITOR_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3259,7 +3259,7 @@ BOOL smb_io_printmonitor_info_1(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_1 * /******************************************************************* ********************************************************************/ -BOOL smb_io_printmonitor_info_2(char *desc, NEW_BUFFER *buffer, PRINTMONITOR_2 *info, int depth) +BOOL smb_io_printmonitor_info_2(const char *desc, NEW_BUFFER *buffer, PRINTMONITOR_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3806,7 +3806,7 @@ BOOL make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u, * called from spoolss_getprinterdriver2 (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_getprinterdriver2(char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getprinterdriver2(const char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdriver2"); depth++; @@ -3848,7 +3848,7 @@ BOOL spoolss_io_q_getprinterdriver2(char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, * called from spoolss_getprinterdriver2 (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getprinterdriver2(const char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriver2"); depth++; @@ -3921,7 +3921,7 @@ BOOL make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS *q_u, * called from spoolss_enumprinters (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprinters(const char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinters"); depth++; @@ -3957,7 +3957,7 @@ BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct Parse a SPOOL_R_ENUMPRINTERS structure. ********************************************************************/ -BOOL spoolss_io_r_enumprinters(char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprinters(const char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprinters"); depth++; @@ -3989,7 +3989,7 @@ BOOL spoolss_io_r_enumprinters(char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct * ********************************************************************/ -BOOL spoolss_io_r_getprinter(char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getprinter(const char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getprinter"); depth++; @@ -4017,7 +4017,7 @@ BOOL spoolss_io_r_getprinter(char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps * called from spoolss_getprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getprinter(const char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_getprinter"); depth++; @@ -4129,7 +4129,7 @@ BOOL make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_setprinter(const char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setprinter"); depth++; @@ -4147,7 +4147,7 @@ BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps Marshall/unmarshall a SPOOL_Q_SETPRINTER struct. ********************************************************************/ -BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_setprinter(const char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth) { uint32 ptr_sec_desc = 0; @@ -4210,7 +4210,7 @@ BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_fcpn(char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_fcpn(const char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_fcpn"); depth++; @@ -4227,7 +4227,7 @@ BOOL spoolss_io_r_fcpn(char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_fcpn(char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_fcpn(const char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_fcpn"); @@ -4246,7 +4246,7 @@ BOOL spoolss_io_q_fcpn(char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_addjob(const char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); depth++; @@ -4272,7 +4272,7 @@ BOOL spoolss_io_r_addjob(char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int de /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_addjob(const char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); depth++; @@ -4300,7 +4300,7 @@ BOOL spoolss_io_q_addjob(char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int de /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumjobs(char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumjobs(const char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumjobs"); depth++; @@ -4352,7 +4352,7 @@ BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumjobs(const char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumjobs"); depth++; @@ -4385,7 +4385,7 @@ BOOL spoolss_io_q_enumjobs(char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, in /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_schedulejob(char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_schedulejob(const char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_schedulejob"); depth++; @@ -4402,7 +4402,7 @@ BOOL spoolss_io_r_schedulejob(char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct * /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_schedulejob(char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_schedulejob(const char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_schedulejob"); depth++; @@ -4421,7 +4421,7 @@ BOOL spoolss_io_q_schedulejob(char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct * /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_setjob(char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_setjob(const char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setjob"); depth++; @@ -4438,7 +4438,7 @@ BOOL spoolss_io_r_setjob(char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int de /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_setjob(const char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_setjob"); depth++; @@ -4466,7 +4466,7 @@ BOOL spoolss_io_q_setjob(char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int de Parse a SPOOL_R_ENUMPRINTERDRIVERS structure. ********************************************************************/ -BOOL spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprinterdrivers(const char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdrivers"); depth++; @@ -4516,7 +4516,7 @@ BOOL make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, Parse a SPOOL_Q_ENUMPRINTERDRIVERS structure. ********************************************************************/ -BOOL spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprinterdrivers(const char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdrivers"); @@ -4557,7 +4557,7 @@ BOOL spoolss_io_q_enumprinterdrivers(char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumforms(const char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumforms"); @@ -4584,7 +4584,7 @@ BOOL spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumforms(const char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumforms"); depth++; @@ -4613,7 +4613,7 @@ BOOL spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_getform(char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getform(const char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_getform"); @@ -4646,7 +4646,7 @@ BOOL spoolss_io_q_getform(char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps, int /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_getform(char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getform(const char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getform"); depth++; @@ -4673,7 +4673,7 @@ BOOL spoolss_io_r_getform(char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps, int Parse a SPOOL_R_ENUMPORTS structure. ********************************************************************/ -BOOL spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumports(const char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumports"); depth++; @@ -4702,7 +4702,7 @@ BOOL spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumports(const char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); depth++; @@ -4735,7 +4735,7 @@ BOOL spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, Parse a SPOOL_PRINTER_INFO_LEVEL_1 structure. ********************************************************************/ -BOOL spool_io_printer_info_level_1(char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, prs_struct *ps, int depth) +BOOL spool_io_printer_info_level_1(const char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level_1"); depth++; @@ -4766,7 +4766,7 @@ BOOL spool_io_printer_info_level_1(char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, p Parse a SPOOL_PRINTER_INFO_LEVEL_3 structure. ********************************************************************/ -BOOL spool_io_printer_info_level_3(char *desc, SPOOL_PRINTER_INFO_LEVEL_3 *il, prs_struct *ps, int depth) +BOOL spool_io_printer_info_level_3(const char *desc, SPOOL_PRINTER_INFO_LEVEL_3 *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level_3"); depth++; @@ -4784,7 +4784,7 @@ BOOL spool_io_printer_info_level_3(char *desc, SPOOL_PRINTER_INFO_LEVEL_3 *il, p Parse a SPOOL_PRINTER_INFO_LEVEL_2 structure. ********************************************************************/ -BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, prs_struct *ps, int depth) +BOOL spool_io_printer_info_level_2(const char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level_2"); depth++; @@ -4863,7 +4863,7 @@ BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, p return True; } -BOOL spool_io_printer_info_level_7(char *desc, SPOOL_PRINTER_INFO_LEVEL_7 *il, prs_struct *ps, int depth) +BOOL spool_io_printer_info_level_7(const char *desc, SPOOL_PRINTER_INFO_LEVEL_7 *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level_7"); depth++; @@ -4884,7 +4884,7 @@ BOOL spool_io_printer_info_level_7(char *desc, SPOOL_PRINTER_INFO_LEVEL_7 *il, p /******************************************************************* ********************************************************************/ -BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth) +BOOL spool_io_printer_info_level(const char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level"); depth++; @@ -4961,7 +4961,7 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_addprinterex(const char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth) { uint32 ptr_sec_desc = 0; @@ -5025,7 +5025,7 @@ BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, +BOOL spoolss_io_r_addprinterex(const char *desc, SPOOL_R_ADDPRINTEREX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addprinterex"); @@ -5043,7 +5043,7 @@ BOOL spoolss_io_r_addprinterex(char *desc, SPOOL_R_ADDPRINTEREX *r_u, /******************************************************************* ********************************************************************/ -BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, +BOOL spool_io_printer_driver_info_level_3(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, prs_struct *ps, int depth) { SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *il; @@ -5121,7 +5121,7 @@ BOOL spool_io_printer_driver_info_level_3(char *desc, SPOOL_PRINTER_DRIVER_INFO_ parse a SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure ********************************************************************/ -BOOL spool_io_printer_driver_info_level_6(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u, +BOOL spool_io_printer_driver_info_level_6(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u, prs_struct *ps, int depth) { SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *il; @@ -5312,7 +5312,7 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) and size of array at beginning ********************************************************************/ -BOOL smb_io_unibuffer(char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) +BOOL smb_io_unibuffer(const char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) { if (buffer==NULL) return False; @@ -5331,7 +5331,7 @@ BOOL smb_io_unibuffer(char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) /******************************************************************* ********************************************************************/ -BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth) +BOOL spool_io_printer_driver_info_level(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level"); depth++; @@ -5480,7 +5480,7 @@ BOOL make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 fill in the prs_struct for a ADDPRINTERDRIVER request PDU ********************************************************************/ -BOOL spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_addprinterdriver(const char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_addprinterdriver"); depth++; @@ -5507,7 +5507,7 @@ BOOL spoolss_io_q_addprinterdriver(char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, pr /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addprinterdriver(char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_addprinterdriver(const char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addprinterdriver"); depth++; @@ -5522,7 +5522,7 @@ BOOL spoolss_io_r_addprinterdriver(char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, pr fill in the prs_struct for a ADDPRINTERDRIVER request PDU ********************************************************************/ -BOOL spoolss_io_q_addprinterdriverex(char *desc, SPOOL_Q_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_addprinterdriverex(const char *desc, SPOOL_Q_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_addprinterdriverex"); depth++; @@ -5554,7 +5554,7 @@ BOOL spoolss_io_q_addprinterdriverex(char *desc, SPOOL_Q_ADDPRINTERDRIVEREX *q_u /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addprinterdriverex(char *desc, SPOOL_R_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_addprinterdriverex(const char *desc, SPOOL_R_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addprinterdriverex"); depth++; @@ -5737,7 +5737,7 @@ BOOL make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR *q_u, Parse a SPOOL_Q_GETPRINTERDRIVERDIR structure. ********************************************************************/ -BOOL spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getprinterdriverdir(const char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdriverdir"); depth++; @@ -5779,7 +5779,7 @@ BOOL spoolss_io_q_getprinterdriverdir(char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q Parse a SPOOL_R_GETPRINTERDRIVERDIR structure. ********************************************************************/ -BOOL spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getprinterdriverdir(const char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriverdir"); depth++; @@ -5805,7 +5805,7 @@ BOOL spoolss_io_r_getprinterdriverdir(char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprintprocessors(const char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocessors"); depth++; @@ -5834,7 +5834,7 @@ BOOL spoolss_io_r_enumprintprocessors(char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprintprocessors(const char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprintprocessors"); depth++; @@ -5876,7 +5876,7 @@ BOOL spoolss_io_q_enumprintprocessors(char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_addprintprocessor(char *desc, SPOOL_Q_ADDPRINTPROCESSOR *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_addprintprocessor(const char *desc, SPOOL_Q_ADDPRINTPROCESSOR *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_addprintprocessor"); depth++; @@ -5910,7 +5910,7 @@ BOOL spoolss_io_q_addprintprocessor(char *desc, SPOOL_Q_ADDPRINTPROCESSOR *q_u, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addprintprocessor(char *desc, SPOOL_R_ADDPRINTPROCESSOR *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_addprintprocessor(const char *desc, SPOOL_R_ADDPRINTPROCESSOR *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addprintproicessor"); depth++; @@ -5927,7 +5927,7 @@ BOOL spoolss_io_r_addprintprocessor(char *desc, SPOOL_R_ADDPRINTPROCESSOR *r_u, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumprintprocdatatypes(char *desc, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprintprocdatatypes(const char *desc, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocdatatypes"); depth++; @@ -5956,7 +5956,7 @@ BOOL spoolss_io_r_enumprintprocdatatypes(char *desc, SPOOL_R_ENUMPRINTPROCDATATY /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumprintprocdatatypes(char *desc, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprintprocdatatypes(const char *desc, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprintprocdatatypes"); depth++; @@ -5999,7 +5999,7 @@ BOOL spoolss_io_q_enumprintprocdatatypes(char *desc, SPOOL_Q_ENUMPRINTPROCDATATY Parse a SPOOL_Q_ENUMPRINTMONITORS structure. ********************************************************************/ -BOOL spoolss_io_q_enumprintmonitors(char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprintmonitors(const char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprintmonitors"); depth++; @@ -6033,7 +6033,7 @@ BOOL spoolss_io_q_enumprintmonitors(char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprintmonitors(const char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprintmonitors"); depth++; @@ -6062,7 +6062,7 @@ BOOL spoolss_io_r_enumprintmonitors(char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprinterdata(const char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdata"); depth++; @@ -6119,7 +6119,7 @@ BOOL spoolss_io_r_enumprinterdata(char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_ /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumprinterdata(char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprinterdata(const char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdata"); depth++; @@ -6157,7 +6157,7 @@ BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, ********************************************************************/ BOOL make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u, - const POLICY_HND *hnd, char *key, + const POLICY_HND *hnd, const char *key, uint32 size) { memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); @@ -6202,7 +6202,7 @@ BOOL make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX *q_u, const POLICY /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_setprinterdata(const char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_setprinterdata"); depth++; @@ -6251,7 +6251,7 @@ BOOL spoolss_io_q_setprinterdata(char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_st /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_setprinterdata(const char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setprinterdata"); depth++; @@ -6266,7 +6266,7 @@ BOOL spoolss_io_r_setprinterdata(char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_st /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_resetprinter(char *desc, SPOOL_Q_RESETPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_resetprinter(const char *desc, SPOOL_Q_RESETPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_resetprinter"); depth++; @@ -6293,7 +6293,7 @@ BOOL spoolss_io_q_resetprinter(char *desc, SPOOL_Q_RESETPRINTER *q_u, prs_struct /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_resetprinter(char *desc, SPOOL_R_RESETPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_resetprinter(const char *desc, SPOOL_R_RESETPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_resetprinter"); depth++; @@ -6309,7 +6309,7 @@ BOOL spoolss_io_r_resetprinter(char *desc, SPOOL_R_RESETPRINTER *r_u, prs_struct /******************************************************************* ********************************************************************/ -static BOOL spoolss_io_addform(char *desc, FORM *f, uint32 ptr, prs_struct *ps, int depth) +static BOOL spoolss_io_addform(const char *desc, FORM *f, uint32 ptr, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_addform"); depth++; @@ -6345,7 +6345,7 @@ static BOOL spoolss_io_addform(char *desc, FORM *f, uint32 ptr, prs_struct *ps, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_deleteform(char *desc, SPOOL_Q_DELETEFORM *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_deleteform(const char *desc, SPOOL_Q_DELETEFORM *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_deleteform"); depth++; @@ -6363,7 +6363,7 @@ BOOL spoolss_io_q_deleteform(char *desc, SPOOL_Q_DELETEFORM *q_u, prs_struct *ps /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_deleteform(char *desc, SPOOL_R_DELETEFORM *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_deleteform(const char *desc, SPOOL_R_DELETEFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteform"); depth++; @@ -6379,7 +6379,7 @@ BOOL spoolss_io_r_deleteform(char *desc, SPOOL_R_DELETEFORM *r_u, prs_struct *ps /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_addform(const char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth) { uint32 useless_ptr=1; prs_debug(ps, depth, desc, "spoolss_io_q_addform"); @@ -6408,7 +6408,7 @@ BOOL spoolss_io_q_addform(char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_addform(const char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addform"); depth++; @@ -6424,7 +6424,7 @@ BOOL spoolss_io_r_addform(char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_setform(const char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth) { uint32 useless_ptr=1; prs_debug(ps, depth, desc, "spoolss_io_q_setform"); @@ -6459,7 +6459,7 @@ BOOL spoolss_io_q_setform(char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_setform(char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_setform(const char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setform"); depth++; @@ -6476,7 +6476,7 @@ BOOL spoolss_io_r_setform(char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int Parse a SPOOL_R_GETJOB structure. ********************************************************************/ -BOOL spoolss_io_r_getjob(char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getjob(const char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getjob"); depth++; @@ -6503,7 +6503,7 @@ BOOL spoolss_io_r_getjob(char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int de Parse a SPOOL_Q_GETJOB structure. ********************************************************************/ -BOOL spoolss_io_q_getjob(char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getjob(const char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); depth++; @@ -6603,7 +6603,7 @@ BOOL make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER *q_u, Parse a SPOOL_Q_REPLYOPENPRINTER structure. ********************************************************************/ -BOOL spoolss_io_q_replyopenprinter(char *desc, SPOOL_Q_REPLYOPENPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_replyopenprinter(const char *desc, SPOOL_Q_REPLYOPENPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_replyopenprinter"); depth++; @@ -6634,7 +6634,7 @@ BOOL spoolss_io_q_replyopenprinter(char *desc, SPOOL_Q_REPLYOPENPRINTER *q_u, pr Parse a SPOOL_R_REPLYOPENPRINTER structure. ********************************************************************/ -BOOL spoolss_io_r_replyopenprinter(char *desc, SPOOL_R_REPLYOPENPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_replyopenprinter(const char *desc, SPOOL_R_REPLYOPENPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_replyopenprinter"); depth++; @@ -6674,7 +6674,7 @@ BOOL make_spoolss_q_routerreplyprinter(SPOOL_Q_ROUTERREPLYPRINTER *q_u, POLICY_H /******************************************************************* Parse a SPOOL_Q_ROUTERREPLYPRINTER structure. ********************************************************************/ -BOOL spoolss_io_q_routerreplyprinter (char *desc, SPOOL_Q_ROUTERREPLYPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_routerreplyprinter (const char *desc, SPOOL_Q_ROUTERREPLYPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_routerreplyprinter"); @@ -6704,7 +6704,7 @@ BOOL spoolss_io_q_routerreplyprinter (char *desc, SPOOL_Q_ROUTERREPLYPRINTER *q_ /******************************************************************* Parse a SPOOL_R_ROUTERREPLYPRINTER structure. ********************************************************************/ -BOOL spoolss_io_r_routerreplyprinter (char *desc, SPOOL_R_ROUTERREPLYPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_routerreplyprinter (const char *desc, SPOOL_R_ROUTERREPLYPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_routerreplyprinter"); depth++; @@ -6736,7 +6736,7 @@ BOOL make_spoolss_q_reply_closeprinter(SPOOL_Q_REPLYCLOSEPRINTER *q_u, POLICY_HN Parse a SPOOL_Q_REPLYCLOSEPRINTER structure. ********************************************************************/ -BOOL spoolss_io_q_replycloseprinter(char *desc, SPOOL_Q_REPLYCLOSEPRINTER *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_replycloseprinter(const char *desc, SPOOL_Q_REPLYCLOSEPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_replycloseprinter"); depth++; @@ -6754,7 +6754,7 @@ BOOL spoolss_io_q_replycloseprinter(char *desc, SPOOL_Q_REPLYCLOSEPRINTER *q_u, Parse a SPOOL_R_REPLYCLOSEPRINTER structure. ********************************************************************/ -BOOL spoolss_io_r_replycloseprinter(char *desc, SPOOL_R_REPLYCLOSEPRINTER *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_replycloseprinter(const char *desc, SPOOL_R_REPLYCLOSEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_replycloseprinter"); depth++; @@ -6881,7 +6881,7 @@ BOOL make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd, Parse a SPOOL_Q_REPLY_RRPCN structure. ********************************************************************/ -BOOL spoolss_io_q_reply_rrpcn(char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_reply_rrpcn(const char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_reply_rrpcn"); depth++; @@ -6918,7 +6918,7 @@ BOOL spoolss_io_q_reply_rrpcn(char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct * Parse a SPOOL_R_REPLY_RRPCN structure. ********************************************************************/ -BOOL spoolss_io_r_reply_rrpcn(char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_reply_rrpcn(const char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_reply_rrpcn"); depth++; @@ -6940,7 +6940,7 @@ BOOL spoolss_io_r_reply_rrpcn(char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct * * called from spoolss_q_getprinterdataex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_getprinterdataex(char *desc, SPOOL_Q_GETPRINTERDATAEX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getprinterdataex(const char *desc, SPOOL_Q_GETPRINTERDATAEX *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -6973,7 +6973,7 @@ BOOL spoolss_io_q_getprinterdataex(char *desc, SPOOL_Q_GETPRINTERDATAEX *q_u, pr * called from spoolss_r_getprinterdataex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_getprinterdataex(char *desc, SPOOL_R_GETPRINTERDATAEX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getprinterdataex(const char *desc, SPOOL_R_GETPRINTERDATAEX *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -7012,7 +7012,7 @@ BOOL spoolss_io_r_getprinterdataex(char *desc, SPOOL_R_GETPRINTERDATAEX *r_u, pr * read a structure. ********************************************************************/ -BOOL spoolss_io_q_setprinterdataex(char *desc, SPOOL_Q_SETPRINTERDATAEX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_setprinterdataex(const char *desc, SPOOL_Q_SETPRINTERDATAEX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_setprinterdataex"); depth++; @@ -7068,7 +7068,7 @@ BOOL spoolss_io_q_setprinterdataex(char *desc, SPOOL_Q_SETPRINTERDATAEX *q_u, pr * write a structure. ********************************************************************/ -BOOL spoolss_io_r_setprinterdataex(char *desc, SPOOL_R_SETPRINTERDATAEX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_setprinterdataex(const char *desc, SPOOL_R_SETPRINTERDATAEX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setprinterdataex"); depth++; @@ -7085,7 +7085,8 @@ BOOL spoolss_io_r_setprinterdataex(char *desc, SPOOL_R_SETPRINTERDATAEX *r_u, pr * read a structure. ********************************************************************/ BOOL make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u, - POLICY_HND *hnd, char *key, uint32 size) + POLICY_HND *hnd, const char *key, + uint32 size) { DEBUG(5,("make_spoolss_q_enumprinterkey\n")); @@ -7100,7 +7101,7 @@ BOOL make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u, * read a structure. ********************************************************************/ -BOOL spoolss_io_q_enumprinterkey(char *desc, SPOOL_Q_ENUMPRINTERKEY *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprinterkey(const char *desc, SPOOL_Q_ENUMPRINTERKEY *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterkey"); depth++; @@ -7126,7 +7127,7 @@ BOOL spoolss_io_q_enumprinterkey(char *desc, SPOOL_Q_ENUMPRINTERKEY *q_u, prs_st * write a structure. ********************************************************************/ -BOOL spoolss_io_r_enumprinterkey(char *desc, SPOOL_R_ENUMPRINTERKEY *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprinterkey(const char *desc, SPOOL_R_ENUMPRINTERKEY *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterkey"); depth++; @@ -7168,7 +7169,7 @@ BOOL make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY *q_u, * read a structure. ********************************************************************/ -BOOL spoolss_io_q_deleteprinterkey(char *desc, SPOOL_Q_DELETEPRINTERKEY *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_deleteprinterkey(const char *desc, SPOOL_Q_DELETEPRINTERKEY *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_deleteprinterkey"); depth++; @@ -7188,7 +7189,7 @@ BOOL spoolss_io_q_deleteprinterkey(char *desc, SPOOL_Q_DELETEPRINTERKEY *q_u, pr * write a structure. ********************************************************************/ -BOOL spoolss_io_r_deleteprinterkey(char *desc, SPOOL_R_DELETEPRINTERKEY *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_deleteprinterkey(const char *desc, SPOOL_R_DELETEPRINTERKEY *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterkey"); depth++; @@ -7207,7 +7208,7 @@ BOOL spoolss_io_r_deleteprinterkey(char *desc, SPOOL_R_DELETEPRINTERKEY *r_u, pr * read a structure. ********************************************************************/ -BOOL spoolss_io_q_enumprinterdataex(char *desc, SPOOL_Q_ENUMPRINTERDATAEX *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_enumprinterdataex(const char *desc, SPOOL_Q_ENUMPRINTERDATAEX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdataex"); depth++; @@ -7232,7 +7233,7 @@ BOOL spoolss_io_q_enumprinterdataex(char *desc, SPOOL_Q_ENUMPRINTERDATAEX *q_u, /******************************************************************* ********************************************************************/ -static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, +static BOOL spoolss_io_printer_enum_values_ctr(const char *desc, prs_struct *ps, PRINTER_ENUM_VALUES_CTR *ctr, int depth) { int i; @@ -7315,7 +7316,7 @@ static BOOL spoolss_io_printer_enum_values_ctr(char *desc, prs_struct *ps, * write a structure. ********************************************************************/ -BOOL spoolss_io_r_enumprinterdataex(char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_enumprinterdataex(const char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, prs_struct *ps, int depth) { uint32 data_offset, end_offset; prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdataex"); @@ -7392,7 +7393,7 @@ BOOL make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTOR return True; } -BOOL spoolss_io_q_getprintprocessordirectory(char *desc, SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, prs_struct *ps, int depth) +BOOL spoolss_io_q_getprintprocessordirectory(const char *desc, SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, prs_struct *ps, int depth) { uint32 ptr; @@ -7444,7 +7445,7 @@ BOOL spoolss_io_q_getprintprocessordirectory(char *desc, SPOOL_Q_GETPRINTPROCESS * write a structure. ********************************************************************/ -BOOL spoolss_io_r_getprintprocessordirectory(char *desc, SPOOL_R_GETPRINTPROCESSORDIRECTORY *r_u, prs_struct *ps, int depth) +BOOL spoolss_io_r_getprintprocessordirectory(const char *desc, SPOOL_R_GETPRINTPROCESSORDIRECTORY *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getprintprocessordirectory"); depth++; @@ -7467,7 +7468,7 @@ BOOL spoolss_io_r_getprintprocessordirectory(char *desc, SPOOL_R_GETPRINTPROCESS return True; } -BOOL smb_io_printprocessordirectory_1(char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR_DIRECTORY_1 *info, int depth) +BOOL smb_io_printprocessordirectory_1(const char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR_DIRECTORY_1 *info, int depth) { prs_struct *ps=&buffer->prs; diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index b3d33645b9..bfa1a13be9 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -32,7 +32,7 @@ Inits a SH_INFO_0_STR structure ********************************************************************/ -void init_srv_share_info0_str(SH_INFO_0_STR *sh0, char *net_name) +void init_srv_share_info0_str(SH_INFO_0_STR *sh0, const char *net_name) { DEBUG(5,("init_srv_share_info0_str\n")); @@ -44,7 +44,7 @@ void init_srv_share_info0_str(SH_INFO_0_STR *sh0, char *net_name) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info0_str(char *desc, SH_INFO_0_STR *sh0, prs_struct *ps, int depth) +static BOOL srv_io_share_info0_str(const char *desc, SH_INFO_0_STR *sh0, prs_struct *ps, int depth) { if (sh0 == NULL) return False; @@ -65,7 +65,7 @@ static BOOL srv_io_share_info0_str(char *desc, SH_INFO_0_STR *sh0, prs_struct *p makes a SH_INFO_0 structure ********************************************************************/ -void init_srv_share_info0(SH_INFO_0 *sh0, char *net_name) +void init_srv_share_info0(SH_INFO_0 *sh0, const char *net_name) { DEBUG(5,("init_srv_share_info0: %s\n", net_name)); @@ -76,7 +76,7 @@ void init_srv_share_info0(SH_INFO_0 *sh0, char *net_name) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info0(char *desc, SH_INFO_0 *sh0, prs_struct *ps, int depth) +static BOOL srv_io_share_info0(const char *desc, SH_INFO_0 *sh0, prs_struct *ps, int depth) { if (sh0 == NULL) return False; @@ -97,7 +97,7 @@ static BOOL srv_io_share_info0(char *desc, SH_INFO_0 *sh0, prs_struct *ps, int d Inits a SH_INFO_1_STR structure ********************************************************************/ -void init_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark) +void init_srv_share_info1_str(SH_INFO_1_STR *sh1, const char *net_name, const char *remark) { DEBUG(5,("init_srv_share_info1_str\n")); @@ -111,7 +111,7 @@ void init_srv_share_info1_str(SH_INFO_1_STR *sh1, char *net_name, char *remark) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth) +static BOOL srv_io_share_info1_str(const char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth) { if (sh1 == NULL) return False; @@ -140,7 +140,7 @@ static BOOL srv_io_share_info1_str(char *desc, SH_INFO_1_STR *sh1, prs_struct *p makes a SH_INFO_1 structure ********************************************************************/ -void init_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *remark) +void init_srv_share_info1(SH_INFO_1 *sh1, const char *net_name, uint32 type, const char *remark) { DEBUG(5,("init_srv_share_info1: %s %8x %s\n", net_name, type, remark)); @@ -153,7 +153,7 @@ void init_srv_share_info1(SH_INFO_1 *sh1, char *net_name, uint32 type, char *rem Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) +static BOOL srv_io_share_info1(const char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) { if (sh1 == NULL) return False; @@ -179,8 +179,8 @@ static BOOL srv_io_share_info1(char *desc, SH_INFO_1 *sh1, prs_struct *ps, int d ********************************************************************/ void init_srv_share_info2_str(SH_INFO_2_STR *sh2, - char *net_name, char *remark, - char *path, char *passwd) + const char *net_name, const char *remark, + const char *path, const char *passwd) { DEBUG(5,("init_srv_share_info2_str\n")); @@ -198,7 +198,7 @@ void init_srv_share_info2_str(SH_INFO_2_STR *sh2, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) +static BOOL srv_io_share_info2_str(const char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) { if (sh2 == NULL) return False; @@ -236,9 +236,9 @@ static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2 ********************************************************************/ void init_srv_share_info2(SH_INFO_2 *sh2, - char *net_name, uint32 type, char *remark, + const char *net_name, uint32 type, const char *remark, uint32 perms, uint32 max_uses, uint32 num_uses, - char *path, char *passwd) + const char *path, const char *passwd) { DEBUG(5,("init_srv_share_info2: %s %8x %s\n", net_name, type, remark)); @@ -256,7 +256,7 @@ void init_srv_share_info2(SH_INFO_2 *sh2, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) +static BOOL srv_io_share_info2(const char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) { if (sh2 == NULL) return False; @@ -292,7 +292,7 @@ static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int d ********************************************************************/ void init_srv_share_info501_str(SH_INFO_501_STR *sh501, - char *net_name, char *remark) + const char *net_name, const char *remark) { DEBUG(5,("init_srv_share_info501_str\n")); @@ -306,7 +306,7 @@ void init_srv_share_info501_str(SH_INFO_501_STR *sh501, Inits a SH_INFO_2 structure *******************************************************************/ -void init_srv_share_info501(SH_INFO_501 *sh501, char *net_name, uint32 type, char *remark, uint32 csc_policy) +void init_srv_share_info501(SH_INFO_501 *sh501, const char *net_name, uint32 type, const char *remark, uint32 csc_policy) { DEBUG(5,("init_srv_share_info501: %s %8x %s %08x\n", net_name, type, remark, csc_policy)); @@ -323,7 +323,7 @@ void init_srv_share_info501(SH_INFO_501 *sh501, char *net_name, uint32 type, cha Reads of writes a structure. *******************************************************************/ -static BOOL srv_io_share_info501(char *desc, SH_INFO_501 *sh501, prs_struct *ps, int depth) +static BOOL srv_io_share_info501(const char *desc, SH_INFO_501 *sh501, prs_struct *ps, int depth) { if (sh501 == NULL) return False; @@ -350,7 +350,7 @@ static BOOL srv_io_share_info501(char *desc, SH_INFO_501 *sh501, prs_struct *ps, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info501_str(char *desc, SH_INFO_501_STR *sh501, prs_struct *ps, int depth) +static BOOL srv_io_share_info501_str(const char *desc, SH_INFO_501_STR *sh501, prs_struct *ps, int depth) { if (sh501 == NULL) return False; @@ -376,9 +376,9 @@ static BOOL srv_io_share_info501_str(char *desc, SH_INFO_501_STR *sh501, prs_str ********************************************************************/ void init_srv_share_info502(SH_INFO_502 *sh502, - const char *net_name, uint32 type, char *remark, + const char *net_name, uint32 type, const char *remark, uint32 perms, uint32 max_uses, uint32 num_uses, - char *path, char *passwd, SEC_DESC *psd, size_t sd_size) + const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size) { DEBUG(5,("init_srv_share_info502: %s %8x %s\n", net_name, type, remark)); @@ -401,7 +401,7 @@ void init_srv_share_info502(SH_INFO_502 *sh502, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info502(char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth) +static BOOL srv_io_share_info502(const char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth) { if (sh502 == NULL) return False; @@ -441,8 +441,8 @@ static BOOL srv_io_share_info502(char *desc, SH_INFO_502 *sh502, prs_struct *ps, ********************************************************************/ void init_srv_share_info502_str(SH_INFO_502_STR *sh502str, - char *net_name, char *remark, - char *path, char *passwd, SEC_DESC *psd, size_t sd_size) + const char *net_name, const char *remark, + const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size) { DEBUG(5,("init_srv_share_info502_str\n")); @@ -463,7 +463,7 @@ void init_srv_share_info502_str(SH_INFO_502_STR *sh502str, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info502_str(char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth) +static BOOL srv_io_share_info502_str(const char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth) { if (sh502 == NULL) return False; @@ -547,7 +547,7 @@ static BOOL srv_io_share_info502_str(char *desc, SH_INFO_502_STR *sh502, prs_str Inits a SH_INFO_1004_STR structure ********************************************************************/ -void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, char *remark) +void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, const char *remark) { DEBUG(5,("init_srv_share_info1004_str\n")); @@ -559,7 +559,7 @@ void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, char *remark) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1004_str(char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth) +static BOOL srv_io_share_info1004_str(const char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth) { if (sh1004 == NULL) return False; @@ -580,7 +580,7 @@ static BOOL srv_io_share_info1004_str(char *desc, SH_INFO_1004_STR *sh1004, prs_ makes a SH_INFO_1004 structure ********************************************************************/ -void init_srv_share_info1004(SH_INFO_1004 *sh1004, char *remark) +void init_srv_share_info1004(SH_INFO_1004 *sh1004, const char *remark) { DEBUG(5,("init_srv_share_info1004: %s\n", remark)); @@ -591,7 +591,7 @@ void init_srv_share_info1004(SH_INFO_1004 *sh1004, char *remark) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1004(char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth) +static BOOL srv_io_share_info1004(const char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth) { if (sh1004 == NULL) return False; @@ -612,7 +612,7 @@ static BOOL srv_io_share_info1004(char *desc, SH_INFO_1004 *sh1004, prs_struct * Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth) +static BOOL srv_io_share_info1005(const char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth) { if(sh1005 == NULL) return False; @@ -633,7 +633,7 @@ static BOOL srv_io_share_info1005(char* desc, SRV_SHARE_INFO_1005* sh1005, prs_s Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1006(char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth) +static BOOL srv_io_share_info1006(const char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth) { if(sh1006 == NULL) return False; @@ -666,7 +666,7 @@ void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1007_str(char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth) +static BOOL srv_io_share_info1007_str(const char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth) { if (sh1007 == NULL) return False; @@ -699,7 +699,7 @@ void init_srv_share_info1007(SH_INFO_1007 *sh1007, uint32 flags, const char *alt Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1007(char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth) +static BOOL srv_io_share_info1007(const char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth) { if (sh1007 == NULL) return False; @@ -722,7 +722,7 @@ static BOOL srv_io_share_info1007(char *desc, SH_INFO_1007 *sh1007, prs_struct * Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1501(char* desc, SRV_SHARE_INFO_1501* sh1501, +static BOOL srv_io_share_info1501(const char* desc, SRV_SHARE_INFO_1501* sh1501, prs_struct* ps, int depth) { if(sh1501 == NULL) @@ -744,7 +744,7 @@ static BOOL srv_io_share_info1501(char* desc, SRV_SHARE_INFO_1501* sh1501, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return False; @@ -1045,7 +1045,7 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct ********************************************************************/ void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, - char *srv_name, uint32 info_level, + const char *srv_name, uint32 info_level, uint32 preferred_len, ENUM_HND *hnd) { @@ -1067,7 +1067,7 @@ void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_share_enum(const char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1102,7 +1102,7 @@ BOOL srv_io_q_net_share_enum(char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct * Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_share_enum(const char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -1151,7 +1151,7 @@ BOOL init_srv_q_net_share_get_info(SRV_Q_NET_SHARE_GET_INFO *q_n, const char *sr Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_share_get_info(char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_share_get_info(const char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1183,7 +1183,7 @@ BOOL srv_io_q_net_share_get_info(char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_ Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n) +static BOOL srv_io_srv_share_info(const char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n) { if (r_n == NULL) return False; @@ -1294,7 +1294,7 @@ static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHA Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_share_get_info(const char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -1349,7 +1349,7 @@ BOOL init_srv_q_net_share_set_info(SRV_Q_NET_SHARE_SET_INFO *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_share_set_info(char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_share_set_info(const char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1396,7 +1396,7 @@ BOOL srv_io_q_net_share_set_info(char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_ Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_share_set_info(const char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -1427,7 +1427,7 @@ BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_ Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_share_add(char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_share_add(const char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1467,10 +1467,10 @@ BOOL srv_io_q_net_share_add(char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps return True; } -void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, char *srvname, - char *netname, uint32 type, char *remark, +void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname, + const char *netname, uint32 type, const char *remark, uint32 perms, uint32 max_uses, uint32 num_uses, - char *path, char *passwd) + const char *path, const char *passwd) { q->ptr_srv_name = 1; init_unistr2(&q->uni_srv_name, srvname, strlen(srvname) +1); @@ -1490,7 +1490,7 @@ void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, char *srvname, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_share_add(const char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -1532,7 +1532,7 @@ void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_share_del(char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_share_del(const char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1563,7 +1563,7 @@ BOOL srv_io_q_net_share_del(char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_del(char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_share_del(const char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1584,7 +1584,7 @@ BOOL srv_io_r_net_share_del(char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps Inits a SESS_INFO_0_STR structure ********************************************************************/ -void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name) +void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, const char *name) { DEBUG(5,("init_srv_sess_info0_str\n")); @@ -1595,7 +1595,7 @@ void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth) +static BOOL srv_io_sess_info0_str(const char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return False; @@ -1616,7 +1616,7 @@ static BOOL srv_io_sess_info0_str(char *desc, SESS_INFO_0_STR *ss0, prs_struct Inits a SESS_INFO_0 structure ********************************************************************/ -void init_srv_sess_info0(SESS_INFO_0 *ss0, char *name) +void init_srv_sess_info0(SESS_INFO_0 *ss0, const char *name) { DEBUG(5,("init_srv_sess_info0: %s\n", name)); @@ -1627,7 +1627,7 @@ void init_srv_sess_info0(SESS_INFO_0 *ss0, char *name) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth) +static BOOL srv_io_sess_info0(const char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return False; @@ -1648,7 +1648,7 @@ static BOOL srv_io_sess_info0(char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth) +static BOOL srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return False; @@ -1698,7 +1698,7 @@ static BOOL srv_io_srv_sess_info_0(char *desc, SRV_SESS_INFO_0 *ss0, prs_struct Inits a SESS_INFO_1_STR structure ********************************************************************/ -void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user) +void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, const char *name, const char *user) { DEBUG(5,("init_srv_sess_info1_str\n")); @@ -1710,7 +1710,7 @@ void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth) +static BOOL srv_io_sess_info1_str(const char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -1734,7 +1734,7 @@ static BOOL srv_io_sess_info1_str(char *desc, SESS_INFO_1_STR *ss1, prs_struct * ********************************************************************/ void init_srv_sess_info1(SESS_INFO_1 *ss1, - char *name, char *user, + const char *name, const char *user, uint32 num_opens, uint32 open_time, uint32 idle_time, uint32 user_flags) { @@ -1753,7 +1753,7 @@ void init_srv_sess_info1(SESS_INFO_1 *ss1, reads or writes a structure. ********************************************************************/ -static BOOL srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth) +static BOOL srv_io_sess_info1(const char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -1785,7 +1785,7 @@ static BOOL srv_io_sess_info1(char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth) +static BOOL srv_io_srv_sess_info_1(const char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -1835,7 +1835,7 @@ static BOOL srv_io_srv_sess_info_1(char *desc, SRV_SESS_INFO_1 *ss1, prs_struct Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth) { SRV_SESS_INFO_CTR *ctr = *pp_ctr; @@ -1884,8 +1884,8 @@ static BOOL srv_io_srv_sess_ctr(char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_stru ********************************************************************/ void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, - char *srv_name, char *qual_name, - char *user_name, uint32 sess_level, + const char *srv_name, const char *qual_name, + const char *user_name, uint32 sess_level, SRV_SESS_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) { @@ -1907,7 +1907,7 @@ void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1962,7 +1962,7 @@ BOOL srv_io_q_net_sess_enum(char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_sess_enum(const char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -2006,7 +2006,7 @@ void init_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth) +static BOOL srv_io_conn_info0(const char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return False; @@ -2027,7 +2027,7 @@ static BOOL srv_io_conn_info0(char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth) +static BOOL srv_io_srv_conn_info_0(const char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return False; @@ -2070,7 +2070,7 @@ static BOOL srv_io_srv_conn_info_0(char *desc, SRV_CONN_INFO_0 *ss0, prs_struct Inits a CONN_INFO_1_STR structure ********************************************************************/ -void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_name) +void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, const char *usr_name, const char *net_name) { DEBUG(5,("init_srv_conn_info1_str\n")); @@ -2082,7 +2082,7 @@ void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, char *usr_name, char *net_nam Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth) +static BOOL srv_io_conn_info1_str(const char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -2108,7 +2108,7 @@ static BOOL srv_io_conn_info1_str(char *desc, CONN_INFO_1_STR *ss1, prs_struct * void init_srv_conn_info1(CONN_INFO_1 *ss1, uint32 id, uint32 type, uint32 num_opens, uint32 num_users, uint32 open_time, - char *usr_name, char *net_name) + const char *usr_name, const char *net_name) { DEBUG(5,("init_srv_conn_info1: %s %s\n", usr_name, net_name)); @@ -2126,7 +2126,7 @@ void init_srv_conn_info1(CONN_INFO_1 *ss1, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth) +static BOOL srv_io_conn_info1(const char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -2160,7 +2160,7 @@ static BOOL srv_io_conn_info1(char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth) +static BOOL srv_io_srv_conn_info_1(const char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -2208,7 +2208,7 @@ static BOOL srv_io_srv_conn_info_1(char *desc, SRV_CONN_INFO_1 *ss1, prs_struct Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_conn_ctr(const char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth) { SRV_CONN_INFO_CTR *ctr = *pp_ctr; @@ -2257,7 +2257,7 @@ static BOOL srv_io_srv_conn_ctr(char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_stru ********************************************************************/ void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, - char *srv_name, char *qual_name, + const char *srv_name, const char *qual_name, uint32 conn_level, SRV_CONN_INFO_CTR *ctr, uint32 preferred_len, ENUM_HND *hnd) @@ -2279,7 +2279,7 @@ void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_conn_enum(const char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -2327,7 +2327,7 @@ BOOL srv_io_q_net_conn_enum(char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -2360,7 +2360,7 @@ BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *p Inits a FILE_INFO_3_STR structure ********************************************************************/ -void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_name) +void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, const char *user_name, const char *path_name) { DEBUG(5,("init_srv_file_info3_str\n")); @@ -2372,7 +2372,7 @@ void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, char *user_name, char *path_n Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth) +static BOOL srv_io_file_info3_str(const char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth) { if (sh1 == NULL) return False; @@ -2397,7 +2397,7 @@ static BOOL srv_io_file_info3_str(char *desc, FILE_INFO_3_STR *sh1, prs_struct * void init_srv_file_info3(FILE_INFO_3 *fl3, uint32 id, uint32 perms, uint32 num_locks, - char *path_name, char *user_name) + const char *path_name, const char *user_name) { DEBUG(5,("init_srv_file_info3: %s %s\n", path_name, user_name)); @@ -2413,7 +2413,7 @@ void init_srv_file_info3(FILE_INFO_3 *fl3, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) +static BOOL srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) { if (fl3 == NULL) return False; @@ -2442,7 +2442,7 @@ static BOOL srv_io_file_info3(char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return False; @@ -2536,7 +2536,7 @@ void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -2591,7 +2591,7 @@ BOOL srv_io_q_net_file_enum(char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -2623,7 +2623,7 @@ BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps /******************************************************************* Initialize a net file close request ********************************************************************/ -void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, char *server, +void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, const char *server, uint32 file_id) { q_n->ptr_srv_name = 1; @@ -2634,7 +2634,7 @@ void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, char *server, /******************************************************************* Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_file_close(char *desc, SRV_Q_NET_FILE_CLOSE *q_n, +BOOL srv_io_q_net_file_close(const char *desc, SRV_Q_NET_FILE_CLOSE *q_n, prs_struct *ps, int depth) { if (q_n == NULL) @@ -2664,7 +2664,7 @@ BOOL srv_io_q_net_file_close(char *desc, SRV_Q_NET_FILE_CLOSE *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_file_close(char *desc, SRV_R_NET_FILE_CLOSE *q_n, +BOOL srv_io_r_net_file_close(const char *desc, SRV_R_NET_FILE_CLOSE *q_n, prs_struct *ps, int depth) { if (q_n == NULL) @@ -2698,7 +2698,7 @@ void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, const char *name Reads or writes a SRV_INFO_101 structure. ********************************************************************/ -static BOOL srv_io_info_100(char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth) +static BOOL srv_io_info_100(const char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth) { if (sv100 == NULL) return False; @@ -2743,7 +2743,7 @@ void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, const char *name Reads or writes a SRV_INFO_101 structure. ********************************************************************/ -static BOOL srv_io_info_101(char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth) +static BOOL srv_io_info_101(const char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth) { if (sv101 == NULL) return False; @@ -2813,7 +2813,7 @@ void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, const char *name Reads or writes a SRV_INFO_102 structure. ********************************************************************/ -static BOOL srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth) +static BOOL srv_io_info_102(const char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth) { if (sv102 == NULL) return False; @@ -2872,7 +2872,7 @@ static BOOL srv_io_info_102(char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int Reads or writes a SRV_INFO_102 structure. ********************************************************************/ -static BOOL srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) +static BOOL srv_io_info_ctr(const char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return False; @@ -2919,7 +2919,7 @@ static BOOL srv_io_info_ctr(char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int d ********************************************************************/ void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv, - char *server_name, uint32 switch_value) + const char *server_name, uint32 switch_value) { DEBUG(5,("init_srv_q_net_srv_get_info\n")); @@ -2932,7 +2932,7 @@ void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_srv_get_info(const char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -2996,7 +2996,7 @@ void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_srv_set_info(char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, +BOOL srv_io_q_net_srv_set_info(const char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info"); @@ -3034,7 +3034,7 @@ BOOL srv_io_q_net_srv_set_info(char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_srv_get_info(const char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -3058,7 +3058,7 @@ BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_stru Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_srv_set_info(char *desc, SRV_R_NET_SRV_SET_INFO *r_n, +BOOL srv_io_r_net_srv_set_info(const char *desc, SRV_R_NET_SRV_SET_INFO *r_n, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "srv_io_r_net_srv_set_info"); @@ -3080,7 +3080,7 @@ BOOL srv_io_r_net_srv_set_info(char *desc, SRV_R_NET_SRV_SET_INFO *r_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_remote_tod(const char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -3103,7 +3103,7 @@ BOOL srv_io_q_net_remote_tod(char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct * Reads or writes a TIME_OF_DAY_INFO structure. ********************************************************************/ -static BOOL srv_io_time_of_day_info(char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth) +static BOOL srv_io_time_of_day_info(const char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth) { if (tod == NULL) return False; @@ -3172,7 +3172,7 @@ void init_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_remote_tod(const char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -3224,7 +3224,7 @@ BOOL init_srv_q_net_disk_enum(SRV_Q_NET_DISK_ENUM *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_disk_enum(char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_disk_enum(const char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -3268,7 +3268,7 @@ BOOL srv_io_q_net_disk_enum(char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_disk_enum(char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth) { int i; @@ -3357,7 +3357,7 @@ BOOL init_srv_q_net_name_validate(SRV_Q_NET_NAME_VALIDATE *q_n, const char *srv_ Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_name_validate(char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_name_validate(const char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -3396,7 +3396,7 @@ BOOL srv_io_q_net_name_validate(char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_st Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_name_validate(char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_name_validate(const char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -3417,7 +3417,7 @@ BOOL srv_io_r_net_name_validate(char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_st Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_file_query_secdesc(char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_file_query_secdesc(const char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -3465,7 +3465,7 @@ BOOL srv_io_q_net_file_query_secdesc(char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_file_query_secdesc(char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_file_query_secdesc(const char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -3504,7 +3504,7 @@ BOOL srv_io_r_net_file_query_secdesc(char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_file_set_secdesc(char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_file_set_secdesc(const char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -3561,7 +3561,7 @@ BOOL srv_io_q_net_file_set_secdesc(char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_file_set_secdesc(char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth) +BOOL srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -3582,7 +3582,7 @@ BOOL srv_io_r_net_file_set_secdesc(char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, Inits a structure ********************************************************************/ -void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, char *server) +void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server) { q_u->ptr_srv_name = 1; init_unistr2(&q_u->uni_srv_name, server, strlen(server) + 1); diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c index 7b8fd76b7b..b6de058652 100644 --- a/source3/rpc_parse/parse_wks.c +++ b/source3/rpc_parse/parse_wks.c @@ -42,7 +42,7 @@ void init_wks_q_query_info(WKS_Q_QUERY_INFO *q_u, Reads or writes a WKS_Q_QUERY_INFO structure. ********************************************************************/ -BOOL wks_io_q_query_info(char *desc, WKS_Q_QUERY_INFO *q_u, prs_struct *ps, int depth) +BOOL wks_io_q_query_info(const char *desc, WKS_Q_QUERY_INFO *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -90,7 +90,7 @@ void init_wks_info_100(WKS_INFO_100 *inf, Reads or writes a WKS_INFO_100 structure. ********************************************************************/ -static BOOL wks_io_wks_info_100(char *desc, WKS_INFO_100 *inf, prs_struct *ps, int depth) +static BOOL wks_io_wks_info_100(const char *desc, WKS_INFO_100 *inf, prs_struct *ps, int depth) { if (inf == NULL) return False; @@ -150,7 +150,7 @@ void init_wks_r_query_info(WKS_R_QUERY_INFO *r_u, Reads or writes a structure. ********************************************************************/ -BOOL wks_io_r_query_info(char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int depth) +BOOL wks_io_r_query_info(const char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; -- cgit From 1bb969520392ea41b1c6841af2164bbca01381fe Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 4 Jan 2003 08:44:05 +0000 Subject: Missed from previous commit - merge from HEAD the changes to the remote shutdown struct - it's 2 byte-boolean flags, not 16 bits. (This used to be commit b5962833527787b0cb3f3904422f252e8d74f40d) --- source3/rpc_parse/parse_reg.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 712d38da2b..456fad69b4 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1736,8 +1736,8 @@ BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *p /******************************************************************* Inits a structure. ********************************************************************/ -void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, - const char *msg, uint32 timeout, uint16 flags) +void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, const char *msg, + uint32 timeout, BOOL reboot, BOOL force) { int msg_len; msg_len = strlen(msg); @@ -1750,7 +1750,9 @@ void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, init_unistr2(&(q_s->uni_msg), msg, msg_len); q_s->timeout = timeout; - q_s->flags = flags; + + q_s->reboot = reboot ? 1 : 0; + q_s->force = force ? 1 : 0; } @@ -1785,7 +1787,9 @@ BOOL reg_io_q_shutdown(const char *desc, REG_Q_SHUTDOWN * q_s, prs_struct *ps, if (!prs_uint32("timeout", ps, depth, &(q_s->timeout))) return False; - if (!prs_uint16("flags ", ps, depth, &(q_s->flags))) + if (!prs_uint8("force ", ps, depth, &(q_s->force))) + return False; + if (!prs_uint8("reboot ", ps, depth, &(q_s->reboot))) return False; return True; -- cgit From baa1276eb0adfef420b0e9bb4a9365c397ef9d84 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 9 Jan 2003 05:50:15 +0000 Subject: Remove dead function. (This used to be commit 6ed4d80baa5ff529bb0a06d7e52528b307ca4a0c) --- source3/rpc_parse/parse_prs.c | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 63f9527dec..6f6117a9e2 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -115,25 +115,6 @@ BOOL prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, BOOL io) return True; } -/******************************************************************* - read from a socket into memory. - ********************************************************************/ -BOOL prs_read(prs_struct *ps, int fd, size_t len, int timeout) -{ - BOOL ok; - size_t prev_size = ps->buffer_size; - if (!prs_grow(ps, len)) - return False; - - if (timeout > 0) { - ok = (read_with_timeout(fd, &ps->data_p[prev_size], - len, len,timeout) == len); - } else { - ok = (read_data(fd, &ps->data_p[prev_size], len) == len); - } - return ok; -} - /******************************************************************* Delete the memory in a parse structure - if we own it. ********************************************************************/ -- cgit From 16925589eb1f12ebe6e493774fd4306a827feb73 Mon Sep 17 00:00:00 2001 From: Richard Sharpe Date: Mon, 13 Jan 2003 20:04:40 +0000 Subject: Now that I am running config.developer, I decided to get rif of some warnings: 1. reboot in parse_reg and cli_reg was shadowing a definition on FreeBSD 4.3 from system includes. 2. Added a bit of const to places. 3. Made sure internal functions were declared where needed. (This used to be commit fd847aa93690eb72f0437a8d22c03b222eb2a016) --- source3/rpc_parse/parse_reg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 456fad69b4..b4d20bf2ba 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1737,7 +1737,7 @@ BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *p Inits a structure. ********************************************************************/ void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, const char *msg, - uint32 timeout, BOOL reboot, BOOL force) + uint32 timeout, BOOL do_reboot, BOOL force) { int msg_len; msg_len = strlen(msg); @@ -1751,7 +1751,7 @@ void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, const char *msg, q_s->timeout = timeout; - q_s->reboot = reboot ? 1 : 0; + q_s->reboot = do_reboot ? 1 : 0; q_s->force = force ? 1 : 0; } -- cgit From 5bbac9dd802cc7a5a5b8a3c6edc4f1cee90c9de7 Mon Sep 17 00:00:00 2001 From: Richard Sharpe Date: Mon, 13 Jan 2003 20:30:28 +0000 Subject: Make sure that those cleanups actually went in. (This used to be commit 9a38e378115a1c36d0cd7c41f4c5767c23b4eb3f) --- source3/rpc_parse/parse_reg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 456fad69b4..bb9bda5cc2 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1737,7 +1737,7 @@ BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *p Inits a structure. ********************************************************************/ void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, const char *msg, - uint32 timeout, BOOL reboot, BOOL force) + uint32 timeout, BOOL do_reboot, BOOL force) { int msg_len; msg_len = strlen(msg); @@ -1751,7 +1751,7 @@ void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, const char *msg, q_s->timeout = timeout; - q_s->reboot = reboot ? 1 : 0; + q_s->do_reboot = reboot ? 1 : 0; q_s->force = force ? 1 : 0; } -- cgit From 5368372382671c9b5f7d3e8450ed30af31c0ffc4 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 13 Jan 2003 21:48:52 +0000 Subject: Fix typo, and the build. (This used to be commit d7452e73b511ceaebfaed66c18e7c61cbe0289d2) --- source3/rpc_parse/parse_reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index bb9bda5cc2..b4d20bf2ba 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1751,7 +1751,7 @@ void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, const char *msg, q_s->timeout = timeout; - q_s->do_reboot = reboot ? 1 : 0; + q_s->reboot = do_reboot ? 1 : 0; q_s->force = force ? 1 : 0; } -- cgit From eb6312af9fcf91b7709af50b499bc3b01eddeee5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 15 Jan 2003 07:40:40 +0000 Subject: added cli_lsa_enum_account_rights() call. Note that this is in principal similar to the existing cli_lsa_enum_privsaccount() call, except that cli_lsa_enum_account_rights() doesn't require a call to open_account first. There is also the minor matter that cli_lsa_enum_account_rights() works whereas cli_lsa_enum_privsaccount() doesn't! this call can be used to find what privileges an account or group has. This is a first step towards proper privileges support in Samba. (This used to be commit 65bac11d716f873dcdbda528313c33634c26a072) --- source3/rpc_parse/parse_lsa.c | 60 ++++++++++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_misc.c | 49 ++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 56398e7cf0..7c9f74da37 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2236,3 +2236,63 @@ BOOL lsa_io_r_query_info2(const char *desc, LSA_R_QUERY_INFO2 *r_c, return True; } + + +/******************************************************************* + Inits an LSA_Q_ENUM_ACCT_RIGHTS structure. +********************************************************************/ +void init_q_enum_acct_rights(LSA_Q_ENUM_ACCT_RIGHTS *q_q, + POLICY_HND *hnd, + uint32 count, + DOM_SID *sid) +{ + DEBUG(5, ("init_q_enum_acct_rights\n")); + + q_q->pol = *hnd; + q_q->count = count; + q_q->sid = *sid; +} + +/******************************************************************* +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 *q_q, prs_struct *ps, int depth) +{ + if (q_q == NULL) + return False; + + prs_debug(ps, depth, desc, "lsa_io_q_enum_acct_rights"); + depth++; + + if (!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + return False; + + if(!prs_uint32("count ", ps, depth, &q_q->count)) + return False; + + if(!smb_io_dom_sid("sid", &q_q->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 *r_c, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_r_enum_acct_rights"); + depth++; + + if(!prs_uint32("count ", ps, depth, &r_c->count)) + return False; + + if(!smb_io_unistr_array("rights", &r_c->rights, ps, depth)) + return False; + + if(!prs_ntstatus("status", ps, depth, &r_c->status)) + return False; + + return True; +} diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index a9157e29b6..9d3bd6f28a 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1042,6 +1042,55 @@ BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct * return True; } + +/******************************************************************* + Reads or writes a UNISTR_ARRAY structure. +********************************************************************/ +BOOL smb_io_unistr_array(const char *desc, UNISTR_ARRAY *array, prs_struct *ps, int depth) +{ + int i; + + depth++; + + array->count = 0; + + if(!prs_uint32("ref_id", ps, depth, &array->ref_id)) + return False; + + if (! array->ref_id) { + return True; + } + + if(!prs_uint32("count", ps, depth, &array->count)) + return False; + + if (array->count == 0) { + return True; + } + + array->strings = talloc_zero(get_talloc_ctx(), array->count * sizeof(array->strings[0])); + if (! array->strings) { + return False; + } + + for (i=0;icount;i++) { + if(!prs_uint16("length", ps, depth, &array->strings[i].length)) + return False; + if(!prs_uint16("size", ps, depth, &array->strings[i].size)) + return False; + if(!prs_uint32("ref_id", ps, depth, &array->strings[i].ref_id)) + return False; + } + + for (i=0;icount;i++) { + if (! smb_io_unistr2("string", &array->strings[i].string, array->strings[i].ref_id, ps, depth)) + return False; + } + + return True; +} + + /******************************************************************* Inits a DOM_RID2 structure. ********************************************************************/ -- cgit From 4242eda183393b0535ac8ef880b4f441c60137af Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 15 Jan 2003 17:22:48 +0000 Subject: merging some rpcclient and net functionality from HEAD (This used to be commit 7a4c87484237308cb3ad0d671687da7e0f6e733b) --- source3/rpc_parse/parse_lsa.c | 60 ++++++++++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_misc.c | 49 ++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_prs.c | 19 ------------- 3 files changed, 109 insertions(+), 19 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 56398e7cf0..7c9f74da37 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2236,3 +2236,63 @@ BOOL lsa_io_r_query_info2(const char *desc, LSA_R_QUERY_INFO2 *r_c, return True; } + + +/******************************************************************* + Inits an LSA_Q_ENUM_ACCT_RIGHTS structure. +********************************************************************/ +void init_q_enum_acct_rights(LSA_Q_ENUM_ACCT_RIGHTS *q_q, + POLICY_HND *hnd, + uint32 count, + DOM_SID *sid) +{ + DEBUG(5, ("init_q_enum_acct_rights\n")); + + q_q->pol = *hnd; + q_q->count = count; + q_q->sid = *sid; +} + +/******************************************************************* +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 *q_q, prs_struct *ps, int depth) +{ + if (q_q == NULL) + return False; + + prs_debug(ps, depth, desc, "lsa_io_q_enum_acct_rights"); + depth++; + + if (!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + return False; + + if(!prs_uint32("count ", ps, depth, &q_q->count)) + return False; + + if(!smb_io_dom_sid("sid", &q_q->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 *r_c, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_r_enum_acct_rights"); + depth++; + + if(!prs_uint32("count ", ps, depth, &r_c->count)) + return False; + + if(!smb_io_unistr_array("rights", &r_c->rights, ps, depth)) + return False; + + if(!prs_ntstatus("status", ps, depth, &r_c->status)) + return False; + + return True; +} diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index a9157e29b6..9d3bd6f28a 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1042,6 +1042,55 @@ BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct * return True; } + +/******************************************************************* + Reads or writes a UNISTR_ARRAY structure. +********************************************************************/ +BOOL smb_io_unistr_array(const char *desc, UNISTR_ARRAY *array, prs_struct *ps, int depth) +{ + int i; + + depth++; + + array->count = 0; + + if(!prs_uint32("ref_id", ps, depth, &array->ref_id)) + return False; + + if (! array->ref_id) { + return True; + } + + if(!prs_uint32("count", ps, depth, &array->count)) + return False; + + if (array->count == 0) { + return True; + } + + array->strings = talloc_zero(get_talloc_ctx(), array->count * sizeof(array->strings[0])); + if (! array->strings) { + return False; + } + + for (i=0;icount;i++) { + if(!prs_uint16("length", ps, depth, &array->strings[i].length)) + return False; + if(!prs_uint16("size", ps, depth, &array->strings[i].size)) + return False; + if(!prs_uint32("ref_id", ps, depth, &array->strings[i].ref_id)) + return False; + } + + for (i=0;icount;i++) { + if (! smb_io_unistr2("string", &array->strings[i].string, array->strings[i].ref_id, ps, depth)) + return False; + } + + return True; +} + + /******************************************************************* Inits a DOM_RID2 structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 63f9527dec..6f6117a9e2 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -115,25 +115,6 @@ BOOL prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, BOOL io) return True; } -/******************************************************************* - read from a socket into memory. - ********************************************************************/ -BOOL prs_read(prs_struct *ps, int fd, size_t len, int timeout) -{ - BOOL ok; - size_t prev_size = ps->buffer_size; - if (!prs_grow(ps, len)) - return False; - - if (timeout > 0) { - ok = (read_with_timeout(fd, &ps->data_p[prev_size], - len, len,timeout) == len); - } else { - ok = (read_data(fd, &ps->data_p[prev_size], len) == len); - } - return ok; -} - /******************************************************************* Delete the memory in a parse structure - if we own it. ********************************************************************/ -- cgit From ec879eacc263043409b584797d1e8c39258ba125 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 17 Jan 2003 04:58:45 +0000 Subject: This removes the 3rd argument from init_unistr2(). There were 240 calls to init_unistr2() in the code and every one of them got the 3rd argument incorrect, so I thought it best just to remove the argument. The incorrect usage was caused by callers using strlen() to determine the length of the string. The 3rd argument to init_unistr2() was supposed to be the character length, not the byte length of the string, so for non-english this could come out wrong. I also removed the bogus 'always allocate at least 256 bytes' hack. There may be some code that relies on this, but if there is then the code is broken and needs fixing. (This used to be commit b9eff31b1433c81fbff733e194914a40f25e3bda) --- source3/rpc_parse/parse_dfs.c | 20 ++++---- source3/rpc_parse/parse_lsa.c | 11 ++--- source3/rpc_parse/parse_misc.c | 59 ++++++++++++------------ source3/rpc_parse/parse_net.c | 51 ++++++++++----------- source3/rpc_parse/parse_reg.c | 18 ++++---- source3/rpc_parse/parse_samr.c | 96 +++++++++++++++++++-------------------- source3/rpc_parse/parse_spoolss.c | 70 ++++++++++++++-------------- source3/rpc_parse/parse_srv.c | 54 +++++++++++----------- 8 files changed, 185 insertions(+), 194 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index ccd6d429fa..c8774932e3 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -80,9 +80,9 @@ BOOL init_dfs_q_dfs_remove(DFS_Q_DFS_REMOVE *q_d, char *entrypath, char *servername, char *sharename) { DEBUG(5,("init_dfs_q_dfs_remove\n")); - init_unistr2(&q_d->DfsEntryPath, entrypath, strlen(entrypath)+1); - init_unistr2(&q_d->ServerName, servername, strlen(servername)+1); - init_unistr2(&q_d->ShareName, sharename, strlen(sharename)+1); + init_unistr2(&q_d->DfsEntryPath, entrypath); + init_unistr2(&q_d->ServerName, servername); + init_unistr2(&q_d->ShareName, sharename); q_d->ptr_ServerName = q_d->ptr_ShareName = 1; return True; } @@ -154,11 +154,11 @@ BOOL init_dfs_q_dfs_add(DFS_Q_DFS_ADD *q_d, char *entrypath, char *servername, { DEBUG(5,("init_dfs_q_dfs_add\n")); q_d->ptr_DfsEntryPath = q_d->ptr_ServerName = q_d->ptr_ShareName = 1; - init_unistr2(&q_d->DfsEntryPath, entrypath, strlen(entrypath)+1); - init_unistr2(&q_d->ServerName, servername, strlen(servername)+1); - init_unistr2(&q_d->ShareName, sharename, strlen(sharename)+1); + init_unistr2(&q_d->DfsEntryPath, entrypath); + init_unistr2(&q_d->ServerName, servername); + init_unistr2(&q_d->ShareName, sharename); if(comment != NULL) { - init_unistr2(&q_d->Comment, comment, strlen(comment)+1); + init_unistr2(&q_d->Comment, comment); q_d->ptr_Comment = 1; } else { q_d->ptr_Comment = 0; @@ -236,9 +236,9 @@ BOOL init_dfs_q_dfs_get_info(DFS_Q_DFS_GET_INFO *q_d, char *entrypath, uint32 info_level) { DEBUG(5,("init_dfs_q2_get_info\n")); - init_unistr2(&q_d->uni_path, entrypath, strlen(entrypath)+1); - init_unistr2(&q_d->uni_server, servername, strlen(servername)+1); - init_unistr2(&q_d->uni_share, sharename, strlen(sharename)+1); + init_unistr2(&q_d->uni_path, entrypath); + init_unistr2(&q_d->uni_server, servername); + init_unistr2(&q_d->uni_share, sharename); q_d->level = info_level; q_d->ptr_server = q_d->ptr_share = 1; return True; diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 7c9f74da37..d37a27a97f 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -43,7 +43,7 @@ void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, trn->sid_name_use = sid_name_use; init_uni_hdr(&trn->hdr_name, len_name); - init_unistr2(uni_name, name, len_name); + init_unistr2(uni_name, name); trn->domain_idx = idx; } @@ -346,8 +346,7 @@ void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, const char *server_name, r_q->des_access = desired_access; - init_unistr2(&r_q->uni_server_name, server_name, - strlen(server_name) + 1); + init_unistr2(&r_q->uni_server_name, server_name); init_lsa_obj_attr(&r_q->attr, attributes, qos); } @@ -1091,7 +1090,7 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, len = strlen(names[i]); init_uni_hdr(&q_l->hdr_name[i], len); - init_unistr2(&q_l->uni_name[i], names[i], len); + init_unistr2(&q_l->uni_name[i], names[i]); } } @@ -1444,7 +1443,7 @@ void init_lsa_priv_get_dispname(LSA_Q_PRIV_GET_DISPNAME *trn, POLICY_HND *hnd, c memcpy(&trn->pol, hnd, sizeof(trn->pol)); init_uni_hdr(&trn->hdr_name, len_name); - init_unistr2(&trn->name, name, len_name); + init_unistr2(&trn->name, name); trn->lang_id = lang_id; trn->lang_id_sys = lang_id_sys; } @@ -1957,7 +1956,7 @@ void init_lsa_q_lookupprivvalue(LSA_Q_LOOKUPPRIVVALUE *trn, POLICY_HND *hnd, con len_name = 1; init_uni_hdr(&trn->hdr_right, len_name); - init_unistr2(&trn->uni2_right, name, len_name); + init_unistr2(&trn->uni2_right, name); } /******************************************************************* diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 9d3bd6f28a..020c49cba1 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -766,12 +766,12 @@ void init_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf) if (buf != NULL) { *ptr = 1; - init_unistr2(str, buf, strlen(buf)+1); + init_unistr2(str, buf); } else { *ptr = 0; - init_unistr2(str, "", 0); + init_unistr2(str, ""); } } @@ -881,37 +881,34 @@ BOOL smb_io_string2(const char *desc, STRING2 *str2, uint32 buffer, prs_struct * } /******************************************************************* - Inits a UNISTR2 structure. + Inits a UNISTR2 structure. This function used to deliberately + over-allocate to a minimum of 256 bytes. That is rather silly, and + just hides potential bugs. If you need to overallocate then don't use + this function! ********************************************************************/ - -void init_unistr2(UNISTR2 *str, const char *buf, size_t len) +void init_unistr2(UNISTR2 *str, const char *buf) { - ZERO_STRUCTP(str); + size_t len; - /* set up string lengths. */ - str->uni_max_len = (uint32)len; - str->undoc = 0; - str->uni_str_len = (uint32)len; + if (!buf) { + /* this is incorrect, but is needed to cope with some + broken code that assumes this function will always + return a valid initialised UNISTR2 */ + buf = ""; + } - if (len < MAX_UNISTRLEN) - len = MAX_UNISTRLEN; - len *= sizeof(uint16); + len = push_ucs2_talloc(get_talloc_ctx() , &str->buffer, buf); - str->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len); - if ((str->buffer == NULL) && (len > 0)) - { - smb_panic("init_unistr2: malloc fail\n"); - return; + if (len == -1) { + /* oops - we can't convert the string? */ + smb_panic("failed to convert string in init_unistr2"); } - /* - * don't move this test above ! The UNISTR2 must be initialized !!! - * jfm, 7/7/2001. - */ - if (buf==NULL) - return; - - rpcstr_push((char *)str->buffer, buf, len, STR_TERMINATE); + /* set up string lengths. Note that len is guaranteed to be a + * multiple of 2 from push_ucs2 */ + str->uni_max_len = len/2; + str->undoc = 0; + str->uni_str_len = len/2; } /** @@ -1192,14 +1189,14 @@ static void init_clnt_srv(DOM_CLNT_SRV *log, const char *logon_srv, const char * if (logon_srv != NULL) { log->undoc_buffer = 1; - init_unistr2(&log->uni_logon_srv, logon_srv, strlen(logon_srv)+1); + init_unistr2(&log->uni_logon_srv, logon_srv); } else { log->undoc_buffer = 0; } if (comp_name != NULL) { log->undoc_buffer2 = 1; - init_unistr2(&log->uni_comp_name, comp_name, strlen(comp_name)+1); + init_unistr2(&log->uni_comp_name, comp_name); } else { log->undoc_buffer2 = 0; } @@ -1253,12 +1250,12 @@ void init_log_info(DOM_LOG_INFO *log, const char *logon_srv, const char *acct_na log->undoc_buffer = 1; - init_unistr2(&log->uni_logon_srv, logon_srv, strlen(logon_srv)+1); - init_unistr2(&log->uni_acct_name, acct_name, strlen(acct_name)+1); + init_unistr2(&log->uni_logon_srv, logon_srv); + init_unistr2(&log->uni_acct_name, acct_name); log->sec_chan = sec_chan; - init_unistr2(&log->uni_comp_name, comp_name, strlen(comp_name)+1); + init_unistr2(&log->uni_comp_name, comp_name); } /******************************************************************* diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index ac21e6f2dd..859ad6b408 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -136,16 +136,15 @@ static BOOL net_io_netinfo_1(const char *desc, NETLOGON_INFO_1 *info, prs_struct static void init_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, uint32 tc_status, const char *trusted_dc_name) { - int len_dc_name = strlen(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, len_dc_name+1); + init_unistr2(&info->uni_trusted_dc_name, trusted_dc_name); else - init_unistr2(&info->uni_trusted_dc_name, "", 1); + init_unistr2(&info->uni_trusted_dc_name, ""); } /******************************************************************* @@ -230,7 +229,7 @@ void init_net_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, const char *srv_name, q_l->query_level = query_level; q_l->switch_value = 0x01; - init_unistr2(&q_l->uni_server_name, srv_name, strlen(srv_name) + 1); + init_unistr2(&q_l->uni_server_name, srv_name); } /******************************************************************* @@ -360,7 +359,7 @@ void init_net_q_logon_ctrl(NET_Q_LOGON_CTRL *q_l, const char *srv_name, q_l->function_code = 0x01; /* ??? */ q_l->query_level = query_level; - init_unistr2(&q_l->uni_server_name, srv_name, strlen(srv_name) + 1); + init_unistr2(&q_l->uni_server_name, srv_name); } /******************************************************************* @@ -447,7 +446,7 @@ void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, fstring domain_name; fstrcpy(domain_name, dom_name); strupper(domain_name); - init_unistr2(&r_t->uni_trust_dom_name[i], domain_name, strlen(domain_name)+1); + init_unistr2(&r_t->uni_trust_dom_name[i], domain_name); /* the use of UNISTR2 here is non-standard. */ r_t->uni_trust_dom_name[i].undoc = 0x1; } @@ -539,8 +538,8 @@ void init_q_req_chal(NET_Q_REQ_CHAL *q_c, q_c->undoc_buffer = 1; /* don't know what this buffer is */ - init_unistr2(&q_c->uni_logon_srv, logon_srv , strlen(logon_srv )+1); - init_unistr2(&q_c->uni_logon_clnt, logon_clnt, strlen(logon_clnt)+1); + init_unistr2(&q_c->uni_logon_srv, logon_srv ); + init_unistr2(&q_c->uni_logon_clnt, logon_clnt); memcpy(q_c->clnt_chal.data, clnt_chal->data, sizeof(clnt_chal->data)); @@ -958,9 +957,9 @@ void init_id_info1(NET_ID_INFO_1 *id, const char *domain_name, init_owf_info(&id->lm_owf, lm_cypher); init_owf_info(&id->nt_owf, nt_cypher); - init_unistr2(&id->uni_domain_name, domain_name, len_domain_name); - init_unistr2(&id->uni_user_name, user_name, len_user_name); - init_unistr2(&id->uni_wksta_name, wksta_name, len_wksta_name); + init_unistr2(&id->uni_domain_name, domain_name); + init_unistr2(&id->uni_user_name, user_name); + init_unistr2(&id->uni_wksta_name, wksta_name); } /******************************************************************* @@ -1070,9 +1069,9 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, 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, len_domain_name); - init_unistr2(&id->uni_user_name, user_name, len_user_name); - init_unistr2(&id->uni_wksta_name, wksta_name, len_wksta_name); + init_unistr2(&id->uni_domain_name, domain_name); + init_unistr2(&id->uni_user_name, user_name); + init_unistr2(&id->uni_wksta_name, 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); @@ -1352,12 +1351,12 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, 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, len_user_name); - init_unistr2(&usr->uni_full_name, full_name, len_full_name); - init_unistr2(&usr->uni_logon_script, logon_script, len_logon_script); - init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path); - init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); - init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); + init_unistr2(&usr->uni_user_name, user_name); + init_unistr2(&usr->uni_full_name, full_name); + init_unistr2(&usr->uni_logon_script, logon_script); + init_unistr2(&usr->uni_profile_path, profile_path); + init_unistr2(&usr->uni_home_dir, home_dir); + init_unistr2(&usr->uni_dir_drive, dir_drive); usr->num_groups2 = num_groups; @@ -1368,8 +1367,8 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, for (i = 0; i < num_groups; i++) usr->gids[i] = gids[i]; - init_unistr2(&usr->uni_logon_srv, logon_srv, len_logon_srv); - init_unistr2(&usr->uni_logon_dom, logon_dom, len_logon_dom); + init_unistr2(&usr->uni_logon_srv, logon_srv); + init_unistr2(&usr->uni_logon_dom, logon_dom); init_dom_sid2(&usr->dom_sid, dom_sid); /* "other" sids are set up above */ @@ -1665,8 +1664,8 @@ BOOL init_net_q_sam_sync(NET_Q_SAM_SYNC * q_s, const char *srv_name, { DEBUG(5, ("init_q_sam_sync\n")); - init_unistr2(&q_s->uni_srv_name, srv_name, strlen(srv_name) + 1); - init_unistr2(&q_s->uni_cli_name, cli_name, strlen(cli_name) + 1); + init_unistr2(&q_s->uni_srv_name, srv_name); + init_unistr2(&q_s->uni_cli_name, cli_name); if (cli_creds) memcpy(&q_s->cli_creds, cli_creds, sizeof(q_s->cli_creds)); @@ -2842,8 +2841,8 @@ BOOL init_net_q_sam_deltas(NET_Q_SAM_DELTAS *q_s, const char *srv_name, { DEBUG(5, ("init_net_q_sam_deltas\n")); - init_unistr2(&q_s->uni_srv_name, srv_name, strlen(srv_name) + 1); - init_unistr2(&q_s->uni_cli_name, cli_name, strlen(cli_name) + 1); + init_unistr2(&q_s->uni_srv_name, srv_name); + init_unistr2(&q_s->uni_cli_name, cli_name); memcpy(&q_s->cli_creds, cli_creds, sizeof(q_s->cli_creds)); memset(&q_s->ret_creds, 0, sizeof(q_s->ret_creds)); diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index b4d20bf2ba..71344a2f9b 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -289,10 +289,10 @@ void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); init_uni_hdr(&q_c->hdr_name, len_name); - init_unistr2(&q_c->uni_name, name, len_name); + init_unistr2(&q_c->uni_name, name); init_uni_hdr(&q_c->hdr_class, len_class); - init_unistr2(&q_c->uni_class, class, len_class); + init_unistr2(&q_c->uni_class, class); q_c->reserved = 0x00000000; memcpy(&q_c->sam_access, sam_access, sizeof(q_c->sam_access)); @@ -403,7 +403,7 @@ void init_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd, memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); init_uni_hdr(&q_c->hdr_name, len_name); - init_unistr2(&q_c->uni_name, name, len_name); + init_unistr2(&q_c->uni_name, name); } /******************************************************************* @@ -469,7 +469,7 @@ void init_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd, memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); init_uni_hdr(&q_c->hdr_name, len_name); - init_unistr2(&q_c->uni_name, name, len_name); + init_unistr2(&q_c->uni_name, name); } /******************************************************************* @@ -1018,7 +1018,7 @@ BOOL init_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char* val_name) q_i->pol = *pol; init_uni_hdr(&(q_i->hdr_type), len_type); - init_unistr2(&(q_i->uni_type), val_name, len_type); + init_unistr2(&(q_i->uni_type), val_name); q_i->ptr_reserved = 1; q_i->ptr_buf = 1; @@ -1271,7 +1271,7 @@ void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) DEBUG(10,("init_reg_r_enum_val: Valuename => [%s]\n", val->valuename)); init_uni_hdr( &r_u->hdr_name, strlen(val->valuename)+1 ); - init_unistr2( &r_u->uni_name, val->valuename, strlen(val->valuename)+1 ); + init_unistr2( &r_u->uni_name, val->valuename); /* type */ @@ -1425,7 +1425,7 @@ void init_reg_q_create_val(REG_Q_CREATE_VALUE *q_i, POLICY_HND *pol, memcpy(&q_i->pol, pol, sizeof(q_i->pol)); init_uni_hdr(&q_i->hdr_name, val_len); - init_unistr2(&q_i->uni_name, val_name, val_len); + init_unistr2(&q_i->uni_name, val_name); q_i->type = type; q_i->buf_value = val; @@ -1655,7 +1655,7 @@ void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, memcpy(&r_q->pol, pol, sizeof(r_q->pol)); init_uni_hdr(&r_q->hdr_name, len_name); - init_unistr2(&r_q->uni_name, key_name, len_name); + init_unistr2(&r_q->uni_name, key_name); r_q->unknown_0 = 0x00000000; r_q->access_desired = access_desired; @@ -1747,7 +1747,7 @@ void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, const char *msg, q_s->ptr_2 = 1; init_uni_hdr(&(q_s->hdr_msg), msg_len); - init_unistr2(&(q_s->uni_msg), msg, msg_len); + init_unistr2(&(q_s->uni_msg), msg); q_s->timeout = timeout; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 918cdbcd1d..e3db7d339c 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -101,7 +101,7 @@ void init_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN * q_u, q_u->connect_pol = *pol; init_uni_hdr(&q_u->hdr_domain, len_name); - init_unistr2(&q_u->uni_domain, dom_name, len_name); + init_unistr2(&q_u->uni_domain, dom_name); } /******************************************************************* @@ -637,7 +637,7 @@ void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *server) init_uni_hdr(&u_5->hdr_server, len_server); - init_unistr2(&u_5->uni_server, server, len_server); + init_unistr2(&u_5->uni_server, server); } /******************************************************************* @@ -692,8 +692,8 @@ void init_unk_info2(SAM_UNK_INFO_2 * u_2, memset(u_2->padding, 0, sizeof(u_2->padding)); /* 12 bytes zeros */ - init_unistr2(&u_2->uni_domain, domain, len_domain); - init_unistr2(&u_2->uni_server, server, len_server); + init_unistr2(&u_2->uni_domain, domain); + init_unistr2(&u_2->uni_server, server); } /******************************************************************* @@ -1573,9 +1573,9 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_en ZERO_STRUCTP(&sam->str[i].uni_full_name); ZERO_STRUCTP(&sam->str[i].uni_acct_desc); - init_unistr2(&sam->str[i].uni_acct_name, pdb_get_username(pwd), len_sam_name); - init_unistr2(&sam->str[i].uni_full_name, pdb_get_fullname(pwd), len_sam_full); - init_unistr2(&sam->str[i].uni_acct_desc, pdb_get_acct_desc(pwd), len_sam_desc); + init_unistr2(&sam->str[i].uni_acct_name, pdb_get_username(pwd)); + init_unistr2(&sam->str[i].uni_full_name, pdb_get_fullname(pwd)); + init_unistr2(&sam->str[i].uni_acct_desc, pdb_get_acct_desc(pwd)); } return NT_STATUS_OK; @@ -1691,8 +1691,8 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_en ZERO_STRUCTP(&sam->str[i].uni_srv_name); ZERO_STRUCTP(&sam->str[i].uni_srv_desc); - init_unistr2(&sam->str[i].uni_srv_name, username, len_sam_name); - init_unistr2(&sam->str[i].uni_srv_desc, pdb_get_acct_desc(pwd), len_sam_desc); + init_unistr2(&sam->str[i].uni_srv_name, username); + init_unistr2(&sam->str[i].uni_srv_desc, pdb_get_acct_desc(pwd)); } return NT_STATUS_OK; @@ -1785,8 +1785,8 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_en init_sam_entry3(&sam->sam[i], start_idx + i + 1, len_sam_name, len_sam_desc, grp->rid); - init_unistr2(&sam->str[i].uni_grp_name, grp->name, len_sam_name); - init_unistr2(&sam->str[i].uni_grp_desc, grp->comment, len_sam_desc); + init_unistr2(&sam->str[i].uni_grp_name, grp->name); + init_unistr2(&sam->str[i].uni_grp_desc, grp->comment); } return NT_STATUS_OK; @@ -2223,8 +2223,8 @@ void init_samr_group_info1(GROUP_INFO1 * gr1, init_uni_hdr(&gr1->hdr_acct_desc, desc_len); - init_unistr2(&gr1->uni_acct_name, acct_name, acct_len); - init_unistr2(&gr1->uni_acct_desc, acct_desc, desc_len); + init_unistr2(&gr1->uni_acct_name, acct_name); + init_unistr2(&gr1->uni_acct_desc, acct_desc); } /******************************************************************* @@ -2308,7 +2308,7 @@ void init_samr_group_info4(GROUP_INFO4 * gr4, char *acct_desc) DEBUG(5, ("init_samr_group_info4\n")); init_uni_hdr(&gr4->hdr_acct_desc, acct_len); - init_unistr2(&gr4->uni_acct_desc, acct_desc, acct_len); + init_unistr2(&gr4->uni_acct_desc, acct_desc); } /******************************************************************* @@ -2391,7 +2391,7 @@ void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e, q_e->pol = *pol; init_uni_hdr(&q_e->hdr_acct_desc, acct_len); - init_unistr2(&q_e->uni_acct_desc, acct_desc, acct_len); + init_unistr2(&q_e->uni_acct_desc, acct_desc); q_e->access_mask = access_mask; } @@ -3509,12 +3509,12 @@ void init_samr_alias_info1(ALIAS_INFO1 * al1, char *acct_name, uint32 num_member DEBUG(5, ("init_samr_alias_info1\n")); init_uni_hdr(&al1->hdr_acct_name, acct_len_name); - init_unistr2(&al1->uni_acct_name, acct_name, acct_len_name); + init_unistr2(&al1->uni_acct_name, acct_name); al1->num_member=num_member; init_uni_hdr(&al1->hdr_acct_desc, acct_len_desc); - init_unistr2(&al1->uni_acct_desc, acct_desc, acct_len_desc); + init_unistr2(&al1->uni_acct_desc, acct_desc); } /******************************************************************* @@ -3565,7 +3565,7 @@ void init_samr_alias_info3(ALIAS_INFO3 * al3, char *acct_desc) DEBUG(5, ("init_samr_alias_info3\n")); init_uni_hdr(&al3->hdr_acct_desc, acct_len); - init_unistr2(&al3->uni_acct_desc, acct_desc, acct_len); + init_unistr2(&al3->uni_acct_desc, acct_desc); } /******************************************************************* @@ -4280,7 +4280,7 @@ void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS * q_u, q_u->dom_pol = *hnd; init_uni_hdr(&q_u->hdr_acct_desc, acct_len); - init_unistr2(&q_u->uni_acct_desc, acct_desc, acct_len); + init_unistr2(&q_u->uni_acct_desc, acct_desc); q_u->access_mask = 0x001f000f; } @@ -4672,7 +4672,7 @@ NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, for (i = 0; i < num_names; i++) { int len_name = name[i] != NULL ? strlen(name[i]) : 0; init_uni_hdr(&q_u->hdr_name[i], len_name); /* unicode header for user_name */ - init_unistr2(&q_u->uni_name[i], name[i], len_name); /* unicode string for machine account */ + init_unistr2(&q_u->uni_name[i], name[i]); /* unicode string for machine account */ } return NT_STATUS_OK; @@ -5016,7 +5016,7 @@ void init_samr_q_create_user(SAMR_Q_CREATE_USER * q_u, q_u->domain_pol = *pol; init_uni_hdr(&q_u->hdr_name, len_name); - init_unistr2(&q_u->uni_name, name, len_name); + init_unistr2(&q_u->uni_name, name); q_u->acb_info = acb_info; q_u->access_mask = access_mask; @@ -5273,7 +5273,7 @@ void init_sam_user_info11(SAM_USER_INFO_11 * usr, 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, len_mach_acct); /* unicode string for machine account */ + init_unistr2(&usr->uni_mach_acct, mach_acct); /* unicode string for machine account */ } /******************************************************************* @@ -5585,16 +5585,16 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z memcpy(usr->pass, newpass, sizeof(usr->pass)); - init_unistr2(&usr->uni_user_name, user_name, len_user_name); /* NULL */ - init_unistr2(&usr->uni_full_name, full_name, len_full_name); - init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); - init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); - init_unistr2(&usr->uni_logon_script, log_scr, len_logon_script); - init_unistr2(&usr->uni_profile_path, prof_path, len_profile_path); - init_unistr2(&usr->uni_acct_desc, desc, len_description); - init_unistr2(&usr->uni_workstations, wkstas, len_workstations); - init_unistr2(&usr->uni_unknown_str, unk_str, len_unknown_str); - init_unistr2(&usr->uni_munged_dial, mung_dial, len_munged_dial); + init_unistr2(&usr->uni_user_name, user_name); /* NULL */ + init_unistr2(&usr->uni_full_name, full_name); + init_unistr2(&usr->uni_home_dir, home_dir); + init_unistr2(&usr->uni_dir_drive, dir_drive); + init_unistr2(&usr->uni_logon_script, log_scr); + init_unistr2(&usr->uni_profile_path, prof_path); + init_unistr2(&usr->uni_acct_desc, desc); + init_unistr2(&usr->uni_workstations, wkstas); + init_unistr2(&usr->uni_unknown_str, unk_str); + init_unistr2(&usr->uni_munged_dial, mung_dial); usr->unknown_6 = unknown_6; /* 0x0000 04ec */ usr->padding4 = 0; @@ -6093,16 +6093,16 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * ZERO_STRUCT(usr->padding1); ZERO_STRUCT(usr->padding2); - init_unistr2(&usr->uni_user_name, user_name, len_user_name); - init_unistr2(&usr->uni_full_name, full_name, len_full_name); - init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); - init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); - init_unistr2(&usr->uni_logon_script, logon_script, len_logon_script); - init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path); - init_unistr2(&usr->uni_acct_desc, description, len_description); - init_unistr2(&usr->uni_workstations, workstations, len_workstations); - init_unistr2(&usr->uni_unknown_str, NULL, len_unknown_str); - init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial); + init_unistr2(&usr->uni_user_name, user_name); + init_unistr2(&usr->uni_full_name, full_name); + init_unistr2(&usr->uni_home_dir, home_dir); + init_unistr2(&usr->uni_dir_drive, dir_drive); + init_unistr2(&usr->uni_logon_script, logon_script); + init_unistr2(&usr->uni_profile_path, profile_path); + init_unistr2(&usr->uni_acct_desc, description); + init_unistr2(&usr->uni_workstations, workstations); + init_unistr2(&usr->uni_unknown_str, NULL); + init_unistr2(&usr->uni_munged_dial, munged_dial); usr->unknown_6 = pdb_get_unknown_6(pw); usr->padding4 = 0; @@ -6245,7 +6245,7 @@ void init_sam_user_info20A(SAM_USER_INFO_20 *usr, SAM_ACCOUNT *pw) len_munged_dial = munged_dial != NULL ? strlen(munged_dial )+1 : 0; init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); - init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial); + init_unistr2(&usr->uni_munged_dial, munged_dial); } @@ -6717,7 +6717,7 @@ void init_samr_q_connect(SAMR_Q_CONNECT * q_u, /* make PDC server name \\server */ q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0; - init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1); + init_unistr2(&q_u->uni_srv_name, srv_name); /* example values: 0x0000 0002 */ q_u->access_mask = access_mask; @@ -6790,7 +6790,7 @@ void init_samr_q_connect4(SAMR_Q_CONNECT4 * q_u, /* make PDC server name \\server */ q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0; - init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1); + init_unistr2(&q_u->uni_srv_name, srv_name); /* Only value we've seen, possibly an address type ? */ q_u->unk_0 = 2; @@ -6935,7 +6935,7 @@ void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO * q_u, q_u->ptr = 1; init_uni_hdr(&q_u->hdr_srv_name, len_srv_name); - init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name); + init_unistr2(&q_u->uni_srv_name, srv_name); } /******************************************************************* @@ -7103,9 +7103,9 @@ void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u, q_u->ptr_0 = 1; init_uni_hdr(&q_u->hdr_dest_host, len_dest_host); - init_unistr2(&q_u->uni_dest_host, dest_host, len_dest_host); + init_unistr2(&q_u->uni_dest_host, dest_host); init_uni_hdr(&q_u->hdr_user_name, len_user_name); - init_unistr2(&q_u->uni_user_name, user_name, len_user_name); + init_unistr2(&q_u->uni_user_name, user_name); init_enc_passwd(&q_u->nt_newpass, nt_newpass); init_enc_hash(&q_u->nt_oldhash, nt_oldhash); diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index cb3b2efd9d..b3fbb655ca 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -916,12 +916,12 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, { DEBUG(5,("make_spoolss_q_open_printer_ex\n")); q_u->printername_ptr = (printername!=NULL)?1:0; - init_unistr2(&q_u->printername, printername, strlen(printername)+1); + init_unistr2(&q_u->printername, printername); q_u->printer_default.datatype_ptr = 0; /* q_u->printer_default.datatype_ptr = (datatype!=NULL)?1:0; - init_unistr2(&q_u->printer_default.datatype, datatype, strlen(datatype)); + init_unistr2(&q_u->printer_default.datatype, datatype); */ q_u->printer_default.devmode_cont.size=0; q_u->printer_default.devmode_cont.devmode_ptr=0; @@ -937,8 +937,8 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, q_u->user_ctr.user1.major=2; q_u->user_ctr.user1.minor=0; q_u->user_ctr.user1.processor=0; - init_unistr2(&q_u->user_ctr.user1.client_name, clientname, strlen(clientname)+1); - init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)+1); + init_unistr2(&q_u->user_ctr.user1.client_name, clientname); + init_unistr2(&q_u->user_ctr.user1.user_name, user_name); return True; } @@ -963,7 +963,7 @@ BOOL make_spoolss_q_addprinterex( ZERO_STRUCTP(q_u); q_u->server_name_ptr = (srv_name!=NULL)?1:0; - init_unistr2(&q_u->server_name, srv_name, strlen(srv_name)); + init_unistr2(&q_u->server_name, srv_name); q_u->level = level; @@ -991,8 +991,8 @@ BOOL make_spoolss_q_addprinterex( q_u->user_ctr.user1.major=2; q_u->user_ctr.user1.minor=0; q_u->user_ctr.user1.processor=0; - init_unistr2(&q_u->user_ctr.user1.client_name, clientname, strlen(clientname)+1); - init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)+1); + init_unistr2(&q_u->user_ctr.user1.client_name, clientname); + init_unistr2(&q_u->user_ctr.user1.user_name, user_name); q_u->user_ctr.user1.size=q_u->user_ctr.user1.user_name.uni_str_len + q_u->user_ctr.user1.client_name.uni_str_len + 2; @@ -1187,9 +1187,9 @@ BOOL make_spoolss_q_deleteprinterdriver( /* these must be NULL terminated or else NT4 will complain about invalid parameters --jerry */ - init_unistr2(&q_u->server, server, strlen(server)+1); - init_unistr2(&q_u->arch, arch, strlen(arch)+1); - init_unistr2(&q_u->driver, driver, strlen(driver)+1); + init_unistr2(&q_u->server, server); + init_unistr2(&q_u->arch, arch); + init_unistr2(&q_u->driver, driver); return True; @@ -1209,7 +1209,7 @@ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, DEBUG(5,("make_spoolss_q_getprinterdata\n")); q_u->handle = *handle; - init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); + init_unistr2(&q_u->valuename, valuename); q_u->size = size; return True; @@ -1228,8 +1228,8 @@ BOOL make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX *q_u, DEBUG(5,("make_spoolss_q_getprinterdataex\n")); q_u->handle = *handle; - init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); - init_unistr2(&q_u->keyname, keyname, strlen(keyname) + 1); + init_unistr2(&q_u->valuename, valuename); + init_unistr2(&q_u->keyname, keyname); q_u->size = size; return True; @@ -5373,7 +5373,7 @@ BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx, DEBUG(5,("make_spoolss_q_addprinterdriver\n")); q_u->server_name_ptr = (srv_name!=NULL)?1:0; - init_unistr2(&q_u->server_name, srv_name, strlen(srv_name)+1); + init_unistr2(&q_u->server_name, srv_name); q_u->level = level; @@ -6161,7 +6161,7 @@ BOOL make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u, uint32 size) { memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - init_unistr2(&q_u->key, key, strlen(key)+1); + init_unistr2(&q_u->key, key); q_u->size = size; return True; @@ -6174,7 +6174,7 @@ BOOL make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND { memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); q_u->type = data_type; - init_unistr2(&q_u->value, value, strlen(value)+1); + init_unistr2(&q_u->value, value); q_u->max_len = q_u->real_len = data_size; q_u->data = data; @@ -6190,8 +6190,8 @@ BOOL make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX *q_u, const POLICY { memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); q_u->type = data_type; - init_unistr2(&q_u->value, value, strlen(value)+1); - init_unistr2(&q_u->key, key, strlen(key)+1); + init_unistr2(&q_u->value, value); + init_unistr2(&q_u->key, key); q_u->max_len = q_u->real_len = data_size; q_u->data = data; @@ -6588,7 +6588,7 @@ BOOL make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER *q_u, if (q_u == NULL) return False; - init_unistr2(&q_u->string, string, strlen(string)+1); + init_unistr2(&q_u->string, string); q_u->printer=printer; q_u->type=type; @@ -7091,7 +7091,7 @@ BOOL make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u, DEBUG(5,("make_spoolss_q_enumprinterkey\n")); memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - init_unistr2(&q_u->key, key, strlen(key)+1); + init_unistr2(&q_u->key, key); q_u->size = size; return True; @@ -7160,7 +7160,7 @@ BOOL make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY *q_u, DEBUG(5,("make_spoolss_q_deleteprinterkey\n")); memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - init_unistr2(&q_u->keyname, keyname, strlen(keyname)+1); + init_unistr2(&q_u->keyname, keyname); return True; } @@ -7382,8 +7382,8 @@ BOOL make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTOR { DEBUG(5,("make_spoolss_q_getprintprocessordirectory\n")); - init_unistr2(&q_u->name, name, strlen(name)+1); - init_unistr2(&q_u->environment, environment, strlen(environment)+1); + init_unistr2(&q_u->name, name); + init_unistr2(&q_u->environment, environment); q_u->level = level; @@ -7509,7 +7509,7 @@ BOOL make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle, q_u->level = level; q_u->level2 = level; memcpy(&q_u->form, form, sizeof(FORM)); - init_unistr2(&q_u->name, form_name, strlen(form_name) + 1); + init_unistr2(&q_u->name, form_name); return True; } @@ -7521,7 +7521,7 @@ BOOL make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle, BOOL make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, char *form) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); - init_unistr2(&q_u->name, form, strlen(form) + 1); + init_unistr2(&q_u->name, form); return True; } @@ -7535,7 +7535,7 @@ BOOL make_spoolss_q_getform(SPOOL_Q_GETFORM *q_u, POLICY_HND *handle, { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); q_u->level = level; - init_unistr2(&q_u->formname, formname, strlen(formname) + 1); + init_unistr2(&q_u->formname, formname); q_u->buffer=buffer; q_u->offered=offered; @@ -7642,16 +7642,13 @@ BOOL make_spoolss_q_startdocprinter(SPOOL_Q_STARTDOCPRINTER *q_u, ctr->docinfo.doc_info_1.p_datatype = datatype ? 1 : 0; if (docname) - init_unistr2(&ctr->docinfo.doc_info_1.docname, docname, - strlen(docname) + 1); + init_unistr2(&ctr->docinfo.doc_info_1.docname, docname); if (outputfile) - init_unistr2(&ctr->docinfo.doc_info_1.outputfile, outputfile, - strlen(outputfile) + 1); + init_unistr2(&ctr->docinfo.doc_info_1.outputfile, outputfile); if (datatype) - init_unistr2(&ctr->docinfo.doc_info_1.datatype, datatype, - strlen(datatype) + 1); + init_unistr2(&ctr->docinfo.doc_info_1.datatype, datatype); break; case 2: @@ -7700,7 +7697,7 @@ BOOL make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA *q_u, POLICY_HND *handle, char *valuename) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); - init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); + init_unistr2(&q_u->valuename, valuename); return True; } @@ -7714,8 +7711,8 @@ BOOL make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX *q_u, char *value) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); - init_unistr2(&q_u->valuename, value, strlen(value) + 1); - init_unistr2(&q_u->keyname, key, strlen(key) + 1); + init_unistr2(&q_u->valuename, value); + init_unistr2(&q_u->keyname, key); return True; } @@ -7735,8 +7732,7 @@ BOOL make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle, q_u->localmachine_ptr = 1; - init_unistr2(&q_u->localmachine, localmachine, - strlen(localmachine) + 1); + init_unistr2(&q_u->localmachine, localmachine); q_u->printerlocal = printerlocal; diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index bfa1a13be9..fb3484d228 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -37,7 +37,7 @@ void init_srv_share_info0_str(SH_INFO_0_STR *sh0, const char *net_name) DEBUG(5,("init_srv_share_info0_str\n")); if(net_name) - init_unistr2(&sh0->uni_netname, net_name, strlen(net_name)+1); + init_unistr2(&sh0->uni_netname, net_name); } /******************************************************************* @@ -102,9 +102,9 @@ void init_srv_share_info1_str(SH_INFO_1_STR *sh1, const char *net_name, const ch DEBUG(5,("init_srv_share_info1_str\n")); if(net_name) - init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1); + init_unistr2(&sh1->uni_netname, net_name); if(remark) - init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh1->uni_remark, remark); } /******************************************************************* @@ -185,13 +185,13 @@ void init_srv_share_info2_str(SH_INFO_2_STR *sh2, DEBUG(5,("init_srv_share_info2_str\n")); if (net_name) - init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1); + init_unistr2(&sh2->uni_netname, net_name); if (remark) - init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh2->uni_remark, remark); if (path) - init_unistr2(&sh2->uni_path, path, strlen(path)+1); + init_unistr2(&sh2->uni_path, path); if (passwd) - init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1); + init_unistr2(&sh2->uni_passwd, passwd); } /******************************************************************* @@ -297,9 +297,9 @@ void init_srv_share_info501_str(SH_INFO_501_STR *sh501, DEBUG(5,("init_srv_share_info501_str\n")); if(net_name) - init_unistr2(&sh501->uni_netname, net_name, strlen(net_name)+1); + init_unistr2(&sh501->uni_netname, net_name); if(remark) - init_unistr2(&sh501->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh501->uni_remark, remark); } /******************************************************************* @@ -447,13 +447,13 @@ void init_srv_share_info502_str(SH_INFO_502_STR *sh502str, DEBUG(5,("init_srv_share_info502_str\n")); if(net_name) - init_unistr2(&sh502str->uni_netname, net_name, strlen(net_name)+1); + init_unistr2(&sh502str->uni_netname, net_name); if(remark) - init_unistr2(&sh502str->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh502str->uni_remark, remark); if(path) - init_unistr2(&sh502str->uni_path, path, strlen(path)+1); + init_unistr2(&sh502str->uni_path, path); if(passwd) - init_unistr2(&sh502str->uni_passwd, passwd, strlen(passwd)+1); + init_unistr2(&sh502str->uni_passwd, passwd); sh502str->sd = psd; sh502str->reserved = 0; sh502str->sd_size = sd_size; @@ -552,7 +552,7 @@ void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, const char *remark) DEBUG(5,("init_srv_share_info1004_str\n")); if(remark) - init_unistr2(&sh1004->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh1004->uni_remark, remark); } /******************************************************************* @@ -659,7 +659,7 @@ void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate DEBUG(5,("init_srv_share_info1007_str\n")); if(alternate_directory_name) - init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, strlen(alternate_directory_name)+1); + init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name); } /******************************************************************* @@ -1473,7 +1473,7 @@ void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname, const char *path, const char *passwd) { q->ptr_srv_name = 1; - init_unistr2(&q->uni_srv_name, srvname, strlen(srvname) +1); + init_unistr2(&q->uni_srv_name, srvname); q->info.switch_value = q->info_level = 2; q->info.ptr_share_ctr = 1; @@ -1524,8 +1524,8 @@ void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname, const char *sharename) { del->ptr_srv_name = 1; - init_unistr2(&del->uni_srv_name, srvname, strlen(srvname) +1 ); - init_unistr2(&del->uni_share_name, sharename, strlen(sharename) + 1); + init_unistr2(&del->uni_srv_name, srvname); + init_unistr2(&del->uni_share_name, sharename); } /******************************************************************* @@ -1588,7 +1588,7 @@ void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, const char *name) { DEBUG(5,("init_srv_sess_info0_str\n")); - init_unistr2(&ss0->uni_name, name, strlen(name)+1); + init_unistr2(&ss0->uni_name, name); } /******************************************************************* @@ -1702,8 +1702,8 @@ void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, const char *name, const char { DEBUG(5,("init_srv_sess_info1_str\n")); - init_unistr2(&ss1->uni_name, name, strlen(name)+1); - init_unistr2(&ss1->uni_user, user, strlen(user)+1); + init_unistr2(&ss1->uni_name, name); + init_unistr2(&ss1->uni_user, user); } /******************************************************************* @@ -2074,8 +2074,8 @@ void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, const char *usr_name, const c { DEBUG(5,("init_srv_conn_info1_str\n")); - init_unistr2(&ss1->uni_usr_name, usr_name, strlen(usr_name)+1); - init_unistr2(&ss1->uni_net_name, net_name, strlen(net_name)+1); + init_unistr2(&ss1->uni_usr_name, usr_name); + init_unistr2(&ss1->uni_net_name, net_name); } /******************************************************************* @@ -2364,8 +2364,8 @@ void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, const char *user_name, const { DEBUG(5,("init_srv_file_info3_str\n")); - init_unistr2(&fi3->uni_path_name, path_name, strlen(path_name)+1); - init_unistr2(&fi3->uni_user_name, user_name, strlen(user_name)+1); + init_unistr2(&fi3->uni_path_name, path_name); + init_unistr2(&fi3->uni_user_name, user_name); } /******************************************************************* @@ -2627,7 +2627,7 @@ void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, const char *server, uint32 file_id) { q_n->ptr_srv_name = 1; - init_unistr2(&q_n->uni_srv_name, server, strlen(server) + 1); + init_unistr2(&q_n->uni_srv_name, server); q_n->file_id = file_id; } @@ -3585,6 +3585,6 @@ BOOL srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server) { q_u->ptr_srv_name = 1; - init_unistr2(&q_u->uni_srv_name, server, strlen(server) + 1); + init_unistr2(&q_u->uni_srv_name, server); } -- cgit From 96c795cea7518b50a40caba34e656f056a832589 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 17 Jan 2003 06:15:18 +0000 Subject: reverted this patch till I sort out the craziness with UNIHDR (This used to be commit e3d00fa47d38cd214f5e350e1d6b30d90ed8a52c) --- source3/rpc_parse/parse_dfs.c | 20 ++++---- source3/rpc_parse/parse_lsa.c | 11 +++-- source3/rpc_parse/parse_misc.c | 59 ++++++++++++------------ source3/rpc_parse/parse_net.c | 51 +++++++++++---------- source3/rpc_parse/parse_reg.c | 18 ++++---- source3/rpc_parse/parse_samr.c | 96 +++++++++++++++++++-------------------- source3/rpc_parse/parse_spoolss.c | 70 ++++++++++++++-------------- source3/rpc_parse/parse_srv.c | 54 +++++++++++----------- 8 files changed, 194 insertions(+), 185 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index c8774932e3..ccd6d429fa 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -80,9 +80,9 @@ BOOL init_dfs_q_dfs_remove(DFS_Q_DFS_REMOVE *q_d, char *entrypath, char *servername, char *sharename) { DEBUG(5,("init_dfs_q_dfs_remove\n")); - init_unistr2(&q_d->DfsEntryPath, entrypath); - init_unistr2(&q_d->ServerName, servername); - init_unistr2(&q_d->ShareName, sharename); + init_unistr2(&q_d->DfsEntryPath, entrypath, strlen(entrypath)+1); + init_unistr2(&q_d->ServerName, servername, strlen(servername)+1); + init_unistr2(&q_d->ShareName, sharename, strlen(sharename)+1); q_d->ptr_ServerName = q_d->ptr_ShareName = 1; return True; } @@ -154,11 +154,11 @@ BOOL init_dfs_q_dfs_add(DFS_Q_DFS_ADD *q_d, char *entrypath, char *servername, { DEBUG(5,("init_dfs_q_dfs_add\n")); q_d->ptr_DfsEntryPath = q_d->ptr_ServerName = q_d->ptr_ShareName = 1; - init_unistr2(&q_d->DfsEntryPath, entrypath); - init_unistr2(&q_d->ServerName, servername); - init_unistr2(&q_d->ShareName, sharename); + init_unistr2(&q_d->DfsEntryPath, entrypath, strlen(entrypath)+1); + init_unistr2(&q_d->ServerName, servername, strlen(servername)+1); + init_unistr2(&q_d->ShareName, sharename, strlen(sharename)+1); if(comment != NULL) { - init_unistr2(&q_d->Comment, comment); + init_unistr2(&q_d->Comment, comment, strlen(comment)+1); q_d->ptr_Comment = 1; } else { q_d->ptr_Comment = 0; @@ -236,9 +236,9 @@ BOOL init_dfs_q_dfs_get_info(DFS_Q_DFS_GET_INFO *q_d, char *entrypath, uint32 info_level) { DEBUG(5,("init_dfs_q2_get_info\n")); - init_unistr2(&q_d->uni_path, entrypath); - init_unistr2(&q_d->uni_server, servername); - init_unistr2(&q_d->uni_share, sharename); + init_unistr2(&q_d->uni_path, entrypath, strlen(entrypath)+1); + init_unistr2(&q_d->uni_server, servername, strlen(servername)+1); + init_unistr2(&q_d->uni_share, sharename, strlen(sharename)+1); q_d->level = info_level; q_d->ptr_server = q_d->ptr_share = 1; return True; diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index d37a27a97f..7c9f74da37 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -43,7 +43,7 @@ void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, trn->sid_name_use = sid_name_use; init_uni_hdr(&trn->hdr_name, len_name); - init_unistr2(uni_name, name); + init_unistr2(uni_name, name, len_name); trn->domain_idx = idx; } @@ -346,7 +346,8 @@ void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, const char *server_name, r_q->des_access = desired_access; - init_unistr2(&r_q->uni_server_name, server_name); + init_unistr2(&r_q->uni_server_name, server_name, + strlen(server_name) + 1); init_lsa_obj_attr(&r_q->attr, attributes, qos); } @@ -1090,7 +1091,7 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, len = strlen(names[i]); init_uni_hdr(&q_l->hdr_name[i], len); - init_unistr2(&q_l->uni_name[i], names[i]); + init_unistr2(&q_l->uni_name[i], names[i], len); } } @@ -1443,7 +1444,7 @@ void init_lsa_priv_get_dispname(LSA_Q_PRIV_GET_DISPNAME *trn, POLICY_HND *hnd, c memcpy(&trn->pol, hnd, sizeof(trn->pol)); init_uni_hdr(&trn->hdr_name, len_name); - init_unistr2(&trn->name, name); + init_unistr2(&trn->name, name, len_name); trn->lang_id = lang_id; trn->lang_id_sys = lang_id_sys; } @@ -1956,7 +1957,7 @@ void init_lsa_q_lookupprivvalue(LSA_Q_LOOKUPPRIVVALUE *trn, POLICY_HND *hnd, con len_name = 1; init_uni_hdr(&trn->hdr_right, len_name); - init_unistr2(&trn->uni2_right, name); + init_unistr2(&trn->uni2_right, name, len_name); } /******************************************************************* diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 020c49cba1..9d3bd6f28a 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -766,12 +766,12 @@ void init_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf) if (buf != NULL) { *ptr = 1; - init_unistr2(str, buf); + init_unistr2(str, buf, strlen(buf)+1); } else { *ptr = 0; - init_unistr2(str, ""); + init_unistr2(str, "", 0); } } @@ -881,34 +881,37 @@ BOOL smb_io_string2(const char *desc, STRING2 *str2, uint32 buffer, prs_struct * } /******************************************************************* - Inits a UNISTR2 structure. This function used to deliberately - over-allocate to a minimum of 256 bytes. That is rather silly, and - just hides potential bugs. If you need to overallocate then don't use - this function! + Inits a UNISTR2 structure. ********************************************************************/ -void init_unistr2(UNISTR2 *str, const char *buf) + +void init_unistr2(UNISTR2 *str, const char *buf, size_t len) { - size_t len; + ZERO_STRUCTP(str); - if (!buf) { - /* this is incorrect, but is needed to cope with some - broken code that assumes this function will always - return a valid initialised UNISTR2 */ - buf = ""; - } + /* set up string lengths. */ + str->uni_max_len = (uint32)len; + str->undoc = 0; + str->uni_str_len = (uint32)len; - len = push_ucs2_talloc(get_talloc_ctx() , &str->buffer, buf); + if (len < MAX_UNISTRLEN) + len = MAX_UNISTRLEN; + len *= sizeof(uint16); - if (len == -1) { - /* oops - we can't convert the string? */ - smb_panic("failed to convert string in init_unistr2"); + str->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len); + if ((str->buffer == NULL) && (len > 0)) + { + smb_panic("init_unistr2: malloc fail\n"); + return; } - /* set up string lengths. Note that len is guaranteed to be a - * multiple of 2 from push_ucs2 */ - str->uni_max_len = len/2; - str->undoc = 0; - str->uni_str_len = len/2; + /* + * don't move this test above ! The UNISTR2 must be initialized !!! + * jfm, 7/7/2001. + */ + if (buf==NULL) + return; + + rpcstr_push((char *)str->buffer, buf, len, STR_TERMINATE); } /** @@ -1189,14 +1192,14 @@ static void init_clnt_srv(DOM_CLNT_SRV *log, const char *logon_srv, const char * if (logon_srv != NULL) { log->undoc_buffer = 1; - init_unistr2(&log->uni_logon_srv, logon_srv); + init_unistr2(&log->uni_logon_srv, logon_srv, strlen(logon_srv)+1); } else { log->undoc_buffer = 0; } if (comp_name != NULL) { log->undoc_buffer2 = 1; - init_unistr2(&log->uni_comp_name, comp_name); + init_unistr2(&log->uni_comp_name, comp_name, strlen(comp_name)+1); } else { log->undoc_buffer2 = 0; } @@ -1250,12 +1253,12 @@ void init_log_info(DOM_LOG_INFO *log, const char *logon_srv, const char *acct_na log->undoc_buffer = 1; - init_unistr2(&log->uni_logon_srv, logon_srv); - init_unistr2(&log->uni_acct_name, acct_name); + init_unistr2(&log->uni_logon_srv, logon_srv, strlen(logon_srv)+1); + init_unistr2(&log->uni_acct_name, acct_name, strlen(acct_name)+1); log->sec_chan = sec_chan; - init_unistr2(&log->uni_comp_name, comp_name); + init_unistr2(&log->uni_comp_name, comp_name, strlen(comp_name)+1); } /******************************************************************* diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 859ad6b408..ac21e6f2dd 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -136,15 +136,16 @@ static BOOL net_io_netinfo_1(const char *desc, NETLOGON_INFO_1 *info, prs_struct static void init_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, uint32 tc_status, const char *trusted_dc_name) { + int len_dc_name = strlen(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); + init_unistr2(&info->uni_trusted_dc_name, trusted_dc_name, len_dc_name+1); else - init_unistr2(&info->uni_trusted_dc_name, ""); + init_unistr2(&info->uni_trusted_dc_name, "", 1); } /******************************************************************* @@ -229,7 +230,7 @@ void init_net_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, const char *srv_name, q_l->query_level = query_level; q_l->switch_value = 0x01; - init_unistr2(&q_l->uni_server_name, srv_name); + init_unistr2(&q_l->uni_server_name, srv_name, strlen(srv_name) + 1); } /******************************************************************* @@ -359,7 +360,7 @@ void init_net_q_logon_ctrl(NET_Q_LOGON_CTRL *q_l, const char *srv_name, q_l->function_code = 0x01; /* ??? */ q_l->query_level = query_level; - init_unistr2(&q_l->uni_server_name, srv_name); + init_unistr2(&q_l->uni_server_name, srv_name, strlen(srv_name) + 1); } /******************************************************************* @@ -446,7 +447,7 @@ void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, fstring domain_name; fstrcpy(domain_name, dom_name); strupper(domain_name); - init_unistr2(&r_t->uni_trust_dom_name[i], domain_name); + init_unistr2(&r_t->uni_trust_dom_name[i], domain_name, strlen(domain_name)+1); /* the use of UNISTR2 here is non-standard. */ r_t->uni_trust_dom_name[i].undoc = 0x1; } @@ -538,8 +539,8 @@ void init_q_req_chal(NET_Q_REQ_CHAL *q_c, q_c->undoc_buffer = 1; /* don't know what this buffer is */ - init_unistr2(&q_c->uni_logon_srv, logon_srv ); - init_unistr2(&q_c->uni_logon_clnt, logon_clnt); + init_unistr2(&q_c->uni_logon_srv, logon_srv , strlen(logon_srv )+1); + init_unistr2(&q_c->uni_logon_clnt, logon_clnt, strlen(logon_clnt)+1); memcpy(q_c->clnt_chal.data, clnt_chal->data, sizeof(clnt_chal->data)); @@ -957,9 +958,9 @@ void init_id_info1(NET_ID_INFO_1 *id, const char *domain_name, init_owf_info(&id->lm_owf, lm_cypher); init_owf_info(&id->nt_owf, nt_cypher); - init_unistr2(&id->uni_domain_name, domain_name); - init_unistr2(&id->uni_user_name, user_name); - init_unistr2(&id->uni_wksta_name, wksta_name); + init_unistr2(&id->uni_domain_name, domain_name, len_domain_name); + init_unistr2(&id->uni_user_name, user_name, len_user_name); + init_unistr2(&id->uni_wksta_name, wksta_name, len_wksta_name); } /******************************************************************* @@ -1069,9 +1070,9 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, 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); - init_unistr2(&id->uni_user_name, user_name); - init_unistr2(&id->uni_wksta_name, wksta_name); + init_unistr2(&id->uni_domain_name, domain_name, len_domain_name); + init_unistr2(&id->uni_user_name, user_name, len_user_name); + init_unistr2(&id->uni_wksta_name, wksta_name, len_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); @@ -1351,12 +1352,12 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, 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); - init_unistr2(&usr->uni_full_name, full_name); - init_unistr2(&usr->uni_logon_script, logon_script); - init_unistr2(&usr->uni_profile_path, profile_path); - init_unistr2(&usr->uni_home_dir, home_dir); - init_unistr2(&usr->uni_dir_drive, dir_drive); + init_unistr2(&usr->uni_user_name, user_name, len_user_name); + init_unistr2(&usr->uni_full_name, full_name, len_full_name); + init_unistr2(&usr->uni_logon_script, logon_script, len_logon_script); + init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path); + init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); + init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); usr->num_groups2 = num_groups; @@ -1367,8 +1368,8 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, for (i = 0; i < num_groups; i++) usr->gids[i] = gids[i]; - init_unistr2(&usr->uni_logon_srv, logon_srv); - init_unistr2(&usr->uni_logon_dom, logon_dom); + init_unistr2(&usr->uni_logon_srv, logon_srv, len_logon_srv); + init_unistr2(&usr->uni_logon_dom, logon_dom, len_logon_dom); init_dom_sid2(&usr->dom_sid, dom_sid); /* "other" sids are set up above */ @@ -1664,8 +1665,8 @@ BOOL init_net_q_sam_sync(NET_Q_SAM_SYNC * q_s, const char *srv_name, { DEBUG(5, ("init_q_sam_sync\n")); - init_unistr2(&q_s->uni_srv_name, srv_name); - init_unistr2(&q_s->uni_cli_name, cli_name); + init_unistr2(&q_s->uni_srv_name, srv_name, strlen(srv_name) + 1); + init_unistr2(&q_s->uni_cli_name, cli_name, strlen(cli_name) + 1); if (cli_creds) memcpy(&q_s->cli_creds, cli_creds, sizeof(q_s->cli_creds)); @@ -2841,8 +2842,8 @@ BOOL init_net_q_sam_deltas(NET_Q_SAM_DELTAS *q_s, const char *srv_name, { DEBUG(5, ("init_net_q_sam_deltas\n")); - init_unistr2(&q_s->uni_srv_name, srv_name); - init_unistr2(&q_s->uni_cli_name, cli_name); + init_unistr2(&q_s->uni_srv_name, srv_name, strlen(srv_name) + 1); + init_unistr2(&q_s->uni_cli_name, cli_name, strlen(cli_name) + 1); memcpy(&q_s->cli_creds, cli_creds, sizeof(q_s->cli_creds)); memset(&q_s->ret_creds, 0, sizeof(q_s->ret_creds)); diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 71344a2f9b..b4d20bf2ba 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -289,10 +289,10 @@ void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); init_uni_hdr(&q_c->hdr_name, len_name); - init_unistr2(&q_c->uni_name, name); + init_unistr2(&q_c->uni_name, name, len_name); init_uni_hdr(&q_c->hdr_class, len_class); - init_unistr2(&q_c->uni_class, class); + init_unistr2(&q_c->uni_class, class, len_class); q_c->reserved = 0x00000000; memcpy(&q_c->sam_access, sam_access, sizeof(q_c->sam_access)); @@ -403,7 +403,7 @@ void init_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd, memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); init_uni_hdr(&q_c->hdr_name, len_name); - init_unistr2(&q_c->uni_name, name); + init_unistr2(&q_c->uni_name, name, len_name); } /******************************************************************* @@ -469,7 +469,7 @@ void init_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd, memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); init_uni_hdr(&q_c->hdr_name, len_name); - init_unistr2(&q_c->uni_name, name); + init_unistr2(&q_c->uni_name, name, len_name); } /******************************************************************* @@ -1018,7 +1018,7 @@ BOOL init_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char* val_name) q_i->pol = *pol; init_uni_hdr(&(q_i->hdr_type), len_type); - init_unistr2(&(q_i->uni_type), val_name); + init_unistr2(&(q_i->uni_type), val_name, len_type); q_i->ptr_reserved = 1; q_i->ptr_buf = 1; @@ -1271,7 +1271,7 @@ void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) DEBUG(10,("init_reg_r_enum_val: Valuename => [%s]\n", val->valuename)); init_uni_hdr( &r_u->hdr_name, strlen(val->valuename)+1 ); - init_unistr2( &r_u->uni_name, val->valuename); + init_unistr2( &r_u->uni_name, val->valuename, strlen(val->valuename)+1 ); /* type */ @@ -1425,7 +1425,7 @@ void init_reg_q_create_val(REG_Q_CREATE_VALUE *q_i, POLICY_HND *pol, memcpy(&q_i->pol, pol, sizeof(q_i->pol)); init_uni_hdr(&q_i->hdr_name, val_len); - init_unistr2(&q_i->uni_name, val_name); + init_unistr2(&q_i->uni_name, val_name, val_len); q_i->type = type; q_i->buf_value = val; @@ -1655,7 +1655,7 @@ void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, memcpy(&r_q->pol, pol, sizeof(r_q->pol)); init_uni_hdr(&r_q->hdr_name, len_name); - init_unistr2(&r_q->uni_name, key_name); + init_unistr2(&r_q->uni_name, key_name, len_name); r_q->unknown_0 = 0x00000000; r_q->access_desired = access_desired; @@ -1747,7 +1747,7 @@ void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, const char *msg, q_s->ptr_2 = 1; init_uni_hdr(&(q_s->hdr_msg), msg_len); - init_unistr2(&(q_s->uni_msg), msg); + init_unistr2(&(q_s->uni_msg), msg, msg_len); q_s->timeout = timeout; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index e3db7d339c..918cdbcd1d 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -101,7 +101,7 @@ void init_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN * q_u, q_u->connect_pol = *pol; init_uni_hdr(&q_u->hdr_domain, len_name); - init_unistr2(&q_u->uni_domain, dom_name); + init_unistr2(&q_u->uni_domain, dom_name, len_name); } /******************************************************************* @@ -637,7 +637,7 @@ void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *server) init_uni_hdr(&u_5->hdr_server, len_server); - init_unistr2(&u_5->uni_server, server); + init_unistr2(&u_5->uni_server, server, len_server); } /******************************************************************* @@ -692,8 +692,8 @@ void init_unk_info2(SAM_UNK_INFO_2 * u_2, memset(u_2->padding, 0, sizeof(u_2->padding)); /* 12 bytes zeros */ - init_unistr2(&u_2->uni_domain, domain); - init_unistr2(&u_2->uni_server, server); + init_unistr2(&u_2->uni_domain, domain, len_domain); + init_unistr2(&u_2->uni_server, server, len_server); } /******************************************************************* @@ -1573,9 +1573,9 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_en ZERO_STRUCTP(&sam->str[i].uni_full_name); ZERO_STRUCTP(&sam->str[i].uni_acct_desc); - init_unistr2(&sam->str[i].uni_acct_name, pdb_get_username(pwd)); - init_unistr2(&sam->str[i].uni_full_name, pdb_get_fullname(pwd)); - init_unistr2(&sam->str[i].uni_acct_desc, pdb_get_acct_desc(pwd)); + init_unistr2(&sam->str[i].uni_acct_name, pdb_get_username(pwd), len_sam_name); + init_unistr2(&sam->str[i].uni_full_name, pdb_get_fullname(pwd), len_sam_full); + init_unistr2(&sam->str[i].uni_acct_desc, pdb_get_acct_desc(pwd), len_sam_desc); } return NT_STATUS_OK; @@ -1691,8 +1691,8 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_en ZERO_STRUCTP(&sam->str[i].uni_srv_name); ZERO_STRUCTP(&sam->str[i].uni_srv_desc); - init_unistr2(&sam->str[i].uni_srv_name, username); - init_unistr2(&sam->str[i].uni_srv_desc, pdb_get_acct_desc(pwd)); + init_unistr2(&sam->str[i].uni_srv_name, username, len_sam_name); + init_unistr2(&sam->str[i].uni_srv_desc, pdb_get_acct_desc(pwd), len_sam_desc); } return NT_STATUS_OK; @@ -1785,8 +1785,8 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_en init_sam_entry3(&sam->sam[i], start_idx + i + 1, len_sam_name, len_sam_desc, grp->rid); - init_unistr2(&sam->str[i].uni_grp_name, grp->name); - init_unistr2(&sam->str[i].uni_grp_desc, grp->comment); + init_unistr2(&sam->str[i].uni_grp_name, grp->name, len_sam_name); + init_unistr2(&sam->str[i].uni_grp_desc, grp->comment, len_sam_desc); } return NT_STATUS_OK; @@ -2223,8 +2223,8 @@ void init_samr_group_info1(GROUP_INFO1 * gr1, init_uni_hdr(&gr1->hdr_acct_desc, desc_len); - init_unistr2(&gr1->uni_acct_name, acct_name); - init_unistr2(&gr1->uni_acct_desc, acct_desc); + init_unistr2(&gr1->uni_acct_name, acct_name, acct_len); + init_unistr2(&gr1->uni_acct_desc, acct_desc, desc_len); } /******************************************************************* @@ -2308,7 +2308,7 @@ void init_samr_group_info4(GROUP_INFO4 * gr4, char *acct_desc) DEBUG(5, ("init_samr_group_info4\n")); init_uni_hdr(&gr4->hdr_acct_desc, acct_len); - init_unistr2(&gr4->uni_acct_desc, acct_desc); + init_unistr2(&gr4->uni_acct_desc, acct_desc, acct_len); } /******************************************************************* @@ -2391,7 +2391,7 @@ void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e, q_e->pol = *pol; init_uni_hdr(&q_e->hdr_acct_desc, acct_len); - init_unistr2(&q_e->uni_acct_desc, acct_desc); + init_unistr2(&q_e->uni_acct_desc, acct_desc, acct_len); q_e->access_mask = access_mask; } @@ -3509,12 +3509,12 @@ void init_samr_alias_info1(ALIAS_INFO1 * al1, char *acct_name, uint32 num_member DEBUG(5, ("init_samr_alias_info1\n")); init_uni_hdr(&al1->hdr_acct_name, acct_len_name); - init_unistr2(&al1->uni_acct_name, acct_name); + init_unistr2(&al1->uni_acct_name, acct_name, acct_len_name); al1->num_member=num_member; init_uni_hdr(&al1->hdr_acct_desc, acct_len_desc); - init_unistr2(&al1->uni_acct_desc, acct_desc); + init_unistr2(&al1->uni_acct_desc, acct_desc, acct_len_desc); } /******************************************************************* @@ -3565,7 +3565,7 @@ void init_samr_alias_info3(ALIAS_INFO3 * al3, char *acct_desc) DEBUG(5, ("init_samr_alias_info3\n")); init_uni_hdr(&al3->hdr_acct_desc, acct_len); - init_unistr2(&al3->uni_acct_desc, acct_desc); + init_unistr2(&al3->uni_acct_desc, acct_desc, acct_len); } /******************************************************************* @@ -4280,7 +4280,7 @@ void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS * q_u, q_u->dom_pol = *hnd; init_uni_hdr(&q_u->hdr_acct_desc, acct_len); - init_unistr2(&q_u->uni_acct_desc, acct_desc); + init_unistr2(&q_u->uni_acct_desc, acct_desc, acct_len); q_u->access_mask = 0x001f000f; } @@ -4672,7 +4672,7 @@ NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, for (i = 0; i < num_names; i++) { int len_name = name[i] != NULL ? strlen(name[i]) : 0; init_uni_hdr(&q_u->hdr_name[i], len_name); /* unicode header for user_name */ - init_unistr2(&q_u->uni_name[i], name[i]); /* unicode string for machine account */ + init_unistr2(&q_u->uni_name[i], name[i], len_name); /* unicode string for machine account */ } return NT_STATUS_OK; @@ -5016,7 +5016,7 @@ void init_samr_q_create_user(SAMR_Q_CREATE_USER * q_u, q_u->domain_pol = *pol; init_uni_hdr(&q_u->hdr_name, len_name); - init_unistr2(&q_u->uni_name, name); + init_unistr2(&q_u->uni_name, name, len_name); q_u->acb_info = acb_info; q_u->access_mask = access_mask; @@ -5273,7 +5273,7 @@ void init_sam_user_info11(SAM_USER_INFO_11 * usr, 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); /* unicode string for machine account */ + init_unistr2(&usr->uni_mach_acct, mach_acct, len_mach_acct); /* unicode string for machine account */ } /******************************************************************* @@ -5585,16 +5585,16 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z memcpy(usr->pass, newpass, sizeof(usr->pass)); - init_unistr2(&usr->uni_user_name, user_name); /* NULL */ - init_unistr2(&usr->uni_full_name, full_name); - init_unistr2(&usr->uni_home_dir, home_dir); - init_unistr2(&usr->uni_dir_drive, dir_drive); - init_unistr2(&usr->uni_logon_script, log_scr); - init_unistr2(&usr->uni_profile_path, prof_path); - init_unistr2(&usr->uni_acct_desc, desc); - init_unistr2(&usr->uni_workstations, wkstas); - init_unistr2(&usr->uni_unknown_str, unk_str); - init_unistr2(&usr->uni_munged_dial, mung_dial); + init_unistr2(&usr->uni_user_name, user_name, len_user_name); /* NULL */ + init_unistr2(&usr->uni_full_name, full_name, len_full_name); + init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); + init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); + init_unistr2(&usr->uni_logon_script, log_scr, len_logon_script); + init_unistr2(&usr->uni_profile_path, prof_path, len_profile_path); + init_unistr2(&usr->uni_acct_desc, desc, len_description); + init_unistr2(&usr->uni_workstations, wkstas, len_workstations); + init_unistr2(&usr->uni_unknown_str, unk_str, len_unknown_str); + init_unistr2(&usr->uni_munged_dial, mung_dial, len_munged_dial); usr->unknown_6 = unknown_6; /* 0x0000 04ec */ usr->padding4 = 0; @@ -6093,16 +6093,16 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * ZERO_STRUCT(usr->padding1); ZERO_STRUCT(usr->padding2); - init_unistr2(&usr->uni_user_name, user_name); - init_unistr2(&usr->uni_full_name, full_name); - init_unistr2(&usr->uni_home_dir, home_dir); - init_unistr2(&usr->uni_dir_drive, dir_drive); - init_unistr2(&usr->uni_logon_script, logon_script); - init_unistr2(&usr->uni_profile_path, profile_path); - init_unistr2(&usr->uni_acct_desc, description); - init_unistr2(&usr->uni_workstations, workstations); - init_unistr2(&usr->uni_unknown_str, NULL); - init_unistr2(&usr->uni_munged_dial, munged_dial); + init_unistr2(&usr->uni_user_name, user_name, len_user_name); + init_unistr2(&usr->uni_full_name, full_name, len_full_name); + init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); + init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); + init_unistr2(&usr->uni_logon_script, logon_script, len_logon_script); + init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path); + init_unistr2(&usr->uni_acct_desc, description, len_description); + init_unistr2(&usr->uni_workstations, workstations, len_workstations); + init_unistr2(&usr->uni_unknown_str, NULL, len_unknown_str); + init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial); usr->unknown_6 = pdb_get_unknown_6(pw); usr->padding4 = 0; @@ -6245,7 +6245,7 @@ void init_sam_user_info20A(SAM_USER_INFO_20 *usr, SAM_ACCOUNT *pw) len_munged_dial = munged_dial != NULL ? strlen(munged_dial )+1 : 0; init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); - init_unistr2(&usr->uni_munged_dial, munged_dial); + init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial); } @@ -6717,7 +6717,7 @@ void init_samr_q_connect(SAMR_Q_CONNECT * q_u, /* make PDC server name \\server */ q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0; - init_unistr2(&q_u->uni_srv_name, srv_name); + init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1); /* example values: 0x0000 0002 */ q_u->access_mask = access_mask; @@ -6790,7 +6790,7 @@ void init_samr_q_connect4(SAMR_Q_CONNECT4 * q_u, /* make PDC server name \\server */ q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0; - init_unistr2(&q_u->uni_srv_name, srv_name); + init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1); /* Only value we've seen, possibly an address type ? */ q_u->unk_0 = 2; @@ -6935,7 +6935,7 @@ void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO * q_u, q_u->ptr = 1; init_uni_hdr(&q_u->hdr_srv_name, len_srv_name); - init_unistr2(&q_u->uni_srv_name, srv_name); + init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name); } /******************************************************************* @@ -7103,9 +7103,9 @@ void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u, q_u->ptr_0 = 1; init_uni_hdr(&q_u->hdr_dest_host, len_dest_host); - init_unistr2(&q_u->uni_dest_host, dest_host); + init_unistr2(&q_u->uni_dest_host, dest_host, len_dest_host); init_uni_hdr(&q_u->hdr_user_name, len_user_name); - init_unistr2(&q_u->uni_user_name, user_name); + init_unistr2(&q_u->uni_user_name, user_name, len_user_name); init_enc_passwd(&q_u->nt_newpass, nt_newpass); init_enc_hash(&q_u->nt_oldhash, nt_oldhash); diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index b3fbb655ca..cb3b2efd9d 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -916,12 +916,12 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, { DEBUG(5,("make_spoolss_q_open_printer_ex\n")); q_u->printername_ptr = (printername!=NULL)?1:0; - init_unistr2(&q_u->printername, printername); + init_unistr2(&q_u->printername, printername, strlen(printername)+1); q_u->printer_default.datatype_ptr = 0; /* q_u->printer_default.datatype_ptr = (datatype!=NULL)?1:0; - init_unistr2(&q_u->printer_default.datatype, datatype); + init_unistr2(&q_u->printer_default.datatype, datatype, strlen(datatype)); */ q_u->printer_default.devmode_cont.size=0; q_u->printer_default.devmode_cont.devmode_ptr=0; @@ -937,8 +937,8 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, q_u->user_ctr.user1.major=2; q_u->user_ctr.user1.minor=0; q_u->user_ctr.user1.processor=0; - init_unistr2(&q_u->user_ctr.user1.client_name, clientname); - init_unistr2(&q_u->user_ctr.user1.user_name, user_name); + init_unistr2(&q_u->user_ctr.user1.client_name, clientname, strlen(clientname)+1); + init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)+1); return True; } @@ -963,7 +963,7 @@ BOOL make_spoolss_q_addprinterex( ZERO_STRUCTP(q_u); q_u->server_name_ptr = (srv_name!=NULL)?1:0; - init_unistr2(&q_u->server_name, srv_name); + init_unistr2(&q_u->server_name, srv_name, strlen(srv_name)); q_u->level = level; @@ -991,8 +991,8 @@ BOOL make_spoolss_q_addprinterex( q_u->user_ctr.user1.major=2; q_u->user_ctr.user1.minor=0; q_u->user_ctr.user1.processor=0; - init_unistr2(&q_u->user_ctr.user1.client_name, clientname); - init_unistr2(&q_u->user_ctr.user1.user_name, user_name); + init_unistr2(&q_u->user_ctr.user1.client_name, clientname, strlen(clientname)+1); + init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)+1); q_u->user_ctr.user1.size=q_u->user_ctr.user1.user_name.uni_str_len + q_u->user_ctr.user1.client_name.uni_str_len + 2; @@ -1187,9 +1187,9 @@ BOOL make_spoolss_q_deleteprinterdriver( /* these must be NULL terminated or else NT4 will complain about invalid parameters --jerry */ - init_unistr2(&q_u->server, server); - init_unistr2(&q_u->arch, arch); - init_unistr2(&q_u->driver, driver); + init_unistr2(&q_u->server, server, strlen(server)+1); + init_unistr2(&q_u->arch, arch, strlen(arch)+1); + init_unistr2(&q_u->driver, driver, strlen(driver)+1); return True; @@ -1209,7 +1209,7 @@ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, DEBUG(5,("make_spoolss_q_getprinterdata\n")); q_u->handle = *handle; - init_unistr2(&q_u->valuename, valuename); + init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); q_u->size = size; return True; @@ -1228,8 +1228,8 @@ BOOL make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX *q_u, DEBUG(5,("make_spoolss_q_getprinterdataex\n")); q_u->handle = *handle; - init_unistr2(&q_u->valuename, valuename); - init_unistr2(&q_u->keyname, keyname); + init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); + init_unistr2(&q_u->keyname, keyname, strlen(keyname) + 1); q_u->size = size; return True; @@ -5373,7 +5373,7 @@ BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx, DEBUG(5,("make_spoolss_q_addprinterdriver\n")); q_u->server_name_ptr = (srv_name!=NULL)?1:0; - init_unistr2(&q_u->server_name, srv_name); + init_unistr2(&q_u->server_name, srv_name, strlen(srv_name)+1); q_u->level = level; @@ -6161,7 +6161,7 @@ BOOL make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u, uint32 size) { memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - init_unistr2(&q_u->key, key); + init_unistr2(&q_u->key, key, strlen(key)+1); q_u->size = size; return True; @@ -6174,7 +6174,7 @@ BOOL make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND { memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); q_u->type = data_type; - init_unistr2(&q_u->value, value); + init_unistr2(&q_u->value, value, strlen(value)+1); q_u->max_len = q_u->real_len = data_size; q_u->data = data; @@ -6190,8 +6190,8 @@ BOOL make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX *q_u, const POLICY { memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); q_u->type = data_type; - init_unistr2(&q_u->value, value); - init_unistr2(&q_u->key, key); + init_unistr2(&q_u->value, value, strlen(value)+1); + init_unistr2(&q_u->key, key, strlen(key)+1); q_u->max_len = q_u->real_len = data_size; q_u->data = data; @@ -6588,7 +6588,7 @@ BOOL make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER *q_u, if (q_u == NULL) return False; - init_unistr2(&q_u->string, string); + init_unistr2(&q_u->string, string, strlen(string)+1); q_u->printer=printer; q_u->type=type; @@ -7091,7 +7091,7 @@ BOOL make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u, DEBUG(5,("make_spoolss_q_enumprinterkey\n")); memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - init_unistr2(&q_u->key, key); + init_unistr2(&q_u->key, key, strlen(key)+1); q_u->size = size; return True; @@ -7160,7 +7160,7 @@ BOOL make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY *q_u, DEBUG(5,("make_spoolss_q_deleteprinterkey\n")); memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - init_unistr2(&q_u->keyname, keyname); + init_unistr2(&q_u->keyname, keyname, strlen(keyname)+1); return True; } @@ -7382,8 +7382,8 @@ BOOL make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTOR { DEBUG(5,("make_spoolss_q_getprintprocessordirectory\n")); - init_unistr2(&q_u->name, name); - init_unistr2(&q_u->environment, environment); + init_unistr2(&q_u->name, name, strlen(name)+1); + init_unistr2(&q_u->environment, environment, strlen(environment)+1); q_u->level = level; @@ -7509,7 +7509,7 @@ BOOL make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle, q_u->level = level; q_u->level2 = level; memcpy(&q_u->form, form, sizeof(FORM)); - init_unistr2(&q_u->name, form_name); + init_unistr2(&q_u->name, form_name, strlen(form_name) + 1); return True; } @@ -7521,7 +7521,7 @@ BOOL make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle, BOOL make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, char *form) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); - init_unistr2(&q_u->name, form); + init_unistr2(&q_u->name, form, strlen(form) + 1); return True; } @@ -7535,7 +7535,7 @@ BOOL make_spoolss_q_getform(SPOOL_Q_GETFORM *q_u, POLICY_HND *handle, { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); q_u->level = level; - init_unistr2(&q_u->formname, formname); + init_unistr2(&q_u->formname, formname, strlen(formname) + 1); q_u->buffer=buffer; q_u->offered=offered; @@ -7642,13 +7642,16 @@ BOOL make_spoolss_q_startdocprinter(SPOOL_Q_STARTDOCPRINTER *q_u, ctr->docinfo.doc_info_1.p_datatype = datatype ? 1 : 0; if (docname) - init_unistr2(&ctr->docinfo.doc_info_1.docname, docname); + init_unistr2(&ctr->docinfo.doc_info_1.docname, docname, + strlen(docname) + 1); if (outputfile) - init_unistr2(&ctr->docinfo.doc_info_1.outputfile, outputfile); + init_unistr2(&ctr->docinfo.doc_info_1.outputfile, outputfile, + strlen(outputfile) + 1); if (datatype) - init_unistr2(&ctr->docinfo.doc_info_1.datatype, datatype); + init_unistr2(&ctr->docinfo.doc_info_1.datatype, datatype, + strlen(datatype) + 1); break; case 2: @@ -7697,7 +7700,7 @@ BOOL make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA *q_u, POLICY_HND *handle, char *valuename) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); - init_unistr2(&q_u->valuename, valuename); + init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); return True; } @@ -7711,8 +7714,8 @@ BOOL make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX *q_u, char *value) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); - init_unistr2(&q_u->valuename, value); - init_unistr2(&q_u->keyname, key); + init_unistr2(&q_u->valuename, value, strlen(value) + 1); + init_unistr2(&q_u->keyname, key, strlen(key) + 1); return True; } @@ -7732,7 +7735,8 @@ BOOL make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle, q_u->localmachine_ptr = 1; - init_unistr2(&q_u->localmachine, localmachine); + init_unistr2(&q_u->localmachine, localmachine, + strlen(localmachine) + 1); q_u->printerlocal = printerlocal; diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index fb3484d228..bfa1a13be9 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -37,7 +37,7 @@ void init_srv_share_info0_str(SH_INFO_0_STR *sh0, const char *net_name) DEBUG(5,("init_srv_share_info0_str\n")); if(net_name) - init_unistr2(&sh0->uni_netname, net_name); + init_unistr2(&sh0->uni_netname, net_name, strlen(net_name)+1); } /******************************************************************* @@ -102,9 +102,9 @@ void init_srv_share_info1_str(SH_INFO_1_STR *sh1, const char *net_name, const ch DEBUG(5,("init_srv_share_info1_str\n")); if(net_name) - init_unistr2(&sh1->uni_netname, net_name); + init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1); if(remark) - init_unistr2(&sh1->uni_remark, remark); + init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1); } /******************************************************************* @@ -185,13 +185,13 @@ void init_srv_share_info2_str(SH_INFO_2_STR *sh2, DEBUG(5,("init_srv_share_info2_str\n")); if (net_name) - init_unistr2(&sh2->uni_netname, net_name); + init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1); if (remark) - init_unistr2(&sh2->uni_remark, remark); + init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1); if (path) - init_unistr2(&sh2->uni_path, path); + init_unistr2(&sh2->uni_path, path, strlen(path)+1); if (passwd) - init_unistr2(&sh2->uni_passwd, passwd); + init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1); } /******************************************************************* @@ -297,9 +297,9 @@ void init_srv_share_info501_str(SH_INFO_501_STR *sh501, DEBUG(5,("init_srv_share_info501_str\n")); if(net_name) - init_unistr2(&sh501->uni_netname, net_name); + init_unistr2(&sh501->uni_netname, net_name, strlen(net_name)+1); if(remark) - init_unistr2(&sh501->uni_remark, remark); + init_unistr2(&sh501->uni_remark, remark, strlen(remark)+1); } /******************************************************************* @@ -447,13 +447,13 @@ void init_srv_share_info502_str(SH_INFO_502_STR *sh502str, DEBUG(5,("init_srv_share_info502_str\n")); if(net_name) - init_unistr2(&sh502str->uni_netname, net_name); + init_unistr2(&sh502str->uni_netname, net_name, strlen(net_name)+1); if(remark) - init_unistr2(&sh502str->uni_remark, remark); + init_unistr2(&sh502str->uni_remark, remark, strlen(remark)+1); if(path) - init_unistr2(&sh502str->uni_path, path); + init_unistr2(&sh502str->uni_path, path, strlen(path)+1); if(passwd) - init_unistr2(&sh502str->uni_passwd, passwd); + init_unistr2(&sh502str->uni_passwd, passwd, strlen(passwd)+1); sh502str->sd = psd; sh502str->reserved = 0; sh502str->sd_size = sd_size; @@ -552,7 +552,7 @@ void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, const char *remark) DEBUG(5,("init_srv_share_info1004_str\n")); if(remark) - init_unistr2(&sh1004->uni_remark, remark); + init_unistr2(&sh1004->uni_remark, remark, strlen(remark)+1); } /******************************************************************* @@ -659,7 +659,7 @@ void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate DEBUG(5,("init_srv_share_info1007_str\n")); if(alternate_directory_name) - init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name); + init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, strlen(alternate_directory_name)+1); } /******************************************************************* @@ -1473,7 +1473,7 @@ void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname, const char *path, const char *passwd) { q->ptr_srv_name = 1; - init_unistr2(&q->uni_srv_name, srvname); + init_unistr2(&q->uni_srv_name, srvname, strlen(srvname) +1); q->info.switch_value = q->info_level = 2; q->info.ptr_share_ctr = 1; @@ -1524,8 +1524,8 @@ void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname, const char *sharename) { del->ptr_srv_name = 1; - init_unistr2(&del->uni_srv_name, srvname); - init_unistr2(&del->uni_share_name, sharename); + init_unistr2(&del->uni_srv_name, srvname, strlen(srvname) +1 ); + init_unistr2(&del->uni_share_name, sharename, strlen(sharename) + 1); } /******************************************************************* @@ -1588,7 +1588,7 @@ void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, const char *name) { DEBUG(5,("init_srv_sess_info0_str\n")); - init_unistr2(&ss0->uni_name, name); + init_unistr2(&ss0->uni_name, name, strlen(name)+1); } /******************************************************************* @@ -1702,8 +1702,8 @@ void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, const char *name, const char { DEBUG(5,("init_srv_sess_info1_str\n")); - init_unistr2(&ss1->uni_name, name); - init_unistr2(&ss1->uni_user, user); + init_unistr2(&ss1->uni_name, name, strlen(name)+1); + init_unistr2(&ss1->uni_user, user, strlen(user)+1); } /******************************************************************* @@ -2074,8 +2074,8 @@ void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, const char *usr_name, const c { DEBUG(5,("init_srv_conn_info1_str\n")); - init_unistr2(&ss1->uni_usr_name, usr_name); - init_unistr2(&ss1->uni_net_name, net_name); + init_unistr2(&ss1->uni_usr_name, usr_name, strlen(usr_name)+1); + init_unistr2(&ss1->uni_net_name, net_name, strlen(net_name)+1); } /******************************************************************* @@ -2364,8 +2364,8 @@ void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, const char *user_name, const { DEBUG(5,("init_srv_file_info3_str\n")); - init_unistr2(&fi3->uni_path_name, path_name); - init_unistr2(&fi3->uni_user_name, user_name); + init_unistr2(&fi3->uni_path_name, path_name, strlen(path_name)+1); + init_unistr2(&fi3->uni_user_name, user_name, strlen(user_name)+1); } /******************************************************************* @@ -2627,7 +2627,7 @@ void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, const char *server, uint32 file_id) { q_n->ptr_srv_name = 1; - init_unistr2(&q_n->uni_srv_name, server); + init_unistr2(&q_n->uni_srv_name, server, strlen(server) + 1); q_n->file_id = file_id; } @@ -3585,6 +3585,6 @@ BOOL srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server) { q_u->ptr_srv_name = 1; - init_unistr2(&q_u->uni_srv_name, server); + init_unistr2(&q_u->uni_srv_name, server, strlen(server) + 1); } -- cgit From 5f9112ac1b03cf3164ec6385237746a90fe0ddfd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 28 Jan 2003 12:52:51 +0000 Subject: cleaned up the lsa_enum_acct_rights function and added a lsa_add_acct_rights function. This allows us to add privileges remotely to accounts using rpcclient. (This used to be commit 2e5e659e095a94b0716d97f673f993f0af99aabe) --- source3/rpc_parse/parse_lsa.c | 74 ++++++++++++++++++++++++++++++++++++++---- source3/rpc_parse/parse_misc.c | 41 ++++++++++++++++++++--- 2 files changed, 103 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 7c9f74da37..ac0242b113 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1519,6 +1519,9 @@ BOOL lsa_io_r_priv_get_dispname(const char *desc, LSA_R_PRIV_GET_DISPNAME *r_q, 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)); @@ -1549,6 +1552,7 @@ BOOL lsa_io_q_enum_accounts(const char *desc, LSA_Q_ENUM_ACCOUNTS *q_q, prs_stru return True; } + /******************************************************************* Inits an LSA_R_ENUM_PRIVS structure. ********************************************************************/ @@ -2249,8 +2253,7 @@ void init_q_enum_acct_rights(LSA_Q_ENUM_ACCT_RIGHTS *q_q, DEBUG(5, ("init_q_enum_acct_rights\n")); q_q->pol = *hnd; - q_q->count = count; - q_q->sid = *sid; + init_dom_sid2(&q_q->sid, sid); } /******************************************************************* @@ -2258,6 +2261,7 @@ 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 *q_q, prs_struct *ps, int depth) { + if (q_q == NULL) return False; @@ -2267,10 +2271,7 @@ BOOL lsa_io_q_enum_acct_rights(const char *desc, LSA_Q_ENUM_ACCT_RIGHTS *q_q, pr if (!smb_io_pol_hnd("", &q_q->pol, ps, depth)) return False; - if(!prs_uint32("count ", ps, depth, &q_q->count)) - return False; - - if(!smb_io_dom_sid("sid", &q_q->sid, ps, depth)) + if(!smb_io_dom_sid2("sid", &q_q->sid, ps, depth)) return False; return True; @@ -2288,9 +2289,68 @@ BOOL lsa_io_r_enum_acct_rights(const char *desc, LSA_R_ENUM_ACCT_RIGHTS *r_c, pr if(!prs_uint32("count ", ps, depth, &r_c->count)) return False; - if(!smb_io_unistr_array("rights", &r_c->rights, ps, depth)) + if(!smb_io_unistr2_array("rights", &r_c->rights, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_ntstatus("status", ps, depth, &r_c->status)) return False; + return True; +} + + +/******************************************************************* + Inits an LSA_Q_ADD_ACCT_RIGHTS structure. +********************************************************************/ +void init_q_add_acct_rights(LSA_Q_ADD_ACCT_RIGHTS *q_q, + POLICY_HND *hnd, + DOM_SID *sid, + uint32 count, + const char **rights) +{ + DEBUG(5, ("init_q_add_acct_rights\n")); + + q_q->pol = *hnd; + init_dom_sid2(&q_q->sid, sid); + init_unistr2_array(&q_q->rights, count, rights); + q_q->count = 5; +} + + +/******************************************************************* +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 *q_q, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_q_add_acct_rights"); + depth++; + + if (!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + return False; + + if(!smb_io_dom_sid2("sid", &q_q->sid, ps, depth)) + return False; + + if(!prs_uint32("count", ps, depth, &q_q->rights.count)) + return False; + + if(!smb_io_unistr2_array("rights", &q_q->rights, ps, depth)) + 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 *r_c, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_r_add_acct_rights"); + depth++; + if(!prs_ntstatus("status", ps, depth, &r_c->status)) return False; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 9d3bd6f28a..43d26a691d 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -216,6 +216,7 @@ BOOL smb_io_dom_sid(const char *desc, DOM_SID *sid, prs_struct *ps, int depth) if(!prs_uint8 ("sid_rev_num", ps, depth, &sid->sid_rev_num)) return False; + if(!prs_uint8 ("num_auths ", ps, depth, &sid->num_auths)) return False; @@ -1043,17 +1044,45 @@ BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct * } +/* + initialise a UNISTR_ARRAY from a char** +*/ +BOOL init_unistr2_array(UNISTR2_ARRAY *array, + uint32 count, const char **strings) +{ + int i; + + array->count = count; + array->ref_id = count?1:0; + if (array->count == 0) { + return True; + } + + array->strings = (UNISTR2_ARRAY_EL *)talloc_zero(get_talloc_ctx(), count * sizeof(UNISTR2_ARRAY_EL)); + if (!array->strings) { + return False; + } + + for (i=0;istrings[i].string, strings[i], strlen(strings[i])); + array->strings[i].size = array->strings[i].string.uni_max_len*2; + array->strings[i].length = array->strings[i].size; + array->strings[i].ref_id = 1; + } + + return True; +} + /******************************************************************* - Reads or writes a UNISTR_ARRAY structure. + Reads or writes a UNISTR2_ARRAY structure. ********************************************************************/ -BOOL smb_io_unistr_array(const char *desc, UNISTR_ARRAY *array, prs_struct *ps, int depth) +BOOL smb_io_unistr2_array(const char *desc, UNISTR2_ARRAY *array, prs_struct *ps, int depth) { int i; + prs_debug(ps, depth, desc, "smb_io_unistr2_array"); depth++; - array->count = 0; - if(!prs_uint32("ref_id", ps, depth, &array->ref_id)) return False; @@ -1068,7 +1097,9 @@ BOOL smb_io_unistr_array(const char *desc, UNISTR_ARRAY *array, prs_struct *ps, return True; } - array->strings = talloc_zero(get_talloc_ctx(), array->count * sizeof(array->strings[0])); + if (UNMARSHALLING(ps)) { + array->strings = talloc_zero(get_talloc_ctx(), array->count * sizeof(array->strings[0])); + } if (! array->strings) { return False; } -- cgit From 734c6d8a513272c6e65ba60c62e21080c4339b8d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 28 Jan 2003 21:09:56 +0000 Subject: Merging tridge's privillage client changes from HEAD. Jeremy. (This used to be commit 30a33920b4d834edc877cc0080291fbda983083a) --- source3/rpc_parse/parse_lsa.c | 74 ++++++++++++++++++++++++++++++++++++++---- source3/rpc_parse/parse_misc.c | 41 ++++++++++++++++++++--- 2 files changed, 103 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 7c9f74da37..ac0242b113 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1519,6 +1519,9 @@ BOOL lsa_io_r_priv_get_dispname(const char *desc, LSA_R_PRIV_GET_DISPNAME *r_q, 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)); @@ -1549,6 +1552,7 @@ BOOL lsa_io_q_enum_accounts(const char *desc, LSA_Q_ENUM_ACCOUNTS *q_q, prs_stru return True; } + /******************************************************************* Inits an LSA_R_ENUM_PRIVS structure. ********************************************************************/ @@ -2249,8 +2253,7 @@ void init_q_enum_acct_rights(LSA_Q_ENUM_ACCT_RIGHTS *q_q, DEBUG(5, ("init_q_enum_acct_rights\n")); q_q->pol = *hnd; - q_q->count = count; - q_q->sid = *sid; + init_dom_sid2(&q_q->sid, sid); } /******************************************************************* @@ -2258,6 +2261,7 @@ 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 *q_q, prs_struct *ps, int depth) { + if (q_q == NULL) return False; @@ -2267,10 +2271,7 @@ BOOL lsa_io_q_enum_acct_rights(const char *desc, LSA_Q_ENUM_ACCT_RIGHTS *q_q, pr if (!smb_io_pol_hnd("", &q_q->pol, ps, depth)) return False; - if(!prs_uint32("count ", ps, depth, &q_q->count)) - return False; - - if(!smb_io_dom_sid("sid", &q_q->sid, ps, depth)) + if(!smb_io_dom_sid2("sid", &q_q->sid, ps, depth)) return False; return True; @@ -2288,9 +2289,68 @@ BOOL lsa_io_r_enum_acct_rights(const char *desc, LSA_R_ENUM_ACCT_RIGHTS *r_c, pr if(!prs_uint32("count ", ps, depth, &r_c->count)) return False; - if(!smb_io_unistr_array("rights", &r_c->rights, ps, depth)) + if(!smb_io_unistr2_array("rights", &r_c->rights, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_ntstatus("status", ps, depth, &r_c->status)) return False; + return True; +} + + +/******************************************************************* + Inits an LSA_Q_ADD_ACCT_RIGHTS structure. +********************************************************************/ +void init_q_add_acct_rights(LSA_Q_ADD_ACCT_RIGHTS *q_q, + POLICY_HND *hnd, + DOM_SID *sid, + uint32 count, + const char **rights) +{ + DEBUG(5, ("init_q_add_acct_rights\n")); + + q_q->pol = *hnd; + init_dom_sid2(&q_q->sid, sid); + init_unistr2_array(&q_q->rights, count, rights); + q_q->count = 5; +} + + +/******************************************************************* +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 *q_q, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_q_add_acct_rights"); + depth++; + + if (!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + return False; + + if(!smb_io_dom_sid2("sid", &q_q->sid, ps, depth)) + return False; + + if(!prs_uint32("count", ps, depth, &q_q->rights.count)) + return False; + + if(!smb_io_unistr2_array("rights", &q_q->rights, ps, depth)) + 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 *r_c, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_r_add_acct_rights"); + depth++; + if(!prs_ntstatus("status", ps, depth, &r_c->status)) return False; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 9d3bd6f28a..43d26a691d 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -216,6 +216,7 @@ BOOL smb_io_dom_sid(const char *desc, DOM_SID *sid, prs_struct *ps, int depth) if(!prs_uint8 ("sid_rev_num", ps, depth, &sid->sid_rev_num)) return False; + if(!prs_uint8 ("num_auths ", ps, depth, &sid->num_auths)) return False; @@ -1043,17 +1044,45 @@ BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct * } +/* + initialise a UNISTR_ARRAY from a char** +*/ +BOOL init_unistr2_array(UNISTR2_ARRAY *array, + uint32 count, const char **strings) +{ + int i; + + array->count = count; + array->ref_id = count?1:0; + if (array->count == 0) { + return True; + } + + array->strings = (UNISTR2_ARRAY_EL *)talloc_zero(get_talloc_ctx(), count * sizeof(UNISTR2_ARRAY_EL)); + if (!array->strings) { + return False; + } + + for (i=0;istrings[i].string, strings[i], strlen(strings[i])); + array->strings[i].size = array->strings[i].string.uni_max_len*2; + array->strings[i].length = array->strings[i].size; + array->strings[i].ref_id = 1; + } + + return True; +} + /******************************************************************* - Reads or writes a UNISTR_ARRAY structure. + Reads or writes a UNISTR2_ARRAY structure. ********************************************************************/ -BOOL smb_io_unistr_array(const char *desc, UNISTR_ARRAY *array, prs_struct *ps, int depth) +BOOL smb_io_unistr2_array(const char *desc, UNISTR2_ARRAY *array, prs_struct *ps, int depth) { int i; + prs_debug(ps, depth, desc, "smb_io_unistr2_array"); depth++; - array->count = 0; - if(!prs_uint32("ref_id", ps, depth, &array->ref_id)) return False; @@ -1068,7 +1097,9 @@ BOOL smb_io_unistr_array(const char *desc, UNISTR_ARRAY *array, prs_struct *ps, return True; } - array->strings = talloc_zero(get_talloc_ctx(), array->count * sizeof(array->strings[0])); + if (UNMARSHALLING(ps)) { + array->strings = talloc_zero(get_talloc_ctx(), array->count * sizeof(array->strings[0])); + } if (! array->strings) { return False; } -- cgit From 79b26867c0ff712e9400f06fdb0a65bcb5e668b7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 28 Jan 2003 21:31:45 +0000 Subject: added LsaRemoveAccountRights this now gives us complete remove privileges control in the client libs, so we are in good shape for starting on the server side. (This used to be commit bf99440398db86f46233eb2f5adddffb61280a1b) --- source3/rpc_parse/parse_lsa.c | 61 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index ac0242b113..3c9c02a23a 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2356,3 +2356,64 @@ BOOL lsa_io_r_add_acct_rights(const char *desc, LSA_R_ADD_ACCT_RIGHTS *r_c, prs_ return True; } + + +/******************************************************************* + Inits an LSA_Q_REMOVE_ACCT_RIGHTS structure. +********************************************************************/ +void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *q_q, + POLICY_HND *hnd, + DOM_SID *sid, + uint32 removeall, + uint32 count, + const char **rights) +{ + DEBUG(5, ("init_q_remove_acct_rights\n")); + + q_q->pol = *hnd; + init_dom_sid2(&q_q->sid, sid); + q_q->removeall = removeall; + init_unistr2_array(&q_q->rights, count, rights); + q_q->count = 5; +} + + +/******************************************************************* +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 *q_q, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_q_remove_acct_rights"); + depth++; + + if (!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + return False; + + if(!smb_io_dom_sid2("sid", &q_q->sid, ps, depth)) + return False; + + if(!prs_uint32("removeall", ps, depth, &q_q->removeall)) + return False; + + if(!prs_uint32("count", ps, depth, &q_q->rights.count)) + return False; + + if(!smb_io_unistr2_array("rights", &q_q->rights, ps, depth)) + 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 *r_c, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_r_remove_acct_rights"); + depth++; + + if(!prs_ntstatus("status", ps, depth, &r_c->status)) + return False; + + return True; +} -- cgit From 438b5c92d4b993efe9bc195851fcb52f49e919fc Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 29 Jan 2003 02:24:12 +0000 Subject: Merge tridge's client priv code from HEAD. Jeremy (This used to be commit 49739be1e2f047fa2cc2fd42eadb190a82114485) --- source3/rpc_parse/parse_lsa.c | 61 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index ac0242b113..3c9c02a23a 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2356,3 +2356,64 @@ BOOL lsa_io_r_add_acct_rights(const char *desc, LSA_R_ADD_ACCT_RIGHTS *r_c, prs_ return True; } + + +/******************************************************************* + Inits an LSA_Q_REMOVE_ACCT_RIGHTS structure. +********************************************************************/ +void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *q_q, + POLICY_HND *hnd, + DOM_SID *sid, + uint32 removeall, + uint32 count, + const char **rights) +{ + DEBUG(5, ("init_q_remove_acct_rights\n")); + + q_q->pol = *hnd; + init_dom_sid2(&q_q->sid, sid); + q_q->removeall = removeall; + init_unistr2_array(&q_q->rights, count, rights); + q_q->count = 5; +} + + +/******************************************************************* +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 *q_q, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_q_remove_acct_rights"); + depth++; + + if (!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + return False; + + if(!smb_io_dom_sid2("sid", &q_q->sid, ps, depth)) + return False; + + if(!prs_uint32("removeall", ps, depth, &q_q->removeall)) + return False; + + if(!prs_uint32("count", ps, depth, &q_q->rights.count)) + return False; + + if(!smb_io_unistr2_array("rights", &q_q->rights, ps, depth)) + 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 *r_c, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_r_remove_acct_rights"); + depth++; + + if(!prs_ntstatus("status", ps, depth, &r_c->status)) + return False; + + return True; +} -- cgit From 9ce596b2a0116e0d4d76a5dac34206d10ad9a643 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 29 Jan 2003 06:13:18 +0000 Subject: Pass down max_size parameter to init_samr_q_query_dispinfo() instead of hardcoding it to 0xffff. (This used to be commit c3b077f763d94ba063b2d4231cd5d411e44933e7) --- source3/rpc_parse/parse_samr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 918cdbcd1d..d031d13955 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1448,7 +1448,7 @@ 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_entries, uint32 max_size) { DEBUG(5, ("init_samr_q_query_dispinfo\n")); @@ -1458,7 +1458,7 @@ void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO * q_e, POLICY_HND *pol, q_e->start_idx = start_idx; q_e->max_entries = max_entries; - q_e->max_size = 0xffff; /* Not especially useful */ + q_e->max_size = max_size; } /******************************************************************* -- cgit From f8601187caac93c5b03b2a5c6f06c674291a0a17 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 29 Jan 2003 20:15:35 +0000 Subject: Merge tpot's changes to request the correct sizes for user dispinfo from HEAD. I had to do this for him as he was *so* tired, the poor chap, plus he has this bad leg, plus the dog ate his homework etc. etc. Jeremy. (This used to be commit 1e752b48a12cdcf2cb6343705be83f304e5ee2b6) --- source3/rpc_parse/parse_samr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 918cdbcd1d..d031d13955 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1448,7 +1448,7 @@ 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_entries, uint32 max_size) { DEBUG(5, ("init_samr_q_query_dispinfo\n")); @@ -1458,7 +1458,7 @@ void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO * q_e, POLICY_HND *pol, q_e->start_idx = start_idx; q_e->max_entries = max_entries; - q_e->max_size = 0xffff; /* Not especially useful */ + q_e->max_size = max_size; } /******************************************************************* -- cgit From 28e3e4843194e2559714adc03e05c43f9328aeda Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 2 Feb 2003 05:10:26 +0000 Subject: Send the user's session key in the SAMLOGON reply, so that a member server can use smb signing. Andrew Bartlett (This used to be commit 574e8a8ab7c94ecd9113df42e395e83632980675) --- source3/rpc_parse/parse_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index ac21e6f2dd..853bca3b54 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1271,7 +1271,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, uint16 logon_count, uint16 bad_pw_count, uint32 num_groups, const DOM_GID *gids, - uint32 user_flgs, uchar *sess_key, + uint32 user_flgs, uchar sess_key[16], const char *logon_srv, const char *logon_dom, const DOM_SID *dom_sid, const char *other_sids) { @@ -1448,7 +1448,7 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, if(!prs_uint32("user_flgs ", ps, depth, &usr->user_flgs)) /* user flags */ return False; - if(!prs_uint8s(False, "user_sess_key", ps, depth, usr->user_sess_key, 16)) /* unused user session key */ + 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 */ -- cgit From 3719bfd1a0d15c7c17d86bc049634063434ba8ca Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 2 Feb 2003 05:22:37 +0000 Subject: Merge from HEAD: Send the session key to the client, allowing it to perform SMB signing. Andrew Bartlett (This used to be commit 9bcdb869e53ee8048dd69053b804bdaf55db7b91) --- source3/rpc_parse/parse_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index ac21e6f2dd..853bca3b54 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1271,7 +1271,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, uint16 logon_count, uint16 bad_pw_count, uint32 num_groups, const DOM_GID *gids, - uint32 user_flgs, uchar *sess_key, + uint32 user_flgs, uchar sess_key[16], const char *logon_srv, const char *logon_dom, const DOM_SID *dom_sid, const char *other_sids) { @@ -1448,7 +1448,7 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, if(!prs_uint32("user_flgs ", ps, depth, &usr->user_flgs)) /* user flags */ return False; - if(!prs_uint8s(False, "user_sess_key", ps, depth, usr->user_sess_key, 16)) /* unused user session key */ + 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 */ -- cgit From b4776d89ea9861def5b9d491b3ec6b881d086505 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 6 Feb 2003 05:42:19 +0000 Subject: added the LSA privileges server backend stubs. Right now they just log what was requested. (This used to be commit 64ac6c2bcb729c4658de48e929cc792681903ecc) --- source3/rpc_parse/parse_lsa.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 3c9c02a23a..a3ffe86af3 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2301,6 +2301,19 @@ BOOL lsa_io_r_enum_acct_rights(const char *desc, LSA_R_ENUM_ACCT_RIGHTS *r_c, pr return True; } +/******************************************************************* + Inits an LSA_R_ENUM_ACCT_RIGHTS structure. +********************************************************************/ +void init_r_enum_acct_rights(LSA_R_ENUM_ACCT_RIGHTS *q_r, + uint32 count, + const char **rights) +{ + DEBUG(5, ("init_r_enum_acct_rights\n")); + + q_r->count = count; + init_unistr2_array(&q_r->rights, count, rights); +} + /******************************************************************* Inits an LSA_Q_ADD_ACCT_RIGHTS structure. @@ -2316,7 +2329,6 @@ void init_q_add_acct_rights(LSA_Q_ADD_ACCT_RIGHTS *q_q, q_q->pol = *hnd; init_dom_sid2(&q_q->sid, sid); init_unistr2_array(&q_q->rights, count, rights); - q_q->count = 5; } @@ -2357,6 +2369,15 @@ BOOL lsa_io_r_add_acct_rights(const char *desc, LSA_R_ADD_ACCT_RIGHTS *r_c, prs_ return True; } +/******************************************************************* + Inits an LSA_R_ADD_ACCT_RIGHTS structure. +********************************************************************/ +void init_r_add_acct_rights(LSA_R_ADD_ACCT_RIGHTS *q_r) +{ + DEBUG(5, ("init_r_add_acct_rights\n")); + /* oh what a silly function! */ +} + /******************************************************************* Inits an LSA_Q_REMOVE_ACCT_RIGHTS structure. @@ -2417,3 +2438,11 @@ BOOL lsa_io_r_remove_acct_rights(const char *desc, LSA_R_REMOVE_ACCT_RIGHTS *r_c return True; } + +/******************************************************************* + Inits an LSA_R_REMOVE_ACCT_RIGHTS structure. +********************************************************************/ +void init_r_remove_acct_rights(LSA_R_REMOVE_ACCT_RIGHTS *q_r) +{ + DEBUG(5, ("init_r_remove_acct_rights\n")); +} -- cgit From 6c66e42d2ccf025f57e652f7ae689f8a3c2ada59 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 10 Feb 2003 11:31:23 +0000 Subject: added the 'lsaenumacctwithright' command to rpcclient. This allows you to lookup what SIDs have a particular privilege (that is how privileges are stored). (This used to be commit 3ddb5fb0dd33992b7db54a661752551a3fefc0b4) --- source3/rpc_parse/parse_lsa.c | 68 ++++++++++++++++++++++++++++++++++++++++-- source3/rpc_parse/parse_misc.c | 45 ++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index a3ffe86af3..6832b0df66 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2395,7 +2395,6 @@ void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *q_q, init_dom_sid2(&q_q->sid, sid); q_q->removeall = removeall; init_unistr2_array(&q_q->rights, count, rights); - q_q->count = 5; } @@ -2426,7 +2425,7 @@ BOOL lsa_io_q_remove_acct_rights(const char *desc, LSA_Q_REMOVE_ACCT_RIGHTS *q_q } /******************************************************************* -reads or writes a LSA_R_ENUM_ACCT_RIGHTS structure. +reads or writes a LSA_R_REMOVE_ACCT_RIGHTS structure. ********************************************************************/ BOOL lsa_io_r_remove_acct_rights(const char *desc, LSA_R_REMOVE_ACCT_RIGHTS *r_c, prs_struct *ps, int depth) { @@ -2446,3 +2445,68 @@ void init_r_remove_acct_rights(LSA_R_REMOVE_ACCT_RIGHTS *q_r) { DEBUG(5, ("init_r_remove_acct_rights\n")); } + +/******************************************************************* + Inits an LSA_Q_ENUM_ACCT_WITH_RIGHT structure. +********************************************************************/ +void init_q_enum_acct_with_right(LSA_Q_ENUM_ACCT_WITH_RIGHT *q_q, + POLICY_HND *hnd, + const char *right) +{ + DEBUG(5, ("init_q_enum_acct_with_right\n")); + + q_q->pol = *hnd; + init_unistr2(&q_q->right, right, strlen(right)); + init_str_hdr(&q_q->right_hdr, + q_q->right.uni_max_len*2, + q_q->right.uni_max_len*2, right?1:0); +} + + +/******************************************************************* +reads or writes a LSA_Q_ENUM_ACCT_WITH_RIGHT structure. +********************************************************************/ +BOOL lsa_io_q_enum_acct_with_right(const char *desc, LSA_Q_ENUM_ACCT_WITH_RIGHT *q_q, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_q_enum_acct_with_right"); + depth++; + + if (!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + return False; + + if (!prs_uint32("ref_id ", ps, depth, &q_q->right_hdr.buffer)) + return False; + + if (UNMARSHALLING(ps) && q_q->right_hdr.buffer == 0) { + return True; + } + + if (!smb_io_strhdr("", &q_q->right_hdr, ps, depth)) + return False; + + if (!smb_io_unistr2("", &q_q->right, q_q->right_hdr.buffer, ps, depth)) + return False; + + return True; +} + + +/******************************************************************* +reads or writes a LSA_R_ENUM_ACCT_WITH_RIGHT structure. +********************************************************************/ +BOOL lsa_io_r_enum_acct_with_right(const char *desc, LSA_R_ENUM_ACCT_WITH_RIGHT *r_c, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_r_enum_acct_with_right"); + depth++; + + if (!prs_uint32("count ", ps, depth, &r_c->count)) + return False; + + if (!smb_io_sid_array("sids ", &r_c->sids, ps, depth)) + return False; + + if(!prs_ntstatus("status", ps, depth, &r_c->status)) + return False; + + return True; +} diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 43d26a691d..403a12ee53 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1122,6 +1122,51 @@ BOOL smb_io_unistr2_array(const char *desc, UNISTR2_ARRAY *array, prs_struct *ps } +/******************************************************************* + Reads or writes a SID_ARRAY structure. +********************************************************************/ +BOOL smb_io_sid_array(const char *desc, SID_ARRAY *array, prs_struct *ps, int depth) +{ + int i; + + prs_debug(ps, depth, desc, "smb_io_sid_array"); + depth++; + + if(!prs_uint32("ref_id", ps, depth, &array->ref_id)) + return False; + + if (! array->ref_id) { + return True; + } + + if(!prs_uint32("count", ps, depth, &array->count)) + return False; + + if (array->count == 0) { + return True; + } + + if (UNMARSHALLING(ps)) { + array->sids = talloc_zero(get_talloc_ctx(), array->count * sizeof(array->sids[0])); + } + if (! array->sids) { + return False; + } + + for (i=0;icount;i++) { + if(!prs_uint32("ref_id", ps, depth, &array->sids[i].ref_id)) + return False; + } + + for (i=0;icount;i++) { + if (!smb_io_dom_sid2("sid", &array->sids[i].sid, ps, depth)) + return False; + } + + return True; +} + + /******************************************************************* Inits a DOM_RID2 structure. ********************************************************************/ -- cgit From 8ddccd47c733abe6118c6f6f8d011bfc508396c1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 11 Feb 2003 21:55:48 +0000 Subject: added server stubs for lsa_enum_acct_with_right (This used to be commit aa2abacaf48924797b6803786c14c9f303185e4a) --- source3/rpc_parse/parse_lsa.c | 13 ++++++++ source3/rpc_parse/parse_misc.c | 73 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 6832b0df66..53a0fc958d 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2510,3 +2510,16 @@ BOOL lsa_io_r_enum_acct_with_right(const char *desc, LSA_R_ENUM_ACCT_WITH_RIGHT return True; } + +/******************************************************************* + Inits an LSA_R_ENUM_ACCT_WITH_RIGHT structure. +********************************************************************/ +void init_r_enum_acct_with_right(LSA_R_ENUM_ACCT_WITH_RIGHT *r_c, + uint32 count, + DOM_SID *sids) +{ + DEBUG(5, ("init_r_enum_acct_with_right\n")); + + r_c->count = count; + init_sid_array(&r_c->sids, count, sids); +} diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 403a12ee53..524b1ed61c 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1122,6 +1122,79 @@ BOOL smb_io_unistr2_array(const char *desc, UNISTR2_ARRAY *array, prs_struct *ps } +/* + initialise a SID_ARRAY from a list of sids +*/ +BOOL init_sid_array(SID_ARRAY *array, + uint32 count, DOM_SID *sids) +{ + int i; + + array->count = count; + array->ref_id = count?1:0; + if (array->count == 0) { + return True; + } + + array->sids = (SID_ARRAY_EL *)talloc_zero(get_talloc_ctx(), count * sizeof(SID_ARRAY_EL)); + if (!array->sids) { + return False; + } + + for (i=0;isids[i].ref_id = 1; + init_dom_sid2(&array->sids[i].sid, &sids[i]); + } + + return True; +} + + +/******************************************************************* + Reads or writes a SID_ARRAY structure. +********************************************************************/ +BOOL smb_io_sid_array(const char *desc, SID_ARRAY *array, prs_struct *ps, int depth) +{ + int i; + + prs_debug(ps, depth, desc, "smb_io_sid_array"); + depth++; + + if(!prs_uint32("ref_id", ps, depth, &array->ref_id)) + return False; + + if (! array->ref_id) { + return True; + } + + if(!prs_uint32("count", ps, depth, &array->count)) + return False; + + if (array->count == 0) { + return True; + } + + if (UNMARSHALLING(ps)) { + array->sids = talloc_zero(get_talloc_ctx(), array->count * sizeof(array->sids[0])); + } + if (! array->sids) { + return False; + } + + for (i=0;icount;i++) { + if(!prs_uint32("ref_id", ps, depth, &array->sids[i].ref_id)) + return False; + } + + for (i=0;icount;i++) { + if (!smb_io_dom_sid2("sid", &array->sids[i].sid, ps, depth)) + return False; + } + + return True; +} + + /******************************************************************* Reads or writes a SID_ARRAY structure. ********************************************************************/ -- cgit From 5b709467441dd79a206d1542d86be9085322b0cc Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 11 Feb 2003 22:53:57 +0000 Subject: removed a duplicate copy of smb_io_sid_array() (This used to be commit 2ef72f95003cebf2ff56e47f16fb8be0e8032042) --- source3/rpc_parse/parse_misc.c | 46 ------------------------------------------ 1 file changed, 46 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 524b1ed61c..df80c76ee5 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1194,52 +1194,6 @@ BOOL smb_io_sid_array(const char *desc, SID_ARRAY *array, prs_struct *ps, int de return True; } - -/******************************************************************* - Reads or writes a SID_ARRAY structure. -********************************************************************/ -BOOL smb_io_sid_array(const char *desc, SID_ARRAY *array, prs_struct *ps, int depth) -{ - int i; - - prs_debug(ps, depth, desc, "smb_io_sid_array"); - depth++; - - if(!prs_uint32("ref_id", ps, depth, &array->ref_id)) - return False; - - if (! array->ref_id) { - return True; - } - - if(!prs_uint32("count", ps, depth, &array->count)) - return False; - - if (array->count == 0) { - return True; - } - - if (UNMARSHALLING(ps)) { - array->sids = talloc_zero(get_talloc_ctx(), array->count * sizeof(array->sids[0])); - } - if (! array->sids) { - return False; - } - - for (i=0;icount;i++) { - if(!prs_uint32("ref_id", ps, depth, &array->sids[i].ref_id)) - return False; - } - - for (i=0;icount;i++) { - if (!smb_io_dom_sid2("sid", &array->sids[i].sid, ps, depth)) - return False; - } - - return True; -} - - /******************************************************************* Inits a DOM_RID2 structure. ********************************************************************/ -- cgit From 8fc1f1aead6db996a6d96efdc5f81779afc9c8d2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 14 Feb 2003 22:55:46 +0000 Subject: Ensure that only parse_prs.c access internal members of the prs_struct. Needed to move to disk based i/o later. Jeremy. (This used to be commit a823fee5b41a5b6cd4ef05aa1f85f7725bd272a5) --- source3/rpc_parse/parse_net.c | 28 +++++++++--------- source3/rpc_parse/parse_prs.c | 66 +++++++++++++++++++++++++++++++++++-------- source3/rpc_parse/parse_sec.c | 8 +++--- 3 files changed, 72 insertions(+), 30 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 853bca3b54..1e31836476 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1804,9 +1804,9 @@ static BOOL net_io_sam_domain_info(const char *desc, SAM_DOMAIN_INFO * info, if (!smb_io_unihdr("hdr_unknown", &info->hdr_unknown, ps, depth)) return False; - if (ps->data_offset + 40 > ps->buffer_size) + if (prs_offset(ps) + 40 > prs_data_size(ps)) return False; - ps->data_offset += 40; + prs_set_offset(ps, prs_offset(ps) + 40); if (!smb_io_unistr2("uni_dom_name", &info->uni_dom_name, info->hdr_dom_name.buffer, ps, depth)) @@ -1843,9 +1843,9 @@ static BOOL net_io_sam_group_info(const char *desc, SAM_GROUP_INFO * info, if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth)) return False; - if (ps->data_offset + 48 > ps->buffer_size) + if (prs_offset(ps) + 48 > prs_data_size(ps)) return False; - ps->data_offset += 48; + prs_set_offset(ps, prs_offset(ps) + 48); if (!smb_io_unistr2("uni_grp_name", &info->uni_grp_name, info->hdr_grp_name.buffer, ps, depth)) @@ -2124,13 +2124,13 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], uint32 len = 0x44; if (!prs_uint32("pwd_len", ps, depth, &len)) return False; - old_offset = ps->data_offset; + old_offset = prs_offset(ps); if (len == 0x44) { if (ps->io) { /* reading */ - if (!prs_hash1(ps, ps->data_offset, sess_key)) + if (!prs_hash1(ps, prs_offset(ps), sess_key)) return False; } if (!net_io_sam_passwd_info("pass", &info->pass, @@ -2144,9 +2144,9 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], return False; } } - if (old_offset + len > ps->buffer_size) + if (old_offset + len > prs_data_size(ps)) return False; - ps->data_offset = old_offset + len; + prs_set_offset(ps, old_offset + len); } if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, info->hdr_sec_desc.buffer, ps, depth)) @@ -2181,9 +2181,9 @@ static BOOL net_io_sam_group_mem_info(const char *desc, SAM_GROUP_MEM_INFO * inf if (!prs_uint32("num_members", ps, depth, &info->num_members)) return False; - if (ps->data_offset + 16 > ps->buffer_size) + if (prs_offset(ps) + 16 > prs_data_size(ps)) return False; - ps->data_offset += 16; + prs_set_offset(ps, prs_offset(ps) + 16); if (info->ptr_rids != 0) { @@ -2263,9 +2263,9 @@ static BOOL net_io_sam_alias_info(const char *desc, SAM_ALIAS_INFO * info, if (!smb_io_unihdr("hdr_als_desc", &info->hdr_als_desc, ps, depth)) return False; - if (ps->data_offset + 40 > ps->buffer_size) + if (prs_offset(ps) + 40 > prs_data_size(ps)) return False; - ps->data_offset += 40; + prs_set_offset(ps, prs_offset(ps) + 40); if (!smb_io_unistr2("uni_als_name", &info->uni_als_name, info->hdr_als_name.buffer, ps, depth)) @@ -2300,9 +2300,9 @@ static BOOL net_io_sam_alias_mem_info(const char *desc, SAM_ALIAS_MEM_INFO * inf if (info->ptr_members != 0) { - if (ps->data_offset + 16 > ps->buffer_size) + if (prs_offset(ps) + 16 > prs_data_size(ps)) return False; - ps->data_offset += 16; + prs_set_offset(ps, prs_offset(ps) + 16); if (!prs_uint32("num_sids", ps, depth, &info->num_sids)) return False; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 6f6117a9e2..702375be35 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -134,7 +134,8 @@ void prs_mem_free(prs_struct *ps) void prs_mem_clear(prs_struct *ps) { - memset(ps->data_p, '\0', (size_t)ps->buffer_size); + if (ps->buffer_size) + memset(ps->data_p, '\0', (size_t)ps->buffer_size); } /******************************************************************* @@ -143,11 +144,13 @@ void prs_mem_clear(prs_struct *ps) char *prs_alloc_mem(prs_struct *ps, size_t size) { - char *ret = talloc(ps->mem_ctx, size); - - if (ret) - memset(ret, '\0', size); + char *ret = NULL; + if (size) { + ret = talloc(ps->mem_ctx, size); + if (ret) + memset(ret, '\0', size); + } return ret; } @@ -308,7 +311,7 @@ BOOL prs_force_grow(prs_struct *ps, uint32 extra_space) /******************************************************************* Get the data pointer (external interface). - ********************************************************************/ +********************************************************************/ char *prs_data_p(prs_struct *ps) { @@ -357,10 +360,13 @@ BOOL prs_set_offset(prs_struct *ps, uint32 offset) BOOL prs_append_prs_data(prs_struct *dst, prs_struct *src) { + if (prs_offset(src) == 0) + return True; + if(!prs_grow(dst, prs_offset(src))) return False; - memcpy(&dst->data_p[dst->data_offset], prs_data_p(src), (size_t)prs_offset(src)); + memcpy(&dst->data_p[dst->data_offset], src->data_p, (size_t)prs_offset(src)); dst->data_offset += prs_offset(src); return True; @@ -378,7 +384,7 @@ BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uin if(!prs_grow(dst, len)) return False; - memcpy(&dst->data_p[dst->data_offset], prs_data_p(src)+start, (size_t)len); + memcpy(&dst->data_p[dst->data_offset], src->data_p + start, (size_t)len); dst->data_offset += len; return True; @@ -388,8 +394,11 @@ BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uin Append the data from a buffer into a parse_struct. ********************************************************************/ -BOOL prs_append_data(prs_struct *dst, char *src, uint32 len) +BOOL prs_copy_data_in(prs_struct *dst, char *src, uint32 len) { + if (len == 0) + return True; + if(!prs_grow(dst, len)) return False; @@ -399,6 +408,39 @@ BOOL prs_append_data(prs_struct *dst, char *src, uint32 len) return True; } +/******************************************************************* + Copy some data from a parse_struct into a buffer. + ********************************************************************/ + +BOOL prs_copy_data_out(char *dst, prs_struct *src, uint32 len) +{ + if (len == 0) + return True; + + if(!prs_mem_get(src, len)) + return False; + + memcpy(dst, &src->data_p[src->data_offset], (size_t)len); + src->data_offset += len; + + return True; +} + +/******************************************************************* + Copy all the data from a parse_struct into a buffer. + ********************************************************************/ + +BOOL prs_copy_all_data_out(char *dst, prs_struct *src) +{ + uint32 len = prs_offset(src); + + if (!len) + return True; + + prs_set_offset(src, 0); + return prs_copy_data_out(dst, src, len); +} + /******************************************************************* Set the data as X-endian (external interface). ********************************************************************/ @@ -1049,7 +1091,7 @@ BOOL prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) else { /* unmarshalling */ uint32 alloc_len = 0; - q = prs_data_p(ps) + prs_offset(ps); + q = ps->data_p + prs_offset(ps); /* * Work out how much space we need and talloc it. @@ -1242,7 +1284,7 @@ int tdb_prs_store(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps) TDB_DATA kbuf, dbuf; kbuf.dptr = keystr; kbuf.dsize = strlen(keystr)+1; - dbuf.dptr = prs_data_p(ps); + dbuf.dptr = ps->data_p; dbuf.dsize = prs_offset(ps); return tdb_store(tdb, kbuf, dbuf, TDB_REPLACE); } @@ -1272,7 +1314,7 @@ BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) { char *q; - q = prs_data_p(ps); + q = ps->data_p; q = &q[offset]; #ifdef DEBUG_PASSWORD diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index a49a34139e..dbd72e5250 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -782,7 +782,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if (psd->off_owner_sid != 0) { - tmp_offset = ps->data_offset; + tmp_offset = prs_offset(ps); if(!prs_set_offset(ps, old_offset + psd->off_owner_sid)) return False; @@ -803,7 +803,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if (psd->off_grp_sid != 0) { - tmp_offset = ps->data_offset; + tmp_offset = prs_offset(ps); if(!prs_set_offset(ps, old_offset + psd->off_grp_sid)) return False; @@ -823,7 +823,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) } if ((psd->type & SEC_DESC_SACL_PRESENT) && psd->off_sacl) { - tmp_offset = ps->data_offset; + tmp_offset = prs_offset(ps); if(!prs_set_offset(ps, old_offset + psd->off_sacl)) return False; if(!sec_io_acl("sacl", &psd->sacl, ps, depth)) @@ -835,7 +835,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if ((psd->type & SEC_DESC_DACL_PRESENT) && psd->off_dacl != 0) { - tmp_offset = ps->data_offset; + tmp_offset = prs_offset(ps); if(!prs_set_offset(ps, old_offset + psd->off_dacl)) return False; if(!sec_io_acl("dacl", &psd->dacl, ps, depth)) -- cgit From 4cd6e31bd364270580f2907fbc5669bf29d09578 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 14 Feb 2003 23:04:03 +0000 Subject: Ensure that only parse_prs.c access internal members of the prs_struct. Needed to move to disk based i/o later. Jeremy. (This used to be commit 4c3ee228fcdb089eaeead95e79532a9cf6cb0de6) --- source3/rpc_parse/parse_net.c | 28 +++++++++--------- source3/rpc_parse/parse_prs.c | 66 +++++++++++++++++++++++++++++++++++-------- source3/rpc_parse/parse_sec.c | 8 +++--- 3 files changed, 72 insertions(+), 30 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 853bca3b54..1e31836476 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1804,9 +1804,9 @@ static BOOL net_io_sam_domain_info(const char *desc, SAM_DOMAIN_INFO * info, if (!smb_io_unihdr("hdr_unknown", &info->hdr_unknown, ps, depth)) return False; - if (ps->data_offset + 40 > ps->buffer_size) + if (prs_offset(ps) + 40 > prs_data_size(ps)) return False; - ps->data_offset += 40; + prs_set_offset(ps, prs_offset(ps) + 40); if (!smb_io_unistr2("uni_dom_name", &info->uni_dom_name, info->hdr_dom_name.buffer, ps, depth)) @@ -1843,9 +1843,9 @@ static BOOL net_io_sam_group_info(const char *desc, SAM_GROUP_INFO * info, if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth)) return False; - if (ps->data_offset + 48 > ps->buffer_size) + if (prs_offset(ps) + 48 > prs_data_size(ps)) return False; - ps->data_offset += 48; + prs_set_offset(ps, prs_offset(ps) + 48); if (!smb_io_unistr2("uni_grp_name", &info->uni_grp_name, info->hdr_grp_name.buffer, ps, depth)) @@ -2124,13 +2124,13 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], uint32 len = 0x44; if (!prs_uint32("pwd_len", ps, depth, &len)) return False; - old_offset = ps->data_offset; + old_offset = prs_offset(ps); if (len == 0x44) { if (ps->io) { /* reading */ - if (!prs_hash1(ps, ps->data_offset, sess_key)) + if (!prs_hash1(ps, prs_offset(ps), sess_key)) return False; } if (!net_io_sam_passwd_info("pass", &info->pass, @@ -2144,9 +2144,9 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], return False; } } - if (old_offset + len > ps->buffer_size) + if (old_offset + len > prs_data_size(ps)) return False; - ps->data_offset = old_offset + len; + prs_set_offset(ps, old_offset + len); } if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, info->hdr_sec_desc.buffer, ps, depth)) @@ -2181,9 +2181,9 @@ static BOOL net_io_sam_group_mem_info(const char *desc, SAM_GROUP_MEM_INFO * inf if (!prs_uint32("num_members", ps, depth, &info->num_members)) return False; - if (ps->data_offset + 16 > ps->buffer_size) + if (prs_offset(ps) + 16 > prs_data_size(ps)) return False; - ps->data_offset += 16; + prs_set_offset(ps, prs_offset(ps) + 16); if (info->ptr_rids != 0) { @@ -2263,9 +2263,9 @@ static BOOL net_io_sam_alias_info(const char *desc, SAM_ALIAS_INFO * info, if (!smb_io_unihdr("hdr_als_desc", &info->hdr_als_desc, ps, depth)) return False; - if (ps->data_offset + 40 > ps->buffer_size) + if (prs_offset(ps) + 40 > prs_data_size(ps)) return False; - ps->data_offset += 40; + prs_set_offset(ps, prs_offset(ps) + 40); if (!smb_io_unistr2("uni_als_name", &info->uni_als_name, info->hdr_als_name.buffer, ps, depth)) @@ -2300,9 +2300,9 @@ static BOOL net_io_sam_alias_mem_info(const char *desc, SAM_ALIAS_MEM_INFO * inf if (info->ptr_members != 0) { - if (ps->data_offset + 16 > ps->buffer_size) + if (prs_offset(ps) + 16 > prs_data_size(ps)) return False; - ps->data_offset += 16; + prs_set_offset(ps, prs_offset(ps) + 16); if (!prs_uint32("num_sids", ps, depth, &info->num_sids)) return False; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 6f6117a9e2..702375be35 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -134,7 +134,8 @@ void prs_mem_free(prs_struct *ps) void prs_mem_clear(prs_struct *ps) { - memset(ps->data_p, '\0', (size_t)ps->buffer_size); + if (ps->buffer_size) + memset(ps->data_p, '\0', (size_t)ps->buffer_size); } /******************************************************************* @@ -143,11 +144,13 @@ void prs_mem_clear(prs_struct *ps) char *prs_alloc_mem(prs_struct *ps, size_t size) { - char *ret = talloc(ps->mem_ctx, size); - - if (ret) - memset(ret, '\0', size); + char *ret = NULL; + if (size) { + ret = talloc(ps->mem_ctx, size); + if (ret) + memset(ret, '\0', size); + } return ret; } @@ -308,7 +311,7 @@ BOOL prs_force_grow(prs_struct *ps, uint32 extra_space) /******************************************************************* Get the data pointer (external interface). - ********************************************************************/ +********************************************************************/ char *prs_data_p(prs_struct *ps) { @@ -357,10 +360,13 @@ BOOL prs_set_offset(prs_struct *ps, uint32 offset) BOOL prs_append_prs_data(prs_struct *dst, prs_struct *src) { + if (prs_offset(src) == 0) + return True; + if(!prs_grow(dst, prs_offset(src))) return False; - memcpy(&dst->data_p[dst->data_offset], prs_data_p(src), (size_t)prs_offset(src)); + memcpy(&dst->data_p[dst->data_offset], src->data_p, (size_t)prs_offset(src)); dst->data_offset += prs_offset(src); return True; @@ -378,7 +384,7 @@ BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uin if(!prs_grow(dst, len)) return False; - memcpy(&dst->data_p[dst->data_offset], prs_data_p(src)+start, (size_t)len); + memcpy(&dst->data_p[dst->data_offset], src->data_p + start, (size_t)len); dst->data_offset += len; return True; @@ -388,8 +394,11 @@ BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uin Append the data from a buffer into a parse_struct. ********************************************************************/ -BOOL prs_append_data(prs_struct *dst, char *src, uint32 len) +BOOL prs_copy_data_in(prs_struct *dst, char *src, uint32 len) { + if (len == 0) + return True; + if(!prs_grow(dst, len)) return False; @@ -399,6 +408,39 @@ BOOL prs_append_data(prs_struct *dst, char *src, uint32 len) return True; } +/******************************************************************* + Copy some data from a parse_struct into a buffer. + ********************************************************************/ + +BOOL prs_copy_data_out(char *dst, prs_struct *src, uint32 len) +{ + if (len == 0) + return True; + + if(!prs_mem_get(src, len)) + return False; + + memcpy(dst, &src->data_p[src->data_offset], (size_t)len); + src->data_offset += len; + + return True; +} + +/******************************************************************* + Copy all the data from a parse_struct into a buffer. + ********************************************************************/ + +BOOL prs_copy_all_data_out(char *dst, prs_struct *src) +{ + uint32 len = prs_offset(src); + + if (!len) + return True; + + prs_set_offset(src, 0); + return prs_copy_data_out(dst, src, len); +} + /******************************************************************* Set the data as X-endian (external interface). ********************************************************************/ @@ -1049,7 +1091,7 @@ BOOL prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) else { /* unmarshalling */ uint32 alloc_len = 0; - q = prs_data_p(ps) + prs_offset(ps); + q = ps->data_p + prs_offset(ps); /* * Work out how much space we need and talloc it. @@ -1242,7 +1284,7 @@ int tdb_prs_store(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps) TDB_DATA kbuf, dbuf; kbuf.dptr = keystr; kbuf.dsize = strlen(keystr)+1; - dbuf.dptr = prs_data_p(ps); + dbuf.dptr = ps->data_p; dbuf.dsize = prs_offset(ps); return tdb_store(tdb, kbuf, dbuf, TDB_REPLACE); } @@ -1272,7 +1314,7 @@ BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) { char *q; - q = prs_data_p(ps); + q = ps->data_p; q = &q[offset]; #ifdef DEBUG_PASSWORD diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index a49a34139e..dbd72e5250 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -782,7 +782,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if (psd->off_owner_sid != 0) { - tmp_offset = ps->data_offset; + tmp_offset = prs_offset(ps); if(!prs_set_offset(ps, old_offset + psd->off_owner_sid)) return False; @@ -803,7 +803,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if (psd->off_grp_sid != 0) { - tmp_offset = ps->data_offset; + tmp_offset = prs_offset(ps); if(!prs_set_offset(ps, old_offset + psd->off_grp_sid)) return False; @@ -823,7 +823,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) } if ((psd->type & SEC_DESC_SACL_PRESENT) && psd->off_sacl) { - tmp_offset = ps->data_offset; + tmp_offset = prs_offset(ps); if(!prs_set_offset(ps, old_offset + psd->off_sacl)) return False; if(!sec_io_acl("sacl", &psd->sacl, ps, depth)) @@ -835,7 +835,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if ((psd->type & SEC_DESC_DACL_PRESENT) && psd->off_dacl != 0) { - tmp_offset = ps->data_offset; + tmp_offset = prs_offset(ps); if(!prs_set_offset(ps, old_offset + psd->off_dacl)) return False; if(!sec_io_acl("dacl", &psd->dacl, ps, depth)) -- cgit From 49c3018cbc5e85d5c492d20263edffd0f1bc7246 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Tue, 18 Feb 2003 01:30:22 +0000 Subject: init_dom_sid2s: Check return code from string_to_sid. Skip tokens that are not valid SIDs. (This used to be commit 5a597272782b74d28859ba98027fe9ff9c278086) --- source3/rpc_parse/parse_net.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 1e31836476..53f660fcc3 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -873,10 +873,12 @@ static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsi int number; DOM_SID2 *sids; - /* Count the number of SIDs. */ - for (count = 0, ptr = sids_str; - next_token(&ptr, s2, NULL, sizeof(s2)); count++) - ; + /* Count the number of valid SIDs. */ + for (count = 0, ptr = sids_str; next_token(&ptr, s2, NULL, sizeof(s2)); ) { + DOM_SID tmpsid; + if (string_to_sid(&tmpsid, s2)) + count++; + } /* Now allocate space for them. */ *ppsids = (DOM_SID2 *)talloc_zero(ctx, count * sizeof(DOM_SID2)); @@ -885,11 +887,13 @@ static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsi sids = *ppsids; - for (number = 0, ptr = sids_str; - next_token(&ptr, s2, NULL, sizeof(s2)); number++) { + for (number = 0, ptr = sids_str; next_token(&ptr, s2, NULL, sizeof(s2)); ) { DOM_SID tmpsid; - string_to_sid(&tmpsid, s2); - init_dom_sid2(&sids[number], &tmpsid); + if (string_to_sid(&tmpsid, s2)) { + /* count only valid sids */ + init_dom_sid2(&sids[number], &tmpsid); + number++; + } } } -- cgit From 188c5195ede9825f30845f4aab549390ac67887e Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Tue, 18 Feb 2003 07:05:02 +0000 Subject: Check return code of string_to_sid. (Merge from HEAD) (This used to be commit 5d09aea6f78aa247dbd77617c93c2a1dd2e2702f) --- source3/rpc_parse/parse_net.c | 48 +++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 1e31836476..007cf9e25d 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -873,10 +873,12 @@ static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsi int number; DOM_SID2 *sids; - /* Count the number of SIDs. */ - for (count = 0, ptr = sids_str; - next_token(&ptr, s2, NULL, sizeof(s2)); count++) - ; + /* Count the number of valid SIDs. */ + for (count = 0, ptr = sids_str; next_token(&ptr, s2, NULL, sizeof(s2)); ) { + DOM_SID tmpsid; + if (string_to_sid(&tmpsid, s2)) + count++; + } /* Now allocate space for them. */ *ppsids = (DOM_SID2 *)talloc_zero(ctx, count * sizeof(DOM_SID2)); @@ -885,11 +887,13 @@ static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsi sids = *ppsids; - for (number = 0, ptr = sids_str; - next_token(&ptr, s2, NULL, sizeof(s2)); number++) { + for (number = 0, ptr = sids_str; next_token(&ptr, s2, NULL, sizeof(s2)); ) { DOM_SID tmpsid; - string_to_sid(&tmpsid, s2); - init_dom_sid2(&sids[number], &tmpsid); + if (string_to_sid(&tmpsid, s2)) { + /* count only valid sids */ + init_dom_sid2(&sids[number], &tmpsid); + number++; + } } } @@ -1804,9 +1808,9 @@ static BOOL net_io_sam_domain_info(const char *desc, SAM_DOMAIN_INFO * info, if (!smb_io_unihdr("hdr_unknown", &info->hdr_unknown, ps, depth)) return False; - if (prs_offset(ps) + 40 > prs_data_size(ps)) + if (ps->data_offset + 40 > ps->buffer_size) return False; - prs_set_offset(ps, prs_offset(ps) + 40); + ps->data_offset += 40; if (!smb_io_unistr2("uni_dom_name", &info->uni_dom_name, info->hdr_dom_name.buffer, ps, depth)) @@ -1843,9 +1847,9 @@ static BOOL net_io_sam_group_info(const char *desc, SAM_GROUP_INFO * info, if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth)) return False; - if (prs_offset(ps) + 48 > prs_data_size(ps)) + if (ps->data_offset + 48 > ps->buffer_size) return False; - prs_set_offset(ps, prs_offset(ps) + 48); + ps->data_offset += 48; if (!smb_io_unistr2("uni_grp_name", &info->uni_grp_name, info->hdr_grp_name.buffer, ps, depth)) @@ -2124,13 +2128,13 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], uint32 len = 0x44; if (!prs_uint32("pwd_len", ps, depth, &len)) return False; - old_offset = prs_offset(ps); + old_offset = ps->data_offset; if (len == 0x44) { if (ps->io) { /* reading */ - if (!prs_hash1(ps, prs_offset(ps), sess_key)) + if (!prs_hash1(ps, ps->data_offset, sess_key)) return False; } if (!net_io_sam_passwd_info("pass", &info->pass, @@ -2144,9 +2148,9 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], return False; } } - if (old_offset + len > prs_data_size(ps)) + if (old_offset + len > ps->buffer_size) return False; - prs_set_offset(ps, old_offset + len); + ps->data_offset = old_offset + len; } if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, info->hdr_sec_desc.buffer, ps, depth)) @@ -2181,9 +2185,9 @@ static BOOL net_io_sam_group_mem_info(const char *desc, SAM_GROUP_MEM_INFO * inf if (!prs_uint32("num_members", ps, depth, &info->num_members)) return False; - if (prs_offset(ps) + 16 > prs_data_size(ps)) + if (ps->data_offset + 16 > ps->buffer_size) return False; - prs_set_offset(ps, prs_offset(ps) + 16); + ps->data_offset += 16; if (info->ptr_rids != 0) { @@ -2263,9 +2267,9 @@ static BOOL net_io_sam_alias_info(const char *desc, SAM_ALIAS_INFO * info, if (!smb_io_unihdr("hdr_als_desc", &info->hdr_als_desc, ps, depth)) return False; - if (prs_offset(ps) + 40 > prs_data_size(ps)) + if (ps->data_offset + 40 > ps->buffer_size) return False; - prs_set_offset(ps, prs_offset(ps) + 40); + ps->data_offset += 40; if (!smb_io_unistr2("uni_als_name", &info->uni_als_name, info->hdr_als_name.buffer, ps, depth)) @@ -2300,9 +2304,9 @@ static BOOL net_io_sam_alias_mem_info(const char *desc, SAM_ALIAS_MEM_INFO * inf if (info->ptr_members != 0) { - if (prs_offset(ps) + 16 > prs_data_size(ps)) + if (ps->data_offset + 16 > ps->buffer_size) return False; - prs_set_offset(ps, prs_offset(ps) + 16); + ps->data_offset += 16; if (!prs_uint32("num_sids", ps, depth, &info->num_sids)) return False; -- cgit From 380635538b442ee4de4d7e1242125acd5eb815fd Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 21 Feb 2003 17:04:01 +0000 Subject: couple of merges from APP_HEAD * performance optimization in enumprinterdataex() when keyname is empty * fix a few typos in comments * reload services after addprinter_command() dump registry data in ascii when the key is REG_SZ or REG_MULTI_SZ (This used to be commit 3fc90ea1d9b11186f26484516a4dd8502b6d7323) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index cb3b2efd9d..fb2aaf71ec 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1372,7 +1372,7 @@ BOOL spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, return False; } - if (!prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size)) + if (!prs_uint8s( r_u->type&(REG_SZ|REG_MULTI_SZ), "data", ps, depth, r_u->data, r_u->size )) return False; if (!prs_align(ps)) -- cgit From ab985b983f45a284b2ee9fdd08801989574edf4b Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 21 Feb 2003 17:08:43 +0000 Subject: couple of merges from APP_HEAD * performance optimization in enumprinterdataex() when keyname is empty * fix a few typos in comments * reload services after addprinter_command() dump registry data in ascii when the key is REG_SZ or REG_MULTI_SZ (This used to be commit fde6ef7cc62c58d512dc8053b214f0a3c59a78ab) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index cb3b2efd9d..fb2aaf71ec 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1372,7 +1372,7 @@ BOOL spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, return False; } - if (!prs_uint8s(False,"data", ps, depth, r_u->data, r_u->size)) + if (!prs_uint8s( r_u->type&(REG_SZ|REG_MULTI_SZ), "data", ps, depth, r_u->data, r_u->size )) return False; if (!prs_align(ps)) -- cgit From 7c7d796b6d292a7c98b099ad1e1adbc4f2363512 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 25 Feb 2003 20:51:23 +0000 Subject: Progress on CR 601 cache the printer_info_2 with the open printer handle. cache is invalidated on a mod_a_printer() call **on that smbd**. Yes, this means that the window for admins to step on each other from different clients just got larger, but since handles a generally short lived this is probably ok. (This used to be commit 33c7b7522504fb15989f32add8e9a087c8d9d0fa) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index fb2aaf71ec..a34740f9ff 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1372,7 +1372,7 @@ BOOL spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, return False; } - if (!prs_uint8s( r_u->type&(REG_SZ|REG_MULTI_SZ), "data", ps, depth, r_u->data, r_u->size )) + if (!prs_uint8s( False, "data", ps, depth, r_u->data, r_u->size )) return False; if (!prs_align(ps)) -- cgit From 23b3b29eec61860155404333f6e70ebd24b50940 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 25 Feb 2003 20:53:53 +0000 Subject: Progress on CR 601 cache the printer_info_2 with the open printer handle. cache is invalidated on a mod_a_printer() call **on that smbd**. Yes, this means that the window for admins to step on each other from different clients just got larger, but since handles a generally short lived this is probably ok. (This used to be commit 31272d3b6bb9ec62fd666301c7adfa0c1720a99b) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index fb2aaf71ec..a34740f9ff 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1372,7 +1372,7 @@ BOOL spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, return False; } - if (!prs_uint8s( r_u->type&(REG_SZ|REG_MULTI_SZ), "data", ps, depth, r_u->data, r_u->size )) + if (!prs_uint8s( False, "data", ps, depth, r_u->data, r_u->size )) return False; if (!prs_align(ps)) -- cgit From 991f6cc3c13cdeb8d7cf0dea25af29bbc7987c64 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 25 Feb 2003 23:34:57 +0000 Subject: More const fixes and flow on fixes from yesterday's const-fest. (This used to be commit 018733eedd7897e6811e8461c07e3acf418c0e09) --- source3/rpc_parse/parse_dfs.c | 13 +++++++------ source3/rpc_parse/parse_spoolss.c | 14 ++++++++------ 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index ccd6d429fa..6f13500359 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -76,8 +76,8 @@ BOOL dfs_io_r_dfs_exist(const char *desc, DFS_R_DFS_EXIST *q_d, prs_struct *ps, Make a DFS_Q_DFS_REMOVE structure *******************************************************************/ -BOOL init_dfs_q_dfs_remove(DFS_Q_DFS_REMOVE *q_d, char *entrypath, - char *servername, char *sharename) +BOOL init_dfs_q_dfs_remove(DFS_Q_DFS_REMOVE *q_d, const char *entrypath, + const char *servername, const char *sharename) { DEBUG(5,("init_dfs_q_dfs_remove\n")); init_unistr2(&q_d->DfsEntryPath, entrypath, strlen(entrypath)+1); @@ -149,8 +149,9 @@ BOOL dfs_io_r_dfs_remove(const char *desc, DFS_R_DFS_REMOVE *r_d, prs_struct *ps Make a DFS_Q_DFS_ADD structure *******************************************************************/ -BOOL init_dfs_q_dfs_add(DFS_Q_DFS_ADD *q_d, char *entrypath, char *servername, - char *sharename, char *comment, uint32 flags) +BOOL init_dfs_q_dfs_add(DFS_Q_DFS_ADD *q_d, const char *entrypath, + const char *servername, const char *sharename, + const char *comment, uint32 flags) { DEBUG(5,("init_dfs_q_dfs_add\n")); q_d->ptr_DfsEntryPath = q_d->ptr_ServerName = q_d->ptr_ShareName = 1; @@ -231,8 +232,8 @@ BOOL dfs_io_r_dfs_add(const char *desc, DFS_R_DFS_ADD *r_d, prs_struct *ps, int return True; } -BOOL init_dfs_q_dfs_get_info(DFS_Q_DFS_GET_INFO *q_d, char *entrypath, - char *servername, char *sharename, +BOOL init_dfs_q_dfs_get_info(DFS_Q_DFS_GET_INFO *q_d, const char *entrypath, + const char *servername, const char *sharename, uint32 info_level) { DEBUG(5,("init_dfs_q2_get_info\n")); diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index a34740f9ff..47737908f0 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1202,7 +1202,7 @@ BOOL make_spoolss_q_deleteprinterdriver( BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, const POLICY_HND *handle, - char *valuename, uint32 size) + const char *valuename, uint32 size) { if (q_u == NULL) return False; @@ -1221,7 +1221,8 @@ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, BOOL make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX *q_u, const POLICY_HND *handle, - char *keyname, char *valuename, uint32 size) + const char *keyname, + const char *valuename, uint32 size) { if (q_u == NULL) return False; @@ -7503,7 +7504,7 @@ BOOL make_spoolss_q_addform(SPOOL_Q_ADDFORM *q_u, POLICY_HND *handle, ********************************************************************/ BOOL make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle, - int level, char *form_name, FORM *form) + int level, const char *form_name, FORM *form) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); q_u->level = level; @@ -7518,7 +7519,8 @@ BOOL make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, char *form) +BOOL make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, + const char *form) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); init_unistr2(&q_u->name, form, strlen(form) + 1); @@ -7530,8 +7532,8 @@ BOOL make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, char ********************************************************************/ BOOL make_spoolss_q_getform(SPOOL_Q_GETFORM *q_u, POLICY_HND *handle, - char *formname, uint32 level, NEW_BUFFER *buffer, - uint32 offered) + const char *formname, uint32 level, + NEW_BUFFER *buffer, uint32 offered) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); q_u->level = level; -- cgit From 1788f806e7655aa37cff22eaa6f3f424fb779274 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 25 Feb 2003 23:51:56 +0000 Subject: Merge: const fixes. (This used to be commit a20aba09996e470425a151271237f2d48a8302af) --- source3/rpc_parse/parse_dfs.c | 13 +++++++------ source3/rpc_parse/parse_spoolss.c | 14 ++++++++------ 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index ccd6d429fa..6f13500359 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -76,8 +76,8 @@ BOOL dfs_io_r_dfs_exist(const char *desc, DFS_R_DFS_EXIST *q_d, prs_struct *ps, Make a DFS_Q_DFS_REMOVE structure *******************************************************************/ -BOOL init_dfs_q_dfs_remove(DFS_Q_DFS_REMOVE *q_d, char *entrypath, - char *servername, char *sharename) +BOOL init_dfs_q_dfs_remove(DFS_Q_DFS_REMOVE *q_d, const char *entrypath, + const char *servername, const char *sharename) { DEBUG(5,("init_dfs_q_dfs_remove\n")); init_unistr2(&q_d->DfsEntryPath, entrypath, strlen(entrypath)+1); @@ -149,8 +149,9 @@ BOOL dfs_io_r_dfs_remove(const char *desc, DFS_R_DFS_REMOVE *r_d, prs_struct *ps Make a DFS_Q_DFS_ADD structure *******************************************************************/ -BOOL init_dfs_q_dfs_add(DFS_Q_DFS_ADD *q_d, char *entrypath, char *servername, - char *sharename, char *comment, uint32 flags) +BOOL init_dfs_q_dfs_add(DFS_Q_DFS_ADD *q_d, const char *entrypath, + const char *servername, const char *sharename, + const char *comment, uint32 flags) { DEBUG(5,("init_dfs_q_dfs_add\n")); q_d->ptr_DfsEntryPath = q_d->ptr_ServerName = q_d->ptr_ShareName = 1; @@ -231,8 +232,8 @@ BOOL dfs_io_r_dfs_add(const char *desc, DFS_R_DFS_ADD *r_d, prs_struct *ps, int return True; } -BOOL init_dfs_q_dfs_get_info(DFS_Q_DFS_GET_INFO *q_d, char *entrypath, - char *servername, char *sharename, +BOOL init_dfs_q_dfs_get_info(DFS_Q_DFS_GET_INFO *q_d, const char *entrypath, + const char *servername, const char *sharename, uint32 info_level) { DEBUG(5,("init_dfs_q2_get_info\n")); diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index a34740f9ff..47737908f0 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1202,7 +1202,7 @@ BOOL make_spoolss_q_deleteprinterdriver( BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, const POLICY_HND *handle, - char *valuename, uint32 size) + const char *valuename, uint32 size) { if (q_u == NULL) return False; @@ -1221,7 +1221,8 @@ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, BOOL make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX *q_u, const POLICY_HND *handle, - char *keyname, char *valuename, uint32 size) + const char *keyname, + const char *valuename, uint32 size) { if (q_u == NULL) return False; @@ -7503,7 +7504,7 @@ BOOL make_spoolss_q_addform(SPOOL_Q_ADDFORM *q_u, POLICY_HND *handle, ********************************************************************/ BOOL make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle, - int level, char *form_name, FORM *form) + int level, const char *form_name, FORM *form) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); q_u->level = level; @@ -7518,7 +7519,8 @@ BOOL make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, char *form) +BOOL make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, + const char *form) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); init_unistr2(&q_u->name, form, strlen(form) + 1); @@ -7530,8 +7532,8 @@ BOOL make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, char ********************************************************************/ BOOL make_spoolss_q_getform(SPOOL_Q_GETFORM *q_u, POLICY_HND *handle, - char *formname, uint32 level, NEW_BUFFER *buffer, - uint32 offered) + const char *formname, uint32 level, + NEW_BUFFER *buffer, uint32 offered) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); q_u->level = level; -- cgit From d95f1e4260e66b0ab37b69105e7cc252e23bee16 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 3 Mar 2003 16:32:03 +0000 Subject: * CR1868: only send a change notify message if we have something that changed that the client is monitoring. * couple of comments abnout how we need to validate driver names on SetPrinter() and AddPrinter() * up the debug level on some overly verbose dev mode parsing messages (This used to be commit e8939165b77c9e2ea8b3cef2e85885b9812c7184) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 47737908f0..0545f89ff7 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -789,7 +789,7 @@ BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE while ((available_space > 0) && (i < DM_NUM_OPTIONAL_FIELDS)) { - DEBUG(10, ("spoolss_io_devmode: [%d] bytes left to parse in devmode\n", available_space)); + DEBUG(11, ("spoolss_io_devmode: [%d] bytes left to parse in devmode\n", available_space)); if (!prs_uint32(opt_fields[i].name, ps, depth, opt_fields[i].field)) return False; available_space -= sizeof(uint32); -- cgit From 21be9e77761f56abf2b00d4faece2fae2f45e3b6 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 3 Mar 2003 16:34:19 +0000 Subject: * CR1868: only send a change notify message if we have something that changed that the client is monitoring. * couple of comments abnout how we need to validate driver names on SetPrinter() and AddPrinter() * up the debug level on some overly verbose dev mode parsing messages (This used to be commit 7377d671e8a95ac2ab0452f564b18b2a098699cb) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 47737908f0..0545f89ff7 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -789,7 +789,7 @@ BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE while ((available_space > 0) && (i < DM_NUM_OPTIONAL_FIELDS)) { - DEBUG(10, ("spoolss_io_devmode: [%d] bytes left to parse in devmode\n", available_space)); + DEBUG(11, ("spoolss_io_devmode: [%d] bytes left to parse in devmode\n", available_space)); if (!prs_uint32(opt_fields[i].name, ps, depth, opt_fields[i].field)) return False; available_space -= sizeof(uint32); -- cgit From 26b1ed7cc05e3bfd9f83bdb664cc6ca0a9883c4a Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 6 Mar 2003 16:06:12 +0000 Subject: add #define for the max device name length in a DEVICEMODE (This used to be commit 21ec2b6ba3ddba6964f6ddb53f8494e4a8b48a83) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 0545f89ff7..a5d2087a3a 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -684,7 +684,7 @@ BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE return False; } - if (!prs_uint16uni(True,"devicename", ps, depth, devmode->devicename.buffer, 32)) + if (!prs_uint16uni(True,"devicename", ps, depth, devmode->devicename.buffer, MAXDEVICENAME)) return False; if (!prs_uint16("specversion", ps, depth, &devmode->specversion)) -- cgit From ccb58b303a5f9b37922450fa535c019511895a8a Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 6 Mar 2003 16:09:11 +0000 Subject: add #define for the max device name length in a DEVICEMODE (This used to be commit 52ef84b53495db1eac6ecfb0b926ef8df7ea5cc5) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 0545f89ff7..a5d2087a3a 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -684,7 +684,7 @@ BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE return False; } - if (!prs_uint16uni(True,"devicename", ps, depth, devmode->devicename.buffer, 32)) + if (!prs_uint16uni(True,"devicename", ps, depth, devmode->devicename.buffer, MAXDEVICENAME)) return False; if (!prs_uint16("specversion", ps, depth, &devmode->specversion)) -- cgit From 8a751c019c21b1925fd352639f8237cf0a6ebac9 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 7 Mar 2003 18:26:24 +0000 Subject: Some progress towards gums and tdbsam2 genparser works fine, and it is a marvelous tool to store objects in tdb :) (This used to be commit 4c6d461a8572f03cd33cba95500cc837638b732c) --- source3/rpc_parse/parse_sec.c | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index dbd72e5250..10b0ff86ae 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -569,24 +569,6 @@ SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BU return(return_sdb); } -/******************************************************************* - Tallocs a duplicate SID. -********************************************************************/ - -static DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, DOM_SID *src) -{ - DOM_SID *dst; - - if(!src) - return NULL; - - if((dst = talloc_zero(ctx, sizeof(DOM_SID))) != NULL) { - sid_copy( dst, src); - } - - return dst; -} - /******************************************************************* Creates a SEC_DESC structure ********************************************************************/ -- cgit From 6ed674023620cc77e3276561f913b7a62ed26245 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 9 Mar 2003 01:13:41 +0000 Subject: Don't fault on error returns (ptr == 0) for this LSA query. (for example, query to non-dc) Andrew Bartlett (This used to be commit d1dde5f684652f86e63ac6cfa34ff42a680693de) --- source3/rpc_parse/parse_lsa.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 53a0fc958d..2753ae524a 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2219,18 +2219,21 @@ BOOL lsa_io_r_query_info2(const char *desc, LSA_R_QUERY_INFO2 *r_c, if(!prs_uint32("ptr", ps, depth, &r_c->ptr)) return False; - if(!prs_uint16("info_class", ps, depth, &r_c->info_class)) - return False; - switch(r_c->info_class) { - case 0x000c: - if (!lsa_io_dns_dom_info("info12", &r_c->info.dns_dom_info, - ps, depth)) + + if (r_c->ptr != 0) { + if(!prs_uint16("info_class", ps, depth, &r_c->info_class)) return False; + switch(r_c->info_class) { + case 0x000c: + if (!lsa_io_dns_dom_info("info12", &r_c->info.dns_dom_info, + ps, depth)) + return False; break; - default: - DEBUG(0,("lsa_io_r_query_info2: unknown info class %d\n", - r_c->info_class)); - return False; + default: + DEBUG(0,("lsa_io_r_query_info2: unknown info class %d\n", + r_c->info_class)); + return False; + } } if(!prs_align(ps)) -- cgit From 537e4d55651a51227fc7af4de0853165503c7b12 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 13 Mar 2003 04:35:15 +0000 Subject: fixed the unmarshalling of the queryaliasmem SAMR call (This used to be commit 80c45434092a881fe2c9ae7f90856deea4722cb0) --- source3/rpc_parse/parse_samr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index d031d13955..222af57e5b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4623,13 +4623,17 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, for (i = 0; i < r_u->num_sids1; i++) { ptr_sid[i] = 1; - if(!prs_uint32("", ps, depth, &ptr_sid[i])) + if(!prs_uint32("ptr_sid", ps, depth, &ptr_sid[i])) return False; } + if (UNMARSHALLING(ps)) { + r_u->sid = talloc(ps->mem_ctx, r_u->num_sids1 * sizeof(DOM_SID)); + } + for (i = 0; i < r_u->num_sids1; i++) { if (ptr_sid[i] != 0) { - if(!smb_io_dom_sid2("", &r_u->sid[i], ps, depth)) + if(!smb_io_dom_sid2("sid", &r_u->sid[i], ps, depth)) return False; } } -- cgit From 71e94ca9046100fcfca409c77540fa046ea1577b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 13 Mar 2003 07:57:49 +0000 Subject: Merge from HEAD. 'fixed the unmarshalling of the queryaliasmem SAMR call' Jeremy. (This used to be commit 40def80d43b14a853045a31b382226fe0381f38a) --- source3/rpc_parse/parse_samr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index d031d13955..222af57e5b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4623,13 +4623,17 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, for (i = 0; i < r_u->num_sids1; i++) { ptr_sid[i] = 1; - if(!prs_uint32("", ps, depth, &ptr_sid[i])) + if(!prs_uint32("ptr_sid", ps, depth, &ptr_sid[i])) return False; } + if (UNMARSHALLING(ps)) { + r_u->sid = talloc(ps->mem_ctx, r_u->num_sids1 * sizeof(DOM_SID)); + } + for (i = 0; i < r_u->num_sids1; i++) { if (ptr_sid[i] != 0) { - if(!smb_io_dom_sid2("", &r_u->sid[i], ps, depth)) + if(!smb_io_dom_sid2("sid", &r_u->sid[i], ps, depth)) return False; } } -- cgit From a27d434c4b4363762e7a0d5eeddd35e2b8dbb374 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 15 Mar 2003 07:45:51 +0000 Subject: Fix signed/unsigned issues - mostly 'i' counters. Fix an inconpatible poitner type that caused the IA64 not to build Andrew Bartlett (This used to be commit 37436b0aae108fceace3049d3868510e1ba592ac) --- source3/rpc_parse/parse_lsa.c | 14 +++++++------- source3/rpc_parse/parse_misc.c | 10 +++++----- source3/rpc_parse/parse_net.c | 22 +++++++++++----------- source3/rpc_parse/parse_prs.c | 4 ++-- source3/rpc_parse/parse_sec.c | 16 ++++++++-------- source3/rpc_parse/parse_srv.c | 20 ++++++++++---------- 6 files changed, 43 insertions(+), 43 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 2753ae524a..fc9999dc4d 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -80,7 +80,7 @@ static BOOL lsa_io_trans_name(const char *desc, LSA_TRANS_NAME *trn, prs_struct static BOOL lsa_io_dom_r_ref(const char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "lsa_io_dom_r_ref"); depth++; @@ -531,7 +531,7 @@ BOOL lsa_io_q_enum_trust_dom(const char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context, uint32 req_num_domains, uint32 num_domains, TRUSTDOM **td) { - int i; + unsigned int i; DEBUG(5, ("init_r_enum_trust_dom\n")); @@ -851,7 +851,7 @@ static void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, static BOOL lsa_io_sid_enum(const char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "lsa_io_sid_enum"); depth++; @@ -967,7 +967,7 @@ BOOL lsa_io_q_lookup_sids(const char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct * static BOOL lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "lsa_io_trans_names"); depth++; @@ -1063,7 +1063,7 @@ 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 i; + unsigned int i; DEBUG(5, ("init_q_lookup_names\n")); @@ -1102,7 +1102,7 @@ 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) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "lsa_io_q_lookup_names"); depth++; @@ -1166,7 +1166,7 @@ reads or writes a structure. BOOL lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "lsa_io_r_lookup_names"); depth++; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index df80c76ee5..b7b0e9346b 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -697,7 +697,7 @@ BOOL smb_io_buffer5(const char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) Inits a BUFFER2 structure. ********************************************************************/ -void init_buffer2(BUFFER2 *str, const uint8 *buf, int len) +void init_buffer2(BUFFER2 *str, const uint8 *buf, size_t len) { ZERO_STRUCTP(str); @@ -1050,7 +1050,7 @@ BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct * BOOL init_unistr2_array(UNISTR2_ARRAY *array, uint32 count, const char **strings) { - int i; + unsigned int i; array->count = count; array->ref_id = count?1:0; @@ -1078,7 +1078,7 @@ BOOL init_unistr2_array(UNISTR2_ARRAY *array, ********************************************************************/ BOOL smb_io_unistr2_array(const char *desc, UNISTR2_ARRAY *array, prs_struct *ps, int depth) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "smb_io_unistr2_array"); depth++; @@ -1128,7 +1128,7 @@ BOOL smb_io_unistr2_array(const char *desc, UNISTR2_ARRAY *array, prs_struct *ps BOOL init_sid_array(SID_ARRAY *array, uint32 count, DOM_SID *sids) { - int i; + unsigned int i; array->count = count; array->ref_id = count?1:0; @@ -1155,7 +1155,7 @@ BOOL init_sid_array(SID_ARRAY *array, ********************************************************************/ BOOL smb_io_sid_array(const char *desc, SID_ARRAY *array, prs_struct *ps, int depth) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "smb_io_sid_array"); depth++; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 53f660fcc3..a660084250 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -432,7 +432,7 @@ BOOL net_io_r_logon_ctrl(const char *desc, NET_R_LOGON_CTRL *r_l, prs_struct *ps void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, uint32 num_doms, const char *dom_name) { - int i = 0; + unsigned int i = 0; DEBUG(5,("init_r_trust_dom\n")); @@ -1038,12 +1038,12 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, 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, int lm_chal_resp_len, - const uchar * nt_chal_resp, int nt_chal_resp_len) + const uchar * lm_chal_resp, size_t lm_chal_resp_len, + const uchar * nt_chal_resp, size_t nt_chal_resp_len) { - int len_domain_name = strlen(domain_name); - int len_user_name = strlen(user_name ); - int len_wksta_name = strlen(wksta_name ); + size_t len_domain_name = strlen(domain_name); + size_t len_user_name = strlen(user_name ); + size_t len_wksta_name = strlen(wksta_name ); unsigned char lm_owf[24]; unsigned char nt_owf[128]; @@ -1281,7 +1281,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, { /* only cope with one "other" sid, right now. */ /* need to count the number of space-delimited sids */ - int i; + unsigned int i; int num_other_sids = 0; NTTIME logon_time, logoff_time, kickoff_time, @@ -1390,7 +1390,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth, uint16 validation_level) { - int i; + unsigned int i; if (usr == NULL) return False; @@ -2363,7 +2363,7 @@ reads or writes a structure. static BOOL net_io_sam_policy_info(const char *desc, SAM_DELTA_POLICY *info, prs_struct *ps, int depth) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "net_io_sam_policy_info"); depth++; @@ -2584,7 +2584,7 @@ reads or writes a structure. static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info, prs_struct *ps, int depth) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "net_io_sam_privs_info"); depth++; @@ -2895,7 +2895,7 @@ reads or writes a structure. BOOL net_io_r_sam_deltas(const char *desc, uint8 sess_key[16], NET_R_SAM_DELTAS *r_s, prs_struct *ps, int depth) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "net_io_r_sam_deltas"); depth++; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 702375be35..aeaa42ac92 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -938,7 +938,7 @@ BOOL prs_buffer2(BOOL charmode, const char *name, prs_struct *ps, int depth, BUF BOOL prs_string2(BOOL charmode, const char *name, prs_struct *ps, int depth, STRING2 *str) { - int i; + unsigned int i; char *q = prs_mem_get(ps, str->str_max_len); if (q == NULL) return False; @@ -1035,7 +1035,7 @@ BOOL prs_unistr3(BOOL charmode, const char *name, UNISTR3 *str, prs_struct *ps, BOOL prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) { - int len = 0; + unsigned int len = 0; unsigned char *p = (unsigned char *)str->buffer; uint8 *start; char *q; diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 10b0ff86ae..081173cf8d 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -159,7 +159,7 @@ BOOL sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth) NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, unsigned *num, DOM_SID *sid, uint32 mask) { - int i = 0; + unsigned int i = 0; if (!ctx || !new || !old || !sid || !num) return NT_STATUS_INVALID_PARAMETER; @@ -185,7 +185,7 @@ NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, unsigned NTSTATUS sec_ace_mod_sid(SEC_ACE *ace, size_t num, DOM_SID *sid, uint32 mask) { - int i = 0; + unsigned int i = 0; if (!ace || !sid) return NT_STATUS_INVALID_PARAMETER; @@ -202,14 +202,14 @@ NTSTATUS sec_ace_mod_sid(SEC_ACE *ace, size_t num, DOM_SID *sid, uint32 mask) delete SID from ACL ********************************************************************/ -NTSTATUS sec_ace_del_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, size_t *num, DOM_SID *sid) +static NTSTATUS sec_ace_del_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, uint32 *num, DOM_SID *sid) { - int i = 0; - int n_del = 0; + unsigned int i = 0; + unsigned int n_del = 0; if (!ctx || !new || !old || !sid || !num) return NT_STATUS_INVALID_PARAMETER; - if((new[0] = (SEC_ACE *) talloc_zero(ctx, *num * sizeof(SEC_ACE))) == 0) + if((new[0] = (SEC_ACE *) talloc_zero(ctx, (*num) * sizeof(SEC_ACE))) == 0) return NT_STATUS_NO_MEMORY; for (i = 0; i < *num; i ++) { @@ -283,7 +283,7 @@ SEC_ACL *dup_sec_acl(TALLOC_CTX *ctx, SEC_ACL *src) BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) { - int i; + unsigned int i; uint32 old_offset; uint32 offset_acl_size; SEC_ACL *psa; @@ -407,7 +407,7 @@ BOOL sec_ace_equal(SEC_ACE *s1, SEC_ACE *s2) BOOL sec_acl_equal(SEC_ACL *s1, SEC_ACL *s2) { - int i, j; + unsigned int i, j; /* Trivial cases */ diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index bfa1a13be9..27763aa224 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1665,8 +1665,8 @@ static BOOL srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_s return False; if (ss0->ptr_sess_info != 0) { - int i; - int num_entries = ss0->num_entries_read; + uint32 i; + uint32 num_entries = ss0->num_entries_read; if (num_entries > MAX_SESS_ENTRIES) { num_entries = MAX_SESS_ENTRIES; /* report this! */ @@ -1802,8 +1802,8 @@ static BOOL srv_io_srv_sess_info_1(const char *desc, SRV_SESS_INFO_1 *ss1, prs_s return False; if (ss1->ptr_sess_info != 0) { - int i; - int num_entries = ss1->num_entries_read; + uint32 i; + uint32 num_entries = ss1->num_entries_read; if (num_entries > MAX_SESS_ENTRIES) { num_entries = MAX_SESS_ENTRIES; /* report this! */ @@ -1944,7 +1944,7 @@ BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_stru if(!prs_uint32("sess_level", ps, depth, &q_n->sess_level)) return False; - if (q_n->sess_level != -1) { + if (q_n->sess_level != (uint32)-1) { if(!srv_io_srv_sess_ctr("sess_ctr", &q_n->ctr, ps, depth)) return False; } @@ -1976,7 +1976,7 @@ BOOL srv_io_r_net_sess_enum(const char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_stru if(!prs_uint32("sess_level", ps, depth, &r_n->sess_level)) return False; - if (r_n->sess_level != -1) { + if (r_n->sess_level != (uint32)-1) { if(!srv_io_srv_sess_ctr("sess_ctr", &r_n->ctr, ps, depth)) return False; } @@ -2309,7 +2309,7 @@ BOOL srv_io_q_net_conn_enum(const char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_stru if(!prs_uint32("conn_level", ps, depth, &q_n->conn_level)) return False; - if (q_n->conn_level != -1) { + if (q_n->conn_level != (uint32)-1) { if(!srv_io_srv_conn_ctr("conn_ctr", &q_n->ctr, ps, depth)) return False; } @@ -2341,7 +2341,7 @@ BOOL srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_str if(!prs_uint32("conn_level", ps, depth, &r_n->conn_level)) return False; - if (r_n->conn_level != -1) { + if (r_n->conn_level != (uint32)-1) { if(!srv_io_srv_conn_ctr("conn_ctr", &r_n->ctr, ps, depth)) return False; } @@ -2573,7 +2573,7 @@ BOOL srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_stru if(!prs_uint32("file_level", ps, depth, &q_n->file_level)) return False; - if (q_n->file_level != -1) { + if (q_n->file_level != (uint32)-1) { if(!srv_io_srv_file_ctr("file_ctr", &q_n->ctr, ps, depth)) return False; } @@ -3271,7 +3271,7 @@ BOOL srv_io_q_net_disk_enum(const char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_stru BOOL srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth) { - int i; + unsigned int i; uint32 entries_read, entries_read2, entries_read3; if (r_n == NULL) -- cgit From e88eab35bc03a2d108b27f2209ec4cfb395dcdba Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 17 Mar 2003 23:04:03 +0000 Subject: Merge from HEAD: signed/unsigned (mostly i counters) a little bit of const. Andrew Bartlett (This used to be commit 50f0ca752e5058c4051f42a9337361373ba1f727) --- source3/rpc_parse/parse_lsa.c | 14 +++++++------- source3/rpc_parse/parse_misc.c | 6 +++--- source3/rpc_parse/parse_net.c | 22 +++++++++++----------- source3/rpc_parse/parse_prs.c | 4 ++-- source3/rpc_parse/parse_sec.c | 16 ++++++++-------- source3/rpc_parse/parse_srv.c | 20 ++++++++++---------- 6 files changed, 41 insertions(+), 41 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 3c9c02a23a..0b45c0baf3 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -80,7 +80,7 @@ static BOOL lsa_io_trans_name(const char *desc, LSA_TRANS_NAME *trn, prs_struct static BOOL lsa_io_dom_r_ref(const char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "lsa_io_dom_r_ref"); depth++; @@ -531,7 +531,7 @@ BOOL lsa_io_q_enum_trust_dom(const char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context, uint32 req_num_domains, uint32 num_domains, TRUSTDOM **td) { - int i; + unsigned int i; DEBUG(5, ("init_r_enum_trust_dom\n")); @@ -851,7 +851,7 @@ static void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, static BOOL lsa_io_sid_enum(const char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "lsa_io_sid_enum"); depth++; @@ -967,7 +967,7 @@ BOOL lsa_io_q_lookup_sids(const char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct * static BOOL lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "lsa_io_trans_names"); depth++; @@ -1063,7 +1063,7 @@ 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 i; + unsigned int i; DEBUG(5, ("init_q_lookup_names\n")); @@ -1102,7 +1102,7 @@ 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) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "lsa_io_q_lookup_names"); depth++; @@ -1166,7 +1166,7 @@ reads or writes a structure. BOOL lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "lsa_io_r_lookup_names"); depth++; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 43d26a691d..f0d4c67d9f 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -697,7 +697,7 @@ BOOL smb_io_buffer5(const char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) Inits a BUFFER2 structure. ********************************************************************/ -void init_buffer2(BUFFER2 *str, const uint8 *buf, int len) +void init_buffer2(BUFFER2 *str, const uint8 *buf, size_t len) { ZERO_STRUCTP(str); @@ -1050,7 +1050,7 @@ BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct * BOOL init_unistr2_array(UNISTR2_ARRAY *array, uint32 count, const char **strings) { - int i; + unsigned int i; array->count = count; array->ref_id = count?1:0; @@ -1078,7 +1078,7 @@ BOOL init_unistr2_array(UNISTR2_ARRAY *array, ********************************************************************/ BOOL smb_io_unistr2_array(const char *desc, UNISTR2_ARRAY *array, prs_struct *ps, int depth) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "smb_io_unistr2_array"); depth++; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 007cf9e25d..163e6bab3c 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -432,7 +432,7 @@ BOOL net_io_r_logon_ctrl(const char *desc, NET_R_LOGON_CTRL *r_l, prs_struct *ps void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, uint32 num_doms, const char *dom_name) { - int i = 0; + unsigned int i = 0; DEBUG(5,("init_r_trust_dom\n")); @@ -1038,12 +1038,12 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, 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, int lm_chal_resp_len, - const uchar * nt_chal_resp, int nt_chal_resp_len) + const uchar * lm_chal_resp, size_t lm_chal_resp_len, + const uchar * nt_chal_resp, size_t nt_chal_resp_len) { - int len_domain_name = strlen(domain_name); - int len_user_name = strlen(user_name ); - int len_wksta_name = strlen(wksta_name ); + size_t len_domain_name = strlen(domain_name); + size_t len_user_name = strlen(user_name ); + size_t len_wksta_name = strlen(wksta_name ); unsigned char lm_owf[24]; unsigned char nt_owf[128]; @@ -1281,7 +1281,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, { /* only cope with one "other" sid, right now. */ /* need to count the number of space-delimited sids */ - int i; + unsigned int i; int num_other_sids = 0; NTTIME logon_time, logoff_time, kickoff_time, @@ -1390,7 +1390,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth, uint16 validation_level) { - int i; + unsigned int i; if (usr == NULL) return False; @@ -2363,7 +2363,7 @@ reads or writes a structure. static BOOL net_io_sam_policy_info(const char *desc, SAM_DELTA_POLICY *info, prs_struct *ps, int depth) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "net_io_sam_policy_info"); depth++; @@ -2584,7 +2584,7 @@ reads or writes a structure. static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info, prs_struct *ps, int depth) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "net_io_sam_privs_info"); depth++; @@ -2895,7 +2895,7 @@ reads or writes a structure. BOOL net_io_r_sam_deltas(const char *desc, uint8 sess_key[16], NET_R_SAM_DELTAS *r_s, prs_struct *ps, int depth) { - int i; + unsigned int i; prs_debug(ps, depth, desc, "net_io_r_sam_deltas"); depth++; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 702375be35..aeaa42ac92 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -938,7 +938,7 @@ BOOL prs_buffer2(BOOL charmode, const char *name, prs_struct *ps, int depth, BUF BOOL prs_string2(BOOL charmode, const char *name, prs_struct *ps, int depth, STRING2 *str) { - int i; + unsigned int i; char *q = prs_mem_get(ps, str->str_max_len); if (q == NULL) return False; @@ -1035,7 +1035,7 @@ BOOL prs_unistr3(BOOL charmode, const char *name, UNISTR3 *str, prs_struct *ps, BOOL prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) { - int len = 0; + unsigned int len = 0; unsigned char *p = (unsigned char *)str->buffer; uint8 *start; char *q; diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index dbd72e5250..47300e083a 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -159,7 +159,7 @@ BOOL sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth) NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, unsigned *num, DOM_SID *sid, uint32 mask) { - int i = 0; + unsigned int i = 0; if (!ctx || !new || !old || !sid || !num) return NT_STATUS_INVALID_PARAMETER; @@ -185,7 +185,7 @@ NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, unsigned NTSTATUS sec_ace_mod_sid(SEC_ACE *ace, size_t num, DOM_SID *sid, uint32 mask) { - int i = 0; + unsigned int i = 0; if (!ace || !sid) return NT_STATUS_INVALID_PARAMETER; @@ -202,14 +202,14 @@ NTSTATUS sec_ace_mod_sid(SEC_ACE *ace, size_t num, DOM_SID *sid, uint32 mask) delete SID from ACL ********************************************************************/ -NTSTATUS sec_ace_del_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, size_t *num, DOM_SID *sid) +static NTSTATUS sec_ace_del_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, uint32 *num, DOM_SID *sid) { - int i = 0; - int n_del = 0; + unsigned int i = 0; + unsigned int n_del = 0; if (!ctx || !new || !old || !sid || !num) return NT_STATUS_INVALID_PARAMETER; - if((new[0] = (SEC_ACE *) talloc_zero(ctx, *num * sizeof(SEC_ACE))) == 0) + if((new[0] = (SEC_ACE *) talloc_zero(ctx, (*num) * sizeof(SEC_ACE))) == 0) return NT_STATUS_NO_MEMORY; for (i = 0; i < *num; i ++) { @@ -283,7 +283,7 @@ SEC_ACL *dup_sec_acl(TALLOC_CTX *ctx, SEC_ACL *src) BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) { - int i; + unsigned int i; uint32 old_offset; uint32 offset_acl_size; SEC_ACL *psa; @@ -407,7 +407,7 @@ BOOL sec_ace_equal(SEC_ACE *s1, SEC_ACE *s2) BOOL sec_acl_equal(SEC_ACL *s1, SEC_ACL *s2) { - int i, j; + unsigned int i, j; /* Trivial cases */ diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index bfa1a13be9..27763aa224 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1665,8 +1665,8 @@ static BOOL srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_s return False; if (ss0->ptr_sess_info != 0) { - int i; - int num_entries = ss0->num_entries_read; + uint32 i; + uint32 num_entries = ss0->num_entries_read; if (num_entries > MAX_SESS_ENTRIES) { num_entries = MAX_SESS_ENTRIES; /* report this! */ @@ -1802,8 +1802,8 @@ static BOOL srv_io_srv_sess_info_1(const char *desc, SRV_SESS_INFO_1 *ss1, prs_s return False; if (ss1->ptr_sess_info != 0) { - int i; - int num_entries = ss1->num_entries_read; + uint32 i; + uint32 num_entries = ss1->num_entries_read; if (num_entries > MAX_SESS_ENTRIES) { num_entries = MAX_SESS_ENTRIES; /* report this! */ @@ -1944,7 +1944,7 @@ BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_stru if(!prs_uint32("sess_level", ps, depth, &q_n->sess_level)) return False; - if (q_n->sess_level != -1) { + if (q_n->sess_level != (uint32)-1) { if(!srv_io_srv_sess_ctr("sess_ctr", &q_n->ctr, ps, depth)) return False; } @@ -1976,7 +1976,7 @@ BOOL srv_io_r_net_sess_enum(const char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_stru if(!prs_uint32("sess_level", ps, depth, &r_n->sess_level)) return False; - if (r_n->sess_level != -1) { + if (r_n->sess_level != (uint32)-1) { if(!srv_io_srv_sess_ctr("sess_ctr", &r_n->ctr, ps, depth)) return False; } @@ -2309,7 +2309,7 @@ BOOL srv_io_q_net_conn_enum(const char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_stru if(!prs_uint32("conn_level", ps, depth, &q_n->conn_level)) return False; - if (q_n->conn_level != -1) { + if (q_n->conn_level != (uint32)-1) { if(!srv_io_srv_conn_ctr("conn_ctr", &q_n->ctr, ps, depth)) return False; } @@ -2341,7 +2341,7 @@ BOOL srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_str if(!prs_uint32("conn_level", ps, depth, &r_n->conn_level)) return False; - if (r_n->conn_level != -1) { + if (r_n->conn_level != (uint32)-1) { if(!srv_io_srv_conn_ctr("conn_ctr", &r_n->ctr, ps, depth)) return False; } @@ -2573,7 +2573,7 @@ BOOL srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_stru if(!prs_uint32("file_level", ps, depth, &q_n->file_level)) return False; - if (q_n->file_level != -1) { + if (q_n->file_level != (uint32)-1) { if(!srv_io_srv_file_ctr("file_ctr", &q_n->ctr, ps, depth)) return False; } @@ -3271,7 +3271,7 @@ BOOL srv_io_q_net_disk_enum(const char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_stru BOOL srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth) { - int i; + unsigned int i; uint32 entries_read, entries_read2, entries_read3; if (r_n == NULL) -- cgit From 4905ba282fc1692b74208b177e934cdebd447c66 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 25 Mar 2003 14:46:11 +0000 Subject: - Support building all auth modules as .so's - Change 2 variable names to avoid conflicts (patch by Stephan Kulow ) (This used to be commit 71b05cd14ae6df8340730e7bad1c783dc278c5d3) --- source3/rpc_parse/parse_misc.c | 70 +++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index b7b0e9346b..a39e3391bb 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1289,22 +1289,22 @@ void init_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid) Inits a DOM_CLNT_SRV structure. ********************************************************************/ -static void init_clnt_srv(DOM_CLNT_SRV *log, const char *logon_srv, const char *comp_name) +static void init_clnt_srv(DOM_CLNT_SRV *dlog, const char *logon_srv, const char *comp_name) { DEBUG(5,("init_clnt_srv: %d\n", __LINE__)); if (logon_srv != NULL) { - log->undoc_buffer = 1; - init_unistr2(&log->uni_logon_srv, logon_srv, strlen(logon_srv)+1); + dlog->undoc_buffer = 1; + init_unistr2(&dlog->uni_logon_srv, logon_srv, strlen(logon_srv)+1); } else { - log->undoc_buffer = 0; + dlog->undoc_buffer = 0; } if (comp_name != NULL) { - log->undoc_buffer2 = 1; - init_unistr2(&log->uni_comp_name, comp_name, strlen(comp_name)+1); + dlog->undoc_buffer2 = 1; + init_unistr2(&dlog->uni_comp_name, comp_name, strlen(comp_name)+1); } else { - log->undoc_buffer2 = 0; + dlog->undoc_buffer2 = 0; } } @@ -1312,9 +1312,9 @@ static void init_clnt_srv(DOM_CLNT_SRV *log, const char *logon_srv, const char * Inits or writes a DOM_CLNT_SRV structure. ********************************************************************/ -static BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth) +static BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *dlog, prs_struct *ps, int depth) { - if (log == NULL) + if (dlog == NULL) return False; prs_debug(ps, depth, desc, "smb_io_clnt_srv"); @@ -1323,22 +1323,22 @@ static BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *log, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_uint32("undoc_buffer ", ps, depth, &log->undoc_buffer)) + if(!prs_uint32("undoc_buffer ", ps, depth, &dlog->undoc_buffer)) return False; - if (log->undoc_buffer != 0) { - if(!smb_io_unistr2("unistr2", &log->uni_logon_srv, log->undoc_buffer, ps, depth)) + if (dlog->undoc_buffer != 0) { + if(!smb_io_unistr2("unistr2", &dlog->uni_logon_srv, dlog->undoc_buffer, ps, depth)) return False; } if(!prs_align(ps)) return False; - if(!prs_uint32("undoc_buffer2", ps, depth, &log->undoc_buffer2)) + if(!prs_uint32("undoc_buffer2", ps, depth, &dlog->undoc_buffer2)) return False; - if (log->undoc_buffer2 != 0) { - if(!smb_io_unistr2("unistr2", &log->uni_comp_name, log->undoc_buffer2, ps, depth)) + if (dlog->undoc_buffer2 != 0) { + if(!smb_io_unistr2("unistr2", &dlog->uni_comp_name, dlog->undoc_buffer2, ps, depth)) return False; } @@ -1349,28 +1349,28 @@ static BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *log, prs_struct *ps, Inits a DOM_LOG_INFO structure. ********************************************************************/ -void init_log_info(DOM_LOG_INFO *log, const char *logon_srv, const char *acct_name, +void init_log_info(DOM_LOG_INFO *dlog, const char *logon_srv, const char *acct_name, uint16 sec_chan, const char *comp_name) { DEBUG(5,("make_log_info %d\n", __LINE__)); - log->undoc_buffer = 1; + dlog->undoc_buffer = 1; - init_unistr2(&log->uni_logon_srv, logon_srv, strlen(logon_srv)+1); - init_unistr2(&log->uni_acct_name, acct_name, strlen(acct_name)+1); + init_unistr2(&dlog->uni_logon_srv, logon_srv, strlen(logon_srv)+1); + init_unistr2(&dlog->uni_acct_name, acct_name, strlen(acct_name)+1); - log->sec_chan = sec_chan; + dlog->sec_chan = sec_chan; - init_unistr2(&log->uni_comp_name, comp_name, strlen(comp_name)+1); + init_unistr2(&dlog->uni_comp_name, comp_name, strlen(comp_name)+1); } /******************************************************************* Reads or writes a DOM_LOG_INFO structure. ********************************************************************/ -BOOL smb_io_log_info(const char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth) +BOOL smb_io_log_info(const char *desc, DOM_LOG_INFO *dlog, prs_struct *ps, int depth) { - if (log == NULL) + if (dlog == NULL) return False; prs_debug(ps, depth, desc, "smb_io_log_info"); @@ -1379,18 +1379,18 @@ BOOL smb_io_log_info(const char *desc, DOM_LOG_INFO *log, prs_struct *ps, int de if(!prs_align(ps)) return False; - if(!prs_uint32("undoc_buffer", ps, depth, &log->undoc_buffer)) + if(!prs_uint32("undoc_buffer", ps, depth, &dlog->undoc_buffer)) return False; - if(!smb_io_unistr2("unistr2", &log->uni_logon_srv, True, ps, depth)) + if(!smb_io_unistr2("unistr2", &dlog->uni_logon_srv, True, ps, depth)) return False; - if(!smb_io_unistr2("unistr2", &log->uni_acct_name, True, ps, depth)) + if(!smb_io_unistr2("unistr2", &dlog->uni_acct_name, True, ps, depth)) return False; - if(!prs_uint16("sec_chan", ps, depth, &log->sec_chan)) + if(!prs_uint16("sec_chan", ps, depth, &dlog->sec_chan)) return False; - if(!smb_io_unistr2("unistr2", &log->uni_comp_name, True, ps, depth)) + if(!smb_io_unistr2("unistr2", &dlog->uni_comp_name, True, ps, depth)) return False; return True; @@ -1529,21 +1529,21 @@ BOOL smb_io_clnt_info(const char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, in Inits a DOM_LOGON_ID structure. ********************************************************************/ -void init_logon_id(DOM_LOGON_ID *log, uint32 log_id_low, uint32 log_id_high) +void init_logon_id(DOM_LOGON_ID *dlog, uint32 log_id_low, uint32 log_id_high) { DEBUG(5,("make_logon_id: %d\n", __LINE__)); - log->low = log_id_low; - log->high = log_id_high; + dlog->low = log_id_low; + dlog->high = log_id_high; } /******************************************************************* Reads or writes a DOM_LOGON_ID structure. ********************************************************************/ -BOOL smb_io_logon_id(const char *desc, DOM_LOGON_ID *log, prs_struct *ps, int depth) +BOOL smb_io_logon_id(const char *desc, DOM_LOGON_ID *dlog, prs_struct *ps, int depth) { - if (log == NULL) + if (dlog == NULL) return False; prs_debug(ps, depth, desc, "smb_io_logon_id"); @@ -1552,9 +1552,9 @@ BOOL smb_io_logon_id(const char *desc, DOM_LOGON_ID *log, prs_struct *ps, int de if(!prs_align(ps)) return False; - if(!prs_uint32("low ", ps, depth, &log->low )) + if(!prs_uint32("low ", ps, depth, &dlog->low )) return False; - if(!prs_uint32("high", ps, depth, &log->high)) + if(!prs_uint32("high", ps, depth, &dlog->high)) return False; return True; -- cgit From 02bb4e1b8ae931d9eefa2fbd4a6f5456aca99b2b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 4 Apr 2003 15:21:04 +0000 Subject: This is a merge of the NETLOGON schannel server code from Samba TNG. Actually, it exists in the main Samba cvs tree in APPLIANCE_TNG as I found out later :-) It adds a new parameter: server schannel = yes/auto/no defaulting to auto. What does this mean to the user: No requireSignOrSeal registry patch for XP anymore. Many thanks for this code to Luke Leighton, Elrond and anybody else I forgot to mention. My next thing will be to see if this applies cleanly to 3_0. Please test and comment! Volker (This used to be commit e1f953241eb020f19fe657f29afdae28dcf5a03b) --- source3/rpc_parse/parse_rpc.c | 95 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index fafbbb1965..baa70ae137 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -691,6 +691,30 @@ BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_stru return True; } +/******************************************************************* + This parses an RPC_AUTH_VERIFIER for NETLOGON schannel. I thing + assuming "NTLMSSP" in sm_io_rpc_auth_verifier is somewhat wrong. + I have to look at that later... +********************************************************************/ + +BOOL smb_io_rpc_netsec_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +{ + if (rav == NULL) + return False; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); + depth++; + + /* "NTLMSSP" */ + if(!prs_string("signature", ps, depth, rav->signature, strlen(rav->signature), + sizeof(rav->signature))) + return False; + if(!prs_uint32("msg_type ", ps, depth, &rav->msg_type)) /* NTLMSSP_MESSAGE_TYPE */ + return False; + + return True; +} + /******************************************************************* Inits an RPC_AUTH_NTLMSSP_NEG structure. ********************************************************************/ @@ -1104,3 +1128,74 @@ BOOL smb_io_rpc_auth_ntlmssp_chk(const char *desc, RPC_AUTH_NTLMSSP_CHK *chk, pr return True; } + +/******************************************************************* + Reads or writes an RPC_AUTH_NETSEC_NEG structure. +********************************************************************/ + +BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, + prs_struct *ps, int depth) +{ + if (neg == NULL) + return False; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_netsec_neg"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("unknown1", ps, depth, &neg->unknown1)) + return False; + if(!prs_uint32("unknown2", ps, depth, &neg->unknown2)) + return False; + if(!prs_string("domain ", ps, depth, neg->domain, + strlen(&ps->data_p[ps->data_offset]), sizeof(neg->domain))) + return False; + if(!prs_string("myname ", ps, depth, neg->myname, + strlen(&ps->data_p[ps->data_offset]), sizeof(neg->myname))) + return False; + + return True; +} + + +/******************************************************************* +creates an RPC_AUTH_NETSEC_CHK structure. +********************************************************************/ +BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, + const uchar sig[8], + const uchar data1[8], + const uchar data3[8], const uchar data8[8]) +{ + if (chk == NULL) + return False; + + memcpy(chk->sig, sig, sizeof(chk->sig)); + memcpy(chk->data1, data1, sizeof(chk->data1)); + memcpy(chk->data3, data3, sizeof(chk->data3)); + memcpy(chk->data8, data8, sizeof(chk->data8)); + + return True; +} + +/******************************************************************* +reads or writes an RPC_AUTH_NETSEC_CHK structure. +********************************************************************/ +BOOL smb_io_rpc_auth_netsec_chk(const char *desc, RPC_AUTH_NETSEC_CHK * chk, + prs_struct *ps, int depth) +{ + if (chk == NULL) + return False; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_netsec_chk"); + depth++; + + prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)); + prs_uint8s(False, "data3", ps, depth, chk->data3, sizeof(chk->data3)); + prs_uint8s(False, "data1", ps, depth, chk->data1, sizeof(chk->data1)); + prs_uint8s(False, "data8", ps, depth, chk->data8, sizeof(chk->data8)); + + return True; +} + -- cgit From b4d0f208fb936382c7b313bd94c180b5cb708cea Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 6 Apr 2003 07:04:09 +0000 Subject: Merge the TNG netlogon schannel from HEAD. No more XP requiresignorseal anymore! Thanks again to Luke :-) Volker (This used to be commit 6b2b55901d66cab0c0c0c90bd0585c870be6e468) --- source3/rpc_parse/parse_rpc.c | 95 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index fafbbb1965..baa70ae137 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -691,6 +691,30 @@ BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_stru return True; } +/******************************************************************* + This parses an RPC_AUTH_VERIFIER for NETLOGON schannel. I thing + assuming "NTLMSSP" in sm_io_rpc_auth_verifier is somewhat wrong. + I have to look at that later... +********************************************************************/ + +BOOL smb_io_rpc_netsec_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +{ + if (rav == NULL) + return False; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); + depth++; + + /* "NTLMSSP" */ + if(!prs_string("signature", ps, depth, rav->signature, strlen(rav->signature), + sizeof(rav->signature))) + return False; + if(!prs_uint32("msg_type ", ps, depth, &rav->msg_type)) /* NTLMSSP_MESSAGE_TYPE */ + return False; + + return True; +} + /******************************************************************* Inits an RPC_AUTH_NTLMSSP_NEG structure. ********************************************************************/ @@ -1104,3 +1128,74 @@ BOOL smb_io_rpc_auth_ntlmssp_chk(const char *desc, RPC_AUTH_NTLMSSP_CHK *chk, pr return True; } + +/******************************************************************* + Reads or writes an RPC_AUTH_NETSEC_NEG structure. +********************************************************************/ + +BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, + prs_struct *ps, int depth) +{ + if (neg == NULL) + return False; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_netsec_neg"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("unknown1", ps, depth, &neg->unknown1)) + return False; + if(!prs_uint32("unknown2", ps, depth, &neg->unknown2)) + return False; + if(!prs_string("domain ", ps, depth, neg->domain, + strlen(&ps->data_p[ps->data_offset]), sizeof(neg->domain))) + return False; + if(!prs_string("myname ", ps, depth, neg->myname, + strlen(&ps->data_p[ps->data_offset]), sizeof(neg->myname))) + return False; + + return True; +} + + +/******************************************************************* +creates an RPC_AUTH_NETSEC_CHK structure. +********************************************************************/ +BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, + const uchar sig[8], + const uchar data1[8], + const uchar data3[8], const uchar data8[8]) +{ + if (chk == NULL) + return False; + + memcpy(chk->sig, sig, sizeof(chk->sig)); + memcpy(chk->data1, data1, sizeof(chk->data1)); + memcpy(chk->data3, data3, sizeof(chk->data3)); + memcpy(chk->data8, data8, sizeof(chk->data8)); + + return True; +} + +/******************************************************************* +reads or writes an RPC_AUTH_NETSEC_CHK structure. +********************************************************************/ +BOOL smb_io_rpc_auth_netsec_chk(const char *desc, RPC_AUTH_NETSEC_CHK * chk, + prs_struct *ps, int depth) +{ + if (chk == NULL) + return False; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_netsec_chk"); + depth++; + + prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)); + prs_uint8s(False, "data3", ps, depth, chk->data3, sizeof(chk->data3)); + prs_uint8s(False, "data1", ps, depth, chk->data1, sizeof(chk->data1)); + prs_uint8s(False, "data8", ps, depth, chk->data8, sizeof(chk->data8)); + + return True; +} + -- cgit From 425797700b24c14c252389c2ff6cf3b569d7ee22 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 9 Apr 2003 09:29:47 +0000 Subject: Put the core schannel functions to parse_prs.c. They are also used by schannel clients. Volker (This used to be commit 41e92409e1c6912db05acc80b6c0d5dccd51859b) --- source3/rpc_parse/parse_prs.c | 182 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index aeaa42ac92..a22ae1bacd 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1330,3 +1330,185 @@ BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) return True; } + +static void netsechash(uchar * key, uchar * data, int data_len) +{ + uchar hash[256]; + uchar index_i = 0; + uchar index_j = 0; + uchar j = 0; + int ind; + + for (ind = 0; ind < 256; ind++) + { + hash[ind] = (uchar) ind; + } + + for (ind = 0; ind < 256; ind++) + { + uchar tc; + + j += (hash[ind] + key[ind % 16]); + + tc = hash[ind]; + hash[ind] = hash[j]; + hash[j] = tc; + } + + for (ind = 0; ind < data_len; ind++) + { + uchar tc; + uchar t; + + index_i++; + index_j += hash[index_i]; + + tc = hash[index_i]; + hash[index_i] = hash[index_j]; + hash[index_j] = tc; + + t = hash[index_i] + hash[index_j]; + data[ind] ^= hash[t]; + } +} + +void dump_data_pw(const char *msg, const uchar * data, size_t len) +{ +#ifdef DEBUG_PASSWORD + DEBUG(11, ("%s", msg)); + if (data != NULL && len > 0) + { + dump_data(11, data, len); + } +#endif +} + +void netsec_encode(struct netsec_auth_struct *a, + RPC_AUTH_NETSEC_CHK * verf, char *data, size_t data_len) +{ + uchar dataN[4]; + uchar digest1[16]; + struct MD5Context ctx3; + uchar sess_kf0[16]; + int i; + + /* store the sequence number */ + SIVAL(dataN, 0, a->seq_num); + + for (i = 0; i < sizeof(sess_kf0); i++) + { + sess_kf0[i] = a->sess_key[i] ^ 0xf0; + } + + dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); + dump_data_pw("a->seq_num :\n", dataN, sizeof(dataN)); + + MD5Init(&ctx3); + MD5Update(&ctx3, dataN, 0x4); + MD5Update(&ctx3, verf->sig, 8); + + MD5Update(&ctx3, verf->data8, 8); + + dump_data_pw("verf->data8:\n", verf->data8, sizeof(verf->data8)); + dump_data_pw("sess_kf0:\n", sess_kf0, sizeof(sess_kf0)); + + hmac_md5(sess_kf0, dataN, 0x4, digest1); + dump_data_pw("digest1 (ebp-8):\n", digest1, sizeof(digest1)); + hmac_md5(digest1, verf->data3, 8, digest1); + dump_data_pw("netsechashkey:\n", digest1, sizeof(digest1)); + netsechash(digest1, verf->data8, 8); + + dump_data_pw("verf->data8:\n", verf->data8, sizeof(verf->data8)); + + dump_data_pw("data :\n", data, data_len); + MD5Update(&ctx3, data, data_len); + + { + char digest_tmp[16]; + char digest2[16]; + MD5Final(digest_tmp, &ctx3); + hmac_md5(a->sess_key, digest_tmp, 16, digest2); + dump_data_pw("digest_tmp:\n", digest_tmp, sizeof(digest_tmp)); + dump_data_pw("digest:\n", digest2, sizeof(digest2)); + memcpy(verf->data1, digest2, sizeof(verf->data1)); + } + + netsechash(digest1, data, data_len); + dump_data_pw("data:\n", data, data_len); + + hmac_md5(a->sess_key, dataN, 0x4, digest1); + dump_data_pw("ctx:\n", digest1, sizeof(digest1)); + + hmac_md5(digest1, verf->data1, 8, digest1); + + dump_data_pw("netsechashkey:\n", digest1, sizeof(digest1)); + + dump_data_pw("verf->data3:\n", verf->data3, sizeof(verf->data3)); + netsechash(digest1, verf->data3, 8); + dump_data_pw("verf->data3:\n", verf->data3, sizeof(verf->data3)); + + return; +} + +BOOL netsec_decode(struct netsec_auth_struct *a, + RPC_AUTH_NETSEC_CHK * verf, char *data, size_t data_len) +{ + uchar dataN[4]; + uchar digest1[16]; + struct MD5Context ctx3; + uchar sess_kf0[16]; + int i; + + /* store the sequence number */ + SIVAL(dataN, 0, a->seq_num); + + for (i = 0; i < sizeof(sess_kf0); i++) + { + sess_kf0[i] = a->sess_key[i] ^ 0xf0; + } + + dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); + dump_data_pw("a->seq_num :\n", dataN, sizeof(dataN)); + hmac_md5(a->sess_key, dataN, 0x4, digest1); + dump_data_pw("ctx:\n", digest1, sizeof(digest1)); + + hmac_md5(digest1, verf->data1, 8, digest1); + + dump_data_pw("netsechashkey:\n", digest1, sizeof(digest1)); + dump_data_pw("verf->data3:\n", verf->data3, sizeof(verf->data3)); + netsechash(digest1, verf->data3, 8); + dump_data_pw("verf->data3_dec:\n", verf->data3, sizeof(verf->data3)); + + MD5Init(&ctx3); + MD5Update(&ctx3, dataN, 0x4); + MD5Update(&ctx3, verf->sig, 8); + + dump_data_pw("sess_kf0:\n", sess_kf0, sizeof(sess_kf0)); + + hmac_md5(sess_kf0, dataN, 0x4, digest1); + dump_data_pw("digest1 (ebp-8):\n", digest1, sizeof(digest1)); + hmac_md5(digest1, verf->data3, 8, digest1); + dump_data_pw("netsechashkey:\n", digest1, sizeof(digest1)); + + dump_data_pw("verf->data8:\n", verf->data8, sizeof(verf->data8)); + netsechash(digest1, verf->data8, 8); + dump_data_pw("verf->data8_dec:\n", verf->data8, sizeof(verf->data8)); + MD5Update(&ctx3, verf->data8, 8); + + dump_data_pw("data :\n", data, data_len); + netsechash(digest1, data, data_len); + dump_data_pw("datadec:\n", data, data_len); + + MD5Update(&ctx3, data, data_len); + { + uchar digest_tmp[16]; + MD5Final(digest_tmp, &ctx3); + hmac_md5(a->sess_key, digest_tmp, 16, digest1); + dump_data_pw("digest_tmp:\n", digest_tmp, sizeof(digest_tmp)); + } + + dump_data_pw("digest:\n", digest1, sizeof(digest1)); + dump_data_pw("verf->data1:\n", verf->data1, sizeof(verf->data1)); + + return memcmp(digest1, verf->data1, sizeof(verf->data1)) == 0; +} -- cgit From d3b8ac6f96889c3dc9137a6b24f351e8df9c23cb Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 9 Apr 2003 09:31:29 +0000 Subject: Put the core schannel functions to parse_prs.c. They are also used by schannel clients. Volker (This used to be commit 0f348a35d09ff020837119157ef7f4b9e6f07643) --- source3/rpc_parse/parse_prs.c | 182 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index aeaa42ac92..a22ae1bacd 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1330,3 +1330,185 @@ BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) return True; } + +static void netsechash(uchar * key, uchar * data, int data_len) +{ + uchar hash[256]; + uchar index_i = 0; + uchar index_j = 0; + uchar j = 0; + int ind; + + for (ind = 0; ind < 256; ind++) + { + hash[ind] = (uchar) ind; + } + + for (ind = 0; ind < 256; ind++) + { + uchar tc; + + j += (hash[ind] + key[ind % 16]); + + tc = hash[ind]; + hash[ind] = hash[j]; + hash[j] = tc; + } + + for (ind = 0; ind < data_len; ind++) + { + uchar tc; + uchar t; + + index_i++; + index_j += hash[index_i]; + + tc = hash[index_i]; + hash[index_i] = hash[index_j]; + hash[index_j] = tc; + + t = hash[index_i] + hash[index_j]; + data[ind] ^= hash[t]; + } +} + +void dump_data_pw(const char *msg, const uchar * data, size_t len) +{ +#ifdef DEBUG_PASSWORD + DEBUG(11, ("%s", msg)); + if (data != NULL && len > 0) + { + dump_data(11, data, len); + } +#endif +} + +void netsec_encode(struct netsec_auth_struct *a, + RPC_AUTH_NETSEC_CHK * verf, char *data, size_t data_len) +{ + uchar dataN[4]; + uchar digest1[16]; + struct MD5Context ctx3; + uchar sess_kf0[16]; + int i; + + /* store the sequence number */ + SIVAL(dataN, 0, a->seq_num); + + for (i = 0; i < sizeof(sess_kf0); i++) + { + sess_kf0[i] = a->sess_key[i] ^ 0xf0; + } + + dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); + dump_data_pw("a->seq_num :\n", dataN, sizeof(dataN)); + + MD5Init(&ctx3); + MD5Update(&ctx3, dataN, 0x4); + MD5Update(&ctx3, verf->sig, 8); + + MD5Update(&ctx3, verf->data8, 8); + + dump_data_pw("verf->data8:\n", verf->data8, sizeof(verf->data8)); + dump_data_pw("sess_kf0:\n", sess_kf0, sizeof(sess_kf0)); + + hmac_md5(sess_kf0, dataN, 0x4, digest1); + dump_data_pw("digest1 (ebp-8):\n", digest1, sizeof(digest1)); + hmac_md5(digest1, verf->data3, 8, digest1); + dump_data_pw("netsechashkey:\n", digest1, sizeof(digest1)); + netsechash(digest1, verf->data8, 8); + + dump_data_pw("verf->data8:\n", verf->data8, sizeof(verf->data8)); + + dump_data_pw("data :\n", data, data_len); + MD5Update(&ctx3, data, data_len); + + { + char digest_tmp[16]; + char digest2[16]; + MD5Final(digest_tmp, &ctx3); + hmac_md5(a->sess_key, digest_tmp, 16, digest2); + dump_data_pw("digest_tmp:\n", digest_tmp, sizeof(digest_tmp)); + dump_data_pw("digest:\n", digest2, sizeof(digest2)); + memcpy(verf->data1, digest2, sizeof(verf->data1)); + } + + netsechash(digest1, data, data_len); + dump_data_pw("data:\n", data, data_len); + + hmac_md5(a->sess_key, dataN, 0x4, digest1); + dump_data_pw("ctx:\n", digest1, sizeof(digest1)); + + hmac_md5(digest1, verf->data1, 8, digest1); + + dump_data_pw("netsechashkey:\n", digest1, sizeof(digest1)); + + dump_data_pw("verf->data3:\n", verf->data3, sizeof(verf->data3)); + netsechash(digest1, verf->data3, 8); + dump_data_pw("verf->data3:\n", verf->data3, sizeof(verf->data3)); + + return; +} + +BOOL netsec_decode(struct netsec_auth_struct *a, + RPC_AUTH_NETSEC_CHK * verf, char *data, size_t data_len) +{ + uchar dataN[4]; + uchar digest1[16]; + struct MD5Context ctx3; + uchar sess_kf0[16]; + int i; + + /* store the sequence number */ + SIVAL(dataN, 0, a->seq_num); + + for (i = 0; i < sizeof(sess_kf0); i++) + { + sess_kf0[i] = a->sess_key[i] ^ 0xf0; + } + + dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); + dump_data_pw("a->seq_num :\n", dataN, sizeof(dataN)); + hmac_md5(a->sess_key, dataN, 0x4, digest1); + dump_data_pw("ctx:\n", digest1, sizeof(digest1)); + + hmac_md5(digest1, verf->data1, 8, digest1); + + dump_data_pw("netsechashkey:\n", digest1, sizeof(digest1)); + dump_data_pw("verf->data3:\n", verf->data3, sizeof(verf->data3)); + netsechash(digest1, verf->data3, 8); + dump_data_pw("verf->data3_dec:\n", verf->data3, sizeof(verf->data3)); + + MD5Init(&ctx3); + MD5Update(&ctx3, dataN, 0x4); + MD5Update(&ctx3, verf->sig, 8); + + dump_data_pw("sess_kf0:\n", sess_kf0, sizeof(sess_kf0)); + + hmac_md5(sess_kf0, dataN, 0x4, digest1); + dump_data_pw("digest1 (ebp-8):\n", digest1, sizeof(digest1)); + hmac_md5(digest1, verf->data3, 8, digest1); + dump_data_pw("netsechashkey:\n", digest1, sizeof(digest1)); + + dump_data_pw("verf->data8:\n", verf->data8, sizeof(verf->data8)); + netsechash(digest1, verf->data8, 8); + dump_data_pw("verf->data8_dec:\n", verf->data8, sizeof(verf->data8)); + MD5Update(&ctx3, verf->data8, 8); + + dump_data_pw("data :\n", data, data_len); + netsechash(digest1, data, data_len); + dump_data_pw("datadec:\n", data, data_len); + + MD5Update(&ctx3, data, data_len); + { + uchar digest_tmp[16]; + MD5Final(digest_tmp, &ctx3); + hmac_md5(a->sess_key, digest_tmp, 16, digest1); + dump_data_pw("digest_tmp:\n", digest_tmp, sizeof(digest_tmp)); + } + + dump_data_pw("digest:\n", digest1, sizeof(digest1)); + dump_data_pw("verf->data1:\n", verf->data1, sizeof(verf->data1)); + + return memcmp(digest1, verf->data1, sizeof(verf->data1)) == 0; +} -- cgit From d9440df5799a80357bcc51d1a8bf83f71b7f5cd9 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 9 Apr 2003 09:52:57 +0000 Subject: A little clarification in the rpc auth header struct. Volker (This used to be commit 9fc3e4bf9fa7845b5d4a7eb4cacfec586045ebd0) --- source3/rpc_parse/parse_rpc.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index baa70ae137..700ce8cfd6 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -607,15 +607,15 @@ BOOL rpc_hdr_auth_chk(RPC_HDR_AUTH *rai) void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, uint8 auth_type, uint8 auth_level, - uint8 stub_type_len, + uint8 padding, uint32 ptr) { rai->auth_type = auth_type; /* nt lm ssp 0x0a */ rai->auth_level = auth_level; /* 0x06 */ - rai->stub_type_len = stub_type_len; /* 0x00 */ - rai->padding = 0; /* padding 0x00 */ + rai->padding = padding; + rai->reserved = 0; - rai->unknown = ptr; /* non-zero pointer to something */ + rai->auth_context = ptr; /* non-zero pointer to something */ } /******************************************************************* @@ -637,12 +637,11 @@ BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, in return False; if(!prs_uint8 ("auth_level ", ps, depth, &rai->auth_level)) /* 0x06 */ return False; - if(!prs_uint8 ("stub_type_len", ps, depth, &rai->stub_type_len)) - return False; if(!prs_uint8 ("padding ", ps, depth, &rai->padding)) return False; - - if(!prs_uint32("unknown ", ps, depth, &rai->unknown)) /* 0x0014a0c0 */ + if(!prs_uint8 ("reserved ", ps, depth, &rai->reserved)) + return False; + if(!prs_uint32("auth_context ", ps, depth, &rai->auth_context)) return False; return True; -- cgit From 42c18d52993cd7aaf3d8c0ef04e44404f72b3ce5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 9 Apr 2003 09:54:26 +0000 Subject: A little clarification in the rpc auth header struct. Volker (This used to be commit 36362c602ba03ae5e89956b16820d5dff580bee7) --- source3/rpc_parse/parse_rpc.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index baa70ae137..700ce8cfd6 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -607,15 +607,15 @@ BOOL rpc_hdr_auth_chk(RPC_HDR_AUTH *rai) void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, uint8 auth_type, uint8 auth_level, - uint8 stub_type_len, + uint8 padding, uint32 ptr) { rai->auth_type = auth_type; /* nt lm ssp 0x0a */ rai->auth_level = auth_level; /* 0x06 */ - rai->stub_type_len = stub_type_len; /* 0x00 */ - rai->padding = 0; /* padding 0x00 */ + rai->padding = padding; + rai->reserved = 0; - rai->unknown = ptr; /* non-zero pointer to something */ + rai->auth_context = ptr; /* non-zero pointer to something */ } /******************************************************************* @@ -637,12 +637,11 @@ BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, in return False; if(!prs_uint8 ("auth_level ", ps, depth, &rai->auth_level)) /* 0x06 */ return False; - if(!prs_uint8 ("stub_type_len", ps, depth, &rai->stub_type_len)) - return False; if(!prs_uint8 ("padding ", ps, depth, &rai->padding)) return False; - - if(!prs_uint32("unknown ", ps, depth, &rai->unknown)) /* 0x0014a0c0 */ + if(!prs_uint8 ("reserved ", ps, depth, &rai->reserved)) + return False; + if(!prs_uint32("auth_context ", ps, depth, &rai->auth_context)) return False; return True; -- cgit From 803e23f403bdb38d2523d73fd12083da486bca2f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 9 Apr 2003 15:47:06 +0000 Subject: This is the netlogon schannel client code. Try a rpcclient -S pdc -U% -c "samlogon user password" and it should work with the schannel. Needs testing platforms different from NT4SP6. Volker (This used to be commit ecd0ee4d248e750168597ccf79c389513bb0f740) --- source3/rpc_parse/parse_rpc.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 700ce8cfd6..656082e05a 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -1128,6 +1128,18 @@ BOOL smb_io_rpc_auth_ntlmssp_chk(const char *desc, RPC_AUTH_NTLMSSP_CHK *chk, pr return True; } +/******************************************************************* +creates an RPC_AUTH_NETSEC_NEG structure. +********************************************************************/ +void init_rpc_auth_netsec_neg(RPC_AUTH_NETSEC_NEG *neg, + const char *domain, const char *myname) +{ + neg->unknown1 = 0; + neg->unknown2 = 0x13; + fstrcpy(neg->domain, domain); + fstrcpy(neg->myname, myname); +} + /******************************************************************* Reads or writes an RPC_AUTH_NETSEC_NEG structure. ********************************************************************/ @@ -1148,11 +1160,11 @@ BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, return False; if(!prs_uint32("unknown2", ps, depth, &neg->unknown2)) return False; - if(!prs_string("domain ", ps, depth, neg->domain, - strlen(&ps->data_p[ps->data_offset]), sizeof(neg->domain))) - return False; if(!prs_string("myname ", ps, depth, neg->myname, - strlen(&ps->data_p[ps->data_offset]), sizeof(neg->myname))) + strlen(neg->myname), sizeof(neg->myname))) + return False; + if(!prs_string("domain ", ps, depth, neg->domain, + strlen(neg->domain), sizeof(neg->domain))) return False; return True; -- cgit From 7238bf5f40e16360439e028fa7607a5a28e02965 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 9 Apr 2003 15:54:17 +0000 Subject: This is the netlogon schannel client code. Try a rpcclient -S pdc -U% -c "samlogon user password" and it should work with the schannel. Needs testing against platforms different from NT4SP6. Volker (This used to be commit eaef0d8aeff1aa5a067679be3f17e08d7434e1e8) --- source3/rpc_parse/parse_rpc.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 700ce8cfd6..656082e05a 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -1128,6 +1128,18 @@ BOOL smb_io_rpc_auth_ntlmssp_chk(const char *desc, RPC_AUTH_NTLMSSP_CHK *chk, pr return True; } +/******************************************************************* +creates an RPC_AUTH_NETSEC_NEG structure. +********************************************************************/ +void init_rpc_auth_netsec_neg(RPC_AUTH_NETSEC_NEG *neg, + const char *domain, const char *myname) +{ + neg->unknown1 = 0; + neg->unknown2 = 0x13; + fstrcpy(neg->domain, domain); + fstrcpy(neg->myname, myname); +} + /******************************************************************* Reads or writes an RPC_AUTH_NETSEC_NEG structure. ********************************************************************/ @@ -1148,11 +1160,11 @@ BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, return False; if(!prs_uint32("unknown2", ps, depth, &neg->unknown2)) return False; - if(!prs_string("domain ", ps, depth, neg->domain, - strlen(&ps->data_p[ps->data_offset]), sizeof(neg->domain))) - return False; if(!prs_string("myname ", ps, depth, neg->myname, - strlen(&ps->data_p[ps->data_offset]), sizeof(neg->myname))) + strlen(neg->myname), sizeof(neg->myname))) + return False; + if(!prs_string("domain ", ps, depth, neg->domain, + strlen(neg->domain), sizeof(neg->domain))) return False; return True; -- cgit From 065561932c660be13f80fefa2a310a51b0c07f9c Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 11 Apr 2003 04:09:14 +0000 Subject: A new RPC pipe! The \pipe\echo named pipe is for testing large RPC requests and responses and is only compiled in when --enable-developer is passed to configure. It includes server and client side code for generating and responding to functions on this pipe. The functions are: - AddOne: add one to the uint32 argument and return ig - EchoData: echo back a variable sized char array to the caller - SourceData: request a variable sized char array - SinkData: send a variable sized char array and throw it away There's a win32 implementation of the client and server in the junkcode CVS repository in the rpcecho-win32 subdirectory. (This used to be commit 4ccd34ef836eba05f81dc2da73fd7cfaac201798) --- source3/rpc_parse/parse_echo.c | 166 +++++++++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_rpc.c | 10 +++ 2 files changed, 176 insertions(+) create mode 100644 source3/rpc_parse/parse_echo.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_echo.c b/source3/rpc_parse/parse_echo.c new file mode 100644 index 0000000000..67f9ad772e --- /dev/null +++ b/source3/rpc_parse/parse_echo.c @@ -0,0 +1,166 @@ +/* + * Unix SMB/CIFS implementation. + * + * RPC Pipe client / server routines + * + * Copyright (C) Tim Potter 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 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "includes.h" +#include "nterr.h" +#include "rpc_parse.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + +void init_echo_q_add_one(ECHO_Q_ADD_ONE *q_d, uint32 request) +{ + q_d->request = request; +} + +BOOL echo_io_q_add_one(const char *desc, ECHO_Q_ADD_ONE *q_d, + prs_struct *ps, int depth) +{ + if (!prs_uint32("request", ps, 0, &q_d->request)) + return False; + + return True; +} + +BOOL echo_io_r_add_one(const char *desc, ECHO_R_ADD_ONE *q_d, + prs_struct *ps, int depth) +{ + if (!prs_uint32("response", ps, 0, &q_d->response)) + return False; + + return True; +} + + +void init_echo_q_echo_data(ECHO_Q_ECHO_DATA *q_d, uint32 size, char *data) +{ + q_d->size = size; + q_d->data = data; +} + +BOOL echo_io_q_echo_data(const char *desc, ECHO_Q_ECHO_DATA *q_d, + prs_struct *ps, int depth) +{ + if (!prs_uint32("size", ps, depth, &q_d->size)) + return False; + + if (!prs_uint32("size", ps, depth, &q_d->size)) + return False; + + if (UNMARSHALLING(ps)) { + q_d->data = prs_alloc_mem(ps, q_d->size); + + if (!q_d->data) + return False; + } + + if (!prs_uint8s(False, "data", ps, depth, q_d->data, q_d->size)) + return False; + + return True; +} + +BOOL echo_io_r_echo_data(const char *desc, ECHO_R_ECHO_DATA *q_d, + prs_struct *ps, int depth) +{ + if (!prs_uint32("size", ps, 0, &q_d->size)) + return False; + + if (UNMARSHALLING(ps)) { + q_d->data = prs_alloc_mem(ps, q_d->size); + + if (!q_d->data) + return False; + } + + if (!prs_uint8s(False, "data", ps, depth, q_d->data, q_d->size)) + return False; + + return True; +} + +void init_echo_q_sink_data(ECHO_Q_SINK_DATA *q_d, uint32 size, char *data) +{ + q_d->size = size; + q_d->data = data; +} + +BOOL echo_io_q_sink_data(const char *desc, ECHO_Q_SINK_DATA *q_d, + prs_struct *ps, int depth) +{ + if (!prs_uint32("size", ps, depth, &q_d->size)) + return False; + + if (!prs_uint32("size", ps, depth, &q_d->size)) + return False; + + if (UNMARSHALLING(ps)) { + q_d->data = prs_alloc_mem(ps, q_d->size); + + if (!q_d->data) + return False; + } + + if (!prs_uint8s(False, "data", ps, depth, q_d->data, q_d->size)) + return False; + + return True; +} + +BOOL echo_io_r_sink_data(const char *desc, ECHO_R_SINK_DATA *q_d, + prs_struct *ps, int depth) +{ + return True; +} + +void init_echo_q_source_data(ECHO_Q_SOURCE_DATA *q_d, uint32 size) +{ + q_d->size = size; +} + +BOOL echo_io_q_source_data(const char *desc, ECHO_Q_SOURCE_DATA *q_d, + prs_struct *ps, int depth) +{ + if (!prs_uint32("size", ps, depth, &q_d->size)) + return False; + + return True; +} + +BOOL echo_io_r_source_data(const char *desc, ECHO_R_SOURCE_DATA *q_d, + prs_struct *ps, int depth) +{ + if (!prs_uint32("size", ps, 0, &q_d->size)) + return False; + + if (UNMARSHALLING(ps)) { + q_d->data = prs_alloc_mem(ps, q_d->size); + + if (!q_d->data) + return False; + } + + if (!prs_uint8s(False, "data", ps, depth, q_d->data, q_d->size)) + return False; + + return True; +} diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 656082e05a..30909c6910 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -138,6 +138,15 @@ interface/version dce/rpc pipe identification }, 0x03 \ } +#define SYNT_ECHO_V1 \ +{ \ + { \ + 0x60a15ec5, 0x4de8, 0x11d7, \ + { 0xa6, 0x37, 0x00, 0x50, \ + 0x56, 0xa2, 0x01, 0x82 } \ + }, 0x01 \ +} + /* * IMPORTANT!! If you update this structure, make sure to * update the index #defines in smb.h. @@ -155,6 +164,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, + { PIPE_ECHO , SYNT_ECHO_V1 , PIPE_ECHO , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From 3b865c73989e7f13e3a6453f9f9c9a7aca74b129 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 14 Apr 2003 02:08:03 +0000 Subject: Merge of rpcecho pipe for testing large dcerpc requests and responses. Only compiled in when --enable-developer argument passed to configure. (This used to be commit 017da9393bab276543d0d5c50df8c760780f2450) --- source3/rpc_parse/parse_rpc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 656082e05a..30909c6910 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -138,6 +138,15 @@ interface/version dce/rpc pipe identification }, 0x03 \ } +#define SYNT_ECHO_V1 \ +{ \ + { \ + 0x60a15ec5, 0x4de8, 0x11d7, \ + { 0xa6, 0x37, 0x00, 0x50, \ + 0x56, 0xa2, 0x01, 0x82 } \ + }, 0x01 \ +} + /* * IMPORTANT!! If you update this structure, make sure to * update the index #defines in smb.h. @@ -155,6 +164,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, + { PIPE_ECHO , SYNT_ECHO_V1 , PIPE_ECHO , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From 09a50497d1360659eb8bd1b9f4be510680267bd2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 16 Apr 2003 15:39:57 +0000 Subject: Fixes to make SCHANNEL work in 3.0 against a W2K DC. Still need to fix multi-PDU encode/decode with SCHANNEL. Also need to test against WNT DC. Jeremy. (This used to be commit ff66d4097088409205b6bad5124a78ef9946010d) --- source3/rpc_parse/parse_prs.c | 14 ++++++-------- source3/rpc_parse/parse_rpc.c | 14 +++++++------- 2 files changed, 13 insertions(+), 15 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index a22ae1bacd..696142905b 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1392,14 +1392,13 @@ void netsec_encode(struct netsec_auth_struct *a, uchar sess_kf0[16]; int i; - /* store the sequence number */ - SIVAL(dataN, 0, a->seq_num); + SIVAL(dataN, 0, 0); - for (i = 0; i < sizeof(sess_kf0); i++) - { + for (i = 0; i < sizeof(sess_kf0); i++) { sess_kf0[i] = a->sess_key[i] ^ 0xf0; } + DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%d\n", a->seq_num, data_len)); dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); dump_data_pw("a->seq_num :\n", dataN, sizeof(dataN)); @@ -1459,14 +1458,13 @@ BOOL netsec_decode(struct netsec_auth_struct *a, uchar sess_kf0[16]; int i; - /* store the sequence number */ - SIVAL(dataN, 0, a->seq_num); + SIVAL(dataN, 0, 0); - for (i = 0; i < sizeof(sess_kf0); i++) - { + for (i = 0; i < sizeof(sess_kf0); i++) { sess_kf0[i] = a->sess_key[i] ^ 0xf0; } + DEBUG(10,("SCHANNEL: netsec_decode seq_num=%d data_len=%d\n", a->seq_num, data_len)); dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); dump_data_pw("a->seq_num :\n", dataN, sizeof(dataN)); hmac_md5(a->sess_key, dataN, 0x4, digest1); diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 30909c6910..dd75ea1f55 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -1144,8 +1144,8 @@ creates an RPC_AUTH_NETSEC_NEG structure. void init_rpc_auth_netsec_neg(RPC_AUTH_NETSEC_NEG *neg, const char *domain, const char *myname) { - neg->unknown1 = 0; - neg->unknown2 = 0x13; + neg->type1 = 0; + neg->type2 = 0x3; fstrcpy(neg->domain, domain); fstrcpy(neg->myname, myname); } @@ -1166,16 +1166,16 @@ BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, if(!prs_align(ps)) return False; - if(!prs_uint32("unknown1", ps, depth, &neg->unknown1)) + if(!prs_uint32("type1", ps, depth, &neg->type1)) return False; - if(!prs_uint32("unknown2", ps, depth, &neg->unknown2)) - return False; - if(!prs_string("myname ", ps, depth, neg->myname, - strlen(neg->myname), sizeof(neg->myname))) + if(!prs_uint32("type2", ps, depth, &neg->type2)) return False; if(!prs_string("domain ", ps, depth, neg->domain, strlen(neg->domain), sizeof(neg->domain))) return False; + if(!prs_string("myname ", ps, depth, neg->myname, + strlen(neg->myname), sizeof(neg->myname))) + return False; return True; } -- cgit From 8f25fd3d7240a309182b32ac705634b4ff5cff2b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 16 Apr 2003 15:54:00 +0000 Subject: Fixes to make SCHANNEL work against a W2K DC. Still need to fix multi-PDU encode/decode with SCHANNEL. Also need to test against WNT DC. Jeremy. (This used to be commit ec82e8e9f4a6bf807a91ac265af39a516c7ab631) --- source3/rpc_parse/parse_prs.c | 14 ++++++-------- source3/rpc_parse/parse_rpc.c | 14 +++++++------- 2 files changed, 13 insertions(+), 15 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index a22ae1bacd..696142905b 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1392,14 +1392,13 @@ void netsec_encode(struct netsec_auth_struct *a, uchar sess_kf0[16]; int i; - /* store the sequence number */ - SIVAL(dataN, 0, a->seq_num); + SIVAL(dataN, 0, 0); - for (i = 0; i < sizeof(sess_kf0); i++) - { + for (i = 0; i < sizeof(sess_kf0); i++) { sess_kf0[i] = a->sess_key[i] ^ 0xf0; } + DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%d\n", a->seq_num, data_len)); dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); dump_data_pw("a->seq_num :\n", dataN, sizeof(dataN)); @@ -1459,14 +1458,13 @@ BOOL netsec_decode(struct netsec_auth_struct *a, uchar sess_kf0[16]; int i; - /* store the sequence number */ - SIVAL(dataN, 0, a->seq_num); + SIVAL(dataN, 0, 0); - for (i = 0; i < sizeof(sess_kf0); i++) - { + for (i = 0; i < sizeof(sess_kf0); i++) { sess_kf0[i] = a->sess_key[i] ^ 0xf0; } + DEBUG(10,("SCHANNEL: netsec_decode seq_num=%d data_len=%d\n", a->seq_num, data_len)); dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); dump_data_pw("a->seq_num :\n", dataN, sizeof(dataN)); hmac_md5(a->sess_key, dataN, 0x4, digest1); diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 30909c6910..dd75ea1f55 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -1144,8 +1144,8 @@ creates an RPC_AUTH_NETSEC_NEG structure. void init_rpc_auth_netsec_neg(RPC_AUTH_NETSEC_NEG *neg, const char *domain, const char *myname) { - neg->unknown1 = 0; - neg->unknown2 = 0x13; + neg->type1 = 0; + neg->type2 = 0x3; fstrcpy(neg->domain, domain); fstrcpy(neg->myname, myname); } @@ -1166,16 +1166,16 @@ BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, if(!prs_align(ps)) return False; - if(!prs_uint32("unknown1", ps, depth, &neg->unknown1)) + if(!prs_uint32("type1", ps, depth, &neg->type1)) return False; - if(!prs_uint32("unknown2", ps, depth, &neg->unknown2)) - return False; - if(!prs_string("myname ", ps, depth, neg->myname, - strlen(neg->myname), sizeof(neg->myname))) + if(!prs_uint32("type2", ps, depth, &neg->type2)) return False; if(!prs_string("domain ", ps, depth, neg->domain, strlen(neg->domain), sizeof(neg->domain))) return False; + if(!prs_string("myname ", ps, depth, neg->myname, + strlen(neg->myname), sizeof(neg->myname))) + return False; return True; } -- cgit From e54b9d59d6985df8fc66dce36968ce98df710742 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 18 Apr 2003 08:35:08 +0000 Subject: Survive a samdump with an alias that has no description Volker (This used to be commit 5af417a6ba24e6bb09979488511f482efa4894b8) --- source3/rpc_parse/parse_net.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 163e6bab3c..2c99d54b1b 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -2277,9 +2277,12 @@ static BOOL net_io_sam_alias_info(const char *desc, SAM_ALIAS_INFO * info, if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, info->hdr_sec_desc.buffer, ps, depth)) return False; - if (!smb_io_unistr2("uni_als_desc", &info->uni_als_desc, - info->hdr_als_name.buffer, ps, depth)) - return False; + + if (info->hdr_als_desc.buffer != 0) { + if (!smb_io_unistr2("uni_als_desc", &info->uni_als_desc, + info->hdr_als_name.buffer, ps, depth)) + return False; + } return True; } -- cgit From cdb197135f504683112826d26f360d79a13ae346 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 18 Apr 2003 08:36:12 +0000 Subject: Survive a samdump with an alias that has no description Volker (This used to be commit 408a94b64d4d799f256c11a2009e161b27553cbb) --- source3/rpc_parse/parse_net.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index a660084250..259ca7fdc1 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -2277,9 +2277,12 @@ static BOOL net_io_sam_alias_info(const char *desc, SAM_ALIAS_INFO * info, if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, info->hdr_sec_desc.buffer, ps, depth)) return False; - if (!smb_io_unistr2("uni_als_desc", &info->uni_als_desc, - info->hdr_als_name.buffer, ps, depth)) - return False; + + if (info->hdr_als_desc.buffer != 0) { + if (!smb_io_unistr2("uni_als_desc", &info->uni_als_desc, + info->hdr_als_name.buffer, ps, depth)) + return False; + } return True; } -- cgit From e15dfd44c912bf9a567a13cbbec63c4ecbabaed4 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 22 Apr 2003 15:54:36 +0000 Subject: parse_string is only used for the authentication negotiators. It can itself determine the length of the string it has to transfer. Andrew B., could you take a look at the length calculation? Is that safe? Thanks, Volker (This used to be commit 0ef69b586a8f1fa11a41a3900180ea2090b60bfd) --- source3/rpc_parse/parse_prs.c | 8 +++++++- source3/rpc_parse/parse_rpc.c | 16 ++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 696142905b..e0a75d7382 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1159,10 +1159,16 @@ BOOL prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) not include the null-termination character. ********************************************************************/ -BOOL prs_string(const char *name, prs_struct *ps, int depth, char *str, int len, int max_buf_size) +BOOL prs_string(const char *name, prs_struct *ps, int depth, char *str, int max_buf_size) { char *q; int i; + int len; + + if (UNMARSHALLING(ps)) + len = strlen(&ps->data_p[ps->data_offset]); + else + len = strlen(str); len = MIN(len, (max_buf_size-1)); diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index dd75ea1f55..be3a04e31c 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -691,7 +691,7 @@ BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_stru depth++; /* "NTLMSSP" */ - if(!prs_string("signature", ps, depth, rav->signature, strlen("NTLMSSP"), + if(!prs_string("signature", ps, depth, rav->signature, sizeof(rav->signature))) return False; if(!prs_uint32("msg_type ", ps, depth, &rav->msg_type)) /* NTLMSSP_MESSAGE_TYPE */ @@ -701,7 +701,7 @@ BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_stru } /******************************************************************* - This parses an RPC_AUTH_VERIFIER for NETLOGON schannel. I thing + This parses an RPC_AUTH_VERIFIER for NETLOGON schannel. I think assuming "NTLMSSP" in sm_io_rpc_auth_verifier is somewhat wrong. I have to look at that later... ********************************************************************/ @@ -714,11 +714,9 @@ BOOL smb_io_rpc_netsec_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_st prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); depth++; - /* "NTLMSSP" */ - if(!prs_string("signature", ps, depth, rav->signature, strlen(rav->signature), - sizeof(rav->signature))) + if(!prs_string("signature", ps, depth, rav->signature, sizeof(rav->signature))) return False; - if(!prs_uint32("msg_type ", ps, depth, &rav->msg_type)) /* NTLMSSP_MESSAGE_TYPE */ + if(!prs_uint32("msg_type ", ps, depth, &rav->msg_type)) return False; return True; @@ -1170,11 +1168,9 @@ BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, return False; if(!prs_uint32("type2", ps, depth, &neg->type2)) return False; - if(!prs_string("domain ", ps, depth, neg->domain, - strlen(neg->domain), sizeof(neg->domain))) + if(!prs_string("domain ", ps, depth, neg->domain, sizeof(neg->domain))) return False; - if(!prs_string("myname ", ps, depth, neg->myname, - strlen(neg->myname), sizeof(neg->myname))) + if(!prs_string("myname ", ps, depth, neg->myname, sizeof(neg->myname))) return False; return True; -- cgit From 0865120fca988a8016f3dd9480f171794212e436 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 22 Apr 2003 15:55:07 +0000 Subject: parse_string is only used for the authentication negotiators. It can itself determine the length of the string it has to transfer. Andrew B., could you take a look at the length calculation? Is that safe? Thanks, Volker (This used to be commit d5f1082753f84f0e3a22739055b6b9cbde29faa9) --- source3/rpc_parse/parse_prs.c | 8 +++++++- source3/rpc_parse/parse_rpc.c | 16 ++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 696142905b..e0a75d7382 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1159,10 +1159,16 @@ BOOL prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) not include the null-termination character. ********************************************************************/ -BOOL prs_string(const char *name, prs_struct *ps, int depth, char *str, int len, int max_buf_size) +BOOL prs_string(const char *name, prs_struct *ps, int depth, char *str, int max_buf_size) { char *q; int i; + int len; + + if (UNMARSHALLING(ps)) + len = strlen(&ps->data_p[ps->data_offset]); + else + len = strlen(str); len = MIN(len, (max_buf_size-1)); diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index dd75ea1f55..be3a04e31c 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -691,7 +691,7 @@ BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_stru depth++; /* "NTLMSSP" */ - if(!prs_string("signature", ps, depth, rav->signature, strlen("NTLMSSP"), + if(!prs_string("signature", ps, depth, rav->signature, sizeof(rav->signature))) return False; if(!prs_uint32("msg_type ", ps, depth, &rav->msg_type)) /* NTLMSSP_MESSAGE_TYPE */ @@ -701,7 +701,7 @@ BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_stru } /******************************************************************* - This parses an RPC_AUTH_VERIFIER for NETLOGON schannel. I thing + This parses an RPC_AUTH_VERIFIER for NETLOGON schannel. I think assuming "NTLMSSP" in sm_io_rpc_auth_verifier is somewhat wrong. I have to look at that later... ********************************************************************/ @@ -714,11 +714,9 @@ BOOL smb_io_rpc_netsec_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_st prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); depth++; - /* "NTLMSSP" */ - if(!prs_string("signature", ps, depth, rav->signature, strlen(rav->signature), - sizeof(rav->signature))) + if(!prs_string("signature", ps, depth, rav->signature, sizeof(rav->signature))) return False; - if(!prs_uint32("msg_type ", ps, depth, &rav->msg_type)) /* NTLMSSP_MESSAGE_TYPE */ + if(!prs_uint32("msg_type ", ps, depth, &rav->msg_type)) return False; return True; @@ -1170,11 +1168,9 @@ BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, return False; if(!prs_uint32("type2", ps, depth, &neg->type2)) return False; - if(!prs_string("domain ", ps, depth, neg->domain, - strlen(neg->domain), sizeof(neg->domain))) + if(!prs_string("domain ", ps, depth, neg->domain, sizeof(neg->domain))) return False; - if(!prs_string("myname ", ps, depth, neg->myname, - strlen(neg->myname), sizeof(neg->myname))) + if(!prs_string("myname ", ps, depth, neg->myname, sizeof(neg->myname))) return False; return True; -- cgit From 2a3a9f0bf43c3bf99a71f7296bb5ff6199893fea Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 23 Apr 2003 13:27:35 +0000 Subject: Merge the 'safe' parts of my StrnCpy patch - many of the users really wanted a pstrcpy/fstrcpy or at most a safe_strcpy(). These have the advantage of being compiler-verifiable. Get these out of the way, along with a rewrite of 'get_short_archi' in the spoolss client and server. (This pushes around const string pointers, rather than copied strings). Andrew Bartlett (This used to be commit 32fb801ddc035e8971e9911ed4b6e51892e9d1cc) --- source3/rpc_parse/parse_spoolss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index a5d2087a3a..53f637db88 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5438,8 +5438,9 @@ BOOL make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx, done = True; else null_char = True; + break; - + default: null_char = False; ;; -- cgit From ca103a076a53f4da083f3eb7f1b12ac95cb14fe1 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 25 Apr 2003 05:29:55 +0000 Subject: This function is a duplicate. (This used to be commit fd0cd6200b4b9b4b002dc5b640620c3fb533873b) --- source3/rpc_parse/parse_sec.c | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 47300e083a..081173cf8d 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -569,24 +569,6 @@ SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BU return(return_sdb); } -/******************************************************************* - Tallocs a duplicate SID. -********************************************************************/ - -static DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, DOM_SID *src) -{ - DOM_SID *dst; - - if(!src) - return NULL; - - if((dst = talloc_zero(ctx, sizeof(DOM_SID))) != NULL) { - sid_copy( dst, src); - } - - return dst; -} - /******************************************************************* Creates a SEC_DESC structure ********************************************************************/ -- cgit From 03412f056d7a277aab8cf6c3daa850803ae74126 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 28 Apr 2003 05:47:07 +0000 Subject: Whitespace syncup. (This used to be commit 7fd7af121ee8ba4f9540394f64fe3c78e2e96cd2) --- source3/rpc_parse/parse_spoolss.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 53f637db88..a5d2087a3a 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5438,9 +5438,8 @@ BOOL make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx, done = True; else null_char = True; - break; - + default: null_char = False; ;; -- cgit From 169a42b249bbfa39c5a2e0da15b1c3d5250a3553 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 24 May 2003 14:52:48 +0000 Subject: Fix an insufficient alloc when querying alias members. Volker (This used to be commit 47c36290db5e1f84ddf78913b3971aea04d243ab) --- source3/rpc_parse/parse_samr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 222af57e5b..ac1e9da61b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4628,7 +4628,7 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, } if (UNMARSHALLING(ps)) { - r_u->sid = talloc(ps->mem_ctx, r_u->num_sids1 * sizeof(DOM_SID)); + r_u->sid = talloc(ps->mem_ctx, r_u->num_sids1 * sizeof(DOM_SID2)); } for (i = 0; i < r_u->num_sids1; i++) { -- cgit From 42954dc0847091a14c8b814c924186cd9ba1b296 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 24 May 2003 14:53:15 +0000 Subject: Fix an insufficient alloc when querying alias members. Volker (This used to be commit 9d2d570caa4dad194534249cd5e4dc4984b4002e) --- source3/rpc_parse/parse_samr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 222af57e5b..ac1e9da61b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4628,7 +4628,7 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, } if (UNMARSHALLING(ps)) { - r_u->sid = talloc(ps->mem_ctx, r_u->num_sids1 * sizeof(DOM_SID)); + r_u->sid = talloc(ps->mem_ctx, r_u->num_sids1 * sizeof(DOM_SID2)); } for (i = 0; i < r_u->num_sids1; i++) { -- cgit From 0d3097c135e382f3540b2bb0fef0497af16d7344 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 26 May 2003 06:59:38 +0000 Subject: This fixes net rpc vampire when talking to win2k (data_offset; - if (len == 0x44) + if (len > 0) { if (ps->io) { /* reading */ - if (!prs_hash1(ps, ps->data_offset, sess_key)) + if (!prs_hash1(ps, ps->data_offset, sess_key, len)) return False; } if (!net_io_sam_passwd_info("pass", &info->pass, @@ -2144,7 +2144,7 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], if (!ps->io) { /* writing */ - if (!prs_hash1(ps, old_offset, sess_key)) + if (!prs_hash1(ps, old_offset, sess_key, len)) return False; } } diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index e0a75d7382..88150c718b 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1316,7 +1316,7 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *me /******************************************************************* hash a stream. ********************************************************************/ -BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) +BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16], int len) { char *q; @@ -1326,12 +1326,12 @@ BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) #ifdef DEBUG_PASSWORD DEBUG(100, ("prs_hash1\n")); dump_data(100, sess_key, 16); - dump_data(100, q, 68); + dump_data(100, q, len); #endif - SamOEMhash((uchar *) q, sess_key, 68); + SamOEMhash((uchar *) q, sess_key, len); #ifdef DEBUG_PASSWORD - dump_data(100, q, 68); + dump_data(100, q, len); #endif return True; -- cgit From b311be4a010307832dbfdb04f7574cbd418fdcad Mon Sep 17 00:00:00 2001 From: John Terpstra Date: Mon, 26 May 2003 16:54:39 +0000 Subject: Metze's patches: here's a small patch which renames the symbol 'log' to some better names to avoid compiler warnings about shodow global var 'log' in proto.h we now have a GLOBAL_SECTION_SNUM -1 so we should use it in swat too:-) (This used to be commit a4733a0748b4d24457558304ad47852c69905cb2) --- source3/rpc_parse/parse_misc.c | 70 +++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index f0d4c67d9f..17a96fff80 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1217,22 +1217,22 @@ void init_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid) Inits a DOM_CLNT_SRV structure. ********************************************************************/ -static void init_clnt_srv(DOM_CLNT_SRV *log, const char *logon_srv, const char *comp_name) +static void init_clnt_srv(DOM_CLNT_SRV *logcln, const char *logon_srv, const char *comp_name) { DEBUG(5,("init_clnt_srv: %d\n", __LINE__)); if (logon_srv != NULL) { - log->undoc_buffer = 1; - init_unistr2(&log->uni_logon_srv, logon_srv, strlen(logon_srv)+1); + logcln->undoc_buffer = 1; + init_unistr2(&logcln->uni_logon_srv, logon_srv, strlen(logon_srv)+1); } else { - log->undoc_buffer = 0; + logcln->undoc_buffer = 0; } if (comp_name != NULL) { - log->undoc_buffer2 = 1; - init_unistr2(&log->uni_comp_name, comp_name, strlen(comp_name)+1); + logcln->undoc_buffer2 = 1; + init_unistr2(&logcln->uni_comp_name, comp_name, strlen(comp_name)+1); } else { - log->undoc_buffer2 = 0; + logcln->undoc_buffer2 = 0; } } @@ -1240,9 +1240,9 @@ static void init_clnt_srv(DOM_CLNT_SRV *log, const char *logon_srv, const char * Inits or writes a DOM_CLNT_SRV structure. ********************************************************************/ -static BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth) +static BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *logcln, prs_struct *ps, int depth) { - if (log == NULL) + if (logcln == NULL) return False; prs_debug(ps, depth, desc, "smb_io_clnt_srv"); @@ -1251,22 +1251,22 @@ static BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *log, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_uint32("undoc_buffer ", ps, depth, &log->undoc_buffer)) + if(!prs_uint32("undoc_buffer ", ps, depth, &logcln->undoc_buffer)) return False; - if (log->undoc_buffer != 0) { - if(!smb_io_unistr2("unistr2", &log->uni_logon_srv, log->undoc_buffer, ps, depth)) + if (logcln->undoc_buffer != 0) { + if(!smb_io_unistr2("unistr2", &logcln->uni_logon_srv, logcln->undoc_buffer, ps, depth)) return False; } if(!prs_align(ps)) return False; - if(!prs_uint32("undoc_buffer2", ps, depth, &log->undoc_buffer2)) + if(!prs_uint32("undoc_buffer2", ps, depth, &logcln->undoc_buffer2)) return False; - if (log->undoc_buffer2 != 0) { - if(!smb_io_unistr2("unistr2", &log->uni_comp_name, log->undoc_buffer2, ps, depth)) + if (logcln->undoc_buffer2 != 0) { + if(!smb_io_unistr2("unistr2", &logcln->uni_comp_name, logcln->undoc_buffer2, ps, depth)) return False; } @@ -1277,28 +1277,28 @@ static BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *log, prs_struct *ps, Inits a DOM_LOG_INFO structure. ********************************************************************/ -void init_log_info(DOM_LOG_INFO *log, const char *logon_srv, const char *acct_name, +void init_log_info(DOM_LOG_INFO *loginfo, const char *logon_srv, const char *acct_name, uint16 sec_chan, const char *comp_name) { DEBUG(5,("make_log_info %d\n", __LINE__)); - log->undoc_buffer = 1; + loginfo->undoc_buffer = 1; - init_unistr2(&log->uni_logon_srv, logon_srv, strlen(logon_srv)+1); - init_unistr2(&log->uni_acct_name, acct_name, strlen(acct_name)+1); + init_unistr2(&loginfo->uni_logon_srv, logon_srv, strlen(logon_srv)+1); + init_unistr2(&loginfo->uni_acct_name, acct_name, strlen(acct_name)+1); - log->sec_chan = sec_chan; + loginfo->sec_chan = sec_chan; - init_unistr2(&log->uni_comp_name, comp_name, strlen(comp_name)+1); + init_unistr2(&loginfo->uni_comp_name, comp_name, strlen(comp_name)+1); } /******************************************************************* Reads or writes a DOM_LOG_INFO structure. ********************************************************************/ -BOOL smb_io_log_info(const char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth) +BOOL smb_io_log_info(const char *desc, DOM_LOG_INFO *loginfo, prs_struct *ps, int depth) { - if (log == NULL) + if (loginfo == NULL) return False; prs_debug(ps, depth, desc, "smb_io_log_info"); @@ -1307,18 +1307,18 @@ BOOL smb_io_log_info(const char *desc, DOM_LOG_INFO *log, prs_struct *ps, int de if(!prs_align(ps)) return False; - if(!prs_uint32("undoc_buffer", ps, depth, &log->undoc_buffer)) + if(!prs_uint32("undoc_buffer", ps, depth, &loginfo->undoc_buffer)) return False; - if(!smb_io_unistr2("unistr2", &log->uni_logon_srv, True, ps, depth)) + if(!smb_io_unistr2("unistr2", &loginfo->uni_logon_srv, True, ps, depth)) return False; - if(!smb_io_unistr2("unistr2", &log->uni_acct_name, True, ps, depth)) + if(!smb_io_unistr2("unistr2", &loginfo->uni_acct_name, True, ps, depth)) return False; - if(!prs_uint16("sec_chan", ps, depth, &log->sec_chan)) + if(!prs_uint16("sec_chan", ps, depth, &loginfo->sec_chan)) return False; - if(!smb_io_unistr2("unistr2", &log->uni_comp_name, True, ps, depth)) + if(!smb_io_unistr2("unistr2", &loginfo->uni_comp_name, True, ps, depth)) return False; return True; @@ -1457,21 +1457,21 @@ BOOL smb_io_clnt_info(const char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, in Inits a DOM_LOGON_ID structure. ********************************************************************/ -void init_logon_id(DOM_LOGON_ID *log, uint32 log_id_low, uint32 log_id_high) +void init_logon_id(DOM_LOGON_ID *logonid, uint32 log_id_low, uint32 log_id_high) { DEBUG(5,("make_logon_id: %d\n", __LINE__)); - log->low = log_id_low; - log->high = log_id_high; + logonid->low = log_id_low; + logonid->high = log_id_high; } /******************************************************************* Reads or writes a DOM_LOGON_ID structure. ********************************************************************/ -BOOL smb_io_logon_id(const char *desc, DOM_LOGON_ID *log, prs_struct *ps, int depth) +BOOL smb_io_logon_id(const char *desc, DOM_LOGON_ID *logonid, prs_struct *ps, int depth) { - if (log == NULL) + if (logonid == NULL) return False; prs_debug(ps, depth, desc, "smb_io_logon_id"); @@ -1480,9 +1480,9 @@ BOOL smb_io_logon_id(const char *desc, DOM_LOGON_ID *log, prs_struct *ps, int de if(!prs_align(ps)) return False; - if(!prs_uint32("low ", ps, depth, &log->low )) + if(!prs_uint32("low ", ps, depth, &logonid->low )) return False; - if(!prs_uint32("high", ps, depth, &log->high)) + if(!prs_uint32("high", ps, depth, &logonid->high)) return False; return True; -- cgit From 0842573b513c7b1788fe0f83f06256515227a1f9 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 27 May 2003 00:30:29 +0000 Subject: Merge of secchan fix from 3.0 that was eaten by CVS yesterday. I think it was becuase I ran out of disk quota. (This used to be commit 10cbec05a7bfe2fab54940329c5b348d5e524f29) --- source3/rpc_parse/parse_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 259ca7fdc1..1a14915c9f 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -2129,7 +2129,7 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], if (!prs_uint32("pwd_len", ps, depth, &len)) return False; old_offset = prs_offset(ps); - if (len == 0x44) + if (len > 0) { if (ps->io) { -- cgit From 545e8d499947fec55832352d741e8a904122d564 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 29 May 2003 23:49:31 +0000 Subject: Change get_nt_acl() to include security_info wanted. Only return this. This gets us closer to W2k+ in what we return for file ACLs. Fix horribly broken make_sec_desc() that screwed up the size when given a SD with no owner or group (how did it get this bad... ?). Jeremy. (This used to be commit 183c9ed4052ab14e269ed1234ca557053f77e77a) --- source3/rpc_parse/parse_sec.c | 57 ++++++++++++------------------------------- 1 file changed, 15 insertions(+), 42 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 081173cf8d..870402db5d 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -48,7 +48,7 @@ BOOL sec_io_access(const char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "sec_io_access"); depth++; - if(!prs_uint32("mask", ps, depth, &(t->mask))) + if(!prs_uint32("mask", ps, depth, &t->mask)) return False; return True; @@ -579,8 +579,6 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, { SEC_DESC *dst; uint32 offset = 0; - uint32 offset_sid = SEC_DESC_HEADER_SIZE; - uint32 offset_acl = 0; *sd_size = 0; @@ -610,58 +608,33 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, if(dacl && ((dst->dacl = dup_sec_acl(ctx, dacl)) == NULL)) goto error_exit; - offset = 0; + offset = SEC_DESC_HEADER_SIZE; /* * Work out the linearization sizes. */ - if (dst->owner_sid != NULL) { - - if (offset == 0) - offset = SEC_DESC_HEADER_SIZE; - - offset += sid_size(dst->owner_sid); - } - - if (dst->grp_sid != NULL) { - - if (offset == 0) - offset = SEC_DESC_HEADER_SIZE; - - offset += sid_size(dst->grp_sid); - } if (dst->sacl != NULL) { - - offset_acl = SEC_DESC_HEADER_SIZE; - - dst->off_sacl = offset_acl; - offset_acl += dst->sacl->size; - offset += dst->sacl->size; - offset_sid += dst->sacl->size; + dst->off_sacl = offset; + offset += dst->sacl->size; } if (dst->dacl != NULL) { - - if (offset_acl == 0) - offset_acl = SEC_DESC_HEADER_SIZE; - - dst->off_dacl = offset_acl; - offset_acl += dst->dacl->size; - offset += dst->dacl->size; - offset_sid += dst->dacl->size; + dst->off_dacl = offset; + offset += dst->dacl->size; } - *sd_size = (size_t)((offset == 0) ? SEC_DESC_HEADER_SIZE : offset); + if (dst->owner_sid != NULL) { + dst->off_owner_sid = offset; + offset += sid_size(dst->owner_sid); + } - if (dst->owner_sid != NULL) - dst->off_owner_sid = offset_sid; - - /* sid_size() returns 0 if the sid is NULL so this is ok */ - - if (dst->grp_sid != NULL) - dst->off_grp_sid = offset_sid + sid_size(dst->owner_sid); + if (dst->grp_sid != NULL) { + dst->off_grp_sid = offset; + offset += sid_size(dst->grp_sid); + } + *sd_size = (size_t)offset; return dst; error_exit: -- cgit From ead7ad7f8048bd30f54f381b5699b2838f1075f5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 3 Jun 2003 07:21:09 +0000 Subject: Fix debug message merge. Jeremy. (This used to be commit d6f23166420d89ea7d3d5433e3234529681cb330) --- source3/rpc_parse/parse_lsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 0b45c0baf3..f620845d3b 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -922,7 +922,7 @@ void init_q_lookup_sids(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd, int num_sids, DOM_SID *sids, uint16 level) { - DEBUG(5, ("init_r_enum_trust_dom\n")); + DEBUG(5, ("init_q_lookup_sids\n")); ZERO_STRUCTP(q_l); -- cgit From e1e363e4e90237c638e5adea3bb3493a35a61268 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 3 Jun 2003 16:19:31 +0000 Subject: * set winbind cache time to 5 minutes * quit obsessing over the sequence number so much * share the updated sequence number between parent and child winbindd processes in dual mode (This used to be commit 6fb5bdb30e2b1341ba600ce0dfd397394f7a831c) --- source3/rpc_parse/parse_lsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index fc9999dc4d..7ff2aa7d01 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -922,7 +922,7 @@ void init_q_lookup_sids(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd, int num_sids, DOM_SID *sids, uint16 level) { - DEBUG(5, ("init_r_enum_trust_dom\n")); + DEBUG(5, ("init_q_lookup_sids\n")); ZERO_STRUCTP(q_l); -- cgit From 894b003ce65061693c47d74f73b0aa5768a8ee17 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 4 Jun 2003 04:42:33 +0000 Subject: fixed the arbitrary 256 limit on the size of aliases in parse_samr (This used to be commit 7f8634c35aed0d8c3fe8f7700ca1175c10b6e031) --- source3/rpc_parse/parse_samr.c | 44 ++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ac1e9da61b..643b35e2e7 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4598,7 +4598,6 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, prs_struct *ps, int depth) { uint32 i; - uint32 ptr_sid[MAX_LOOKUP_SIDS]; if (r_u == NULL) return False; @@ -4614,28 +4613,31 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, if(!prs_uint32("ptr", ps, depth, &r_u->ptr)) return False; - if (r_u->ptr != 0) { - SMB_ASSERT_ARRAY(ptr_sid, r_u->num_sids); - - if (r_u->num_sids != 0) { - if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1)) - return False; - - 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 (r_u->ptr != 0 && r_u->num_sids != 0) { + uint32 *ptr_sid; - if (UNMARSHALLING(ps)) { - r_u->sid = talloc(ps->mem_ctx, r_u->num_sids1 * sizeof(DOM_SID2)); - } + if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1)) + return False; - 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; - } + ptr_sid = talloc(ps->mem_ctx, sizeof(uint32) * r_u->num_sids1); + if (!ptr_sid) { + return False; + } + + 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)) { + r_u->sid = talloc(ps->mem_ctx, r_u->num_sids1 * sizeof(DOM_SID2)); + } + + 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; } } } -- cgit From bcf59e2575a486629a52f9d2e7cb29260595686f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 4 Jun 2003 06:22:44 +0000 Subject: Fix for previous checkin. Only use talloc on unmarshalling or we'll leak memory. Jeremy. (This used to be commit 07a76eb2e01833d5e2e447391cffeda712118c20) --- source3/rpc_parse/parse_samr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 643b35e2e7..2146ccec91 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4619,9 +4619,11 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1)) return False; - ptr_sid = talloc(ps->mem_ctx, sizeof(uint32) * r_u->num_sids1); - if (!ptr_sid) { - return False; + if (UNMARSHALLING(ps)) { + ptr_sid = talloc(ps->mem_ctx, sizeof(uint32) * r_u->num_sids1); + if (!ptr_sid) { + return False; + } } for (i = 0; i < r_u->num_sids1; i++) { -- cgit From bf50387f492ac273a7c3d22c0f9d298466059e89 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 5 Jun 2003 02:44:24 +0000 Subject: Never second guess tridge.... (always talloc an internal pointer... ). Jeremy. (This used to be commit 72ecdb387db60a4afab4d4fabf76f4c1d7ecbeeb) --- source3/rpc_parse/parse_samr.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 2146ccec91..47bf3f390d 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4614,16 +4614,14 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, return False; if (r_u->ptr != 0 && r_u->num_sids != 0) { - uint32 *ptr_sid; + uint32 *ptr_sid = NULL; if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1)) return False; - if (UNMARSHALLING(ps)) { - ptr_sid = talloc(ps->mem_ctx, sizeof(uint32) * r_u->num_sids1); - if (!ptr_sid) { - return False; - } + ptr_sid = talloc(ps->mem_ctx, sizeof(uint32) * r_u->num_sids1); + if (!ptr_sid) { + return False; } for (i = 0; i < r_u->num_sids1; i++) { -- cgit From fb82535d1f1233498f2dfeebee96eb5333358164 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 23 Jun 2003 17:47:25 +0000 Subject: fix bug #178; available space in devmode should be int (This used to be commit 944480b89a829f159cabff100d83a72400aa6b6c) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index a5d2087a3a..03b204e69d 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -645,7 +645,7 @@ static BOOL spool_io_user_level(const char *desc, SPOOL_USER_CTR *q_u, prs_struc BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) { - uint32 available_space; /* size of the device mode left to parse */ + int available_space; /* size of the device mode left to parse */ /* only important on unmarshalling */ int i = 0; -- cgit From 9fda812d01d899603f7a6f7470e57de53f5c0593 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 30 Jun 2003 18:53:48 +0000 Subject: Finally ! Fixed the ACL ordering bug reported by jcmd. I realised we were not sorting returned ACE's correctly w.r.t. W2K - implemented the correct algorithm. Jeremy. (This used to be commit fa23a4158ec23c0b8dbdc6c53f29958243107dee) --- source3/rpc_parse/parse_sec.c | 122 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 115 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 870402db5d..3848bd7051 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -3,7 +3,7 @@ * Version 1.9. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1998, - * Copyright (C) Jeremy R. Allison 1995-1998 + * Copyright (C) Jeremy R. Allison 1995-2003. * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, * Copyright (C) Paul Ashton 1997-1998. * @@ -901,7 +901,7 @@ BOOL sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int } /******************************************************************* - adds new SID with its permissions to SEC_DESC + Add a new SID with its permissions to SEC_DESC. ********************************************************************/ NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32 mask, size_t *sd_size) @@ -913,7 +913,8 @@ NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32 *sd_size = 0; - if (!ctx || !psd || !sid || !sd_size) return NT_STATUS_INVALID_PARAMETER; + if (!ctx || !psd || !sid || !sd_size) + return NT_STATUS_INVALID_PARAMETER; status = sec_ace_add_sid(ctx, &ace, psd[0]->dacl->ace, &psd[0]->dacl->num_aces, sid, mask); @@ -933,14 +934,15 @@ NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32 } /******************************************************************* - modify SID's permissions at SEC_DESC + Modify a SID's permissions in a SEC_DESC. ********************************************************************/ NTSTATUS sec_desc_mod_sid(SEC_DESC *sd, DOM_SID *sid, uint32 mask) { NTSTATUS status; - if (!sd || !sid) return NT_STATUS_INVALID_PARAMETER; + if (!sd || !sid) + return NT_STATUS_INVALID_PARAMETER; status = sec_ace_mod_sid(sd->dacl->ace, sd->dacl->num_aces, sid, mask); @@ -951,7 +953,7 @@ NTSTATUS sec_desc_mod_sid(SEC_DESC *sd, DOM_SID *sid, uint32 mask) } /******************************************************************* - delete SID from SEC_DESC + Delete a SID from a SEC_DESC. ********************************************************************/ NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t *sd_size) @@ -963,7 +965,8 @@ NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t *sd_size = 0; - if (!ctx || !psd[0] || !sid || !sd_size) return NT_STATUS_INVALID_PARAMETER; + if (!ctx || !psd[0] || !sid || !sd_size) + return NT_STATUS_INVALID_PARAMETER; status = sec_ace_del_sid(ctx, &ace, psd[0]->dacl->ace, &psd[0]->dacl->num_aces, sid); @@ -981,3 +984,108 @@ NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t sd = 0; return NT_STATUS_OK; } + +/******************************************************************* + Comparison function to sort non-inherited first. +*******************************************************************/ + +static int nt_ace_inherit_comp( SEC_ACE *a1, SEC_ACE *a2) +{ + int a1_inh = a1->flags & SEC_ACE_FLAG_INHERITED_ACE; + int a2_inh = a2->flags & SEC_ACE_FLAG_INHERITED_ACE; + + if (a1_inh == a2_inh) + return 0; + + if (!a1_inh && a2_inh) + return -1; + return 1; +} + +/******************************************************************* + Comparison function to apply the order explained below in a group. +*******************************************************************/ + +static int nt_ace_canon_comp( SEC_ACE *a1, SEC_ACE *a2) +{ + if ((a1->type == SEC_ACE_TYPE_ACCESS_DENIED) && + (a2->type != SEC_ACE_TYPE_ACCESS_DENIED)) + return -1; + + if ((a2->type == SEC_ACE_TYPE_ACCESS_DENIED) && + (a1->type != SEC_ACE_TYPE_ACCESS_DENIED)) + return 1; + + /* Both access denied or access allowed. */ + + /* 1. ACEs that apply to the object itself */ + + if (!(a1->flags & SEC_ACE_FLAG_INHERIT_ONLY) && + (a2->flags & SEC_ACE_FLAG_INHERIT_ONLY)) + return -1; + else if (!(a2->flags & SEC_ACE_FLAG_INHERIT_ONLY) && + (a1->flags & SEC_ACE_FLAG_INHERIT_ONLY)) + return 1; + + /* 2. ACEs that apply to a subobject of the object, such as + * a property set or property. */ + + if (a1->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT) && + !(a2->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT))) + return -1; + else if (a2->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT) && + !(a1->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT))) + return 1; + + return 0; +} + +/******************************************************************* + Functions to convert a SEC_DESC ACE DACL list into canonical order. + JRA. + +--- from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/security/order_of_aces_in_a_dacl.asp + +The following describes the preferred order: + + To ensure that noninherited ACEs have precedence over inherited ACEs, + place all noninherited ACEs in a group before any inherited ACEs. + This ordering ensures, for example, that a noninherited access-denied ACE + is enforced regardless of any inherited ACE that allows access. + + Within the groups of noninherited ACEs and inherited ACEs, order ACEs according to ACE type, as the following shows: + 1. Access-denied ACEs that apply to the object itself + 2. Access-denied ACEs that apply to a subobject of the object, such as a property set or property + 3. Access-allowed ACEs that apply to the object itself + 4. Access-allowed ACEs that apply to a subobject of the object" + +********************************************************************/ + +void dacl_sort_into_canonical_order(SEC_ACE *srclist, unsigned int num_aces) +{ + unsigned int i; + + if (!srclist || num_aces == 0) + return; + + /* Sort so that non-inherited ACE's come first. */ + qsort( srclist, num_aces, sizeof(srclist[0]), QSORT_CAST nt_ace_inherit_comp); + + /* Find the boundary between non-inherited ACEs. */ + for (i = 0; i < num_aces; i++ ) { + SEC_ACE *curr_ace = &srclist[i]; + + if (curr_ace->flags & SEC_ACE_FLAG_INHERITED_ACE) + break; + } + + /* i now points at entry number of the first inherited ACE. */ + + /* Sort the non-inherited ACEs. */ + if (i) + qsort( srclist, i, sizeof(srclist[0]), QSORT_CAST nt_ace_canon_comp); + + /* Now sort the inherited ACEs. */ + if (num_aces - i) + qsort( &srclist[i], num_aces - i, sizeof(srclist[0]), QSORT_CAST nt_ace_canon_comp); +} -- cgit From 58fca5074216891bcc9b0c1674b221646af79841 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 1 Jul 2003 21:47:13 +0000 Subject: Adding jcmd's share ACL on XP patch. Thanks Jim ! Jeremy. (This used to be commit 7ed1118ae61a13de2c781a94fc2394090efd1f9b) --- source3/rpc_parse/parse_srv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 27763aa224..bbb5193ddc 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -623,7 +623,8 @@ static BOOL srv_io_share_info1005(const char* desc, SRV_SHARE_INFO_1005* sh1005, if(!prs_align(ps)) return False; - if(!prs_uint32("dfs_root_flag", ps, depth, &sh1005->dfs_root_flag)) + if(!prs_uint32("share_info_flags", ps, depth, + &sh1005->share_info_flags)) return False; return True; -- cgit From a31a2c159cd51112abdbe230c7a4df743fe14288 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 3 Jul 2003 03:56:16 +0000 Subject: well this was easy... When winbindd is running on a PDC the SAM_ACCOUNT for a trusted user has a username of DOMAIN\user. Make sure to trim the domain part from the username when filling in the net_sam_logon reply. This fixes the browsing issues i was seen across domain trusts. (This used to be commit 62e36e6ede067ace23f5473d04917c7eeedf07e2) --- source3/rpc_parse/parse_net.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 7d04eace23..43bd8cd20e 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1283,6 +1283,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, /* need to count the number of space-delimited sids */ unsigned int i; int num_other_sids = 0; + char *username; NTTIME logon_time, logoff_time, kickoff_time, pass_last_set_time, pass_can_change_time, @@ -1294,7 +1295,21 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, int len_logon_srv = strlen(logon_srv); int len_logon_dom = strlen(logon_dom); - len_user_name = strlen(user_name ); + + /* do some cleanup on the user name here to deal with users from a + trusted domain logging onto a client in our domain. If we are running + winbindd, the trusted users will be of the form DOMAIN\user so strip + out the domain portion. I noticed then when looking at an SMBsessionsetup&X. + The client was sending GLASS\Administrator as the username and GLASS as the + domain name -- jerry */ + + if ( (username = strchr( user_name, *lp_winbind_separator() )) != NULL ) + username++; + else + username = user_name; + + + len_user_name = strlen(username ); len_full_name = strlen(full_name ); len_home_dir = strlen(home_dir ); len_dir_drive = strlen(dir_drive ); @@ -1306,6 +1321,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *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); @@ -1356,7 +1372,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, 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, len_user_name); + init_unistr2(&usr->uni_user_name, username, len_user_name); init_unistr2(&usr->uni_full_name, full_name, len_full_name); init_unistr2(&usr->uni_logon_script, logon_script, len_logon_script); init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path); -- cgit From 61116049cabc292c2f2d570af4d68ddc537b91f5 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 3 Jul 2003 14:36:42 +0000 Subject: This patch takes the work the jerry did for beta2, and generalises it: - The 'not implmented' checks are now done by all auth modules - the ntdomain/trustdomain/winbind modules are more presise as to what domain names they can and cannot handle - The become_root() calls are now around the winbind pipe opening only, not the entire auth call - The unix username is kept seperate from the NT username, removing the need for 'clean off the domain\' in parse_net.c - All sid->uid translations are now validated with getpwuid() to put a very basic stop to logins with 'half deleted' accounts. Andrew Bartlett (This used to be commit 85f88191b9927cc434645ef4c1eaf5ec0e8af2ec) --- source3/rpc_parse/parse_net.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 43bd8cd20e..f977549a07 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1283,7 +1283,6 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, /* need to count the number of space-delimited sids */ unsigned int i; int num_other_sids = 0; - char *username; NTTIME logon_time, logoff_time, kickoff_time, pass_last_set_time, pass_can_change_time, @@ -1295,21 +1294,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, int len_logon_srv = strlen(logon_srv); int len_logon_dom = strlen(logon_dom); - - /* do some cleanup on the user name here to deal with users from a - trusted domain logging onto a client in our domain. If we are running - winbindd, the trusted users will be of the form DOMAIN\user so strip - out the domain portion. I noticed then when looking at an SMBsessionsetup&X. - The client was sending GLASS\Administrator as the username and GLASS as the - domain name -- jerry */ - - if ( (username = strchr( user_name, *lp_winbind_separator() )) != NULL ) - username++; - else - username = user_name; - - - len_user_name = strlen(username ); + len_user_name = strlen(user_name ); len_full_name = strlen(full_name ); len_home_dir = strlen(home_dir ); len_dir_drive = strlen(dir_drive ); @@ -1372,7 +1357,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, usr->num_other_sids = num_other_sids; usr->buffer_other_sids = (num_other_sids != 0) ? 1 : 0; - init_unistr2(&usr->uni_user_name, username, len_user_name); + init_unistr2(&usr->uni_user_name, user_name, len_user_name); init_unistr2(&usr->uni_full_name, full_name, len_full_name); init_unistr2(&usr->uni_logon_script, logon_script, len_logon_script); init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path); -- cgit From ce72beb2b558d86fb49063c6b1fa00e07952ce56 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 3 Jul 2003 19:11:31 +0000 Subject: Removed strupper/strlower macros that automatically map to strupper_m/strlower_m. I really want people to think about when they're using multibyte strings. Jeremy. (This used to be commit ff222716a08af65d26ad842ce4c2841cc6540959) --- source3/rpc_parse/parse_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index f977549a07..804da707de 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -446,7 +446,7 @@ void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, for (i = 0; i < num_doms; i++) { fstring domain_name; fstrcpy(domain_name, dom_name); - strupper(domain_name); + strupper_m(domain_name); init_unistr2(&r_t->uni_trust_dom_name[i], domain_name, strlen(domain_name)+1); /* the use of UNISTR2 here is non-standard. */ r_t->uni_trust_dom_name[i].undoc = 0x1; -- cgit From 4072006fecf56bebf113fe1d4566156c0d89bacc Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 9 Jul 2003 00:23:42 +0000 Subject: Get rid of DISP_USER_INFO/DISP_GROUP_INFO as they serve no useful purpose. Replace with an array of SAM_ACCOUNT/DOMAIN_GRP entries. ZERO struct's in smbd/uid.c stops core dumps when sid_to_XX functions fail. Getting ready to add caching. Jeremy. (This used to be commit 9d0692a54fe2cb087f25796ec2ab5e1d8433e388) --- source3/rpc_parse/parse_samr.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 47bf3f390d..45c81deb89 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1500,7 +1500,7 @@ inits a SAM_DISPINFO_1 structure. ********************************************************************/ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_entries, - uint32 start_idx, DISP_USER_INFO *disp_user_info, + uint32 start_idx, SAM_ACCOUNT *disp_user_info, DOM_SID *domain_sid) { uint32 len_sam_name, len_sam_full, len_sam_desc; @@ -1535,7 +1535,7 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_en DEBUG(11, ("init_sam_dispinfo_1: entry: %d\n",i)); - pwd=disp_user_info[i+start_idx].sam; + pwd=&disp_user_info[i+start_idx]; username = pdb_get_username(pwd); fullname = pdb_get_fullname(pwd); @@ -1635,7 +1635,7 @@ inits a SAM_DISPINFO_2 structure. ********************************************************************/ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_entries, - uint32 start_idx, DISP_USER_INFO *disp_user_info, + uint32 start_idx, SAM_ACCOUNT *disp_user_info, DOM_SID *domain_sid ) { uint32 len_sam_name, len_sam_desc; @@ -1666,7 +1666,7 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_en fstring user_sid_string, domain_sid_string; DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i)); - pwd=disp_user_info[i+start_idx].sam; + pwd=&disp_user_info[i+start_idx]; username = pdb_get_username(pwd); acct_desc = pdb_get_acct_desc(pwd); @@ -1754,7 +1754,7 @@ inits a SAM_DISPINFO_3 structure. ********************************************************************/ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_entries, - uint32 start_idx, DISP_GROUP_INFO *disp_group_info) + uint32 start_idx, DOMAIN_GRP *disp_group_info) { uint32 len_sam_name, len_sam_desc; uint32 i; @@ -1776,7 +1776,7 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_en ZERO_STRUCTP(sam->str); for (i = 0; i < num_entries; i++) { - DOMAIN_GRP *grp = disp_group_info[i+start_idx].grp; + DOMAIN_GRP *grp = &disp_group_info[i+start_idx]; DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i)); @@ -1848,7 +1848,7 @@ inits a SAM_DISPINFO_4 structure. ********************************************************************/ NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 num_entries, - uint32 start_idx, DISP_USER_INFO *disp_user_info) + uint32 start_idx, SAM_ACCOUNT *disp_user_info) { uint32 len_sam_name; uint32 i; @@ -1872,7 +1872,7 @@ NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 num_en for (i = 0; i < num_entries; i++) { DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i)); - pwd=disp_user_info[i+start_idx].sam; + pwd=&disp_user_info[i+start_idx]; len_sam_name = strlen(pdb_get_username(pwd)); @@ -1939,7 +1939,7 @@ inits a SAM_DISPINFO_5 structure. ********************************************************************/ NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 num_entries, - uint32 start_idx, DISP_GROUP_INFO *disp_group_info) + uint32 start_idx, DOMAIN_GRP *disp_group_info) { uint32 len_sam_name; uint32 i; @@ -1961,7 +1961,7 @@ NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 num_en ZERO_STRUCTP(sam->str); for (i = 0; i < num_entries; i++) { - DOMAIN_GRP *grp = disp_group_info[i+start_idx].grp; + DOMAIN_GRP *grp = &disp_group_info[i+start_idx]; DEBUG(11, ("init_sam_dispinfo_5: entry: %d\n",i)); -- cgit From 9e51951e6e4e5c1fcf89e37123f59c08df56e09e Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 14 Jul 2003 05:13:30 +0000 Subject: Don't bomb out when trying to unmarshall a zero length printerdata value. Fixes remote printer publishing of shared printers from a Samba server. (This used to be commit 7f363fa32d3b660567fc87d5d0b1e1d4dd58461a) --- source3/rpc_parse/parse_spoolss.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 03b204e69d..1a380c64d5 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7296,15 +7296,14 @@ static BOOL spoolss_io_printer_enum_values_ctr(const char *desc, prs_struct *ps, if (!prs_unistr("valuename", ps, depth, &ctr->values[i].valuename)) return False; - if (UNMARSHALLING(ps)) { + if (UNMARSHALLING(ps) && ctr->values[i].data_len) { ctr->values[i].data = (uint8 *)prs_alloc_mem( ps, ctr->values[i].data_len); if (!ctr->values[i].data) return False; + if (!prs_uint8s(False, "data", ps, depth, ctr->values[i].data, ctr->values[i].data_len)) + return False; } - - if (!prs_uint8s(False, "data", ps, depth, ctr->values[i].data, ctr->values[i].data_len)) - return False; if ( !prs_align_uint16(ps) ) return False; -- cgit From 456f51bcbe04ccbb37a27b6e115a851cc134adcd Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 14 Jul 2003 08:46:32 +0000 Subject: Jeremy requested that I get my NTLMSSP patch into CVS. He didn't request the schannel code, but I've included that anyway. :-) This patch revives the client-side NTLMSSP support for RPC named pipes in Samba, and cleans up the client and server schannel code. The use of the new code is enabled by the 'sign', 'seal' and 'schannel' commands in rpcclient. The aim was to prove that our separate NTLMSSP client library actually implements NTLMSSP signing and sealing as per Microsoft's NTLMv1 implementation, in the hope that knowing this will assist us in correctly implementing NTLMSSP signing for SMB packets. (Still not yet functional) This patch replaces the NTLMSSP implementation in rpc_client/cli_pipe.c with calls to libsmb/ntlmssp.c. In the process, we have gained the ability to use the more secure NT password, and the ability to sign-only, instead of having to seal the pipe connection. (Previously we were limited to sealing, and could only use the LM-password derived key). Our new client-side NTLMSSP code also needed alteration to cope with our comparatively simple server-side implementation. A future step is to replace it with calls to the same NTLMSSP library. Also included in this patch is the schannel 'sign only' patch I submitted to the team earlier. While not enabled (and not functional, at this stage) the work in this patch makes the code paths *much* easier to follow. I have also included similar hooks in rpccleint to allow the use of schannel on *any* pipe. rpcclient now defaults to not using schannel (or any other extra per-pipe authenticiation) for any connection. The 'schannel' command enables schannel for all pipes until disabled. This code is also much more secure than the previous code, as changes to our cli_pipe routines ensure that the authentication footer cannot be removed by an attacker, and more error states are correctly handled. (The same needs to be done to our server) Andrew Bartlett (This used to be commit 5472ddc9eaf4e79c5b2e1c8ee8c7f190dc285f19) --- source3/rpc_parse/parse_prs.c | 270 +++++++++++++++++++++++++++--------------- source3/rpc_parse/parse_rpc.c | 26 ++-- 2 files changed, 184 insertions(+), 112 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 88150c718b..efd4914c66 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1378,141 +1378,221 @@ static void netsechash(uchar * key, uchar * data, int data_len) } } -void dump_data_pw(const char *msg, const uchar * data, size_t len) + +/******************************************************************* + Create a digest over the entire packet (including the data), and + MD5 it with the session key. + ********************************************************************/ +static void netsec_digest(struct netsec_auth_struct *a, + int auth_flags, + RPC_AUTH_NETSEC_CHK * verf, + char *data, size_t data_len, + uchar digest_final[16]) { -#ifdef DEBUG_PASSWORD - DEBUG(11, ("%s", msg)); - if (data != NULL && len > 0) - { - dump_data(11, data, len); + uchar whole_packet_digest[16]; + static uchar zeros[4]; + struct MD5Context ctx3; + + /* verfiy the signature on the packet by MD5 over various bits */ + MD5Init(&ctx3); + /* use our sequence number, which ensures the packet is not + out of order */ + MD5Update(&ctx3, zeros, sizeof(zeros)); + MD5Update(&ctx3, verf->sig, sizeof(verf->sig)); + if (auth_flags & AUTH_PIPE_SEAL) { + MD5Update(&ctx3, verf->data8, sizeof(verf->data8)); } -#endif + MD5Update(&ctx3, data, data_len); + MD5Final(whole_packet_digest, &ctx3); + dump_data_pw("whole_packet_digest:\n", whole_packet_digest, sizeof(whole_packet_digest)); + + /* MD5 this result and the session key, to prove that + only a valid client could had produced this */ + hmac_md5(a->sess_key, whole_packet_digest, sizeof(whole_packet_digest), digest_final); } -void netsec_encode(struct netsec_auth_struct *a, - RPC_AUTH_NETSEC_CHK * verf, char *data, size_t data_len) +/******************************************************************* + Calculate the key with which to encode the data payload + ********************************************************************/ +static void netsec_get_sealing_key(struct netsec_auth_struct *a, + RPC_AUTH_NETSEC_CHK *verf, + uchar sealing_key[16]) { - uchar dataN[4]; - uchar digest1[16]; - struct MD5Context ctx3; + static uchar zeros[4]; + uchar digest2[16]; uchar sess_kf0[16]; int i; - SIVAL(dataN, 0, 0); - for (i = 0; i < sizeof(sess_kf0); i++) { sess_kf0[i] = a->sess_key[i] ^ 0xf0; } + + dump_data_pw("sess_kf0:\n", sess_kf0, sizeof(sess_kf0)); + + /* MD5 of sess_kf0 and the high bytes of the sequence number */ + hmac_md5(sess_kf0, zeros, 0x4, digest2); + dump_data_pw("digest2:\n", digest2, sizeof(digest2)); + + /* MD5 of the above result, plus 8 bytes of sequence number */ + hmac_md5(digest2, verf->seq_num, sizeof(verf->seq_num), sealing_key); + dump_data_pw("sealing_key:\n", sealing_key, 16); +} - DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%d\n", a->seq_num, data_len)); - dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); - dump_data_pw("a->seq_num :\n", dataN, sizeof(dataN)); +/******************************************************************* + Encode or Decode the sequence number (which is symmetric) + ********************************************************************/ +static void netsec_deal_with_seq_num(struct netsec_auth_struct *a, + RPC_AUTH_NETSEC_CHK *verf) +{ + static uchar zeros[4]; + uchar sequence_key[16]; + uchar digest1[16]; - MD5Init(&ctx3); - MD5Update(&ctx3, dataN, 0x4); - MD5Update(&ctx3, verf->sig, 8); + hmac_md5(a->sess_key, zeros, sizeof(zeros), digest1); + dump_data_pw("(sequence key) digest1:\n", digest1, sizeof(digest1)); - MD5Update(&ctx3, verf->data8, 8); + hmac_md5(digest1, verf->packet_digest, 8, sequence_key); - dump_data_pw("verf->data8:\n", verf->data8, sizeof(verf->data8)); - dump_data_pw("sess_kf0:\n", sess_kf0, sizeof(sess_kf0)); + dump_data_pw("sequence_key:\n", sequence_key, sizeof(sequence_key)); - hmac_md5(sess_kf0, dataN, 0x4, digest1); - dump_data_pw("digest1 (ebp-8):\n", digest1, sizeof(digest1)); - hmac_md5(digest1, verf->data3, 8, digest1); - dump_data_pw("netsechashkey:\n", digest1, sizeof(digest1)); - netsechash(digest1, verf->data8, 8); + dump_data_pw("seq_num (before):\n", verf->seq_num, sizeof(verf->seq_num)); + netsechash(sequence_key, verf->seq_num, 8); + dump_data_pw("seq_num (after):\n", verf->seq_num, sizeof(verf->seq_num)); +} - dump_data_pw("verf->data8:\n", verf->data8, sizeof(verf->data8)); - dump_data_pw("data :\n", data, data_len); - MD5Update(&ctx3, data, data_len); +/******************************************************************* + Encode a blob of data using the netsec (schannel) alogrithm, also produceing + a checksum over the original data. We currently only support + signing and sealing togeather - the signing-only code is close, but not + quite compatible with what MS does. + ********************************************************************/ +void netsec_encode(struct netsec_auth_struct *a, int auth_flags, + enum netsec_direction direction, + RPC_AUTH_NETSEC_CHK * verf, char *data, size_t data_len) +{ + uchar digest_final[16]; - { - char digest_tmp[16]; - char digest2[16]; - MD5Final(digest_tmp, &ctx3); - hmac_md5(a->sess_key, digest_tmp, 16, digest2); - dump_data_pw("digest_tmp:\n", digest_tmp, sizeof(digest_tmp)); - dump_data_pw("digest:\n", digest2, sizeof(digest2)); - memcpy(verf->data1, digest2, sizeof(verf->data1)); + DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%d\n", a->seq_num, data_len)); + dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); + + RSIVAL(verf->seq_num, 0, a->seq_num); + + switch (direction) { + case SENDER_IS_INITIATOR: + SIVAL(verf->seq_num, 4, 0x80); + break; + case SENDER_IS_ACCEPTOR: + SIVAL(verf->seq_num, 4, 0x0); + break; } - netsechash(digest1, data, data_len); - dump_data_pw("data:\n", data, data_len); + dump_data_pw("verf->seq_num:\n", verf->seq_num, sizeof(verf->seq_num)); - hmac_md5(a->sess_key, dataN, 0x4, digest1); - dump_data_pw("ctx:\n", digest1, sizeof(digest1)); + /* produce a digest of the packet to prove it's legit (before we seal it) */ + netsec_digest(a, auth_flags, verf, data, data_len, digest_final); + memcpy(verf->packet_digest, digest_final, sizeof(verf->packet_digest)); - hmac_md5(digest1, verf->data1, 8, digest1); + if (auth_flags & AUTH_PIPE_SEAL) { + uchar sealing_key[16]; - dump_data_pw("netsechashkey:\n", digest1, sizeof(digest1)); + /* get the key to encode the data with */ + netsec_get_sealing_key(a, verf, sealing_key); - dump_data_pw("verf->data3:\n", verf->data3, sizeof(verf->data3)); - netsechash(digest1, verf->data3, 8); - dump_data_pw("verf->data3:\n", verf->data3, sizeof(verf->data3)); + /* encode the verification data */ + dump_data_pw("verf->data8:\n", verf->data8, sizeof(verf->data8)); + netsechash(sealing_key, verf->data8, 8); + + dump_data_pw("verf->data8_enc:\n", verf->data8, sizeof(verf->data8)); + + /* encode the packet payload */ + dump_data_pw("data:\n", data, data_len); + netsechash(sealing_key, data, data_len); + dump_data_pw("data_enc:\n", data, data_len); + } + + /* encode the sequence number (key based on packet digest) */ + /* needs to be done after the sealing, as the original version + is used in the sealing stuff... */ + netsec_deal_with_seq_num(a, verf); return; } -BOOL netsec_decode(struct netsec_auth_struct *a, +/******************************************************************* + Decode a blob of data using the netsec (schannel) alogrithm, also verifiying + a checksum over the original data. We currently can verify signed messages, + as well as decode sealed messages + ********************************************************************/ + +BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, + enum netsec_direction direction, RPC_AUTH_NETSEC_CHK * verf, char *data, size_t data_len) { - uchar dataN[4]; - uchar digest1[16]; - struct MD5Context ctx3; - uchar sess_kf0[16]; - int i; - - SIVAL(dataN, 0, 0); - - for (i = 0; i < sizeof(sess_kf0); i++) { - sess_kf0[i] = a->sess_key[i] ^ 0xf0; + uchar digest_final[16]; + + /* Create the expected sequence number for comparison */ + uchar seq_num[8]; + RSIVAL(seq_num, 0, a->seq_num); + + switch (direction) { + case SENDER_IS_INITIATOR: + SIVAL(seq_num, 4, 0x80); + break; + case SENDER_IS_ACCEPTOR: + SIVAL(seq_num, 4, 0x0); + break; } DEBUG(10,("SCHANNEL: netsec_decode seq_num=%d data_len=%d\n", a->seq_num, data_len)); dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); - dump_data_pw("a->seq_num :\n", dataN, sizeof(dataN)); - hmac_md5(a->sess_key, dataN, 0x4, digest1); - dump_data_pw("ctx:\n", digest1, sizeof(digest1)); - - hmac_md5(digest1, verf->data1, 8, digest1); - - dump_data_pw("netsechashkey:\n", digest1, sizeof(digest1)); - dump_data_pw("verf->data3:\n", verf->data3, sizeof(verf->data3)); - netsechash(digest1, verf->data3, 8); - dump_data_pw("verf->data3_dec:\n", verf->data3, sizeof(verf->data3)); - - MD5Init(&ctx3); - MD5Update(&ctx3, dataN, 0x4); - MD5Update(&ctx3, verf->sig, 8); - - dump_data_pw("sess_kf0:\n", sess_kf0, sizeof(sess_kf0)); - hmac_md5(sess_kf0, dataN, 0x4, digest1); - dump_data_pw("digest1 (ebp-8):\n", digest1, sizeof(digest1)); - hmac_md5(digest1, verf->data3, 8, digest1); - dump_data_pw("netsechashkey:\n", digest1, sizeof(digest1)); + dump_data_pw("seq_num:\n", seq_num, sizeof(seq_num)); - dump_data_pw("verf->data8:\n", verf->data8, sizeof(verf->data8)); - netsechash(digest1, verf->data8, 8); - dump_data_pw("verf->data8_dec:\n", verf->data8, sizeof(verf->data8)); - MD5Update(&ctx3, verf->data8, 8); + /* extract the sequence number (key based on supplied packet digest) */ + /* needs to be done before the sealing, as the original version + is used in the sealing stuff... */ + netsec_deal_with_seq_num(a, verf); - dump_data_pw("data :\n", data, data_len); - netsechash(digest1, data, data_len); - dump_data_pw("datadec:\n", data, data_len); + if (memcmp(verf->seq_num, seq_num, sizeof(seq_num))) { + /* don't even bother with the below if the sequence number is out */ + /* The sequence number is MD5'ed with a key based on the whole-packet + digest, as supplied by the client. We check that it's a valid + checksum after the decode, below + */ + return False; + } - MD5Update(&ctx3, data, data_len); - { - uchar digest_tmp[16]; - MD5Final(digest_tmp, &ctx3); - hmac_md5(a->sess_key, digest_tmp, 16, digest1); - dump_data_pw("digest_tmp:\n", digest_tmp, sizeof(digest_tmp)); + if (auth_flags & AUTH_PIPE_SEAL) { + uchar sealing_key[16]; + + /* get the key to extract the data with */ + netsec_get_sealing_key(a, verf, sealing_key); + + /* extract the verification data */ + dump_data_pw("verf->data8:\n", verf->data8, + sizeof(verf->data8)); + netsechash(sealing_key, verf->data8, 8); + + dump_data_pw("verf->data8_dec:\n", verf->data8, + sizeof(verf->data8)); + + /* extract the packet payload */ + dump_data_pw("data :\n", data, data_len); + netsechash(sealing_key, data, data_len); + dump_data_pw("datadec:\n", data, data_len); } - dump_data_pw("digest:\n", digest1, sizeof(digest1)); - dump_data_pw("verf->data1:\n", verf->data1, sizeof(verf->data1)); + /* digest includes 'data' after unsealing */ + netsec_digest(a, auth_flags, verf, data, data_len, digest_final); - return memcmp(digest1, verf->data1, sizeof(verf->data1)) == 0; + dump_data_pw("Calculated digest:\n", digest_final, + sizeof(digest_final)); + dump_data_pw("verf->packet_digest:\n", verf->packet_digest, + sizeof(verf->packet_digest)); + + /* compare - if the client got the same result as us, then + it must know the session key */ + return (memcmp(digest_final, verf->packet_digest, + sizeof(verf->packet_digest)) == 0); } diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index be3a04e31c..34ba62caa9 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -602,15 +602,6 @@ BOOL smb_io_rpc_hdr_autha(const char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, return True; } -/******************************************************************* - Checks an RPC_HDR_AUTH structure. -********************************************************************/ - -BOOL rpc_hdr_auth_chk(RPC_HDR_AUTH *rai) -{ - return (rai->auth_type == NTLMSSP_AUTH_TYPE && rai->auth_level == NTLMSSP_AUTH_LEVEL); -} - /******************************************************************* Inits an RPC_HDR_AUTH structure. ********************************************************************/ @@ -1088,9 +1079,10 @@ BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 seq_nu chk->seq_num != seq_num) { DEBUG(5,("verify failed - crc %x ver %x seq %d\n", - crc32, NTLMSSP_SIGN_VERSION, seq_num)); + chk->crc32, chk->ver, chk->seq_num)); + DEBUG(5,("verify expect - crc %x ver %x seq %d\n", - chk->crc32, chk->ver, chk->seq_num)); + crc32, NTLMSSP_SIGN_VERSION, seq_num)); return False; } return True; @@ -1182,15 +1174,15 @@ creates an RPC_AUTH_NETSEC_CHK structure. ********************************************************************/ BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, const uchar sig[8], - const uchar data1[8], - const uchar data3[8], const uchar data8[8]) + const uchar packet_digest[8], + const uchar seq_num[8], const uchar data8[8]) { if (chk == NULL) return False; memcpy(chk->sig, sig, sizeof(chk->sig)); - memcpy(chk->data1, data1, sizeof(chk->data1)); - memcpy(chk->data3, data3, sizeof(chk->data3)); + memcpy(chk->packet_digest, packet_digest, sizeof(chk->packet_digest)); + memcpy(chk->seq_num, seq_num, sizeof(chk->seq_num)); memcpy(chk->data8, data8, sizeof(chk->data8)); return True; @@ -1209,8 +1201,8 @@ BOOL smb_io_rpc_auth_netsec_chk(const char *desc, RPC_AUTH_NETSEC_CHK * chk, depth++; prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)); - prs_uint8s(False, "data3", ps, depth, chk->data3, sizeof(chk->data3)); - prs_uint8s(False, "data1", ps, depth, chk->data1, sizeof(chk->data1)); + prs_uint8s(False, "seq_num", ps, depth, chk->seq_num, sizeof(chk->seq_num)); + prs_uint8s(False, "packet_digest", ps, depth, chk->packet_digest, sizeof(chk->packet_digest)); prs_uint8s(False, "data8", ps, depth, chk->data8, sizeof(chk->data8)); return True; -- cgit From 4a090ba06a54f5da179ac02bb307cc03d08831bf Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 16 Jul 2003 05:34:56 +0000 Subject: trying to get HEAD building again. If you want the code prior to this merge, checkout HEAD_PRE_3_0_0_BETA_3_MERGE (This used to be commit adb98e7b7cd0f025b52c570e4034eebf4047b1ad) --- source3/rpc_parse/parse_misc.c | 142 +++++-------------- source3/rpc_parse/parse_net.c | 35 ++--- source3/rpc_parse/parse_prs.c | 278 ++++++++++++++++++++++++-------------- source3/rpc_parse/parse_rpc.c | 26 ++-- source3/rpc_parse/parse_samr.c | 64 ++++----- source3/rpc_parse/parse_sec.c | 179 +++++++++++++++++------- source3/rpc_parse/parse_spoolss.c | 9 +- source3/rpc_parse/parse_srv.c | 3 +- 8 files changed, 410 insertions(+), 326 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index a39e3391bb..17a96fff80 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1122,78 +1122,6 @@ BOOL smb_io_unistr2_array(const char *desc, UNISTR2_ARRAY *array, prs_struct *ps } -/* - initialise a SID_ARRAY from a list of sids -*/ -BOOL init_sid_array(SID_ARRAY *array, - uint32 count, DOM_SID *sids) -{ - unsigned int i; - - array->count = count; - array->ref_id = count?1:0; - if (array->count == 0) { - return True; - } - - array->sids = (SID_ARRAY_EL *)talloc_zero(get_talloc_ctx(), count * sizeof(SID_ARRAY_EL)); - if (!array->sids) { - return False; - } - - for (i=0;isids[i].ref_id = 1; - init_dom_sid2(&array->sids[i].sid, &sids[i]); - } - - return True; -} - - -/******************************************************************* - Reads or writes a SID_ARRAY structure. -********************************************************************/ -BOOL smb_io_sid_array(const char *desc, SID_ARRAY *array, prs_struct *ps, int depth) -{ - unsigned int i; - - prs_debug(ps, depth, desc, "smb_io_sid_array"); - depth++; - - if(!prs_uint32("ref_id", ps, depth, &array->ref_id)) - return False; - - if (! array->ref_id) { - return True; - } - - if(!prs_uint32("count", ps, depth, &array->count)) - return False; - - if (array->count == 0) { - return True; - } - - if (UNMARSHALLING(ps)) { - array->sids = talloc_zero(get_talloc_ctx(), array->count * sizeof(array->sids[0])); - } - if (! array->sids) { - return False; - } - - for (i=0;icount;i++) { - if(!prs_uint32("ref_id", ps, depth, &array->sids[i].ref_id)) - return False; - } - - for (i=0;icount;i++) { - if (!smb_io_dom_sid2("sid", &array->sids[i].sid, ps, depth)) - return False; - } - - return True; -} - /******************************************************************* Inits a DOM_RID2 structure. ********************************************************************/ @@ -1289,22 +1217,22 @@ void init_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid) Inits a DOM_CLNT_SRV structure. ********************************************************************/ -static void init_clnt_srv(DOM_CLNT_SRV *dlog, const char *logon_srv, const char *comp_name) +static void init_clnt_srv(DOM_CLNT_SRV *logcln, const char *logon_srv, const char *comp_name) { DEBUG(5,("init_clnt_srv: %d\n", __LINE__)); if (logon_srv != NULL) { - dlog->undoc_buffer = 1; - init_unistr2(&dlog->uni_logon_srv, logon_srv, strlen(logon_srv)+1); + logcln->undoc_buffer = 1; + init_unistr2(&logcln->uni_logon_srv, logon_srv, strlen(logon_srv)+1); } else { - dlog->undoc_buffer = 0; + logcln->undoc_buffer = 0; } if (comp_name != NULL) { - dlog->undoc_buffer2 = 1; - init_unistr2(&dlog->uni_comp_name, comp_name, strlen(comp_name)+1); + logcln->undoc_buffer2 = 1; + init_unistr2(&logcln->uni_comp_name, comp_name, strlen(comp_name)+1); } else { - dlog->undoc_buffer2 = 0; + logcln->undoc_buffer2 = 0; } } @@ -1312,9 +1240,9 @@ static void init_clnt_srv(DOM_CLNT_SRV *dlog, const char *logon_srv, const char Inits or writes a DOM_CLNT_SRV structure. ********************************************************************/ -static BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *dlog, prs_struct *ps, int depth) +static BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *logcln, prs_struct *ps, int depth) { - if (dlog == NULL) + if (logcln == NULL) return False; prs_debug(ps, depth, desc, "smb_io_clnt_srv"); @@ -1323,22 +1251,22 @@ static BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *dlog, prs_struct *ps if(!prs_align(ps)) return False; - if(!prs_uint32("undoc_buffer ", ps, depth, &dlog->undoc_buffer)) + if(!prs_uint32("undoc_buffer ", ps, depth, &logcln->undoc_buffer)) return False; - if (dlog->undoc_buffer != 0) { - if(!smb_io_unistr2("unistr2", &dlog->uni_logon_srv, dlog->undoc_buffer, ps, depth)) + if (logcln->undoc_buffer != 0) { + if(!smb_io_unistr2("unistr2", &logcln->uni_logon_srv, logcln->undoc_buffer, ps, depth)) return False; } if(!prs_align(ps)) return False; - if(!prs_uint32("undoc_buffer2", ps, depth, &dlog->undoc_buffer2)) + if(!prs_uint32("undoc_buffer2", ps, depth, &logcln->undoc_buffer2)) return False; - if (dlog->undoc_buffer2 != 0) { - if(!smb_io_unistr2("unistr2", &dlog->uni_comp_name, dlog->undoc_buffer2, ps, depth)) + if (logcln->undoc_buffer2 != 0) { + if(!smb_io_unistr2("unistr2", &logcln->uni_comp_name, logcln->undoc_buffer2, ps, depth)) return False; } @@ -1349,28 +1277,28 @@ static BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *dlog, prs_struct *ps Inits a DOM_LOG_INFO structure. ********************************************************************/ -void init_log_info(DOM_LOG_INFO *dlog, const char *logon_srv, const char *acct_name, +void init_log_info(DOM_LOG_INFO *loginfo, const char *logon_srv, const char *acct_name, uint16 sec_chan, const char *comp_name) { DEBUG(5,("make_log_info %d\n", __LINE__)); - dlog->undoc_buffer = 1; + loginfo->undoc_buffer = 1; - init_unistr2(&dlog->uni_logon_srv, logon_srv, strlen(logon_srv)+1); - init_unistr2(&dlog->uni_acct_name, acct_name, strlen(acct_name)+1); + init_unistr2(&loginfo->uni_logon_srv, logon_srv, strlen(logon_srv)+1); + init_unistr2(&loginfo->uni_acct_name, acct_name, strlen(acct_name)+1); - dlog->sec_chan = sec_chan; + loginfo->sec_chan = sec_chan; - init_unistr2(&dlog->uni_comp_name, comp_name, strlen(comp_name)+1); + init_unistr2(&loginfo->uni_comp_name, comp_name, strlen(comp_name)+1); } /******************************************************************* Reads or writes a DOM_LOG_INFO structure. ********************************************************************/ -BOOL smb_io_log_info(const char *desc, DOM_LOG_INFO *dlog, prs_struct *ps, int depth) +BOOL smb_io_log_info(const char *desc, DOM_LOG_INFO *loginfo, prs_struct *ps, int depth) { - if (dlog == NULL) + if (loginfo == NULL) return False; prs_debug(ps, depth, desc, "smb_io_log_info"); @@ -1379,18 +1307,18 @@ BOOL smb_io_log_info(const char *desc, DOM_LOG_INFO *dlog, prs_struct *ps, int d if(!prs_align(ps)) return False; - if(!prs_uint32("undoc_buffer", ps, depth, &dlog->undoc_buffer)) + if(!prs_uint32("undoc_buffer", ps, depth, &loginfo->undoc_buffer)) return False; - if(!smb_io_unistr2("unistr2", &dlog->uni_logon_srv, True, ps, depth)) + if(!smb_io_unistr2("unistr2", &loginfo->uni_logon_srv, True, ps, depth)) return False; - if(!smb_io_unistr2("unistr2", &dlog->uni_acct_name, True, ps, depth)) + if(!smb_io_unistr2("unistr2", &loginfo->uni_acct_name, True, ps, depth)) return False; - if(!prs_uint16("sec_chan", ps, depth, &dlog->sec_chan)) + if(!prs_uint16("sec_chan", ps, depth, &loginfo->sec_chan)) return False; - if(!smb_io_unistr2("unistr2", &dlog->uni_comp_name, True, ps, depth)) + if(!smb_io_unistr2("unistr2", &loginfo->uni_comp_name, True, ps, depth)) return False; return True; @@ -1529,21 +1457,21 @@ BOOL smb_io_clnt_info(const char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, in Inits a DOM_LOGON_ID structure. ********************************************************************/ -void init_logon_id(DOM_LOGON_ID *dlog, uint32 log_id_low, uint32 log_id_high) +void init_logon_id(DOM_LOGON_ID *logonid, uint32 log_id_low, uint32 log_id_high) { DEBUG(5,("make_logon_id: %d\n", __LINE__)); - dlog->low = log_id_low; - dlog->high = log_id_high; + logonid->low = log_id_low; + logonid->high = log_id_high; } /******************************************************************* Reads or writes a DOM_LOGON_ID structure. ********************************************************************/ -BOOL smb_io_logon_id(const char *desc, DOM_LOGON_ID *dlog, prs_struct *ps, int depth) +BOOL smb_io_logon_id(const char *desc, DOM_LOGON_ID *logonid, prs_struct *ps, int depth) { - if (dlog == NULL) + if (logonid == NULL) return False; prs_debug(ps, depth, desc, "smb_io_logon_id"); @@ -1552,9 +1480,9 @@ BOOL smb_io_logon_id(const char *desc, DOM_LOGON_ID *dlog, prs_struct *ps, int d if(!prs_align(ps)) return False; - if(!prs_uint32("low ", ps, depth, &dlog->low )) + if(!prs_uint32("low ", ps, depth, &logonid->low )) return False; - if(!prs_uint32("high", ps, depth, &dlog->high)) + if(!prs_uint32("high", ps, depth, &logonid->high)) return False; return True; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 1a14915c9f..804da707de 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -446,7 +446,7 @@ void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, for (i = 0; i < num_doms; i++) { fstring domain_name; fstrcpy(domain_name, dom_name); - strupper(domain_name); + strupper_m(domain_name); init_unistr2(&r_t->uni_trust_dom_name[i], domain_name, strlen(domain_name)+1); /* the use of UNISTR2 here is non-standard. */ r_t->uni_trust_dom_name[i].undoc = 0x1; @@ -1294,7 +1294,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, int len_logon_srv = strlen(logon_srv); int len_logon_dom = strlen(logon_dom); - len_user_name = strlen(user_name ); + len_user_name = strlen(user_name ); len_full_name = strlen(full_name ); len_home_dir = strlen(home_dir ); len_dir_drive = strlen(dir_drive ); @@ -1306,6 +1306,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *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); @@ -1808,9 +1809,9 @@ static BOOL net_io_sam_domain_info(const char *desc, SAM_DOMAIN_INFO * info, if (!smb_io_unihdr("hdr_unknown", &info->hdr_unknown, ps, depth)) return False; - if (prs_offset(ps) + 40 > prs_data_size(ps)) + if (ps->data_offset + 40 > ps->buffer_size) return False; - prs_set_offset(ps, prs_offset(ps) + 40); + ps->data_offset += 40; if (!smb_io_unistr2("uni_dom_name", &info->uni_dom_name, info->hdr_dom_name.buffer, ps, depth)) @@ -1847,9 +1848,9 @@ static BOOL net_io_sam_group_info(const char *desc, SAM_GROUP_INFO * info, if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth)) return False; - if (prs_offset(ps) + 48 > prs_data_size(ps)) + if (ps->data_offset + 48 > ps->buffer_size) return False; - prs_set_offset(ps, prs_offset(ps) + 48); + ps->data_offset += 48; if (!smb_io_unistr2("uni_grp_name", &info->uni_grp_name, info->hdr_grp_name.buffer, ps, depth)) @@ -2128,13 +2129,13 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], uint32 len = 0x44; if (!prs_uint32("pwd_len", ps, depth, &len)) return False; - old_offset = prs_offset(ps); + old_offset = ps->data_offset; if (len > 0) { if (ps->io) { /* reading */ - if (!prs_hash1(ps, prs_offset(ps), sess_key)) + if (!prs_hash1(ps, ps->data_offset, sess_key, len)) return False; } if (!net_io_sam_passwd_info("pass", &info->pass, @@ -2144,13 +2145,13 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], if (!ps->io) { /* writing */ - if (!prs_hash1(ps, old_offset, sess_key)) + if (!prs_hash1(ps, old_offset, sess_key, len)) return False; } } - if (old_offset + len > prs_data_size(ps)) + if (old_offset + len > ps->buffer_size) return False; - prs_set_offset(ps, old_offset + len); + ps->data_offset = old_offset + len; } if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, info->hdr_sec_desc.buffer, ps, depth)) @@ -2185,9 +2186,9 @@ static BOOL net_io_sam_group_mem_info(const char *desc, SAM_GROUP_MEM_INFO * inf if (!prs_uint32("num_members", ps, depth, &info->num_members)) return False; - if (prs_offset(ps) + 16 > prs_data_size(ps)) + if (ps->data_offset + 16 > ps->buffer_size) return False; - prs_set_offset(ps, prs_offset(ps) + 16); + ps->data_offset += 16; if (info->ptr_rids != 0) { @@ -2267,9 +2268,9 @@ static BOOL net_io_sam_alias_info(const char *desc, SAM_ALIAS_INFO * info, if (!smb_io_unihdr("hdr_als_desc", &info->hdr_als_desc, ps, depth)) return False; - if (prs_offset(ps) + 40 > prs_data_size(ps)) + if (ps->data_offset + 40 > ps->buffer_size) return False; - prs_set_offset(ps, prs_offset(ps) + 40); + ps->data_offset += 40; if (!smb_io_unistr2("uni_als_name", &info->uni_als_name, info->hdr_als_name.buffer, ps, depth)) @@ -2307,9 +2308,9 @@ static BOOL net_io_sam_alias_mem_info(const char *desc, SAM_ALIAS_MEM_INFO * inf if (info->ptr_members != 0) { - if (prs_offset(ps) + 16 > prs_data_size(ps)) + if (ps->data_offset + 16 > ps->buffer_size) return False; - prs_set_offset(ps, prs_offset(ps) + 16); + ps->data_offset += 16; if (!prs_uint32("num_sids", ps, depth, &info->num_sids)) return False; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index e0a75d7382..efd4914c66 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1316,7 +1316,7 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *me /******************************************************************* hash a stream. ********************************************************************/ -BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) +BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16], int len) { char *q; @@ -1326,12 +1326,12 @@ BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16]) #ifdef DEBUG_PASSWORD DEBUG(100, ("prs_hash1\n")); dump_data(100, sess_key, 16); - dump_data(100, q, 68); + dump_data(100, q, len); #endif - SamOEMhash((uchar *) q, sess_key, 68); + SamOEMhash((uchar *) q, sess_key, len); #ifdef DEBUG_PASSWORD - dump_data(100, q, 68); + dump_data(100, q, len); #endif return True; @@ -1378,141 +1378,221 @@ static void netsechash(uchar * key, uchar * data, int data_len) } } -void dump_data_pw(const char *msg, const uchar * data, size_t len) + +/******************************************************************* + Create a digest over the entire packet (including the data), and + MD5 it with the session key. + ********************************************************************/ +static void netsec_digest(struct netsec_auth_struct *a, + int auth_flags, + RPC_AUTH_NETSEC_CHK * verf, + char *data, size_t data_len, + uchar digest_final[16]) { -#ifdef DEBUG_PASSWORD - DEBUG(11, ("%s", msg)); - if (data != NULL && len > 0) - { - dump_data(11, data, len); + uchar whole_packet_digest[16]; + static uchar zeros[4]; + struct MD5Context ctx3; + + /* verfiy the signature on the packet by MD5 over various bits */ + MD5Init(&ctx3); + /* use our sequence number, which ensures the packet is not + out of order */ + MD5Update(&ctx3, zeros, sizeof(zeros)); + MD5Update(&ctx3, verf->sig, sizeof(verf->sig)); + if (auth_flags & AUTH_PIPE_SEAL) { + MD5Update(&ctx3, verf->data8, sizeof(verf->data8)); } -#endif + MD5Update(&ctx3, data, data_len); + MD5Final(whole_packet_digest, &ctx3); + dump_data_pw("whole_packet_digest:\n", whole_packet_digest, sizeof(whole_packet_digest)); + + /* MD5 this result and the session key, to prove that + only a valid client could had produced this */ + hmac_md5(a->sess_key, whole_packet_digest, sizeof(whole_packet_digest), digest_final); } -void netsec_encode(struct netsec_auth_struct *a, - RPC_AUTH_NETSEC_CHK * verf, char *data, size_t data_len) +/******************************************************************* + Calculate the key with which to encode the data payload + ********************************************************************/ +static void netsec_get_sealing_key(struct netsec_auth_struct *a, + RPC_AUTH_NETSEC_CHK *verf, + uchar sealing_key[16]) { - uchar dataN[4]; - uchar digest1[16]; - struct MD5Context ctx3; + static uchar zeros[4]; + uchar digest2[16]; uchar sess_kf0[16]; int i; - SIVAL(dataN, 0, 0); - for (i = 0; i < sizeof(sess_kf0); i++) { sess_kf0[i] = a->sess_key[i] ^ 0xf0; } + + dump_data_pw("sess_kf0:\n", sess_kf0, sizeof(sess_kf0)); + + /* MD5 of sess_kf0 and the high bytes of the sequence number */ + hmac_md5(sess_kf0, zeros, 0x4, digest2); + dump_data_pw("digest2:\n", digest2, sizeof(digest2)); + + /* MD5 of the above result, plus 8 bytes of sequence number */ + hmac_md5(digest2, verf->seq_num, sizeof(verf->seq_num), sealing_key); + dump_data_pw("sealing_key:\n", sealing_key, 16); +} - DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%d\n", a->seq_num, data_len)); - dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); - dump_data_pw("a->seq_num :\n", dataN, sizeof(dataN)); +/******************************************************************* + Encode or Decode the sequence number (which is symmetric) + ********************************************************************/ +static void netsec_deal_with_seq_num(struct netsec_auth_struct *a, + RPC_AUTH_NETSEC_CHK *verf) +{ + static uchar zeros[4]; + uchar sequence_key[16]; + uchar digest1[16]; - MD5Init(&ctx3); - MD5Update(&ctx3, dataN, 0x4); - MD5Update(&ctx3, verf->sig, 8); + hmac_md5(a->sess_key, zeros, sizeof(zeros), digest1); + dump_data_pw("(sequence key) digest1:\n", digest1, sizeof(digest1)); - MD5Update(&ctx3, verf->data8, 8); + hmac_md5(digest1, verf->packet_digest, 8, sequence_key); - dump_data_pw("verf->data8:\n", verf->data8, sizeof(verf->data8)); - dump_data_pw("sess_kf0:\n", sess_kf0, sizeof(sess_kf0)); + dump_data_pw("sequence_key:\n", sequence_key, sizeof(sequence_key)); - hmac_md5(sess_kf0, dataN, 0x4, digest1); - dump_data_pw("digest1 (ebp-8):\n", digest1, sizeof(digest1)); - hmac_md5(digest1, verf->data3, 8, digest1); - dump_data_pw("netsechashkey:\n", digest1, sizeof(digest1)); - netsechash(digest1, verf->data8, 8); + dump_data_pw("seq_num (before):\n", verf->seq_num, sizeof(verf->seq_num)); + netsechash(sequence_key, verf->seq_num, 8); + dump_data_pw("seq_num (after):\n", verf->seq_num, sizeof(verf->seq_num)); +} - dump_data_pw("verf->data8:\n", verf->data8, sizeof(verf->data8)); - dump_data_pw("data :\n", data, data_len); - MD5Update(&ctx3, data, data_len); +/******************************************************************* + Encode a blob of data using the netsec (schannel) alogrithm, also produceing + a checksum over the original data. We currently only support + signing and sealing togeather - the signing-only code is close, but not + quite compatible with what MS does. + ********************************************************************/ +void netsec_encode(struct netsec_auth_struct *a, int auth_flags, + enum netsec_direction direction, + RPC_AUTH_NETSEC_CHK * verf, char *data, size_t data_len) +{ + uchar digest_final[16]; - { - char digest_tmp[16]; - char digest2[16]; - MD5Final(digest_tmp, &ctx3); - hmac_md5(a->sess_key, digest_tmp, 16, digest2); - dump_data_pw("digest_tmp:\n", digest_tmp, sizeof(digest_tmp)); - dump_data_pw("digest:\n", digest2, sizeof(digest2)); - memcpy(verf->data1, digest2, sizeof(verf->data1)); + DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%d\n", a->seq_num, data_len)); + dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); + + RSIVAL(verf->seq_num, 0, a->seq_num); + + switch (direction) { + case SENDER_IS_INITIATOR: + SIVAL(verf->seq_num, 4, 0x80); + break; + case SENDER_IS_ACCEPTOR: + SIVAL(verf->seq_num, 4, 0x0); + break; } - netsechash(digest1, data, data_len); - dump_data_pw("data:\n", data, data_len); + dump_data_pw("verf->seq_num:\n", verf->seq_num, sizeof(verf->seq_num)); - hmac_md5(a->sess_key, dataN, 0x4, digest1); - dump_data_pw("ctx:\n", digest1, sizeof(digest1)); + /* produce a digest of the packet to prove it's legit (before we seal it) */ + netsec_digest(a, auth_flags, verf, data, data_len, digest_final); + memcpy(verf->packet_digest, digest_final, sizeof(verf->packet_digest)); - hmac_md5(digest1, verf->data1, 8, digest1); + if (auth_flags & AUTH_PIPE_SEAL) { + uchar sealing_key[16]; - dump_data_pw("netsechashkey:\n", digest1, sizeof(digest1)); + /* get the key to encode the data with */ + netsec_get_sealing_key(a, verf, sealing_key); - dump_data_pw("verf->data3:\n", verf->data3, sizeof(verf->data3)); - netsechash(digest1, verf->data3, 8); - dump_data_pw("verf->data3:\n", verf->data3, sizeof(verf->data3)); + /* encode the verification data */ + dump_data_pw("verf->data8:\n", verf->data8, sizeof(verf->data8)); + netsechash(sealing_key, verf->data8, 8); + + dump_data_pw("verf->data8_enc:\n", verf->data8, sizeof(verf->data8)); + + /* encode the packet payload */ + dump_data_pw("data:\n", data, data_len); + netsechash(sealing_key, data, data_len); + dump_data_pw("data_enc:\n", data, data_len); + } + + /* encode the sequence number (key based on packet digest) */ + /* needs to be done after the sealing, as the original version + is used in the sealing stuff... */ + netsec_deal_with_seq_num(a, verf); return; } -BOOL netsec_decode(struct netsec_auth_struct *a, +/******************************************************************* + Decode a blob of data using the netsec (schannel) alogrithm, also verifiying + a checksum over the original data. We currently can verify signed messages, + as well as decode sealed messages + ********************************************************************/ + +BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, + enum netsec_direction direction, RPC_AUTH_NETSEC_CHK * verf, char *data, size_t data_len) { - uchar dataN[4]; - uchar digest1[16]; - struct MD5Context ctx3; - uchar sess_kf0[16]; - int i; - - SIVAL(dataN, 0, 0); - - for (i = 0; i < sizeof(sess_kf0); i++) { - sess_kf0[i] = a->sess_key[i] ^ 0xf0; + uchar digest_final[16]; + + /* Create the expected sequence number for comparison */ + uchar seq_num[8]; + RSIVAL(seq_num, 0, a->seq_num); + + switch (direction) { + case SENDER_IS_INITIATOR: + SIVAL(seq_num, 4, 0x80); + break; + case SENDER_IS_ACCEPTOR: + SIVAL(seq_num, 4, 0x0); + break; } DEBUG(10,("SCHANNEL: netsec_decode seq_num=%d data_len=%d\n", a->seq_num, data_len)); dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); - dump_data_pw("a->seq_num :\n", dataN, sizeof(dataN)); - hmac_md5(a->sess_key, dataN, 0x4, digest1); - dump_data_pw("ctx:\n", digest1, sizeof(digest1)); - - hmac_md5(digest1, verf->data1, 8, digest1); - - dump_data_pw("netsechashkey:\n", digest1, sizeof(digest1)); - dump_data_pw("verf->data3:\n", verf->data3, sizeof(verf->data3)); - netsechash(digest1, verf->data3, 8); - dump_data_pw("verf->data3_dec:\n", verf->data3, sizeof(verf->data3)); - - MD5Init(&ctx3); - MD5Update(&ctx3, dataN, 0x4); - MD5Update(&ctx3, verf->sig, 8); - - dump_data_pw("sess_kf0:\n", sess_kf0, sizeof(sess_kf0)); - hmac_md5(sess_kf0, dataN, 0x4, digest1); - dump_data_pw("digest1 (ebp-8):\n", digest1, sizeof(digest1)); - hmac_md5(digest1, verf->data3, 8, digest1); - dump_data_pw("netsechashkey:\n", digest1, sizeof(digest1)); + dump_data_pw("seq_num:\n", seq_num, sizeof(seq_num)); - dump_data_pw("verf->data8:\n", verf->data8, sizeof(verf->data8)); - netsechash(digest1, verf->data8, 8); - dump_data_pw("verf->data8_dec:\n", verf->data8, sizeof(verf->data8)); - MD5Update(&ctx3, verf->data8, 8); + /* extract the sequence number (key based on supplied packet digest) */ + /* needs to be done before the sealing, as the original version + is used in the sealing stuff... */ + netsec_deal_with_seq_num(a, verf); - dump_data_pw("data :\n", data, data_len); - netsechash(digest1, data, data_len); - dump_data_pw("datadec:\n", data, data_len); + if (memcmp(verf->seq_num, seq_num, sizeof(seq_num))) { + /* don't even bother with the below if the sequence number is out */ + /* The sequence number is MD5'ed with a key based on the whole-packet + digest, as supplied by the client. We check that it's a valid + checksum after the decode, below + */ + return False; + } - MD5Update(&ctx3, data, data_len); - { - uchar digest_tmp[16]; - MD5Final(digest_tmp, &ctx3); - hmac_md5(a->sess_key, digest_tmp, 16, digest1); - dump_data_pw("digest_tmp:\n", digest_tmp, sizeof(digest_tmp)); + if (auth_flags & AUTH_PIPE_SEAL) { + uchar sealing_key[16]; + + /* get the key to extract the data with */ + netsec_get_sealing_key(a, verf, sealing_key); + + /* extract the verification data */ + dump_data_pw("verf->data8:\n", verf->data8, + sizeof(verf->data8)); + netsechash(sealing_key, verf->data8, 8); + + dump_data_pw("verf->data8_dec:\n", verf->data8, + sizeof(verf->data8)); + + /* extract the packet payload */ + dump_data_pw("data :\n", data, data_len); + netsechash(sealing_key, data, data_len); + dump_data_pw("datadec:\n", data, data_len); } - dump_data_pw("digest:\n", digest1, sizeof(digest1)); - dump_data_pw("verf->data1:\n", verf->data1, sizeof(verf->data1)); + /* digest includes 'data' after unsealing */ + netsec_digest(a, auth_flags, verf, data, data_len, digest_final); - return memcmp(digest1, verf->data1, sizeof(verf->data1)) == 0; + dump_data_pw("Calculated digest:\n", digest_final, + sizeof(digest_final)); + dump_data_pw("verf->packet_digest:\n", verf->packet_digest, + sizeof(verf->packet_digest)); + + /* compare - if the client got the same result as us, then + it must know the session key */ + return (memcmp(digest_final, verf->packet_digest, + sizeof(verf->packet_digest)) == 0); } diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index be3a04e31c..34ba62caa9 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -602,15 +602,6 @@ BOOL smb_io_rpc_hdr_autha(const char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, return True; } -/******************************************************************* - Checks an RPC_HDR_AUTH structure. -********************************************************************/ - -BOOL rpc_hdr_auth_chk(RPC_HDR_AUTH *rai) -{ - return (rai->auth_type == NTLMSSP_AUTH_TYPE && rai->auth_level == NTLMSSP_AUTH_LEVEL); -} - /******************************************************************* Inits an RPC_HDR_AUTH structure. ********************************************************************/ @@ -1088,9 +1079,10 @@ BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 seq_nu chk->seq_num != seq_num) { DEBUG(5,("verify failed - crc %x ver %x seq %d\n", - crc32, NTLMSSP_SIGN_VERSION, seq_num)); + chk->crc32, chk->ver, chk->seq_num)); + DEBUG(5,("verify expect - crc %x ver %x seq %d\n", - chk->crc32, chk->ver, chk->seq_num)); + crc32, NTLMSSP_SIGN_VERSION, seq_num)); return False; } return True; @@ -1182,15 +1174,15 @@ creates an RPC_AUTH_NETSEC_CHK structure. ********************************************************************/ BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, const uchar sig[8], - const uchar data1[8], - const uchar data3[8], const uchar data8[8]) + const uchar packet_digest[8], + const uchar seq_num[8], const uchar data8[8]) { if (chk == NULL) return False; memcpy(chk->sig, sig, sizeof(chk->sig)); - memcpy(chk->data1, data1, sizeof(chk->data1)); - memcpy(chk->data3, data3, sizeof(chk->data3)); + memcpy(chk->packet_digest, packet_digest, sizeof(chk->packet_digest)); + memcpy(chk->seq_num, seq_num, sizeof(chk->seq_num)); memcpy(chk->data8, data8, sizeof(chk->data8)); return True; @@ -1209,8 +1201,8 @@ BOOL smb_io_rpc_auth_netsec_chk(const char *desc, RPC_AUTH_NETSEC_CHK * chk, depth++; prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)); - prs_uint8s(False, "data3", ps, depth, chk->data3, sizeof(chk->data3)); - prs_uint8s(False, "data1", ps, depth, chk->data1, sizeof(chk->data1)); + prs_uint8s(False, "seq_num", ps, depth, chk->seq_num, sizeof(chk->seq_num)); + prs_uint8s(False, "packet_digest", ps, depth, chk->packet_digest, sizeof(chk->packet_digest)); prs_uint8s(False, "data8", ps, depth, chk->data8, sizeof(chk->data8)); return True; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ac1e9da61b..45c81deb89 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1500,7 +1500,7 @@ inits a SAM_DISPINFO_1 structure. ********************************************************************/ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_entries, - uint32 start_idx, DISP_USER_INFO *disp_user_info, + uint32 start_idx, SAM_ACCOUNT *disp_user_info, DOM_SID *domain_sid) { uint32 len_sam_name, len_sam_full, len_sam_desc; @@ -1535,7 +1535,7 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_en DEBUG(11, ("init_sam_dispinfo_1: entry: %d\n",i)); - pwd=disp_user_info[i+start_idx].sam; + pwd=&disp_user_info[i+start_idx]; username = pdb_get_username(pwd); fullname = pdb_get_fullname(pwd); @@ -1635,7 +1635,7 @@ inits a SAM_DISPINFO_2 structure. ********************************************************************/ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_entries, - uint32 start_idx, DISP_USER_INFO *disp_user_info, + uint32 start_idx, SAM_ACCOUNT *disp_user_info, DOM_SID *domain_sid ) { uint32 len_sam_name, len_sam_desc; @@ -1666,7 +1666,7 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_en fstring user_sid_string, domain_sid_string; DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i)); - pwd=disp_user_info[i+start_idx].sam; + pwd=&disp_user_info[i+start_idx]; username = pdb_get_username(pwd); acct_desc = pdb_get_acct_desc(pwd); @@ -1754,7 +1754,7 @@ inits a SAM_DISPINFO_3 structure. ********************************************************************/ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_entries, - uint32 start_idx, DISP_GROUP_INFO *disp_group_info) + uint32 start_idx, DOMAIN_GRP *disp_group_info) { uint32 len_sam_name, len_sam_desc; uint32 i; @@ -1776,7 +1776,7 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_en ZERO_STRUCTP(sam->str); for (i = 0; i < num_entries; i++) { - DOMAIN_GRP *grp = disp_group_info[i+start_idx].grp; + DOMAIN_GRP *grp = &disp_group_info[i+start_idx]; DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i)); @@ -1848,7 +1848,7 @@ inits a SAM_DISPINFO_4 structure. ********************************************************************/ NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 num_entries, - uint32 start_idx, DISP_USER_INFO *disp_user_info) + uint32 start_idx, SAM_ACCOUNT *disp_user_info) { uint32 len_sam_name; uint32 i; @@ -1872,7 +1872,7 @@ NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 num_en for (i = 0; i < num_entries; i++) { DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i)); - pwd=disp_user_info[i+start_idx].sam; + pwd=&disp_user_info[i+start_idx]; len_sam_name = strlen(pdb_get_username(pwd)); @@ -1939,7 +1939,7 @@ inits a SAM_DISPINFO_5 structure. ********************************************************************/ NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 num_entries, - uint32 start_idx, DISP_GROUP_INFO *disp_group_info) + uint32 start_idx, DOMAIN_GRP *disp_group_info) { uint32 len_sam_name; uint32 i; @@ -1961,7 +1961,7 @@ NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 num_en ZERO_STRUCTP(sam->str); for (i = 0; i < num_entries; i++) { - DOMAIN_GRP *grp = disp_group_info[i+start_idx].grp; + DOMAIN_GRP *grp = &disp_group_info[i+start_idx]; DEBUG(11, ("init_sam_dispinfo_5: entry: %d\n",i)); @@ -4598,7 +4598,6 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, prs_struct *ps, int depth) { uint32 i; - uint32 ptr_sid[MAX_LOOKUP_SIDS]; if (r_u == NULL) return False; @@ -4614,28 +4613,31 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, if(!prs_uint32("ptr", ps, depth, &r_u->ptr)) return False; - if (r_u->ptr != 0) { - SMB_ASSERT_ARRAY(ptr_sid, r_u->num_sids); - - if (r_u->num_sids != 0) { - if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1)) - return False; - - 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 (r_u->ptr != 0 && r_u->num_sids != 0) { + uint32 *ptr_sid = NULL; - if (UNMARSHALLING(ps)) { - r_u->sid = talloc(ps->mem_ctx, r_u->num_sids1 * sizeof(DOM_SID2)); - } + if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1)) + return False; - 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; - } + ptr_sid = talloc(ps->mem_ctx, sizeof(uint32) * r_u->num_sids1); + if (!ptr_sid) { + return False; + } + + 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)) { + r_u->sid = talloc(ps->mem_ctx, r_u->num_sids1 * sizeof(DOM_SID2)); + } + + 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; } } } diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 081173cf8d..3848bd7051 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -3,7 +3,7 @@ * Version 1.9. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1998, - * Copyright (C) Jeremy R. Allison 1995-1998 + * Copyright (C) Jeremy R. Allison 1995-2003. * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, * Copyright (C) Paul Ashton 1997-1998. * @@ -48,7 +48,7 @@ BOOL sec_io_access(const char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "sec_io_access"); depth++; - if(!prs_uint32("mask", ps, depth, &(t->mask))) + if(!prs_uint32("mask", ps, depth, &t->mask)) return False; return True; @@ -579,8 +579,6 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, { SEC_DESC *dst; uint32 offset = 0; - uint32 offset_sid = SEC_DESC_HEADER_SIZE; - uint32 offset_acl = 0; *sd_size = 0; @@ -610,58 +608,33 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, if(dacl && ((dst->dacl = dup_sec_acl(ctx, dacl)) == NULL)) goto error_exit; - offset = 0; + offset = SEC_DESC_HEADER_SIZE; /* * Work out the linearization sizes. */ - if (dst->owner_sid != NULL) { - - if (offset == 0) - offset = SEC_DESC_HEADER_SIZE; - - offset += sid_size(dst->owner_sid); - } - - if (dst->grp_sid != NULL) { - - if (offset == 0) - offset = SEC_DESC_HEADER_SIZE; - - offset += sid_size(dst->grp_sid); - } if (dst->sacl != NULL) { - - offset_acl = SEC_DESC_HEADER_SIZE; - - dst->off_sacl = offset_acl; - offset_acl += dst->sacl->size; - offset += dst->sacl->size; - offset_sid += dst->sacl->size; + dst->off_sacl = offset; + offset += dst->sacl->size; } if (dst->dacl != NULL) { - - if (offset_acl == 0) - offset_acl = SEC_DESC_HEADER_SIZE; - - dst->off_dacl = offset_acl; - offset_acl += dst->dacl->size; - offset += dst->dacl->size; - offset_sid += dst->dacl->size; + dst->off_dacl = offset; + offset += dst->dacl->size; } - *sd_size = (size_t)((offset == 0) ? SEC_DESC_HEADER_SIZE : offset); + if (dst->owner_sid != NULL) { + dst->off_owner_sid = offset; + offset += sid_size(dst->owner_sid); + } - if (dst->owner_sid != NULL) - dst->off_owner_sid = offset_sid; - - /* sid_size() returns 0 if the sid is NULL so this is ok */ - - if (dst->grp_sid != NULL) - dst->off_grp_sid = offset_sid + sid_size(dst->owner_sid); + if (dst->grp_sid != NULL) { + dst->off_grp_sid = offset; + offset += sid_size(dst->grp_sid); + } + *sd_size = (size_t)offset; return dst; error_exit: @@ -928,7 +901,7 @@ BOOL sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int } /******************************************************************* - adds new SID with its permissions to SEC_DESC + Add a new SID with its permissions to SEC_DESC. ********************************************************************/ NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32 mask, size_t *sd_size) @@ -940,7 +913,8 @@ NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32 *sd_size = 0; - if (!ctx || !psd || !sid || !sd_size) return NT_STATUS_INVALID_PARAMETER; + if (!ctx || !psd || !sid || !sd_size) + return NT_STATUS_INVALID_PARAMETER; status = sec_ace_add_sid(ctx, &ace, psd[0]->dacl->ace, &psd[0]->dacl->num_aces, sid, mask); @@ -960,14 +934,15 @@ NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32 } /******************************************************************* - modify SID's permissions at SEC_DESC + Modify a SID's permissions in a SEC_DESC. ********************************************************************/ NTSTATUS sec_desc_mod_sid(SEC_DESC *sd, DOM_SID *sid, uint32 mask) { NTSTATUS status; - if (!sd || !sid) return NT_STATUS_INVALID_PARAMETER; + if (!sd || !sid) + return NT_STATUS_INVALID_PARAMETER; status = sec_ace_mod_sid(sd->dacl->ace, sd->dacl->num_aces, sid, mask); @@ -978,7 +953,7 @@ NTSTATUS sec_desc_mod_sid(SEC_DESC *sd, DOM_SID *sid, uint32 mask) } /******************************************************************* - delete SID from SEC_DESC + Delete a SID from a SEC_DESC. ********************************************************************/ NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t *sd_size) @@ -990,7 +965,8 @@ NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t *sd_size = 0; - if (!ctx || !psd[0] || !sid || !sd_size) return NT_STATUS_INVALID_PARAMETER; + if (!ctx || !psd[0] || !sid || !sd_size) + return NT_STATUS_INVALID_PARAMETER; status = sec_ace_del_sid(ctx, &ace, psd[0]->dacl->ace, &psd[0]->dacl->num_aces, sid); @@ -1008,3 +984,108 @@ NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t sd = 0; return NT_STATUS_OK; } + +/******************************************************************* + Comparison function to sort non-inherited first. +*******************************************************************/ + +static int nt_ace_inherit_comp( SEC_ACE *a1, SEC_ACE *a2) +{ + int a1_inh = a1->flags & SEC_ACE_FLAG_INHERITED_ACE; + int a2_inh = a2->flags & SEC_ACE_FLAG_INHERITED_ACE; + + if (a1_inh == a2_inh) + return 0; + + if (!a1_inh && a2_inh) + return -1; + return 1; +} + +/******************************************************************* + Comparison function to apply the order explained below in a group. +*******************************************************************/ + +static int nt_ace_canon_comp( SEC_ACE *a1, SEC_ACE *a2) +{ + if ((a1->type == SEC_ACE_TYPE_ACCESS_DENIED) && + (a2->type != SEC_ACE_TYPE_ACCESS_DENIED)) + return -1; + + if ((a2->type == SEC_ACE_TYPE_ACCESS_DENIED) && + (a1->type != SEC_ACE_TYPE_ACCESS_DENIED)) + return 1; + + /* Both access denied or access allowed. */ + + /* 1. ACEs that apply to the object itself */ + + if (!(a1->flags & SEC_ACE_FLAG_INHERIT_ONLY) && + (a2->flags & SEC_ACE_FLAG_INHERIT_ONLY)) + return -1; + else if (!(a2->flags & SEC_ACE_FLAG_INHERIT_ONLY) && + (a1->flags & SEC_ACE_FLAG_INHERIT_ONLY)) + return 1; + + /* 2. ACEs that apply to a subobject of the object, such as + * a property set or property. */ + + if (a1->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT) && + !(a2->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT))) + return -1; + else if (a2->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT) && + !(a1->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT))) + return 1; + + return 0; +} + +/******************************************************************* + Functions to convert a SEC_DESC ACE DACL list into canonical order. + JRA. + +--- from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/security/order_of_aces_in_a_dacl.asp + +The following describes the preferred order: + + To ensure that noninherited ACEs have precedence over inherited ACEs, + place all noninherited ACEs in a group before any inherited ACEs. + This ordering ensures, for example, that a noninherited access-denied ACE + is enforced regardless of any inherited ACE that allows access. + + Within the groups of noninherited ACEs and inherited ACEs, order ACEs according to ACE type, as the following shows: + 1. Access-denied ACEs that apply to the object itself + 2. Access-denied ACEs that apply to a subobject of the object, such as a property set or property + 3. Access-allowed ACEs that apply to the object itself + 4. Access-allowed ACEs that apply to a subobject of the object" + +********************************************************************/ + +void dacl_sort_into_canonical_order(SEC_ACE *srclist, unsigned int num_aces) +{ + unsigned int i; + + if (!srclist || num_aces == 0) + return; + + /* Sort so that non-inherited ACE's come first. */ + qsort( srclist, num_aces, sizeof(srclist[0]), QSORT_CAST nt_ace_inherit_comp); + + /* Find the boundary between non-inherited ACEs. */ + for (i = 0; i < num_aces; i++ ) { + SEC_ACE *curr_ace = &srclist[i]; + + if (curr_ace->flags & SEC_ACE_FLAG_INHERITED_ACE) + break; + } + + /* i now points at entry number of the first inherited ACE. */ + + /* Sort the non-inherited ACEs. */ + if (i) + qsort( srclist, i, sizeof(srclist[0]), QSORT_CAST nt_ace_canon_comp); + + /* Now sort the inherited ACEs. */ + if (num_aces - i) + qsort( &srclist[i], num_aces - i, sizeof(srclist[0]), QSORT_CAST nt_ace_canon_comp); +} diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index a5d2087a3a..1a380c64d5 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -645,7 +645,7 @@ static BOOL spool_io_user_level(const char *desc, SPOOL_USER_CTR *q_u, prs_struc BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) { - uint32 available_space; /* size of the device mode left to parse */ + int available_space; /* size of the device mode left to parse */ /* only important on unmarshalling */ int i = 0; @@ -7296,15 +7296,14 @@ static BOOL spoolss_io_printer_enum_values_ctr(const char *desc, prs_struct *ps, if (!prs_unistr("valuename", ps, depth, &ctr->values[i].valuename)) return False; - if (UNMARSHALLING(ps)) { + if (UNMARSHALLING(ps) && ctr->values[i].data_len) { ctr->values[i].data = (uint8 *)prs_alloc_mem( ps, ctr->values[i].data_len); if (!ctr->values[i].data) return False; + if (!prs_uint8s(False, "data", ps, depth, ctr->values[i].data, ctr->values[i].data_len)) + return False; } - - if (!prs_uint8s(False, "data", ps, depth, ctr->values[i].data, ctr->values[i].data_len)) - return False; if ( !prs_align_uint16(ps) ) return False; diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 27763aa224..bbb5193ddc 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -623,7 +623,8 @@ static BOOL srv_io_share_info1005(const char* desc, SRV_SHARE_INFO_1005* sh1005, if(!prs_align(ps)) return False; - if(!prs_uint32("dfs_root_flag", ps, depth, &sh1005->dfs_root_flag)) + if(!prs_uint32("share_info_flags", ps, depth, + &sh1005->share_info_flags)) return False; return True; -- cgit From c39c02e1aeeb74e8c45b32d99d9354eb66040171 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 17 Jul 2003 02:49:26 +0000 Subject: fix the build. Ifdef out some code (This used to be commit e66541d0e1befec5d589890994454dd639ea0665) --- source3/rpc_parse/parse_lsa.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 7ff2aa7d01..d8c3b4e3c3 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2382,10 +2382,11 @@ void init_r_add_acct_rights(LSA_R_ADD_ACCT_RIGHTS *q_r) } +#if 0 /******************************************************************* Inits an LSA_Q_REMOVE_ACCT_RIGHTS structure. ********************************************************************/ -void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *q_q, + void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *q_q, POLICY_HND *hnd, DOM_SID *sid, uint32 removeall, @@ -2404,7 +2405,7 @@ void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *q_q, /******************************************************************* 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 *q_q, prs_struct *ps, int depth) + BOOL lsa_io_q_remove_acct_rights(const char *desc, LSA_Q_REMOVE_ACCT_RIGHTS *q_q, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_remove_acct_rights"); depth++; @@ -2430,7 +2431,7 @@ BOOL lsa_io_q_remove_acct_rights(const char *desc, LSA_Q_REMOVE_ACCT_RIGHTS *q_q /******************************************************************* reads or writes a LSA_R_REMOVE_ACCT_RIGHTS structure. ********************************************************************/ -BOOL lsa_io_r_remove_acct_rights(const char *desc, LSA_R_REMOVE_ACCT_RIGHTS *r_c, prs_struct *ps, int depth) + BOOL lsa_io_r_remove_acct_rights(const char *desc, LSA_R_REMOVE_ACCT_RIGHTS *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_remove_acct_rights"); depth++; @@ -2444,7 +2445,7 @@ BOOL lsa_io_r_remove_acct_rights(const char *desc, LSA_R_REMOVE_ACCT_RIGHTS *r_c /******************************************************************* Inits an LSA_R_REMOVE_ACCT_RIGHTS structure. ********************************************************************/ -void init_r_remove_acct_rights(LSA_R_REMOVE_ACCT_RIGHTS *q_r) + void init_r_remove_acct_rights(LSA_R_REMOVE_ACCT_RIGHTS *q_r) { DEBUG(5, ("init_r_remove_acct_rights\n")); } @@ -2452,7 +2453,7 @@ void init_r_remove_acct_rights(LSA_R_REMOVE_ACCT_RIGHTS *q_r) /******************************************************************* Inits an LSA_Q_ENUM_ACCT_WITH_RIGHT structure. ********************************************************************/ -void init_q_enum_acct_with_right(LSA_Q_ENUM_ACCT_WITH_RIGHT *q_q, + void init_q_enum_acct_with_right(LSA_Q_ENUM_ACCT_WITH_RIGHT *q_q, POLICY_HND *hnd, const char *right) { @@ -2469,7 +2470,7 @@ void init_q_enum_acct_with_right(LSA_Q_ENUM_ACCT_WITH_RIGHT *q_q, /******************************************************************* reads or writes a LSA_Q_ENUM_ACCT_WITH_RIGHT structure. ********************************************************************/ -BOOL lsa_io_q_enum_acct_with_right(const char *desc, LSA_Q_ENUM_ACCT_WITH_RIGHT *q_q, prs_struct *ps, int depth) + BOOL lsa_io_q_enum_acct_with_right(const char *desc, LSA_Q_ENUM_ACCT_WITH_RIGHT *q_q, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_enum_acct_with_right"); depth++; @@ -2497,7 +2498,7 @@ BOOL lsa_io_q_enum_acct_with_right(const char *desc, LSA_Q_ENUM_ACCT_WITH_RIGHT /******************************************************************* reads or writes a LSA_R_ENUM_ACCT_WITH_RIGHT structure. ********************************************************************/ -BOOL lsa_io_r_enum_acct_with_right(const char *desc, LSA_R_ENUM_ACCT_WITH_RIGHT *r_c, prs_struct *ps, int depth) + BOOL lsa_io_r_enum_acct_with_right(const char *desc, LSA_R_ENUM_ACCT_WITH_RIGHT *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_enum_acct_with_right"); depth++; @@ -2517,7 +2518,7 @@ BOOL lsa_io_r_enum_acct_with_right(const char *desc, LSA_R_ENUM_ACCT_WITH_RIGHT /******************************************************************* Inits an LSA_R_ENUM_ACCT_WITH_RIGHT structure. ********************************************************************/ -void init_r_enum_acct_with_right(LSA_R_ENUM_ACCT_WITH_RIGHT *r_c, + void init_r_enum_acct_with_right(LSA_R_ENUM_ACCT_WITH_RIGHT *r_c, uint32 count, DOM_SID *sids) { @@ -2526,3 +2527,4 @@ void init_r_enum_acct_with_right(LSA_R_ENUM_ACCT_WITH_RIGHT *r_c, r_c->count = count; init_sid_array(&r_c->sids, count, sids); } +#endif -- cgit From 77373f1f8e3b2f61e9bbcd9fadfb83257d390cf2 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 24 Jul 2003 23:46:27 +0000 Subject: More printf fixes - size_t is long on some architectures. (This used to be commit ba4d334b822248d8ab929c9568533431603d967e) --- source3/rpc_parse/parse_prs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index efd4914c66..25c44c9da9 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1473,7 +1473,7 @@ void netsec_encode(struct netsec_auth_struct *a, int auth_flags, { uchar digest_final[16]; - DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%d\n", a->seq_num, data_len)); + DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%l\n", a->seq_num, data_len)); dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); RSIVAL(verf->seq_num, 0, a->seq_num); @@ -1544,7 +1544,7 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, break; } - DEBUG(10,("SCHANNEL: netsec_decode seq_num=%d data_len=%d\n", a->seq_num, data_len)); + DEBUG(10,("SCHANNEL: netsec_decode seq_num=%d data_len=%l\n", a->seq_num, data_len)); dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); dump_data_pw("seq_num:\n", seq_num, sizeof(seq_num)); -- cgit From 7d833de662b83f026b54a236588da27dd8899630 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 25 Jul 2003 04:24:40 +0000 Subject: More printf portability fixes. Got caught out by some gcc'isms last time. )-: (This used to be commit 59dae1da66a5eb7e128263bd578f167d8746e9f0) --- source3/rpc_parse/parse_prs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 25c44c9da9..11d8658b15 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1473,7 +1473,7 @@ void netsec_encode(struct netsec_auth_struct *a, int auth_flags, { uchar digest_final[16]; - DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%l\n", a->seq_num, data_len)); + DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%lu\n", a->seq_num, (unsigned long)data_len)); dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); RSIVAL(verf->seq_num, 0, a->seq_num); @@ -1544,7 +1544,7 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, break; } - DEBUG(10,("SCHANNEL: netsec_decode seq_num=%d data_len=%l\n", a->seq_num, data_len)); + DEBUG(10,("SCHANNEL: netsec_decode seq_num=%d data_len=%lu\n", a->seq_num, (unsigned long)data_len)); dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); dump_data_pw("seq_num:\n", seq_num, sizeof(seq_num)); -- cgit From de1a9986222fa578b129204dec193877b2a09abb Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 30 Jul 2003 17:29:00 +0000 Subject: add support for DsEnumerateDomainTrusted for enumerating all the trusted domains in a forest. (This used to be commit c691c7f7d9afb8af542dc83cf934df1dfd38ef17) --- source3/rpc_parse/parse_ds.c | 187 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 184 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index ab07631831..8edd38226b 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -1,7 +1,8 @@ /* * Unix SMB/CIFS implementation. * RPC Pipe client / server routines - * Copyright (C) Gerald Carter 2002 + + * 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 @@ -20,6 +21,9 @@ #include "includes.h" +/************************************************************************ +************************************************************************/ + static BOOL ds_io_dominfobasic( const char *desc, prs_struct *ps, int depth, DSROLE_PRIMARY_DOMAIN_INFO_BASIC **basic) { DSROLE_PRIMARY_DOMAIN_INFO_BASIC *p = *basic; @@ -68,7 +72,10 @@ static BOOL ds_io_dominfobasic( const char *desc, prs_struct *ps, int depth, DSR } -BOOL ds_io_q_getprimdominfo( const char *desc, DS_Q_GETPRIMDOMINFO *q_u, prs_struct *ps, int depth) +/************************************************************************ +************************************************************************/ + +BOOL ds_io_q_getprimdominfo( const char *desc, prs_struct *ps, int depth, DS_Q_GETPRIMDOMINFO *q_u) { prs_debug(ps, depth, desc, "ds_io_q_getprimdominfo"); depth++; @@ -82,7 +89,10 @@ BOOL ds_io_q_getprimdominfo( const char *desc, DS_Q_GETPRIMDOMINFO *q_u, prs_str return True; } -BOOL ds_io_r_getprimdominfo( const char *desc, DS_R_GETPRIMDOMINFO *r_u, prs_struct *ps, int depth) +/************************************************************************ +************************************************************************/ + +BOOL ds_io_r_getprimdominfo( const char *desc, prs_struct *ps, int depth, DS_R_GETPRIMDOMINFO *r_u) { prs_debug(ps, depth, desc, "ds_io_r_getprimdominfo"); depth++; @@ -120,3 +130,174 @@ BOOL ds_io_r_getprimdominfo( const char *desc, DS_R_GETPRIMDOMINFO *r_u, prs_str 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 ) +{ + int len; + + q->flags = flags; + + if ( server && *server ) + q->server_ptr = 1; + else + q->server_ptr = 0; + + len = q->server_ptr ? strlen(server)+1 : 0; + + init_unistr2( &q->server, server, len ); + + return True; +} + +/************************************************************************ +************************************************************************/ + +static BOOL ds_io_domain_trusts( const char *desc, prs_struct *ps, int depth, DS_DOMAIN_TRUSTS *trust) +{ + 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 ( !prs_uint8s(False, "guid", ps, depth, trust->guid.info, GUID_SIZE) ) + return False; + + return True; +} + +/************************************************************************ +************************************************************************/ + +static BOOL ds_io_dom_trusts_ctr( const char *desc, prs_struct *ps, int depth, DS_DOMAIN_TRUSTS_CTR *ctr) +{ + 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 = (DS_DOMAIN_TRUSTS*)talloc(ps->mem_ctx, sizeof(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; imax_count;i++ ) { + if ( !ds_io_domain_trusts("domain_trusts", ps, depth, &ctr->trusts[i] ) ) + return False; + } + + for ( i=0; imax_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, prs_struct *ps, int depth, DS_Q_ENUM_DOM_TRUSTS *q_u) +{ + 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_uint32( "flags", ps, depth, &q_u->flags ) ) + return False; + + return True; +} + +/************************************************************************ +************************************************************************/ + +BOOL ds_io_r_enum_domain_trusts( const char *desc, prs_struct *ps, int depth, DS_R_ENUM_DOM_TRUSTS *r_u) +{ + 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", ps, depth, &r_u->domains ) ) + return False; + } + + if(!prs_align(ps)) + return False; + + if ( !prs_ntstatus("status", ps, depth, &r_u->status ) ) + return False; + + return True; +} + + -- cgit From 0d087e3ba28a9061529c95799624ccc4686eb1e9 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 31 Jul 2003 05:43:47 +0000 Subject: working on transtive trusts issue: * use DsEnumerateDomainTrusts() instead of LDAP search. wbinfo -m now lists all trusted downlevel domains and all domains in the forest. Thnigs to do: o Look at Krb5 connection trusted domains o make sure to initial the trusted domain cache as soon as possible (This used to be commit 0ab00ccaedf204b39c86a9e1c2fcac5f15d0e033) --- source3/rpc_parse/parse_ds.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index 8edd38226b..f954806036 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -266,6 +266,9 @@ BOOL ds_io_q_enum_domain_trusts( const char *desc, prs_struct *ps, int depth, DS 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; -- cgit From f210ee9b99b3b6ac0234680f1af83fd783ef9af4 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Fri, 1 Aug 2003 14:47:39 +0000 Subject: Fix copyright statements for various pieces of Anthony Liguori's work. (This used to be commit 15d2bc47854df75f8b2644ccbc887d0357d9cd27) --- source3/rpc_parse/parse_samr.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 45c81deb89..b299ed3d33 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -7,7 +7,6 @@ * Copyright (C) Elrond 2000, * Copyright (C) Jeremy Allison 2001, * Copyright (C) Jean Franois Micouleau 1998-2001, - * Copyright (C) Anthony Liguori 2002, * Copyright (C) Jim McDonough 2002. * * This program is free software; you can redistribute it and/or modify -- cgit From 8c64504f7c58b05769ec1014242c15a2eb93ca84 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Fri, 1 Aug 2003 15:30:44 +0000 Subject: Update my copyrights according to my agreement with IBM (This used to be commit a2bd8f0bfa12f2a1e33c96bc9dabcc0e2171700d) --- source3/rpc_parse/parse_lsa.c | 2 +- source3/rpc_parse/parse_samr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index f620845d3b..07b0da7e9c 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -5,7 +5,7 @@ * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997, * Copyright (C) Andrew Bartlett 2002, - * Copyright (C) Jim McDonough 2002. + * Copyright (C) Jim McDonough 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 diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index b299ed3d33..fce3195225 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -7,7 +7,7 @@ * Copyright (C) Elrond 2000, * Copyright (C) Jeremy Allison 2001, * Copyright (C) Jean Franois Micouleau 1998-2001, - * Copyright (C) Jim McDonough 2002. + * Copyright (C) Jim McDonough 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 -- cgit From 04bf12b176d5abe06b7f1401810369bcafe0b611 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sat, 2 Aug 2003 20:06:57 +0000 Subject: port latest changes from SAMBA_3_0 tree (This used to be commit 3101c236b8241dc0183995ffceed551876427de4) --- source3/rpc_parse/parse_ds.c | 190 ++++++++++++++++++++++++++++++++++++++++- source3/rpc_parse/parse_lsa.c | 145 ++++--------------------------- source3/rpc_parse/parse_prs.c | 4 +- source3/rpc_parse/parse_samr.c | 3 +- 4 files changed, 207 insertions(+), 135 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index ab07631831..f954806036 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -1,7 +1,8 @@ /* * Unix SMB/CIFS implementation. * RPC Pipe client / server routines - * Copyright (C) Gerald Carter 2002 + + * 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 @@ -20,6 +21,9 @@ #include "includes.h" +/************************************************************************ +************************************************************************/ + static BOOL ds_io_dominfobasic( const char *desc, prs_struct *ps, int depth, DSROLE_PRIMARY_DOMAIN_INFO_BASIC **basic) { DSROLE_PRIMARY_DOMAIN_INFO_BASIC *p = *basic; @@ -68,7 +72,10 @@ static BOOL ds_io_dominfobasic( const char *desc, prs_struct *ps, int depth, DSR } -BOOL ds_io_q_getprimdominfo( const char *desc, DS_Q_GETPRIMDOMINFO *q_u, prs_struct *ps, int depth) +/************************************************************************ +************************************************************************/ + +BOOL ds_io_q_getprimdominfo( const char *desc, prs_struct *ps, int depth, DS_Q_GETPRIMDOMINFO *q_u) { prs_debug(ps, depth, desc, "ds_io_q_getprimdominfo"); depth++; @@ -82,7 +89,10 @@ BOOL ds_io_q_getprimdominfo( const char *desc, DS_Q_GETPRIMDOMINFO *q_u, prs_str return True; } -BOOL ds_io_r_getprimdominfo( const char *desc, DS_R_GETPRIMDOMINFO *r_u, prs_struct *ps, int depth) +/************************************************************************ +************************************************************************/ + +BOOL ds_io_r_getprimdominfo( const char *desc, prs_struct *ps, int depth, DS_R_GETPRIMDOMINFO *r_u) { prs_debug(ps, depth, desc, "ds_io_r_getprimdominfo"); depth++; @@ -120,3 +130,177 @@ BOOL ds_io_r_getprimdominfo( const char *desc, DS_R_GETPRIMDOMINFO *r_u, prs_str 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 ) +{ + int len; + + q->flags = flags; + + if ( server && *server ) + q->server_ptr = 1; + else + q->server_ptr = 0; + + len = q->server_ptr ? strlen(server)+1 : 0; + + init_unistr2( &q->server, server, len ); + + return True; +} + +/************************************************************************ +************************************************************************/ + +static BOOL ds_io_domain_trusts( const char *desc, prs_struct *ps, int depth, DS_DOMAIN_TRUSTS *trust) +{ + 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 ( !prs_uint8s(False, "guid", ps, depth, trust->guid.info, GUID_SIZE) ) + return False; + + return True; +} + +/************************************************************************ +************************************************************************/ + +static BOOL ds_io_dom_trusts_ctr( const char *desc, prs_struct *ps, int depth, DS_DOMAIN_TRUSTS_CTR *ctr) +{ + 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 = (DS_DOMAIN_TRUSTS*)talloc(ps->mem_ctx, sizeof(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; imax_count;i++ ) { + if ( !ds_io_domain_trusts("domain_trusts", ps, depth, &ctr->trusts[i] ) ) + return False; + } + + for ( i=0; imax_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, prs_struct *ps, int depth, DS_Q_ENUM_DOM_TRUSTS *q_u) +{ + 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, prs_struct *ps, int depth, DS_R_ENUM_DOM_TRUSTS *r_u) +{ + 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", ps, depth, &r_u->domains ) ) + 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_lsa.c b/source3/rpc_parse/parse_lsa.c index d8c3b4e3c3..07b0da7e9c 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -5,7 +5,7 @@ * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997, * Copyright (C) Andrew Bartlett 2002, - * Copyright (C) Jim McDonough 2002. + * Copyright (C) Jim McDonough 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 @@ -2219,21 +2219,18 @@ BOOL lsa_io_r_query_info2(const char *desc, LSA_R_QUERY_INFO2 *r_c, if(!prs_uint32("ptr", ps, depth, &r_c->ptr)) return False; - - if (r_c->ptr != 0) { - if(!prs_uint16("info_class", ps, depth, &r_c->info_class)) + if(!prs_uint16("info_class", ps, depth, &r_c->info_class)) + return False; + switch(r_c->info_class) { + case 0x000c: + if (!lsa_io_dns_dom_info("info12", &r_c->info.dns_dom_info, + ps, depth)) return False; - switch(r_c->info_class) { - case 0x000c: - if (!lsa_io_dns_dom_info("info12", &r_c->info.dns_dom_info, - ps, depth)) - return False; break; - default: - DEBUG(0,("lsa_io_r_query_info2: unknown info class %d\n", - r_c->info_class)); - return False; - } + default: + DEBUG(0,("lsa_io_r_query_info2: unknown info class %d\n", + r_c->info_class)); + return False; } if(!prs_align(ps)) @@ -2304,19 +2301,6 @@ BOOL lsa_io_r_enum_acct_rights(const char *desc, LSA_R_ENUM_ACCT_RIGHTS *r_c, pr return True; } -/******************************************************************* - Inits an LSA_R_ENUM_ACCT_RIGHTS structure. -********************************************************************/ -void init_r_enum_acct_rights(LSA_R_ENUM_ACCT_RIGHTS *q_r, - uint32 count, - const char **rights) -{ - DEBUG(5, ("init_r_enum_acct_rights\n")); - - q_r->count = count; - init_unistr2_array(&q_r->rights, count, rights); -} - /******************************************************************* Inits an LSA_Q_ADD_ACCT_RIGHTS structure. @@ -2332,6 +2316,7 @@ void init_q_add_acct_rights(LSA_Q_ADD_ACCT_RIGHTS *q_q, q_q->pol = *hnd; init_dom_sid2(&q_q->sid, sid); init_unistr2_array(&q_q->rights, count, rights); + q_q->count = 5; } @@ -2372,21 +2357,11 @@ BOOL lsa_io_r_add_acct_rights(const char *desc, LSA_R_ADD_ACCT_RIGHTS *r_c, prs_ return True; } -/******************************************************************* - Inits an LSA_R_ADD_ACCT_RIGHTS structure. -********************************************************************/ -void init_r_add_acct_rights(LSA_R_ADD_ACCT_RIGHTS *q_r) -{ - DEBUG(5, ("init_r_add_acct_rights\n")); - /* oh what a silly function! */ -} - -#if 0 /******************************************************************* Inits an LSA_Q_REMOVE_ACCT_RIGHTS structure. ********************************************************************/ - void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *q_q, +void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *q_q, POLICY_HND *hnd, DOM_SID *sid, uint32 removeall, @@ -2399,13 +2374,14 @@ void init_r_add_acct_rights(LSA_R_ADD_ACCT_RIGHTS *q_r) init_dom_sid2(&q_q->sid, sid); q_q->removeall = removeall; init_unistr2_array(&q_q->rights, count, rights); + q_q->count = 5; } /******************************************************************* 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 *q_q, prs_struct *ps, int depth) +BOOL lsa_io_q_remove_acct_rights(const char *desc, LSA_Q_REMOVE_ACCT_RIGHTS *q_q, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_remove_acct_rights"); depth++; @@ -2429,9 +2405,9 @@ reads or writes a LSA_Q_REMOVE_ACCT_RIGHTS structure. } /******************************************************************* -reads or writes a LSA_R_REMOVE_ACCT_RIGHTS structure. +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 *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_remove_acct_rights(const char *desc, LSA_R_REMOVE_ACCT_RIGHTS *r_c, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_remove_acct_rights"); depth++; @@ -2441,90 +2417,3 @@ reads or writes a LSA_R_REMOVE_ACCT_RIGHTS structure. return True; } - -/******************************************************************* - Inits an LSA_R_REMOVE_ACCT_RIGHTS structure. -********************************************************************/ - void init_r_remove_acct_rights(LSA_R_REMOVE_ACCT_RIGHTS *q_r) -{ - DEBUG(5, ("init_r_remove_acct_rights\n")); -} - -/******************************************************************* - Inits an LSA_Q_ENUM_ACCT_WITH_RIGHT structure. -********************************************************************/ - void init_q_enum_acct_with_right(LSA_Q_ENUM_ACCT_WITH_RIGHT *q_q, - POLICY_HND *hnd, - const char *right) -{ - DEBUG(5, ("init_q_enum_acct_with_right\n")); - - q_q->pol = *hnd; - init_unistr2(&q_q->right, right, strlen(right)); - init_str_hdr(&q_q->right_hdr, - q_q->right.uni_max_len*2, - q_q->right.uni_max_len*2, right?1:0); -} - - -/******************************************************************* -reads or writes a LSA_Q_ENUM_ACCT_WITH_RIGHT structure. -********************************************************************/ - BOOL lsa_io_q_enum_acct_with_right(const char *desc, LSA_Q_ENUM_ACCT_WITH_RIGHT *q_q, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_enum_acct_with_right"); - depth++; - - if (!smb_io_pol_hnd("", &q_q->pol, ps, depth)) - return False; - - if (!prs_uint32("ref_id ", ps, depth, &q_q->right_hdr.buffer)) - return False; - - if (UNMARSHALLING(ps) && q_q->right_hdr.buffer == 0) { - return True; - } - - if (!smb_io_strhdr("", &q_q->right_hdr, ps, depth)) - return False; - - if (!smb_io_unistr2("", &q_q->right, q_q->right_hdr.buffer, ps, depth)) - return False; - - return True; -} - - -/******************************************************************* -reads or writes a LSA_R_ENUM_ACCT_WITH_RIGHT structure. -********************************************************************/ - BOOL lsa_io_r_enum_acct_with_right(const char *desc, LSA_R_ENUM_ACCT_WITH_RIGHT *r_c, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_enum_acct_with_right"); - depth++; - - if (!prs_uint32("count ", ps, depth, &r_c->count)) - return False; - - if (!smb_io_sid_array("sids ", &r_c->sids, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_c->status)) - return False; - - return True; -} - -/******************************************************************* - Inits an LSA_R_ENUM_ACCT_WITH_RIGHT structure. -********************************************************************/ - void init_r_enum_acct_with_right(LSA_R_ENUM_ACCT_WITH_RIGHT *r_c, - uint32 count, - DOM_SID *sids) -{ - DEBUG(5, ("init_r_enum_acct_with_right\n")); - - r_c->count = count; - init_sid_array(&r_c->sids, count, sids); -} -#endif diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index efd4914c66..11d8658b15 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1473,7 +1473,7 @@ void netsec_encode(struct netsec_auth_struct *a, int auth_flags, { uchar digest_final[16]; - DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%d\n", a->seq_num, data_len)); + DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%lu\n", a->seq_num, (unsigned long)data_len)); dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); RSIVAL(verf->seq_num, 0, a->seq_num); @@ -1544,7 +1544,7 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, break; } - DEBUG(10,("SCHANNEL: netsec_decode seq_num=%d data_len=%d\n", a->seq_num, data_len)); + DEBUG(10,("SCHANNEL: netsec_decode seq_num=%d data_len=%lu\n", a->seq_num, (unsigned long)data_len)); dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); dump_data_pw("seq_num:\n", seq_num, sizeof(seq_num)); diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 45c81deb89..fce3195225 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -7,8 +7,7 @@ * Copyright (C) Elrond 2000, * Copyright (C) Jeremy Allison 2001, * Copyright (C) Jean Franois Micouleau 1998-2001, - * Copyright (C) Anthony Liguori 2002, - * Copyright (C) Jim McDonough 2002. + * Copyright (C) Jim McDonough 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 -- cgit From 225048e2e67e85ac6ff33ed4984435ffb7ccab62 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 12 Aug 2003 05:01:24 +0000 Subject: Fix comment (This used to be commit 024d32f79390210bee6da8e75c228a4aaa7fe6b0) --- source3/rpc_parse/parse_prs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 11d8658b15..90fce9eb9d 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1429,7 +1429,7 @@ static void netsec_get_sealing_key(struct netsec_auth_struct *a, dump_data_pw("sess_kf0:\n", sess_kf0, sizeof(sess_kf0)); - /* MD5 of sess_kf0 and the high bytes of the sequence number */ + /* MD5 of sess_kf0 and 4 zero bytes */ hmac_md5(sess_kf0, zeros, 0x4, digest2); dump_data_pw("digest2:\n", digest2, sizeof(digest2)); -- cgit From 062f89bc2833bf49f873a7fd5c2624babd702db0 Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Fri, 15 Aug 2003 01:42:30 +0000 Subject: get rid of some sompiler warnings on IRIX (This used to be commit a6a39c61e8228c8b3b7552ab3c61ec3a6a639143) --- source3/rpc_parse/parse_echo.c | 8 ++++---- source3/rpc_parse/parse_net.c | 2 +- source3/rpc_parse/parse_reg.c | 2 +- source3/rpc_parse/parse_spoolss.c | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_echo.c b/source3/rpc_parse/parse_echo.c index 67f9ad772e..4b1ff1f4d5 100644 --- a/source3/rpc_parse/parse_echo.c +++ b/source3/rpc_parse/parse_echo.c @@ -73,7 +73,7 @@ BOOL echo_io_q_echo_data(const char *desc, ECHO_Q_ECHO_DATA *q_d, return False; } - if (!prs_uint8s(False, "data", ps, depth, q_d->data, q_d->size)) + if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size)) return False; return True; @@ -92,7 +92,7 @@ BOOL echo_io_r_echo_data(const char *desc, ECHO_R_ECHO_DATA *q_d, return False; } - if (!prs_uint8s(False, "data", ps, depth, q_d->data, q_d->size)) + if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size)) return False; return True; @@ -120,7 +120,7 @@ BOOL echo_io_q_sink_data(const char *desc, ECHO_Q_SINK_DATA *q_d, return False; } - if (!prs_uint8s(False, "data", ps, depth, q_d->data, q_d->size)) + if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size)) return False; return True; @@ -159,7 +159,7 @@ BOOL echo_io_r_source_data(const char *desc, ECHO_R_SOURCE_DATA *q_d, return False; } - if (!prs_uint8s(False, "data", ps, depth, q_d->data, q_d->size)) + if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size)) return False; return True; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 804da707de..252e690723 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -801,7 +801,7 @@ void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s, DEBUG(5,("init_q_srv_pwset\n")); /* Process the new password. */ - cred_hash3( nt_cypher, hashed_mach_pwd, sess_key, 1); + 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); diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index b4d20bf2ba..bbf6e6a8e3 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -40,7 +40,7 @@ static uint32 reg_init_buffer2( BUFFER2 *buf2, REGISTRY_VALUE *val ) return 0; real_size = regval_size(val); - init_buffer2( buf2, (char*)regval_data_p(val), real_size ); + init_buffer2( buf2, (unsigned char*)regval_data_p(val), real_size ); return real_size; } diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 1a380c64d5..7ca9bccab4 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1368,7 +1368,7 @@ BOOL spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, return False; if (UNMARSHALLING(ps) && r_u->size) { - r_u->data = prs_alloc_mem(ps, r_u->size); + r_u->data = (unsigned char *)prs_alloc_mem(ps, r_u->size); if(!r_u->data) return False; } @@ -6178,7 +6178,7 @@ BOOL make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND init_unistr2(&q_u->value, value, strlen(value)+1); q_u->max_len = q_u->real_len = data_size; - q_u->data = data; + q_u->data = (unsigned char *)data; return True; } @@ -6195,7 +6195,7 @@ BOOL make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX *q_u, const POLICY init_unistr2(&q_u->key, key, strlen(key)+1); q_u->max_len = q_u->real_len = data_size; - q_u->data = data; + q_u->data = (unsigned char *)data; return True; } @@ -6990,7 +6990,7 @@ BOOL spoolss_io_r_getprinterdataex(const char *desc, SPOOL_R_GETPRINTERDATAEX *r return False; if (UNMARSHALLING(ps) && r_u->size) { - r_u->data = prs_alloc_mem(ps, r_u->size); + r_u->data = (unsigned char *)prs_alloc_mem(ps, r_u->size); if(!r_u->data) return False; } @@ -7689,7 +7689,7 @@ BOOL make_spoolss_q_writeprinter(SPOOL_Q_WRITEPRINTER *q_u, { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); q_u->buffer_size = q_u->buffer_size2 = data_size; - q_u->buffer = data; + q_u->buffer = (unsigned char *)data; return True; } -- cgit From aa39cc37dab9c4f8c3295d872bb8cc143890b378 Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Fri, 15 Aug 2003 04:42:05 +0000 Subject: get rid of more compiler warnings (This used to be commit 398bd14fc6e2f8ab2f34211270e179b8928a6669) --- source3/rpc_parse/parse_prs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 90fce9eb9d..81a9573077 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1402,7 +1402,7 @@ static void netsec_digest(struct netsec_auth_struct *a, if (auth_flags & AUTH_PIPE_SEAL) { MD5Update(&ctx3, verf->data8, sizeof(verf->data8)); } - MD5Update(&ctx3, data, data_len); + MD5Update(&ctx3, (const unsigned char *)data, data_len); MD5Final(whole_packet_digest, &ctx3); dump_data_pw("whole_packet_digest:\n", whole_packet_digest, sizeof(whole_packet_digest)); @@ -1506,9 +1506,9 @@ void netsec_encode(struct netsec_auth_struct *a, int auth_flags, dump_data_pw("verf->data8_enc:\n", verf->data8, sizeof(verf->data8)); /* encode the packet payload */ - dump_data_pw("data:\n", data, data_len); - netsechash(sealing_key, data, data_len); - dump_data_pw("data_enc:\n", data, data_len); + dump_data_pw("data:\n", (const unsigned char *)data, data_len); + netsechash(sealing_key, (unsigned char *)data, data_len); + dump_data_pw("data_enc:\n", (const unsigned char *)data, data_len); } /* encode the sequence number (key based on packet digest) */ @@ -1578,9 +1578,9 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, sizeof(verf->data8)); /* extract the packet payload */ - dump_data_pw("data :\n", data, data_len); - netsechash(sealing_key, data, data_len); - dump_data_pw("datadec:\n", data, data_len); + dump_data_pw("data :\n", (const unsigned char *)data, data_len); + netsechash(sealing_key, (unsigned char *)data, data_len); + dump_data_pw("datadec:\n", (const unsigned char *)data, data_len); } /* digest includes 'data' after unsealing */ -- cgit From 65409a49feb83c48043b980c7cda79149e2d837b Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 20 Aug 2003 16:07:19 +0000 Subject: Fix bug #252. Implement missing SAMR_REMOVE_USER_FOREIGN_DOMAIN call. (This used to be commit dd2cf4897ec3db25c24a2724ffdef4f905625f6a) --- source3/rpc_parse/parse_samr.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index fce3195225..1fe9b3231f 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -183,9 +183,9 @@ BOOL samr_io_r_lookup_domain(const char *desc, SAMR_R_LOOKUP_DOMAIN * r_u, reads or writes a structure. ********************************************************************/ -void init_samr_q_unknown_2d(SAMR_Q_UNKNOWN_2D * q_u, POLICY_HND *dom_pol, DOM_SID *sid) +void init_samr_q_remove_user_foreign_domain(SAMR_Q_REMOVE_USER_FOREIGN_DOMAIN * q_u, POLICY_HND *dom_pol, DOM_SID *sid) { - DEBUG(5, ("samr_init_samr_q_unknown_2d\n")); + DEBUG(5, ("samr_init_samr_q_remove_user_foreign_domain\n")); q_u->dom_pol = *dom_pol; init_dom_sid2(&q_u->sid, sid); @@ -195,13 +195,13 @@ void init_samr_q_unknown_2d(SAMR_Q_UNKNOWN_2D * q_u, POLICY_HND *dom_pol, DOM_SI reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_unknown_2d(const char *desc, SAMR_Q_UNKNOWN_2D * q_u, +BOOL samr_io_q_remove_user_foreign_domain(const char *desc, SAMR_Q_REMOVE_USER_FOREIGN_DOMAIN * q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_q_unknown_2d"); + prs_debug(ps, depth, desc, "samr_io_q_remove_user_foreign_domain"); depth++; if(!prs_align(ps)) @@ -223,13 +223,13 @@ BOOL samr_io_q_unknown_2d(const char *desc, SAMR_Q_UNKNOWN_2D * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_unknown_2d(const char *desc, SAMR_R_UNKNOWN_2D * r_u, +BOOL samr_io_r_remove_user_foreign_domain(const char *desc, SAMR_R_REMOVE_USER_FOREIGN_DOMAIN * r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_unknown_2d"); + prs_debug(ps, depth, desc, "samr_io_r_remove_user_foreign_domain"); depth++; if(!prs_align(ps)) -- cgit From b42500299cf0ead3a9cc42ac02c18cab2fdbd1f9 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 8 Sep 2003 02:13:38 +0000 Subject: Fix for bug #334. We don't unmarshall the trusted domain or secrets info delta correctly and thus crash when doing a net rpc samdump. The easiest thing at the moment it to comment out these functions as they seriously don't correspond with reality (netmon/ethereal) and the data in the containers aren't used anyway. (This used to be commit 695aa39c5d798b112f0a06281b499fcac8a5bf31) --- source3/rpc_parse/parse_net.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 252e690723..dd319df5a0 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -2447,6 +2447,10 @@ static BOOL net_io_sam_policy_info(const char *desc, SAM_DELTA_POLICY *info, return True; } +#if 0 + +/* This function is pretty broken - see bug #334 */ + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -2495,6 +2499,12 @@ static BOOL net_io_sam_trustdoms_info(const char *desc, SAM_DELTA_TRUSTDOMS *inf return True; } +#endif + +#if 0 + +/* This function doesn't work - see bug #334 */ + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -2582,6 +2592,8 @@ static BOOL net_io_sam_secret_info(const char *desc, SAM_DELTA_SECRET *info, return True; } +#endif + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -2726,14 +2738,10 @@ static BOOL net_io_sam_delta_ctr(const char *desc, uint8 sess_key[16], return False; break; - case SAM_DELTA_TRUST_DOMS: - if (!net_io_sam_trustdoms_info("", &delta->trustdoms_info, ps, depth)) - return False; - break; + /* These guys are implemented but broken */ + case SAM_DELTA_TRUST_DOMS: case SAM_DELTA_SECRET_INFO: - if (!net_io_sam_secret_info("", &delta->secret_info, ps, depth)) - return False; break; /* These guys are not implemented yet */ -- cgit From 4093bf7ff8c8861cf7b941945ede53a8ec5bb6c8 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 9 Sep 2003 04:07:32 +0000 Subject: sync 3.0 into HEAD for the last time (This used to be commit c17a7dc9a190156a069da3e861c18fd3f81224ad) --- source3/rpc_parse/parse_echo.c | 8 ++++---- source3/rpc_parse/parse_net.c | 22 +++++++++++++++------- source3/rpc_parse/parse_prs.c | 16 ++++++++-------- source3/rpc_parse/parse_reg.c | 2 +- source3/rpc_parse/parse_samr.c | 12 ++++++------ source3/rpc_parse/parse_spoolss.c | 10 +++++----- 6 files changed, 39 insertions(+), 31 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_echo.c b/source3/rpc_parse/parse_echo.c index 67f9ad772e..4b1ff1f4d5 100644 --- a/source3/rpc_parse/parse_echo.c +++ b/source3/rpc_parse/parse_echo.c @@ -73,7 +73,7 @@ BOOL echo_io_q_echo_data(const char *desc, ECHO_Q_ECHO_DATA *q_d, return False; } - if (!prs_uint8s(False, "data", ps, depth, q_d->data, q_d->size)) + if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size)) return False; return True; @@ -92,7 +92,7 @@ BOOL echo_io_r_echo_data(const char *desc, ECHO_R_ECHO_DATA *q_d, return False; } - if (!prs_uint8s(False, "data", ps, depth, q_d->data, q_d->size)) + if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size)) return False; return True; @@ -120,7 +120,7 @@ BOOL echo_io_q_sink_data(const char *desc, ECHO_Q_SINK_DATA *q_d, return False; } - if (!prs_uint8s(False, "data", ps, depth, q_d->data, q_d->size)) + if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size)) return False; return True; @@ -159,7 +159,7 @@ BOOL echo_io_r_source_data(const char *desc, ECHO_R_SOURCE_DATA *q_d, return False; } - if (!prs_uint8s(False, "data", ps, depth, q_d->data, q_d->size)) + if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size)) return False; return True; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 804da707de..dd319df5a0 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -801,7 +801,7 @@ void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s, DEBUG(5,("init_q_srv_pwset\n")); /* Process the new password. */ - cred_hash3( nt_cypher, hashed_mach_pwd, sess_key, 1); + 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); @@ -2447,6 +2447,10 @@ static BOOL net_io_sam_policy_info(const char *desc, SAM_DELTA_POLICY *info, return True; } +#if 0 + +/* This function is pretty broken - see bug #334 */ + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -2495,6 +2499,12 @@ static BOOL net_io_sam_trustdoms_info(const char *desc, SAM_DELTA_TRUSTDOMS *inf return True; } +#endif + +#if 0 + +/* This function doesn't work - see bug #334 */ + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -2582,6 +2592,8 @@ static BOOL net_io_sam_secret_info(const char *desc, SAM_DELTA_SECRET *info, return True; } +#endif + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -2726,14 +2738,10 @@ static BOOL net_io_sam_delta_ctr(const char *desc, uint8 sess_key[16], return False; break; - case SAM_DELTA_TRUST_DOMS: - if (!net_io_sam_trustdoms_info("", &delta->trustdoms_info, ps, depth)) - return False; - break; + /* These guys are implemented but broken */ + case SAM_DELTA_TRUST_DOMS: case SAM_DELTA_SECRET_INFO: - if (!net_io_sam_secret_info("", &delta->secret_info, ps, depth)) - return False; break; /* These guys are not implemented yet */ diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 11d8658b15..81a9573077 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1402,7 +1402,7 @@ static void netsec_digest(struct netsec_auth_struct *a, if (auth_flags & AUTH_PIPE_SEAL) { MD5Update(&ctx3, verf->data8, sizeof(verf->data8)); } - MD5Update(&ctx3, data, data_len); + MD5Update(&ctx3, (const unsigned char *)data, data_len); MD5Final(whole_packet_digest, &ctx3); dump_data_pw("whole_packet_digest:\n", whole_packet_digest, sizeof(whole_packet_digest)); @@ -1429,7 +1429,7 @@ static void netsec_get_sealing_key(struct netsec_auth_struct *a, dump_data_pw("sess_kf0:\n", sess_kf0, sizeof(sess_kf0)); - /* MD5 of sess_kf0 and the high bytes of the sequence number */ + /* MD5 of sess_kf0 and 4 zero bytes */ hmac_md5(sess_kf0, zeros, 0x4, digest2); dump_data_pw("digest2:\n", digest2, sizeof(digest2)); @@ -1506,9 +1506,9 @@ void netsec_encode(struct netsec_auth_struct *a, int auth_flags, dump_data_pw("verf->data8_enc:\n", verf->data8, sizeof(verf->data8)); /* encode the packet payload */ - dump_data_pw("data:\n", data, data_len); - netsechash(sealing_key, data, data_len); - dump_data_pw("data_enc:\n", data, data_len); + dump_data_pw("data:\n", (const unsigned char *)data, data_len); + netsechash(sealing_key, (unsigned char *)data, data_len); + dump_data_pw("data_enc:\n", (const unsigned char *)data, data_len); } /* encode the sequence number (key based on packet digest) */ @@ -1578,9 +1578,9 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, sizeof(verf->data8)); /* extract the packet payload */ - dump_data_pw("data :\n", data, data_len); - netsechash(sealing_key, data, data_len); - dump_data_pw("datadec:\n", data, data_len); + dump_data_pw("data :\n", (const unsigned char *)data, data_len); + netsechash(sealing_key, (unsigned char *)data, data_len); + dump_data_pw("datadec:\n", (const unsigned char *)data, data_len); } /* digest includes 'data' after unsealing */ diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index b4d20bf2ba..bbf6e6a8e3 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -40,7 +40,7 @@ static uint32 reg_init_buffer2( BUFFER2 *buf2, REGISTRY_VALUE *val ) return 0; real_size = regval_size(val); - init_buffer2( buf2, (char*)regval_data_p(val), real_size ); + init_buffer2( buf2, (unsigned char*)regval_data_p(val), real_size ); return real_size; } diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index fce3195225..1fe9b3231f 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -183,9 +183,9 @@ BOOL samr_io_r_lookup_domain(const char *desc, SAMR_R_LOOKUP_DOMAIN * r_u, reads or writes a structure. ********************************************************************/ -void init_samr_q_unknown_2d(SAMR_Q_UNKNOWN_2D * q_u, POLICY_HND *dom_pol, DOM_SID *sid) +void init_samr_q_remove_user_foreign_domain(SAMR_Q_REMOVE_USER_FOREIGN_DOMAIN * q_u, POLICY_HND *dom_pol, DOM_SID *sid) { - DEBUG(5, ("samr_init_samr_q_unknown_2d\n")); + DEBUG(5, ("samr_init_samr_q_remove_user_foreign_domain\n")); q_u->dom_pol = *dom_pol; init_dom_sid2(&q_u->sid, sid); @@ -195,13 +195,13 @@ void init_samr_q_unknown_2d(SAMR_Q_UNKNOWN_2D * q_u, POLICY_HND *dom_pol, DOM_SI reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_unknown_2d(const char *desc, SAMR_Q_UNKNOWN_2D * q_u, +BOOL samr_io_q_remove_user_foreign_domain(const char *desc, SAMR_Q_REMOVE_USER_FOREIGN_DOMAIN * q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_q_unknown_2d"); + prs_debug(ps, depth, desc, "samr_io_q_remove_user_foreign_domain"); depth++; if(!prs_align(ps)) @@ -223,13 +223,13 @@ BOOL samr_io_q_unknown_2d(const char *desc, SAMR_Q_UNKNOWN_2D * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_unknown_2d(const char *desc, SAMR_R_UNKNOWN_2D * r_u, +BOOL samr_io_r_remove_user_foreign_domain(const char *desc, SAMR_R_REMOVE_USER_FOREIGN_DOMAIN * r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_unknown_2d"); + prs_debug(ps, depth, desc, "samr_io_r_remove_user_foreign_domain"); depth++; if(!prs_align(ps)) diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 1a380c64d5..7ca9bccab4 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1368,7 +1368,7 @@ BOOL spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, return False; if (UNMARSHALLING(ps) && r_u->size) { - r_u->data = prs_alloc_mem(ps, r_u->size); + r_u->data = (unsigned char *)prs_alloc_mem(ps, r_u->size); if(!r_u->data) return False; } @@ -6178,7 +6178,7 @@ BOOL make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND init_unistr2(&q_u->value, value, strlen(value)+1); q_u->max_len = q_u->real_len = data_size; - q_u->data = data; + q_u->data = (unsigned char *)data; return True; } @@ -6195,7 +6195,7 @@ BOOL make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX *q_u, const POLICY init_unistr2(&q_u->key, key, strlen(key)+1); q_u->max_len = q_u->real_len = data_size; - q_u->data = data; + q_u->data = (unsigned char *)data; return True; } @@ -6990,7 +6990,7 @@ BOOL spoolss_io_r_getprinterdataex(const char *desc, SPOOL_R_GETPRINTERDATAEX *r return False; if (UNMARSHALLING(ps) && r_u->size) { - r_u->data = prs_alloc_mem(ps, r_u->size); + r_u->data = (unsigned char *)prs_alloc_mem(ps, r_u->size); if(!r_u->data) return False; } @@ -7689,7 +7689,7 @@ BOOL make_spoolss_q_writeprinter(SPOOL_Q_WRITEPRINTER *q_u, { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); q_u->buffer_size = q_u->buffer_size2 = data_size; - q_u->buffer = data; + q_u->buffer = (unsigned char *)data; return True; } -- cgit From 3a48e4b2875a6cb1c143377d7f6fb0be50ea80d2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Sep 2003 23:53:48 +0000 Subject: The "unknown_5" 32 bit field in the user structs is actually 2 16-bit fields, bad_password_count and logon_count. Ensure this is stored/fetched in the various SAMs. As it replaces the unknown_5 field this fits exactly into the tdb SAM without any binary problems. It also is added to the LDAP SAM as two extra attributes. It breaks compatibility with the experimental SAMs xml and mysql. The maintainers of these SAMs must fix them so upgrades like this can be done transparently. I will insist on the "experimental" status until this is solved. Jeremy. (This used to be commit cd7bd8c2daff3293d48f3376a7c5a708a140fd94) --- source3/rpc_parse/parse_samr.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 1fe9b3231f..420a727765 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5411,7 +5411,6 @@ static BOOL sam_io_user_info24(const char *desc, SAM_USER_INFO_24 * usr, init_sam_user_info23 unknown_3 = 0x09f8 27fa - unknown_5 = 0x0001 0000 unknown_6 = 0x0000 04ec *************************************************************************/ @@ -5438,7 +5437,8 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z uint32 unknown_3, uint16 logon_divs, LOGON_HRS * hrs, - uint32 unknown_5, + uint16 bad_password_count, + uint16 logon_count, char newpass[516], uint32 unknown_6) { int len_user_name = user_name != NULL ? user_name->uni_str_len : 0; @@ -5487,11 +5487,11 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z usr->passmustchange=0; } - ZERO_STRUCT(usr->padding1); ZERO_STRUCT(usr->padding2); - usr->unknown_5 = unknown_5; /* 0x0001 0000 */ + usr->bad_password_count = bad_password_count; + usr->logon_count = logon_count; memcpy(usr->pass, newpass, sizeof(usr->pass)); @@ -5516,7 +5516,6 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z init_sam_user_info23 unknown_3 = 0x09f8 27fa - unknown_5 = 0x0001 0000 unknown_6 = 0x0000 04ec *************************************************************************/ @@ -5534,7 +5533,7 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z char *unk_str, char *mung_dial, uint32 user_rid, /* 0x0000 0000 */ uint32 group_rid, uint32 acb_info, uint32 unknown_3, uint16 logon_divs, - LOGON_HRS * hrs, uint32 unknown_5, + LOGON_HRS * hrs, uint16 bad_password_count, uint16 logon_count, char newpass[516], uint32 unknown_6) { int len_user_name = user_name != NULL ? strlen(user_name) : 0; @@ -5586,7 +5585,8 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z ZERO_STRUCT(usr->padding1); ZERO_STRUCT(usr->padding2); - usr->unknown_5 = unknown_5; /* 0x0001 0000 */ + usr->bad_password_count = bad_password_count; + usr->logon_count = logon_count; memcpy(usr->pass, newpass, sizeof(usr->pass)); @@ -5678,7 +5678,9 @@ static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr, if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs)) return False; - if(!prs_uint32("unknown_5 ", ps, depth, &usr->unknown_5)) + 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))) @@ -5865,7 +5867,6 @@ static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_str init_sam_user_info21W unknown_3 = 0x00ff ffff - unknown_5 = 0x0002 0000 unknown_6 = 0x0000 04ec *************************************************************************/ @@ -5895,7 +5896,9 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, uint32 unknown_3, uint16 logon_divs, LOGON_HRS * hrs, - uint32 unknown_5, uint32 unknown_6) + uint16 bad_password_count, + uint16 logon_count, + uint32 unknown_6) { int len_user_name = user_name != NULL ? user_name->uni_str_len : 0; int len_full_name = full_name != NULL ? full_name->uni_str_len : 0; @@ -5936,7 +5939,8 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, usr->logon_divs = logon_divs; /* should be 168 (hours/week) */ usr->ptr_logon_hrs = hrs ? 1 : 0; - usr->unknown_5 = unknown_5; /* 0x0002 0000 */ + 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; @@ -5944,7 +5948,6 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, usr->passmustchange=0; } - ZERO_STRUCT(usr->padding1); ZERO_STRUCT(usr->padding2); @@ -5969,7 +5972,6 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, init_sam_user_info21 unknown_3 = 0x00ff ffff - unknown_5 = 0x0002 0000 unknown_6 = 0x0000 04ec *************************************************************************/ @@ -6086,7 +6088,8 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * usr->logon_divs = pdb_get_logon_divs(pw); usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0; - usr->unknown_5 = pdb_get_unknown_5(pw); /* 0x0002 0000 */ + 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; @@ -6094,7 +6097,6 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * usr->passmustchange=0; } - ZERO_STRUCT(usr->padding1); ZERO_STRUCT(usr->padding2); @@ -6192,7 +6194,9 @@ static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs)) return False; - if(!prs_uint32("unknown_5 ", ps, depth, &usr->unknown_5)) + 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))) -- cgit From 30fd3599143260ee6893a5125e7ec7cec8bb2289 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Sep 2003 23:54:12 +0000 Subject: The "unknown_5" 32 bit field in the user structs is actually 2 16-bit fields, bad_password_count and logon_count. Ensure this is stored/fetched in the various SAMs. As it replaces the unknown_5 field this fits exactly into the tdb SAM without any binary problems. It also is added to the LDAP SAM as two extra attributes. It breaks compatibility with the experimental SAMs xml and mysql. The maintainers of these SAMs must fix them so upgrades like this can be done transparently. I will insist on the "experimental" status until this is solved. Jeremy. (This used to be commit 71ecd10181cd35313b79f618c2928c2f45424812) --- source3/rpc_parse/parse_samr.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 1fe9b3231f..420a727765 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5411,7 +5411,6 @@ static BOOL sam_io_user_info24(const char *desc, SAM_USER_INFO_24 * usr, init_sam_user_info23 unknown_3 = 0x09f8 27fa - unknown_5 = 0x0001 0000 unknown_6 = 0x0000 04ec *************************************************************************/ @@ -5438,7 +5437,8 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z uint32 unknown_3, uint16 logon_divs, LOGON_HRS * hrs, - uint32 unknown_5, + uint16 bad_password_count, + uint16 logon_count, char newpass[516], uint32 unknown_6) { int len_user_name = user_name != NULL ? user_name->uni_str_len : 0; @@ -5487,11 +5487,11 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z usr->passmustchange=0; } - ZERO_STRUCT(usr->padding1); ZERO_STRUCT(usr->padding2); - usr->unknown_5 = unknown_5; /* 0x0001 0000 */ + usr->bad_password_count = bad_password_count; + usr->logon_count = logon_count; memcpy(usr->pass, newpass, sizeof(usr->pass)); @@ -5516,7 +5516,6 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z init_sam_user_info23 unknown_3 = 0x09f8 27fa - unknown_5 = 0x0001 0000 unknown_6 = 0x0000 04ec *************************************************************************/ @@ -5534,7 +5533,7 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z char *unk_str, char *mung_dial, uint32 user_rid, /* 0x0000 0000 */ uint32 group_rid, uint32 acb_info, uint32 unknown_3, uint16 logon_divs, - LOGON_HRS * hrs, uint32 unknown_5, + LOGON_HRS * hrs, uint16 bad_password_count, uint16 logon_count, char newpass[516], uint32 unknown_6) { int len_user_name = user_name != NULL ? strlen(user_name) : 0; @@ -5586,7 +5585,8 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z ZERO_STRUCT(usr->padding1); ZERO_STRUCT(usr->padding2); - usr->unknown_5 = unknown_5; /* 0x0001 0000 */ + usr->bad_password_count = bad_password_count; + usr->logon_count = logon_count; memcpy(usr->pass, newpass, sizeof(usr->pass)); @@ -5678,7 +5678,9 @@ static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr, if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs)) return False; - if(!prs_uint32("unknown_5 ", ps, depth, &usr->unknown_5)) + 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))) @@ -5865,7 +5867,6 @@ static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_str init_sam_user_info21W unknown_3 = 0x00ff ffff - unknown_5 = 0x0002 0000 unknown_6 = 0x0000 04ec *************************************************************************/ @@ -5895,7 +5896,9 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, uint32 unknown_3, uint16 logon_divs, LOGON_HRS * hrs, - uint32 unknown_5, uint32 unknown_6) + uint16 bad_password_count, + uint16 logon_count, + uint32 unknown_6) { int len_user_name = user_name != NULL ? user_name->uni_str_len : 0; int len_full_name = full_name != NULL ? full_name->uni_str_len : 0; @@ -5936,7 +5939,8 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, usr->logon_divs = logon_divs; /* should be 168 (hours/week) */ usr->ptr_logon_hrs = hrs ? 1 : 0; - usr->unknown_5 = unknown_5; /* 0x0002 0000 */ + 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; @@ -5944,7 +5948,6 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, usr->passmustchange=0; } - ZERO_STRUCT(usr->padding1); ZERO_STRUCT(usr->padding2); @@ -5969,7 +5972,6 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, init_sam_user_info21 unknown_3 = 0x00ff ffff - unknown_5 = 0x0002 0000 unknown_6 = 0x0000 04ec *************************************************************************/ @@ -6086,7 +6088,8 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * usr->logon_divs = pdb_get_logon_divs(pw); usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0; - usr->unknown_5 = pdb_get_unknown_5(pw); /* 0x0002 0000 */ + 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; @@ -6094,7 +6097,6 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * usr->passmustchange=0; } - ZERO_STRUCT(usr->padding1); ZERO_STRUCT(usr->padding2); @@ -6192,7 +6194,9 @@ static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs)) return False; - if(!prs_uint32("unknown_5 ", ps, depth, &usr->unknown_5)) + 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))) -- cgit From 0551426657167c676f1b88443602f9268d21784e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 19 Sep 2003 21:57:43 +0000 Subject: Ensure that dup_sec_desc copies the 'type' field correctly. This caused me to expose a type arguement to make_sec_desc(). We weren't copying the SE_DESC_DACL_AUTO_INHERITED flag which could cause errors on auto inherited checks. Jeremy. (This used to be commit 28b315a7501f42928d73efaa75f74146ba95cf2d) --- source3/rpc_parse/parse_sec.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 3848bd7051..0ed930c08d 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -561,7 +561,7 @@ SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BU /* Create new security descriptor from bits */ - psd = make_sec_desc(ctx, new_sdb->sec->revision, + psd = make_sec_desc(ctx, new_sdb->sec->revision, secdesc_type, owner_sid, group_sid, sacl, dacl, &secdesc_size); return_sdb = make_sec_desc_buf(ctx, secdesc_size, psd); @@ -573,7 +573,7 @@ SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BU Creates a SEC_DESC structure ********************************************************************/ -SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, +SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, uint16 type, DOM_SID *owner_sid, DOM_SID *grp_sid, SEC_ACL *sacl, SEC_ACL *dacl, size_t *sd_size) { @@ -586,10 +586,12 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, return NULL; dst->revision = revision; - dst->type = SEC_DESC_SELF_RELATIVE; + dst->type = type; - if (sacl) dst->type |= SEC_DESC_SACL_PRESENT; - if (dacl) dst->type |= SEC_DESC_DACL_PRESENT; + if (sacl) + dst->type |= SEC_DESC_SACL_PRESENT; + if (dacl) + dst->type |= SEC_DESC_DACL_PRESENT; dst->off_owner_sid = 0; dst->off_grp_sid = 0; @@ -654,7 +656,7 @@ SEC_DESC *dup_sec_desc( TALLOC_CTX *ctx, SEC_DESC *src) if(src == NULL) return NULL; - return make_sec_desc( ctx, src->revision, + return make_sec_desc( ctx, src->revision, src->type, src->owner_sid, src->grp_sid, src->sacl, src->dacl, &dummy); } @@ -666,7 +668,7 @@ SEC_DESC *dup_sec_desc( TALLOC_CTX *ctx, SEC_DESC *src) SEC_DESC *make_standard_sec_desc(TALLOC_CTX *ctx, DOM_SID *owner_sid, DOM_SID *grp_sid, SEC_ACL *dacl, size_t *sd_size) { - return make_sec_desc(ctx, SEC_DESC_REVISION, + return make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, owner_sid, grp_sid, NULL, dacl, sd_size); } @@ -924,7 +926,7 @@ NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32 if (!(dacl = make_sec_acl(ctx, psd[0]->dacl->revision, psd[0]->dacl->num_aces, ace))) return NT_STATUS_UNSUCCESSFUL; - if (!(sd = make_sec_desc(ctx, psd[0]->revision, psd[0]->owner_sid, + if (!(sd = make_sec_desc(ctx, psd[0]->revision, psd[0]->type, psd[0]->owner_sid, psd[0]->grp_sid, psd[0]->sacl, dacl, sd_size))) return NT_STATUS_UNSUCCESSFUL; @@ -976,7 +978,7 @@ NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t if (!(dacl = make_sec_acl(ctx, psd[0]->dacl->revision, psd[0]->dacl->num_aces, ace))) return NT_STATUS_UNSUCCESSFUL; - if (!(sd = make_sec_desc(ctx, psd[0]->revision, psd[0]->owner_sid, + if (!(sd = make_sec_desc(ctx, psd[0]->revision, psd[0]->type, psd[0]->owner_sid, psd[0]->grp_sid, psd[0]->sacl, dacl, sd_size))) return NT_STATUS_UNSUCCESSFUL; -- cgit From 8139c5fcfa6bd26ce03af41c374f84be48343666 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 19 Sep 2003 21:57:46 +0000 Subject: Ensure that dup_sec_desc copies the 'type' field correctly. This caused me to expose a type arguement to make_sec_desc(). We weren't copying the SE_DESC_DACL_AUTO_INHERITED flag which could cause errors on auto inherited checks. Jeremy. (This used to be commit 546b2271c08735ac1049a453abac996d794aa364) --- source3/rpc_parse/parse_sec.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 3848bd7051..0ed930c08d 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -561,7 +561,7 @@ SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BU /* Create new security descriptor from bits */ - psd = make_sec_desc(ctx, new_sdb->sec->revision, + psd = make_sec_desc(ctx, new_sdb->sec->revision, secdesc_type, owner_sid, group_sid, sacl, dacl, &secdesc_size); return_sdb = make_sec_desc_buf(ctx, secdesc_size, psd); @@ -573,7 +573,7 @@ SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BU Creates a SEC_DESC structure ********************************************************************/ -SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, +SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, uint16 type, DOM_SID *owner_sid, DOM_SID *grp_sid, SEC_ACL *sacl, SEC_ACL *dacl, size_t *sd_size) { @@ -586,10 +586,12 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, return NULL; dst->revision = revision; - dst->type = SEC_DESC_SELF_RELATIVE; + dst->type = type; - if (sacl) dst->type |= SEC_DESC_SACL_PRESENT; - if (dacl) dst->type |= SEC_DESC_DACL_PRESENT; + if (sacl) + dst->type |= SEC_DESC_SACL_PRESENT; + if (dacl) + dst->type |= SEC_DESC_DACL_PRESENT; dst->off_owner_sid = 0; dst->off_grp_sid = 0; @@ -654,7 +656,7 @@ SEC_DESC *dup_sec_desc( TALLOC_CTX *ctx, SEC_DESC *src) if(src == NULL) return NULL; - return make_sec_desc( ctx, src->revision, + return make_sec_desc( ctx, src->revision, src->type, src->owner_sid, src->grp_sid, src->sacl, src->dacl, &dummy); } @@ -666,7 +668,7 @@ SEC_DESC *dup_sec_desc( TALLOC_CTX *ctx, SEC_DESC *src) SEC_DESC *make_standard_sec_desc(TALLOC_CTX *ctx, DOM_SID *owner_sid, DOM_SID *grp_sid, SEC_ACL *dacl, size_t *sd_size) { - return make_sec_desc(ctx, SEC_DESC_REVISION, + return make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, owner_sid, grp_sid, NULL, dacl, sd_size); } @@ -924,7 +926,7 @@ NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32 if (!(dacl = make_sec_acl(ctx, psd[0]->dacl->revision, psd[0]->dacl->num_aces, ace))) return NT_STATUS_UNSUCCESSFUL; - if (!(sd = make_sec_desc(ctx, psd[0]->revision, psd[0]->owner_sid, + if (!(sd = make_sec_desc(ctx, psd[0]->revision, psd[0]->type, psd[0]->owner_sid, psd[0]->grp_sid, psd[0]->sacl, dacl, sd_size))) return NT_STATUS_UNSUCCESSFUL; @@ -976,7 +978,7 @@ NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t if (!(dacl = make_sec_acl(ctx, psd[0]->dacl->revision, psd[0]->dacl->num_aces, ace))) return NT_STATUS_UNSUCCESSFUL; - if (!(sd = make_sec_desc(ctx, psd[0]->revision, psd[0]->owner_sid, + if (!(sd = make_sec_desc(ctx, psd[0]->revision, psd[0]->type, psd[0]->owner_sid, psd[0]->grp_sid, psd[0]->sacl, dacl, sd_size))) return NT_STATUS_UNSUCCESSFUL; -- cgit From d3b9384308e4b5130c9455b853edc4702d7af303 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 25 Sep 2003 21:26:16 +0000 Subject: Fix for #480. Change the interface for init_unistr2 to not take a length but a flags field. We were assuming that 2*strlen(mb_string) == length of ucs2-le string. This is not the case. Count it after conversion. Jeremy. (This used to be commit f82c273a42f930c7152cfab84394781744815e0e) --- source3/rpc_parse/parse_dfs.c | 20 +- source3/rpc_parse/parse_ds.c | 6 +- source3/rpc_parse/parse_lsa.c | 39 +--- source3/rpc_parse/parse_misc.c | 98 ++++----- source3/rpc_parse/parse_net.c | 108 ++++------ source3/rpc_parse/parse_reg.c | 64 +++--- source3/rpc_parse/parse_samr.c | 416 ++++++++++++++++---------------------- source3/rpc_parse/parse_spoolss.c | 79 ++++---- source3/rpc_parse/parse_srv.c | 74 +++---- 9 files changed, 367 insertions(+), 537 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index 6f13500359..0d0ce557b2 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -80,9 +80,9 @@ BOOL init_dfs_q_dfs_remove(DFS_Q_DFS_REMOVE *q_d, const char *entrypath, const char *servername, const char *sharename) { DEBUG(5,("init_dfs_q_dfs_remove\n")); - init_unistr2(&q_d->DfsEntryPath, entrypath, strlen(entrypath)+1); - init_unistr2(&q_d->ServerName, servername, strlen(servername)+1); - init_unistr2(&q_d->ShareName, sharename, strlen(sharename)+1); + init_unistr2(&q_d->DfsEntryPath, entrypath, UNI_STR_TERMINATE); + init_unistr2(&q_d->ServerName, servername, UNI_STR_TERMINATE); + init_unistr2(&q_d->ShareName, sharename, UNI_STR_TERMINATE); q_d->ptr_ServerName = q_d->ptr_ShareName = 1; return True; } @@ -155,11 +155,11 @@ BOOL init_dfs_q_dfs_add(DFS_Q_DFS_ADD *q_d, const char *entrypath, { DEBUG(5,("init_dfs_q_dfs_add\n")); q_d->ptr_DfsEntryPath = q_d->ptr_ServerName = q_d->ptr_ShareName = 1; - init_unistr2(&q_d->DfsEntryPath, entrypath, strlen(entrypath)+1); - init_unistr2(&q_d->ServerName, servername, strlen(servername)+1); - init_unistr2(&q_d->ShareName, sharename, strlen(sharename)+1); + init_unistr2(&q_d->DfsEntryPath, entrypath, UNI_STR_TERMINATE); + init_unistr2(&q_d->ServerName, servername, UNI_STR_TERMINATE); + init_unistr2(&q_d->ShareName, sharename, UNI_STR_TERMINATE); if(comment != NULL) { - init_unistr2(&q_d->Comment, comment, strlen(comment)+1); + init_unistr2(&q_d->Comment, comment,UNI_STR_TERMINATE); q_d->ptr_Comment = 1; } else { q_d->ptr_Comment = 0; @@ -237,9 +237,9 @@ BOOL init_dfs_q_dfs_get_info(DFS_Q_DFS_GET_INFO *q_d, const char *entrypath, uint32 info_level) { DEBUG(5,("init_dfs_q2_get_info\n")); - init_unistr2(&q_d->uni_path, entrypath, strlen(entrypath)+1); - init_unistr2(&q_d->uni_server, servername, strlen(servername)+1); - init_unistr2(&q_d->uni_share, sharename, strlen(sharename)+1); + init_unistr2(&q_d->uni_path, entrypath, UNI_STR_TERMINATE); + init_unistr2(&q_d->uni_server, servername, UNI_STR_TERMINATE); + init_unistr2(&q_d->uni_share, sharename, UNI_STR_TERMINATE); q_d->level = info_level; q_d->ptr_server = q_d->ptr_share = 1; return True; diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index f954806036..26dcdb34b8 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -138,8 +138,6 @@ BOOL ds_io_r_getprimdominfo( const char *desc, prs_struct *ps, int depth, DS_R_G BOOL init_q_ds_enum_domain_trusts( DS_Q_ENUM_DOM_TRUSTS *q, const char *server, uint32 flags ) { - int len; - q->flags = flags; if ( server && *server ) @@ -147,9 +145,7 @@ BOOL init_q_ds_enum_domain_trusts( DS_Q_ENUM_DOM_TRUSTS *q, const char *server, else q->server_ptr = 0; - len = q->server_ptr ? strlen(server)+1 : 0; - - init_unistr2( &q->server, server, len ); + init_unistr2( &q->server, server, UNI_STR_TERMINATE); return True; } diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 07b0da7e9c..3a5b232dc3 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -36,14 +36,9 @@ static BOOL lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, prs_s void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, uint16 sid_name_use, const char *name, uint32 idx) { - int len_name = strlen(name); - - if(len_name == 0) - len_name = 1; - trn->sid_name_use = sid_name_use; - init_uni_hdr(&trn->hdr_name, len_name); - init_unistr2(uni_name, name, len_name); + init_unistr2(uni_name, name, UNI_FLAGS_NONE); + init_uni_hdr(&trn->hdr_name, uni_name); trn->domain_idx = idx; } @@ -346,8 +341,7 @@ void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, const char *server_name, r_q->des_access = desired_access; - init_unistr2(&r_q->uni_server_name, server_name, - strlen(server_name) + 1); + init_unistr2(&r_q->uni_server_name, server_name, UNI_STR_TERMINATE); init_lsa_obj_attr(&r_q->attr, attributes, qos); } @@ -566,10 +560,10 @@ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 en /* don't know what actually is this for */ r_e->ptr_enum_domains = 1; - init_uni_hdr2(&r_e->hdr_domain_name[i], strlen_w((td[i])->name)); init_dom_sid2(&r_e->domain_sid[i], &(td[i])->sid); init_unistr2_w(ctx, &r_e->uni_domain_name[i], (td[i])->name); + init_uni_hdr2(&r_e->hdr_domain_name[i], &r_e->uni_domain_name[i]); }; } @@ -1087,11 +1081,8 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, } for (i = 0; i < num_names; i++) { - int len; - len = strlen(names[i]); - - init_uni_hdr(&q_l->hdr_name[i], len); - init_unistr2(&q_l->uni_name[i], names[i], len); + 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]); } } @@ -1436,15 +1427,10 @@ BOOL lsa_io_r_enum_privs(const char *desc, LSA_R_ENUM_PRIVS *r_q, prs_struct *ps 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) { - int len_name = strlen(name); - - if(len_name == 0) - len_name = 1; - memcpy(&trn->pol, hnd, sizeof(trn->pol)); - init_uni_hdr(&trn->hdr_name, len_name); - init_unistr2(&trn->name, name, len_name); + 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; } @@ -1954,14 +1940,9 @@ BOOL lsa_io_r_setsystemaccount(const char *desc, LSA_R_SETSYSTEMACCOUNT *r_c, p void init_lsa_q_lookupprivvalue(LSA_Q_LOOKUPPRIVVALUE *trn, POLICY_HND *hnd, const char *name) { - int len_name = strlen(name); memcpy(&trn->pol, hnd, sizeof(trn->pol)); - - if(len_name == 0) - len_name = 1; - - init_uni_hdr(&trn->hdr_right, len_name); - init_unistr2(&trn->uni2_right, name, len_name); + init_unistr2(&trn->uni2_right, name, UNI_FLAGS_NONE); + init_uni_hdr(&trn->hdr_right, &trn->uni2_right); } /******************************************************************* diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 17a96fff80..e182535532 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -361,11 +361,11 @@ BOOL smb_io_strhdr(const char *desc, STRHDR *hdr, prs_struct *ps, int depth) Inits a UNIHDR structure. ********************************************************************/ -void init_uni_hdr(UNIHDR *hdr, int len) +void init_uni_hdr(UNIHDR *hdr, UNISTR2 *str2) { - hdr->uni_str_len = 2 * len; - hdr->uni_max_len = 2 * len; - hdr->buffer = len != 0 ? 1 : 0; + hdr->uni_str_len = 2 * (str2->uni_str_len); + hdr->uni_max_len = 2 * (str2->uni_max_len); + hdr->buffer = (str2->uni_str_len != 0) ? 1 : 0; } /******************************************************************* @@ -482,10 +482,10 @@ BOOL smb_io_hdrbuf(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth) creates a UNIHDR2 structure. ********************************************************************/ -void init_uni_hdr2(UNIHDR2 *hdr, int len) +void init_uni_hdr2(UNIHDR2 *hdr, UNISTR2 *str2) { - init_uni_hdr(&hdr->unihdr, len); - hdr->buffer = (len > 0) ? 1 : 0; + init_uni_hdr(&hdr->unihdr, str2); + hdr->buffer = (str2->uni_str_len > 0) ? 1 : 0; } /******************************************************************* @@ -703,7 +703,7 @@ void init_buffer2(BUFFER2 *str, const uint8 *buf, size_t len) /* max buffer size (allocated size) */ str->buf_max_len = len; - str->undoc = 0; + str->offset = 0; str->buf_len = buf != NULL ? len : 0; if (buf != NULL) { @@ -737,7 +737,7 @@ BOOL smb_io_buffer2(const char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct * if(!prs_uint32("uni_max_len", ps, depth, &buf2->buf_max_len)) return False; - if(!prs_uint32("undoc ", ps, depth, &buf2->undoc)) + if(!prs_uint32("offset ", ps, depth, &buf2->offset)) return False; if(!prs_uint32("buf_len ", ps, depth, &buf2->buf_len)) return False; @@ -765,14 +765,11 @@ creates a UNISTR2 structure: sets up the buffer, too void init_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf) { if (buf != NULL) { - *ptr = 1; - init_unistr2(str, buf, strlen(buf)+1); - + init_unistr2(str, buf, UNI_STR_TERMINATE); } else { - *ptr = 0; - init_unistr2(str, "", 0); + init_unistr2(str, NULL, UNI_FLAGS_NONE); } } @@ -783,10 +780,8 @@ void init_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf) void copy_unistr2(UNISTR2 *str, const UNISTR2 *from) { - - /* set up string lengths. add one if string is not null-terminated */ str->uni_max_len = from->uni_max_len; - str->undoc = from->undoc; + str->offset = from->offset; str->uni_str_len = from->uni_str_len; if (from->buffer == NULL) @@ -803,8 +798,7 @@ void copy_unistr2(UNISTR2 *str, const UNISTR2 *from) len *= sizeof(uint16); str->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len); - if ((str->buffer == NULL) && (len > 0 )) - { + if ((str->buffer == NULL) && (len > 0 )) { smb_panic("copy_unistr2: talloc fail\n"); return; } @@ -824,7 +818,7 @@ void init_string2(STRING2 *str, const char *buf, int max_len, int str_len) /* set up string lengths. */ str->str_max_len = max_len; - str->undoc = 0; + str->offset = 0; str->str_str_len = str_len; /* store the string */ @@ -835,7 +829,7 @@ void init_string2(STRING2 *str, const char *buf, int max_len, int str_len) if (str->buffer == NULL) smb_panic("init_string2: malloc fail\n"); memcpy(str->buffer, buf, str_len); - } + } } /******************************************************************* @@ -860,7 +854,7 @@ BOOL smb_io_string2(const char *desc, STRING2 *str2, uint32 buffer, prs_struct * if(!prs_uint32("str_max_len", ps, depth, &str2->str_max_len)) return False; - if(!prs_uint32("undoc ", ps, depth, &str2->undoc)) + if(!prs_uint32("offset ", ps, depth, &str2->offset)) return False; if(!prs_uint32("str_str_len", ps, depth, &str2->str_str_len)) return False; @@ -885,34 +879,43 @@ BOOL smb_io_string2(const char *desc, STRING2 *str2, uint32 buffer, prs_struct * Inits a UNISTR2 structure. ********************************************************************/ -void init_unistr2(UNISTR2 *str, const char *buf, size_t len) +void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) { - ZERO_STRUCTP(str); + size_t len = 0; + uint32 num_chars = 0; - /* set up string lengths. */ - str->uni_max_len = (uint32)len; - str->undoc = 0; - str->uni_str_len = (uint32)len; + if (buf) { + /* We always null terminate the copy. */ + len = strlen(buf) + 1; + } if (len < MAX_UNISTRLEN) len = MAX_UNISTRLEN; len *= sizeof(uint16); str->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len); - if ((str->buffer == NULL) && (len > 0)) - { + if ((str->buffer == NULL) && (len > 0)) { smb_panic("init_unistr2: malloc fail\n"); return; } /* - * don't move this test above ! The UNISTR2 must be initialized !!! + * The UNISTR2 must be initialized !!! * jfm, 7/7/2001. */ - if (buf==NULL) - return; + if (buf) { + rpcstr_push((char *)str->buffer, buf, len, STR_TERMINATE); + num_chars = strlen_w(str->buffer); + if (flags == STR_TERMINATE || flags == UNI_MAXLEN_TERMINATE) { + num_chars++; + } + } - rpcstr_push((char *)str->buffer, buf, len, STR_TERMINATE); + str->uni_max_len = num_chars; + str->offset = 0; + str->uni_str_len = num_chars; + if (num_chars && (flags == UNI_MAXLEN_TERMINATE)) + str->uni_max_len++; } /** @@ -932,7 +935,7 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) /* set up string lengths. */ str->uni_max_len = len; - str->undoc = 0; + str->offset = 0; str->uni_str_len = len; if (max_len < MAX_UNISTRLEN) @@ -941,8 +944,7 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) alloc_len = (max_len + 1) * sizeof(uint16); str->buffer = (uint16 *)talloc_zero(ctx, alloc_len); - if ((str->buffer == NULL) && (alloc_len > 0)) - { + if ((str->buffer == NULL) && (alloc_len > 0)) { smb_panic("init_unistr2_w: malloc fail\n"); return; } @@ -963,9 +965,9 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) /******************************************************************* Inits a UNISTR2 structure from a UNISTR ********************************************************************/ -void init_unistr2_from_unistr (UNISTR2 *to, const UNISTR *from) -{ +void init_unistr2_from_unistr(UNISTR2 *to, const UNISTR *from) +{ uint32 i; /* the destination UNISTR2 should never be NULL. @@ -987,7 +989,7 @@ void init_unistr2_from_unistr (UNISTR2 *to, const UNISTR *from) /* set up string lengths; uni_max_len is set to i+1 because we need to account for the final NULL termination */ to->uni_max_len = i; - to->undoc = 0; + to->offset = 0; to->uni_str_len = i; /* allocate the space and copy the string buffer */ @@ -995,11 +997,9 @@ void init_unistr2_from_unistr (UNISTR2 *to, const UNISTR *from) if (to->buffer == NULL) smb_panic("init_unistr2_from_unistr: malloc fail\n"); memcpy(to->buffer, from->buffer, to->uni_max_len*sizeof(uint16)); - return; } - /******************************************************************* Reads or writes a UNISTR2 structure. XXXX NOTE: UNISTR2 structures need NOT be null-terminated. @@ -1022,7 +1022,7 @@ BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct * if(!prs_uint32("uni_max_len", ps, depth, &uni2->uni_max_len)) return False; - if(!prs_uint32("undoc ", ps, depth, &uni2->undoc)) + if(!prs_uint32("offset ", ps, depth, &uni2->offset)) return False; if(!prs_uint32("uni_str_len", ps, depth, &uni2->uni_str_len)) return False; @@ -1064,7 +1064,7 @@ BOOL init_unistr2_array(UNISTR2_ARRAY *array, } for (i=0;istrings[i].string, strings[i], strlen(strings[i])); + init_unistr2(&array->strings[i].string, strings[i], UNI_FLAGS_NONE); array->strings[i].size = array->strings[i].string.uni_max_len*2; array->strings[i].length = array->strings[i].size; array->strings[i].ref_id = 1; @@ -1223,14 +1223,14 @@ static void init_clnt_srv(DOM_CLNT_SRV *logcln, const char *logon_srv, const cha if (logon_srv != NULL) { logcln->undoc_buffer = 1; - init_unistr2(&logcln->uni_logon_srv, logon_srv, strlen(logon_srv)+1); + init_unistr2(&logcln->uni_logon_srv, logon_srv, UNI_STR_TERMINATE); } else { logcln->undoc_buffer = 0; } if (comp_name != NULL) { logcln->undoc_buffer2 = 1; - init_unistr2(&logcln->uni_comp_name, comp_name, strlen(comp_name)+1); + init_unistr2(&logcln->uni_comp_name, comp_name, UNI_STR_TERMINATE); } else { logcln->undoc_buffer2 = 0; } @@ -1284,12 +1284,12 @@ void init_log_info(DOM_LOG_INFO *loginfo, const char *logon_srv, const char *acc loginfo->undoc_buffer = 1; - init_unistr2(&loginfo->uni_logon_srv, logon_srv, strlen(logon_srv)+1); - init_unistr2(&loginfo->uni_acct_name, acct_name, strlen(acct_name)+1); + init_unistr2(&loginfo->uni_logon_srv, logon_srv, UNI_STR_TERMINATE); + init_unistr2(&loginfo->uni_acct_name, acct_name, UNI_STR_TERMINATE); loginfo->sec_chan = sec_chan; - init_unistr2(&loginfo->uni_comp_name, comp_name, strlen(comp_name)+1); + init_unistr2(&loginfo->uni_comp_name, comp_name, UNI_STR_TERMINATE); } /******************************************************************* diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index dd319df5a0..3b096e088a 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -136,16 +136,15 @@ static BOOL net_io_netinfo_1(const char *desc, NETLOGON_INFO_1 *info, prs_struct static void init_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, uint32 tc_status, const char *trusted_dc_name) { - int len_dc_name = strlen(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, len_dc_name+1); + init_unistr2(&info->uni_trusted_dc_name, trusted_dc_name, UNI_STR_TERMINATE); else - init_unistr2(&info->uni_trusted_dc_name, "", 1); + init_unistr2(&info->uni_trusted_dc_name, "", UNI_STR_TERMINATE); } /******************************************************************* @@ -230,7 +229,7 @@ void init_net_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, const char *srv_name, q_l->query_level = query_level; q_l->switch_value = 0x01; - init_unistr2(&q_l->uni_server_name, srv_name, strlen(srv_name) + 1); + init_unistr2(&q_l->uni_server_name, srv_name, UNI_STR_TERMINATE); } /******************************************************************* @@ -360,7 +359,7 @@ void init_net_q_logon_ctrl(NET_Q_LOGON_CTRL *q_l, const char *srv_name, q_l->function_code = 0x01; /* ??? */ q_l->query_level = query_level; - init_unistr2(&q_l->uni_server_name, srv_name, strlen(srv_name) + 1); + init_unistr2(&q_l->uni_server_name, srv_name, UNI_STR_TERMINATE); } /******************************************************************* @@ -447,9 +446,9 @@ void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, fstring domain_name; fstrcpy(domain_name, dom_name); strupper_m(domain_name); - init_unistr2(&r_t->uni_trust_dom_name[i], domain_name, strlen(domain_name)+1); + 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].undoc = 0x1; + r_t->uni_trust_dom_name[i].offset = 0x1; } r_t->status = NT_STATUS_OK; @@ -539,8 +538,8 @@ void init_q_req_chal(NET_Q_REQ_CHAL *q_c, q_c->undoc_buffer = 1; /* don't know what this buffer is */ - init_unistr2(&q_c->uni_logon_srv, logon_srv , strlen(logon_srv )+1); - init_unistr2(&q_c->uni_logon_clnt, logon_clnt, strlen(logon_clnt)+1); + 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)); @@ -910,10 +909,6 @@ void init_id_info1(NET_ID_INFO_1 *id, const char *domain_name, const char *sess_key, unsigned char lm_cypher[16], unsigned char nt_cypher[16]) { - int len_domain_name = strlen(domain_name); - int len_user_name = strlen(user_name ); - int len_wksta_name = strlen(wksta_name ); - unsigned char lm_owf[16]; unsigned char nt_owf[16]; @@ -921,13 +916,9 @@ void init_id_info1(NET_ID_INFO_1 *id, const char *domain_name, id->ptr_id_info1 = 1; - init_uni_hdr(&id->hdr_domain_name, len_domain_name); - id->param_ctrl = param_ctrl; init_logon_id(&id->logon_id, log_id_low, log_id_high); - init_uni_hdr(&id->hdr_user_name, len_user_name); - init_uni_hdr(&id->hdr_wksta_name, len_wksta_name); if (lm_cypher && nt_cypher) { unsigned char key[16]; @@ -962,9 +953,12 @@ void init_id_info1(NET_ID_INFO_1 *id, const char *domain_name, init_owf_info(&id->lm_owf, lm_cypher); init_owf_info(&id->nt_owf, nt_cypher); - init_unistr2(&id->uni_domain_name, domain_name, len_domain_name); - init_unistr2(&id->uni_user_name, user_name, len_user_name); - init_unistr2(&id->uni_wksta_name, wksta_name, len_wksta_name); + 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); } /******************************************************************* @@ -1041,9 +1035,6 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, const uchar * lm_chal_resp, size_t lm_chal_resp_len, const uchar * nt_chal_resp, size_t nt_chal_resp_len) { - size_t len_domain_name = strlen(domain_name); - size_t len_user_name = strlen(user_name ); - size_t len_wksta_name = strlen(wksta_name ); unsigned char lm_owf[24]; unsigned char nt_owf[128]; @@ -1051,14 +1042,10 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, id->ptr_id_info2 = 1; - init_uni_hdr(&id->hdr_domain_name, len_domain_name); id->param_ctrl = param_ctrl; init_logon_id(&id->logon_id, log_id_low, log_id_high); - init_uni_hdr(&id->hdr_user_name, len_user_name); - init_uni_hdr(&id->hdr_wksta_name, len_wksta_name); - if (nt_chal_resp) { /* oops. can only send what-ever-it-is direct */ memcpy(nt_owf, nt_chal_resp, MIN(sizeof(nt_owf), nt_chal_resp_len)); @@ -1074,9 +1061,12 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, 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, len_domain_name); - init_unistr2(&id->uni_user_name, user_name, len_user_name); - init_unistr2(&id->uni_wksta_name, wksta_name, len_wksta_name); + 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); @@ -1288,26 +1278,10 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, pass_last_set_time, pass_can_change_time, pass_must_change_time; - int len_user_name, len_full_name, len_home_dir, - len_dir_drive, len_logon_script, len_profile_path; - - int len_logon_srv = strlen(logon_srv); - int len_logon_dom = strlen(logon_dom); - - len_user_name = strlen(user_name ); - len_full_name = strlen(full_name ); - len_home_dir = strlen(home_dir ); - len_dir_drive = strlen(dir_drive ); - len_logon_script = strlen(logon_script); - len_profile_path = strlen(profile_path); - - 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); @@ -1323,13 +1297,6 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, usr->pass_can_change_time = pass_can_change_time; usr->pass_must_change_time = pass_must_change_time; - init_uni_hdr(&usr->hdr_user_name, len_user_name); - init_uni_hdr(&usr->hdr_full_name, len_full_name); - init_uni_hdr(&usr->hdr_logon_script, len_logon_script); - init_uni_hdr(&usr->hdr_profile_path, len_profile_path); - init_uni_hdr(&usr->hdr_home_dir, len_home_dir); - init_uni_hdr(&usr->hdr_dir_drive, len_dir_drive); - usr->logon_count = logon_count; usr->bad_pw_count = bad_pw_count; @@ -1345,9 +1312,6 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, else memset((char *)usr->user_sess_key, '\0', sizeof(usr->user_sess_key)); - init_uni_hdr(&usr->hdr_logon_srv, len_logon_srv); - init_uni_hdr(&usr->hdr_logon_dom, len_logon_dom); - usr->buffer_dom_id = dom_sid ? 1 : 0; /* yes, we're bothering to put a domain SID in */ memset((char *)usr->padding, '\0', sizeof(usr->padding)); @@ -1357,12 +1321,18 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, 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, len_user_name); - init_unistr2(&usr->uni_full_name, full_name, len_full_name); - init_unistr2(&usr->uni_logon_script, logon_script, len_logon_script); - init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path); - init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); - init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); + 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; @@ -1373,8 +1343,10 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, for (i = 0; i < num_groups; i++) usr->gids[i] = gids[i]; - init_unistr2(&usr->uni_logon_srv, logon_srv, len_logon_srv); - init_unistr2(&usr->uni_logon_dom, logon_dom, len_logon_dom); + 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 */ @@ -1670,8 +1642,8 @@ BOOL init_net_q_sam_sync(NET_Q_SAM_SYNC * q_s, const char *srv_name, { DEBUG(5, ("init_q_sam_sync\n")); - init_unistr2(&q_s->uni_srv_name, srv_name, strlen(srv_name) + 1); - init_unistr2(&q_s->uni_cli_name, cli_name, strlen(cli_name) + 1); + 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)); @@ -2858,8 +2830,8 @@ BOOL init_net_q_sam_deltas(NET_Q_SAM_DELTAS *q_s, const char *srv_name, { DEBUG(5, ("init_net_q_sam_deltas\n")); - init_unistr2(&q_s->uni_srv_name, srv_name, strlen(srv_name) + 1); - init_unistr2(&q_s->uni_cli_name, cli_name, strlen(cli_name) + 1); + 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)); diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index bbf6e6a8e3..69c0dfc754 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -281,18 +281,15 @@ void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, char *name, char *class, SEC_ACCESS *sam_access, SEC_DESC_BUF *sec_buf) { - int len_name = name != NULL ? strlen(name ) + 1: 0; - int len_class = class != NULL ? strlen(class) + 1: 0; - ZERO_STRUCTP(q_c); memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); - init_uni_hdr(&q_c->hdr_name, len_name); - init_unistr2(&q_c->uni_name, name, len_name); + init_unistr2(&q_c->uni_name, name, UNI_STR_TERMINATE); + init_uni_hdr(&q_c->hdr_name, &q_c->uni_name); - init_uni_hdr(&q_c->hdr_class, len_class); - init_unistr2(&q_c->uni_class, class, len_class); + init_unistr2(&q_c->uni_class, class, UNI_STR_TERMINATE); + init_uni_hdr(&q_c->hdr_class, &q_c->uni_class); q_c->reserved = 0x00000000; memcpy(&q_c->sam_access, sam_access, sizeof(q_c->sam_access)); @@ -397,13 +394,12 @@ BOOL reg_io_r_create_key(const char *desc, REG_R_CREATE_KEY *r_r, prs_struct *p void init_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd, char *name) { - int len_name = name != NULL ? strlen(name ) + 1: 0; ZERO_STRUCTP(q_c); memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); - init_uni_hdr(&q_c->hdr_name, len_name); - init_unistr2(&q_c->uni_name, name, len_name); + init_unistr2(&q_c->uni_name, name, UNI_STR_TERMINATE); + init_uni_hdr(&q_c->hdr_name, &q_c->uni_name); } /******************************************************************* @@ -463,13 +459,12 @@ BOOL reg_io_r_delete_val(const char *desc, REG_R_DELETE_VALUE *r_r, prs_struct void init_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd, char *name) { - int len_name = name != NULL ? strlen(name ) + 1: 0; ZERO_STRUCTP(q_c); memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); - init_uni_hdr(&q_c->hdr_name, len_name); - init_unistr2(&q_c->uni_name, name, len_name); + init_unistr2(&q_c->uni_name, name, UNI_STR_TERMINATE); + init_uni_hdr(&q_c->hdr_name, &q_c->uni_name); } /******************************************************************* @@ -525,14 +520,12 @@ BOOL reg_io_r_delete_key(const char *desc, REG_R_DELETE_KEY *r_r, prs_struct *p Inits a structure. ********************************************************************/ -void init_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, - uint32 max_class_len) +void init_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, UNISTR2 *uni2) { ZERO_STRUCTP(q_o); memcpy(&q_o->pol, hnd, sizeof(q_o->pol)); - init_uni_hdr(&q_o->hdr_class, max_class_len); - q_o->uni_class.uni_max_len = max_class_len; + init_uni_hdr(&q_o->hdr_class, uni2); } /******************************************************************* @@ -1010,15 +1003,13 @@ makes a structure. BOOL init_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char* val_name) { - int len_type = val_name != NULL ? strlen(val_name) + 1 : 0; - if (q_i == NULL) return False; q_i->pol = *pol; - init_uni_hdr(&(q_i->hdr_type), len_type); - init_unistr2(&(q_i->uni_type), val_name, len_type); + init_unistr2(&q_i->uni_type, val_name, UNI_STR_TERMINATE); + init_uni_hdr(&q_i->hdr_type, &q_i->uni_type); q_i->ptr_reserved = 1; q_i->ptr_buf = 1; @@ -1230,7 +1221,7 @@ makes a structure. ********************************************************************/ void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol, - uint32 val_idx, uint32 max_val_len, + uint32 val_idx, UNISTR2 *uni2, uint32 max_buf_len) { ZERO_STRUCTP(q_i); @@ -1238,8 +1229,7 @@ void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol, memcpy(&q_i->pol, pol, sizeof(q_i->pol)); q_i->val_index = val_idx; - init_uni_hdr(&q_i->hdr_name, max_val_len); - q_i->uni_name.uni_max_len = max_val_len; + init_uni_hdr(&q_i->hdr_name, uni2); q_i->ptr_type = 1; q_i->type = 0x0; @@ -1270,8 +1260,8 @@ void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) DEBUG(10,("init_reg_r_enum_val: Valuename => [%s]\n", val->valuename)); - init_uni_hdr( &r_u->hdr_name, strlen(val->valuename)+1 ); - init_unistr2( &r_u->uni_name, val->valuename, strlen(val->valuename)+1 ); + init_unistr2( &r_u->uni_name, val->valuename, UNI_STR_TERMINATE); + init_uni_hdr( &r_u->hdr_name, &r_u->uni_name); /* type */ @@ -1418,14 +1408,12 @@ void init_reg_q_create_val(REG_Q_CREATE_VALUE *q_i, POLICY_HND *pol, char *val_name, uint32 type, BUFFER3 *val) { - int val_len = strlen(val_name) + 1; - ZERO_STRUCTP(q_i); memcpy(&q_i->pol, pol, sizeof(q_i->pol)); - init_uni_hdr(&q_i->hdr_name, val_len); - init_unistr2(&q_i->uni_name, val_name, val_len); + init_unistr2(&q_i->uni_name, val_name, UNI_STR_TERMINATE); + init_uni_hdr(&q_i->hdr_name, &q_i->uni_name); q_i->type = type; q_i->buf_value = val; @@ -1650,12 +1638,10 @@ makes a structure. void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, char *key_name, uint32 access_desired) { - int len_name = strlen(key_name)+1; - memcpy(&r_q->pol, pol, sizeof(r_q->pol)); - init_uni_hdr(&r_q->hdr_name, len_name); - init_unistr2(&r_q->uni_name, key_name, len_name); + init_unistr2(&r_q->uni_name, key_name, UNI_STR_TERMINATE); + init_uni_hdr(&r_q->hdr_name, &r_q->uni_name); r_q->unknown_0 = 0x00000000; r_q->access_desired = access_desired; @@ -1736,29 +1722,27 @@ BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *p /******************************************************************* Inits a structure. ********************************************************************/ + void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, const char *msg, uint32 timeout, BOOL do_reboot, BOOL force) { - int msg_len; - msg_len = strlen(msg); - q_s->ptr_0 = 1; q_s->ptr_1 = 1; q_s->ptr_2 = 1; - init_uni_hdr(&(q_s->hdr_msg), msg_len); - init_unistr2(&(q_s->uni_msg), msg, msg_len); + init_unistr2(&q_s->uni_msg, msg, UNI_FLAGS_NONE); + init_uni_hdr(&q_s->hdr_msg, &q_s->uni_msg); q_s->timeout = timeout; q_s->reboot = do_reboot ? 1 : 0; q_s->force = force ? 1 : 0; - } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_shutdown(const char *desc, REG_Q_SHUTDOWN * q_s, prs_struct *ps, int depth) { diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 420a727765..939b652a1e 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -93,14 +93,12 @@ 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) { - int len_name = strlen(dom_name); - DEBUG(5, ("init_samr_q_lookup_domain\n")); q_u->connect_pol = *pol; - init_uni_hdr(&q_u->hdr_domain, len_name); - init_unistr2(&q_u->uni_domain, dom_name, len_name); + init_unistr2(&q_u->uni_domain, dom_name, UNI_FLAGS_NONE); + init_uni_hdr(&q_u->hdr_domain, &q_u->uni_domain); } /******************************************************************* @@ -630,13 +628,11 @@ static BOOL sam_io_unk_info12(const char *desc, SAM_UNK_INFO_12 * u_12, /******************************************************************* inits a structure. ********************************************************************/ + void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *server) { - int len_server = strlen(server); - - init_uni_hdr(&u_5->hdr_server, len_server); - - init_unistr2(&u_5->uni_server, server, len_server); + init_unistr2(&u_5->uni_server, server, UNI_FLAGS_NONE); + init_uni_hdr(&u_5->hdr_server, &u_5->uni_server); } /******************************************************************* @@ -664,20 +660,16 @@ static BOOL sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5, /******************************************************************* inits a structure. ********************************************************************/ + void init_unk_info2(SAM_UNK_INFO_2 * u_2, const char *domain, const char *server, uint32 seq_num, uint32 num_users, uint32 num_groups, uint32 num_alias) { - int len_domain = strlen(domain); - int len_server = strlen(server); - u_2->unknown_0 = 0x00000000; u_2->unknown_1 = 0x80000000; u_2->unknown_2 = 0x00000000; u_2->ptr_0 = 1; - init_uni_hdr(&u_2->hdr_domain, len_domain); - init_uni_hdr(&u_2->hdr_server, len_server); u_2->seq_num = seq_num; u_2->unknown_3 = 0x00000000; @@ -691,8 +683,10 @@ void init_unk_info2(SAM_UNK_INFO_2 * u_2, memset(u_2->padding, 0, sizeof(u_2->padding)); /* 12 bytes zeros */ - init_unistr2(&u_2->uni_domain, domain, len_domain); - init_unistr2(&u_2->uni_server, server, len_server); + 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); } /******************************************************************* @@ -984,9 +978,9 @@ static BOOL sam_io_sam_str1(const char *desc, SAM_STR1 * sam, uint32 acct_buf, inits a SAM_ENTRY1 structure. ********************************************************************/ -static void init_sam_entry1(SAM_ENTRY1 * sam, uint32 user_idx, - uint32 len_sam_name, uint32 len_sam_full, - uint32 len_sam_desc, uint32 rid_user, +static void init_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, + UNISTR2 *sam_name, UNISTR2 *sam_full, + UNISTR2 *sam_desc, uint32 rid_user, uint16 acb_info) { DEBUG(5, ("init_sam_entry1\n")); @@ -997,9 +991,9 @@ static void init_sam_entry1(SAM_ENTRY1 * sam, uint32 user_idx, sam->rid_user = rid_user; sam->acb_info = acb_info; - init_uni_hdr(&sam->hdr_acct_name, len_sam_name); - init_uni_hdr(&sam->hdr_user_name, len_sam_full); - init_uni_hdr(&sam->hdr_user_desc, len_sam_desc); + 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); } /******************************************************************* @@ -1067,7 +1061,7 @@ static BOOL sam_io_sam_str2(const char *desc, SAM_STR2 * sam, uint32 acct_buf, inits a SAM_ENTRY2 structure. ********************************************************************/ static void init_sam_entry2(SAM_ENTRY2 * sam, uint32 user_idx, - uint32 len_sam_name, uint32 len_sam_desc, + UNISTR2 *sam_name, UNISTR2 *sam_desc, uint32 rid_user, uint16 acb_info) { DEBUG(5, ("init_sam_entry2\n")); @@ -1076,8 +1070,8 @@ static void init_sam_entry2(SAM_ENTRY2 * sam, uint32 user_idx, sam->rid_user = rid_user; sam->acb_info = acb_info; - init_uni_hdr(&sam->hdr_srv_name, len_sam_name); - init_uni_hdr(&sam->hdr_srv_desc, len_sam_desc); + init_uni_hdr(&sam->hdr_srv_name, sam_name); + init_uni_hdr(&sam->hdr_srv_desc, sam_desc); } /******************************************************************* @@ -1144,7 +1138,7 @@ inits a SAM_ENTRY3 structure. ********************************************************************/ static void init_sam_entry3(SAM_ENTRY3 * sam, uint32 grp_idx, - uint32 len_grp_name, uint32 len_grp_desc, + UNISTR2 *grp_name, UNISTR2 *grp_desc, uint32 rid_grp) { DEBUG(5, ("init_sam_entry3\n")); @@ -1153,8 +1147,8 @@ static void init_sam_entry3(SAM_ENTRY3 * sam, uint32 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, len_grp_name); - init_uni_hdr(&sam->hdr_grp_desc, len_grp_desc); + init_uni_hdr(&sam->hdr_grp_name, grp_name); + init_uni_hdr(&sam->hdr_grp_desc, grp_desc); } /******************************************************************* @@ -1268,12 +1262,12 @@ static BOOL sam_io_sam_entry5(const char *desc, SAM_ENTRY5 * sam, inits a SAM_ENTRY structure. ********************************************************************/ -void init_sam_entry(SAM_ENTRY * sam, uint32 len_sam_name, uint32 rid) +void init_sam_entry(SAM_ENTRY *sam, UNISTR2 *uni2, uint32 rid) { - DEBUG(10, ("init_sam_entry: %d %d\n", len_sam_name, rid)); + DEBUG(10, ("init_sam_entry: %d\n", rid)); sam->rid = rid; - init_uni_hdr(&sam->hdr_name, len_sam_name); + init_uni_hdr(&sam->hdr_name, uni2); } /******************************************************************* @@ -1502,7 +1496,6 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_en uint32 start_idx, SAM_ACCOUNT *disp_user_info, DOM_SID *domain_sid) { - uint32 len_sam_name, len_sam_full, len_sam_desc; uint32 i; SAM_ACCOUNT *pwd = NULL; @@ -1560,21 +1553,14 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_en return NT_STATUS_UNSUCCESSFUL; } - len_sam_name = strlen(username); - len_sam_full = strlen(fullname); - len_sam_desc = strlen(acct_desc); + init_unistr2(&sam->str[i].uni_acct_name, pdb_get_username(pwd), UNI_FLAGS_NONE); + init_unistr2(&sam->str[i].uni_full_name, pdb_get_fullname(pwd), UNI_FLAGS_NONE); + init_unistr2(&sam->str[i].uni_acct_desc, pdb_get_acct_desc(pwd), UNI_FLAGS_NONE); init_sam_entry1(&sam->sam[i], start_idx + i + 1, - len_sam_name, len_sam_full, len_sam_desc, + &sam->str[i].uni_acct_name, &sam->str[i].uni_full_name, &sam->str[i].uni_acct_desc, user_rid, pdb_get_acct_ctrl(pwd)); - ZERO_STRUCTP(&sam->str[i].uni_acct_name); - ZERO_STRUCTP(&sam->str[i].uni_full_name); - ZERO_STRUCTP(&sam->str[i].uni_acct_desc); - - init_unistr2(&sam->str[i].uni_acct_name, pdb_get_username(pwd), len_sam_name); - init_unistr2(&sam->str[i].uni_full_name, pdb_get_fullname(pwd), len_sam_full); - init_unistr2(&sam->str[i].uni_acct_desc, pdb_get_acct_desc(pwd), len_sam_desc); } return NT_STATUS_OK; @@ -1637,7 +1623,6 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_en uint32 start_idx, SAM_ACCOUNT *disp_user_info, DOM_SID *domain_sid ) { - uint32 len_sam_name, len_sam_desc; uint32 i; SAM_ACCOUNT *pwd = NULL; @@ -1680,18 +1665,12 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_en return NT_STATUS_UNSUCCESSFUL; } - len_sam_name = strlen(username); - len_sam_desc = strlen(acct_desc); - + init_unistr2(&sam->str[i].uni_srv_name, username, UNI_FLAGS_NONE); + init_unistr2(&sam->str[i].uni_srv_desc, pdb_get_acct_desc(pwd), UNI_FLAGS_NONE); + init_sam_entry2(&sam->sam[i], start_idx + i + 1, - len_sam_name, len_sam_desc, + &sam->str[i].uni_srv_name, &sam->str[i].uni_srv_desc, user_rid, pdb_get_acct_ctrl(pwd)); - - ZERO_STRUCTP(&sam->str[i].uni_srv_name); - ZERO_STRUCTP(&sam->str[i].uni_srv_desc); - - init_unistr2(&sam->str[i].uni_srv_name, username, len_sam_name); - init_unistr2(&sam->str[i].uni_srv_desc, pdb_get_acct_desc(pwd), len_sam_desc); } return NT_STATUS_OK; @@ -1755,7 +1734,6 @@ inits a SAM_DISPINFO_3 structure. NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_entries, uint32 start_idx, DOMAIN_GRP *disp_group_info) { - uint32 len_sam_name, len_sam_desc; uint32 i; ZERO_STRUCTP(sam); @@ -1779,13 +1757,11 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_en DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i)); - len_sam_name = strlen(grp->name); - len_sam_desc = strlen(grp->comment); + init_unistr2(&sam->str[i].uni_grp_name, grp->name, UNI_FLAGS_NONE); + init_unistr2(&sam->str[i].uni_grp_desc, grp->comment, UNI_FLAGS_NONE); - init_sam_entry3(&sam->sam[i], start_idx + i + 1, len_sam_name, len_sam_desc, grp->rid); - - init_unistr2(&sam->str[i].uni_grp_name, grp->name, len_sam_name); - init_unistr2(&sam->str[i].uni_grp_desc, grp->comment, len_sam_desc); + init_sam_entry3(&sam->sam[i], start_idx + i + 1, &sam->str[i].uni_grp_name, + &sam->str[i].uni_grp_desc, grp->rid); } return NT_STATUS_OK; @@ -2210,20 +2186,15 @@ void init_samr_group_info1(GROUP_INFO1 * gr1, char *acct_name, char *acct_desc, uint32 num_members) { - int desc_len = acct_desc != NULL ? strlen(acct_desc) : 0; - int acct_len = acct_name != NULL ? strlen(acct_name) : 0; - DEBUG(5, ("init_samr_group_info1\n")); - init_uni_hdr(&gr1->hdr_acct_name, acct_len); - gr1->unknown_1 = 0x3; gr1->num_members = num_members; - init_uni_hdr(&gr1->hdr_acct_desc, desc_len); - - init_unistr2(&gr1->uni_acct_name, acct_name, acct_len); - init_unistr2(&gr1->uni_acct_desc, acct_desc, desc_len); + 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); } /******************************************************************* @@ -2302,12 +2273,10 @@ inits a GROUP_INFO4 structure. void init_samr_group_info4(GROUP_INFO4 * gr4, char *acct_desc) { - int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - DEBUG(5, ("init_samr_group_info4\n")); - init_uni_hdr(&gr4->hdr_acct_desc, acct_len); - init_unistr2(&gr4->uni_acct_desc, acct_desc, acct_len); + init_unistr2(&gr4->uni_acct_desc, acct_desc, UNI_FLAGS_NONE); + init_uni_hdr(&gr4->hdr_acct_desc, &gr4->uni_acct_desc); } /******************************************************************* @@ -2383,14 +2352,12 @@ void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e, POLICY_HND *pol, char *acct_desc, uint32 access_mask) { - int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - DEBUG(5, ("init_samr_q_create_dom_group\n")); q_e->pol = *pol; - init_uni_hdr(&q_e->hdr_acct_desc, acct_len); - init_unistr2(&q_e->uni_acct_desc, acct_desc, acct_len); + 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; } @@ -3502,18 +3469,15 @@ inits a ALIAS_INFO1 structure. void init_samr_alias_info1(ALIAS_INFO1 * al1, char *acct_name, uint32 num_member, char *acct_desc) { - int acct_len_name = acct_name != NULL ? strlen(acct_name) : 0; - int acct_len_desc = acct_desc != NULL ? strlen(acct_desc) : 0; - DEBUG(5, ("init_samr_alias_info1\n")); - init_uni_hdr(&al1->hdr_acct_name, acct_len_name); - init_unistr2(&al1->uni_acct_name, acct_name, acct_len_name); + init_unistr2(&al1->uni_acct_name, acct_name, UNI_FLAGS_NONE); + init_uni_hdr(&al1->hdr_acct_name, &al1->uni_acct_name); al1->num_member=num_member; - init_uni_hdr(&al1->hdr_acct_desc, acct_len_desc); - init_unistr2(&al1->uni_acct_desc, acct_desc, acct_len_desc); + init_unistr2(&al1->uni_acct_desc, acct_desc, UNI_FLAGS_NONE); + init_uni_hdr(&al1->hdr_acct_desc, &al1->uni_acct_name); } /******************************************************************* @@ -3559,12 +3523,10 @@ inits a ALIAS_INFO3 structure. void init_samr_alias_info3(ALIAS_INFO3 * al3, char *acct_desc) { - int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - DEBUG(5, ("init_samr_alias_info3\n")); - init_uni_hdr(&al3->hdr_acct_desc, acct_len); - init_unistr2(&al3->uni_acct_desc, acct_desc, acct_len); + init_unistr2(&al3->uni_acct_desc, acct_desc, UNI_FLAGS_NONE); + init_uni_hdr(&al3->hdr_acct_desc, &al3->uni_acct_desc); } /******************************************************************* @@ -4272,14 +4234,12 @@ 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, char *acct_desc) { - int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - DEBUG(5, ("init_samr_q_create_dom_alias\n")); q_u->dom_pol = *hnd; - init_uni_hdr(&q_u->hdr_acct_desc, acct_len); - init_unistr2(&q_u->uni_acct_desc, acct_desc, acct_len); + 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 = 0x001f000f; } @@ -4675,9 +4635,8 @@ NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, return NT_STATUS_NO_MEMORY; for (i = 0; i < num_names; i++) { - int len_name = name[i] != NULL ? strlen(name[i]) : 0; - init_uni_hdr(&q_u->hdr_name[i], len_name); /* unicode header for user_name */ - init_unistr2(&q_u->uni_name[i], name[i], len_name); /* unicode string for machine account */ + 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; @@ -5013,15 +4972,12 @@ void init_samr_q_create_user(SAMR_Q_CREATE_USER * q_u, const char *name, uint32 acb_info, uint32 access_mask) { - int len_name; - len_name = strlen(name); - DEBUG(5, ("samr_init_samr_q_create_user\n")); q_u->domain_pol = *pol; - init_uni_hdr(&q_u->hdr_name, len_name); - init_unistr2(&q_u->uni_name, name, len_name); + 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; @@ -5244,16 +5200,11 @@ void init_sam_user_info11(SAM_USER_INFO_11 * usr, char *mach_acct, uint32 rid_user, uint32 rid_group, uint16 acct_ctrl) { - int len_mach_acct; - DEBUG(5, ("init_sam_user_info11\n")); - len_mach_acct = strlen(mach_acct); - - memcpy(&(usr->expiry), expiry, sizeof(usr->expiry)); /* expiry time or something? */ + memcpy(&usr->expiry, expiry, sizeof(usr->expiry)); /* expiry time or something? */ ZERO_STRUCT(usr->padding_1); /* 0 - padding 24 bytes */ - init_uni_hdr(&usr->hdr_mach_acct, len_mach_acct); /* unicode header for machine account */ usr->padding_2 = 0; /* 0 - padding 4 bytes */ usr->ptr_1 = 1; /* pointer */ @@ -5278,7 +5229,8 @@ void init_sam_user_info11(SAM_USER_INFO_11 * usr, 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, len_mach_acct); /* unicode string for machine account */ + 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 */ } /******************************************************************* @@ -5441,17 +5393,6 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z uint16 logon_count, char newpass[516], uint32 unknown_6) { - int len_user_name = user_name != NULL ? user_name->uni_str_len : 0; - int len_full_name = full_name != NULL ? full_name->uni_str_len : 0; - int len_home_dir = home_dir != NULL ? home_dir->uni_str_len : 0; - int len_dir_drive = dir_drive != NULL ? dir_drive->uni_str_len : 0; - int len_logon_script = log_scr != NULL ? log_scr->uni_str_len : 0; - int len_profile_path = prof_path != NULL ? prof_path->uni_str_len : 0; - int len_description = desc != NULL ? desc->uni_str_len : 0; - int len_workstations = wkstas != NULL ? wkstas->uni_str_len : 0; - int len_unknown_str = unk_str != NULL ? unk_str->uni_str_len : 0; - int len_munged_dial = mung_dial != NULL ? mung_dial->uni_str_len : 0; - usr->logon_time = *logon_time; /* all zeros */ usr->logoff_time = *logoff_time; /* all zeros */ usr->kickoff_time = *kickoff_time; /* all zeros */ @@ -5459,17 +5400,6 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z usr->pass_can_change_time = *pass_can_change_time; /* all zeros */ usr->pass_must_change_time = *pass_must_change_time; /* all zeros */ - init_uni_hdr(&usr->hdr_user_name, len_user_name); /* NULL */ - init_uni_hdr(&usr->hdr_full_name, len_full_name); - init_uni_hdr(&usr->hdr_home_dir, len_home_dir); - init_uni_hdr(&usr->hdr_dir_drive, len_dir_drive); - init_uni_hdr(&usr->hdr_logon_script, len_logon_script); - init_uni_hdr(&usr->hdr_profile_path, len_profile_path); - init_uni_hdr(&usr->hdr_acct_desc, len_description); - init_uni_hdr(&usr->hdr_workstations, len_workstations); - init_uni_hdr(&usr->hdr_unknown_str, len_unknown_str); - init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); - ZERO_STRUCT(usr->nt_pwd); ZERO_STRUCT(usr->lm_pwd); @@ -5496,15 +5426,34 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z 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_unknown_str, unk_str); + init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); + copy_unistr2(&usr->uni_munged_dial, mung_dial); + init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); usr->unknown_6 = unknown_6; /* 0x0000 04ec */ usr->padding4 = 0; @@ -5536,17 +5485,6 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z LOGON_HRS * hrs, uint16 bad_password_count, uint16 logon_count, char newpass[516], uint32 unknown_6) { - int len_user_name = user_name != NULL ? strlen(user_name) : 0; - int len_full_name = full_name != NULL ? strlen(full_name) : 0; - int len_home_dir = home_dir != NULL ? strlen(home_dir) : 0; - int len_dir_drive = dir_drive != NULL ? strlen(dir_drive) : 0; - int len_logon_script = log_scr != NULL ? strlen(log_scr) : 0; - int len_profile_path = prof_path != NULL ? strlen(prof_path) : 0; - int len_description = desc != NULL ? strlen(desc) : 0; - int len_workstations = wkstas != NULL ? strlen(wkstas) : 0; - int len_unknown_str = unk_str != NULL ? strlen(unk_str) : 0; - int len_munged_dial = mung_dial != NULL ? strlen(mung_dial) : 0; - usr->logon_time = *logon_time; /* all zeros */ usr->logoff_time = *logoff_time; /* all zeros */ usr->kickoff_time = *kickoff_time; /* all zeros */ @@ -5554,17 +5492,6 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z usr->pass_can_change_time = *pass_can_change_time; /* all zeros */ usr->pass_must_change_time = *pass_must_change_time; /* all zeros */ - init_uni_hdr(&usr->hdr_user_name, len_user_name); /* NULL */ - init_uni_hdr(&usr->hdr_full_name, len_full_name); - init_uni_hdr(&usr->hdr_home_dir, len_home_dir); - init_uni_hdr(&usr->hdr_dir_drive, len_dir_drive); - init_uni_hdr(&usr->hdr_logon_script, len_logon_script); - init_uni_hdr(&usr->hdr_profile_path, len_profile_path); - init_uni_hdr(&usr->hdr_acct_desc, len_description); - init_uni_hdr(&usr->hdr_workstations, len_workstations); - init_uni_hdr(&usr->hdr_unknown_str, len_unknown_str); - init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); - ZERO_STRUCT(usr->nt_pwd); ZERO_STRUCT(usr->lm_pwd); @@ -5590,16 +5517,35 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z memcpy(usr->pass, newpass, sizeof(usr->pass)); - init_unistr2(&usr->uni_user_name, user_name, len_user_name); /* NULL */ - init_unistr2(&usr->uni_full_name, full_name, len_full_name); - init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); - init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); - init_unistr2(&usr->uni_logon_script, log_scr, len_logon_script); - init_unistr2(&usr->uni_profile_path, prof_path, len_profile_path); - init_unistr2(&usr->uni_acct_desc, desc, len_description); - init_unistr2(&usr->uni_workstations, wkstas, len_workstations); - init_unistr2(&usr->uni_unknown_str, unk_str, len_unknown_str); - init_unistr2(&usr->uni_munged_dial, mung_dial, len_munged_dial); + 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_unknown_str, unk_str, UNI_FLAGS_NONE); + init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); + + init_unistr2(&usr->uni_munged_dial, mung_dial, UNI_FLAGS_NONE); + init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); usr->unknown_6 = unknown_6; /* 0x0000 04ec */ usr->padding4 = 0; @@ -5900,17 +5846,6 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, uint16 logon_count, uint32 unknown_6) { - int len_user_name = user_name != NULL ? user_name->uni_str_len : 0; - int len_full_name = full_name != NULL ? full_name->uni_str_len : 0; - int len_home_dir = home_dir != NULL ? home_dir->uni_str_len : 0; - int len_dir_drive = dir_drive != NULL ? dir_drive->uni_str_len : 0; - int len_logon_script = log_scr != NULL ? log_scr->uni_str_len : 0; - int len_profile_path = prof_path != NULL ? prof_path->uni_str_len : 0; - int len_description = desc != NULL ? desc->uni_str_len : 0; - int len_workstations = wkstas != NULL ? wkstas->uni_str_len : 0; - int len_unknown_str = unk_str != NULL ? unk_str->uni_str_len : 0; - int len_munged_dial = mung_dial != NULL ? mung_dial->uni_str_len : 0; - usr->logon_time = *logon_time; usr->logoff_time = *logoff_time; usr->kickoff_time = *kickoff_time; @@ -5918,17 +5853,6 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, usr->pass_can_change_time = *pass_can_change_time; usr->pass_must_change_time = *pass_must_change_time; - init_uni_hdr(&usr->hdr_user_name, len_user_name); - init_uni_hdr(&usr->hdr_full_name, len_full_name); - init_uni_hdr(&usr->hdr_home_dir, len_home_dir); - init_uni_hdr(&usr->hdr_dir_drive, len_dir_drive); - init_uni_hdr(&usr->hdr_logon_script, len_logon_script); - init_uni_hdr(&usr->hdr_profile_path, len_profile_path); - init_uni_hdr(&usr->hdr_acct_desc, len_description); - init_uni_hdr(&usr->hdr_workstations, len_workstations); - init_uni_hdr(&usr->hdr_unknown_str, len_unknown_str); - init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); - memcpy(usr->lm_pwd, lm_pwd, sizeof(usr->lm_pwd)); memcpy(usr->nt_pwd, nt_pwd, sizeof(usr->nt_pwd)); @@ -5952,15 +5876,34 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, 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_unknown_str, unk_str); + init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); + copy_unistr2(&usr->uni_munged_dial, mung_dial); + init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); usr->unknown_6 = unknown_6; /* 0x0000 04ec */ usr->padding4 = 0; @@ -5981,11 +5924,6 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * NTTIME logon_time, logoff_time, kickoff_time, pass_last_set_time, pass_can_change_time, pass_must_change_time; - - int len_user_name, len_full_name, len_home_dir, - len_dir_drive, len_logon_script, len_profile_path, - len_description, len_workstations, len_unknown_str, - len_munged_dial; const char* user_name = pdb_get_username(pw); const char* full_name = pdb_get_fullname(pw); @@ -6003,18 +5941,6 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * uint32 group_rid; const DOM_SID *group_sid; - len_user_name = user_name != NULL ? strlen(user_name )+1 : 0; - len_full_name = full_name != NULL ? strlen(full_name )+1 : 0; - len_home_dir = home_dir != NULL ? strlen(home_dir )+1 : 0; - len_dir_drive = dir_drive != NULL ? strlen(dir_drive )+1 : 0; - len_logon_script = logon_script != NULL ? strlen(logon_script)+1 : 0; - len_profile_path = profile_path != NULL ? strlen(profile_path)+1 : 0; - len_description = description != NULL ? strlen(description )+1 : 0; - len_workstations = workstations != NULL ? strlen(workstations)+1 : 0; - len_unknown_str = 0; - len_munged_dial = munged_dial != NULL ? strlen(munged_dial )+1 : 0; - - /* 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)); @@ -6031,17 +5957,6 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * usr->pass_can_change_time = pass_can_change_time; usr->pass_must_change_time = pass_must_change_time; - init_uni_hdr(&usr->hdr_user_name, len_user_name); - init_uni_hdr(&usr->hdr_full_name, len_full_name); - init_uni_hdr(&usr->hdr_home_dir, len_home_dir); - init_uni_hdr(&usr->hdr_dir_drive, len_dir_drive); - init_uni_hdr(&usr->hdr_logon_script, len_logon_script); - init_uni_hdr(&usr->hdr_profile_path, len_profile_path); - init_uni_hdr(&usr->hdr_acct_desc, len_description); - init_uni_hdr(&usr->hdr_workstations, len_workstations); - init_uni_hdr(&usr->hdr_unknown_str, len_unknown_str); - init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); - ZERO_STRUCT(usr->nt_pwd); ZERO_STRUCT(usr->lm_pwd); @@ -6100,16 +6015,35 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * ZERO_STRUCT(usr->padding1); ZERO_STRUCT(usr->padding2); - init_unistr2(&usr->uni_user_name, user_name, len_user_name); - init_unistr2(&usr->uni_full_name, full_name, len_full_name); - init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); - init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); - init_unistr2(&usr->uni_logon_script, logon_script, len_logon_script); - init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path); - init_unistr2(&usr->uni_acct_desc, description, len_description); - init_unistr2(&usr->uni_workstations, workstations, len_workstations); - init_unistr2(&usr->uni_unknown_str, NULL, len_unknown_str); - init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial); + 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_unknown_str, NULL, UNI_STR_TERMINATE); + init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); + + init_unistr2(&usr->uni_munged_dial, munged_dial, UNI_STR_TERMINATE); + init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); usr->unknown_6 = pdb_get_unknown_6(pw); usr->padding4 = 0; @@ -6249,12 +6183,10 @@ static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, void init_sam_user_info20A(SAM_USER_INFO_20 *usr, SAM_ACCOUNT *pw) { - int len_munged_dial; - const char* munged_dial = pdb_get_munged_dial(pw); + const char *munged_dial = pdb_get_munged_dial(pw); - len_munged_dial = munged_dial != NULL ? strlen(munged_dial )+1 : 0; - init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); - init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial); + init_unistr2(&usr->uni_munged_dial, munged_dial, UNI_STR_TERMINATE); + init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); } @@ -6720,13 +6652,11 @@ inits a SAMR_Q_CONNECT structure. void init_samr_q_connect(SAMR_Q_CONNECT * q_u, char *srv_name, uint32 access_mask) { - int len_srv_name = strlen(srv_name); - DEBUG(5, ("init_samr_q_connect\n")); /* make PDC server name \\server */ - q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0; - init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1); + 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; @@ -6793,13 +6723,11 @@ inits a SAMR_Q_CONNECT4 structure. void init_samr_q_connect4(SAMR_Q_CONNECT4 * q_u, char *srv_name, uint32 access_mask) { - int len_srv_name = strlen(srv_name); - DEBUG(5, ("init_samr_q_connect\n")); /* make PDC server name \\server */ - q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0; - init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1); + 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; @@ -6938,13 +6866,11 @@ 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) { - int len_srv_name = strlen(srv_name); - DEBUG(5, ("init_samr_q_get_dom_pwinfo\n")); q_u->ptr = 1; - init_uni_hdr(&q_u->hdr_srv_name, len_srv_name); - init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name); + 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); } /******************************************************************* @@ -7105,16 +7031,14 @@ void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u, char lm_newpass[516], uchar lm_oldhash[16]) { - int len_dest_host = strlen(dest_host); - int len_user_name = strlen(user_name); - DEBUG(5, ("init_samr_q_chgpasswd_user\n")); q_u->ptr_0 = 1; - init_uni_hdr(&q_u->hdr_dest_host, len_dest_host); - init_unistr2(&q_u->uni_dest_host, dest_host, len_dest_host); - init_uni_hdr(&q_u->hdr_user_name, len_user_name); - init_unistr2(&q_u->uni_user_name, user_name, len_user_name); + 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, nt_newpass); init_enc_hash(&q_u->nt_oldhash, nt_oldhash); diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 7ca9bccab4..65f16414a0 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -916,12 +916,12 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, { DEBUG(5,("make_spoolss_q_open_printer_ex\n")); q_u->printername_ptr = (printername!=NULL)?1:0; - init_unistr2(&q_u->printername, printername, strlen(printername)+1); + init_unistr2(&q_u->printername, printername, UNI_STR_TERMINATE); q_u->printer_default.datatype_ptr = 0; /* q_u->printer_default.datatype_ptr = (datatype!=NULL)?1:0; - init_unistr2(&q_u->printer_default.datatype, datatype, strlen(datatype)); + init_unistr2(&q_u->printer_default.datatype, datatype, UNI_FLAGS_NONE); */ q_u->printer_default.devmode_cont.size=0; q_u->printer_default.devmode_cont.devmode_ptr=0; @@ -937,8 +937,8 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, q_u->user_ctr.user1.major=2; q_u->user_ctr.user1.minor=0; q_u->user_ctr.user1.processor=0; - init_unistr2(&q_u->user_ctr.user1.client_name, clientname, strlen(clientname)+1); - init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)+1); + init_unistr2(&q_u->user_ctr.user1.client_name, clientname, UNI_STR_TERMINATE); + init_unistr2(&q_u->user_ctr.user1.user_name, user_name, UNI_STR_TERMINATE); return True; } @@ -963,7 +963,7 @@ BOOL make_spoolss_q_addprinterex( ZERO_STRUCTP(q_u); q_u->server_name_ptr = (srv_name!=NULL)?1:0; - init_unistr2(&q_u->server_name, srv_name, strlen(srv_name)); + init_unistr2(&q_u->server_name, srv_name, UNI_FLAGS_NONE); q_u->level = level; @@ -991,8 +991,8 @@ BOOL make_spoolss_q_addprinterex( q_u->user_ctr.user1.major=2; q_u->user_ctr.user1.minor=0; q_u->user_ctr.user1.processor=0; - init_unistr2(&q_u->user_ctr.user1.client_name, clientname, strlen(clientname)+1); - init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)+1); + init_unistr2(&q_u->user_ctr.user1.client_name, clientname, UNI_STR_TERMINATE); + init_unistr2(&q_u->user_ctr.user1.user_name, user_name, UNI_STR_TERMINATE); q_u->user_ctr.user1.size=q_u->user_ctr.user1.user_name.uni_str_len + q_u->user_ctr.user1.client_name.uni_str_len + 2; @@ -1187,15 +1187,13 @@ BOOL make_spoolss_q_deleteprinterdriver( /* these must be NULL terminated or else NT4 will complain about invalid parameters --jerry */ - init_unistr2(&q_u->server, server, strlen(server)+1); - init_unistr2(&q_u->arch, arch, strlen(arch)+1); - init_unistr2(&q_u->driver, driver, strlen(driver)+1); - + init_unistr2(&q_u->server, server, UNI_STR_TERMINATE); + init_unistr2(&q_u->arch, arch, UNI_STR_TERMINATE); + init_unistr2(&q_u->driver, driver, UNI_STR_TERMINATE); return True; } - /******************************************************************* * make a structure. ********************************************************************/ @@ -1209,7 +1207,7 @@ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, DEBUG(5,("make_spoolss_q_getprinterdata\n")); q_u->handle = *handle; - init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); + init_unistr2(&q_u->valuename, valuename, UNI_STR_TERMINATE); q_u->size = size; return True; @@ -1229,8 +1227,8 @@ BOOL make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX *q_u, DEBUG(5,("make_spoolss_q_getprinterdataex\n")); q_u->handle = *handle; - init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); - init_unistr2(&q_u->keyname, keyname, strlen(keyname) + 1); + init_unistr2(&q_u->valuename, valuename, UNI_STR_TERMINATE); + init_unistr2(&q_u->keyname, keyname, UNI_STR_TERMINATE); q_u->size = size; return True; @@ -5317,7 +5315,7 @@ BOOL smb_io_unibuffer(const char *desc, UNISTR2 *buffer, prs_struct *ps, int dep { if (buffer==NULL) return False; - buffer->undoc=0; + buffer->offset=0; buffer->uni_str_len=buffer->uni_max_len; if(!prs_uint32("buffer_size", ps, depth, &buffer->uni_max_len)) @@ -5374,7 +5372,7 @@ BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx, DEBUG(5,("make_spoolss_q_addprinterdriver\n")); q_u->server_name_ptr = (srv_name!=NULL)?1:0; - init_unistr2(&q_u->server_name, srv_name, strlen(srv_name)+1); + init_unistr2(&q_u->server_name, srv_name, UNI_STR_TERMINATE); q_u->level = level; @@ -6162,7 +6160,7 @@ BOOL make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u, uint32 size) { memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - init_unistr2(&q_u->key, key, strlen(key)+1); + init_unistr2(&q_u->key, key, UNI_STR_TERMINATE); q_u->size = size; return True; @@ -6175,7 +6173,7 @@ BOOL make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND { memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); q_u->type = data_type; - init_unistr2(&q_u->value, value, strlen(value)+1); + init_unistr2(&q_u->value, value, UNI_STR_TERMINATE); q_u->max_len = q_u->real_len = data_size; q_u->data = (unsigned char *)data; @@ -6191,8 +6189,8 @@ BOOL make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX *q_u, const POLICY { memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); q_u->type = data_type; - init_unistr2(&q_u->value, value, strlen(value)+1); - init_unistr2(&q_u->key, key, strlen(key)+1); + init_unistr2(&q_u->value, value, UNI_STR_TERMINATE); + init_unistr2(&q_u->key, key, UNI_STR_TERMINATE); q_u->max_len = q_u->real_len = data_size; q_u->data = (unsigned char *)data; @@ -6589,7 +6587,7 @@ BOOL make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER *q_u, if (q_u == NULL) return False; - init_unistr2(&q_u->string, string, strlen(string)+1); + init_unistr2(&q_u->string, string, UNI_STR_TERMINATE); q_u->printer=printer; q_u->type=type; @@ -7092,7 +7090,7 @@ BOOL make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u, DEBUG(5,("make_spoolss_q_enumprinterkey\n")); memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - init_unistr2(&q_u->key, key, strlen(key)+1); + init_unistr2(&q_u->key, key, UNI_STR_TERMINATE); q_u->size = size; return True; @@ -7161,7 +7159,7 @@ BOOL make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY *q_u, DEBUG(5,("make_spoolss_q_deleteprinterkey\n")); memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - init_unistr2(&q_u->keyname, keyname, strlen(keyname)+1); + init_unistr2(&q_u->keyname, keyname, UNI_STR_TERMINATE); return True; } @@ -7382,8 +7380,8 @@ BOOL make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTOR { DEBUG(5,("make_spoolss_q_getprintprocessordirectory\n")); - init_unistr2(&q_u->name, name, strlen(name)+1); - init_unistr2(&q_u->environment, environment, strlen(environment)+1); + init_unistr2(&q_u->name, name, UNI_STR_TERMINATE); + init_unistr2(&q_u->environment, environment, UNI_STR_TERMINATE); q_u->level = level; @@ -7509,7 +7507,7 @@ BOOL make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle, q_u->level = level; q_u->level2 = level; memcpy(&q_u->form, form, sizeof(FORM)); - init_unistr2(&q_u->name, form_name, strlen(form_name) + 1); + init_unistr2(&q_u->name, form_name, UNI_STR_TERMINATE); return True; } @@ -7522,7 +7520,7 @@ BOOL make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, const char *form) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); - init_unistr2(&q_u->name, form, strlen(form) + 1); + init_unistr2(&q_u->name, form, UNI_STR_TERMINATE); return True; } @@ -7536,7 +7534,7 @@ BOOL make_spoolss_q_getform(SPOOL_Q_GETFORM *q_u, POLICY_HND *handle, { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); q_u->level = level; - init_unistr2(&q_u->formname, formname, strlen(formname) + 1); + init_unistr2(&q_u->formname, formname, UNI_STR_TERMINATE); q_u->buffer=buffer; q_u->offered=offered; @@ -7642,17 +7640,9 @@ BOOL make_spoolss_q_startdocprinter(SPOOL_Q_STARTDOCPRINTER *q_u, ctr->docinfo.doc_info_1.p_outputfile = outputfile ? 1 : 0; ctr->docinfo.doc_info_1.p_datatype = datatype ? 1 : 0; - if (docname) - init_unistr2(&ctr->docinfo.doc_info_1.docname, docname, - strlen(docname) + 1); - - if (outputfile) - init_unistr2(&ctr->docinfo.doc_info_1.outputfile, outputfile, - strlen(outputfile) + 1); - - if (datatype) - init_unistr2(&ctr->docinfo.doc_info_1.datatype, datatype, - strlen(datatype) + 1); + init_unistr2(&ctr->docinfo.doc_info_1.docname, docname, UNI_STR_TERMINATE); + init_unistr2(&ctr->docinfo.doc_info_1.outputfile, outputfile, UNI_STR_TERMINATE); + init_unistr2(&ctr->docinfo.doc_info_1.datatype, datatype, UNI_STR_TERMINATE); break; case 2: @@ -7701,7 +7691,7 @@ BOOL make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA *q_u, POLICY_HND *handle, char *valuename) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); - init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); + init_unistr2(&q_u->valuename, valuename, UNI_STR_TERMINATE); return True; } @@ -7715,8 +7705,8 @@ BOOL make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX *q_u, char *value) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); - init_unistr2(&q_u->valuename, value, strlen(value) + 1); - init_unistr2(&q_u->keyname, key, strlen(key) + 1); + init_unistr2(&q_u->valuename, value, UNI_STR_TERMINATE); + init_unistr2(&q_u->keyname, key, UNI_STR_TERMINATE); return True; } @@ -7736,8 +7726,7 @@ BOOL make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle, q_u->localmachine_ptr = 1; - init_unistr2(&q_u->localmachine, localmachine, - strlen(localmachine) + 1); + init_unistr2(&q_u->localmachine, localmachine, UNI_STR_TERMINATE); q_u->printerlocal = printerlocal; diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index bbb5193ddc..6349fc1632 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -36,8 +36,7 @@ void init_srv_share_info0_str(SH_INFO_0_STR *sh0, const char *net_name) { DEBUG(5,("init_srv_share_info0_str\n")); - if(net_name) - init_unistr2(&sh0->uni_netname, net_name, strlen(net_name)+1); + init_unistr2(&sh0->uni_netname, net_name, UNI_STR_TERMINATE); } /******************************************************************* @@ -101,10 +100,8 @@ void init_srv_share_info1_str(SH_INFO_1_STR *sh1, const char *net_name, const ch { DEBUG(5,("init_srv_share_info1_str\n")); - if(net_name) - init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1); - if(remark) - init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh1->uni_netname, net_name, UNI_STR_TERMINATE); + init_unistr2(&sh1->uni_remark, remark, UNI_STR_TERMINATE); } /******************************************************************* @@ -184,14 +181,10 @@ void init_srv_share_info2_str(SH_INFO_2_STR *sh2, { DEBUG(5,("init_srv_share_info2_str\n")); - if (net_name) - init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1); - if (remark) - init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1); - if (path) - init_unistr2(&sh2->uni_path, path, strlen(path)+1); - if (passwd) - init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1); + init_unistr2(&sh2->uni_netname, net_name, UNI_STR_TERMINATE); + init_unistr2(&sh2->uni_remark, remark, UNI_STR_TERMINATE); + init_unistr2(&sh2->uni_path, path, UNI_STR_TERMINATE); + init_unistr2(&sh2->uni_passwd, passwd, UNI_STR_TERMINATE); } /******************************************************************* @@ -296,10 +289,8 @@ void init_srv_share_info501_str(SH_INFO_501_STR *sh501, { DEBUG(5,("init_srv_share_info501_str\n")); - if(net_name) - init_unistr2(&sh501->uni_netname, net_name, strlen(net_name)+1); - if(remark) - init_unistr2(&sh501->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh501->uni_netname, net_name, UNI_STR_TERMINATE); + init_unistr2(&sh501->uni_remark, remark, UNI_STR_TERMINATE); } /******************************************************************* @@ -446,17 +437,13 @@ void init_srv_share_info502_str(SH_INFO_502_STR *sh502str, { DEBUG(5,("init_srv_share_info502_str\n")); - if(net_name) - init_unistr2(&sh502str->uni_netname, net_name, strlen(net_name)+1); - if(remark) - init_unistr2(&sh502str->uni_remark, remark, strlen(remark)+1); - if(path) - init_unistr2(&sh502str->uni_path, path, strlen(path)+1); - if(passwd) - init_unistr2(&sh502str->uni_passwd, passwd, strlen(passwd)+1); - sh502str->sd = psd; + init_unistr2(&sh502str->uni_netname, net_name, UNI_STR_TERMINATE); + init_unistr2(&sh502str->uni_remark, remark, UNI_STR_TERMINATE); + init_unistr2(&sh502str->uni_path, path, UNI_STR_TERMINATE); + init_unistr2(&sh502str->uni_passwd, passwd, UNI_STR_TERMINATE); + sh502str->sd = psd; sh502str->reserved = 0; - sh502str->sd_size = sd_size; + sh502str->sd_size = sd_size; } /******************************************************************* @@ -551,8 +538,7 @@ void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, const char *remark) { DEBUG(5,("init_srv_share_info1004_str\n")); - if(remark) - init_unistr2(&sh1004->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh1004->uni_remark, remark, UNI_STR_TERMINATE); } /******************************************************************* @@ -659,8 +645,7 @@ void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate { DEBUG(5,("init_srv_share_info1007_str\n")); - if(alternate_directory_name) - init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, strlen(alternate_directory_name)+1); + init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, UNI_STR_TERMINATE); } /******************************************************************* @@ -1474,7 +1459,7 @@ void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname, const char *path, const char *passwd) { q->ptr_srv_name = 1; - init_unistr2(&q->uni_srv_name, srvname, strlen(srvname) +1); + init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE); q->info.switch_value = q->info_level = 2; q->info.ptr_share_ctr = 1; @@ -1525,8 +1510,8 @@ void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname, const char *sharename) { del->ptr_srv_name = 1; - init_unistr2(&del->uni_srv_name, srvname, strlen(srvname) +1 ); - init_unistr2(&del->uni_share_name, sharename, strlen(sharename) + 1); + init_unistr2(&del->uni_srv_name, srvname, UNI_STR_TERMINATE); + init_unistr2(&del->uni_share_name, sharename, UNI_STR_TERMINATE); } /******************************************************************* @@ -1589,7 +1574,7 @@ void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, const char *name) { DEBUG(5,("init_srv_sess_info0_str\n")); - init_unistr2(&ss0->uni_name, name, strlen(name)+1); + init_unistr2(&ss0->uni_name, name, UNI_STR_TERMINATE); } /******************************************************************* @@ -1703,8 +1688,8 @@ void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, const char *name, const char { DEBUG(5,("init_srv_sess_info1_str\n")); - init_unistr2(&ss1->uni_name, name, strlen(name)+1); - init_unistr2(&ss1->uni_user, user, strlen(user)+1); + init_unistr2(&ss1->uni_name, name, UNI_STR_TERMINATE); + init_unistr2(&ss1->uni_user, user, UNI_STR_TERMINATE); } /******************************************************************* @@ -2075,8 +2060,8 @@ void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, const char *usr_name, const c { DEBUG(5,("init_srv_conn_info1_str\n")); - init_unistr2(&ss1->uni_usr_name, usr_name, strlen(usr_name)+1); - init_unistr2(&ss1->uni_net_name, net_name, strlen(net_name)+1); + init_unistr2(&ss1->uni_usr_name, usr_name, UNI_STR_TERMINATE); + init_unistr2(&ss1->uni_net_name, net_name, UNI_STR_TERMINATE); } /******************************************************************* @@ -2365,8 +2350,8 @@ void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, const char *user_name, const { DEBUG(5,("init_srv_file_info3_str\n")); - init_unistr2(&fi3->uni_path_name, path_name, strlen(path_name)+1); - init_unistr2(&fi3->uni_user_name, user_name, strlen(user_name)+1); + init_unistr2(&fi3->uni_path_name, path_name, UNI_STR_TERMINATE); + init_unistr2(&fi3->uni_user_name, user_name, UNI_STR_TERMINATE); } /******************************************************************* @@ -2628,7 +2613,7 @@ void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, const char *server, uint32 file_id) { q_n->ptr_srv_name = 1; - init_unistr2(&q_n->uni_srv_name, server, strlen(server) + 1); + init_unistr2(&q_n->uni_srv_name, server, UNI_STR_TERMINATE); q_n->file_id = file_id; } @@ -3586,6 +3571,5 @@ BOOL srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server) { q_u->ptr_srv_name = 1; - init_unistr2(&q_u->uni_srv_name, server, strlen(server) + 1); + init_unistr2(&q_u->uni_srv_name, server, UNI_STR_TERMINATE); } - -- cgit From 5400952f7f74d6e656fcf4ded173868ecec3cb77 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 29 Sep 2003 06:17:09 +0000 Subject: Merge from 3.0: >Fix for #480. Change the interface for init_unistr2 to not take a length >but a flags field. We were assuming that 2*strlen(mb_string) == length of ucs2-le string. >This is not the case. Count it after conversion. >Jeremy. (This used to be commit e2ab9e54cd0ec0002175cf18ff364f4aebaf85a0) --- source3/rpc_parse/parse_dfs.c | 20 +- source3/rpc_parse/parse_ds.c | 6 +- source3/rpc_parse/parse_lsa.c | 39 +--- source3/rpc_parse/parse_misc.c | 98 ++++----- source3/rpc_parse/parse_net.c | 108 ++++------ source3/rpc_parse/parse_reg.c | 64 +++--- source3/rpc_parse/parse_samr.c | 416 ++++++++++++++++---------------------- source3/rpc_parse/parse_spoolss.c | 79 ++++---- source3/rpc_parse/parse_srv.c | 74 +++---- 9 files changed, 367 insertions(+), 537 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index 6f13500359..0d0ce557b2 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -80,9 +80,9 @@ BOOL init_dfs_q_dfs_remove(DFS_Q_DFS_REMOVE *q_d, const char *entrypath, const char *servername, const char *sharename) { DEBUG(5,("init_dfs_q_dfs_remove\n")); - init_unistr2(&q_d->DfsEntryPath, entrypath, strlen(entrypath)+1); - init_unistr2(&q_d->ServerName, servername, strlen(servername)+1); - init_unistr2(&q_d->ShareName, sharename, strlen(sharename)+1); + init_unistr2(&q_d->DfsEntryPath, entrypath, UNI_STR_TERMINATE); + init_unistr2(&q_d->ServerName, servername, UNI_STR_TERMINATE); + init_unistr2(&q_d->ShareName, sharename, UNI_STR_TERMINATE); q_d->ptr_ServerName = q_d->ptr_ShareName = 1; return True; } @@ -155,11 +155,11 @@ BOOL init_dfs_q_dfs_add(DFS_Q_DFS_ADD *q_d, const char *entrypath, { DEBUG(5,("init_dfs_q_dfs_add\n")); q_d->ptr_DfsEntryPath = q_d->ptr_ServerName = q_d->ptr_ShareName = 1; - init_unistr2(&q_d->DfsEntryPath, entrypath, strlen(entrypath)+1); - init_unistr2(&q_d->ServerName, servername, strlen(servername)+1); - init_unistr2(&q_d->ShareName, sharename, strlen(sharename)+1); + init_unistr2(&q_d->DfsEntryPath, entrypath, UNI_STR_TERMINATE); + init_unistr2(&q_d->ServerName, servername, UNI_STR_TERMINATE); + init_unistr2(&q_d->ShareName, sharename, UNI_STR_TERMINATE); if(comment != NULL) { - init_unistr2(&q_d->Comment, comment, strlen(comment)+1); + init_unistr2(&q_d->Comment, comment,UNI_STR_TERMINATE); q_d->ptr_Comment = 1; } else { q_d->ptr_Comment = 0; @@ -237,9 +237,9 @@ BOOL init_dfs_q_dfs_get_info(DFS_Q_DFS_GET_INFO *q_d, const char *entrypath, uint32 info_level) { DEBUG(5,("init_dfs_q2_get_info\n")); - init_unistr2(&q_d->uni_path, entrypath, strlen(entrypath)+1); - init_unistr2(&q_d->uni_server, servername, strlen(servername)+1); - init_unistr2(&q_d->uni_share, sharename, strlen(sharename)+1); + init_unistr2(&q_d->uni_path, entrypath, UNI_STR_TERMINATE); + init_unistr2(&q_d->uni_server, servername, UNI_STR_TERMINATE); + init_unistr2(&q_d->uni_share, sharename, UNI_STR_TERMINATE); q_d->level = info_level; q_d->ptr_server = q_d->ptr_share = 1; return True; diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index f954806036..26dcdb34b8 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -138,8 +138,6 @@ BOOL ds_io_r_getprimdominfo( const char *desc, prs_struct *ps, int depth, DS_R_G BOOL init_q_ds_enum_domain_trusts( DS_Q_ENUM_DOM_TRUSTS *q, const char *server, uint32 flags ) { - int len; - q->flags = flags; if ( server && *server ) @@ -147,9 +145,7 @@ BOOL init_q_ds_enum_domain_trusts( DS_Q_ENUM_DOM_TRUSTS *q, const char *server, else q->server_ptr = 0; - len = q->server_ptr ? strlen(server)+1 : 0; - - init_unistr2( &q->server, server, len ); + init_unistr2( &q->server, server, UNI_STR_TERMINATE); return True; } diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 07b0da7e9c..3a5b232dc3 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -36,14 +36,9 @@ static BOOL lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, prs_s void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, uint16 sid_name_use, const char *name, uint32 idx) { - int len_name = strlen(name); - - if(len_name == 0) - len_name = 1; - trn->sid_name_use = sid_name_use; - init_uni_hdr(&trn->hdr_name, len_name); - init_unistr2(uni_name, name, len_name); + init_unistr2(uni_name, name, UNI_FLAGS_NONE); + init_uni_hdr(&trn->hdr_name, uni_name); trn->domain_idx = idx; } @@ -346,8 +341,7 @@ void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, const char *server_name, r_q->des_access = desired_access; - init_unistr2(&r_q->uni_server_name, server_name, - strlen(server_name) + 1); + init_unistr2(&r_q->uni_server_name, server_name, UNI_STR_TERMINATE); init_lsa_obj_attr(&r_q->attr, attributes, qos); } @@ -566,10 +560,10 @@ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 en /* don't know what actually is this for */ r_e->ptr_enum_domains = 1; - init_uni_hdr2(&r_e->hdr_domain_name[i], strlen_w((td[i])->name)); init_dom_sid2(&r_e->domain_sid[i], &(td[i])->sid); init_unistr2_w(ctx, &r_e->uni_domain_name[i], (td[i])->name); + init_uni_hdr2(&r_e->hdr_domain_name[i], &r_e->uni_domain_name[i]); }; } @@ -1087,11 +1081,8 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, } for (i = 0; i < num_names; i++) { - int len; - len = strlen(names[i]); - - init_uni_hdr(&q_l->hdr_name[i], len); - init_unistr2(&q_l->uni_name[i], names[i], len); + 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]); } } @@ -1436,15 +1427,10 @@ BOOL lsa_io_r_enum_privs(const char *desc, LSA_R_ENUM_PRIVS *r_q, prs_struct *ps 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) { - int len_name = strlen(name); - - if(len_name == 0) - len_name = 1; - memcpy(&trn->pol, hnd, sizeof(trn->pol)); - init_uni_hdr(&trn->hdr_name, len_name); - init_unistr2(&trn->name, name, len_name); + 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; } @@ -1954,14 +1940,9 @@ BOOL lsa_io_r_setsystemaccount(const char *desc, LSA_R_SETSYSTEMACCOUNT *r_c, p void init_lsa_q_lookupprivvalue(LSA_Q_LOOKUPPRIVVALUE *trn, POLICY_HND *hnd, const char *name) { - int len_name = strlen(name); memcpy(&trn->pol, hnd, sizeof(trn->pol)); - - if(len_name == 0) - len_name = 1; - - init_uni_hdr(&trn->hdr_right, len_name); - init_unistr2(&trn->uni2_right, name, len_name); + init_unistr2(&trn->uni2_right, name, UNI_FLAGS_NONE); + init_uni_hdr(&trn->hdr_right, &trn->uni2_right); } /******************************************************************* diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 17a96fff80..e182535532 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -361,11 +361,11 @@ BOOL smb_io_strhdr(const char *desc, STRHDR *hdr, prs_struct *ps, int depth) Inits a UNIHDR structure. ********************************************************************/ -void init_uni_hdr(UNIHDR *hdr, int len) +void init_uni_hdr(UNIHDR *hdr, UNISTR2 *str2) { - hdr->uni_str_len = 2 * len; - hdr->uni_max_len = 2 * len; - hdr->buffer = len != 0 ? 1 : 0; + hdr->uni_str_len = 2 * (str2->uni_str_len); + hdr->uni_max_len = 2 * (str2->uni_max_len); + hdr->buffer = (str2->uni_str_len != 0) ? 1 : 0; } /******************************************************************* @@ -482,10 +482,10 @@ BOOL smb_io_hdrbuf(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth) creates a UNIHDR2 structure. ********************************************************************/ -void init_uni_hdr2(UNIHDR2 *hdr, int len) +void init_uni_hdr2(UNIHDR2 *hdr, UNISTR2 *str2) { - init_uni_hdr(&hdr->unihdr, len); - hdr->buffer = (len > 0) ? 1 : 0; + init_uni_hdr(&hdr->unihdr, str2); + hdr->buffer = (str2->uni_str_len > 0) ? 1 : 0; } /******************************************************************* @@ -703,7 +703,7 @@ void init_buffer2(BUFFER2 *str, const uint8 *buf, size_t len) /* max buffer size (allocated size) */ str->buf_max_len = len; - str->undoc = 0; + str->offset = 0; str->buf_len = buf != NULL ? len : 0; if (buf != NULL) { @@ -737,7 +737,7 @@ BOOL smb_io_buffer2(const char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct * if(!prs_uint32("uni_max_len", ps, depth, &buf2->buf_max_len)) return False; - if(!prs_uint32("undoc ", ps, depth, &buf2->undoc)) + if(!prs_uint32("offset ", ps, depth, &buf2->offset)) return False; if(!prs_uint32("buf_len ", ps, depth, &buf2->buf_len)) return False; @@ -765,14 +765,11 @@ creates a UNISTR2 structure: sets up the buffer, too void init_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf) { if (buf != NULL) { - *ptr = 1; - init_unistr2(str, buf, strlen(buf)+1); - + init_unistr2(str, buf, UNI_STR_TERMINATE); } else { - *ptr = 0; - init_unistr2(str, "", 0); + init_unistr2(str, NULL, UNI_FLAGS_NONE); } } @@ -783,10 +780,8 @@ void init_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf) void copy_unistr2(UNISTR2 *str, const UNISTR2 *from) { - - /* set up string lengths. add one if string is not null-terminated */ str->uni_max_len = from->uni_max_len; - str->undoc = from->undoc; + str->offset = from->offset; str->uni_str_len = from->uni_str_len; if (from->buffer == NULL) @@ -803,8 +798,7 @@ void copy_unistr2(UNISTR2 *str, const UNISTR2 *from) len *= sizeof(uint16); str->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len); - if ((str->buffer == NULL) && (len > 0 )) - { + if ((str->buffer == NULL) && (len > 0 )) { smb_panic("copy_unistr2: talloc fail\n"); return; } @@ -824,7 +818,7 @@ void init_string2(STRING2 *str, const char *buf, int max_len, int str_len) /* set up string lengths. */ str->str_max_len = max_len; - str->undoc = 0; + str->offset = 0; str->str_str_len = str_len; /* store the string */ @@ -835,7 +829,7 @@ void init_string2(STRING2 *str, const char *buf, int max_len, int str_len) if (str->buffer == NULL) smb_panic("init_string2: malloc fail\n"); memcpy(str->buffer, buf, str_len); - } + } } /******************************************************************* @@ -860,7 +854,7 @@ BOOL smb_io_string2(const char *desc, STRING2 *str2, uint32 buffer, prs_struct * if(!prs_uint32("str_max_len", ps, depth, &str2->str_max_len)) return False; - if(!prs_uint32("undoc ", ps, depth, &str2->undoc)) + if(!prs_uint32("offset ", ps, depth, &str2->offset)) return False; if(!prs_uint32("str_str_len", ps, depth, &str2->str_str_len)) return False; @@ -885,34 +879,43 @@ BOOL smb_io_string2(const char *desc, STRING2 *str2, uint32 buffer, prs_struct * Inits a UNISTR2 structure. ********************************************************************/ -void init_unistr2(UNISTR2 *str, const char *buf, size_t len) +void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) { - ZERO_STRUCTP(str); + size_t len = 0; + uint32 num_chars = 0; - /* set up string lengths. */ - str->uni_max_len = (uint32)len; - str->undoc = 0; - str->uni_str_len = (uint32)len; + if (buf) { + /* We always null terminate the copy. */ + len = strlen(buf) + 1; + } if (len < MAX_UNISTRLEN) len = MAX_UNISTRLEN; len *= sizeof(uint16); str->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len); - if ((str->buffer == NULL) && (len > 0)) - { + if ((str->buffer == NULL) && (len > 0)) { smb_panic("init_unistr2: malloc fail\n"); return; } /* - * don't move this test above ! The UNISTR2 must be initialized !!! + * The UNISTR2 must be initialized !!! * jfm, 7/7/2001. */ - if (buf==NULL) - return; + if (buf) { + rpcstr_push((char *)str->buffer, buf, len, STR_TERMINATE); + num_chars = strlen_w(str->buffer); + if (flags == STR_TERMINATE || flags == UNI_MAXLEN_TERMINATE) { + num_chars++; + } + } - rpcstr_push((char *)str->buffer, buf, len, STR_TERMINATE); + str->uni_max_len = num_chars; + str->offset = 0; + str->uni_str_len = num_chars; + if (num_chars && (flags == UNI_MAXLEN_TERMINATE)) + str->uni_max_len++; } /** @@ -932,7 +935,7 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) /* set up string lengths. */ str->uni_max_len = len; - str->undoc = 0; + str->offset = 0; str->uni_str_len = len; if (max_len < MAX_UNISTRLEN) @@ -941,8 +944,7 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) alloc_len = (max_len + 1) * sizeof(uint16); str->buffer = (uint16 *)talloc_zero(ctx, alloc_len); - if ((str->buffer == NULL) && (alloc_len > 0)) - { + if ((str->buffer == NULL) && (alloc_len > 0)) { smb_panic("init_unistr2_w: malloc fail\n"); return; } @@ -963,9 +965,9 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) /******************************************************************* Inits a UNISTR2 structure from a UNISTR ********************************************************************/ -void init_unistr2_from_unistr (UNISTR2 *to, const UNISTR *from) -{ +void init_unistr2_from_unistr(UNISTR2 *to, const UNISTR *from) +{ uint32 i; /* the destination UNISTR2 should never be NULL. @@ -987,7 +989,7 @@ void init_unistr2_from_unistr (UNISTR2 *to, const UNISTR *from) /* set up string lengths; uni_max_len is set to i+1 because we need to account for the final NULL termination */ to->uni_max_len = i; - to->undoc = 0; + to->offset = 0; to->uni_str_len = i; /* allocate the space and copy the string buffer */ @@ -995,11 +997,9 @@ void init_unistr2_from_unistr (UNISTR2 *to, const UNISTR *from) if (to->buffer == NULL) smb_panic("init_unistr2_from_unistr: malloc fail\n"); memcpy(to->buffer, from->buffer, to->uni_max_len*sizeof(uint16)); - return; } - /******************************************************************* Reads or writes a UNISTR2 structure. XXXX NOTE: UNISTR2 structures need NOT be null-terminated. @@ -1022,7 +1022,7 @@ BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct * if(!prs_uint32("uni_max_len", ps, depth, &uni2->uni_max_len)) return False; - if(!prs_uint32("undoc ", ps, depth, &uni2->undoc)) + if(!prs_uint32("offset ", ps, depth, &uni2->offset)) return False; if(!prs_uint32("uni_str_len", ps, depth, &uni2->uni_str_len)) return False; @@ -1064,7 +1064,7 @@ BOOL init_unistr2_array(UNISTR2_ARRAY *array, } for (i=0;istrings[i].string, strings[i], strlen(strings[i])); + init_unistr2(&array->strings[i].string, strings[i], UNI_FLAGS_NONE); array->strings[i].size = array->strings[i].string.uni_max_len*2; array->strings[i].length = array->strings[i].size; array->strings[i].ref_id = 1; @@ -1223,14 +1223,14 @@ static void init_clnt_srv(DOM_CLNT_SRV *logcln, const char *logon_srv, const cha if (logon_srv != NULL) { logcln->undoc_buffer = 1; - init_unistr2(&logcln->uni_logon_srv, logon_srv, strlen(logon_srv)+1); + init_unistr2(&logcln->uni_logon_srv, logon_srv, UNI_STR_TERMINATE); } else { logcln->undoc_buffer = 0; } if (comp_name != NULL) { logcln->undoc_buffer2 = 1; - init_unistr2(&logcln->uni_comp_name, comp_name, strlen(comp_name)+1); + init_unistr2(&logcln->uni_comp_name, comp_name, UNI_STR_TERMINATE); } else { logcln->undoc_buffer2 = 0; } @@ -1284,12 +1284,12 @@ void init_log_info(DOM_LOG_INFO *loginfo, const char *logon_srv, const char *acc loginfo->undoc_buffer = 1; - init_unistr2(&loginfo->uni_logon_srv, logon_srv, strlen(logon_srv)+1); - init_unistr2(&loginfo->uni_acct_name, acct_name, strlen(acct_name)+1); + init_unistr2(&loginfo->uni_logon_srv, logon_srv, UNI_STR_TERMINATE); + init_unistr2(&loginfo->uni_acct_name, acct_name, UNI_STR_TERMINATE); loginfo->sec_chan = sec_chan; - init_unistr2(&loginfo->uni_comp_name, comp_name, strlen(comp_name)+1); + init_unistr2(&loginfo->uni_comp_name, comp_name, UNI_STR_TERMINATE); } /******************************************************************* diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index dd319df5a0..3b096e088a 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -136,16 +136,15 @@ static BOOL net_io_netinfo_1(const char *desc, NETLOGON_INFO_1 *info, prs_struct static void init_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status, uint32 tc_status, const char *trusted_dc_name) { - int len_dc_name = strlen(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, len_dc_name+1); + init_unistr2(&info->uni_trusted_dc_name, trusted_dc_name, UNI_STR_TERMINATE); else - init_unistr2(&info->uni_trusted_dc_name, "", 1); + init_unistr2(&info->uni_trusted_dc_name, "", UNI_STR_TERMINATE); } /******************************************************************* @@ -230,7 +229,7 @@ void init_net_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, const char *srv_name, q_l->query_level = query_level; q_l->switch_value = 0x01; - init_unistr2(&q_l->uni_server_name, srv_name, strlen(srv_name) + 1); + init_unistr2(&q_l->uni_server_name, srv_name, UNI_STR_TERMINATE); } /******************************************************************* @@ -360,7 +359,7 @@ void init_net_q_logon_ctrl(NET_Q_LOGON_CTRL *q_l, const char *srv_name, q_l->function_code = 0x01; /* ??? */ q_l->query_level = query_level; - init_unistr2(&q_l->uni_server_name, srv_name, strlen(srv_name) + 1); + init_unistr2(&q_l->uni_server_name, srv_name, UNI_STR_TERMINATE); } /******************************************************************* @@ -447,9 +446,9 @@ void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, fstring domain_name; fstrcpy(domain_name, dom_name); strupper_m(domain_name); - init_unistr2(&r_t->uni_trust_dom_name[i], domain_name, strlen(domain_name)+1); + 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].undoc = 0x1; + r_t->uni_trust_dom_name[i].offset = 0x1; } r_t->status = NT_STATUS_OK; @@ -539,8 +538,8 @@ void init_q_req_chal(NET_Q_REQ_CHAL *q_c, q_c->undoc_buffer = 1; /* don't know what this buffer is */ - init_unistr2(&q_c->uni_logon_srv, logon_srv , strlen(logon_srv )+1); - init_unistr2(&q_c->uni_logon_clnt, logon_clnt, strlen(logon_clnt)+1); + 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)); @@ -910,10 +909,6 @@ void init_id_info1(NET_ID_INFO_1 *id, const char *domain_name, const char *sess_key, unsigned char lm_cypher[16], unsigned char nt_cypher[16]) { - int len_domain_name = strlen(domain_name); - int len_user_name = strlen(user_name ); - int len_wksta_name = strlen(wksta_name ); - unsigned char lm_owf[16]; unsigned char nt_owf[16]; @@ -921,13 +916,9 @@ void init_id_info1(NET_ID_INFO_1 *id, const char *domain_name, id->ptr_id_info1 = 1; - init_uni_hdr(&id->hdr_domain_name, len_domain_name); - id->param_ctrl = param_ctrl; init_logon_id(&id->logon_id, log_id_low, log_id_high); - init_uni_hdr(&id->hdr_user_name, len_user_name); - init_uni_hdr(&id->hdr_wksta_name, len_wksta_name); if (lm_cypher && nt_cypher) { unsigned char key[16]; @@ -962,9 +953,12 @@ void init_id_info1(NET_ID_INFO_1 *id, const char *domain_name, init_owf_info(&id->lm_owf, lm_cypher); init_owf_info(&id->nt_owf, nt_cypher); - init_unistr2(&id->uni_domain_name, domain_name, len_domain_name); - init_unistr2(&id->uni_user_name, user_name, len_user_name); - init_unistr2(&id->uni_wksta_name, wksta_name, len_wksta_name); + 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); } /******************************************************************* @@ -1041,9 +1035,6 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, const uchar * lm_chal_resp, size_t lm_chal_resp_len, const uchar * nt_chal_resp, size_t nt_chal_resp_len) { - size_t len_domain_name = strlen(domain_name); - size_t len_user_name = strlen(user_name ); - size_t len_wksta_name = strlen(wksta_name ); unsigned char lm_owf[24]; unsigned char nt_owf[128]; @@ -1051,14 +1042,10 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, id->ptr_id_info2 = 1; - init_uni_hdr(&id->hdr_domain_name, len_domain_name); id->param_ctrl = param_ctrl; init_logon_id(&id->logon_id, log_id_low, log_id_high); - init_uni_hdr(&id->hdr_user_name, len_user_name); - init_uni_hdr(&id->hdr_wksta_name, len_wksta_name); - if (nt_chal_resp) { /* oops. can only send what-ever-it-is direct */ memcpy(nt_owf, nt_chal_resp, MIN(sizeof(nt_owf), nt_chal_resp_len)); @@ -1074,9 +1061,12 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, 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, len_domain_name); - init_unistr2(&id->uni_user_name, user_name, len_user_name); - init_unistr2(&id->uni_wksta_name, wksta_name, len_wksta_name); + 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); @@ -1288,26 +1278,10 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, pass_last_set_time, pass_can_change_time, pass_must_change_time; - int len_user_name, len_full_name, len_home_dir, - len_dir_drive, len_logon_script, len_profile_path; - - int len_logon_srv = strlen(logon_srv); - int len_logon_dom = strlen(logon_dom); - - len_user_name = strlen(user_name ); - len_full_name = strlen(full_name ); - len_home_dir = strlen(home_dir ); - len_dir_drive = strlen(dir_drive ); - len_logon_script = strlen(logon_script); - len_profile_path = strlen(profile_path); - - 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); @@ -1323,13 +1297,6 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, usr->pass_can_change_time = pass_can_change_time; usr->pass_must_change_time = pass_must_change_time; - init_uni_hdr(&usr->hdr_user_name, len_user_name); - init_uni_hdr(&usr->hdr_full_name, len_full_name); - init_uni_hdr(&usr->hdr_logon_script, len_logon_script); - init_uni_hdr(&usr->hdr_profile_path, len_profile_path); - init_uni_hdr(&usr->hdr_home_dir, len_home_dir); - init_uni_hdr(&usr->hdr_dir_drive, len_dir_drive); - usr->logon_count = logon_count; usr->bad_pw_count = bad_pw_count; @@ -1345,9 +1312,6 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, else memset((char *)usr->user_sess_key, '\0', sizeof(usr->user_sess_key)); - init_uni_hdr(&usr->hdr_logon_srv, len_logon_srv); - init_uni_hdr(&usr->hdr_logon_dom, len_logon_dom); - usr->buffer_dom_id = dom_sid ? 1 : 0; /* yes, we're bothering to put a domain SID in */ memset((char *)usr->padding, '\0', sizeof(usr->padding)); @@ -1357,12 +1321,18 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, 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, len_user_name); - init_unistr2(&usr->uni_full_name, full_name, len_full_name); - init_unistr2(&usr->uni_logon_script, logon_script, len_logon_script); - init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path); - init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); - init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); + 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; @@ -1373,8 +1343,10 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, for (i = 0; i < num_groups; i++) usr->gids[i] = gids[i]; - init_unistr2(&usr->uni_logon_srv, logon_srv, len_logon_srv); - init_unistr2(&usr->uni_logon_dom, logon_dom, len_logon_dom); + 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 */ @@ -1670,8 +1642,8 @@ BOOL init_net_q_sam_sync(NET_Q_SAM_SYNC * q_s, const char *srv_name, { DEBUG(5, ("init_q_sam_sync\n")); - init_unistr2(&q_s->uni_srv_name, srv_name, strlen(srv_name) + 1); - init_unistr2(&q_s->uni_cli_name, cli_name, strlen(cli_name) + 1); + 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)); @@ -2858,8 +2830,8 @@ BOOL init_net_q_sam_deltas(NET_Q_SAM_DELTAS *q_s, const char *srv_name, { DEBUG(5, ("init_net_q_sam_deltas\n")); - init_unistr2(&q_s->uni_srv_name, srv_name, strlen(srv_name) + 1); - init_unistr2(&q_s->uni_cli_name, cli_name, strlen(cli_name) + 1); + 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)); diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index bbf6e6a8e3..69c0dfc754 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -281,18 +281,15 @@ void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, char *name, char *class, SEC_ACCESS *sam_access, SEC_DESC_BUF *sec_buf) { - int len_name = name != NULL ? strlen(name ) + 1: 0; - int len_class = class != NULL ? strlen(class) + 1: 0; - ZERO_STRUCTP(q_c); memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); - init_uni_hdr(&q_c->hdr_name, len_name); - init_unistr2(&q_c->uni_name, name, len_name); + init_unistr2(&q_c->uni_name, name, UNI_STR_TERMINATE); + init_uni_hdr(&q_c->hdr_name, &q_c->uni_name); - init_uni_hdr(&q_c->hdr_class, len_class); - init_unistr2(&q_c->uni_class, class, len_class); + init_unistr2(&q_c->uni_class, class, UNI_STR_TERMINATE); + init_uni_hdr(&q_c->hdr_class, &q_c->uni_class); q_c->reserved = 0x00000000; memcpy(&q_c->sam_access, sam_access, sizeof(q_c->sam_access)); @@ -397,13 +394,12 @@ BOOL reg_io_r_create_key(const char *desc, REG_R_CREATE_KEY *r_r, prs_struct *p void init_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd, char *name) { - int len_name = name != NULL ? strlen(name ) + 1: 0; ZERO_STRUCTP(q_c); memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); - init_uni_hdr(&q_c->hdr_name, len_name); - init_unistr2(&q_c->uni_name, name, len_name); + init_unistr2(&q_c->uni_name, name, UNI_STR_TERMINATE); + init_uni_hdr(&q_c->hdr_name, &q_c->uni_name); } /******************************************************************* @@ -463,13 +459,12 @@ BOOL reg_io_r_delete_val(const char *desc, REG_R_DELETE_VALUE *r_r, prs_struct void init_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd, char *name) { - int len_name = name != NULL ? strlen(name ) + 1: 0; ZERO_STRUCTP(q_c); memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); - init_uni_hdr(&q_c->hdr_name, len_name); - init_unistr2(&q_c->uni_name, name, len_name); + init_unistr2(&q_c->uni_name, name, UNI_STR_TERMINATE); + init_uni_hdr(&q_c->hdr_name, &q_c->uni_name); } /******************************************************************* @@ -525,14 +520,12 @@ BOOL reg_io_r_delete_key(const char *desc, REG_R_DELETE_KEY *r_r, prs_struct *p Inits a structure. ********************************************************************/ -void init_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, - uint32 max_class_len) +void init_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, UNISTR2 *uni2) { ZERO_STRUCTP(q_o); memcpy(&q_o->pol, hnd, sizeof(q_o->pol)); - init_uni_hdr(&q_o->hdr_class, max_class_len); - q_o->uni_class.uni_max_len = max_class_len; + init_uni_hdr(&q_o->hdr_class, uni2); } /******************************************************************* @@ -1010,15 +1003,13 @@ makes a structure. BOOL init_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char* val_name) { - int len_type = val_name != NULL ? strlen(val_name) + 1 : 0; - if (q_i == NULL) return False; q_i->pol = *pol; - init_uni_hdr(&(q_i->hdr_type), len_type); - init_unistr2(&(q_i->uni_type), val_name, len_type); + init_unistr2(&q_i->uni_type, val_name, UNI_STR_TERMINATE); + init_uni_hdr(&q_i->hdr_type, &q_i->uni_type); q_i->ptr_reserved = 1; q_i->ptr_buf = 1; @@ -1230,7 +1221,7 @@ makes a structure. ********************************************************************/ void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol, - uint32 val_idx, uint32 max_val_len, + uint32 val_idx, UNISTR2 *uni2, uint32 max_buf_len) { ZERO_STRUCTP(q_i); @@ -1238,8 +1229,7 @@ void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol, memcpy(&q_i->pol, pol, sizeof(q_i->pol)); q_i->val_index = val_idx; - init_uni_hdr(&q_i->hdr_name, max_val_len); - q_i->uni_name.uni_max_len = max_val_len; + init_uni_hdr(&q_i->hdr_name, uni2); q_i->ptr_type = 1; q_i->type = 0x0; @@ -1270,8 +1260,8 @@ void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) DEBUG(10,("init_reg_r_enum_val: Valuename => [%s]\n", val->valuename)); - init_uni_hdr( &r_u->hdr_name, strlen(val->valuename)+1 ); - init_unistr2( &r_u->uni_name, val->valuename, strlen(val->valuename)+1 ); + init_unistr2( &r_u->uni_name, val->valuename, UNI_STR_TERMINATE); + init_uni_hdr( &r_u->hdr_name, &r_u->uni_name); /* type */ @@ -1418,14 +1408,12 @@ void init_reg_q_create_val(REG_Q_CREATE_VALUE *q_i, POLICY_HND *pol, char *val_name, uint32 type, BUFFER3 *val) { - int val_len = strlen(val_name) + 1; - ZERO_STRUCTP(q_i); memcpy(&q_i->pol, pol, sizeof(q_i->pol)); - init_uni_hdr(&q_i->hdr_name, val_len); - init_unistr2(&q_i->uni_name, val_name, val_len); + init_unistr2(&q_i->uni_name, val_name, UNI_STR_TERMINATE); + init_uni_hdr(&q_i->hdr_name, &q_i->uni_name); q_i->type = type; q_i->buf_value = val; @@ -1650,12 +1638,10 @@ makes a structure. void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, char *key_name, uint32 access_desired) { - int len_name = strlen(key_name)+1; - memcpy(&r_q->pol, pol, sizeof(r_q->pol)); - init_uni_hdr(&r_q->hdr_name, len_name); - init_unistr2(&r_q->uni_name, key_name, len_name); + init_unistr2(&r_q->uni_name, key_name, UNI_STR_TERMINATE); + init_uni_hdr(&r_q->hdr_name, &r_q->uni_name); r_q->unknown_0 = 0x00000000; r_q->access_desired = access_desired; @@ -1736,29 +1722,27 @@ BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *p /******************************************************************* Inits a structure. ********************************************************************/ + void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, const char *msg, uint32 timeout, BOOL do_reboot, BOOL force) { - int msg_len; - msg_len = strlen(msg); - q_s->ptr_0 = 1; q_s->ptr_1 = 1; q_s->ptr_2 = 1; - init_uni_hdr(&(q_s->hdr_msg), msg_len); - init_unistr2(&(q_s->uni_msg), msg, msg_len); + init_unistr2(&q_s->uni_msg, msg, UNI_FLAGS_NONE); + init_uni_hdr(&q_s->hdr_msg, &q_s->uni_msg); q_s->timeout = timeout; q_s->reboot = do_reboot ? 1 : 0; q_s->force = force ? 1 : 0; - } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_shutdown(const char *desc, REG_Q_SHUTDOWN * q_s, prs_struct *ps, int depth) { diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 420a727765..939b652a1e 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -93,14 +93,12 @@ 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) { - int len_name = strlen(dom_name); - DEBUG(5, ("init_samr_q_lookup_domain\n")); q_u->connect_pol = *pol; - init_uni_hdr(&q_u->hdr_domain, len_name); - init_unistr2(&q_u->uni_domain, dom_name, len_name); + init_unistr2(&q_u->uni_domain, dom_name, UNI_FLAGS_NONE); + init_uni_hdr(&q_u->hdr_domain, &q_u->uni_domain); } /******************************************************************* @@ -630,13 +628,11 @@ static BOOL sam_io_unk_info12(const char *desc, SAM_UNK_INFO_12 * u_12, /******************************************************************* inits a structure. ********************************************************************/ + void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *server) { - int len_server = strlen(server); - - init_uni_hdr(&u_5->hdr_server, len_server); - - init_unistr2(&u_5->uni_server, server, len_server); + init_unistr2(&u_5->uni_server, server, UNI_FLAGS_NONE); + init_uni_hdr(&u_5->hdr_server, &u_5->uni_server); } /******************************************************************* @@ -664,20 +660,16 @@ static BOOL sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5, /******************************************************************* inits a structure. ********************************************************************/ + void init_unk_info2(SAM_UNK_INFO_2 * u_2, const char *domain, const char *server, uint32 seq_num, uint32 num_users, uint32 num_groups, uint32 num_alias) { - int len_domain = strlen(domain); - int len_server = strlen(server); - u_2->unknown_0 = 0x00000000; u_2->unknown_1 = 0x80000000; u_2->unknown_2 = 0x00000000; u_2->ptr_0 = 1; - init_uni_hdr(&u_2->hdr_domain, len_domain); - init_uni_hdr(&u_2->hdr_server, len_server); u_2->seq_num = seq_num; u_2->unknown_3 = 0x00000000; @@ -691,8 +683,10 @@ void init_unk_info2(SAM_UNK_INFO_2 * u_2, memset(u_2->padding, 0, sizeof(u_2->padding)); /* 12 bytes zeros */ - init_unistr2(&u_2->uni_domain, domain, len_domain); - init_unistr2(&u_2->uni_server, server, len_server); + 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); } /******************************************************************* @@ -984,9 +978,9 @@ static BOOL sam_io_sam_str1(const char *desc, SAM_STR1 * sam, uint32 acct_buf, inits a SAM_ENTRY1 structure. ********************************************************************/ -static void init_sam_entry1(SAM_ENTRY1 * sam, uint32 user_idx, - uint32 len_sam_name, uint32 len_sam_full, - uint32 len_sam_desc, uint32 rid_user, +static void init_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, + UNISTR2 *sam_name, UNISTR2 *sam_full, + UNISTR2 *sam_desc, uint32 rid_user, uint16 acb_info) { DEBUG(5, ("init_sam_entry1\n")); @@ -997,9 +991,9 @@ static void init_sam_entry1(SAM_ENTRY1 * sam, uint32 user_idx, sam->rid_user = rid_user; sam->acb_info = acb_info; - init_uni_hdr(&sam->hdr_acct_name, len_sam_name); - init_uni_hdr(&sam->hdr_user_name, len_sam_full); - init_uni_hdr(&sam->hdr_user_desc, len_sam_desc); + 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); } /******************************************************************* @@ -1067,7 +1061,7 @@ static BOOL sam_io_sam_str2(const char *desc, SAM_STR2 * sam, uint32 acct_buf, inits a SAM_ENTRY2 structure. ********************************************************************/ static void init_sam_entry2(SAM_ENTRY2 * sam, uint32 user_idx, - uint32 len_sam_name, uint32 len_sam_desc, + UNISTR2 *sam_name, UNISTR2 *sam_desc, uint32 rid_user, uint16 acb_info) { DEBUG(5, ("init_sam_entry2\n")); @@ -1076,8 +1070,8 @@ static void init_sam_entry2(SAM_ENTRY2 * sam, uint32 user_idx, sam->rid_user = rid_user; sam->acb_info = acb_info; - init_uni_hdr(&sam->hdr_srv_name, len_sam_name); - init_uni_hdr(&sam->hdr_srv_desc, len_sam_desc); + init_uni_hdr(&sam->hdr_srv_name, sam_name); + init_uni_hdr(&sam->hdr_srv_desc, sam_desc); } /******************************************************************* @@ -1144,7 +1138,7 @@ inits a SAM_ENTRY3 structure. ********************************************************************/ static void init_sam_entry3(SAM_ENTRY3 * sam, uint32 grp_idx, - uint32 len_grp_name, uint32 len_grp_desc, + UNISTR2 *grp_name, UNISTR2 *grp_desc, uint32 rid_grp) { DEBUG(5, ("init_sam_entry3\n")); @@ -1153,8 +1147,8 @@ static void init_sam_entry3(SAM_ENTRY3 * sam, uint32 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, len_grp_name); - init_uni_hdr(&sam->hdr_grp_desc, len_grp_desc); + init_uni_hdr(&sam->hdr_grp_name, grp_name); + init_uni_hdr(&sam->hdr_grp_desc, grp_desc); } /******************************************************************* @@ -1268,12 +1262,12 @@ static BOOL sam_io_sam_entry5(const char *desc, SAM_ENTRY5 * sam, inits a SAM_ENTRY structure. ********************************************************************/ -void init_sam_entry(SAM_ENTRY * sam, uint32 len_sam_name, uint32 rid) +void init_sam_entry(SAM_ENTRY *sam, UNISTR2 *uni2, uint32 rid) { - DEBUG(10, ("init_sam_entry: %d %d\n", len_sam_name, rid)); + DEBUG(10, ("init_sam_entry: %d\n", rid)); sam->rid = rid; - init_uni_hdr(&sam->hdr_name, len_sam_name); + init_uni_hdr(&sam->hdr_name, uni2); } /******************************************************************* @@ -1502,7 +1496,6 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_en uint32 start_idx, SAM_ACCOUNT *disp_user_info, DOM_SID *domain_sid) { - uint32 len_sam_name, len_sam_full, len_sam_desc; uint32 i; SAM_ACCOUNT *pwd = NULL; @@ -1560,21 +1553,14 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_en return NT_STATUS_UNSUCCESSFUL; } - len_sam_name = strlen(username); - len_sam_full = strlen(fullname); - len_sam_desc = strlen(acct_desc); + init_unistr2(&sam->str[i].uni_acct_name, pdb_get_username(pwd), UNI_FLAGS_NONE); + init_unistr2(&sam->str[i].uni_full_name, pdb_get_fullname(pwd), UNI_FLAGS_NONE); + init_unistr2(&sam->str[i].uni_acct_desc, pdb_get_acct_desc(pwd), UNI_FLAGS_NONE); init_sam_entry1(&sam->sam[i], start_idx + i + 1, - len_sam_name, len_sam_full, len_sam_desc, + &sam->str[i].uni_acct_name, &sam->str[i].uni_full_name, &sam->str[i].uni_acct_desc, user_rid, pdb_get_acct_ctrl(pwd)); - ZERO_STRUCTP(&sam->str[i].uni_acct_name); - ZERO_STRUCTP(&sam->str[i].uni_full_name); - ZERO_STRUCTP(&sam->str[i].uni_acct_desc); - - init_unistr2(&sam->str[i].uni_acct_name, pdb_get_username(pwd), len_sam_name); - init_unistr2(&sam->str[i].uni_full_name, pdb_get_fullname(pwd), len_sam_full); - init_unistr2(&sam->str[i].uni_acct_desc, pdb_get_acct_desc(pwd), len_sam_desc); } return NT_STATUS_OK; @@ -1637,7 +1623,6 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_en uint32 start_idx, SAM_ACCOUNT *disp_user_info, DOM_SID *domain_sid ) { - uint32 len_sam_name, len_sam_desc; uint32 i; SAM_ACCOUNT *pwd = NULL; @@ -1680,18 +1665,12 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_en return NT_STATUS_UNSUCCESSFUL; } - len_sam_name = strlen(username); - len_sam_desc = strlen(acct_desc); - + init_unistr2(&sam->str[i].uni_srv_name, username, UNI_FLAGS_NONE); + init_unistr2(&sam->str[i].uni_srv_desc, pdb_get_acct_desc(pwd), UNI_FLAGS_NONE); + init_sam_entry2(&sam->sam[i], start_idx + i + 1, - len_sam_name, len_sam_desc, + &sam->str[i].uni_srv_name, &sam->str[i].uni_srv_desc, user_rid, pdb_get_acct_ctrl(pwd)); - - ZERO_STRUCTP(&sam->str[i].uni_srv_name); - ZERO_STRUCTP(&sam->str[i].uni_srv_desc); - - init_unistr2(&sam->str[i].uni_srv_name, username, len_sam_name); - init_unistr2(&sam->str[i].uni_srv_desc, pdb_get_acct_desc(pwd), len_sam_desc); } return NT_STATUS_OK; @@ -1755,7 +1734,6 @@ inits a SAM_DISPINFO_3 structure. NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_entries, uint32 start_idx, DOMAIN_GRP *disp_group_info) { - uint32 len_sam_name, len_sam_desc; uint32 i; ZERO_STRUCTP(sam); @@ -1779,13 +1757,11 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_en DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i)); - len_sam_name = strlen(grp->name); - len_sam_desc = strlen(grp->comment); + init_unistr2(&sam->str[i].uni_grp_name, grp->name, UNI_FLAGS_NONE); + init_unistr2(&sam->str[i].uni_grp_desc, grp->comment, UNI_FLAGS_NONE); - init_sam_entry3(&sam->sam[i], start_idx + i + 1, len_sam_name, len_sam_desc, grp->rid); - - init_unistr2(&sam->str[i].uni_grp_name, grp->name, len_sam_name); - init_unistr2(&sam->str[i].uni_grp_desc, grp->comment, len_sam_desc); + init_sam_entry3(&sam->sam[i], start_idx + i + 1, &sam->str[i].uni_grp_name, + &sam->str[i].uni_grp_desc, grp->rid); } return NT_STATUS_OK; @@ -2210,20 +2186,15 @@ void init_samr_group_info1(GROUP_INFO1 * gr1, char *acct_name, char *acct_desc, uint32 num_members) { - int desc_len = acct_desc != NULL ? strlen(acct_desc) : 0; - int acct_len = acct_name != NULL ? strlen(acct_name) : 0; - DEBUG(5, ("init_samr_group_info1\n")); - init_uni_hdr(&gr1->hdr_acct_name, acct_len); - gr1->unknown_1 = 0x3; gr1->num_members = num_members; - init_uni_hdr(&gr1->hdr_acct_desc, desc_len); - - init_unistr2(&gr1->uni_acct_name, acct_name, acct_len); - init_unistr2(&gr1->uni_acct_desc, acct_desc, desc_len); + 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); } /******************************************************************* @@ -2302,12 +2273,10 @@ inits a GROUP_INFO4 structure. void init_samr_group_info4(GROUP_INFO4 * gr4, char *acct_desc) { - int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - DEBUG(5, ("init_samr_group_info4\n")); - init_uni_hdr(&gr4->hdr_acct_desc, acct_len); - init_unistr2(&gr4->uni_acct_desc, acct_desc, acct_len); + init_unistr2(&gr4->uni_acct_desc, acct_desc, UNI_FLAGS_NONE); + init_uni_hdr(&gr4->hdr_acct_desc, &gr4->uni_acct_desc); } /******************************************************************* @@ -2383,14 +2352,12 @@ void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e, POLICY_HND *pol, char *acct_desc, uint32 access_mask) { - int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - DEBUG(5, ("init_samr_q_create_dom_group\n")); q_e->pol = *pol; - init_uni_hdr(&q_e->hdr_acct_desc, acct_len); - init_unistr2(&q_e->uni_acct_desc, acct_desc, acct_len); + 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; } @@ -3502,18 +3469,15 @@ inits a ALIAS_INFO1 structure. void init_samr_alias_info1(ALIAS_INFO1 * al1, char *acct_name, uint32 num_member, char *acct_desc) { - int acct_len_name = acct_name != NULL ? strlen(acct_name) : 0; - int acct_len_desc = acct_desc != NULL ? strlen(acct_desc) : 0; - DEBUG(5, ("init_samr_alias_info1\n")); - init_uni_hdr(&al1->hdr_acct_name, acct_len_name); - init_unistr2(&al1->uni_acct_name, acct_name, acct_len_name); + init_unistr2(&al1->uni_acct_name, acct_name, UNI_FLAGS_NONE); + init_uni_hdr(&al1->hdr_acct_name, &al1->uni_acct_name); al1->num_member=num_member; - init_uni_hdr(&al1->hdr_acct_desc, acct_len_desc); - init_unistr2(&al1->uni_acct_desc, acct_desc, acct_len_desc); + init_unistr2(&al1->uni_acct_desc, acct_desc, UNI_FLAGS_NONE); + init_uni_hdr(&al1->hdr_acct_desc, &al1->uni_acct_name); } /******************************************************************* @@ -3559,12 +3523,10 @@ inits a ALIAS_INFO3 structure. void init_samr_alias_info3(ALIAS_INFO3 * al3, char *acct_desc) { - int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - DEBUG(5, ("init_samr_alias_info3\n")); - init_uni_hdr(&al3->hdr_acct_desc, acct_len); - init_unistr2(&al3->uni_acct_desc, acct_desc, acct_len); + init_unistr2(&al3->uni_acct_desc, acct_desc, UNI_FLAGS_NONE); + init_uni_hdr(&al3->hdr_acct_desc, &al3->uni_acct_desc); } /******************************************************************* @@ -4272,14 +4234,12 @@ 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, char *acct_desc) { - int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0; - DEBUG(5, ("init_samr_q_create_dom_alias\n")); q_u->dom_pol = *hnd; - init_uni_hdr(&q_u->hdr_acct_desc, acct_len); - init_unistr2(&q_u->uni_acct_desc, acct_desc, acct_len); + 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 = 0x001f000f; } @@ -4675,9 +4635,8 @@ NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, return NT_STATUS_NO_MEMORY; for (i = 0; i < num_names; i++) { - int len_name = name[i] != NULL ? strlen(name[i]) : 0; - init_uni_hdr(&q_u->hdr_name[i], len_name); /* unicode header for user_name */ - init_unistr2(&q_u->uni_name[i], name[i], len_name); /* unicode string for machine account */ + 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; @@ -5013,15 +4972,12 @@ void init_samr_q_create_user(SAMR_Q_CREATE_USER * q_u, const char *name, uint32 acb_info, uint32 access_mask) { - int len_name; - len_name = strlen(name); - DEBUG(5, ("samr_init_samr_q_create_user\n")); q_u->domain_pol = *pol; - init_uni_hdr(&q_u->hdr_name, len_name); - init_unistr2(&q_u->uni_name, name, len_name); + 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; @@ -5244,16 +5200,11 @@ void init_sam_user_info11(SAM_USER_INFO_11 * usr, char *mach_acct, uint32 rid_user, uint32 rid_group, uint16 acct_ctrl) { - int len_mach_acct; - DEBUG(5, ("init_sam_user_info11\n")); - len_mach_acct = strlen(mach_acct); - - memcpy(&(usr->expiry), expiry, sizeof(usr->expiry)); /* expiry time or something? */ + memcpy(&usr->expiry, expiry, sizeof(usr->expiry)); /* expiry time or something? */ ZERO_STRUCT(usr->padding_1); /* 0 - padding 24 bytes */ - init_uni_hdr(&usr->hdr_mach_acct, len_mach_acct); /* unicode header for machine account */ usr->padding_2 = 0; /* 0 - padding 4 bytes */ usr->ptr_1 = 1; /* pointer */ @@ -5278,7 +5229,8 @@ void init_sam_user_info11(SAM_USER_INFO_11 * usr, 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, len_mach_acct); /* unicode string for machine account */ + 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 */ } /******************************************************************* @@ -5441,17 +5393,6 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z uint16 logon_count, char newpass[516], uint32 unknown_6) { - int len_user_name = user_name != NULL ? user_name->uni_str_len : 0; - int len_full_name = full_name != NULL ? full_name->uni_str_len : 0; - int len_home_dir = home_dir != NULL ? home_dir->uni_str_len : 0; - int len_dir_drive = dir_drive != NULL ? dir_drive->uni_str_len : 0; - int len_logon_script = log_scr != NULL ? log_scr->uni_str_len : 0; - int len_profile_path = prof_path != NULL ? prof_path->uni_str_len : 0; - int len_description = desc != NULL ? desc->uni_str_len : 0; - int len_workstations = wkstas != NULL ? wkstas->uni_str_len : 0; - int len_unknown_str = unk_str != NULL ? unk_str->uni_str_len : 0; - int len_munged_dial = mung_dial != NULL ? mung_dial->uni_str_len : 0; - usr->logon_time = *logon_time; /* all zeros */ usr->logoff_time = *logoff_time; /* all zeros */ usr->kickoff_time = *kickoff_time; /* all zeros */ @@ -5459,17 +5400,6 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z usr->pass_can_change_time = *pass_can_change_time; /* all zeros */ usr->pass_must_change_time = *pass_must_change_time; /* all zeros */ - init_uni_hdr(&usr->hdr_user_name, len_user_name); /* NULL */ - init_uni_hdr(&usr->hdr_full_name, len_full_name); - init_uni_hdr(&usr->hdr_home_dir, len_home_dir); - init_uni_hdr(&usr->hdr_dir_drive, len_dir_drive); - init_uni_hdr(&usr->hdr_logon_script, len_logon_script); - init_uni_hdr(&usr->hdr_profile_path, len_profile_path); - init_uni_hdr(&usr->hdr_acct_desc, len_description); - init_uni_hdr(&usr->hdr_workstations, len_workstations); - init_uni_hdr(&usr->hdr_unknown_str, len_unknown_str); - init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); - ZERO_STRUCT(usr->nt_pwd); ZERO_STRUCT(usr->lm_pwd); @@ -5496,15 +5426,34 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z 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_unknown_str, unk_str); + init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); + copy_unistr2(&usr->uni_munged_dial, mung_dial); + init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); usr->unknown_6 = unknown_6; /* 0x0000 04ec */ usr->padding4 = 0; @@ -5536,17 +5485,6 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z LOGON_HRS * hrs, uint16 bad_password_count, uint16 logon_count, char newpass[516], uint32 unknown_6) { - int len_user_name = user_name != NULL ? strlen(user_name) : 0; - int len_full_name = full_name != NULL ? strlen(full_name) : 0; - int len_home_dir = home_dir != NULL ? strlen(home_dir) : 0; - int len_dir_drive = dir_drive != NULL ? strlen(dir_drive) : 0; - int len_logon_script = log_scr != NULL ? strlen(log_scr) : 0; - int len_profile_path = prof_path != NULL ? strlen(prof_path) : 0; - int len_description = desc != NULL ? strlen(desc) : 0; - int len_workstations = wkstas != NULL ? strlen(wkstas) : 0; - int len_unknown_str = unk_str != NULL ? strlen(unk_str) : 0; - int len_munged_dial = mung_dial != NULL ? strlen(mung_dial) : 0; - usr->logon_time = *logon_time; /* all zeros */ usr->logoff_time = *logoff_time; /* all zeros */ usr->kickoff_time = *kickoff_time; /* all zeros */ @@ -5554,17 +5492,6 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z usr->pass_can_change_time = *pass_can_change_time; /* all zeros */ usr->pass_must_change_time = *pass_must_change_time; /* all zeros */ - init_uni_hdr(&usr->hdr_user_name, len_user_name); /* NULL */ - init_uni_hdr(&usr->hdr_full_name, len_full_name); - init_uni_hdr(&usr->hdr_home_dir, len_home_dir); - init_uni_hdr(&usr->hdr_dir_drive, len_dir_drive); - init_uni_hdr(&usr->hdr_logon_script, len_logon_script); - init_uni_hdr(&usr->hdr_profile_path, len_profile_path); - init_uni_hdr(&usr->hdr_acct_desc, len_description); - init_uni_hdr(&usr->hdr_workstations, len_workstations); - init_uni_hdr(&usr->hdr_unknown_str, len_unknown_str); - init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); - ZERO_STRUCT(usr->nt_pwd); ZERO_STRUCT(usr->lm_pwd); @@ -5590,16 +5517,35 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z memcpy(usr->pass, newpass, sizeof(usr->pass)); - init_unistr2(&usr->uni_user_name, user_name, len_user_name); /* NULL */ - init_unistr2(&usr->uni_full_name, full_name, len_full_name); - init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); - init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); - init_unistr2(&usr->uni_logon_script, log_scr, len_logon_script); - init_unistr2(&usr->uni_profile_path, prof_path, len_profile_path); - init_unistr2(&usr->uni_acct_desc, desc, len_description); - init_unistr2(&usr->uni_workstations, wkstas, len_workstations); - init_unistr2(&usr->uni_unknown_str, unk_str, len_unknown_str); - init_unistr2(&usr->uni_munged_dial, mung_dial, len_munged_dial); + 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_unknown_str, unk_str, UNI_FLAGS_NONE); + init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); + + init_unistr2(&usr->uni_munged_dial, mung_dial, UNI_FLAGS_NONE); + init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); usr->unknown_6 = unknown_6; /* 0x0000 04ec */ usr->padding4 = 0; @@ -5900,17 +5846,6 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, uint16 logon_count, uint32 unknown_6) { - int len_user_name = user_name != NULL ? user_name->uni_str_len : 0; - int len_full_name = full_name != NULL ? full_name->uni_str_len : 0; - int len_home_dir = home_dir != NULL ? home_dir->uni_str_len : 0; - int len_dir_drive = dir_drive != NULL ? dir_drive->uni_str_len : 0; - int len_logon_script = log_scr != NULL ? log_scr->uni_str_len : 0; - int len_profile_path = prof_path != NULL ? prof_path->uni_str_len : 0; - int len_description = desc != NULL ? desc->uni_str_len : 0; - int len_workstations = wkstas != NULL ? wkstas->uni_str_len : 0; - int len_unknown_str = unk_str != NULL ? unk_str->uni_str_len : 0; - int len_munged_dial = mung_dial != NULL ? mung_dial->uni_str_len : 0; - usr->logon_time = *logon_time; usr->logoff_time = *logoff_time; usr->kickoff_time = *kickoff_time; @@ -5918,17 +5853,6 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, usr->pass_can_change_time = *pass_can_change_time; usr->pass_must_change_time = *pass_must_change_time; - init_uni_hdr(&usr->hdr_user_name, len_user_name); - init_uni_hdr(&usr->hdr_full_name, len_full_name); - init_uni_hdr(&usr->hdr_home_dir, len_home_dir); - init_uni_hdr(&usr->hdr_dir_drive, len_dir_drive); - init_uni_hdr(&usr->hdr_logon_script, len_logon_script); - init_uni_hdr(&usr->hdr_profile_path, len_profile_path); - init_uni_hdr(&usr->hdr_acct_desc, len_description); - init_uni_hdr(&usr->hdr_workstations, len_workstations); - init_uni_hdr(&usr->hdr_unknown_str, len_unknown_str); - init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); - memcpy(usr->lm_pwd, lm_pwd, sizeof(usr->lm_pwd)); memcpy(usr->nt_pwd, nt_pwd, sizeof(usr->nt_pwd)); @@ -5952,15 +5876,34 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, 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_unknown_str, unk_str); + init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); + copy_unistr2(&usr->uni_munged_dial, mung_dial); + init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); usr->unknown_6 = unknown_6; /* 0x0000 04ec */ usr->padding4 = 0; @@ -5981,11 +5924,6 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * NTTIME logon_time, logoff_time, kickoff_time, pass_last_set_time, pass_can_change_time, pass_must_change_time; - - int len_user_name, len_full_name, len_home_dir, - len_dir_drive, len_logon_script, len_profile_path, - len_description, len_workstations, len_unknown_str, - len_munged_dial; const char* user_name = pdb_get_username(pw); const char* full_name = pdb_get_fullname(pw); @@ -6003,18 +5941,6 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * uint32 group_rid; const DOM_SID *group_sid; - len_user_name = user_name != NULL ? strlen(user_name )+1 : 0; - len_full_name = full_name != NULL ? strlen(full_name )+1 : 0; - len_home_dir = home_dir != NULL ? strlen(home_dir )+1 : 0; - len_dir_drive = dir_drive != NULL ? strlen(dir_drive )+1 : 0; - len_logon_script = logon_script != NULL ? strlen(logon_script)+1 : 0; - len_profile_path = profile_path != NULL ? strlen(profile_path)+1 : 0; - len_description = description != NULL ? strlen(description )+1 : 0; - len_workstations = workstations != NULL ? strlen(workstations)+1 : 0; - len_unknown_str = 0; - len_munged_dial = munged_dial != NULL ? strlen(munged_dial )+1 : 0; - - /* 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)); @@ -6031,17 +5957,6 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * usr->pass_can_change_time = pass_can_change_time; usr->pass_must_change_time = pass_must_change_time; - init_uni_hdr(&usr->hdr_user_name, len_user_name); - init_uni_hdr(&usr->hdr_full_name, len_full_name); - init_uni_hdr(&usr->hdr_home_dir, len_home_dir); - init_uni_hdr(&usr->hdr_dir_drive, len_dir_drive); - init_uni_hdr(&usr->hdr_logon_script, len_logon_script); - init_uni_hdr(&usr->hdr_profile_path, len_profile_path); - init_uni_hdr(&usr->hdr_acct_desc, len_description); - init_uni_hdr(&usr->hdr_workstations, len_workstations); - init_uni_hdr(&usr->hdr_unknown_str, len_unknown_str); - init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); - ZERO_STRUCT(usr->nt_pwd); ZERO_STRUCT(usr->lm_pwd); @@ -6100,16 +6015,35 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * ZERO_STRUCT(usr->padding1); ZERO_STRUCT(usr->padding2); - init_unistr2(&usr->uni_user_name, user_name, len_user_name); - init_unistr2(&usr->uni_full_name, full_name, len_full_name); - init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir); - init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive); - init_unistr2(&usr->uni_logon_script, logon_script, len_logon_script); - init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path); - init_unistr2(&usr->uni_acct_desc, description, len_description); - init_unistr2(&usr->uni_workstations, workstations, len_workstations); - init_unistr2(&usr->uni_unknown_str, NULL, len_unknown_str); - init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial); + 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_unknown_str, NULL, UNI_STR_TERMINATE); + init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); + + init_unistr2(&usr->uni_munged_dial, munged_dial, UNI_STR_TERMINATE); + init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); usr->unknown_6 = pdb_get_unknown_6(pw); usr->padding4 = 0; @@ -6249,12 +6183,10 @@ static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, void init_sam_user_info20A(SAM_USER_INFO_20 *usr, SAM_ACCOUNT *pw) { - int len_munged_dial; - const char* munged_dial = pdb_get_munged_dial(pw); + const char *munged_dial = pdb_get_munged_dial(pw); - len_munged_dial = munged_dial != NULL ? strlen(munged_dial )+1 : 0; - init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial); - init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial); + init_unistr2(&usr->uni_munged_dial, munged_dial, UNI_STR_TERMINATE); + init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); } @@ -6720,13 +6652,11 @@ inits a SAMR_Q_CONNECT structure. void init_samr_q_connect(SAMR_Q_CONNECT * q_u, char *srv_name, uint32 access_mask) { - int len_srv_name = strlen(srv_name); - DEBUG(5, ("init_samr_q_connect\n")); /* make PDC server name \\server */ - q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0; - init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1); + 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; @@ -6793,13 +6723,11 @@ inits a SAMR_Q_CONNECT4 structure. void init_samr_q_connect4(SAMR_Q_CONNECT4 * q_u, char *srv_name, uint32 access_mask) { - int len_srv_name = strlen(srv_name); - DEBUG(5, ("init_samr_q_connect\n")); /* make PDC server name \\server */ - q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0; - init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name + 1); + 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; @@ -6938,13 +6866,11 @@ 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) { - int len_srv_name = strlen(srv_name); - DEBUG(5, ("init_samr_q_get_dom_pwinfo\n")); q_u->ptr = 1; - init_uni_hdr(&q_u->hdr_srv_name, len_srv_name); - init_unistr2(&q_u->uni_srv_name, srv_name, len_srv_name); + 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); } /******************************************************************* @@ -7105,16 +7031,14 @@ void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u, char lm_newpass[516], uchar lm_oldhash[16]) { - int len_dest_host = strlen(dest_host); - int len_user_name = strlen(user_name); - DEBUG(5, ("init_samr_q_chgpasswd_user\n")); q_u->ptr_0 = 1; - init_uni_hdr(&q_u->hdr_dest_host, len_dest_host); - init_unistr2(&q_u->uni_dest_host, dest_host, len_dest_host); - init_uni_hdr(&q_u->hdr_user_name, len_user_name); - init_unistr2(&q_u->uni_user_name, user_name, len_user_name); + 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, nt_newpass); init_enc_hash(&q_u->nt_oldhash, nt_oldhash); diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 7ca9bccab4..65f16414a0 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -916,12 +916,12 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, { DEBUG(5,("make_spoolss_q_open_printer_ex\n")); q_u->printername_ptr = (printername!=NULL)?1:0; - init_unistr2(&q_u->printername, printername, strlen(printername)+1); + init_unistr2(&q_u->printername, printername, UNI_STR_TERMINATE); q_u->printer_default.datatype_ptr = 0; /* q_u->printer_default.datatype_ptr = (datatype!=NULL)?1:0; - init_unistr2(&q_u->printer_default.datatype, datatype, strlen(datatype)); + init_unistr2(&q_u->printer_default.datatype, datatype, UNI_FLAGS_NONE); */ q_u->printer_default.devmode_cont.size=0; q_u->printer_default.devmode_cont.devmode_ptr=0; @@ -937,8 +937,8 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, q_u->user_ctr.user1.major=2; q_u->user_ctr.user1.minor=0; q_u->user_ctr.user1.processor=0; - init_unistr2(&q_u->user_ctr.user1.client_name, clientname, strlen(clientname)+1); - init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)+1); + init_unistr2(&q_u->user_ctr.user1.client_name, clientname, UNI_STR_TERMINATE); + init_unistr2(&q_u->user_ctr.user1.user_name, user_name, UNI_STR_TERMINATE); return True; } @@ -963,7 +963,7 @@ BOOL make_spoolss_q_addprinterex( ZERO_STRUCTP(q_u); q_u->server_name_ptr = (srv_name!=NULL)?1:0; - init_unistr2(&q_u->server_name, srv_name, strlen(srv_name)); + init_unistr2(&q_u->server_name, srv_name, UNI_FLAGS_NONE); q_u->level = level; @@ -991,8 +991,8 @@ BOOL make_spoolss_q_addprinterex( q_u->user_ctr.user1.major=2; q_u->user_ctr.user1.minor=0; q_u->user_ctr.user1.processor=0; - init_unistr2(&q_u->user_ctr.user1.client_name, clientname, strlen(clientname)+1); - init_unistr2(&q_u->user_ctr.user1.user_name, user_name, strlen(user_name)+1); + init_unistr2(&q_u->user_ctr.user1.client_name, clientname, UNI_STR_TERMINATE); + init_unistr2(&q_u->user_ctr.user1.user_name, user_name, UNI_STR_TERMINATE); q_u->user_ctr.user1.size=q_u->user_ctr.user1.user_name.uni_str_len + q_u->user_ctr.user1.client_name.uni_str_len + 2; @@ -1187,15 +1187,13 @@ BOOL make_spoolss_q_deleteprinterdriver( /* these must be NULL terminated or else NT4 will complain about invalid parameters --jerry */ - init_unistr2(&q_u->server, server, strlen(server)+1); - init_unistr2(&q_u->arch, arch, strlen(arch)+1); - init_unistr2(&q_u->driver, driver, strlen(driver)+1); - + init_unistr2(&q_u->server, server, UNI_STR_TERMINATE); + init_unistr2(&q_u->arch, arch, UNI_STR_TERMINATE); + init_unistr2(&q_u->driver, driver, UNI_STR_TERMINATE); return True; } - /******************************************************************* * make a structure. ********************************************************************/ @@ -1209,7 +1207,7 @@ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, DEBUG(5,("make_spoolss_q_getprinterdata\n")); q_u->handle = *handle; - init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); + init_unistr2(&q_u->valuename, valuename, UNI_STR_TERMINATE); q_u->size = size; return True; @@ -1229,8 +1227,8 @@ BOOL make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX *q_u, DEBUG(5,("make_spoolss_q_getprinterdataex\n")); q_u->handle = *handle; - init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); - init_unistr2(&q_u->keyname, keyname, strlen(keyname) + 1); + init_unistr2(&q_u->valuename, valuename, UNI_STR_TERMINATE); + init_unistr2(&q_u->keyname, keyname, UNI_STR_TERMINATE); q_u->size = size; return True; @@ -5317,7 +5315,7 @@ BOOL smb_io_unibuffer(const char *desc, UNISTR2 *buffer, prs_struct *ps, int dep { if (buffer==NULL) return False; - buffer->undoc=0; + buffer->offset=0; buffer->uni_str_len=buffer->uni_max_len; if(!prs_uint32("buffer_size", ps, depth, &buffer->uni_max_len)) @@ -5374,7 +5372,7 @@ BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx, DEBUG(5,("make_spoolss_q_addprinterdriver\n")); q_u->server_name_ptr = (srv_name!=NULL)?1:0; - init_unistr2(&q_u->server_name, srv_name, strlen(srv_name)+1); + init_unistr2(&q_u->server_name, srv_name, UNI_STR_TERMINATE); q_u->level = level; @@ -6162,7 +6160,7 @@ BOOL make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u, uint32 size) { memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - init_unistr2(&q_u->key, key, strlen(key)+1); + init_unistr2(&q_u->key, key, UNI_STR_TERMINATE); q_u->size = size; return True; @@ -6175,7 +6173,7 @@ BOOL make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND { memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); q_u->type = data_type; - init_unistr2(&q_u->value, value, strlen(value)+1); + init_unistr2(&q_u->value, value, UNI_STR_TERMINATE); q_u->max_len = q_u->real_len = data_size; q_u->data = (unsigned char *)data; @@ -6191,8 +6189,8 @@ BOOL make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX *q_u, const POLICY { memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); q_u->type = data_type; - init_unistr2(&q_u->value, value, strlen(value)+1); - init_unistr2(&q_u->key, key, strlen(key)+1); + init_unistr2(&q_u->value, value, UNI_STR_TERMINATE); + init_unistr2(&q_u->key, key, UNI_STR_TERMINATE); q_u->max_len = q_u->real_len = data_size; q_u->data = (unsigned char *)data; @@ -6589,7 +6587,7 @@ BOOL make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER *q_u, if (q_u == NULL) return False; - init_unistr2(&q_u->string, string, strlen(string)+1); + init_unistr2(&q_u->string, string, UNI_STR_TERMINATE); q_u->printer=printer; q_u->type=type; @@ -7092,7 +7090,7 @@ BOOL make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u, DEBUG(5,("make_spoolss_q_enumprinterkey\n")); memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - init_unistr2(&q_u->key, key, strlen(key)+1); + init_unistr2(&q_u->key, key, UNI_STR_TERMINATE); q_u->size = size; return True; @@ -7161,7 +7159,7 @@ BOOL make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY *q_u, DEBUG(5,("make_spoolss_q_deleteprinterkey\n")); memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - init_unistr2(&q_u->keyname, keyname, strlen(keyname)+1); + init_unistr2(&q_u->keyname, keyname, UNI_STR_TERMINATE); return True; } @@ -7382,8 +7380,8 @@ BOOL make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTOR { DEBUG(5,("make_spoolss_q_getprintprocessordirectory\n")); - init_unistr2(&q_u->name, name, strlen(name)+1); - init_unistr2(&q_u->environment, environment, strlen(environment)+1); + init_unistr2(&q_u->name, name, UNI_STR_TERMINATE); + init_unistr2(&q_u->environment, environment, UNI_STR_TERMINATE); q_u->level = level; @@ -7509,7 +7507,7 @@ BOOL make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle, q_u->level = level; q_u->level2 = level; memcpy(&q_u->form, form, sizeof(FORM)); - init_unistr2(&q_u->name, form_name, strlen(form_name) + 1); + init_unistr2(&q_u->name, form_name, UNI_STR_TERMINATE); return True; } @@ -7522,7 +7520,7 @@ BOOL make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, const char *form) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); - init_unistr2(&q_u->name, form, strlen(form) + 1); + init_unistr2(&q_u->name, form, UNI_STR_TERMINATE); return True; } @@ -7536,7 +7534,7 @@ BOOL make_spoolss_q_getform(SPOOL_Q_GETFORM *q_u, POLICY_HND *handle, { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); q_u->level = level; - init_unistr2(&q_u->formname, formname, strlen(formname) + 1); + init_unistr2(&q_u->formname, formname, UNI_STR_TERMINATE); q_u->buffer=buffer; q_u->offered=offered; @@ -7642,17 +7640,9 @@ BOOL make_spoolss_q_startdocprinter(SPOOL_Q_STARTDOCPRINTER *q_u, ctr->docinfo.doc_info_1.p_outputfile = outputfile ? 1 : 0; ctr->docinfo.doc_info_1.p_datatype = datatype ? 1 : 0; - if (docname) - init_unistr2(&ctr->docinfo.doc_info_1.docname, docname, - strlen(docname) + 1); - - if (outputfile) - init_unistr2(&ctr->docinfo.doc_info_1.outputfile, outputfile, - strlen(outputfile) + 1); - - if (datatype) - init_unistr2(&ctr->docinfo.doc_info_1.datatype, datatype, - strlen(datatype) + 1); + init_unistr2(&ctr->docinfo.doc_info_1.docname, docname, UNI_STR_TERMINATE); + init_unistr2(&ctr->docinfo.doc_info_1.outputfile, outputfile, UNI_STR_TERMINATE); + init_unistr2(&ctr->docinfo.doc_info_1.datatype, datatype, UNI_STR_TERMINATE); break; case 2: @@ -7701,7 +7691,7 @@ BOOL make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA *q_u, POLICY_HND *handle, char *valuename) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); - init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); + init_unistr2(&q_u->valuename, valuename, UNI_STR_TERMINATE); return True; } @@ -7715,8 +7705,8 @@ BOOL make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX *q_u, char *value) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); - init_unistr2(&q_u->valuename, value, strlen(value) + 1); - init_unistr2(&q_u->keyname, key, strlen(key) + 1); + init_unistr2(&q_u->valuename, value, UNI_STR_TERMINATE); + init_unistr2(&q_u->keyname, key, UNI_STR_TERMINATE); return True; } @@ -7736,8 +7726,7 @@ BOOL make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle, q_u->localmachine_ptr = 1; - init_unistr2(&q_u->localmachine, localmachine, - strlen(localmachine) + 1); + init_unistr2(&q_u->localmachine, localmachine, UNI_STR_TERMINATE); q_u->printerlocal = printerlocal; diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index bbb5193ddc..6349fc1632 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -36,8 +36,7 @@ void init_srv_share_info0_str(SH_INFO_0_STR *sh0, const char *net_name) { DEBUG(5,("init_srv_share_info0_str\n")); - if(net_name) - init_unistr2(&sh0->uni_netname, net_name, strlen(net_name)+1); + init_unistr2(&sh0->uni_netname, net_name, UNI_STR_TERMINATE); } /******************************************************************* @@ -101,10 +100,8 @@ void init_srv_share_info1_str(SH_INFO_1_STR *sh1, const char *net_name, const ch { DEBUG(5,("init_srv_share_info1_str\n")); - if(net_name) - init_unistr2(&sh1->uni_netname, net_name, strlen(net_name)+1); - if(remark) - init_unistr2(&sh1->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh1->uni_netname, net_name, UNI_STR_TERMINATE); + init_unistr2(&sh1->uni_remark, remark, UNI_STR_TERMINATE); } /******************************************************************* @@ -184,14 +181,10 @@ void init_srv_share_info2_str(SH_INFO_2_STR *sh2, { DEBUG(5,("init_srv_share_info2_str\n")); - if (net_name) - init_unistr2(&sh2->uni_netname, net_name, strlen(net_name)+1); - if (remark) - init_unistr2(&sh2->uni_remark, remark, strlen(remark)+1); - if (path) - init_unistr2(&sh2->uni_path, path, strlen(path)+1); - if (passwd) - init_unistr2(&sh2->uni_passwd, passwd, strlen(passwd)+1); + init_unistr2(&sh2->uni_netname, net_name, UNI_STR_TERMINATE); + init_unistr2(&sh2->uni_remark, remark, UNI_STR_TERMINATE); + init_unistr2(&sh2->uni_path, path, UNI_STR_TERMINATE); + init_unistr2(&sh2->uni_passwd, passwd, UNI_STR_TERMINATE); } /******************************************************************* @@ -296,10 +289,8 @@ void init_srv_share_info501_str(SH_INFO_501_STR *sh501, { DEBUG(5,("init_srv_share_info501_str\n")); - if(net_name) - init_unistr2(&sh501->uni_netname, net_name, strlen(net_name)+1); - if(remark) - init_unistr2(&sh501->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh501->uni_netname, net_name, UNI_STR_TERMINATE); + init_unistr2(&sh501->uni_remark, remark, UNI_STR_TERMINATE); } /******************************************************************* @@ -446,17 +437,13 @@ void init_srv_share_info502_str(SH_INFO_502_STR *sh502str, { DEBUG(5,("init_srv_share_info502_str\n")); - if(net_name) - init_unistr2(&sh502str->uni_netname, net_name, strlen(net_name)+1); - if(remark) - init_unistr2(&sh502str->uni_remark, remark, strlen(remark)+1); - if(path) - init_unistr2(&sh502str->uni_path, path, strlen(path)+1); - if(passwd) - init_unistr2(&sh502str->uni_passwd, passwd, strlen(passwd)+1); - sh502str->sd = psd; + init_unistr2(&sh502str->uni_netname, net_name, UNI_STR_TERMINATE); + init_unistr2(&sh502str->uni_remark, remark, UNI_STR_TERMINATE); + init_unistr2(&sh502str->uni_path, path, UNI_STR_TERMINATE); + init_unistr2(&sh502str->uni_passwd, passwd, UNI_STR_TERMINATE); + sh502str->sd = psd; sh502str->reserved = 0; - sh502str->sd_size = sd_size; + sh502str->sd_size = sd_size; } /******************************************************************* @@ -551,8 +538,7 @@ void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, const char *remark) { DEBUG(5,("init_srv_share_info1004_str\n")); - if(remark) - init_unistr2(&sh1004->uni_remark, remark, strlen(remark)+1); + init_unistr2(&sh1004->uni_remark, remark, UNI_STR_TERMINATE); } /******************************************************************* @@ -659,8 +645,7 @@ void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate { DEBUG(5,("init_srv_share_info1007_str\n")); - if(alternate_directory_name) - init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, strlen(alternate_directory_name)+1); + init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, UNI_STR_TERMINATE); } /******************************************************************* @@ -1474,7 +1459,7 @@ void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname, const char *path, const char *passwd) { q->ptr_srv_name = 1; - init_unistr2(&q->uni_srv_name, srvname, strlen(srvname) +1); + init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE); q->info.switch_value = q->info_level = 2; q->info.ptr_share_ctr = 1; @@ -1525,8 +1510,8 @@ void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname, const char *sharename) { del->ptr_srv_name = 1; - init_unistr2(&del->uni_srv_name, srvname, strlen(srvname) +1 ); - init_unistr2(&del->uni_share_name, sharename, strlen(sharename) + 1); + init_unistr2(&del->uni_srv_name, srvname, UNI_STR_TERMINATE); + init_unistr2(&del->uni_share_name, sharename, UNI_STR_TERMINATE); } /******************************************************************* @@ -1589,7 +1574,7 @@ void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, const char *name) { DEBUG(5,("init_srv_sess_info0_str\n")); - init_unistr2(&ss0->uni_name, name, strlen(name)+1); + init_unistr2(&ss0->uni_name, name, UNI_STR_TERMINATE); } /******************************************************************* @@ -1703,8 +1688,8 @@ void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, const char *name, const char { DEBUG(5,("init_srv_sess_info1_str\n")); - init_unistr2(&ss1->uni_name, name, strlen(name)+1); - init_unistr2(&ss1->uni_user, user, strlen(user)+1); + init_unistr2(&ss1->uni_name, name, UNI_STR_TERMINATE); + init_unistr2(&ss1->uni_user, user, UNI_STR_TERMINATE); } /******************************************************************* @@ -2075,8 +2060,8 @@ void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, const char *usr_name, const c { DEBUG(5,("init_srv_conn_info1_str\n")); - init_unistr2(&ss1->uni_usr_name, usr_name, strlen(usr_name)+1); - init_unistr2(&ss1->uni_net_name, net_name, strlen(net_name)+1); + init_unistr2(&ss1->uni_usr_name, usr_name, UNI_STR_TERMINATE); + init_unistr2(&ss1->uni_net_name, net_name, UNI_STR_TERMINATE); } /******************************************************************* @@ -2365,8 +2350,8 @@ void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, const char *user_name, const { DEBUG(5,("init_srv_file_info3_str\n")); - init_unistr2(&fi3->uni_path_name, path_name, strlen(path_name)+1); - init_unistr2(&fi3->uni_user_name, user_name, strlen(user_name)+1); + init_unistr2(&fi3->uni_path_name, path_name, UNI_STR_TERMINATE); + init_unistr2(&fi3->uni_user_name, user_name, UNI_STR_TERMINATE); } /******************************************************************* @@ -2628,7 +2613,7 @@ void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, const char *server, uint32 file_id) { q_n->ptr_srv_name = 1; - init_unistr2(&q_n->uni_srv_name, server, strlen(server) + 1); + init_unistr2(&q_n->uni_srv_name, server, UNI_STR_TERMINATE); q_n->file_id = file_id; } @@ -3586,6 +3571,5 @@ BOOL srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server) { q_u->ptr_srv_name = 1; - init_unistr2(&q_u->uni_srv_name, server, strlen(server) + 1); + init_unistr2(&q_u->uni_srv_name, server, UNI_STR_TERMINATE); } - -- cgit From cbe69f65f69b0c7b7c2d0d32005da488b50e52ba Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 1 Oct 2003 21:18:32 +0000 Subject: commit sign only patch from Andrew; bug 167; tested using 2k & XP clientspreviously joined to the Samba domain (This used to be commit 3802f5895ee18507c6f467bd11db0b1147a6fdfd) --- source3/rpc_parse/parse_prs.c | 147 +++++++++++++++++++++++++----------------- source3/rpc_parse/parse_rpc.c | 6 +- 2 files changed, 90 insertions(+), 63 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 81a9573077..b30c41c090 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -3,7 +3,8 @@ Samba memory buffer functions Copyright (C) Andrew Tridgell 1992-1997 Copyright (C) Luke Kenneth Casson Leighton 1996-1997 - Copyright (C) Jeremy Allison 1999. + Copyright (C) Jeremy Allison 1999 + Copyright (C) Andrew Bartlett 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 @@ -1337,47 +1338,6 @@ BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16], int len) return True; } -static void netsechash(uchar * key, uchar * data, int data_len) -{ - uchar hash[256]; - uchar index_i = 0; - uchar index_j = 0; - uchar j = 0; - int ind; - - for (ind = 0; ind < 256; ind++) - { - hash[ind] = (uchar) ind; - } - - for (ind = 0; ind < 256; ind++) - { - uchar tc; - - j += (hash[ind] + key[ind % 16]); - - tc = hash[ind]; - hash[ind] = hash[j]; - hash[j] = tc; - } - - for (ind = 0; ind < data_len; ind++) - { - uchar tc; - uchar t; - - index_i++; - index_j += hash[index_i]; - - tc = hash[index_i]; - hash[index_i] = hash[index_j]; - hash[index_j] = tc; - - t = hash[index_i] + hash[index_j]; - data[ind] ^= hash[t]; - } -} - /******************************************************************* Create a digest over the entire packet (including the data), and @@ -1400,7 +1360,7 @@ static void netsec_digest(struct netsec_auth_struct *a, MD5Update(&ctx3, zeros, sizeof(zeros)); MD5Update(&ctx3, verf->sig, sizeof(verf->sig)); if (auth_flags & AUTH_PIPE_SEAL) { - MD5Update(&ctx3, verf->data8, sizeof(verf->data8)); + MD5Update(&ctx3, verf->confounder, sizeof(verf->confounder)); } MD5Update(&ctx3, (const unsigned char *)data, data_len); MD5Final(whole_packet_digest, &ctx3); @@ -1456,10 +1416,29 @@ static void netsec_deal_with_seq_num(struct netsec_auth_struct *a, dump_data_pw("sequence_key:\n", sequence_key, sizeof(sequence_key)); dump_data_pw("seq_num (before):\n", verf->seq_num, sizeof(verf->seq_num)); - netsechash(sequence_key, verf->seq_num, 8); + SamOEMhash(verf->seq_num, sequence_key, 8); dump_data_pw("seq_num (after):\n", verf->seq_num, sizeof(verf->seq_num)); } +/******************************************************************* +creates an RPC_AUTH_NETSEC_CHK structure. +********************************************************************/ +static BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, + const uchar sig[8], + const uchar packet_digest[8], + const uchar seq_num[8], const uchar confounder[8]) +{ + if (chk == NULL) + return False; + + memcpy(chk->sig, sig, sizeof(chk->sig)); + memcpy(chk->packet_digest, packet_digest, sizeof(chk->packet_digest)); + memcpy(chk->seq_num, seq_num, sizeof(chk->seq_num)); + memcpy(chk->confounder, confounder, sizeof(chk->confounder)); + + return True; +} + /******************************************************************* Encode a blob of data using the netsec (schannel) alogrithm, also produceing @@ -1469,26 +1448,47 @@ static void netsec_deal_with_seq_num(struct netsec_auth_struct *a, ********************************************************************/ void netsec_encode(struct netsec_auth_struct *a, int auth_flags, enum netsec_direction direction, - RPC_AUTH_NETSEC_CHK * verf, char *data, size_t data_len) + RPC_AUTH_NETSEC_CHK * verf, + char *data, size_t data_len) { uchar digest_final[16]; + uchar confounder[8]; + uchar seq_num[8]; + static const uchar nullbytes[8]; + + static const uchar netsec_seal_sig[8] = NETSEC_SEAL_SIGNATURE; + static const uchar netsec_sign_sig[8] = NETSEC_SIGN_SIGNATURE; + const uchar *netsec_sig; DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%lu\n", a->seq_num, (unsigned long)data_len)); + + if (auth_flags & AUTH_PIPE_SEAL) { + netsec_sig = netsec_seal_sig; + } else if (auth_flags & AUTH_PIPE_SIGN) { + netsec_sig = netsec_sign_sig; + } + + /* fill the 'confounder' with random data */ + generate_random_buffer(confounder, sizeof(confounder), False); + dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); - RSIVAL(verf->seq_num, 0, a->seq_num); + RSIVAL(seq_num, 0, a->seq_num); switch (direction) { case SENDER_IS_INITIATOR: - SIVAL(verf->seq_num, 4, 0x80); + SIVAL(seq_num, 4, 0x80); break; case SENDER_IS_ACCEPTOR: - SIVAL(verf->seq_num, 4, 0x0); + SIVAL(seq_num, 4, 0x0); break; } - dump_data_pw("verf->seq_num:\n", verf->seq_num, sizeof(verf->seq_num)); + dump_data_pw("verf->seq_num:\n", seq_num, sizeof(verf->seq_num)); + init_rpc_auth_netsec_chk(verf, netsec_sig, nullbytes, + seq_num, confounder); + /* produce a digest of the packet to prove it's legit (before we seal it) */ netsec_digest(a, auth_flags, verf, data, data_len, digest_final); memcpy(verf->packet_digest, digest_final, sizeof(verf->packet_digest)); @@ -1500,14 +1500,14 @@ void netsec_encode(struct netsec_auth_struct *a, int auth_flags, netsec_get_sealing_key(a, verf, sealing_key); /* encode the verification data */ - dump_data_pw("verf->data8:\n", verf->data8, sizeof(verf->data8)); - netsechash(sealing_key, verf->data8, 8); + dump_data_pw("verf->confounder:\n", verf->confounder, sizeof(verf->confounder)); + SamOEMhash(verf->confounder, sealing_key, 8); - dump_data_pw("verf->data8_enc:\n", verf->data8, sizeof(verf->data8)); + dump_data_pw("verf->confounder_enc:\n", verf->confounder, sizeof(verf->confounder)); /* encode the packet payload */ dump_data_pw("data:\n", (const unsigned char *)data, data_len); - netsechash(sealing_key, (unsigned char *)data, data_len); + SamOEMhash((unsigned char *)data, sealing_key, data_len); dump_data_pw("data_enc:\n", (const unsigned char *)data, data_len); } @@ -1531,8 +1531,21 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, { uchar digest_final[16]; - /* Create the expected sequence number for comparison */ + static const uchar netsec_seal_sig[8] = NETSEC_SEAL_SIGNATURE; + static const uchar netsec_sign_sig[8] = NETSEC_SIGN_SIGNATURE; + const uchar *netsec_sig; + uchar seq_num[8]; + + DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%lu\n", a->seq_num, (unsigned long)data_len)); + + if (auth_flags & AUTH_PIPE_SEAL) { + netsec_sig = netsec_seal_sig; + } else if (auth_flags & AUTH_PIPE_SIGN) { + netsec_sig = netsec_sign_sig; + } + + /* Create the expected sequence number for comparison */ RSIVAL(seq_num, 0, a->seq_num); switch (direction) { @@ -1560,6 +1573,20 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, digest, as supplied by the client. We check that it's a valid checksum after the decode, below */ + DEBUG(2, ("netsec_decode: FAILED: packet sequence number:\n")); + dump_data(2, verf->seq_num, sizeof(verf->seq_num)); + DEBUG(2, ("should be:\n")); + dump_data(2, seq_num, sizeof(seq_num)); + + return False; + } + + if (memcmp(verf->sig, netsec_sig, sizeof(verf->sig))) { + /* Validate that the other end sent the expected header */ + DEBUG(2, ("netsec_decode: FAILED: packet header:\n")); + dump_data(2, verf->sig, sizeof(verf->sig)); + DEBUG(2, ("should be:\n")); + dump_data(2, netsec_sig, sizeof(netsec_sig)); return False; } @@ -1570,16 +1597,16 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, netsec_get_sealing_key(a, verf, sealing_key); /* extract the verification data */ - dump_data_pw("verf->data8:\n", verf->data8, - sizeof(verf->data8)); - netsechash(sealing_key, verf->data8, 8); + dump_data_pw("verf->confounder:\n", verf->confounder, + sizeof(verf->confounder)); + SamOEMhash(verf->confounder, sealing_key, 8); - dump_data_pw("verf->data8_dec:\n", verf->data8, - sizeof(verf->data8)); + dump_data_pw("verf->confounder_dec:\n", verf->confounder, + sizeof(verf->confounder)); /* extract the packet payload */ dump_data_pw("data :\n", (const unsigned char *)data, data_len); - netsechash(sealing_key, (unsigned char *)data, data_len); + SamOEMhash((unsigned char *)data, sealing_key, data_len); dump_data_pw("datadec:\n", (const unsigned char *)data, data_len); } diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 34ba62caa9..558378548a 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -1175,7 +1175,7 @@ creates an RPC_AUTH_NETSEC_CHK structure. BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, const uchar sig[8], const uchar packet_digest[8], - const uchar seq_num[8], const uchar data8[8]) + const uchar seq_num[8], const uchar confounder[8]) { if (chk == NULL) return False; @@ -1183,7 +1183,7 @@ BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, memcpy(chk->sig, sig, sizeof(chk->sig)); memcpy(chk->packet_digest, packet_digest, sizeof(chk->packet_digest)); memcpy(chk->seq_num, seq_num, sizeof(chk->seq_num)); - memcpy(chk->data8, data8, sizeof(chk->data8)); + memcpy(chk->confounder, confounder, sizeof(chk->confounder)); return True; } @@ -1203,7 +1203,7 @@ BOOL smb_io_rpc_auth_netsec_chk(const char *desc, RPC_AUTH_NETSEC_CHK * chk, prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)); prs_uint8s(False, "seq_num", ps, depth, chk->seq_num, sizeof(chk->seq_num)); prs_uint8s(False, "packet_digest", ps, depth, chk->packet_digest, sizeof(chk->packet_digest)); - prs_uint8s(False, "data8", ps, depth, chk->data8, sizeof(chk->data8)); + prs_uint8s(False, "data8", ps, depth, chk->confounder, sizeof(chk->confounder)); return True; } -- cgit From e9568f8df282a8de58d077fb88b54b43023795ca Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 1 Oct 2003 22:00:19 +0000 Subject: commit sign only patch from Andrew; bug 167; tested using 2k & XP clientspreviously joined to the Samba domain (This used to be commit 9d2e585e5e6f9066c6901aa8d8308734f8667296) --- source3/rpc_parse/parse_prs.c | 147 +++++++++++++++++++++++++----------------- source3/rpc_parse/parse_rpc.c | 6 +- 2 files changed, 90 insertions(+), 63 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 81a9573077..b30c41c090 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -3,7 +3,8 @@ Samba memory buffer functions Copyright (C) Andrew Tridgell 1992-1997 Copyright (C) Luke Kenneth Casson Leighton 1996-1997 - Copyright (C) Jeremy Allison 1999. + Copyright (C) Jeremy Allison 1999 + Copyright (C) Andrew Bartlett 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 @@ -1337,47 +1338,6 @@ BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16], int len) return True; } -static void netsechash(uchar * key, uchar * data, int data_len) -{ - uchar hash[256]; - uchar index_i = 0; - uchar index_j = 0; - uchar j = 0; - int ind; - - for (ind = 0; ind < 256; ind++) - { - hash[ind] = (uchar) ind; - } - - for (ind = 0; ind < 256; ind++) - { - uchar tc; - - j += (hash[ind] + key[ind % 16]); - - tc = hash[ind]; - hash[ind] = hash[j]; - hash[j] = tc; - } - - for (ind = 0; ind < data_len; ind++) - { - uchar tc; - uchar t; - - index_i++; - index_j += hash[index_i]; - - tc = hash[index_i]; - hash[index_i] = hash[index_j]; - hash[index_j] = tc; - - t = hash[index_i] + hash[index_j]; - data[ind] ^= hash[t]; - } -} - /******************************************************************* Create a digest over the entire packet (including the data), and @@ -1400,7 +1360,7 @@ static void netsec_digest(struct netsec_auth_struct *a, MD5Update(&ctx3, zeros, sizeof(zeros)); MD5Update(&ctx3, verf->sig, sizeof(verf->sig)); if (auth_flags & AUTH_PIPE_SEAL) { - MD5Update(&ctx3, verf->data8, sizeof(verf->data8)); + MD5Update(&ctx3, verf->confounder, sizeof(verf->confounder)); } MD5Update(&ctx3, (const unsigned char *)data, data_len); MD5Final(whole_packet_digest, &ctx3); @@ -1456,10 +1416,29 @@ static void netsec_deal_with_seq_num(struct netsec_auth_struct *a, dump_data_pw("sequence_key:\n", sequence_key, sizeof(sequence_key)); dump_data_pw("seq_num (before):\n", verf->seq_num, sizeof(verf->seq_num)); - netsechash(sequence_key, verf->seq_num, 8); + SamOEMhash(verf->seq_num, sequence_key, 8); dump_data_pw("seq_num (after):\n", verf->seq_num, sizeof(verf->seq_num)); } +/******************************************************************* +creates an RPC_AUTH_NETSEC_CHK structure. +********************************************************************/ +static BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, + const uchar sig[8], + const uchar packet_digest[8], + const uchar seq_num[8], const uchar confounder[8]) +{ + if (chk == NULL) + return False; + + memcpy(chk->sig, sig, sizeof(chk->sig)); + memcpy(chk->packet_digest, packet_digest, sizeof(chk->packet_digest)); + memcpy(chk->seq_num, seq_num, sizeof(chk->seq_num)); + memcpy(chk->confounder, confounder, sizeof(chk->confounder)); + + return True; +} + /******************************************************************* Encode a blob of data using the netsec (schannel) alogrithm, also produceing @@ -1469,26 +1448,47 @@ static void netsec_deal_with_seq_num(struct netsec_auth_struct *a, ********************************************************************/ void netsec_encode(struct netsec_auth_struct *a, int auth_flags, enum netsec_direction direction, - RPC_AUTH_NETSEC_CHK * verf, char *data, size_t data_len) + RPC_AUTH_NETSEC_CHK * verf, + char *data, size_t data_len) { uchar digest_final[16]; + uchar confounder[8]; + uchar seq_num[8]; + static const uchar nullbytes[8]; + + static const uchar netsec_seal_sig[8] = NETSEC_SEAL_SIGNATURE; + static const uchar netsec_sign_sig[8] = NETSEC_SIGN_SIGNATURE; + const uchar *netsec_sig; DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%lu\n", a->seq_num, (unsigned long)data_len)); + + if (auth_flags & AUTH_PIPE_SEAL) { + netsec_sig = netsec_seal_sig; + } else if (auth_flags & AUTH_PIPE_SIGN) { + netsec_sig = netsec_sign_sig; + } + + /* fill the 'confounder' with random data */ + generate_random_buffer(confounder, sizeof(confounder), False); + dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); - RSIVAL(verf->seq_num, 0, a->seq_num); + RSIVAL(seq_num, 0, a->seq_num); switch (direction) { case SENDER_IS_INITIATOR: - SIVAL(verf->seq_num, 4, 0x80); + SIVAL(seq_num, 4, 0x80); break; case SENDER_IS_ACCEPTOR: - SIVAL(verf->seq_num, 4, 0x0); + SIVAL(seq_num, 4, 0x0); break; } - dump_data_pw("verf->seq_num:\n", verf->seq_num, sizeof(verf->seq_num)); + dump_data_pw("verf->seq_num:\n", seq_num, sizeof(verf->seq_num)); + init_rpc_auth_netsec_chk(verf, netsec_sig, nullbytes, + seq_num, confounder); + /* produce a digest of the packet to prove it's legit (before we seal it) */ netsec_digest(a, auth_flags, verf, data, data_len, digest_final); memcpy(verf->packet_digest, digest_final, sizeof(verf->packet_digest)); @@ -1500,14 +1500,14 @@ void netsec_encode(struct netsec_auth_struct *a, int auth_flags, netsec_get_sealing_key(a, verf, sealing_key); /* encode the verification data */ - dump_data_pw("verf->data8:\n", verf->data8, sizeof(verf->data8)); - netsechash(sealing_key, verf->data8, 8); + dump_data_pw("verf->confounder:\n", verf->confounder, sizeof(verf->confounder)); + SamOEMhash(verf->confounder, sealing_key, 8); - dump_data_pw("verf->data8_enc:\n", verf->data8, sizeof(verf->data8)); + dump_data_pw("verf->confounder_enc:\n", verf->confounder, sizeof(verf->confounder)); /* encode the packet payload */ dump_data_pw("data:\n", (const unsigned char *)data, data_len); - netsechash(sealing_key, (unsigned char *)data, data_len); + SamOEMhash((unsigned char *)data, sealing_key, data_len); dump_data_pw("data_enc:\n", (const unsigned char *)data, data_len); } @@ -1531,8 +1531,21 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, { uchar digest_final[16]; - /* Create the expected sequence number for comparison */ + static const uchar netsec_seal_sig[8] = NETSEC_SEAL_SIGNATURE; + static const uchar netsec_sign_sig[8] = NETSEC_SIGN_SIGNATURE; + const uchar *netsec_sig; + uchar seq_num[8]; + + DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%lu\n", a->seq_num, (unsigned long)data_len)); + + if (auth_flags & AUTH_PIPE_SEAL) { + netsec_sig = netsec_seal_sig; + } else if (auth_flags & AUTH_PIPE_SIGN) { + netsec_sig = netsec_sign_sig; + } + + /* Create the expected sequence number for comparison */ RSIVAL(seq_num, 0, a->seq_num); switch (direction) { @@ -1560,6 +1573,20 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, digest, as supplied by the client. We check that it's a valid checksum after the decode, below */ + DEBUG(2, ("netsec_decode: FAILED: packet sequence number:\n")); + dump_data(2, verf->seq_num, sizeof(verf->seq_num)); + DEBUG(2, ("should be:\n")); + dump_data(2, seq_num, sizeof(seq_num)); + + return False; + } + + if (memcmp(verf->sig, netsec_sig, sizeof(verf->sig))) { + /* Validate that the other end sent the expected header */ + DEBUG(2, ("netsec_decode: FAILED: packet header:\n")); + dump_data(2, verf->sig, sizeof(verf->sig)); + DEBUG(2, ("should be:\n")); + dump_data(2, netsec_sig, sizeof(netsec_sig)); return False; } @@ -1570,16 +1597,16 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, netsec_get_sealing_key(a, verf, sealing_key); /* extract the verification data */ - dump_data_pw("verf->data8:\n", verf->data8, - sizeof(verf->data8)); - netsechash(sealing_key, verf->data8, 8); + dump_data_pw("verf->confounder:\n", verf->confounder, + sizeof(verf->confounder)); + SamOEMhash(verf->confounder, sealing_key, 8); - dump_data_pw("verf->data8_dec:\n", verf->data8, - sizeof(verf->data8)); + dump_data_pw("verf->confounder_dec:\n", verf->confounder, + sizeof(verf->confounder)); /* extract the packet payload */ dump_data_pw("data :\n", (const unsigned char *)data, data_len); - netsechash(sealing_key, (unsigned char *)data, data_len); + SamOEMhash((unsigned char *)data, sealing_key, data_len); dump_data_pw("datadec:\n", (const unsigned char *)data, data_len); } diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 34ba62caa9..558378548a 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -1175,7 +1175,7 @@ creates an RPC_AUTH_NETSEC_CHK structure. BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, const uchar sig[8], const uchar packet_digest[8], - const uchar seq_num[8], const uchar data8[8]) + const uchar seq_num[8], const uchar confounder[8]) { if (chk == NULL) return False; @@ -1183,7 +1183,7 @@ BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, memcpy(chk->sig, sig, sizeof(chk->sig)); memcpy(chk->packet_digest, packet_digest, sizeof(chk->packet_digest)); memcpy(chk->seq_num, seq_num, sizeof(chk->seq_num)); - memcpy(chk->data8, data8, sizeof(chk->data8)); + memcpy(chk->confounder, confounder, sizeof(chk->confounder)); return True; } @@ -1203,7 +1203,7 @@ BOOL smb_io_rpc_auth_netsec_chk(const char *desc, RPC_AUTH_NETSEC_CHK * chk, prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)); prs_uint8s(False, "seq_num", ps, depth, chk->seq_num, sizeof(chk->seq_num)); prs_uint8s(False, "packet_digest", ps, depth, chk->packet_digest, sizeof(chk->packet_digest)); - prs_uint8s(False, "data8", ps, depth, chk->data8, sizeof(chk->data8)); + prs_uint8s(False, "data8", ps, depth, chk->confounder, sizeof(chk->confounder)); return True; } -- cgit From ad12b87aeb3b838a330633f151bacdd30fec0a1c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 1 Oct 2003 23:04:34 +0000 Subject: Remove duplicate function (now in rpc_parse/parse_prs.c) and fix a RPC debug (I renamed the element of the structure). Andrew Bartlett (This used to be commit 641652cad97b761ba11d4e89b7c9ad098c7dd1c2) --- source3/rpc_parse/parse_rpc.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 558378548a..1752e10114 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -1168,26 +1168,6 @@ BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, return True; } - -/******************************************************************* -creates an RPC_AUTH_NETSEC_CHK structure. -********************************************************************/ -BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, - const uchar sig[8], - const uchar packet_digest[8], - const uchar seq_num[8], const uchar confounder[8]) -{ - if (chk == NULL) - return False; - - memcpy(chk->sig, sig, sizeof(chk->sig)); - memcpy(chk->packet_digest, packet_digest, sizeof(chk->packet_digest)); - memcpy(chk->seq_num, seq_num, sizeof(chk->seq_num)); - memcpy(chk->confounder, confounder, sizeof(chk->confounder)); - - return True; -} - /******************************************************************* reads or writes an RPC_AUTH_NETSEC_CHK structure. ********************************************************************/ @@ -1203,7 +1183,7 @@ BOOL smb_io_rpc_auth_netsec_chk(const char *desc, RPC_AUTH_NETSEC_CHK * chk, prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)); prs_uint8s(False, "seq_num", ps, depth, chk->seq_num, sizeof(chk->seq_num)); prs_uint8s(False, "packet_digest", ps, depth, chk->packet_digest, sizeof(chk->packet_digest)); - prs_uint8s(False, "data8", ps, depth, chk->confounder, sizeof(chk->confounder)); + prs_uint8s(False, "confounder", ps, depth, chk->confounder, sizeof(chk->confounder)); return True; } -- cgit From faca10b35d5a3a311f55301889dca9743ad0e176 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 3 Oct 2003 15:07:15 +0000 Subject: abstract UUID parsing code to an individual function; patch from Anthony (This used to be commit 9365c619d6feb15289d963e9e70e1f947b7f8c3f) --- source3/rpc_parse/parse_rpc.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 1752e10114..5b97c44d65 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -243,29 +243,48 @@ BOOL smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) } /******************************************************************* - Reads or writes an RPC_IFACE structure. + Reads or writes an RPC_UUID structure. ********************************************************************/ -static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) +static BOOL smb_io_rpc_uuid(const char *desc, RPC_UUID *uuid, prs_struct *ps, int depth) { if (ifc == NULL) return False; - prs_debug(ps, depth, desc, "smb_io_rpc_iface"); + prs_debug(ps, depth, desc, "smb_io_rpc_uuid"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32 ("data ", ps, depth, &ifc->uuid.time_low)) + if(!prs_uint32 ("data ", ps, depth, &uuid->time_low)) + return False; + if(!prs_uint16 ("data ", ps, depth, &uuid->time_mid)) + return False; + if(!prs_uint16 ("data ", ps, depth, &uuid->time_hi_and_version)) return False; - if(!prs_uint16 ("data ", ps, depth, &ifc->uuid.time_mid)) + + if(!prs_uint8s (False, "data ", ps, depth, uuid->remaining, sizeof(uuid->remaining))) return False; - if(!prs_uint16 ("data ", ps, depth, &ifc->uuid.time_hi_and_version)) + + return true; +} + +/******************************************************************* + Reads or writes an RPC_IFACE structure. +********************************************************************/ + +static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) +{ + if (ifc == NULL) return False; - if(!prs_uint8s (False, "data ", ps, depth, ifc->uuid.remaining, sizeof(ifc->uuid.remaining))) + prs_debug(ps, depth, desc, "smb_io_rpc_iface"); + depth++; + + if (!smb_io_rpc_uuid( "uuid", ps, depth, &ifc->uuid)) return False; + if(!prs_uint32 ( "version", ps, depth, &ifc->version)) return False; -- cgit From 8ae168b46df07414f1d56a74e2ecb8aa2332d50a Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 3 Oct 2003 15:08:16 +0000 Subject: abstract UUID parsing code to an individual function; patch from Anthony (This used to be commit 6cbdbdf9e1e76837c8ef03e795db11caa74ccf18) --- source3/rpc_parse/parse_rpc.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 558378548a..c1e663f877 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -243,29 +243,48 @@ BOOL smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) } /******************************************************************* - Reads or writes an RPC_IFACE structure. + Reads or writes an RPC_UUID structure. ********************************************************************/ -static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) +static BOOL smb_io_rpc_uuid(const char *desc, RPC_UUID *uuid, prs_struct *ps, int depth) { if (ifc == NULL) return False; - prs_debug(ps, depth, desc, "smb_io_rpc_iface"); + prs_debug(ps, depth, desc, "smb_io_rpc_uuid"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32 ("data ", ps, depth, &ifc->uuid.time_low)) + if(!prs_uint32 ("data ", ps, depth, &uuid->time_low)) + return False; + if(!prs_uint16 ("data ", ps, depth, &uuid->time_mid)) + return False; + if(!prs_uint16 ("data ", ps, depth, &uuid->time_hi_and_version)) return False; - if(!prs_uint16 ("data ", ps, depth, &ifc->uuid.time_mid)) + + if(!prs_uint8s (False, "data ", ps, depth, uuid->remaining, sizeof(uuid->remaining))) return False; - if(!prs_uint16 ("data ", ps, depth, &ifc->uuid.time_hi_and_version)) + + return true; +} + +/******************************************************************* + Reads or writes an RPC_IFACE structure. +********************************************************************/ + +static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) +{ + if (ifc == NULL) return False; - if(!prs_uint8s (False, "data ", ps, depth, ifc->uuid.remaining, sizeof(ifc->uuid.remaining))) + prs_debug(ps, depth, desc, "smb_io_rpc_iface"); + depth++; + + if (!smb_io_rpc_uuid( "uuid", ps, depth, &ifc->uuid)) return False; + if(!prs_uint32 ( "version", ps, depth, &ifc->version)) return False; -- cgit From c81c09d66ff4ed5c524312f73540862ded3335d2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 3 Oct 2003 20:13:11 +0000 Subject: Grrr. compile patches before you apply ! Jeremy. (This used to be commit dfbde4be7191895d79762855b21f5c62d53d5267) --- source3/rpc_parse/parse_rpc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 5b97c44d65..1ea59feaed 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -248,7 +248,7 @@ BOOL smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) static BOOL smb_io_rpc_uuid(const char *desc, RPC_UUID *uuid, prs_struct *ps, int depth) { - if (ifc == NULL) + if (uuid == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_uuid"); @@ -267,7 +267,7 @@ static BOOL smb_io_rpc_uuid(const char *desc, RPC_UUID *uuid, prs_struct *ps, in if(!prs_uint8s (False, "data ", ps, depth, uuid->remaining, sizeof(uuid->remaining))) return False; - return true; + return True; } /******************************************************************* @@ -282,10 +282,10 @@ static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, i prs_debug(ps, depth, desc, "smb_io_rpc_iface"); depth++; - if (!smb_io_rpc_uuid( "uuid", ps, depth, &ifc->uuid)) + if (!smb_io_rpc_uuid( "uuid", &ifc->uuid, ps, depth)) return False; - if(!prs_uint32 ( "version", ps, depth, &ifc->version)) + if(!prs_uint32 ("version", ps, depth, &ifc->version)) return False; return True; -- cgit From 762e7e1dff89cc14b0130fc9a22038b0845630a2 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 6 Oct 2003 01:24:48 +0000 Subject: split some security related functions in their own files. (no need to include all of smbd files to use some basic sec functions) also minor compile fixes (This used to be commit 66074d3b097d8cf2a231bf08c7f4db62da68189d) --- source3/rpc_parse/parse_lsa.c | 43 ++- source3/rpc_parse/parse_rpc.c | 6 +- source3/rpc_parse/parse_sec.c | 727 ------------------------------------------ 3 files changed, 32 insertions(+), 744 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 3a5b232dc3..22dbd5307a 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1809,14 +1809,20 @@ static BOOL lsa_io_privilege_set(const char *desc, PRIVILEGE_SET *r_c, prs_struc return True; } -void init_lsa_r_enum_privsaccount(LSA_R_ENUMPRIVSACCOUNT *r_u, LUID_ATTR *set, uint32 count, uint32 control) +NTSTATUS init_lsa_r_enum_privsaccount(TALLOC_CTX *mem_ctx, LSA_R_ENUMPRIVSACCOUNT *r_u, LUID_ATTR *set, uint32 count, uint32 control) { - r_u->ptr=1; - r_u->count=count; - r_u->set.set=set; - r_u->set.count=count; - r_u->set.control=control; - DEBUG(10,("init_lsa_r_enum_privsaccount: %d %d privileges\n", r_u->count, r_u->set.count)); + NTSTATUS ret; + + r_u->ptr = 1; + r_u->count = count; + + if (!NT_STATUS_IS_OK(ret = init_priv_with_ctx(mem_ctx, &(r_u->set)))) + return ret; + + if (!NT_STATUS_IS_OK(ret = dupalloc_luid_attr(r_u->set->mem_ctx, &(r_u->set->set), set))) + return ret; + + DEBUG(10,("init_lsa_r_enum_privsaccount: %d %d privileges\n", r_u->count, r_u->set->count)); } /******************************************************************* @@ -1840,13 +1846,16 @@ BOOL lsa_io_r_enum_privsaccount(const char *desc, LSA_R_ENUMPRIVSACCOUNT *r_c, p /* malloc memory if unmarshalling here */ - if (UNMARSHALLING(ps) && r_c->count!=0) { - if (!(r_c->set.set = (LUID_ATTR *)prs_alloc_mem(ps,sizeof(LUID_ATTR) * r_c->count))) + if (UNMARSHALLING(ps) && r_c->count != 0) { + if (!NT_STATUS_IS_OK(init_priv_with_ctx(ps->mem_ctx, &(r_c->set)))) + return False; + + if (!(r_c->set->set = (LUID_ATTR *)prs_alloc_mem(ps,sizeof(LUID_ATTR) * r_c->count))) return False; } - if(!lsa_io_privilege_set(desc, &r_c->set, ps, depth)) + if(!lsa_io_privilege_set(desc, r_c->set, ps, depth)) return False; } @@ -2008,11 +2017,14 @@ BOOL lsa_io_q_addprivs(const char *desc, LSA_Q_ADDPRIVS *r_c, prs_struct *ps, in return False; if (UNMARSHALLING(ps) && r_c->count!=0) { - if (!(r_c->set.set = (LUID_ATTR *)prs_alloc_mem(ps,sizeof(LUID_ATTR) * r_c->count))) + if (!NT_STATUS_IS_OK(init_priv_with_ctx(ps->mem_ctx, &(r_c->set)))) + return False; + + if (!(r_c->set->set = (LUID_ATTR *)prs_alloc_mem(ps, sizeof(LUID_ATTR) * r_c->count))) return False; } - if(!lsa_io_privilege_set(desc, &r_c->set, ps, depth)) + if(!lsa_io_privilege_set(desc, r_c->set, ps, depth)) return False; return True; @@ -2067,11 +2079,14 @@ BOOL lsa_io_q_removeprivs(const char *desc, LSA_Q_REMOVEPRIVS *r_c, prs_struct * return False; if (UNMARSHALLING(ps) && r_c->count!=0) { - if (!(r_c->set.set = (LUID_ATTR *)prs_alloc_mem(ps,sizeof(LUID_ATTR) * r_c->count))) + if (!NT_STATUS_IS_OK(init_priv_with_ctx(ps->mem_ctx, &(r_c->set)))) + return False; + + if (!(r_c->set->set = (LUID_ATTR *)prs_alloc_mem(ps, sizeof(LUID_ATTR) * r_c->count))) return False; } - if(!lsa_io_privilege_set(desc, &r_c->set, ps, depth)) + if(!lsa_io_privilege_set(desc, r_c->set, ps, depth)) return False; } diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index c1e663f877..7e51f1e35b 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -248,7 +248,7 @@ BOOL smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) static BOOL smb_io_rpc_uuid(const char *desc, RPC_UUID *uuid, prs_struct *ps, int depth) { - if (ifc == NULL) + if (uuid == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_uuid"); @@ -267,7 +267,7 @@ static BOOL smb_io_rpc_uuid(const char *desc, RPC_UUID *uuid, prs_struct *ps, in if(!prs_uint8s (False, "data ", ps, depth, uuid->remaining, sizeof(uuid->remaining))) return False; - return true; + return True; } /******************************************************************* @@ -282,7 +282,7 @@ static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, i prs_debug(ps, depth, desc, "smb_io_rpc_iface"); depth++; - if (!smb_io_rpc_uuid( "uuid", ps, depth, &ifc->uuid)) + if (!smb_io_rpc_uuid( "uuid", &ifc->uuid, ps, depth)) return False; if(!prs_uint32 ( "version", ps, depth, &ifc->version)) diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 0ed930c08d..bf43ef288a 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -27,15 +27,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/******************************************************************* - Sets up a SEC_ACCESS structure. -********************************************************************/ - -void init_sec_access(SEC_ACCESS *t, uint32 mask) -{ - t->mask = mask; -} - /******************************************************************* Reads or writes a SEC_ACCESS structure. ********************************************************************/ @@ -54,51 +45,6 @@ BOOL sec_io_access(const char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) return True; } -/******************************************************************* - Check if ACE has OBJECT type. -********************************************************************/ - -BOOL sec_ace_object(uint8 type) -{ - if (type == SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT || - type == SEC_ACE_TYPE_ACCESS_DENIED_OBJECT || - type == SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT || - type == SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT) { - return True; - } - return False; -} - -/******************************************************************* - copy a SEC_ACE structure. -********************************************************************/ -void sec_ace_copy(SEC_ACE *ace_dest, SEC_ACE *ace_src) -{ - ace_dest->type = ace_src->type; - ace_dest->flags = ace_src->flags; - ace_dest->size = ace_src->size; - ace_dest->info.mask = ace_src->info.mask; - ace_dest->obj_flags = ace_src->obj_flags; - memcpy(&ace_dest->obj_guid, &ace_src->obj_guid, GUID_SIZE); - memcpy(&ace_dest->inh_guid, &ace_src->inh_guid, GUID_SIZE); - sid_copy(&ace_dest->trustee, &ace_src->trustee); -} - -/******************************************************************* - Sets up a SEC_ACE structure. -********************************************************************/ - -void init_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 flag) -{ - t->type = type; - t->flags = flag; - t->size = sid_size(sid) + 8; - t->info = mask; - - ZERO_STRUCTP(&t->trustee); - sid_copy(&t->trustee, sid); -} - /******************************************************************* Reads or writes a SEC_ACE structure. ********************************************************************/ @@ -153,127 +99,6 @@ BOOL sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth) return True; } -/******************************************************************* - adds new SID with its permissions to ACE list -********************************************************************/ - -NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, unsigned *num, DOM_SID *sid, uint32 mask) -{ - unsigned int i = 0; - - if (!ctx || !new || !old || !sid || !num) return NT_STATUS_INVALID_PARAMETER; - - *num += 1; - - if((new[0] = (SEC_ACE *) talloc_zero(ctx, (*num) * sizeof(SEC_ACE))) == 0) - return NT_STATUS_NO_MEMORY; - - for (i = 0; i < *num - 1; i ++) - sec_ace_copy(&(*new)[i], &old[i]); - - (*new)[i].type = 0; - (*new)[i].flags = 0; - (*new)[i].size = SEC_ACE_HEADER_SIZE + sid_size(sid); - (*new)[i].info.mask = mask; - sid_copy(&(*new)[i].trustee, sid); - return NT_STATUS_OK; -} - -/******************************************************************* - modify SID's permissions at ACL -********************************************************************/ - -NTSTATUS sec_ace_mod_sid(SEC_ACE *ace, size_t num, DOM_SID *sid, uint32 mask) -{ - unsigned int i = 0; - - if (!ace || !sid) return NT_STATUS_INVALID_PARAMETER; - - for (i = 0; i < num; i ++) { - if (sid_compare(&ace[i].trustee, sid) == 0) { - ace[i].info.mask = mask; - return NT_STATUS_OK; - } - } - return NT_STATUS_NOT_FOUND; -} - -/******************************************************************* - delete SID from ACL -********************************************************************/ - -static NTSTATUS sec_ace_del_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, uint32 *num, DOM_SID *sid) -{ - unsigned int i = 0; - unsigned int n_del = 0; - - if (!ctx || !new || !old || !sid || !num) return NT_STATUS_INVALID_PARAMETER; - - if((new[0] = (SEC_ACE *) talloc_zero(ctx, (*num) * sizeof(SEC_ACE))) == 0) - return NT_STATUS_NO_MEMORY; - - for (i = 0; i < *num; i ++) { - if (sid_compare(&old[i].trustee, sid) != 0) - sec_ace_copy(&(*new)[i], &old[i]); - else - n_del ++; - } - if (n_del == 0) - return NT_STATUS_NOT_FOUND; - else { - *num -= n_del; - return NT_STATUS_OK; - } -} - -/******************************************************************* - Create a SEC_ACL structure. -********************************************************************/ - -SEC_ACL *make_sec_acl(TALLOC_CTX *ctx, uint16 revision, int num_aces, SEC_ACE *ace_list) -{ - SEC_ACL *dst; - int i; - - if((dst = (SEC_ACL *)talloc_zero(ctx,sizeof(SEC_ACL))) == NULL) - return NULL; - - dst->revision = revision; - dst->num_aces = num_aces; - dst->size = SEC_ACL_HEADER_SIZE; - - /* Now we need to return a non-NULL address for the ace list even - if the number of aces required is zero. This is because there - is a distinct difference between a NULL ace and an ace with zero - entries in it. This is achieved by checking that num_aces is a - positive number. */ - - if ((num_aces) && - ((dst->ace = (SEC_ACE *)talloc(ctx, sizeof(SEC_ACE) * num_aces)) - == NULL)) { - return NULL; - } - - for (i = 0; i < num_aces; i++) { - dst->ace[i] = ace_list[i]; /* Structure copy. */ - dst->size += ace_list[i].size; - } - - return dst; -} - -/******************************************************************* - Duplicate a SEC_ACL structure. -********************************************************************/ - -SEC_ACL *dup_sec_acl(TALLOC_CTX *ctx, SEC_ACL *src) -{ - if(src == NULL) - return NULL; - - return make_sec_acl(ctx, src->revision, src->num_aces, src->ace); -} - /******************************************************************* Reads or writes a SEC_ACL structure. @@ -346,332 +171,6 @@ BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) return True; } -/******************************************************************* - Works out the linearization size of a SEC_DESC. -********************************************************************/ - -size_t sec_desc_size(SEC_DESC *psd) -{ - size_t offset; - - if (!psd) return 0; - - offset = SEC_DESC_HEADER_SIZE; - - /* don't align */ - - if (psd->owner_sid != NULL) - offset += sid_size(psd->owner_sid); - - if (psd->grp_sid != NULL) - offset += sid_size(psd->grp_sid); - - if (psd->sacl != NULL) - offset += psd->sacl->size; - - if (psd->dacl != NULL) - offset += psd->dacl->size; - - return offset; -} - -/******************************************************************* - Compares two SEC_ACE structures -********************************************************************/ - -BOOL sec_ace_equal(SEC_ACE *s1, SEC_ACE *s2) -{ - /* Trivial case */ - - if (!s1 && !s2) return True; - - /* Check top level stuff */ - - if (s1->type != s2->type || s1->flags != s2->flags || - s1->info.mask != s2->info.mask) { - return False; - } - - /* Check SID */ - - if (!sid_equal(&s1->trustee, &s2->trustee)) { - return False; - } - - return True; -} - -/******************************************************************* - Compares two SEC_ACL structures -********************************************************************/ - -BOOL sec_acl_equal(SEC_ACL *s1, SEC_ACL *s2) -{ - unsigned int i, j; - - /* Trivial cases */ - - if (!s1 && !s2) return True; - if (!s1 || !s2) return False; - - /* Check top level stuff */ - - if (s1->revision != s2->revision) { - DEBUG(10, ("sec_acl_equal(): revision differs (%d != %d)\n", - s1->revision, s2->revision)); - return False; - } - - if (s1->num_aces != s2->num_aces) { - DEBUG(10, ("sec_acl_equal(): num_aces differs (%d != %d)\n", - s1->revision, s2->revision)); - return False; - } - - /* The ACEs could be in any order so check each ACE in s1 against - each ACE in s2. */ - - for (i = 0; i < s1->num_aces; i++) { - BOOL found = False; - - for (j = 0; j < s2->num_aces; j++) { - if (sec_ace_equal(&s1->ace[i], &s2->ace[j])) { - found = True; - break; - } - } - - if (!found) return False; - } - - return True; -} - -/******************************************************************* - Compares two SEC_DESC structures -********************************************************************/ - -BOOL sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2) -{ - /* Trivial case */ - - if (!s1 && !s2) { - goto done; - } - - /* Check top level stuff */ - - if (s1->revision != s2->revision) { - DEBUG(10, ("sec_desc_equal(): revision differs (%d != %d)\n", - s1->revision, s2->revision)); - return False; - } - - if (s1->type!= s2->type) { - DEBUG(10, ("sec_desc_equal(): type differs (%d != %d)\n", - s1->type, s2->type)); - return False; - } - - /* Check owner and group */ - - if (!sid_equal(s1->owner_sid, s2->owner_sid)) { - fstring str1, str2; - - sid_to_string(str1, s1->owner_sid); - sid_to_string(str2, s2->owner_sid); - - DEBUG(10, ("sec_desc_equal(): owner differs (%s != %s)\n", - str1, str2)); - return False; - } - - if (!sid_equal(s1->grp_sid, s2->grp_sid)) { - fstring str1, str2; - - sid_to_string(str1, s1->grp_sid); - sid_to_string(str2, s2->grp_sid); - - DEBUG(10, ("sec_desc_equal(): group differs (%s != %s)\n", - str1, str2)); - return False; - } - - /* Check ACLs present in one but not the other */ - - if ((s1->dacl && !s2->dacl) || (!s1->dacl && s2->dacl) || - (s1->sacl && !s2->sacl) || (!s1->sacl && s2->sacl)) { - DEBUG(10, ("sec_desc_equal(): dacl or sacl not present\n")); - return False; - } - - /* Sigh - we have to do it the hard way by iterating over all - the ACEs in the ACLs */ - - if (!sec_acl_equal(s1->dacl, s2->dacl) || - !sec_acl_equal(s1->sacl, s2->sacl)) { - DEBUG(10, ("sec_desc_equal(): dacl/sacl list not equal\n")); - return False; - } - - done: - DEBUG(10, ("sec_desc_equal(): secdescs are identical\n")); - return True; -} - -/******************************************************************* - Merge part of security descriptor old_sec in to the empty sections of - security descriptor new_sec. -********************************************************************/ - -SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb) -{ - DOM_SID *owner_sid, *group_sid; - SEC_DESC_BUF *return_sdb; - SEC_ACL *dacl, *sacl; - SEC_DESC *psd = NULL; - uint16 secdesc_type; - size_t secdesc_size; - - /* Copy over owner and group sids. There seems to be no flag for - this so just check the pointer values. */ - - owner_sid = new_sdb->sec->owner_sid ? new_sdb->sec->owner_sid : - old_sdb->sec->owner_sid; - - group_sid = new_sdb->sec->grp_sid ? new_sdb->sec->grp_sid : - old_sdb->sec->grp_sid; - - secdesc_type = new_sdb->sec->type; - - /* Ignore changes to the system ACL. This has the effect of making - changes through the security tab audit button not sticking. - Perhaps in future Samba could implement these settings somehow. */ - - sacl = NULL; - secdesc_type &= ~SEC_DESC_SACL_PRESENT; - - /* Copy across discretionary ACL */ - - if (secdesc_type & SEC_DESC_DACL_PRESENT) { - dacl = new_sdb->sec->dacl; - } else { - dacl = old_sdb->sec->dacl; - } - - /* Create new security descriptor from bits */ - - psd = make_sec_desc(ctx, new_sdb->sec->revision, secdesc_type, - owner_sid, group_sid, sacl, dacl, &secdesc_size); - - return_sdb = make_sec_desc_buf(ctx, secdesc_size, psd); - - return(return_sdb); -} - -/******************************************************************* - Creates a SEC_DESC structure -********************************************************************/ - -SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, uint16 type, - DOM_SID *owner_sid, DOM_SID *grp_sid, - SEC_ACL *sacl, SEC_ACL *dacl, size_t *sd_size) -{ - SEC_DESC *dst; - uint32 offset = 0; - - *sd_size = 0; - - if(( dst = (SEC_DESC *)talloc_zero(ctx, sizeof(SEC_DESC))) == NULL) - return NULL; - - dst->revision = revision; - dst->type = type; - - if (sacl) - dst->type |= SEC_DESC_SACL_PRESENT; - if (dacl) - dst->type |= SEC_DESC_DACL_PRESENT; - - dst->off_owner_sid = 0; - dst->off_grp_sid = 0; - dst->off_sacl = 0; - dst->off_dacl = 0; - - if(owner_sid && ((dst->owner_sid = sid_dup_talloc(ctx,owner_sid)) == NULL)) - goto error_exit; - - if(grp_sid && ((dst->grp_sid = sid_dup_talloc(ctx,grp_sid)) == NULL)) - goto error_exit; - - if(sacl && ((dst->sacl = dup_sec_acl(ctx, sacl)) == NULL)) - goto error_exit; - - if(dacl && ((dst->dacl = dup_sec_acl(ctx, dacl)) == NULL)) - goto error_exit; - - offset = SEC_DESC_HEADER_SIZE; - - /* - * Work out the linearization sizes. - */ - - if (dst->sacl != NULL) { - dst->off_sacl = offset; - offset += dst->sacl->size; - } - - if (dst->dacl != NULL) { - dst->off_dacl = offset; - offset += dst->dacl->size; - } - - if (dst->owner_sid != NULL) { - dst->off_owner_sid = offset; - offset += sid_size(dst->owner_sid); - } - - if (dst->grp_sid != NULL) { - dst->off_grp_sid = offset; - offset += sid_size(dst->grp_sid); - } - - *sd_size = (size_t)offset; - return dst; - -error_exit: - - *sd_size = 0; - return NULL; -} - -/******************************************************************* - Duplicate a SEC_DESC structure. -********************************************************************/ - -SEC_DESC *dup_sec_desc( TALLOC_CTX *ctx, SEC_DESC *src) -{ - size_t dummy; - - if(src == NULL) - return NULL; - - return make_sec_desc( ctx, src->revision, src->type, - src->owner_sid, src->grp_sid, src->sacl, - src->dacl, &dummy); -} - -/******************************************************************* - Creates a SEC_DESC structure with typical defaults. -********************************************************************/ - -SEC_DESC *make_standard_sec_desc(TALLOC_CTX *ctx, DOM_SID *owner_sid, DOM_SID *grp_sid, - SEC_ACL *dacl, size_t *sd_size) -{ - return make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, - owner_sid, grp_sid, NULL, dacl, sd_size); -} - /******************************************************************* Reads or writes a SEC_DESC structure. If reading and the *ppsd = NULL, allocates the structure. @@ -807,42 +306,6 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) return True; } -/******************************************************************* - Creates a SEC_DESC_BUF structure. -********************************************************************/ - -SEC_DESC_BUF *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, SEC_DESC *sec_desc) -{ - SEC_DESC_BUF *dst; - - if((dst = (SEC_DESC_BUF *)talloc_zero(ctx, sizeof(SEC_DESC_BUF))) == NULL) - return NULL; - - /* max buffer size (allocated size) */ - dst->max_len = (uint32)len; - dst->len = (uint32)len; - - if(sec_desc && ((dst->sec = dup_sec_desc(ctx, sec_desc)) == NULL)) { - return NULL; - } - - dst->ptr = 0x1; - - return dst; -} - -/******************************************************************* - Duplicates a SEC_DESC_BUF structure. -********************************************************************/ - -SEC_DESC_BUF *dup_sec_desc_buf(TALLOC_CTX *ctx, SEC_DESC_BUF *src) -{ - if(src == NULL) - return NULL; - - return make_sec_desc_buf( ctx, src->len, src->sec); -} - /******************************************************************* Reads or writes a SEC_DESC_BUF structure. ********************************************************************/ @@ -901,193 +364,3 @@ BOOL sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int return True; } - -/******************************************************************* - Add a new SID with its permissions to SEC_DESC. -********************************************************************/ - -NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32 mask, size_t *sd_size) -{ - SEC_DESC *sd = 0; - SEC_ACL *dacl = 0; - SEC_ACE *ace = 0; - NTSTATUS status; - - *sd_size = 0; - - if (!ctx || !psd || !sid || !sd_size) - return NT_STATUS_INVALID_PARAMETER; - - status = sec_ace_add_sid(ctx, &ace, psd[0]->dacl->ace, &psd[0]->dacl->num_aces, sid, mask); - - if (!NT_STATUS_IS_OK(status)) - return status; - - if (!(dacl = make_sec_acl(ctx, psd[0]->dacl->revision, psd[0]->dacl->num_aces, ace))) - return NT_STATUS_UNSUCCESSFUL; - - if (!(sd = make_sec_desc(ctx, psd[0]->revision, psd[0]->type, psd[0]->owner_sid, - psd[0]->grp_sid, psd[0]->sacl, dacl, sd_size))) - return NT_STATUS_UNSUCCESSFUL; - - *psd = sd; - sd = 0; - return NT_STATUS_OK; -} - -/******************************************************************* - Modify a SID's permissions in a SEC_DESC. -********************************************************************/ - -NTSTATUS sec_desc_mod_sid(SEC_DESC *sd, DOM_SID *sid, uint32 mask) -{ - NTSTATUS status; - - if (!sd || !sid) - return NT_STATUS_INVALID_PARAMETER; - - status = sec_ace_mod_sid(sd->dacl->ace, sd->dacl->num_aces, sid, mask); - - if (!NT_STATUS_IS_OK(status)) - return status; - - return NT_STATUS_OK; -} - -/******************************************************************* - Delete a SID from a SEC_DESC. -********************************************************************/ - -NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t *sd_size) -{ - SEC_DESC *sd = 0; - SEC_ACL *dacl = 0; - SEC_ACE *ace = 0; - NTSTATUS status; - - *sd_size = 0; - - if (!ctx || !psd[0] || !sid || !sd_size) - return NT_STATUS_INVALID_PARAMETER; - - status = sec_ace_del_sid(ctx, &ace, psd[0]->dacl->ace, &psd[0]->dacl->num_aces, sid); - - if (!NT_STATUS_IS_OK(status)) - return status; - - if (!(dacl = make_sec_acl(ctx, psd[0]->dacl->revision, psd[0]->dacl->num_aces, ace))) - return NT_STATUS_UNSUCCESSFUL; - - if (!(sd = make_sec_desc(ctx, psd[0]->revision, psd[0]->type, psd[0]->owner_sid, - psd[0]->grp_sid, psd[0]->sacl, dacl, sd_size))) - return NT_STATUS_UNSUCCESSFUL; - - *psd = sd; - sd = 0; - return NT_STATUS_OK; -} - -/******************************************************************* - Comparison function to sort non-inherited first. -*******************************************************************/ - -static int nt_ace_inherit_comp( SEC_ACE *a1, SEC_ACE *a2) -{ - int a1_inh = a1->flags & SEC_ACE_FLAG_INHERITED_ACE; - int a2_inh = a2->flags & SEC_ACE_FLAG_INHERITED_ACE; - - if (a1_inh == a2_inh) - return 0; - - if (!a1_inh && a2_inh) - return -1; - return 1; -} - -/******************************************************************* - Comparison function to apply the order explained below in a group. -*******************************************************************/ - -static int nt_ace_canon_comp( SEC_ACE *a1, SEC_ACE *a2) -{ - if ((a1->type == SEC_ACE_TYPE_ACCESS_DENIED) && - (a2->type != SEC_ACE_TYPE_ACCESS_DENIED)) - return -1; - - if ((a2->type == SEC_ACE_TYPE_ACCESS_DENIED) && - (a1->type != SEC_ACE_TYPE_ACCESS_DENIED)) - return 1; - - /* Both access denied or access allowed. */ - - /* 1. ACEs that apply to the object itself */ - - if (!(a1->flags & SEC_ACE_FLAG_INHERIT_ONLY) && - (a2->flags & SEC_ACE_FLAG_INHERIT_ONLY)) - return -1; - else if (!(a2->flags & SEC_ACE_FLAG_INHERIT_ONLY) && - (a1->flags & SEC_ACE_FLAG_INHERIT_ONLY)) - return 1; - - /* 2. ACEs that apply to a subobject of the object, such as - * a property set or property. */ - - if (a1->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT) && - !(a2->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT))) - return -1; - else if (a2->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT) && - !(a1->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT))) - return 1; - - return 0; -} - -/******************************************************************* - Functions to convert a SEC_DESC ACE DACL list into canonical order. - JRA. - ---- from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/security/order_of_aces_in_a_dacl.asp - -The following describes the preferred order: - - To ensure that noninherited ACEs have precedence over inherited ACEs, - place all noninherited ACEs in a group before any inherited ACEs. - This ordering ensures, for example, that a noninherited access-denied ACE - is enforced regardless of any inherited ACE that allows access. - - Within the groups of noninherited ACEs and inherited ACEs, order ACEs according to ACE type, as the following shows: - 1. Access-denied ACEs that apply to the object itself - 2. Access-denied ACEs that apply to a subobject of the object, such as a property set or property - 3. Access-allowed ACEs that apply to the object itself - 4. Access-allowed ACEs that apply to a subobject of the object" - -********************************************************************/ - -void dacl_sort_into_canonical_order(SEC_ACE *srclist, unsigned int num_aces) -{ - unsigned int i; - - if (!srclist || num_aces == 0) - return; - - /* Sort so that non-inherited ACE's come first. */ - qsort( srclist, num_aces, sizeof(srclist[0]), QSORT_CAST nt_ace_inherit_comp); - - /* Find the boundary between non-inherited ACEs. */ - for (i = 0; i < num_aces; i++ ) { - SEC_ACE *curr_ace = &srclist[i]; - - if (curr_ace->flags & SEC_ACE_FLAG_INHERITED_ACE) - break; - } - - /* i now points at entry number of the first inherited ACE. */ - - /* Sort the non-inherited ACEs. */ - if (i) - qsort( srclist, i, sizeof(srclist[0]), QSORT_CAST nt_ace_canon_comp); - - /* Now sort the inherited ACEs. */ - if (num_aces - i) - qsort( &srclist[i], num_aces - i, sizeof(srclist[0]), QSORT_CAST nt_ace_canon_comp); -} -- cgit From b1f610ebb1ba1e6ae0f0e9fbbc703f6a4af68b67 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 6 Oct 2003 01:38:46 +0000 Subject: split some security related functions in their own files. (no need to include all of smbd files to use some basic sec functions) also minor compile fixes couldn't compile to test these due to some kerberos problems wirh 3.0, but on HEAD they're working well, so I suppose it's ok to commit (This used to be commit c78f2d0bd15ecd2ba643bb141cc35a3405787aa1) --- source3/rpc_parse/parse_lsa.c | 43 ++- source3/rpc_parse/parse_sec.c | 727 ------------------------------------------ 2 files changed, 29 insertions(+), 741 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 3a5b232dc3..22dbd5307a 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1809,14 +1809,20 @@ static BOOL lsa_io_privilege_set(const char *desc, PRIVILEGE_SET *r_c, prs_struc return True; } -void init_lsa_r_enum_privsaccount(LSA_R_ENUMPRIVSACCOUNT *r_u, LUID_ATTR *set, uint32 count, uint32 control) +NTSTATUS init_lsa_r_enum_privsaccount(TALLOC_CTX *mem_ctx, LSA_R_ENUMPRIVSACCOUNT *r_u, LUID_ATTR *set, uint32 count, uint32 control) { - r_u->ptr=1; - r_u->count=count; - r_u->set.set=set; - r_u->set.count=count; - r_u->set.control=control; - DEBUG(10,("init_lsa_r_enum_privsaccount: %d %d privileges\n", r_u->count, r_u->set.count)); + NTSTATUS ret; + + r_u->ptr = 1; + r_u->count = count; + + if (!NT_STATUS_IS_OK(ret = init_priv_with_ctx(mem_ctx, &(r_u->set)))) + return ret; + + if (!NT_STATUS_IS_OK(ret = dupalloc_luid_attr(r_u->set->mem_ctx, &(r_u->set->set), set))) + return ret; + + DEBUG(10,("init_lsa_r_enum_privsaccount: %d %d privileges\n", r_u->count, r_u->set->count)); } /******************************************************************* @@ -1840,13 +1846,16 @@ BOOL lsa_io_r_enum_privsaccount(const char *desc, LSA_R_ENUMPRIVSACCOUNT *r_c, p /* malloc memory if unmarshalling here */ - if (UNMARSHALLING(ps) && r_c->count!=0) { - if (!(r_c->set.set = (LUID_ATTR *)prs_alloc_mem(ps,sizeof(LUID_ATTR) * r_c->count))) + if (UNMARSHALLING(ps) && r_c->count != 0) { + if (!NT_STATUS_IS_OK(init_priv_with_ctx(ps->mem_ctx, &(r_c->set)))) + return False; + + if (!(r_c->set->set = (LUID_ATTR *)prs_alloc_mem(ps,sizeof(LUID_ATTR) * r_c->count))) return False; } - if(!lsa_io_privilege_set(desc, &r_c->set, ps, depth)) + if(!lsa_io_privilege_set(desc, r_c->set, ps, depth)) return False; } @@ -2008,11 +2017,14 @@ BOOL lsa_io_q_addprivs(const char *desc, LSA_Q_ADDPRIVS *r_c, prs_struct *ps, in return False; if (UNMARSHALLING(ps) && r_c->count!=0) { - if (!(r_c->set.set = (LUID_ATTR *)prs_alloc_mem(ps,sizeof(LUID_ATTR) * r_c->count))) + if (!NT_STATUS_IS_OK(init_priv_with_ctx(ps->mem_ctx, &(r_c->set)))) + return False; + + if (!(r_c->set->set = (LUID_ATTR *)prs_alloc_mem(ps, sizeof(LUID_ATTR) * r_c->count))) return False; } - if(!lsa_io_privilege_set(desc, &r_c->set, ps, depth)) + if(!lsa_io_privilege_set(desc, r_c->set, ps, depth)) return False; return True; @@ -2067,11 +2079,14 @@ BOOL lsa_io_q_removeprivs(const char *desc, LSA_Q_REMOVEPRIVS *r_c, prs_struct * return False; if (UNMARSHALLING(ps) && r_c->count!=0) { - if (!(r_c->set.set = (LUID_ATTR *)prs_alloc_mem(ps,sizeof(LUID_ATTR) * r_c->count))) + if (!NT_STATUS_IS_OK(init_priv_with_ctx(ps->mem_ctx, &(r_c->set)))) + return False; + + if (!(r_c->set->set = (LUID_ATTR *)prs_alloc_mem(ps, sizeof(LUID_ATTR) * r_c->count))) return False; } - if(!lsa_io_privilege_set(desc, &r_c->set, ps, depth)) + if(!lsa_io_privilege_set(desc, r_c->set, ps, depth)) return False; } diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 0ed930c08d..bf43ef288a 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -27,15 +27,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/******************************************************************* - Sets up a SEC_ACCESS structure. -********************************************************************/ - -void init_sec_access(SEC_ACCESS *t, uint32 mask) -{ - t->mask = mask; -} - /******************************************************************* Reads or writes a SEC_ACCESS structure. ********************************************************************/ @@ -54,51 +45,6 @@ BOOL sec_io_access(const char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) return True; } -/******************************************************************* - Check if ACE has OBJECT type. -********************************************************************/ - -BOOL sec_ace_object(uint8 type) -{ - if (type == SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT || - type == SEC_ACE_TYPE_ACCESS_DENIED_OBJECT || - type == SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT || - type == SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT) { - return True; - } - return False; -} - -/******************************************************************* - copy a SEC_ACE structure. -********************************************************************/ -void sec_ace_copy(SEC_ACE *ace_dest, SEC_ACE *ace_src) -{ - ace_dest->type = ace_src->type; - ace_dest->flags = ace_src->flags; - ace_dest->size = ace_src->size; - ace_dest->info.mask = ace_src->info.mask; - ace_dest->obj_flags = ace_src->obj_flags; - memcpy(&ace_dest->obj_guid, &ace_src->obj_guid, GUID_SIZE); - memcpy(&ace_dest->inh_guid, &ace_src->inh_guid, GUID_SIZE); - sid_copy(&ace_dest->trustee, &ace_src->trustee); -} - -/******************************************************************* - Sets up a SEC_ACE structure. -********************************************************************/ - -void init_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 flag) -{ - t->type = type; - t->flags = flag; - t->size = sid_size(sid) + 8; - t->info = mask; - - ZERO_STRUCTP(&t->trustee); - sid_copy(&t->trustee, sid); -} - /******************************************************************* Reads or writes a SEC_ACE structure. ********************************************************************/ @@ -153,127 +99,6 @@ BOOL sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth) return True; } -/******************************************************************* - adds new SID with its permissions to ACE list -********************************************************************/ - -NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, unsigned *num, DOM_SID *sid, uint32 mask) -{ - unsigned int i = 0; - - if (!ctx || !new || !old || !sid || !num) return NT_STATUS_INVALID_PARAMETER; - - *num += 1; - - if((new[0] = (SEC_ACE *) talloc_zero(ctx, (*num) * sizeof(SEC_ACE))) == 0) - return NT_STATUS_NO_MEMORY; - - for (i = 0; i < *num - 1; i ++) - sec_ace_copy(&(*new)[i], &old[i]); - - (*new)[i].type = 0; - (*new)[i].flags = 0; - (*new)[i].size = SEC_ACE_HEADER_SIZE + sid_size(sid); - (*new)[i].info.mask = mask; - sid_copy(&(*new)[i].trustee, sid); - return NT_STATUS_OK; -} - -/******************************************************************* - modify SID's permissions at ACL -********************************************************************/ - -NTSTATUS sec_ace_mod_sid(SEC_ACE *ace, size_t num, DOM_SID *sid, uint32 mask) -{ - unsigned int i = 0; - - if (!ace || !sid) return NT_STATUS_INVALID_PARAMETER; - - for (i = 0; i < num; i ++) { - if (sid_compare(&ace[i].trustee, sid) == 0) { - ace[i].info.mask = mask; - return NT_STATUS_OK; - } - } - return NT_STATUS_NOT_FOUND; -} - -/******************************************************************* - delete SID from ACL -********************************************************************/ - -static NTSTATUS sec_ace_del_sid(TALLOC_CTX *ctx, SEC_ACE **new, SEC_ACE *old, uint32 *num, DOM_SID *sid) -{ - unsigned int i = 0; - unsigned int n_del = 0; - - if (!ctx || !new || !old || !sid || !num) return NT_STATUS_INVALID_PARAMETER; - - if((new[0] = (SEC_ACE *) talloc_zero(ctx, (*num) * sizeof(SEC_ACE))) == 0) - return NT_STATUS_NO_MEMORY; - - for (i = 0; i < *num; i ++) { - if (sid_compare(&old[i].trustee, sid) != 0) - sec_ace_copy(&(*new)[i], &old[i]); - else - n_del ++; - } - if (n_del == 0) - return NT_STATUS_NOT_FOUND; - else { - *num -= n_del; - return NT_STATUS_OK; - } -} - -/******************************************************************* - Create a SEC_ACL structure. -********************************************************************/ - -SEC_ACL *make_sec_acl(TALLOC_CTX *ctx, uint16 revision, int num_aces, SEC_ACE *ace_list) -{ - SEC_ACL *dst; - int i; - - if((dst = (SEC_ACL *)talloc_zero(ctx,sizeof(SEC_ACL))) == NULL) - return NULL; - - dst->revision = revision; - dst->num_aces = num_aces; - dst->size = SEC_ACL_HEADER_SIZE; - - /* Now we need to return a non-NULL address for the ace list even - if the number of aces required is zero. This is because there - is a distinct difference between a NULL ace and an ace with zero - entries in it. This is achieved by checking that num_aces is a - positive number. */ - - if ((num_aces) && - ((dst->ace = (SEC_ACE *)talloc(ctx, sizeof(SEC_ACE) * num_aces)) - == NULL)) { - return NULL; - } - - for (i = 0; i < num_aces; i++) { - dst->ace[i] = ace_list[i]; /* Structure copy. */ - dst->size += ace_list[i].size; - } - - return dst; -} - -/******************************************************************* - Duplicate a SEC_ACL structure. -********************************************************************/ - -SEC_ACL *dup_sec_acl(TALLOC_CTX *ctx, SEC_ACL *src) -{ - if(src == NULL) - return NULL; - - return make_sec_acl(ctx, src->revision, src->num_aces, src->ace); -} - /******************************************************************* Reads or writes a SEC_ACL structure. @@ -346,332 +171,6 @@ BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) return True; } -/******************************************************************* - Works out the linearization size of a SEC_DESC. -********************************************************************/ - -size_t sec_desc_size(SEC_DESC *psd) -{ - size_t offset; - - if (!psd) return 0; - - offset = SEC_DESC_HEADER_SIZE; - - /* don't align */ - - if (psd->owner_sid != NULL) - offset += sid_size(psd->owner_sid); - - if (psd->grp_sid != NULL) - offset += sid_size(psd->grp_sid); - - if (psd->sacl != NULL) - offset += psd->sacl->size; - - if (psd->dacl != NULL) - offset += psd->dacl->size; - - return offset; -} - -/******************************************************************* - Compares two SEC_ACE structures -********************************************************************/ - -BOOL sec_ace_equal(SEC_ACE *s1, SEC_ACE *s2) -{ - /* Trivial case */ - - if (!s1 && !s2) return True; - - /* Check top level stuff */ - - if (s1->type != s2->type || s1->flags != s2->flags || - s1->info.mask != s2->info.mask) { - return False; - } - - /* Check SID */ - - if (!sid_equal(&s1->trustee, &s2->trustee)) { - return False; - } - - return True; -} - -/******************************************************************* - Compares two SEC_ACL structures -********************************************************************/ - -BOOL sec_acl_equal(SEC_ACL *s1, SEC_ACL *s2) -{ - unsigned int i, j; - - /* Trivial cases */ - - if (!s1 && !s2) return True; - if (!s1 || !s2) return False; - - /* Check top level stuff */ - - if (s1->revision != s2->revision) { - DEBUG(10, ("sec_acl_equal(): revision differs (%d != %d)\n", - s1->revision, s2->revision)); - return False; - } - - if (s1->num_aces != s2->num_aces) { - DEBUG(10, ("sec_acl_equal(): num_aces differs (%d != %d)\n", - s1->revision, s2->revision)); - return False; - } - - /* The ACEs could be in any order so check each ACE in s1 against - each ACE in s2. */ - - for (i = 0; i < s1->num_aces; i++) { - BOOL found = False; - - for (j = 0; j < s2->num_aces; j++) { - if (sec_ace_equal(&s1->ace[i], &s2->ace[j])) { - found = True; - break; - } - } - - if (!found) return False; - } - - return True; -} - -/******************************************************************* - Compares two SEC_DESC structures -********************************************************************/ - -BOOL sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2) -{ - /* Trivial case */ - - if (!s1 && !s2) { - goto done; - } - - /* Check top level stuff */ - - if (s1->revision != s2->revision) { - DEBUG(10, ("sec_desc_equal(): revision differs (%d != %d)\n", - s1->revision, s2->revision)); - return False; - } - - if (s1->type!= s2->type) { - DEBUG(10, ("sec_desc_equal(): type differs (%d != %d)\n", - s1->type, s2->type)); - return False; - } - - /* Check owner and group */ - - if (!sid_equal(s1->owner_sid, s2->owner_sid)) { - fstring str1, str2; - - sid_to_string(str1, s1->owner_sid); - sid_to_string(str2, s2->owner_sid); - - DEBUG(10, ("sec_desc_equal(): owner differs (%s != %s)\n", - str1, str2)); - return False; - } - - if (!sid_equal(s1->grp_sid, s2->grp_sid)) { - fstring str1, str2; - - sid_to_string(str1, s1->grp_sid); - sid_to_string(str2, s2->grp_sid); - - DEBUG(10, ("sec_desc_equal(): group differs (%s != %s)\n", - str1, str2)); - return False; - } - - /* Check ACLs present in one but not the other */ - - if ((s1->dacl && !s2->dacl) || (!s1->dacl && s2->dacl) || - (s1->sacl && !s2->sacl) || (!s1->sacl && s2->sacl)) { - DEBUG(10, ("sec_desc_equal(): dacl or sacl not present\n")); - return False; - } - - /* Sigh - we have to do it the hard way by iterating over all - the ACEs in the ACLs */ - - if (!sec_acl_equal(s1->dacl, s2->dacl) || - !sec_acl_equal(s1->sacl, s2->sacl)) { - DEBUG(10, ("sec_desc_equal(): dacl/sacl list not equal\n")); - return False; - } - - done: - DEBUG(10, ("sec_desc_equal(): secdescs are identical\n")); - return True; -} - -/******************************************************************* - Merge part of security descriptor old_sec in to the empty sections of - security descriptor new_sec. -********************************************************************/ - -SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb) -{ - DOM_SID *owner_sid, *group_sid; - SEC_DESC_BUF *return_sdb; - SEC_ACL *dacl, *sacl; - SEC_DESC *psd = NULL; - uint16 secdesc_type; - size_t secdesc_size; - - /* Copy over owner and group sids. There seems to be no flag for - this so just check the pointer values. */ - - owner_sid = new_sdb->sec->owner_sid ? new_sdb->sec->owner_sid : - old_sdb->sec->owner_sid; - - group_sid = new_sdb->sec->grp_sid ? new_sdb->sec->grp_sid : - old_sdb->sec->grp_sid; - - secdesc_type = new_sdb->sec->type; - - /* Ignore changes to the system ACL. This has the effect of making - changes through the security tab audit button not sticking. - Perhaps in future Samba could implement these settings somehow. */ - - sacl = NULL; - secdesc_type &= ~SEC_DESC_SACL_PRESENT; - - /* Copy across discretionary ACL */ - - if (secdesc_type & SEC_DESC_DACL_PRESENT) { - dacl = new_sdb->sec->dacl; - } else { - dacl = old_sdb->sec->dacl; - } - - /* Create new security descriptor from bits */ - - psd = make_sec_desc(ctx, new_sdb->sec->revision, secdesc_type, - owner_sid, group_sid, sacl, dacl, &secdesc_size); - - return_sdb = make_sec_desc_buf(ctx, secdesc_size, psd); - - return(return_sdb); -} - -/******************************************************************* - Creates a SEC_DESC structure -********************************************************************/ - -SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, uint16 type, - DOM_SID *owner_sid, DOM_SID *grp_sid, - SEC_ACL *sacl, SEC_ACL *dacl, size_t *sd_size) -{ - SEC_DESC *dst; - uint32 offset = 0; - - *sd_size = 0; - - if(( dst = (SEC_DESC *)talloc_zero(ctx, sizeof(SEC_DESC))) == NULL) - return NULL; - - dst->revision = revision; - dst->type = type; - - if (sacl) - dst->type |= SEC_DESC_SACL_PRESENT; - if (dacl) - dst->type |= SEC_DESC_DACL_PRESENT; - - dst->off_owner_sid = 0; - dst->off_grp_sid = 0; - dst->off_sacl = 0; - dst->off_dacl = 0; - - if(owner_sid && ((dst->owner_sid = sid_dup_talloc(ctx,owner_sid)) == NULL)) - goto error_exit; - - if(grp_sid && ((dst->grp_sid = sid_dup_talloc(ctx,grp_sid)) == NULL)) - goto error_exit; - - if(sacl && ((dst->sacl = dup_sec_acl(ctx, sacl)) == NULL)) - goto error_exit; - - if(dacl && ((dst->dacl = dup_sec_acl(ctx, dacl)) == NULL)) - goto error_exit; - - offset = SEC_DESC_HEADER_SIZE; - - /* - * Work out the linearization sizes. - */ - - if (dst->sacl != NULL) { - dst->off_sacl = offset; - offset += dst->sacl->size; - } - - if (dst->dacl != NULL) { - dst->off_dacl = offset; - offset += dst->dacl->size; - } - - if (dst->owner_sid != NULL) { - dst->off_owner_sid = offset; - offset += sid_size(dst->owner_sid); - } - - if (dst->grp_sid != NULL) { - dst->off_grp_sid = offset; - offset += sid_size(dst->grp_sid); - } - - *sd_size = (size_t)offset; - return dst; - -error_exit: - - *sd_size = 0; - return NULL; -} - -/******************************************************************* - Duplicate a SEC_DESC structure. -********************************************************************/ - -SEC_DESC *dup_sec_desc( TALLOC_CTX *ctx, SEC_DESC *src) -{ - size_t dummy; - - if(src == NULL) - return NULL; - - return make_sec_desc( ctx, src->revision, src->type, - src->owner_sid, src->grp_sid, src->sacl, - src->dacl, &dummy); -} - -/******************************************************************* - Creates a SEC_DESC structure with typical defaults. -********************************************************************/ - -SEC_DESC *make_standard_sec_desc(TALLOC_CTX *ctx, DOM_SID *owner_sid, DOM_SID *grp_sid, - SEC_ACL *dacl, size_t *sd_size) -{ - return make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, - owner_sid, grp_sid, NULL, dacl, sd_size); -} - /******************************************************************* Reads or writes a SEC_DESC structure. If reading and the *ppsd = NULL, allocates the structure. @@ -807,42 +306,6 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) return True; } -/******************************************************************* - Creates a SEC_DESC_BUF structure. -********************************************************************/ - -SEC_DESC_BUF *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, SEC_DESC *sec_desc) -{ - SEC_DESC_BUF *dst; - - if((dst = (SEC_DESC_BUF *)talloc_zero(ctx, sizeof(SEC_DESC_BUF))) == NULL) - return NULL; - - /* max buffer size (allocated size) */ - dst->max_len = (uint32)len; - dst->len = (uint32)len; - - if(sec_desc && ((dst->sec = dup_sec_desc(ctx, sec_desc)) == NULL)) { - return NULL; - } - - dst->ptr = 0x1; - - return dst; -} - -/******************************************************************* - Duplicates a SEC_DESC_BUF structure. -********************************************************************/ - -SEC_DESC_BUF *dup_sec_desc_buf(TALLOC_CTX *ctx, SEC_DESC_BUF *src) -{ - if(src == NULL) - return NULL; - - return make_sec_desc_buf( ctx, src->len, src->sec); -} - /******************************************************************* Reads or writes a SEC_DESC_BUF structure. ********************************************************************/ @@ -901,193 +364,3 @@ BOOL sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int return True; } - -/******************************************************************* - Add a new SID with its permissions to SEC_DESC. -********************************************************************/ - -NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32 mask, size_t *sd_size) -{ - SEC_DESC *sd = 0; - SEC_ACL *dacl = 0; - SEC_ACE *ace = 0; - NTSTATUS status; - - *sd_size = 0; - - if (!ctx || !psd || !sid || !sd_size) - return NT_STATUS_INVALID_PARAMETER; - - status = sec_ace_add_sid(ctx, &ace, psd[0]->dacl->ace, &psd[0]->dacl->num_aces, sid, mask); - - if (!NT_STATUS_IS_OK(status)) - return status; - - if (!(dacl = make_sec_acl(ctx, psd[0]->dacl->revision, psd[0]->dacl->num_aces, ace))) - return NT_STATUS_UNSUCCESSFUL; - - if (!(sd = make_sec_desc(ctx, psd[0]->revision, psd[0]->type, psd[0]->owner_sid, - psd[0]->grp_sid, psd[0]->sacl, dacl, sd_size))) - return NT_STATUS_UNSUCCESSFUL; - - *psd = sd; - sd = 0; - return NT_STATUS_OK; -} - -/******************************************************************* - Modify a SID's permissions in a SEC_DESC. -********************************************************************/ - -NTSTATUS sec_desc_mod_sid(SEC_DESC *sd, DOM_SID *sid, uint32 mask) -{ - NTSTATUS status; - - if (!sd || !sid) - return NT_STATUS_INVALID_PARAMETER; - - status = sec_ace_mod_sid(sd->dacl->ace, sd->dacl->num_aces, sid, mask); - - if (!NT_STATUS_IS_OK(status)) - return status; - - return NT_STATUS_OK; -} - -/******************************************************************* - Delete a SID from a SEC_DESC. -********************************************************************/ - -NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t *sd_size) -{ - SEC_DESC *sd = 0; - SEC_ACL *dacl = 0; - SEC_ACE *ace = 0; - NTSTATUS status; - - *sd_size = 0; - - if (!ctx || !psd[0] || !sid || !sd_size) - return NT_STATUS_INVALID_PARAMETER; - - status = sec_ace_del_sid(ctx, &ace, psd[0]->dacl->ace, &psd[0]->dacl->num_aces, sid); - - if (!NT_STATUS_IS_OK(status)) - return status; - - if (!(dacl = make_sec_acl(ctx, psd[0]->dacl->revision, psd[0]->dacl->num_aces, ace))) - return NT_STATUS_UNSUCCESSFUL; - - if (!(sd = make_sec_desc(ctx, psd[0]->revision, psd[0]->type, psd[0]->owner_sid, - psd[0]->grp_sid, psd[0]->sacl, dacl, sd_size))) - return NT_STATUS_UNSUCCESSFUL; - - *psd = sd; - sd = 0; - return NT_STATUS_OK; -} - -/******************************************************************* - Comparison function to sort non-inherited first. -*******************************************************************/ - -static int nt_ace_inherit_comp( SEC_ACE *a1, SEC_ACE *a2) -{ - int a1_inh = a1->flags & SEC_ACE_FLAG_INHERITED_ACE; - int a2_inh = a2->flags & SEC_ACE_FLAG_INHERITED_ACE; - - if (a1_inh == a2_inh) - return 0; - - if (!a1_inh && a2_inh) - return -1; - return 1; -} - -/******************************************************************* - Comparison function to apply the order explained below in a group. -*******************************************************************/ - -static int nt_ace_canon_comp( SEC_ACE *a1, SEC_ACE *a2) -{ - if ((a1->type == SEC_ACE_TYPE_ACCESS_DENIED) && - (a2->type != SEC_ACE_TYPE_ACCESS_DENIED)) - return -1; - - if ((a2->type == SEC_ACE_TYPE_ACCESS_DENIED) && - (a1->type != SEC_ACE_TYPE_ACCESS_DENIED)) - return 1; - - /* Both access denied or access allowed. */ - - /* 1. ACEs that apply to the object itself */ - - if (!(a1->flags & SEC_ACE_FLAG_INHERIT_ONLY) && - (a2->flags & SEC_ACE_FLAG_INHERIT_ONLY)) - return -1; - else if (!(a2->flags & SEC_ACE_FLAG_INHERIT_ONLY) && - (a1->flags & SEC_ACE_FLAG_INHERIT_ONLY)) - return 1; - - /* 2. ACEs that apply to a subobject of the object, such as - * a property set or property. */ - - if (a1->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT) && - !(a2->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT))) - return -1; - else if (a2->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT) && - !(a1->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT))) - return 1; - - return 0; -} - -/******************************************************************* - Functions to convert a SEC_DESC ACE DACL list into canonical order. - JRA. - ---- from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/security/order_of_aces_in_a_dacl.asp - -The following describes the preferred order: - - To ensure that noninherited ACEs have precedence over inherited ACEs, - place all noninherited ACEs in a group before any inherited ACEs. - This ordering ensures, for example, that a noninherited access-denied ACE - is enforced regardless of any inherited ACE that allows access. - - Within the groups of noninherited ACEs and inherited ACEs, order ACEs according to ACE type, as the following shows: - 1. Access-denied ACEs that apply to the object itself - 2. Access-denied ACEs that apply to a subobject of the object, such as a property set or property - 3. Access-allowed ACEs that apply to the object itself - 4. Access-allowed ACEs that apply to a subobject of the object" - -********************************************************************/ - -void dacl_sort_into_canonical_order(SEC_ACE *srclist, unsigned int num_aces) -{ - unsigned int i; - - if (!srclist || num_aces == 0) - return; - - /* Sort so that non-inherited ACE's come first. */ - qsort( srclist, num_aces, sizeof(srclist[0]), QSORT_CAST nt_ace_inherit_comp); - - /* Find the boundary between non-inherited ACEs. */ - for (i = 0; i < num_aces; i++ ) { - SEC_ACE *curr_ace = &srclist[i]; - - if (curr_ace->flags & SEC_ACE_FLAG_INHERITED_ACE) - break; - } - - /* i now points at entry number of the first inherited ACE. */ - - /* Sort the non-inherited ACEs. */ - if (i) - qsort( srclist, i, sizeof(srclist[0]), QSORT_CAST nt_ace_canon_comp); - - /* Now sort the inherited ACEs. */ - if (num_aces - i) - qsort( &srclist[i], num_aces - i, sizeof(srclist[0]), QSORT_CAST nt_ace_canon_comp); -} -- cgit From 764c03b9b8f552c187aad327fc857535ee322036 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 7 Oct 2003 05:06:58 +0000 Subject: Tut tut - always run with max warnings on gcc... Jeremy. (This used to be commit 3ebbd67dec2044ed8022491747e65b90f1354602) --- source3/rpc_parse/parse_lsa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 22dbd5307a..f960345fe7 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1811,7 +1811,7 @@ static BOOL lsa_io_privilege_set(const char *desc, PRIVILEGE_SET *r_c, prs_struc NTSTATUS init_lsa_r_enum_privsaccount(TALLOC_CTX *mem_ctx, LSA_R_ENUMPRIVSACCOUNT *r_u, LUID_ATTR *set, uint32 count, uint32 control) { - NTSTATUS ret; + NTSTATUS ret = NT_STATUS_OK; r_u->ptr = 1; r_u->count = count; @@ -1823,6 +1823,8 @@ NTSTATUS init_lsa_r_enum_privsaccount(TALLOC_CTX *mem_ctx, LSA_R_ENUMPRIVSACCOUN return ret; DEBUG(10,("init_lsa_r_enum_privsaccount: %d %d privileges\n", r_u->count, r_u->set->count)); + + return ret; } /******************************************************************* -- cgit From 2c1030d755a83b8f8df21e06e52b708e0d72cb04 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 7 Oct 2003 17:23:59 +0000 Subject: Max warnings with gcc. Jeremy. (This used to be commit cdba166e31b3c611652783a2ab63e59f57f41fde) --- source3/rpc_parse/parse_lsa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 22dbd5307a..f960345fe7 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1811,7 +1811,7 @@ static BOOL lsa_io_privilege_set(const char *desc, PRIVILEGE_SET *r_c, prs_struc NTSTATUS init_lsa_r_enum_privsaccount(TALLOC_CTX *mem_ctx, LSA_R_ENUMPRIVSACCOUNT *r_u, LUID_ATTR *set, uint32 count, uint32 control) { - NTSTATUS ret; + NTSTATUS ret = NT_STATUS_OK; r_u->ptr = 1; r_u->count = count; @@ -1823,6 +1823,8 @@ NTSTATUS init_lsa_r_enum_privsaccount(TALLOC_CTX *mem_ctx, LSA_R_ENUMPRIVSACCOUN return ret; DEBUG(10,("init_lsa_r_enum_privsaccount: %d %d privileges\n", r_u->count, r_u->set->count)); + + return ret; } /******************************************************************* -- cgit From 58153961e4dce5fe74f78bfebdf847d349369376 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 9 Oct 2003 06:29:08 +0000 Subject: Merge from 3.0: >Remove duplicate function (now in rpc_parse/parse_prs.c) and fix a RPC debug >(I renamed the element of the structure). > >Andrew Bartlett (This used to be commit 2aaafa500780f7de0dec5632d53f3347b67fae4a) --- source3/rpc_parse/parse_rpc.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 7e51f1e35b..1ea59feaed 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -285,7 +285,7 @@ static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, i if (!smb_io_rpc_uuid( "uuid", &ifc->uuid, ps, depth)) return False; - if(!prs_uint32 ( "version", ps, depth, &ifc->version)) + if(!prs_uint32 ("version", ps, depth, &ifc->version)) return False; return True; @@ -1187,26 +1187,6 @@ BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, return True; } - -/******************************************************************* -creates an RPC_AUTH_NETSEC_CHK structure. -********************************************************************/ -BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, - const uchar sig[8], - const uchar packet_digest[8], - const uchar seq_num[8], const uchar confounder[8]) -{ - if (chk == NULL) - return False; - - memcpy(chk->sig, sig, sizeof(chk->sig)); - memcpy(chk->packet_digest, packet_digest, sizeof(chk->packet_digest)); - memcpy(chk->seq_num, seq_num, sizeof(chk->seq_num)); - memcpy(chk->confounder, confounder, sizeof(chk->confounder)); - - return True; -} - /******************************************************************* reads or writes an RPC_AUTH_NETSEC_CHK structure. ********************************************************************/ @@ -1222,7 +1202,7 @@ BOOL smb_io_rpc_auth_netsec_chk(const char *desc, RPC_AUTH_NETSEC_CHK * chk, prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)); prs_uint8s(False, "seq_num", ps, depth, chk->seq_num, sizeof(chk->seq_num)); prs_uint8s(False, "packet_digest", ps, depth, chk->packet_digest, sizeof(chk->packet_digest)); - prs_uint8s(False, "data8", ps, depth, chk->confounder, sizeof(chk->confounder)); + prs_uint8s(False, "confounder", ps, depth, chk->confounder, sizeof(chk->confounder)); return True; } -- cgit From a6ff6254dad51acfc484c0ef92c1c484d466f509 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Fri, 17 Oct 2003 15:03:46 +0000 Subject: Add (un)marshalling code for endpoint mapper map operation (This used to be commit bdd5158d9a45f4b935ea0fa495c0d83bc5ca96f8) --- source3/rpc_parse/parse_epmapper.c | 406 +++++++++++++++++++++++++++++++++++++ 1 file changed, 406 insertions(+) create mode 100644 source3/rpc_parse/parse_epmapper.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_epmapper.c b/source3/rpc_parse/parse_epmapper.c new file mode 100644 index 0000000000..9e21da04dd --- /dev/null +++ b/source3/rpc_parse/parse_epmapper.c @@ -0,0 +1,406 @@ +/* + Unix SMB/CIFS implementation. + Samba end point mapper functions + Copyright (C) Jim McDonough (jmcd@us.ibm.com) 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 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + +/******************************************************************* + Reads or writes a handle. +********************************************************************/ +BOOL epm_io_handle(const char *desc, EPM_HANDLE *handle, prs_struct *ps, + int depth) +{ + + if (!prs_uint8s(False, "data", ps, depth, handle->data, + sizeof(handle->data))) + return False; + + return True; +} + +/******************************************************************* + inits an EPM_FLOOR structure. +********************************************************************/ +NTSTATUS init_epm_floor(EPM_FLOOR *floor, uint8 protocol) +{ + /* handle lhs */ + floor->lhs.protocol = protocol; + floor->lhs.length = sizeof(floor->lhs.protocol); + + switch(floor->lhs.protocol) { + case EPM_FLOOR_UUID: + floor->lhs.length += sizeof(floor->lhs.uuid.uuid); + floor->lhs.length += sizeof(floor->lhs.uuid.version); + break; + default: + break; + } + + /* handle rhs */ + switch(floor->lhs.protocol) { + case EPM_FLOOR_RPC: + case EPM_FLOOR_UUID: + floor->rhs.length = sizeof(floor->rhs.unknown); + break; + case EPM_FLOOR_TCP: + floor->rhs.length = sizeof(floor->rhs.tcp.port); + break; + case EPM_FLOOR_IP: + floor->rhs.length = sizeof(floor->rhs.ip.addr); + break; + default: + break; + } + + return NT_STATUS_OK; +} + +/******************************************************************* + inits an EPM_FLOOR structure with a UUID +********************************************************************/ +NTSTATUS init_epm_floor_uuid(EPM_FLOOR *floor, + const RPC_UUID *uuid, uint16 version) +{ + memcpy(&floor->lhs.uuid.uuid, uuid, sizeof(*uuid)); + floor->lhs.uuid.version = version; + floor->rhs.unknown = 0; + return init_epm_floor(floor, EPM_FLOOR_UUID); +} + +/******************************************************************* + inits an EPM_FLOOR structure for RPC +********************************************************************/ +NTSTATUS init_epm_floor_rpc(EPM_FLOOR *floor) +{ + floor->rhs.unknown = 0; + return init_epm_floor(floor, EPM_FLOOR_RPC); +} + +/******************************************************************* + inits an EPM_FLOOR structure for TCP +********************************************************************/ +NTSTATUS init_epm_floor_tcp(EPM_FLOOR *floor, uint16 port) +{ + floor->rhs.tcp.port = htons(port); + return init_epm_floor(floor, EPM_FLOOR_TCP); +} + +/******************************************************************* + inits an EPM_FLOOR structure for IP +********************************************************************/ +NTSTATUS init_epm_floor_ip(EPM_FLOOR *floor, uint8 addr[4]) +{ + memcpy(&floor->rhs.ip.addr, addr, sizeof(addr)); + return init_epm_floor(floor, EPM_FLOOR_IP); +} + +/******************************************************************* + reads and writes EPM_FLOOR. +********************************************************************/ +BOOL epm_io_floor(const char *desc, EPM_FLOOR *floor, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "epm_io_floor"); + depth++; + + if (!prs_uint16("lhs_length", ps, depth, &floor->lhs.length)) + return False; + if (!prs_uint8("protocol", ps, depth, &floor->lhs.protocol)) + return False; + + switch (floor->lhs.protocol) { + case EPM_FLOOR_UUID: + if (!smb_io_rpc_uuid("uuid", &floor->lhs.uuid.uuid, ps, depth)) + return False; + if (!prs_uint16("version", ps, depth, + &floor->lhs.uuid.version)) + return False; + break; + } + + if (!prs_uint16("rhs_length", ps, depth, &floor->rhs.length)) + return False; + + switch (floor->lhs.protocol) { + case EPM_FLOOR_UUID: + case EPM_FLOOR_RPC: + if (!prs_uint16("unknown", ps, depth, &floor->rhs.unknown)) + return False; + break; + case EPM_FLOOR_TCP: + if (!prs_uint16("tcp_port", ps, depth, &floor->rhs.tcp.port)) + return False; + break; + case EPM_FLOOR_IP: + if (!prs_uint8s(False, "ip_addr", ps, depth, + floor->rhs.ip.addr, + sizeof(floor->rhs.ip.addr))) + return False; + break; + default: + break; + } + + return True; +} + +/******************************************************************* + Inits a EPM_TOWER structure. +********************************************************************/ +NTSTATUS init_epm_tower(TALLOC_CTX *ctx, EPM_TOWER *tower, + const EPM_FLOOR *floors, int num_floors) +{ + static uint32 internal_referent_id = 0; + int size = 0; + int i; + + DEBUG(5, ("init_epm_tower\n")); + + for (i = 0; i < num_floors; i++) { + size += (sizeof(uint32) * 2); + size += floors[i].lhs.length; + size += floors[i].rhs.length; + } + size += sizeof(uint8); /* this could be aligning... */ + + tower->referent_id = ++internal_referent_id; + tower->max_length = tower->length = size; + tower->num_floors = num_floors; + tower->floors = talloc(ctx, sizeof(EPM_FLOOR) * num_floors); + if (!tower->floors) { + return NT_STATUS_NO_MEMORY; + } + memcpy(tower->floors, floors, sizeof(EPM_FLOOR) * num_floors); + tower->unknown = 0x7e; + + return NT_STATUS_OK; +} + +/******************************************************************* + Reads or writes an EPM_TOWER structure. +********************************************************************/ +BOOL epm_io_tower(const char *desc, EPM_TOWER *tower, + prs_struct *ps, int depth) +{ + int i; + + prs_debug(ps, depth, desc, "epm_io_tower"); + depth++; + + if (!prs_uint32("referent_id", ps, depth, &tower->referent_id)) + return False; + if (!prs_uint32("max_length", ps, depth, &tower->max_length)) + return False; + if (!prs_uint32("length", ps, depth, &tower->length)) + return False; + if (!prs_uint16("num_floors", ps, depth, &tower->num_floors)) + return False; + + if (UNMARSHALLING(ps)) { + tower->floors = talloc(ps->mem_ctx, + sizeof(EPM_FLOOR) * tower->num_floors); + if (!tower->floors) + return False; + } + + for (i = 0; i < tower->num_floors; i++) { + if (!epm_io_floor("floor", tower->floors + i, ps, depth)) + return False; + } + + if (!prs_uint8("unknown", ps, depth, &tower->unknown)) + return False; + + return True; +} + +/******************************************************************* + Initialize an EPM_TOWER_ARRAY structure +********************************************************************/ +NTSTATUS init_epm_tower_array(TALLOC_CTX *ctx, EPM_TOWER_ARRAY *array, + const EPM_TOWER *towers, int num_towers) +{ + array->max_count = num_towers; + array->offset = 0; + array->count = num_towers; + array->towers = talloc(ctx, sizeof(EPM_TOWER) * num_towers); + if (!array->towers) { + return NT_STATUS_NO_MEMORY; + } + memcpy(array->towers, towers, sizeof(EPM_TOWER) * num_towers); + + return NT_STATUS_OK; +} + +/******************************************************************* + Reads or writes an EPM_TOWER_ARRAY structure. +********************************************************************/ +BOOL epm_io_tower_array(const char *desc, EPM_TOWER_ARRAY *array, + prs_struct *ps, int depth) +{ + int i; + + prs_debug(ps, depth, desc, "epm_io_tower_array"); + depth++; + + if (!prs_uint32("max_count", ps, depth, &array->max_count)) + return False; + if (!prs_uint32("offset", ps, depth, &array->offset)) + return False; + if (!prs_uint32("count", ps, depth, &array->count)) + return False; + + if (!prs_set_offset(ps, prs_offset(ps) + array->offset)) + return False; + + if (UNMARSHALLING(ps)) { + array->towers = talloc(ps->mem_ctx, + sizeof(EPM_TOWER) * array->count); + if (!array->towers) { + return False; + } + } + + for (i = 0; i < array->count; i++) { + if (!epm_io_tower("tower", array->towers + 1, ps, depth)) + return False; + } + + return True; +} + +/******************************************************************* + Initialize EPM_R_MAP structure +******************************************************************/ +NTSTATUS init_epm_r_map(TALLOC_CTX *ctx, EPM_R_MAP *r_map, + const EPM_HANDLE *handle, const EPM_TOWER_ARRAY *array, + int num_elements, uint32 status) +{ + memcpy(&r_map->handle, handle, sizeof(*handle)); + r_map->num_results = num_elements; + r_map->results = talloc(ctx, sizeof(EPM_TOWER_ARRAY) * num_elements); + if (!r_map->results) { + return NT_STATUS_NO_MEMORY; + } + memcpy(r_map->results, array, sizeof(EPM_TOWER_ARRAY) * num_elements); + r_map->status = status; + return NT_STATUS_OK; +} + +/************************************************************************* + Inits a EPM_Q_MAP structure. +************************************************************************** +* We attempt to hide the ugliness of the wire format by taking a EPM_TOWER +* array with a defined size +**************************************************************************/ +NTSTATUS init_epm_q_map(TALLOC_CTX *ctx, EPM_Q_MAP *q_map, + const EPM_TOWER *towers, int num_towers) +{ + static uint32 handle = 1; + + ZERO_STRUCTP(q_map); + + DEBUG(5, ("init_epm_q_map\n")); + q_map->handle.data[0] = (handle >> 0) & 0xFF; + q_map->handle.data[1] = (handle >> 8) & 0xFF; + q_map->handle.data[2] = (handle >> 16) & 0xFF; + q_map->handle.data[3] = (handle >> 24) & 0xFF; + + q_map->tower = talloc(ctx, sizeof(EPM_TOWER) * (num_towers + 1)); + if (!q_map->tower) { + return NT_STATUS_NO_MEMORY; + } + + memcpy(q_map->tower, towers, sizeof(EPM_TOWER) * num_towers); + + ZERO_STRUCT(q_map->tower[num_towers]); + + /* For now let's not take more than 4 towers per result */ + q_map->max_towers = num_towers * 4; + + handle++; + + return NT_STATUS_OK; +} + +/***************************************************************** + epm_io_q_map - read or write EPM_Q_MAP structure +******************************************************************/ +BOOL epm_io_q_map(char *desc, EPM_Q_MAP *io_map, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "epm_io_q_map"); + depth++; + + if (!epm_io_handle("handle", &io_map->handle, ps, depth)) + return False; + + /* HACK: We need a more elegant way of doing this */ + if (UNMARSHALLING(ps)) { + io_map->tower = talloc(ps->mem_ctx, sizeof(EPM_TOWER)); + if (!io_map->tower) + return False; + } + if (!epm_io_tower("tower", io_map->tower, ps, depth)) + return False; + if (!epm_io_handle("term_handle", &io_map->term_handle, ps, depth)) + return False; + + if (!prs_uint32("max_towers", ps, 0, &io_map->max_towers)) + return False; + + return True; +} + +/******************************************************************* + epm_io_r_map - Read/Write EPM_R_MAP structure +******************************************************************/ +BOOL epm_io_r_map(char *desc, EPM_R_MAP *io_map, + prs_struct *ps, int depth) +{ + int i; + + prs_debug(ps, depth, desc, "epm_io_r_map"); + depth++; + + if (!epm_io_handle("handle", &io_map->handle, ps, depth)) + return False; + if (!prs_uint32("num_results", ps, depth, &io_map->num_results)) + return False; + + if (UNMARSHALLING(ps)) { + io_map->results = talloc(ps->mem_ctx, + sizeof(EPM_TOWER_ARRAY) * + io_map->num_results); + if (!io_map->results) + return False; + } + for (i = 0; i < io_map->num_results; i++) { + if (!epm_io_tower_array("results", io_map->results + i, + ps, depth)) + return False; + } + + if (!prs_uint32("status", ps, depth, &io_map->status)) + return False; + + return True; +} -- cgit From d807bc12fb1d208de9b4f9e2532810cf1a9e3695 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Fri, 17 Oct 2003 15:07:23 +0000 Subject: Add epmapper pipe (This used to be commit 041c17bd665ea5fa771b111d7008036fb3e7b72f) --- source3/rpc_parse/parse_rpc.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 1ea59feaed..57ebe5d356 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -147,6 +147,15 @@ interface/version dce/rpc pipe identification }, 0x01 \ } +#define SYNT_EPM_V3 \ +{ \ + { \ + 0xe1af8308, 0x5d1f, 0x11c9, \ + { 0x91, 0xa4, 0x08, 0x00, \ + 0x2b, 0x14, 0xa0, 0xfa } \ + }, 0x03 \ +} + /* * IMPORTANT!! If you update this structure, make sure to * update the index #defines in smb.h. @@ -165,6 +174,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, { PIPE_ECHO , SYNT_ECHO_V1 , PIPE_ECHO , TRANS_SYNT_V2 }, + { PIPE_EPM , SYNT_EPM_V3 , PIPE_EPM , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; @@ -246,7 +256,7 @@ BOOL smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) Reads or writes an RPC_UUID structure. ********************************************************************/ -static BOOL smb_io_rpc_uuid(const char *desc, RPC_UUID *uuid, prs_struct *ps, int depth) +BOOL smb_io_rpc_uuid(const char *desc, RPC_UUID *uuid, prs_struct *ps, int depth) { if (uuid == NULL) return False; -- cgit From e6900132ca7d216662e3ab08ad37a1e34c752cd9 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Fri, 17 Oct 2003 19:47:06 +0000 Subject: uuid itself might not be aligned (as is the case in epm map requests), so it needs to be aligned outside the smb_io_rpc_uuid() call if a specific rpc or struct needs it that way. (This used to be commit e9fc15d58c52c12438c1f9c69394c11f76ce72d8) --- source3/rpc_parse/parse_rpc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 57ebe5d356..f053297192 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -264,9 +264,6 @@ BOOL smb_io_rpc_uuid(const char *desc, RPC_UUID *uuid, prs_struct *ps, int depth prs_debug(ps, depth, desc, "smb_io_rpc_uuid"); depth++; - if(!prs_align(ps)) - return False; - if(!prs_uint32 ("data ", ps, depth, &uuid->time_low)) return False; if(!prs_uint16 ("data ", ps, depth, &uuid->time_mid)) @@ -292,6 +289,9 @@ static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, i prs_debug(ps, depth, desc, "smb_io_rpc_iface"); depth++; + if (!prs_align(ps)) + return False; + if (!smb_io_rpc_uuid( "uuid", &ifc->uuid, ps, depth)) return False; -- cgit From ba0c899510e81eddfc76eeb1b3d875d5a8c6d0d0 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Sat, 18 Oct 2003 01:07:37 +0000 Subject: Fix tower length calculations and add some const (This used to be commit 2f84c6c9a1c292535e73721a8bcdb27aaa2b2b46) --- source3/rpc_parse/parse_epmapper.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_epmapper.c b/source3/rpc_parse/parse_epmapper.c index 9e21da04dd..368ea319bd 100644 --- a/source3/rpc_parse/parse_epmapper.c +++ b/source3/rpc_parse/parse_epmapper.c @@ -175,12 +175,12 @@ NTSTATUS init_epm_tower(TALLOC_CTX *ctx, EPM_TOWER *tower, DEBUG(5, ("init_epm_tower\n")); + size += sizeof(uint16); /* number of floors is in tower length */ for (i = 0; i < num_floors; i++) { - size += (sizeof(uint32) * 2); + size += (sizeof(uint16) * 2); size += floors[i].lhs.length; size += floors[i].rhs.length; } - size += sizeof(uint8); /* this could be aligning... */ tower->referent_id = ++internal_referent_id; tower->max_length = tower->length = size; @@ -345,7 +345,8 @@ NTSTATUS init_epm_q_map(TALLOC_CTX *ctx, EPM_Q_MAP *q_map, /***************************************************************** epm_io_q_map - read or write EPM_Q_MAP structure ******************************************************************/ -BOOL epm_io_q_map(char *desc, EPM_Q_MAP *io_map, prs_struct *ps, int depth) +BOOL epm_io_q_map(const char *desc, EPM_Q_MAP *io_map, prs_struct *ps, + int depth) { prs_debug(ps, depth, desc, "epm_io_q_map"); depth++; @@ -373,7 +374,7 @@ BOOL epm_io_q_map(char *desc, EPM_Q_MAP *io_map, prs_struct *ps, int depth) /******************************************************************* epm_io_r_map - Read/Write EPM_R_MAP structure ******************************************************************/ -BOOL epm_io_r_map(char *desc, EPM_R_MAP *io_map, +BOOL epm_io_r_map(const char *desc, EPM_R_MAP *io_map, prs_struct *ps, int depth) { int i; -- cgit From 2cfb3e9b7046fe2db330a292aed71f1c27688a16 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Mon, 20 Oct 2003 18:35:12 +0000 Subject: Several updates: - add support for named pipe and netbios queries in parse code - fix map request structure...unknown byte was alignment - add sample of named pipe over netbios query in rpcclient (comment only) (This used to be commit 71dcdf54e60204d6b499d25d8759ed20fc7a021a) --- source3/rpc_parse/parse_epmapper.c | 45 +++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_epmapper.c b/source3/rpc_parse/parse_epmapper.c index 368ea319bd..2bdb755deb 100644 --- a/source3/rpc_parse/parse_epmapper.c +++ b/source3/rpc_parse/parse_epmapper.c @@ -29,6 +29,8 @@ BOOL epm_io_handle(const char *desc, EPM_HANDLE *handle, prs_struct *ps, int depth) { + if (!prs_align(ps)) + return False; if (!prs_uint8s(False, "data", ps, depth, handle->data, sizeof(handle->data))) @@ -67,6 +69,11 @@ NTSTATUS init_epm_floor(EPM_FLOOR *floor, uint8 protocol) case EPM_FLOOR_IP: floor->rhs.length = sizeof(floor->rhs.ip.addr); break; + case EPM_FLOOR_NMPIPES: + case EPM_FLOOR_LRPC: + case EPM_FLOOR_NETBIOS: + floor->rhs.length = strlen(floor->rhs.string) + 1; + break; default: break; } @@ -113,6 +120,33 @@ NTSTATUS init_epm_floor_ip(EPM_FLOOR *floor, uint8 addr[4]) return init_epm_floor(floor, EPM_FLOOR_IP); } +/******************************************************************* + inits an EPM_FLOOR structure for named pipe +********************************************************************/ +NTSTATUS init_epm_floor_np(EPM_FLOOR *floor, const char *pipe_name) +{ + safe_strcpy(floor->rhs.string, pipe_name, sizeof(floor->rhs.string)-1); + return init_epm_floor(floor, EPM_FLOOR_NMPIPES); +} + +/******************************************************************* + inits an EPM_FLOOR structure for named pipe +********************************************************************/ +NTSTATUS init_epm_floor_lrpc(EPM_FLOOR *floor, const char *pipe_name) +{ + safe_strcpy(floor->rhs.string, pipe_name, sizeof(floor->rhs.string)-1); + return init_epm_floor(floor, EPM_FLOOR_LRPC); +} + +/******************************************************************* + inits an EPM_FLOOR structure for named pipe +********************************************************************/ +NTSTATUS init_epm_floor_nb(EPM_FLOOR *floor, char *host_name) +{ + safe_strcpy(floor->rhs.string, host_name, sizeof(floor->rhs.string)-1); + return init_epm_floor(floor, EPM_FLOOR_NETBIOS); +} + /******************************************************************* reads and writes EPM_FLOOR. ********************************************************************/ @@ -156,6 +190,14 @@ BOOL epm_io_floor(const char *desc, EPM_FLOOR *floor, sizeof(floor->rhs.ip.addr))) return False; break; + case EPM_FLOOR_NMPIPES: + case EPM_FLOOR_LRPC: + case EPM_FLOOR_NETBIOS: + if (!prs_uint8s(False, "string", ps, depth, + floor->rhs.string, + floor->rhs.length)) + return False; + break; default: break; } @@ -227,9 +269,6 @@ BOOL epm_io_tower(const char *desc, EPM_TOWER *tower, return False; } - if (!prs_uint8("unknown", ps, depth, &tower->unknown)) - return False; - return True; } -- cgit From 6fe9423fc69f3c1a79d0e45ac47d0b3228e4d4d6 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Mon, 20 Oct 2003 21:10:18 +0000 Subject: Update structures after ethereal showed some marshalling/unmarshalling errors. (This used to be commit 9d0f322a851f487cea320e57076213435e5c6481) --- source3/rpc_parse/parse_epmapper.c | 44 ++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_epmapper.c b/source3/rpc_parse/parse_epmapper.c index 2bdb755deb..02340430ec 100644 --- a/source3/rpc_parse/parse_epmapper.c +++ b/source3/rpc_parse/parse_epmapper.c @@ -23,6 +23,9 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE +static uint32 internal_referent_id = 0; + + /******************************************************************* Reads or writes a handle. ********************************************************************/ @@ -211,7 +214,6 @@ BOOL epm_io_floor(const char *desc, EPM_FLOOR *floor, NTSTATUS init_epm_tower(TALLOC_CTX *ctx, EPM_TOWER *tower, const EPM_FLOOR *floors, int num_floors) { - static uint32 internal_referent_id = 0; int size = 0; int i; @@ -224,7 +226,6 @@ NTSTATUS init_epm_tower(TALLOC_CTX *ctx, EPM_TOWER *tower, size += floors[i].rhs.length; } - tower->referent_id = ++internal_referent_id; tower->max_length = tower->length = size; tower->num_floors = num_floors; tower->floors = talloc(ctx, sizeof(EPM_FLOOR) * num_floors); @@ -248,8 +249,9 @@ BOOL epm_io_tower(const char *desc, EPM_TOWER *tower, prs_debug(ps, depth, desc, "epm_io_tower"); depth++; - if (!prs_uint32("referent_id", ps, depth, &tower->referent_id)) + if (!prs_align(ps)) return False; + if (!prs_uint32("max_length", ps, depth, &tower->max_length)) return False; if (!prs_uint32("length", ps, depth, &tower->length)) @@ -278,9 +280,18 @@ BOOL epm_io_tower(const char *desc, EPM_TOWER *tower, NTSTATUS init_epm_tower_array(TALLOC_CTX *ctx, EPM_TOWER_ARRAY *array, const EPM_TOWER *towers, int num_towers) { + int i; + array->max_count = num_towers; array->offset = 0; array->count = num_towers; + array->tower_ref_ids = talloc(ctx, sizeof(uint32) * num_towers); + if (!array->tower_ref_ids) { + return NT_STATUS_NO_MEMORY; + } + for (i=0;itower_ref_ids[i] = ++internal_referent_id; + array->towers = talloc(ctx, sizeof(EPM_TOWER) * num_towers); if (!array->towers) { return NT_STATUS_NO_MEMORY; @@ -308,6 +319,18 @@ BOOL epm_io_tower_array(const char *desc, EPM_TOWER_ARRAY *array, if (!prs_uint32("count", ps, depth, &array->count)) return False; + + if (UNMARSHALLING(ps)) { + array->tower_ref_ids = talloc(ps->mem_ctx, + sizeof(uint32) * array->count); + if (!array->tower_ref_ids) { + return False; + } + } + for (i=0; i < array->count; i++) + if (!prs_uint32("ref_id", ps, depth, &array->tower_ref_ids[i])) + return False; + if (!prs_set_offset(ps, prs_offset(ps) + array->offset)) return False; @@ -376,6 +399,8 @@ NTSTATUS init_epm_q_map(TALLOC_CTX *ctx, EPM_Q_MAP *q_map, /* For now let's not take more than 4 towers per result */ q_map->max_towers = num_towers * 4; + q_map->tower_ref_id = ++internal_referent_id; + handle++; return NT_STATUS_OK; @@ -393,6 +418,9 @@ BOOL epm_io_q_map(const char *desc, EPM_Q_MAP *io_map, prs_struct *ps, if (!epm_io_handle("handle", &io_map->handle, ps, depth)) return False; + if (!prs_uint32("max_towers", ps, 0, &io_map->tower_ref_id)) + return False; + /* HACK: We need a more elegant way of doing this */ if (UNMARSHALLING(ps)) { io_map->tower = talloc(ps->mem_ctx, sizeof(EPM_TOWER)); @@ -416,8 +444,6 @@ BOOL epm_io_q_map(const char *desc, EPM_Q_MAP *io_map, prs_struct *ps, BOOL epm_io_r_map(const char *desc, EPM_R_MAP *io_map, prs_struct *ps, int depth) { - int i; - prs_debug(ps, depth, desc, "epm_io_r_map"); depth++; @@ -433,11 +459,11 @@ BOOL epm_io_r_map(const char *desc, EPM_R_MAP *io_map, if (!io_map->results) return False; } - for (i = 0; i < io_map->num_results; i++) { - if (!epm_io_tower_array("results", io_map->results + i, - ps, depth)) + if (!epm_io_tower_array("results", io_map->results, ps, depth)) return False; - } + + if (!prs_align(ps)) + return False; if (!prs_uint32("status", ps, depth, &io_map->status)) return False; -- cgit From 718634017933bbf39526b834981cde92cfe7a2da Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Tue, 21 Oct 2003 16:27:46 +0000 Subject: Fix typo (This used to be commit 26956cdef902819f94616c33694641752f0f14e9) --- source3/rpc_parse/parse_epmapper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_epmapper.c b/source3/rpc_parse/parse_epmapper.c index 02340430ec..61704136a0 100644 --- a/source3/rpc_parse/parse_epmapper.c +++ b/source3/rpc_parse/parse_epmapper.c @@ -343,7 +343,7 @@ BOOL epm_io_tower_array(const char *desc, EPM_TOWER_ARRAY *array, } for (i = 0; i < array->count; i++) { - if (!epm_io_tower("tower", array->towers + 1, ps, depth)) + if (!epm_io_tower("tower", &array->towers[i], ps, depth)) return False; } -- cgit From bca9e7d3258058594daaaedd2518fcb2c793ded0 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Wed, 22 Oct 2003 20:59:46 +0000 Subject: Be sure referent ID is updated for incoming structures, too. (This used to be commit 00e0aba2cf97e686a0b6b4d7bab50afbc5e97ac1) --- source3/rpc_parse/parse_epmapper.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_epmapper.c b/source3/rpc_parse/parse_epmapper.c index 61704136a0..7a5f147c50 100644 --- a/source3/rpc_parse/parse_epmapper.c +++ b/source3/rpc_parse/parse_epmapper.c @@ -327,9 +327,17 @@ BOOL epm_io_tower_array(const char *desc, EPM_TOWER_ARRAY *array, return False; } } - for (i=0; i < array->count; i++) - if (!prs_uint32("ref_id", ps, depth, &array->tower_ref_ids[i])) + for (i=0; i < array->count; i++) { + if (!prs_uint32("ref_id", ps, depth, &array->tower_ref_ids[i])) { return False; + } else { + if (array->tower_ref_ids[i] > internal_referent_id) { + internal_referent_id = array->tower_ref_ids[i]; + } + } + } + + if (!prs_set_offset(ps, prs_offset(ps) + array->offset)) return False; @@ -418,8 +426,10 @@ BOOL epm_io_q_map(const char *desc, EPM_Q_MAP *io_map, prs_struct *ps, if (!epm_io_handle("handle", &io_map->handle, ps, depth)) return False; - if (!prs_uint32("max_towers", ps, 0, &io_map->tower_ref_id)) + if (!prs_uint32("referent_id", ps, 0, &io_map->tower_ref_id)) return False; + if (io_map->tower_ref_id > internal_referent_id) + internal_referent_id = io_map->tower_ref_id; /* HACK: We need a more elegant way of doing this */ if (UNMARSHALLING(ps)) { -- cgit From 6258550534050e59a80ae8e39d9fb308b2e648fb Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Fri, 24 Oct 2003 13:38:13 +0000 Subject: New files for support of initshutdown pipe. Win2k doesn't respond properly to all requests on the winreg pipe, so we need to handle this new pipe. First part of fix for bug #534 (This used to be commit 532fab74c12d8c55872c2bad2abead2647f919d7) --- source3/rpc_parse/parse_shutdown.c | 163 +++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 source3/rpc_parse/parse_shutdown.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_shutdown.c b/source3/rpc_parse/parse_shutdown.c new file mode 100644 index 0000000000..ad2d6e1a02 --- /dev/null +++ b/source3/rpc_parse/parse_shutdown.c @@ -0,0 +1,163 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * Copyright (C) Jim McDonough (jmcd@us.ibm.com) 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 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + +/******************************************************************* +Inits a structure. +********************************************************************/ + +void init_shutdown_q_init(SHUTDOWN_Q_INIT *q_s, const char *msg, + uint32 timeout, BOOL do_reboot, BOOL force) +{ + q_s->ptr_server = 1; + q_s->server = 1; + q_s->ptr_msg = 1; + + init_unistr2(&q_s->uni_msg, msg, UNI_FLAGS_NONE); + init_uni_hdr(&q_s->hdr_msg, &q_s->uni_msg); + + q_s->timeout = timeout; + + q_s->reboot = do_reboot ? 1 : 0; + q_s->force = force ? 1 : 0; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL shutdown_io_q_init(const char *desc, SHUTDOWN_Q_INIT *q_s, prs_struct *ps, + int depth) +{ + if (q_s == NULL) + return False; + + prs_debug(ps, depth, desc, "shutdown_io_q_init"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("ptr_server", ps, depth, &(q_s->ptr_server))) + return False; + if (!prs_uint16("server", ps, depth, &(q_s->server))) + return False; + + if (!prs_align(ps)) + return False; + if (!prs_uint32("ptr_msg", ps, depth, &(q_s->ptr_msg))) + return False; + + if (!smb_io_unihdr("hdr_msg", &(q_s->hdr_msg), ps, depth)) + return False; + if (!smb_io_unistr2("uni_msg", &(q_s->uni_msg), q_s->hdr_msg.buffer, ps, depth)) + return False; + if (!prs_align(ps)) + return False; + + if (!prs_uint32("timeout", ps, depth, &(q_s->timeout))) + return False; + if (!prs_uint8("force ", ps, depth, &(q_s->force))) + return False; + if (!prs_uint8("reboot ", ps, depth, &(q_s->reboot))) + return False; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL shutdown_io_r_init(const char *desc, SHUTDOWN_R_INIT* r_s, prs_struct *ps, + int depth) +{ + if (r_s == NULL) + return False; + + prs_debug(ps, depth, desc, "shutdown_io_r_init"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_ntstatus("status", ps, depth, &r_s->status)) + return False; + + return True; +} + +/******************************************************************* +Inits a structure. +********************************************************************/ +void init_shutdown_q_abort(SHUTDOWN_Q_ABORT *q_s) +{ + + q_s->ptr_server = 0; + +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL shutdown_io_q_abort(const char *desc, SHUTDOWN_Q_ABORT *q_s, + prs_struct *ps, int depth) +{ + if (q_s == NULL) + return False; + + prs_debug(ps, depth, desc, "shutdown_io_q_abort"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("ptr_server", ps, depth, &(q_s->ptr_server))) + return False; + if (q_s->ptr_server != 0) + if (!prs_uint16("server", ps, depth, &(q_s->server))) + return False; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL shutdown_io_r_abort(const char *desc, SHUTDOWN_R_ABORT *r_s, + prs_struct *ps, int depth) +{ + if (r_s == NULL) + return False; + + prs_debug(ps, depth, desc, "shutdown_io_r_abort"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_ntstatus("status", ps, depth, &r_s->status)) + return False; + + return True; +} -- cgit From 3d8e3f314b9f1ad3966afd5ad217a63b109de0f9 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Fri, 24 Oct 2003 13:49:29 +0000 Subject: Add initshutdown pipe commands to rpcclient. Second part of fix to bug #534 (This used to be commit 4e86243ea1d4bbe96720caaaf02300f5e15bee5a) --- source3/rpc_parse/parse_rpc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 1ea59feaed..e2781b2008 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -147,6 +147,15 @@ interface/version dce/rpc pipe identification }, 0x01 \ } +#define SYNT_SHUTDOWN_V1 \ +{ \ + { \ + 0x894de0c0, 0x0d55, 0x11d3, \ + { 0xa3, 0x22, 0x00, 0xc0, \ + 0x4f, 0xa3, 0x21, 0xa1 } \ + }, 0x01 \ +} + /* * IMPORTANT!! If you update this structure, make sure to * update the index #defines in smb.h. @@ -165,6 +174,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, { PIPE_ECHO , SYNT_ECHO_V1 , PIPE_ECHO , TRANS_SYNT_V2 }, + { PIPE_SHUTDOWN, SYNT_SHUTDOWN_V1 , PIPE_SHUTDOWN , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From 490dbaec81007a9b5dd3aabfc188bdb397927e78 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 3 Nov 2003 14:21:10 +0000 Subject: Fix some uninitialised variable warnings. (This used to be commit 68945027b5dc6b5e1aee13e4df4d11a34e42a3a9) --- source3/rpc_parse/parse_prs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index b30c41c090..9056348239 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1458,7 +1458,7 @@ void netsec_encode(struct netsec_auth_struct *a, int auth_flags, static const uchar netsec_seal_sig[8] = NETSEC_SEAL_SIGNATURE; static const uchar netsec_sign_sig[8] = NETSEC_SIGN_SIGNATURE; - const uchar *netsec_sig; + const uchar *netsec_sig = NULL; DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%lu\n", a->seq_num, (unsigned long)data_len)); @@ -1533,7 +1533,7 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, static const uchar netsec_seal_sig[8] = NETSEC_SEAL_SIGNATURE; static const uchar netsec_sign_sig[8] = NETSEC_SIGN_SIGNATURE; - const uchar *netsec_sig; + const uchar *netsec_sig = NULL; uchar seq_num[8]; -- cgit From 5cfe36d09d1de8c6a82152d4941c1563111f4364 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 7 Nov 2003 18:32:23 +0000 Subject: Handle munged dial string. Patch from Aur?lien Degr?mont with memory leak fixes by me. Jeremy. (This used to be commit e591854eda8568ed1a4ad6b9de64e523c02b4392) --- source3/rpc_parse/parse_misc.c | 21 +++++++++++++++++++++ source3/rpc_parse/parse_samr.c | 19 ++++++++++++++----- 2 files changed, 35 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index e182535532..86ea83d7aa 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1000,6 +1000,27 @@ void init_unistr2_from_unistr(UNISTR2 *to, const UNISTR *from) return; } +/******************************************************************* + Inits a UNISTR2 structure from a DATA_BLOB. + The length of the data_blob must count the bytes of the buffer. + Copies the blob data. +********************************************************************/ + +void init_unistr2_from_datablob(UNISTR2 *str, DATA_BLOB *blob) +{ + /* Allocs the unistring */ + init_unistr2(str, NULL, UNI_FLAGS_NONE); + + /* Sets the values */ + str->uni_str_len = blob->length / sizeof(uint16); + str->uni_max_len = str->uni_str_len; + str->offset = 0; + str->buffer = (uint16 *) memdup(blob->data, blob->length); + if (!str->buffer) { + smb_panic("init_unistr2_from_datablob: malloc fail\n"); + } +} + /******************************************************************* Reads or writes a UNISTR2 structure. XXXX NOTE: UNISTR2 structures need NOT be null-terminated. diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 939b652a1e..73107f8f61 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5485,6 +5485,8 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z LOGON_HRS * hrs, uint16 bad_password_count, uint16 logon_count, char newpass[516], uint32 unknown_6) { + 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 */ @@ -5544,9 +5546,11 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z init_unistr2(&usr->uni_unknown_str, unk_str, UNI_FLAGS_NONE); init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); - init_unistr2(&usr->uni_munged_dial, mung_dial, UNI_FLAGS_NONE); + init_unistr2_from_datablob(&usr->uni_munged_dial, &blob); init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); + data_blob_free(&blob); + usr->unknown_6 = unknown_6; /* 0x0000 04ec */ usr->padding4 = 0; @@ -5934,6 +5938,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * 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 blob = base64_decode_data_blob(munged_dial); uint32 user_rid; const DOM_SID *user_sid; @@ -5970,6 +5975,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * user_name, sid_to_string(user_sid_string, user_sid), sid_to_string(domain_sid_string, domain_sid))); + data_blob_free(&blob); return NT_STATUS_UNSUCCESSFUL; } @@ -5983,6 +5989,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * user_name, sid_to_string(group_sid_string, group_sid), sid_to_string(domain_sid_string, domain_sid))); + data_blob_free(&blob); return NT_STATUS_UNSUCCESSFUL; } @@ -6042,8 +6049,9 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * init_unistr2(&usr->uni_unknown_str, NULL, UNI_STR_TERMINATE); init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); - init_unistr2(&usr->uni_munged_dial, munged_dial, UNI_STR_TERMINATE); + init_unistr2_from_datablob(&usr->uni_munged_dial, &blob); init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); + data_blob_free(&blob); usr->unknown_6 = pdb_get_unknown_6(pw); usr->padding4 = 0; @@ -6184,10 +6192,11 @@ static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, void init_sam_user_info20A(SAM_USER_INFO_20 *usr, SAM_ACCOUNT *pw) { const char *munged_dial = pdb_get_munged_dial(pw); - - init_unistr2(&usr->uni_munged_dial, munged_dial, UNI_STR_TERMINATE); + DATA_BLOB blob = base64_decode_data_blob(munged_dial); + + init_unistr2_from_datablob(&usr->uni_munged_dial, &blob); init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); - + data_blob_free(&blob); } /******************************************************************* -- cgit From b64c6355b04f1c199a5883821653b937f9198c9d Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 11 Nov 2003 19:22:00 +0000 Subject: fix crash bug due to empyrt munged dial string; patch from metze (This used to be commit ccd5665a65de6ccfdb9a5f490be1a7b5de486e2a) --- source3/rpc_parse/parse_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 86ea83d7aa..203122e73c 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1016,7 +1016,7 @@ void init_unistr2_from_datablob(UNISTR2 *str, DATA_BLOB *blob) str->uni_max_len = str->uni_str_len; str->offset = 0; str->buffer = (uint16 *) memdup(blob->data, blob->length); - if (!str->buffer) { + if ((str->buffer == NULL) && (blob->length > 0)) { smb_panic("init_unistr2_from_datablob: malloc fail\n"); } } -- cgit From 281e293331f20d9341ebaf555f10ef339952048c Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 13 Nov 2003 20:15:17 +0000 Subject: * Fix from SATOH Fumiyasu for bug 660 (failing to view print jobs) by only enforce the 'max reported print jobs' parameter when it is non-zero. * Fixed bug 338 by making sure that data values are written out when we are marshalling an EnumPrinterDataEx() reply. This probably fixes other bugs reported against point-n-print feature in 3.0.0 (This used to be commit fd98af75d655449a677360f6991da5caabc88b4d) --- source3/rpc_parse/parse_spoolss.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 65f16414a0..7581316767 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7294,11 +7294,13 @@ static BOOL spoolss_io_printer_enum_values_ctr(const char *desc, prs_struct *ps, if (!prs_unistr("valuename", ps, depth, &ctr->values[i].valuename)) return False; - if (UNMARSHALLING(ps) && ctr->values[i].data_len) { - ctr->values[i].data = (uint8 *)prs_alloc_mem( - ps, ctr->values[i].data_len); - if (!ctr->values[i].data) - return False; + if ( ctr->values[i].data_len ) { + if ( UNMARSHALLING(ps) ) { + ctr->values[i].data = (uint8 *)prs_alloc_mem( + ps, ctr->values[i].data_len); + if (!ctr->values[i].data) + return False; + } if (!prs_uint8s(False, "data", ps, depth, ctr->values[i].data, ctr->values[i].data_len)) return False; } -- cgit From e0fd9d28e90dbc6dab9a0d17e2f0403fa2f21e98 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 17 Nov 2003 22:07:47 +0000 Subject: Fix from Andrew Bartlett to fix up the munged-dial problem. Jeremy. (This used to be commit 703b1b76e25fc83b3b84767c0e1b64c97c21bf09) --- source3/rpc_parse/parse_misc.c | 6 +++++- source3/rpc_parse/parse_samr.c | 16 +++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 203122e73c..afdf0fc4c9 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1015,7 +1015,11 @@ void init_unistr2_from_datablob(UNISTR2 *str, DATA_BLOB *blob) str->uni_str_len = blob->length / sizeof(uint16); str->uni_max_len = str->uni_str_len; str->offset = 0; - str->buffer = (uint16 *) memdup(blob->data, blob->length); + if (blob->length) { + str->buffer = (uint16 *) memdup(blob->data, blob->length); + } else { + str->buffer = NULL; + } if ((str->buffer == NULL) && (blob->length > 0)) { smb_panic("init_unistr2_from_datablob: malloc fail\n"); } diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 73107f8f61..20adf0c756 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5938,7 +5938,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * 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 blob = base64_decode_data_blob(munged_dial); + DATA_BLOB munged_dial_blob; uint32 user_rid; const DOM_SID *user_sid; @@ -5946,6 +5946,12 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_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, 0); + } + /* 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)); @@ -5975,7 +5981,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * user_name, sid_to_string(user_sid_string, user_sid), sid_to_string(domain_sid_string, domain_sid))); - data_blob_free(&blob); + data_blob_free(&munged_dial_blob); return NT_STATUS_UNSUCCESSFUL; } @@ -5989,7 +5995,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * user_name, sid_to_string(group_sid_string, group_sid), sid_to_string(domain_sid_string, domain_sid))); - data_blob_free(&blob); + data_blob_free(&munged_dial_blob); return NT_STATUS_UNSUCCESSFUL; } @@ -6049,9 +6055,9 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * init_unistr2(&usr->uni_unknown_str, NULL, UNI_STR_TERMINATE); init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); - init_unistr2_from_datablob(&usr->uni_munged_dial, &blob); + 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(&blob); + data_blob_free(&munged_dial_blob); usr->unknown_6 = pdb_get_unknown_6(pw); usr->padding4 = 0; -- cgit From fcbfc7ad0669009957c65fa61bb20df75a9701b4 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 22 Nov 2003 13:19:38 +0000 Subject: Changes all over the shop, but all towards: - NTLM2 support in the server - KEY_EXCH support in the server - variable length session keys. In detail: - NTLM2 is an extension of NTLMv1, that is compatible with existing domain controllers (unlike NTLMv2, which requires a DC upgrade). * This is known as 'NTLMv2 session security' * (This is not yet implemented on the RPC pipes however, so there may well still be issues for PDC setups, particuarly around password changes. We do not fully understand the sign/seal implications of NTLM2 on RPC pipes.) This requires modifications to our authentication subsystem, as we must handle the 'challege' input into the challenge-response algorithm being changed. This also needs to be turned off for 'security=server', which does not support this. - KEY_EXCH is another 'security' mechanism, whereby the session key actually used by the server is sent by the client, rather than being the shared-secret directly or indirectly. - As both these methods change the session key, the auth subsystem needed to be changed, to 'override' session keys provided by the backend. - There has also been a major overhaul of the NTLMSSP subsystem, to merge the 'client' and 'server' functions, so they both operate on a single structure. This should help the SPNEGO implementation. - The 'names blob' in NTLMSSP is always in unicode - never in ascii. Don't make an ascii version ever. - The other big change is to allow variable length session keys. We have always assumed that session keys are 16 bytes long - and padded to this length if shorter. However, Kerberos session keys are 8 bytes long, when the krb5 login uses DES. * This fix allows SMB signging on machines not yet running MIT KRB5 1.3.1. * - Add better DEBUG() messages to ntlm_auth, warning administrators of misconfigurations that prevent access to the privileged pipe. This should help reduce some of the 'it just doesn't work' issues. - Fix data_blob_talloc() to behave the same way data_blob() does when passed a NULL data pointer. (just allocate) REMEMBER to make clean after this commit - I have changed plenty of data structures... (This used to be commit f3bbc87b0dac63426cda6fac7a295d3aad810ecc) --- source3/rpc_parse/parse_net.c | 11 ++++++++--- source3/rpc_parse/parse_samr.c | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 13 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 3b096e088a..ad0a91e7ea 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1265,7 +1265,8 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, uint16 logon_count, uint16 bad_pw_count, uint32 num_groups, const DOM_GID *gids, - uint32 user_flgs, uchar sess_key[16], + uint32 user_flgs, uchar nt_session_key[16], + uchar lm_session_key[16], const char *logon_srv, const char *logon_dom, const DOM_SID *dom_sid, const char *other_sids) { @@ -1307,8 +1308,8 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, usr->buffer_groups = 1; /* indicates fill in groups, below, even if there are none */ usr->user_flgs = user_flgs; - if (sess_key != NULL) - memcpy(usr->user_sess_key, sess_key, sizeof(usr->user_sess_key)); + if (nt_session_key != NULL) + memcpy(usr->user_sess_key, nt_session_key, sizeof(usr->user_sess_key)); else memset((char *)usr->user_sess_key, '\0', sizeof(usr->user_sess_key)); @@ -1316,6 +1317,10 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, memset((char *)usr->padding, '\0', sizeof(usr->padding)); + if (lm_session_key != NULL) + memcpy(usr->padding, lm_session_key, sizeof(usr->user_sess_key)); + + num_other_sids = init_dom_sid2s(ctx, other_sids, &usr->other_sids); usr->num_other_sids = num_other_sids; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 20adf0c756..1966538362 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6302,7 +6302,7 @@ NTSTATUS make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr, inits a SAM_USERINFO_CTR structure. ********************************************************************/ -void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, uchar * sess_key, +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")); @@ -6312,13 +6312,13 @@ void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, uchar * sess_key, switch (switch_value) { case 0x18: - SamOEMhash(ctr->info.id24->pass, sess_key, 516); - dump_data(100, (char *)sess_key, 16); + SamOEMhash(ctr->info.id24->pass, sess_key.data, 516); + dump_data(100, (char *)sess_key.data, 16); dump_data(100, (char *)ctr->info.id24->pass, 516); break; case 0x17: - SamOEMhash(ctr->info.id23->pass, sess_key, 516); - dump_data(100, (char *)sess_key, 16); + SamOEMhash(ctr->info.id23->pass, sess_key.data, 516); + dump_data(100, (char *)sess_key.data, 16); dump_data(100, (char *)ctr->info.id23->pass, 516); break; default: @@ -6503,7 +6503,7 @@ inits a SAMR_Q_SET_USERINFO structure. ********************************************************************/ void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO * q_u, - POLICY_HND *hnd, unsigned char sess_key[16], + POLICY_HND *hnd, DATA_BLOB sess_key, uint16 switch_value, void *info) { DEBUG(5, ("init_samr_q_set_userinfo\n")); @@ -6577,7 +6577,7 @@ inits a SAMR_Q_SET_USERINFO2 structure. ********************************************************************/ void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u, - POLICY_HND *hnd, unsigned char sess_key[16], + POLICY_HND *hnd, DATA_BLOB sess_key, uint16 switch_value, SAM_USERINFO_CTR * ctr) { DEBUG(5, ("init_samr_q_set_userinfo2\n")); @@ -6591,9 +6591,9 @@ void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u, switch (switch_value) { case 0x12: - SamOEMhash(ctr->info.id12->lm_pwd, sess_key, 16); - SamOEMhash(ctr->info.id12->nt_pwd, sess_key, 16); - dump_data(100, (char *)sess_key, 16); + SamOEMhash(ctr->info.id12->lm_pwd, sess_key.data, 16); + SamOEMhash(ctr->info.id12->nt_pwd, sess_key.data, 16); + dump_data(100, (char *)sess_key.data, 16); dump_data(100, (char *)ctr->info.id12->lm_pwd, 16); dump_data(100, (char *)ctr->info.id12->nt_pwd, 16); break; -- cgit From 78404434d055ff86177d7c659358c23f12a27a77 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 22 Nov 2003 23:38:41 +0000 Subject: Add support for variable-length session keys in our client code. This means that we now support 'net rpc join' with KRB5 (des based) logins. Now, you need to hack 'net' to do that, but the principal is important... When we add kerberos to 'net rpc', it should be possible to still do user management and the like over RPC. (server-side support to follow shortly) Andrew Bartlett (This used to be commit 9ecf9408d98639186b283f1acf0fac46417547d0) --- source3/rpc_parse/parse_samr.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 1966538362..5e3502b242 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6302,8 +6302,8 @@ NTSTATUS make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr, inits a SAM_USERINFO_CTR structure. ********************************************************************/ -void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, DATA_BLOB sess_key, - uint16 switch_value, void *info) +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")); @@ -6312,13 +6312,13 @@ void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, DATA_BLOB sess_key, switch (switch_value) { case 0x18: - SamOEMhash(ctr->info.id24->pass, sess_key.data, 516); - dump_data(100, (char *)sess_key.data, 16); + SamOEMhashBlob(ctr->info.id24->pass, 516, sess_key); + dump_data(100, (char *)sess_key->data, sess_key->length); dump_data(100, (char *)ctr->info.id24->pass, 516); break; case 0x17: - SamOEMhash(ctr->info.id23->pass, sess_key.data, 516); - dump_data(100, (char *)sess_key.data, 16); + SamOEMhashBlob(ctr->info.id23->pass, 516, sess_key); + dump_data(100, (char *)sess_key->data, sess_key->length); dump_data(100, (char *)ctr->info.id23->pass, 516); break; default: @@ -6503,7 +6503,7 @@ inits a SAMR_Q_SET_USERINFO structure. ********************************************************************/ void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO * q_u, - POLICY_HND *hnd, DATA_BLOB sess_key, + POLICY_HND *hnd, DATA_BLOB *sess_key, uint16 switch_value, void *info) { DEBUG(5, ("init_samr_q_set_userinfo\n")); @@ -6577,7 +6577,7 @@ inits a SAMR_Q_SET_USERINFO2 structure. ********************************************************************/ void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u, - POLICY_HND *hnd, DATA_BLOB sess_key, + POLICY_HND *hnd, DATA_BLOB *sess_key, uint16 switch_value, SAM_USERINFO_CTR * ctr) { DEBUG(5, ("init_samr_q_set_userinfo2\n")); @@ -6591,9 +6591,9 @@ void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u, switch (switch_value) { case 0x12: - SamOEMhash(ctr->info.id12->lm_pwd, sess_key.data, 16); - SamOEMhash(ctr->info.id12->nt_pwd, sess_key.data, 16); - dump_data(100, (char *)sess_key.data, 16); + SamOEMhashBlob(ctr->info.id12->lm_pwd, 16, sess_key); + SamOEMhashBlob(ctr->info.id12->nt_pwd, 16, sess_key); + dump_data(100, (char *)sess_key->data, sess_key->length); dump_data(100, (char *)ctr->info.id12->lm_pwd, 16); dump_data(100, (char *)ctr->info.id12->nt_pwd, 16); break; -- cgit From 3d929b1ce67d945979552fe1ea2c70f6d3925326 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 4 Dec 2003 03:35:46 +0000 Subject: * fix RemoveSidForeignDomain() ; bug 252 * don't fall back to unmapped UNIX group for get_local_group_from_sid() * remove an extra become/unbecome_root() pair from group enumeration (This used to be commit da12bbdb0dd9179b1ed457fa009679e2da4a8440) --- source3/rpc_parse/parse_samr.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 5e3502b242..607c9ecf64 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -181,9 +181,9 @@ BOOL samr_io_r_lookup_domain(const char *desc, SAMR_R_LOOKUP_DOMAIN * r_u, reads or writes a structure. ********************************************************************/ -void init_samr_q_remove_user_foreign_domain(SAMR_Q_REMOVE_USER_FOREIGN_DOMAIN * q_u, POLICY_HND *dom_pol, DOM_SID *sid) +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_user_foreign_domain\n")); + DEBUG(5, ("samr_init_samr_q_remove_sid_foreign_domain\n")); q_u->dom_pol = *dom_pol; init_dom_sid2(&q_u->sid, sid); @@ -193,13 +193,13 @@ void init_samr_q_remove_user_foreign_domain(SAMR_Q_REMOVE_USER_FOREIGN_DOMAIN * reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_remove_user_foreign_domain(const char *desc, SAMR_Q_REMOVE_USER_FOREIGN_DOMAIN * q_u, +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_user_foreign_domain"); + prs_debug(ps, depth, desc, "samr_io_q_remove_sid_foreign_domain"); depth++; if(!prs_align(ps)) @@ -221,13 +221,13 @@ BOOL samr_io_q_remove_user_foreign_domain(const char *desc, SAMR_Q_REMOVE_USER_F reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_remove_user_foreign_domain(const char *desc, SAMR_R_REMOVE_USER_FOREIGN_DOMAIN * r_u, +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_user_foreign_domain"); + prs_debug(ps, depth, desc, "samr_io_r_remove_sid_foreign_domain"); depth++; if(!prs_align(ps)) -- cgit From 1d4978d7225c3bab6374bb3f6aa5d563e69f52cf Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 5 Dec 2003 11:30:47 +0000 Subject: fixed a problem with "net rpc vampire" mis-parsing the alias member info reply Thanks to a bug report by 'musb' (This used to be commit 310f90f3689d4acd16368a833f23ea5f9aaa0133) --- source3/rpc_parse/parse_net.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index ad0a91e7ea..5df75fc5f6 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -2283,12 +2283,12 @@ static BOOL net_io_sam_alias_mem_info(const char *desc, SAM_ALIAS_MEM_INFO * inf 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 (ps->data_offset + 16 > ps->buffer_size) - return False; - ps->data_offset += 16; - if (!prs_uint32("num_sids", ps, depth, &info->num_sids)) return False; if (info->num_sids != info->num_members) -- cgit From ae8d35b2a2cead8a21a7c4f4bfbefa830384470e Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 10 Dec 2003 21:13:44 +0000 Subject: Fix UNISTR2 length bug in LsaQueryInfo(3) that cause SID resolution to fail on local files on on domain members; bug 875 (This used to be commit c6594e35573186966a4d57404f1c06b98670db06) --- source3/rpc_parse/parse_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index afdf0fc4c9..976ba20681 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -914,7 +914,7 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) str->uni_max_len = num_chars; str->offset = 0; str->uni_str_len = num_chars; - if (num_chars && (flags == UNI_MAXLEN_TERMINATE)) + if ( num_chars && ((flags == UNI_MAXLEN_TERMINATE) || (flags == UNI_BROKEN_NON_NULL)) ) str->uni_max_len++; } -- cgit From d90e41600629f963d8bd3b9bda98260d70130947 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 29 Dec 2003 04:21:32 +0000 Subject: Add the alignment required before all 2-byte quantities in NDR. Allows us to correctly parse plaintext netlogon calls with odd-length passwords Andrew Bartlett (This used to be commit de3c3cbeeb8b674ffc0dd8fe16913f15edcf9022) --- source3/rpc_parse/parse_net.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 5df75fc5f6..89673dd0e3 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1540,6 +1540,9 @@ BOOL net_io_q_sam_logon(const char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, 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; -- cgit From 614c18d24bc1bb19c884138c8c16099d1b8484d2 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 5 Jan 2004 02:04:37 +0000 Subject: rpc_client/cli_lsarpc.c: rpc_parse/parse_lsa.c: nsswitch/winbindd_rpc.c: nsswitch/winbindd.h: - Add const libads/ads_ldap.c: - Cleanup function for use nsswitch/winbindd_ads.c: - Use new utility function ads_sid_to_dn - Don't search for 'dn=', rather call the ads_search_retry_dn() nsswitch/winbindd_ads.c: include/rpc_ds.h: rpc_client/cli_ds.c: - Fixup braindamage in cli_ds_enum_domain_trusts(): - This function was returning a UNISTR2 up to the caller, and was doing nasty (invalid, per valgrind) things with memcpy() - Create a new structure that represents this informaiton in a useful way and use talloc. Andrew Bartlett (This used to be commit 06c3f15aa166bb567d8be0a8bc4b095b167ab371) --- source3/rpc_parse/parse_lsa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index f960345fe7..d29b7bc580 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -804,7 +804,7 @@ BOOL lsa_io_r_query(const char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, ********************************************************************/ static void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, - int num_entries, DOM_SID *sids) + int num_entries, const DOM_SID *sids) { int i; @@ -913,7 +913,7 @@ static BOOL lsa_io_sid_enum(const char *desc, LSA_SID_ENUM *sen, prs_struct *ps, ********************************************************************/ void init_q_lookup_sids(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_SIDS *q_l, - POLICY_HND *hnd, int num_sids, DOM_SID *sids, + POLICY_HND *hnd, int num_sids, const DOM_SID *sids, uint16 level) { DEBUG(5, ("init_q_lookup_sids\n")); -- cgit From fb1c0450f2a804edf317b3be9eb1a1ff2a6cbb16 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 7 Jan 2004 19:57:08 +0000 Subject: commiting jra's fix for Exchange clear test auth (This used to be commit 344e113368cb46fc4d26107d1cd276e4c76a6a9b) --- source3/rpc_parse/parse_net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 89673dd0e3..90cd348f5a 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1317,9 +1317,10 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, memset((char *)usr->padding, '\0', sizeof(usr->padding)); +#if 0 /* JRATEST - exchange auth test. */ if (lm_session_key != NULL) memcpy(usr->padding, lm_session_key, sizeof(usr->user_sess_key)); - +#endif num_other_sids = init_dom_sid2s(ctx, other_sids, &usr->other_sids); -- cgit From 500c28974ded4c4789d9f197de5860b20447e606 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 9 Jan 2004 14:54:33 +0000 Subject: fix some warnings from the Sun compiler (This used to be commit ebabf72a78f0165521268b73e0fcabe1ea7834fd) --- source3/rpc_parse/parse_prs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 9056348239..58652fa0c5 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1574,9 +1574,9 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, checksum after the decode, below */ DEBUG(2, ("netsec_decode: FAILED: packet sequence number:\n")); - dump_data(2, verf->seq_num, sizeof(verf->seq_num)); + dump_data(2, (const char*)verf->seq_num, sizeof(verf->seq_num)); DEBUG(2, ("should be:\n")); - dump_data(2, seq_num, sizeof(seq_num)); + dump_data(2, (const char*)seq_num, sizeof(seq_num)); return False; } @@ -1584,9 +1584,9 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, if (memcmp(verf->sig, netsec_sig, sizeof(verf->sig))) { /* Validate that the other end sent the expected header */ DEBUG(2, ("netsec_decode: FAILED: packet header:\n")); - dump_data(2, verf->sig, sizeof(verf->sig)); + dump_data(2, (const char*)verf->sig, sizeof(verf->sig)); DEBUG(2, ("should be:\n")); - dump_data(2, netsec_sig, sizeof(netsec_sig)); + dump_data(2, (const char*)netsec_sig, sizeof(netsec_sig)); return False; } -- cgit From be1b3604ef3d351b1e3013a509dcceb5fed8409f Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Wed, 14 Jan 2004 22:53:50 +0000 Subject: source/rpc_parse/parse_prs.c ZERO_STRUCTP(ps) not needed as it is done in prs_init now testsuite/printing/psec.c cannot do a prs_mem_free() when tdb_prs_fetch fails as the prs structure has not been initialized (This used to be commit a363e5d8c549861329506bd87c11d82ace5520e5) --- source3/rpc_parse/parse_prs.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 58652fa0c5..0e5a25fe8c 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1307,7 +1307,6 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *me if (!dbuf.dptr) return -1; - ZERO_STRUCTP(ps); prs_init(ps, 0, mem_ctx, UNMARSHALL); prs_give_memory(ps, dbuf.dptr, dbuf.dsize, True); -- cgit From 784b05c4895fa8d7f5215d4444bc74e91a918114 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 26 Jan 2004 08:45:02 +0000 Subject: This adds client-side support for the unicode/SAMR password change scheme. As well as avoiding DOS charset issues, this scheme returns useful error codes, that we can map back via the pam interface. This patch also cleans up the interfaces used for password buffers, to avoid duplication of code. Andrew Bartlett (This used to be commit 2a2b1f0c872d154fbcce71a250e23dfad085ba1e) --- source3/rpc_parse/parse_samr.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 607c9ecf64..712baa5cf7 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6954,7 +6954,7 @@ BOOL samr_io_r_get_dom_pwinfo(const char *desc, SAMR_R_GET_DOM_PWINFO * r_u, make a SAMR_ENC_PASSWD structure. ********************************************************************/ -void init_enc_passwd(SAMR_ENC_PASSWD * pwd, char pass[512]) +void init_enc_passwd(SAMR_ENC_PASSWD * pwd, const char pass[512]) { ZERO_STRUCTP(pwd); @@ -6997,7 +6997,7 @@ BOOL samr_io_enc_passwd(const char *desc, SAMR_ENC_PASSWD * pwd, inits a SAMR_ENC_HASH structure. ********************************************************************/ -void init_enc_hash(SAMR_ENC_HASH * hsh, uchar hash[16]) +void init_enc_hash(SAMR_ENC_HASH * hsh, const uchar hash[16]) { ZERO_STRUCTP(hsh); @@ -7040,11 +7040,11 @@ inits a SAMR_R_GET_DOM_PWINFO structure. ********************************************************************/ void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u, - char *dest_host, char *user_name, - char nt_newpass[516], - uchar nt_oldhash[16], - char lm_newpass[516], - uchar lm_oldhash[16]) + const char *dest_host, const char *user_name, + const char nt_newpass[516], + const uchar nt_oldhash[16], + const char lm_newpass[516], + const uchar lm_oldhash[16]) { DEBUG(5, ("init_samr_q_chgpasswd_user\n")); -- cgit From d198c5587774808823aa09e997ff492826738c51 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 8 Feb 2004 08:38:42 +0000 Subject: Make more functions static, and remove duplication in the use of functions in lib/smbpasswd.c that were exact duplicates of functions in passdb/passdb.c (These should perhaps be pulled back out to smbpasswd.c, but that can occour later). Andrew Bartlett (This used to be commit fcdc5efb1e245c8fa95cd031f67ec56093b9056e) --- source3/rpc_parse/parse_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 976ba20681..efb2bfa97f 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -32,7 +32,7 @@ static TALLOC_CTX *current_rpc_talloc = NULL; -TALLOC_CTX *get_current_rpc_talloc(void) +static TALLOC_CTX *get_current_rpc_talloc(void) { return current_rpc_talloc; } -- cgit From 1fa1e931a3ab031675f4e4e08119a531a1b98ab5 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Thu, 12 Feb 2004 16:16:53 +0000 Subject: More sync between passdb on 3.0 and HEAD. Replace unknown_3 with fields_present. Also causes rpc_samr structure field changes. (This used to be commit 1976843345efb6ca4f9cebd964a61acd8ae11d41) --- source3/rpc_parse/parse_samr.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 712baa5cf7..40fb8e6fe3 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5316,7 +5316,6 @@ static BOOL sam_io_user_info11(const char *desc, SAM_USER_INFO_11 * usr, /************************************************************************* init_sam_user_infoa - unknown_3 = 0x09f8 27fa unknown_5 = 0x0001 0000 unknown_6 = 0x0000 04ec @@ -5362,7 +5361,6 @@ static BOOL sam_io_user_info24(const char *desc, SAM_USER_INFO_24 * usr, /************************************************************************* init_sam_user_info23 - unknown_3 = 0x09f8 27fa unknown_6 = 0x0000 04ec *************************************************************************/ @@ -5386,7 +5384,7 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z uint32 user_rid, /* 0x0000 0000 */ uint32 group_rid, uint32 acb_info, - uint32 unknown_3, + uint32 fields_present, uint16 logon_divs, LOGON_HRS * hrs, uint16 bad_password_count, @@ -5406,7 +5404,7 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z usr->user_rid = user_rid; /* 0x0000 0000 */ usr->group_rid = group_rid; usr->acb_info = acb_info; - usr->unknown_3 = unknown_3; /* 09f8 27fa */ + usr->fields_present = fields_present; /* 09f8 27fa */ usr->logon_divs = logon_divs; /* should be 168 (hours/week) */ usr->ptr_logon_hrs = hrs ? 1 : 0; @@ -5464,7 +5462,6 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z /************************************************************************* init_sam_user_info23 - unknown_3 = 0x09f8 27fa unknown_6 = 0x0000 04ec *************************************************************************/ @@ -5481,7 +5478,7 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z 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 unknown_3, uint16 logon_divs, + uint32 fields_present, uint16 logon_divs, LOGON_HRS * hrs, uint16 bad_password_count, uint16 logon_count, char newpass[516], uint32 unknown_6) { @@ -5500,7 +5497,7 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z usr->user_rid = user_rid; /* 0x0000 0000 */ usr->group_rid = group_rid; usr->acb_info = acb_info; - usr->unknown_3 = unknown_3; /* 09f8 27fa */ + usr->fields_present = fields_present; /* 09f8 27fa */ usr->logon_divs = logon_divs; /* should be 168 (hours/week) */ usr->ptr_logon_hrs = hrs ? 1 : 0; @@ -5619,7 +5616,7 @@ static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr, if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info)) return False; - if(!prs_uint32("unknown_3 ", ps, depth, &usr->unknown_3)) + 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; @@ -5816,7 +5813,6 @@ static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_str /************************************************************************* init_sam_user_info21W - unknown_3 = 0x00ff ffff unknown_6 = 0x0000 04ec *************************************************************************/ @@ -5843,7 +5839,7 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, uint32 user_rid, uint32 group_rid, uint32 acb_info, - uint32 unknown_3, + uint32 fields_present, uint16 logon_divs, LOGON_HRS * hrs, uint16 bad_password_count, @@ -5863,7 +5859,7 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, usr->user_rid = user_rid; usr->group_rid = group_rid; usr->acb_info = acb_info; - usr->unknown_3 = unknown_3; /* 0x00ff ffff */ + usr->fields_present = fields_present; /* 0x00ff ffff */ usr->logon_divs = logon_divs; /* should be 168 (hours/week) */ usr->ptr_logon_hrs = hrs ? 1 : 0; @@ -5918,7 +5914,6 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, /************************************************************************* init_sam_user_info21 - unknown_3 = 0x00ff ffff unknown_6 = 0x0000 04ec *************************************************************************/ @@ -6005,14 +6000,14 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * /* Look at a user on a real NT4 PDC with usrmgr, press - 'ok'. Then you will see that unknown_3 is set to + '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->unknown_3 = 0x00ffffff; + 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; @@ -6133,7 +6128,7 @@ static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info)) return False; - if(!prs_uint32("unknown_3 ", ps, depth, &usr->unknown_3)) + 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; -- cgit From f934f5d7df7a9180146b238b55e92ac3cda9df3d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 24 Feb 2004 18:00:41 +0000 Subject: Add 'net rpc group add'. For this parse_samr.c had to be changed: The group_info4 in set_dom_group_info also has the level in the record itself. This seems not to be an align. Tested with NT4 usrmgr.exe. It can still create a domain group on a samba machine. Volker (This used to be commit 76c75bb8a7ad2a2e719dbbe997abf8aefe2fbbb4) --- source3/rpc_parse/parse_samr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 40fb8e6fe3..fda0b0f1e1 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2271,10 +2271,11 @@ BOOL samr_io_group_info3(const char *desc, GROUP_INFO3 *gr3, prs_struct *ps, int inits a GROUP_INFO4 structure. ********************************************************************/ -void init_samr_group_info4(GROUP_INFO4 * gr4, char *acct_desc) +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); } @@ -2292,9 +2293,8 @@ BOOL samr_io_group_info4(const char *desc, GROUP_INFO4 * gr4, prs_debug(ps, depth, desc, "samr_io_group_info4"); depth++; - if(!prs_align(ps)) + 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, @@ -2349,7 +2349,7 @@ 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, char *acct_desc, + POLICY_HND *pol, const char *acct_desc, uint32 access_mask) { DEBUG(5, ("init_samr_q_create_dom_group\n")); -- cgit From a92de03d9e2f22c7d8a6361f5d9d93738d9e3409 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 28 Feb 2004 18:41:16 +0000 Subject: Add 'net rpc group [add|del]mem' for domain groups and aliases. Volker (This used to be commit e597420421e085b17dcdc062c5900518d0d4e685) --- source3/rpc_parse/parse_samr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index fda0b0f1e1..34b0cf2848 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3521,7 +3521,7 @@ BOOL samr_io_alias_info1(const char *desc, ALIAS_INFO1 * al1, inits a ALIAS_INFO3 structure. ********************************************************************/ -void init_samr_alias_info3(ALIAS_INFO3 * al3, char *acct_desc) +void init_samr_alias_info3(ALIAS_INFO3 * al3, const char *acct_desc) { DEBUG(5, ("init_samr_alias_info3\n")); @@ -4232,7 +4232,7 @@ 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, char *acct_desc) + POLICY_HND *hnd, const char *acct_desc) { DEBUG(5, ("init_samr_q_create_dom_alias\n")); @@ -4241,7 +4241,7 @@ void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS * q_u, 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 = 0x001f000f; + q_u->access_mask = MAXIMUM_ALLOWED_ACCESS; } /******************************************************************* -- cgit From cc98a35689b114aed9bab705e54881e5439805e3 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 24 Mar 2004 19:15:17 +0000 Subject: fixes for prnadmin.dll API * force the PRINTER_ATTRIBUTE_LOCAL (nor PRINTER_ATTRIBUTE_NETWORK) * ensure that we return the sec_desc in smb_io_printer_info_2 (allows prnui.dll to restore security descriptors from a data file). (This used to be commit c335cb80d2e4c687279b7a6038a97518770ccae9) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 7581316767..ae087c7f77 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2561,7 +2561,7 @@ BOOL smb_io_printer_info_2(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 return False; /* parse the sec_desc */ - if (has_secdesc) { + if (info->secdesc) { if (!prs_set_offset(ps, sd_offset)) return False; if (!smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc)) -- cgit From 044c6f513dca21d4fc01db4a686c75d43d4952d2 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 2 Apr 2004 12:56:18 +0000 Subject: Implement NETLOGON GetDCName client side. You can ask a DC for the name of a DC it trusts. Volker (This used to be commit ae6840320ff47827c2817549fe3133a57e3fe77f) --- source3/rpc_parse/parse_net.c | 84 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 90cd348f5a..a98738b51f 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -424,6 +424,90 @@ BOOL net_io_r_logon_ctrl(const char *desc, NET_R_LOGON_CTRL *r_l, prs_struct *ps 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_r_getdcname\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_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 (!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_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_ntstatus("status", ps, depth, &r_t->status)) + return False; + + return True; +} + /******************************************************************* Inits an NET_R_TRUST_DOM_LIST structure. ********************************************************************/ -- cgit From 931df5850e326ad0639fe317e0ca82e6d820a68e Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 5 Apr 2004 12:19:50 +0000 Subject: r39: * importing .cvsignore files * updateing WHATSNEW with vl's change (This used to be commit a7e2730ec4389e0c249886a8bfe1ee14c5abac41) --- source3/rpc_parse/.cvsignore | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 source3/rpc_parse/.cvsignore (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/.cvsignore b/source3/rpc_parse/.cvsignore deleted file mode 100644 index 5f2a5c4cf7..0000000000 --- a/source3/rpc_parse/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -*.po -*.po32 -- cgit From d17425ed52b086b7046708a207e849271cedc804 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 6 Apr 2004 08:11:16 +0000 Subject: r69: Global rename of 'nt_session_key' -> 'user_session_key'. The session key could be anything, and may not be based on anything 'NT'. This is also what microsoft calls it. (This used to be commit 724e8d3f33719543146280062435c69a835c491e) --- source3/rpc_parse/parse_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index a98738b51f..36d55c7bf6 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1349,7 +1349,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, uint16 logon_count, uint16 bad_pw_count, uint32 num_groups, const DOM_GID *gids, - uint32 user_flgs, uchar nt_session_key[16], + uint32 user_flgs, uchar user_session_key[16], uchar lm_session_key[16], const char *logon_srv, const char *logon_dom, const DOM_SID *dom_sid, const char *other_sids) @@ -1392,8 +1392,8 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, usr->buffer_groups = 1; /* indicates fill in groups, below, even if there are none */ usr->user_flgs = user_flgs; - if (nt_session_key != NULL) - memcpy(usr->user_sess_key, nt_session_key, sizeof(usr->user_sess_key)); + 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)); -- cgit From 8ad3d8c9b065f3a2040beff801bdc9dceac868a8 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 13 Apr 2004 14:39:48 +0000 Subject: r196: merging struct uuid from trunk (This used to be commit 911a28361b9d8dd50597627f245ebfb57c6294fb) --- source3/rpc_parse/parse_ds.c | 4 +-- source3/rpc_parse/parse_lsa.c | 2 +- source3/rpc_parse/parse_misc.c | 28 ++++++++++++++++ source3/rpc_parse/parse_rpc.c | 75 ++++++++++++++++++------------------------ source3/rpc_parse/parse_samr.c | 4 --- source3/rpc_parse/parse_sec.c | 4 +-- 6 files changed, 65 insertions(+), 52 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index 26dcdb34b8..070f6be43a 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -49,7 +49,7 @@ static BOOL ds_io_dominfobasic( const char *desc, prs_struct *ps, int depth, DSR if ( !prs_uint32("forestname_ptr", ps, depth, &p->forestname_ptr) ) return False; - if ( !prs_uint8s(False, "domain_guid", ps, depth, p->domain_guid.info, GUID_SIZE) ) + 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) ) @@ -179,7 +179,7 @@ static BOOL ds_io_domain_trusts( const char *desc, prs_struct *ps, int depth, DS if ( !prs_uint32( "sid_ptr", ps, depth, &trust->sid_ptr ) ) return False; - if ( !prs_uint8s(False, "guid", ps, depth, trust->guid.info, GUID_SIZE) ) + if ( !smb_io_uuid("guid", &trust->guid, ps, depth) ) return False; return True; diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index d29b7bc580..5fff1fea37 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2142,7 +2142,7 @@ BOOL lsa_io_dns_dom_info(const char *desc, LSA_DNS_DOM_INFO *info, if(!prs_align(ps)) return False; - if (!prs_uint8s(False, "dom_guid", ps, depth, info->dom_guid.info, GUID_SIZE)) + if ( !smb_io_uuid("dom_guid", &info->dom_guid, ps, depth) ) return False; if(!prs_align(ps)) diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index efb2bfa97f..cea31c88a8 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -322,6 +322,34 @@ BOOL smb_io_dom_sid2(const char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) return True; } +/******************************************************************* + Reads or writes a struct uuid +********************************************************************/ + +BOOL smb_io_uuid(const char *desc, struct uuid *uuid, + prs_struct *ps, int depth) +{ + if (uuid == NULL) + return False; + + prs_debug(ps, depth, desc, "smb_io_uuid"); + depth++; + + if(!prs_uint32 ("data ", ps, depth, &uuid->time_low)) + return False; + if(!prs_uint16 ("data ", ps, depth, &uuid->time_mid)) + return False; + if(!prs_uint16 ("data ", ps, depth, &uuid->time_hi_and_version)) + return False; + + if(!prs_uint8s (False, "data ", ps, depth, uuid->clock_seq, sizeof(uuid->clock_seq))) + return False; + if(!prs_uint8s (False, "data ", ps, depth, uuid->node, sizeof(uuid->node))) + return False; + + return True; +} + /******************************************************************* creates a STRHDR structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index e2781b2008..69262b6d0c 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -34,7 +34,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x8a885d04, 0x1ceb, 0x11c9, \ - { 0x9f, 0xe8, 0x08, 0x00, \ + { 0x9f, 0xe8 }, \ + { 0x08, 0x00, \ 0x2b, 0x10, 0x48, 0x60 } \ }, 0x02 \ } @@ -43,7 +44,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x8a885d04, 0x1ceb, 0x11c9, \ - { 0x9f, 0xe8, 0x08, 0x00, \ + { 0x9f, 0xe8 }, \ + { 0x08, 0x00, \ 0x2b, 0x10, 0x48, 0x60 } \ }, 0x02 \ } @@ -52,7 +54,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x6bffd098, 0xa112, 0x3610, \ - { 0x98, 0x33, 0x46, 0xc3, \ + { 0x98, 0x33 }, \ + { 0x46, 0xc3, \ 0xf8, 0x7e, 0x34, 0x5a } \ }, 0x01 \ } @@ -61,7 +64,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x4b324fc8, 0x1670, 0x01d3, \ - { 0x12, 0x78, 0x5a, 0x47, \ + { 0x12, 0x78 }, \ + { 0x5a, 0x47, \ 0xbf, 0x6e, 0xe1, 0x88 } \ }, 0x03 \ } @@ -70,7 +74,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x12345778, 0x1234, 0xabcd, \ - { 0xef, 0x00, 0x01, 0x23, \ + { 0xef, 0x00 }, \ + { 0x01, 0x23, \ 0x45, 0x67, 0x89, 0xab } \ }, 0x00 \ } @@ -79,7 +84,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x3919286a, 0xb10c, 0x11d0, \ - { 0x9b, 0xa8, 0x00, 0xc0, \ + { 0x9b, 0xa8 }, \ + { 0x00, 0xc0, \ 0x4f, 0xd9, 0x2e, 0xf5 } \ }, 0x00 \ } @@ -88,7 +94,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x12345778, 0x1234, 0xabcd, \ - { 0xef, 0x00, 0x01, 0x23, \ + { 0xef, 0x00 }, \ + { 0x01, 0x23, \ 0x45, 0x67, 0x89, 0xac } \ }, 0x01 \ } @@ -97,7 +104,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x12345678, 0x1234, 0xabcd, \ - { 0xef, 0x00, 0x01, 0x23, \ + { 0xef, 0x00 }, \ + { 0x01, 0x23, \ 0x45, 0x67, 0xcf, 0xfb } \ }, 0x01 \ } @@ -106,7 +114,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x338cd001, 0x2244, 0x31f1, \ - { 0xaa, 0xaa, 0x90, 0x00, \ + { 0xaa, 0xaa }, \ + { 0x90, 0x00, \ 0x38, 0x00, 0x10, 0x03 } \ }, 0x01 \ } @@ -115,7 +124,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x12345678, 0x1234, 0xabcd, \ - { 0xef, 0x00, 0x01, 0x23, \ + { 0xef, 0x00 }, \ + { 0x01, 0x23, \ 0x45, 0x67, 0x89, 0xab } \ }, 0x01 \ } @@ -124,7 +134,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x0, 0x0, 0x0, \ - { 0x00, 0x00, 0x00, 0x00, \ + { 0x00, 0x00 }, \ + { 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00 } \ }, 0x00 \ } @@ -133,7 +144,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x4fc742e0, 0x4a10, 0x11cf, \ - { 0x82, 0x73, 0x00, 0xaa, \ + { 0x82, 0x73 }, \ + { 0x00, 0xaa, \ 0x00, 0x4a, 0xe6, 0x73 } \ }, 0x03 \ } @@ -142,7 +154,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x60a15ec5, 0x4de8, 0x11d7, \ - { 0xa6, 0x37, 0x00, 0x50, \ + { 0xa6, 0x37 }, \ + { 0x00, 0x50, \ 0x56, 0xa2, 0x01, 0x82 } \ }, 0x01 \ } @@ -151,7 +164,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x894de0c0, 0x0d55, 0x11d3, \ - { 0xa3, 0x22, 0x00, 0xc0, \ + { 0xa3, 0x22 }, \ + { 0x00, 0xc0, \ 0x4f, 0xa3, 0x21, 0xa1 } \ }, 0x01 \ } @@ -252,34 +266,6 @@ BOOL smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) return True; } -/******************************************************************* - Reads or writes an RPC_UUID structure. -********************************************************************/ - -static BOOL smb_io_rpc_uuid(const char *desc, RPC_UUID *uuid, prs_struct *ps, int depth) -{ - if (uuid == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_uuid"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32 ("data ", ps, depth, &uuid->time_low)) - return False; - if(!prs_uint16 ("data ", ps, depth, &uuid->time_mid)) - return False; - if(!prs_uint16 ("data ", ps, depth, &uuid->time_hi_and_version)) - return False; - - if(!prs_uint8s (False, "data ", ps, depth, uuid->remaining, sizeof(uuid->remaining))) - return False; - - return True; -} - /******************************************************************* Reads or writes an RPC_IFACE structure. ********************************************************************/ @@ -292,7 +278,10 @@ static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, i prs_debug(ps, depth, desc, "smb_io_rpc_iface"); depth++; - if (!smb_io_rpc_uuid( "uuid", &ifc->uuid, ps, depth)) + if (!prs_align(ps)) + return False; + + if (!smb_io_uuid( "uuid", &ifc->uuid, ps, depth)) return False; if(!prs_uint32 ("version", ps, depth, &ifc->version)) diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 34b0cf2848..287dc3bd7f 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5315,10 +5315,6 @@ static BOOL sam_io_user_info11(const char *desc, SAM_USER_INFO_11 * usr, /************************************************************************* init_sam_user_infoa - - unknown_5 = 0x0001 0000 - unknown_6 = 0x0000 04ec - *************************************************************************/ void init_sam_user_info24(SAM_USER_INFO_24 * usr, char newpass[516], uint16 pw_len) diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index bf43ef288a..a78627650a 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -83,11 +83,11 @@ BOOL sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth) return False; if (psa->obj_flags & SEC_ACE_OBJECT_PRESENT) - if (!prs_uint8s(False, "obj_guid", ps, depth, psa->obj_guid.info, GUID_SIZE)) + if (!smb_io_uuid("obj_guid", &psa->obj_guid, ps,depth)) return False; if (psa->obj_flags & SEC_ACE_OBJECT_INHERITED_PRESENT) - if (!prs_uint8s(False, "inh_guid", ps, depth, psa->inh_guid.info, GUID_SIZE)) + if (!smb_io_uuid("inh_guid", &psa->inh_guid, ps,depth)) return False; if(!smb_io_dom_sid("trustee ", &psa->trustee , ps, depth)) -- cgit From dcdd94f20955e68b80769cb7ee42dd256e40da26 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 5 May 2004 00:26:46 +0000 Subject: r480: Added Andrew Bartletts pwinfo-parse-error.patch. Jeremy. (This used to be commit b9e79004a4c1e4a472f0627d2c33c966af22ccd2) --- source3/rpc_parse/parse_samr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 287dc3bd7f..85eedc7baa 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6928,11 +6928,11 @@ BOOL samr_io_r_get_dom_pwinfo(const char *desc, SAMR_R_GET_DOM_PWINFO * r_u, * what they are, but the length is important for the singing */ - if(!prs_uint32("unk_0", ps, depth, &r_u->unk_0)) + if(!prs_uint16("unk_0", ps, depth, &r_u->unk_0)) return False; - if(!prs_uint32("unk_1", ps, depth, &r_u->unk_1)) + if(!prs_align(ps)) return False; - if(!prs_uint32("unk_2", ps, depth, &r_u->unk_2)) + if(!prs_uint32("unk_1", ps, depth, &r_u->unk_1)) return False; if(!prs_ntstatus("status", ps, depth, &r_u->status)) -- cgit From 41db2016adc464691ea2c3497aedca55fcf004ed Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 13 May 2004 20:32:21 +0000 Subject: r704: BUG 1315: fix for schannel client connections to server's that don't support 128 bit encryption (This used to be commit 316ba5ad89ddfa445d44d28141c5901fc64aec90) --- source3/rpc_parse/parse_rpc.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 69262b6d0c..f4ffcba1bd 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -1189,7 +1189,8 @@ BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, /******************************************************************* reads or writes an RPC_AUTH_NETSEC_CHK structure. ********************************************************************/ -BOOL smb_io_rpc_auth_netsec_chk(const char *desc, RPC_AUTH_NETSEC_CHK * chk, +BOOL smb_io_rpc_auth_netsec_chk(const char *desc, int auth_len, + RPC_AUTH_NETSEC_CHK * chk, prs_struct *ps, int depth) { if (chk == NULL) @@ -1198,10 +1199,19 @@ BOOL smb_io_rpc_auth_netsec_chk(const char *desc, RPC_AUTH_NETSEC_CHK * chk, prs_debug(ps, depth, desc, "smb_io_rpc_auth_netsec_chk"); depth++; - prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)); - prs_uint8s(False, "seq_num", ps, depth, chk->seq_num, sizeof(chk->seq_num)); - prs_uint8s(False, "packet_digest", ps, depth, chk->packet_digest, sizeof(chk->packet_digest)); - prs_uint8s(False, "confounder", ps, depth, chk->confounder, sizeof(chk->confounder)); + if ( !prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)) ) + return False; + + if ( !prs_uint8s(False, "seq_num", ps, depth, chk->seq_num, sizeof(chk->seq_num)) ) + return False; + + if ( !prs_uint8s(False, "packet_digest", ps, depth, chk->packet_digest, sizeof(chk->packet_digest)) ) + return False; + + if ( auth_len == RPC_AUTH_NETSEC_SIGN_OR_SEAL_CHK_LEN ) { + if ( !prs_uint8s(False, "confounder", ps, depth, chk->confounder, sizeof(chk->confounder)) ) + return False; + } return True; } -- cgit From 47af5445f39202b91e29bce0fff8933e56063789 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 2 Jun 2004 14:25:29 +0000 Subject: r977: Implement 'net rpc group rename' -- rename domain groups. Volker (This used to be commit 9ceff803278bdbc09cb5ab678a108cea24ab49a9) --- source3/rpc_parse/parse_samr.c | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 85eedc7baa..e6d7e847ad 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2204,12 +2204,17 @@ 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; @@ -2235,6 +2240,43 @@ BOOL samr_io_group_info1(const char *desc, GROUP_INFO1 * gr1, 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. ********************************************************************/ @@ -2328,6 +2370,10 @@ static BOOL samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr, 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; -- cgit From 9dbf2e2419e2ba0f2293b4a7a5971123f34a09ad Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 3 Jun 2004 18:00:22 +0000 Subject: r991: Allow winbindd to use the domain trust account password for setting up an schannel connection. This solves the problem of a Samba DC running winbind, trusting a native mode AD domain, and needing to enumerate AD users via wbinfo -u. (This used to be commit e9f109d1b38e0b0adec9b7e9a907f90a79d297ea) --- source3/rpc_parse/parse_net.c | 67 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 36d55c7bf6..b42b9b2a8b 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -182,6 +182,50 @@ static BOOL net_io_netinfo_2(const char *desc, NETLOGON_INFO_2 *info, prs_struct 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. ********************************************************************/ @@ -210,9 +254,23 @@ BOOL net_io_q_logon_ctrl2(const char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct * return False; if(!prs_uint32("query_level ", ps, depth, &q_l->query_level)) return False; - if(!prs_uint32("switch_value ", ps, depth, &q_l->switch_value)) - 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; } @@ -227,7 +285,6 @@ void init_net_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, const char *srv_name, q_l->function_code = 0x01; q_l->query_level = query_level; - q_l->switch_value = 0x01; init_unistr2(&q_l->uni_server_name, srv_name, UNI_STR_TERMINATE); } @@ -241,9 +298,7 @@ void init_net_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level, uint32 logon_attempts, uint32 tc_status, const char *trusted_domain_name) { - DEBUG(5,("init_r_logon_ctrl2\n")); - - r_l->switch_value = query_level; /* should only be 0x1 */ + r_l->switch_value = query_level; switch (query_level) { case 1: -- cgit From 0805d1ddc324ec6f8ffd35b296f9fc4a245dccb9 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 14 Jun 2004 02:58:50 +0000 Subject: r1125: Remove bougus comments. (The real fix was to the sealed pipe padding) Andrew Bartlett (This used to be commit 61768f4cb3a268ce30911b15b30f82de36716b5f) --- source3/rpc_parse/parse_samr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index e6d7e847ad..bb4c94404b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6970,8 +6970,7 @@ BOOL samr_io_r_get_dom_pwinfo(const char *desc, SAMR_R_GET_DOM_PWINFO * r_u, return False; /* - * We need 16 bytes here according to tests. Don't know - * what they are, but the length is important for the singing + * see the Samba4 IDL for what these actually are. */ if(!prs_uint16("unk_0", ps, depth, &r_u->unk_0)) -- cgit From 5db731d899987d1a53e72f16b92b7e01eafd80c2 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jun 2004 08:37:01 +0000 Subject: r1202: This hopefully fixes our memory use when unmarshalling strings. The test case was 'rpcclient -c "enumprinters 2"' with 4000 printers. At some point this completely exploded in memory usage. For every string we talloc'ed memory up to the end of the buffer. -> O(n^2). This survives valgrind with this number of printers. It might also have influence on winbind with a large number of users. All those who dare to look at samba3 rpc code, could you please take a look? I know this is a burden, but I would like comments ;-))) Volker (This used to be commit af251f4ea63c584604972e1c8add83e65046de80) --- source3/rpc_parse/parse_prs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 0e5a25fe8c..92c5b13632 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1101,10 +1101,13 @@ BOOL prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) /* the test of the value of *ptr helps to catch the circumstance where we have an emtpty (non-existent) string in the buffer */ - for ( ptr = (uint16 *)q; *ptr && (alloc_len <= max_len); alloc_len++) + for ( ptr = (uint16 *)q; *ptr++ && (alloc_len <= max_len); alloc_len++) /* do nothing */ ; + if (alloc_len < max_len) + alloc_len += 1; + /* should we allocate anything at all? */ str->buffer = (uint16 *)prs_alloc_mem(ps,alloc_len * sizeof(uint16)); if ((str->buffer == NULL) && (alloc_len > 0)) -- cgit From 9d0783bf211dffe58845b36b0669f05bf8bf25b5 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 14 Jul 2004 04:36:01 +0000 Subject: r1492: Rework our random number generation system. On systems with /dev/urandom, this avoids a change to secrets.tdb for every fork(). For other systems, we now only re-seed after a fork, and on startup. No need to do it per-operation. This removes the 'need_reseed' parameter from generate_random_buffer(). Andrew Bartlett (This used to be commit 36741d3cf53a7bd17d361251f2bb50851cdb035f) --- source3/rpc_parse/parse_prs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 92c5b13632..c70011c648 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1471,7 +1471,7 @@ void netsec_encode(struct netsec_auth_struct *a, int auth_flags, } /* fill the 'confounder' with random data */ - generate_random_buffer(confounder, sizeof(confounder), False); + generate_random_buffer(confounder, sizeof(confounder)); dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); -- cgit From 60727acc3b33cb90309a43c10813fadcb94142eb Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 10 Aug 2004 14:27:17 +0000 Subject: r1692: first commit :) * add IA64 to the architecture table of printer-drivers * add new "net"-subcommands: net rpc printer migrate {drivers|printers|forms|security|settings|all} [printer] net rpc share migrate {shares|files|all} [share] this is the first part of the migration suite. this will will (once feature-complete) allow to do 1:1 server-cloning in the best possible way by making heavy use of samba's rpc_client-functions. all migration-steps are implemented as rpc/smb-client-calls; net communicates via rpc/smb with two servers at the same time (a remote, source server and a destination server that currently defaults to the local smbd). this allows e. g. printer-driver migration including driverfiles, recursive mirroring of file-shares including file-acls, etc. almost any migration step can be called with a migrate-subcommand to provide more flexibility during a migration process (at the cost of quite some redundancy :) ). "net rpc printer migrate settings" is still in a bad condition (many open questions that hopefully can be adressed soon). "net rpc share migrate security" as an isolated call to just migrate share-ACLs will be added later. Before playing with it, make sure to use a test-server. Migration is a serious business and this tool-set can perfectly overwrite your existing file/print-shares. * along with the migration functions had to make I the following changes: - implement setprinter level 3 client-side - implement net_add_share level 502 client-side - allow security descriptor to be set in setprinterdata level 2 serverside guenther (This used to be commit 8f1716a29b7e85baf738bc14df7dabf03762f723) --- source3/rpc_parse/parse_spoolss.c | 38 ++++++++++++++++++++++++++++++++- source3/rpc_parse/parse_srv.c | 45 ++++++++++++++++++++++++++++----------- 2 files changed, 69 insertions(+), 14 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index ae087c7f77..7ae6a0d893 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1053,6 +1053,28 @@ BOOL make_spoolss_printer_info_2(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_2 return True; } +/******************************************************************* +create a SPOOL_PRINTER_INFO_3 struct from a PRINTER_INFO_3 struct +*******************************************************************/ + +BOOL make_spoolss_printer_info_3(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_3 **spool_info3, + PRINTER_INFO_3 *info) +{ + + SPOOL_PRINTER_INFO_LEVEL_3 *inf; + + /* allocate the necessary memory */ + if (!(inf=(SPOOL_PRINTER_INFO_LEVEL_3*)talloc(mem_ctx, sizeof(SPOOL_PRINTER_INFO_LEVEL_3)))) { + DEBUG(0,("make_spoolss_printer_info_3: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_3 sruct!\n")); + return False; + } + + inf->secdesc_ptr = (info->secdesc!=NULL)?1:0; + + *spool_info3 = inf; + + return True; +} /******************************************************************* * read a structure. @@ -4112,6 +4134,20 @@ BOOL make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, q_u->devmode_ctr.size = 0; q_u->devmode_ctr.devmode = NULL; #endif + break; + case 3: + secdesc = info->printers_3->secdesc; + + make_spoolss_printer_info_3 (mem_ctx, &q_u->info.info_3, info->printers_3); + + q_u->secdesc_ctr = (SEC_DESC_BUF*)malloc(sizeof(SEC_DESC_BUF)); + if (!q_u->secdesc_ctr) + return False; + q_u->secdesc_ctr->ptr = (secdesc != NULL) ? 1: 0; + q_u->secdesc_ctr->max_len = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0; + q_u->secdesc_ctr->len = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0; + q_u->secdesc_ctr->sec = secdesc; + break; default: DEBUG(0,("make_spoolss_q_setprinter: Unknown info level [%d]\n", level)); @@ -7358,7 +7394,7 @@ BOOL spoolss_io_r_enumprinterdataex(const char *desc, SPOOL_R_ENUMPRINTERDATAEX if (!prs_set_offset(ps, end_offset)) return False; - return True; + return True; } /******************************************************************* diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 6349fc1632..8313c82c93 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1456,19 +1456,38 @@ BOOL srv_io_q_net_share_add(const char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_stru void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname, const char *netname, uint32 type, const char *remark, uint32 perms, uint32 max_uses, uint32 num_uses, - const char *path, const char *passwd) -{ - q->ptr_srv_name = 1; - init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE); - q->info.switch_value = q->info_level = 2; - - q->info.ptr_share_ctr = 1; - init_srv_share_info2(&q->info.share.info2.info_2, netname, type, - remark, perms, max_uses, num_uses, path, passwd); - init_srv_share_info2_str(&q->info.share.info2.info_2_str, netname, - remark, path, passwd); - q->ptr_err_index = 1; - q->err_index = 0; + const char *path, const char *passwd, + int level, SEC_DESC *sd) +{ + switch(level) { + case 502: { + size_t sd_size = sec_desc_size(sd); + q->ptr_srv_name = 1; + init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE); + q->info.switch_value = q->info_level = level; + q->info.ptr_share_ctr = 1; + init_srv_share_info502(&q->info.share.info502.info_502, netname, type, + remark, perms, max_uses, num_uses, path, passwd, sd, sd_size); + init_srv_share_info502_str(&q->info.share.info502.info_502_str, netname, + remark, path, passwd, sd, sd_size); + q->ptr_err_index = 1; + q->err_index = 0; + } + break; + case 2: + default: + q->ptr_srv_name = 1; + init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE); + q->info.switch_value = q->info_level = level; + q->info.ptr_share_ctr = 1; + init_srv_share_info2(&q->info.share.info2.info_2, netname, type, + remark, perms, max_uses, num_uses, path, passwd); + init_srv_share_info2_str(&q->info.share.info2.info_2_str, netname, + remark, path, passwd); + q->ptr_err_index = 1; + q->err_index = 0; + break; + } } -- cgit From 7418d20abe0870745f4845de59aa92128ea646ef Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 17 Sep 2004 21:20:32 +0000 Subject: r2396: Fix bug found by Cornelio Bondad Jr . To correct “net rpc vampire” core dump. Jeremy. (This used to be commit cd910ffc510f2007c2619d7a4d31e5e41de7d1d1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source3/rpc_parse/parse_net.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index b42b9b2a8b..813316177a 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -2399,11 +2399,9 @@ static BOOL net_io_sam_alias_info(const char *desc, SAM_ALIAS_INFO * info, info->hdr_sec_desc.buffer, ps, depth)) return False; - if (info->hdr_als_desc.buffer != 0) { - if (!smb_io_unistr2("uni_als_desc", &info->uni_als_desc, - info->hdr_als_name.buffer, 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; } -- cgit From d25aba1d144eef4fb400b730ffde308120440d17 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 21 Sep 2004 13:31:57 +0000 Subject: r2476: now that PRINTER_ATTRIBUTE_PUBLISHED does not get reset anymore, migrate the publishing-state for migrated printers as well. Therefor added client-side-support for setprinter level 7. Next will be a "net rpc printer publish"-command (just for completeness). Guenther (This used to be commit 224920738fdc65ef170152062177421cfed85bbf) --- source3/rpc_parse/parse_spoolss.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 7ae6a0d893..2b2038d16a 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1076,6 +1076,32 @@ BOOL make_spoolss_printer_info_3(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_3 return True; } +/******************************************************************* +create a SPOOL_PRINTER_INFO_7 struct from a PRINTER_INFO_7 struct +*******************************************************************/ + +BOOL make_spoolss_printer_info_7(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_7 **spool_info7, + PRINTER_INFO_7 *info) +{ + + SPOOL_PRINTER_INFO_LEVEL_7 *inf; + + /* allocate the necessary memory */ + if (!(inf=(SPOOL_PRINTER_INFO_LEVEL_7*)talloc(mem_ctx, sizeof(SPOOL_PRINTER_INFO_LEVEL_7)))) { + DEBUG(0,("make_spoolss_printer_info_7: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_7 struct!\n")); + return False; + } + + inf->guid_ptr = (info->guid.buffer!=NULL)?1:0; + inf->action = info->action; + init_unistr2_from_unistr(&inf->guid, &info->guid); + + *spool_info7 = inf; + + return True; +} + + /******************************************************************* * read a structure. * called from spoolss_q_open_printer_ex (srv_spoolss.c) @@ -4149,6 +4175,10 @@ BOOL make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, q_u->secdesc_ctr->sec = secdesc; break; + case 7: + make_spoolss_printer_info_7 (mem_ctx, &q_u->info.info_7, info->printers_7); + break; + default: DEBUG(0,("make_spoolss_q_setprinter: Unknown info level [%d]\n", level)); break; -- cgit From 2d0f5486f085e0db4528fb3f72ca311c73c36b92 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 9 Nov 2004 21:15:14 +0000 Subject: r3639: patch from Martin Zielinski to add DeleteDriverEx() function to rpcclient (This used to be commit cfd51c02447f7b42cffcaf4cc6179237d58c8229) --- source3/rpc_parse/parse_spoolss.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 2b2038d16a..503a9454fc 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1218,6 +1218,30 @@ BOOL spoolss_io_r_open_printer_ex(const char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u return True; } +/******************************************************************* + * init a structure. + ********************************************************************/ +BOOL make_spoolss_q_deleteprinterdriverex( TALLOC_CTX *mem_ctx, + SPOOL_Q_DELETEPRINTERDRIVEREX *q_u, + const char *server, + const char* arch, + const char* driver ) +{ + DEBUG(5,("make_spoolss_q_deleteprinterdriverex\n")); + + q_u->server_ptr = (server!=NULL)?1:0; + q_u->delete_flags = DPD_DELETE_UNUSED_FILES; + + /* these must be NULL terminated or else NT4 will + complain about invalid parameters --jerry */ + init_unistr2(&q_u->server, server, UNI_STR_TERMINATE); + init_unistr2(&q_u->arch, arch, UNI_STR_TERMINATE); + init_unistr2(&q_u->driver, driver, UNI_STR_TERMINATE); + + return True; +} + + /******************************************************************* * init a structure. ********************************************************************/ -- cgit From d7bbbb28bde0149ff98f2e3bacee455235e3fb92 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 10 Nov 2004 00:53:35 +0000 Subject: r3645: Allow deldriverex in rpcclient to delete drivers for a specific architecture and a specific version. Guenther (This used to be commit a24df09386f177e625fb99c975896cbe7a594b4b) --- source3/rpc_parse/parse_spoolss.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 503a9454fc..6362dcf0f1 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1225,7 +1225,8 @@ BOOL make_spoolss_q_deleteprinterdriverex( TALLOC_CTX *mem_ctx, SPOOL_Q_DELETEPRINTERDRIVEREX *q_u, const char *server, const char* arch, - const char* driver ) + const char* driver, + uint32 version) { DEBUG(5,("make_spoolss_q_deleteprinterdriverex\n")); @@ -1237,7 +1238,12 @@ BOOL make_spoolss_q_deleteprinterdriverex( TALLOC_CTX *mem_ctx, init_unistr2(&q_u->server, server, UNI_STR_TERMINATE); init_unistr2(&q_u->arch, arch, UNI_STR_TERMINATE); init_unistr2(&q_u->driver, driver, UNI_STR_TERMINATE); - + + if (version >= 0) { + q_u->delete_flags |= DPD_DELETE_SPECIFIC_VERSION; + q_u->version = version; + } + return True; } -- cgit From cbba4885f356f191aeda1952473336c2eb6607e8 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 23 Nov 2004 20:50:16 +0000 Subject: r3928: Fix duplicate call to pdb_get_acct_desc(). Bugzilla #2080. (This used to be commit 3ebfd137b2d8f393874561046ef79f4d9a8cae52) --- source3/rpc_parse/parse_samr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index bb4c94404b..ddae4bbdff 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1666,7 +1666,7 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_en } init_unistr2(&sam->str[i].uni_srv_name, username, UNI_FLAGS_NONE); - init_unistr2(&sam->str[i].uni_srv_desc, pdb_get_acct_desc(pwd), UNI_FLAGS_NONE); + init_unistr2(&sam->str[i].uni_srv_desc, acct_desc, 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, -- cgit From b9fcb5b961fc4165899487c7cb368ab2d8d15e8a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 29 Nov 2004 19:28:12 +0000 Subject: r4005: Fix for bug #2071 reported by Jason Mader . Use correct enum type for comparisons. Jeremy. (This used to be commit b926480d053e42205e959b9808a6e3bb90db9ce5) --- source3/rpc_parse/parse_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index cea31c88a8..c6f05df0c4 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -934,7 +934,7 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) if (buf) { rpcstr_push((char *)str->buffer, buf, len, STR_TERMINATE); num_chars = strlen_w(str->buffer); - if (flags == STR_TERMINATE || flags == UNI_MAXLEN_TERMINATE) { + if (flags == UNI_STR_TERMINATE || flags == UNI_MAXLEN_TERMINATE) { num_chars++; } } -- cgit From acf9d61421faa6c0055d57fdee7db300dc5431aa Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 7 Dec 2004 18:25:53 +0000 Subject: r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation functions so we can funnel through some well known functions. Should help greatly with malloc checking. HEAD patch to follow. Jeremy. (This used to be commit 620f2e608f70ba92f032720c031283d295c5c06a) --- source3/rpc_parse/parse_dfs.c | 8 +- source3/rpc_parse/parse_ds.c | 4 +- source3/rpc_parse/parse_echo.c | 8 +- source3/rpc_parse/parse_lsa.c | 58 ++++++--------- source3/rpc_parse/parse_misc.c | 80 ++++++++------------ source3/rpc_parse/parse_net.c | 49 +++++-------- source3/rpc_parse/parse_prs.c | 37 ++++++---- source3/rpc_parse/parse_samr.c | 150 ++++++++++++++++---------------------- source3/rpc_parse/parse_sec.c | 12 +-- source3/rpc_parse/parse_spoolss.c | 105 +++++++++++++------------- source3/rpc_parse/parse_srv.c | 34 ++++----- 11 files changed, 239 insertions(+), 306 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index 0d0ce557b2..3f7b2a4cd5 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -374,7 +374,7 @@ BOOL dfs_io_dfs_info_ctr(const char *desc, DFS_INFO_CTR* ctr, uint32 num_entries depth++; /* should depend on whether marshalling or unmarshalling! */ if(UNMARSHALLING(ps)) { - ctr->dfs.info1 = (DFS_INFO_1 *)prs_alloc_mem(ps, sizeof(DFS_INFO_1)*num_entries); + ctr->dfs.info1 = PRS_ALLOC_MEM(ps, DFS_INFO_1, num_entries); if (!ctr->dfs.info1) return False; } @@ -394,7 +394,7 @@ BOOL dfs_io_dfs_info_ctr(const char *desc, DFS_INFO_CTR* ctr, uint32 num_entries case 2: depth++; if(UNMARSHALLING(ps)) { - ctr->dfs.info2 = (DFS_INFO_2 *)prs_alloc_mem(ps, num_entries*sizeof(DFS_INFO_2)); + ctr->dfs.info2 = PRS_ALLOC_MEM(ps, DFS_INFO_2, num_entries); if (!ctr->dfs.info2) return False; } @@ -424,7 +424,7 @@ BOOL dfs_io_dfs_info_ctr(const char *desc, DFS_INFO_CTR* ctr, uint32 num_entries case 3: depth++; if(UNMARSHALLING(ps)) { - ctr->dfs.info3 = (DFS_INFO_3 *)prs_alloc_mem(ps, num_entries*sizeof(DFS_INFO_3)); + ctr->dfs.info3 = PRS_ALLOC_MEM(ps, DFS_INFO_3, num_entries); if (!ctr->dfs.info3) return False; } @@ -517,7 +517,7 @@ BOOL dfs_io_dfs_storage_info(const char *desc, DFS_INFO_3* info3, prs_struct *ps depth++; if(UNMARSHALLING(ps)) { - info3->storages = (DFS_STORAGE_INFO *)prs_alloc_mem(ps, info3->num_storage_infos*sizeof(DFS_STORAGE_INFO)); + info3->storages = PRS_ALLOC_MEM(ps, DFS_STORAGE_INFO, info3->num_storage_infos); if (!info3->storages) return False; } diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index 070f6be43a..9155419ae4 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -29,7 +29,7 @@ static BOOL ds_io_dominfobasic( const char *desc, prs_struct *ps, int depth, DSR DSROLE_PRIMARY_DOMAIN_INFO_BASIC *p = *basic; if ( UNMARSHALLING(ps) ) - p = *basic = (DSROLE_PRIMARY_DOMAIN_INFO_BASIC *)prs_alloc_mem(ps, sizeof(DSROLE_PRIMARY_DOMAIN_INFO_BASIC)); + p = *basic = PRS_ALLOC_MEM(ps, DSROLE_PRIMARY_DOMAIN_INFO_BASIC, 1); if ( !p ) return False; @@ -208,7 +208,7 @@ static BOOL ds_io_dom_trusts_ctr( const char *desc, prs_struct *ps, int depth, D /* allocate the domain trusts array are parse it */ - ctr->trusts = (DS_DOMAIN_TRUSTS*)talloc(ps->mem_ctx, sizeof(DS_DOMAIN_TRUSTS)*ctr->max_count); + ctr->trusts = TALLOC_ARRAY(ps->mem_ctx, DS_DOMAIN_TRUSTS, ctr->max_count); if ( !ctr->trusts ) return False; diff --git a/source3/rpc_parse/parse_echo.c b/source3/rpc_parse/parse_echo.c index 4b1ff1f4d5..b4aa8de24a 100644 --- a/source3/rpc_parse/parse_echo.c +++ b/source3/rpc_parse/parse_echo.c @@ -67,7 +67,7 @@ BOOL echo_io_q_echo_data(const char *desc, ECHO_Q_ECHO_DATA *q_d, return False; if (UNMARSHALLING(ps)) { - q_d->data = prs_alloc_mem(ps, q_d->size); + q_d->data = PRS_ALLOC_MEM(ps, char, q_d->size); if (!q_d->data) return False; @@ -86,7 +86,7 @@ BOOL echo_io_r_echo_data(const char *desc, ECHO_R_ECHO_DATA *q_d, return False; if (UNMARSHALLING(ps)) { - q_d->data = prs_alloc_mem(ps, q_d->size); + q_d->data = PRS_ALLOC_MEM(ps, char, q_d->size); if (!q_d->data) return False; @@ -114,7 +114,7 @@ BOOL echo_io_q_sink_data(const char *desc, ECHO_Q_SINK_DATA *q_d, return False; if (UNMARSHALLING(ps)) { - q_d->data = prs_alloc_mem(ps, q_d->size); + q_d->data = PRS_ALLOC_MEM(ps, char, q_d->size); if (!q_d->data) return False; @@ -153,7 +153,7 @@ BOOL echo_io_r_source_data(const char *desc, ECHO_R_SOURCE_DATA *q_d, return False; if (UNMARSHALLING(ps)) { - q_d->data = prs_alloc_mem(ps, q_d->size); + q_d->data = PRS_ALLOC_MEM(ps, char, q_d->size); if (!q_d->data) return False; diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 5fff1fea37..e2cb94c8fe 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -251,7 +251,7 @@ static BOOL lsa_io_obj_attr(const char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps if (attr->ptr_sec_qos != 0) { if (UNMARSHALLING(ps)) - if (!(attr->sec_qos = (LSA_SEC_QOS *)prs_alloc_mem(ps,sizeof(LSA_SEC_QOS)))) + 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)) @@ -540,17 +540,17 @@ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 en * allocating empty arrays of unicode headers, strings * and sids of enumerated trusted domains */ - if (!(r_e->hdr_domain_name = (UNIHDR2 *)talloc(ctx,sizeof(UNIHDR2) * num_domains))) { + if (!(r_e->hdr_domain_name = TALLOC_ARRAY(ctx,UNIHDR2,num_domains))) { r_e->status = NT_STATUS_NO_MEMORY; return; } - if (!(r_e->uni_domain_name = (UNISTR2 *)talloc(ctx,sizeof(UNISTR2) * num_domains))) { + if (!(r_e->uni_domain_name = TALLOC_ARRAY(ctx,UNISTR2,num_domains))) { r_e->status = NT_STATUS_NO_MEMORY; return; } - if (!(r_e->domain_sid = (DOM_SID2 *)talloc(ctx,sizeof(DOM_SID2) * num_domains))) { + if (!(r_e->domain_sid = TALLOC_ARRAY(ctx,DOM_SID2,num_domains))) { r_e->status = NT_STATUS_NO_MEMORY; return; } @@ -596,13 +596,13 @@ BOOL lsa_io_r_enum_trust_dom(const char *desc, LSA_R_ENUM_TRUST_DOM *r_e, num_domains = r_e->num_domains2; if (UNMARSHALLING(ps)) { - if (!(r_e->hdr_domain_name = (UNIHDR2 *)prs_alloc_mem(ps,sizeof(UNIHDR2) * num_domains))) + if (!(r_e->hdr_domain_name = PRS_ALLOC_MEM(ps,UNIHDR2,num_domains))) return False; - if (!(r_e->uni_domain_name = (UNISTR2 *)prs_alloc_mem(ps,sizeof(UNISTR2) * num_domains))) + if (!(r_e->uni_domain_name = PRS_ALLOC_MEM(ps,UNISTR2,num_domains))) return False; - if (!(r_e->domain_sid = (DOM_SID2 *)prs_alloc_mem(ps,sizeof(DOM_SID2) * num_domains))) + if (!(r_e->domain_sid = PRS_ALLOC_MEM(ps,DOM_SID2,num_domains))) return False; } @@ -697,7 +697,7 @@ static BOOL lsa_io_dom_query_2(const char *desc, DOM_QUERY_2 *d_q, prs_struct *p return False; if (UNMARSHALLING(ps)) { - d_q->auditsettings = (uint32 *)talloc_zero(ps->mem_ctx, d_q->count2 * sizeof(uint32)); + d_q->auditsettings = TALLOC_ZERO_ARRAY(ps->mem_ctx, uint32, d_q->count2); } if (d_q->auditsettings == NULL) { @@ -818,14 +818,12 @@ static void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, if (num_entries == 0) return; - if ((sen->ptr_sid = (uint32 *)talloc_zero(mem_ctx, num_entries * - sizeof(uint32))) == NULL) { + 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 = (DOM_SID2 *)talloc_zero(mem_ctx, num_entries * - sizeof(DOM_SID2))) == NULL) { + 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; } @@ -872,15 +870,13 @@ static BOOL lsa_io_sid_enum(const char *desc, LSA_SID_ENUM *sen, prs_struct *ps, /* Mallocate memory if we're unpacking from the wire */ if (UNMARSHALLING(ps)) { - if ((sen->ptr_sid = (uint32 *)prs_alloc_mem( ps, - sen->num_entries * sizeof(uint32))) == NULL) { + 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 = (DOM_SID2 *)prs_alloc_mem( ps, - sen->num_entries * sizeof(DOM_SID2))) == NULL) { + 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; @@ -980,15 +976,11 @@ static BOOL lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, return False; if (UNMARSHALLING(ps)) { - if ((trn->name = (LSA_TRANS_NAME *) - prs_alloc_mem(ps, trn->num_entries * - sizeof(LSA_TRANS_NAME))) == NULL) { + if ((trn->name = PRS_ALLOC_MEM(ps, LSA_TRANS_NAME, trn->num_entries)) == NULL) { return False; } - if ((trn->uni_name = (UNISTR2 *) - prs_alloc_mem(ps, trn->num_entries * - sizeof(UNISTR2))) == NULL) { + if ((trn->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, trn->num_entries)) == NULL) { return False; } } @@ -1068,14 +1060,12 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, q_l->num_entries2 = num_names; q_l->lookup_level = 1; - if ((q_l->uni_name = (UNISTR2 *)talloc_zero( - mem_ctx, num_names * sizeof(UNISTR2))) == NULL) { + 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 = (UNIHDR *)talloc_zero( - mem_ctx, num_names * sizeof(UNIHDR))) == NULL) { + 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; } @@ -1113,11 +1103,9 @@ BOOL lsa_io_q_lookup_names(const char *desc, LSA_Q_LOOKUP_NAMES *q_r, if (UNMARSHALLING(ps)) { if (q_r->num_entries) { - if ((q_r->hdr_name = (UNIHDR *)prs_alloc_mem(ps, - q_r->num_entries * sizeof(UNIHDR))) == NULL) + if ((q_r->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, q_r->num_entries)) == NULL) return False; - if ((q_r->uni_name = (UNISTR2 *)prs_alloc_mem(ps, - q_r->num_entries * sizeof(UNISTR2))) == NULL) + if ((q_r->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, q_r->num_entries)) == NULL) return False; } } @@ -1187,7 +1175,7 @@ BOOL lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *r_r, } if (UNMARSHALLING(ps)) { - if ((r_r->dom_rid = (DOM_RID2 *)prs_alloc_mem(ps, r_r->num_entries2 * sizeof(DOM_RID2))) + if ((r_r->dom_rid = PRS_ALLOC_MEM(ps, DOM_RID2, r_r->num_entries2)) == NULL) { DEBUG(3, ("lsa_io_r_lookup_names(): out of memory\n")); return False; @@ -1409,7 +1397,7 @@ BOOL lsa_io_r_enum_privs(const char *desc, LSA_R_ENUM_PRIVS *r_q, prs_struct *ps return False; if (UNMARSHALLING(ps)) - if (!(r_q->privs = (LSA_PRIV_ENTRY *)prs_alloc_mem(ps, sizeof(LSA_PRIV_ENTRY) * r_q->count1))) + if (!(r_q->privs = PRS_ALLOC_MEM(ps, LSA_PRIV_ENTRY, r_q->count1))) return False; if (!lsa_io_priv_entries("", r_q->privs, r_q->count1, ps, depth)) @@ -1852,7 +1840,7 @@ BOOL lsa_io_r_enum_privsaccount(const char *desc, LSA_R_ENUMPRIVSACCOUNT *r_c, p if (!NT_STATUS_IS_OK(init_priv_with_ctx(ps->mem_ctx, &(r_c->set)))) return False; - if (!(r_c->set->set = (LUID_ATTR *)prs_alloc_mem(ps,sizeof(LUID_ATTR) * r_c->count))) + if (!(r_c->set->set = PRS_ALLOC_MEM(ps,LUID_ATTR,r_c->count))) return False; } @@ -2022,7 +2010,7 @@ BOOL lsa_io_q_addprivs(const char *desc, LSA_Q_ADDPRIVS *r_c, prs_struct *ps, in if (!NT_STATUS_IS_OK(init_priv_with_ctx(ps->mem_ctx, &(r_c->set)))) return False; - if (!(r_c->set->set = (LUID_ATTR *)prs_alloc_mem(ps, sizeof(LUID_ATTR) * r_c->count))) + if (!(r_c->set->set = PRS_ALLOC_MEM(ps, LUID_ATTR, r_c->count))) return False; } @@ -2084,7 +2072,7 @@ BOOL lsa_io_q_removeprivs(const char *desc, LSA_Q_REMOVEPRIVS *r_c, prs_struct * if (!NT_STATUS_IS_OK(init_priv_with_ctx(ps->mem_ctx, &(r_c->set)))) return False; - if (!(r_c->set->set = (LUID_ATTR *)prs_alloc_mem(ps, sizeof(LUID_ATTR) * r_c->count))) + if (!(r_c->set->set = PRS_ALLOC_MEM(ps, LUID_ATTR, r_c->count))) return False; } diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index c6f05df0c4..17a8f624ae 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -552,18 +552,14 @@ void init_unistr(UNISTR *str, const char *buf) return; } - len = strlen(buf) + 1; + len = MAX(len,MAX_UNISTRLEN); - if (len < MAX_UNISTRLEN) - len = MAX_UNISTRLEN; - len *= sizeof(uint16); - - str->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len); + str->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, len); if (str->buffer == NULL) smb_panic("init_unistr: malloc fail\n"); - rpcstr_push(str->buffer, buf, len, STR_TERMINATE); + rpcstr_push(str->buffer, buf, len*sizeof(uint16), STR_TERMINATE); } /******************************************************************* @@ -591,10 +587,9 @@ BOOL smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth) static void create_buffer3(BUFFER3 *str, size_t len) { - if (len < MAX_BUFFERLEN) - len = MAX_BUFFERLEN; + len = MAX(len,MAX_BUFFERLEN); - str->buffer = talloc_zero(get_talloc_ctx(), len); + str->buffer = TALLOC_ZERO(get_talloc_ctx(), len); if (str->buffer == NULL) smb_panic("create_buffer3: talloc fail\n"); @@ -683,7 +678,7 @@ BOOL smb_io_buffer3(const char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) return False; if (UNMARSHALLING(ps)) { - buf3->buffer = (unsigned char *)prs_alloc_mem(ps, buf3->buf_max_len); + buf3->buffer = PRS_ALLOC_MEM(ps, unsigned char, buf3->buf_max_len); if (buf3->buffer == NULL) return False; } @@ -735,9 +730,8 @@ void init_buffer2(BUFFER2 *str, const uint8 *buf, size_t len) str->buf_len = buf != NULL ? len : 0; if (buf != NULL) { - if (len < MAX_BUFFERLEN) - len = MAX_BUFFERLEN; - str->buffer = talloc_zero(get_talloc_ctx(), len); + len = MAX(len,MAX_BUFFERLEN); + str->buffer = TALLOC_ZERO(get_talloc_ctx(), len); if (str->buffer == NULL) smb_panic("init_buffer2: talloc fail\n"); memcpy(str->buffer, buf, MIN(str->buf_len, len)); @@ -819,14 +813,9 @@ void copy_unistr2(UNISTR2 *str, const UNISTR2 *from) (the the length of the source string) to prevent reallocation of memory. */ if (str->buffer == NULL) { - size_t len = from->uni_max_len * sizeof(uint16); - - if (len < MAX_UNISTRLEN) - len = MAX_UNISTRLEN; - len *= sizeof(uint16); - - str->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len); - if ((str->buffer == NULL) && (len > 0 )) { + size_t alloc_len = MAX(from->uni_max_len,MAX_UNISTRLEN); + str->buffer = (uint16 *)TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, alloc_len); + if ((str->buffer == NULL)) { smb_panic("copy_unistr2: talloc fail\n"); return; } @@ -842,8 +831,6 @@ void copy_unistr2(UNISTR2 *str, const UNISTR2 *from) void init_string2(STRING2 *str, const char *buf, int max_len, int str_len) { - int alloc_len = 0; - /* set up string lengths. */ str->str_max_len = max_len; str->offset = 0; @@ -851,9 +838,8 @@ void init_string2(STRING2 *str, const char *buf, int max_len, int str_len) /* store the string */ if(str_len != 0) { - if (str_len < MAX_STRINGLEN) - alloc_len = MAX_STRINGLEN; - str->buffer = talloc_zero(get_talloc_ctx(), alloc_len); + int alloc_len = MAX(str_len, MAX_STRINGLEN); + str->buffer = TALLOC_ZERO(get_talloc_ctx(), alloc_len); if (str->buffer == NULL) smb_panic("init_string2: malloc fail\n"); memcpy(str->buffer, buf, str_len); @@ -917,16 +903,17 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) len = strlen(buf) + 1; } - if (len < MAX_UNISTRLEN) - len = MAX_UNISTRLEN; - len *= sizeof(uint16); + len = MAX(len,MAX_UNISTRLEN); - str->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len); - if ((str->buffer == NULL) && (len > 0)) { + str->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, len); + if (str->buffer == NULL) { smb_panic("init_unistr2: malloc fail\n"); return; } + /* Ensure len is the length in *bytes* */ + len *= sizeof(uint16); + /* * The UNISTR2 must be initialized !!! * jfm, 7/7/2001. @@ -956,7 +943,6 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) { uint32 len = strlen_w(buf); - uint32 max_len = len; uint32 alloc_len; ZERO_STRUCTP(str); @@ -966,13 +952,10 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) str->offset = 0; str->uni_str_len = len; - if (max_len < MAX_UNISTRLEN) - max_len = MAX_UNISTRLEN; + alloc_len = MAX((len + 1), MAX_UNISTRLEN); - alloc_len = (max_len + 1) * sizeof(uint16); - - str->buffer = (uint16 *)talloc_zero(ctx, alloc_len); - if ((str->buffer == NULL) && (alloc_len > 0)) { + str->buffer = TALLOC_ZERO_ARRAY(ctx, uint16, alloc_len); + if (str->buffer == NULL) { smb_panic("init_unistr2_w: malloc fail\n"); return; } @@ -1021,10 +1004,10 @@ void init_unistr2_from_unistr(UNISTR2 *to, const UNISTR *from) to->uni_str_len = i; /* allocate the space and copy the string buffer */ - to->buffer = (uint16 *)talloc_zero(get_talloc_ctx(), sizeof(uint16)*(to->uni_str_len)); + to->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, i); if (to->buffer == NULL) smb_panic("init_unistr2_from_unistr: malloc fail\n"); - memcpy(to->buffer, from->buffer, to->uni_max_len*sizeof(uint16)); + memcpy(to->buffer, from->buffer, i*sizeof(uint16)); return; } @@ -1111,7 +1094,7 @@ BOOL init_unistr2_array(UNISTR2_ARRAY *array, return True; } - array->strings = (UNISTR2_ARRAY_EL *)talloc_zero(get_talloc_ctx(), count * sizeof(UNISTR2_ARRAY_EL)); + array->strings = TALLOC_ZERO_ARRAY(get_talloc_ctx(), UNISTR2_ARRAY_EL, count ); if (!array->strings) { return False; } @@ -1151,7 +1134,7 @@ BOOL smb_io_unistr2_array(const char *desc, UNISTR2_ARRAY *array, prs_struct *ps } if (UNMARSHALLING(ps)) { - array->strings = talloc_zero(get_talloc_ctx(), array->count * sizeof(array->strings[0])); + array->strings = TALLOC_ZERO_ARRAY(get_talloc_ctx(), UNISTR2_ARRAY_EL, array->count ); } if (! array->strings) { return False; @@ -1637,7 +1620,7 @@ BOOL smb_io_pol_hnd(const char *desc, POLICY_HND *pol, prs_struct *ps, int depth void init_unistr3(UNISTR3 *str, const char *buf) { - size_t len; + size_t len, alloc_len; if (buf == NULL) { str->uni_str_len=0; @@ -1649,16 +1632,13 @@ void init_unistr3(UNISTR3 *str, const char *buf) str->uni_str_len=len; - if (len < MAX_UNISTRLEN) - len = MAX_UNISTRLEN; - - len *= sizeof(uint16); + alloc_len = MAX(len, MAX_UNISTRLEN); - str->str.buffer = (uint16 *)talloc_zero(get_talloc_ctx(), len); + str->str.buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, alloc_len); if (str->str.buffer == NULL) smb_panic("init_unistr3: malloc fail\n"); - rpcstr_push((char *)str->str.buffer, buf, len, STR_TERMINATE); + rpcstr_push((char *)str->str.buffer, buf, len * sizeof(uint16), STR_TERMINATE); } /******************************************************************* diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 813316177a..97ca0d406b 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1019,7 +1019,7 @@ static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsi } /* Now allocate space for them. */ - *ppsids = (DOM_SID2 *)talloc_zero(ctx, count * sizeof(DOM_SID2)); + *ppsids = TALLOC_ZERO_ARRAY(ctx, DOM_SID2, count); if (*ppsids == NULL) return 0; @@ -1310,7 +1310,7 @@ static BOOL net_io_id_info_ctr(const char *desc, NET_ID_INFO_CTR **pp_ctr, prs_s depth++; if (UNMARSHALLING(ps)) { - ctr = *pp_ctr = (NET_ID_INFO_CTR *)prs_alloc_mem(ps, sizeof(NET_ID_INFO_CTR)); + ctr = *pp_ctr = PRS_ALLOC_MEM(ps, NET_ID_INFO_CTR, 1); if (ctr == NULL) return False; } @@ -1481,7 +1481,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, usr->num_groups2 = num_groups; - usr->gids = (DOM_GID *)talloc_zero(ctx,sizeof(DOM_GID) * (num_groups)); + usr->gids = TALLOC_ZERO_ARRAY(ctx,DOM_GID,num_groups); if (usr->gids == NULL && num_groups>0) return; @@ -1614,7 +1614,7 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, return False; if (UNMARSHALLING(ps) && usr->num_groups2 > 0) { - usr->gids = (DOM_GID *)prs_alloc_mem(ps, sizeof(DOM_GID)*usr->num_groups2); + usr->gids = PRS_ALLOC_MEM(ps, DOM_GID, usr->num_groups2); if (usr->gids == NULL) return False; } @@ -1635,7 +1635,7 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, if (usr->num_other_sids) { if (UNMARSHALLING(ps)) { - usr->other_sids = (DOM_SID2 *)prs_alloc_mem(ps, sizeof(DOM_SID2)*usr->num_other_sids); + usr->other_sids = PRS_ALLOC_MEM(ps, DOM_SID2, usr->num_other_sids); if (usr->other_sids == NULL) return False; } @@ -1644,7 +1644,7 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, return False; if (UNMARSHALLING(ps) && usr->num_other_groups > 0) { - usr->other_gids = (DOM_GID *)prs_alloc_mem(ps, sizeof(DOM_GID)*usr->num_other_groups); + usr->other_gids = PRS_ALLOC_MEM(ps, DOM_GID, usr->num_other_groups); if (usr->other_gids == NULL) return False; } @@ -2322,8 +2322,7 @@ static BOOL net_io_sam_group_mem_info(const char *desc, SAM_GROUP_MEM_INFO * inf return False; } - info->rids = talloc(ps->mem_ctx, sizeof(uint32) * - 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", @@ -2350,8 +2349,7 @@ static BOOL net_io_sam_group_mem_info(const char *desc, SAM_GROUP_MEM_INFO * inf return False; } - info->attribs = talloc(ps->mem_ctx, sizeof(uint32) * - 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", @@ -2438,8 +2436,7 @@ static BOOL net_io_sam_alias_mem_info(const char *desc, SAM_ALIAS_MEM_INFO * inf return False; } - info->ptr_sids = talloc(ps->mem_ctx, sizeof(uint32) * - 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", @@ -2454,8 +2451,7 @@ static BOOL net_io_sam_alias_mem_info(const char *desc, SAM_ALIAS_MEM_INFO * inf return False; } - info->sids = talloc(ps->mem_ctx, sizeof(DOM_SID2) * - 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", @@ -2772,7 +2768,7 @@ static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info, if(!prs_uint32("attribute_count", ps, depth, &info->attribute_count)) return False; - info->attributes = talloc(ps->mem_ctx, sizeof(uint32) * info->attribute_count); + info->attributes = TALLOC_ARRAY(ps->mem_ctx, uint32, info->attribute_count); for (i=0; iattribute_count; i++) if(!prs_uint32("attributes", ps, depth, &info->attributes[i])) @@ -2781,8 +2777,8 @@ static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info, if(!prs_uint32("privlist_count", ps, depth, &info->privlist_count)) return False; - info->hdr_privslist = talloc(ps->mem_ctx, sizeof(UNIHDR) * info->privlist_count); - info->uni_privslist = talloc(ps->mem_ctx, sizeof(UNISTR2) * 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); for (i=0; iprivlist_count; i++) if(!smb_io_unihdr("hdr_privslist", &info->hdr_privslist[i], ps, depth)) @@ -2914,10 +2910,7 @@ BOOL net_io_r_sam_sync(const char *desc, uint8 sess_key[16], } if (r_s->num_deltas2 > 0) { - r_s->hdr_deltas = (SAM_DELTA_HDR *) - talloc(ps->mem_ctx, r_s->num_deltas2 * - sizeof(SAM_DELTA_HDR)); - + 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", @@ -2935,10 +2928,7 @@ BOOL net_io_r_sam_sync(const char *desc, uint8 sess_key[16], } if (r_s->num_deltas2 > 0) { - r_s->deltas = (SAM_DELTA_CTR *) - talloc(ps->mem_ctx, r_s->num_deltas2 * - sizeof(SAM_DELTA_CTR)); - + 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", @@ -3050,9 +3040,7 @@ BOOL net_io_r_sam_deltas(const char *desc, uint8 sess_key[16], if (r_s->ptr_deltas != 0) { if (r_s->num_deltas > 0) { - r_s->hdr_deltas = (SAM_DELTA_HDR *) - talloc(ps->mem_ctx, r_s->num_deltas * - sizeof(SAM_DELTA_HDR)); + 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", @@ -3068,10 +3056,7 @@ BOOL net_io_r_sam_deltas(const char *desc, uint8 sess_key[16], } if (r_s->num_deltas > 0) { - r_s->deltas = (SAM_DELTA_CTR *) - talloc(ps->mem_ctx, r_s->num_deltas * - sizeof(SAM_DELTA_CTR)); - + 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", diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index c70011c648..67a9d96e19 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -105,7 +105,7 @@ BOOL prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, BOOL io) if (size != 0) { ps->buffer_size = size; - if((ps->data_p = (char *)malloc((size_t)size)) == NULL) { + if((ps->data_p = (char *)SMB_MALLOC((size_t)size)) == NULL) { DEBUG(0,("prs_init: malloc fail for %u bytes.\n", (unsigned int)size)); return False; } @@ -143,14 +143,21 @@ void prs_mem_clear(prs_struct *ps) Allocate memory when unmarshalling... Always zero clears. ********************************************************************/ -char *prs_alloc_mem(prs_struct *ps, size_t size) +#if defined(PARANOID_MALLOC_CHECKER) +char *prs_alloc_mem_(prs_struct *ps, size_t size, unsigned int count) +#else +char *prs_alloc_mem(prs_struct *ps, size_t size, unsigned int count) +#endif { char *ret = NULL; if (size) { - ret = talloc(ps->mem_ctx, size); - if (ret) - memset(ret, '\0', size); + /* We can't call the type-safe version here. */ +#if defined(PARANOID_MALLOC_CHECKER) + ret = talloc_zero_array_(ps->mem_ctx, size, count); +#else + ret = talloc_zero_array(ps->mem_ctx, size, count); +#endif } return ret; } @@ -199,7 +206,7 @@ BOOL prs_set_buffer_size(prs_struct *ps, uint32 newsize) return prs_force_grow(ps, newsize - ps->buffer_size); if (newsize < ps->buffer_size) { - char *new_data_p = Realloc(ps->data_p, newsize); + char *new_data_p = SMB_REALLOC(ps->data_p, newsize); /* if newsize is zero, Realloc acts like free() & returns NULL*/ if (new_data_p == NULL && newsize != 0) { DEBUG(0,("prs_set_buffer_size: Realloc failure for size %u.\n", @@ -253,7 +260,7 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) new_size = MAX(MAX_PDU_FRAG_LEN,extra_space); - if((new_data = malloc(new_size)) == NULL) { + if((new_data = SMB_MALLOC(new_size)) == NULL) { DEBUG(0,("prs_grow: Malloc failure for size %u.\n", (unsigned int)new_size)); return False; } @@ -265,7 +272,7 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) */ new_size = MAX(ps->buffer_size*2, ps->buffer_size + extra_space); - if ((new_data = Realloc(ps->data_p, new_size)) == NULL) { + if ((new_data = SMB_REALLOC(ps->data_p, new_size)) == NULL) { DEBUG(0,("prs_grow: Realloc failure for size %u.\n", (unsigned int)new_size)); return False; @@ -296,7 +303,7 @@ BOOL prs_force_grow(prs_struct *ps, uint32 extra_space) return False; } - if((new_data = Realloc(ps->data_p, new_size)) == NULL) { + if((new_data = SMB_REALLOC(ps->data_p, new_size)) == NULL) { DEBUG(0,("prs_force_grow: Realloc failure for size %u.\n", (unsigned int)new_size)); return False; @@ -886,7 +893,7 @@ BOOL prs_buffer5(BOOL charmode, const char *name, prs_struct *ps, int depth, BUF return False; if (UNMARSHALLING(ps)) { - str->buffer = (uint16 *)prs_alloc_mem(ps,str->buf_len * sizeof(uint16)); + str->buffer = PRS_ALLOC_MEM(ps,uint16,str->buf_len); if (str->buffer == NULL) return False; } @@ -918,7 +925,7 @@ BOOL prs_buffer2(BOOL charmode, const char *name, prs_struct *ps, int depth, BUF if (UNMARSHALLING(ps)) { if ( str->buf_len ) { - str->buffer = (uint16 *)prs_alloc_mem(ps,str->buf_len); + str->buffer = PRS_ALLOC_MEM(ps, uint16, str->buf_len); if ( str->buffer == NULL ) return False; } @@ -945,7 +952,7 @@ BOOL prs_string2(BOOL charmode, const char *name, prs_struct *ps, int depth, STR return False; if (UNMARSHALLING(ps)) { - str->buffer = (unsigned char *)prs_alloc_mem(ps,str->str_max_len); + str->buffer = PRS_ALLOC_MEM(ps,unsigned char, str->str_max_len); if (str->buffer == NULL) return False; } @@ -989,7 +996,7 @@ BOOL prs_unistr2(BOOL charmode, const char *name, prs_struct *ps, int depth, UNI return True; if (UNMARSHALLING(ps)) { - str->buffer = (uint16 *)prs_alloc_mem(ps,str->uni_max_len * sizeof(uint16)); + str->buffer = PRS_ALLOC_MEM(ps,uint16,str->uni_max_len); if (str->buffer == NULL) return False; } @@ -1016,7 +1023,7 @@ BOOL prs_unistr3(BOOL charmode, const char *name, UNISTR3 *str, prs_struct *ps, return False; if (UNMARSHALLING(ps)) { - str->str.buffer = (uint16 *)prs_alloc_mem(ps,str->uni_str_len * sizeof(uint16)); + str->str.buffer = PRS_ALLOC_MEM(ps,uint16,str->uni_str_len); if (str->str.buffer == NULL) return False; } @@ -1109,7 +1116,7 @@ BOOL prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) alloc_len += 1; /* should we allocate anything at all? */ - str->buffer = (uint16 *)prs_alloc_mem(ps,alloc_len * sizeof(uint16)); + str->buffer = PRS_ALLOC_MEM(ps,uint16,alloc_len); if ((str->buffer == NULL) && (alloc_len > 0)) return False; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ddae4bbdff..34f48b9ad7 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1401,8 +1401,8 @@ BOOL samr_io_r_enum_dom_users(const char *desc, SAMR_R_ENUM_DOM_USERS * r_u, return False; if (UNMARSHALLING(ps) && (r_u->num_entries2 != 0)) { - r_u->sam = (SAM_ENTRY *)prs_alloc_mem(ps,sizeof(SAM_ENTRY)*r_u->num_entries2); - r_u->uni_acct_name = (UNISTR2 *)prs_alloc_mem(ps,sizeof(UNISTR2)*r_u->num_entries2); + 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) { @@ -1506,11 +1506,11 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_en if (num_entries==0) return NT_STATUS_OK; - sam->sam=(SAM_ENTRY1 *)talloc(ctx, num_entries*sizeof(SAM_ENTRY1)); + sam->sam=TALLOC_ARRAY(ctx, SAM_ENTRY1, num_entries); if (!sam->sam) return NT_STATUS_NO_MEMORY; - sam->str=(SAM_STR1 *)talloc(ctx, num_entries*sizeof(SAM_STR1)); + sam->str=TALLOC_ARRAY(ctx, SAM_STR1, num_entries); if (!sam->str) return NT_STATUS_NO_MEMORY; @@ -1584,16 +1584,12 @@ static BOOL sam_io_sam_dispinfo_1(const char *desc, SAM_DISPINFO_1 * sam, if (UNMARSHALLING(ps) && num_entries > 0) { - if ((sam->sam = (SAM_ENTRY1 *) - prs_alloc_mem(ps, sizeof(SAM_ENTRY1) * - num_entries)) == NULL) { + 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 = (SAM_STR1 *) - prs_alloc_mem(ps, sizeof(SAM_STR1) * - num_entries)) == NULL) { + if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR1, num_entries)) == NULL) { DEBUG(0, ("out of memory allocating SAM_STR1\n")); return False; } @@ -1633,10 +1629,10 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_en if (num_entries==0) return NT_STATUS_OK; - if (!(sam->sam=(SAM_ENTRY2 *)talloc(ctx, num_entries*sizeof(SAM_ENTRY2)))) + if (!(sam->sam=TALLOC_ARRAY(ctx, SAM_ENTRY2, num_entries))) return NT_STATUS_NO_MEMORY; - if (!(sam->str=(SAM_STR2 *)talloc(ctx, num_entries*sizeof(SAM_STR2)))) + if (!(sam->str=TALLOC_ARRAY(ctx, SAM_STR2, num_entries))) return NT_STATUS_NO_MEMORY; ZERO_STRUCTP(sam->sam); @@ -1697,16 +1693,12 @@ static BOOL sam_io_sam_dispinfo_2(const char *desc, SAM_DISPINFO_2 * sam, if (UNMARSHALLING(ps) && num_entries > 0) { - if ((sam->sam = (SAM_ENTRY2 *) - prs_alloc_mem(ps, sizeof(SAM_ENTRY2) * - num_entries)) == NULL) { + 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 = (SAM_STR2 *) - prs_alloc_mem(ps, sizeof(SAM_STR2) * - num_entries)) == NULL) { + if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR2, num_entries)) == NULL) { DEBUG(0, ("out of memory allocating SAM_STR2\n")); return False; } @@ -1743,10 +1735,10 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_en if (num_entries==0) return NT_STATUS_OK; - if (!(sam->sam=(SAM_ENTRY3 *)talloc(ctx, num_entries*sizeof(SAM_ENTRY3)))) + if (!(sam->sam=TALLOC_ARRAY(ctx, SAM_ENTRY3, num_entries))) return NT_STATUS_NO_MEMORY; - if (!(sam->str=(SAM_STR3 *)talloc(ctx, num_entries*sizeof(SAM_STR3)))) + if (!(sam->str=TALLOC_ARRAY(ctx, SAM_STR3, num_entries))) return NT_STATUS_NO_MEMORY; ZERO_STRUCTP(sam->sam); @@ -1788,16 +1780,12 @@ static BOOL sam_io_sam_dispinfo_3(const char *desc, SAM_DISPINFO_3 * sam, if (UNMARSHALLING(ps) && num_entries > 0) { - if ((sam->sam = (SAM_ENTRY3 *) - prs_alloc_mem(ps, sizeof(SAM_ENTRY3) * - num_entries)) == NULL) { + 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 = (SAM_STR3 *) - prs_alloc_mem(ps, sizeof(SAM_STR3) * - num_entries)) == NULL) { + if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR3, num_entries)) == NULL) { DEBUG(0, ("out of memory allocating SAM_STR3\n")); return False; } @@ -1836,10 +1824,10 @@ NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 num_en if (num_entries==0) return NT_STATUS_OK; - if (!(sam->sam=(SAM_ENTRY4 *)talloc(ctx, num_entries*sizeof(SAM_ENTRY4)))) + if (!(sam->sam=TALLOC_ARRAY(ctx, SAM_ENTRY4, num_entries))) return NT_STATUS_NO_MEMORY; - if (!(sam->str=(SAM_STR4 *)talloc(ctx, num_entries*sizeof(SAM_STR4)))) + if (!(sam->str=TALLOC_ARRAY(ctx, SAM_STR4, num_entries))) return NT_STATUS_NO_MEMORY; ZERO_STRUCTP(sam->sam); @@ -1880,16 +1868,12 @@ static BOOL sam_io_sam_dispinfo_4(const char *desc, SAM_DISPINFO_4 * sam, if (UNMARSHALLING(ps) && num_entries > 0) { - if ((sam->sam = (SAM_ENTRY4 *) - prs_alloc_mem(ps, sizeof(SAM_ENTRY4) * - num_entries)) == NULL) { + 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 = (SAM_STR4 *) - prs_alloc_mem(ps, sizeof(SAM_STR4) * - num_entries)) == NULL) { + if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR4, num_entries)) == NULL) { DEBUG(0, ("out of memory allocating SAM_STR4\n")); return False; } @@ -1926,10 +1910,10 @@ NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 num_en if (num_entries==0) return NT_STATUS_OK; - if (!(sam->sam=(SAM_ENTRY5 *)talloc(ctx, num_entries*sizeof(SAM_ENTRY5)))) + if (!(sam->sam=TALLOC_ARRAY(ctx, SAM_ENTRY5, num_entries))) return NT_STATUS_NO_MEMORY; - if (!(sam->str=(SAM_STR5 *)talloc(ctx, num_entries*sizeof(SAM_STR5)))) + if (!(sam->str=TALLOC_ARRAY(ctx, SAM_STR5, num_entries))) return NT_STATUS_NO_MEMORY; ZERO_STRUCTP(sam->sam); @@ -1970,16 +1954,12 @@ static BOOL sam_io_sam_dispinfo_5(const char *desc, SAM_DISPINFO_5 * sam, if (UNMARSHALLING(ps) && num_entries > 0) { - if ((sam->sam = (SAM_ENTRY5 *) - prs_alloc_mem(ps, sizeof(SAM_ENTRY5) * - num_entries)) == NULL) { + 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 = (SAM_STR5 *) - prs_alloc_mem(ps, sizeof(SAM_STR5) * - num_entries)) == NULL) { + if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR5, num_entries)) == NULL) { DEBUG(0, ("out of memory allocating SAM_STR5\n")); return False; } @@ -2354,7 +2334,7 @@ static BOOL samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr, prs_struct *ps, int depth) { if (UNMARSHALLING(ps)) - *ctr = (GROUP_INFO_CTR *)prs_alloc_mem(ps,sizeof(GROUP_INFO_CTR)); + *ctr = PRS_ALLOC_MEM(ps,GROUP_INFO_CTR,1); if (*ctr == NULL) return False; @@ -2929,7 +2909,7 @@ BOOL samr_io_r_query_groupmem(const char *desc, SAMR_R_QUERY_GROUPMEM * r_u, if(!prs_uint32("num_rids", ps, depth, &r_u->num_rids)) return False; if (UNMARSHALLING(ps) && r_u->num_rids != 0) { - r_u->rid = (uint32 *)prs_alloc_mem(ps,sizeof(r_u->rid[0])*r_u->num_rids); + r_u->rid = PRS_ALLOC_MEM(ps,uint32,r_u->num_rids); if (r_u->rid == NULL) return False; } @@ -2945,7 +2925,7 @@ BOOL samr_io_r_query_groupmem(const char *desc, SAMR_R_QUERY_GROUPMEM * r_u, return False; if (UNMARSHALLING(ps) && r_u->num_attrs != 0) { - r_u->attr = (uint32 *)prs_alloc_mem(ps,sizeof(r_u->attr[0])*r_u->num_attrs); + r_u->attr = PRS_ALLOC_MEM(ps,uint32,r_u->num_attrs); if (r_u->attr == NULL) return False; } @@ -3046,7 +3026,7 @@ BOOL samr_io_gids(const char *desc, uint32 *num_gids, DOM_GID ** gid, if ((*num_gids) != 0) { if (UNMARSHALLING(ps)) { - (*gid) = (DOM_GID *)prs_alloc_mem(ps,sizeof(DOM_GID)*(*num_gids)); + (*gid) = PRS_ALLOC_MEM(ps,DOM_GID,*num_gids); } if ((*gid) == NULL) { @@ -3201,8 +3181,8 @@ BOOL samr_io_r_enum_domains(const char *desc, SAMR_R_ENUM_DOMAINS * r_u, return False; if (UNMARSHALLING(ps)) { - r_u->sam = (SAM_ENTRY *)prs_alloc_mem(ps,sizeof(SAM_ENTRY)*r_u->num_entries2); - r_u->uni_dom_name = (UNISTR2 *)prs_alloc_mem(ps,sizeof(UNISTR2)*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) { @@ -3340,8 +3320,8 @@ BOOL samr_io_r_enum_dom_groups(const char *desc, SAMR_R_ENUM_DOM_GROUPS * r_u, return False; if (UNMARSHALLING(ps)) { - r_u->sam = (SAM_ENTRY *)prs_alloc_mem(ps,sizeof(SAM_ENTRY)*r_u->num_entries2); - r_u->uni_grp_name = (UNISTR2 *)prs_alloc_mem(ps,sizeof(UNISTR2)*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) { @@ -3474,8 +3454,8 @@ BOOL samr_io_r_enum_dom_aliases(const char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u, return False; if (UNMARSHALLING(ps) && (r_u->num_entries2 > 0)) { - r_u->sam = (SAM_ENTRY *)prs_alloc_mem(ps,sizeof(SAM_ENTRY)*r_u->num_entries2); - r_u->uni_grp_name = (UNISTR2 *)prs_alloc_mem(ps,sizeof(UNISTR2)*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->num_entries2 != 0 && @@ -3832,11 +3812,11 @@ BOOL samr_io_q_query_useraliases(const char *desc, SAMR_Q_QUERY_USERALIASES * q_ return False; if (UNMARSHALLING(ps) && (q_u->num_sids2 != 0)) { - q_u->ptr_sid = (uint32 *)prs_alloc_mem(ps,sizeof(q_u->ptr_sid[0])*q_u->num_sids2); + q_u->ptr_sid = PRS_ALLOC_MEM(ps,uint32,q_u->num_sids2); if (q_u->ptr_sid == NULL) return False; - q_u->sid = (DOM_SID2 *)prs_alloc_mem(ps, sizeof(q_u->sid[0]) * q_u->num_sids2); + q_u->sid = PRS_ALLOC_MEM(ps, DOM_SID2, q_u->num_sids2); if (q_u->sid == NULL) return False; } @@ -3907,7 +3887,7 @@ BOOL samr_io_rids(const char *desc, uint32 *num_rids, uint32 **rid, if ((*num_rids) != 0) { if (UNMARSHALLING(ps)) { /* reading */ - (*rid) = (uint32 *)prs_alloc_mem(ps,sizeof(uint32)*(*num_rids)); + (*rid) = PRS_ALLOC_MEM(ps,uint32, *num_rids); } if ((*rid) == NULL) return False; @@ -4038,7 +4018,7 @@ void init_samr_q_lookup_rids(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_RIDS * q_u, q_u->flags = flags; q_u->ptr = 0; q_u->num_rids2 = num_rids; - q_u->rid = (uint32 *)talloc_zero(ctx, num_rids * sizeof(q_u->rid[0])); + q_u->rid = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids ); if (q_u->rid == NULL) { q_u->num_rids1 = 0; q_u->num_rids2 = 0; @@ -4082,7 +4062,7 @@ BOOL samr_io_q_lookup_rids(const char *desc, SAMR_Q_LOOKUP_RIDS * q_u, return False; if (UNMARSHALLING(ps) && (q_u->num_rids2 != 0)) { - q_u->rid = (uint32 *)prs_alloc_mem(ps, sizeof(q_u->rid[0])*q_u->num_rids2); + q_u->rid = PRS_ALLOC_MEM(ps, uint32, q_u->num_rids2); if (q_u->rid == NULL) return False; } @@ -4163,11 +4143,11 @@ BOOL samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u, if (UNMARSHALLING(ps) && (r_u->num_names2 != 0)) { - r_u->hdr_name = (UNIHDR *) prs_alloc_mem(ps, r_u->num_names2 * sizeof(r_u->hdr_name[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 = (UNISTR2 *)prs_alloc_mem(ps, r_u->num_names2 * sizeof(r_u->uni_name[0])); + r_u->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, r_u->num_names2); if (r_u->uni_name == NULL) return False; } @@ -4198,7 +4178,7 @@ BOOL samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u, return False; if (UNMARSHALLING(ps) && (r_u->num_types2 != 0)) { - r_u->type = (uint32 *)prs_alloc_mem(ps, r_u->num_types2 * sizeof(r_u->type[0])); + r_u->type = PRS_ALLOC_MEM(ps, uint32, r_u->num_types2); if (r_u->type == NULL) return False; } @@ -4624,7 +4604,7 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1)) return False; - ptr_sid = talloc(ps->mem_ctx, sizeof(uint32) * r_u->num_sids1); + ptr_sid = TALLOC_ARRAY(ps->mem_ctx, uint32, r_u->num_sids1); if (!ptr_sid) { return False; } @@ -4636,7 +4616,7 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, } if (UNMARSHALLING(ps)) { - r_u->sid = talloc(ps->mem_ctx, r_u->num_sids1 * sizeof(DOM_SID2)); + r_u->sid = TALLOC_ARRAY(ps->mem_ctx, DOM_SID2, r_u->num_sids1); } for (i = 0; i < r_u->num_sids1; i++) { @@ -4674,10 +4654,10 @@ NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, q_u->ptr = 0; q_u->num_names2 = num_names; - if (!(q_u->hdr_name = (UNIHDR *)talloc_zero(ctx, num_names * sizeof(UNIHDR)))) + if (!(q_u->hdr_name = TALLOC_ZERO_ARRAY(ctx, UNIHDR, num_names))) return NT_STATUS_NO_MEMORY; - if (!(q_u->uni_name = (UNISTR2 *)talloc_zero(ctx, num_names * sizeof(UNISTR2)))) + if (!(q_u->uni_name = TALLOC_ZERO_ARRAY(ctx, UNISTR2, num_names))) return NT_STATUS_NO_MEMORY; for (i = 0; i < num_names; i++) { @@ -4722,10 +4702,8 @@ BOOL samr_io_q_lookup_names(const char *desc, SAMR_Q_LOOKUP_NAMES * q_u, return False; if (UNMARSHALLING(ps) && (q_u->num_names2 != 0)) { - q_u->hdr_name = (UNIHDR *)prs_alloc_mem(ps, sizeof(UNIHDR) * - q_u->num_names2); - q_u->uni_name = (UNISTR2 *)prs_alloc_mem(ps, sizeof(UNISTR2) * - q_u->num_names2); + 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; } @@ -4765,9 +4743,9 @@ NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, r_u->ptr_rids = 1; r_u->num_rids2 = num_rids; - if (!(r_u->rids = (uint32 *)talloc_zero(ctx, sizeof(uint32)*num_rids))) + if (!(r_u->rids = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids))) return NT_STATUS_NO_MEMORY; - if (!(r_u->types = (uint32 *)talloc_zero(ctx, sizeof(uint32)*num_rids))) + if (!(r_u->types = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids))) return NT_STATUS_NO_MEMORY; if (!r_u->rids || !r_u->types) @@ -4834,7 +4812,7 @@ BOOL samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u, } if (UNMARSHALLING(ps)) - r_u->rids = (uint32 *)prs_alloc_mem(ps, sizeof(uint32)*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")); @@ -4863,7 +4841,7 @@ BOOL samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u, } if (UNMARSHALLING(ps)) - r_u->types = (uint32 *)prs_alloc_mem(ps, sizeof(uint32)*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")); @@ -6282,7 +6260,7 @@ NTSTATUS make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr, switch (switch_value) { case 0x10: - ctr->info.id10 = (SAM_USER_INFO_10 *)talloc_zero(ctx,sizeof(SAM_USER_INFO_10)); + ctr->info.id10 = TALLOC_ZERO_P(ctx,SAM_USER_INFO_10); if (ctr->info.id10 == NULL) return NT_STATUS_NO_MEMORY; @@ -6298,7 +6276,7 @@ NTSTATUS make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr, expire.low = 0xffffffff; expire.high = 0x7fffffff; - ctr->info.id = (SAM_USER_INFO_11 *) talloc_zero(ctx,sizeof(*ctr->info.id11)); + ctr->info.id = TALLOC_ZERO_P(ctx,SAM_USER_INFO_11); init_sam_user_info11(ctr->info.id11, &expire, "BROOKFIELDS$", /* name */ 0x03ef, /* user rid */ @@ -6309,7 +6287,7 @@ NTSTATUS make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr, } #endif case 0x12: - ctr->info.id12 = (SAM_USER_INFO_12 *)talloc_zero(ctx,sizeof(SAM_USER_INFO_12)); + ctr->info.id12 = TALLOC_ZERO_P(ctx,SAM_USER_INFO_12); if (ctr->info.id12 == NULL) return NT_STATUS_NO_MEMORY; @@ -6318,7 +6296,7 @@ NTSTATUS make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr, case 21: { SAM_USER_INFO_21 *cusr; - cusr = (SAM_USER_INFO_21 *)talloc_zero(ctx,sizeof(SAM_USER_INFO_21)); + cusr = TALLOC_ZERO_P(ctx,SAM_USER_INFO_21); ctr->info.id21 = cusr; if (ctr->info.id21 == NULL) return NT_STATUS_NO_MEMORY; @@ -6377,7 +6355,7 @@ static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, depth++; if (UNMARSHALLING(ps)) { - ctr = (SAM_USERINFO_CTR *)prs_alloc_mem(ps,sizeof(SAM_USERINFO_CTR)); + ctr = PRS_ALLOC_MEM(ps,SAM_USERINFO_CTR,1); if (ctr == NULL) return False; *ppctr = ctr; @@ -6397,7 +6375,7 @@ static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, switch (ctr->switch_value) { case 0x10: if (UNMARSHALLING(ps)) - ctr->info.id10 = (SAM_USER_INFO_10 *)prs_alloc_mem(ps,sizeof(SAM_USER_INFO_10)); + ctr->info.id10 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_10,1); if (ctr->info.id10 == NULL) { DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n")); return False; @@ -6406,7 +6384,7 @@ static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, break; case 0x11: if (UNMARSHALLING(ps)) - ctr->info.id11 = (SAM_USER_INFO_11 *)prs_alloc_mem(ps,sizeof(SAM_USER_INFO_11)); + ctr->info.id11 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_11,1); if (ctr->info.id11 == NULL) { DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n")); @@ -6416,7 +6394,7 @@ static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, break; case 0x12: if (UNMARSHALLING(ps)) - ctr->info.id12 = (SAM_USER_INFO_12 *)prs_alloc_mem(ps,sizeof(SAM_USER_INFO_12)); + ctr->info.id12 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_12,1); if (ctr->info.id12 == NULL) { DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n")); @@ -6426,7 +6404,7 @@ static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, break; case 20: if (UNMARSHALLING(ps)) - ctr->info.id20 = (SAM_USER_INFO_20 *)prs_alloc_mem(ps,sizeof(SAM_USER_INFO_20)); + 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")); @@ -6436,7 +6414,7 @@ static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, break; case 21: if (UNMARSHALLING(ps)) - ctr->info.id21 = (SAM_USER_INFO_21 *)prs_alloc_mem(ps,sizeof(SAM_USER_INFO_21)); + 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")); @@ -6446,7 +6424,7 @@ static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, break; case 23: if (UNMARSHALLING(ps)) - ctr->info.id23 = (SAM_USER_INFO_23 *)prs_alloc_mem(ps,sizeof(SAM_USER_INFO_23)); + 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")); @@ -6456,7 +6434,7 @@ static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, break; case 24: if (UNMARSHALLING(ps)) - ctr->info.id24 = (SAM_USER_INFO_24 *)prs_alloc_mem(ps,sizeof(SAM_USER_INFO_24)); + 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")); @@ -6466,7 +6444,7 @@ static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, break; case 25: if (UNMARSHALLING(ps)) - ctr->info.id25 = (SAM_USER_INFO_25 *)prs_alloc_mem(ps,sizeof(SAM_USER_INFO_25)); + 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")); @@ -7356,7 +7334,7 @@ BOOL samr_io_q_set_domain_info(const char *desc, SAMR_Q_SET_DOMAIN_INFO *q_u, if(!prs_align(ps)) return False; - if ((q_u->ctr = (SAM_UNK_CTR *)prs_alloc_mem(ps, sizeof(SAM_UNK_CTR))) == NULL) + if ((q_u->ctr = PRS_ALLOC_MEM(ps, SAM_UNK_CTR, 1)) == NULL) return False; switch (q_u->switch_value) { diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index a78627650a..8656b8f5d8 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -129,7 +129,7 @@ BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) /* * This is a read and we must allocate the stuct to read into. */ - if((psa = (SEC_ACL *)prs_alloc_mem(ps, sizeof(SEC_ACL))) == NULL) + if((psa = PRS_ALLOC_MEM(ps, SEC_ACL, 1)) == NULL) return False; *ppsa = psa; } @@ -154,7 +154,7 @@ BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) * between a non-present DACL (allow all access) and a DACL with no ACE's * (allow no access). */ - if((psa->ace = (SEC_ACE *)prs_alloc_mem(ps,sizeof(psa->ace[0]) * (psa->num_aces+1))) == NULL) + if((psa->ace = PRS_ALLOC_MEM(ps, SEC_ACE, psa->num_aces+1)) == NULL) return False; } @@ -191,7 +191,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if (psd == NULL) { if(UNMARSHALLING(ps)) { - if((psd = (SEC_DESC *)prs_alloc_mem(ps,sizeof(SEC_DESC))) == NULL) + if((psd = PRS_ALLOC_MEM(ps,SEC_DESC,1)) == NULL) return False; *ppsd = psd; } else { @@ -244,7 +244,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if (UNMARSHALLING(ps)) { /* reading */ - if((psd->owner_sid = (DOM_SID *)prs_alloc_mem(ps,sizeof(*psd->owner_sid))) == NULL) + if((psd->owner_sid = PRS_ALLOC_MEM(ps,DOM_SID,1)) == NULL) return False; } @@ -265,7 +265,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if (UNMARSHALLING(ps)) { /* reading */ - if((psd->grp_sid = (DOM_SID *)prs_alloc_mem(ps,sizeof(*psd->grp_sid))) == NULL) + if((psd->grp_sid = PRS_ALLOC_MEM(ps,DOM_SID,1)) == NULL) return False; } @@ -324,7 +324,7 @@ BOOL sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int psdb = *ppsdb; if (UNMARSHALLING(ps) && psdb == NULL) { - if((psdb = (SEC_DESC_BUF *)prs_alloc_mem(ps,sizeof(SEC_DESC_BUF))) == NULL) + if((psdb = PRS_ALLOC_MEM(ps,SEC_DESC_BUF,1)) == NULL) return False; *ppsdb = psdb; } diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 6362dcf0f1..2e5244d653 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -269,7 +269,7 @@ static BOOL smb_io_notify_option_type_ctr(const char *desc, SPOOL_NOTIFY_OPTION_ /* reading */ if (UNMARSHALLING(ps)) - if((ctr->type=(SPOOL_NOTIFY_OPTION_TYPE *)prs_alloc_mem(ps,ctr->count*sizeof(SPOOL_NOTIFY_OPTION_TYPE))) == NULL) + if((ctr->type=PRS_ALLOC_MEM(ps,SPOOL_NOTIFY_OPTION_TYPE,ctr->count)) == NULL) return False; /* the option type struct */ @@ -421,20 +421,20 @@ BOOL smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *da case NOTIFY_STRING: - if (UNMARSHALLING(ps)) { - data->notify_data.data.string = - (uint16 *)prs_alloc_mem(ps, data->notify_data.data.length); - - if (!data->notify_data.data.string) - return False; - } - if (MARSHALLING(ps)) data->notify_data.data.length /= 2; if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length)) return False; + if (UNMARSHALLING(ps)) { + data->notify_data.data.string = PRS_ALLOC_MEM(ps, uint16, + data->notify_data.data.length); + + if (!data->notify_data.data.string) + return False; + } + if (!prs_uint16uni(True, "string", ps, depth, data->notify_data.data.string, data->notify_data.data.length)) return False; @@ -447,8 +447,8 @@ BOOL smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *da case NOTIFY_POINTER: if (UNMARSHALLING(ps)) { - data->notify_data.data.string = - (uint16 *)prs_alloc_mem(ps, data->notify_data.data.length); + data->notify_data.data.string = PRS_ALLOC_MEM(ps, uint16, + data->notify_data.data.length); if (!data->notify_data.data.string) return False; @@ -506,7 +506,7 @@ BOOL smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *da /* Tallocate memory for string */ - data->notify_data.data.string = (uint16 *)prs_alloc_mem(ps, x * 2); + data->notify_data.data.string = PRS_ALLOC_MEM(ps, uint16, x * 2); if (!data->notify_data.data.string) return False; @@ -679,7 +679,7 @@ BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE depth++; if (UNMARSHALLING(ps)) { - devmode->devicename.buffer = (uint16 *)prs_alloc_mem(ps, 32 * sizeof(uint16) ); + devmode->devicename.buffer = PRS_ALLOC_MEM(ps, uint16, 32); if (devmode->devicename.buffer == NULL) return False; } @@ -745,7 +745,7 @@ BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE return False; if (UNMARSHALLING(ps)) { - devmode->formname.buffer = (uint16 *)prs_alloc_mem(ps, 32 * sizeof(uint16) ); + devmode->formname.buffer = PRS_ALLOC_MEM(ps, uint16, 32); if (devmode->formname.buffer == NULL) return False; } @@ -810,7 +810,7 @@ BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE if (devmode->driverextra!=0) { if (UNMARSHALLING(ps)) { - devmode->private=(uint8 *)prs_alloc_mem(ps, devmode->driverextra*sizeof(uint8)); + devmode->private=PRS_ALLOC_MEM(ps, uint8, devmode->driverextra); if(devmode->private == NULL) return False; DEBUG(7,("spoolss_io_devmode: allocated memory [%d] for private\n",devmode->driverextra)); @@ -856,7 +856,7 @@ static BOOL spoolss_io_devmode_cont(const char *desc, DEVMODE_CTR *dm_c, prs_str /* so we have a DEVICEMODE to follow */ if (UNMARSHALLING(ps)) { DEBUG(9,("Allocating memory for spoolss_io_devmode\n")); - dm_c->devmode=(DEVICEMODE *)prs_alloc_mem(ps,sizeof(DEVICEMODE)); + dm_c->devmode=PRS_ALLOC_MEM(ps,DEVICEMODE,1); if(dm_c->devmode == NULL) return False; } @@ -1010,7 +1010,7 @@ BOOL make_spoolss_printer_info_2(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_2 SPOOL_PRINTER_INFO_LEVEL_2 *inf; /* allocate the necessary memory */ - if (!(inf=(SPOOL_PRINTER_INFO_LEVEL_2*)talloc(mem_ctx, sizeof(SPOOL_PRINTER_INFO_LEVEL_2)))) { + if (!(inf=TALLOC_P(mem_ctx, SPOOL_PRINTER_INFO_LEVEL_2))) { DEBUG(0,("make_spoolss_printer_info_2: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_2 sruct!\n")); return False; } @@ -1064,7 +1064,7 @@ BOOL make_spoolss_printer_info_3(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_3 SPOOL_PRINTER_INFO_LEVEL_3 *inf; /* allocate the necessary memory */ - if (!(inf=(SPOOL_PRINTER_INFO_LEVEL_3*)talloc(mem_ctx, sizeof(SPOOL_PRINTER_INFO_LEVEL_3)))) { + if (!(inf=TALLOC_P(mem_ctx, SPOOL_PRINTER_INFO_LEVEL_3))) { DEBUG(0,("make_spoolss_printer_info_3: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_3 sruct!\n")); return False; } @@ -1087,7 +1087,7 @@ BOOL make_spoolss_printer_info_7(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_7 SPOOL_PRINTER_INFO_LEVEL_7 *inf; /* allocate the necessary memory */ - if (!(inf=(SPOOL_PRINTER_INFO_LEVEL_7*)talloc(mem_ctx, sizeof(SPOOL_PRINTER_INFO_LEVEL_7)))) { + if (!(inf=TALLOC_P(mem_ctx, SPOOL_PRINTER_INFO_LEVEL_7))) { DEBUG(0,("make_spoolss_printer_info_7: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_7 struct!\n")); return False; } @@ -1444,7 +1444,7 @@ BOOL spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, return False; if (UNMARSHALLING(ps) && r_u->size) { - r_u->data = (unsigned char *)prs_alloc_mem(ps, r_u->size); + r_u->data = PRS_ALLOC_MEM(ps, unsigned char, r_u->size); if(!r_u->data) return False; } @@ -1885,7 +1885,7 @@ BOOL spoolss_io_q_writeprinter(const char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_ if (q_u->buffer_size!=0) { if (UNMARSHALLING(ps)) - q_u->buffer=(uint8 *)prs_alloc_mem(ps,q_u->buffer_size*sizeof(uint8)); + q_u->buffer=PRS_ALLOC_MEM(ps, uint8, q_u->buffer_size); if(q_u->buffer == NULL) return False; if(!prs_uint8s(True, "buffer", ps, depth, q_u->buffer, q_u->buffer_size)) @@ -1952,7 +1952,7 @@ BOOL spoolss_io_q_rffpcnex(const char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct * if (q_u->option_ptr!=0) { if (UNMARSHALLING(ps)) - if((q_u->option=(SPOOL_NOTIFY_OPTION *)prs_alloc_mem(ps,sizeof(SPOOL_NOTIFY_OPTION))) == NULL) + if((q_u->option=PRS_ALLOC_MEM(ps,SPOOL_NOTIFY_OPTION,1)) == NULL) return False; if(!smb_io_notify_option("notify option", q_u->option, ps, depth)) @@ -2003,7 +2003,7 @@ BOOL spoolss_io_q_rfnpcnex(const char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct * if (q_u->option_ptr!=0) { if (UNMARSHALLING(ps)) - if((q_u->option=(SPOOL_NOTIFY_OPTION *)prs_alloc_mem(ps,sizeof(SPOOL_NOTIFY_OPTION))) == NULL) + if((q_u->option=PRS_ALLOC_MEM(ps,SPOOL_NOTIFY_OPTION,1)) == NULL) return False; if(!smb_io_notify_option("notify option", q_u->option, ps, depth)) @@ -2229,7 +2229,7 @@ static BOOL smb_io_relarraystr(const char *desc, NEW_BUFFER *buffer, int depth, /* Yes this should be malloc not talloc. Don't change. */ - chaine.buffer = malloc((q-p+1)*sizeof(uint16)); + chaine.buffer = SMB_MALLOC((q-p+1)*sizeof(uint16)); if (chaine.buffer == NULL) return False; @@ -2298,7 +2298,7 @@ static BOOL smb_io_relarraystr(const char *desc, NEW_BUFFER *buffer, int depth, /* Yes this should be realloc - it's freed below. JRA */ - if((tc2=(uint16 *)Realloc(chaine2, realloc_size)) == NULL) { + if((tc2=(uint16 *)SMB_REALLOC(chaine2, realloc_size)) == NULL) { SAFE_FREE(chaine2); return False; } @@ -2314,7 +2314,7 @@ static BOOL smb_io_relarraystr(const char *desc, NEW_BUFFER *buffer, int depth, if (chaine2) { chaine2[l_chaine2] = '\0'; - *string=(uint16 *)talloc_memdup(prs_get_mem_context(ps),chaine2,realloc_size); + *string=(uint16 *)TALLOC_MEMDUP(prs_get_mem_context(ps),chaine2,realloc_size); SAFE_FREE(chaine2); } @@ -2442,7 +2442,7 @@ static BOOL smb_io_reldevmode(const char *desc, NEW_BUFFER *buffer, int depth, D return False; /* read the string */ - if((*devmode=(DEVICEMODE *)prs_alloc_mem(ps,sizeof(DEVICEMODE))) == NULL) + if((*devmode=PRS_ALLOC_MEM(ps,DEVICEMODE,1)) == NULL) return False; if (!spoolss_io_devmode(desc, ps, depth, *devmode)) return False; @@ -3114,7 +3114,7 @@ static BOOL spoolss_io_buffer(const char *desc, prs_struct *ps, int depth, NEW_B depth++; if (UNMARSHALLING(ps)) - buffer = *pp_buffer = (NEW_BUFFER *)prs_alloc_mem(ps, sizeof(NEW_BUFFER)); + buffer = *pp_buffer = PRS_ALLOC_MEM(ps, NEW_BUFFER, 1); if (buffer == NULL) return False; @@ -4172,7 +4172,7 @@ BOOL make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, make_spoolss_printer_info_2 (mem_ctx, &q_u->info.info_2, info->printers_2); #if 1 /* JERRY TEST */ - q_u->secdesc_ctr = (SEC_DESC_BUF*)malloc(sizeof(SEC_DESC_BUF)); + q_u->secdesc_ctr = SMB_MALLOC_P(SEC_DESC_BUF); if (!q_u->secdesc_ctr) return False; q_u->secdesc_ctr->ptr = (secdesc != NULL) ? 1: 0; @@ -4196,7 +4196,7 @@ BOOL make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, make_spoolss_printer_info_3 (mem_ctx, &q_u->info.info_3, info->printers_3); - q_u->secdesc_ctr = (SEC_DESC_BUF*)malloc(sizeof(SEC_DESC_BUF)); + q_u->secdesc_ctr = SMB_MALLOC_P(SEC_DESC_BUF); if (!q_u->secdesc_ctr) return False; q_u->secdesc_ctr->ptr = (secdesc != NULL) ? 1: 0; @@ -5011,7 +5011,7 @@ BOOL spool_io_printer_info_level(const char *desc, SPOOL_PRINTER_INFO_LEVEL *il, case 1: { if (UNMARSHALLING(ps)) { - if ((il->info_1=(SPOOL_PRINTER_INFO_LEVEL_1 *)prs_alloc_mem(ps,sizeof(SPOOL_PRINTER_INFO_LEVEL_1))) == NULL) + if ((il->info_1=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_INFO_LEVEL_1,1)) == NULL) return False; } if (!spool_io_printer_info_level_1("", il->info_1, ps, depth)) @@ -5024,7 +5024,7 @@ BOOL spool_io_printer_info_level(const char *desc, SPOOL_PRINTER_INFO_LEVEL *il, */ case 2: if (UNMARSHALLING(ps)) { - if ((il->info_2=(SPOOL_PRINTER_INFO_LEVEL_2 *)prs_alloc_mem(ps,sizeof(SPOOL_PRINTER_INFO_LEVEL_2))) == NULL) + if ((il->info_2=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_INFO_LEVEL_2,1)) == NULL) return False; } if (!spool_io_printer_info_level_2("", il->info_2, ps, depth)) @@ -5034,7 +5034,7 @@ BOOL spool_io_printer_info_level(const char *desc, SPOOL_PRINTER_INFO_LEVEL *il, case 3: { if (UNMARSHALLING(ps)) { - if ((il->info_3=(SPOOL_PRINTER_INFO_LEVEL_3 *)prs_alloc_mem(ps,sizeof(SPOOL_PRINTER_INFO_LEVEL_3))) == NULL) + if ((il->info_3=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_INFO_LEVEL_3,1)) == NULL) return False; } if (!spool_io_printer_info_level_3("", il->info_3, ps, depth)) @@ -5043,7 +5043,7 @@ BOOL spool_io_printer_info_level(const char *desc, SPOOL_PRINTER_INFO_LEVEL *il, } case 7: if (UNMARSHALLING(ps)) - if ((il->info_7=(SPOOL_PRINTER_INFO_LEVEL_7 *)prs_alloc_mem(ps,sizeof(SPOOL_PRINTER_INFO_LEVEL_7))) == NULL) + if ((il->info_7=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_INFO_LEVEL_7,1)) == NULL) return False; if (!spool_io_printer_info_level_7("", il->info_7, ps, depth)) return False; @@ -5148,7 +5148,7 @@ BOOL spool_io_printer_driver_info_level_3(const char *desc, SPOOL_PRINTER_DRIVER /* reading */ if (UNMARSHALLING(ps)) { - il=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *)prs_alloc_mem(ps,sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)); + il=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_DRIVER_INFO_LEVEL_3,1); if(il == NULL) return False; *q_u=il; @@ -5226,7 +5226,7 @@ BOOL spool_io_printer_driver_info_level_6(const char *desc, SPOOL_PRINTER_DRIVER /* reading */ if (UNMARSHALLING(ps)) { - il=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *)prs_alloc_mem(ps,sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6)); + il=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_DRIVER_INFO_LEVEL_6,1); if(il == NULL) return False; *q_u=il; @@ -5385,7 +5385,7 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) while (src < ((char *)buf5->buffer) + buf5->buf_len*2) { rpcstr_pull(f, src, sizeof(f)-1, -1, STR_TERMINATE); src = skip_unibuf(src, 2*buf5->buf_len - PTR_DIFF(src,buf5->buffer)); - tar = (fstring *)Realloc(*ar, sizeof(fstring)*(n+2)); + tar = SMB_REALLOC_ARRAY(*ar, fstring, n+2); if (!tar) return False; else @@ -5499,7 +5499,7 @@ BOOL make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx, BOOL null_char = False; SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *inf; - if (!(inf=(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3*)talloc_zero(mem_ctx, sizeof(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)))) + if (!(inf=TALLOC_ZERO_P(mem_ctx, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3))) return False; inf->cversion = info3->version; @@ -5562,8 +5562,7 @@ BOOL make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 { buf5->buf_len = len; - if((buf5->buffer=(uint16*)talloc_memdup(mem_ctx, src, sizeof(uint16)*len)) == NULL) - { + if((buf5->buffer=(uint16*)TALLOC_MEMDUP(mem_ctx, src, sizeof(uint16)*len)) == NULL) { DEBUG(0,("make_spoolss_buffer5: Unable to malloc memory for buffer!\n")); return False; } @@ -5672,7 +5671,7 @@ BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, if (*asc==NULL) { - *asc=(NT_PRINTER_DRIVER_INFO_LEVEL_3 *)malloc(sizeof(NT_PRINTER_DRIVER_INFO_LEVEL_3)); + *asc=SMB_MALLOC_P(NT_PRINTER_DRIVER_INFO_LEVEL_3); if(*asc == NULL) return False; ZERO_STRUCTP(*asc); @@ -5719,7 +5718,7 @@ BOOL uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni, if (*asc==NULL) { - *asc=(NT_PRINTER_DRIVER_INFO_LEVEL_6 *)malloc(sizeof(NT_PRINTER_DRIVER_INFO_LEVEL_6)); + *asc=SMB_MALLOC_P(NT_PRINTER_DRIVER_INFO_LEVEL_6); if(*asc == NULL) return False; ZERO_STRUCTP(*asc); @@ -5772,7 +5771,7 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, if (*asc==NULL) { DEBUGADD(8,("allocating memory\n")); - *asc=(NT_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(NT_PRINTER_INFO_LEVEL_2)); + *asc=SMB_MALLOC_P(NT_PRINTER_INFO_LEVEL_2); if(*asc == NULL) return False; ZERO_STRUCTP(*asc); @@ -6168,7 +6167,7 @@ BOOL spoolss_io_r_enumprinterdata(const char *desc, SPOOL_R_ENUMPRINTERDATA *r_u return False; if (UNMARSHALLING(ps) && r_u->valuesize) { - r_u->value = (uint16 *)prs_alloc_mem(ps, r_u->valuesize * 2); + r_u->value = PRS_ALLOC_MEM(ps, uint16, r_u->valuesize); if (!r_u->value) { DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata value\n")); return False; @@ -6191,7 +6190,7 @@ BOOL spoolss_io_r_enumprinterdata(const char *desc, SPOOL_R_ENUMPRINTERDATA *r_u return False; if (UNMARSHALLING(ps) && r_u->datasize) { - r_u->data = (uint8 *)prs_alloc_mem(ps, r_u->datasize); + r_u->data = PRS_ALLOC_MEM(ps, uint8, r_u->datasize); if (!r_u->data) { DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata data\n")); return False; @@ -6326,7 +6325,7 @@ BOOL spoolss_io_q_setprinterdata(const char *desc, SPOOL_Q_SETPRINTERDATA *q_u, case REG_MULTI_SZ: if (q_u->max_len) { if (UNMARSHALLING(ps)) - q_u->data=(uint8 *)prs_alloc_mem(ps, q_u->max_len * sizeof(uint8)); + q_u->data=PRS_ALLOC_MEM(ps, uint8, q_u->max_len); if(q_u->data == NULL) return False; if(!prs_uint8s(False,"data", ps, depth, q_u->data, q_u->max_len)) @@ -6885,7 +6884,7 @@ static BOOL copy_spool_notify_info_data(SPOOL_NOTIFY_INFO_DATA *dst, if (src->size != POINTER) continue; len = src->notify_data.data.length; - s = malloc(sizeof(uint16)*len); + s = SMB_MALLOC_ARRAY(uint16, len); if (s == NULL) { DEBUG(0,("copy_spool_notify_info_data: malloc() failed!\n")); return False; @@ -6914,7 +6913,7 @@ static BOOL copy_spool_notify_info(SPOOL_NOTIFY_INFO *dst, SPOOL_NOTIFY_INFO *sr if (dst->count) { - dst->data = malloc(dst->count * sizeof(SPOOL_NOTIFY_INFO_DATA)); + dst->data = SMB_MALLOC_ARRAY(SPOOL_NOTIFY_INFO_DATA, dst->count); DEBUG(10,("copy_spool_notify_info: allocating space for [%d] PRINTER_NOTIFY_INFO_DATA entries\n", dst->count)); @@ -7084,7 +7083,7 @@ BOOL spoolss_io_r_getprinterdataex(const char *desc, SPOOL_R_GETPRINTERDATAEX *r return False; if (UNMARSHALLING(ps) && r_u->size) { - r_u->data = (unsigned char *)prs_alloc_mem(ps, r_u->size); + r_u->data = PRS_ALLOC_MEM(ps, unsigned char, r_u->size); if(!r_u->data) return False; } @@ -7142,7 +7141,7 @@ BOOL spoolss_io_q_setprinterdataex(const char *desc, SPOOL_Q_SETPRINTERDATAEX *q case 0x7: if (q_u->max_len) { if (UNMARSHALLING(ps)) - q_u->data=(uint8 *)prs_alloc_mem(ps, q_u->max_len * sizeof(uint8)); + q_u->data=PRS_ALLOC_MEM(ps, uint8, q_u->max_len); if(q_u->data == NULL) return False; if(!prs_uint8s(False,"data", ps, depth, q_u->data, q_u->max_len)) @@ -7350,8 +7349,7 @@ static BOOL spoolss_io_printer_enum_values_ctr(const char *desc, prs_struct *ps, /* first loop to write basic enum_value information */ if (UNMARSHALLING(ps)) { - ctr->values = (PRINTER_ENUM_VALUES *)prs_alloc_mem( - ps, ctr->size_of_array * sizeof(PRINTER_ENUM_VALUES)); + ctr->values = PRS_ALLOC_MEM(ps, PRINTER_ENUM_VALUES, ctr->size_of_array); if (!ctr->values) return False; } @@ -7392,8 +7390,7 @@ static BOOL spoolss_io_printer_enum_values_ctr(const char *desc, prs_struct *ps, if ( ctr->values[i].data_len ) { if ( UNMARSHALLING(ps) ) { - ctr->values[i].data = (uint8 *)prs_alloc_mem( - ps, ctr->values[i].data_len); + ctr->values[i].data = PRS_ALLOC_MEM(ps, uint8, ctr->values[i].data_len); if (!ctr->values[i].data) return False; } diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 8313c82c93..84c45b5901 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -783,7 +783,7 @@ static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_ int i; if (UNMARSHALLING(ps)) { - if (!(info0 = (SRV_SHARE_INFO_0 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_0)))) + if (!(info0 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_0, num_entries))) return False; ctr->share.info0 = info0; } @@ -809,7 +809,7 @@ static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_ int i; if (UNMARSHALLING(ps)) { - if (!(info1 = (SRV_SHARE_INFO_1 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_SHARE_INFO_1)))) + if (!(info1 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_1, num_entries))) return False; ctr->share.info1 = info1; } @@ -835,7 +835,7 @@ static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_ int i; if (UNMARSHALLING(ps)) { - if (!(info2 = (SRV_SHARE_INFO_2 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_2)))) + if (!(info2 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_2,num_entries))) return False; ctr->share.info2 = info2; } @@ -860,8 +860,7 @@ static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_ int i; if (UNMARSHALLING(ps)) { - if (!(info501 = (SRV_SHARE_INFO_501 *) prs_alloc_mem(ps, num_entries * - sizeof (SRV_SHARE_INFO_501)))) + if (!(info501 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_501, num_entries))) return False; ctr->share.info501 = info501; } @@ -886,7 +885,7 @@ static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_ int i; if (UNMARSHALLING(ps)) { - if (!(info502 = (SRV_SHARE_INFO_502 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_502)))) + if (!(info502 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_502,num_entries))) return False; ctr->share.info502 = info502; } @@ -912,7 +911,7 @@ static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_ int i; if (UNMARSHALLING(ps)) { - if (!(info1004 = (SRV_SHARE_INFO_1004 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1004)))) + if (!(info1004 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1004,num_entries))) return False; ctr->share.info1004 = info1004; } @@ -938,7 +937,7 @@ static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_ int i; if (UNMARSHALLING(ps)) { - if (!(info1005 = (SRV_SHARE_INFO_1005 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1005)))) + if (!(info1005 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1005,num_entries))) return False; ctr->share.info1005 = info1005; } @@ -958,7 +957,7 @@ static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_ int i; if (UNMARSHALLING(ps)) { - if (!(info1006 = (SRV_SHARE_INFO_1006 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1006)))) + if (!(info1006 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1006,num_entries))) return False; ctr->share.info1006 = info1006; } @@ -978,7 +977,7 @@ static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_ int i; if (UNMARSHALLING(ps)) { - if (!(info1007 = (SRV_SHARE_INFO_1007 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1007)))) + if (!(info1007 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1007,num_entries))) return False; ctr->share.info1007 = info1007; } @@ -1004,7 +1003,7 @@ static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_ int i; if (UNMARSHALLING(ps)) { - if (!(info1501 = (SRV_SHARE_INFO_1501 *)prs_alloc_mem(ps,num_entries * sizeof(SRV_SHARE_INFO_1501)))) + if (!(info1501 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1501,num_entries))) return False; ctr->share.info1501 = info1501; } @@ -1848,7 +1847,7 @@ static BOOL srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, pr depth++; if(UNMARSHALLING(ps)) { - ctr = *pp_ctr = (SRV_SESS_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_SESS_INFO_CTR)); + ctr = *pp_ctr = PRS_ALLOC_MEM(ps, SRV_SESS_INFO_CTR, 1); if (ctr == NULL) return False; } @@ -2221,7 +2220,7 @@ static BOOL srv_io_srv_conn_ctr(const char *desc, SRV_CONN_INFO_CTR **pp_ctr, pr depth++; if (UNMARSHALLING(ps)) { - ctr = *pp_ctr = (SRV_CONN_INFO_CTR *)prs_alloc_mem(ps, sizeof(SRV_CONN_INFO_CTR)); + ctr = *pp_ctr = PRS_ALLOC_MEM(ps, SRV_CONN_INFO_CTR, 1); if (ctr == NULL) return False; } @@ -2487,7 +2486,7 @@ static BOOL srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_st int i; if (UNMARSHALLING(ps)) { - if (!(info3 = (SRV_FILE_INFO_3 *)prs_alloc_mem(ps, num_entries * sizeof(SRV_FILE_INFO_3)))) + if (!(info3 = PRS_ALLOC_MEM(ps, SRV_FILE_INFO_3, num_entries))) return False; ctr->file.info3 = info3; } @@ -3022,8 +3021,7 @@ BOOL srv_io_q_net_srv_set_info(const char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, return False; if (UNMARSHALLING(ps)) { - q_n->ctr = (SRV_INFO_CTR *) - prs_alloc_mem(ps, sizeof(SRV_INFO_CTR)); + q_n->ctr = PRS_ALLOC_MEM(ps, SRV_INFO_CTR, 1); if (!q_n->ctr) return False; @@ -3310,8 +3308,8 @@ BOOL srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_stru DISK_INFO *dinfo; - if(!(dinfo = (DISK_INFO *)prs_alloc_mem(ps, sizeof(*dinfo) * entries_read3))) - return False; + if(!(dinfo = PRS_ALLOC_MEM(ps, DISK_INFO, entries_read3))) + return False; r_n->disk_enum_ctr.disk_info = dinfo; } -- cgit From 4027c4088b0e5e4d6f87781a44f8703c62f24027 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 15 Dec 2004 13:13:15 +0000 Subject: r4219: Fix samba3 samr "idl"... According to samba4 idl samr_DomInfo2 contains a comment string and not an unknown 12 byte structure... Found after abartlet's smbtorture extended this string to "Tortured by Samba4: Fri Nov 26 15:40:18 2004 CET" ;-)) Volker (This used to be commit b41d94d8186f66136918432cf32e9dcef5a8bd12) --- source3/rpc_parse/parse_samr.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 34f48b9ad7..a674b89ab6 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -662,14 +662,11 @@ inits a structure. ********************************************************************/ void init_unk_info2(SAM_UNK_INFO_2 * u_2, - const char *domain, const char *server, + const char *comment, const char *domain, const char *server, uint32 seq_num, uint32 num_users, uint32 num_groups, uint32 num_alias) { u_2->unknown_0 = 0x00000000; u_2->unknown_1 = 0x80000000; - u_2->unknown_2 = 0x00000000; - - u_2->ptr_0 = 1; u_2->seq_num = seq_num; u_2->unknown_3 = 0x00000000; @@ -683,6 +680,8 @@ void init_unk_info2(SAM_UNK_INFO_2 * u_2, memset(u_2->padding, 0, sizeof(u_2->padding)); /* 12 bytes zeros */ + 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); @@ -706,10 +705,7 @@ static BOOL sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2, return False; if(!prs_uint32("unknown_1", ps, depth, &u_2->unknown_1)) /* 0x8000 0000 */ return False; - if(!prs_uint32("unknown_2", ps, depth, &u_2->unknown_2)) /* 0x0000 0000 */ - return False; - - if(!prs_uint32("ptr_0", ps, depth, &u_2->ptr_0)) + 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; @@ -738,15 +734,8 @@ static BOOL sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2, if(!prs_uint32("num_local_grps", ps, depth, &u_2->num_local_grps)) return False; - if (u_2->ptr_0) { - /* this was originally marked as 'padding'. It isn't - padding, it is some sort of optional 12 byte - structure. When it is present it contains zeros - !? */ - if(!prs_uint8s(False, "unknown", ps, depth, u_2->padding,sizeof(u_2->padding))) - 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)) -- cgit From 992ad2848522e5219291d6b9b7a6be982c147a12 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 20 Dec 2004 11:36:39 +0000 Subject: r4286: Give back 8 byte lm_session_key in Netrsamlogon-reply. The old #ifdef JRATEST-block was copying 16 bytes and thus overwriting acct_flags with bizarre values, breaking a lot of things. This patch is successfully running in a production environment for quite some time now and is required to finally allow Exchange 5.5 to access another Exchange Server when both are running on NT4 in a samba-controlled domain. This also allows Exchange Replication to take place, Exchange Administrator to access other Servers in the network, etc. Fixes Bugzilla #1136. Thanks abartlet for helping me with that one. Guenther (This used to be commit bd4c5125d6989cebc90152a23e113b345806c660) --- source3/rpc_parse/parse_net.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 97ca0d406b..7e5eec3e6d 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1454,12 +1454,16 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, usr->buffer_dom_id = dom_sid ? 1 : 0; /* yes, we're bothering to put a domain SID in */ - memset((char *)usr->padding, '\0', sizeof(usr->padding)); + memset((char *)usr->lm_sess_key, '\0', sizeof(usr->lm_sess_key)); + memset(&usr->acct_flags, '\0', sizeof(usr->acct_flags)); -#if 0 /* JRATEST - exchange auth test. */ - if (lm_session_key != NULL) - memcpy(usr->padding, lm_session_key, sizeof(usr->user_sess_key)); -#endif + 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, other_sids, &usr->other_sids); @@ -1580,9 +1584,19 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, if(!prs_uint32("buffer_dom_id ", ps, depth, &usr->buffer_dom_id)) /* undocumented logon domain id pointer */ return False; - if(!prs_uint8s (False, "padding ", ps, depth, usr->padding, 40)) /* unused padding bytes? */ + + 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; + + 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; -- cgit From 111f62c00c31ac98d50c0a01e31cb1d44082be29 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 20 Dec 2004 12:52:33 +0000 Subject: r4287: Vampire SAM_DELTA_DOMAIN_INFO. Based on samba4-idl. The decoding of account-lockout-string is somewhat experimental though. Guenther (This used to be commit 721bf50d7446b8ce18bc1d45e17d4214d5a43d26) --- source3/rpc_parse/parse_misc.c | 62 ++++++++++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_net.c | 46 +++++++++++++++++++++++-------- 2 files changed, 96 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 17a8f624ae..0ebc16581b 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1109,6 +1109,53 @@ BOOL init_unistr2_array(UNISTR2_ARRAY *array, return True; } +BOOL smb_io_lockout_string_hdr(const char *desc, HDR_LOCKOUT_STRING *hdr_account_lockout, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "smb_io_lockout_string_hdr"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint16("size", ps, depth, &hdr_account_lockout->size)) + return False; + if(!prs_uint16("length", ps, depth, &hdr_account_lockout->length)) + return False; + if(!prs_uint32("buffer", ps, depth, &hdr_account_lockout->buffer)) + return False; + + return True; +} + +BOOL smb_io_account_lockout_str(const char *desc, LOCKOUT_STRING *account_lockout, uint32 buffer, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "smb_io_account_lockout_string"); + depth++; + + if(!prs_uint32("array_size", ps, depth, &account_lockout->array_size)) + return False; + + if(!prs_uint32("offset", ps, depth, &account_lockout->offset)) + return False; + if(!prs_uint32("length", ps, depth, &account_lockout->length)) + return False; + + if (!prs_uint64("lockout_duration", ps, depth, &account_lockout->lockout_duration)) + return False; + if (!prs_uint64("reset_count", ps, depth, &account_lockout->reset_count)) + return False; + if (!prs_uint32("bad_attempt_lockout", ps, depth, &account_lockout->bad_attempt_lockout)) + return False; + if (!prs_uint32("dummy", ps, depth, &account_lockout->dummy)) + return False; +#if 0 + if(!prs_uint16s (False, "bindata", ps, depth, &account_lockout->bindata, length)) + return False; +#endif + + return True; +} + /******************************************************************* Reads or writes a UNISTR2_ARRAY structure. ********************************************************************/ @@ -1694,6 +1741,21 @@ BOOL smb_io_bufhdr2(const char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) return True; } +/******************************************************************* +reads or writes a BUFHDR4 structure. +********************************************************************/ +BOOL smb_io_bufhdr4(const char *desc, BUFHDR4 *hdr, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "smb_io_bufhdr4"); + depth++; + + prs_align(ps); + prs_uint32("size", ps, depth, &(hdr->size)); + prs_uint32("buffer", ps, depth, &(hdr->buffer)); + + return True; +} + /******************************************************************* reads or writes a BUFFER4 structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 7e5eec3e6d..5f1d4b622e 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1937,15 +1937,26 @@ static BOOL net_io_sam_domain_info(const char *desc, SAM_DOMAIN_INFO * info, return False; if (!smb_io_time("creation_time", &info->creation_time, ps, depth)) return False; - - if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth)) - return False; - if (!smb_io_unihdr("hdr_unknown", &info->hdr_unknown, ps, depth)) - return False; - - if (ps->data_offset + 40 > ps->buffer_size) - return False; - ps->data_offset += 40; + 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)) @@ -1957,9 +1968,20 @@ static BOOL net_io_sam_domain_info(const char *desc, SAM_DOMAIN_INFO * info, if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, info->hdr_sec_desc.buffer, ps, depth)) return False; - if (!smb_io_unistr2("buf_unknown", &info->buf_unknown, - info->hdr_unknown.buffer, 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; } -- cgit From 9aba116607c0b85a371c3556a6483bc662c769a3 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 22 Dec 2004 16:58:43 +0000 Subject: r4331: Implement SAMR query_dom_info-call info-level 8 server- and client-side, based on samba4-idl. This saves us an enormous amount of totally unnecessary ldap-traffic when several hundreds of winbind-daemons query a Samba3 DC just to get the fake SAM-sequence-number (time(NULL)) by enumerating all users, all groups and all aliases when query-dom-info level 2 is used. Note that we apparently never get the sequence number right (we parse a uint32, although it's a uint64, at least in samba4 idl). For the time being, I would propose to stay with that behaviour. Guenther (This used to be commit f9ab15a986626581000d4b93961184c501f36b93) --- source3/rpc_parse/parse_samr.c | 47 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a674b89ab6..5b211f8349 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -588,6 +588,40 @@ static BOOL sam_io_unk_info7(const char *desc, SAM_UNK_INFO_7 * u_7, 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.low = seq_num; + u_8->seq_num.high = 0x0000; +} + +/******************************************************************* +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. ********************************************************************/ @@ -668,8 +702,9 @@ void init_unk_info2(SAM_UNK_INFO_2 * u_2, u_2->unknown_0 = 0x00000000; u_2->unknown_1 = 0x80000000; - u_2->seq_num = seq_num; - u_2->unknown_3 = 0x00000000; + u_2->seq_num.low = seq_num; + u_2->seq_num.high = 0x00000000; + u_2->unknown_4 = 0x00000001; u_2->unknown_5 = 0x00000003; @@ -716,9 +751,7 @@ static BOOL sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2, pointer is referring to */ - if(!prs_uint32("seq_num ", ps, depth, &u_2->seq_num)) /* 0x0000 0099 or 0x1000 0000 */ - return False; - if(!prs_uint32("unknown_3 ", ps, depth, &u_2->unknown_3)) /* 0x0000 0000 */ + 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 */ @@ -843,6 +876,10 @@ BOOL samr_io_r_query_dom_info(const char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, 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; -- cgit From 8222f958d15256a62712710c9c9a159106746d8b Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 22 Dec 2004 23:50:31 +0000 Subject: r4336: Apply some other samba4 SAMR idl that is just too obvious. Don't hard set the value "forcibly disconnect remote users from server when logon hours expire" to "no", instead take the value from our account-policy storage. Guenther (This used to be commit e3bd2a22a5cebc4adf6910d3ec31bc6fada8cd35) --- source3/rpc_parse/parse_samr.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 5b211f8349..8d5fee68e0 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -697,10 +697,10 @@ 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) + uint32 seq_num, uint32 num_users, uint32 num_groups, uint32 num_alias, NTTIME nt_logout) { - u_2->unknown_0 = 0x00000000; - u_2->unknown_1 = 0x80000000; + u_2->logout.low = nt_logout.low; + u_2->logout.high = nt_logout.high; u_2->seq_num.low = seq_num; u_2->seq_num.high = 0x00000000; @@ -736,9 +736,7 @@ static BOOL sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2, prs_debug(ps, depth, desc, "sam_io_unk_info2"); depth++; - if(!prs_uint32("unknown_0", ps, depth, &u_2->unknown_0)) /* 0x0000 0000 */ - return False; - if(!prs_uint32("unknown_1", ps, depth, &u_2->unknown_1)) /* 0x8000 0000 */ + 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; -- cgit From 07fdfa2ce9762557c3be632f3e438a1f59970c5c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 8 Jan 2005 00:51:12 +0000 Subject: r4601: Removed any use of the MAX_XXX_STR style definitions. A little larger change than I'd hoped for due to formating changes to tidy up code. Jeremy. (This used to be commit a348f9221a9fe719dc6f0db6eb295575c2f95e1e) --- source3/rpc_parse/parse_misc.c | 92 +++++++++++++++++------------------------- source3/rpc_parse/parse_prs.c | 57 +++++++++++++++----------- 2 files changed, 71 insertions(+), 78 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 0ebc16581b..b53f9ec98c 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -553,7 +553,6 @@ void init_unistr(UNISTR *str, const char *buf) } len = strlen(buf) + 1; - len = MAX(len,MAX_UNISTRLEN); str->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, len); if (str->buffer == NULL) @@ -585,14 +584,12 @@ BOOL smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth) Allocate the BUFFER3 memory. ********************************************************************/ -static void create_buffer3(BUFFER3 *str, size_t len) +static size_t create_buffer3(BUFFER3 *str, size_t len) { - len = MAX(len,MAX_BUFFERLEN); - str->buffer = TALLOC_ZERO(get_talloc_ctx(), len); if (str->buffer == NULL) smb_panic("create_buffer3: talloc fail\n"); - + return len; } /******************************************************************* @@ -604,10 +601,7 @@ void init_buffer3_uint32(BUFFER3 *str, uint32 val) ZERO_STRUCTP(str); /* set up string lengths. */ - str->buf_max_len = sizeof(uint32); - str->buf_len = sizeof(uint32); - - create_buffer3(str, sizeof(uint32)); + str->buf_max_len = str->buf_len = create_buffer3(str, sizeof(uint32)); SIVAL(str->buffer, 0, val); } @@ -620,11 +614,7 @@ void init_buffer3_str(BUFFER3 *str, const char *buf, int len) ZERO_STRUCTP(str); /* set up string lengths. */ - str->buf_max_len = len * 2; - str->buf_len = len * 2; - - create_buffer3(str, str->buf_max_len); - + str->buf_max_len = str->buf_len = create_buffer3(str, len*2); rpcstr_push(str->buffer, buf, str->buf_max_len, STR_TERMINATE); } @@ -636,24 +626,24 @@ void init_buffer3_str(BUFFER3 *str, const char *buf, int len) void init_buffer3_hex(BUFFER3 *str, const char *buf) { ZERO_STRUCTP(str); - create_buffer3(str, strlen(buf)); - str->buf_max_len = str->buf_len = strhex_to_str((char *)str->buffer, sizeof(str->buffer), buf); + str->buf_max_len = str->buf_len = create_buffer3(str, strlen(buf)); + str->buf_max_len = str->buf_len = strhex_to_str((char *)str->buffer, str->buf_len, buf); } /******************************************************************* Inits a BUFFER3 structure. ********************************************************************/ -void init_buffer3_bytes(BUFFER3 *str, uint8 *buf, int len) +void init_buffer3_bytes(BUFFER3 *str, uint8 *buf, size_t len) { ZERO_STRUCTP(str); /* max buffer size (allocated size) */ - str->buf_max_len = len; if (buf != NULL) { - create_buffer3(str, len); + len = create_buffer3(str, len); memcpy(str->buffer, buf, len); } + str->buf_max_len = len; str->buf_len = buf != NULL ? len : 0; } @@ -730,11 +720,11 @@ void init_buffer2(BUFFER2 *str, const uint8 *buf, size_t len) str->buf_len = buf != NULL ? len : 0; if (buf != NULL) { - len = MAX(len,MAX_BUFFERLEN); - str->buffer = TALLOC_ZERO(get_talloc_ctx(), len); + SMB_ASSERT(str->buf_max_len >= str->buf_len); + str->buffer = TALLOC_ZERO(get_talloc_ctx(), str->buf_max_len); if (str->buffer == NULL) smb_panic("init_buffer2: talloc fail\n"); - memcpy(str->buffer, buf, MIN(str->buf_len, len)); + memcpy(str->buffer, buf, str->buf_len); } } @@ -802,19 +792,22 @@ void init_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf) void copy_unistr2(UNISTR2 *str, const UNISTR2 *from) { + if (from->buffer == NULL) { + ZERO_STRUCTP(str); + return; + } + + SMB_ASSERT(from->uni_max_len >= from->uni_str_len); + str->uni_max_len = from->uni_max_len; str->offset = from->offset; str->uni_str_len = from->uni_str_len; - if (from->buffer == NULL) - return; - /* the string buffer is allocated to the maximum size (the the length of the source string) to prevent reallocation of memory. */ if (str->buffer == NULL) { - size_t alloc_len = MAX(from->uni_max_len,MAX_UNISTRLEN); - str->buffer = (uint16 *)TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, alloc_len); + str->buffer = (uint16 *)TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, str->uni_max_len); if ((str->buffer == NULL)) { smb_panic("copy_unistr2: talloc fail\n"); return; @@ -822,24 +815,25 @@ void copy_unistr2(UNISTR2 *str, const UNISTR2 *from) } /* copy the string */ - memcpy(str->buffer, from->buffer, from->uni_max_len*sizeof(uint16)); + memcpy(str->buffer, from->buffer, str->uni_max_len*sizeof(uint16)); } /******************************************************************* Creates a STRING2 structure. ********************************************************************/ -void init_string2(STRING2 *str, const char *buf, int max_len, int str_len) +void init_string2(STRING2 *str, const char *buf, size_t max_len, size_t str_len) { /* set up string lengths. */ + SMB_ASSERT(max_len >= str_len); + str->str_max_len = max_len; str->offset = 0; str->str_str_len = str_len; /* store the string */ if(str_len != 0) { - int alloc_len = MAX(str_len, MAX_STRINGLEN); - str->buffer = TALLOC_ZERO(get_talloc_ctx(), alloc_len); + str->buffer = TALLOC_ZERO(get_talloc_ctx(), str->str_max_len); if (str->buffer == NULL) smb_panic("init_string2: malloc fail\n"); memcpy(str->buffer, buf, str_len); @@ -903,8 +897,6 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) len = strlen(buf) + 1; } - len = MAX(len,MAX_UNISTRLEN); - str->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, len); if (str->buffer == NULL) { smb_panic("init_unistr2: malloc fail\n"); @@ -943,7 +935,6 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) { uint32 len = strlen_w(buf); - uint32 alloc_len; ZERO_STRUCTP(str); @@ -952,9 +943,7 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) str->offset = 0; str->uni_str_len = len; - alloc_len = MAX((len + 1), MAX_UNISTRLEN); - - str->buffer = TALLOC_ZERO_ARRAY(ctx, uint16, alloc_len); + str->buffer = TALLOC_ZERO_ARRAY(ctx, uint16, len + 1); if (str->buffer == NULL) { smb_panic("init_unistr2_w: malloc fail\n"); return; @@ -1667,25 +1656,19 @@ BOOL smb_io_pol_hnd(const char *desc, POLICY_HND *pol, prs_struct *ps, int depth void init_unistr3(UNISTR3 *str, const char *buf) { - size_t len, alloc_len; - if (buf == NULL) { str->uni_str_len=0; str->str.buffer = NULL; return; } - len = strlen(buf) + 1; + str->uni_str_len = strlen(buf) + 1; - str->uni_str_len=len; - - alloc_len = MAX(len, MAX_UNISTRLEN); - - str->str.buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, alloc_len); + str->str.buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, str->uni_str_len); if (str->str.buffer == NULL) smb_panic("init_unistr3: malloc fail\n"); - rpcstr_push((char *)str->str.buffer, buf, len * sizeof(uint16), STR_TERMINATE); + rpcstr_push((char *)str->str.buffer, buf, str->uni_str_len * sizeof(uint16), STR_TERMINATE); } /******************************************************************* @@ -1750,8 +1733,8 @@ BOOL smb_io_bufhdr4(const char *desc, BUFHDR4 *hdr, prs_struct *ps, int depth) depth++; prs_align(ps); - prs_uint32("size", ps, depth, &(hdr->size)); - prs_uint32("buffer", ps, depth, &(hdr->buffer)); + prs_uint32("size", ps, depth, &hdr->size); + prs_uint32("buffer", ps, depth, &hdr->buffer); return True; } @@ -1759,19 +1742,20 @@ BOOL smb_io_bufhdr4(const char *desc, BUFHDR4 *hdr, prs_struct *ps, int depth) /******************************************************************* reads or writes a BUFFER4 structure. ********************************************************************/ + BOOL smb_io_buffer4(const char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_buffer4"); depth++; prs_align(ps); - prs_uint32("buf_len", ps, depth, &(buf4->buf_len)); - - if (buf4->buf_len > MAX_BUFFERLEN) - { - buf4->buf_len = MAX_BUFFERLEN; + prs_uint32("buf_len", ps, depth, &buf4->buf_len); + if (UNMARSHALLING(ps)) { + buf4->buffer = PRS_ALLOC_MEM(ps, uint8, buf4->buf_len); + if (!buf4->buffer) { + return False; + } } - prs_uint8s(True, "buffer", ps, depth, buf4->buffer, buf4->buf_len); return True; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 67a9d96e19..4b78d373ba 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -726,14 +726,14 @@ BOOL prs_uint8s(BOOL charmode, const char *name, prs_struct *ps, int depth, uint SCVAL(q, i, data8s[i]); } - DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset ,name)); - if (charmode) + DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset ,name)); + if (charmode) print_asc(5, (unsigned char*)data8s, len); else { - for (i = 0; i < len; i++) + for (i = 0; i < len; i++) DEBUG(5,("%02x ", data8s[i])); } - DEBUG(5,("\n")); + DEBUG(5,("\n")); ps->data_offset += len; @@ -776,7 +776,7 @@ BOOL prs_uint16s(BOOL charmode, const char *name, prs_struct *ps, int depth, uin for (i = 0; i < len; i++) DEBUG(5,("%04x ", data16s[i])); } - DEBUG(5,("\n")); + DEBUG(5,("\n")); ps->data_offset += (len * sizeof(uint16)); @@ -818,7 +818,7 @@ static void dbg_rw_punival(BOOL charmode, const char *name, int depth, prs_struc for (i = 0; i < len; i++) DEBUG(5,("%04x ", out_buf[i])); } - DEBUG(5,("\n")); + DEBUG(5,("\n")); } /****************************************************************** @@ -873,7 +873,7 @@ BOOL prs_uint32s(BOOL charmode, const char *name, prs_struct *ps, int depth, uin for (i = 0; i < len; i++) DEBUG(5,("%08x ", data32s[i])); } - DEBUG(5,("\n")); + DEBUG(5,("\n")); ps->data_offset += (len * sizeof(uint32)); @@ -924,8 +924,11 @@ BOOL prs_buffer2(BOOL charmode, const char *name, prs_struct *ps, int depth, BUF return False; if (UNMARSHALLING(ps)) { - if ( str->buf_len ) { - str->buffer = PRS_ALLOC_MEM(ps, uint16, str->buf_len); + if (str->buf_len > str->buf_max_len) { + return False; + } + if ( str->buf_max_len ) { + str->buffer = PRS_ALLOC_MEM(ps, uint16, str->buf_max_len); if ( str->buffer == NULL ) return False; } @@ -947,11 +950,14 @@ BOOL prs_buffer2(BOOL charmode, const char *name, prs_struct *ps, int depth, BUF BOOL prs_string2(BOOL charmode, const char *name, prs_struct *ps, int depth, STRING2 *str) { unsigned int i; - char *q = prs_mem_get(ps, str->str_max_len); + char *q = prs_mem_get(ps, str->str_str_len); if (q == NULL) return False; if (UNMARSHALLING(ps)) { + if (str->str_str_len > str->str_max_len) { + return False; + } str->buffer = PRS_ALLOC_MEM(ps,unsigned char, str->str_max_len); if (str->buffer == NULL) return False; @@ -965,14 +971,14 @@ BOOL prs_string2(BOOL charmode, const char *name, prs_struct *ps, int depth, STR SCVAL(q, i, str->buffer[i]); } - DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); - if (charmode) + DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + if (charmode) print_asc(5, (unsigned char*)str->buffer, str->str_str_len); else { - for (i = 0; i < str->str_str_len; i++) + for (i = 0; i < str->str_str_len; i++) DEBUG(5,("%02x ", str->buffer[i])); } - DEBUG(5,("\n")); + DEBUG(5,("\n")); ps->data_offset += str->str_str_len; @@ -996,6 +1002,9 @@ BOOL prs_unistr2(BOOL charmode, const char *name, prs_struct *ps, int depth, UNI return True; if (UNMARSHALLING(ps)) { + if (str->uni_str_len > str->uni_max_len) { + return False; + } str->buffer = PRS_ALLOC_MEM(ps,uint16,str->uni_max_len); if (str->buffer == NULL) return False; @@ -1061,10 +1070,8 @@ BOOL prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) start = (uint8*)q; - for(len = 0; str->buffer[len] != 0; len++) - { - if(ps->bigendian_data) - { + for(len = 0; str->buffer[len] != 0; len++) { + if(ps->bigendian_data) { /* swap bytes - p is little endian, q is big endian. */ q[0] = (char)p[1]; q[1] = (char)p[0]; @@ -1126,8 +1133,7 @@ BOOL prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) /* the (len < alloc_len) test is to prevent us from overwriting memory that is not ours...if we get that far, we have a non-null terminated string in the buffer and have messed up somewhere */ - while ((len < alloc_len) && (*(uint16 *)q != 0)) - { + while ((len < alloc_len) && (*(uint16 *)q != 0)) { if(ps->bigendian_data) { /* swap bytes - q is big endian, p is little endian. */ @@ -1145,8 +1151,7 @@ BOOL prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) len++; } - if (len < alloc_len) - { + if (len < alloc_len) { /* NULL terminate the UNISTR */ str->buffer[len++] = '\0'; } @@ -1326,6 +1331,7 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *me /******************************************************************* hash a stream. ********************************************************************/ + BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16], int len) { char *q; @@ -1347,11 +1353,11 @@ BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16], int len) return True; } - /******************************************************************* Create a digest over the entire packet (including the data), and MD5 it with the session key. ********************************************************************/ + static void netsec_digest(struct netsec_auth_struct *a, int auth_flags, RPC_AUTH_NETSEC_CHK * verf, @@ -1383,6 +1389,7 @@ static void netsec_digest(struct netsec_auth_struct *a, /******************************************************************* Calculate the key with which to encode the data payload ********************************************************************/ + static void netsec_get_sealing_key(struct netsec_auth_struct *a, RPC_AUTH_NETSEC_CHK *verf, uchar sealing_key[16]) @@ -1410,6 +1417,7 @@ static void netsec_get_sealing_key(struct netsec_auth_struct *a, /******************************************************************* Encode or Decode the sequence number (which is symmetric) ********************************************************************/ + static void netsec_deal_with_seq_num(struct netsec_auth_struct *a, RPC_AUTH_NETSEC_CHK *verf) { @@ -1432,6 +1440,7 @@ static void netsec_deal_with_seq_num(struct netsec_auth_struct *a, /******************************************************************* creates an RPC_AUTH_NETSEC_CHK structure. ********************************************************************/ + static BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, const uchar sig[8], const uchar packet_digest[8], @@ -1448,13 +1457,13 @@ static BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, return True; } - /******************************************************************* Encode a blob of data using the netsec (schannel) alogrithm, also produceing a checksum over the original data. We currently only support signing and sealing togeather - the signing-only code is close, but not quite compatible with what MS does. ********************************************************************/ + void netsec_encode(struct netsec_auth_struct *a, int auth_flags, enum netsec_direction direction, RPC_AUTH_NETSEC_CHK * verf, -- cgit From bd22606da04bffd3b4966c17ad2c98e6dc8b5e35 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 10 Jan 2005 20:33:41 +0000 Subject: r4656: Convert the winreg pipe to use WERROR returns (as it should). Also fix return of NT_STATUS_NO_MORE_ENTRIES should be ERROR_NO_MORE_ITEMS reported by "Marcin Porwit" . Jeremy. (This used to be commit 511cdec60d431d767fb02f68ca5ddd4ddb59e64a) --- source3/rpc_parse/parse_reg.c | 50 +++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 69c0dfc754..a67a3973b9 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -107,7 +107,7 @@ BOOL reg_io_r_open_hkcr(const char *desc, REG_R_OPEN_HKCR *r_r, prs_struct *ps, if(!smb_io_pol_hnd("", &r_r->pol, ps, depth)) return False; - if(!prs_ntstatus("status", ps, depth, &r_r->status)) + if(!prs_werror("status", ps, depth, &r_r->status)) return False; return True; @@ -176,7 +176,7 @@ BOOL reg_io_r_open_hklm(const char *desc, REG_R_OPEN_HKLM * r_r, prs_struct *ps, if (!smb_io_pol_hnd("", &r_r->pol, ps, depth)) return False; - if (!prs_ntstatus("status", ps, depth, &r_r->status)) + if (!prs_werror("status", ps, depth, &r_r->status)) return False; return True; @@ -230,7 +230,7 @@ BOOL reg_io_r_flush_key(const char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_r->status)) + if(!prs_werror("status", ps, depth, &r_r->status)) return False; return True; @@ -380,7 +380,7 @@ BOOL reg_io_r_create_key(const char *desc, REG_R_CREATE_KEY *r_r, prs_struct *p if(!prs_uint32("unknown", ps, depth, &r_r->unknown)) return False; - if(!prs_ntstatus("status", ps, depth, &r_r->status)) + if(!prs_werror("status", ps, depth, &r_r->status)) return False; return True; @@ -446,7 +446,7 @@ BOOL reg_io_r_delete_val(const char *desc, REG_R_DELETE_VALUE *r_r, prs_struct if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_r->status)) + if(!prs_werror("status", ps, depth, &r_r->status)) return False; return True; @@ -510,7 +510,7 @@ BOOL reg_io_r_delete_key(const char *desc, REG_R_DELETE_KEY *r_r, prs_struct *p if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_r->status)) + if(!prs_werror("status", ps, depth, &r_r->status)) return False; return True; @@ -597,7 +597,7 @@ BOOL reg_io_r_query_key(const char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, if(!smb_io_time("mod_time ", &r_r->mod_time, ps, depth)) return False; - if(!prs_ntstatus("status", ps, depth, &r_r->status)) + if(!prs_werror("status", ps, depth, &r_r->status)) return False; return True; @@ -651,7 +651,7 @@ BOOL reg_io_r_unknown_1a(const char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *p if(!prs_uint32("unknown", ps, depth, &r_r->unknown)) return False; - if(!prs_ntstatus("status" , ps, depth, &r_r->status)) + if(!prs_werror("status" , ps, depth, &r_r->status)) return False; return True; @@ -702,7 +702,7 @@ BOOL reg_io_r_save_key(const char *desc, REG_R_SAVE_KEY *r_r, prs_struct *ps, i if(!prs_align(ps)) return False; - if(!prs_ntstatus("status" , ps, depth, &r_r->status)) + if(!prs_werror("status" , ps, depth, &r_r->status)) return False; return True; @@ -768,7 +768,7 @@ BOOL reg_io_r_open_hku(const char *desc, REG_R_OPEN_HKU *r_r, prs_struct *ps, i if(!smb_io_pol_hnd("", &r_r->pol, ps, depth)) return False; - if(!prs_ntstatus("status", ps, depth, &r_r->status)) + if(!prs_werror("status", ps, depth, &r_r->status)) return False; return True; @@ -828,7 +828,7 @@ BOOL reg_io_r_close(const char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int dep if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_u->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -893,7 +893,7 @@ BOOL reg_io_r_set_key_sec(const char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct * if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_q->status)) + if(!prs_werror("status", ps, depth, &r_q->status)) return False; return True; @@ -991,7 +991,7 @@ BOOL reg_io_r_get_key_sec(const char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct return False; } - if(!prs_ntstatus("status", ps, depth, &r_q->status)) + if(!prs_werror("status", ps, depth, &r_q->status)) return False; return True; @@ -1092,7 +1092,7 @@ BOOL reg_io_q_info(const char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth ********************************************************************/ BOOL new_init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r, - REGISTRY_VALUE *val, NTSTATUS status) + REGISTRY_VALUE *val, WERROR status) { uint32 buf_len = 0; BUFFER2 buf2; @@ -1136,7 +1136,7 @@ BOOL new_init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r, ********************************************************************/ BOOL init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r, - BUFFER2* buf, uint32 type, NTSTATUS status) + BUFFER2* buf, uint32 type, WERROR status) { if(r_r == NULL) return False; @@ -1210,7 +1210,7 @@ BOOL reg_io_r_info(const char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) return False; } - if(!prs_ntstatus("status", ps, depth, &r_r->status)) + if(!prs_werror("status", ps, depth, &r_r->status)) return False; return True; @@ -1394,7 +1394,7 @@ BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, return False; } - if(!prs_ntstatus("status", ps, depth, &r_q->status)) + if(!prs_werror("status", ps, depth, &r_q->status)) return False; return True; @@ -1469,7 +1469,7 @@ BOOL reg_io_r_create_val(const char *desc, REG_R_CREATE_VALUE *r_q, prs_struct if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_q->status)) + if(!prs_werror("status", ps, depth, &r_q->status)) return False; return True; @@ -1625,7 +1625,7 @@ BOOL reg_io_r_enum_key(const char *desc, REG_R_ENUM_KEY *r_q, prs_struct *ps, i return False; } - if(!prs_ntstatus("status", ps, depth, &r_q->status)) + if(!prs_werror("status", ps, depth, &r_q->status)) return False; return True; @@ -1685,14 +1685,14 @@ BOOL reg_io_q_open_entry(const char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *p ********************************************************************/ void init_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r, - POLICY_HND *pol, NTSTATUS status) + POLICY_HND *pol, WERROR werr) { - if (NT_STATUS_IS_OK(status)) { + if (W_ERROR_IS_OK(werr)) { memcpy(&r_r->pol, pol, sizeof(r_r->pol)); } else { ZERO_STRUCT(r_r->pol); } - r_r->status = status; + r_r->status = werr; } /******************************************************************* @@ -1713,7 +1713,7 @@ BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *p if(!smb_io_pol_hnd("", &r_r->pol, ps, depth)) return False; - if(!prs_ntstatus("status", ps, depth, &r_r->status)) + if(!prs_werror("status", ps, depth, &r_r->status)) return False; return True; @@ -1794,7 +1794,7 @@ BOOL reg_io_r_shutdown(const char *desc, REG_R_SHUTDOWN * r_s, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_s->status)) + if(!prs_werror("status", ps, depth, &r_s->status)) return False; return True; @@ -1849,7 +1849,7 @@ BOOL reg_io_r_abort_shutdown(const char *desc, REG_R_ABORT_SHUTDOWN * r_s, if (!prs_align(ps)) return False; - if (!prs_ntstatus("status", ps, depth, &r_s->status)) + if (!prs_werror("status", ps, depth, &r_s->status)) return False; return True; -- cgit From 08a9d98cdecfd8cac2a5b72130e30a711eddb050 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 11 Jan 2005 02:53:00 +0000 Subject: r4668: allow the caller to invoke init_unistr2() with a NULL buffer to match previous behavior; more checks to come tomorrow (This used to be commit 9a29bef056f92ef6f1df01f56c121088f84be16b) --- source3/rpc_parse/parse_misc.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index b53f9ec98c..bca40a64c8 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -895,7 +895,15 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) if (buf) { /* We always null terminate the copy. */ len = strlen(buf) + 1; + } else { + /* no buffer -- nothing to do */ + str->uni_max_len = 0; + str->offset = 0; + str->uni_str_len = 0; + + return; } + str->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, len); if (str->buffer == NULL) { -- cgit From d94d87472ca2f3875caa146424caa178ce20274f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 13 Jan 2005 18:20:37 +0000 Subject: r4724: Add support for Windows privileges in Samba 3.0 (based on Simo's code in trunk). Rewritten with the following changes: * privilege set is based on a 32-bit mask instead of strings (plans are to extend this to a 64 or 128-bit mask before the next 3.0.11preX release). * Remove the privilege code from the passdb API (replication to come later) * Only support the minimum amount of privileges that make sense. * Rewrite the domain join checks to use the SeMachineAccountPrivilege instead of the 'is a member of "Domain Admins"?' check that started all this. Still todo: * Utilize the SePrintOperatorPrivilege in addition to the 'printer admin' parameter * Utilize the SeAddUserPrivilege for adding users and groups * Fix some of the hard coded _lsa_*() calls * Start work on enough of SAM replication to get privileges from one Samba DC to another. * Come up with some management tool for manipultaing privileges instead of user manager since it is buggy when run on a 2k client (haven't tried xp). Works ok on NT4. (This used to be commit 77c10ff9aa6414a31eece6dfec00793f190a9d6c) --- source3/rpc_parse/parse_lsa.c | 81 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 69 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index e2cb94c8fe..20ccc39ce0 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1650,6 +1650,61 @@ BOOL lsa_io_r_unk_get_connuser(const char *desc, LSA_R_UNK_GET_CONNUSER *r_c, pr 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 *r_c, 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", &r_c->pol, ps, depth)) + return False; + + if(!smb_io_dom_sid2("sid", &r_c->sid, ps, depth)) /* domain SID */ + return False; + + if(!prs_uint32("access", ps, depth, &r_c->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 *r_c, 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", &r_c->pol, ps, depth)) + return False; + + if(!prs_ntstatus("status", ps, depth, &r_c->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)); @@ -1804,13 +1859,15 @@ NTSTATUS init_lsa_r_enum_privsaccount(TALLOC_CTX *mem_ctx, LSA_R_ENUMPRIVSACCOUN r_u->ptr = 1; r_u->count = count; - if (!NT_STATUS_IS_OK(ret = init_priv_with_ctx(mem_ctx, &(r_u->set)))) + if ( !NT_STATUS_IS_OK(ret = privilege_set_init_by_ctx(mem_ctx, &(r_u->set))) ) return ret; - if (!NT_STATUS_IS_OK(ret = dupalloc_luid_attr(r_u->set->mem_ctx, &(r_u->set->set), set))) + r_u->set.count = count; + + if (!NT_STATUS_IS_OK(ret = dup_luid_attr(r_u->set.mem_ctx, &(r_u->set.set), set, count))) return ret; - DEBUG(10,("init_lsa_r_enum_privsaccount: %d %d privileges\n", r_u->count, r_u->set->count)); + DEBUG(10,("init_lsa_r_enum_privsaccount: %d privileges\n", r_u->count)); return ret; } @@ -1837,15 +1894,15 @@ BOOL lsa_io_r_enum_privsaccount(const char *desc, LSA_R_ENUMPRIVSACCOUNT *r_c, p /* malloc memory if unmarshalling here */ if (UNMARSHALLING(ps) && r_c->count != 0) { - if (!NT_STATUS_IS_OK(init_priv_with_ctx(ps->mem_ctx, &(r_c->set)))) + if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps->mem_ctx, &(r_c->set)))) return False; - if (!(r_c->set->set = PRS_ALLOC_MEM(ps,LUID_ATTR,r_c->count))) + if (!(r_c->set.set = PRS_ALLOC_MEM(ps,LUID_ATTR,r_c->count))) return False; } - if(!lsa_io_privilege_set(desc, r_c->set, ps, depth)) + if(!lsa_io_privilege_set(desc, &r_c->set, ps, depth)) return False; } @@ -2007,14 +2064,14 @@ BOOL lsa_io_q_addprivs(const char *desc, LSA_Q_ADDPRIVS *r_c, prs_struct *ps, in return False; if (UNMARSHALLING(ps) && r_c->count!=0) { - if (!NT_STATUS_IS_OK(init_priv_with_ctx(ps->mem_ctx, &(r_c->set)))) + if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps->mem_ctx, &(r_c->set)))) return False; - if (!(r_c->set->set = PRS_ALLOC_MEM(ps, LUID_ATTR, r_c->count))) + if (!(r_c->set.set = PRS_ALLOC_MEM(ps, LUID_ATTR, r_c->count))) return False; } - if(!lsa_io_privilege_set(desc, r_c->set, ps, depth)) + if(!lsa_io_privilege_set(desc, &r_c->set, ps, depth)) return False; return True; @@ -2069,14 +2126,14 @@ BOOL lsa_io_q_removeprivs(const char *desc, LSA_Q_REMOVEPRIVS *r_c, prs_struct * return False; if (UNMARSHALLING(ps) && r_c->count!=0) { - if (!NT_STATUS_IS_OK(init_priv_with_ctx(ps->mem_ctx, &(r_c->set)))) + if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps->mem_ctx, &(r_c->set)))) return False; - if (!(r_c->set->set = PRS_ALLOC_MEM(ps, LUID_ATTR, r_c->count))) + if (!(r_c->set.set = PRS_ALLOC_MEM(ps, LUID_ATTR, r_c->count))) return False; } - if(!lsa_io_privilege_set(desc, r_c->set, ps, depth)) + if(!lsa_io_privilege_set(desc, &r_c->set, ps, depth)) return False; } -- cgit From c727866172b5abb1cab0913eb78f3f1d58fcb9aa Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 15 Jan 2005 02:20:30 +0000 Subject: r4742: add server support for lsa_add/remove_account_rights() and fix some parsing bugs related to that code (This used to be commit 7bf1312287cc1ec6b97917ba25fc60d6db09f26c) --- source3/rpc_parse/parse_lsa.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 20ccc39ce0..a4a3917d2e 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2359,7 +2359,7 @@ void init_q_add_acct_rights(LSA_Q_ADD_ACCT_RIGHTS *q_q, q_q->pol = *hnd; init_dom_sid2(&q_q->sid, sid); init_unistr2_array(&q_q->rights, count, rights); - q_q->count = 5; + q_q->count = count; } @@ -2377,7 +2377,7 @@ BOOL lsa_io_q_add_acct_rights(const char *desc, LSA_Q_ADD_ACCT_RIGHTS *q_q, prs_ if(!smb_io_dom_sid2("sid", &q_q->sid, ps, depth)) return False; - if(!prs_uint32("count", ps, depth, &q_q->rights.count)) + if(!prs_uint32("count", ps, depth, &q_q->count)) return False; if(!smb_io_unistr2_array("rights", &q_q->rights, ps, depth)) @@ -2417,7 +2417,7 @@ void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *q_q, init_dom_sid2(&q_q->sid, sid); q_q->removeall = removeall; init_unistr2_array(&q_q->rights, count, rights); - q_q->count = 5; + q_q->count = count; } @@ -2438,7 +2438,7 @@ BOOL lsa_io_q_remove_acct_rights(const char *desc, LSA_Q_REMOVE_ACCT_RIGHTS *q_q if(!prs_uint32("removeall", ps, depth, &q_q->removeall)) return False; - if(!prs_uint32("count", ps, depth, &q_q->rights.count)) + if(!prs_uint32("count", ps, depth, &q_q->count)) return False; if(!smb_io_unistr2_array("rights", &q_q->rights, ps, depth)) -- cgit From ff909274787a92fcdb0ed36bab097f7d2ae07036 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 15 Jan 2005 03:54:03 +0000 Subject: r4746: add server support for lsa_enum_acct_rights(); last checkin for the night (This used to be commit ccdff4a998405544433aa32938963e4c37962fcc) --- source3/rpc_parse/parse_lsa.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index a4a3917d2e..c4ff240cef 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2299,6 +2299,33 @@ void init_q_enum_acct_rights(LSA_Q_ENUM_ACCT_RIGHTS *q_q, init_dom_sid2(&q_q->sid, sid); } +/******************************************************************* +********************************************************************/ +NTSTATUS init_r_enum_acct_rights( LSA_R_ENUM_ACCT_RIGHTS *r_u, PRIVILEGE_SET *privileges ) +{ + uint32 i; + char *privname; + const char **privname_array = NULL; + int num_priv = 0; + + for ( i=0; icount; i++ ) { + privname = luid_to_privilege_name( &privileges->set[i].luid ); + if ( privname ) { + if ( !add_string_to_array( get_talloc_ctx(), privname, &privname_array, &num_priv ) ) + return NT_STATUS_NO_MEMORY; + } + } + + if ( num_priv ) { + if ( !init_unistr2_array( &r_u->rights, num_priv, privname_array ) ) + return NT_STATUS_NO_MEMORY; + + r_u->count = num_priv; + } + + return NT_STATUS_OK; +} + /******************************************************************* reads or writes a LSA_Q_ENUM_ACCT_RIGHTS structure. ********************************************************************/ -- cgit From 725edd20f1589be310a8d1bab7a0aa907a55416e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 20 Jan 2005 16:51:24 +0000 Subject: r4868: Add "net rpc user RENAME"-command. Note that Samba3 does not yet support it server-side. Guenther (This used to be commit b2c8220931733593fd312fc25b6c73f440b4567a) --- source3/rpc_parse/parse_samr.c | 53 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 8d5fee68e0..748ee1fb7c 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5206,6 +5206,44 @@ static BOOL sam_io_user_info12(const char *desc, SAM_USER_INFO_12 * u, 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_10 structure. ********************************************************************/ @@ -6277,7 +6315,7 @@ NTSTATUS make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr, uint16 switch_value, SAM_USER_INFO_21 * usr) { - DEBUG(5, ("init_samr_userinfo_ctr\n")); + DEBUG(5, ("make_samr_userinfo_ctr_usr21\n")); ctr->switch_value = switch_value; ctr->info.id = NULL; @@ -6360,8 +6398,10 @@ static void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, DATA_BLOB *sess_key, dump_data(100, (char *)sess_key->data, sess_key->length); dump_data(100, (char *)ctr->info.id23->pass, 516); break; + case 0x07: + break; default: - DEBUG(4,("init_samr_userinfo_ctr: unsupported switch level\n")); + DEBUG(4,("init_samr_userinfo_ctr: unsupported switch level: %d\n", switch_value)); } } @@ -6397,6 +6437,15 @@ static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, ret = False; switch (ctr->switch_value) { + case 0x07: + 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 0x10: if (UNMARSHALLING(ps)) ctr->info.id10 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_10,1); -- cgit From b3b315078e747c37b5330def90f2103ab1a549fb Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 20 Jan 2005 18:31:11 +0000 Subject: r4875: Fix for bugid #221, inspired by Mrinal Kalakrishnan . NT sometimes send garbage bytes in NT security descriptor linearizations when sending well-known sids. Cope with these. Jeremy. (This used to be commit 51b34bb536fdb18c99da1e151eba03ea634e0449) --- source3/rpc_parse/parse_sec.c | 82 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 69 insertions(+), 13 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 8656b8f5d8..f6fdf10292 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -3,7 +3,7 @@ * Version 1.9. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1998, - * Copyright (C) Jeremy R. Allison 1995-2003. + * Copyright (C) Jeremy R. Allison 1995-2005. * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, * Copyright (C) Paul Ashton 1997-1998. * @@ -94,8 +94,24 @@ BOOL sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth) return False; } + /* Theorectically an ACE can have a size greater than the + sum of its components. When marshalling, pad with extra null bytes up to the + correct size. */ + + if (MARSHALLING(ps) && (psa->size > prs_offset(ps) - old_offset)) { + uint32 extra_len = psa->size - (prs_offset(ps) - old_offset); + uint32 i; + uint8 c = 0; + + for (i = 0; i < extra_len; i++) { + if (!prs_uint8("ace extra space", ps, depth, &c)) + return False; + } + } + if(!prs_uint16_post("size ", ps, depth, &psa->size, offset_ace_size, old_offset)) return False; + return True; } @@ -165,6 +181,20 @@ BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) return False; } + /* Theorectically an ACL can have a size greater than the + sum of its components. When marshalling, pad with extra null bytes up to the + correct size. */ + + if (MARSHALLING(ps) && (psa->size > prs_offset(ps) - old_offset)) { + uint32 extra_len = psa->size - (prs_offset(ps) - old_offset); + uint8 c = 0; + + for (i = 0; i < extra_len; i++) { + if (!prs_uint8("acl extra space", ps, depth, &c)) + return False; + } + } + if(!prs_uint16_post("size ", ps, depth, &psa->size, offset_acl_size, old_offset)) return False; @@ -181,7 +211,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) uint32 old_offset; uint32 max_offset = 0; /* after we're done, move offset to end */ uint32 tmp_offset = 0; - + SEC_DESC *psd; if (ppsd == NULL) @@ -203,16 +233,6 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "sec_io_desc"); depth++; -#if 0 - /* - * if alignment is needed, should be done by the the - * caller. Not here. This caused me problems when marshalling - * printer info into a buffer. --jerry - */ - if(!prs_align(ps)) - return False; -#endif - /* start of security descriptor stored for back-calc offset purposes */ old_offset = prs_offset(ps); @@ -222,6 +242,42 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if(!prs_uint16("type ", ps, depth, &psd->type)) return False; + if (MARSHALLING(ps)) { + uint32 offset = SEC_DESC_HEADER_SIZE; + + /* + * Work out the offsets here, as we write it out. + */ + + if (psd->sacl != NULL) { + psd->off_sacl = offset; + offset += psd->sacl->size; + } else { + psd->off_sacl = 0; + } + + if (psd->dacl != NULL) { + psd->off_dacl = offset; + offset += psd->dacl->size; + } else { + psd->off_dacl = 0; + } + + if (psd->owner_sid != NULL) { + psd->off_owner_sid = offset; + offset += sid_size(psd->owner_sid); + } else { + psd->off_owner_sid = 0; + } + + if (psd->grp_sid != NULL) { + psd->off_grp_sid = offset; + offset += sid_size(psd->grp_sid); + } else { + psd->off_grp_sid = 0; + } + } + if(!prs_uint32("off_owner_sid", ps, depth, &psd->off_owner_sid)) return False; @@ -289,7 +345,6 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) return False; } - if ((psd->type & SEC_DESC_DACL_PRESENT) && psd->off_dacl != 0) { tmp_offset = prs_offset(ps); if(!prs_set_offset(ps, old_offset + psd->off_dacl)) @@ -303,6 +358,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if(!prs_set_offset(ps, max_offset)) return False; + return True; } -- cgit From fcfc94a66ac66af1f12cb5924df31e936bca3dc9 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 23 Jan 2005 14:10:57 +0000 Subject: r4946: Our notion the other_sids in the info3 SamLogon struct was ...hmmm... completely bogus. This does not affect us as a domain controller, as we never set other_sids, but I have *no* idea how winbind got away with it. Please review thoroughly, samba4 idl looks closer to reality here. Test case: Member of w2k3 domain, authenticate as a user who is member of one or more domain local groups. Easiest review with 'client schannel = no'. Thanks, Volker (This used to be commit a0a6388830d9457de3e42686c64bddeba42954f8) --- source3/rpc_parse/parse_net.c | 45 +++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 5f1d4b622e..b26083b89e 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1646,31 +1646,52 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, if(!smb_io_dom_sid2("", &usr->dom_sid, ps, depth)) /* domain SID */ return False; - if (usr->num_other_sids) { + if (usr->buffer_other_sids) { + + uint32 num_other_sids = usr->num_other_sids; + + 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)) { usr->other_sids = PRS_ALLOC_MEM(ps, DOM_SID2, usr->num_other_sids); - if (usr->other_sids == NULL) + usr->other_sids_attrib = + PRS_ALLOC_MEM(ps, uint32, usr->num_other_sids); + + if ((num_other_sids != 0) && + ((usr->other_sids == NULL) || + (usr->other_sids_attrib == NULL))) return False; } - - if(!prs_uint32("num_other_groups", ps, depth, &usr->num_other_groups)) - return False; - if (UNMARSHALLING(ps) && usr->num_other_groups > 0) { - usr->other_gids = PRS_ALLOC_MEM(ps, DOM_GID, usr->num_other_groups); - if (usr->other_gids == NULL) + /* First the pointers to the SIDS and attributes */ + + depth++; + + for (i=0; inum_other_sids; i++) { + uint32 ptr = 1; + + if (!prs_uint32("sid_ptr", ps, depth, &ptr)) return False; - } - - for (i = 0; i < usr->num_other_groups; i++) { - if(!smb_io_gid("", &usr->other_gids[i], ps, depth)) /* other GIDs */ + + 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; -- cgit From c23c9bfd67fb3ebf6aeef243af8a93b1be867369 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 31 Jan 2005 08:29:51 +0000 Subject: r5125: Fix bug 2113 -- thanks to jason@ncac.gwu.edu (This used to be commit 0c205bcc864c8dc01124a5d654792de0cbf79a63) --- source3/rpc_parse/parse_lsa.c | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index c4ff240cef..e38197ddba 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -214,16 +214,12 @@ static void init_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS static BOOL lsa_io_obj_attr(const char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int depth) { - uint32 start; - prs_debug(ps, depth, desc, "lsa_io_obj_attr"); 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! */ @@ -240,15 +236,6 @@ static BOOL lsa_io_obj_attr(const char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps if(!prs_uint32("ptr_sec_qos ", ps, depth, &attr->ptr_sec_qos )) /* security quality of service (pointer) */ return False; - /* code commented out as it's not necessary true (tested with hyena). JFM, 11/22/2001 */ -#if 0 - if (attr->len != prs_offset(ps) - start) { - DEBUG(3,("lsa_io_obj_attr: length %x does not match size %x\n", - attr->len, prs_offset(ps) - start)); - return False; - } -#endif - if (attr->ptr_sec_qos != 0) { if (UNMARSHALLING(ps)) if (!(attr->sec_qos = PRS_ALLOC_MEM(ps,LSA_SEC_QOS,1))) -- cgit From e98f56373bca0efc200bc3a4263477e1790a746b Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Feb 2005 14:14:44 +0000 Subject: r5262: Fix server_role in the samr_query_dom_info calls. When we are a BDC we should not say we are a PDC. Guenther (This used to be commit 6cdf3b97de2c28ac92f972621b0ce04c1c80cea5) --- source3/rpc_parse/parse_samr.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 748ee1fb7c..27570ae821 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -564,9 +564,9 @@ static BOOL sam_io_unk_info6(const char *desc, SAM_UNK_INFO_6 * u_6, inits a structure. ********************************************************************/ -void init_unk_info7(SAM_UNK_INFO_7 * u_7) +void init_unk_info7(SAM_UNK_INFO_7 * u_7, uint32 server_role) { - u_7->unknown_0 = 0x0003; + u_7->server_role = server_role; } /******************************************************************* @@ -582,7 +582,7 @@ static BOOL sam_io_unk_info7(const char *desc, SAM_UNK_INFO_7 * u_7, prs_debug(ps, depth, desc, "sam_io_unk_info7"); depth++; - if(!prs_uint16("unknown_0", ps, depth, &u_7->unknown_0)) /* 0x0003 */ + if(!prs_uint16("server_role", ps, depth, &u_7->server_role)) return False; return True; @@ -697,7 +697,7 @@ 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 seq_num, uint32 num_users, uint32 num_groups, uint32 num_alias, NTTIME nt_logout, uint32 server_role) { u_2->logout.low = nt_logout.low; u_2->logout.high = nt_logout.high; @@ -707,7 +707,7 @@ void init_unk_info2(SAM_UNK_INFO_2 * u_2, u_2->unknown_4 = 0x00000001; - u_2->unknown_5 = 0x00000003; + 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; @@ -754,7 +754,7 @@ static BOOL sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2, if(!prs_uint32("unknown_4 ", ps, depth, &u_2->unknown_4)) /* 0x0000 0001 */ return False; - if(!prs_uint32("unknown_5 ", ps, depth, &u_2->unknown_5)) /* 0x0000 0003 */ + 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; -- cgit From 8d06233d1115f56e586aa49a7871fbeb8b0ff76d Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 24 Feb 2005 03:45:09 +0000 Subject: r5536: Avoid intermediate copy of NT and LM responses in NETLOGON client. This copy was length-limited, which broke when the NTLMv2 response was more than 128 bytes in length. Andrew Bartlett (This used to be commit bae18aaaff7f9eff90db566b9a254a11d281aa01) --- source3/rpc_parse/parse_net.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index b26083b89e..d7bdca4df9 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1174,28 +1174,14 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, const uchar * lm_chal_resp, size_t lm_chal_resp_len, const uchar * nt_chal_resp, size_t nt_chal_resp_len) { - unsigned char lm_owf[24]; - unsigned char nt_owf[128]; 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); - if (nt_chal_resp) { - /* oops. can only send what-ever-it-is direct */ - memcpy(nt_owf, nt_chal_resp, MIN(sizeof(nt_owf), nt_chal_resp_len)); - nt_chal_resp = nt_owf; - } - if (lm_chal_resp) { - /* oops. can only send what-ever-it-is direct */ - memcpy(lm_owf, lm_chal_resp, MIN(sizeof(lm_owf), lm_chal_resp_len)); - lm_chal_resp = lm_owf; - } - 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); -- cgit From 180fa12026caef8f22154e0e7c60f9043b5588e2 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Sat, 26 Feb 2005 15:26:55 +0000 Subject: r5580: Fix "net rpc trustdom add". Much closer to what windows does. Also stop referencing unknown_6 from sam, because it's just fixed at 1260, the max len of LOGON_HRS. Need to go in and mark it as "remove me" from passdb. (This used to be commit ffac752875938d510446ebbeba6fc983f65cda1e) --- source3/rpc_parse/parse_samr.c | 60 +++++++++++++----------------------------- 1 file changed, 18 insertions(+), 42 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 27570ae821..14d4bb9fdf 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5148,6 +5148,12 @@ static BOOL sam_io_logon_hrs(const char *desc, LOGON_HRS * hrs, 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; @@ -5471,7 +5477,7 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z LOGON_HRS * hrs, uint16 bad_password_count, uint16 logon_count, - char newpass[516], uint32 unknown_6) + char newpass[516]) { usr->logon_time = *logon_time; /* all zeros */ usr->logoff_time = *logoff_time; /* all zeros */ @@ -5535,9 +5541,6 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z copy_unistr2(&usr->uni_munged_dial, mung_dial); init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); - usr->unknown_6 = unknown_6; /* 0x0000 04ec */ - usr->padding4 = 0; - memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs)); } @@ -5562,7 +5565,7 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z 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], uint32 unknown_6) + char newpass[516]) { DATA_BLOB blob = base64_decode_data_blob(mung_dial); @@ -5630,9 +5633,6 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z data_blob_free(&blob); - usr->unknown_6 = unknown_6; /* 0x0000 04ec */ - usr->padding4 = 0; - memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs)); } @@ -5757,16 +5757,9 @@ static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr, /* ok, this is only guess-work (as usual) */ if (usr->ptr_logon_hrs) { - if(!prs_uint32("unknown_6 ", ps, depth, &usr->unknown_6)) - return False; - if(!prs_uint32("padding4 ", ps, depth, &usr->padding4)) - return False; if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth)) return False; - } else if (UNMARSHALLING(ps)) { - usr->unknown_6 = 0; - usr->padding4 = 0; - } + } return True; } @@ -5876,16 +5869,9 @@ static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_str #if 0 /* JRA - unknown... */ /* ok, this is only guess-work (as usual) */ if (usr->ptr_logon_hrs) { - if(!prs_uint32("unknown_6 ", ps, depth, &usr->unknown_6)) - return False; - if(!prs_uint32("padding4 ", ps, depth, &usr->padding4)) - return False; if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth)) return False; - } else if (UNMARSHALLING(ps)) { - usr->unknown_6 = 0; - usr->padding4 = 0; - } + } #endif return True; @@ -5925,8 +5911,7 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, uint16 logon_divs, LOGON_HRS * hrs, uint16 bad_password_count, - uint16 logon_count, - uint32 unknown_6) + uint16 logon_count) { usr->logon_time = *logon_time; usr->logoff_time = *logoff_time; @@ -5987,9 +5972,6 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, copy_unistr2(&usr->uni_munged_dial, mung_dial); init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); - usr->unknown_6 = unknown_6; /* 0x0000 04ec */ - usr->padding4 = 0; - memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs)); } @@ -6136,14 +6118,17 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); data_blob_free(&munged_dial_blob); - usr->unknown_6 = pdb_get_unknown_6(pw); - usr->padding4 = 0; - 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 + } 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; } @@ -6256,17 +6241,8 @@ static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, /* ok, this is only guess-work (as usual) */ if (usr->ptr_logon_hrs) { - if(!prs_align(ps)) - return False; - if(!prs_uint32("unknown_6 ", ps, depth, &usr->unknown_6)) - return False; - if(!prs_uint32("padding4 ", ps, depth, &usr->padding4)) - return False; if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth)) return False; - } else if (UNMARSHALLING(ps)) { - usr->unknown_6 = 0; - usr->padding4 = 0; } return True; -- cgit From 66df8431ec092c4e629fc07e8e5a242ff3821b2d Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 10 Mar 2005 18:50:47 +0000 Subject: r5726: merge LsaLookupPrivValue() code from trunk (This used to be commit 277203b5356af58ce62eb4eec0db2eccadeeffd6) --- source3/rpc_parse/parse_lsa.c | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index e38197ddba..bbff258722 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1981,20 +1981,38 @@ BOOL lsa_io_r_setsystemaccount(const char *desc, LSA_R_SETSYSTEMACCOUNT *r_c, p } -void init_lsa_q_lookupprivvalue(LSA_Q_LOOKUPPRIVVALUE *trn, POLICY_HND *hnd, const char *name) +static void init_lsa_string( LSA_STRING *uni, const char *string ) { - memcpy(&trn->pol, hnd, sizeof(trn->pol)); - init_unistr2(&trn->uni2_right, name, UNI_FLAGS_NONE); - init_uni_hdr(&trn->hdr_right, &trn->uni2_right); + 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_LOOKUPPRIVVALUE structure. + Reads or writes an LSA_Q_LOOKUP_PRIV_VALUE structure. ********************************************************************/ -BOOL lsa_io_q_lookupprivvalue(const char *desc, LSA_Q_LOOKUPPRIVVALUE *r_c, prs_struct *ps, int depth) +BOOL lsa_io_q_lookup_priv_value(const char *desc, LSA_Q_LOOKUP_PRIV_VALUE *r_c, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, "lsa_io_q_lookupprivvalue"); + prs_debug(ps, depth, desc, "lsa_io_q_lookup_priv_value"); depth++; if(!prs_align(ps)) @@ -2002,21 +2020,19 @@ BOOL lsa_io_q_lookupprivvalue(const char *desc, LSA_Q_LOOKUPPRIVVALUE *r_c, prs if(!smb_io_pol_hnd("pol", &r_c->pol, ps, depth)) return False; - if(!smb_io_unihdr ("hdr_name", &r_c->hdr_right, ps, depth)) - return False; - if(!smb_io_unistr2("uni2_right", &r_c->uni2_right, r_c->hdr_right.buffer, ps, depth)) + if(!smb_io_lsa_string("privname", &r_c->privname, ps, depth)) return False; return True; } /******************************************************************* - Reads or writes an LSA_R_LOOKUPPRIVVALUE structure. + Reads or writes an LSA_R_LOOKUP_PRIV_VALUE structure. ********************************************************************/ -BOOL lsa_io_r_lookupprivvalue(const char *desc, LSA_R_LOOKUPPRIVVALUE *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_lookup_priv_value(const char *desc, LSA_R_LOOKUP_PRIV_VALUE *r_c, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, "lsa_io_r_lookupprivvalue"); + prs_debug(ps, depth, desc, "lsa_io_r_lookup_priv_value"); depth++; if(!prs_align(ps)) @@ -2271,7 +2287,6 @@ BOOL lsa_io_r_query_info2(const char *desc, LSA_R_QUERY_INFO2 *r_c, return True; } - /******************************************************************* Inits an LSA_Q_ENUM_ACCT_RIGHTS structure. ********************************************************************/ -- cgit From 61dfab9f705cb38e552dcec1822974433997543c Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 15 Mar 2005 19:43:44 +0000 Subject: r5805: merging spoolss parsing changes from trunk and cleaning up resulting segvs (This used to be commit 25121547caaaed0d60f4db7458570c14e7d21b2a) --- source3/rpc_parse/parse_buffer.c | 512 +++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_misc.c | 19 ++ source3/rpc_parse/parse_prs.c | 28 ++ source3/rpc_parse/parse_sec.c | 2 +- source3/rpc_parse/parse_spoolss.c | 554 +++++--------------------------------- 5 files changed, 627 insertions(+), 488 deletions(-) create mode 100644 source3/rpc_parse/parse_buffer.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c new file mode 100644 index 0000000000..d3584c3954 --- /dev/null +++ b/source3/rpc_parse/parse_buffer.c @@ -0,0 +1,512 @@ +/* + * 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) Jean Franois Micouleau 1998-2000, + * Copyright (C) Gerald Carter 2000-2005, + * Copyright (C) Tim Potter 2001-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 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + +/********************************************************************** + Initialize a new spoolss buff for use by a client rpc +**********************************************************************/ +void rpcbuf_init(RPC_BUFFER *buffer, uint32 size, TALLOC_CTX *ctx) +{ +#if 0 + buffer->ptr = (size != 0); +#endif + buffer->size = size; + buffer->string_at_end = size; + prs_init(&buffer->prs, size, ctx, MARSHALL); + buffer->struct_start = prs_offset(&buffer->prs); +} + +/******************************************************************* + Read/write a RPC_BUFFER struct. +********************************************************************/ + +BOOL prs_rpcbuffer(const char *desc, prs_struct *ps, int depth, RPC_BUFFER *buffer) +{ + prs_debug(ps, depth, desc, "prs_rpcbuffer"); + depth++; + + /* reading */ + if (UNMARSHALLING(ps)) { + buffer->size=0; + buffer->string_at_end=0; + +#if 0 + if (buffer->ptr==0) { + /* + * JRA. I'm not sure if the data in here is in big-endian format if + * the client is big-endian. Leave as default (little endian) for now. + */ + + if (!prs_init(&buffer->prs, 0, prs_get_mem_context(ps), UNMARSHALL)) + return False; + return True; + } +#endif + + if (!prs_uint32("size", ps, depth, &buffer->size)) + return False; + + /* + * JRA. I'm not sure if the data in here is in big-endian format if + * the client is big-endian. Leave as default (little endian) for now. + */ + + if (!prs_init(&buffer->prs, buffer->size, prs_get_mem_context(ps), UNMARSHALL)) + return False; + + if (!prs_append_some_prs_data(&buffer->prs, ps, prs_offset(ps), buffer->size)) + return False; + + if (!prs_set_offset(&buffer->prs, 0)) + return False; + + if (!prs_set_offset(ps, buffer->size+prs_offset(ps))) + return False; + + buffer->string_at_end=buffer->size; + + return True; + } + else { + BOOL ret = False; + +#if 0 + /* writing */ + if (buffer->ptr==0) { + /* We have finished with the data in buffer->prs - free it. */ + prs_mem_free(&buffer->prs); + return True; + } +#endif + + if (!prs_uint32("size", ps, depth, &buffer->size)) + goto out; + + if (!prs_append_some_prs_data(ps, &buffer->prs, 0, buffer->size)) + goto out; + + ret = True; + out: + + /* We have finished with the data in buffer->prs - free it. */ + prs_mem_free(&buffer->prs); + + return ret; + } +} + +/******************************************************************* + Read/write an RPC_BUFFER* struct.(allocate memory if unmarshalling) +********************************************************************/ + +BOOL prs_rpcbuffer_p(const char *desc, prs_struct *ps, int depth, RPC_BUFFER **buffer) +{ + uint32 data_p; + + /* caputure the pointer value to stream */ + + data_p = (uint32) *buffer; + + if ( !prs_uint32("ptr", ps, depth, &data_p )) + return False; + + /* we're done if there is no data */ + + if ( !data_p ) + return True; + + if ( UNMARSHALLING(ps) ) { + if ( !(*buffer = PRS_ALLOC_MEM(ps, RPC_BUFFER, 1)) ) + return False; + } + + return prs_rpcbuffer( desc, ps, depth, *buffer); +} + +/**************************************************************************** + Allocate more memory for a RPC_BUFFER. +****************************************************************************/ + +BOOL rpcbuf_alloc_size(RPC_BUFFER *buffer, uint32 buffer_size) +{ + prs_struct *ps; + uint32 extra_space; + uint32 old_offset; + + ps= &buffer->prs; + + /* damn, I'm doing the reverse operation of prs_grow() :) */ + if (buffer_size < prs_data_size(ps)) + extra_space=0; + else + extra_space = buffer_size - prs_data_size(ps); + + /* + * save the offset and move to the end of the buffer + * prs_grow() checks the extra_space against the offset + */ + old_offset=prs_offset(ps); + prs_set_offset(ps, prs_data_size(ps)); + + if (!prs_grow(ps, extra_space)) + return False; + + prs_set_offset(ps, old_offset); + + buffer->string_at_end=prs_data_size(ps); + + return True; +} + +/******************************************************************* + move a BUFFER from the query to the reply. + As the data pointers in RPC_BUFFER are malloc'ed, not talloc'ed, + this is ok. This is an OPTIMIZATION and is not strictly neccessary. + Clears the memory to zero also. +********************************************************************/ + +void rpcbuf_move(RPC_BUFFER *src, RPC_BUFFER **dest) +{ + if ( !src ) + return; + + prs_switch_type(&src->prs, MARSHALL); + if(!prs_set_offset(&src->prs, 0)) + return; + prs_force_dynamic(&src->prs); + prs_mem_clear(&src->prs); + *dest=src; +} + +/******************************************************************* + Get the size of a BUFFER struct. +********************************************************************/ + +uint32 rpcbuf_get_size(RPC_BUFFER *buffer) +{ + return (buffer->size); +} + + +/******************************************************************* + * write a UNICODE string and its relative pointer. + * used by all the RPC structs passing a buffer + * + * As I'm a nice guy, I'm forcing myself to explain this code. + * MS did a good job in the overall spoolss code except in some + * functions where they are passing the API buffer directly in the + * RPC request/reply. That's to maintain compatiility at the API level. + * They could have done it the good way the first time. + * + * So what happen is: the strings are written at the buffer's end, + * in the reverse order of the original structure. Some pointers to + * the strings are also in the buffer. Those are relative to the + * buffer's start. + * + * If you don't understand or want to change that function, + * first get in touch with me: jfm@samba.org + * + ********************************************************************/ + +BOOL smb_io_relstr(const char *desc, RPC_BUFFER *buffer, int depth, UNISTR *string) +{ + prs_struct *ps=&buffer->prs; + + if (MARSHALLING(ps)) { + uint32 struct_offset = prs_offset(ps); + uint32 relative_offset; + + buffer->string_at_end -= (size_of_relative_string(string) - 4); + if(!prs_set_offset(ps, buffer->string_at_end)) + return False; +#if 0 /* JERRY */ + /* + * Win2k does not align strings in a buffer + * Tested against WinNT 4.0 SP 6a & 2k SP2 --jerry + */ + if (!prs_align(ps)) + return False; +#endif + buffer->string_at_end = prs_offset(ps); + + /* write the string */ + if (!smb_io_unistr(desc, string, ps, depth)) + return False; + + if(!prs_set_offset(ps, struct_offset)) + return False; + + relative_offset=buffer->string_at_end - buffer->struct_start; + /* write its offset */ + if (!prs_uint32("offset", ps, depth, &relative_offset)) + return False; + } + else { + uint32 old_offset; + + /* read the offset */ + if (!prs_uint32("offset", ps, depth, &(buffer->string_at_end))) + return False; + + if (buffer->string_at_end == 0) + return True; + + old_offset = prs_offset(ps); + if(!prs_set_offset(ps, buffer->string_at_end+buffer->struct_start)) + return False; + + /* read the string */ + if (!smb_io_unistr(desc, string, ps, depth)) + return False; + + if(!prs_set_offset(ps, old_offset)) + return False; + } + return True; +} + +/******************************************************************* + * write a array of UNICODE strings and its relative pointer. + * used by 2 RPC structs + ********************************************************************/ + +BOOL smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16 **string) +{ + UNISTR chaine; + + prs_struct *ps=&buffer->prs; + + if (MARSHALLING(ps)) { + uint32 struct_offset = prs_offset(ps); + uint32 relative_offset; + uint16 *p; + uint16 *q; + uint16 zero=0; + p=*string; + q=*string; + + /* first write the last 0 */ + buffer->string_at_end -= 2; + if(!prs_set_offset(ps, buffer->string_at_end)) + return False; + + if(!prs_uint16("leading zero", ps, depth, &zero)) + return False; + + while (p && (*p!=0)) { + while (*q!=0) + q++; + + /* Yes this should be malloc not talloc. Don't change. */ + + chaine.buffer = SMB_MALLOC((q-p+1)*sizeof(uint16)); + if (chaine.buffer == NULL) + return False; + + memcpy(chaine.buffer, p, (q-p+1)*sizeof(uint16)); + + buffer->string_at_end -= (q-p+1)*sizeof(uint16); + + if(!prs_set_offset(ps, buffer->string_at_end)) { + SAFE_FREE(chaine.buffer); + return False; + } + + /* write the string */ + if (!smb_io_unistr(desc, &chaine, ps, depth)) { + SAFE_FREE(chaine.buffer); + return False; + } + q++; + p=q; + + SAFE_FREE(chaine.buffer); + } + + if(!prs_set_offset(ps, struct_offset)) + return False; + + relative_offset=buffer->string_at_end - buffer->struct_start; + /* write its offset */ + if (!prs_uint32("offset", ps, depth, &relative_offset)) + return False; + + } else { + + /* UNMARSHALLING */ + + uint32 old_offset; + uint16 *chaine2=NULL; + int l_chaine=0; + int l_chaine2=0; + size_t realloc_size = 0; + + *string=NULL; + + /* read the offset */ + if (!prs_uint32("offset", ps, depth, &buffer->string_at_end)) + return False; + + old_offset = prs_offset(ps); + if(!prs_set_offset(ps, buffer->string_at_end + buffer->struct_start)) + return False; + + do { + if (!smb_io_unistr(desc, &chaine, ps, depth)) + return False; + + l_chaine=str_len_uni(&chaine); + + /* we're going to add two more bytes here in case this + is the last string in the array and we need to add + an extra NULL for termination */ + if (l_chaine > 0) + { + uint16 *tc2; + + realloc_size = (l_chaine2+l_chaine+2)*sizeof(uint16); + + /* Yes this should be realloc - it's freed below. JRA */ + + if((tc2=(uint16 *)SMB_REALLOC(chaine2, realloc_size)) == NULL) { + SAFE_FREE(chaine2); + return False; + } + else chaine2 = tc2; + memcpy(chaine2+l_chaine2, chaine.buffer, (l_chaine+1)*sizeof(uint16)); + l_chaine2+=l_chaine+1; + } + + } while(l_chaine!=0); + + /* the end should be bould NULL terminated so add + the second one here */ + if (chaine2) + { + chaine2[l_chaine2] = '\0'; + *string=(uint16 *)TALLOC_MEMDUP(prs_get_mem_context(ps),chaine2,realloc_size); + SAFE_FREE(chaine2); + } + + if(!prs_set_offset(ps, old_offset)) + return False; + } + return True; +} + +/******************************************************************* + Parse a DEVMODE structure and its relative pointer. +********************************************************************/ + +BOOL smb_io_relsecdesc(const char *desc, RPC_BUFFER *buffer, int depth, SEC_DESC **secdesc) +{ + prs_struct *ps= &buffer->prs; + + prs_debug(ps, depth, desc, "smb_io_relsecdesc"); + depth++; + + if (MARSHALLING(ps)) { + uint32 struct_offset = prs_offset(ps); + uint32 relative_offset; + + if (! *secdesc) { + relative_offset = 0; + if (!prs_uint32("offset", ps, depth, &relative_offset)) + return False; + return True; + } + + if (*secdesc != NULL) { + buffer->string_at_end -= sec_desc_size(*secdesc); + + if(!prs_set_offset(ps, buffer->string_at_end)) + return False; + /* write the secdesc */ + if (!sec_io_desc(desc, secdesc, ps, depth)) + return False; + + if(!prs_set_offset(ps, struct_offset)) + return False; + } + + relative_offset=buffer->string_at_end - buffer->struct_start; + /* write its offset */ + + if (!prs_uint32("offset", ps, depth, &relative_offset)) + return False; + } else { + uint32 old_offset; + + /* read the offset */ + if (!prs_uint32("offset", ps, depth, &buffer->string_at_end)) + return False; + + old_offset = prs_offset(ps); + if(!prs_set_offset(ps, buffer->string_at_end + buffer->struct_start)) + return False; + + /* read the sd */ + if (!sec_io_desc(desc, secdesc, ps, depth)) + return False; + + if(!prs_set_offset(ps, old_offset)) + return False; + } + return True; +} + + + +/******************************************************************* + * return the length of a UNICODE string in number of char, includes: + * - the leading zero + * - the relative pointer size + ********************************************************************/ + +uint32 size_of_relative_string(UNISTR *string) +{ + uint32 size=0; + + size=str_len_uni(string); /* the string length */ + size=size+1; /* add the trailing zero */ + size=size*2; /* convert in char */ + size=size+4; /* add the size of the ptr */ + +#if 0 /* JERRY */ + /* + * Do not include alignment as Win2k does not align relative + * strings within a buffer --jerry + */ + /* Ensure size is 4 byte multiple (prs_align is being called...). */ + /* size += ((4 - (size & 3)) & 3); */ +#endif + + return size; +} + diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index bca40a64c8..dec20769b6 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1797,3 +1797,22 @@ BOOL make_bufhdr2(BUFHDR2 *hdr, uint32 info_level, uint32 length, uint32 buffer) return True; } + +/******************************************************************* +return the length of a UNISTR string. +********************************************************************/ + +uint32 str_len_uni(UNISTR *source) +{ + uint32 i=0; + + if (!source->buffer) + return 0; + + while (source->buffer[i]) + i++; + + return i; +} + + diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 4b78d373ba..566efae7a9 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -646,6 +646,34 @@ BOOL prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32) return True; } +/******************************************************************* + Stream a uint32* (allocate memory if unmarshalling) + ********************************************************************/ + +BOOL prs_uint32_p(const char *name, prs_struct *ps, int depth, uint32 **data32) +{ + uint32 data_p; + + /* caputure the pointer value to stream */ + + data_p = (uint32) *data32; + + if ( !prs_uint32("ptr", ps, depth, &data_p )) + return False; + + /* we're done if there is no data */ + + if ( !data_p ) + return True; + + if (UNMARSHALLING(ps)) { + if ( !(*data32 = PRS_ALLOC_MEM(ps, uint32, 1)) ) + return False; + } + + return prs_uint32(name, ps, depth, *data32); +} + /******************************************************************* Stream a NTSTATUS ********************************************************************/ diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index f6fdf10292..6a752688a0 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -133,7 +133,7 @@ BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) * Note that the size is always a multiple of 4 bytes due to the * nature of the data structure. Therefore the prs_align() calls * have been removed as they through us off when doing two-layer - * marshalling such as in the printing code (NEW_BUFFER). --jerry + * marshalling such as in the printing code (RPC_BUFFER). --jerry */ if (ppsa == NULL) diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 2e5244d653..0279074946 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -27,22 +27,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/******************************************************************* -return the length of a UNISTR string. -********************************************************************/ - -static uint32 str_len_uni(UNISTR *source) -{ - uint32 i=0; - - if (!source->buffer) - return 0; - - while (source->buffer[i]) - i++; - - return i; -} /******************************************************************* This should be moved in a more generic lib. @@ -2067,33 +2051,6 @@ static uint32 size_of_nttime(NTTIME *value) return (sizeof(*value)); } -/******************************************************************* - * return the length of a UNICODE string in number of char, includes: - * - the leading zero - * - the relative pointer size - ********************************************************************/ - -static uint32 size_of_relative_string(UNISTR *string) -{ - uint32 size=0; - - size=str_len_uni(string); /* the string length */ - size=size+1; /* add the trailing zero */ - size=size*2; /* convert in char */ - size=size+4; /* add the size of the ptr */ - -#if 0 /* JERRY */ - /* - * Do not include alignment as Win2k does not align relative - * strings within a buffer --jerry - */ - /* Ensure size is 4 byte multiple (prs_align is being called...). */ - /* size += ((4 - (size & 3)) & 3); */ -#endif - - return size; -} - /******************************************************************* * return the length of a uint32 (obvious, but the code is clean) ********************************************************************/ @@ -2118,278 +2075,11 @@ static uint32 size_of_systemtime(SYSTEMTIME *systime) return (sizeof(SYSTEMTIME) +4); } -/******************************************************************* - * write a UNICODE string and its relative pointer. - * used by all the RPC structs passing a buffer - * - * As I'm a nice guy, I'm forcing myself to explain this code. - * MS did a good job in the overall spoolss code except in some - * functions where they are passing the API buffer directly in the - * RPC request/reply. That's to maintain compatiility at the API level. - * They could have done it the good way the first time. - * - * So what happen is: the strings are written at the buffer's end, - * in the reverse order of the original structure. Some pointers to - * the strings are also in the buffer. Those are relative to the - * buffer's start. - * - * If you don't understand or want to change that function, - * first get in touch with me: jfm@samba.org - * - ********************************************************************/ - -static BOOL smb_io_relstr(const char *desc, NEW_BUFFER *buffer, int depth, UNISTR *string) -{ - prs_struct *ps=&buffer->prs; - - if (MARSHALLING(ps)) { - uint32 struct_offset = prs_offset(ps); - uint32 relative_offset; - - buffer->string_at_end -= (size_of_relative_string(string) - 4); - if(!prs_set_offset(ps, buffer->string_at_end)) - return False; -#if 0 /* JERRY */ - /* - * Win2k does not align strings in a buffer - * Tested against WinNT 4.0 SP 6a & 2k SP2 --jerry - */ - if (!prs_align(ps)) - return False; -#endif - buffer->string_at_end = prs_offset(ps); - - /* write the string */ - if (!smb_io_unistr(desc, string, ps, depth)) - return False; - - if(!prs_set_offset(ps, struct_offset)) - return False; - - relative_offset=buffer->string_at_end - buffer->struct_start; - /* write its offset */ - if (!prs_uint32("offset", ps, depth, &relative_offset)) - return False; - } - else { - uint32 old_offset; - - /* read the offset */ - if (!prs_uint32("offset", ps, depth, &(buffer->string_at_end))) - return False; - - if (buffer->string_at_end == 0) - return True; - - old_offset = prs_offset(ps); - if(!prs_set_offset(ps, buffer->string_at_end+buffer->struct_start)) - return False; - - /* read the string */ - if (!smb_io_unistr(desc, string, ps, depth)) - return False; - - if(!prs_set_offset(ps, old_offset)) - return False; - } - return True; -} - -/******************************************************************* - * write a array of UNICODE strings and its relative pointer. - * used by 2 RPC structs - ********************************************************************/ - -static BOOL smb_io_relarraystr(const char *desc, NEW_BUFFER *buffer, int depth, uint16 **string) -{ - UNISTR chaine; - - prs_struct *ps=&buffer->prs; - - if (MARSHALLING(ps)) { - uint32 struct_offset = prs_offset(ps); - uint32 relative_offset; - uint16 *p; - uint16 *q; - uint16 zero=0; - p=*string; - q=*string; - - /* first write the last 0 */ - buffer->string_at_end -= 2; - if(!prs_set_offset(ps, buffer->string_at_end)) - return False; - - if(!prs_uint16("leading zero", ps, depth, &zero)) - return False; - - while (p && (*p!=0)) { - while (*q!=0) - q++; - - /* Yes this should be malloc not talloc. Don't change. */ - - chaine.buffer = SMB_MALLOC((q-p+1)*sizeof(uint16)); - if (chaine.buffer == NULL) - return False; - - memcpy(chaine.buffer, p, (q-p+1)*sizeof(uint16)); - - buffer->string_at_end -= (q-p+1)*sizeof(uint16); - - if(!prs_set_offset(ps, buffer->string_at_end)) { - SAFE_FREE(chaine.buffer); - return False; - } - - /* write the string */ - if (!smb_io_unistr(desc, &chaine, ps, depth)) { - SAFE_FREE(chaine.buffer); - return False; - } - q++; - p=q; - - SAFE_FREE(chaine.buffer); - } - - if(!prs_set_offset(ps, struct_offset)) - return False; - - relative_offset=buffer->string_at_end - buffer->struct_start; - /* write its offset */ - if (!prs_uint32("offset", ps, depth, &relative_offset)) - return False; - - } else { - - /* UNMARSHALLING */ - - uint32 old_offset; - uint16 *chaine2=NULL; - int l_chaine=0; - int l_chaine2=0; - size_t realloc_size = 0; - - *string=NULL; - - /* read the offset */ - if (!prs_uint32("offset", ps, depth, &buffer->string_at_end)) - return False; - - old_offset = prs_offset(ps); - if(!prs_set_offset(ps, buffer->string_at_end + buffer->struct_start)) - return False; - - do { - if (!smb_io_unistr(desc, &chaine, ps, depth)) - return False; - - l_chaine=str_len_uni(&chaine); - - /* we're going to add two more bytes here in case this - is the last string in the array and we need to add - an extra NULL for termination */ - if (l_chaine > 0) - { - uint16 *tc2; - - realloc_size = (l_chaine2+l_chaine+2)*sizeof(uint16); - - /* Yes this should be realloc - it's freed below. JRA */ - - if((tc2=(uint16 *)SMB_REALLOC(chaine2, realloc_size)) == NULL) { - SAFE_FREE(chaine2); - return False; - } - else chaine2 = tc2; - memcpy(chaine2+l_chaine2, chaine.buffer, (l_chaine+1)*sizeof(uint16)); - l_chaine2+=l_chaine+1; - } - - } while(l_chaine!=0); - - /* the end should be bould NULL terminated so add - the second one here */ - if (chaine2) - { - chaine2[l_chaine2] = '\0'; - *string=(uint16 *)TALLOC_MEMDUP(prs_get_mem_context(ps),chaine2,realloc_size); - SAFE_FREE(chaine2); - } - - if(!prs_set_offset(ps, old_offset)) - return False; - } - return True; -} - -/******************************************************************* - Parse a DEVMODE structure and its relative pointer. -********************************************************************/ - -static BOOL smb_io_relsecdesc(const char *desc, NEW_BUFFER *buffer, int depth, SEC_DESC **secdesc) -{ - prs_struct *ps= &buffer->prs; - - prs_debug(ps, depth, desc, "smb_io_relsecdesc"); - depth++; - - if (MARSHALLING(ps)) { - uint32 struct_offset = prs_offset(ps); - uint32 relative_offset; - - if (! *secdesc) { - relative_offset = 0; - if (!prs_uint32("offset", ps, depth, &relative_offset)) - return False; - return True; - } - - if (*secdesc != NULL) { - buffer->string_at_end -= sec_desc_size(*secdesc); - - if(!prs_set_offset(ps, buffer->string_at_end)) - return False; - /* write the secdesc */ - if (!sec_io_desc(desc, secdesc, ps, depth)) - return False; - - if(!prs_set_offset(ps, struct_offset)) - return False; - } - - relative_offset=buffer->string_at_end - buffer->struct_start; - /* write its offset */ - - if (!prs_uint32("offset", ps, depth, &relative_offset)) - return False; - } else { - uint32 old_offset; - - /* read the offset */ - if (!prs_uint32("offset", ps, depth, &buffer->string_at_end)) - return False; - - old_offset = prs_offset(ps); - if(!prs_set_offset(ps, buffer->string_at_end + buffer->struct_start)) - return False; - - /* read the sd */ - if (!sec_io_desc(desc, secdesc, ps, depth)) - return False; - - if(!prs_set_offset(ps, old_offset)) - return False; - } - return True; -} - /******************************************************************* Parse a DEVMODE structure and its relative pointer. ********************************************************************/ -static BOOL smb_io_reldevmode(const char *desc, NEW_BUFFER *buffer, int depth, DEVICEMODE **devmode) +static BOOL smb_io_reldevmode(const char *desc, RPC_BUFFER *buffer, int depth, DEVICEMODE **devmode) { prs_struct *ps=&buffer->prs; @@ -2457,7 +2147,7 @@ static BOOL smb_io_reldevmode(const char *desc, NEW_BUFFER *buffer, int depth, D Parse a PRINTER_INFO_0 structure. ********************************************************************/ -BOOL smb_io_printer_info_0(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *info, int depth) +BOOL smb_io_printer_info_0(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_0 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2558,7 +2248,7 @@ BOOL smb_io_printer_info_0(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 Parse a PRINTER_INFO_1 structure. ********************************************************************/ -BOOL smb_io_printer_info_1(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info, int depth) +BOOL smb_io_printer_info_1(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2583,7 +2273,7 @@ BOOL smb_io_printer_info_1(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 Parse a PRINTER_INFO_2 structure. ********************************************************************/ -BOOL smb_io_printer_info_2(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) +BOOL smb_io_printer_info_2(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; uint32 dm_offset, sd_offset, current_offset; @@ -2674,7 +2364,7 @@ BOOL smb_io_printer_info_2(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 Parse a PRINTER_INFO_3 structure. ********************************************************************/ -BOOL smb_io_printer_info_3(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 *info, int depth) +BOOL smb_io_printer_info_3(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_3 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2695,7 +2385,7 @@ BOOL smb_io_printer_info_3(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_3 Parse a PRINTER_INFO_4 structure. ********************************************************************/ -BOOL smb_io_printer_info_4(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_4 *info, int depth) +BOOL smb_io_printer_info_4(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_4 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2717,7 +2407,7 @@ BOOL smb_io_printer_info_4(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_4 Parse a PRINTER_INFO_5 structure. ********************************************************************/ -BOOL smb_io_printer_info_5(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_5 *info, int depth) +BOOL smb_io_printer_info_5(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_5 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2743,7 +2433,7 @@ BOOL smb_io_printer_info_5(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_5 Parse a PRINTER_INFO_7 structure. ********************************************************************/ -BOOL smb_io_printer_info_7(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_7 *info, int depth) +BOOL smb_io_printer_info_7(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_7 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2763,7 +2453,7 @@ BOOL smb_io_printer_info_7(const char *desc, NEW_BUFFER *buffer, PRINTER_INFO_7 Parse a PORT_INFO_1 structure. ********************************************************************/ -BOOL smb_io_port_info_1(const char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) +BOOL smb_io_port_info_1(const char *desc, RPC_BUFFER *buffer, PORT_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2782,7 +2472,7 @@ BOOL smb_io_port_info_1(const char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, Parse a PORT_INFO_2 structure. ********************************************************************/ -BOOL smb_io_port_info_2(const char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) +BOOL smb_io_port_info_2(const char *desc, RPC_BUFFER *buffer, PORT_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2809,7 +2499,7 @@ BOOL smb_io_port_info_2(const char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, Parse a DRIVER_INFO_1 structure. ********************************************************************/ -BOOL smb_io_printer_driver_info_1(const char *desc, NEW_BUFFER *buffer, DRIVER_INFO_1 *info, int depth) +BOOL smb_io_printer_driver_info_1(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2828,7 +2518,7 @@ BOOL smb_io_printer_driver_info_1(const char *desc, NEW_BUFFER *buffer, DRIVER_I Parse a DRIVER_INFO_2 structure. ********************************************************************/ -BOOL smb_io_printer_driver_info_2(const char *desc, NEW_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) +BOOL smb_io_printer_driver_info_2(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2857,7 +2547,7 @@ BOOL smb_io_printer_driver_info_2(const char *desc, NEW_BUFFER *buffer, DRIVER_I Parse a DRIVER_INFO_3 structure. ********************************************************************/ -BOOL smb_io_printer_driver_info_3(const char *desc, NEW_BUFFER *buffer, DRIVER_INFO_3 *info, int depth) +BOOL smb_io_printer_driver_info_3(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_3 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2896,7 +2586,7 @@ BOOL smb_io_printer_driver_info_3(const char *desc, NEW_BUFFER *buffer, DRIVER_I Parse a DRIVER_INFO_6 structure. ********************************************************************/ -BOOL smb_io_printer_driver_info_6(const char *desc, NEW_BUFFER *buffer, DRIVER_INFO_6 *info, int depth) +BOOL smb_io_printer_driver_info_6(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_6 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2961,7 +2651,7 @@ BOOL smb_io_printer_driver_info_6(const char *desc, NEW_BUFFER *buffer, DRIVER_I Parse a JOB_INFO_1 structure. ********************************************************************/ -BOOL smb_io_job_info_1(const char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int depth) +BOOL smb_io_job_info_1(const char *desc, RPC_BUFFER *buffer, JOB_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3004,7 +2694,7 @@ BOOL smb_io_job_info_1(const char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, i Parse a JOB_INFO_2 structure. ********************************************************************/ -BOOL smb_io_job_info_2(const char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int depth) +BOOL smb_io_job_info_2(const char *desc, RPC_BUFFER *buffer, JOB_INFO_2 *info, int depth) { uint32 pipo=0; prs_struct *ps=&buffer->prs; @@ -3071,7 +2761,7 @@ BOOL smb_io_job_info_2(const char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, i /******************************************************************* ********************************************************************/ -BOOL smb_io_form_1(const char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth) +BOOL smb_io_form_1(const char *desc, RPC_BUFFER *buffer, FORM_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3102,123 +2792,13 @@ BOOL smb_io_form_1(const char *desc, NEW_BUFFER *buffer, FORM_1 *info, int depth return True; } -/******************************************************************* - Read/write a BUFFER struct. -********************************************************************/ - -static BOOL spoolss_io_buffer(const char *desc, prs_struct *ps, int depth, NEW_BUFFER **pp_buffer) -{ - NEW_BUFFER *buffer = *pp_buffer; - - prs_debug(ps, depth, desc, "spoolss_io_buffer"); - depth++; - - if (UNMARSHALLING(ps)) - buffer = *pp_buffer = PRS_ALLOC_MEM(ps, NEW_BUFFER, 1); - - if (buffer == NULL) - return False; - - if (!prs_uint32("ptr", ps, depth, &buffer->ptr)) - return False; - - /* reading */ - if (UNMARSHALLING(ps)) { - buffer->size=0; - buffer->string_at_end=0; - - if (buffer->ptr==0) { - /* - * JRA. I'm not sure if the data in here is in big-endian format if - * the client is big-endian. Leave as default (little endian) for now. - */ - - if (!prs_init(&buffer->prs, 0, prs_get_mem_context(ps), UNMARSHALL)) - return False; - return True; - } - - if (!prs_uint32("size", ps, depth, &buffer->size)) - return False; - - /* - * JRA. I'm not sure if the data in here is in big-endian format if - * the client is big-endian. Leave as default (little endian) for now. - */ - - if (!prs_init(&buffer->prs, buffer->size, prs_get_mem_context(ps), UNMARSHALL)) - return False; - - if (!prs_append_some_prs_data(&buffer->prs, ps, prs_offset(ps), buffer->size)) - return False; - - if (!prs_set_offset(&buffer->prs, 0)) - return False; - - if (!prs_set_offset(ps, buffer->size+prs_offset(ps))) - return False; - - buffer->string_at_end=buffer->size; - - return True; - } - else { - BOOL ret = False; - - /* writing */ - if (buffer->ptr==0) { - /* We have finished with the data in buffer->prs - free it. */ - prs_mem_free(&buffer->prs); - return True; - } - - if (!prs_uint32("size", ps, depth, &buffer->size)) - goto out; - - if (!prs_append_some_prs_data(ps, &buffer->prs, 0, buffer->size)) - goto out; - - ret = True; - out: - - /* We have finished with the data in buffer->prs - free it. */ - prs_mem_free(&buffer->prs); - - return ret; - } -} - -/******************************************************************* - move a BUFFER from the query to the reply. - As the data pointers in NEW_BUFFER are malloc'ed, not talloc'ed, - this is ok. This is an OPTIMIZATION and is not strictly neccessary. - Clears the memory to zero also. -********************************************************************/ - -void spoolss_move_buffer(NEW_BUFFER *src, NEW_BUFFER **dest) -{ - prs_switch_type(&src->prs, MARSHALL); - if(!prs_set_offset(&src->prs, 0)) - return; - prs_force_dynamic(&src->prs); - prs_mem_clear(&src->prs); - *dest=src; -} - -/******************************************************************* - Get the size of a BUFFER struct. -********************************************************************/ -uint32 new_get_buffer_size(NEW_BUFFER *buffer) -{ - return (buffer->size); -} /******************************************************************* Parse a DRIVER_DIRECTORY_1 structure. ********************************************************************/ -BOOL smb_io_driverdir_1(const char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 *info, int depth) +BOOL smb_io_driverdir_1(const char *desc, RPC_BUFFER *buffer, DRIVER_DIRECTORY_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3237,7 +2817,7 @@ BOOL smb_io_driverdir_1(const char *desc, NEW_BUFFER *buffer, DRIVER_DIRECTORY_1 Parse a PORT_INFO_1 structure. ********************************************************************/ -BOOL smb_io_port_1(const char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int depth) +BOOL smb_io_port_1(const char *desc, RPC_BUFFER *buffer, PORT_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3256,7 +2836,7 @@ BOOL smb_io_port_1(const char *desc, NEW_BUFFER *buffer, PORT_INFO_1 *info, int Parse a PORT_INFO_2 structure. ********************************************************************/ -BOOL smb_io_port_2(const char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int depth) +BOOL smb_io_port_2(const char *desc, RPC_BUFFER *buffer, PORT_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3282,7 +2862,7 @@ BOOL smb_io_port_2(const char *desc, NEW_BUFFER *buffer, PORT_INFO_2 *info, int /******************************************************************* ********************************************************************/ -BOOL smb_io_printprocessor_info_1(const char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR_1 *info, int depth) +BOOL smb_io_printprocessor_info_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCESSOR_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3300,7 +2880,7 @@ BOOL smb_io_printprocessor_info_1(const char *desc, NEW_BUFFER *buffer, PRINTPRO /******************************************************************* ********************************************************************/ -BOOL smb_io_printprocdatatype_info_1(const char *desc, NEW_BUFFER *buffer, PRINTPROCDATATYPE_1 *info, int depth) +BOOL smb_io_printprocdatatype_info_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCDATATYPE_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3318,7 +2898,7 @@ BOOL smb_io_printprocdatatype_info_1(const char *desc, NEW_BUFFER *buffer, PRINT /******************************************************************* ********************************************************************/ -BOOL smb_io_printmonitor_info_1(const char *desc, NEW_BUFFER *buffer, PRINTMONITOR_1 *info, int depth) +BOOL smb_io_printmonitor_info_1(const char *desc, RPC_BUFFER *buffer, PRINTMONITOR_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3336,7 +2916,7 @@ BOOL smb_io_printmonitor_info_1(const char *desc, NEW_BUFFER *buffer, PRINTMONIT /******************************************************************* ********************************************************************/ -BOOL smb_io_printmonitor_info_2(const char *desc, NEW_BUFFER *buffer, PRINTMONITOR_2 *info, int depth) +BOOL smb_io_printmonitor_info_2(const char *desc, RPC_BUFFER *buffer, PRINTMONITOR_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3859,7 +3439,7 @@ BOOL make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u, const POLICY_HND *hnd, const fstring architecture, uint32 level, uint32 clientmajor, uint32 clientminor, - NEW_BUFFER *buffer, uint32 offered) + RPC_BUFFER *buffer, uint32 offered) { if (q_u == NULL) return False; @@ -3903,7 +3483,7 @@ BOOL spoolss_io_q_getprinterdriver2(const char *desc, SPOOL_Q_GETPRINTERDRIVER2 if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer)) return False; if(!prs_align(ps)) @@ -3933,7 +3513,7 @@ BOOL spoolss_io_r_getprinterdriver2(const char *desc, SPOOL_R_GETPRINTERDRIVER2 if (!prs_align(ps)) return False; - if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -3959,7 +3539,7 @@ BOOL make_spoolss_q_enumprinters( uint32 flags, char *servername, uint32 level, - NEW_BUFFER *buffer, + RPC_BUFFER *buffer, uint32 offered ) { @@ -3981,7 +3561,7 @@ BOOL make_spoolss_q_enumprinters( BOOL make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS *q_u, fstring servername, uint32 level, - NEW_BUFFER *buffer, uint32 offered) + RPC_BUFFER *buffer, uint32 offered) { q_u->name_ptr = (servername != NULL) ? 1 : 0; init_buf_unistr2(&q_u->name, &q_u->name_ptr, servername); @@ -4019,7 +3599,7 @@ BOOL spoolss_io_q_enumprinters(const char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_ if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -4042,7 +3622,7 @@ BOOL spoolss_io_r_enumprinters(const char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_ if (!prs_align(ps)) return False; - if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -4074,7 +3654,7 @@ BOOL spoolss_io_r_getprinter(const char *desc, SPOOL_R_GETPRINTER *r_u, prs_stru if (!prs_align(ps)) return False; - if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -4107,7 +3687,7 @@ BOOL spoolss_io_q_getprinter(const char *desc, SPOOL_Q_GETPRINTER *q_u, prs_stru if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -4127,7 +3707,7 @@ BOOL make_spoolss_q_getprinter( SPOOL_Q_GETPRINTER *q_u, const POLICY_HND *hnd, uint32 level, - NEW_BUFFER *buffer, + RPC_BUFFER *buffer, uint32 offered ) { @@ -4349,7 +3929,7 @@ BOOL spoolss_io_r_addjob(const char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, if(!prs_align(ps)) return False; - if(!spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if(!prs_rpcbuffer_p("", ps, depth, &r_u->buffer)) return False; if(!prs_align(ps)) @@ -4380,7 +3960,7 @@ BOOL spoolss_io_q_addjob(const char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer)) return False; if(!prs_align(ps)) @@ -4403,7 +3983,7 @@ BOOL spoolss_io_r_enumjobs(const char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct * if (!prs_align(ps)) return False; - if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -4428,7 +4008,7 @@ BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd, uint32 firstjob, uint32 numofjobs, uint32 level, - NEW_BUFFER *buffer, + RPC_BUFFER *buffer, uint32 offered) { if (q_u == NULL) @@ -4465,7 +4045,7 @@ BOOL spoolss_io_q_enumjobs(const char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct * if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer)) return False; if(!prs_align(ps)) @@ -4569,7 +4149,7 @@ BOOL spoolss_io_r_enumprinterdrivers(const char *desc, SPOOL_R_ENUMPRINTERDRIVER if (!prs_align(ps)) return False; - if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -4595,7 +4175,7 @@ BOOL make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, const char *name, const char *environment, uint32 level, - NEW_BUFFER *buffer, uint32 offered) + RPC_BUFFER *buffer, uint32 offered) { init_buf_unistr2(&q_u->name, &q_u->name_ptr, name); init_buf_unistr2(&q_u->environment, &q_u->environment_ptr, environment); @@ -4637,7 +4217,7 @@ BOOL spoolss_io_q_enumprinterdrivers(const char *desc, SPOOL_Q_ENUMPRINTERDRIVER if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -4665,7 +4245,7 @@ BOOL spoolss_io_q_enumforms(const char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -4687,7 +4267,7 @@ BOOL spoolss_io_r_enumforms(const char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct if (!prs_align(ps)) return False; - if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -4727,7 +4307,7 @@ BOOL spoolss_io_q_getform(const char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -4749,7 +4329,7 @@ BOOL spoolss_io_r_getform(const char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps if (!prs_align(ps)) return False; - if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -4776,7 +4356,7 @@ BOOL spoolss_io_r_enumports(const char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct if (!prs_align(ps)) return False; - if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -4815,7 +4395,7 @@ BOOL spoolss_io_q_enumports(const char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -5815,7 +5395,7 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, BOOL make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR *q_u, fstring servername, fstring env_name, uint32 level, - NEW_BUFFER *buffer, uint32 offered) + RPC_BUFFER *buffer, uint32 offered) { init_buf_unistr2(&q_u->name, &q_u->name_ptr, servername); init_buf_unistr2(&q_u->environment, &q_u->environment_ptr, env_name); @@ -5857,7 +5437,7 @@ BOOL spoolss_io_q_getprinterdriverdir(const char *desc, SPOOL_Q_GETPRINTERDRIVER if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer)) return False; if(!prs_align(ps)) @@ -5881,7 +5461,7 @@ BOOL spoolss_io_r_getprinterdriverdir(const char *desc, SPOOL_R_GETPRINTERDRIVER if (!prs_align(ps)) return False; - if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -5907,7 +5487,7 @@ BOOL spoolss_io_r_enumprintprocessors(const char *desc, SPOOL_R_ENUMPRINTPROCESS if (!prs_align(ps)) return False; - if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -5955,7 +5535,7 @@ BOOL spoolss_io_q_enumprintprocessors(const char *desc, SPOOL_Q_ENUMPRINTPROCESS if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -6029,7 +5609,7 @@ BOOL spoolss_io_r_enumprintprocdatatypes(const char *desc, SPOOL_R_ENUMPRINTPROC if (!prs_align(ps)) return False; - if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -6077,7 +5657,7 @@ BOOL spoolss_io_q_enumprintprocdatatypes(const char *desc, SPOOL_Q_ENUMPRINTPROC if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!spoolss_io_buffer("buffer", ps, depth, &q_u->buffer)) + if(!prs_rpcbuffer_p("buffer", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -6112,7 +5692,7 @@ BOOL spoolss_io_q_enumprintmonitors(const char *desc, SPOOL_Q_ENUMPRINTMONITORS if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer)) return False; if (!prs_align(ps)) @@ -6135,7 +5715,7 @@ BOOL spoolss_io_r_enumprintmonitors(const char *desc, SPOOL_R_ENUMPRINTMONITORS if (!prs_align(ps)) return False; - if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -6578,7 +6158,7 @@ BOOL spoolss_io_r_getjob(const char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, if (!prs_align(ps)) return False; - if (!spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer)) return False; if (!prs_align(ps)) @@ -6612,7 +6192,7 @@ BOOL spoolss_io_q_getjob(const char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer)) return False; if(!prs_align(ps)) @@ -7463,7 +7043,7 @@ BOOL spoolss_io_r_enumprinterdataex(const char *desc, SPOOL_R_ENUMPRINTERDATAEX [in] unistr2 *name, [in] unistr2 *environment, [in] uint32 level, - [in,out] NEW_BUFFER buffer, + [in,out] RPC_BUFFER buffer, [in] uint32 offered, [out] uint32 needed, [out] uint32 returned @@ -7471,7 +7051,7 @@ BOOL spoolss_io_r_enumprinterdataex(const char *desc, SPOOL_R_ENUMPRINTERDATAEX */ -BOOL make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, const char *name, char *environment, int level, NEW_BUFFER *buffer, uint32 offered) +BOOL make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, const char *name, char *environment, int level, RPC_BUFFER *buffer, uint32 offered) { DEBUG(5,("make_spoolss_q_getprintprocessordirectory\n")); @@ -7522,7 +7102,7 @@ BOOL spoolss_io_q_getprintprocessordirectory(const char *desc, SPOOL_Q_GETPRINTP if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if(!spoolss_io_buffer("", ps, depth, &q_u->buffer)) + if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer)) return False; if(!prs_align(ps)) @@ -7546,7 +7126,7 @@ BOOL spoolss_io_r_getprintprocessordirectory(const char *desc, SPOOL_R_GETPRINTP if(!prs_align(ps)) return False; - if(!spoolss_io_buffer("", ps, depth, &r_u->buffer)) + if(!prs_rpcbuffer_p("", ps, depth, &r_u->buffer)) return False; if(!prs_align(ps)) @@ -7561,7 +7141,7 @@ BOOL spoolss_io_r_getprintprocessordirectory(const char *desc, SPOOL_R_GETPRINTP return True; } -BOOL smb_io_printprocessordirectory_1(const char *desc, NEW_BUFFER *buffer, PRINTPROCESSOR_DIRECTORY_1 *info, int depth) +BOOL smb_io_printprocessordirectory_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCESSOR_DIRECTORY_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -7625,7 +7205,7 @@ BOOL make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, BOOL make_spoolss_q_getform(SPOOL_Q_GETFORM *q_u, POLICY_HND *handle, const char *formname, uint32 level, - NEW_BUFFER *buffer, uint32 offered) + RPC_BUFFER *buffer, uint32 offered) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); q_u->level = level; @@ -7641,7 +7221,7 @@ BOOL make_spoolss_q_getform(SPOOL_Q_GETFORM *q_u, POLICY_HND *handle, ********************************************************************/ BOOL make_spoolss_q_enumforms(SPOOL_Q_ENUMFORMS *q_u, POLICY_HND *handle, - uint32 level, NEW_BUFFER *buffer, + uint32 level, RPC_BUFFER *buffer, uint32 offered) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); @@ -7676,7 +7256,7 @@ BOOL make_spoolss_q_setjob(SPOOL_Q_SETJOB *q_u, POLICY_HND *handle, ********************************************************************/ BOOL make_spoolss_q_getjob(SPOOL_Q_GETJOB *q_u, POLICY_HND *handle, - uint32 jobid, uint32 level, NEW_BUFFER *buffer, + uint32 jobid, uint32 level, RPC_BUFFER *buffer, uint32 offered) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); -- cgit From 76f3e5a90f768f0d9f88512e47edb7aac321985c Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 15 Mar 2005 20:46:26 +0000 Subject: r5808: removing unneeded structure field from RPC_BUFFER (This used to be commit 9b0bfd7e6fd1acc85ec53d2fa32d61cd34aa2345) --- source3/rpc_parse/parse_buffer.c | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index d3584c3954..41064572d9 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -33,9 +33,6 @@ **********************************************************************/ void rpcbuf_init(RPC_BUFFER *buffer, uint32 size, TALLOC_CTX *ctx) { -#if 0 - buffer->ptr = (size != 0); -#endif buffer->size = size; buffer->string_at_end = size; prs_init(&buffer->prs, size, ctx, MARSHALL); @@ -56,19 +53,6 @@ BOOL prs_rpcbuffer(const char *desc, prs_struct *ps, int depth, RPC_BUFFER *buff buffer->size=0; buffer->string_at_end=0; -#if 0 - if (buffer->ptr==0) { - /* - * JRA. I'm not sure if the data in here is in big-endian format if - * the client is big-endian. Leave as default (little endian) for now. - */ - - if (!prs_init(&buffer->prs, 0, prs_get_mem_context(ps), UNMARSHALL)) - return False; - return True; - } -#endif - if (!prs_uint32("size", ps, depth, &buffer->size)) return False; @@ -96,15 +80,6 @@ BOOL prs_rpcbuffer(const char *desc, prs_struct *ps, int depth, RPC_BUFFER *buff else { BOOL ret = False; -#if 0 - /* writing */ - if (buffer->ptr==0) { - /* We have finished with the data in buffer->prs - free it. */ - prs_mem_free(&buffer->prs); - return True; - } -#endif - if (!prs_uint32("size", ps, depth, &buffer->size)) goto out; -- cgit From c8e02022772c8c29548451dc93c895daa492f100 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 15 Mar 2005 20:51:14 +0000 Subject: r5809: try to catch NULL pointers during developerment for rpcbuf_move() (This used to be commit f9e9a42c0734129100e1cdd4a9ad1539b65ab5bc) --- source3/rpc_parse/parse_buffer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index 41064572d9..ea72df8db4 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -168,8 +168,7 @@ BOOL rpcbuf_alloc_size(RPC_BUFFER *buffer, uint32 buffer_size) void rpcbuf_move(RPC_BUFFER *src, RPC_BUFFER **dest) { - if ( !src ) - return; + SMB_ASSERT( src != NULL ); prs_switch_type(&src->prs, MARSHALL); if(!prs_set_offset(&src->prs, 0)) -- cgit From d2b8348fefdb21811999bef6d344e152c44084b8 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 22 Mar 2005 14:44:16 +0000 Subject: r5946: BUG 2497: fix bug in rpcclient's deletedriverex when asking to delete all versions of a driver (This used to be commit 1f0060278609a194b76872367530d2f7bcea7fa7) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 0279074946..c64587b590 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1210,7 +1210,7 @@ BOOL make_spoolss_q_deleteprinterdriverex( TALLOC_CTX *mem_ctx, const char *server, const char* arch, const char* driver, - uint32 version) + int version) { DEBUG(5,("make_spoolss_q_deleteprinterdriverex\n")); -- cgit From bece9417d2e232e5b13ea340c79430bb9680eb8a Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 23 Mar 2005 20:57:03 +0000 Subject: r6004: Let's make server manager able to kill a user session. This will send a shutdown command to the right process by pid read from the sessions list. (This used to be commit 5d3d025db757f7d48f241142a60a93214f2b47ea) --- source3/rpc_parse/parse_srv.c | 73 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 84c45b5901..7d15eda630 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1995,6 +1995,79 @@ BOOL srv_io_r_net_sess_enum(const char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_stru return True; } +/******************************************************************* + Inits a SRV_Q_NET_SESS_DEL structure. +********************************************************************/ + +void init_srv_q_net_sess_del(SRV_Q_NET_SESS_DEL *q_n, const char *srv_name, + const char *cli_name, const char *user_name) +{ + DEBUG(5,("init_q_net_sess_enum\n")); + + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); + init_buf_unistr2(&q_n->uni_cli_name, &q_n->ptr_cli_name, cli_name); + init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_sess_del(const char *desc, SRV_Q_NET_SESS_DEL *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_sess_del"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_cli_name", ps, depth, &q_n->ptr_cli_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_cli_name, q_n->ptr_cli_name, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_sess_del(const char *desc, SRV_R_NET_SESS_DEL *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_sess_del"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} + /******************************************************************* Inits a CONN_INFO_0 structure ********************************************************************/ -- cgit From 5d1cb8e79edea9e8581d3c2c9dd297310cd9a98c Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 23 Mar 2005 23:26:33 +0000 Subject: r6014: rather large change set.... pulling back all recent rpc changes from trunk into 3.0. I've tested a compile and so don't think I've missed any files. But if so, just mail me and I'll clean backup in a couple of hours. Changes include \winreg, \eventlog, \svcctl, and general parse_misc.c updates. I am planning on bracketing the event code with an #ifdef ENABLE_EVENTLOG until I finish merging Marcin's changes (very soon). (This used to be commit 4e0ac63c36527cd8c52ef720cae17e84f67e7221) --- source3/rpc_parse/parse_eventlog.c | 457 +++++++++++++++ source3/rpc_parse/parse_lsa.c | 7 +- source3/rpc_parse/parse_misc.c | 159 ++++-- source3/rpc_parse/parse_prs.c | 81 +-- source3/rpc_parse/parse_reg.c | 1100 +++++++++++++++--------------------- source3/rpc_parse/parse_rpc.c | 45 +- source3/rpc_parse/parse_shutdown.c | 123 +++- source3/rpc_parse/parse_spoolss.c | 135 +++-- source3/rpc_parse/parse_svcctl.c | 665 ++++++++++++++++++++++ 9 files changed, 1937 insertions(+), 835 deletions(-) create mode 100644 source3/rpc_parse/parse_eventlog.c create mode 100644 source3/rpc_parse/parse_svcctl.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c new file mode 100644 index 0000000000..9bb0a13169 --- /dev/null +++ b/source3/rpc_parse/parse_eventlog.c @@ -0,0 +1,457 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * Copyright (C) Marcin Krzysztof Porwit 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 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + +/* + * called from eventlog_q_open_eventlog (srv_eventlog.c) + */ + +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; + + /* Data format seems to be: + UNKNOWN structure + uint32 unknown + uint16 unknown + uint16 unknown + Eventlog name + uint16 eventlog name length + uint16 eventlog name size + Character Array + uint32 unknown + uint32 max count + uint32 offset + uint32 actual count + UNISTR2 log file name + Server Name + uint16 server name length + uint16 server name size + Character Array + UNISTR2 server name + */ + + prs_debug(ps, depth, desc, "eventlog_io_q_open_eventlog"); + depth++; + + if(!prs_align(ps)) + return False; + + /* Munch unknown bits */ + + if(!prs_uint32("", ps, depth, &q_u->unknown1)) + return False; + if(!prs_uint16("", ps, depth, &q_u->unknown2)) + return False; + if(!prs_uint16("", ps, depth, &q_u->unknown3)) + return False; + if(!prs_align(ps)) + return False; + + /* Get name of log source */ + + if(!prs_uint16("sourcename_length", ps, depth, &q_u->sourcename_length)) + return False; + if(!prs_uint16("sourcename_size", ps, depth, &q_u->sourcename_size)) + return False; + if(!prs_uint32("sourcename_ptr", ps, depth, &q_u->sourcename_ptr)) + return False; + if(!smb_io_unistr2("", &q_u->sourcename, q_u->sourcename_ptr, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + /* Get server name */ + + if(!prs_uint32("servername_ptr", ps, depth, &q_u->servername_ptr)) + return False; + if(!smb_io_unistr2("", &q_u->servername, q_u->servername_ptr, ps, depth)) + 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_werror("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_werror("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_werror("status code", ps, depth, &(r_u->status)))) + return False; + + return True; +} + +BOOL eventlog_io_q_close_eventlog(const char *desc, EVENTLOG_Q_CLOSE_EVENTLOG *q_u, + prs_struct *ps, int depth) +{ + if(q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "eventlog_io_q_close_eventlog"); + 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_close_eventlog(const char *desc, EVENTLOG_R_CLOSE_EVENTLOG *r_u, + prs_struct *ps, int depth) +{ + if(r_u == NULL) + return False; + + prs_debug(ps, depth, desc, "eventlog_io_r_close_eventlog"); + depth++; + + if(!(prs_align(ps))) + return False; + + if(!(smb_io_pol_hnd("log handle", &(r_u->handle), ps, depth))) + return False; + + if(!(prs_werror("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) +{ + if(q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "eventlog_io_q_read_eventlog"); + depth++; + + if(!(prs_align(ps))) + return False; + + if(!(smb_io_pol_hnd("log handle", &(q_u->handle), ps, depth))) + return False; + + if(!(prs_uint32("read flags", ps, depth, &(q_u->flags)))) + return False; + + if(!(prs_uint32("read offset", ps, depth, &(q_u->offset)))) + return False; + + if(!(prs_uint32("read buf size", ps, depth, &(q_u->max_read_size)))) + return False; + + return True; +} +/* Structure of response seems to be: + DWORD num_bytes_in_resp -- MUST be the same as q_u->max_read_size + for i=0..n + EVENTLOGRECORD record + DWORD sent_size -- sum of EVENTLOGRECORD lengths if records returned, 0 otherwise + DWORD real_size -- 0 if records returned, otherwise length of next record to be returned + WERROR status */ +BOOL eventlog_io_r_read_eventlog(const char *desc, + EVENTLOG_Q_READ_EVENTLOG *q_u, + EVENTLOG_R_READ_EVENTLOG *r_u, + prs_struct *ps, + int depth) +{ + Eventlog_entry *entry; + uint32 record_written = 0; + uint32 record_total = 0; + + if(r_u == NULL) + return False; + + prs_debug(ps, depth, desc, "eventlog_io_r_read_eventlog"); + depth++; + + /* First, see if we've read more logs than we can output */ + + if(r_u->num_bytes_in_resp > q_u->max_read_size) { + entry = r_u->entry; + + /* remove the size of the last entry from the list */ + + while(entry->next != NULL) + entry = entry->next; + + r_u->num_bytes_in_resp -= entry->record.length; + + /* do not output the last log entry */ + + r_u->num_records--; + } + + entry = r_u->entry; + record_total = r_u->num_records; + + if(r_u->num_bytes_in_resp != 0) + r_u->sent_size = r_u->num_bytes_in_resp; + else + r_u->real_size = entry->record.length; + + if(!(prs_align(ps))) + return False; + if(!(prs_uint32("bytes in resp", ps, depth, &(q_u->max_read_size)))) + return False; + + while(entry != NULL && record_written < record_total) + { + DEBUG(10, ("eventlog_io_r_read_eventlog: writing record [%d] out of [%d].\n", record_written, record_total)); + + /* Encode the actual eventlog record record */ + + if(!(prs_uint32("length", ps, depth, &(entry->record.length)))) + return False; + if(!(prs_uint32("reserved", ps, depth, &(entry->record.reserved1)))) + return False; + if(!(prs_uint32("record number", ps, depth, &(entry->record.record_number)))) + return False; + if(!(prs_uint32("time generated", ps, depth, &(entry->record.time_generated)))) + return False; + if(!(prs_uint32("time written", ps, depth, &(entry->record.time_written)))) + return False; + if(!(prs_uint32("event id", ps, depth, &(entry->record.event_id)))) + return False; + if(!(prs_uint16("event type", ps, depth, &(entry->record.event_type)))) + return False; + if(!(prs_uint16("num strings", ps, depth, &(entry->record.num_strings)))) + return False; + if(!(prs_uint16("event category", ps, depth, &(entry->record.event_category)))) + return False; + if(!(prs_uint16("reserved2", ps, depth, &(entry->record.reserved2)))) + return False; + if(!(prs_uint32("closing record", ps, depth, &(entry->record.closing_record_number)))) + return False; + if(!(prs_uint32("string offset", ps, depth, &(entry->record.string_offset)))) + return False; + if(!(prs_uint32("user sid length", ps, depth, &(entry->record.user_sid_length)))) + return False; + if(!(prs_uint32("user sid offset", ps, depth, &(entry->record.user_sid_offset)))) + return False; + if(!(prs_uint32("data length", ps, depth, &(entry->record.data_length)))) + return False; + if(!(prs_uint32("data offset", ps, depth, &(entry->record.data_offset)))) + return False; + if(!(prs_align(ps))) + return False; + + /* Now encoding data */ + + if(!(prs_uint8s(False, "buffer", ps, depth, entry->data, + entry->record.length - sizeof(Eventlog_record) - sizeof(entry->record.length)))) + { + return False; + } + + if(!(prs_align(ps))) + return False; + if(!(prs_uint32("length 2", ps, depth, &(entry->record.length)))) + return False; + + entry = entry->next; + record_written++; + + } /* end of encoding EVENTLOGRECORD */ + + /* Now pad with whitespace until the end of the response buffer */ + + r_u->end_of_entries_padding = (uint8 *)calloc(q_u->max_read_size - r_u->num_bytes_in_resp, sizeof(uint8)); + + if(!(prs_uint8s(False, "end of entries padding", ps, + depth, r_u->end_of_entries_padding, + (q_u->max_read_size - r_u->num_bytes_in_resp)))) + { + return False; + } + + free(r_u->end_of_entries_padding); + + /* We had better be DWORD aligned here */ + + if(!(prs_uint32("sent size", ps, depth, &(r_u->sent_size)))) + return False; + if(!(prs_uint32("real size", ps, depth, &(r_u->real_size)))) + return False; + if(!(prs_werror("status code", ps, depth, &(r_u->status)))) + return False; + + 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_align(ps)) + return False; + if(!(prs_uint32("unknown1", ps, depth, &q_u->unknown1))) + return False; + if(!(prs_uint16("backup_file_length", ps, depth, &q_u->backup_file_length))) + return False; + if(!(prs_uint16("backup_file_size", ps, depth, &q_u->backup_file_size))) + return False; + if(!prs_uint32("backup_file_ptr", ps, depth, &q_u->backup_file_ptr)) + return False; + if(!smb_io_unistr2("backup file", &q_u->backup_file, q_u->backup_file_ptr, ps, depth)) + 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_werror("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 index bbff258722..d0b9b20a3b 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -906,7 +906,7 @@ void init_q_lookup_sids(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_SIDS *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.value = level; + q_l->level = level; } /******************************************************************* @@ -928,7 +928,10 @@ BOOL lsa_io_q_lookup_sids(const char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct * return False; if(!lsa_io_trans_names("names ", &q_s->names, ps, depth)) /* translated names */ return False; - if(!smb_io_lookup_level("switch ", &q_s->level, ps, depth)) /* lookup level */ + + 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)) diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index dec20769b6..76c6438d59 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -131,28 +131,6 @@ BOOL smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth) return True; } -/******************************************************************* - Reads or writes a LOOKUP_LEVEL structure. -********************************************************************/ - -BOOL smb_io_lookup_level(const char *desc, LOOKUP_LEVEL *level, prs_struct *ps, int depth) -{ - if (level == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_lookup_level"); - depth++; - - if(!prs_align(ps)) - return False; - if(!prs_uint16("value", ps, depth, &level->value)) - return False; - if(!prs_align(ps)) - return False; - - return True; -} - /******************************************************************* Gets an enumeration handle from an ENUM_HND structure. ********************************************************************/ @@ -707,10 +685,10 @@ BOOL smb_io_buffer5(const char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) } /******************************************************************* - Inits a BUFFER2 structure. + Inits a REGVAL_BUFFER structure. ********************************************************************/ -void init_buffer2(BUFFER2 *str, const uint8 *buf, size_t len) +void init_regval_buffer(REGVAL_BUFFER *str, const uint8 *buf, size_t len) { ZERO_STRUCTP(str); @@ -723,50 +701,39 @@ void init_buffer2(BUFFER2 *str, const uint8 *buf, size_t len) SMB_ASSERT(str->buf_max_len >= str->buf_len); str->buffer = TALLOC_ZERO(get_talloc_ctx(), str->buf_max_len); if (str->buffer == NULL) - smb_panic("init_buffer2: talloc fail\n"); + smb_panic("init_regval_buffer: talloc fail\n"); memcpy(str->buffer, buf, str->buf_len); } } /******************************************************************* - Reads or writes a BUFFER2 structure. + Reads or writes a REGVAL_BUFFER structure. the uni_max_len member tells you how large the buffer is. the uni_str_len member tells you how much of the buffer is really used. ********************************************************************/ -BOOL smb_io_buffer2(const char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_regval_buffer(const char *desc, prs_struct *ps, int depth, REGVAL_BUFFER *buf2) { - if (buf2 == NULL) - return False; - if (buffer) { - - prs_debug(ps, depth, desc, "smb_io_buffer2"); - depth++; + prs_debug(ps, depth, desc, "smb_io_regval_buffer"); + depth++; - if(!prs_align(ps)) - return False; + if(!prs_align(ps)) + return False; - if(!prs_uint32("uni_max_len", ps, depth, &buf2->buf_max_len)) - return False; - if(!prs_uint32("offset ", ps, depth, &buf2->offset)) - return False; - if(!prs_uint32("buf_len ", ps, depth, &buf2->buf_len)) - return False; - - /* buffer advanced by indicated length of string - NOT by searching for null-termination */ - - if(!prs_buffer2(True, "buffer ", ps, depth, buf2)) - return False; + if(!prs_uint32("uni_max_len", ps, depth, &buf2->buf_max_len)) + return False; + if(!prs_uint32("offset ", ps, depth, &buf2->offset)) + return False; + if(!prs_uint32("buf_len ", ps, depth, &buf2->buf_len)) + return False; - } else { + /* buffer advanced by indicated length of string + NOT by searching for null-termination */ - prs_debug(ps, depth, desc, "smb_io_buffer2 - NULL"); - depth++; - memset((char *)buf2, '\0', sizeof(*buf2)); + if(!prs_regval_buffer(True, "buffer ", ps, depth, buf2)) + return False; - } return True; } @@ -933,6 +900,20 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) str->uni_max_len++; } +/******************************************************************* + Inits a UNISTR4 structure. +********************************************************************/ + +void init_unistr4(UNISTR4 *uni4, const char *buf, enum unistr2_term_codes flags) +{ + uni4->string = TALLOC_P( get_talloc_ctx(), UNISTR2 ); + init_unistr2( uni4->string, buf, flags ); + + uni4->length = 2 * (uni4->string->uni_str_len); + uni4->size = 2 * (uni4->string->uni_max_len); +} + + /** * Inits a UNISTR2 structure. * @param ctx talloc context to allocate string on @@ -1033,6 +1014,57 @@ void init_unistr2_from_datablob(UNISTR2 *str, DATA_BLOB *blob) } } +/******************************************************************* + UNISTR2* are a little different in that the pointer and the UNISTR2 + are not necessarily read/written back to back. So we break it up + into 2 separate functions. + See SPOOL_USER_1 in include/rpc_spoolss.h for an example. +********************************************************************/ + +BOOL prs_io_unistr2_p(const char *desc, prs_struct *ps, int depth, UNISTR2 **uni2) +{ + uint32 data_p; + + /* caputure the pointer value to stream */ + + data_p = (uint32) *uni2; + + if ( !prs_uint32("ptr", ps, depth, &data_p )) + return False; + + /* we're done if there is no data */ + + if ( !data_p ) + return True; + + if (UNMARSHALLING(ps)) { + if ( !(*uni2 = PRS_ALLOC_MEM(ps, UNISTR2, 1)) ) + return False; + } + + return True; +} + +/******************************************************************* + now read/write the actual UNISTR2. Memory for the UNISTR2 (but + not UNISTR2.buffer) has been allocated previously by prs_unistr2_p() +********************************************************************/ + +BOOL prs_io_unistr2(const char *desc, prs_struct *ps, int depth, UNISTR2 *uni2 ) +{ + /* just return true if there is no pointer to deal with. + the memory must have been previously allocated on unmarshalling + by prs_unistr2_p() */ + + if ( !uni2 ) + return True; + + /* just pass off to smb_io_unstr2() passing the uni2 address as + the pointer (like you would expect) */ + + return smb_io_unistr2( desc, uni2, (uint32)uni2, ps, depth ); +} + /******************************************************************* Reads or writes a UNISTR2 structure. XXXX NOTE: UNISTR2 structures need NOT be null-terminated. @@ -1076,10 +1108,29 @@ BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct * return True; } +/******************************************************************* + now read/write UNISTR4 +********************************************************************/ + +BOOL prs_unistr4(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) +{ -/* + if ( !prs_uint16("length", ps, depth, &uni4->length )) + return False; + if ( !prs_uint16("size", ps, depth, &uni4->size )) + return False; + + if ( !prs_pointer( desc, ps, depth, (void**)&uni4->string, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) ) + return False; + + return True; +} + + +/******************************************************************** initialise a UNISTR_ARRAY from a char** -*/ +********************************************************************/ + BOOL init_unistr2_array(UNISTR2_ARRAY *array, uint32 count, const char **strings) { diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 566efae7a9..1b9ac51c61 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -588,6 +588,37 @@ BOOL prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8) return True; } +/******************************************************************* + Stream a uint16* (allocate memory if unmarshalling) + ********************************************************************/ + +BOOL prs_pointer( const char *name, prs_struct *ps, int depth, + void **data, size_t data_size, + BOOL(*prs_fn)(const char*, prs_struct*, int, void*) ) +{ + uint32 data_p; + + /* caputure the pointer value to stream */ + + data_p = (uint32) *data; + + if ( !prs_uint32("ptr", ps, depth, &data_p )) + return False; + + /* we're done if there is no data */ + + if ( !data_p ) + return True; + + if (UNMARSHALLING(ps)) { + if ( !(*data = PRS_ALLOC_MEM_VOID(ps, data_size)) ) + return False; + } + + return prs_fn(name, ps, depth, *data); +} + + /******************************************************************* Stream a uint16. ********************************************************************/ @@ -598,12 +629,12 @@ BOOL prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16) if (q == NULL) return False; - if (UNMARSHALLING(ps)) { + if (UNMARSHALLING(ps)) { if (ps->bigendian_data) *data16 = RSVAL(q,0); else *data16 = SVAL(q,0); - } else { + } else { if (ps->bigendian_data) RSSVAL(q,0,*data16); else @@ -646,34 +677,6 @@ BOOL prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32) return True; } -/******************************************************************* - Stream a uint32* (allocate memory if unmarshalling) - ********************************************************************/ - -BOOL prs_uint32_p(const char *name, prs_struct *ps, int depth, uint32 **data32) -{ - uint32 data_p; - - /* caputure the pointer value to stream */ - - data_p = (uint32) *data32; - - if ( !prs_uint32("ptr", ps, depth, &data_p )) - return False; - - /* we're done if there is no data */ - - if ( !data_p ) - return True; - - if (UNMARSHALLING(ps)) { - if ( !(*data32 = PRS_ALLOC_MEM(ps, uint32, 1)) ) - return False; - } - - return prs_uint32(name, ps, depth, *data32); -} - /******************************************************************* Stream a NTSTATUS ********************************************************************/ @@ -944,28 +947,28 @@ BOOL prs_buffer5(BOOL charmode, const char *name, prs_struct *ps, int depth, BUF in byte chars. String is in little-endian format. ********************************************************************/ -BOOL prs_buffer2(BOOL charmode, const char *name, prs_struct *ps, int depth, BUFFER2 *str) +BOOL prs_regval_buffer(BOOL charmode, const char *name, prs_struct *ps, int depth, REGVAL_BUFFER *buf) { char *p; - char *q = prs_mem_get(ps, str->buf_len); + char *q = prs_mem_get(ps, buf->buf_len); if (q == NULL) return False; if (UNMARSHALLING(ps)) { - if (str->buf_len > str->buf_max_len) { + if (buf->buf_len > buf->buf_max_len) { return False; } - if ( str->buf_max_len ) { - str->buffer = PRS_ALLOC_MEM(ps, uint16, str->buf_max_len); - if ( str->buffer == NULL ) + if ( buf->buf_max_len ) { + buf->buffer = PRS_ALLOC_MEM(ps, uint16, buf->buf_max_len); + if ( buf->buffer == NULL ) return False; } } - p = (char *)str->buffer; + p = (char *)buf->buffer; - dbg_rw_punival(charmode, name, depth, ps, q, p, str->buf_len/2); - ps->data_offset += str->buf_len; + dbg_rw_punival(charmode, name, depth, ps, q, p, buf->buf_len/2); + ps->data_offset += buf->buf_len; return True; } diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index a67a3973b9..fabffd2b6d 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -6,7 +6,8 @@ * Copyright (C) Paul Ashton 1997. * Copyright (C) Marc Jacobsen 1999. * Copyright (C) Simo Sorce 2000. - * Copyright (C) Gerald Carter 2002. + * Copyright (C) Jeremy Cooper 2004 + * Copyright (C) Gerald Carter 2002-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 @@ -29,10 +30,10 @@ #define DBGC_CLASS DBGC_RPC_PARSE /******************************************************************* - Fill in a BUFFER2 for the data given a REGISTRY_VALUE + Fill in a REGVAL_BUFFER for the data given a REGISTRY_VALUE *******************************************************************/ -static uint32 reg_init_buffer2( BUFFER2 *buf2, REGISTRY_VALUE *val ) +static uint32 reg_init_regval_buffer( REGVAL_BUFFER *buf2, REGISTRY_VALUE *val ) { uint32 real_size = 0; @@ -40,151 +41,72 @@ static uint32 reg_init_buffer2( BUFFER2 *buf2, REGISTRY_VALUE *val ) return 0; real_size = regval_size(val); - init_buffer2( buf2, (unsigned char*)regval_data_p(val), real_size ); + init_regval_buffer( buf2, (unsigned char*)regval_data_p(val), real_size ); return real_size; } /******************************************************************* - Inits a structure. + Inits a hive connect request structure ********************************************************************/ -void init_reg_q_open_hkcr(REG_Q_OPEN_HKCR *q_o, - uint16 unknown_0, uint32 level) +void init_reg_q_open_hive( REG_Q_OPEN_HIVE *q_o, uint32 access_desired ) { - q_o->ptr = 1; - q_o->unknown_0 = unknown_0; - q_o->unknown_1 = 0x0; /* random - changes */ - q_o->level = level; + + q_o->server = TALLOC_P( get_talloc_ctx(), uint16); + *q_o->server = 0x1; + + q_o->access = access_desired; } /******************************************************************* -reads or writes a structure. +Marshalls a hive connect request ********************************************************************/ -BOOL reg_io_q_open_hkcr(const char *desc, REG_Q_OPEN_HKCR *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_open_hive(const char *desc, REG_Q_OPEN_HIVE *q_u, + prs_struct *ps, int depth) { - if (r_q == NULL) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_open_hkcr"); + prs_debug(ps, depth, desc, "reg_io_q_open_hive"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32("ptr ", ps, depth, &r_q->ptr)) + if(!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; - if (r_q->ptr != 0) { - if(!prs_uint16("unknown_0", ps, depth, &r_q->unknown_0)) - return False; - if(!prs_uint16("unknown_1", ps, depth, &r_q->unknown_1)) - return False; - if(!prs_uint32("level ", ps, depth, &r_q->level)) - return False; - } + if(!prs_uint32("access", ps, depth, &q_u->access)) + return False; return True; } /******************************************************************* -reads or writes a structure. +Unmarshalls a hive connect response ********************************************************************/ -BOOL reg_io_r_open_hkcr(const char *desc, REG_R_OPEN_HKCR *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_open_hive(const char *desc, REG_R_OPEN_HIVE *r_u, + prs_struct *ps, int depth) { - if (r_r == NULL) + if ( !r_u ) return False; - prs_debug(ps, depth, desc, "reg_io_r_open_hkcr"); + prs_debug(ps, depth, desc, "reg_io_r_open_hive"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &r_r->pol, ps, depth)) - return False; - - if(!prs_werror("status", ps, depth, &r_r->status)) - return False; - - return True; -} - -/******************************************************************* - Inits a structure. -********************************************************************/ - -void init_reg_q_open_hklm(REG_Q_OPEN_HKLM * q_o, - uint16 unknown_0, uint32 access_mask) -{ - q_o->ptr = 1; - q_o->unknown_0 = unknown_0; - q_o->unknown_1 = 0x0; /* random - changes */ - q_o->access_mask = access_mask; - -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL reg_io_q_open_hklm(const char *desc, REG_Q_OPEN_HKLM * r_q, prs_struct *ps, - int depth) -{ - if (r_q == NULL) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_open_hklm"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("ptr ", ps, depth, &(r_q->ptr))) - return False; - if (r_q->ptr != 0) - { - if (!prs_uint16("unknown_0", ps, depth, &(r_q->unknown_0))) - return False; - if (!prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1))) - return False; - if (!prs_uint32("access_mask", ps, depth, &(r_q->access_mask))) - return False; - } - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL reg_io_r_open_hklm(const char *desc, REG_R_OPEN_HKLM * r_r, prs_struct *ps, - int depth) -{ - if (r_r == NULL) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_open_hklm"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!smb_io_pol_hnd("", &r_r->pol, ps, depth)) + if(!smb_io_pol_hnd("", &r_u->pol, ps, depth)) return False; - if (!prs_werror("status", ps, depth, &r_r->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; } - - - /******************************************************************* Inits a structure. ********************************************************************/ @@ -198,9 +120,9 @@ void init_reg_q_flush_key(REG_Q_FLUSH_KEY *q_u, POLICY_HND *pol) reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_flush_key(const char *desc, REG_Q_FLUSH_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_flush_key(const char *desc, REG_Q_FLUSH_KEY *q_u, prs_struct *ps, int depth) { - if (r_q == NULL) + if ( !q_u ) return False; prs_debug(ps, depth, desc, "reg_io_q_flush_key"); @@ -209,19 +131,20 @@ BOOL reg_io_q_flush_key(const char *desc, REG_Q_FLUSH_KEY *r_q, prs_struct *ps, if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) return False; return True; } /******************************************************************* -reads or writes a structure. +Unmarshalls a registry key flush response ********************************************************************/ -BOOL reg_io_r_flush_key(const char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_flush_key(const char *desc, REG_R_FLUSH_KEY *r_u, + prs_struct *ps, int depth) { - if (r_r == NULL) + if ( !r_u ) return False; prs_debug(ps, depth, desc, "reg_io_r_flush_key"); @@ -230,7 +153,7 @@ BOOL reg_io_r_flush_key(const char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_werror("status", ps, depth, &r_r->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -240,12 +163,14 @@ BOOL reg_io_r_flush_key(const char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps, reads or writes SEC_DESC_BUF and SEC_DATA structures. ********************************************************************/ -static BOOL reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, SEC_DESC_BUF *data, prs_struct *ps, int depth) +static BOOL reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, + SEC_DESC_BUF *data, prs_struct *ps, int depth) { if (ptr != 0) { uint32 hdr_offset; uint32 old_offset; - if(!smb_io_hdrbuf_pre("hdr_sec", hdr_sec, ps, depth, &hdr_offset)) + if(!smb_io_hdrbuf_pre("hdr_sec", hdr_sec, ps, depth, + &hdr_offset)) return False; old_offset = prs_offset(ps); @@ -256,14 +181,16 @@ static BOOL reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, SEC_DES } if (ptr3 == NULL || *ptr3 != 0) { - if(!sec_io_desc_buf("data ", &data, ps, depth)) /* JRA - this line is probably wrong... */ + /* JRA - this next line is probably wrong... */ + if(!sec_io_desc_buf("data ", &data, ps, depth)) return False; } - if(!smb_io_hdrbuf_post("hdr_sec", hdr_sec, ps, depth, hdr_offset, - data->max_len, data->len)) + if(!smb_io_hdrbuf_post("hdr_sec", hdr_sec, ps, depth, + hdr_offset, data->max_len, data->len)) return False; - if(!prs_set_offset(ps, old_offset + data->len + sizeof(uint32) * ((ptr3 != NULL) ? 5 : 3))) + if(!prs_set_offset(ps, old_offset + data->len + + sizeof(uint32) * ((ptr3 != NULL) ? 5 : 3))) return False; if(!prs_align(ps)) @@ -274,28 +201,25 @@ static BOOL reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, SEC_DES } /******************************************************************* - Inits a structure. + Inits a registry key create request ********************************************************************/ void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, - char *name, char *class, SEC_ACCESS *sam_access, - SEC_DESC_BUF *sec_buf) + char *name, char *class, uint32 access_desired, + SEC_DESC_BUF *sec_buf) { ZERO_STRUCTP(q_c); memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); - init_unistr2(&q_c->uni_name, name, UNI_STR_TERMINATE); - init_uni_hdr(&q_c->hdr_name, &q_c->uni_name); - init_unistr2(&q_c->uni_class, class, UNI_STR_TERMINATE); - init_uni_hdr(&q_c->hdr_class, &q_c->uni_class); + init_unistr4( &q_c->name, name, UNI_STR_TERMINATE ); + init_unistr4( &q_c->class, class, UNI_STR_TERMINATE ); - q_c->reserved = 0x00000000; - memcpy(&q_c->sam_access, sam_access, sizeof(q_c->sam_access)); + q_c->access = access_desired; - q_c->ptr1 = 1; - q_c->sec_info = DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION; + q_c->sec_info = TALLOC_P( get_talloc_ctx(), uint32 ); + *q_c->sec_info = DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION; q_c->data = sec_buf; q_c->ptr2 = 1; @@ -305,12 +229,13 @@ void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, } /******************************************************************* -reads or writes a structure. +Marshalls a registry key create request ********************************************************************/ -BOOL reg_io_q_create_key(const char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_create_key(const char *desc, REG_Q_CREATE_KEY *q_u, + prs_struct *ps, int depth) { - if (r_q == NULL) + if ( !q_u ) return False; prs_debug(ps, depth, desc, "reg_io_q_create_key"); @@ -319,54 +244,47 @@ BOOL reg_io_q_create_key(const char *desc, REG_Q_CREATE_KEY *r_q, prs_struct *p if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &r_q->pnt_pol, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->pnt_pol, ps, depth)) return False; - if(!smb_io_unihdr ("", &r_q->hdr_name, ps, depth)) - return False; - if(!smb_io_unistr2("", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth)) + if(!prs_unistr4 ("name", ps, depth, &q_u->name)) return False; if(!prs_align(ps)) return False; - if(!smb_io_unihdr ("", &r_q->hdr_class, ps, depth)) - return False; - if(!smb_io_unistr2("", &r_q->uni_class, r_q->hdr_class.buffer, ps, depth)) + if(!prs_unistr4 ("class", ps, depth, &q_u->class)) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("reserved", ps, depth, &r_q->reserved)) + if(!prs_uint32("reserved", ps, depth, &q_u->reserved)) return False; - if(!sec_io_access("sam_access", &r_q->sam_access, ps, depth)) + if(!prs_uint32("access", ps, depth, &q_u->access)) return False; - if(!prs_uint32("ptr1", ps, depth, &r_q->ptr1)) + if(!prs_pointer("sec_info", ps, depth, (void**)&q_u->sec_info, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if (r_q->ptr1 != 0) { - if(!prs_uint32("sec_info", ps, depth, &r_q->sec_info)) - return False; - } - - if(!prs_uint32("ptr2", ps, depth, &r_q->ptr2)) + if(!prs_uint32("ptr2", ps, depth, &q_u->ptr2)) return False; - if(!reg_io_hdrbuf_sec(r_q->ptr2, &r_q->ptr3, &r_q->hdr_sec, r_q->data, ps, depth)) + if(!reg_io_hdrbuf_sec(q_u->ptr2, &q_u->ptr3, &q_u->hdr_sec, q_u->data, + ps, depth)) return False; - if(!prs_uint32("unknown_2", ps, depth, &r_q->unknown_2)) + if(!prs_uint32("unknown_2", ps, depth, &q_u->unknown_2)) return False; return True; } /******************************************************************* -reads or writes a structure. +Unmarshalls a registry key create response ********************************************************************/ -BOOL reg_io_r_create_key(const char *desc, REG_R_CREATE_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_create_key(const char *desc, REG_R_CREATE_KEY *r_u, + prs_struct *ps, int depth) { - if (r_r == NULL) + if ( !r_u ) return False; prs_debug(ps, depth, desc, "reg_io_r_create_key"); @@ -375,12 +293,12 @@ BOOL reg_io_r_create_key(const char *desc, REG_R_CREATE_KEY *r_r, prs_struct *p if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &r_r->key_pol, ps, depth)) + if(!smb_io_pol_hnd("", &r_u->key_pol, ps, depth)) return False; - if(!prs_uint32("unknown", ps, depth, &r_r->unknown)) + if(!prs_uint32("unknown", ps, depth, &r_u->unknown)) return False; - if(!prs_werror("status", ps, depth, &r_r->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -392,23 +310,22 @@ BOOL reg_io_r_create_key(const char *desc, REG_R_CREATE_KEY *r_r, prs_struct *p ********************************************************************/ void init_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd, - char *name) + char *name) { ZERO_STRUCTP(q_c); memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); - - init_unistr2(&q_c->uni_name, name, UNI_STR_TERMINATE); - init_uni_hdr(&q_c->hdr_name, &q_c->uni_name); + init_unistr4(&q_c->name, name, UNI_STR_TERMINATE); } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_delete_val(const char *desc, REG_Q_DELETE_VALUE *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_delete_val(const char *desc, REG_Q_DELETE_VALUE *q_u, + prs_struct *ps, int depth) { - if (r_q == NULL) + if ( !q_u ) return False; prs_debug(ps, depth, desc, "reg_io_q_delete_val"); @@ -417,12 +334,10 @@ BOOL reg_io_q_delete_val(const char *desc, REG_Q_DELETE_VALUE *r_q, prs_struct if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &r_q->pnt_pol, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->pnt_pol, ps, depth)) return False; - if(!smb_io_unihdr ("", &r_q->hdr_name, ps, depth)) - return False; - if(!smb_io_unistr2("", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth)) + if(!prs_unistr4("name", ps, depth, &q_u->name)) return False; if(!prs_align(ps)) return False; @@ -435,9 +350,10 @@ BOOL reg_io_q_delete_val(const char *desc, REG_Q_DELETE_VALUE *r_q, prs_struct reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_delete_val(const char *desc, REG_R_DELETE_VALUE *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_delete_val(const char *desc, REG_R_DELETE_VALUE *r_u, + prs_struct *ps, int depth) { - if (r_r == NULL) + if ( !r_u ) return False; prs_debug(ps, depth, desc, "reg_io_r_delete_val"); @@ -446,7 +362,7 @@ BOOL reg_io_r_delete_val(const char *desc, REG_R_DELETE_VALUE *r_r, prs_struct if(!prs_align(ps)) return False; - if(!prs_werror("status", ps, depth, &r_r->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -457,23 +373,23 @@ BOOL reg_io_r_delete_val(const char *desc, REG_R_DELETE_VALUE *r_r, prs_struct ********************************************************************/ void init_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd, - char *name) + char *name) { ZERO_STRUCTP(q_c); memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); - init_unistr2(&q_c->uni_name, name, UNI_STR_TERMINATE); - init_uni_hdr(&q_c->hdr_name, &q_c->uni_name); + init_unistr4(&q_c->name, name, UNI_STR_TERMINATE); } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_delete_key(const char *desc, REG_Q_DELETE_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_delete_key(const char *desc, REG_Q_DELETE_KEY *q_u, + prs_struct *ps, int depth) { - if (r_q == NULL) + if ( !q_u ) return False; prs_debug(ps, depth, desc, "reg_io_q_delete_key"); @@ -482,12 +398,10 @@ BOOL reg_io_q_delete_key(const char *desc, REG_Q_DELETE_KEY *r_q, prs_struct *p if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &r_q->pnt_pol, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->pnt_pol, ps, depth)) return False; - if(!smb_io_unihdr ("", &r_q->hdr_name, ps, depth)) - return False; - if(!smb_io_unistr2("", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth)) + if(!prs_unistr4("", ps, depth, &q_u->name)) return False; if(!prs_align(ps)) return False; @@ -499,9 +413,9 @@ BOOL reg_io_q_delete_key(const char *desc, REG_Q_DELETE_KEY *r_q, prs_struct *p reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_delete_key(const char *desc, REG_R_DELETE_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_delete_key(const char *desc, REG_R_DELETE_KEY *r_u, prs_struct *ps, int depth) { - if (r_r == NULL) + if ( !r_u ) return False; prs_debug(ps, depth, desc, "reg_io_r_delete_key"); @@ -510,7 +424,7 @@ BOOL reg_io_r_delete_key(const char *desc, REG_R_DELETE_KEY *r_r, prs_struct *p if(!prs_align(ps)) return False; - if(!prs_werror("status", ps, depth, &r_r->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -520,21 +434,21 @@ BOOL reg_io_r_delete_key(const char *desc, REG_R_DELETE_KEY *r_r, prs_struct *p Inits a structure. ********************************************************************/ -void init_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, UNISTR2 *uni2) +void init_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, const char *class) { ZERO_STRUCTP(q_o); memcpy(&q_o->pol, hnd, sizeof(q_o->pol)); - init_uni_hdr(&q_o->hdr_class, uni2); + init_unistr4(&q_o->class, class, UNI_STR_TERMINATE); } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_query_key(const char *desc, REG_Q_QUERY_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_query_key(const char *desc, REG_Q_QUERY_KEY *q_u, prs_struct *ps, int depth) { - if (r_q == NULL) + if ( !q_u ) return False; prs_debug(ps, depth, desc, "reg_io_q_query_key"); @@ -543,11 +457,9 @@ BOOL reg_io_q_query_key(const char *desc, REG_Q_QUERY_KEY *r_q, prs_struct *ps, if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) - return False; - if(!smb_io_unihdr ("", &r_q->hdr_class, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) return False; - if(!smb_io_unistr2("", &r_q->uni_class, r_q->hdr_class.buffer, ps, depth)) + if(!prs_unistr4("class", ps, depth, &q_u->class)) return False; if(!prs_align(ps)) @@ -561,9 +473,9 @@ BOOL reg_io_q_query_key(const char *desc, REG_Q_QUERY_KEY *r_q, prs_struct *ps, reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_query_key(const char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_query_key(const char *desc, REG_R_QUERY_KEY *r_u, prs_struct *ps, int depth) { - if (r_r == NULL) + if ( !r_u ) return False; prs_debug(ps, depth, desc, "reg_io_r_query_key"); @@ -572,32 +484,30 @@ BOOL reg_io_r_query_key(const char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, if(!prs_align(ps)) return False; - if(!smb_io_unihdr ("", &r_r->hdr_class, ps, depth)) - return False; - if(!smb_io_unistr2("", &r_r->uni_class, r_r->hdr_class.buffer, ps, depth)) + if(!prs_unistr4("class", ps, depth, &r_u->class)) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("num_subkeys ", ps, depth, &r_r->num_subkeys)) + if(!prs_uint32("num_subkeys ", ps, depth, &r_u->num_subkeys)) return False; - if(!prs_uint32("max_subkeylen ", ps, depth, &r_r->max_subkeylen)) + if(!prs_uint32("max_subkeylen ", ps, depth, &r_u->max_subkeylen)) return False; - if(!prs_uint32("reserved ", ps, depth, &r_r->reserved)) + if(!prs_uint32("reserved ", ps, depth, &r_u->reserved)) return False; - if(!prs_uint32("num_values ", ps, depth, &r_r->num_values)) + if(!prs_uint32("num_values ", ps, depth, &r_u->num_values)) return False; - if(!prs_uint32("max_valnamelen", ps, depth, &r_r->max_valnamelen)) + if(!prs_uint32("max_valnamelen", ps, depth, &r_u->max_valnamelen)) return False; - if(!prs_uint32("max_valbufsize", ps, depth, &r_r->max_valbufsize)) + if(!prs_uint32("max_valbufsize", ps, depth, &r_u->max_valbufsize)) return False; - if(!prs_uint32("sec_desc ", ps, depth, &r_r->sec_desc)) + if(!prs_uint32("sec_desc ", ps, depth, &r_u->sec_desc)) return False; - if(!smb_io_time("mod_time ", &r_r->mod_time, ps, depth)) + if(!smb_io_time("mod_time ", &r_u->mod_time, ps, depth)) return False; - if(!prs_werror("status", ps, depth, &r_r->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -607,7 +517,7 @@ BOOL reg_io_r_query_key(const char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, Inits a structure. ********************************************************************/ -void init_reg_q_unknown_1a(REG_Q_UNKNOWN_1A *q_o, POLICY_HND *hnd) +void init_reg_q_getversion(REG_Q_GETVERSION *q_o, POLICY_HND *hnd) { memcpy(&q_o->pol, hnd, sizeof(q_o->pol)); } @@ -617,18 +527,18 @@ void init_reg_q_unknown_1a(REG_Q_UNKNOWN_1A *q_o, POLICY_HND *hnd) reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_unknown_1a(const char *desc, REG_Q_UNKNOWN_1A *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_getversion(const char *desc, REG_Q_GETVERSION *q_u, prs_struct *ps, int depth) { - if (r_q == NULL) + if ( !q_u ) return False; - prs_debug(ps, depth, desc, "reg_io_q_unknown_1a"); + prs_debug(ps, depth, desc, "reg_io_q_getversion"); depth++; if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) return False; return True; @@ -638,20 +548,20 @@ BOOL reg_io_q_unknown_1a(const char *desc, REG_Q_UNKNOWN_1A *r_q, prs_struct *p reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_unknown_1a(const char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_getversion(const char *desc, REG_R_GETVERSION *r_u, prs_struct *ps, int depth) { - if (r_r == NULL) + if ( !r_u ) return False; - prs_debug(ps, depth, desc, "reg_io_r_unknown_1a"); + prs_debug(ps, depth, desc, "reg_io_r_getversion"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32("unknown", ps, depth, &r_r->unknown)) + if(!prs_uint32("unknown", ps, depth, &r_u->unknown)) return False; - if(!prs_werror("status" , ps, depth, &r_r->status)) + if(!prs_werror("status" , ps, depth, &r_u->status)) return False; return True; @@ -662,9 +572,9 @@ BOOL reg_io_r_unknown_1a(const char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *p reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_save_key(const char *desc, REG_Q_SAVE_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_save_key(const char *desc, REG_Q_SAVE_KEY *q_u, prs_struct *ps, int depth) { - if (r_q == NULL) + if ( !q_u ) return False; prs_debug(ps, depth, desc, "reg_io_q_save_key"); @@ -673,15 +583,13 @@ BOOL reg_io_q_save_key(const char *desc, REG_Q_SAVE_KEY *r_q, prs_struct *ps, i if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) return False; - if(!smb_io_unihdr ("hdr_file", &r_q->hdr_file, ps, depth)) - return False; - if(!smb_io_unistr2("uni_file", &r_q->uni_file, r_q->hdr_file.buffer, ps, depth)) + if(!prs_unistr4("filename", ps, depth, &q_u->filename)) return False; - if(!prs_uint32("unknown", ps, depth, &r_q->unknown)) + if(!prs_uint32("unknown", ps, depth, &q_u->unknown)) return False; return True; @@ -691,9 +599,9 @@ BOOL reg_io_q_save_key(const char *desc, REG_Q_SAVE_KEY *r_q, prs_struct *ps, i reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_save_key(const char *desc, REG_R_SAVE_KEY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_save_key(const char *desc, REG_R_SAVE_KEY *r_u, prs_struct *ps, int depth) { - if (r_r == NULL) + if ( !r_u ) return False; prs_debug(ps, depth, desc, "reg_io_r_save_key"); @@ -702,73 +610,7 @@ BOOL reg_io_r_save_key(const char *desc, REG_R_SAVE_KEY *r_r, prs_struct *ps, i if(!prs_align(ps)) return False; - if(!prs_werror("status" , ps, depth, &r_r->status)) - return False; - - return True; -} - -/******************************************************************* - Inits a structure. -********************************************************************/ - -void init_reg_q_open_hku(REG_Q_OPEN_HKU *q_o, - uint16 unknown_0, uint32 access_mask) -{ - q_o->ptr = 1; - q_o->unknown_0 = unknown_0; - q_o->unknown_1 = 0x0; /* random - changes */ - q_o->access_mask = access_mask; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_open_hku(const char *desc, REG_Q_OPEN_HKU *r_q, prs_struct *ps, int depth) -{ - if (r_q == NULL) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_open_hku"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr ", ps, depth, &r_q->ptr)) - return False; - if (r_q->ptr != 0) { - if(!prs_uint16("unknown_0 ", ps, depth, &r_q->unknown_0)) - return False; - if(!prs_uint16("unknown_1 ", ps, depth, &r_q->unknown_1)) - return False; - if(!prs_uint32("access_mask ", ps, depth, &r_q->access_mask)) - return False; - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_r_open_hku(const char *desc, REG_R_OPEN_HKU *r_r, prs_struct *ps, int depth) -{ - if (r_r == NULL) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_open_hku"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &r_r->pol, ps, depth)) - return False; - - if(!prs_werror("status", ps, depth, &r_r->status)) + if(!prs_werror("status" , ps, depth, &r_u->status)) return False; return True; @@ -814,7 +656,7 @@ reads or writes a structure. BOOL reg_io_r_close(const char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) { - if (r_u == NULL) + if ( !r_u ) return False; prs_debug(ps, depth, desc, "reg_io_r_close"); @@ -838,24 +680,25 @@ BOOL reg_io_r_close(const char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int dep makes a structure. ********************************************************************/ -void init_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, SEC_DESC_BUF *sec_desc_buf) +void init_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_u, POLICY_HND *pol, + uint32 sec_info, SEC_DESC_BUF *sec_desc_buf) { - memcpy(&q_i->pol, pol, sizeof(q_i->pol)); + memcpy(&q_u->pol, pol, sizeof(q_u->pol)); - q_i->sec_info = DACL_SECURITY_INFORMATION; + q_u->sec_info = sec_info; - q_i->ptr = 1; - init_buf_hdr(&q_i->hdr_sec, sec_desc_buf->len, sec_desc_buf->len); - q_i->data = sec_desc_buf; + q_u->ptr = 1; + init_buf_hdr(&q_u->hdr_sec, sec_desc_buf->len, sec_desc_buf->len); + q_u->data = sec_desc_buf; } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_set_key_sec(const char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_set_key_sec(const char *desc, REG_Q_SET_KEY_SEC *q_u, prs_struct *ps, int depth) { - if (r_q == NULL) + if ( !q_u ) return False; prs_debug(ps, depth, desc, "reg_io_q_set_key_sec"); @@ -864,15 +707,15 @@ BOOL reg_io_q_set_key_sec(const char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) return False; - if(!prs_uint32("sec_info", ps, depth, &r_q->sec_info)) + if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info)) return False; - if(!prs_uint32("ptr ", ps, depth, &r_q->ptr)) + if(!prs_uint32("ptr ", ps, depth, &q_u->ptr)) return False; - if(!reg_io_hdrbuf_sec(r_q->ptr, NULL, &r_q->hdr_sec, r_q->data, ps, depth)) + if(!reg_io_hdrbuf_sec(q_u->ptr, NULL, &q_u->hdr_sec, q_u->data, ps, depth)) return False; return True; @@ -882,9 +725,9 @@ BOOL reg_io_q_set_key_sec(const char *desc, REG_Q_SET_KEY_SEC *r_q, prs_struct reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_set_key_sec(const char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_set_key_sec(const char *desc, REG_R_SET_KEY_SEC *q_u, prs_struct *ps, int depth) { - if (r_q == NULL) + if ( !q_u ) return False; prs_debug(ps, depth, desc, "reg_io_r_set_key_sec"); @@ -893,7 +736,7 @@ BOOL reg_io_r_set_key_sec(const char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct * if(!prs_align(ps)) return False; - if(!prs_werror("status", ps, depth, &r_q->status)) + if(!prs_werror("status", ps, depth, &q_u->status)) return False; return True; @@ -904,28 +747,27 @@ BOOL reg_io_r_set_key_sec(const char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct * makes a structure. ********************************************************************/ -void init_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, - uint32 sec_buf_size, SEC_DESC_BUF *psdb) +void init_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_u, POLICY_HND *pol, + uint32 sec_info, uint32 sec_buf_size, + SEC_DESC_BUF *psdb) { - memcpy(&q_i->pol, pol, sizeof(q_i->pol)); + memcpy(&q_u->pol, pol, sizeof(q_u->pol)); - q_i->sec_info = OWNER_SECURITY_INFORMATION | - GROUP_SECURITY_INFORMATION | - DACL_SECURITY_INFORMATION; + q_u->sec_info = sec_info; - q_i->ptr = psdb != NULL ? 1 : 0; - q_i->data = psdb; + q_u->ptr = psdb != NULL ? 1 : 0; + q_u->data = psdb; - init_buf_hdr(&q_i->hdr_sec, sec_buf_size, 0); + init_buf_hdr(&q_u->hdr_sec, sec_buf_size, 0); } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_get_key_sec(const char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_get_key_sec(const char *desc, REG_Q_GET_KEY_SEC *q_u, prs_struct *ps, int depth) { - if (r_q == NULL) + if ( !q_u ) return False; prs_debug(ps, depth, desc, "reg_io_q_get_key_sec"); @@ -934,15 +776,15 @@ BOOL reg_io_q_get_key_sec(const char *desc, REG_Q_GET_KEY_SEC *r_q, prs_struct if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) return False; - if(!prs_uint32("sec_info", ps, depth, &r_q->sec_info)) + if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info)) return False; - if(!prs_uint32("ptr ", ps, depth, &r_q->ptr)) + if(!prs_uint32("ptr ", ps, depth, &q_u->ptr)) return False; - if(!reg_io_hdrbuf_sec(r_q->ptr, NULL, &r_q->hdr_sec, r_q->data, ps, depth)) + if(!reg_io_hdrbuf_sec(q_u->ptr, NULL, &q_u->hdr_sec, q_u->data, ps, depth)) return False; return True; @@ -968,9 +810,9 @@ makes a structure. reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_get_key_sec(const char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_get_key_sec(const char *desc, REG_R_GET_KEY_SEC *q_u, prs_struct *ps, int depth) { - if (r_q == NULL) + if ( !q_u ) return False; prs_debug(ps, depth, desc, "reg_io_r_get_key_sec"); @@ -979,19 +821,19 @@ BOOL reg_io_r_get_key_sec(const char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct if(!prs_align(ps)) return False; - if(!prs_uint32("ptr ", ps, depth, &r_q->ptr)) + if(!prs_uint32("ptr ", ps, depth, &q_u->ptr)) return False; - if (r_q->ptr != 0) { - if(!smb_io_hdrbuf("", &r_q->hdr_sec, ps, depth)) + if (q_u->ptr != 0) { + if(!smb_io_hdrbuf("", &q_u->hdr_sec, ps, depth)) return False; - if(!sec_io_desc_buf("", &r_q->data, ps, depth)) + if(!sec_io_desc_buf("", &q_u->data, ps, depth)) return False; if(!prs_align(ps)) return False; } - if(!prs_werror("status", ps, depth, &r_q->status)) + if(!prs_werror("status", ps, depth, &q_u->status)) return False; return True; @@ -1001,29 +843,29 @@ BOOL reg_io_r_get_key_sec(const char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct makes a structure. ********************************************************************/ -BOOL init_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char* val_name) +BOOL init_reg_q_info(REG_Q_INFO *q_u, POLICY_HND *pol, const char *val_name, + REGVAL_BUFFER *value_output) { - if (q_i == NULL) + if (q_u == NULL) return False; - q_i->pol = *pol; + q_u->pol = *pol; - init_unistr2(&q_i->uni_type, val_name, UNI_STR_TERMINATE); - init_uni_hdr(&q_i->hdr_type, &q_i->uni_type); + init_unistr4(&q_u->name, val_name, UNI_STR_TERMINATE); - q_i->ptr_reserved = 1; - q_i->ptr_buf = 1; + q_u->ptr_reserved = 1; + q_u->ptr_buf = 1; - q_i->ptr_bufsize = 1; - q_i->bufsize = 0; - q_i->buf_unk = 0; + q_u->ptr_bufsize = 1; + q_u->bufsize = value_output->buf_max_len; + q_u->buf_unk = 0; - q_i->unk1 = 0; - q_i->ptr_buflen = 1; - q_i->buflen = 0; + q_u->unk1 = 0; + q_u->ptr_buflen = 1; + q_u->buflen = value_output->buf_max_len; - q_i->ptr_buflen2 = 1; - q_i->buflen2 = 0; + q_u->ptr_buflen2 = 1; + q_u->buflen2 = 0; return True; } @@ -1032,9 +874,9 @@ BOOL init_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char* val_name) reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_info(const char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_info(const char *desc, REG_Q_INFO *q_u, prs_struct *ps, int depth) { - if (r_q == NULL) + if ( !q_u ) return False; prs_debug(ps, depth, desc, "reg_io_q_info"); @@ -1043,43 +885,41 @@ BOOL reg_io_q_info(const char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) - return False; - if(!smb_io_unihdr ("", &r_q->hdr_type, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) return False; - if(!smb_io_unistr2("", &r_q->uni_type, r_q->hdr_type.buffer, ps, depth)) + if(!prs_unistr4("name", ps, depth, &q_u->name)) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_reserved", ps, depth, &(r_q->ptr_reserved))) + if(!prs_uint32("ptr_reserved", ps, depth, &(q_u->ptr_reserved))) return False; - if(!prs_uint32("ptr_buf", ps, depth, &(r_q->ptr_buf))) + if(!prs_uint32("ptr_buf", ps, depth, &(q_u->ptr_buf))) return False; - if(r_q->ptr_buf) { - if(!prs_uint32("ptr_bufsize", ps, depth, &(r_q->ptr_bufsize))) + if(q_u->ptr_buf) { + if(!prs_uint32("ptr_bufsize", ps, depth, &(q_u->ptr_bufsize))) return False; - if(!prs_uint32("bufsize", ps, depth, &(r_q->bufsize))) + if(!prs_uint32("bufsize", ps, depth, &(q_u->bufsize))) return False; - if(!prs_uint32("buf_unk", ps, depth, &(r_q->buf_unk))) + if(!prs_uint32("buf_unk", ps, depth, &(q_u->buf_unk))) return False; } - if(!prs_uint32("unk1", ps, depth, &(r_q->unk1))) + if(!prs_uint32("unk1", ps, depth, &(q_u->unk1))) return False; - if(!prs_uint32("ptr_buflen", ps, depth, &(r_q->ptr_buflen))) + if(!prs_uint32("ptr_buflen", ps, depth, &(q_u->ptr_buflen))) return False; - if (r_q->ptr_buflen) { - if(!prs_uint32("buflen", ps, depth, &(r_q->buflen))) + if (q_u->ptr_buflen) { + if(!prs_uint32("buflen", ps, depth, &(q_u->buflen))) return False; - if(!prs_uint32("ptr_buflen2", ps, depth, &(r_q->ptr_buflen2))) + if(!prs_uint32("ptr_buflen2", ps, depth, &(q_u->ptr_buflen2))) return False; - if(!prs_uint32("buflen2", ps, depth, &(r_q->buflen2))) + if(!prs_uint32("buflen2", ps, depth, &(q_u->buflen2))) return False; } @@ -1091,72 +931,36 @@ BOOL reg_io_q_info(const char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth New version to replace older init_reg_r_info() ********************************************************************/ -BOOL new_init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r, +BOOL init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_u, REGISTRY_VALUE *val, WERROR status) { - uint32 buf_len = 0; - BUFFER2 buf2; + uint32 buf_len = 0; + REGVAL_BUFFER buf2; - if(r_r == NULL) + if( !r_u || !val ) return False; - if ( !val ) - return False; - - r_r->ptr_type = 1; - r_r->type = val->type; + r_u->type = TALLOC_P( get_talloc_ctx(), uint32 ); + *r_u->type = val->type; - /* if include_keyval is not set, don't send the key value, just - the buflen data. probably used by NT5 to allocate buffer space - SK */ - - if ( include_keyval ) { - r_r->ptr_uni_val = 1; - buf_len = reg_init_buffer2( &r_r->uni_val, val ); + buf_len = reg_init_regval_buffer( &buf2, val ); - } - else { - /* dummy buffer used so we can get the size */ - r_r->ptr_uni_val = 0; - buf_len = reg_init_buffer2( &buf2, val ); - } - - r_r->ptr_max_len = 1; - r_r->buf_max_len = buf_len; - - r_r->ptr_len = 1; - r_r->buf_len = buf_len; - - r_r->status = status; - - return True; -} - -/******************************************************************* - Inits a structure. -********************************************************************/ - -BOOL init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r, - BUFFER2* buf, uint32 type, WERROR status) -{ - if(r_r == NULL) - return False; - - r_r->ptr_type = 1; - r_r->type = type; + r_u->buf_max_len = TALLOC_P( get_talloc_ctx(), uint32 ); + *r_u->buf_max_len = buf_len; + r_u->buf_len = TALLOC_P( get_talloc_ctx(), uint32 ); + *r_u->buf_len = buf_len; + /* if include_keyval is not set, don't send the key value, just the buflen data. probably used by NT5 to allocate buffer space - SK */ - r_r->ptr_uni_val = include_keyval ? 1:0; - r_r->uni_val = *buf; - - r_r->ptr_max_len = 1; - r_r->buf_max_len = r_r->uni_val.buf_max_len; - - r_r->ptr_len = 1; - r_r->buf_len = r_r->uni_val.buf_len; + if ( include_keyval ) { + r_u->value = TALLOC_P( get_talloc_ctx(), REGVAL_BUFFER ); + /* steal the memory */ + *r_u->value = buf2; + } - r_r->status = status; + r_u->status = status; return True; } @@ -1165,9 +969,9 @@ BOOL init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r, reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_info(const char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_info(const char *desc, REG_R_INFO *r_u, prs_struct *ps, int depth) { - if (r_r == NULL) + if ( !r_u ) return False; prs_debug(ps, depth, desc, "reg_io_r_info"); @@ -1176,41 +980,20 @@ BOOL reg_io_r_info(const char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_type", ps, depth, &(r_r->ptr_type))) + if ( !prs_pointer("type", ps, depth, (void**)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if (r_r->ptr_type != 0) { - if(!prs_uint32("type", ps, depth, &r_r->type)) - return False; - } - - if(!prs_uint32("ptr_uni_val", ps, depth, &(r_r->ptr_uni_val))) + if ( !prs_pointer("value", ps, depth, (void**)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) return False; - - if(r_r->ptr_uni_val != 0) { - if(!smb_io_buffer2("uni_val", &r_r->uni_val, r_r->ptr_uni_val, ps, depth)) - return False; - } - if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_max_len", ps, depth, &(r_r->ptr_max_len))) + if ( !prs_pointer("buf_max_len", ps, depth, (void**)&r_u->buf_max_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - - if (r_r->ptr_max_len != 0) { - if(!prs_uint32("buf_max_len", ps, depth, &(r_r->buf_max_len))) + if ( !prs_pointer("buf_len", ps, depth, (void**)&r_u->buf_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - } - if(!prs_uint32("ptr_len", ps, depth, &(r_r->ptr_len))) - return False; - if (r_r->ptr_len != 0) { - if(!prs_uint32("buf_len", ps, depth, &(r_r->buf_len))) - return False; - } - - if(!prs_werror("status", ps, depth, &r_r->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -1220,28 +1003,29 @@ BOOL reg_io_r_info(const char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth) makes a structure. ********************************************************************/ -void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol, - uint32 val_idx, UNISTR2 *uni2, +void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_u, POLICY_HND *pol, + uint32 val_idx, char *name, uint32 max_buf_len) { - ZERO_STRUCTP(q_i); + ZERO_STRUCTP(q_u); - memcpy(&q_i->pol, pol, sizeof(q_i->pol)); + memcpy(&q_u->pol, pol, sizeof(q_u->pol)); + + q_u->val_index = val_idx; - q_i->val_index = val_idx; - init_uni_hdr(&q_i->hdr_name, uni2); + init_unistr4( &q_u->name, name, UNI_STR_TERMINATE ); - q_i->ptr_type = 1; - q_i->type = 0x0; + q_u->type = TALLOC_P( get_talloc_ctx(), uint32 ); + *q_u->type = 0x0; - q_i->ptr_value = 1; - q_i->buf_value.buf_max_len = max_buf_len; + q_u->value = TALLOC_P( get_talloc_ctx(), REGVAL_BUFFER ); + q_u->value->buf_max_len = max_buf_len; - q_i->ptr1 = 1; - q_i->len_value1 = max_buf_len; + q_u->len_value1 = TALLOC_P( get_talloc_ctx(), uint32 ); + *q_u->len_value1 = max_buf_len; - q_i->ptr2 = 1; - q_i->len_value2 = 0; + q_u->len_value2 = TALLOC_P( get_talloc_ctx(), uint32 ); + *q_u->len_value2 = max_buf_len; } /******************************************************************* @@ -1260,26 +1044,25 @@ void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) DEBUG(10,("init_reg_r_enum_val: Valuename => [%s]\n", val->valuename)); - init_unistr2( &r_u->uni_name, val->valuename, UNI_STR_TERMINATE); - init_uni_hdr( &r_u->hdr_name, &r_u->uni_name); + init_unistr4( &r_u->name, val->valuename, UNI_STR_TERMINATE); /* type */ - r_u->ptr_type = 1; - r_u->type = val->type; + r_u->type = TALLOC_P( get_talloc_ctx(), uint32 ); + *r_u->type = val->type; /* REG_SZ & REG_MULTI_SZ must be converted to UNICODE */ - r_u->ptr_value = 1; - real_size = reg_init_buffer2( &r_u->buf_value, val ); + r_u->value = TALLOC_P( get_talloc_ctx(), REGVAL_BUFFER ); + real_size = reg_init_regval_buffer( r_u->value, val ); /* lengths */ - r_u->ptr1 = 1; - r_u->len_value1 = real_size; + r_u->len_value1 = TALLOC_P( get_talloc_ctx(), uint32 ); + *r_u->len_value1 = real_size; - r_u->ptr2 = 1; - r_u->len_value2 = real_size; + r_u->len_value2 = TALLOC_P( get_talloc_ctx(), uint32 ); + *r_u->len_value2 = real_size; DEBUG(8,("init_reg_r_enum_val: Exit\n")); } @@ -1288,9 +1071,9 @@ void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_enum_val(const char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int depth) +BOOL reg_io_q_enum_val(const char *desc, REG_Q_ENUM_VALUE *q_u, prs_struct *ps, int depth) { - if (q_q == NULL) + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_enum_val"); @@ -1299,46 +1082,29 @@ BOOL reg_io_q_enum_val(const char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) return False; - if(!prs_uint32("val_index", ps, depth, &q_q->val_index)) + if(!prs_uint32("val_index", ps, depth, &q_u->val_index)) return False; - if(!smb_io_unihdr ("hdr_name", &q_q->hdr_name, ps, depth)) - return False; - if(!smb_io_unistr2("uni_name", &q_q->uni_name, q_q->hdr_name.buffer, ps, depth)) + if(!prs_unistr4("name", ps, depth, &q_u->name )) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_type", ps, depth, &q_q->ptr_type)) + if(!prs_pointer("type", ps, depth, (void**)&q_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if (q_q->ptr_type != 0) { - if(!prs_uint32("type", ps, depth, &q_q->type)) - return False; - } - - if(!prs_uint32("ptr_value", ps, depth, &q_q->ptr_value)) - return False; - if(!smb_io_buffer2("buf_value", &q_q->buf_value, q_q->ptr_value, ps, depth)) + if ( !prs_pointer("value", ps, depth, (void**)&q_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("ptr1", ps, depth, &q_q->ptr1)) + if(!prs_pointer("len_value1", ps, depth, (void**)&q_u->len_value1, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if (q_q->ptr1 != 0) { - if(!prs_uint32("len_value1", ps, depth, &q_q->len_value1)) - return False; - } - if(!prs_uint32("ptr2", ps, depth, &q_q->ptr2)) + if(!prs_pointer("len_value2", ps, depth, (void**)&q_u->len_value2, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if (q_q->ptr2 != 0) { - if(!prs_uint32("len_value2", ps, depth, &q_q->len_value2)) - return False; - } return True; } @@ -1347,9 +1113,9 @@ BOOL reg_io_q_enum_val(const char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_u, prs_struct *ps, int depth) { - if (r_q == NULL) + if ( !r_u ) return False; prs_debug(ps, depth, desc, "reg_io_r_enum_val"); @@ -1358,43 +1124,26 @@ BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, if(!prs_align(ps)) return False; - if(!smb_io_unihdr ("hdr_name", &r_q->hdr_name, ps, depth)) - return False; - if(!smb_io_unistr2("uni_name", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth)) + if(!prs_unistr4("name", ps, depth, &r_u->name )) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_type", ps, depth, &r_q->ptr_type)) + if(!prs_pointer("type", ps, depth, (void**)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if (r_q->ptr_type != 0) { - if(!prs_uint32("type", ps, depth, &r_q->type)) - return False; - } - - if(!prs_uint32("ptr_value", ps, depth, &r_q->ptr_value)) - return False; - if(!smb_io_buffer2("buf_value", &r_q->buf_value, r_q->ptr_value, ps, depth)) + if ( !prs_pointer("value", ps, depth, (void**)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("ptr1", ps, depth, &r_q->ptr1)) + if(!prs_pointer("len_value1", ps, depth, (void**)&r_u->len_value1, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if (r_q->ptr1 != 0) { - if(!prs_uint32("len_value1", ps, depth, &r_q->len_value1)) - return False; - } - - if(!prs_uint32("ptr2", ps, depth, &r_q->ptr2)) + if(!prs_pointer("len_value2", ps, depth, (void**)&r_u->len_value2, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if (r_q->ptr2 != 0) { - if(!prs_uint32("len_value2", ps, depth, &r_q->len_value2)) - return False; - } - if(!prs_werror("status", ps, depth, &r_q->status)) + + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -1404,28 +1153,27 @@ BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, makes a structure. ********************************************************************/ -void init_reg_q_create_val(REG_Q_CREATE_VALUE *q_i, POLICY_HND *pol, +void init_reg_q_create_val(REG_Q_CREATE_VALUE *q_u, POLICY_HND *pol, char *val_name, uint32 type, BUFFER3 *val) { - ZERO_STRUCTP(q_i); + ZERO_STRUCTP(q_u); - memcpy(&q_i->pol, pol, sizeof(q_i->pol)); + memcpy(&q_u->pol, pol, sizeof(q_u->pol)); - init_unistr2(&q_i->uni_name, val_name, UNI_STR_TERMINATE); - init_uni_hdr(&q_i->hdr_name, &q_i->uni_name); + init_unistr4(&q_u->name, val_name, UNI_STR_TERMINATE); - q_i->type = type; - q_i->buf_value = val; + q_u->type = type; + q_u->value = val; } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_create_val(const char *desc, REG_Q_CREATE_VALUE *q_q, prs_struct *ps, int depth) +BOOL reg_io_q_create_val(const char *desc, REG_Q_CREATE_VALUE *q_u, prs_struct *ps, int depth) { - if (q_q == NULL) + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_create_val"); @@ -1434,19 +1182,17 @@ BOOL reg_io_q_create_val(const char *desc, REG_Q_CREATE_VALUE *q_q, prs_struct if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) return False; - if(!smb_io_unihdr ("hdr_name", &q_q->hdr_name, ps, depth)) - return False; - if(!smb_io_unistr2("uni_name", &q_q->uni_name, q_q->hdr_name.buffer, ps, depth)) + if(!prs_unistr4("name", ps, depth, &q_u->name )) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("type", ps, depth, &q_q->type)) + if(!prs_uint32("type", ps, depth, &q_u->type)) return False; - if(!smb_io_buffer3("buf_value", q_q->buf_value, ps, depth)) + if(!smb_io_buffer3("value", q_u->value, ps, depth)) return False; if(!prs_align(ps)) return False; @@ -1458,9 +1204,9 @@ BOOL reg_io_q_create_val(const char *desc, REG_Q_CREATE_VALUE *q_q, prs_struct reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_create_val(const char *desc, REG_R_CREATE_VALUE *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_create_val(const char *desc, REG_R_CREATE_VALUE *q_u, prs_struct *ps, int depth) { - if (r_q == NULL) + if ( !q_u ) return False; prs_debug(ps, depth, desc, "reg_io_r_create_val"); @@ -1469,7 +1215,7 @@ BOOL reg_io_r_create_val(const char *desc, REG_R_CREATE_VALUE *r_q, prs_struct if(!prs_align(ps)) return False; - if(!prs_werror("status", ps, depth, &r_q->status)) + if(!prs_werror("status", ps, depth, &q_u->status)) return False; return True; @@ -1479,23 +1225,23 @@ BOOL reg_io_r_create_val(const char *desc, REG_R_CREATE_VALUE *r_q, prs_struct makes a structure. ********************************************************************/ -void init_reg_q_enum_key(REG_Q_ENUM_KEY *q_i, POLICY_HND *pol, uint32 key_idx) +void init_reg_q_enum_key(REG_Q_ENUM_KEY *q_u, POLICY_HND *pol, uint32 key_idx) { - memcpy(&q_i->pol, pol, sizeof(q_i->pol)); + memcpy(&q_u->pol, pol, sizeof(q_u->pol)); - q_i->key_index = key_idx; - q_i->key_name_len = 0; - q_i->unknown_1 = 0x0414; + q_u->key_index = key_idx; + q_u->key_name_len = 0; + q_u->unknown_1 = 0x0414; - q_i->ptr1 = 1; - q_i->unknown_2 = 0x0000020A; - memset(q_i->pad1, 0, sizeof(q_i->pad1)); + q_u->ptr1 = 1; + q_u->unknown_2 = 0x0000020A; + memset(q_u->pad1, 0, sizeof(q_u->pad1)); - q_i->ptr2 = 1; - memset(q_i->pad2, 0, sizeof(q_i->pad2)); + q_u->ptr2 = 1; + memset(q_u->pad2, 0, sizeof(q_u->pad2)); - q_i->ptr3 = 1; - unix_to_nt_time(&q_i->time, 0); /* current time? */ + q_u->ptr3 = 1; + unix_to_nt_time(&q_u->time, 0); /* current time? */ } /******************************************************************* @@ -1525,9 +1271,9 @@ void init_reg_r_enum_key(REG_R_ENUM_KEY *r_u, char *subkey, uint32 unknown_1, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_enum_key(const char *desc, REG_Q_ENUM_KEY *q_q, prs_struct *ps, int depth) +BOOL reg_io_q_enum_key(const char *desc, REG_Q_ENUM_KEY *q_u, prs_struct *ps, int depth) { - if (q_q == NULL) + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "reg_io_q_enum_key"); @@ -1536,39 +1282,39 @@ BOOL reg_io_q_enum_key(const char *desc, REG_Q_ENUM_KEY *q_q, prs_struct *ps, i if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) return False; - if(!prs_uint32("key_index", ps, depth, &q_q->key_index)) + if(!prs_uint32("key_index", ps, depth, &q_u->key_index)) return False; - if(!prs_uint16("key_name_len", ps, depth, &q_q->key_name_len)) + if(!prs_uint16("key_name_len", ps, depth, &q_u->key_name_len)) return False; - if(!prs_uint16("unknown_1", ps, depth, &q_q->unknown_1)) + if(!prs_uint16("unknown_1", ps, depth, &q_u->unknown_1)) return False; - if(!prs_uint32("ptr1", ps, depth, &q_q->ptr1)) + if(!prs_uint32("ptr1", ps, depth, &q_u->ptr1)) return False; - if (q_q->ptr1 != 0) { - if(!prs_uint32("unknown_2", ps, depth, &q_q->unknown_2)) + if (q_u->ptr1 != 0) { + if(!prs_uint32("unknown_2", ps, depth, &q_u->unknown_2)) return False; - if(!prs_uint8s(False, "pad1", ps, depth, q_q->pad1, sizeof(q_q->pad1))) + if(!prs_uint8s(False, "pad1", ps, depth, q_u->pad1, sizeof(q_u->pad1))) return False; } - if(!prs_uint32("ptr2", ps, depth, &q_q->ptr2)) + if(!prs_uint32("ptr2", ps, depth, &q_u->ptr2)) return False; - if (q_q->ptr2 != 0) { - if(!prs_uint8s(False, "pad2", ps, depth, q_q->pad2, sizeof(q_q->pad2))) + if (q_u->ptr2 != 0) { + if(!prs_uint8s(False, "pad2", ps, depth, q_u->pad2, sizeof(q_u->pad2))) return False; } - if(!prs_uint32("ptr3", ps, depth, &q_q->ptr3)) + if(!prs_uint32("ptr3", ps, depth, &q_u->ptr3)) return False; - if (q_q->ptr3 != 0) { - if(!smb_io_time("", &q_q->time, ps, depth)) + if (q_u->ptr3 != 0) { + if(!smb_io_time("", &q_u->time, ps, depth)) return False; } @@ -1579,9 +1325,9 @@ BOOL reg_io_q_enum_key(const char *desc, REG_Q_ENUM_KEY *q_q, prs_struct *ps, i reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_enum_key(const char *desc, REG_R_ENUM_KEY *r_q, prs_struct *ps, int depth) +BOOL reg_io_r_enum_key(const char *desc, REG_R_ENUM_KEY *q_u, prs_struct *ps, int depth) { - if (r_q == NULL) + if ( !q_u ) return False; prs_debug(ps, depth, desc, "reg_io_r_enum_key"); @@ -1590,42 +1336,42 @@ BOOL reg_io_r_enum_key(const char *desc, REG_R_ENUM_KEY *r_q, prs_struct *ps, i if(!prs_align(ps)) return False; - if(!prs_uint16("key_name_len", ps, depth, &r_q->key_name_len)) + if(!prs_uint16("key_name_len", ps, depth, &q_u->key_name_len)) return False; - if(!prs_uint16("unknown_1", ps, depth, &r_q->unknown_1)) + if(!prs_uint16("unknown_1", ps, depth, &q_u->unknown_1)) return False; - if(!prs_uint32("ptr1", ps, depth, &r_q->ptr1)) + if(!prs_uint32("ptr1", ps, depth, &q_u->ptr1)) return False; - if (r_q->ptr1 != 0) { - if(!prs_uint32("unknown_2", ps, depth, &r_q->unknown_2)) + if (q_u->ptr1 != 0) { + if(!prs_uint32("unknown_2", ps, depth, &q_u->unknown_2)) return False; - if(!prs_uint32("unknown_3", ps, depth, &r_q->unknown_3)) + if(!prs_uint32("unknown_3", ps, depth, &q_u->unknown_3)) return False; - if(!smb_io_unistr3("key_name", &r_q->key_name, ps, depth)) + if(!smb_io_unistr3("key_name", &q_u->key_name, ps, depth)) return False; if(!prs_align(ps)) return False; } - if(!prs_uint32("ptr2", ps, depth, &r_q->ptr2)) + if(!prs_uint32("ptr2", ps, depth, &q_u->ptr2)) return False; - if (r_q->ptr2 != 0) { - if(!prs_uint8s(False, "pad2", ps, depth, r_q->pad2, sizeof(r_q->pad2))) + if (q_u->ptr2 != 0) { + if(!prs_uint8s(False, "pad2", ps, depth, q_u->pad2, sizeof(q_u->pad2))) return False; } - if(!prs_uint32("ptr3", ps, depth, &r_q->ptr3)) + if(!prs_uint32("ptr3", ps, depth, &q_u->ptr3)) return False; - if (r_q->ptr3 != 0) { - if(!smb_io_time("", &r_q->time, ps, depth)) + if (q_u->ptr3 != 0) { + if(!smb_io_time("", &q_u->time, ps, depth)) return False; } - if(!prs_werror("status", ps, depth, &r_q->status)) + if(!prs_werror("status", ps, depth, &q_u->status)) return False; return True; @@ -1635,25 +1381,24 @@ BOOL reg_io_r_enum_key(const char *desc, REG_R_ENUM_KEY *r_q, prs_struct *ps, i makes a structure. ********************************************************************/ -void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol, +void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *q_u, POLICY_HND *pol, char *key_name, uint32 access_desired) { - memcpy(&r_q->pol, pol, sizeof(r_q->pol)); + memcpy(&q_u->pol, pol, sizeof(q_u->pol)); - init_unistr2(&r_q->uni_name, key_name, UNI_STR_TERMINATE); - init_uni_hdr(&r_q->hdr_name, &r_q->uni_name); + init_unistr4(&q_u->name, key_name, UNI_STR_TERMINATE); - r_q->unknown_0 = 0x00000000; - r_q->access_desired = access_desired; + q_u->unknown_0 = 0x00000000; + q_u->access = access_desired; } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_open_entry(const char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int depth) +BOOL reg_io_q_open_entry(const char *desc, REG_Q_OPEN_ENTRY *q_u, prs_struct *ps, int depth) { - if (r_q == NULL) + if ( !q_u ) return False; prs_debug(ps, depth, desc, "reg_io_q_entry"); @@ -1662,19 +1407,17 @@ BOOL reg_io_q_open_entry(const char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *p if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &r_q->pol, ps, depth)) - return False; - if(!smb_io_unihdr ("", &r_q->hdr_name, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) return False; - if(!smb_io_unistr2("", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth)) + if(!prs_unistr4("name", ps, depth, &q_u->name)) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("unknown_0 ", ps, depth, &r_q->unknown_0)) + if(!prs_uint32("unknown_0 ", ps, depth, &q_u->unknown_0)) return False; - if(!prs_uint32("access_desired ", ps, depth, &r_q->access_desired)) + if(!prs_uint32("access", ps, depth, &q_u->access)) return False; return True; @@ -1684,24 +1427,24 @@ BOOL reg_io_q_open_entry(const char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *p Inits a structure. ********************************************************************/ -void init_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r, +void init_reg_r_open_entry(REG_R_OPEN_ENTRY *r_u, POLICY_HND *pol, WERROR werr) { if (W_ERROR_IS_OK(werr)) { - memcpy(&r_r->pol, pol, sizeof(r_r->pol)); + memcpy(&r_u->pol, pol, sizeof(r_u->pol)); } else { - ZERO_STRUCT(r_r->pol); + ZERO_STRUCT(r_u->pol); } - r_r->status = werr; + r_u->status = werr; } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int depth) +BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_u, prs_struct *ps, int depth) { - if (r_r == NULL) + if ( !r_u ) return False; prs_debug(ps, depth, desc, "reg_io_r_open_entry"); @@ -1710,10 +1453,10 @@ BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *p if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &r_r->pol, ps, depth)) + if(!smb_io_pol_hnd("", &r_u->pol, ps, depth)) return False; - if(!prs_werror("status", ps, depth, &r_r->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; @@ -1723,30 +1466,53 @@ BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *p Inits a structure. ********************************************************************/ -void init_reg_q_shutdown(REG_Q_SHUTDOWN * q_s, const char *msg, +void init_reg_q_shutdown(REG_Q_SHUTDOWN *q_u, const char *msg, uint32 timeout, BOOL do_reboot, BOOL force) { - q_s->ptr_0 = 1; - q_s->ptr_1 = 1; - q_s->ptr_2 = 1; + q_u->server = TALLOC_P( get_talloc_ctx(), uint16 ); + *q_u->server = 0x1; - init_unistr2(&q_s->uni_msg, msg, UNI_FLAGS_NONE); - init_uni_hdr(&q_s->hdr_msg, &q_s->uni_msg); + q_u->message = TALLOC_P( get_talloc_ctx(), UNISTR4 ); + init_unistr4( q_u->message, msg, UNI_FLAGS_NONE ); - q_s->timeout = timeout; + q_u->timeout = timeout; - q_s->reboot = do_reboot ? 1 : 0; - q_s->force = force ? 1 : 0; + q_u->reboot = do_reboot ? 1 : 0; + q_u->force = force ? 1 : 0; +} + +/******************************************************************* +Inits a REG_Q_SHUTDOWN_EX structure. +********************************************************************/ + +void init_reg_q_shutdown_ex(REG_Q_SHUTDOWN_EX * q_u_ex, const char *msg, + uint32 timeout, BOOL do_reboot, BOOL force, uint32 reason) +{ + REG_Q_SHUTDOWN q_u; + + ZERO_STRUCT( q_u ); + + init_reg_q_shutdown( &q_u, msg, timeout, do_reboot, force ); + + /* steal memory */ + + q_u_ex->server = q_u.server; + q_u_ex->message = q_u.message; + + q_u_ex->reboot = q_u.reboot; + q_u_ex->force = q_u.force; + + q_u_ex->reason = reason; } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_shutdown(const char *desc, REG_Q_SHUTDOWN * q_s, prs_struct *ps, +BOOL reg_io_q_shutdown(const char *desc, REG_Q_SHUTDOWN *q_u, prs_struct *ps, int depth) { - if (q_s == NULL) + if ( !q_u ) return False; prs_debug(ps, depth, desc, "reg_io_q_shutdown"); @@ -1755,37 +1521,34 @@ BOOL reg_io_q_shutdown(const char *desc, REG_Q_SHUTDOWN * q_s, prs_struct *ps, if (!prs_align(ps)) return False; - if (!prs_uint32("ptr_0", ps, depth, &(q_s->ptr_0))) - return False; - if (!prs_uint32("ptr_1", ps, depth, &(q_s->ptr_1))) - return False; - if (!prs_uint32("ptr_2", ps, depth, &(q_s->ptr_2))) + if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; - if (!smb_io_unihdr("hdr_msg", &(q_s->hdr_msg), ps, depth)) - return False; - if (!smb_io_unistr2("uni_msg", &(q_s->uni_msg), q_s->hdr_msg.buffer, ps, depth)) + if (!prs_pointer("message", ps, depth, (void**)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; + if (!prs_align(ps)) return False; - if (!prs_uint32("timeout", ps, depth, &(q_s->timeout))) + if (!prs_uint32("timeout", ps, depth, &(q_u->timeout))) return False; - if (!prs_uint8("force ", ps, depth, &(q_s->force))) + + if (!prs_uint8("force ", ps, depth, &(q_u->force))) return False; - if (!prs_uint8("reboot ", ps, depth, &(q_s->reboot))) + if (!prs_uint8("reboot ", ps, depth, &(q_u->reboot))) return False; + return True; } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_shutdown(const char *desc, REG_R_SHUTDOWN * r_s, prs_struct *ps, +BOOL reg_io_r_shutdown(const char *desc, REG_R_SHUTDOWN *r_u, prs_struct *ps, int depth) { - if (r_s == NULL) + if ( !r_u ) return False; prs_debug(ps, depth, desc, "reg_io_r_shutdown"); @@ -1794,29 +1557,93 @@ BOOL reg_io_r_shutdown(const char *desc, REG_R_SHUTDOWN * r_s, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_werror("status", ps, depth, &r_s->status)) + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; } /******************************************************************* -Inits a structure. +reads or writes a REG_Q_SHUTDOWN_EX structure. ********************************************************************/ -void init_reg_q_abort_shutdown(REG_Q_ABORT_SHUTDOWN * q_s) + +BOOL reg_io_q_shutdown_ex(const char *desc, REG_Q_SHUTDOWN_EX *q_u, prs_struct *ps, + int depth) { + if ( !q_u ) + return False; + + prs_debug(ps, depth, desc, "reg_io_q_shutdown_ex"); + depth++; - q_s->ptr_server = 0; + if (!prs_align(ps)) + return False; + + if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) + return False; + + if (!prs_pointer("message", ps, depth, (void**)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) + return False; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("timeout", ps, depth, &(q_u->timeout))) + return False; + if (!prs_uint8("force ", ps, depth, &(q_u->force))) + return False; + if (!prs_uint8("reboot ", ps, depth, &(q_u->reboot))) + return False; + + if (!prs_align(ps)) + return False; + if (!prs_uint32("reason", ps, depth, &(q_u->reason))) + return False; + + + return True; +} + +/******************************************************************* +reads or writes a REG_R_SHUTDOWN_EX structure. +********************************************************************/ +BOOL reg_io_r_shutdown_ex(const char *desc, REG_R_SHUTDOWN_EX *r_u, prs_struct *ps, + int depth) +{ + if ( !r_u ) + return False; + + prs_debug(ps, depth, desc, "reg_io_r_shutdown_ex"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status", ps, depth, &r_u->status)) + return False; + + return True; +} + + + +/******************************************************************* +Inits a structure. +********************************************************************/ +void init_reg_q_abort_shutdown(REG_Q_ABORT_SHUTDOWN *q_u) +{ + q_u->server = TALLOC_P( get_talloc_ctx(), uint16 ); + *q_u->server = 0x1; } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_abort_shutdown(const char *desc, REG_Q_ABORT_SHUTDOWN * q_s, +BOOL reg_io_q_abort_shutdown(const char *desc, REG_Q_ABORT_SHUTDOWN *q_u, prs_struct *ps, int depth) { - if (q_s == NULL) + if ( !q_u ) return False; prs_debug(ps, depth, desc, "reg_io_q_abort_shutdown"); @@ -1825,11 +1652,8 @@ BOOL reg_io_q_abort_shutdown(const char *desc, REG_Q_ABORT_SHUTDOWN * q_s, if (!prs_align(ps)) return False; - if (!prs_uint32("ptr_server", ps, depth, &(q_s->ptr_server))) + if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; - if (q_s->ptr_server != 0) - if (!prs_uint16("server", ps, depth, &(q_s->server))) - return False; return True; } @@ -1837,10 +1661,10 @@ BOOL reg_io_q_abort_shutdown(const char *desc, REG_Q_ABORT_SHUTDOWN * q_s, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_abort_shutdown(const char *desc, REG_R_ABORT_SHUTDOWN * r_s, +BOOL reg_io_r_abort_shutdown(const char *desc, REG_R_ABORT_SHUTDOWN *r_u, prs_struct *ps, int depth) { - if (r_s == NULL) + if ( !r_u ) return False; prs_debug(ps, depth, desc, "reg_io_r_abort_shutdown"); @@ -1849,7 +1673,7 @@ BOOL reg_io_r_abort_shutdown(const char *desc, REG_R_ABORT_SHUTDOWN * r_s, if (!prs_align(ps)) return False; - if (!prs_werror("status", ps, depth, &r_s->status)) + if (!prs_werror("status", ps, depth, &r_u->status)) return False; return True; diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index f4ffcba1bd..823e0e8d2a 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -36,7 +36,7 @@ interface/version dce/rpc pipe identification 0x8a885d04, 0x1ceb, 0x11c9, \ { 0x9f, 0xe8 }, \ { 0x08, 0x00, \ - 0x2b, 0x10, 0x48, 0x60 } \ + 0x2b, 0x10, 0x48, 0x60 } \ }, 0x02 \ } @@ -46,7 +46,7 @@ interface/version dce/rpc pipe identification 0x8a885d04, 0x1ceb, 0x11c9, \ { 0x9f, 0xe8 }, \ { 0x08, 0x00, \ - 0x2b, 0x10, 0x48, 0x60 } \ + 0x2b, 0x10, 0x48, 0x60 } \ }, 0x02 \ } @@ -56,7 +56,7 @@ interface/version dce/rpc pipe identification 0x6bffd098, 0xa112, 0x3610, \ { 0x98, 0x33 }, \ { 0x46, 0xc3, \ - 0xf8, 0x7e, 0x34, 0x5a } \ + 0xf8, 0x7e, 0x34, 0x5a } \ }, 0x01 \ } @@ -66,7 +66,7 @@ interface/version dce/rpc pipe identification 0x4b324fc8, 0x1670, 0x01d3, \ { 0x12, 0x78 }, \ { 0x5a, 0x47, \ - 0xbf, 0x6e, 0xe1, 0x88 } \ + 0xbf, 0x6e, 0xe1, 0x88 } \ }, 0x03 \ } @@ -76,7 +76,7 @@ interface/version dce/rpc pipe identification 0x12345778, 0x1234, 0xabcd, \ { 0xef, 0x00 }, \ { 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xab } \ + 0x45, 0x67, 0x89, 0xab } \ }, 0x00 \ } @@ -86,7 +86,7 @@ interface/version dce/rpc pipe identification 0x3919286a, 0xb10c, 0x11d0, \ { 0x9b, 0xa8 }, \ { 0x00, 0xc0, \ - 0x4f, 0xd9, 0x2e, 0xf5 } \ + 0x4f, 0xd9, 0x2e, 0xf5 } \ }, 0x00 \ } @@ -96,7 +96,7 @@ interface/version dce/rpc pipe identification 0x12345778, 0x1234, 0xabcd, \ { 0xef, 0x00 }, \ { 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xac } \ + 0x45, 0x67, 0x89, 0xac } \ }, 0x01 \ } @@ -106,7 +106,7 @@ interface/version dce/rpc pipe identification 0x12345678, 0x1234, 0xabcd, \ { 0xef, 0x00 }, \ { 0x01, 0x23, \ - 0x45, 0x67, 0xcf, 0xfb } \ + 0x45, 0x67, 0xcf, 0xfb } \ }, 0x01 \ } @@ -116,7 +116,7 @@ interface/version dce/rpc pipe identification 0x338cd001, 0x2244, 0x31f1, \ { 0xaa, 0xaa }, \ { 0x90, 0x00, \ - 0x38, 0x00, 0x10, 0x03 } \ + 0x38, 0x00, 0x10, 0x03 } \ }, 0x01 \ } @@ -126,7 +126,7 @@ interface/version dce/rpc pipe identification 0x12345678, 0x1234, 0xabcd, \ { 0xef, 0x00 }, \ { 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xab } \ + 0x45, 0x67, 0x89, 0xab } \ }, 0x01 \ } @@ -136,7 +136,7 @@ interface/version dce/rpc pipe identification 0x0, 0x0, 0x0, \ { 0x00, 0x00 }, \ { 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00 } \ + 0x00, 0x00, 0x00, 0x00 } \ }, 0x00 \ } @@ -170,6 +170,27 @@ interface/version dce/rpc pipe identification }, 0x01 \ } +#define SYNT_SVCCTL_V2 \ +{ \ + { \ + 0x367abb81, 0x9844, 0x35f1, \ + { 0xad, 0x32 }, \ + { 0x98, 0xf0, \ + 0x38, 0x00, 0x10, 0x03 } \ + }, 0x02 \ +} + + +#define SYNT_EVENTLOG_V0 \ +{ \ + { \ + 0x82273fdc, 0xe32a, 0x18c3, \ + { 0x3f, 0x78 }, \ + { 0x82, 0x79, \ + 0x29, 0xdc, 0x23, 0xea } \ + }, 0x00 \ +} + /* * IMPORTANT!! If you update this structure, make sure to * update the index #defines in smb.h. @@ -189,6 +210,8 @@ const struct pipe_id_info pipe_names [] = { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, { PIPE_ECHO , SYNT_ECHO_V1 , PIPE_ECHO , TRANS_SYNT_V2 }, { PIPE_SHUTDOWN, SYNT_SHUTDOWN_V1 , PIPE_SHUTDOWN , TRANS_SYNT_V2 }, + { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, + { PIPE_EVENTLOG, SYNT_EVENTLOG_V0 , PIPE_EVENTLOG , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; diff --git a/source3/rpc_parse/parse_shutdown.c b/source3/rpc_parse/parse_shutdown.c index ad2d6e1a02..00daeaaaee 100644 --- a/source3/rpc_parse/parse_shutdown.c +++ b/source3/rpc_parse/parse_shutdown.c @@ -2,6 +2,7 @@ * Unix SMB/CIFS implementation. * RPC Pipe client / server routines * Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003. + * Copyright (C) Gerald (Jerry) Carter 2002-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 @@ -30,12 +31,11 @@ Inits a structure. void init_shutdown_q_init(SHUTDOWN_Q_INIT *q_s, const char *msg, uint32 timeout, BOOL do_reboot, BOOL force) { - q_s->ptr_server = 1; - q_s->server = 1; - q_s->ptr_msg = 1; + q_s->server = TALLOC_P( get_talloc_ctx(), uint16 ); + *q_s->server = 0x1; - init_unistr2(&q_s->uni_msg, msg, UNI_FLAGS_NONE); - init_uni_hdr(&q_s->hdr_msg, &q_s->uni_msg); + q_s->message = TALLOC_P( get_talloc_ctx(), UNISTR4 ); + init_unistr4( q_s->message, msg, UNI_FLAGS_NONE ); q_s->timeout = timeout; @@ -43,6 +43,29 @@ void init_shutdown_q_init(SHUTDOWN_Q_INIT *q_s, const char *msg, q_s->force = force ? 1 : 0; } +/******************************************************************* +********************************************************************/ + +void init_shutdown_q_init_ex(SHUTDOWN_Q_INIT_EX * q_u_ex, const char *msg, + uint32 timeout, BOOL do_reboot, BOOL force, uint32 reason) +{ + SHUTDOWN_Q_INIT q_u; + + ZERO_STRUCT( q_u ); + + init_shutdown_q_init( &q_u, msg, timeout, do_reboot, force ); + + /* steal memory */ + + q_u_ex->server = q_u.server; + q_u_ex->message = q_u.message; + + q_u_ex->reboot = q_u.reboot; + q_u_ex->force = q_u.force; + + q_u_ex->reason = reason; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -59,62 +82,119 @@ BOOL shutdown_io_q_init(const char *desc, SHUTDOWN_Q_INIT *q_s, prs_struct *ps, if (!prs_align(ps)) return False; - if (!prs_uint32("ptr_server", ps, depth, &(q_s->ptr_server))) + if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; - if (!prs_uint16("server", ps, depth, &(q_s->server))) + + if (!prs_pointer("message", ps, depth, (void**)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; if (!prs_align(ps)) return False; - if (!prs_uint32("ptr_msg", ps, depth, &(q_s->ptr_msg))) + + if (!prs_uint32("timeout", ps, depth, &(q_s->timeout))) return False; - if (!smb_io_unihdr("hdr_msg", &(q_s->hdr_msg), ps, depth)) + if (!prs_uint8("force ", ps, depth, &(q_s->force))) return False; - if (!smb_io_unistr2("uni_msg", &(q_s->uni_msg), q_s->hdr_msg.buffer, ps, depth)) + if (!prs_uint8("reboot ", ps, depth, &(q_s->reboot))) return False; + + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +BOOL shutdown_io_r_init(const char *desc, SHUTDOWN_R_INIT* r_s, prs_struct *ps, + int depth) +{ + if (r_s == NULL) + return False; + + prs_debug(ps, depth, desc, "shutdown_io_r_init"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status", ps, depth, &r_s->status)) + return False; + + return True; +} + +/******************************************************************* +reads or writes a REG_Q_SHUTDOWN_EX structure. +********************************************************************/ + +BOOL shutdown_io_q_init_ex(const char *desc, SHUTDOWN_Q_INIT_EX * q_s, prs_struct *ps, + int depth) +{ + if (q_s == NULL) + return False; + + prs_debug(ps, depth, desc, "shutdown_io_q_init_ex"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) + return False; + + if (!prs_pointer("message", ps, depth, (void**)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) + return False; + if (!prs_align(ps)) return False; if (!prs_uint32("timeout", ps, depth, &(q_s->timeout))) return False; + if (!prs_uint8("force ", ps, depth, &(q_s->force))) return False; if (!prs_uint8("reboot ", ps, depth, &(q_s->reboot))) return False; + if (!prs_align(ps)) + return False; + if (!prs_uint32("reason", ps, depth, &(q_s->reason))) + return False; + + return True; } /******************************************************************* -reads or writes a structure. +reads or writes a REG_R_SHUTDOWN_EX structure. ********************************************************************/ -BOOL shutdown_io_r_init(const char *desc, SHUTDOWN_R_INIT* r_s, prs_struct *ps, - int depth) +BOOL shutdown_io_r_init_ex(const char *desc, SHUTDOWN_R_INIT_EX * r_s, prs_struct *ps, + int depth) { if (r_s == NULL) return False; - prs_debug(ps, depth, desc, "shutdown_io_r_init"); + prs_debug(ps, depth, desc, "shutdown_io_r_init_ex"); depth++; if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_s->status)) + if(!prs_werror("status", ps, depth, &r_s->status)) return False; return True; } + /******************************************************************* Inits a structure. ********************************************************************/ void init_shutdown_q_abort(SHUTDOWN_Q_ABORT *q_s) { - - q_s->ptr_server = 0; - + q_s->server = TALLOC_P( get_talloc_ctx(), uint16 ); + *q_s->server = 0x1; } /******************************************************************* @@ -132,11 +212,8 @@ BOOL shutdown_io_q_abort(const char *desc, SHUTDOWN_Q_ABORT *q_s, if (!prs_align(ps)) return False; - if (!prs_uint32("ptr_server", ps, depth, &(q_s->ptr_server))) + if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; - if (q_s->ptr_server != 0) - if (!prs_uint16("server", ps, depth, &(q_s->server))) - return False; return True; } @@ -156,7 +233,7 @@ BOOL shutdown_io_r_abort(const char *desc, SHUTDOWN_R_ABORT *r_s, if (!prs_align(ps)) return False; - if (!prs_ntstatus("status", ps, depth, &r_s->status)) + if (!prs_werror("status", ps, depth, &r_s->status)) return False; return True; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index c64587b590..78602dd806 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -550,23 +550,22 @@ static BOOL smb_io_notify_info(const char *desc, SPOOL_NOTIFY_INFO *info, prs_st /******************************************************************* ********************************************************************/ -static BOOL spool_io_user_level_1(const char *desc, SPOOL_USER_1 *q_u, prs_struct *ps, int depth) +BOOL spool_io_user_level_1( const char *desc, prs_struct *ps, int depth, SPOOL_USER_1 *q_u ) { prs_debug(ps, depth, desc, ""); depth++; - /* reading */ - if (UNMARSHALLING(ps)) - ZERO_STRUCTP(q_u); - if (!prs_align(ps)) return False; + if (!prs_uint32("size", ps, depth, &q_u->size)) return False; - if (!prs_uint32("client_name_ptr", ps, depth, &q_u->client_name_ptr)) + + if (!prs_io_unistr2_p("", ps, depth, &q_u->client_name)) return False; - if (!prs_uint32("user_name_ptr", ps, depth, &q_u->user_name_ptr)) + if (!prs_io_unistr2_p("", ps, depth, &q_u->user_name)) return False; + if (!prs_uint32("build", ps, depth, &q_u->build)) return False; if (!prs_uint32("major", ps, depth, &q_u->major)) @@ -576,11 +575,12 @@ static BOOL spool_io_user_level_1(const char *desc, SPOOL_USER_1 *q_u, prs_struc if (!prs_uint32("processor", ps, depth, &q_u->processor)) return False; - if (!smb_io_unistr2("", &q_u->client_name, q_u->client_name_ptr, ps, depth)) + if (!prs_io_unistr2("", ps, depth, q_u->client_name)) return False; if (!prs_align(ps)) return False; - if (!smb_io_unistr2("", &q_u->user_name, q_u->user_name_ptr, ps, depth)) + + if (!prs_io_unistr2("", ps, depth, q_u->user_name)) return False; return True; @@ -600,21 +600,20 @@ static BOOL spool_io_user_level(const char *desc, SPOOL_USER_CTR *q_u, prs_struc if (!prs_align(ps)) return False; - /* From looking at many captures in ethereal, it looks like - the level and ptr fields should be transposed. -tpot */ - if (!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (!prs_uint32("ptr", ps, depth, &q_u->ptr)) - return False; - switch (q_u->level) { - case 1: - if (!spool_io_user_level_1("", &q_u->user1, ps, depth)) - return False; - break; - default: - return False; + switch ( q_u->level ) + { + case 1: + if ( !prs_pointer( "" , ps, depth, (void**)&q_u->user.user1, + sizeof(SPOOL_USER_1), (PRS_POINTER_CAST)spool_io_user_level_1 )) + { + return False; + } + break; + default: + return False; } return True; @@ -899,30 +898,31 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, const fstring user_name) { DEBUG(5,("make_spoolss_q_open_printer_ex\n")); - q_u->printername_ptr = (printername!=NULL)?1:0; - init_unistr2(&q_u->printername, printername, UNI_STR_TERMINATE); + + q_u->printername = TALLOC_P( get_talloc_ctx(), UNISTR2 ); + init_unistr2(q_u->printername, printername, UNI_STR_TERMINATE); q_u->printer_default.datatype_ptr = 0; -/* - q_u->printer_default.datatype_ptr = (datatype!=NULL)?1:0; - init_unistr2(&q_u->printer_default.datatype, datatype, UNI_FLAGS_NONE); -*/ + q_u->printer_default.devmode_cont.size=0; q_u->printer_default.devmode_cont.devmode_ptr=0; q_u->printer_default.devmode_cont.devmode=NULL; q_u->printer_default.access_required=access_required; - q_u->user_switch=1; - q_u->user_ctr.level=1; - q_u->user_ctr.ptr=1; - q_u->user_ctr.user1.size=strlen(clientname)+strlen(user_name)+10; - q_u->user_ctr.user1.client_name_ptr = (clientname!=NULL)?1:0; - q_u->user_ctr.user1.user_name_ptr = (user_name!=NULL)?1:0; - q_u->user_ctr.user1.build=1381; - q_u->user_ctr.user1.major=2; - q_u->user_ctr.user1.minor=0; - q_u->user_ctr.user1.processor=0; - init_unistr2(&q_u->user_ctr.user1.client_name, clientname, UNI_STR_TERMINATE); - init_unistr2(&q_u->user_ctr.user1.user_name, user_name, UNI_STR_TERMINATE); + + q_u->user_switch = 1; + + q_u->user_ctr.level = 1; + q_u->user_ctr.user.user1->size = strlen(clientname) + strlen(user_name) + 10; + q_u->user_ctr.user.user1->build = 1381; + q_u->user_ctr.user.user1->major = 2; + q_u->user_ctr.user.user1->minor = 0; + q_u->user_ctr.user.user1->processor = 0; + + q_u->user_ctr.user.user1->client_name = TALLOC_P( get_talloc_ctx(), UNISTR2 ); + q_u->user_ctr.user.user1->user_name = TALLOC_P( get_talloc_ctx(), UNISTR2 ); + + init_unistr2(q_u->user_ctr.user.user1->client_name, clientname, UNI_STR_TERMINATE); + init_unistr2(q_u->user_ctr.user.user1->user_name, user_name, UNI_STR_TERMINATE); return True; } @@ -931,23 +931,19 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_addprinterex( - TALLOC_CTX *mem_ctx, - SPOOL_Q_ADDPRINTEREX *q_u, - const char *srv_name, - const char* clientname, - const char* user_name, - uint32 level, - PRINTER_INFO_CTR *ctr) +BOOL make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u, + const char *srv_name, const char* clientname, const char* user_name, + uint32 level, PRINTER_INFO_CTR *ctr) { DEBUG(5,("make_spoolss_q_addprinterex\n")); - if (!ctr) return False; + if (!ctr) + return False; ZERO_STRUCTP(q_u); - q_u->server_name_ptr = (srv_name!=NULL)?1:0; - init_unistr2(&q_u->server_name, srv_name, UNI_FLAGS_NONE); + q_u->server_name = TALLOC_P( mem_ctx, UNISTR2 ); + init_unistr2(q_u->server_name, srv_name, UNI_FLAGS_NONE); q_u->level = level; @@ -967,18 +963,20 @@ BOOL make_spoolss_q_addprinterex( q_u->user_switch=1; - q_u->user_ctr.level=1; - q_u->user_ctr.ptr=1; - q_u->user_ctr.user1.client_name_ptr = (clientname!=NULL)?1:0; - q_u->user_ctr.user1.user_name_ptr = (user_name!=NULL)?1:0; - q_u->user_ctr.user1.build=1381; - q_u->user_ctr.user1.major=2; - q_u->user_ctr.user1.minor=0; - q_u->user_ctr.user1.processor=0; - init_unistr2(&q_u->user_ctr.user1.client_name, clientname, UNI_STR_TERMINATE); - init_unistr2(&q_u->user_ctr.user1.user_name, user_name, UNI_STR_TERMINATE); - q_u->user_ctr.user1.size=q_u->user_ctr.user1.user_name.uni_str_len + - q_u->user_ctr.user1.client_name.uni_str_len + 2; + q_u->user_ctr.level = 1; + q_u->user_ctr.user.user1->build = 1381; + q_u->user_ctr.user.user1->major = 2; + q_u->user_ctr.user.user1->minor = 0; + q_u->user_ctr.user.user1->processor = 0; + + q_u->user_ctr.user.user1->client_name = TALLOC_P( mem_ctx, UNISTR2 ); + q_u->user_ctr.user.user1->user_name = TALLOC_P( mem_ctx, UNISTR2 ); + + init_unistr2(q_u->user_ctr.user.user1->client_name, clientname, UNI_STR_TERMINATE); + init_unistr2(q_u->user_ctr.user.user1->user_name, user_name, UNI_STR_TERMINATE); + + q_u->user_ctr.user.user1->size = q_u->user_ctr.user.user1->user_name->uni_str_len + + q_u->user_ctr.user.user1->client_name->uni_str_len + 2; return True; } @@ -1102,9 +1100,9 @@ BOOL spoolss_io_q_open_printer(const char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_ if (!prs_align(ps)) return False; - if (!prs_uint32("printername_ptr", ps, depth, &q_u->printername_ptr)) + if (!prs_io_unistr2_p("ptr", ps, depth, &q_u->printername)) return False; - if (!smb_io_unistr2("", &q_u->printername, q_u->printername_ptr, ps,depth)) + if (!prs_io_unistr2("printername", ps, depth, q_u->printername)) return False; if (!prs_align(ps)) @@ -1158,9 +1156,9 @@ BOOL spoolss_io_q_open_printer_ex(const char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u if (!prs_align(ps)) return False; - if (!prs_uint32("printername_ptr", ps, depth, &q_u->printername_ptr)) + if (!prs_io_unistr2_p("ptr", ps, depth, &q_u->printername)) return False; - if (!smb_io_unistr2("", &q_u->printername, q_u->printername_ptr, ps,depth)) + if (!prs_io_unistr2("printername", ps, depth, q_u->printername)) return False; if (!prs_align(ps)) @@ -4645,9 +4643,10 @@ BOOL spoolss_io_q_addprinterex(const char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_ if(!prs_align(ps)) return False; - if(!prs_uint32("", ps, depth, &q_u->server_name_ptr)) + + if (!prs_io_unistr2_p("ptr", ps, depth, &q_u->server_name)) return False; - if(!smb_io_unistr2("", &q_u->server_name, q_u->server_name_ptr, ps, depth)) + if (!prs_io_unistr2("servername", ps, depth, q_u->server_name)) return False; if(!prs_align(ps)) diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c new file mode 100644 index 0000000000..15f71b0ca0 --- /dev/null +++ b/source3/rpc_parse/parse_svcctl.c @@ -0,0 +1,665 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * 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 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + +/******************************************************************* +********************************************************************/ + +static BOOL svcctl_io_service_status( const char *desc, SERVICE_STATUS *status, prs_struct *ps, int depth ) +{ + + prs_debug(ps, depth, desc, "svcctl_io_service_status"); + depth++; + + if(!prs_uint32("type", ps, depth, &status->type)) + return False; + + if(!prs_uint32("state", ps, depth, &status->state)) + return False; + + if(!prs_uint32("controls_accepted", ps, depth, &status->controls_accepted)) + return False; + + if(!prs_uint32("win32_exit_code", ps, depth, &status->win32_exit_code)) + return False; + + if(!prs_uint32("service_exit_code", ps, depth, &status->service_exit_code)) + return False; + + if(!prs_uint32("check_point", ps, depth, &status->check_point)) + return False; + + if(!prs_uint32("wait_hint", ps, depth, &status->wait_hint)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +static BOOL svcctl_io_service_config( const char *desc, SERVICE_CONFIG *config, prs_struct *ps, int depth ) +{ + + prs_debug(ps, depth, desc, "svcctl_io_service_config"); + depth++; + + if(!prs_uint32("service_type", ps, depth, &config->service_type)) + return False; + if(!prs_uint32("start_type", ps, depth, &config->start_type)) + return False; + if(!prs_uint32("error_control", ps, depth, &config->error_control)) + return False; + + if (!prs_io_unistr2_p("", ps, depth, &config->executablepath)) + return False; + if (!prs_io_unistr2_p("", ps, depth, &config->loadordergroup)) + return False; + + if(!prs_uint32("tag_id", ps, depth, &config->tag_id)) + return False; + + if (!prs_io_unistr2_p("", ps, depth, &config->dependencies)) + return False; + if (!prs_io_unistr2_p("", ps, depth, &config->startname)) + return False; + if (!prs_io_unistr2_p("", ps, depth, &config->displayname)) + return False; + + if (!prs_io_unistr2("", ps, depth, config->executablepath)) + return False; + if (!prs_io_unistr2("", ps, depth, config->loadordergroup)) + return False; + if (!prs_io_unistr2("", ps, depth, config->dependencies)) + return False; + if (!prs_io_unistr2("", ps, depth, config->startname)) + return False; + if (!prs_io_unistr2("", ps, depth, config->displayname)) + return False; + + return True; +} + + +/******************************************************************* +********************************************************************/ + +BOOL svcctl_io_enum_services_status( const char *desc, ENUM_SERVICES_STATUS *enum_status, RPC_BUFFER *buffer, int depth ) +{ + prs_struct *ps=&buffer->prs; + + prs_debug(ps, depth, desc, "svcctl_io_enum_services_status"); + depth++; + + if ( !smb_io_relstr("servicename", buffer, depth, &enum_status->servicename) ) + return False; + if ( !smb_io_relstr("displayname", buffer, depth, &enum_status->displayname) ) + return False; + + if ( !svcctl_io_service_status("svc_status", &enum_status->status, ps, depth) ) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +uint32 svcctl_sizeof_enum_services_status( ENUM_SERVICES_STATUS *status ) +{ + uint32 size = 0; + + size += size_of_relative_string( &status->servicename ); + size += size_of_relative_string( &status->displayname ); + size += sizeof(SERVICE_STATUS); + + return size; +} + +/******************************************************************* +********************************************************************/ + +BOOL svcctl_io_q_close_service(const char *desc, SVCCTL_Q_CLOSE_SERVICE *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "svcctl_io_q_close_service"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("scm_pol", &q_u->handle, ps, depth)) + return False; + + return True; +} + + +/******************************************************************* +********************************************************************/ + +BOOL svcctl_io_r_close_service(const char *desc, SVCCTL_R_CLOSE_SERVICE *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) + return False; + + prs_debug(ps, depth, desc, "svcctl_io_r_close_service"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status", ps, depth, &r_u->status)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +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_uint32("srv_ptr", ps, depth, &q_u->ptr_srv)) + return False; + if(!smb_io_unistr2("servername", &q_u->servername, q_u->ptr_srv, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + if(!prs_uint32("db_ptr", ps, depth, &q_u->ptr_db)) + return False; + if(!smb_io_unistr2("database", &q_u->database, q_u->ptr_db, 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; +} + +/******************************************************************* +********************************************************************/ + +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_mask", ps, depth, &q_u->access_mask)) + 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) + return False; + + prs_debug(ps, depth, desc, "svcctl_io_q_enum_services_status"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("scm_pol", &q_u->handle, ps, depth)) + return False; + + if(!prs_uint32("type", ps, depth, &q_u->type)) + return False; + if(!prs_uint32("state", ps, depth, &q_u->state)) + return False; + if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size)) + return False; + + if(!prs_pointer("resume", ps, depth, (void**)&q_u->resume, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +BOOL svcctl_io_r_enum_services_status(const char *desc, SVCCTL_R_ENUM_SERVICES_STATUS *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) + return False; + + prs_debug(ps, depth, desc, "svcctl_io_r_enum_services_status"); + depth++; + + if(!prs_align(ps)) + return False; + + if (!prs_rpcbuffer("", ps, depth, &r_u->buffer)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("needed", ps, depth, &r_u->needed)) + return False; + if(!prs_uint32("returned", ps, depth, &r_u->returned)) + return False; + + if(!prs_pointer("resume", ps, depth, (void**)&r_u->resume, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + return False; + + if(!prs_werror("status", ps, depth, &r_u->status)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +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(!smb_io_unistr2_array("parameters", &q_u->parameters, ps, depth)) + 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) + return False; + + prs_debug(ps, depth, desc, "svcctl_io_q_enum_dependent_services"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth)) + return False; + + if(!prs_uint32("state", ps, depth, &q_u->state)) + return False; + if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +BOOL svcctl_io_r_enum_dependent_services(const char *desc, SVCCTL_R_ENUM_DEPENDENT_SERVICES *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) + return False; + + prs_debug(ps, depth, desc, "svcctl_io_r_enum_dependent_services"); + depth++; + + if(!prs_align(ps)) + return False; + + if (!prs_rpcbuffer("", ps, depth, &r_u->buffer)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("needed", ps, depth, &r_u->needed)) + return False; + if(!prs_uint32("returned", ps, depth, &r_u->returned)) + return False; + + if(!prs_werror("status", ps, depth, &r_u->status)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +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) + return False; + + prs_debug(ps, depth, desc, "svcctl_io_q_query_service_config"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth)) + return False; + + if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +BOOL svcctl_io_r_query_service_config(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) + return False; + + prs_debug(ps, depth, desc, "svcctl_io_r_query_service_config"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!svcctl_io_service_config("config", &r_u->config, ps, depth)) + 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; +} + + -- cgit From 259d44dbb2c2239339f6888fd5da12632abcbb28 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 24 Mar 2005 16:11:23 +0000 Subject: r6038: adding more flesh to 'net rpc service' open and close the service control manager. Also experimenting with ideas for cli_xxx() interface. (This used to be commit 4da89ef17b8c4644b97b923cebfe8e446b508b4d) --- source3/rpc_parse/parse_svcctl.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index 15f71b0ca0..f13f01a05a 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -192,22 +192,17 @@ BOOL svcctl_io_q_open_scmanager(const char *desc, SVCCTL_Q_OPEN_SCMANAGER *q_u, if(!prs_align(ps)) return False; - if(!prs_uint32("srv_ptr", ps, depth, &q_u->ptr_srv)) - return False; - if(!smb_io_unistr2("servername", &q_u->servername, q_u->ptr_srv, ps, depth)) + 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_uint32("db_ptr", ps, depth, &q_u->ptr_db)) - return False; - if(!smb_io_unistr2("database", &q_u->database, q_u->ptr_db, ps, depth)) + 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_mask", ps, depth, &q_u->access_mask)) + if(!prs_uint32("access", ps, depth, &q_u->access)) return False; return True; -- cgit From dbb5a1fdabf8e66343cd2a4a2dda79cef95e14b1 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 24 Mar 2005 22:32:31 +0000 Subject: r6046: $ net -S block -U % -W VALE rpc service status spooler spooler service is SVCCTL_RUNNING. Configuration details: Service Type = 0x110 Start Type = 0x2 Error Control = 0x1 Tag ID = 0x0 Executable Path = C:\WINNT\system32\spoolsv.exe Load Order Group = SpoolerGroup Dependencies = RPCSS/ Start Name = LocalSystem Display Name = Print Spooler (This used to be commit b921bf568835042a43bb0bcb2abd9d36c9d2e43f) --- source3/rpc_parse/parse_svcctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index f13f01a05a..acebcf34c6 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -325,7 +325,7 @@ BOOL svcctl_io_q_open_service(const char *desc, SVCCTL_Q_OPEN_SERVICE *q_u, prs_ if(!prs_align(ps)) return False; - if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask)) + if(!prs_uint32("access", ps, depth, &q_u->access)) return False; return True; -- cgit From 0aa89db9471330fd02db395c2eb387ac2dfef54f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 26 Mar 2005 06:52:56 +0000 Subject: r6071: * clean up UNISTR2_ARRAY ( really just an array of UNISTR4 + count ) * add some backwards compatibility to 'net rpc rights list' * verify privilege name in 'net rpc rights privileges ' in order to give back better error messages. (This used to be commit 0e29dc8aa384dfa6d2495beb8a9ffb5371e60a13) --- source3/rpc_parse/parse_lsa.c | 28 +++++--- source3/rpc_parse/parse_misc.c | 142 +++++++++++++++++++++------------------ source3/rpc_parse/parse_svcctl.c | 2 +- 3 files changed, 96 insertions(+), 76 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index d0b9b20a3b..649cb7845a 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2322,7 +2322,9 @@ NTSTATUS init_r_enum_acct_rights( LSA_R_ENUM_ACCT_RIGHTS *r_u, PRIVILEGE_SET *pr } if ( num_priv ) { - if ( !init_unistr2_array( &r_u->rights, num_priv, privname_array ) ) + r_u->rights = TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY ); + + if ( !init_unistr4_array( r_u->rights, num_priv, privname_array ) ) return NT_STATUS_NO_MEMORY; r_u->count = num_priv; @@ -2364,7 +2366,7 @@ BOOL lsa_io_r_enum_acct_rights(const char *desc, LSA_R_ENUM_ACCT_RIGHTS *r_c, pr if(!prs_uint32("count ", ps, depth, &r_c->count)) return False; - if(!smb_io_unistr2_array("rights", &r_c->rights, ps, depth)) + if ( !prs_pointer("rights", ps, depth, (void**)&r_c->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) return False; if(!prs_align(ps)) @@ -2380,17 +2382,17 @@ BOOL lsa_io_r_enum_acct_rights(const char *desc, LSA_R_ENUM_ACCT_RIGHTS *r_c, pr /******************************************************************* Inits an LSA_Q_ADD_ACCT_RIGHTS structure. ********************************************************************/ -void init_q_add_acct_rights(LSA_Q_ADD_ACCT_RIGHTS *q_q, - POLICY_HND *hnd, - DOM_SID *sid, - uint32 count, - const char **rights) +void init_q_add_acct_rights( LSA_Q_ADD_ACCT_RIGHTS *q_q, POLICY_HND *hnd, + DOM_SID *sid, uint32 count, const char **rights ) { DEBUG(5, ("init_q_add_acct_rights\n")); q_q->pol = *hnd; init_dom_sid2(&q_q->sid, sid); - init_unistr2_array(&q_q->rights, count, rights); + + q_q->rights = TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY ); + init_unistr4_array( q_q->rights, count, rights ); + q_q->count = count; } @@ -2412,7 +2414,7 @@ BOOL lsa_io_q_add_acct_rights(const char *desc, LSA_Q_ADD_ACCT_RIGHTS *q_q, prs_ if(!prs_uint32("count", ps, depth, &q_q->count)) return False; - if(!smb_io_unistr2_array("rights", &q_q->rights, ps, depth)) + if ( !prs_pointer("rights", ps, depth, (void**)&q_q->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) return False; return True; @@ -2446,10 +2448,14 @@ void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *q_q, DEBUG(5, ("init_q_remove_acct_rights\n")); q_q->pol = *hnd; + init_dom_sid2(&q_q->sid, sid); + q_q->removeall = removeall; - init_unistr2_array(&q_q->rights, count, rights); q_q->count = count; + + q_q->rights = TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY ); + init_unistr4_array( q_q->rights, count, rights ); } @@ -2473,7 +2479,7 @@ BOOL lsa_io_q_remove_acct_rights(const char *desc, LSA_Q_REMOVE_ACCT_RIGHTS *q_q if(!prs_uint32("count", ps, depth, &q_q->count)) return False; - if(!smb_io_unistr2_array("rights", &q_q->rights, ps, depth)) + if ( !prs_pointer("rights", ps, depth, (void**)&q_q->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) return False; return True; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 76c6438d59..57f44f9f85 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1114,7 +1114,6 @@ BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct * BOOL prs_unistr4(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) { - if ( !prs_uint16("length", ps, depth, &uni4->length )) return False; if ( !prs_uint16("size", ps, depth, &uni4->size )) @@ -1126,33 +1125,97 @@ BOOL prs_unistr4(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) return True; } +/******************************************************************* + now read/write UNISTR4 header +********************************************************************/ + +BOOL prs_unistr4_hdr(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) +{ + prs_debug(ps, depth, desc, "prs_unistr4_hdr"); + depth++; + + if ( !prs_uint16("length", ps, depth, &uni4->length) ) + return False; + if ( !prs_uint16("size", ps, depth, &uni4->size) ) + return False; + if ( !prs_io_unistr2_p(desc, ps, depth, &uni4->string) ) + return False; + + return True; +} + +/******************************************************************* + now read/write UNISTR4 string +********************************************************************/ + +BOOL prs_unistr4_str(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) +{ + prs_debug(ps, depth, desc, "prs_unistr4_str"); + depth++; + + if ( !prs_io_unistr2(desc, ps, depth, uni4->string) ) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a UNISTR2_ARRAY structure. +********************************************************************/ + +BOOL prs_unistr4_array(const char *desc, prs_struct *ps, int depth, UNISTR4_ARRAY *array ) +{ + unsigned int i; + + prs_debug(ps, depth, desc, "prs_unistr4_array"); + depth++; + + if(!prs_uint32("count", ps, depth, &array->count)) + return False; + + if ( array->count == 0 ) + return True; + + if (UNMARSHALLING(ps)) { + if ( !(array->strings = TALLOC_ZERO_ARRAY( get_talloc_ctx(), UNISTR4, array->count)) ) + return False; + } + + /* write the headers and then the actual string buffer */ + + for ( i=0; icount; i++ ) { + if ( !prs_unistr4_hdr( "string", ps, depth, &array->strings[i]) ) + return False; + } + + for (i=0;icount;i++) { + if ( !prs_unistr4_str("string", ps, depth, &array->strings[i]) ) + return False; + } + + return True; +} /******************************************************************** initialise a UNISTR_ARRAY from a char** ********************************************************************/ -BOOL init_unistr2_array(UNISTR2_ARRAY *array, - uint32 count, const char **strings) +BOOL init_unistr4_array( UNISTR4_ARRAY *array, uint32 count, const char **strings ) { unsigned int i; array->count = count; - array->ref_id = count?1:0; - if (array->count == 0) { + + if ( array->count == 0 ) return True; - } - array->strings = TALLOC_ZERO_ARRAY(get_talloc_ctx(), UNISTR2_ARRAY_EL, count ); - if (!array->strings) { + /* allocate memory for the array of UNISTR4 objects */ + + if ( !(array->strings = TALLOC_ZERO_ARRAY(get_talloc_ctx(), UNISTR4, count )) ) return False; - } - for (i=0;istrings[i].string, strings[i], UNI_FLAGS_NONE); - array->strings[i].size = array->strings[i].string.uni_max_len*2; - array->strings[i].length = array->strings[i].size; - array->strings[i].ref_id = 1; - } + for ( i=0; istrings[i], strings[i], STR_TERMINATE ); return True; } @@ -1204,55 +1267,6 @@ BOOL smb_io_account_lockout_str(const char *desc, LOCKOUT_STRING *account_lockou return True; } -/******************************************************************* - Reads or writes a UNISTR2_ARRAY structure. -********************************************************************/ -BOOL smb_io_unistr2_array(const char *desc, UNISTR2_ARRAY *array, prs_struct *ps, int depth) -{ - unsigned int i; - - prs_debug(ps, depth, desc, "smb_io_unistr2_array"); - depth++; - - if(!prs_uint32("ref_id", ps, depth, &array->ref_id)) - return False; - - if (! array->ref_id) { - return True; - } - - if(!prs_uint32("count", ps, depth, &array->count)) - return False; - - if (array->count == 0) { - return True; - } - - if (UNMARSHALLING(ps)) { - array->strings = TALLOC_ZERO_ARRAY(get_talloc_ctx(), UNISTR2_ARRAY_EL, array->count ); - } - if (! array->strings) { - return False; - } - - for (i=0;icount;i++) { - if(!prs_uint16("length", ps, depth, &array->strings[i].length)) - return False; - if(!prs_uint16("size", ps, depth, &array->strings[i].size)) - return False; - if(!prs_uint32("ref_id", ps, depth, &array->strings[i].ref_id)) - return False; - } - - for (i=0;icount;i++) { - if (! smb_io_unistr2("string", &array->strings[i].string, array->strings[i].ref_id, ps, depth)) - return False; - } - - return True; -} - - /******************************************************************* Inits a DOM_RID2 structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index acebcf34c6..1c41a18b99 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -481,7 +481,7 @@ BOOL svcctl_io_q_start_service(const char *desc, SVCCTL_Q_START_SERVICE *q_u, pr if(!prs_uint32("parmcount", ps, depth, &q_u->parmcount)) return False; - if(!smb_io_unistr2_array("parameters", &q_u->parameters, ps, depth)) + if ( !prs_pointer("rights", ps, depth, (void**)&q_u->parameters, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) return False; return True; -- cgit From b4c720412978c0a49e11846c7cfe553d055cca1f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 5 Apr 2005 17:49:16 +0000 Subject: r6218: * fix a segv in EnumPrinters():rpc_buffer_alloc when the caller does not provide an RPC_BUFFER in the request * add initial (but wire untested) support for RegRestoreKey() (This used to be commit 22855c7aae940cc4082c231a470f612b8fc6fa0d) --- source3/rpc_parse/parse_buffer.c | 5 +++++ source3/rpc_parse/parse_reg.c | 48 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index ea72df8db4..a48d5cfa98 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -134,6 +134,11 @@ BOOL rpcbuf_alloc_size(RPC_BUFFER *buffer, uint32 buffer_size) uint32 extra_space; uint32 old_offset; + /* if we don't need anything. don't do anything */ + + if ( buffer_size == 0x0 ) + return True; + ps= &buffer->prs; /* damn, I'm doing the reverse operation of prs_grow() :) */ diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index fabffd2b6d..09e19bf701 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -568,6 +568,54 @@ BOOL reg_io_r_getversion(const char *desc, REG_R_GETVERSION *r_u, prs_struct *p } +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL reg_io_q_restore_key(const char *desc, REG_Q_RESTORE_KEY *q_u, prs_struct *ps, int depth) +{ + if ( !q_u ) + return False; + + prs_debug(ps, depth, desc, "reg_io_q_restore_key"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) + return False; + + if(!prs_unistr4("filename", ps, depth, &q_u->filename)) + return False; + + if(!prs_uint32("flags", ps, depth, &q_u->flags)) + return False; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL reg_io_r_restore_key(const char *desc, REG_R_RESTORE_KEY *r_u, prs_struct *ps, int depth) +{ + if ( !r_u ) + return False; + + prs_debug(ps, depth, desc, "reg_io_r_restore_key"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status" , ps, depth, &r_u->status)) + return False; + + return True; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ -- cgit From b137b7cc4720ca9d99eab2bb198be1b112c2e24c Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 6 Apr 2005 22:27:55 +0000 Subject: r6228: remove BUFHDR2 and clean up LsaEnumTrustedDomains() Tested client and server code. (This used to be commit efb3ac4c69c72c0fa01c558951fa357893562bce) --- source3/rpc_parse/parse_lsa.c | 136 ++++++++++++++++++++--------------------- source3/rpc_parse/parse_misc.c | 69 +++++++++++---------- source3/rpc_parse/parse_reg.c | 2 + 3 files changed, 106 insertions(+), 101 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 649cb7845a..ab3d3fcfe8 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -6,6 +6,7 @@ * Copyright (C) Paul Ashton 1997, * Copyright (C) Andrew Bartlett 2002, * Copyright (C) Jim McDonough 2002. + * Copyright (C) Gerald )Jerry) Carter 2005 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -516,100 +517,99 @@ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 en DEBUG(5, ("init_r_enum_trust_dom\n")); - r_e->enum_context = enum_context; - r_e->num_domains = num_domains; - r_e->ptr_enum_domains = 0; - r_e->num_domains2 = num_domains; - - if (num_domains != 0) { + r_e->enum_context = enum_context; + r_e->count = num_domains; + + if ( num_domains != 0 ) { - /* - * allocating empty arrays of unicode headers, strings - * and sids of enumerated trusted domains - */ - if (!(r_e->hdr_domain_name = TALLOC_ARRAY(ctx,UNIHDR2,num_domains))) { - r_e->status = NT_STATUS_NO_MEMORY; - return; - } + /* allocate container memory */ - if (!(r_e->uni_domain_name = TALLOC_ARRAY(ctx,UNISTR2,num_domains))) { - r_e->status = NT_STATUS_NO_MEMORY; - return; - } - - if (!(r_e->domain_sid = TALLOC_ARRAY(ctx,DOM_SID2,num_domains))) { + r_e->domlist = TALLOC_P( ctx, DOMAIN_LIST ); + r_e->domlist->domains = TALLOC_ARRAY( ctx, DOMAIN_INFO, r_e->count ); + + if ( !r_e->domlist || !r_e->domlist->domains ) { r_e->status = NT_STATUS_NO_MEMORY; return; } + + r_e->domlist->count = r_e->count; + + /* initialize the list of domains and their sid */ + + for (i = 0; i < num_domains; i++) { + if ( !(r_e->domlist->domains[i].sid = TALLOC_P(ctx, DOM_SID2)) ) { + r_e->status = NT_STATUS_NO_MEMORY; + return; + } - for (i = 0; i < num_domains; i++) { - - /* don't know what actually is this for */ - r_e->ptr_enum_domains = 1; - - init_dom_sid2(&r_e->domain_sid[i], &(td[i])->sid); - - init_unistr2_w(ctx, &r_e->uni_domain_name[i], (td[i])->name); - init_uni_hdr2(&r_e->hdr_domain_name[i], &r_e->uni_domain_name[i]); - - }; + init_dom_sid2(r_e->domlist->domains[i].sid, &(td[i])->sid); + init_unistr4_w(ctx, &r_e->domlist->domains[i].name, (td[i])->name); + } } } /******************************************************************* - 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 *r_e, - prs_struct *ps, int depth) +BOOL lsa_io_domain_list( const char *desc, prs_struct *ps, int depth, DOMAIN_LIST *domlist ) { - prs_debug(ps, depth, desc, "lsa_io_r_enum_trust_dom"); + int i; + + prs_debug(ps, depth, desc, "lsa_io_domain_list"); depth++; - if(!prs_uint32("enum_context ", ps, depth, &r_e->enum_context)) - return False; - if(!prs_uint32("num_domains ", ps, depth, &r_e->num_domains)) - return False; - if(!prs_uint32("ptr_enum_domains", ps, depth, &r_e->ptr_enum_domains)) + if(!prs_uint32("count", ps, depth, &domlist->count)) return False; - if (r_e->ptr_enum_domains) { - int i, num_domains; + 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; icount; 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; + } - if(!prs_uint32("num_domains2", ps, depth, &r_e->num_domains2)) + /* data */ + + for ( i=0; icount; 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; +} - num_domains = r_e->num_domains2; +/******************************************************************* + Reads or writes an LSA_R_ENUM_TRUST_DOM structure. +********************************************************************/ - if (UNMARSHALLING(ps)) { - if (!(r_e->hdr_domain_name = PRS_ALLOC_MEM(ps,UNIHDR2,num_domains))) - return False; +BOOL lsa_io_r_enum_trust_dom(const char *desc, LSA_R_ENUM_TRUST_DOM *r_e, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_r_enum_trust_dom"); + depth++; - if (!(r_e->uni_domain_name = PRS_ALLOC_MEM(ps,UNISTR2,num_domains))) - return False; + if(!prs_uint32("enum_context", ps, depth, &r_e->enum_context)) + return False; - if (!(r_e->domain_sid = PRS_ALLOC_MEM(ps,DOM_SID2,num_domains))) - return False; - } + if(!prs_uint32("count", ps, depth, &r_e->count)) + return False; - for (i = 0; i < num_domains; i++) { - if(!smb_io_unihdr2 ("", &r_e->hdr_domain_name[i], ps, - depth)) - return False; - } + if ( !prs_pointer("trusted_domains", ps, depth, (void**)&r_e->domlist, sizeof(DOMAIN_LIST), (PRS_POINTER_CAST)lsa_io_domain_list)) + return False; - for (i = 0; i < num_domains; i++) { - if(!smb_io_unistr2 ("", &r_e->uni_domain_name[i], - r_e->hdr_domain_name[i].buffer, - ps, depth)) - return False; - if(!smb_io_dom_sid2("", &r_e->domain_sid[i], ps, - depth)) - return False; - } - } - if(!prs_ntstatus("status", ps, depth, &r_e->status)) return False; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 57f44f9f85..858366d4ad 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -4,6 +4,7 @@ * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997. + * 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 @@ -280,6 +281,33 @@ void init_dom_sid2(DOM_SID2 *sid2, const DOM_SID *sid) Reads or writes a DOM_SID2 structure. ********************************************************************/ +BOOL smb_io_dom_sid2_p(const char *desc, prs_struct *ps, int depth, DOM_SID2 **sid2) +{ + uint32 data_p; + + /* caputure the pointer value to stream */ + + data_p = (uint32) *sid2; + + if ( !prs_uint32("dom_sid2_p", ps, depth, &data_p )) + return False; + + /* we're done if there is no data */ + + if ( !data_p ) + return True; + + if (UNMARSHALLING(ps)) { + if ( !(*sid2 = PRS_ALLOC_MEM(ps, DOM_SID2, 1)) ) + return False; + } + + return True; +} +/******************************************************************* + Reads or writes a DOM_SID2 structure. +********************************************************************/ + BOOL smb_io_dom_sid2(const char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) { if (sid == NULL) @@ -484,39 +512,6 @@ BOOL smb_io_hdrbuf(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth) return True; } -/******************************************************************* -creates a UNIHDR2 structure. -********************************************************************/ - -void init_uni_hdr2(UNIHDR2 *hdr, UNISTR2 *str2) -{ - init_uni_hdr(&hdr->unihdr, str2); - hdr->buffer = (str2->uni_str_len > 0) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a UNIHDR2 structure. -********************************************************************/ - -BOOL smb_io_unihdr2(const char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) -{ - if (hdr2 == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_unihdr2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unihdr("hdr", &hdr2->unihdr, ps, depth)) - return False; - if(!prs_uint32("buffer", ps, depth, &hdr2->buffer)) - return False; - - return True; -} - /******************************************************************* Inits a UNISTR structure. ********************************************************************/ @@ -913,6 +908,14 @@ void init_unistr4(UNISTR4 *uni4, const char *buf, enum unistr2_term_codes flags) uni4->size = 2 * (uni4->string->uni_max_len); } +void init_unistr4_w( TALLOC_CTX *ctx, UNISTR4 *uni4, const smb_ucs2_t *buf ) +{ + uni4->string = TALLOC_P( ctx, UNISTR2 ); + init_unistr2_w( ctx, uni4->string, buf ); + + uni4->length = 2 * (uni4->string->uni_str_len); + uni4->size = 2 * (uni4->string->uni_max_len); +} /** * Inits a UNISTR2 structure. diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 09e19bf701..e76c536cee 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -271,8 +271,10 @@ BOOL reg_io_q_create_key(const char *desc, REG_Q_CREATE_KEY *q_u, ps, depth)) return False; +#if 0 if(!prs_uint32("unknown_2", ps, depth, &q_u->unknown_2)) return False; +#endif return True; } -- cgit From 466a825ce7a3c9a40a694608523f47e580c78415 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 7 Apr 2005 04:58:38 +0000 Subject: r6232: more cleanups; remove BUFFER3; rename BUFFER4 -> RPC_DATA_BLOB; rename REG_CREATE_VALE -> REG_SET_VALUE (This used to be commit 28d433351cf813c7fb57ebac0e0f4973c85f73e8) --- source3/rpc_parse/parse_misc.c | 93 +++++++++++++++--------------------------- source3/rpc_parse/parse_net.c | 21 ++++------ source3/rpc_parse/parse_reg.c | 25 ++++++++---- 3 files changed, 55 insertions(+), 84 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 858366d4ad..faa00d1862 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -554,105 +554,69 @@ BOOL smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth) } /******************************************************************* - Allocate the BUFFER3 memory. + Allocate the RPC_DATA_BLOB memory. ********************************************************************/ -static size_t create_buffer3(BUFFER3 *str, size_t len) +static size_t create_rpc_blob(RPC_DATA_BLOB *str, size_t len) { str->buffer = TALLOC_ZERO(get_talloc_ctx(), len); if (str->buffer == NULL) - smb_panic("create_buffer3: talloc fail\n"); + smb_panic("create_rpc_blob: talloc fail\n"); return len; } /******************************************************************* - Inits a BUFFER3 structure from a uint32 + Inits a RPC_DATA_BLOB structure from a uint32 ********************************************************************/ -void init_buffer3_uint32(BUFFER3 *str, uint32 val) +void init_rpc_blob_uint32(RPC_DATA_BLOB *str, uint32 val) { ZERO_STRUCTP(str); /* set up string lengths. */ - str->buf_max_len = str->buf_len = create_buffer3(str, sizeof(uint32)); + str->buf_len = create_rpc_blob(str, sizeof(uint32)); SIVAL(str->buffer, 0, val); } /******************************************************************* - Inits a BUFFER3 structure. + Inits a RPC_DATA_BLOB structure. ********************************************************************/ -void init_buffer3_str(BUFFER3 *str, const char *buf, int len) +void init_rpc_blob_str(RPC_DATA_BLOB *str, const char *buf, int len) { ZERO_STRUCTP(str); /* set up string lengths. */ - str->buf_max_len = str->buf_len = create_buffer3(str, len*2); - rpcstr_push(str->buffer, buf, str->buf_max_len, STR_TERMINATE); + str->buf_len = create_rpc_blob(str, len*2); + rpcstr_push(str->buffer, buf, str->buf_len, STR_TERMINATE); } /******************************************************************* - Inits a BUFFER3 structure from a hex string. + Inits a RPC_DATA_BLOB structure from a hex string. ********************************************************************/ -void init_buffer3_hex(BUFFER3 *str, const char *buf) +void init_rpc_blob_hex(RPC_DATA_BLOB *str, const char *buf) { ZERO_STRUCTP(str); - str->buf_max_len = str->buf_len = create_buffer3(str, strlen(buf)); - str->buf_max_len = str->buf_len = strhex_to_str((char *)str->buffer, str->buf_len, buf); + str->buf_len = create_rpc_blob(str, strlen(buf)); + str->buf_len = strhex_to_str((char *)str->buffer, str->buf_len, buf); } /******************************************************************* - Inits a BUFFER3 structure. + Inits a RPC_DATA_BLOB structure. ********************************************************************/ -void init_buffer3_bytes(BUFFER3 *str, uint8 *buf, size_t len) +void init_rpc_blob_bytes(RPC_DATA_BLOB *str, uint8 *buf, size_t len) { ZERO_STRUCTP(str); /* max buffer size (allocated size) */ if (buf != NULL) { - len = create_buffer3(str, len); + len = create_rpc_blob(str, len); memcpy(str->buffer, buf, len); } - str->buf_max_len = len; - str->buf_len = buf != NULL ? len : 0; -} - -/******************************************************************* - Reads or writes a BUFFER3 structure. - the uni_max_len member tells you how large the buffer is. - the uni_str_len member tells you how much of the buffer is really used. -********************************************************************/ - -BOOL smb_io_buffer3(const char *desc, BUFFER3 *buf3, prs_struct *ps, int depth) -{ - if (buf3 == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_buffer3"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("uni_max_len", ps, depth, &buf3->buf_max_len)) - return False; - - if (UNMARSHALLING(ps)) { - buf3->buffer = PRS_ALLOC_MEM(ps, unsigned char, buf3->buf_max_len); - if (buf3->buffer == NULL) - return False; - } - - if(!prs_uint8s(True, "buffer ", ps, depth, buf3->buffer, buf3->buf_max_len)) - return False; - - if(!prs_uint32("buf_len ", ps, depth, &buf3->buf_len)) - return False; - - return True; + str->buf_len = len; } /******************************************************************* @@ -1816,23 +1780,30 @@ BOOL smb_io_bufhdr4(const char *desc, BUFHDR4 *hdr, prs_struct *ps, int depth) } /******************************************************************* -reads or writes a BUFFER4 structure. +reads or writes a RPC_DATA_BLOB structure. ********************************************************************/ -BOOL smb_io_buffer4(const char *desc, BUFFER4 *buf4, uint32 buffer, prs_struct *ps, int depth) +BOOL smb_io_rpc_blob(const char *desc, RPC_DATA_BLOB *blob, prs_struct *ps, int depth) { - prs_debug(ps, depth, desc, "smb_io_buffer4"); + prs_debug(ps, depth, desc, "smb_io_rpc_blob"); depth++; prs_align(ps); - prs_uint32("buf_len", ps, depth, &buf4->buf_len); + if ( !prs_uint32("buf_len", ps, depth, &blob->buf_len) ) + return False; + + if ( blob->buf_len == 0 ) + return True; + if (UNMARSHALLING(ps)) { - buf4->buffer = PRS_ALLOC_MEM(ps, uint8, buf4->buf_len); - if (!buf4->buffer) { + blob->buffer = PRS_ALLOC_MEM(ps, uint8, blob->buf_len); + if (!blob->buffer) { return False; } } - prs_uint8s(True, "buffer", ps, depth, buf4->buffer, buf4->buf_len); + + if ( !prs_uint8s(True, "buffer", ps, depth, blob->buffer, blob->buf_len) ) + return False; return True; } diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index d7bdca4df9..ed95656fda 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1972,8 +1972,7 @@ static BOOL net_io_sam_domain_info(const char *desc, SAM_DOMAIN_INFO * info, info->hdr_oem_info.buffer, ps, depth)) return False; - if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, - info->hdr_sec_desc.buffer, ps, depth)) + 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, @@ -2021,8 +2020,7 @@ static BOOL net_io_sam_group_info(const char *desc, SAM_GROUP_INFO * info, if (!smb_io_unistr2("uni_grp_desc", &info->uni_grp_desc, info->hdr_grp_desc.buffer, ps, depth)) return False; - if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, - info->hdr_sec_desc.buffer, ps, depth)) + if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth)) return False; return True; @@ -2274,8 +2272,7 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], if (!prs_uint32("unknown2", ps, depth, &info->unknown2)) return False; - if (!smb_io_buffer4("buf_logon_hrs", &info->buf_logon_hrs, - info->ptr_logon_hrs, ps, depth)) + 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, @@ -2316,8 +2313,7 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], return False; ps->data_offset = old_offset + len; } - if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, - info->hdr_sec_desc.buffer, ps, depth)) + 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, @@ -2436,8 +2432,7 @@ static BOOL net_io_sam_alias_info(const char *desc, SAM_ALIAS_INFO * info, if (!smb_io_unistr2("uni_als_name", &info->uni_als_name, info->hdr_als_name.buffer, ps, depth)) return False; - if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, - info->hdr_sec_desc.buffer, ps, depth)) + 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, @@ -2596,8 +2591,7 @@ static BOOL net_io_sam_policy_info(const char *desc, SAM_DELTA_POLICY *info, if(!smb_io_dom_sid2("domain_sid", &info->domain_sid, ps, depth)) return False; - if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, - info->hdr_sec_desc.buffer, ps, depth)) + if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth)) return False; @@ -2831,8 +2825,7 @@ static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info, if (!smb_io_unistr2("uni_privslist", &info->uni_privslist[i], True, ps, depth)) return False; - if (!smb_io_buffer4("buf_sec_desc", &info->buf_sec_desc, - info->hdr_sec_desc.buffer, ps, depth)) + if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth)) return False; return True; diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index e76c536cee..a51b4269e3 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -639,8 +639,10 @@ BOOL reg_io_q_save_key(const char *desc, REG_Q_SAVE_KEY *q_u, prs_struct *ps, i if(!prs_unistr4("filename", ps, depth, &q_u->filename)) return False; +#if 0 /* reg_io_sec_attr() */ if(!prs_uint32("unknown", ps, depth, &q_u->unknown)) return False; +#endif return True; } @@ -1203,9 +1205,9 @@ BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_u, prs_struct *ps, makes a structure. ********************************************************************/ -void init_reg_q_create_val(REG_Q_CREATE_VALUE *q_u, POLICY_HND *pol, +void init_reg_q_set_val(REG_Q_SET_VALUE *q_u, POLICY_HND *pol, char *val_name, uint32 type, - BUFFER3 *val) + RPC_DATA_BLOB *val) { ZERO_STRUCTP(q_u); @@ -1214,19 +1216,20 @@ void init_reg_q_create_val(REG_Q_CREATE_VALUE *q_u, POLICY_HND *pol, init_unistr4(&q_u->name, val_name, UNI_STR_TERMINATE); q_u->type = type; - q_u->value = val; + q_u->value = *val; + q_u->size = val->buf_len; } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_create_val(const char *desc, REG_Q_CREATE_VALUE *q_u, prs_struct *ps, int depth) +BOOL reg_io_q_set_val(const char *desc, REG_Q_SET_VALUE *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "reg_io_q_create_val"); + prs_debug(ps, depth, desc, "reg_io_q_set_val"); depth++; if(!prs_align(ps)) @@ -1242,11 +1245,15 @@ BOOL reg_io_q_create_val(const char *desc, REG_Q_CREATE_VALUE *q_u, prs_struct if(!prs_uint32("type", ps, depth, &q_u->type)) return False; - if(!smb_io_buffer3("value", q_u->value, ps, depth)) + + if(!smb_io_rpc_blob("value", &q_u->value, ps, depth )) return False; if(!prs_align(ps)) return False; + if(!prs_uint32("size", ps, depth, &q_u->size)) + return False; + return True; } @@ -1254,12 +1261,12 @@ BOOL reg_io_q_create_val(const char *desc, REG_Q_CREATE_VALUE *q_u, prs_struct reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_create_val(const char *desc, REG_R_CREATE_VALUE *q_u, prs_struct *ps, int depth) +BOOL reg_io_r_set_val(const char *desc, REG_R_SET_VALUE *q_u, prs_struct *ps, int depth) { if ( !q_u ) return False; - prs_debug(ps, depth, desc, "reg_io_r_create_val"); + prs_debug(ps, depth, desc, "reg_io_r_set_val"); depth++; if(!prs_align(ps)) @@ -1451,7 +1458,7 @@ BOOL reg_io_q_open_entry(const char *desc, REG_Q_OPEN_ENTRY *q_u, prs_struct *p if ( !q_u ) return False; - prs_debug(ps, depth, desc, "reg_io_q_entry"); + prs_debug(ps, depth, desc, "reg_io_q_open_entry"); depth++; if(!prs_align(ps)) -- cgit From 14ce1ed40c9c6b7a4ac55ae56c247c66c46fe546 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 8 Apr 2005 04:13:19 +0000 Subject: r6243: Yes. I *will* hate myself in the morning for this one. I need to gather some more information to know if these extra context id's may be used later. But for now, pw changes via CTL+ALT+DEL from win2k3sp1 clients work. (This used to be commit e7189a4e4b2211ce396944559d38056fa5b57f65) --- source3/rpc_parse/parse_rpc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 823e0e8d2a..6bdab2e437 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -404,6 +404,9 @@ void init_rpc_hdr_rb(RPC_HDR_RB *rpc, BOOL smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) { + RPC_HDR_RB rpc2; + int i; + if (rpc == NULL) return False; @@ -424,6 +427,20 @@ BOOL smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int de return False; if(!smb_io_rpc_iface("", &rpc->transfer, ps, depth)) return False; + + /* just chew through extra context id's for now */ + + for ( i=1; inum_elements; i++ ) { + if(!prs_uint16("context_id ", ps, depth, &rpc2.context_id )) + return False; + if(!prs_uint8 ("num_syntaxes", ps, depth, &rpc2.num_syntaxes)) + return False; + + if(!smb_io_rpc_iface("", &rpc2.abstract, ps, depth)) + return False; + if(!smb_io_rpc_iface("", &rpc2.transfer, ps, depth)) + return False; + } return True; } -- cgit From d3d6126d94d55a69c45b2f7a63a7fa9b561baf48 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 15 Apr 2005 13:41:49 +0000 Subject: r6351: This is quite a large and intrusive patch, but there are not many pieces that can be taken out of it, so I decided to commit this in one lump. It changes the passdb enumerating functions to use ldap paged results where possible. In particular the samr calls querydispinfo, enumdomusers and friends have undergone significant internal changes. I have tested this extensively with rpcclient and a bit with usrmgr.exe. More tests and the merge to trunk will follow later. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code is based on a first implementation by Günther Deschner, but has evolved quite a bit since then. Volker (This used to be commit f0bb44ac58e190e19eb4e92928979b0446e611c9) --- source3/rpc_parse/parse_samr.c | 221 ++++++++++++++++------------------------- 1 file changed, 86 insertions(+), 135 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 14d4bb9fdf..d3f709c352 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1516,75 +1516,42 @@ BOOL samr_io_q_query_dispinfo(const char *desc, SAMR_Q_QUERY_DISPINFO * q_e, inits a SAM_DISPINFO_1 structure. ********************************************************************/ -NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 *sam, uint32 num_entries, - uint32 start_idx, SAM_ACCOUNT *disp_user_info, - DOM_SID *domain_sid) +NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 **sam, + uint32 num_entries, uint32 start_idx, + struct samr_displayentry *entries) { uint32 i; - SAM_ACCOUNT *pwd = NULL; - ZERO_STRUCTP(sam); - DEBUG(10, ("init_sam_dispinfo_1: num_entries: %d\n", num_entries)); if (num_entries==0) return NT_STATUS_OK; - sam->sam=TALLOC_ARRAY(ctx, SAM_ENTRY1, num_entries); - if (!sam->sam) + *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_1, num_entries); + if (*sam == NULL) return NT_STATUS_NO_MEMORY; - sam->str=TALLOC_ARRAY(ctx, SAM_STR1, num_entries); - if (!sam->str) + (*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY1, num_entries); + if ((*sam)->sam == NULL) return NT_STATUS_NO_MEMORY; - ZERO_STRUCTP(sam->sam); - ZERO_STRUCTP(sam->str); + (*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++) { - const char *username; - const char *fullname; - const char *acct_desc; - uint32 user_rid; - const DOM_SID *user_sid; - fstring user_sid_string, domain_sid_string; - - DEBUG(11, ("init_sam_dispinfo_1: entry: %d\n",i)); - - pwd=&disp_user_info[i+start_idx]; - - username = pdb_get_username(pwd); - fullname = pdb_get_fullname(pwd); - acct_desc = pdb_get_acct_desc(pwd); - - if (!username) - username = ""; - - if (!fullname) - fullname = ""; - - if (!acct_desc) - acct_desc = ""; - - user_sid = pdb_get_user_sid(pwd); - - if (!sid_peek_check_rid(domain_sid, user_sid, &user_rid)) { - DEBUG(0, ("init_sam_dispinfo_1: User %s has SID %s, which conflicts with " - "the domain sid %s. Failing operation.\n", - username, - sid_to_string(user_sid_string, user_sid), - sid_to_string(domain_sid_string, domain_sid))); - return NT_STATUS_UNSUCCESSFUL; - } - - init_unistr2(&sam->str[i].uni_acct_name, pdb_get_username(pwd), UNI_FLAGS_NONE); - init_unistr2(&sam->str[i].uni_full_name, pdb_get_fullname(pwd), UNI_FLAGS_NONE); - init_unistr2(&sam->str[i].uni_acct_desc, pdb_get_acct_desc(pwd), 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, - user_rid, pdb_get_acct_ctrl(pwd)); - + 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; @@ -1639,58 +1606,39 @@ static BOOL sam_io_sam_dispinfo_1(const char *desc, SAM_DISPINFO_1 * sam, inits a SAM_DISPINFO_2 structure. ********************************************************************/ -NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 *sam, uint32 num_entries, - uint32 start_idx, SAM_ACCOUNT *disp_user_info, - DOM_SID *domain_sid ) +NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 **sam, + uint32 num_entries, uint32 start_idx, + struct samr_displayentry *entries) { uint32 i; - SAM_ACCOUNT *pwd = NULL; - ZERO_STRUCTP(sam); - DEBUG(10, ("init_sam_dispinfo_2: num_entries: %d\n", num_entries)); if (num_entries==0) return NT_STATUS_OK; - if (!(sam->sam=TALLOC_ARRAY(ctx, SAM_ENTRY2, num_entries))) + *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_2, num_entries); + if (*sam == NULL) return NT_STATUS_NO_MEMORY; - if (!(sam->str=TALLOC_ARRAY(ctx, SAM_STR2, num_entries))) + (*sam)->sam = TALLOC_ARRAY(ctx, SAM_ENTRY2, num_entries); + if ((*sam)->sam == NULL) return NT_STATUS_NO_MEMORY; - ZERO_STRUCTP(sam->sam); - ZERO_STRUCTP(sam->str); + (*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++) { - uint32 user_rid; - const DOM_SID *user_sid; - const char *username; - const char *acct_desc; - fstring user_sid_string, domain_sid_string; - - DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i)); - pwd=&disp_user_info[i+start_idx]; - - username = pdb_get_username(pwd); - acct_desc = pdb_get_acct_desc(pwd); - user_sid = pdb_get_user_sid(pwd); - - if (!sid_peek_check_rid(domain_sid, user_sid, &user_rid)) { - DEBUG(0, ("init_sam_dispinfo_2: User %s has SID %s, which conflicts with " - "the domain sid %s. Failing operation.\n", - username, - sid_to_string(user_sid_string, user_sid), - sid_to_string(domain_sid_string, domain_sid))); - return NT_STATUS_UNSUCCESSFUL; - } - - init_unistr2(&sam->str[i].uni_srv_name, username, UNI_FLAGS_NONE); - init_unistr2(&sam->str[i].uni_srv_desc, acct_desc, 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, - user_rid, pdb_get_acct_ctrl(pwd)); + 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; @@ -1747,37 +1695,39 @@ static BOOL sam_io_sam_dispinfo_2(const char *desc, SAM_DISPINFO_2 * sam, inits a SAM_DISPINFO_3 structure. ********************************************************************/ -NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 *sam, uint32 num_entries, - uint32 start_idx, DOMAIN_GRP *disp_group_info) +NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 **sam, + uint32 num_entries, uint32 start_idx, + struct samr_displayentry *entries) { uint32 i; - ZERO_STRUCTP(sam); - DEBUG(5, ("init_sam_dispinfo_3: num_entries: %d\n", num_entries)); if (num_entries==0) return NT_STATUS_OK; - if (!(sam->sam=TALLOC_ARRAY(ctx, SAM_ENTRY3, num_entries))) + *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_3, num_entries); + if (*sam == NULL) return NT_STATUS_NO_MEMORY; - if (!(sam->str=TALLOC_ARRAY(ctx, SAM_STR3, num_entries))) + if (!((*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY3, num_entries))) return NT_STATUS_NO_MEMORY; - ZERO_STRUCTP(sam->sam); - ZERO_STRUCTP(sam->str); + if (!((*sam)->str=TALLOC_ARRAY(ctx, SAM_STR3, num_entries))) + return NT_STATUS_NO_MEMORY; for (i = 0; i < num_entries; i++) { - DOMAIN_GRP *grp = &disp_group_info[i+start_idx]; - DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i)); - init_unistr2(&sam->str[i].uni_grp_name, grp->name, UNI_FLAGS_NONE); - init_unistr2(&sam->str[i].uni_grp_desc, grp->comment, UNI_FLAGS_NONE); + 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, grp->rid); + 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; @@ -1834,38 +1784,40 @@ static BOOL sam_io_sam_dispinfo_3(const char *desc, SAM_DISPINFO_3 * sam, inits a SAM_DISPINFO_4 structure. ********************************************************************/ -NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 *sam, uint32 num_entries, - uint32 start_idx, SAM_ACCOUNT *disp_user_info) +NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 **sam, + uint32 num_entries, uint32 start_idx, + struct samr_displayentry *entries) { - uint32 len_sam_name; uint32 i; - SAM_ACCOUNT *pwd = NULL; - ZERO_STRUCTP(sam); - DEBUG(5, ("init_sam_dispinfo_4: num_entries: %d\n", num_entries)); if (num_entries==0) return NT_STATUS_OK; - if (!(sam->sam=TALLOC_ARRAY(ctx, SAM_ENTRY4, num_entries))) + *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_4, num_entries); + if (*sam == NULL) return NT_STATUS_NO_MEMORY; - if (!(sam->str=TALLOC_ARRAY(ctx, SAM_STR4, num_entries))) + (*sam)->sam = TALLOC_ARRAY(ctx, SAM_ENTRY4, num_entries); + if ((*sam)->sam == NULL) return NT_STATUS_NO_MEMORY; - ZERO_STRUCTP(sam->sam); - ZERO_STRUCTP(sam->str); + (*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++) { - DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i)); - pwd=&disp_user_info[i+start_idx]; + size_t len_sam_name = strlen(entries[i].account_name); - len_sam_name = strlen(pdb_get_username(pwd)); + DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i)); - init_sam_entry4(&sam->sam[i], start_idx + i + 1, len_sam_name); + init_sam_entry4(&(*sam)->sam[i], start_idx + i + 1, + len_sam_name); - init_string2(&sam->str[i].acct_name, pdb_get_username(pwd), len_sam_name+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; @@ -1921,37 +1873,36 @@ static BOOL sam_io_sam_dispinfo_4(const char *desc, SAM_DISPINFO_4 * sam, inits a SAM_DISPINFO_5 structure. ********************************************************************/ -NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 *sam, uint32 num_entries, - uint32 start_idx, DOMAIN_GRP *disp_group_info) +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; - ZERO_STRUCTP(sam); - DEBUG(5, ("init_sam_dispinfo_5: num_entries: %d\n", num_entries)); if (num_entries==0) return NT_STATUS_OK; - if (!(sam->sam=TALLOC_ARRAY(ctx, SAM_ENTRY5, num_entries))) + *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_5, num_entries); + if (*sam == NULL) return NT_STATUS_NO_MEMORY; - if (!(sam->str=TALLOC_ARRAY(ctx, SAM_STR5, num_entries))) + if (!((*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY5, num_entries))) return NT_STATUS_NO_MEMORY; - ZERO_STRUCTP(sam->sam); - ZERO_STRUCTP(sam->str); + if (!((*sam)->str=TALLOC_ARRAY(ctx, SAM_STR5, num_entries))) + return NT_STATUS_NO_MEMORY; for (i = 0; i < num_entries; i++) { - DOMAIN_GRP *grp = &disp_group_info[i+start_idx]; - DEBUG(11, ("init_sam_dispinfo_5: entry: %d\n",i)); - len_sam_name = strlen(grp->name); + 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, grp->name, len_sam_name+1, len_sam_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; -- cgit From 2e0cac8e3eb021aa8f5cad4ce8b72f98036af639 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 23 Apr 2005 18:07:01 +0000 Subject: r6445: Make us survive the PARANOID_MALLOC_CHECKER. Should we enable that for --enable-developer=yes? Volker (This used to be commit 61d40ac60dd9c8c9bbcf92e4fc57fe1d706bc721) --- source3/rpc_parse/parse_eventlog.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 9bb0a13169..be21f0f74e 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -372,7 +372,9 @@ BOOL eventlog_io_r_read_eventlog(const char *desc, /* Now pad with whitespace until the end of the response buffer */ - r_u->end_of_entries_padding = (uint8 *)calloc(q_u->max_read_size - r_u->num_bytes_in_resp, sizeof(uint8)); + r_u->end_of_entries_padding = + SMB_CALLOC_ARRAY(uint8, + q_u->max_read_size - r_u->num_bytes_in_resp); if(!(prs_uint8s(False, "end of entries padding", ps, depth, r_u->end_of_entries_padding, -- cgit From d65f313fa742d8cb34a36a7a4699fba6c0b744f3 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 26 Apr 2005 14:42:48 +0000 Subject: r6491: BUG 2653: patch from Olaf Imig ; allocate memory for user1* in make_spoolss_q_open_printer_ex() (This used to be commit f04232cce7f940814828caf80a2ecb8761146b14) --- source3/rpc_parse/parse_spoolss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 78602dd806..160d9c78b1 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -911,7 +911,8 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, q_u->user_switch = 1; - q_u->user_ctr.level = 1; + q_u->user_ctr.level = 1; + q_u->user_ctr.user.user1 = TALLOC_P( get_talloc_ctx(), SPOOL_USER_1 ); q_u->user_ctr.user.user1->size = strlen(clientname) + strlen(user_name) + 10; q_u->user_ctr.user.user1->build = 1381; q_u->user_ctr.user.user1->major = 2; -- cgit From 7b9d6ac23e1a7d8136fffd2e3977b09a815da65a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 3 May 2005 07:33:49 +0000 Subject: r6595: This is Volkers new-talloc patch. Just got the go-ahead from Volker to commit. Woo Hoo ! Jeremy. (This used to be commit 316df944a456f150944761dab34add5e8c4ab699) --- source3/rpc_parse/parse_prs.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 1b9ac51c61..cccad9ad55 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -153,11 +153,7 @@ char *prs_alloc_mem(prs_struct *ps, size_t size, unsigned int count) if (size) { /* We can't call the type-safe version here. */ -#if defined(PARANOID_MALLOC_CHECKER) - ret = talloc_zero_array_(ps->mem_ctx, size, count); -#else - ret = talloc_zero_array(ps->mem_ctx, size, count); -#endif + ret = _talloc_zero_array(ps->mem_ctx, size, count, "parse_prs"); } return ret; } -- cgit From 28824fb1971afd398739723ee7c65427bd086d4b Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 3 May 2005 14:01:39 +0000 Subject: r6601: fixing query and set alias info calls (level 1 from the MMC manage computer plugin. (This used to be commit c43c1ec80cb52569ccabcdf95e4004386ecb29d6) --- source3/rpc_parse/parse_samr.c | 87 +++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 52 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index d3f709c352..ba8b367a42 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3472,13 +3472,9 @@ void init_samr_alias_info1(ALIAS_INFO1 * al1, char *acct_name, uint32 num_member { DEBUG(5, ("init_samr_alias_info1\n")); - init_unistr2(&al1->uni_acct_name, acct_name, UNI_FLAGS_NONE); - init_uni_hdr(&al1->hdr_acct_name, &al1->uni_acct_name); - - al1->num_member=num_member; - - init_unistr2(&al1->uni_acct_desc, acct_desc, UNI_FLAGS_NONE); - init_uni_hdr(&al1->hdr_acct_desc, &al1->uni_acct_name); + init_unistr4(&al1->name, acct_name, UNI_FLAGS_NONE); + al1->num_member = num_member; + init_unistr4(&al1->description, acct_desc, UNI_FLAGS_NONE); } /******************************************************************* @@ -3497,22 +3493,20 @@ BOOL samr_io_alias_info1(const char *desc, ALIAS_INFO1 * al1, if(!prs_align(ps)) return False; - if(!smb_io_unihdr("hdr_acct_name", &al1->hdr_acct_name, ps, depth)) + if ( !prs_unistr4_hdr("name", ps, depth, &al1->name) ) return False; - if(!prs_uint32("num_member", ps, depth, &al1->num_member)) + if ( !prs_uint32("num_member", ps, depth, &al1->num_member) ) return False; - if(!smb_io_unihdr("hdr_acct_desc", &al1->hdr_acct_desc, ps, depth)) + if ( !prs_unistr4_hdr("description", ps, depth, &al1->description) ) return False; - if(!smb_io_unistr2("uni_acct_name", &al1->uni_acct_name, - al1->hdr_acct_name.buffer, ps, depth)) + if ( !prs_unistr4_str("name", ps, depth, &al1->name) ) return False; - - if(!prs_align(ps)) + if ( !prs_align(ps) ) return False; - - if(!smb_io_unistr2("uni_acct_desc", &al1->uni_acct_desc, - al1->hdr_acct_desc.buffer, ps, depth)) + if ( !prs_unistr4_str("description", ps, depth, &al1->description) ) + return False; + if ( !prs_align(ps) ) return False; return True; @@ -3526,15 +3520,14 @@ void init_samr_alias_info3(ALIAS_INFO3 * al3, const char *acct_desc) { DEBUG(5, ("init_samr_alias_info3\n")); - init_unistr2(&al3->uni_acct_desc, acct_desc, UNI_FLAGS_NONE); - init_uni_hdr(&al3->hdr_acct_desc, &al3->uni_acct_desc); + 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, +BOOL samr_io_alias_info3(const char *desc, ALIAS_INFO3 *al3, prs_struct *ps, int depth) { if (al3 == NULL) @@ -3546,10 +3539,7 @@ BOOL samr_io_alias_info3(const char *desc, ALIAS_INFO3 * al3, if(!prs_align(ps)) return False; - if(!smb_io_unihdr("hdr_acct_desc", &al3->hdr_acct_desc, ps, depth)) - return False; - if(!smb_io_unistr2("uni_acct_desc", &al3->uni_acct_desc, - al3->hdr_acct_desc.buffer, ps, depth)) + if (!prs_unistr4("description", ps, depth, &al3->description)) return False; return True; @@ -3559,21 +3549,20 @@ BOOL samr_io_alias_info3(const char *desc, ALIAS_INFO3 * al3, reads or writes a structure. ********************************************************************/ -BOOL samr_alias_info_ctr(const char *desc, ALIAS_INFO_CTR * ctr, - prs_struct *ps, int depth) +BOOL samr_alias_info_ctr(const char *desc, prs_struct *ps, int depth, ALIAS_INFO_CTR * ctr) { - if (ctr == NULL) + if ( !ctr ) return False; prs_debug(ps, depth, desc, "samr_alias_info_ctr"); depth++; - if(!prs_uint16("switch_value1", ps, depth, &ctr->switch_value1)) - return False; - if(!prs_uint16("switch_value2", ps, depth, &ctr->switch_value2)) + if ( !prs_uint16("level", ps, depth, &ctr->level) ) return False; - switch (ctr->switch_value1) { + 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; @@ -3595,22 +3584,22 @@ inits a SAMR_Q_QUERY_ALIASINFO structure. ********************************************************************/ void init_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO * q_e, - POLICY_HND *pol, uint16 switch_level) + POLICY_HND *pol, uint32 switch_level) { DEBUG(5, ("init_samr_q_query_aliasinfo\n")); q_e->pol = *pol; - q_e->switch_level = switch_level; + q_e->level = switch_level; } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_aliasinfo(const char *desc, SAMR_Q_QUERY_ALIASINFO * q_e, +BOOL samr_io_q_query_aliasinfo(const char *desc, SAMR_Q_QUERY_ALIASINFO *in, prs_struct *ps, int depth) { - if (q_e == NULL) + if ( !in ) return False; prs_debug(ps, depth, desc, "samr_io_q_query_aliasinfo"); @@ -3619,10 +3608,10 @@ BOOL samr_io_q_query_aliasinfo(const char *desc, SAMR_Q_QUERY_ALIASINFO * q_e, if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &(q_e->pol), ps, depth)) + if ( !smb_io_pol_hnd("pol", &(in->pol), ps, depth) ) return False; - if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level)) + if ( !prs_uint16("level", ps, depth, &in->level) ) return False; return True; @@ -3632,24 +3621,23 @@ BOOL samr_io_q_query_aliasinfo(const char *desc, SAMR_Q_QUERY_ALIASINFO * q_e, inits a SAMR_R_QUERY_ALIASINFO structure. ********************************************************************/ -void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO * r_u, +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")); - r_u->ptr = (NT_STATUS_IS_OK(status) && ctr != NULL) ? 1 : 0; - r_u->ctr = *ctr; - r_u->status = status; + out->ctr = ctr; + out->status = status; } /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_aliasinfo(const char *desc, SAMR_R_QUERY_ALIASINFO * r_u, +BOOL samr_io_r_query_aliasinfo(const char *desc, SAMR_R_QUERY_ALIASINFO *out, prs_struct *ps, int depth) { - if (r_u == NULL) + if ( !out ) return False; prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo"); @@ -3658,17 +3646,12 @@ BOOL samr_io_r_query_aliasinfo(const char *desc, SAMR_R_QUERY_ALIASINFO * r_u, if(!prs_align(ps)) return False; - if(!prs_uint32("ptr", ps, depth, &r_u->ptr)) + if ( !prs_pointer("alias", ps, depth, (void**)&out->ctr, sizeof(ALIAS_INFO_CTR), (PRS_POINTER_CAST)samr_alias_info_ctr)) return False; - - if (r_u->ptr != 0) { - if(!samr_alias_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)) + + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -3705,7 +3688,7 @@ BOOL samr_io_q_set_aliasinfo(const char *desc, SAMR_Q_SET_ALIASINFO * q_u, if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth)) return False; - if(!samr_alias_info_ctr("ctr", &q_u->ctr, ps, depth)) + if(!samr_alias_info_ctr("ctr", ps, depth, &q_u->ctr)) return False; return True; -- cgit From cf4005a78d5b2ce922abb0f15e0d0207d7c74077 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 9 May 2005 13:51:44 +0000 Subject: r6680: event log patches from Marcin (This used to be commit a71e104af84810f488f42cb0843976961e6f6ebe) --- source3/rpc_parse/parse_eventlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index be21f0f74e..d27761ad0f 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -304,7 +304,7 @@ BOOL eventlog_io_r_read_eventlog(const char *desc, if(r_u->num_bytes_in_resp != 0) r_u->sent_size = r_u->num_bytes_in_resp; else - r_u->real_size = entry->record.length; + r_u->real_size = r_u->bytes_in_next_record; if(!(prs_align(ps))) return False; -- cgit From 839dc8e59b7118aa758cb69e8fc738fae61965b6 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 9 May 2005 16:03:55 +0000 Subject: r6683: remove log messages about unknown specversions since I think we are fairly safe at this point (This used to be commit 6eaefa1a9a47421e20e346c652c31fd524db8878) --- source3/rpc_parse/parse_spoolss.c | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 160d9c78b1..6c2d6b4978 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -673,25 +673,6 @@ BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE if (!prs_uint16("specversion", ps, depth, &devmode->specversion)) return False; - /* Sanity Check - look for unknown specversions, but don't fail if we see one. - Let the size determine that */ - - switch (devmode->specversion) { - /* list of observed spec version's */ - case 0x0320: - case 0x0400: - case 0x0401: - case 0x040d: - break; - - default: - DEBUG(0,("spoolss_io_devmode: Unknown specversion in devicemode [0x%x]\n", - devmode->specversion)); - DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n")); - break; - } - - if (!prs_uint16("driverversion", ps, depth, &devmode->driverversion)) return False; if (!prs_uint16("size", ps, depth, &devmode->size)) -- cgit From f0c650a38286c07b9f3e83139c15bfbadc70ad5f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 23 May 2005 16:25:31 +0000 Subject: r6942: * merging the registry changes back to the 3.0 tree * removing the testprns tool (This used to be commit 81ffb0dbbbd244623507880c323a3c37e2b8dc4d) --- source3/rpc_parse/parse_misc.c | 20 ++++++++- source3/rpc_parse/parse_reg.c | 94 ++++++++++++++---------------------------- 2 files changed, 49 insertions(+), 65 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index faa00d1862..ccb3e75ac8 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -132,6 +132,15 @@ BOOL smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth) return True; } +/******************************************************************* + Reads or writes an NTTIME structure. +********************************************************************/ + +BOOL smb_io_nttime(const char *desc, prs_struct *ps, int depth, NTTIME *nttime) +{ + return smb_io_time( desc, nttime, ps, depth ); +} + /******************************************************************* Gets an enumeration handle from an ENUM_HND structure. ********************************************************************/ @@ -680,7 +689,7 @@ BOOL smb_io_regval_buffer(const char *desc, prs_struct *ps, int depth, REGVAL_BU if(!prs_align(ps)) return False; - if(!prs_uint32("uni_max_len", ps, depth, &buf2->buf_max_len)) + if(!prs_uint32("buf_max_len", ps, depth, &buf2->buf_max_len)) return False; if(!prs_uint32("offset ", ps, depth, &buf2->offset)) return False; @@ -1081,6 +1090,9 @@ BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct * BOOL prs_unistr4(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) { + prs_debug(ps, depth, desc, "prs_unistr4"); + depth++; + if ( !prs_uint16("length", ps, depth, &uni4->length )) return False; if ( !prs_uint16("size", ps, depth, &uni4->size )) @@ -1728,6 +1740,11 @@ BOOL smb_io_unistr3(const char *desc, UNISTR3 *name, prs_struct *ps, int depth) if(!prs_uint32("uni_str_len", ps, depth, &name->uni_str_len)) return False; + + /* we're done if there is no string */ + + if ( name->uni_str_len == 0 ) + return True; /* don't know if len is specified by uni_str_len member... */ /* assume unicode string is unicode-null-terminated, instead */ @@ -1738,7 +1755,6 @@ BOOL smb_io_unistr3(const char *desc, UNISTR3 *name, prs_struct *ps, int depth) return True; } - /******************************************************************* Stream a uint64_struct ********************************************************************/ diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index a51b4269e3..ce23d15a11 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -75,6 +75,8 @@ BOOL reg_io_q_open_hive(const char *desc, REG_Q_OPEN_HIVE *q_u, if(!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; + if(!prs_align(ps)) + return False; if(!prs_uint32("access", ps, depth, &q_u->access)) return False; @@ -1056,8 +1058,8 @@ makes a structure. ********************************************************************/ void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_u, POLICY_HND *pol, - uint32 val_idx, char *name, - uint32 max_buf_len) + uint32 val_idx, + uint32 max_name_len, uint32 max_buf_len) { ZERO_STRUCTP(q_u); @@ -1065,19 +1067,21 @@ void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_u, POLICY_HND *pol, q_u->val_index = val_idx; - init_unistr4( &q_u->name, name, UNI_STR_TERMINATE ); + q_u->name.size = max_name_len*2; + q_u->name.string = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR2 ); + q_u->name.string->uni_max_len = max_name_len; q_u->type = TALLOC_P( get_talloc_ctx(), uint32 ); *q_u->type = 0x0; - q_u->value = TALLOC_P( get_talloc_ctx(), REGVAL_BUFFER ); + q_u->value = TALLOC_ZERO_P( get_talloc_ctx(), REGVAL_BUFFER ); q_u->value->buf_max_len = max_buf_len; - q_u->len_value1 = TALLOC_P( get_talloc_ctx(), uint32 ); - *q_u->len_value1 = max_buf_len; + q_u->buffer_len = TALLOC_P( get_talloc_ctx(), uint32 ); + *q_u->buffer_len = max_buf_len; - q_u->len_value2 = TALLOC_P( get_talloc_ctx(), uint32 ); - *q_u->len_value2 = max_buf_len; + q_u->name_len = TALLOC_P( get_talloc_ctx(), uint32 ); + *q_u->name_len = 0x0; } /******************************************************************* @@ -1088,8 +1092,6 @@ void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) { uint32 real_size; - DEBUG(8,("init_reg_r_enum_val: Enter\n")); - ZERO_STRUCTP(r_u); /* value name */ @@ -1110,13 +1112,10 @@ void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) /* lengths */ - r_u->len_value1 = TALLOC_P( get_talloc_ctx(), uint32 ); - *r_u->len_value1 = real_size; - - r_u->len_value2 = TALLOC_P( get_talloc_ctx(), uint32 ); - *r_u->len_value2 = real_size; - - DEBUG(8,("init_reg_r_enum_val: Exit\n")); + r_u->buffer_len1 = TALLOC_P( get_talloc_ctx(), uint32 ); + *r_u->buffer_len1 = real_size; + r_u->buffer_len2 = TALLOC_P( get_talloc_ctx(), uint32 ); + *r_u->buffer_len2 = real_size; } /******************************************************************* @@ -1153,9 +1152,9 @@ BOOL reg_io_q_enum_val(const char *desc, REG_Q_ENUM_VALUE *q_u, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_pointer("len_value1", ps, depth, (void**)&q_u->len_value1, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("buffer_len", ps, depth, (void**)&q_u->buffer_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if(!prs_pointer("len_value2", ps, depth, (void**)&q_u->len_value2, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("name_len", ps, depth, (void**)&q_u->name_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; return True; @@ -1189,12 +1188,11 @@ BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_u, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_pointer("len_value1", ps, depth, (void**)&r_u->len_value1, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("buffer_len1", ps, depth, (void**)&r_u->buffer_len1, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if(!prs_pointer("len_value2", ps, depth, (void**)&r_u->len_value2, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("buffer_len2", ps, depth, (void**)&r_u->buffer_len2, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if(!prs_werror("status", ps, depth, &r_u->status)) return False; @@ -1305,23 +1303,14 @@ void init_reg_q_enum_key(REG_Q_ENUM_KEY *q_u, POLICY_HND *pol, uint32 key_idx) makes a reply structure. ********************************************************************/ -void init_reg_r_enum_key(REG_R_ENUM_KEY *r_u, char *subkey, uint32 unknown_1, - uint32 unknown_2) +void init_reg_r_enum_key(REG_R_ENUM_KEY *r_u, char *subkey ) { if ( !r_u ) return; - r_u->unknown_1 = unknown_1; - r_u->unknown_2 = unknown_2; - r_u->unknown_3 = 0x0; - - r_u->key_name_len = (strlen(subkey)+1) * 2; - if (r_u->key_name_len) - r_u->ptr1 = 0x1; - init_unistr3( &r_u->key_name, subkey ); - - r_u->ptr2 = 0x1; - r_u->ptr3 = 0x1; + init_unistr4( &r_u->keyname, subkey, STR_TERMINATE ); + r_u->classname = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR4 ); + r_u->time = TALLOC_ZERO_P( get_talloc_ctx(), NTTIME ); } /******************************************************************* @@ -1392,42 +1381,21 @@ BOOL reg_io_r_enum_key(const char *desc, REG_R_ENUM_KEY *q_u, prs_struct *ps, i if(!prs_align(ps)) return False; + if ( !prs_unistr4( "keyname", ps, depth, &q_u->keyname ) ) + return False; - if(!prs_uint16("key_name_len", ps, depth, &q_u->key_name_len)) + if(!prs_align(ps)) return False; - if(!prs_uint16("unknown_1", ps, depth, &q_u->unknown_1)) + if (!prs_pointer("class", ps, depth, (void**)&q_u->classname, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; - if(!prs_uint32("ptr1", ps, depth, &q_u->ptr1)) + if(!prs_align(ps)) return False; - - if (q_u->ptr1 != 0) { - if(!prs_uint32("unknown_2", ps, depth, &q_u->unknown_2)) - return False; - if(!prs_uint32("unknown_3", ps, depth, &q_u->unknown_3)) - return False; - if(!smb_io_unistr3("key_name", &q_u->key_name, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - } - - if(!prs_uint32("ptr2", ps, depth, &q_u->ptr2)) + if (!prs_pointer("time", ps, depth, (void**)&q_u->time, sizeof(NTTIME), (PRS_POINTER_CAST)smb_io_nttime)) return False; - if (q_u->ptr2 != 0) { - if(!prs_uint8s(False, "pad2", ps, depth, q_u->pad2, sizeof(q_u->pad2))) - return False; - } - - if(!prs_uint32("ptr3", ps, depth, &q_u->ptr3)) + if(!prs_align(ps)) return False; - - if (q_u->ptr3 != 0) { - if(!smb_io_time("", &q_u->time, ps, depth)) - return False; - } - if(!prs_werror("status", ps, depth, &q_u->status)) return False; -- cgit From d5e79de59561e614fce79a9460c3b2caaa459673 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 26 May 2005 20:36:04 +0000 Subject: r6995: * fixing segfault when writing out registry values of zero length * add RegSaveKey() client function * add 'net rpc registry save' subcommand (This used to be commit f35e0a0a8d8df5c39e61ebd34c4aecbc5c9bb635) --- source3/rpc_parse/parse_reg.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index ce23d15a11..7e8ae03039 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -620,6 +620,16 @@ BOOL reg_io_r_restore_key(const char *desc, REG_R_RESTORE_KEY *r_u, prs_struct return True; } +/******************************************************************* +********************************************************************/ + +void init_q_reg_save_key( REG_Q_SAVE_KEY *q_u, POLICY_HND *handle, const char *fname ) +{ + memcpy(&q_u->pol, handle, sizeof(q_u->pol)); + init_unistr4( &q_u->filename, fname, UNI_STR_TERMINATE ); + q_u->sec_attr = NULL; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ -- cgit From f24d88cf9da46680d52b42b92bd484e7b09ce99b Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 31 May 2005 13:46:45 +0000 Subject: r7139: trying to reduce the number of diffs between trunk and 3.0; changing version to 3.0.20pre1 (This used to be commit 9727d05241574042dd3aa8844ae5c701d22e2da1) --- source3/rpc_parse/parse_lsa.c | 900 ++++++++++++++++++++++++++---------------- 1 file changed, 564 insertions(+), 336 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index ab3d3fcfe8..6d0a0bfc51 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -73,8 +73,7 @@ static BOOL lsa_io_trans_name(const char *desc, LSA_TRANS_NAME *trn, prs_struct Reads or writes a DOM_R_REF structure. ********************************************************************/ -static BOOL lsa_io_dom_r_ref(const char *desc, DOM_R_REF *r_r, prs_struct *ps, - int depth) +static BOOL lsa_io_dom_r_ref(const char *desc, DOM_R_REF *dom, prs_struct *ps, int depth) { unsigned int i; @@ -84,48 +83,48 @@ static BOOL lsa_io_dom_r_ref(const char *desc, DOM_R_REF *r_r, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_uint32("num_ref_doms_1", ps, depth, &r_r->num_ref_doms_1)) /* num referenced domains? */ + 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, &r_r->ptr_ref_dom)) /* undocumented buffer pointer. */ + if(!prs_uint32("ptr_ref_dom ", ps, depth, &dom->ptr_ref_dom)) /* undocumented buffer pointer. */ return False; - if(!prs_uint32("max_entries ", ps, depth, &r_r->max_entries)) /* 32 - max number of entries */ + if(!prs_uint32("max_entries ", ps, depth, &dom->max_entries)) /* 32 - max number of entries */ return False; - SMB_ASSERT_ARRAY(r_r->hdr_ref_dom, r_r->num_ref_doms_1); + SMB_ASSERT_ARRAY(dom->hdr_ref_dom, dom->num_ref_doms_1); - if (r_r->ptr_ref_dom != 0) { + if (dom->ptr_ref_dom != 0) { - if(!prs_uint32("num_ref_doms_2", ps, depth, &r_r->num_ref_doms_2)) /* 4 - num referenced domains? */ + if(!prs_uint32("num_ref_doms_2", ps, depth, &dom->num_ref_doms_2)) /* 4 - num referenced domains? */ return False; - SMB_ASSERT_ARRAY(r_r->ref_dom, r_r->num_ref_doms_2); + SMB_ASSERT_ARRAY(dom->ref_dom, dom->num_ref_doms_2); - for (i = 0; i < r_r->num_ref_doms_1; i++) { + 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, &r_r->hdr_ref_dom[i].hdr_dom_name, ps, depth)) + 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, &r_r->hdr_ref_dom[i].ptr_dom_sid)) + if(!prs_uint32(t, ps, depth, &dom->hdr_ref_dom[i].ptr_dom_sid)) return False; } - for (i = 0; i < r_r->num_ref_doms_2; i++) { + for (i = 0; i < dom->num_ref_doms_2; i++) { fstring t; - if (r_r->hdr_ref_dom[i].hdr_dom_name.buffer != 0) { + 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, &r_r->ref_dom[i].uni_dom_name, True, ps, depth)) /* domain name unicode string */ + 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 (r_r->hdr_ref_dom[i].ptr_dom_sid != 0) { + 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, &r_r->ref_dom[i].ref_dom, ps, depth)) /* referenced domain SIDs */ + if(!smb_io_dom_sid2(t, &dom->ref_dom[i].ref_dom, ps, depth)) /* referenced domain SIDs */ return False; } } @@ -254,42 +253,42 @@ static BOOL lsa_io_obj_attr(const char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps Inits an LSA_Q_OPEN_POL structure. ********************************************************************/ -void init_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name, +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)); - r_q->ptr = 1; /* undocumented pointer */ + in->ptr = 1; /* undocumented pointer */ - r_q->des_access = desired_access; + in->des_access = desired_access; - r_q->system_name = system_name; - init_lsa_obj_attr(&r_q->attr, attributes, qos); + 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 *r_q, prs_struct *ps, +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, &r_q->ptr)) + if(!prs_uint32("ptr ", ps, depth, &in->ptr)) return False; - if(!prs_uint16("system_name", ps, depth, &r_q->system_name)) + if(!prs_uint16("system_name", ps, depth, &in->system_name)) return False; if(!prs_align( ps )) return False; - if(!lsa_io_obj_attr("", &r_q->attr, ps, depth)) + if(!lsa_io_obj_attr("", &in->attr, ps, depth)) return False; - if(!prs_uint32("des_access", ps, depth, &r_q->des_access)) + if(!prs_uint32("des_access", ps, depth, &in->des_access)) return False; return True; @@ -299,16 +298,16 @@ BOOL lsa_io_q_open_pol(const char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, Reads or writes an LSA_R_OPEN_POL structure. ********************************************************************/ -BOOL lsa_io_r_open_pol(const char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, +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("", &r_p->pol, ps, depth)) + if(!smb_io_pol_hnd("", &out->pol, ps, depth)) return False; - if(!prs_ntstatus("status", ps, depth, &r_p->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -318,41 +317,41 @@ BOOL lsa_io_r_open_pol(const char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, Inits an LSA_Q_OPEN_POL2 structure. ********************************************************************/ -void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, const char *server_name, +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)); - r_q->ptr = 1; /* undocumented pointer */ + in->ptr = 1; /* undocumented pointer */ - r_q->des_access = desired_access; + in->des_access = desired_access; - init_unistr2(&r_q->uni_server_name, server_name, UNI_STR_TERMINATE); + init_unistr2(&in->uni_server_name, server_name, UNI_STR_TERMINATE); - init_lsa_obj_attr(&r_q->attr, attributes, qos); + 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 *r_q, prs_struct *ps, +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, &r_q->ptr)) + if(!prs_uint32("ptr ", ps, depth, &in->ptr)) return False; - if(!smb_io_unistr2 ("", &r_q->uni_server_name, r_q->ptr, ps, depth)) + if(!smb_io_unistr2 ("", &in->uni_server_name, in->ptr, ps, depth)) return False; - if(!lsa_io_obj_attr("", &r_q->attr, ps, depth)) + if(!lsa_io_obj_attr("", &in->attr, ps, depth)) return False; - if(!prs_uint32("des_access", ps, depth, &r_q->des_access)) + if(!prs_uint32("des_access", ps, depth, &in->des_access)) return False; return True; @@ -362,16 +361,16 @@ BOOL lsa_io_q_open_pol2(const char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, Reads or writes an LSA_R_OPEN_POL2 structure. ********************************************************************/ -BOOL lsa_io_r_open_pol2(const char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, +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("", &r_p->pol, ps, depth)) + if(!smb_io_pol_hnd("", &out->pol, ps, depth)) return False; - if(!prs_ntstatus("status", ps, depth, &r_p->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -381,13 +380,13 @@ BOOL lsa_io_r_open_pol2(const char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, makes an LSA_Q_QUERY_SEC_OBJ structure. ********************************************************************/ -void init_q_query_sec_obj(LSA_Q_QUERY_SEC_OBJ *q_q, const POLICY_HND *hnd, +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")); - q_q->pol = *hnd; - q_q->sec_info = sec_info; + in->pol = *hnd; + in->sec_info = sec_info; return; } @@ -396,16 +395,16 @@ void init_q_query_sec_obj(LSA_Q_QUERY_SEC_OBJ *q_q, const POLICY_HND *hnd, 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 *q_q, +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("", &q_q->pol, ps, depth)) + if (!smb_io_pol_hnd("", &in->pol, ps, depth)) return False; - if (!prs_uint32("sec_info", ps, depth, &q_q->sec_info)) + if (!prs_uint32("sec_info", ps, depth, &in->sec_info)) return False; return True; @@ -415,8 +414,7 @@ BOOL lsa_io_q_query_sec_obj(const char *desc, LSA_Q_QUERY_SEC_OBJ *q_q, 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 *r_u, - prs_struct *ps, int depth) +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++; @@ -424,15 +422,15 @@ BOOL lsa_io_r_query_sec_obj(const char *desc, LSA_R_QUERY_SEC_OBJ *r_u, if (!prs_align(ps)) return False; - if (!prs_uint32("ptr", ps, depth, &r_u->ptr)) + if (!prs_uint32("ptr", ps, depth, &out->ptr)) return False; - if (r_u->ptr != 0) { - if (!sec_io_desc_buf("sec", &r_u->buf, ps, depth)) + if (out->ptr != 0) { + if (!sec_io_desc_buf("sec", &out->buf, ps, depth)) return False; } - if (!prs_ntstatus("status", ps, depth, &r_u->status)) + if (!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -442,29 +440,29 @@ BOOL lsa_io_r_query_sec_obj(const char *desc, LSA_R_QUERY_SEC_OBJ *r_u, Inits an LSA_Q_QUERY_INFO structure. ********************************************************************/ -void init_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class) +void init_q_query(LSA_Q_QUERY_INFO *in, POLICY_HND *hnd, uint16 info_class) { DEBUG(5, ("init_q_query\n")); - memcpy(&q_q->pol, hnd, sizeof(q_q->pol)); + memcpy(&in->pol, hnd, sizeof(in->pol)); - q_q->info_class = info_class; + 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 *q_q, prs_struct *ps, +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("", &q_q->pol, ps, depth)) + if(!smb_io_pol_hnd("", &in->pol, ps, depth)) return False; - if(!prs_uint16("info_class", ps, depth, &q_q->info_class)) + if(!prs_uint16("info_class", ps, depth, &in->info_class)) return False; return True; @@ -510,40 +508,40 @@ BOOL lsa_io_q_enum_trust_dom(const char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, Inits an LSA_R_ENUM_TRUST_DOM structure. ********************************************************************/ -void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context, +void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *out, uint32 enum_context, uint32 req_num_domains, uint32 num_domains, TRUSTDOM **td) { unsigned int i; DEBUG(5, ("init_r_enum_trust_dom\n")); - r_e->enum_context = enum_context; - r_e->count = num_domains; + out->enum_context = enum_context; + out->count = num_domains; if ( num_domains != 0 ) { /* allocate container memory */ - r_e->domlist = TALLOC_P( ctx, DOMAIN_LIST ); - r_e->domlist->domains = TALLOC_ARRAY( ctx, DOMAIN_INFO, r_e->count ); + out->domlist = TALLOC_P( ctx, DOMAIN_LIST ); + out->domlist->domains = TALLOC_ARRAY( ctx, DOMAIN_INFO, out->count ); - if ( !r_e->domlist || !r_e->domlist->domains ) { - r_e->status = NT_STATUS_NO_MEMORY; + if ( !out->domlist || !out->domlist->domains ) { + out->status = NT_STATUS_NO_MEMORY; return; } - r_e->domlist->count = r_e->count; + out->domlist->count = out->count; /* initialize the list of domains and their sid */ for (i = 0; i < num_domains; i++) { - if ( !(r_e->domlist->domains[i].sid = TALLOC_P(ctx, DOM_SID2)) ) { - r_e->status = NT_STATUS_NO_MEMORY; + if ( !(out->domlist->domains[i].sid = TALLOC_P(ctx, DOM_SID2)) ) { + out->status = NT_STATUS_NO_MEMORY; return; } - init_dom_sid2(r_e->domlist->domains[i].sid, &(td[i])->sid); - init_unistr4_w(ctx, &r_e->domlist->domains[i].name, (td[i])->name); + init_dom_sid2(out->domlist->domains[i].sid, &(td[i])->sid); + init_unistr4_w(ctx, &out->domlist->domains[i].name, (td[i])->name); } } @@ -595,22 +593,22 @@ BOOL lsa_io_domain_list( const char *desc, prs_struct *ps, int depth, DOMAIN_LIS 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 *r_e, +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, &r_e->enum_context)) + if(!prs_uint32("enum_context", ps, depth, &out->enum_context)) return False; - if(!prs_uint32("count", ps, depth, &r_e->count)) + if(!prs_uint32("count", ps, depth, &out->count)) return False; - if ( !prs_pointer("trusted_domains", ps, depth, (void**)&r_e->domlist, sizeof(DOMAIN_LIST), (PRS_POINTER_CAST)lsa_io_domain_list)) + 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, &r_e->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -738,37 +736,36 @@ static BOOL lsa_io_dom_query_6(const char *desc, DOM_QUERY_6 *d_q, prs_struct *p Reads or writes an LSA_R_QUERY_INFO structure. ********************************************************************/ -BOOL lsa_io_r_query(const char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, - int depth) +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_uint32("undoc_buffer", ps, depth, &r_q->undoc_buffer)) + if(!prs_uint32("undoc_buffer", ps, depth, &out->undoc_buffer)) return False; - if (r_q->undoc_buffer != 0) { - if(!prs_uint16("info_class", ps, depth, &r_q->info_class)) + if (out->undoc_buffer != 0) { + if(!prs_uint16("info_class", ps, depth, &out->info_class)) return False; if(!prs_align(ps)) return False; - switch (r_q->info_class) { + switch (out->info_class) { case 2: - if(!lsa_io_dom_query_2("", &r_q->dom.id2, ps, depth)) + if(!lsa_io_dom_query_2("", &out->dom.id2, ps, depth)) return False; break; case 3: - if(!lsa_io_dom_query_3("", &r_q->dom.id3, ps, depth)) + if(!lsa_io_dom_query_3("", &out->dom.id3, ps, depth)) return False; break; case 5: - if(!lsa_io_dom_query_5("", &r_q->dom.id5, ps, depth)) + if(!lsa_io_dom_query_5("", &out->dom.id5, ps, depth)) return False; break; case 6: - if(!lsa_io_dom_query_6("", &r_q->dom.id6, ps, depth)) + if(!lsa_io_dom_query_6("", &out->dom.id6, ps, depth)) return False; break; default: @@ -780,7 +777,7 @@ BOOL lsa_io_r_query(const char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_q->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -1132,8 +1129,7 @@ BOOL lsa_io_q_lookup_names(const char *desc, LSA_Q_LOOKUP_NAMES *q_r, reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *r_r, - prs_struct *ps, int depth) +BOOL lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *out, prs_struct *ps, int depth) { unsigned int i; @@ -1143,44 +1139,44 @@ BOOL lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *r_r, if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_dom_ref", ps, depth, &r_r->ptr_dom_ref)) + if(!prs_uint32("ptr_dom_ref", ps, depth, &out->ptr_dom_ref)) return False; - if (r_r->ptr_dom_ref != 0) - if(!lsa_io_dom_r_ref("", r_r->dom_ref, ps, depth)) + 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, &r_r->num_entries)) + if(!prs_uint32("num_entries", ps, depth, &out->num_entries)) return False; - if(!prs_uint32("ptr_entries", ps, depth, &r_r->ptr_entries)) + if(!prs_uint32("ptr_entries", ps, depth, &out->ptr_entries)) return False; - if (r_r->ptr_entries != 0) { - if(!prs_uint32("num_entries2", ps, depth, &r_r->num_entries2)) + if (out->ptr_entries != 0) { + if(!prs_uint32("num_entries2", ps, depth, &out->num_entries2)) return False; - if (r_r->num_entries2 != r_r->num_entries) { + if (out->num_entries2 != out->num_entries) { /* RPC fault */ return False; } if (UNMARSHALLING(ps)) { - if ((r_r->dom_rid = PRS_ALLOC_MEM(ps, DOM_RID2, r_r->num_entries2)) + if ((out->dom_rid = PRS_ALLOC_MEM(ps, DOM_RID2, out->num_entries2)) == NULL) { DEBUG(3, ("lsa_io_r_lookup_names(): out of memory\n")); return False; } } - for (i = 0; i < r_r->num_entries2; i++) - if(!smb_io_dom_rid2("", &r_r->dom_rid[i], ps, depth)) /* domain RIDs being looked up */ + 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, &r_r->mapped_count)) + if(!prs_uint32("mapped_count", ps, depth, &out->mapped_count)) return False; - if(!prs_ntstatus("status ", ps, depth, &r_r->status)) + if(!prs_ntstatus("status ", ps, depth, &out->status)) return False; return True; @@ -1191,23 +1187,23 @@ BOOL lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *r_r, Inits an LSA_Q_CLOSE structure. ********************************************************************/ -void init_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd) +void init_lsa_q_close(LSA_Q_CLOSE *in, POLICY_HND *hnd) { DEBUG(5, ("init_lsa_q_close\n")); - memcpy(&q_c->pol, hnd, sizeof(q_c->pol)); + memcpy(&in->pol, hnd, sizeof(in->pol)); } /******************************************************************* Reads or writes an LSA_Q_CLOSE structure. ********************************************************************/ -BOOL lsa_io_q_close(const char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth) +BOOL lsa_io_q_close(const char *desc, LSA_Q_CLOSE *in, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_close"); depth++; - if(!smb_io_pol_hnd("", &q_c->pol, ps, depth)) + if(!smb_io_pol_hnd("", &in->pol, ps, depth)) return False; return True; @@ -1217,15 +1213,15 @@ BOOL lsa_io_q_close(const char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int dept Reads or writes an LSA_R_CLOSE structure. ********************************************************************/ -BOOL lsa_io_r_close(const char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth) +BOOL lsa_io_r_close(const char *desc, LSA_R_CLOSE *out, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_close"); depth++; - if(!smb_io_pol_hnd("", &r_c->pol, ps, depth)) + if(!smb_io_pol_hnd("", &out->pol, ps, depth)) return False; - if(!prs_ntstatus("status", ps, depth, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -1235,12 +1231,25 @@ BOOL lsa_io_r_close(const char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int dep Reads or writes an LSA_Q_OPEN_SECRET structure. ********************************************************************/ -BOOL lsa_io_q_open_secret(const char *desc, LSA_Q_OPEN_SECRET *q_c, prs_struct *ps, int depth) +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++; - /* Don't bother to read or write at present... */ + 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; } @@ -1248,7 +1257,7 @@ BOOL lsa_io_q_open_secret(const char *desc, LSA_Q_OPEN_SECRET *q_c, prs_struct * Reads or writes an LSA_R_OPEN_SECRET structure. ********************************************************************/ -BOOL lsa_io_r_open_secret(const char *desc, LSA_R_OPEN_SECRET *r_c, prs_struct *ps, int depth) +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++; @@ -1256,15 +1265,10 @@ BOOL lsa_io_r_open_secret(const char *desc, LSA_R_OPEN_SECRET *r_c, prs_struct * if(!prs_align(ps)) return False; - if(!prs_uint32("dummy1", ps, depth, &r_c->dummy1)) - return False; - if(!prs_uint32("dummy2", ps, depth, &r_c->dummy2)) + if(!smb_io_pol_hnd("", &out->handle, ps, depth)) return False; - if(!prs_uint32("dummy3", ps, depth, &r_c->dummy3)) - return False; - if(!prs_uint32("dummy4", ps, depth, &r_c->dummy4)) - return False; - if(!prs_ntstatus("status", ps, depth, &r_c->status)) + + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -1274,33 +1278,33 @@ BOOL lsa_io_r_open_secret(const char *desc, LSA_R_OPEN_SECRET *r_c, prs_struct * Inits an LSA_Q_ENUM_PRIVS structure. ********************************************************************/ -void init_q_enum_privs(LSA_Q_ENUM_PRIVS *q_q, POLICY_HND *hnd, uint32 enum_context, uint32 pref_max_length) +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(&q_q->pol, hnd, sizeof(q_q->pol)); + memcpy(&in->pol, hnd, sizeof(in->pol)); - q_q->enum_context = enum_context; - q_q->pref_max_length = pref_max_length; + 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 *q_q, prs_struct *ps, int depth) +BOOL lsa_io_q_enum_privs(const char *desc, LSA_Q_ENUM_PRIVS *in, prs_struct *ps, int depth) { - if (q_q == NULL) + if (in == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_q_enum_privs"); depth++; - if (!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + if (!smb_io_pol_hnd("", &in->pol, ps, depth)) return False; - if(!prs_uint32("enum_context ", ps, depth, &q_q->enum_context)) + if(!prs_uint32("enum_context ", ps, depth, &in->enum_context)) return False; - if(!prs_uint32("pref_max_length", ps, depth, &q_q->pref_max_length)) + if(!prs_uint32("pref_max_length", ps, depth, &in->pref_max_length)) return False; return True; @@ -1342,31 +1346,31 @@ static BOOL lsa_io_priv_entries(const char *desc, LSA_PRIV_ENTRY *entries, uint3 Inits an LSA_R_ENUM_PRIVS structure. ********************************************************************/ -void init_lsa_r_enum_privs(LSA_R_ENUM_PRIVS *r_u, uint32 enum_context, +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")); - r_u->enum_context=enum_context; - r_u->count=count; + out->enum_context=enum_context; + out->count=count; if (entries!=NULL) { - r_u->ptr=1; - r_u->count1=count; - r_u->privs=entries; + out->ptr=1; + out->count1=count; + out->privs=entries; } else { - r_u->ptr=0; - r_u->count1=0; - r_u->privs=NULL; + 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 *r_q, prs_struct *ps, int depth) +BOOL lsa_io_r_enum_privs(const char *desc, LSA_R_ENUM_PRIVS *out, prs_struct *ps, int depth) { - if (r_q == NULL) + if (out == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_r_enum_privs"); @@ -1375,29 +1379,29 @@ BOOL lsa_io_r_enum_privs(const char *desc, LSA_R_ENUM_PRIVS *r_q, prs_struct *ps if(!prs_align(ps)) return False; - if(!prs_uint32("enum_context", ps, depth, &r_q->enum_context)) + if(!prs_uint32("enum_context", ps, depth, &out->enum_context)) return False; - if(!prs_uint32("count", ps, depth, &r_q->count)) + if(!prs_uint32("count", ps, depth, &out->count)) return False; - if(!prs_uint32("ptr", ps, depth, &r_q->ptr)) + if(!prs_uint32("ptr", ps, depth, &out->ptr)) return False; - if (r_q->ptr) { - if(!prs_uint32("count1", ps, depth, &r_q->count1)) + if (out->ptr) { + if(!prs_uint32("count1", ps, depth, &out->count1)) return False; if (UNMARSHALLING(ps)) - if (!(r_q->privs = PRS_ALLOC_MEM(ps, LSA_PRIV_ENTRY, r_q->count1))) + if (!(out->privs = PRS_ALLOC_MEM(ps, LSA_PRIV_ENTRY, out->count1))) return False; - if (!lsa_io_priv_entries("", r_q->privs, r_q->count1, ps, depth)) + 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, &r_q->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -1416,9 +1420,9 @@ void init_lsa_priv_get_dispname(LSA_Q_PRIV_GET_DISPNAME *trn, POLICY_HND *hnd, c /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_q_priv_get_dispname(const char *desc, LSA_Q_PRIV_GET_DISPNAME *q_q, prs_struct *ps, int depth) +BOOL lsa_io_q_priv_get_dispname(const char *desc, LSA_Q_PRIV_GET_DISPNAME *in, prs_struct *ps, int depth) { - if (q_q == NULL) + if (in == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_q_priv_get_dispname"); @@ -1427,18 +1431,18 @@ BOOL lsa_io_q_priv_get_dispname(const char *desc, LSA_Q_PRIV_GET_DISPNAME *q_q, if(!prs_align(ps)) return False; - if (!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + if (!smb_io_pol_hnd("", &in->pol, ps, depth)) return False; - if (!smb_io_unihdr("hdr_name", &q_q->hdr_name, ps, depth)) + if (!smb_io_unihdr("hdr_name", &in->hdr_name, ps, depth)) return False; - if (!smb_io_unistr2("name", &q_q->name, q_q->hdr_name.buffer, ps, depth)) + if (!smb_io_unistr2("name", &in->name, in->hdr_name.buffer, ps, depth)) return False; - if(!prs_uint16("lang_id ", ps, depth, &q_q->lang_id)) + if(!prs_uint16("lang_id ", ps, depth, &in->lang_id)) return False; - if(!prs_uint16("lang_id_sys", ps, depth, &q_q->lang_id_sys)) + if(!prs_uint16("lang_id_sys", ps, depth, &in->lang_id_sys)) return False; return True; @@ -1447,9 +1451,9 @@ BOOL lsa_io_q_priv_get_dispname(const char *desc, LSA_Q_PRIV_GET_DISPNAME *q_q, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_priv_get_dispname(const char *desc, LSA_R_PRIV_GET_DISPNAME *r_q, prs_struct *ps, int depth) +BOOL lsa_io_r_priv_get_dispname(const char *desc, LSA_R_PRIV_GET_DISPNAME *out, prs_struct *ps, int depth) { - if (r_q == NULL) + if (out == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_r_priv_get_dispname"); @@ -1458,26 +1462,26 @@ BOOL lsa_io_r_priv_get_dispname(const char *desc, LSA_R_PRIV_GET_DISPNAME *r_q, if (!prs_align(ps)) return False; - if (!prs_uint32("ptr_info", ps, depth, &r_q->ptr_info)) + if (!prs_uint32("ptr_info", ps, depth, &out->ptr_info)) return False; - if (r_q->ptr_info){ - if (!smb_io_unihdr("hdr_name", &r_q->hdr_desc, ps, depth)) + if (out->ptr_info){ + if (!smb_io_unihdr("hdr_name", &out->hdr_desc, ps, depth)) return False; - if (!smb_io_unistr2("desc", &r_q->desc, r_q->hdr_desc.buffer, ps, depth)) + 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, &r_q->lang_id)) + if(!prs_uint16("lang_id", ps, depth, &out->lang_id)) return False; if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_q->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -1497,20 +1501,20 @@ void init_lsa_q_enum_accounts(LSA_Q_ENUM_ACCOUNTS *trn, POLICY_HND *hnd, uint32 /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_q_enum_accounts(const char *desc, LSA_Q_ENUM_ACCOUNTS *q_q, prs_struct *ps, int depth) +BOOL lsa_io_q_enum_accounts(const char *desc, LSA_Q_ENUM_ACCOUNTS *in, prs_struct *ps, int depth) { - if (q_q == NULL) + if (in == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_q_enum_accounts"); depth++; - if (!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + if (!smb_io_pol_hnd("", &in->pol, ps, depth)) return False; - if(!prs_uint32("enum_context ", ps, depth, &q_q->enum_context)) + if(!prs_uint32("enum_context ", ps, depth, &in->enum_context)) return False; - if(!prs_uint32("pref_max_length", ps, depth, &q_q->pref_max_length)) + if(!prs_uint32("pref_max_length", ps, depth, &in->pref_max_length)) return False; return True; @@ -1521,28 +1525,28 @@ BOOL lsa_io_q_enum_accounts(const char *desc, LSA_Q_ENUM_ACCOUNTS *q_q, prs_stru Inits an LSA_R_ENUM_PRIVS structure. ********************************************************************/ -void init_lsa_r_enum_accounts(LSA_R_ENUM_ACCOUNTS *r_u, uint32 enum_context) +void init_lsa_r_enum_accounts(LSA_R_ENUM_ACCOUNTS *out, uint32 enum_context) { DEBUG(5, ("init_lsa_r_enum_accounts\n")); - r_u->enum_context=enum_context; - if (r_u->enum_context!=0) { - r_u->sids.num_entries=enum_context; - r_u->sids.ptr_sid_enum=1; - r_u->sids.num_entries2=enum_context; + 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 { - r_u->sids.num_entries=0; - r_u->sids.ptr_sid_enum=0; - r_u->sids.num_entries2=0; + 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 *r_q, prs_struct *ps, int depth) +BOOL lsa_io_r_enum_accounts(const char *desc, LSA_R_ENUM_ACCOUNTS *out, prs_struct *ps, int depth) { - if (r_q == NULL) + if (out == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_r_enum_accounts"); @@ -1551,16 +1555,16 @@ BOOL lsa_io_r_enum_accounts(const char *desc, LSA_R_ENUM_ACCOUNTS *r_q, prs_stru if (!prs_align(ps)) return False; - if(!prs_uint32("enum_context", ps, depth, &r_q->enum_context)) + if(!prs_uint32("enum_context", ps, depth, &out->enum_context)) return False; - if (!lsa_io_sid_enum("sids", &r_q->sids, ps, depth)) + if (!lsa_io_sid_enum("sids", &out->sids, ps, depth)) return False; if (!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_q->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -1571,7 +1575,7 @@ BOOL lsa_io_r_enum_accounts(const char *desc, LSA_R_ENUM_ACCOUNTS *r_q, prs_stru 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 *q_c, prs_struct *ps, int depth) +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++; @@ -1579,20 +1583,20 @@ BOOL lsa_io_q_unk_get_connuser(const char *desc, LSA_Q_UNK_GET_CONNUSER *q_c, pr if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_srvname", ps, depth, &q_c->ptr_srvname)) + if(!prs_uint32("ptr_srvname", ps, depth, &in->ptr_srvname)) return False; - if(!smb_io_unistr2("uni2_srvname", &q_c->uni2_srvname, q_c->ptr_srvname, ps, depth)) /* server name to be looked up */ + 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, &q_c->unk1)) + if(!prs_uint32("unk1", ps, depth, &in->unk1)) return False; - if(!prs_uint32("unk2", ps, depth, &q_c->unk2)) + if(!prs_uint32("unk2", ps, depth, &in->unk2)) return False; - if(!prs_uint32("unk3", ps, depth, &q_c->unk3)) + if(!prs_uint32("unk3", ps, depth, &in->unk3)) return False; /* Don't bother to read or write at present... */ @@ -1603,7 +1607,7 @@ BOOL lsa_io_q_unk_get_connuser(const char *desc, LSA_Q_UNK_GET_CONNUSER *q_c, pr 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 *r_c, prs_struct *ps, int depth) +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++; @@ -1611,30 +1615,30 @@ BOOL lsa_io_r_unk_get_connuser(const char *desc, LSA_R_UNK_GET_CONNUSER *r_c, pr if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_user_name", ps, depth, &r_c->ptr_user_name)) + if(!prs_uint32("ptr_user_name", ps, depth, &out->ptr_user_name)) return False; - if(!smb_io_unihdr("hdr_user_name", &r_c->hdr_user_name, ps, depth)) + if(!smb_io_unihdr("hdr_user_name", &out->hdr_user_name, ps, depth)) return False; - if(!smb_io_unistr2("uni2_user_name", &r_c->uni2_user_name, r_c->ptr_user_name, ps, depth)) + 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, &r_c->unk1)) + if(!prs_uint32("unk1", ps, depth, &out->unk1)) return False; - if(!prs_uint32("ptr_dom_name", ps, depth, &r_c->ptr_dom_name)) + if(!prs_uint32("ptr_dom_name", ps, depth, &out->ptr_dom_name)) return False; - if(!smb_io_unihdr("hdr_dom_name", &r_c->hdr_dom_name, ps, depth)) + if(!smb_io_unihdr("hdr_dom_name", &out->hdr_dom_name, ps, depth)) return False; - if(!smb_io_unistr2("uni2_dom_name", &r_c->uni2_dom_name, r_c->ptr_dom_name, ps, depth)) + 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, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -1653,7 +1657,7 @@ void init_lsa_q_create_account(LSA_Q_CREATEACCOUNT *trn, POLICY_HND *hnd, DOM_SI Reads or writes an LSA_Q_CREATEACCOUNT structure. ********************************************************************/ -BOOL lsa_io_q_create_account(const char *desc, LSA_Q_CREATEACCOUNT *r_c, prs_struct *ps, int depth) +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++; @@ -1661,13 +1665,13 @@ BOOL lsa_io_q_create_account(const char *desc, LSA_Q_CREATEACCOUNT *r_c, prs_str if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &r_c->pol, ps, depth)) + if(!smb_io_pol_hnd("pol", &out->pol, ps, depth)) return False; - if(!smb_io_dom_sid2("sid", &r_c->sid, ps, depth)) /* domain SID */ + if(!smb_io_dom_sid2("sid", &out->sid, ps, depth)) /* domain SID */ return False; - if(!prs_uint32("access", ps, depth, &r_c->access)) + if(!prs_uint32("access", ps, depth, &out->access)) return False; return True; @@ -1677,7 +1681,7 @@ BOOL lsa_io_q_create_account(const char *desc, LSA_Q_CREATEACCOUNT *r_c, prs_str Reads or writes an LSA_R_CREATEACCOUNT structure. ********************************************************************/ -BOOL lsa_io_r_create_account(const char *desc, LSA_R_CREATEACCOUNT *r_c, prs_struct *ps, int depth) +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++; @@ -1685,10 +1689,10 @@ BOOL lsa_io_r_create_account(const char *desc, LSA_R_CREATEACCOUNT *r_c, prs_st if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &r_c->pol, ps, depth)) + if(!smb_io_pol_hnd("pol", &out->pol, ps, depth)) return False; - if(!prs_ntstatus("status", ps, depth, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -1707,7 +1711,7 @@ void init_lsa_q_open_account(LSA_Q_OPENACCOUNT *trn, POLICY_HND *hnd, DOM_SID *s Reads or writes an LSA_Q_OPENACCOUNT structure. ********************************************************************/ -BOOL lsa_io_q_open_account(const char *desc, LSA_Q_OPENACCOUNT *r_c, prs_struct *ps, int depth) +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++; @@ -1715,13 +1719,13 @@ BOOL lsa_io_q_open_account(const char *desc, LSA_Q_OPENACCOUNT *r_c, prs_struct if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &r_c->pol, ps, depth)) + if(!smb_io_pol_hnd("pol", &out->pol, ps, depth)) return False; - if(!smb_io_dom_sid2("sid", &r_c->sid, ps, depth)) /* domain SID */ + if(!smb_io_dom_sid2("sid", &out->sid, ps, depth)) /* domain SID */ return False; - if(!prs_uint32("access", ps, depth, &r_c->access)) + if(!prs_uint32("access", ps, depth, &out->access)) return False; return True; @@ -1731,7 +1735,7 @@ BOOL lsa_io_q_open_account(const char *desc, LSA_Q_OPENACCOUNT *r_c, prs_struct Reads or writes an LSA_R_OPENACCOUNT structure. ********************************************************************/ -BOOL lsa_io_r_open_account(const char *desc, LSA_R_OPENACCOUNT *r_c, prs_struct *ps, int depth) +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++; @@ -1739,10 +1743,10 @@ BOOL lsa_io_r_open_account(const char *desc, LSA_R_OPENACCOUNT *r_c, prs_struct if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &r_c->pol, ps, depth)) + if(!smb_io_pol_hnd("pol", &out->pol, ps, depth)) return False; - if(!prs_ntstatus("status", ps, depth, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -1759,7 +1763,7 @@ void init_lsa_q_enum_privsaccount(LSA_Q_ENUMPRIVSACCOUNT *trn, POLICY_HND *hnd) Reads or writes an LSA_Q_ENUMPRIVSACCOUNT structure. ********************************************************************/ -BOOL lsa_io_q_enum_privsaccount(const char *desc, LSA_Q_ENUMPRIVSACCOUNT *r_c, prs_struct *ps, int depth) +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++; @@ -1767,7 +1771,7 @@ BOOL lsa_io_q_enum_privsaccount(const char *desc, LSA_Q_ENUMPRIVSACCOUNT *r_c, p if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &r_c->pol, ps, depth)) + if(!smb_io_pol_hnd("pol", &out->pol, ps, depth)) return False; return True; @@ -1777,7 +1781,7 @@ BOOL lsa_io_q_enum_privsaccount(const char *desc, LSA_Q_ENUMPRIVSACCOUNT *r_c, p Reads or writes an LUID structure. ********************************************************************/ -static BOOL lsa_io_luid(const char *desc, LUID *r_c, prs_struct *ps, int depth) +static BOOL lsa_io_luid(const char *desc, LUID *out, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_luid"); depth++; @@ -1785,10 +1789,10 @@ static BOOL lsa_io_luid(const char *desc, LUID *r_c, prs_struct *ps, int depth) if(!prs_align(ps)) return False; - if(!prs_uint32("low", ps, depth, &r_c->low)) + if(!prs_uint32("low", ps, depth, &out->low)) return False; - if(!prs_uint32("high", ps, depth, &r_c->high)) + if(!prs_uint32("high", ps, depth, &out->high)) return False; return True; @@ -1798,7 +1802,7 @@ static BOOL lsa_io_luid(const char *desc, LUID *r_c, prs_struct *ps, int depth) Reads or writes an LUID_ATTR structure. ********************************************************************/ -static BOOL lsa_io_luid_attr(const char *desc, LUID_ATTR *r_c, prs_struct *ps, int depth) +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++; @@ -1806,10 +1810,10 @@ static BOOL lsa_io_luid_attr(const char *desc, LUID_ATTR *r_c, prs_struct *ps, i if(!prs_align(ps)) return False; - if (!lsa_io_luid(desc, &r_c->luid, ps, depth)) + if (!lsa_io_luid(desc, &out->luid, ps, depth)) return False; - if(!prs_uint32("attr", ps, depth, &r_c->attr)) + if(!prs_uint32("attr", ps, depth, &out->attr)) return False; return True; @@ -1819,7 +1823,7 @@ static BOOL lsa_io_luid_attr(const char *desc, LUID_ATTR *r_c, prs_struct *ps, i Reads or writes an PRIVILEGE_SET structure. ********************************************************************/ -static BOOL lsa_io_privilege_set(const char *desc, PRIVILEGE_SET *r_c, prs_struct *ps, int depth) +static BOOL lsa_io_privilege_set(const char *desc, PRIVILEGE_SET *out, prs_struct *ps, int depth) { uint32 i; @@ -1829,35 +1833,35 @@ static BOOL lsa_io_privilege_set(const char *desc, PRIVILEGE_SET *r_c, prs_struc if(!prs_align(ps)) return False; - if(!prs_uint32("count", ps, depth, &r_c->count)) + if(!prs_uint32("count", ps, depth, &out->count)) return False; - if(!prs_uint32("control", ps, depth, &r_c->control)) + if(!prs_uint32("control", ps, depth, &out->control)) return False; - for (i=0; icount; i++) { - if (!lsa_io_luid_attr(desc, &r_c->set[i], ps, depth)) + for (i=0; icount; 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 *r_u, LUID_ATTR *set, uint32 count, uint32 control) +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; - r_u->ptr = 1; - r_u->count = count; + out->ptr = 1; + out->count = count; - if ( !NT_STATUS_IS_OK(ret = privilege_set_init_by_ctx(mem_ctx, &(r_u->set))) ) + if ( !NT_STATUS_IS_OK(ret = privilege_set_init_by_ctx(mem_ctx, &(out->set))) ) return ret; - r_u->set.count = count; + out->set.count = count; - if (!NT_STATUS_IS_OK(ret = dup_luid_attr(r_u->set.mem_ctx, &(r_u->set.set), set, 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", r_u->count)); + DEBUG(10,("init_lsa_r_enum_privsaccount: %d privileges\n", out->count)); return ret; } @@ -1866,7 +1870,7 @@ NTSTATUS init_lsa_r_enum_privsaccount(TALLOC_CTX *mem_ctx, LSA_R_ENUMPRIVSACCOUN Reads or writes an LSA_R_ENUMPRIVSACCOUNT structure. ********************************************************************/ -BOOL lsa_io_r_enum_privsaccount(const char *desc, LSA_R_ENUMPRIVSACCOUNT *r_c, prs_struct *ps, int depth) +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++; @@ -1874,29 +1878,29 @@ BOOL lsa_io_r_enum_privsaccount(const char *desc, LSA_R_ENUMPRIVSACCOUNT *r_c, p if(!prs_align(ps)) return False; - if(!prs_uint32("ptr", ps, depth, &r_c->ptr)) + if(!prs_uint32("ptr", ps, depth, &out->ptr)) return False; - if (r_c->ptr!=0) { - if(!prs_uint32("count", ps, depth, &r_c->count)) + if (out->ptr!=0) { + if(!prs_uint32("count", ps, depth, &out->count)) return False; /* malloc memory if unmarshalling here */ - if (UNMARSHALLING(ps) && r_c->count != 0) { - if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps->mem_ctx, &(r_c->set)))) + if (UNMARSHALLING(ps) && out->count != 0) { + if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps->mem_ctx, &(out->set)))) return False; - if (!(r_c->set.set = PRS_ALLOC_MEM(ps,LUID_ATTR,r_c->count))) + if (!(out->set.set = PRS_ALLOC_MEM(ps,LUID_ATTR,out->count))) return False; } - if(!lsa_io_privilege_set(desc, &r_c->set, ps, depth)) + if(!lsa_io_privilege_set(desc, &out->set, ps, depth)) return False; } - if(!prs_ntstatus("status", ps, depth, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -1908,7 +1912,7 @@ BOOL lsa_io_r_enum_privsaccount(const char *desc, LSA_R_ENUMPRIVSACCOUNT *r_c, p Reads or writes an LSA_Q_GETSYSTEMACCOUNTstructure. ********************************************************************/ -BOOL lsa_io_q_getsystemaccount(const char *desc, LSA_Q_GETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) +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++; @@ -1916,7 +1920,7 @@ BOOL lsa_io_q_getsystemaccount(const char *desc, LSA_Q_GETSYSTEMACCOUNT *r_c, p if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &r_c->pol, ps, depth)) + if(!smb_io_pol_hnd("pol", &out->pol, ps, depth)) return False; return True; @@ -1926,7 +1930,7 @@ BOOL lsa_io_q_getsystemaccount(const char *desc, LSA_Q_GETSYSTEMACCOUNT *r_c, p Reads or writes an LSA_R_GETSYSTEMACCOUNTstructure. ********************************************************************/ -BOOL lsa_io_r_getsystemaccount(const char *desc, LSA_R_GETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) +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++; @@ -1934,10 +1938,10 @@ BOOL lsa_io_r_getsystemaccount(const char *desc, LSA_R_GETSYSTEMACCOUNT *r_c, p if(!prs_align(ps)) return False; - if(!prs_uint32("access", ps, depth, &r_c->access)) + if(!prs_uint32("access", ps, depth, &out->access)) return False; - if(!prs_ntstatus("status", ps, depth, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -1948,7 +1952,7 @@ BOOL lsa_io_r_getsystemaccount(const char *desc, LSA_R_GETSYSTEMACCOUNT *r_c, p Reads or writes an LSA_Q_SETSYSTEMACCOUNT structure. ********************************************************************/ -BOOL lsa_io_q_setsystemaccount(const char *desc, LSA_Q_SETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) +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++; @@ -1956,10 +1960,10 @@ BOOL lsa_io_q_setsystemaccount(const char *desc, LSA_Q_SETSYSTEMACCOUNT *r_c, p if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &r_c->pol, ps, depth)) + if(!smb_io_pol_hnd("pol", &out->pol, ps, depth)) return False; - if(!prs_uint32("access", ps, depth, &r_c->access)) + if(!prs_uint32("access", ps, depth, &out->access)) return False; return True; @@ -1969,7 +1973,7 @@ BOOL lsa_io_q_setsystemaccount(const char *desc, LSA_Q_SETSYSTEMACCOUNT *r_c, p Reads or writes an LSA_R_SETSYSTEMACCOUNT structure. ********************************************************************/ -BOOL lsa_io_r_setsystemaccount(const char *desc, LSA_R_SETSYSTEMACCOUNT *r_c, prs_struct *ps, int depth) +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++; @@ -1977,7 +1981,7 @@ BOOL lsa_io_r_setsystemaccount(const char *desc, LSA_R_SETSYSTEMACCOUNT *r_c, p if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -2013,7 +2017,7 @@ BOOL smb_io_lsa_string( const char *desc, LSA_STRING *string, prs_struct *ps, in 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 *r_c, prs_struct *ps, int depth) +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++; @@ -2021,9 +2025,9 @@ BOOL lsa_io_q_lookup_priv_value(const char *desc, LSA_Q_LOOKUP_PRIV_VALUE *r_c, if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &r_c->pol, ps, depth)) + if(!smb_io_pol_hnd("pol", &out->pol, ps, depth)) return False; - if(!smb_io_lsa_string("privname", &r_c->privname, ps, depth)) + if(!smb_io_lsa_string("privname", &out->privname, ps, depth)) return False; return True; @@ -2033,7 +2037,7 @@ BOOL lsa_io_q_lookup_priv_value(const char *desc, LSA_Q_LOOKUP_PRIV_VALUE *r_c, 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 *r_c, prs_struct *ps, int depth) +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++; @@ -2041,10 +2045,10 @@ BOOL lsa_io_r_lookup_priv_value(const char *desc, LSA_R_LOOKUP_PRIV_VALUE *r_c, if(!prs_align(ps)) return False; - if(!lsa_io_luid("luid", &r_c->luid, ps, depth)) + if(!lsa_io_luid("luid", &out->luid, ps, depth)) return False; - if(!prs_ntstatus("status", ps, depth, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -2055,7 +2059,7 @@ BOOL lsa_io_r_lookup_priv_value(const char *desc, LSA_R_LOOKUP_PRIV_VALUE *r_c, Reads or writes an LSA_Q_ADDPRIVS structure. ********************************************************************/ -BOOL lsa_io_q_addprivs(const char *desc, LSA_Q_ADDPRIVS *r_c, prs_struct *ps, int depth) +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++; @@ -2063,21 +2067,21 @@ BOOL lsa_io_q_addprivs(const char *desc, LSA_Q_ADDPRIVS *r_c, prs_struct *ps, in if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &r_c->pol, ps, depth)) + if(!smb_io_pol_hnd("pol", &out->pol, ps, depth)) return False; - if(!prs_uint32("count", ps, depth, &r_c->count)) + if(!prs_uint32("count", ps, depth, &out->count)) return False; - if (UNMARSHALLING(ps) && r_c->count!=0) { - if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps->mem_ctx, &(r_c->set)))) + if (UNMARSHALLING(ps) && out->count!=0) { + if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps->mem_ctx, &(out->set)))) return False; - if (!(r_c->set.set = PRS_ALLOC_MEM(ps, LUID_ATTR, r_c->count))) + if (!(out->set.set = PRS_ALLOC_MEM(ps, LUID_ATTR, out->count))) return False; } - if(!lsa_io_privilege_set(desc, &r_c->set, ps, depth)) + if(!lsa_io_privilege_set(desc, &out->set, ps, depth)) return False; return True; @@ -2087,7 +2091,7 @@ BOOL lsa_io_q_addprivs(const char *desc, LSA_Q_ADDPRIVS *r_c, prs_struct *ps, in Reads or writes an LSA_R_ADDPRIVS structure. ********************************************************************/ -BOOL lsa_io_r_addprivs(const char *desc, LSA_R_ADDPRIVS *r_c, prs_struct *ps, int depth) +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++; @@ -2095,7 +2099,7 @@ BOOL lsa_io_r_addprivs(const char *desc, LSA_R_ADDPRIVS *r_c, prs_struct *ps, in if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -2105,7 +2109,7 @@ BOOL lsa_io_r_addprivs(const char *desc, LSA_R_ADDPRIVS *r_c, prs_struct *ps, in Reads or writes an LSA_Q_REMOVEPRIVS structure. ********************************************************************/ -BOOL lsa_io_q_removeprivs(const char *desc, LSA_Q_REMOVEPRIVS *r_c, prs_struct *ps, int depth) +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++; @@ -2113,13 +2117,13 @@ BOOL lsa_io_q_removeprivs(const char *desc, LSA_Q_REMOVEPRIVS *r_c, prs_struct * if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &r_c->pol, ps, depth)) + if(!smb_io_pol_hnd("pol", &out->pol, ps, depth)) return False; - if(!prs_uint32("allrights", ps, depth, &r_c->allrights)) + if(!prs_uint32("allrights", ps, depth, &out->allrights)) return False; - if(!prs_uint32("ptr", ps, depth, &r_c->ptr)) + if(!prs_uint32("ptr", ps, depth, &out->ptr)) return False; /* @@ -2127,19 +2131,19 @@ BOOL lsa_io_q_removeprivs(const char *desc, LSA_Q_REMOVEPRIVS *r_c, prs_struct * * never seen one with ptr=0 */ - if (r_c->ptr!=0) { - if(!prs_uint32("count", ps, depth, &r_c->count)) + if (out->ptr!=0) { + if(!prs_uint32("count", ps, depth, &out->count)) return False; - if (UNMARSHALLING(ps) && r_c->count!=0) { - if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps->mem_ctx, &(r_c->set)))) + if (UNMARSHALLING(ps) && out->count!=0) { + if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps->mem_ctx, &(out->set)))) return False; - if (!(r_c->set.set = PRS_ALLOC_MEM(ps, LUID_ATTR, r_c->count))) + if (!(out->set.set = PRS_ALLOC_MEM(ps, LUID_ATTR, out->count))) return False; } - if(!lsa_io_privilege_set(desc, &r_c->set, ps, depth)) + if(!lsa_io_privilege_set(desc, &out->set, ps, depth)) return False; } @@ -2150,7 +2154,7 @@ BOOL lsa_io_q_removeprivs(const char *desc, LSA_Q_REMOVEPRIVS *r_c, prs_struct * Reads or writes an LSA_R_REMOVEPRIVS structure. ********************************************************************/ -BOOL lsa_io_r_removeprivs(const char *desc, LSA_R_REMOVEPRIVS *r_c, prs_struct *ps, int depth) +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++; @@ -2158,7 +2162,7 @@ BOOL lsa_io_r_removeprivs(const char *desc, LSA_R_REMOVEPRIVS *r_c, prs_struct * if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -2222,21 +2226,20 @@ BOOL lsa_io_dns_dom_info(const char *desc, LSA_DNS_DOM_INFO *info, Inits an LSA_Q_QUERY_INFO2 structure. ********************************************************************/ -void init_q_query2(LSA_Q_QUERY_INFO2 *q_q, POLICY_HND *hnd, uint16 info_class) +void init_q_query2(LSA_Q_QUERY_INFO2 *in, POLICY_HND *hnd, uint16 info_class) { DEBUG(5, ("init_q_query2\n")); - memcpy(&q_q->pol, hnd, sizeof(q_q->pol)); + memcpy(&in->pol, hnd, sizeof(in->pol)); - q_q->info_class = info_class; + 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 *q_c, - prs_struct *ps, int depth) +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++; @@ -2244,10 +2247,10 @@ BOOL lsa_io_q_query_info2(const char *desc, LSA_Q_QUERY_INFO2 *q_c, if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("pol", &q_c->pol, ps, depth)) + if(!smb_io_pol_hnd("pol", &in->pol, ps, depth)) return False; - if(!prs_uint16("info_class", ps, depth, &q_c->info_class)) + if(!prs_uint16("info_class", ps, depth, &in->info_class)) return False; return True; @@ -2257,7 +2260,7 @@ BOOL lsa_io_q_query_info2(const char *desc, LSA_Q_QUERY_INFO2 *q_c, Reads or writes an LSA_R_QUERY_DNSDOMINFO structure. ********************************************************************/ -BOOL lsa_io_r_query_info2(const char *desc, LSA_R_QUERY_INFO2 *r_c, +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"); @@ -2266,25 +2269,25 @@ BOOL lsa_io_r_query_info2(const char *desc, LSA_R_QUERY_INFO2 *r_c, if(!prs_align(ps)) return False; - if(!prs_uint32("ptr", ps, depth, &r_c->ptr)) + if(!prs_uint32("ptr", ps, depth, &out->ptr)) return False; - if(!prs_uint16("info_class", ps, depth, &r_c->info_class)) + if(!prs_uint16("info_class", ps, depth, &out->info_class)) return False; - switch(r_c->info_class) { + switch(out->info_class) { case 0x000c: - if (!lsa_io_dns_dom_info("info12", &r_c->info.dns_dom_info, + if (!lsa_io_dns_dom_info("info12", &out->info.dns_dom_info, ps, depth)) return False; break; default: DEBUG(0,("lsa_io_r_query_info2: unknown info class %d\n", - r_c->info_class)); + out->info_class)); return False; } if(!prs_align(ps)) return False; - if(!prs_ntstatus("status", ps, depth, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -2293,20 +2296,20 @@ BOOL lsa_io_r_query_info2(const char *desc, LSA_R_QUERY_INFO2 *r_c, /******************************************************************* Inits an LSA_Q_ENUM_ACCT_RIGHTS structure. ********************************************************************/ -void init_q_enum_acct_rights(LSA_Q_ENUM_ACCT_RIGHTS *q_q, +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")); - q_q->pol = *hnd; - init_dom_sid2(&q_q->sid, sid); + in->pol = *hnd; + init_dom_sid2(&in->sid, sid); } /******************************************************************* ********************************************************************/ -NTSTATUS init_r_enum_acct_rights( LSA_R_ENUM_ACCT_RIGHTS *r_u, PRIVILEGE_SET *privileges ) +NTSTATUS init_r_enum_acct_rights( LSA_R_ENUM_ACCT_RIGHTS *out, PRIVILEGE_SET *privileges ) { uint32 i; char *privname; @@ -2322,12 +2325,12 @@ NTSTATUS init_r_enum_acct_rights( LSA_R_ENUM_ACCT_RIGHTS *r_u, PRIVILEGE_SET *pr } if ( num_priv ) { - r_u->rights = TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY ); + out->rights = TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY ); - if ( !init_unistr4_array( r_u->rights, num_priv, privname_array ) ) + if ( !init_unistr4_array( out->rights, num_priv, privname_array ) ) return NT_STATUS_NO_MEMORY; - r_u->count = num_priv; + out->count = num_priv; } return NT_STATUS_OK; @@ -2336,19 +2339,19 @@ NTSTATUS init_r_enum_acct_rights( LSA_R_ENUM_ACCT_RIGHTS *r_u, PRIVILEGE_SET *pr /******************************************************************* 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 *q_q, prs_struct *ps, int depth) +BOOL lsa_io_q_enum_acct_rights(const char *desc, LSA_Q_ENUM_ACCT_RIGHTS *in, prs_struct *ps, int depth) { - if (q_q == NULL) + if (in == NULL) return False; prs_debug(ps, depth, desc, "lsa_io_q_enum_acct_rights"); depth++; - if (!smb_io_pol_hnd("", &q_q->pol, ps, depth)) + if (!smb_io_pol_hnd("", &in->pol, ps, depth)) return False; - if(!smb_io_dom_sid2("sid", &q_q->sid, ps, depth)) + if(!smb_io_dom_sid2("sid", &in->sid, ps, depth)) return False; return True; @@ -2358,21 +2361,21 @@ BOOL lsa_io_q_enum_acct_rights(const char *desc, LSA_Q_ENUM_ACCT_RIGHTS *q_q, pr /******************************************************************* 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 *r_c, prs_struct *ps, int depth) +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, &r_c->count)) + if(!prs_uint32("count ", ps, depth, &out->count)) return False; - if ( !prs_pointer("rights", ps, depth, (void**)&r_c->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) + 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, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -2382,39 +2385,39 @@ BOOL lsa_io_r_enum_acct_rights(const char *desc, LSA_R_ENUM_ACCT_RIGHTS *r_c, pr /******************************************************************* Inits an LSA_Q_ADD_ACCT_RIGHTS structure. ********************************************************************/ -void init_q_add_acct_rights( LSA_Q_ADD_ACCT_RIGHTS *q_q, POLICY_HND *hnd, +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")); - q_q->pol = *hnd; - init_dom_sid2(&q_q->sid, sid); + in->pol = *hnd; + init_dom_sid2(&in->sid, sid); - q_q->rights = TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY ); - init_unistr4_array( q_q->rights, count, rights ); + in->rights = TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY ); + init_unistr4_array( in->rights, count, rights ); - q_q->count = count; + 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 *q_q, prs_struct *ps, int depth) +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("", &q_q->pol, ps, depth)) + if (!smb_io_pol_hnd("", &in->pol, ps, depth)) return False; - if(!smb_io_dom_sid2("sid", &q_q->sid, ps, depth)) + if(!smb_io_dom_sid2("sid", &in->sid, ps, depth)) return False; - if(!prs_uint32("count", ps, depth, &q_q->count)) + if(!prs_uint32("count", ps, depth, &in->count)) return False; - if ( !prs_pointer("rights", ps, depth, (void**)&q_q->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) + if ( !prs_pointer("rights", ps, depth, (void**)&in->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) return False; return True; @@ -2423,12 +2426,12 @@ BOOL lsa_io_q_add_acct_rights(const char *desc, LSA_Q_ADD_ACCT_RIGHTS *q_q, prs_ /******************************************************************* 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 *r_c, prs_struct *ps, int depth) +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, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) return False; return True; @@ -2438,7 +2441,7 @@ BOOL lsa_io_r_add_acct_rights(const char *desc, LSA_R_ADD_ACCT_RIGHTS *r_c, prs_ /******************************************************************* Inits an LSA_Q_REMOVE_ACCT_RIGHTS structure. ********************************************************************/ -void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *q_q, +void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *in, POLICY_HND *hnd, DOM_SID *sid, uint32 removeall, @@ -2447,39 +2450,39 @@ void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *q_q, { DEBUG(5, ("init_q_remove_acct_rights\n")); - q_q->pol = *hnd; + in->pol = *hnd; - init_dom_sid2(&q_q->sid, sid); + init_dom_sid2(&in->sid, sid); - q_q->removeall = removeall; - q_q->count = count; + in->removeall = removeall; + in->count = count; - q_q->rights = TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY ); - init_unistr4_array( q_q->rights, count, rights ); + in->rights = TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY ); + 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 *q_q, prs_struct *ps, int depth) +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("", &q_q->pol, ps, depth)) + if (!smb_io_pol_hnd("", &in->pol, ps, depth)) return False; - if(!smb_io_dom_sid2("sid", &q_q->sid, ps, depth)) + if(!smb_io_dom_sid2("sid", &in->sid, ps, depth)) return False; - if(!prs_uint32("removeall", ps, depth, &q_q->removeall)) + if(!prs_uint32("removeall", ps, depth, &in->removeall)) return False; - if(!prs_uint32("count", ps, depth, &q_q->count)) + if(!prs_uint32("count", ps, depth, &in->count)) return False; - if ( !prs_pointer("rights", ps, depth, (void**)&q_q->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) + if ( !prs_pointer("rights", ps, depth, (void**)&in->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) return False; return True; @@ -2488,12 +2491,237 @@ BOOL lsa_io_q_remove_acct_rights(const char *desc, LSA_Q_REMOVE_ACCT_RIGHTS *q_q /******************************************************************* 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 *r_c, prs_struct *ps, int depth) +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, &r_c->status)) + if(!prs_ntstatus("status", ps, depth, &out->status)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +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; +} + +/******************************************************************* +********************************************************************/ + +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("", &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; -- cgit From 04e07e8cc9d6615381e0501cd36cf7d78aeed189 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 8 Jun 2005 03:48:40 +0000 Subject: r7385: Rewrite the RPC bind parsing functions to follow the spec. I haven't yet tested this so I may have screwed this up - however it now follows the DCE spec. valgrinded tests to follow.... Jeremy. (This used to be commit 877e0a61f5821c89149b1403d08675dd7db8039e) --- source3/rpc_parse/parse_rpc.c | 101 +++++++++++++++++++++++++++++------------- 1 file changed, 71 insertions(+), 30 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 6bdab2e437..ef5c230d2d 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -376,27 +376,75 @@ static BOOL smb_io_rpc_hdr_bba(const char *desc, RPC_HDR_BBA *rpc, prs_struct * return True; } +/******************************************************************* + Inits an RPC_CONTEXT structure. + Note the transfer pointer must remain valid until this is marshalled. +********************************************************************/ + +void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id, RPC_IFACE *abstract, RPC_IFACE *transfer) +{ + rpc_ctx->context_id = context_id ; /* presentation context identifier (0x0) */ + rpc_ctx->num_transfer_syntaxes = 1 ; /* the number of syntaxes (has always been 1?)(0x1) */ + + /* num and vers. of interface client is using */ + rpc_ctx->abstract = *abstract; + + /* vers. of interface to use for replies */ + rpc_ctx->transfer = transfer; +} + /******************************************************************* Inits an RPC_HDR_RB structure. + Note the context pointer must remain valid until this is marshalled. ********************************************************************/ void init_rpc_hdr_rb(RPC_HDR_RB *rpc, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, - uint32 num_elements, uint16 context_id, uint8 num_syntaxes, - RPC_IFACE *abstract, RPC_IFACE *transfer) + RPC_CONTEXT *context) { init_rpc_hdr_bba(&rpc->bba, max_tsize, max_rsize, assoc_gid); - rpc->num_elements = num_elements ; /* the number of elements (0x1) */ - rpc->context_id = context_id ; /* presentation context identifier (0x0) */ - rpc->num_syntaxes = num_syntaxes ; /* the number of syntaxes (has always been 1?)(0x1) */ + rpc->num_contexts = 1; + rpc->rpc_context = context; +} - /* num and vers. of interface client is using */ - rpc->abstract = *abstract; +/******************************************************************* + Reads or writes an RPC_CONTEXT structure. +********************************************************************/ - /* num and vers. of interface to use for replies */ - rpc->transfer = *transfer; -} +BOOL smb_io_rpc_context(const char *desc, RPC_CONTEXT *rpc_ctx, prs_struct *ps, int depth) +{ + int i; + + if (rpc_ctx == NULL) + return False; + + if(!prs_align(ps)) + return False; + if(!prs_uint16("context_id ", ps, depth, &rpc_ctx->context_id )) + return False; + if(!prs_uint8 ("num_transfer_syntaxes", ps, depth, &rpc_ctx->num_transfer_syntaxes)) + return False; + + /* num_transfer_syntaxes must not be zero. */ + if (rpc_ctx->num_transfer_syntaxes == 0) + return False; + + if(!smb_io_rpc_iface("", &rpc_ctx->abstract, ps, depth)) + return False; + + if (UNMARSHALLING(ps)) { + if (!(rpc_ctx->transfer = PRS_ALLOC_MEM(ps, RPC_IFACE, rpc_ctx->num_transfer_syntaxes))) { + return False; + } + } + + for (i = 0; i < rpc_ctx->num_transfer_syntaxes; i++ ) { + if (!smb_io_rpc_iface("", &rpc_ctx->transfer[i], ps, depth)) + return False; + } + return True; +} /******************************************************************* Reads or writes an RPC_HDR_RB structure. @@ -404,7 +452,6 @@ void init_rpc_hdr_rb(RPC_HDR_RB *rpc, BOOL smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) { - RPC_HDR_RB rpc2; int i; if (rpc == NULL) @@ -416,31 +463,25 @@ BOOL smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int de if(!smb_io_rpc_hdr_bba("", &rpc->bba, ps, depth)) return False; - if(!prs_uint32("num_elements", ps, depth, &rpc->num_elements)) - return False; - if(!prs_uint16("context_id ", ps, depth, &rpc->context_id )) - return False; - if(!prs_uint8 ("num_syntaxes", ps, depth, &rpc->num_syntaxes)) + if(!prs_uint32("num_contexts", ps, depth, &rpc->num_contexts)) return False; - if(!smb_io_rpc_iface("", &rpc->abstract, ps, depth)) - return False; - if(!smb_io_rpc_iface("", &rpc->transfer, ps, depth)) + rpc->num_contexts &= 0xff; /* Actually a 1 byte field.. */ + + /* num_contexts must not be zero. */ + if (rpc->num_contexts == 0) return False; - - /* just chew through extra context id's for now */ - - for ( i=1; inum_elements; i++ ) { - if(!prs_uint16("context_id ", ps, depth, &rpc2.context_id )) - return False; - if(!prs_uint8 ("num_syntaxes", ps, depth, &rpc2.num_syntaxes)) - return False; - if(!smb_io_rpc_iface("", &rpc2.abstract, ps, depth)) + if (UNMARSHALLING(ps)) { + if (!(rpc->rpc_context = PRS_ALLOC_MEM(ps, RPC_CONTEXT, rpc->num_contexts))) { return False; - if(!smb_io_rpc_iface("", &rpc2.transfer, ps, depth)) + } + } + + for (i = 0; i < rpc->num_contexts; i++ ) { + if (!smb_io_rpc_context("", &rpc->rpc_context[i], ps, depth)) return False; - } + } return True; } -- cgit From 4bc39f05b77a8601506fa144a20d7e9ab9c3efe6 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 8 Jun 2005 13:59:03 +0000 Subject: r7391: - Added client-support for various lsa_query_trust_dom_info-calls and a rpcclient-tester for some info-levels. Jerry, I tried to adopt to prs_pointer() where possible and to not interfere with your work for usrmgr. - Add "net rpc trustdom vampire"-tool. This allows to retrieve Interdomain Trust(ed)-Relationships from NT4-Servers including cleartext-passwords (still stored in the local secrets.tdb). The net-hook was done in cooperation with Lars Mueller . To vampire trusted domains simply call: net rpc trustdom vampire -S nt4dc -Uadmin%pass Guenther (This used to be commit 512585293963a1737f831af697ea1dc092d63cb0) --- source3/rpc_parse/parse_lsa.c | 346 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 345 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 6d0a0bfc51..884012c9be 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2503,8 +2503,21 @@ BOOL lsa_io_r_remove_acct_rights(const char *desc, LSA_R_REMOVE_ACCT_RIGHTS *out } /******************************************************************* + 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"); @@ -2524,8 +2537,34 @@ BOOL lsa_io_q_open_trusted_domain(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN *i return True; } +#endif + +/******************************************************************* + Reads or writes an LSA_Q_OPEN_TRUSTED_DOMAIN structure. +********************************************************************/ + +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) @@ -2536,7 +2575,7 @@ BOOL lsa_io_r_open_trusted_domain(const char *desc, LSA_R_OPEN_TRUSTED_DOMAIN *o if(!prs_align(ps)) return False; - if (!smb_io_pol_hnd("", &out->handle, ps, depth)) + if (!smb_io_pol_hnd("handle", &out->handle, ps, depth)) return False; if(!prs_ntstatus("status", ps, depth, &out->status)) @@ -2726,3 +2765,308 @@ BOOL lsa_io_r_delete_object(const char *desc, LSA_R_DELETE_OBJECT *out, prs_stru return True; } + +/******************************************************************* + Inits an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO structure. +********************************************************************/ + +void init_q_query_trusted_domain_info(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO *q, + POLICY_HND *hnd, uint16 info_class) +{ + DEBUG(5, ("init_q_query_trusted_domain_info\n")); + + q->pol = *hnd; + q->info_class = info_class; +} + +/******************************************************************* + Inits an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME structure. +********************************************************************/ + +void init_q_query_trusted_domain_info_by_name(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME *q, + POLICY_HND *hnd, uint16 info_class, + const char *dom_name) +{ + DEBUG(5, ("init_q_query_trusted_domain_info_by_name\n")); + + q->pol = *hnd; + init_lsa_string(&q->domain_name, dom_name ); + q->info_class = info_class; +} + +/******************************************************************* + Inits an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID structure. +********************************************************************/ + +void init_q_query_trusted_domain_info_by_sid(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID *q, + POLICY_HND *hnd, uint16 info_class, + DOM_SID *dom_sid) +{ + DEBUG(5, ("init_q_query_trusted_domain_info_by_sid\n")); + + q->pol = *hnd; + init_dom_sid2(&q->dom_sid, dom_sid); + q->info_class = info_class; +} + +/******************************************************************* + Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO structure. +********************************************************************/ + +BOOL lsa_io_q_query_trusted_domain_info(const char *desc, + LSA_Q_QUERY_TRUSTED_DOMAIN_INFO *q_q, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_q_query_trusted_domain_info"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("pol", &q_q->pol, ps, depth)) + return False; + + if(!prs_uint16("info_class", ps, depth, &q_q->info_class)) + return False; + + return True; +} + + +/******************************************************************* + Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID structure. +********************************************************************/ + +BOOL lsa_io_q_query_trusted_domain_info_by_sid(const char *desc, + LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID *q_q, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_q_query_trusted_domain_info_by_sid"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("pol", &q_q->pol, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!smb_io_dom_sid2("dom_sid", &q_q->dom_sid, ps, depth)) + return False; + + if(!prs_uint16("info_class", ps, depth, &q_q->info_class)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME structure. +********************************************************************/ + +BOOL lsa_io_q_query_trusted_domain_info_by_name(const char *desc, + LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME *q_q, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_q_query_trusted_domain_info_by_name"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("pol", &q_q->pol, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!smb_io_lsa_string("domain_name", &q_q->domain_name, ps, depth)) + return False; + + if(!prs_uint16("info_class", ps, depth, &q_q->info_class)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +static BOOL smb_io_lsa_data_buf_hdr(const char *desc, LSA_DATA_BUF_HDR *buf_hdr, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "smb_io_lsa_data_buf_hdr"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("length", ps, depth, &buf_hdr->length)) + return False; + + if(!prs_uint32("size", ps, depth, &buf_hdr->size)) + return False; + + if (!prs_uint32("data_ptr", ps, depth, &buf_hdr->data_ptr)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +static BOOL smb_io_lsa_data_buf(const char *desc, LSA_DATA_BUF *buf, + prs_struct *ps, int depth, int length, int size) +{ + prs_debug(ps, depth, desc, "smb_io_lsa_data_buf"); + depth++; + + if ( UNMARSHALLING(ps) ) { + if ( !(buf->data = PRS_ALLOC_MEM( ps, uint8, length )) ) + return False; + } + + if (!prs_uint32("size", ps, depth, &buf->size)) + return False; + + if (!prs_uint32("offset", ps, depth, &buf->offset)) + return False; + + if (!prs_uint32("length", ps, depth, &buf->length)) + return False; + + if(!prs_uint8s(False, "data", ps, depth, buf->data, size)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +static BOOL lsa_io_trustdom_query_1(const char *desc, TRUSTED_DOMAIN_INFO_NAME *name, + prs_struct *ps, int depth) +{ + if (!smb_io_lsa_string("netbios_name", &name->netbios_name, ps, depth)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +static BOOL lsa_io_trustdom_query_3(const char *desc, TRUSTED_DOMAIN_INFO_POSIX_OFFSET *posix, + prs_struct *ps, int depth) +{ + if(!prs_uint32("posix_offset", ps, depth, &posix->posix_offset)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +static BOOL lsa_io_trustdom_query_4(const char *desc, TRUSTED_DOMAIN_INFO_PASSWORD *password, + prs_struct *ps, int depth) +{ + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_password", ps, depth, &password->ptr_password)) + return False; + + if(!prs_uint32("ptr_old_password", ps, depth, &password->ptr_old_password)) + return False; + + if (&password->ptr_password) { + + if (!smb_io_lsa_data_buf_hdr("password_hdr", &password->password_hdr, ps, depth)) + return False; + + if (!smb_io_lsa_data_buf("password", &password->password, ps, depth, + password->password_hdr.length, password->password_hdr.size)) + return False; + } + + if (&password->ptr_old_password) { + + if (!smb_io_lsa_data_buf_hdr("old_password_hdr", &password->old_password_hdr, ps, depth)) + return False; + + if (!smb_io_lsa_data_buf("old_password", &password->old_password, ps, depth, + password->old_password_hdr.length, password->old_password_hdr.size)) + return False; + } + + return True; +} + +/******************************************************************* +********************************************************************/ + +static BOOL lsa_io_trustdom_query(const char *desc, prs_struct *ps, int depth, LSA_TRUSTED_DOMAIN_INFO *info) +{ + prs_debug(ps, depth, desc, "lsa_io_trustdom_query"); + depth++; + + if(!prs_uint16("info_class", ps, depth, &info->info_class)) + return False; + + if(!prs_align(ps)) + return False; + + switch (info->info_class) { + case 1: + if(!lsa_io_trustdom_query_1("name", &info->name, ps, depth)) + return False; + break; + case 3: + if(!lsa_io_trustdom_query_3("posix_offset", &info->posix_offset, ps, depth)) + return False; + break; + case 4: + if(!lsa_io_trustdom_query_4("password", &info->password, ps, depth)) + return False; + break; + default: + DEBUG(0,("unsupported info-level: %d\n", info->info_class)); + return False; + break; + } + + return True; +} + +/******************************************************************* + Reads or writes an LSA_R_QUERY_TRUSTED_DOMAIN_INFO structure. +********************************************************************/ + +BOOL lsa_io_r_query_trusted_domain_info(const char *desc, + LSA_R_QUERY_TRUSTED_DOMAIN_INFO *r_q, + prs_struct *ps, int depth) +{ + if (r_q == NULL) + return False; + + prs_debug(ps, depth, desc, "lsa_io_r_query_trusted_domain_info"); + depth++; + + if (!prs_pointer("trustdom", ps, depth, (void**)&r_q->info, + sizeof(LSA_TRUSTED_DOMAIN_INFO), + (PRS_POINTER_CAST)lsa_io_trustdom_query) ) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_ntstatus("status", ps, depth, &r_q->status)) + return False; + + return True; +} + -- cgit From fed660877c16562265327c6093ea645cf4176b5c Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 8 Jun 2005 22:10:34 +0000 Subject: r7415: * big change -- volker's new async winbindd from trunk (This used to be commit a0ac9a8ffd4af31a0ebc423b4acbb2f043d865b8) --- source3/rpc_parse/parse_prs.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index cccad9ad55..493536eb2a 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1240,6 +1240,32 @@ BOOL prs_string(const char *name, prs_struct *ps, int depth, char *str, int max_ return True; } +BOOL prs_string_alloc(const char *name, prs_struct *ps, int depth, + const char **str) +{ + size_t len; + char *tmp_str; + + if (UNMARSHALLING(ps)) + len = strlen(&ps->data_p[ps->data_offset]); + else + len = strlen(*str); + + tmp_str = PRS_ALLOC_MEM(ps, char, len+1); + + if (tmp_str == NULL) + return False; + + if (MARSHALLING(ps)) + strncpy(tmp_str, *str, len); + + if (!prs_string(name, ps, depth, tmp_str, len+1)) + return False; + + *str = tmp_str; + return True; +} + /******************************************************************* prs_uint16 wrapper. Call this and it sets up a pointer to where the uint16 should be stored, or gets the size if reading. -- cgit From d559edcce23ada96c4a788c3dbeb66c2890db054 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 14 Jun 2005 03:17:31 +0000 Subject: r7563: svcctl patches from Marcin; have cleaned up formating and am checking the code in to snapshot it before I start changing more things (This used to be commit 560ce111ce8de37d02bce64d2ca60a5f471d5477) --- source3/rpc_parse/parse_misc.c | 2 +- source3/rpc_parse/parse_svcctl.c | 174 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 174 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index ccb3e75ac8..2fe448f47d 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -566,7 +566,7 @@ BOOL smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth) Allocate the RPC_DATA_BLOB memory. ********************************************************************/ -static size_t create_rpc_blob(RPC_DATA_BLOB *str, size_t len) +size_t create_rpc_blob(RPC_DATA_BLOB *str, size_t len) { str->buffer = TALLOC_ZERO(get_talloc_ctx(), len); if (str->buffer == NULL) diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index 1c41a18b99..1f21cb2aab 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -100,6 +100,21 @@ static BOOL svcctl_io_service_config( const char *desc, SERVICE_CONFIG *config, return True; } +/******************************************************************* +********************************************************************/ + +BOOL svcctl_io_service_description( const char *desc, UNISTR2 *svcdesc, prs_struct *ps, int depth ) +{ + + prs_debug(ps, depth, desc, "svcctl_io_service_description"); + depth++; + + //DEBUG(10, ("_svcctl_io_service_description: descrption is [%s]\n",svcdesc)); + if (!prs_io_unistr2("", ps, depth, svcdesc)) + return False; + + return True; +} /******************************************************************* @@ -142,6 +157,7 @@ uint32 svcctl_sizeof_enum_services_status( ENUM_SERVICES_STATUS *status ) BOOL svcctl_io_q_close_service(const char *desc, SVCCTL_Q_CLOSE_SERVICE *q_u, prs_struct *ps, int depth) { + if (q_u == NULL) return False; @@ -170,7 +186,10 @@ BOOL svcctl_io_r_close_service(const char *desc, SVCCTL_R_CLOSE_SERVICE *r_u, pr depth++; if(!prs_align(ps)) - return False; + return False; + + if(!smb_io_pol_hnd("pol_handle", &r_u->handle, ps, depth)) + return False; if(!prs_werror("status", ps, depth, &r_u->status)) return False; @@ -642,6 +661,7 @@ BOOL svcctl_io_r_query_service_config(const char *desc, SVCCTL_R_QUERY_SERVICE_C prs_debug(ps, depth, desc, "svcctl_io_r_query_service_config"); depth++; + if(!prs_align(ps)) return False; @@ -654,6 +674,158 @@ BOOL svcctl_io_r_query_service_config(const char *desc, SVCCTL_R_QUERY_SERVICE_C if(!prs_werror("status", ps, depth, &r_u->status)) return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +BOOL svcctl_io_q_query_service_config2(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "svcctl_io_q_query_service_config2"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth)) + return False; + + if(!prs_uint32("info_level", ps, depth, &q_u->info_level)) + return False; + + if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size)) + return False; + + return True; +} + + +/******************************************************************* + Creates a service description response buffer. + The format seems to be DWORD:length of buffer + DWORD:offset (fixed as four) + UNISTR: unicode description in the rest of the buffer +********************************************************************/ + +void init_service_description_buffer(RPC_DATA_BLOB *str, const char *service_desc, int blob_length) +{ + uint32 offset; + char *bp; + + ZERO_STRUCTP(str); + + offset = 4; + + /* set up string lengths. */ + + str->buf_len = create_rpc_blob(str, blob_length); + DEBUG(10, ("init_service_description buffer: Allocated a blob of [%d] \n",str->buf_len)); + + if ( str && str->buffer && str->buf_len) { + memset(str->buffer,0,str->buf_len); + memcpy(str->buffer, &offset, sizeof(uint32)); + bp = &str->buffer[4]; + if (service_desc) { + rpcstr_push(bp, service_desc,str->buf_len-4,0); + } + } +} + +/******************************************************************* +********************************************************************/ + +BOOL svcctl_io_q_query_service_status_ex(const char *desc, SVCCTL_Q_QUERY_SERVICE_STATUSEX *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "svcctl_io_q_query_service_status_ex"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth)) + return False; + + if(!prs_uint32("info_level", ps, depth, &q_u->info_level)) + return False; + + if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size)) + return False; + + return True; + +} + +/******************************************************************* +********************************************************************/ + +BOOL svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVICE_STATUSEX *r_u, prs_struct *ps, int depth) +{ + if ( !r_u ) + return False; + + prs_debug(ps, depth, desc, "svcctl_io_r_query_service_status_ex"); + depth++; + + if (!prs_rpcbuffer("", ps, depth, &r_u->buffer)) + return False; + + if(!prs_align(ps)) + 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_r_query_service_config2(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u, prs_struct *ps, int depth) +{ + if ( !r_u ) + return False; + + prs_debug(ps, depth, desc, "svcctl_io_r_query_service_config2"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("returned", ps, depth, &r_u->returned)) + return False; + + if (r_u->returned > 4) { + if (!prs_uint32("offset", ps, depth, &r_u->offset)) + return False; + if(!prs_unistr2(True, "description ", ps, depth, r_u->description)) + return False; + if(!prs_align(ps)) + return False; + } else { + /* offset does double duty here */ + r_u->offset = 0; + if (!prs_uint32("offset", ps, depth, &r_u->offset)) + 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; } -- cgit From bb2616d0180d21e5962a028617d274c51f5dcc63 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 16 Jun 2005 20:04:16 +0000 Subject: r7645: adding server stubs for RegCreateKey() and RegSetValue() (This used to be commit ce82566badfb907a2f72e2f7d90a7bbbe3811177) --- source3/rpc_parse/parse_reg.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 7e8ae03039..7957478af0 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -212,7 +212,7 @@ void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, { ZERO_STRUCTP(q_c); - memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); + memcpy(&q_c->handle, hnd, sizeof(q_c->handle)); init_unistr4( &q_c->name, name, UNI_STR_TERMINATE ); @@ -246,7 +246,7 @@ BOOL reg_io_q_create_key(const char *desc, REG_Q_CREATE_KEY *q_u, if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &q_u->pnt_pol, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->handle, ps, depth)) return False; if(!prs_unistr4 ("name", ps, depth, &q_u->name)) @@ -318,7 +318,7 @@ void init_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd, { ZERO_STRUCTP(q_c); - memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); + memcpy(&q_c->handle, hnd, sizeof(q_c->handle)); init_unistr4(&q_c->name, name, UNI_STR_TERMINATE); } @@ -338,7 +338,7 @@ BOOL reg_io_q_delete_val(const char *desc, REG_Q_DELETE_VALUE *q_u, if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &q_u->pnt_pol, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->handle, ps, depth)) return False; if(!prs_unistr4("name", ps, depth, &q_u->name)) @@ -381,7 +381,7 @@ void init_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd, { ZERO_STRUCTP(q_c); - memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol)); + memcpy(&q_c->handle, hnd, sizeof(q_c->handle)); init_unistr4(&q_c->name, name, UNI_STR_TERMINATE); } @@ -402,7 +402,7 @@ BOOL reg_io_q_delete_key(const char *desc, REG_Q_DELETE_KEY *q_u, if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &q_u->pnt_pol, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->handle, ps, depth)) return False; if(!prs_unistr4("", ps, depth, &q_u->name)) @@ -1232,7 +1232,7 @@ void init_reg_q_set_val(REG_Q_SET_VALUE *q_u, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_set_val(const char *desc, REG_Q_SET_VALUE *q_u, prs_struct *ps, int depth) +BOOL reg_io_q_set_value(const char *desc, REG_Q_SET_VALUE *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1269,7 +1269,7 @@ BOOL reg_io_q_set_val(const char *desc, REG_Q_SET_VALUE *q_u, prs_struct *ps, i reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_set_val(const char *desc, REG_R_SET_VALUE *q_u, prs_struct *ps, int depth) +BOOL reg_io_r_set_value(const char *desc, REG_R_SET_VALUE *q_u, prs_struct *ps, int depth) { if ( !q_u ) return False; -- cgit From b2db8a9bd3aad8e56ab4d95b05d2db7773057e8b Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 16 Jun 2005 20:59:39 +0000 Subject: r7649: * fix compile breakage (sorry, should have done a make clean before the last checking). * rename unknown field in REG_GETVERSION * add server stubs for RegDeleteKey() and RegDeleteValue() (This used to be commit 023728c0595eaef60e357d32a25e2c4cee9e21f4) --- source3/rpc_parse/parse_reg.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 7957478af0..9f50f50acf 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -326,13 +326,13 @@ void init_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_delete_val(const char *desc, REG_Q_DELETE_VALUE *q_u, +BOOL reg_io_q_delete_value(const char *desc, REG_Q_DELETE_VALUE *q_u, prs_struct *ps, int depth) { if ( !q_u ) return False; - prs_debug(ps, depth, desc, "reg_io_q_delete_val"); + prs_debug(ps, depth, desc, "reg_io_q_delete_value"); depth++; if(!prs_align(ps)) @@ -354,13 +354,13 @@ BOOL reg_io_q_delete_val(const char *desc, REG_Q_DELETE_VALUE *q_u, reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_delete_val(const char *desc, REG_R_DELETE_VALUE *r_u, +BOOL reg_io_r_delete_value(const char *desc, REG_R_DELETE_VALUE *r_u, prs_struct *ps, int depth) { if ( !r_u ) return False; - prs_debug(ps, depth, desc, "reg_io_r_delete_val"); + prs_debug(ps, depth, desc, "reg_io_r_delete_value"); depth++; if(!prs_align(ps)) @@ -563,7 +563,7 @@ BOOL reg_io_r_getversion(const char *desc, REG_R_GETVERSION *r_u, prs_struct *p if(!prs_align(ps)) return False; - if(!prs_uint32("unknown", ps, depth, &r_u->unknown)) + if(!prs_uint32("win_version", ps, depth, &r_u->win_version)) return False; if(!prs_werror("status" , ps, depth, &r_u->status)) return False; @@ -1237,7 +1237,7 @@ BOOL reg_io_q_set_value(const char *desc, REG_Q_SET_VALUE *q_u, prs_struct *ps, if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "reg_io_q_set_val"); + prs_debug(ps, depth, desc, "reg_io_q_set_value"); depth++; if(!prs_align(ps)) @@ -1274,7 +1274,7 @@ BOOL reg_io_r_set_value(const char *desc, REG_R_SET_VALUE *q_u, prs_struct *ps, if ( !q_u ) return False; - prs_debug(ps, depth, desc, "reg_io_r_set_val"); + prs_debug(ps, depth, desc, "reg_io_r_set_value"); depth++; if(!prs_align(ps)) -- cgit From 2102f6bff9641eeec3b593529be7bf8d9ec784d4 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 17 Jun 2005 01:57:18 +0000 Subject: r7664: add access check hooks to _reg_open_entry which are passed off to the reg_XXX backend. If the backend does not define a regkey_access_check() function, we default to using the standard registry_access_check() (This used to be commit 2f08a904eee772e7d99ae6e3e4c922f74732284f) --- source3/rpc_parse/parse_reg.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 9f50f50acf..5eed245a28 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1458,21 +1458,6 @@ BOOL reg_io_q_open_entry(const char *desc, REG_Q_OPEN_ENTRY *q_u, prs_struct *p return True; } -/******************************************************************* - Inits a structure. -********************************************************************/ - -void init_reg_r_open_entry(REG_R_OPEN_ENTRY *r_u, - POLICY_HND *pol, WERROR werr) -{ - if (W_ERROR_IS_OK(werr)) { - memcpy(&r_u->pol, pol, sizeof(r_u->pol)); - } else { - ZERO_STRUCT(r_u->pol); - } - r_u->status = werr; -} - /******************************************************************* reads or writes a structure. ********************************************************************/ @@ -1488,7 +1473,7 @@ BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_u, prs_struct *p if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &r_u->pol, ps, depth)) + if(!smb_io_pol_hnd("handle", &r_u->handle, ps, depth)) return False; if(!prs_werror("status", ps, depth, &r_u->status)) -- cgit From 2129d3c711a109b47c3c1596a6a639520d2f72d2 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 17 Jun 2005 15:35:31 +0000 Subject: r7691: * add .gdbinit to the svn:ignore files * start adding write support to the Samba registry Flesh out the server implementations of RegCreateKey(), RegSetValue(), RegDeleteKey() and RegDeleteValue() I can create a new key using regedit.exe now but the 'New Key #1' key cannot be deleted yet. (This used to be commit e188fdbef8f0ad202b0ecf3c30be2941ebe6d5b1) --- source3/rpc_parse/parse_reg.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 5eed245a28..5cc4d06f4f 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -297,7 +297,7 @@ BOOL reg_io_r_create_key(const char *desc, REG_R_CREATE_KEY *r_u, if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &r_u->key_pol, ps, depth)) + if(!smb_io_pol_hnd("", &r_u->handle, ps, depth)) return False; if(!prs_uint32("unknown", ps, depth, &r_u->unknown)) return False; @@ -407,8 +407,6 @@ BOOL reg_io_q_delete_key(const char *desc, REG_Q_DELETE_KEY *q_u, if(!prs_unistr4("", ps, depth, &q_u->name)) return False; - if(!prs_align(ps)) - return False; return True; } @@ -1219,7 +1217,7 @@ void init_reg_q_set_val(REG_Q_SET_VALUE *q_u, POLICY_HND *pol, { ZERO_STRUCTP(q_u); - memcpy(&q_u->pol, pol, sizeof(q_u->pol)); + memcpy(&q_u->handle, pol, sizeof(q_u->handle)); init_unistr4(&q_u->name, val_name, UNI_STR_TERMINATE); @@ -1243,7 +1241,7 @@ BOOL reg_io_q_set_value(const char *desc, REG_Q_SET_VALUE *q_u, prs_struct *ps, if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->handle, ps, depth)) return False; if(!prs_unistr4("name", ps, depth, &q_u->name )) -- cgit From 5c9963c287e20a4a4b8bbaa088328438eb4f942c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 17 Jun 2005 18:05:46 +0000 Subject: r7696: Don't try and be clever and read an 8 byte int and 3 pad bytes as a uint32 - you'll just get it wrong (as I did :-). Second attempt to fix the Apple client issues. Jeremy. (This used to be commit d2aa5bc7aaa9fe11fa4748f99e4ba49be08aa639) --- source3/rpc_parse/parse_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index ef5c230d2d..3c10975876 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -463,10 +463,10 @@ BOOL smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int de if(!smb_io_rpc_hdr_bba("", &rpc->bba, ps, depth)) return False; - if(!prs_uint32("num_contexts", ps, depth, &rpc->num_contexts)) + if(!prs_uint8("num_contexts", ps, depth, &rpc->num_contexts)) return False; - rpc->num_contexts &= 0xff; /* Actually a 1 byte field.. */ + /* 3 pad bytes following - will be mopped up by the prs_align in smb_io_rpc_context(). */ /* num_contexts must not be zero. */ if (rpc->num_contexts == 0) -- cgit From ef34e3336b6f4a84fb0d0a121c1eb5c54165b457 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 20 Jun 2005 22:13:19 +0000 Subject: r7789: fix overparanoid assert() call when checking spolss buffer pointers (This used to be commit e81e6e653aecdd0e4cfd2ea7ced16070bc376292) --- source3/rpc_parse/parse_buffer.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index a48d5cfa98..ff2a7cc2f6 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -173,14 +173,20 @@ BOOL rpcbuf_alloc_size(RPC_BUFFER *buffer, uint32 buffer_size) void rpcbuf_move(RPC_BUFFER *src, RPC_BUFFER **dest) { - SMB_ASSERT( src != NULL ); + if ( !src ) { + *dest = NULL; + return; + } + + prs_switch_type( &src->prs, MARSHALL ); - prs_switch_type(&src->prs, MARSHALL); - if(!prs_set_offset(&src->prs, 0)) + if ( !prs_set_offset(&src->prs, 0) ) return; - prs_force_dynamic(&src->prs); - prs_mem_clear(&src->prs); - *dest=src; + + prs_force_dynamic( &src->prs ); + prs_mem_clear( &src->prs ); + + *dest = src; } /******************************************************************* -- cgit From bc8954c4fce89992eb31bcb88e27728859aa7132 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 22 Jun 2005 20:33:30 +0000 Subject: r7839: remove C++ style comment (This used to be commit e04fd56e0097dc8007394bf295b227b454e524b4) --- source3/rpc_parse/parse_svcctl.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index 1f21cb2aab..85889d5889 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -109,7 +109,6 @@ BOOL svcctl_io_service_description( const char *desc, UNISTR2 *svcdesc, prs_stru prs_debug(ps, depth, desc, "svcctl_io_service_description"); depth++; - //DEBUG(10, ("_svcctl_io_service_description: descrption is [%s]\n",svcdesc)); if (!prs_io_unistr2("", ps, depth, svcdesc)) return False; -- cgit From 2fb7ff7d9def29e21dd87f565ccda5437c848cdd Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 24 Jun 2005 14:55:09 +0000 Subject: r7878: mostly just a rename of REG_INFO to REG_QUERY_VALUE for better clarity (This used to be commit d50f0ba07e285728605c8e8aae9d9a251a525e78) --- source3/rpc_parse/parse_reg.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 5cc4d06f4f..fc2d3c4086 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -905,7 +905,7 @@ BOOL reg_io_r_get_key_sec(const char *desc, REG_R_GET_KEY_SEC *q_u, prs_struct makes a structure. ********************************************************************/ -BOOL init_reg_q_info(REG_Q_INFO *q_u, POLICY_HND *pol, const char *val_name, +BOOL init_reg_q_query_value(REG_Q_QUERY_VALUE *q_u, POLICY_HND *pol, const char *val_name, REGVAL_BUFFER *value_output) { if (q_u == NULL) @@ -936,12 +936,12 @@ BOOL init_reg_q_info(REG_Q_INFO *q_u, POLICY_HND *pol, const char *val_name, reads or writes a structure. ********************************************************************/ -BOOL reg_io_q_info(const char *desc, REG_Q_INFO *q_u, prs_struct *ps, int depth) +BOOL reg_io_q_query_value(const char *desc, REG_Q_QUERY_VALUE *q_u, prs_struct *ps, int depth) { if ( !q_u ) return False; - prs_debug(ps, depth, desc, "reg_io_q_info"); + prs_debug(ps, depth, desc, "reg_io_q_query_value"); depth++; if(!prs_align(ps)) @@ -990,10 +990,10 @@ BOOL reg_io_q_info(const char *desc, REG_Q_INFO *q_u, prs_struct *ps, int depth /******************************************************************* Inits a structure. - New version to replace older init_reg_r_info() + New version to replace older init_reg_r_query_value() ********************************************************************/ -BOOL init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_u, +BOOL init_reg_r_query_value(uint32 include_keyval, REG_R_QUERY_VALUE *r_u, REGISTRY_VALUE *val, WERROR status) { uint32 buf_len = 0; @@ -1031,12 +1031,12 @@ BOOL init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_u, reads or writes a structure. ********************************************************************/ -BOOL reg_io_r_info(const char *desc, REG_R_INFO *r_u, prs_struct *ps, int depth) +BOOL reg_io_r_query_value(const char *desc, REG_R_QUERY_VALUE *r_u, prs_struct *ps, int depth) { if ( !r_u ) return False; - prs_debug(ps, depth, desc, "reg_io_r_info"); + prs_debug(ps, depth, desc, "reg_io_r_query_value"); depth++; if(!prs_align(ps)) -- cgit From 8387af752f81e26f1c141f6053bf6d106f0af5eb Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 24 Jun 2005 15:49:02 +0000 Subject: r7880: fix a typo and memleak on failures cases (patch from marcin) (This used to be commit 6ff0fa0b4385481f2212047d80ca17b55d996def) --- source3/rpc_parse/parse_eventlog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index d27761ad0f..734f52fffb 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -33,7 +33,7 @@ BOOL eventlog_io_q_open_eventlog(const char *desc, EVENTLOG_Q_OPEN_EVENTLOG *q_u if(q_u == NULL) return False; - /* Data format seems to be: + /** Data format seems to be: UNKNOWN structure uint32 unknown uint16 unknown @@ -258,7 +258,7 @@ BOOL eventlog_io_q_read_eventlog(const char *desc, EVENTLOG_Q_READ_EVENTLOG *q_u return True; } -/* Structure of response seems to be: +/** Structure of response seems to be: DWORD num_bytes_in_resp -- MUST be the same as q_u->max_read_size for i=0..n EVENTLOGRECORD record @@ -397,7 +397,7 @@ BOOL eventlog_io_r_read_eventlog(const char *desc, return True; } -/* The windows client seems to be doing something funny with the file name +/** 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 -- cgit From 19ca97a70f6b7b41d251eaa76e4d3c980c6eedff Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 24 Jun 2005 20:25:18 +0000 Subject: r7882: Looks like a large patch - but what it actually does is make Samba safe for using our headers and linking with C++ modules. Stops us from using C++ reserved keywords in our code. Jeremy (This used to be commit 9506b8e145982b1160a2f0aee5c9b7a54980940a) --- source3/rpc_parse/parse_reg.c | 14 +++++++------- source3/rpc_parse/parse_spoolss.c | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index fc2d3c4086..d71ecc33de 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -207,7 +207,7 @@ static BOOL reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, ********************************************************************/ void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, - char *name, char *class, uint32 access_desired, + char *name, char *key_class, uint32 access_desired, SEC_DESC_BUF *sec_buf) { ZERO_STRUCTP(q_c); @@ -216,7 +216,7 @@ void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, init_unistr4( &q_c->name, name, UNI_STR_TERMINATE ); - init_unistr4( &q_c->class, class, UNI_STR_TERMINATE ); + init_unistr4( &q_c->key_class, key_class, UNI_STR_TERMINATE ); q_c->access = access_desired; @@ -254,7 +254,7 @@ BOOL reg_io_q_create_key(const char *desc, REG_Q_CREATE_KEY *q_u, if(!prs_align(ps)) return False; - if(!prs_unistr4 ("class", ps, depth, &q_u->class)) + if(!prs_unistr4 ("key_class", ps, depth, &q_u->key_class)) return False; if(!prs_align(ps)) return False; @@ -436,12 +436,12 @@ BOOL reg_io_r_delete_key(const char *desc, REG_R_DELETE_KEY *r_u, prs_struct *p Inits a structure. ********************************************************************/ -void init_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, const char *class) +void init_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, const char *key_class) { ZERO_STRUCTP(q_o); memcpy(&q_o->pol, hnd, sizeof(q_o->pol)); - init_unistr4(&q_o->class, class, UNI_STR_TERMINATE); + init_unistr4(&q_o->key_class, key_class, UNI_STR_TERMINATE); } /******************************************************************* @@ -461,7 +461,7 @@ BOOL reg_io_q_query_key(const char *desc, REG_Q_QUERY_KEY *q_u, prs_struct *ps, if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) return False; - if(!prs_unistr4("class", ps, depth, &q_u->class)) + if(!prs_unistr4("key_class", ps, depth, &q_u->key_class)) return False; if(!prs_align(ps)) @@ -486,7 +486,7 @@ BOOL reg_io_r_query_key(const char *desc, REG_R_QUERY_KEY *r_u, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_unistr4("class", ps, depth, &r_u->class)) + if(!prs_unistr4("key_class", ps, depth, &r_u->key_class)) return False; if(!prs_align(ps)) diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 6c2d6b4978..34e3f8fe35 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -774,15 +774,15 @@ BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE if (devmode->driverextra!=0) { if (UNMARSHALLING(ps)) { - devmode->private=PRS_ALLOC_MEM(ps, uint8, devmode->driverextra); - if(devmode->private == NULL) + devmode->dev_private=PRS_ALLOC_MEM(ps, uint8, devmode->driverextra); + if(devmode->dev_private == NULL) return False; - DEBUG(7,("spoolss_io_devmode: allocated memory [%d] for private\n",devmode->driverextra)); + DEBUG(7,("spoolss_io_devmode: allocated memory [%d] for dev_private\n",devmode->driverextra)); } - DEBUG(7,("spoolss_io_devmode: parsing [%d] bytes of private\n",devmode->driverextra)); - if (!prs_uint8s(False, "private", ps, depth, - devmode->private, devmode->driverextra)) + DEBUG(7,("spoolss_io_devmode: parsing [%d] bytes of dev_private\n",devmode->driverextra)); + if (!prs_uint8s(False, "dev_private", ps, depth, + devmode->dev_private, devmode->driverextra)) return False; } @@ -6188,7 +6188,7 @@ BOOL spoolss_io_q_getjob(const char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, void free_devmode(DEVICEMODE *devmode) { if (devmode!=NULL) { - SAFE_FREE(devmode->private); + SAFE_FREE(devmode->dev_private); SAFE_FREE(devmode); } } @@ -6350,7 +6350,7 @@ BOOL spoolss_io_q_routerreplyprinter (const char *desc, SPOOL_Q_ROUTERREPLYPRINT if (!prs_uint32("change_id", ps, depth, &q_u->change_id)) return False; - if (!prs_uint8s(False, "private", ps, depth, q_u->unknown2, 5)) + if (!prs_uint8s(False, "dev_private", ps, depth, q_u->unknown2, 5)) return False; return True; -- cgit From b8e787bcac79b01d3f44d497517138b0c013be00 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 24 Jun 2005 22:34:40 +0000 Subject: r7890: * add Reg[SG]etKeySec() server stubs * merge a compile warning fix from trunk to SAMBA_3_0 (This used to be commit 71eb018a05c5012fbd42ba6817aabc0797d38ba1) --- source3/rpc_parse/parse_reg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index d71ecc33de..190f39eb79 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -745,7 +745,7 @@ makes a structure. void init_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_u, POLICY_HND *pol, uint32 sec_info, SEC_DESC_BUF *sec_desc_buf) { - memcpy(&q_u->pol, pol, sizeof(q_u->pol)); + memcpy(&q_u->handle, pol, sizeof(q_u->handle)); q_u->sec_info = sec_info; @@ -769,7 +769,7 @@ BOOL reg_io_q_set_key_sec(const char *desc, REG_Q_SET_KEY_SEC *q_u, prs_struct if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->handle, ps, depth)) return False; if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info)) @@ -813,7 +813,7 @@ void init_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_u, POLICY_HND *pol, uint32 sec_info, uint32 sec_buf_size, SEC_DESC_BUF *psdb) { - memcpy(&q_u->pol, pol, sizeof(q_u->pol)); + memcpy(&q_u->handle, pol, sizeof(q_u->handle)); q_u->sec_info = sec_info; @@ -838,7 +838,7 @@ BOOL reg_io_q_get_key_sec(const char *desc, REG_Q_GET_KEY_SEC *q_u, prs_struct if(!prs_align(ps)) return False; - if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) + if(!smb_io_pol_hnd("", &q_u->handle, ps, depth)) return False; if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info)) -- cgit From bd509a81cb6c295988a1626adfe394c9778c005e Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 25 Jun 2005 17:31:40 +0000 Subject: r7908: * change REGISTRY_HOOK api to use const (fix compiler warning in init_registry_data() * Add means of storing registry values in registry.tdb * add builtin_registry_values[] array for REG_DWORD and REG_SZ values needed during startup * Finish up RegDeleteValue() and RegSetValue() * Finish up regdb_store_reg_values() and regdb_fetch_reg_values() I can now create and retrieve values using regedit.exe on Win2k. bin/net -S rain -U% rpc registry enumerate 'hklm\software\samba' Valuename = Version Type = REG_SZ Data = 3.0.20 Next is to do the virtual writes in reg_printing.c and I'll be done with Print Migrator (yeah! finally) (This used to be commit 3d837e58db9ded64d6b85f047012c7d487be4627) --- source3/rpc_parse/parse_reg.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 190f39eb79..9048f0f58f 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -343,8 +343,6 @@ BOOL reg_io_q_delete_value(const char *desc, REG_Q_DELETE_VALUE *q_u, if(!prs_unistr4("name", ps, depth, &q_u->name)) return False; - if(!prs_align(ps)) - return False; return True; } @@ -464,9 +462,6 @@ BOOL reg_io_q_query_key(const char *desc, REG_Q_QUERY_KEY *q_u, prs_struct *ps, if(!prs_unistr4("key_class", ps, depth, &q_u->key_class)) return False; - if(!prs_align(ps)) - return False; - return True; } -- cgit From 270b90e25f2ec5fcb1283588a9e605b7228e0e41 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 29 Jun 2005 16:35:32 +0000 Subject: r7995: * privileges are local except when they're *not* printmig.exe assumes that the LUID of the SeBackupPrivlege on the target server matches the LUID of the privilege on the local client. Even though an LUID is never guaranteed to be the same across reboots. How *awful*! My cat could write better code! (more on my cat later....) * Set the privelege LUID in the global PRIVS[] array * Rename RegCreateKey() to RegCreateKeyEx() to better match MSDN * Rename the unknown field in RegCreateKeyEx() to disposition (guess according to MSDN) * Add the capability to define REG_TDB_ONLY for using the reg_db.c functions and stress the RegXXX() rpc functions. (This used to be commit 0d6352da4800aabc04dfd7c65a6afe6af7cd2d4b) --- source3/rpc_parse/parse_reg.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 9048f0f58f..c46eef1300 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -206,7 +206,7 @@ static BOOL reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, Inits a registry key create request ********************************************************************/ -void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, +void init_reg_q_create_key_ex(REG_Q_CREATE_KEY_EX *q_c, POLICY_HND *hnd, char *name, char *key_class, uint32 access_desired, SEC_DESC_BUF *sec_buf) { @@ -234,13 +234,13 @@ void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd, Marshalls a registry key create request ********************************************************************/ -BOOL reg_io_q_create_key(const char *desc, REG_Q_CREATE_KEY *q_u, +BOOL reg_io_q_create_key_ex(const char *desc, REG_Q_CREATE_KEY_EX *q_u, prs_struct *ps, int depth) { if ( !q_u ) return False; - prs_debug(ps, depth, desc, "reg_io_q_create_key"); + prs_debug(ps, depth, desc, "reg_io_q_create_key_ex"); depth++; if(!prs_align(ps)) @@ -285,13 +285,13 @@ BOOL reg_io_q_create_key(const char *desc, REG_Q_CREATE_KEY *q_u, Unmarshalls a registry key create response ********************************************************************/ -BOOL reg_io_r_create_key(const char *desc, REG_R_CREATE_KEY *r_u, +BOOL reg_io_r_create_key_ex(const char *desc, REG_R_CREATE_KEY_EX *r_u, prs_struct *ps, int depth) { if ( !r_u ) return False; - prs_debug(ps, depth, desc, "reg_io_r_create_key"); + prs_debug(ps, depth, desc, "reg_io_r_create_key_ex"); depth++; if(!prs_align(ps)) @@ -299,7 +299,7 @@ BOOL reg_io_r_create_key(const char *desc, REG_R_CREATE_KEY *r_u, if(!smb_io_pol_hnd("", &r_u->handle, ps, depth)) return False; - if(!prs_uint32("unknown", ps, depth, &r_u->unknown)) + if(!prs_uint32("disposition", ps, depth, &r_u->disposition)) return False; if(!prs_werror("status", ps, depth, &r_u->status)) -- cgit From 40035db926c66f849df4111736b4d3db3a98e249 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 12 Jul 2005 23:52:32 +0000 Subject: r8398: Fix segfault in the client addprinterex-call. Found with "net rpc printer"-functions. Thanks to Thomas Di Naro (Novell) for the detailed debug-logs. Guenther (This used to be commit b532553b064f1e9893b39dda903d458055c11f86) --- source3/rpc_parse/parse_spoolss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 34e3f8fe35..8050712d97 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -945,7 +945,8 @@ BOOL make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u q_u->user_switch=1; - q_u->user_ctr.level = 1; + q_u->user_ctr.level = 1; + q_u->user_ctr.user.user1 = TALLOC_P( get_talloc_ctx(), SPOOL_USER_1 ); q_u->user_ctr.user.user1->build = 1381; q_u->user_ctr.user.user1->major = 2; q_u->user_ctr.user.user1->minor = 0; -- cgit From a5868d58c718e9122f65db50f1799bcb82c778a0 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 15 Jul 2005 18:13:40 +0000 Subject: r8507: BUG 2557: don't give and rpc fault when you get an unsupported SetPrinter() level (This used to be commit f617ca33f45fbc779356c52664c1e689114accdd) --- source3/rpc_parse/parse_spoolss.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 8050712d97..2663b09381 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3817,6 +3817,22 @@ BOOL spoolss_io_q_setprinter(const char *desc, SPOOL_Q_SETPRINTER *q_u, prs_stru return False; if(!prs_uint32("level", ps, depth, &q_u->level)) return False; + + /* check for supported levels and structures we know about */ + + switch ( q_u->level ) { + case 0: + case 2: + case 3: + case 7: + /* supported levels */ + break; + default: + DEBUG(0,("spoolss_io_q_setprinter: unsupported printer info level [%d]\n", + q_u->level)); + return True; + } + if(!spool_io_printer_info_level("", &q_u->info, ps, depth)) return False; -- cgit From be964085d24fd0fa5f3149c8253528edf9f7cfdd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 18 Jul 2005 22:10:20 +0000 Subject: r8553: Another compile warning fix from jason@ncac.gwu.edu. Jeremy. (This used to be commit 99937d99b6d893689e0471b20a605af3591c2703) --- source3/rpc_parse/parse_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 2fe448f47d..921e366f11 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1194,7 +1194,7 @@ BOOL init_unistr4_array( UNISTR4_ARRAY *array, uint32 count, const char **string return False; for ( i=0; istrings[i], strings[i], STR_TERMINATE ); + init_unistr4( &array->strings[i], strings[i], UNI_STR_TERMINATE ); return True; } -- cgit From 263a51cd62815b568d0d2053ee29cdd77428ba31 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 19 Jul 2005 00:59:25 +0000 Subject: r8564: Sometimes we're too dumb to live... Fix samr calls where we were using USER_INFO_XX structs and functions where XX was sometimes in hex and sometimes in decimal. Now it's all in decimal (should be no functionality change). Jeremy. (This used to be commit 84651aca04cbcbf50ab2e78333cc9d9e49dd92f5) --- source3/rpc_parse/parse_samr.c | 88 +++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 44 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ba8b367a42..6b0193c6e4 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5103,13 +5103,13 @@ static BOOL sam_io_logon_hrs(const char *desc, LOGON_HRS * hrs, } /******************************************************************* -inits a SAM_USER_INFO_12 structure. +inits a SAM_USER_INFO_18 structure. ********************************************************************/ -void init_sam_user_info12(SAM_USER_INFO_12 * usr, +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_info12\n")); + DEBUG(5, ("init_sam_user_info18\n")); usr->lm_pwd_active = memcpy(usr->lm_pwd, lm_pwd, sizeof(usr->lm_pwd)) ? 1 : 0; @@ -5121,13 +5121,13 @@ void init_sam_user_info12(SAM_USER_INFO_12 * usr, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info12(const char *desc, SAM_USER_INFO_12 * u, +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_info12"); + prs_debug(ps, depth, desc, "samr_io_r_user_info18"); depth++; if(!prs_align(ps)) @@ -5185,12 +5185,12 @@ static BOOL sam_io_user_info7(const char *desc, SAM_USER_INFO_7 * usr, } /******************************************************************* -inits a SAM_USER_INFO_10 structure. +inits a SAM_USER_INFO_16 structure. ********************************************************************/ -void init_sam_user_info10(SAM_USER_INFO_10 * usr, uint32 acb_info) +void init_sam_user_info16(SAM_USER_INFO_16 * usr, uint32 acb_info) { - DEBUG(5, ("init_sam_user_info10\n")); + DEBUG(5, ("init_sam_user_info16\n")); usr->acb_info = acb_info; } @@ -5199,13 +5199,13 @@ void init_sam_user_info10(SAM_USER_INFO_10 * usr, uint32 acb_info) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info10(const char *desc, SAM_USER_INFO_10 * usr, +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_info10"); + prs_debug(ps, depth, desc, "samr_io_r_user_info16"); depth++; if(!prs_align(ps)) @@ -5218,15 +5218,15 @@ static BOOL sam_io_user_info10(const char *desc, SAM_USER_INFO_10 * usr, } /******************************************************************* -inits a SAM_USER_INFO_11 structure. +inits a SAM_USER_INFO_17 structure. ********************************************************************/ -void init_sam_user_info11(SAM_USER_INFO_11 * usr, +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_info11\n")); + 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 */ @@ -5263,13 +5263,13 @@ void init_sam_user_info11(SAM_USER_INFO_11 * usr, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info11(const char *desc, SAM_USER_INFO_11 * usr, +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_11"); + prs_debug(ps, depth, desc, "samr_io_r_unknown_17"); depth++; if(!prs_align(ps)) @@ -6231,16 +6231,16 @@ NTSTATUS make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr, ctr->info.id = NULL; switch (switch_value) { - case 0x10: - ctr->info.id10 = TALLOC_ZERO_P(ctx,SAM_USER_INFO_10); - if (ctr->info.id10 == NULL) + 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_info10(ctr->info.id10, usr->acb_info); + 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 0x11: + case 17: { NTTIME expire; info = (void *)&id11; @@ -6248,8 +6248,8 @@ NTSTATUS make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr, expire.low = 0xffffffff; expire.high = 0x7fffffff; - ctr->info.id = TALLOC_ZERO_P(ctx,SAM_USER_INFO_11); - init_sam_user_info11(ctr->info.id11, &expire, + 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 */ @@ -6258,12 +6258,12 @@ NTSTATUS make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr, break; } #endif - case 0x12: - ctr->info.id12 = TALLOC_ZERO_P(ctx,SAM_USER_INFO_12); - if (ctr->info.id12 == NULL) + 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_info12(ctr->info.id12, usr->lm_pwd, usr->nt_pwd); + init_sam_user_info18(ctr->info.id18, usr->lm_pwd, usr->nt_pwd); break; case 21: { @@ -6347,7 +6347,7 @@ static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, ret = False; switch (ctr->switch_value) { - case 0x07: + case 7: if (UNMARSHALLING(ps)) ctr->info.id7 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_7,1); if (ctr->info.id7 == NULL) { @@ -6356,34 +6356,34 @@ static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, } ret = sam_io_user_info7("", ctr->info.id7, ps, depth); break; - case 0x10: + case 16: if (UNMARSHALLING(ps)) - ctr->info.id10 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_10,1); - if (ctr->info.id10 == NULL) { + 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_info10("", ctr->info.id10, ps, depth); + ret = sam_io_user_info16("", ctr->info.id16, ps, depth); break; - case 0x11: + case 17: if (UNMARSHALLING(ps)) - ctr->info.id11 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_11,1); + ctr->info.id17 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_17,1); - if (ctr->info.id11 == NULL) { + if (ctr->info.id17 == NULL) { DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n")); return False; } - ret = sam_io_user_info11("", ctr->info.id11, ps, depth); + ret = sam_io_user_info17("", ctr->info.id17, ps, depth); break; - case 0x12: + case 18: if (UNMARSHALLING(ps)) - ctr->info.id12 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_12,1); + ctr->info.id18 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_18,1); - if (ctr->info.id12 == NULL) { + if (ctr->info.id18 == NULL) { DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n")); return False; } - ret = sam_io_user_info12("", ctr->info.id12, ps, depth); + ret = sam_io_user_info18("", ctr->info.id18, ps, depth); break; case 20: if (UNMARSHALLING(ps)) @@ -6588,12 +6588,12 @@ void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u, q_u->ctr->switch_value = switch_value; switch (switch_value) { - case 0x12: - SamOEMhashBlob(ctr->info.id12->lm_pwd, 16, sess_key); - SamOEMhashBlob(ctr->info.id12->nt_pwd, 16, sess_key); + case 18: + SamOEMhashBlob(ctr->info.id18->lm_pwd, 16, sess_key); + SamOEMhashBlob(ctr->info.id18->nt_pwd, 16, sess_key); dump_data(100, (char *)sess_key->data, sess_key->length); - dump_data(100, (char *)ctr->info.id12->lm_pwd, 16); - dump_data(100, (char *)ctr->info.id12->nt_pwd, 16); + dump_data(100, (char *)ctr->info.id18->lm_pwd, 16); + dump_data(100, (char *)ctr->info.id18->nt_pwd, 16); break; } } -- cgit From 46e7935d25ffacf352738ea50647d607e5303ba7 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 19 Jul 2005 10:15:10 +0000 Subject: r8597: Use UNI_STR_TERMINATE (an enum value) instead of STR_TERMINATE (a #define) to quieten a warning. Bugzilla #2892. (This used to be commit 4e91f29621d5ab9fa748dd1077f8efd1dab45522) --- source3/rpc_parse/parse_reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index c46eef1300..3d586b3779 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1311,7 +1311,7 @@ void init_reg_r_enum_key(REG_R_ENUM_KEY *r_u, char *subkey ) if ( !r_u ) return; - init_unistr4( &r_u->keyname, subkey, STR_TERMINATE ); + init_unistr4( &r_u->keyname, subkey, UNI_STR_TERMINATE ); r_u->classname = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR4 ); r_u->time = TALLOC_ZERO_P( get_talloc_ctx(), NTTIME ); } -- cgit From 8b2b177a8e07e3a0cb00fbd7fdbafc8aeba5b204 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 27 Jul 2005 20:25:04 +0000 Subject: r8805: Merge a duplicate struct. Get ready to support SPNEGO rpc binds. Jeremy. (This used to be commit fd6e342746edfda2f25df1ae0067d359b756e0cd) --- source3/rpc_parse/parse_rpc.c | 74 +++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 45 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 3c10975876..ce081b92e8 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -650,98 +650,82 @@ BOOL smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, } /******************************************************************* - Init an RPC_HDR_AUTHA structure. + Inits an RPC_HDR_AUTH structure. ********************************************************************/ -void init_rpc_hdr_autha(RPC_HDR_AUTHA *rai, - uint16 max_tsize, uint16 max_rsize, +void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, uint8 auth_type, uint8 auth_level, - uint8 stub_type_len) + uint8 auth_pad_len, + uint32 auth_context_id) { - rai->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ - rai->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ - rai->auth_type = auth_type; /* nt lm ssp 0x0a */ rai->auth_level = auth_level; /* 0x06 */ - rai->stub_type_len = stub_type_len; /* 0x00 */ - rai->padding = 0; /* padding 0x00 */ - - rai->unknown = 0x0014a0c0; /* non-zero pointer to something */ + rai->auth_pad_len = auth_pad_len; + rai->auth_reserved = 0; + rai->auth_context_id = auth_context_id; } /******************************************************************* - Reads or writes an RPC_HDR_AUTHA structure. + Reads or writes an RPC_HDR_AUTH structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_autha(const char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) { if (rai == NULL) return False; - prs_debug(ps, depth, desc, "smb_io_rpc_hdr_autha"); + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_auth"); depth++; - if(!prs_uint16("max_tsize ", ps, depth, &rai->max_tsize)) - return False; - if(!prs_uint16("max_rsize ", ps, depth, &rai->max_rsize)) + if(!prs_align(ps)) return False; if(!prs_uint8 ("auth_type ", ps, depth, &rai->auth_type)) /* 0x0a nt lm ssp */ return False; if(!prs_uint8 ("auth_level ", ps, depth, &rai->auth_level)) /* 0x06 */ return False; - if(!prs_uint8 ("stub_type_len", ps, depth, &rai->stub_type_len)) + if(!prs_uint8 ("auth_pad_len ", ps, depth, &rai->auth_pad_len)) return False; - if(!prs_uint8 ("padding ", ps, depth, &rai->padding)) + if(!prs_uint8 ("auth_reserved", ps, depth, &rai->auth_reserved)) return False; - - if(!prs_uint32("unknown ", ps, depth, &rai->unknown)) /* 0x0014a0c0 */ + if(!prs_uint32("auth_context_id", ps, depth, &rai->auth_context_id)) return False; return True; } + /******************************************************************* - Inits an RPC_HDR_AUTH structure. + Init an RPC_HDR_AUTHA structure. ********************************************************************/ -void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, - uint8 auth_type, uint8 auth_level, - uint8 padding, - uint32 ptr) +void init_rpc_hdr_autha(RPC_HDR_AUTHA *rai, + uint16 max_tsize, uint16 max_rsize, + RPC_HDR_AUTH *auth) { - rai->auth_type = auth_type; /* nt lm ssp 0x0a */ - rai->auth_level = auth_level; /* 0x06 */ - rai->padding = padding; - rai->reserved = 0; - - rai->auth_context = ptr; /* non-zero pointer to something */ + rai->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ + rai->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ + rai->auth = *auth; } /******************************************************************* - Reads or writes an RPC_HDR_AUTH structure. + Reads or writes an RPC_HDR_AUTHA structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_autha(const char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) { if (rai == NULL) return False; - prs_debug(ps, depth, desc, "smb_io_rpc_hdr_auth"); + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_autha"); depth++; - if(!prs_align(ps)) - return False; - - if(!prs_uint8 ("auth_type ", ps, depth, &rai->auth_type)) /* 0x0a nt lm ssp */ - return False; - if(!prs_uint8 ("auth_level ", ps, depth, &rai->auth_level)) /* 0x06 */ - return False; - if(!prs_uint8 ("padding ", ps, depth, &rai->padding)) + if(!prs_uint16("max_tsize ", ps, depth, &rai->max_tsize)) return False; - if(!prs_uint8 ("reserved ", ps, depth, &rai->reserved)) + if(!prs_uint16("max_rsize ", ps, depth, &rai->max_rsize)) return False; - if(!prs_uint32("auth_context ", ps, depth, &rai->auth_context)) + + if(!smb_io_rpc_hdr_auth("auth", &rai->auth, ps, depth)) return False; return True; -- cgit From 8c05cc8a2ed4b546e52a5fa12107505d7d1e727a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 31 Jul 2005 23:27:55 +0000 Subject: r8869: Get rid of a warning. Volker (This used to be commit dbcc1de3f89de9f0b2fa75287e7640e824b58e20) --- source3/rpc_parse/parse_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index ed95656fda..a92f16d648 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -792,7 +792,7 @@ BOOL net_io_r_auth(const char *desc, NET_R_AUTH *r_a, prs_struct *ps, int depth) 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, - DOM_CHAL *clnt_chal, uint32 clnt_flgs) + const DOM_CHAL *clnt_chal, uint32 clnt_flgs) { DEBUG(5,("init_q_auth_2: %d\n", __LINE__)); -- cgit From 14a9d52832b19a698968900da6378d542d6a21ce Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 1 Aug 2005 20:54:31 +0000 Subject: r8899: various compiler warning fixes reported by Jason Mader (This used to be commit d8ae9f2b3e5387ef2c4e84cd9c33f4a7c795b0d3) --- source3/rpc_parse/parse_svcctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index 85889d5889..77b48fd0ee 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -714,7 +714,7 @@ BOOL svcctl_io_q_query_service_config2(const char *desc, SVCCTL_Q_QUERY_SERVICE_ void init_service_description_buffer(RPC_DATA_BLOB *str, const char *service_desc, int blob_length) { uint32 offset; - char *bp; + uint8 *bp; ZERO_STRUCTP(str); -- cgit From 4ff44ae90e59d305bb765c88327a3d3292bafb35 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 2 Aug 2005 23:23:25 +0000 Subject: r8956: fix segfault caused by trying to parse a UNISTR2 and not a UNISTR2* (This used to be commit f775fc7209da9e11768625f4084297aa16c9a4d1) --- source3/rpc_parse/parse_svcctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index 77b48fd0ee..b86ca23df1 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -808,8 +808,10 @@ BOOL svcctl_io_r_query_service_config2(const char *desc, SVCCTL_R_QUERY_SERVICE_ if (r_u->returned > 4) { if (!prs_uint32("offset", ps, depth, &r_u->offset)) return False; - if(!prs_unistr2(True, "description ", ps, depth, r_u->description)) + + if ( !prs_pointer( desc, ps, depth, (void**)&r_u->description, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) ) return False; + if(!prs_align(ps)) return False; } else { -- cgit From ac42cd59f27de7d753fafd12b4c667073b8758c1 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 5 Aug 2005 00:58:31 +0000 Subject: r9086: * fix invalid read in parse_spoolss when writing a devmode to the wire * fix dup_a_regval() when size is 0 * ensure we pass a pstring to unlink_internals (fixes delete_driver code) (This used to be commit 353e63ff421c564a1b7c7cfe95982f31c871a227) --- source3/rpc_parse/parse_spoolss.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 2663b09381..2677a4a2df 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -631,6 +631,8 @@ BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE int available_space; /* size of the device mode left to parse */ /* only important on unmarshalling */ int i = 0; + uint16 *unistr_buffer; + int j; struct optional_fields { fstring name; @@ -662,12 +664,20 @@ BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE depth++; if (UNMARSHALLING(ps)) { - devmode->devicename.buffer = PRS_ALLOC_MEM(ps, uint16, 32); + devmode->devicename.buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME); if (devmode->devicename.buffer == NULL) return False; + unistr_buffer = devmode->devicename.buffer; } - - if (!prs_uint16uni(True,"devicename", ps, depth, devmode->devicename.buffer, MAXDEVICENAME)) + else { + /* devicename is a static sized string but the buffer we set is not */ + unistr_buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME); + memset( unistr_buffer, 0x0, MAXDEVICENAME ); + for ( j=0; devmode->devicename.buffer[j]; j++ ) + unistr_buffer[j] = devmode->devicename.buffer[j]; + } + + if (!prs_uint16uni(True,"devicename", ps, depth, unistr_buffer, MAXDEVICENAME)) return False; if (!prs_uint16("specversion", ps, depth, &devmode->specversion)) @@ -709,12 +719,20 @@ BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE return False; if (UNMARSHALLING(ps)) { - devmode->formname.buffer = PRS_ALLOC_MEM(ps, uint16, 32); + devmode->formname.buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME); if (devmode->formname.buffer == NULL) return False; + unistr_buffer = devmode->formname.buffer; } - - if (!prs_uint16uni(True, "formname", ps, depth, devmode->formname.buffer, 32)) + else { + /* devicename is a static sized string but the buffer we set is not */ + unistr_buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME); + memset( unistr_buffer, 0x0, MAXDEVICENAME ); + for ( j=0; devmode->formname.buffer[j]; j++ ) + unistr_buffer[j] = devmode->formname.buffer[j]; + } + + if (!prs_uint16uni(True, "formname", ps, depth, unistr_buffer, MAXDEVICENAME)) return False; if (!prs_uint16("logpixels", ps, depth, &devmode->logpixels)) return False; -- cgit From 1487a72da2d618c578fdf49bd9cf268c2ae3c26c Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 24 Aug 2005 18:13:04 +0000 Subject: r9593: fix enumerated group name (should be full name (i.e. mapped name) and not unix name) (This used to be commit 8928575abde51f04d0596420a85381f697b66c58) --- source3/rpc_parse/parse_samr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 6b0193c6e4..45a1f0e23c 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1720,7 +1720,7 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 **sam, 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); + entries[i].fullname, UNI_FLAGS_NONE); init_unistr2(&(*sam)->str[i].uni_grp_desc, entries[i].description, UNI_FLAGS_NONE); -- cgit From be0f3f159f6c210cc3f9c6054dc7e1d079f2c611 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 26 Aug 2005 18:57:32 +0000 Subject: r9660: real fix for group enumeration bug in 3.0.20; only affected the ldapsam code (This used to be commit 62f9fb5e3a9bce539c9fedc5fdec1b8741a922c7) --- source3/rpc_parse/parse_samr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 45a1f0e23c..6b0193c6e4 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1720,7 +1720,7 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 **sam, DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i)); init_unistr2(&(*sam)->str[i].uni_grp_name, - entries[i].fullname, UNI_FLAGS_NONE); + entries[i].account_name, UNI_FLAGS_NONE); init_unistr2(&(*sam)->str[i].uni_grp_desc, entries[i].description, UNI_FLAGS_NONE); -- cgit From 44707ad2e00a91f459e80efbe8f362b5853b0a62 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 29 Aug 2005 14:55:40 +0000 Subject: r9739: conver the reg_objects (REGSUBKEY_CTR & REGVAL_CTR) to use the new talloc() features: Note that the REGSUB_CTR and REGVAL_CTR objects *must* be talloc()'d since the methods use the object pointer as the talloc context for internal private data. There is no longer a regXXX_ctr_intit() and regXXX_ctr_destroy() pair of functions. Simply TALLOC_ZERO_P() and TALLOC_FREE() the object. Also had to convert the printer_info_2->NT_PRINTER_DATA field to be talloc()'d as well. This is just a stop on the road to cleaning up the printer memory management. (This used to be commit ef721333ab9639cb5346067497e99fbd0d4425dd) --- source3/rpc_parse/parse_spoolss.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 2677a4a2df..45b683e9c6 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5356,32 +5356,10 @@ error: } BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, - NT_PRINTER_INFO_LEVEL_2 **asc) + NT_PRINTER_INFO_LEVEL_2 *d) { - NT_PRINTER_INFO_LEVEL_2 *d; - time_t time_unix; - DEBUG(7,("Converting from UNICODE to ASCII\n")); - time_unix=time(NULL); - if (*asc==NULL) { - DEBUGADD(8,("allocating memory\n")); - - *asc=SMB_MALLOC_P(NT_PRINTER_INFO_LEVEL_2); - if(*asc == NULL) - return False; - ZERO_STRUCTP(*asc); - - /* we allocate memory iff called from - * addprinter(ex) so we can do one time stuff here. - */ - (*asc)->setuptime=time_unix; - - } - DEBUGADD(8,("start converting\n")); - - d=*asc; - d->attributes=uni->attributes; d->priority=uni->priority; d->default_priority=uni->default_priority; -- cgit From 8c072021efba737539b46e993df0c21a6438a82a Mon Sep 17 00:00:00 2001 From: James Peach Date: Tue, 30 Aug 2005 06:41:32 +0000 Subject: r9780: Clean up a bunch of compiler warnings. (This used to be commit 623d2e69319ffead31a780a4d6156dae45f386d7) --- source3/rpc_parse/parse_lsa.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 884012c9be..d924ea27d1 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -3036,7 +3036,6 @@ static BOOL lsa_io_trustdom_query(const char *desc, prs_struct *ps, int depth, L default: DEBUG(0,("unsupported info-level: %d\n", info->info_class)); return False; - break; } return True; -- cgit From be36d74ec2bbceb4bae848917ec90e8133a905c8 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 1 Sep 2005 13:57:10 +0000 Subject: r9893: fix REG_CREATE_KEY_EX parsing error caused by WinXP clients looking for an not finding a 'Terminal Server' key. Claims to make problems with usrmgr.exe support as well according the Samba ml. Posted on samba@samba.org for review. Reviewed by Thomas Bork (comments integrated into the reg_db.c patch coming up next). (This used to be commit ee54d1abf929e1b5ad2c202469d1c1c744cc30d9) --- source3/rpc_parse/parse_reg.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 3d586b3779..332f38ab26 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -227,7 +227,7 @@ void init_reg_q_create_key_ex(REG_Q_CREATE_KEY_EX *q_c, POLICY_HND *hnd, q_c->ptr2 = 1; init_buf_hdr(&q_c->hdr_sec, sec_buf->len, sec_buf->len); q_c->ptr3 = 1; - q_c->unknown_2 = 0x00000000; + q_c->disposition = TALLOC_P( get_talloc_ctx(), uint32 ); } /******************************************************************* @@ -259,7 +259,7 @@ BOOL reg_io_q_create_key_ex(const char *desc, REG_Q_CREATE_KEY_EX *q_u, if(!prs_align(ps)) return False; - if(!prs_uint32("reserved", ps, depth, &q_u->reserved)) + if(!prs_uint32("options", ps, depth, &q_u->options)) return False; if(!prs_uint32("access", ps, depth, &q_u->access)) return False; @@ -267,16 +267,15 @@ BOOL reg_io_q_create_key_ex(const char *desc, REG_Q_CREATE_KEY_EX *q_u, if(!prs_pointer("sec_info", ps, depth, (void**)&q_u->sec_info, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if(!prs_uint32("ptr2", ps, depth, &q_u->ptr2)) - return False; - if(!reg_io_hdrbuf_sec(q_u->ptr2, &q_u->ptr3, &q_u->hdr_sec, q_u->data, - ps, depth)) - return False; + if ( q_u->sec_info ) { + if(!prs_uint32("ptr2", ps, depth, &q_u->ptr2)) + return False; + if(!reg_io_hdrbuf_sec(q_u->ptr2, &q_u->ptr3, &q_u->hdr_sec, q_u->data, ps, depth)) + return False; + } -#if 0 - if(!prs_uint32("unknown_2", ps, depth, &q_u->unknown_2)) + if(!prs_pointer("disposition", ps, depth, (void**)&q_u->disposition, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; -#endif return True; } -- cgit From adfd5cddf7577ce0db2d46351d02a440db63e4ec Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 2 Sep 2005 00:24:28 +0000 Subject: r9935: Make it easier to find overruns. Jeremy. (This used to be commit e68872d1473ea0557fac1072055a6ed21e5b3d82) --- source3/rpc_parse/parse_prs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 493536eb2a..709a5d39af 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -529,8 +529,10 @@ char *prs_mem_get(prs_struct *ps, uint32 extra_size) * If reading, ensure that we can read the requested size item. */ if (ps->data_offset + extra_size > ps->buffer_size) { - DEBUG(0,("prs_mem_get: reading data of size %u would overrun buffer.\n", - (unsigned int)extra_size )); + DEBUG(0,("prs_mem_get: reading data of size %u would overrun " + "buffer by %u bytes.\n", + (unsigned int)extra_size, + (unsigned int)(ps->data_offset + extra_size - ps->buffer_size) )); return NULL; } } else { -- cgit From b51567624895f83f0274b60fd33cfad20c73db07 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 13 Sep 2005 17:03:03 +0000 Subject: r10205: fix obvious typo in the NET_USER_INFO_3 parsing Guenther (This used to be commit fdba056a2fbcc118e3d0584c280da1ee5f730f22) --- source3/rpc_parse/parse_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index a92f16d648..3a050148c9 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1626,7 +1626,7 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, 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_srv.buffer, ps, depth)) /* logon domain unicode string */ + 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 */ -- cgit From 9d7a70f3a4fc1ab51eabb7bdc8f7b89a2f67ddbb Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 15 Sep 2005 18:35:26 +0000 Subject: r10243: fix net rpc shutdown (missing alignments and sending an invalid UNISTR4 for this request) (This used to be commit cf99e1716dfa880f84abc55062389d03fff05509) --- source3/rpc_parse/parse_reg.c | 12 ++++++++++-- source3/rpc_parse/parse_shutdown.c | 13 ++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 332f38ab26..c9e09b6528 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1484,8 +1484,10 @@ void init_reg_q_shutdown(REG_Q_SHUTDOWN *q_u, const char *msg, q_u->server = TALLOC_P( get_talloc_ctx(), uint16 ); *q_u->server = 0x1; - q_u->message = TALLOC_P( get_talloc_ctx(), UNISTR4 ); - init_unistr4( q_u->message, msg, UNI_FLAGS_NONE ); + if ( msg && *msg ) { + q_u->message = TALLOC_P( get_talloc_ctx(), UNISTR4 ); + init_unistr4( q_u->message, msg, UNI_FLAGS_NONE ); + } q_u->timeout = timeout; @@ -1535,6 +1537,8 @@ BOOL reg_io_q_shutdown(const char *desc, REG_Q_SHUTDOWN *q_u, prs_struct *ps, if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; + if (!prs_align(ps)) + return False; if (!prs_pointer("message", ps, depth, (void**)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; @@ -1593,6 +1597,8 @@ BOOL reg_io_q_shutdown_ex(const char *desc, REG_Q_SHUTDOWN_EX *q_u, prs_struct * if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; + if (!prs_align(ps)) + return False; if (!prs_pointer("message", ps, depth, (void**)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; @@ -1666,6 +1672,8 @@ BOOL reg_io_q_abort_shutdown(const char *desc, REG_Q_ABORT_SHUTDOWN *q_u, if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; + if (!prs_align(ps)) + return False; return True; } diff --git a/source3/rpc_parse/parse_shutdown.c b/source3/rpc_parse/parse_shutdown.c index 00daeaaaee..eaed686012 100644 --- a/source3/rpc_parse/parse_shutdown.c +++ b/source3/rpc_parse/parse_shutdown.c @@ -34,8 +34,10 @@ void init_shutdown_q_init(SHUTDOWN_Q_INIT *q_s, const char *msg, q_s->server = TALLOC_P( get_talloc_ctx(), uint16 ); *q_s->server = 0x1; - q_s->message = TALLOC_P( get_talloc_ctx(), UNISTR4 ); - init_unistr4( q_s->message, msg, UNI_FLAGS_NONE ); + if ( msg && *msg ) { + q_s->message = TALLOC_P( get_talloc_ctx(), UNISTR4 ); + init_unistr4( q_s->message, msg, UNI_FLAGS_NONE ); + } q_s->timeout = timeout; @@ -84,6 +86,8 @@ BOOL shutdown_io_q_init(const char *desc, SHUTDOWN_Q_INIT *q_s, prs_struct *ps, if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; + if (!prs_align(ps)) + return False; if (!prs_pointer("message", ps, depth, (void**)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; @@ -99,7 +103,6 @@ BOOL shutdown_io_q_init(const char *desc, SHUTDOWN_Q_INIT *q_s, prs_struct *ps, if (!prs_uint8("reboot ", ps, depth, &(q_s->reboot))) return False; - return True; } @@ -142,6 +145,8 @@ BOOL shutdown_io_q_init_ex(const char *desc, SHUTDOWN_Q_INIT_EX * q_s, prs_struc if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; + if (!prs_align(ps)) + return False; if (!prs_pointer("message", ps, depth, (void**)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; @@ -214,6 +219,8 @@ BOOL shutdown_io_q_abort(const char *desc, SHUTDOWN_Q_ABORT *q_s, if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; + if (!prs_align(ps)) + return False; return True; } -- cgit From fbaa3fb8d8724b5bdbd7e0efbbf0e7c2149348c7 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 16 Sep 2005 20:59:12 +0000 Subject: r10278: more fixes for bug 3080. Ensure the length on the message string is correct. Windows 2000 is very senstive io this apparently (This used to be commit 0fd02f1477dbf38ddab614b1171ac66124e15cf3) --- source3/rpc_parse/parse_reg.c | 7 +++++++ source3/rpc_parse/parse_shutdown.c | 6 ++++++ 2 files changed, 13 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index c9e09b6528..57157ce17e 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1487,6 +1487,13 @@ void init_reg_q_shutdown(REG_Q_SHUTDOWN *q_u, const char *msg, if ( msg && *msg ) { q_u->message = TALLOC_P( get_talloc_ctx(), UNISTR4 ); init_unistr4( q_u->message, msg, UNI_FLAGS_NONE ); + + /* Win2000 is apparently very sensitive to these lengths */ + /* do a special case here */ + + q_u->message->string->uni_max_len++; + q_u->message->size += 2; + } q_u->timeout = timeout; diff --git a/source3/rpc_parse/parse_shutdown.c b/source3/rpc_parse/parse_shutdown.c index eaed686012..dac33243f1 100644 --- a/source3/rpc_parse/parse_shutdown.c +++ b/source3/rpc_parse/parse_shutdown.c @@ -37,6 +37,12 @@ void init_shutdown_q_init(SHUTDOWN_Q_INIT *q_s, const char *msg, if ( msg && *msg ) { q_s->message = TALLOC_P( get_talloc_ctx(), UNISTR4 ); init_unistr4( q_s->message, msg, UNI_FLAGS_NONE ); + + /* Win2000 is apparently very sensitive to these lengths */ + /* do a special case here */ + + q_s->message->string->uni_max_len++; + q_s->message->size += 2; } q_s->timeout = timeout; -- cgit From c923e981cafcb9abde9bc5123351c34b2bb075d9 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 22 Sep 2005 19:21:27 +0000 Subject: r10432: BUG 3080: fix 'net rpc shutdown' for XP clients (This used to be commit e877a5148783f4ce920a1f21f2081c32ebbbe827) --- source3/rpc_parse/parse_reg.c | 3 ++- source3/rpc_parse/parse_shutdown.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 57157ce17e..be452033fe 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1484,8 +1484,9 @@ void init_reg_q_shutdown(REG_Q_SHUTDOWN *q_u, const char *msg, q_u->server = TALLOC_P( get_talloc_ctx(), uint16 ); *q_u->server = 0x1; + q_u->message = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR4 ); + if ( msg && *msg ) { - q_u->message = TALLOC_P( get_talloc_ctx(), UNISTR4 ); init_unistr4( q_u->message, msg, UNI_FLAGS_NONE ); /* Win2000 is apparently very sensitive to these lengths */ diff --git a/source3/rpc_parse/parse_shutdown.c b/source3/rpc_parse/parse_shutdown.c index dac33243f1..de850ca4cc 100644 --- a/source3/rpc_parse/parse_shutdown.c +++ b/source3/rpc_parse/parse_shutdown.c @@ -34,8 +34,9 @@ void init_shutdown_q_init(SHUTDOWN_Q_INIT *q_s, const char *msg, q_s->server = TALLOC_P( get_talloc_ctx(), uint16 ); *q_s->server = 0x1; + q_s->message = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR4 ); + if ( msg && *msg ) { - q_s->message = TALLOC_P( get_talloc_ctx(), UNISTR4 ); init_unistr4( q_s->message, msg, UNI_FLAGS_NONE ); /* Win2000 is apparently very sensitive to these lengths */ -- cgit From 54abd2aa66069e6baf7769c496f46d9dba18db39 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 30 Sep 2005 17:13:37 +0000 Subject: r10656: BIG merge from trunk. Features not copied over * \PIPE\unixinfo * winbindd's {group,alias}membership new functions * winbindd's lookupsids() functionality * swat (trunk changes to be reverted as per discussion with Deryck) (This used to be commit 939c3cb5d78e3a2236209b296aa8aba8bdce32d3) --- source3/rpc_parse/parse_buffer.c | 2 +- source3/rpc_parse/parse_dfs.c | 2 - source3/rpc_parse/parse_ds.c | 28 +- source3/rpc_parse/parse_echo.c | 2 - source3/rpc_parse/parse_eventlog.c | 84 ++---- source3/rpc_parse/parse_misc.c | 8 +- source3/rpc_parse/parse_net.c | 54 ++-- source3/rpc_parse/parse_ntsvcs.c | 415 +++++++++++++++++++++++++++++ source3/rpc_parse/parse_prs.c | 146 ++++++----- source3/rpc_parse/parse_reg.c | 2 +- source3/rpc_parse/parse_rpc.c | 518 ++++--------------------------------- source3/rpc_parse/parse_samr.c | 6 +- source3/rpc_parse/parse_svcctl.c | 305 ++++++++++++++++++---- 13 files changed, 881 insertions(+), 691 deletions(-) create mode 100644 source3/rpc_parse/parse_ntsvcs.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index ff2a7cc2f6..36d8eda847 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -106,7 +106,7 @@ BOOL prs_rpcbuffer_p(const char *desc, prs_struct *ps, int depth, RPC_BUFFER **b /* caputure the pointer value to stream */ - data_p = (uint32) *buffer; + data_p = *buffer ? 0xf000baaa : 0; if ( !prs_uint32("ptr", ps, depth, &data_p )) return False; diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index 3f7b2a4cd5..f102e95004 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -22,8 +22,6 @@ */ #include "includes.h" -#include "nterr.h" -#include "rpc_parse.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index 9155419ae4..c613145222 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -24,12 +24,13 @@ /************************************************************************ ************************************************************************/ -static BOOL ds_io_dominfobasic( const char *desc, prs_struct *ps, int depth, DSROLE_PRIMARY_DOMAIN_INFO_BASIC **basic) +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) ) + if ( UNMARSHALLING(ps) ) { p = *basic = PRS_ALLOC_MEM(ps, DSROLE_PRIMARY_DOMAIN_INFO_BASIC, 1); + } if ( !p ) return False; @@ -75,7 +76,7 @@ static BOOL ds_io_dominfobasic( const char *desc, prs_struct *ps, int depth, DSR /************************************************************************ ************************************************************************/ -BOOL ds_io_q_getprimdominfo( const char *desc, prs_struct *ps, int depth, DS_Q_GETPRIMDOMINFO *q_u) +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++; @@ -92,7 +93,7 @@ BOOL ds_io_q_getprimdominfo( const char *desc, prs_struct *ps, int depth, DS_Q_G /************************************************************************ ************************************************************************/ -BOOL ds_io_r_getprimdominfo( const char *desc, prs_struct *ps, int depth, DS_R_GETPRIMDOMINFO *r_u) +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++; @@ -114,7 +115,7 @@ BOOL ds_io_r_getprimdominfo( const char *desc, prs_struct *ps, int depth, DS_R_G switch ( r_u->level ) { case DsRolePrimaryDomainInfoBasic: - if ( !ds_io_dominfobasic( "dominfobasic", ps, depth, &r_u->info.basic ) ) + if ( !ds_io_dominfobasic( "dominfobasic", &r_u->info.basic, ps, depth) ) return False; break; default: @@ -135,8 +136,7 @@ BOOL ds_io_r_getprimdominfo( const char *desc, prs_struct *ps, int depth, DS_R_G 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 ) +BOOL init_q_ds_enum_domain_trusts( DS_Q_ENUM_DOM_TRUSTS *q, const char *server, uint32 flags ) { q->flags = flags; @@ -153,7 +153,7 @@ BOOL init_q_ds_enum_domain_trusts( DS_Q_ENUM_DOM_TRUSTS *q, const char *server, /************************************************************************ ************************************************************************/ -static BOOL ds_io_domain_trusts( const char *desc, prs_struct *ps, int depth, DS_DOMAIN_TRUSTS *trust) +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++; @@ -188,7 +188,7 @@ static BOOL ds_io_domain_trusts( const char *desc, prs_struct *ps, int depth, DS /************************************************************************ ************************************************************************/ -static BOOL ds_io_dom_trusts_ctr( const char *desc, prs_struct *ps, int depth, DS_DOMAIN_TRUSTS_CTR *ctr) +static BOOL ds_io_dom_trusts_ctr( const char *desc, DS_DOMAIN_TRUSTS_CTR *ctr, prs_struct *ps, int depth) { int i; @@ -217,7 +217,7 @@ static BOOL ds_io_dom_trusts_ctr( const char *desc, prs_struct *ps, int depth, D we need another loop to read the UNISTR2's and SID's */ for ( i=0; imax_count;i++ ) { - if ( !ds_io_domain_trusts("domain_trusts", ps, depth, &ctr->trusts[i] ) ) + if ( !ds_io_domain_trusts("domain_trusts", &ctr->trusts[i], ps, depth) ) return False; } @@ -248,7 +248,7 @@ static BOOL ds_io_dom_trusts_ctr( const char *desc, prs_struct *ps, int depth, D initialize a DS_ENUM_DOM_TRUSTS request ************************************************************************/ -BOOL ds_io_q_enum_domain_trusts( const char *desc, prs_struct *ps, int depth, DS_Q_ENUM_DOM_TRUSTS *q_u) +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++; @@ -274,7 +274,7 @@ BOOL ds_io_q_enum_domain_trusts( const char *desc, prs_struct *ps, int depth, DS /************************************************************************ ************************************************************************/ -BOOL ds_io_r_enum_domain_trusts( const char *desc, prs_struct *ps, int depth, DS_R_ENUM_DOM_TRUSTS *r_u) +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++; @@ -286,7 +286,7 @@ BOOL ds_io_r_enum_domain_trusts( const char *desc, prs_struct *ps, int depth, DS return False; if ( r_u->num_domains ) { - if ( !ds_io_dom_trusts_ctr("domains", ps, depth, &r_u->domains ) ) + if ( !ds_io_dom_trusts_ctr("domains", &r_u->domains, ps, depth) ) return False; } @@ -298,5 +298,3 @@ BOOL ds_io_r_enum_domain_trusts( const char *desc, prs_struct *ps, int depth, DS return True; } - - diff --git a/source3/rpc_parse/parse_echo.c b/source3/rpc_parse/parse_echo.c index b4aa8de24a..48dda7b171 100644 --- a/source3/rpc_parse/parse_echo.c +++ b/source3/rpc_parse/parse_echo.c @@ -21,8 +21,6 @@ */ #include "includes.h" -#include "nterr.h" -#include "rpc_parse.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 734f52fffb..1b57272ca4 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -23,9 +23,24 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/* - * called from eventlog_q_open_eventlog (srv_eventlog.c) - */ +/******************************************************************** +********************************************************************/ + +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) @@ -33,62 +48,28 @@ BOOL eventlog_io_q_open_eventlog(const char *desc, EVENTLOG_Q_OPEN_EVENTLOG *q_u if(q_u == NULL) return False; - /** Data format seems to be: - UNKNOWN structure - uint32 unknown - uint16 unknown - uint16 unknown - Eventlog name - uint16 eventlog name length - uint16 eventlog name size - Character Array - uint32 unknown - uint32 max count - uint32 offset - uint32 actual count - UNISTR2 log file name - Server Name - uint16 server name length - uint16 server name size - Character Array - UNISTR2 server name - */ - prs_debug(ps, depth, desc, "eventlog_io_q_open_eventlog"); depth++; if(!prs_align(ps)) return False; - /* Munch unknown bits */ - - if(!prs_uint32("", ps, depth, &q_u->unknown1)) - return False; - if(!prs_uint16("", ps, depth, &q_u->unknown2)) - return False; - if(!prs_uint16("", ps, depth, &q_u->unknown3)) - return False; - if(!prs_align(ps)) + if ( !prs_pointer("", ps, depth, (void**)&q_u->unknown0, sizeof(EVENTLOG_OPEN_UNKNOWN0), (PRS_POINTER_CAST)prs_ev_open_unknown0)) return False; - /* Get name of log source */ - - if(!prs_uint16("sourcename_length", ps, depth, &q_u->sourcename_length)) - return False; - if(!prs_uint16("sourcename_size", ps, depth, &q_u->sourcename_size)) + if ( !prs_unistr4("logname", ps, depth, &q_u->logname) ) return False; - if(!prs_uint32("sourcename_ptr", ps, depth, &q_u->sourcename_ptr)) + if ( !prs_align(ps) ) return False; - if(!smb_io_unistr2("", &q_u->sourcename, q_u->sourcename_ptr, ps, depth)) + + if ( !prs_unistr4("servername", ps, depth, &q_u->servername) ) return False; - if(!prs_align(ps)) + if ( !prs_align(ps) ) return False; - /* Get server name */ - - if(!prs_uint32("servername_ptr", ps, depth, &q_u->servername_ptr)) + if ( !prs_uint32("unknown1", ps, depth, &q_u->unknown1) ) return False; - if(!smb_io_unistr2("", &q_u->servername, q_u->servername_ptr, ps, depth)) + if ( !prs_uint32("unknown2", ps, depth, &q_u->unknown2) ) return False; return True; @@ -424,17 +405,8 @@ BOOL eventlog_io_q_clear_eventlog(const char *desc, EVENTLOG_Q_CLEAR_EVENTLOG *q return False; if(!(smb_io_pol_hnd("log handle", &(q_u->handle), ps, depth))) return False; - if(!prs_align(ps)) - return False; - if(!(prs_uint32("unknown1", ps, depth, &q_u->unknown1))) - return False; - if(!(prs_uint16("backup_file_length", ps, depth, &q_u->backup_file_length))) - return False; - if(!(prs_uint16("backup_file_size", ps, depth, &q_u->backup_file_size))) - return False; - if(!prs_uint32("backup_file_ptr", ps, depth, &q_u->backup_file_ptr)) - return False; - if(!smb_io_unistr2("backup file", &q_u->backup_file, q_u->backup_file_ptr, ps, depth)) + + if ( !prs_unistr4("backupfile", ps, depth, &q_u->backupfile) ) return False; return True; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 921e366f11..8bbb97f226 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -296,7 +296,7 @@ BOOL smb_io_dom_sid2_p(const char *desc, prs_struct *ps, int depth, DOM_SID2 **s /* caputure the pointer value to stream */ - data_p = (uint32) *sid2; + data_p = *sid2 ? 0xf000baaa : 0; if ( !prs_uint32("dom_sid2_p", ps, depth, &data_p )) return False; @@ -1003,7 +1003,7 @@ BOOL prs_io_unistr2_p(const char *desc, prs_struct *ps, int depth, UNISTR2 **uni /* caputure the pointer value to stream */ - data_p = (uint32) *uni2; + data_p = *uni2 ? 0xf000baaa : 0; if ( !prs_uint32("ptr", ps, depth, &data_p )) return False; @@ -1038,7 +1038,7 @@ BOOL prs_io_unistr2(const char *desc, prs_struct *ps, int depth, UNISTR2 *uni2 ) /* just pass off to smb_io_unstr2() passing the uni2 address as the pointer (like you would expect) */ - return smb_io_unistr2( desc, uni2, (uint32)uni2, ps, depth ); + return smb_io_unistr2( desc, uni2, uni2 ? 1 : 0, ps, depth ); } /******************************************************************* @@ -1139,7 +1139,7 @@ BOOL prs_unistr4_str(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) } /******************************************************************* - Reads or writes a UNISTR2_ARRAY structure. + Reads or writes a UNISTR4_ARRAY structure. ********************************************************************/ BOOL prs_unistr4_array(const char *desc, prs_struct *ps, int depth, UNISTR4_ARRAY *array ) diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 3a050148c9..35533e360a 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -671,7 +671,7 @@ BOOL net_io_q_trust_dom(const char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct void init_q_req_chal(NET_Q_REQ_CHAL *q_c, const char *logon_srv, const char *logon_clnt, - DOM_CHAL *clnt_chal) + const DOM_CHAL *clnt_chal) { DEBUG(5,("init_q_req_chal: %d\n", __LINE__)); @@ -860,7 +860,7 @@ BOOL net_io_r_auth_2(const char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int de 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, - DOM_CHAL *clnt_chal, uint32 clnt_flgs) + const DOM_CHAL *clnt_chal, uint32 clnt_flgs) { DEBUG(5,("init_q_auth_3: %d\n", __LINE__)); @@ -1496,7 +1496,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, ********************************************************************/ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, - int depth, uint16 validation_level) + int depth, uint16 validation_level, BOOL kerb_validation_level) { unsigned int i; @@ -1595,6 +1595,18 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, } } + /* 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 */ @@ -1636,6 +1648,11 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, 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; @@ -1724,8 +1741,10 @@ BOOL net_io_r_sam_logon(const char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, 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 (&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; @@ -1733,11 +1752,11 @@ BOOL net_io_r_sam_logon(const char *desc, NET_R_SAM_LOGON *r_l, prs_struct *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)) + 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)) + if(!net_io_user_info3("", r_l->user, ps, depth, r_l->switch_value, False)) return False; } #endif @@ -2139,9 +2158,8 @@ BOOL make_sam_account_info(SAM_ACCOUNT_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], - SAM_ACCOUNT_INFO * info, prs_struct *ps, - int depth) +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; @@ -2295,7 +2313,7 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], if (ps->io) { /* reading */ - if (!prs_hash1(ps, ps->data_offset, sess_key, len)) + if (!prs_hash1(ps, ps->data_offset, len)) return False; } if (!net_io_sam_passwd_info("pass", &info->pass, @@ -2305,7 +2323,7 @@ static BOOL net_io_sam_account_info(const char *desc, uint8 sess_key[16], if (!ps->io) { /* writing */ - if (!prs_hash1(ps, old_offset, sess_key, len)) + if (!prs_hash1(ps, old_offset, len)) return False; } } @@ -2834,7 +2852,7 @@ static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_delta_ctr(const char *desc, uint8 sess_key[16], +static BOOL net_io_sam_delta_ctr(const char *desc, SAM_DELTA_CTR * delta, uint16 type, prs_struct *ps, int depth) { @@ -2859,7 +2877,7 @@ static BOOL net_io_sam_delta_ctr(const char *desc, uint8 sess_key[16], break; case SAM_DELTA_ACCOUNT_INFO: - if (!net_io_sam_account_info("", sess_key, &delta->account_info, ps, depth)) + if (!net_io_sam_account_info("", &delta->account_info, ps, depth)) return False; break; @@ -2912,7 +2930,7 @@ static BOOL net_io_sam_delta_ctr(const char *desc, uint8 sess_key[16], /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL net_io_r_sam_sync(const char *desc, uint8 sess_key[16], +BOOL net_io_r_sam_sync(const char *desc, NET_R_SAM_SYNC * r_s, prs_struct *ps, int depth) { uint32 i; @@ -2976,7 +2994,7 @@ BOOL net_io_r_sam_sync(const char *desc, uint8 sess_key[16], for (i = 0; i < r_s->num_deltas2; i++) { if (!net_io_sam_delta_ctr( - "", sess_key, &r_s->deltas[i], + "", &r_s->deltas[i], r_s->hdr_deltas[i].type3, ps, depth)) { DEBUG(0, ("hmm, failed on i=%d\n", i)); @@ -3048,7 +3066,7 @@ BOOL net_io_q_sam_deltas(const char *desc, NET_Q_SAM_DELTAS *q_s, prs_struct *ps /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL net_io_r_sam_deltas(const char *desc, uint8 sess_key[16], +BOOL net_io_r_sam_deltas(const char *desc, NET_R_SAM_DELTAS *r_s, prs_struct *ps, int depth) { unsigned int i; @@ -3104,7 +3122,7 @@ BOOL net_io_r_sam_deltas(const char *desc, uint8 sess_key[16], for (i = 0; i < r_s->num_deltas; i++) { if (!net_io_sam_delta_ctr( - "", sess_key, + "", &r_s->deltas[i], r_s->hdr_deltas[i].type2, ps, depth)) diff --git a/source3/rpc_parse/parse_ntsvcs.c b/source3/rpc_parse/parse_ntsvcs.c new file mode 100644 index 0000000000..f2e4456025 --- /dev/null +++ b/source3/rpc_parse/parse_ntsvcs.c @@ -0,0 +1,415 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * 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 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + +/******************************************************************* +********************************************************************/ + +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) + return False; + + prs_debug(ps, depth, desc, "ntsvcs_io_q_get_device_list"); + 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("buffer_size", ps, depth, &q_u->buffer_size) ) + return False; + if ( !prs_uint32("flags", ps, depth, &q_u->flags) ) + return False; + + return True; + +} + +/******************************************************************* +********************************************************************/ + +BOOL ntsvcs_io_r_get_device_list(const char *desc, NTSVCS_R_GET_DEVICE_LIST *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_io_unistr2("devicepath", ps, depth, &r_u->devicepath) ) + return False; + if(!prs_align(ps)) + 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 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) + return False; + + prs_debug(ps, depth, desc, "ntsvcs_io_q_get_device_reg_property"); + 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("property", ps, depth, &q_u->property) ) + return False; + if ( !prs_uint32("unknown2", ps, depth, &q_u->unknown2) ) + return False; + if ( !prs_uint32("buffer_size1", ps, depth, &q_u->buffer_size1) ) + return False; + if ( !prs_uint32("buffer_size2", ps, depth, &q_u->buffer_size2) ) + return False; + if ( !prs_uint32("unknown5", ps, depth, &q_u->unknown5) ) + return False; + + return True; + +} + +/******************************************************************* +********************************************************************/ + +BOOL ntsvcs_io_r_get_device_reg_property(const char *desc, NTSVCS_R_GET_DEVICE_REG_PROPERTY *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 ( !prs_uint32("unknown1", ps, depth, &r_u->unknown1) ) + return False; + + if ( !smb_io_regval_buffer("value", ps, depth, &r_u->value) ) + return False; + if ( !prs_align(ps) ) + return False; + + if ( !prs_uint32("size", ps, depth, &r_u->size) ) + 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 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(get_talloc_ctx(), uint8, q_u->buffer_size ); + + 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) ) + r_u->buffer = TALLOC_ARRAY(get_talloc_ctx(), uint8, r_u->buffer_size ); + + 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_prs.c b/source3/rpc_parse/parse_prs.c index 709a5d39af..d174bad444 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -34,7 +34,6 @@ void prs_dump(char *name, int v, prs_struct *ps) prs_dump_region(name, v, ps, ps->data_offset, ps->buffer_size); } - /** * Dump from the start of the prs to the current location. **/ @@ -43,7 +42,6 @@ void prs_dump_before(char *name, int v, prs_struct *ps) prs_dump_region(name, v, ps, 0, ps->data_offset); } - /** * Dump everything from the start of the prs up to the current location. **/ @@ -52,6 +50,7 @@ void prs_dump_region(char *name, int v, prs_struct *ps, { int fd, i; pstring fname; + ssize_t sz; if (DEBUGLEVEL < 50) return; for (i=1;i<100;i++) { if (v != -1) { @@ -63,26 +62,28 @@ void prs_dump_region(char *name, int v, prs_struct *ps, if (fd != -1 || errno != EEXIST) break; } if (fd != -1) { - write(fd, ps->data_p + from_off, to_off - from_off); - close(fd); - DEBUG(0,("created %s\n", fname)); + sz = write(fd, ps->data_p + from_off, to_off - from_off); + i = close(fd); + if ( (sz != to_off-from_off) || (i != 0) ) { + DEBUG(0,("Error writing/closing %s: %ld!=%ld %d\n", fname, (unsigned long)sz, (unsigned long)to_off-from_off, i )); + } else { + DEBUG(0,("created %s\n", fname)); + } } } - - /******************************************************************* - debug output for parsing info. + Debug output for parsing info - XXXX side-effect of this function is to increase the debug depth XXXX + XXXX side-effect of this function is to increase the debug depth XXXX. + +********************************************************************/ - ********************************************************************/ void prs_debug(prs_struct *ps, int depth, const char *desc, const char *fn_name) { DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(depth), ps->data_offset, fn_name, desc)); } - /** * Initialise an expandable parse structure. * @@ -91,6 +92,7 @@ void prs_debug(prs_struct *ps, int depth, const char *desc, const char *fn_name) * * @return False if allocation fails, otherwise True. **/ + BOOL prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, BOOL io) { ZERO_STRUCTP(ps); @@ -111,6 +113,9 @@ BOOL prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, BOOL io) } memset(ps->data_p, '\0', (size_t)size); ps->is_dynamic = True; /* We own this memory. */ + } else if (MARSHALLING(ps)) { + /* If size is zero and we're marshalling we should allocate memory on demand. */ + ps->is_dynamic = True; } return True; @@ -254,7 +259,7 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) * is greater. */ - new_size = MAX(MAX_PDU_FRAG_LEN,extra_space); + new_size = MAX(RPC_MAX_PDU_FRAG_LEN,extra_space); if((new_data = SMB_MALLOC(new_size)) == NULL) { DEBUG(0,("prs_grow: Malloc failure for size %u.\n", (unsigned int)new_size)); @@ -398,7 +403,7 @@ BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uin Append the data from a buffer into a parse_struct. ********************************************************************/ -BOOL prs_copy_data_in(prs_struct *dst, char *src, uint32 len) +BOOL prs_copy_data_in(prs_struct *dst, const char *src, uint32 len) { if (len == 0) return True; @@ -564,6 +569,15 @@ void prs_force_dynamic(prs_struct *ps) ps->is_dynamic=True; } +/******************************************************************* + Associate a session key with a parse struct. + ********************************************************************/ + +void prs_set_session_key(prs_struct *ps, const char sess_key[16]) +{ + ps->sess_key = sess_key; +} + /******************************************************************* Stream a uint8. ********************************************************************/ @@ -596,9 +610,9 @@ BOOL prs_pointer( const char *name, prs_struct *ps, int depth, { uint32 data_p; - /* caputure the pointer value to stream */ + /* output f000baaa to stream if the pointer is non-zero. */ - data_p = (uint32) *data; + data_p = *data ? 0xf000baaa : 0; if ( !prs_uint32("ptr", ps, depth, &data_p )) return False; @@ -1387,7 +1401,7 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *me hash a stream. ********************************************************************/ -BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16], int len) +BOOL prs_hash1(prs_struct *ps, uint32 offset, int len) { char *q; @@ -1396,10 +1410,10 @@ BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16], int len) #ifdef DEBUG_PASSWORD DEBUG(100, ("prs_hash1\n")); - dump_data(100, sess_key, 16); + dump_data(100, ps->sess_key, 16); dump_data(100, q, len); #endif - SamOEMhash((uchar *) q, sess_key, len); + SamOEMhash((uchar *) q, ps->sess_key, len); #ifdef DEBUG_PASSWORD dump_data(100, q, len); @@ -1413,9 +1427,9 @@ BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16], int len) MD5 it with the session key. ********************************************************************/ -static void netsec_digest(struct netsec_auth_struct *a, - int auth_flags, - RPC_AUTH_NETSEC_CHK * verf, +static void schannel_digest(struct schannel_auth_struct *a, + enum pipe_auth_level auth_level, + RPC_AUTH_SCHANNEL_CHK * verf, char *data, size_t data_len, uchar digest_final[16]) { @@ -1429,7 +1443,7 @@ static void netsec_digest(struct netsec_auth_struct *a, out of order */ MD5Update(&ctx3, zeros, sizeof(zeros)); MD5Update(&ctx3, verf->sig, sizeof(verf->sig)); - if (auth_flags & AUTH_PIPE_SEAL) { + if (auth_level == PIPE_AUTH_LEVEL_PRIVACY) { MD5Update(&ctx3, verf->confounder, sizeof(verf->confounder)); } MD5Update(&ctx3, (const unsigned char *)data, data_len); @@ -1445,8 +1459,8 @@ static void netsec_digest(struct netsec_auth_struct *a, Calculate the key with which to encode the data payload ********************************************************************/ -static void netsec_get_sealing_key(struct netsec_auth_struct *a, - RPC_AUTH_NETSEC_CHK *verf, +static void schannel_get_sealing_key(struct schannel_auth_struct *a, + RPC_AUTH_SCHANNEL_CHK *verf, uchar sealing_key[16]) { static uchar zeros[4]; @@ -1473,8 +1487,8 @@ static void netsec_get_sealing_key(struct netsec_auth_struct *a, Encode or Decode the sequence number (which is symmetric) ********************************************************************/ -static void netsec_deal_with_seq_num(struct netsec_auth_struct *a, - RPC_AUTH_NETSEC_CHK *verf) +static void schannel_deal_with_seq_num(struct schannel_auth_struct *a, + RPC_AUTH_SCHANNEL_CHK *verf) { static uchar zeros[4]; uchar sequence_key[16]; @@ -1493,10 +1507,10 @@ static void netsec_deal_with_seq_num(struct netsec_auth_struct *a, } /******************************************************************* -creates an RPC_AUTH_NETSEC_CHK structure. +creates an RPC_AUTH_SCHANNEL_CHK structure. ********************************************************************/ -static BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, +static BOOL init_rpc_auth_schannel_chk(RPC_AUTH_SCHANNEL_CHK * chk, const uchar sig[8], const uchar packet_digest[8], const uchar seq_num[8], const uchar confounder[8]) @@ -1513,15 +1527,15 @@ static BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, } /******************************************************************* - Encode a blob of data using the netsec (schannel) alogrithm, also produceing + Encode a blob of data using the schannel alogrithm, also produceing a checksum over the original data. We currently only support signing and sealing togeather - the signing-only code is close, but not quite compatible with what MS does. ********************************************************************/ -void netsec_encode(struct netsec_auth_struct *a, int auth_flags, - enum netsec_direction direction, - RPC_AUTH_NETSEC_CHK * verf, +void schannel_encode(struct schannel_auth_struct *a, enum pipe_auth_level auth_level, + enum schannel_direction direction, + RPC_AUTH_SCHANNEL_CHK * verf, char *data, size_t data_len) { uchar digest_final[16]; @@ -1529,16 +1543,16 @@ void netsec_encode(struct netsec_auth_struct *a, int auth_flags, uchar seq_num[8]; static const uchar nullbytes[8]; - static const uchar netsec_seal_sig[8] = NETSEC_SEAL_SIGNATURE; - static const uchar netsec_sign_sig[8] = NETSEC_SIGN_SIGNATURE; - const uchar *netsec_sig = NULL; + static const uchar schannel_seal_sig[8] = SCHANNEL_SEAL_SIGNATURE; + static const uchar schannel_sign_sig[8] = SCHANNEL_SIGN_SIGNATURE; + const uchar *schannel_sig = NULL; - DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%lu\n", a->seq_num, (unsigned long)data_len)); + DEBUG(10,("SCHANNEL: schannel_encode seq_num=%d data_len=%lu\n", a->seq_num, (unsigned long)data_len)); - if (auth_flags & AUTH_PIPE_SEAL) { - netsec_sig = netsec_seal_sig; - } else if (auth_flags & AUTH_PIPE_SIGN) { - netsec_sig = netsec_sign_sig; + if (auth_level == PIPE_AUTH_LEVEL_PRIVACY) { + schannel_sig = schannel_seal_sig; + } else { + schannel_sig = schannel_sign_sig; } /* fill the 'confounder' with random data */ @@ -1559,18 +1573,18 @@ void netsec_encode(struct netsec_auth_struct *a, int auth_flags, dump_data_pw("verf->seq_num:\n", seq_num, sizeof(verf->seq_num)); - init_rpc_auth_netsec_chk(verf, netsec_sig, nullbytes, + init_rpc_auth_schannel_chk(verf, schannel_sig, nullbytes, seq_num, confounder); /* produce a digest of the packet to prove it's legit (before we seal it) */ - netsec_digest(a, auth_flags, verf, data, data_len, digest_final); + schannel_digest(a, auth_level, verf, data, data_len, digest_final); memcpy(verf->packet_digest, digest_final, sizeof(verf->packet_digest)); - if (auth_flags & AUTH_PIPE_SEAL) { + if (auth_level == PIPE_AUTH_LEVEL_PRIVACY) { uchar sealing_key[16]; /* get the key to encode the data with */ - netsec_get_sealing_key(a, verf, sealing_key); + schannel_get_sealing_key(a, verf, sealing_key); /* encode the verification data */ dump_data_pw("verf->confounder:\n", verf->confounder, sizeof(verf->confounder)); @@ -1587,35 +1601,35 @@ void netsec_encode(struct netsec_auth_struct *a, int auth_flags, /* encode the sequence number (key based on packet digest) */ /* needs to be done after the sealing, as the original version is used in the sealing stuff... */ - netsec_deal_with_seq_num(a, verf); + schannel_deal_with_seq_num(a, verf); return; } /******************************************************************* - Decode a blob of data using the netsec (schannel) alogrithm, also verifiying + Decode a blob of data using the schannel alogrithm, also verifiying a checksum over the original data. We currently can verify signed messages, as well as decode sealed messages ********************************************************************/ -BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, - enum netsec_direction direction, - RPC_AUTH_NETSEC_CHK * verf, char *data, size_t data_len) +BOOL schannel_decode(struct schannel_auth_struct *a, enum pipe_auth_level auth_level, + enum schannel_direction direction, + RPC_AUTH_SCHANNEL_CHK * verf, char *data, size_t data_len) { uchar digest_final[16]; - static const uchar netsec_seal_sig[8] = NETSEC_SEAL_SIGNATURE; - static const uchar netsec_sign_sig[8] = NETSEC_SIGN_SIGNATURE; - const uchar *netsec_sig = NULL; + static const uchar schannel_seal_sig[8] = SCHANNEL_SEAL_SIGNATURE; + static const uchar schannel_sign_sig[8] = SCHANNEL_SIGN_SIGNATURE; + const uchar *schannel_sig = NULL; uchar seq_num[8]; - DEBUG(10,("SCHANNEL: netsec_encode seq_num=%d data_len=%lu\n", a->seq_num, (unsigned long)data_len)); + DEBUG(10,("SCHANNEL: schannel_decode seq_num=%d data_len=%lu\n", a->seq_num, (unsigned long)data_len)); - if (auth_flags & AUTH_PIPE_SEAL) { - netsec_sig = netsec_seal_sig; - } else if (auth_flags & AUTH_PIPE_SIGN) { - netsec_sig = netsec_sign_sig; + if (auth_level == PIPE_AUTH_LEVEL_PRIVACY) { + schannel_sig = schannel_seal_sig; + } else { + schannel_sig = schannel_sign_sig; } /* Create the expected sequence number for comparison */ @@ -1630,7 +1644,7 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, break; } - DEBUG(10,("SCHANNEL: netsec_decode seq_num=%d data_len=%lu\n", a->seq_num, (unsigned long)data_len)); + DEBUG(10,("SCHANNEL: schannel_decode seq_num=%d data_len=%lu\n", a->seq_num, (unsigned long)data_len)); dump_data_pw("a->sess_key:\n", a->sess_key, sizeof(a->sess_key)); dump_data_pw("seq_num:\n", seq_num, sizeof(seq_num)); @@ -1638,7 +1652,7 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, /* extract the sequence number (key based on supplied packet digest) */ /* needs to be done before the sealing, as the original version is used in the sealing stuff... */ - netsec_deal_with_seq_num(a, verf); + schannel_deal_with_seq_num(a, verf); if (memcmp(verf->seq_num, seq_num, sizeof(seq_num))) { /* don't even bother with the below if the sequence number is out */ @@ -1646,7 +1660,7 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, digest, as supplied by the client. We check that it's a valid checksum after the decode, below */ - DEBUG(2, ("netsec_decode: FAILED: packet sequence number:\n")); + DEBUG(2, ("schannel_decode: FAILED: packet sequence number:\n")); dump_data(2, (const char*)verf->seq_num, sizeof(verf->seq_num)); DEBUG(2, ("should be:\n")); dump_data(2, (const char*)seq_num, sizeof(seq_num)); @@ -1654,20 +1668,20 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, return False; } - if (memcmp(verf->sig, netsec_sig, sizeof(verf->sig))) { + if (memcmp(verf->sig, schannel_sig, sizeof(verf->sig))) { /* Validate that the other end sent the expected header */ - DEBUG(2, ("netsec_decode: FAILED: packet header:\n")); + DEBUG(2, ("schannel_decode: FAILED: packet header:\n")); dump_data(2, (const char*)verf->sig, sizeof(verf->sig)); DEBUG(2, ("should be:\n")); - dump_data(2, (const char*)netsec_sig, sizeof(netsec_sig)); + dump_data(2, (const char*)schannel_sig, sizeof(schannel_sig)); return False; } - if (auth_flags & AUTH_PIPE_SEAL) { + if (auth_level == PIPE_AUTH_LEVEL_PRIVACY) { uchar sealing_key[16]; /* get the key to extract the data with */ - netsec_get_sealing_key(a, verf, sealing_key); + schannel_get_sealing_key(a, verf, sealing_key); /* extract the verification data */ dump_data_pw("verf->confounder:\n", verf->confounder, @@ -1684,7 +1698,7 @@ BOOL netsec_decode(struct netsec_auth_struct *a, int auth_flags, } /* digest includes 'data' after unsealing */ - netsec_digest(a, auth_flags, verf, data, data_len, digest_final); + schannel_digest(a, auth_level, verf, data, data_len, digest_final); dump_data_pw("Calculated digest:\n", digest_final, sizeof(digest_final)); diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index be452033fe..295fead103 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -33,7 +33,7 @@ Fill in a REGVAL_BUFFER for the data given a REGISTRY_VALUE *******************************************************************/ -static uint32 reg_init_regval_buffer( REGVAL_BUFFER *buf2, REGISTRY_VALUE *val ) +uint32 reg_init_regval_buffer( REGVAL_BUFFER *buf2, REGISTRY_VALUE *val ) { uint32 real_size = 0; diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index ce081b92e8..ea4ec2c863 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -191,6 +191,26 @@ interface/version dce/rpc pipe identification }, 0x00 \ } +#define SYNT_UNIXINFO_V0 \ +{ \ + { \ + 0x9c54e310, 0xa955, 0x4885, \ + { 0xbd, 0x31 }, \ + { 0x78, 0x78, \ + 0x71, 0x47, 0xdf, 0xa6 } \ + }, 0x00 \ +} + +#define SYNT_NTSVCS_V1 \ +{ \ + { \ + 0x8d9f4e40, 0xa03d, 0x11ce, \ + { 0x8f, 0x69}, \ + { 0x08, 0x00, \ + 0x3e, 0x30, 0x05, 0x1b } \ + }, 0x01 \ +} + /* * IMPORTANT!! If you update this structure, make sure to * update the index #defines in smb.h. @@ -212,9 +232,19 @@ const struct pipe_id_info pipe_names [] = { PIPE_SHUTDOWN, SYNT_SHUTDOWN_V1 , PIPE_SHUTDOWN , TRANS_SYNT_V2 }, { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_EVENTLOG, SYNT_EVENTLOG_V0 , PIPE_EVENTLOG , TRANS_SYNT_V2 }, + { PIPE_NTSVCS , SYNT_NTSVCS_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; +/**************************************************************************** + Return the pipe name from the index. + ****************************************************************************/ + +const char *cli_get_pipe_name(int pipe_idx) +{ + return &pipe_names[pipe_idx].client_pipe[5]; +} + /******************************************************************* Inits an RPC_HDR structure. ********************************************************************/ @@ -658,8 +688,8 @@ void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, uint8 auth_pad_len, uint32 auth_context_id) { - rai->auth_type = auth_type; /* nt lm ssp 0x0a */ - rai->auth_level = auth_level; /* 0x06 */ + rai->auth_type = auth_type; + rai->auth_level = auth_level; rai->auth_pad_len = auth_pad_len; rai->auth_reserved = 0; rai->auth_context_id = auth_context_id; @@ -680,9 +710,9 @@ BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, in if(!prs_align(ps)) return False; - if(!prs_uint8 ("auth_type ", ps, depth, &rai->auth_type)) /* 0x0a nt lm ssp */ + if(!prs_uint8 ("auth_type ", ps, depth, &rai->auth_type)) return False; - if(!prs_uint8 ("auth_level ", ps, depth, &rai->auth_level)) /* 0x06 */ + if(!prs_uint8 ("auth_level ", ps, depth, &rai->auth_level)) return False; if(!prs_uint8 ("auth_pad_len ", ps, depth, &rai->auth_pad_len)) return False; @@ -694,43 +724,6 @@ BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, in return True; } - -/******************************************************************* - Init an RPC_HDR_AUTHA structure. -********************************************************************/ - -void init_rpc_hdr_autha(RPC_HDR_AUTHA *rai, - uint16 max_tsize, uint16 max_rsize, - RPC_HDR_AUTH *auth) -{ - rai->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ - rai->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ - rai->auth = *auth; -} - -/******************************************************************* - Reads or writes an RPC_HDR_AUTHA structure. -********************************************************************/ - -BOOL smb_io_rpc_hdr_autha(const char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) -{ - if (rai == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_hdr_autha"); - depth++; - - if(!prs_uint16("max_tsize ", ps, depth, &rai->max_tsize)) - return False; - if(!prs_uint16("max_rsize ", ps, depth, &rai->max_rsize)) - return False; - - if(!smb_io_rpc_hdr_auth("auth", &rai->auth, ps, depth)) - return False; - - return True; -} - /******************************************************************* Checks an RPC_AUTH_VERIFIER structure. ********************************************************************/ @@ -775,17 +768,15 @@ BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_stru } /******************************************************************* - This parses an RPC_AUTH_VERIFIER for NETLOGON schannel. I think - assuming "NTLMSSP" in sm_io_rpc_auth_verifier is somewhat wrong. - I have to look at that later... + This parses an RPC_AUTH_VERIFIER for schannel. I think ********************************************************************/ -BOOL smb_io_rpc_netsec_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +BOOL smb_io_rpc_schannel_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) { if (rav == NULL) return False; - prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); + prs_debug(ps, depth, desc, "smb_io_rpc_schannel_verifier"); depth++; if(!prs_string("signature", ps, depth, rav->signature, sizeof(rav->signature))) @@ -797,424 +788,10 @@ BOOL smb_io_rpc_netsec_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_st } /******************************************************************* - Inits an RPC_AUTH_NTLMSSP_NEG structure. -********************************************************************/ - -void init_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, - uint32 neg_flgs, - const char *myname, const char *domain) -{ - int len_myname = strlen(myname); - int len_domain = strlen(domain); - - neg->neg_flgs = neg_flgs ; /* 0x00b2b3 */ - - init_str_hdr(&neg->hdr_domain, len_domain, len_domain, 0x20 + len_myname); - init_str_hdr(&neg->hdr_myname, len_myname, len_myname, 0x20); - - fstrcpy(neg->myname, myname); - fstrcpy(neg->domain, domain); -} - -/******************************************************************* - Reads or writes an RPC_AUTH_NTLMSSP_NEG structure. - - *** lkclXXXX HACK ALERT! *** -********************************************************************/ - -BOOL smb_io_rpc_auth_ntlmssp_neg(const char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) -{ - uint32 start_offset = prs_offset(ps); - if (neg == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_neg"); - depth++; - - if(!prs_uint32("neg_flgs ", ps, depth, &neg->neg_flgs)) - return False; - - if (ps->io) { - uint32 old_offset; - uint32 old_neg_flags = neg->neg_flgs; - - /* reading */ - - ZERO_STRUCTP(neg); - - neg->neg_flgs = old_neg_flags; - - if(!smb_io_strhdr("hdr_domain", &neg->hdr_domain, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_myname", &neg->hdr_myname, ps, depth)) - return False; - - old_offset = prs_offset(ps); - - if(!prs_set_offset(ps, neg->hdr_myname.buffer + start_offset - 12)) - return False; - - if(!prs_uint8s(True, "myname", ps, depth, (uint8*)neg->myname, - MIN(neg->hdr_myname.str_str_len, sizeof(neg->myname)))) - return False; - - old_offset += neg->hdr_myname.str_str_len; - - if(!prs_set_offset(ps, neg->hdr_domain.buffer + start_offset - 12)) - return False; - - if(!prs_uint8s(True, "domain", ps, depth, (uint8*)neg->domain, - MIN(neg->hdr_domain.str_str_len, sizeof(neg->domain )))) - return False; - - old_offset += neg->hdr_domain .str_str_len; - - if(!prs_set_offset(ps, old_offset)) - return False; - } else { - /* writing */ - if(!smb_io_strhdr("hdr_domain", &neg->hdr_domain, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_myname", &neg->hdr_myname, ps, depth)) - return False; - - if(!prs_uint8s(True, "myname", ps, depth, (uint8*)neg->myname, - MIN(neg->hdr_myname.str_str_len, sizeof(neg->myname)))) - return False; - if(!prs_uint8s(True, "domain", ps, depth, (uint8*)neg->domain, - MIN(neg->hdr_domain.str_str_len, sizeof(neg->domain )))) - return False; - } - - return True; -} - -/******************************************************************* -creates an RPC_AUTH_NTLMSSP_CHAL structure. -********************************************************************/ - -void init_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, - uint32 neg_flags, - uint8 challenge[8]) -{ - chl->unknown_1 = 0x0; - chl->unknown_2 = 0x00000028; - chl->neg_flags = neg_flags; /* 0x0082b1 */ - - memcpy(chl->challenge, challenge, sizeof(chl->challenge)); - memset((char *)chl->reserved , '\0', sizeof(chl->reserved)); -} - -/******************************************************************* - Reads or writes an RPC_AUTH_NTLMSSP_CHAL structure. -********************************************************************/ - -BOOL smb_io_rpc_auth_ntlmssp_chal(const char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth) -{ - if (chl == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chal"); - depth++; - - if(!prs_uint32("unknown_1", ps, depth, &chl->unknown_1)) /* 0x0000 0000 */ - return False; - if(!prs_uint32("unknown_2", ps, depth, &chl->unknown_2)) /* 0x0000 b2b3 */ - return False; - if(!prs_uint32("neg_flags", ps, depth, &chl->neg_flags)) /* 0x0000 82b1 */ - return False; - - if(!prs_uint8s (False, "challenge", ps, depth, chl->challenge, sizeof(chl->challenge))) - return False; - if(!prs_uint8s (False, "reserved ", ps, depth, chl->reserved , sizeof(chl->reserved ))) - return False; - - return True; -} - -/******************************************************************* - Inits an RPC_AUTH_NTLMSSP_RESP structure. - - *** lkclXXXX FUDGE! HAVE TO MANUALLY SPECIFY OFFSET HERE (0x1c bytes) *** - *** lkclXXXX the actual offset is at the start of the auth verifier *** -********************************************************************/ - -void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, - uchar lm_resp[24], uchar nt_resp[24], - const char *domain, const char *user, const char *wks, - uint32 neg_flags) -{ - uint32 offset; - int dom_len = strlen(domain); - int wks_len = strlen(wks); - int usr_len = strlen(user); - int lm_len = (lm_resp != NULL) ? 24 : 0; - int nt_len = (nt_resp != NULL) ? 24 : 0; - - DEBUG(5,("make_rpc_auth_ntlmssp_resp\n")); - -#ifdef DEBUG_PASSWORD - DEBUG(100,("lm_resp\n")); - dump_data(100, (char *)lm_resp, 24); - DEBUG(100,("nt_resp\n")); - dump_data(100, (char *)nt_resp, 24); -#endif - - DEBUG(6,("dom: %s user: %s wks: %s neg_flgs: 0x%x\n", - domain, user, wks, neg_flags)); - - offset = 0x40; - - if (neg_flags & NTLMSSP_NEGOTIATE_UNICODE) { - dom_len *= 2; - wks_len *= 2; - usr_len *= 2; - } - - init_str_hdr(&rsp->hdr_domain, dom_len, dom_len, offset); - offset += dom_len; - - init_str_hdr(&rsp->hdr_usr, usr_len, usr_len, offset); - offset += usr_len; - - init_str_hdr(&rsp->hdr_wks, wks_len, wks_len, offset); - offset += wks_len; - - init_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, offset); - offset += lm_len; - - init_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, offset); - offset += nt_len; - - init_str_hdr(&rsp->hdr_sess_key, 0, 0, offset); - - rsp->neg_flags = neg_flags; - - memcpy(rsp->lm_resp, lm_resp, 24); - memcpy(rsp->nt_resp, nt_resp, 24); - - if (neg_flags & NTLMSSP_NEGOTIATE_UNICODE) { - rpcstr_push(rsp->domain, domain, sizeof(rsp->domain), 0); - rpcstr_push(rsp->user, user, sizeof(rsp->user), 0); - rpcstr_push(rsp->wks, wks, sizeof(rsp->wks), 0); - } else { - fstrcpy(rsp->domain, domain); - fstrcpy(rsp->user, user); - fstrcpy(rsp->wks, wks); - } - - rsp->sess_key[0] = 0; -} - -/******************************************************************* - Reads or writes an RPC_AUTH_NTLMSSP_RESP structure. - - *** lkclXXXX FUDGE! HAVE TO MANUALLY SPECIFY OFFSET HERE (0x1c bytes) *** - *** lkclXXXX the actual offset is at the start of the auth verifier *** -********************************************************************/ - -BOOL smb_io_rpc_auth_ntlmssp_resp(const char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) -{ - if (rsp == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_resp"); - depth++; - - if (ps->io) { - uint32 old_offset; - - /* reading */ - - ZERO_STRUCTP(rsp); - - if(!smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_domain ", &rsp->hdr_domain, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_user ", &rsp->hdr_usr, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_wks ", &rsp->hdr_wks, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth)) - return False; - - if(!prs_uint32("neg_flags", ps, depth, &rsp->neg_flags)) /* 0x0000 82b1 */ - return False; - - old_offset = prs_offset(ps); - - if(!prs_set_offset(ps, rsp->hdr_domain.buffer + 0xc)) - return False; - - if(!prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain, - MIN(rsp->hdr_domain.str_str_len, sizeof(rsp->domain)))) - return False; - - old_offset += rsp->hdr_domain.str_str_len; - - if(!prs_set_offset(ps, rsp->hdr_usr.buffer + 0xc)) - return False; - - if(!prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user, - MIN(rsp->hdr_usr.str_str_len, sizeof(rsp->user)))) - return False; - - old_offset += rsp->hdr_usr.str_str_len; - - if(!prs_set_offset(ps, rsp->hdr_wks.buffer + 0xc)) - return False; - - if(!prs_uint8s(True, "wks ", ps, depth, (uint8*)rsp->wks, - MIN(rsp->hdr_wks.str_str_len, sizeof(rsp->wks)))) - return False; - - old_offset += rsp->hdr_wks.str_str_len; - - if(!prs_set_offset(ps, rsp->hdr_lm_resp.buffer + 0xc)) - return False; - - if(!prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp, - MIN(rsp->hdr_lm_resp.str_str_len, sizeof(rsp->lm_resp )))) - return False; - - old_offset += rsp->hdr_lm_resp.str_str_len; - - if(!prs_set_offset(ps, rsp->hdr_nt_resp.buffer + 0xc)) - return False; - - if(!prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp, - MIN(rsp->hdr_nt_resp.str_str_len, sizeof(rsp->nt_resp )))) - return False; - - old_offset += rsp->hdr_nt_resp.str_str_len; - - if (rsp->hdr_sess_key.str_str_len != 0) { - - if(!prs_set_offset(ps, rsp->hdr_sess_key.buffer + 0x10)) - return False; - - old_offset += rsp->hdr_sess_key.str_str_len; - - if(!prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, - MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key)))) - return False; - } - - if(!prs_set_offset(ps, old_offset)) - return False; - } else { - /* writing */ - if(!smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_domain ", &rsp->hdr_domain, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_user ", &rsp->hdr_usr, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_wks ", &rsp->hdr_wks, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth)) - return False; - - if(!prs_uint32("neg_flags", ps, depth, &rsp->neg_flags)) /* 0x0000 82b1 */ - return False; - - if(!prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain, - MIN(rsp->hdr_domain.str_str_len, sizeof(rsp->domain)))) - return False; - - if(!prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user, - MIN(rsp->hdr_usr.str_str_len, sizeof(rsp->user)))) - return False; - - if(!prs_uint8s(True , "wks ", ps, depth, (uint8*)rsp->wks, - MIN(rsp->hdr_wks.str_str_len, sizeof(rsp->wks)))) - return False; - if(!prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp, - MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp)))) - return False; - if(!prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp, - MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp )))) - return False; - if(!prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, - MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key)))) - return False; - } - - return True; -} - -/******************************************************************* - Checks an RPC_AUTH_NTLMSSP_CHK structure. -********************************************************************/ - -BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 seq_num) -{ - if (chk == NULL) - return False; - - if (chk->crc32 != crc32 || - chk->ver != NTLMSSP_SIGN_VERSION || - chk->seq_num != seq_num) - { - DEBUG(5,("verify failed - crc %x ver %x seq %d\n", - chk->crc32, chk->ver, chk->seq_num)); - - DEBUG(5,("verify expect - crc %x ver %x seq %d\n", - crc32, NTLMSSP_SIGN_VERSION, seq_num)); - return False; - } - return True; -} - -/******************************************************************* - Inits an RPC_AUTH_NTLMSSP_CHK structure. -********************************************************************/ - -void init_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, - uint32 ver, uint32 crc32, uint32 seq_num) -{ - chk->ver = ver; - chk->reserved = 0x0; - chk->crc32 = crc32; - chk->seq_num = seq_num; -} - -/******************************************************************* - Reads or writes an RPC_AUTH_NTLMSSP_CHK structure. +creates an RPC_AUTH_SCHANNEL_NEG structure. ********************************************************************/ -BOOL smb_io_rpc_auth_ntlmssp_chk(const char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth) -{ - if (chk == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chk"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ver ", ps, depth, &chk->ver)) - return False; - if(!prs_uint32("reserved", ps, depth, &chk->reserved)) - return False; - if(!prs_uint32("crc32 ", ps, depth, &chk->crc32)) - return False; - if(!prs_uint32("seq_num ", ps, depth, &chk->seq_num)) - return False; - - return True; -} - -/******************************************************************* -creates an RPC_AUTH_NETSEC_NEG structure. -********************************************************************/ -void init_rpc_auth_netsec_neg(RPC_AUTH_NETSEC_NEG *neg, +void init_rpc_auth_schannel_neg(RPC_AUTH_SCHANNEL_NEG *neg, const char *domain, const char *myname) { neg->type1 = 0; @@ -1224,16 +801,16 @@ void init_rpc_auth_netsec_neg(RPC_AUTH_NETSEC_NEG *neg, } /******************************************************************* - Reads or writes an RPC_AUTH_NETSEC_NEG structure. + Reads or writes an RPC_AUTH_SCHANNEL_NEG structure. ********************************************************************/ -BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, +BOOL smb_io_rpc_auth_schannel_neg(const char *desc, RPC_AUTH_SCHANNEL_NEG *neg, prs_struct *ps, int depth) { if (neg == NULL) return False; - prs_debug(ps, depth, desc, "smb_io_rpc_auth_netsec_neg"); + prs_debug(ps, depth, desc, "smb_io_rpc_auth_schannel_neg"); depth++; if(!prs_align(ps)) @@ -1252,16 +829,17 @@ BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, } /******************************************************************* -reads or writes an RPC_AUTH_NETSEC_CHK structure. +reads or writes an RPC_AUTH_SCHANNEL_CHK structure. ********************************************************************/ -BOOL smb_io_rpc_auth_netsec_chk(const char *desc, int auth_len, - RPC_AUTH_NETSEC_CHK * chk, + +BOOL smb_io_rpc_auth_schannel_chk(const char *desc, int auth_len, + RPC_AUTH_SCHANNEL_CHK * chk, prs_struct *ps, int depth) { if (chk == NULL) return False; - prs_debug(ps, depth, desc, "smb_io_rpc_auth_netsec_chk"); + prs_debug(ps, depth, desc, "smb_io_rpc_auth_schannel_chk"); depth++; if ( !prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)) ) @@ -1273,7 +851,7 @@ BOOL smb_io_rpc_auth_netsec_chk(const char *desc, int auth_len, if ( !prs_uint8s(False, "packet_digest", ps, depth, chk->packet_digest, sizeof(chk->packet_digest)) ) return False; - if ( auth_len == RPC_AUTH_NETSEC_SIGN_OR_SEAL_CHK_LEN ) { + if ( auth_len == RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN ) { if ( !prs_uint8s(False, "confounder", ps, depth, chk->confounder, sizeof(chk->confounder)) ) return False; } diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 6b0193c6e4..1aaebf71e3 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -25,8 +25,6 @@ */ #include "includes.h" -#include "rpc_parse.h" -#include "nterr.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE @@ -7038,9 +7036,9 @@ inits a SAMR_R_GET_DOM_PWINFO structure. void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u, const char *dest_host, const char *user_name, - const char nt_newpass[516], + const uchar nt_newpass[516], const uchar nt_oldhash[16], - const char lm_newpass[516], + const uchar lm_newpass[516], const uchar lm_oldhash[16]) { DEBUG(5, ("init_samr_q_chgpasswd_user\n")); diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index b86ca23df1..e1a7ad8427 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -100,40 +100,48 @@ static BOOL svcctl_io_service_config( const char *desc, SERVICE_CONFIG *config, return True; } + /******************************************************************* ********************************************************************/ -BOOL svcctl_io_service_description( const char *desc, UNISTR2 *svcdesc, prs_struct *ps, int depth ) +BOOL svcctl_io_enum_services_status( const char *desc, ENUM_SERVICES_STATUS *enum_status, RPC_BUFFER *buffer, int depth ) { - - prs_debug(ps, depth, desc, "svcctl_io_service_description"); + prs_struct *ps=&buffer->prs; + + prs_debug(ps, depth, desc, "svcctl_io_enum_services_status"); depth++; - - if (!prs_io_unistr2("", ps, depth, svcdesc)) + + if ( !smb_io_relstr("servicename", buffer, depth, &enum_status->servicename) ) + return False; + if ( !smb_io_relstr("displayname", buffer, depth, &enum_status->displayname) ) return False; + if ( !svcctl_io_service_status("svc_status", &enum_status->status, ps, depth) ) + return False; + return True; } - /******************************************************************* ********************************************************************/ -BOOL svcctl_io_enum_services_status( const char *desc, ENUM_SERVICES_STATUS *enum_status, RPC_BUFFER *buffer, int depth ) +BOOL svcctl_io_service_status_process( const char *desc, SERVICE_STATUS_PROCESS *status, RPC_BUFFER *buffer, int depth ) { prs_struct *ps=&buffer->prs; - - prs_debug(ps, depth, desc, "svcctl_io_enum_services_status"); + + prs_debug(ps, depth, desc, "svcctl_io_service_status_process"); depth++; - - if ( !smb_io_relstr("servicename", buffer, depth, &enum_status->servicename) ) + + if ( !svcctl_io_service_status("status", &status->status, ps, depth) ) return False; - if ( !smb_io_relstr("displayname", buffer, depth, &enum_status->displayname) ) + if(!prs_align(ps)) return False; - if ( !svcctl_io_service_status("svc_status", &enum_status->status, ps, depth) ) + if(!prs_uint32("process_id", ps, depth, &status->process_id)) return False; - + if(!prs_uint32("service_flags", ps, depth, &status->service_flags)) + return False; + return True; } @@ -151,6 +159,45 @@ uint32 svcctl_sizeof_enum_services_status( ENUM_SERVICES_STATUS *status ) return size; } +/******************************************************************** +********************************************************************/ + +static uint32 sizeof_unistr2( UNISTR2 *string ) +{ + uint32 size = 0; + + if ( !string ) + return 0; + + size = sizeof(uint32) * 3; /* length fields */ + size += 2 * string->uni_max_len; /* string data */ + size += size % 4; /* alignment */ + + return size; +} + +/******************************************************************** +********************************************************************/ + +uint32 svcctl_sizeof_service_config( SERVICE_CONFIG *config ) +{ + uint32 size = 0; + + size = sizeof(uint32) * 4; /* static uint32 fields */ + + /* now add the UNISTR2 + pointer sizes */ + + size += sizeof(uint32) * sizeof_unistr2(config->executablepath); + size += sizeof(uint32) * sizeof_unistr2(config->loadordergroup); + size += sizeof(uint32) * sizeof_unistr2(config->dependencies); + size += sizeof(uint32) * sizeof_unistr2(config->startname); + size += sizeof(uint32) * sizeof_unistr2(config->displayname); + + return size; +} + + + /******************************************************************* ********************************************************************/ @@ -694,7 +741,7 @@ BOOL svcctl_io_q_query_service_config2(const char *desc, SVCCTL_Q_QUERY_SERVICE_ if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth)) return False; - if(!prs_uint32("info_level", ps, depth, &q_u->info_level)) + if(!prs_uint32("level", ps, depth, &q_u->level)) return False; if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size)) @@ -705,36 +752,145 @@ BOOL svcctl_io_q_query_service_config2(const char *desc, SVCCTL_Q_QUERY_SERVICE_ /******************************************************************* - Creates a service description response buffer. - The format seems to be DWORD:length of buffer - DWORD:offset (fixed as four) - UNISTR: unicode description in the rest of the buffer ********************************************************************/ -void init_service_description_buffer(RPC_DATA_BLOB *str, const char *service_desc, int blob_length) +void init_service_description_buffer(SERVICE_DESCRIPTION *desc, const char *service_desc ) { - uint32 offset; - uint8 *bp; + desc->unknown = 0x04; /* always 0x0000 0004 (no idea what this is) */ + init_unistr( &desc->description, service_desc ); +} - ZERO_STRUCTP(str); +/******************************************************************* +********************************************************************/ - offset = 4; +BOOL svcctl_io_service_description( const char *desc, SERVICE_DESCRIPTION *description, RPC_BUFFER *buffer, int depth ) +{ + prs_struct *ps = &buffer->prs; - /* set up string lengths. */ + prs_debug(ps, depth, desc, "svcctl_io_service_description"); + depth++; - str->buf_len = create_rpc_blob(str, blob_length); - DEBUG(10, ("init_service_description buffer: Allocated a blob of [%d] \n",str->buf_len)); + if ( !prs_uint32("unknown", ps, depth, &description->unknown) ) + return False; + if ( !prs_unistr("description", ps, depth, &description->description) ) + return False; - if ( str && str->buffer && str->buf_len) { - memset(str->buffer,0,str->buf_len); - memcpy(str->buffer, &offset, sizeof(uint32)); - bp = &str->buffer[4]; - if (service_desc) { - rpcstr_push(bp, service_desc,str->buf_len-4,0); + return True; +} + +/******************************************************************* +********************************************************************/ + +uint32 svcctl_sizeof_service_description( SERVICE_DESCRIPTION *desc ) +{ + if ( !desc ) + return 0; + + /* make sure to include the terminating NULL */ + return ( sizeof(uint32) + (2*(str_len_uni(&desc->description)+1)) ); +} + +/******************************************************************* +********************************************************************/ + +static BOOL svcctl_io_action( const char *desc, SC_ACTION *action, prs_struct *ps, int depth ) +{ + + prs_debug(ps, depth, desc, "svcctl_io_action"); + depth++; + + if ( !prs_uint32("type", ps, depth, &action->type) ) + return False; + if ( !prs_uint32("delay", ps, depth, &action->delay) ) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + +BOOL svcctl_io_service_fa( const char *desc, SERVICE_FAILURE_ACTIONS *fa, RPC_BUFFER *buffer, int depth ) +{ + prs_struct *ps = &buffer->prs; + int i; + + prs_debug(ps, depth, desc, "svcctl_io_service_description"); + depth++; + + if ( !prs_uint32("reset_period", ps, depth, &fa->reset_period) ) + return False; + + if ( !prs_pointer( desc, ps, depth, (void**)&fa->rebootmsg, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) ) + return False; + if ( !prs_pointer( desc, ps, depth, (void**)&fa->command, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) ) + return False; + + if ( !prs_uint32("num_actions", ps, depth, &fa->num_actions) ) + return False; + + if ( UNMARSHALLING(ps) && fa->num_actions ) { + if ( !(fa->actions = TALLOC_ARRAY( get_talloc_ctx(), SC_ACTION, fa->num_actions )) ) { + DEBUG(0,("svcctl_io_service_fa: talloc() failure!\n")); + return False; } } + + for ( i=0; inum_actions; i++ ) { + if ( !svcctl_io_action( "actions", &fa->actions[i], ps, depth ) ) + return False; + } + + return True; +} + +/******************************************************************* +********************************************************************/ + +uint32 svcctl_sizeof_service_fa( SERVICE_FAILURE_ACTIONS *fa) +{ + uint32 size = 0; + + if ( !fa ) + return 0; + + size = sizeof(uint32) * 2; + size += sizeof_unistr2( fa->rebootmsg ); + size += sizeof_unistr2( fa->command ); + size += sizeof(SC_ACTION) * fa->num_actions; + + return size; } +/******************************************************************* +********************************************************************/ + +BOOL svcctl_io_r_query_service_config2(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u, prs_struct *ps, int depth) +{ + if ( !r_u ) + return False; + + prs_debug(ps, depth, desc, "svcctl_io_r_query_service_config2"); + depth++; + + if ( !prs_align(ps) ) + return False; + + if (!prs_rpcbuffer("", ps, depth, &r_u->buffer)) + return False; + if(!prs_align(ps)) + 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; +} + + /******************************************************************* ********************************************************************/ @@ -752,7 +908,7 @@ BOOL svcctl_io_q_query_service_status_ex(const char *desc, SVCCTL_Q_QUERY_SERVIC if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth)) return False; - if(!prs_uint32("info_level", ps, depth, &q_u->info_level)) + if(!prs_uint32("level", ps, depth, &q_u->level)) return False; if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size)) @@ -771,7 +927,7 @@ BOOL svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVIC return False; prs_debug(ps, depth, desc, "svcctl_io_r_query_service_status_ex"); - depth++; + depth++; if (!prs_rpcbuffer("", ps, depth, &r_u->buffer)) return False; @@ -791,37 +947,80 @@ BOOL svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVIC /******************************************************************* ********************************************************************/ -BOOL svcctl_io_r_query_service_config2(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u, prs_struct *ps, int depth) +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_query_service_config2"); + prs_debug(ps, depth, desc, "svcctl_io_r_lock_service_db"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32("returned", ps, depth, &r_u->returned)) + if(!smb_io_pol_hnd("lock_handle", &r_u->h_lock, ps, depth)) return False; - if (r_u->returned > 4) { - if (!prs_uint32("offset", ps, depth, &r_u->offset)) - return False; + if(!prs_werror("status", ps, depth, &r_u->status)) + return False; - if ( !prs_pointer( desc, ps, depth, (void**)&r_u->description, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) ) - return False; + return True; +} - if(!prs_align(ps)) - return False; - } else { - /* offset does double duty here */ - r_u->offset = 0; - if (!prs_uint32("offset", ps, depth, &r_u->offset)) - return False; - } +/******************************************************************* +********************************************************************/ - if (!prs_uint32("needed", ps, depth, &r_u->needed)) +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)) @@ -831,3 +1030,5 @@ BOOL svcctl_io_r_query_service_config2(const char *desc, SVCCTL_R_QUERY_SERVICE_ } + + -- cgit From 8c9ad87af2a04bdbe04872441a7bda2ae385a493 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 4 Oct 2005 21:56:53 +0000 Subject: r10720: Add helper function that does prs alignment on a specified number of bytes. (This used to be commit 4576e6843b67c5919823307a196b1582b78fdeaf) --- source3/rpc_parse/parse_prs.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index d174bad444..088c8f08fb 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -511,6 +511,24 @@ BOOL prs_align_uint64(prs_struct *ps) return ret; } +/****************************************************************** + Align on a specific byte boundary + *****************************************************************/ + +BOOL prs_align_custom(prs_struct *ps, uint8 boundary) +{ + BOOL ret; + uint8 old_align = ps->align; + + ps->align = boundary; + ret = prs_align(ps); + ps->align = old_align; + + return ret; +} + + + /******************************************************************* Align only if required (for the unistr2 string mainly) ********************************************************************/ -- cgit From 0bf72b6e330a76bee502cb36c1cb80c46d47d33c Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 6 Oct 2005 17:48:03 +0000 Subject: r10781: merging eventlog and svcctl code from trunk (This used to be commit f10aa9fb84bfac4f1a22b74d63999668700ffaac) --- source3/rpc_parse/parse_misc.c | 4 ++++ source3/rpc_parse/parse_ntsvcs.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 8bbb97f226..26da87b280 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -830,6 +830,8 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) if (buf) { /* We always null terminate the copy. */ len = strlen(buf) + 1; + if ( flags == UNI_STR_DBLTERMINATE ) + len++; } else { /* no buffer -- nothing to do */ str->uni_max_len = 0; @@ -859,6 +861,8 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) if (flags == UNI_STR_TERMINATE || flags == UNI_MAXLEN_TERMINATE) { num_chars++; } + if ( flags == UNI_STR_DBLTERMINATE ) + num_chars += 2; } str->uni_max_len = num_chars; diff --git a/source3/rpc_parse/parse_ntsvcs.c b/source3/rpc_parse/parse_ntsvcs.c index f2e4456025..24bf3a455b 100644 --- a/source3/rpc_parse/parse_ntsvcs.c +++ b/source3/rpc_parse/parse_ntsvcs.c @@ -79,7 +79,7 @@ BOOL ntsvcs_io_q_get_device_list_size(const char *desc, NTSVCS_Q_GET_DEVICE_LIST if ( !prs_pointer("devicename", ps, depth, (void**)&q_u->devicename, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2) ) return False; - if( !prs_align(ps) ) + if ( !prs_align(ps) ) return False; if ( !prs_uint32("flags", ps, depth, &q_u->flags) ) -- cgit From 8cbe35f6f8fea2757fb3df49c2b9baa94cf5fe84 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 6 Oct 2005 18:00:19 +0000 Subject: r10782: Only parse the group rid_array in net_user_info3() when num_group is > 0. This fixes the PAC parsing for win2k DCs up to SP3. (Where full SIDs are stored in the PAC instead of RIDs). Guenther (This used to be commit 3d5d5ddce2d0c602d985438af996e7af5ccef329) --- source3/rpc_parse/parse_net.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 35533e360a..f4ba0e76a1 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1622,18 +1622,30 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_uint32("num_groups2 ", ps, depth, &usr->num_groups2)) /* num groups */ - return False; - if (UNMARSHALLING(ps) && usr->num_groups2 > 0) { - usr->gids = PRS_ALLOC_MEM(ps, DOM_GID, usr->num_groups2); - if (usr->gids == NULL) + if (usr->num_groups > 0) { + + if(!prs_uint32("num_groups2 ", ps, depth, &usr->num_groups2)) /* num groups2 */ return False; - } - for (i = 0; i < usr->num_groups2; i++) { - if(!smb_io_gid("", &usr->gids[i], ps, depth)) /* group info */ + 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)) { + usr->gids = PRS_ALLOC_MEM(ps, DOM_GID, usr->num_groups); + if (usr->gids == NULL) + return False; + } + + 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 */ -- cgit From 8d7c88667190fe286971ac4fffb64ee5bd9eeeb0 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 18 Oct 2005 03:24:00 +0000 Subject: r11137: Compile with only 2 warnings (I'm still working on that code) on a gcc4 x86_64 box. Jeremy. (This used to be commit d720867a788c735e56d53d63265255830ec21208) --- source3/rpc_parse/parse_net.c | 2 +- source3/rpc_parse/parse_prs.c | 2 +- source3/rpc_parse/parse_samr.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index f4ba0e76a1..401daea39c 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -932,7 +932,7 @@ BOOL net_io_r_auth_3(const char *desc, NET_R_AUTH_3 *r_a, prs_struct *ps, int de 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, uchar hashed_mach_pwd[16]) + DOM_CRED *cred, const uchar hashed_mach_pwd[16]) { unsigned char nt_cypher[16]; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 088c8f08fb..3742ac95be 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1431,7 +1431,7 @@ BOOL prs_hash1(prs_struct *ps, uint32 offset, int len) dump_data(100, ps->sess_key, 16); dump_data(100, q, len); #endif - SamOEMhash((uchar *) q, ps->sess_key, len); + SamOEMhash((uchar *) q, (const unsigned char *)ps->sess_key, len); #ifdef DEBUG_PASSWORD dump_data(100, q, len); diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 1aaebf71e3..dfe80a65e2 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -7050,12 +7050,12 @@ void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u, 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, nt_newpass); + 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, lm_newpass); + init_enc_passwd(&q_u->lm_newpass, (const char *)lm_newpass); init_enc_hash(&q_u->lm_oldhash, lm_oldhash); } -- cgit From 354124efb76cb16a511ed0f2f451170830b1a9f2 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 27 Oct 2005 12:45:10 +0000 Subject: r11326: Fix alignment in getdc response (This used to be commit 9741818d2c54240ef1f38762396828adceb92b2a) --- source3/rpc_parse/parse_net.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 401daea39c..a32edd4384 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -557,6 +557,9 @@ BOOL net_io_r_getdcname(const char *desc, NET_R_GETDCNAME *r_t, prs_struct *ps, r_t->ptr_dcname, ps, depth)) return False; + if (!prs_align(ps)) + return False; + if (!prs_ntstatus("status", ps, depth, &r_t->status)) return False; -- cgit From e1ffd2d612184fb1343cbe7e1d5d1aacebe0e8fa Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 27 Oct 2005 13:30:23 +0000 Subject: r11332: eventlog API uses NTSTATUS, not WERROR for return codes (This used to be commit f5f40633bc3f641a0fef4934375d0d829899b0d7) --- source3/rpc_parse/parse_eventlog.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 1b57272ca4..0f0b02748b 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -90,7 +90,7 @@ BOOL eventlog_io_r_open_eventlog(const char *desc, EVENTLOG_R_OPEN_EVENTLOG *r_u if(!(smb_io_pol_hnd("log handle", &(r_u->handle), ps, depth))) return False; - if(!(prs_werror("status code", ps, depth, &(r_u->status)))) + if(!(prs_ntstatus("status code", ps, depth, &r_u->status))) return False; return True; @@ -129,7 +129,7 @@ BOOL eventlog_io_r_get_num_records(const char *desc, EVENTLOG_R_GET_NUM_RECORDS if(!(prs_uint32("num records", ps, depth, &(r_u->num_records)))) return False; - if(!(prs_werror("status code", ps, depth, &(r_u->status)))) + if(!(prs_ntstatus("status code", ps, depth, &r_u->status))) return False; return True; @@ -168,7 +168,7 @@ BOOL eventlog_io_r_get_oldest_entry(const char *desc, EVENTLOG_R_GET_OLDEST_ENTR if(!(prs_uint32("oldest entry", ps, depth, &(r_u->oldest_entry)))) return False; - if(!(prs_werror("status code", ps, depth, &(r_u->status)))) + if(!(prs_ntstatus("status code", ps, depth, &r_u->status))) return False; return True; @@ -207,7 +207,7 @@ BOOL eventlog_io_r_close_eventlog(const char *desc, EVENTLOG_R_CLOSE_EVENTLOG *r if(!(smb_io_pol_hnd("log handle", &(r_u->handle), ps, depth))) return False; - if(!(prs_werror("status code", ps, depth, &(r_u->status)))) + if(!(prs_ntstatus("status code", ps, depth, &r_u->status))) return False; return True; @@ -372,7 +372,7 @@ BOOL eventlog_io_r_read_eventlog(const char *desc, return False; if(!(prs_uint32("real size", ps, depth, &(r_u->real_size)))) return False; - if(!(prs_werror("status code", ps, depth, &(r_u->status)))) + if(!(prs_ntstatus("status code", ps, depth, &r_u->status))) return False; return True; @@ -424,7 +424,7 @@ BOOL eventlog_io_r_clear_eventlog(const char *desc, EVENTLOG_R_CLEAR_EVENTLOG *r if(!prs_align(ps)) return False; - if(!(prs_werror("status code", ps, depth, &(r_u->status)))) + if(!(prs_ntstatus("status code", ps, depth, &r_u->status))) return False; return True; -- cgit From 9d4760d1190b907010d67dd938be568b776329b8 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 1 Nov 2005 23:29:02 +0000 Subject: r11446: Remove unused fn. Remove unneeded strncpy use. Jeremy. (This used to be commit d202aae3c821f3d78ff063d867bac1f84dca3548) --- source3/rpc_parse/parse_prs.c | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 3742ac95be..77f0e6d5c8 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1274,32 +1274,6 @@ BOOL prs_string(const char *name, prs_struct *ps, int depth, char *str, int max_ return True; } -BOOL prs_string_alloc(const char *name, prs_struct *ps, int depth, - const char **str) -{ - size_t len; - char *tmp_str; - - if (UNMARSHALLING(ps)) - len = strlen(&ps->data_p[ps->data_offset]); - else - len = strlen(*str); - - tmp_str = PRS_ALLOC_MEM(ps, char, len+1); - - if (tmp_str == NULL) - return False; - - if (MARSHALLING(ps)) - strncpy(tmp_str, *str, len); - - if (!prs_string(name, ps, depth, tmp_str, len+1)) - return False; - - *str = tmp_str; - return True; -} - /******************************************************************* prs_uint16 wrapper. Call this and it sets up a pointer to where the uint16 should be stored, or gets the size if reading. -- cgit From 32cf16f3cfaf52414c324c0a333ff29cb9a326aa Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 13 Nov 2005 11:38:17 +0000 Subject: r11706: Implement dsr_getdcname client code. It's handy: It not only gives you the IP address but also the fqdn of the remote dc and site info. Volker (This used to be commit 62d01ce7e6c14971084c208ab61f379cb172cb22) --- source3/rpc_parse/parse_net.c | 236 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 236 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index a32edd4384..3732ab3a72 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -3153,3 +3153,239 @@ BOOL net_io_r_sam_deltas(const char *desc, 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 uuid *domain_guid, + struct uuid *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; +} + +/******************************************************************* + 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 uuid, 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 uuid, 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; +} + +/******************************************************************* + 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 uuid 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_uint32("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; +} -- cgit From 70cac98b6e1871cf93b379a4834de1778853de86 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 17 Nov 2005 17:41:02 +0000 Subject: r11760: fix sequential reads in the eventlog; event viewer is behaving better now as well but needs more testing (This used to be commit ba2f94aeae1f8e69d53fc360785adf222a8c9c6e) --- source3/rpc_parse/parse_eventlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 0f0b02748b..5e28a4aba5 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -294,7 +294,7 @@ BOOL eventlog_io_r_read_eventlog(const char *desc, while(entry != NULL && record_written < record_total) { - DEBUG(10, ("eventlog_io_r_read_eventlog: writing record [%d] out of [%d].\n", record_written, record_total)); + DEBUG(11, ("eventlog_io_r_read_eventlog: writing record [%d] out of [%d].\n", record_written, record_total)); /* Encode the actual eventlog record record */ -- cgit From d09beee040b62d9b783869bc9af7f17301e3f5e0 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 17 Nov 2005 22:40:10 +0000 Subject: r11769: Looking at a performance problem enumerating accounts, wondered if changing to support samr_connect5 might help so quickly coded it up. No it doesn't :-(. Don't merge this for 3.0.21 please. Jeremy. (This used to be commit bff1df678a8948d382f4555e83a1df23146a4b12) --- source3/rpc_parse/parse_samr.c | 112 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 111 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index dfe80a65e2..7e39b44fe6 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6734,7 +6734,7 @@ 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_connect\n")); + DEBUG(5, ("init_samr_q_connect4\n")); /* make PDC server name \\server */ q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0; @@ -6803,6 +6803,116 @@ BOOL samr_io_r_connect4(const char *desc, SAMR_R_CONNECT4 * r_u, 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. ********************************************************************/ -- cgit From 9be0ce442285a0f63e6c226f6cf07d05a3f20021 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 18 Nov 2005 23:15:47 +0000 Subject: r11793: Fix the SAMR cache so it works across completely insane client behaviour (ie.: open pipe/open SAMR handle/enumerate 0 - 1024 close SAMR handle, close pipe. open pipe/open SAMR handle/enumerate 1024 - 2048... close SAMR handle, close pipe. And on ad-nausium. Amazing.... probably object-oriented client side programming in action yet again. This change should *massively* improve performance when enumerating users from an LDAP database. Jeremy. (This used to be commit 8ce705d9cc1b6a79d710a10ff38f72a0f1006dda) --- source3/rpc_parse/parse_samr.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 7e39b44fe6..817244a2b2 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -7253,10 +7253,10 @@ BOOL samr_io_r_chgpasswd_user(const char *desc, SAMR_R_CHGPASSWD_USER * r_u, reads or writes a structure. ********************************************************************/ -void init_samr_q_unknown_2e(SAMR_Q_UNKNOWN_2E *q_u, +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_unknown_2e\n")); + DEBUG(5, ("init_samr_q_query_domain_info2\n")); q_u->domain_pol = *domain_pol; q_u->switch_value = switch_value; @@ -7266,13 +7266,13 @@ void init_samr_q_unknown_2e(SAMR_Q_UNKNOWN_2E *q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_unknown_2e(const char *desc, SAMR_Q_UNKNOWN_2E *q_u, +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_unknown_2e"); + prs_debug(ps, depth, desc, "samr_io_q_query_domain_info2"); depth++; if(!prs_align(ps)) @@ -7291,11 +7291,11 @@ BOOL samr_io_q_unknown_2e(const char *desc, SAMR_Q_UNKNOWN_2E *q_u, inits a SAMR_R_QUERY_DOMAIN_INFO structure. ********************************************************************/ -void init_samr_r_samr_unknown_2e(SAMR_R_UNKNOWN_2E * r_u, +void init_samr_r_samr_query_domain_info2(SAMR_R_QUERY_DOMAIN_INFO2 * r_u, uint16 switch_value, SAM_UNK_CTR * ctr, NTSTATUS status) { - DEBUG(5, ("init_samr_r_samr_unknown_2e\n")); + DEBUG(5, ("init_samr_r_samr_query_domain_info2\n")); r_u->ptr_0 = 0; r_u->switch_value = 0; @@ -7312,13 +7312,13 @@ void init_samr_r_samr_unknown_2e(SAMR_R_UNKNOWN_2E * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_samr_unknown_2e(const char *desc, SAMR_R_UNKNOWN_2E * r_u, +BOOL samr_io_r_samr_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_samr_unknown_2e"); + prs_debug(ps, depth, desc, "samr_io_r_samr_query_domain_info2"); depth++; if(!prs_align(ps)) @@ -7363,7 +7363,7 @@ BOOL samr_io_r_samr_unknown_2e(const char *desc, SAMR_R_UNKNOWN_2E * r_u, return False; break; default: - DEBUG(0, ("samr_io_r_samr_unknown_2e: unknown switch level 0x%x\n", + DEBUG(0, ("samr_io_r_samr_query_domain_info2: unknown switch level 0x%x\n", r_u->switch_value)); r_u->status = NT_STATUS_INVALID_INFO_CLASS; return False; -- cgit From e09cc27d3b0156fd410c1e47cbbb6686819119d4 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 22 Nov 2005 13:58:51 +0000 Subject: r11852: Fill in samr_get_dom_pwinfo based on Samba4. Guenther (This used to be commit a8bc4bc902075cfd009dc92674c4560a44a74277) --- source3/rpc_parse/parse_samr.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 817244a2b2..e0efb72aab 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -7038,15 +7038,11 @@ BOOL samr_io_r_get_dom_pwinfo(const char *desc, SAMR_R_GET_DOM_PWINFO * r_u, if(!prs_align(ps)) return False; - /* - * see the Samba4 IDL for what these actually are. - */ - - if(!prs_uint16("unk_0", ps, depth, &r_u->unk_0)) + if(!prs_uint16("min_pwd_length", ps, depth, &r_u->min_pwd_length)) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("unk_1", ps, depth, &r_u->unk_1)) + if(!prs_uint32("password_properties", ps, depth, &r_u->password_properties)) return False; if(!prs_ntstatus("status", ps, depth, &r_u->status)) -- cgit From 63addcb4d7c9c13446d91a0972fe29542a7e1bad Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 22 Nov 2005 14:10:49 +0000 Subject: r11853: Add Dsr_GetSiteName (handy for experimenting with GPOs). Guenther (This used to be commit c54430a7b5e40d3bdf8afdc813eb722c0a3b861e) --- source3/rpc_parse/parse_net.c | 72 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 3732ab3a72..ce2a085f47 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -3389,3 +3389,75 @@ BOOL net_io_r_dsr_getdcname(const char *desc, NET_R_DSR_GETDCNAME *r_t, 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; +} + + -- cgit From 2770e98aec8bcf462f1619a6506385cb4cfbc256 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 22 Nov 2005 14:29:14 +0000 Subject: r11856: Replace unknown1 with group_attr. Can anyone remember why we initialize groups only with 0x03 instead of 0x07 ? Guenther (This used to be commit 3282c7c458d390547fbaca44821eff376e8f9aaa) --- source3/rpc_parse/parse_samr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index e0efb72aab..ed6abc398b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2141,7 +2141,7 @@ void init_samr_group_info1(GROUP_INFO1 * gr1, { DEBUG(5, ("init_samr_group_info1\n")); - gr1->unknown_1 = 0x3; + 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); @@ -2174,7 +2174,7 @@ BOOL samr_io_group_info1(const char *desc, GROUP_INFO1 * gr1, if(!smb_io_unihdr("hdr_acct_name", &gr1->hdr_acct_name, ps, depth)) return False; - if(!prs_uint32("unknown_1", ps, depth, &gr1->unknown_1)) + if(!prs_uint32("group_attr", ps, depth, &gr1->group_attr)) return False; if(!prs_uint32("num_members", ps, depth, &gr1->num_members)) return False; @@ -2238,7 +2238,7 @@ void init_samr_group_info3(GROUP_INFO3 *gr3) { DEBUG(5, ("init_samr_group_info3\n")); - gr3->unknown_1 = 0x3; + gr3->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT); /* why not | SE_GROUP_ENABLED ? */ } /******************************************************************* @@ -2256,7 +2256,7 @@ BOOL samr_io_group_info3(const char *desc, GROUP_INFO3 *gr3, prs_struct *ps, int if(!prs_align(ps)) return False; - if(!prs_uint32("unknown_1", ps, depth, &gr3->unknown_1)) + if(!prs_uint32("group_attr", ps, depth, &gr3->group_attr)) return False; return True; -- cgit From 1b624b69bda1eb94a0aa511eba3df0b9549a3000 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 22 Nov 2005 14:38:49 +0000 Subject: r11858: Fill in the clientside TRUSTED_DOMAIN_INFO_EX query. Guenther (This used to be commit 02f13dee6d0bbca71a991682bfe214ed8363e818) --- source3/rpc_parse/parse_lsa.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index d924ea27d1..3d28b657f3 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -3009,6 +3009,44 @@ static BOOL lsa_io_trustdom_query_4(const char *desc, TRUSTED_DOMAIN_INFO_PASSWO /******************************************************************* ********************************************************************/ +static BOOL lsa_io_trustdom_query_6(const char *desc, TRUSTED_DOMAIN_INFO_EX *info_ex, + prs_struct *ps, int depth) +{ + uint32 dom_sid_ptr; + + if (!smb_io_unihdr("domain_name_hdr", &info_ex->domain_name.hdr, ps, depth)) + return False; + + if (!smb_io_unihdr("netbios_name_hdr", &info_ex->netbios_name.hdr, ps, depth)) + return False; + + if (!prs_uint32("dom_sid_ptr", ps, depth, &dom_sid_ptr)) + return False; + + if (!prs_uint32("trust_direction", ps, depth, &info_ex->trust_direction)) + return False; + + if (!prs_uint32("trust_type", ps, depth, &info_ex->trust_type)) + return False; + + if (!prs_uint32("trust_attributes", ps, depth, &info_ex->trust_attributes)) + return False; + + if (!smb_io_unistr2("domain_name_unistring", &info_ex->domain_name.unistring, info_ex->domain_name.hdr.buffer, ps, depth)) + return False; + + if (!smb_io_unistr2("netbios_name_unistring", &info_ex->netbios_name.unistring, info_ex->netbios_name.hdr.buffer, ps, depth)) + return False; + + if (!smb_io_dom_sid2("sid", &info_ex->sid, ps, depth)) + return False; + + return True; +} + +/******************************************************************* +********************************************************************/ + static BOOL lsa_io_trustdom_query(const char *desc, prs_struct *ps, int depth, LSA_TRUSTED_DOMAIN_INFO *info) { prs_debug(ps, depth, desc, "lsa_io_trustdom_query"); @@ -3033,6 +3071,10 @@ static BOOL lsa_io_trustdom_query(const char *desc, prs_struct *ps, int depth, L if(!lsa_io_trustdom_query_4("password", &info->password, ps, depth)) return False; break; + case 6: + if(!lsa_io_trustdom_query_6("info_ex", &info->info_ex, ps, depth)) + return False; + break; default: DEBUG(0,("unsupported info-level: %d\n", info->info_class)); return False; -- cgit From 41eb1127fdc9b554e283246d994d65588078907b Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 29 Nov 2005 23:23:02 +0000 Subject: r11963: add rpccli_samr_chgpasswd3 from samba4. Guenther (This used to be commit 0705fed566efdeab05d605dd239afe67ca5e9811) --- source3/rpc_parse/parse_samr.c | 168 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 167 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ed6abc398b..b5aa2cd831 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -7137,7 +7137,7 @@ BOOL samr_io_enc_hash(const char *desc, SAMR_ENC_HASH * hsh, } /******************************************************************* -inits a SAMR_R_GET_DOM_PWINFO structure. +inits a SAMR_Q_CHGPASSWD_USER structure. ********************************************************************/ void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u, @@ -7245,6 +7245,172 @@ BOOL samr_io_r_chgpasswd_user(const char *desc, SAMR_R_CHGPASSWD_USER * r_u, return True; } +/******************************************************************* +inits a SAMR_Q_CHGPASSWD3 structure. +********************************************************************/ + +void init_samr_q_chgpasswd3(SAMR_Q_CHGPASSWD3 * 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_chgpasswd3\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_chgpasswd3(const char *desc, SAMR_Q_CHGPASSWD3 * q_u, + prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_q_chgpasswd3"); + 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_CHGPASSWD3 structure. +********************************************************************/ + +void init_samr_r_chgpasswd3(SAMR_R_CHGPASSWD3 * r_u, NTSTATUS status) +{ + DEBUG(5, ("init_r_chgpasswd3\n")); + + r_u->status = status; +} + +/******************************************************************* + 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_chgpasswd3(const char *desc, SAMR_R_CHGPASSWD3 * r_u, + prs_struct *ps, int depth) +{ + uint32 ptr_info, ptr_reject; + + if (r_u == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_r_chgpasswd3"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_info", ps, depth, &ptr_info)) + return False; + + if (ptr_info) { + + /* SAM_UNK_INFO_1 */ + if(!sam_io_unk_info1("info", &r_u->info, ps, depth)) + return False; + } + + if(!prs_uint32("ptr_reject", ps, depth, &ptr_reject)) + return False; + + if (ptr_reject) { + + /* 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. ********************************************************************/ -- cgit From 6ffd82ea7794747619e4d5eab20100f019eef2da Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 29 Nov 2005 23:40:01 +0000 Subject: r11964: rename flag to password_properties in SAM_UNK_INFO_1 because that's what it is. (SAM_UNK_INFO_1 should get a better name as well). Guenther (This used to be commit d94aaeb625c39b6205fe61c274aed57b1399bafc) --- source3/rpc_parse/parse_samr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index b5aa2cd831..0a055ff826 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -778,11 +778,11 @@ inits a structure. ********************************************************************/ void init_unk_info1(SAM_UNK_INFO_1 *u_1, uint16 min_pass_len, uint16 pass_hist, - uint32 flag, NTTIME nt_expire, NTTIME nt_min_age) + uint32 password_properties, NTTIME nt_expire, NTTIME nt_min_age) { u_1->min_length_password = min_pass_len; u_1->password_history = pass_hist; - u_1->flag = flag; + u_1->password_properties = password_properties; /* password never expire */ u_1->expire.high = nt_expire.high; @@ -811,7 +811,7 @@ static BOOL sam_io_unk_info1(const char *desc, SAM_UNK_INFO_1 * u_1, return False; if(!prs_uint16("password_history", ps, depth, &u_1->password_history)) return False; - if(!prs_uint32("flag", ps, depth, &u_1->flag)) + 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; -- cgit From d1f91f7c723733113b4e9792042101c80dfc064c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 3 Dec 2005 06:46:46 +0000 Subject: r12043: It's amazing the warnings you find when compiling on a 64-bit box with gcc4 and -O6... Fix a bunch of C99 dereferencing type-punned pointer will break strict-aliasing rules errors. Also added prs_int32 (not uint32...) as it's needed in one place. Find places where prs_uint32 was being used to marshall/unmarshall a time_t (a big no no on 64-bits). More warning fixes to come. Thanks to Volker for nudging me to compile like this. Jeremy. (This used to be commit c65b752604f8f58abc4e7ae8514dc2c7f086271c) --- source3/rpc_parse/parse_net.c | 2 +- source3/rpc_parse/parse_prs.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index ce2a085f47..3bd6977dbb 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -3317,7 +3317,7 @@ BOOL net_io_r_dsr_getdcname(const char *desc, NET_R_DSR_GETDCNAME *r_t, if (!prs_uint32("ptr_dc_address", ps, depth, &r_t->ptr_dc_address)) return False; - if (!prs_uint32("dc_address_type", ps, depth, &r_t->dc_address_type)) + 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)) diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 77f0e6d5c8..7c84ee800b 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -707,6 +707,35 @@ BOOL prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32) return True; } +/******************************************************************* + Stream an int32. + ********************************************************************/ + +BOOL prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32) +{ + char *q = prs_mem_get(ps, sizeof(int32)); + if (q == NULL) + return False; + + if (UNMARSHALLING(ps)) { + if (ps->bigendian_data) + *data32 = RIVALS(q,0); + else + *data32 = IVALS(q,0); + } else { + if (ps->bigendian_data) + RSIVALS(q,0,*data32); + else + SIVALS(q,0,*data32); + } + + DEBUG(5,("%s%04x %s: %08x\n", tab_depth(depth), ps->data_offset, name, *data32)); + + ps->data_offset += sizeof(int32); + + return True; +} + /******************************************************************* Stream a NTSTATUS ********************************************************************/ -- cgit From 7cd1af4a639b0852df25fe936519c9613b342dca Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sun, 11 Dec 2005 04:41:54 +0000 Subject: r12176: fix type mismatch after rpc structure change in rpc_svcctl.h (This used to be commit ba67d3ae0430abc196d245218556c23002e52076) --- source3/rpc_parse/parse_svcctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index e1a7ad8427..dd0c68bd79 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -41,7 +41,7 @@ static BOOL svcctl_io_service_status( const char *desc, SERVICE_STATUS *status, if(!prs_uint32("controls_accepted", ps, depth, &status->controls_accepted)) return False; - if(!prs_uint32("win32_exit_code", ps, depth, &status->win32_exit_code)) + if(!prs_werror("win32_exit_code", ps, depth, &status->win32_exit_code)) return False; if(!prs_uint32("service_exit_code", ps, depth, &status->service_exit_code)) -- cgit From e7a1a0ead2013464dc8204e5b997ddc3ae46e973 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 13 Jan 2006 20:24:50 +0000 Subject: r12914: adding query/set ops for security descriptors on services. (This used to be commit cefd2d7cb6140b068d66e2383e9acfa4c3c4b4c7) --- source3/rpc_parse/parse_svcctl.c | 103 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index dd0c68bd79..2cb44c6319 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -1029,6 +1029,109 @@ BOOL svcctl_io_r_unlock_service_db(const char *desc, SVCCTL_R_UNLOCK_SERVICE_DB 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; +} + -- cgit From a02415bf363e3c1b6863b135bdae3b2e2708db3b Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Sat, 14 Jan 2006 12:37:25 +0000 Subject: r12935: After discussion with Volker fix bug #3397 using a variant of the patch by Alex Deiter (tiamat@komi.mts.ru). Introduces level 9 of getuserinfo and allows to successfully install MS SMS2003 on a member of a Samba domain. Also added support for this level in rpcclient. The code for infolevel 9 is modelled upon Samba-TNG by Alex Deiter. Jerry, we need this in 3.0.21b. (This used to be commit 93461646ce2ad6e2f8b11d40ce98722d56a83b43) --- source3/rpc_parse/parse_samr.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 0a055ff826..6c2b4f4ea7 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5182,6 +5182,39 @@ static BOOL sam_io_user_info7(const char *desc, SAM_USER_INFO_7 * usr, 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. ********************************************************************/ @@ -6354,6 +6387,15 @@ static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, } 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); -- cgit From 0af1500fc0bafe61019f1b2ab1d9e1d369221240 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 3 Feb 2006 22:19:41 +0000 Subject: r13316: Let the carnage begin.... Sync with trunk as off r13315 (This used to be commit 17e63ac4ed8325c0d44fe62b2442449f3298559f) --- source3/rpc_parse/parse_dfs.c | 2917 ++++++++++++++++++++++++++++++++++------ source3/rpc_parse/parse_lsa.c | 221 ++- source3/rpc_parse/parse_net.c | 49 +- source3/rpc_parse/parse_prs.c | 29 + source3/rpc_parse/parse_rpc.c | 10 - source3/rpc_parse/parse_samr.c | 6 +- 6 files changed, 2811 insertions(+), 421 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index f102e95004..f1d0705302 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -1,24 +1,6 @@ -/* - * Unix SMB/CIFS implementation. - * MSDfs RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-2000, - * Copyright (C) Luke Kenneth Casson Leighton 1996-2000, - * Copyright (C) Shirish Kalele 2000. - * Copyright (C) Jeremy Allison 2001. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +/* + * Unix SMB/CIFS implementation. + * parser auto-generated by pidl. DO NOT MODIFY! */ #include "includes.h" @@ -26,519 +8,2660 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/******************************************************************* -Make a DFS_Q_DFS_QUERY structure -*******************************************************************/ - -void init_dfs_q_dfs_exist(DFS_Q_DFS_EXIST *q_d) +/* netdfs structures */ +BOOL init_netdfs_dfs_Info0(NETDFS_DFS_INFO0 *v) { - q_d->dummy = 0; + DEBUG(5,("init_netdfs_dfs_Info0\n")); + + return True; } -/************************************************************* - Read/write a DFS_Q_DFS_EXIST structure - dummy... - ************************************************************/ +BOOL netdfs_io_dfs_Info0_p(const char *desc, NETDFS_DFS_INFO0 *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info0_p"); + depth++; + return True; +} -BOOL dfs_io_q_dfs_exist(const char *desc, DFS_Q_DFS_EXIST *q_d, prs_struct *ps, int depth) +BOOL netdfs_io_dfs_Info0_d(const char *desc, NETDFS_DFS_INFO0 *v, prs_struct *ps, int depth) { - if(q_d == NULL) + if (v == NULL) return False; - - prs_debug(ps, depth, desc, "dfs_io_q_dfs_exist"); + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info0_d"); + depth++; + return True; +} +BOOL init_netdfs_dfs_Info1(NETDFS_DFS_INFO1 *v, const char *path) +{ + DEBUG(5,("init_netdfs_dfs_Info1\n")); + + if (path) { + v->ptr0_path = 1; + init_unistr2(&v->path, path, UNI_FLAGS_NONE); + } else { + v->ptr0_path = 0; + } + return True; } - -/************************************************************* - Read/write a DFS_R_DFS_EXIST structure - ************************************************************/ -BOOL dfs_io_r_dfs_exist(const char *desc, DFS_R_DFS_EXIST *q_d, prs_struct *ps, int depth) +BOOL netdfs_io_dfs_Info1_p(const char *desc, NETDFS_DFS_INFO1 *v, prs_struct *ps, int depth) { - if(q_d == NULL) + if (v == NULL) return False; - - prs_debug(ps, depth, desc, "dfs_io_r_dfs_exist"); + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info1_p"); depth++; - - if(!prs_align(ps)) + if (!prs_uint32("ptr0_path", ps, depth, &v->ptr0_path)) return False; + + + return True; +} - if(!prs_uint32("exist flag", ps, 0, &q_d->status)) +BOOL netdfs_io_dfs_Info1_d(const char *desc, NETDFS_DFS_INFO1 *v, prs_struct *ps, int depth) +{ + if (v == NULL) return False; - + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info1_d"); + depth++; + if (v->ptr0_path) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("path", &v->path, 1, ps, depth)) + return False; + } + return True; } - -/******************************************************************* -Make a DFS_Q_DFS_REMOVE structure -*******************************************************************/ -BOOL init_dfs_q_dfs_remove(DFS_Q_DFS_REMOVE *q_d, const char *entrypath, - const char *servername, const char *sharename) +BOOL init_netdfs_dfs_Info2(NETDFS_DFS_INFO2 *v, const char *path, const char *comment, uint32 state, uint32 num_stores) { - DEBUG(5,("init_dfs_q_dfs_remove\n")); - init_unistr2(&q_d->DfsEntryPath, entrypath, UNI_STR_TERMINATE); - init_unistr2(&q_d->ServerName, servername, UNI_STR_TERMINATE); - init_unistr2(&q_d->ShareName, sharename, UNI_STR_TERMINATE); - q_d->ptr_ServerName = q_d->ptr_ShareName = 1; + DEBUG(5,("init_netdfs_dfs_Info2\n")); + + if (path) { + v->ptr0_path = 1; + init_unistr2(&v->path, path, UNI_FLAGS_NONE); + } else { + v->ptr0_path = 0; + } + + if (comment) { + v->ptr0_comment = 1; + init_unistr2(&v->comment, comment, UNI_FLAGS_NONE); + } else { + v->ptr0_comment = 0; + } + + v->state = state; + + v->num_stores = num_stores; + return True; } -/******************************************************************* -Read/write a DFS_Q_DFS_REMOVE structure -*******************************************************************/ - -BOOL dfs_io_q_dfs_remove(const char *desc, DFS_Q_DFS_REMOVE *q_d, prs_struct *ps, int depth) +BOOL netdfs_io_dfs_Info2_p(const char *desc, NETDFS_DFS_INFO2 *v, prs_struct *ps, int depth) { - if(q_d == NULL) + if (v == NULL) return False; - - prs_debug(ps, depth, desc, "dfs_io_q_dfs_remove"); + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info2_p"); depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("DfsEntryPath",&q_d->DfsEntryPath, 1, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_ServerName", ps, depth, &q_d->ptr_ServerName)) + if (!prs_uint32("ptr0_path", ps, depth, &v->ptr0_path)) return False; - if(q_d->ptr_ServerName) - if (!smb_io_unistr2("ServerName",&q_d->ServerName, q_d->ptr_ServerName, ps, depth)) - return False; - if(!prs_align(ps)) + + + if (!prs_uint32("ptr0_comment", ps, depth, &v->ptr0_comment)) return False; - - if(!prs_uint32("ptr_ShareName", ps, depth, &q_d->ptr_ShareName)) + + + if (!prs_uint32("state", ps, depth, &v->state)) return False; - if(q_d->ptr_ShareName) - if (!smb_io_unistr2("ShareName",&q_d->ShareName, q_d->ptr_ShareName, ps, depth)) - return False; - if(!prs_align(ps)) + + if (!prs_uint32("num_stores", ps, depth, &v->num_stores)) return False; - + return True; } -/******************************************************************* -Read/write a DFS_R_DFS_REMOVE structure -*******************************************************************/ - -BOOL dfs_io_r_dfs_remove(const char *desc, DFS_R_DFS_REMOVE *r_d, prs_struct *ps, int depth) +BOOL netdfs_io_dfs_Info2_d(const char *desc, NETDFS_DFS_INFO2 *v, prs_struct *ps, int depth) { - if(r_d == NULL) + if (v == NULL) return False; - - prs_debug(ps, depth, desc, "dfs_io_r_dfs_remove"); + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info2_d"); depth++; - - if(!prs_werror("status", ps, depth, &r_d->status)) - return False; - + if (v->ptr0_path) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("path", &v->path, 1, ps, depth)) + return False; + } + + if (v->ptr0_comment) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("comment", &v->comment, 1, ps, depth)) + return False; + } + + + return True; } -/******************************************************************* -Make a DFS_Q_DFS_ADD structure -*******************************************************************/ - -BOOL init_dfs_q_dfs_add(DFS_Q_DFS_ADD *q_d, const char *entrypath, - const char *servername, const char *sharename, - const char *comment, uint32 flags) +BOOL init_netdfs_dfs_StorageInfo(NETDFS_DFS_STORAGEINFO *v, uint32 state, const char *server, const char *share) { - DEBUG(5,("init_dfs_q_dfs_add\n")); - q_d->ptr_DfsEntryPath = q_d->ptr_ServerName = q_d->ptr_ShareName = 1; - init_unistr2(&q_d->DfsEntryPath, entrypath, UNI_STR_TERMINATE); - init_unistr2(&q_d->ServerName, servername, UNI_STR_TERMINATE); - init_unistr2(&q_d->ShareName, sharename, UNI_STR_TERMINATE); - if(comment != NULL) { - init_unistr2(&q_d->Comment, comment,UNI_STR_TERMINATE); - q_d->ptr_Comment = 1; + DEBUG(5,("init_netdfs_dfs_StorageInfo\n")); + + v->state = state; + + if (server) { + v->ptr0_server = 1; + init_unistr2(&v->server, server, UNI_FLAGS_NONE); } else { - q_d->ptr_Comment = 0; + v->ptr0_server = 0; } - - q_d->Flags = flags; + + if (share) { + v->ptr0_share = 1; + init_unistr2(&v->share, share, UNI_FLAGS_NONE); + } else { + v->ptr0_share = 0; + } + return True; } -/************************************************************ - Read/write a DFS_Q_DFS_ADD structure - ************************************************************/ - -BOOL dfs_io_q_dfs_add(const char *desc, DFS_Q_DFS_ADD *q_d, prs_struct *ps, int depth) +BOOL netdfs_io_dfs_StorageInfo_p(const char *desc, NETDFS_DFS_STORAGEINFO *v, prs_struct *ps, int depth) { - if(q_d == NULL) + if (v == NULL) return False; - - prs_debug(ps, depth, desc, "dfs_io_q_dfs_add"); + + prs_debug(ps, depth, desc, "netdfs_io_dfs_StorageInfo_p"); depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("DfsEntryPath",&q_d->DfsEntryPath, 1, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("ServerName",&q_d->ServerName, 1, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_ShareName", ps, depth, &q_d->ptr_ShareName)) - return False; - if(!smb_io_unistr2("ShareName",&q_d->ShareName, 1, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_Comment", ps, depth, &q_d->ptr_Comment)) + if (!prs_uint32("state", ps, depth, &v->state)) return False; - if(!smb_io_unistr2("",&q_d->Comment, q_d->ptr_Comment , ps, depth)) + + if (!prs_uint32("ptr0_server", ps, depth, &v->ptr0_server)) return False; - if(!prs_align(ps)) + + + if (!prs_uint32("ptr0_share", ps, depth, &v->ptr0_share)) return False; - - if(!prs_uint32("Flags", ps, depth, &q_d->Flags)) - return True; - + + return True; } -/************************************************************ - Read/write a DFS_R_DFS_ADD structure - ************************************************************/ - -BOOL dfs_io_r_dfs_add(const char *desc, DFS_R_DFS_ADD *r_d, prs_struct *ps, int depth) +BOOL netdfs_io_dfs_StorageInfo_d(const char *desc, NETDFS_DFS_STORAGEINFO *v, prs_struct *ps, int depth) { - if(r_d == NULL) + if (v == NULL) return False; - - prs_debug(ps, depth, desc, "dfs_io_r_dfs_add"); + + prs_debug(ps, depth, desc, "netdfs_io_dfs_StorageInfo_d"); depth++; - - if(!prs_werror("status", ps, depth, &r_d->status)) - return False; - + + if (v->ptr0_server) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("server", &v->server, 1, ps, depth)) + return False; + } + + if (v->ptr0_share) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("share", &v->share, 1, ps, depth)) + return False; + } + return True; } -BOOL init_dfs_q_dfs_get_info(DFS_Q_DFS_GET_INFO *q_d, const char *entrypath, - const char *servername, const char *sharename, - uint32 info_level) +BOOL init_netdfs_dfs_Info3(NETDFS_DFS_INFO3 *v, const char *path, const char *comment, uint32 state, uint32 num_stores, NETDFS_DFS_STORAGEINFO **stores) { - DEBUG(5,("init_dfs_q2_get_info\n")); - init_unistr2(&q_d->uni_path, entrypath, UNI_STR_TERMINATE); - init_unistr2(&q_d->uni_server, servername, UNI_STR_TERMINATE); - init_unistr2(&q_d->uni_share, sharename, UNI_STR_TERMINATE); - q_d->level = info_level; - q_d->ptr_server = q_d->ptr_share = 1; + DEBUG(5,("init_netdfs_dfs_Info3\n")); + + if (path) { + v->ptr0_path = 1; + init_unistr2(&v->path, path, UNI_FLAGS_NONE); + } else { + v->ptr0_path = 0; + } + + if (comment) { + v->ptr0_comment = 1; + init_unistr2(&v->comment, comment, UNI_FLAGS_NONE); + } else { + v->ptr0_comment = 0; + } + + v->state = state; + + v->num_stores = num_stores; + + if (stores) { + v->ptr0_stores = 1; + v->stores = *stores; + } else { + v->ptr0_stores = 0; + } + return True; } -/************************************************************ - Read/write a DFS_Q_GET_INFO structure - ************************************************************/ - -BOOL dfs_io_q_dfs_get_info(const char *desc, DFS_Q_DFS_GET_INFO* q_i, prs_struct* ps, int depth) +BOOL netdfs_io_dfs_Info3_p(const char *desc, NETDFS_DFS_INFO3 *v, prs_struct *ps, int depth) { - if(q_i == NULL) + if (v == NULL) return False; - - prs_debug(ps, depth, desc, "dfs_io_q_dfs_get_info"); + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info3_p"); depth++; - - if(!smb_io_unistr2("",&q_i->uni_path, 1, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_server", ps, depth, &q_i->ptr_server)) + if (!prs_uint32("ptr0_path", ps, depth, &v->ptr0_path)) return False; - - if(q_i->ptr_server) - if (!smb_io_unistr2("",&q_i->uni_server, q_i->ptr_server, ps, depth)) - return False; - if(!prs_align(ps)) + + + if (!prs_uint32("ptr0_comment", ps, depth, &v->ptr0_comment)) return False; - - if(!prs_uint32("ptr_share", ps, depth, &q_i->ptr_share)) + + + if (!prs_uint32("state", ps, depth, &v->state)) return False; - if(q_i->ptr_share) - if(!smb_io_unistr2("", &q_i->uni_share, q_i->ptr_share, ps, depth)) - return False; - if(!prs_align(ps)) + + if (!prs_uint32("num_stores", ps, depth, &v->num_stores)) return False; - - if(!prs_uint32("level", ps, depth, &q_i->level)) + + if (!prs_uint32("ptr0_stores", ps, depth, &v->ptr0_stores)) return False; + + return True; } -/************************************************************ - Read/write a DFS_R_GET_INFO structure - ************************************************************/ - -BOOL dfs_io_r_dfs_get_info(const char *desc, DFS_R_DFS_GET_INFO* r_i, prs_struct* ps, int depth) +BOOL netdfs_io_dfs_Info3_d(const char *desc, NETDFS_DFS_INFO3 *v, prs_struct *ps, int depth) { - if(r_i == NULL) - return False; - - if(!prs_uint32("level", ps, depth, &r_i->level)) - return False; - if(!prs_uint32("ptr_ctr", ps, depth, &r_i->ptr_ctr)) - return False; - - if(!dfs_io_dfs_info_ctr("", &r_i->ctr, 1, r_i->level, ps, depth)) - return False; - if(!prs_werror("status", ps, depth, &r_i->status)) + uint32 i_stores_1; + + if (v == NULL) return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info3_d"); + depth++; + if (v->ptr0_path) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("path", &v->path, 1, ps, depth)) + return False; + } + + if (v->ptr0_comment) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("comment", &v->comment, 1, ps, depth)) + return False; + } + + + + if (v->ptr0_stores) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("size_stores", ps, depth, &v->size_stores)) + return False; + + if (UNMARSHALLING(ps)) { + v->stores = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->stores)*v->num_stores); + } + for (i_stores_1=0; i_stores_1num_stores;i_stores_1++) { + if (!netdfs_io_dfs_StorageInfo_p("stores", &v->stores[i_stores_1], ps, depth)) + return False; + } + for (i_stores_1=0; i_stores_1num_stores;i_stores_1++) { + if (!netdfs_io_dfs_StorageInfo_d("stores", &v->stores[i_stores_1], ps, depth)) + return False; + } + } + return True; } - -/************************************************************ - Make a DFS_Q_DFS_ENUM structure - ************************************************************/ -BOOL init_dfs_q_dfs_enum(DFS_Q_DFS_ENUM *q_d, uint32 level, DFS_INFO_CTR *ctr) + +BOOL init_netdfs_dfs_Info4(NETDFS_DFS_INFO4 *v, const char *path, const char *comment, uint32 state, uint32 timeout, struct uuid guid, uint32 num_stores, NETDFS_DFS_STORAGEINFO **stores) { - q_d->level = level; - q_d->maxpreflen = -1; - q_d->ptr_buffer = 1; - q_d->level2 = level; - - q_d->ptr_num_entries = 1; - q_d->num_entries = 0; - q_d->num_entries2 = 0; - q_d->reshnd.ptr_hnd = 1; - q_d->reshnd.handle = 0; + DEBUG(5,("init_netdfs_dfs_Info4\n")); + + if (path) { + v->ptr0_path = 1; + init_unistr2(&v->path, path, UNI_FLAGS_NONE); + } else { + v->ptr0_path = 0; + } + + if (comment) { + v->ptr0_comment = 1; + init_unistr2(&v->comment, comment, UNI_FLAGS_NONE); + } else { + v->ptr0_comment = 0; + } + + v->state = state; + + v->timeout = timeout; + + + + v->num_stores = num_stores; + + if (stores) { + v->ptr0_stores = 1; + v->stores = *stores; + } else { + v->ptr0_stores = 0; + } + return True; } - -/************************************************************ - Read or write the DFS_Q_DFS_ENUM structure - ************************************************************/ -BOOL dfs_io_q_dfs_enum(const char *desc, DFS_Q_DFS_ENUM *q_d, prs_struct *ps, int depth) +BOOL netdfs_io_dfs_Info4_p(const char *desc, NETDFS_DFS_INFO4 *v, prs_struct *ps, int depth) { - if(q_d == NULL) + if (v == NULL) return False; - - prs_debug(ps, depth, desc, "dfs_io_q_dfs_enum"); + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info4_p"); depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("level", ps, depth, &q_d->level)) - return False; - if(!prs_uint32("maxpreflen", ps, depth, &q_d->maxpreflen)) - return False; - if(!prs_uint32("ptr_buffer", ps, depth, &q_d->ptr_buffer)) + if (!prs_uint32("ptr0_path", ps, depth, &v->ptr0_path)) return False; - if(!prs_uint32("level2", ps, depth, &q_d->level2)) + + + if (!prs_uint32("ptr0_comment", ps, depth, &v->ptr0_comment)) return False; - if(!prs_uint32("level3", ps, depth, &q_d->level2)) + + + if (!prs_uint32("state", ps, depth, &v->state)) return False; - - if(!prs_uint32("ptr_num_entries", ps, depth, &q_d->ptr_num_entries)) + + if (!prs_uint32("timeout", ps, depth, &v->timeout)) return False; - if(!prs_uint32("num_entries", ps, depth, &q_d->num_entries)) + + if (!smb_io_uuid("guid", &v->guid, ps, depth)) return False; - if(!prs_uint32("num_entries2", ps, depth, &q_d->num_entries2)) + + if (!prs_uint32("num_stores", ps, depth, &v->num_stores)) return False; - if(!smb_io_enum_hnd("resume_hnd",&q_d->reshnd, ps, depth)) + + if (!prs_uint32("ptr0_stores", ps, depth, &v->ptr0_stores)) return False; + + return True; } -/************************************************************ - Read/write a DFS_INFO_CTR structure - ************************************************************/ - -BOOL dfs_io_dfs_info_ctr(const char *desc, DFS_INFO_CTR* ctr, uint32 num_entries, uint32 level, prs_struct* ps, int depth) +BOOL netdfs_io_dfs_Info4_d(const char *desc, NETDFS_DFS_INFO4 *v, prs_struct *ps, int depth) { - int i=0; - - switch(level) { - case 1: - depth++; - /* should depend on whether marshalling or unmarshalling! */ - if(UNMARSHALLING(ps)) { - ctr->dfs.info1 = PRS_ALLOC_MEM(ps, DFS_INFO_1, num_entries); - if (!ctr->dfs.info1) - return False; - } - - for(i=0;idfs.info1[i].ptr_entrypath)) - return False; - } - for(i=0;idfs.info1[i].entrypath, ctr->dfs.info1[i].ptr_entrypath, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - } - depth--; - break; - case 2: - depth++; - if(UNMARSHALLING(ps)) { - ctr->dfs.info2 = PRS_ALLOC_MEM(ps, DFS_INFO_2, num_entries); - if (!ctr->dfs.info2) - return False; - } - - for(i=0;idfs.info2[i].ptr_entrypath)) - return False; - if(!prs_uint32("ptr_comment", ps, depth, &ctr->dfs.info2[i].ptr_comment)) - return False; - if(!prs_uint32("state", ps, depth, &ctr->dfs.info2[i].state)) - return False; - if(!prs_uint32("num_storages", ps, depth, &ctr->dfs.info2[i].num_storages)) - return False; - } - for(i=0;idfs.info2[i].entrypath, ctr->dfs.info2[i].ptr_entrypath, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("",&ctr->dfs.info2[i].comment, ctr->dfs.info2[i].ptr_comment, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - } - depth--; - break; - case 3: - depth++; - if(UNMARSHALLING(ps)) { - ctr->dfs.info3 = PRS_ALLOC_MEM(ps, DFS_INFO_3, num_entries); - if (!ctr->dfs.info3) - return False; + uint32 i_stores_1; + + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info4_d"); + depth++; + if (v->ptr0_path) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("path", &v->path, 1, ps, depth)) + return False; + } + + if (v->ptr0_comment) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("comment", &v->comment, 1, ps, depth)) + return False; + } + + + + + + if (v->ptr0_stores) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("size_stores", ps, depth, &v->size_stores)) + return False; + + if (UNMARSHALLING(ps)) { + v->stores = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->stores)*v->num_stores); } - - for(i=0;idfs.info3[i].ptr_entrypath)) - return False; - if(!prs_uint32("ptr_comment", ps, depth, &ctr->dfs.info3[i].ptr_comment)) - return False; - if(!prs_uint32("state", ps, depth, &ctr->dfs.info3[i].state)) - return False; - if(!prs_uint32("num_storages", ps, depth, &ctr->dfs.info3[i].num_storages)) - return False; - if(!prs_uint32("ptr_storages", ps, depth, &ctr->dfs.info3[i].ptr_storages)) + for (i_stores_1=0; i_stores_1num_stores;i_stores_1++) { + if (!netdfs_io_dfs_StorageInfo_p("stores", &v->stores[i_stores_1], ps, depth)) return False; } - for(i=0;idfs.info3[i].entrypath, ctr->dfs.info3[i].ptr_entrypath, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("", &ctr->dfs.info3[i].comment, ctr->dfs.info3[i].ptr_comment, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - if(!prs_uint32("num_storage_infos", ps, depth, &ctr->dfs.info3[i].num_storage_infos)) - return False; - - if(!dfs_io_dfs_storage_info("storage_info", &ctr->dfs.info3[i], ps, depth)) + for (i_stores_1=0; i_stores_1num_stores;i_stores_1++) { + if (!netdfs_io_dfs_StorageInfo_d("stores", &v->stores[i_stores_1], ps, depth)) return False; } } - + return True; } -/************************************************************ - Read/write a DFS_R_DFS_ENUM structure - ************************************************************/ +BOOL init_netdfs_dfs_Info100(NETDFS_DFS_INFO100 *v, const char *comment) +{ + DEBUG(5,("init_netdfs_dfs_Info100\n")); + + if (comment) { + v->ptr0_comment = 1; + init_unistr2(&v->comment, comment, UNI_FLAGS_NONE); + } else { + v->ptr0_comment = 0; + } + + return True; +} -BOOL dfs_io_r_dfs_enum(const char *desc, DFS_R_DFS_ENUM *q_d, prs_struct *ps, int depth) +BOOL netdfs_io_dfs_Info100_p(const char *desc, NETDFS_DFS_INFO100 *v, prs_struct *ps, int depth) { - DFS_INFO_CTR *ctr; - if(q_d == NULL) + if (v == NULL) return False; - ctr = q_d->ctr; - if(ctr == NULL) + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info100_p"); + depth++; + if (!prs_uint32("ptr0_comment", ps, depth, &v->ptr0_comment)) return False; + + + return True; +} - prs_debug(ps, depth, desc, "dfs_io_r_dfs_enum"); +BOOL netdfs_io_dfs_Info100_d(const char *desc, NETDFS_DFS_INFO100 *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info100_d"); depth++; + if (v->ptr0_comment) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("comment", &v->comment, 1, ps, depth)) + return False; + } + + return True; +} - if(!prs_align(ps)) - return False; +BOOL init_netdfs_dfs_Info101(NETDFS_DFS_INFO101 *v, uint32 state) +{ + DEBUG(5,("init_netdfs_dfs_Info101\n")); + + v->state = state; + + return True; +} - if(!prs_uint32("ptr_buffer", ps, depth, &q_d->ptr_buffer)) +BOOL netdfs_io_dfs_Info101_p(const char *desc, NETDFS_DFS_INFO101 *v, prs_struct *ps, int depth) +{ + if (v == NULL) return False; - if(!prs_uint32("level", ps, depth, &q_d->level)) + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info101_p"); + depth++; + if (!prs_uint32("state", ps, depth, &v->state)) return False; - if(!prs_uint32("level2", ps, depth, &ctr->switch_value)) + + return True; +} + +BOOL netdfs_io_dfs_Info101_d(const char *desc, NETDFS_DFS_INFO101 *v, prs_struct *ps, int depth) +{ + if (v == NULL) return False; - if(!prs_uint32("ptr_num_entries", ps, depth, &q_d->ptr_num_entries)) + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info101_d"); + depth++; + + return True; +} + +BOOL init_netdfs_dfs_Info102(NETDFS_DFS_INFO102 *v, uint32 timeout) +{ + DEBUG(5,("init_netdfs_dfs_Info102\n")); + + v->timeout = timeout; + + return True; +} + +BOOL netdfs_io_dfs_Info102_p(const char *desc, NETDFS_DFS_INFO102 *v, prs_struct *ps, int depth) +{ + if (v == NULL) return False; - if(q_d->ptr_num_entries) - if(!prs_uint32("num_entries", ps, depth, &q_d->num_entries)) - return False; - if(!prs_uint32("ptr_num_entries2", ps, depth, &q_d->ptr_num_entries2)) + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info102_p"); + depth++; + if (!prs_uint32("timeout", ps, depth, &v->timeout)) return False; - if(q_d->ptr_num_entries2) - if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries)) - return False; + + return True; +} - if(!dfs_io_dfs_info_ctr("", ctr, q_d->num_entries, q_d->level, ps, depth)) +BOOL netdfs_io_dfs_Info102_d(const char *desc, NETDFS_DFS_INFO102 *v, prs_struct *ps, int depth) +{ + if (v == NULL) return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info102_d"); + depth++; + + return True; +} + +BOOL init_netdfs_dfs_Info200(NETDFS_DFS_INFO200 *v, const char *dom_root) +{ + DEBUG(5,("init_netdfs_dfs_Info200\n")); + + if (dom_root) { + v->ptr0_dom_root = 1; + init_unistr2(&v->dom_root, dom_root, UNI_FLAGS_NONE); + } else { + v->ptr0_dom_root = 0; + } + + return True; +} - if(!smb_io_enum_hnd("resume_hnd", &q_d->reshnd, ps, depth)) +BOOL netdfs_io_dfs_Info200_p(const char *desc, NETDFS_DFS_INFO200 *v, prs_struct *ps, int depth) +{ + if (v == NULL) return False; - if(!prs_werror("status", ps, depth, &q_d->status)) + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info200_p"); + depth++; + if (!prs_uint32("ptr0_dom_root", ps, depth, &v->ptr0_dom_root)) return False; + + return True; } -BOOL dfs_io_dfs_storage_info(const char *desc, DFS_INFO_3* info3, prs_struct *ps, int depth) +BOOL netdfs_io_dfs_Info200_d(const char *desc, NETDFS_DFS_INFO200 *v, prs_struct *ps, int depth) { - int i=0; - if(info3 == NULL) + if (v == NULL) return False; - - prs_debug(ps, depth, desc, "smb_io_dfs_storage_info"); + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info200_d"); depth++; - - if(UNMARSHALLING(ps)) { - info3->storages = PRS_ALLOC_MEM(ps, DFS_STORAGE_INFO, info3->num_storage_infos); - if (!info3->storages) + if (v->ptr0_dom_root) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("dom_root", &v->dom_root, 1, ps, depth)) return False; } + + return True; +} - for(i=0;inum_storage_infos;i++) { - if(!prs_uint32("storage_state", ps, depth, &info3->storages[i].state)) - return False; - if(!prs_uint32("ptr_servername", ps, depth, &info3->storages[i].ptr_servername)) - return False; - if(!prs_uint32("ptr_sharename", ps, depth, &info3->storages[i].ptr_sharename)) - return False; +BOOL init_netdfs_dfs_Info300(NETDFS_DFS_INFO300 *v, uint32 flags, const char *dom_root) +{ + DEBUG(5,("init_netdfs_dfs_Info300\n")); + + v->flags = flags; + + if (dom_root) { + v->ptr0_dom_root = 1; + init_unistr2(&v->dom_root, dom_root, UNI_FLAGS_NONE); + } else { + v->ptr0_dom_root = 0; } + + return True; +} - for(i=0;inum_storage_infos;i++) { - if(!smb_io_unistr2("servername", &info3->storages[i].servername, info3->storages[i].ptr_servername, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("sharename", &info3->storages[i].sharename, info3->storages[i].ptr_sharename, ps, depth)) +BOOL netdfs_io_dfs_Info300_p(const char *desc, NETDFS_DFS_INFO300 *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info300_p"); + depth++; + if (!prs_uint32("flags", ps, depth, &v->flags)) + return False; + + if (!prs_uint32("ptr0_dom_root", ps, depth, &v->ptr0_dom_root)) + return False; + + + return True; +} + +BOOL netdfs_io_dfs_Info300_d(const char *desc, NETDFS_DFS_INFO300 *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_Info300_d"); + depth++; + + if (v->ptr0_dom_root) { + if (!prs_align_custom(ps, 4)) return False; - if(!prs_align(ps)) + + if (!smb_io_unistr2("dom_root", &v->dom_root, 1, ps, depth)) return False; } - + return True; } + +BOOL netdfs_io_dfs_Info_p(const char *desc, NETDFS_DFS_INFO_CTR* v, prs_struct *ps, int depth) +{ + if (!prs_uint32("switch_value", ps, depth, &v->switch_value)) + return False; + + switch (v->switch_value) { + case 0: + depth++; + if (!prs_uint32("ptr0_info0", ps, depth, &v->ptr0)) + return False; + + depth--; + break; + + case 1: + depth++; + if (!prs_uint32("ptr0_info1", ps, depth, &v->ptr0)) + return False; + + depth--; + break; + + case 2: + depth++; + if (!prs_uint32("ptr0_info2", ps, depth, &v->ptr0)) + return False; + + depth--; + break; + + case 3: + depth++; + if (!prs_uint32("ptr0_info3", ps, depth, &v->ptr0)) + return False; + + depth--; + break; + + case 4: + depth++; + if (!prs_uint32("ptr0_info4", ps, depth, &v->ptr0)) + return False; + + depth--; + break; + + case 100: + depth++; + if (!prs_uint32("ptr0_info100", ps, depth, &v->ptr0)) + return False; + + depth--; + break; + + case 101: + depth++; + if (!prs_uint32("ptr0_info101", ps, depth, &v->ptr0)) + return False; + + depth--; + break; + + case 102: + depth++; + if (!prs_uint32("ptr0_info102", ps, depth, &v->ptr0)) + return False; + + depth--; + break; + + default: + return False; + + } + + return True; +} + +BOOL netdfs_io_dfs_Info_d(const char *desc, NETDFS_DFS_INFO_CTR* v, prs_struct *ps, int depth) +{ + switch (v->switch_value) { + case 0: + depth++; + if (v->ptr0) { + if (!prs_align_custom(ps, 1)) + return False; + + if (!netdfs_io_dfs_Info0_p("info0", &v->u.info0, ps, depth)) + return False; + if (!netdfs_io_dfs_Info0_d("info0", &v->u.info0, ps, depth)) + return False; + } + depth--; + break; + + case 1: + depth++; + if (v->ptr0) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!netdfs_io_dfs_Info1_p("info1", &v->u.info1, ps, depth)) + return False; + if (!netdfs_io_dfs_Info1_d("info1", &v->u.info1, ps, depth)) + return False; + } + depth--; + break; + + case 2: + depth++; + if (v->ptr0) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!netdfs_io_dfs_Info2_p("info2", &v->u.info2, ps, depth)) + return False; + if (!netdfs_io_dfs_Info2_d("info2", &v->u.info2, ps, depth)) + return False; + } + depth--; + break; + + case 3: + depth++; + if (v->ptr0) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!netdfs_io_dfs_Info3_p("info3", &v->u.info3, ps, depth)) + return False; + if (!netdfs_io_dfs_Info3_d("info3", &v->u.info3, ps, depth)) + return False; + } + depth--; + break; + + case 4: + depth++; + if (v->ptr0) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!netdfs_io_dfs_Info4_p("info4", &v->u.info4, ps, depth)) + return False; + if (!netdfs_io_dfs_Info4_d("info4", &v->u.info4, ps, depth)) + return False; + } + depth--; + break; + + case 100: + depth++; + if (v->ptr0) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!netdfs_io_dfs_Info100_p("info100", &v->u.info100, ps, depth)) + return False; + if (!netdfs_io_dfs_Info100_d("info100", &v->u.info100, ps, depth)) + return False; + } + depth--; + break; + + case 101: + depth++; + if (v->ptr0) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!netdfs_io_dfs_Info101_p("info101", &v->u.info101, ps, depth)) + return False; + if (!netdfs_io_dfs_Info101_d("info101", &v->u.info101, ps, depth)) + return False; + } + depth--; + break; + + case 102: + depth++; + if (v->ptr0) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!netdfs_io_dfs_Info102_p("info102", &v->u.info102, ps, depth)) + return False; + if (!netdfs_io_dfs_Info102_d("info102", &v->u.info102, ps, depth)) + return False; + } + depth--; + break; + + } + + return True; +} +BOOL init_netdfs_dfs_EnumArray1(NETDFS_DFS_ENUMARRAY1 *v, uint32 count, NETDFS_DFS_INFO1 **s) +{ + DEBUG(5,("init_netdfs_dfs_EnumArray1\n")); + + v->count = count; + + if (s) { + v->ptr0_s = 1; + v->s = *s; + } else { + v->ptr0_s = 0; + } + + return True; +} + +BOOL netdfs_io_dfs_EnumArray1_p(const char *desc, NETDFS_DFS_ENUMARRAY1 *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray1_p"); + depth++; + if (!prs_uint32("count", ps, depth, &v->count)) + return False; + + if (!prs_uint32("ptr0_s", ps, depth, &v->ptr0_s)) + return False; + + + return True; +} + +BOOL netdfs_io_dfs_EnumArray1_d(const char *desc, NETDFS_DFS_ENUMARRAY1 *v, prs_struct *ps, int depth) +{ + uint32 i_s_1; + + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray1_d"); + depth++; + + if (v->ptr0_s) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("size_s", ps, depth, &v->size_s)) + return False; + + if (UNMARSHALLING(ps)) { + v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); + } + for (i_s_1=0; i_s_1count;i_s_1++) { + if (!netdfs_io_dfs_Info1_p("s", &v->s[i_s_1], ps, depth)) + return False; + } + for (i_s_1=0; i_s_1count;i_s_1++) { + if (!netdfs_io_dfs_Info1_d("s", &v->s[i_s_1], ps, depth)) + return False; + } + } + + return True; +} + +BOOL init_netdfs_dfs_EnumArray2(NETDFS_DFS_ENUMARRAY2 *v, uint32 count, NETDFS_DFS_INFO2 **s) +{ + DEBUG(5,("init_netdfs_dfs_EnumArray2\n")); + + v->count = count; + + if (s) { + v->ptr0_s = 1; + v->s = *s; + } else { + v->ptr0_s = 0; + } + + return True; +} + +BOOL netdfs_io_dfs_EnumArray2_p(const char *desc, NETDFS_DFS_ENUMARRAY2 *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray2_p"); + depth++; + if (!prs_uint32("count", ps, depth, &v->count)) + return False; + + if (!prs_uint32("ptr0_s", ps, depth, &v->ptr0_s)) + return False; + + + return True; +} + +BOOL netdfs_io_dfs_EnumArray2_d(const char *desc, NETDFS_DFS_ENUMARRAY2 *v, prs_struct *ps, int depth) +{ + uint32 i_s_1; + + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray2_d"); + depth++; + + if (v->ptr0_s) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("size_s", ps, depth, &v->size_s)) + return False; + + if (UNMARSHALLING(ps)) { + v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); + } + for (i_s_1=0; i_s_1count;i_s_1++) { + if (!netdfs_io_dfs_Info2_p("s", &v->s[i_s_1], ps, depth)) + return False; + } + for (i_s_1=0; i_s_1count;i_s_1++) { + if (!netdfs_io_dfs_Info2_d("s", &v->s[i_s_1], ps, depth)) + return False; + } + } + + return True; +} + +BOOL init_netdfs_dfs_EnumArray3(NETDFS_DFS_ENUMARRAY3 *v, uint32 count, NETDFS_DFS_INFO3 **s) +{ + DEBUG(5,("init_netdfs_dfs_EnumArray3\n")); + + v->count = count; + + if (s) { + v->ptr0_s = 1; + v->s = *s; + } else { + v->ptr0_s = 0; + } + + return True; +} + +BOOL netdfs_io_dfs_EnumArray3_p(const char *desc, NETDFS_DFS_ENUMARRAY3 *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray3_p"); + depth++; + if (!prs_uint32("count", ps, depth, &v->count)) + return False; + + if (!prs_uint32("ptr0_s", ps, depth, &v->ptr0_s)) + return False; + + + return True; +} + +BOOL netdfs_io_dfs_EnumArray3_d(const char *desc, NETDFS_DFS_ENUMARRAY3 *v, prs_struct *ps, int depth) +{ + uint32 i_s_1; + + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray3_d"); + depth++; + + if (v->ptr0_s) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("size_s", ps, depth, &v->size_s)) + return False; + + if (UNMARSHALLING(ps)) { + v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); + } + for (i_s_1=0; i_s_1count;i_s_1++) { + if (!netdfs_io_dfs_Info3_p("s", &v->s[i_s_1], ps, depth)) + return False; + } + for (i_s_1=0; i_s_1count;i_s_1++) { + if (!netdfs_io_dfs_Info3_d("s", &v->s[i_s_1], ps, depth)) + return False; + } + } + + return True; +} + +BOOL init_netdfs_dfs_EnumArray4(NETDFS_DFS_ENUMARRAY4 *v, uint32 count, NETDFS_DFS_INFO4 **s) +{ + DEBUG(5,("init_netdfs_dfs_EnumArray4\n")); + + v->count = count; + + if (s) { + v->ptr0_s = 1; + v->s = *s; + } else { + v->ptr0_s = 0; + } + + return True; +} + +BOOL netdfs_io_dfs_EnumArray4_p(const char *desc, NETDFS_DFS_ENUMARRAY4 *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray4_p"); + depth++; + if (!prs_uint32("count", ps, depth, &v->count)) + return False; + + if (!prs_uint32("ptr0_s", ps, depth, &v->ptr0_s)) + return False; + + + return True; +} + +BOOL netdfs_io_dfs_EnumArray4_d(const char *desc, NETDFS_DFS_ENUMARRAY4 *v, prs_struct *ps, int depth) +{ + uint32 i_s_1; + + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray4_d"); + depth++; + + if (v->ptr0_s) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("size_s", ps, depth, &v->size_s)) + return False; + + if (UNMARSHALLING(ps)) { + v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); + } + for (i_s_1=0; i_s_1count;i_s_1++) { + if (!netdfs_io_dfs_Info4_p("s", &v->s[i_s_1], ps, depth)) + return False; + } + for (i_s_1=0; i_s_1count;i_s_1++) { + if (!netdfs_io_dfs_Info4_d("s", &v->s[i_s_1], ps, depth)) + return False; + } + } + + return True; +} + +BOOL init_netdfs_dfs_EnumArray200(NETDFS_DFS_ENUMARRAY200 *v, uint32 count, NETDFS_DFS_INFO200 **s) +{ + DEBUG(5,("init_netdfs_dfs_EnumArray200\n")); + + v->count = count; + + if (s) { + v->ptr0_s = 1; + v->s = *s; + } else { + v->ptr0_s = 0; + } + + return True; +} + +BOOL netdfs_io_dfs_EnumArray200_p(const char *desc, NETDFS_DFS_ENUMARRAY200 *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray200_p"); + depth++; + if (!prs_uint32("count", ps, depth, &v->count)) + return False; + + if (!prs_uint32("ptr0_s", ps, depth, &v->ptr0_s)) + return False; + + + return True; +} + +BOOL netdfs_io_dfs_EnumArray200_d(const char *desc, NETDFS_DFS_ENUMARRAY200 *v, prs_struct *ps, int depth) +{ + uint32 i_s_1; + + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray200_d"); + depth++; + + if (v->ptr0_s) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("size_s", ps, depth, &v->size_s)) + return False; + + if (UNMARSHALLING(ps)) { + v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); + } + for (i_s_1=0; i_s_1count;i_s_1++) { + if (!netdfs_io_dfs_Info200_p("s", &v->s[i_s_1], ps, depth)) + return False; + } + for (i_s_1=0; i_s_1count;i_s_1++) { + if (!netdfs_io_dfs_Info200_d("s", &v->s[i_s_1], ps, depth)) + return False; + } + } + + return True; +} + +BOOL init_netdfs_dfs_EnumArray300(NETDFS_DFS_ENUMARRAY300 *v, uint32 count, NETDFS_DFS_INFO300 **s) +{ + DEBUG(5,("init_netdfs_dfs_EnumArray300\n")); + + v->count = count; + + if (s) { + v->ptr0_s = 1; + v->s = *s; + } else { + v->ptr0_s = 0; + } + + return True; +} + +BOOL netdfs_io_dfs_EnumArray300_p(const char *desc, NETDFS_DFS_ENUMARRAY300 *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray300_p"); + depth++; + if (!prs_uint32("count", ps, depth, &v->count)) + return False; + + if (!prs_uint32("ptr0_s", ps, depth, &v->ptr0_s)) + return False; + + + return True; +} + +BOOL netdfs_io_dfs_EnumArray300_d(const char *desc, NETDFS_DFS_ENUMARRAY300 *v, prs_struct *ps, int depth) +{ + uint32 i_s_1; + + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray300_d"); + depth++; + + if (v->ptr0_s) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("size_s", ps, depth, &v->size_s)) + return False; + + if (UNMARSHALLING(ps)) { + v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); + } + for (i_s_1=0; i_s_1count;i_s_1++) { + if (!netdfs_io_dfs_Info300_p("s", &v->s[i_s_1], ps, depth)) + return False; + } + for (i_s_1=0; i_s_1count;i_s_1++) { + if (!netdfs_io_dfs_Info300_d("s", &v->s[i_s_1], ps, depth)) + return False; + } + } + + return True; +} + +BOOL netdfs_io_dfs_EnumInfo_p(const char *desc, NETDFS_DFS_ENUMINFO_CTR* v, prs_struct *ps, int depth) +{ + if (!prs_uint32("switch_value", ps, depth, &v->switch_value)) + return False; + + switch (v->switch_value) { + case 1: + depth++; + if (!prs_uint32("ptr0_info1", ps, depth, &v->ptr0)) + return False; + + depth--; + break; + + case 2: + depth++; + if (!prs_uint32("ptr0_info2", ps, depth, &v->ptr0)) + return False; + + depth--; + break; + + case 3: + depth++; + if (!prs_uint32("ptr0_info3", ps, depth, &v->ptr0)) + return False; + + depth--; + break; + + case 4: + depth++; + if (!prs_uint32("ptr0_info4", ps, depth, &v->ptr0)) + return False; + + depth--; + break; + + case 200: + depth++; + if (!prs_uint32("ptr0_info200", ps, depth, &v->ptr0)) + return False; + + depth--; + break; + + case 300: + depth++; + if (!prs_uint32("ptr0_info300", ps, depth, &v->ptr0)) + return False; + + depth--; + break; + + default: + return False; + + } + + return True; +} + +BOOL netdfs_io_dfs_EnumInfo_d(const char *desc, NETDFS_DFS_ENUMINFO_CTR* v, prs_struct *ps, int depth) +{ + switch (v->switch_value) { + case 1: + depth++; + if (v->ptr0) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!netdfs_io_dfs_EnumArray1_p("info1", &v->u.info1, ps, depth)) + return False; + if (!netdfs_io_dfs_EnumArray1_d("info1", &v->u.info1, ps, depth)) + return False; + } + depth--; + break; + + case 2: + depth++; + if (v->ptr0) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!netdfs_io_dfs_EnumArray2_p("info2", &v->u.info2, ps, depth)) + return False; + if (!netdfs_io_dfs_EnumArray2_d("info2", &v->u.info2, ps, depth)) + return False; + } + depth--; + break; + + case 3: + depth++; + if (v->ptr0) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!netdfs_io_dfs_EnumArray3_p("info3", &v->u.info3, ps, depth)) + return False; + if (!netdfs_io_dfs_EnumArray3_d("info3", &v->u.info3, ps, depth)) + return False; + } + depth--; + break; + + case 4: + depth++; + if (v->ptr0) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!netdfs_io_dfs_EnumArray4_p("info4", &v->u.info4, ps, depth)) + return False; + if (!netdfs_io_dfs_EnumArray4_d("info4", &v->u.info4, ps, depth)) + return False; + } + depth--; + break; + + case 200: + depth++; + if (v->ptr0) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!netdfs_io_dfs_EnumArray200_p("info200", &v->u.info200, ps, depth)) + return False; + if (!netdfs_io_dfs_EnumArray200_d("info200", &v->u.info200, ps, depth)) + return False; + } + depth--; + break; + + case 300: + depth++; + if (v->ptr0) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!netdfs_io_dfs_EnumArray300_p("info300", &v->u.info300, ps, depth)) + return False; + if (!netdfs_io_dfs_EnumArray300_d("info300", &v->u.info300, ps, depth)) + return False; + } + depth--; + break; + + } + + return True; +} +BOOL init_netdfs_dfs_EnumStruct(NETDFS_DFS_ENUMSTRUCT *v, uint32 level, NETDFS_DFS_ENUMINFO_CTR e) +{ + DEBUG(5,("init_netdfs_dfs_EnumStruct\n")); + + v->level = level; + + v->e = e; + v->e.switch_value = v->level; + + return True; +} + +BOOL netdfs_io_dfs_EnumStruct_p(const char *desc, NETDFS_DFS_ENUMSTRUCT *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumStruct_p"); + depth++; + if (!prs_uint32("level", ps, depth, &v->level)) + return False; + + if (!netdfs_io_dfs_EnumInfo_p("e", &v->e, ps, depth)) + return False; + + return True; +} + +BOOL netdfs_io_dfs_EnumStruct_d(const char *desc, NETDFS_DFS_ENUMSTRUCT *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumStruct_d"); + depth++; + + if (!prs_align_custom(ps, 4)) + return False; + + if (!netdfs_io_dfs_EnumInfo_d("e", &v->e, ps, depth)) + return False; + + return True; +} + +/* netdfs functions */ +BOOL init_netdfs_q_dfs_GetManagerVersion(NETDFS_Q_DFS_GETMANAGERVERSION *v) +{ + DEBUG(5,("init_netdfs_q_dfs_GetManagerVersion\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_GetManagerVersion(const char *desc, NETDFS_Q_DFS_GETMANAGERVERSION *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_GetManagerVersion"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_GetManagerVersion(NETDFS_R_DFS_GETMANAGERVERSION *v, uint32 *exist_flag) +{ + DEBUG(5,("init_netdfs_r_dfs_GetManagerVersion\n")); + + if (!exist_flag) + return False; + + v->exist_flag = *exist_flag; + + return True; +} + +BOOL netdfs_io_r_dfs_GetManagerVersion(const char *desc, NETDFS_R_DFS_GETMANAGERVERSION *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_GetManagerVersion"); + depth++; + if (!prs_uint32("exist_flag", ps, depth, &v->exist_flag)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_Add(NETDFS_Q_DFS_ADD *v, const char *path, const char *server, const char *share, const char *comment, uint32 flags) +{ + DEBUG(5,("init_netdfs_q_dfs_Add\n")); + + if (!path) + return False; + + init_unistr2(&v->path, path, UNI_FLAGS_NONE); + + if (!server) + return False; + + init_unistr2(&v->server, server, UNI_FLAGS_NONE); + + if (share) { + v->ptr0_share = 1; + init_unistr2(&v->share, share, UNI_FLAGS_NONE); + } else { + v->ptr0_share = 0; + } + + if (comment) { + v->ptr0_comment = 1; + init_unistr2(&v->comment, comment, UNI_FLAGS_NONE); + } else { + v->ptr0_comment = 0; + } + + v->flags = flags; + + return True; +} + +BOOL netdfs_io_q_dfs_Add(const char *desc, NETDFS_Q_DFS_ADD *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_Add"); + depth++; + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("path", &v->path, 1, ps, depth)) + return False; + + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("server", &v->server, 1, ps, depth)) + return False; + + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("ptr0_share", ps, depth, &v->ptr0_share)) + return False; + + if (v->ptr0_share) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("share", &v->share, 1, ps, depth)) + return False; + } + + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("ptr0_comment", ps, depth, &v->ptr0_comment)) + return False; + + if (v->ptr0_comment) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("comment", &v->comment, 1, ps, depth)) + return False; + } + + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("flags", ps, depth, &v->flags)) + return False; + + return True; +} + +BOOL init_netdfs_r_dfs_Add(NETDFS_R_DFS_ADD *v, const char *path, const char *server, const char *share, const char *comment, uint32 flags, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_Add\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_Add(const char *desc, NETDFS_R_DFS_ADD *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_Add"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_Remove(NETDFS_Q_DFS_REMOVE *v, const char *path, const char *server, const char *share) +{ + DEBUG(5,("init_netdfs_q_dfs_Remove\n")); + + if (!path) + return False; + + init_unistr2(&v->path, path, UNI_FLAGS_NONE); + + if (server) { + v->ptr0_server = 1; + init_unistr2(&v->server, server, UNI_FLAGS_NONE); + } else { + v->ptr0_server = 0; + } + + if (share) { + v->ptr0_share = 1; + init_unistr2(&v->share, share, UNI_FLAGS_NONE); + } else { + v->ptr0_share = 0; + } + + return True; +} + +BOOL netdfs_io_q_dfs_Remove(const char *desc, NETDFS_Q_DFS_REMOVE *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_Remove"); + depth++; + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("path", &v->path, 1, ps, depth)) + return False; + + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("ptr0_server", ps, depth, &v->ptr0_server)) + return False; + + if (v->ptr0_server) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("server", &v->server, 1, ps, depth)) + return False; + } + + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("ptr0_share", ps, depth, &v->ptr0_share)) + return False; + + if (v->ptr0_share) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("share", &v->share, 1, ps, depth)) + return False; + } + + return True; +} + +BOOL init_netdfs_r_dfs_Remove(NETDFS_R_DFS_REMOVE *v, const char *path, const char *server, const char *share, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_Remove\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_Remove(const char *desc, NETDFS_R_DFS_REMOVE *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_Remove"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_SetInfo(NETDFS_Q_DFS_SETINFO *v) +{ + DEBUG(5,("init_netdfs_q_dfs_SetInfo\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_SetInfo(const char *desc, NETDFS_Q_DFS_SETINFO *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_SetInfo"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_SetInfo(NETDFS_R_DFS_SETINFO *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_SetInfo\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_SetInfo(const char *desc, NETDFS_R_DFS_SETINFO *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_SetInfo"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_GetInfo(NETDFS_Q_DFS_GETINFO *v, const char *path, const char *server, const char *share, uint32 level) +{ + DEBUG(5,("init_netdfs_q_dfs_GetInfo\n")); + + if (!path) + return False; + + init_unistr2(&v->path, path, UNI_FLAGS_NONE); + + if (server) { + v->ptr0_server = 1; + init_unistr2(&v->server, server, UNI_FLAGS_NONE); + } else { + v->ptr0_server = 0; + } + + if (share) { + v->ptr0_share = 1; + init_unistr2(&v->share, share, UNI_FLAGS_NONE); + } else { + v->ptr0_share = 0; + } + + v->level = level; + + return True; +} + +BOOL netdfs_io_q_dfs_GetInfo(const char *desc, NETDFS_Q_DFS_GETINFO *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_GetInfo"); + depth++; + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("path", &v->path, 1, ps, depth)) + return False; + + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("ptr0_server", ps, depth, &v->ptr0_server)) + return False; + + if (v->ptr0_server) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("server", &v->server, 1, ps, depth)) + return False; + } + + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("ptr0_share", ps, depth, &v->ptr0_share)) + return False; + + if (v->ptr0_share) { + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("share", &v->share, 1, ps, depth)) + return False; + } + + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("level", ps, depth, &v->level)) + return False; + + return True; +} + +BOOL init_netdfs_r_dfs_GetInfo(NETDFS_R_DFS_GETINFO *v, const char *path, const char *server, const char *share, uint32 level, NETDFS_DFS_INFO_CTR *info, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_GetInfo\n")); + + if (!info) + return False; + + v->info = *info; + v->info.switch_value = level; + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_GetInfo(const char *desc, NETDFS_R_DFS_GETINFO *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_GetInfo"); + depth++; + if (!netdfs_io_dfs_Info_p("info", &v->info, ps, depth)) + return False; + if (!netdfs_io_dfs_Info_d("info", &v->info, ps, depth)) + return False; + + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_Enum(NETDFS_Q_DFS_ENUM *v, uint32 level, uint32 bufsize, NETDFS_DFS_ENUMSTRUCT *info, uint32 *unknown, uint32 *total) +{ + DEBUG(5,("init_netdfs_q_dfs_Enum\n")); + + v->level = level; + + v->bufsize = bufsize; + + if (info) { + v->ptr0_info = 1; + v->info = *info; + } else { + v->ptr0_info = 0; + } + + if (unknown) { + v->ptr0_unknown = 1; + v->unknown = *unknown; + } else { + v->ptr0_unknown = 0; + } + + if (total) { + v->ptr0_total = 1; + v->total = *total; + } else { + v->ptr0_total = 0; + } + + return True; +} + +BOOL netdfs_io_q_dfs_Enum(const char *desc, NETDFS_Q_DFS_ENUM *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_Enum"); + depth++; + if (!prs_uint32("level", ps, depth, &v->level)) + return False; + + if (!prs_uint32("bufsize", ps, depth, &v->bufsize)) + return False; + + if (!prs_uint32("ptr0_info", ps, depth, &v->ptr0_info)) + return False; + + if (v->ptr0_info) { + if (!netdfs_io_dfs_EnumStruct_p("info", &v->info, ps, depth)) + return False; + if (!netdfs_io_dfs_EnumStruct_d("info", &v->info, ps, depth)) + return False; + } + + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("ptr0_unknown", ps, depth, &v->ptr0_unknown)) + return False; + + if (v->ptr0_unknown) { + if (!prs_uint32("unknown", ps, depth, &v->unknown)) + return False; + } + + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("ptr0_total", ps, depth, &v->ptr0_total)) + return False; + + if (v->ptr0_total) { + if (!prs_uint32("total", ps, depth, &v->total)) + return False; + } + + return True; +} + +BOOL init_netdfs_r_dfs_Enum(NETDFS_R_DFS_ENUM *v, uint32 level, uint32 bufsize, NETDFS_DFS_ENUMSTRUCT *info, uint32 *unknown, uint32 *total, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_Enum\n")); + + if (info) { + v->ptr0_info = 1; + v->info = *info; + } else { + v->ptr0_info = 0; + } + + if (total) { + v->ptr0_total = 1; + v->total = *total; + } else { + v->ptr0_total = 0; + } + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_Enum(const char *desc, NETDFS_R_DFS_ENUM *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_Enum"); + depth++; + if (!prs_uint32("ptr0_info", ps, depth, &v->ptr0_info)) + return False; + + if (v->ptr0_info) { + if (!netdfs_io_dfs_EnumStruct_p("info", &v->info, ps, depth)) + return False; + if (!netdfs_io_dfs_EnumStruct_d("info", &v->info, ps, depth)) + return False; + } + + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("ptr0_total", ps, depth, &v->ptr0_total)) + return False; + + if (v->ptr0_total) { + if (!prs_uint32("total", ps, depth, &v->total)) + return False; + } + + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_Rename(NETDFS_Q_DFS_RENAME *v) +{ + DEBUG(5,("init_netdfs_q_dfs_Rename\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_Rename(const char *desc, NETDFS_Q_DFS_RENAME *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_Rename"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_Rename(NETDFS_R_DFS_RENAME *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_Rename\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_Rename(const char *desc, NETDFS_R_DFS_RENAME *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_Rename"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_Move(NETDFS_Q_DFS_MOVE *v) +{ + DEBUG(5,("init_netdfs_q_dfs_Move\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_Move(const char *desc, NETDFS_Q_DFS_MOVE *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_Move"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_Move(NETDFS_R_DFS_MOVE *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_Move\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_Move(const char *desc, NETDFS_R_DFS_MOVE *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_Move"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_ManagerGetConfigInfo(NETDFS_Q_DFS_MANAGERGETCONFIGINFO *v) +{ + DEBUG(5,("init_netdfs_q_dfs_ManagerGetConfigInfo\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_ManagerGetConfigInfo(const char *desc, NETDFS_Q_DFS_MANAGERGETCONFIGINFO *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_ManagerGetConfigInfo"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_ManagerGetConfigInfo(NETDFS_R_DFS_MANAGERGETCONFIGINFO *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_ManagerGetConfigInfo\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_ManagerGetConfigInfo(const char *desc, NETDFS_R_DFS_MANAGERGETCONFIGINFO *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_ManagerGetConfigInfo"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_ManagerSendSiteInfo(NETDFS_Q_DFS_MANAGERSENDSITEINFO *v) +{ + DEBUG(5,("init_netdfs_q_dfs_ManagerSendSiteInfo\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_ManagerSendSiteInfo(const char *desc, NETDFS_Q_DFS_MANAGERSENDSITEINFO *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_ManagerSendSiteInfo"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_ManagerSendSiteInfo(NETDFS_R_DFS_MANAGERSENDSITEINFO *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_ManagerSendSiteInfo\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_ManagerSendSiteInfo(const char *desc, NETDFS_R_DFS_MANAGERSENDSITEINFO *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_ManagerSendSiteInfo"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_AddFtRoot(NETDFS_Q_DFS_ADDFTROOT *v) +{ + DEBUG(5,("init_netdfs_q_dfs_AddFtRoot\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_AddFtRoot(const char *desc, NETDFS_Q_DFS_ADDFTROOT *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_AddFtRoot"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_AddFtRoot(NETDFS_R_DFS_ADDFTROOT *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_AddFtRoot\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_AddFtRoot(const char *desc, NETDFS_R_DFS_ADDFTROOT *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_AddFtRoot"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_RemoveFtRoot(NETDFS_Q_DFS_REMOVEFTROOT *v) +{ + DEBUG(5,("init_netdfs_q_dfs_RemoveFtRoot\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_RemoveFtRoot(const char *desc, NETDFS_Q_DFS_REMOVEFTROOT *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_RemoveFtRoot"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_RemoveFtRoot(NETDFS_R_DFS_REMOVEFTROOT *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_RemoveFtRoot\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_RemoveFtRoot(const char *desc, NETDFS_R_DFS_REMOVEFTROOT *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_RemoveFtRoot"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_AddStdRoot(NETDFS_Q_DFS_ADDSTDROOT *v) +{ + DEBUG(5,("init_netdfs_q_dfs_AddStdRoot\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_AddStdRoot(const char *desc, NETDFS_Q_DFS_ADDSTDROOT *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_AddStdRoot"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_AddStdRoot(NETDFS_R_DFS_ADDSTDROOT *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_AddStdRoot\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_AddStdRoot(const char *desc, NETDFS_R_DFS_ADDSTDROOT *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_AddStdRoot"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_RemoveStdRoot(NETDFS_Q_DFS_REMOVESTDROOT *v) +{ + DEBUG(5,("init_netdfs_q_dfs_RemoveStdRoot\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_RemoveStdRoot(const char *desc, NETDFS_Q_DFS_REMOVESTDROOT *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_RemoveStdRoot"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_RemoveStdRoot(NETDFS_R_DFS_REMOVESTDROOT *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_RemoveStdRoot\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_RemoveStdRoot(const char *desc, NETDFS_R_DFS_REMOVESTDROOT *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_RemoveStdRoot"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_ManagerInitialize(NETDFS_Q_DFS_MANAGERINITIALIZE *v) +{ + DEBUG(5,("init_netdfs_q_dfs_ManagerInitialize\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_ManagerInitialize(const char *desc, NETDFS_Q_DFS_MANAGERINITIALIZE *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_ManagerInitialize"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_ManagerInitialize(NETDFS_R_DFS_MANAGERINITIALIZE *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_ManagerInitialize\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_ManagerInitialize(const char *desc, NETDFS_R_DFS_MANAGERINITIALIZE *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_ManagerInitialize"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_AddStdRootForced(NETDFS_Q_DFS_ADDSTDROOTFORCED *v) +{ + DEBUG(5,("init_netdfs_q_dfs_AddStdRootForced\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_AddStdRootForced(const char *desc, NETDFS_Q_DFS_ADDSTDROOTFORCED *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_AddStdRootForced"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_AddStdRootForced(NETDFS_R_DFS_ADDSTDROOTFORCED *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_AddStdRootForced\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_AddStdRootForced(const char *desc, NETDFS_R_DFS_ADDSTDROOTFORCED *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_AddStdRootForced"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_GetDcAddress(NETDFS_Q_DFS_GETDCADDRESS *v) +{ + DEBUG(5,("init_netdfs_q_dfs_GetDcAddress\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_GetDcAddress(const char *desc, NETDFS_Q_DFS_GETDCADDRESS *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_GetDcAddress"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_GetDcAddress(NETDFS_R_DFS_GETDCADDRESS *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_GetDcAddress\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_GetDcAddress(const char *desc, NETDFS_R_DFS_GETDCADDRESS *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_GetDcAddress"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_SetDcAddress(NETDFS_Q_DFS_SETDCADDRESS *v) +{ + DEBUG(5,("init_netdfs_q_dfs_SetDcAddress\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_SetDcAddress(const char *desc, NETDFS_Q_DFS_SETDCADDRESS *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_SetDcAddress"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_SetDcAddress(NETDFS_R_DFS_SETDCADDRESS *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_SetDcAddress\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_SetDcAddress(const char *desc, NETDFS_R_DFS_SETDCADDRESS *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_SetDcAddress"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_FlushFtTable(NETDFS_Q_DFS_FLUSHFTTABLE *v) +{ + DEBUG(5,("init_netdfs_q_dfs_FlushFtTable\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_FlushFtTable(const char *desc, NETDFS_Q_DFS_FLUSHFTTABLE *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_FlushFtTable"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_FlushFtTable(NETDFS_R_DFS_FLUSHFTTABLE *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_FlushFtTable\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_FlushFtTable(const char *desc, NETDFS_R_DFS_FLUSHFTTABLE *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_FlushFtTable"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_Add2(NETDFS_Q_DFS_ADD2 *v) +{ + DEBUG(5,("init_netdfs_q_dfs_Add2\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_Add2(const char *desc, NETDFS_Q_DFS_ADD2 *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_Add2"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_Add2(NETDFS_R_DFS_ADD2 *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_Add2\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_Add2(const char *desc, NETDFS_R_DFS_ADD2 *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_Add2"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_Remove2(NETDFS_Q_DFS_REMOVE2 *v) +{ + DEBUG(5,("init_netdfs_q_dfs_Remove2\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_Remove2(const char *desc, NETDFS_Q_DFS_REMOVE2 *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_Remove2"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_Remove2(NETDFS_R_DFS_REMOVE2 *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_Remove2\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_Remove2(const char *desc, NETDFS_R_DFS_REMOVE2 *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_Remove2"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_EnumEx(NETDFS_Q_DFS_ENUMEX *v) +{ + DEBUG(5,("init_netdfs_q_dfs_EnumEx\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_EnumEx(const char *desc, NETDFS_Q_DFS_ENUMEX *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_EnumEx"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_EnumEx(NETDFS_R_DFS_ENUMEX *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_EnumEx\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_EnumEx(const char *desc, NETDFS_R_DFS_ENUMEX *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_EnumEx"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + +BOOL init_netdfs_q_dfs_SetInfo2(NETDFS_Q_DFS_SETINFO2 *v) +{ + DEBUG(5,("init_netdfs_q_dfs_SetInfo2\n")); + + return True; +} + +BOOL netdfs_io_q_dfs_SetInfo2(const char *desc, NETDFS_Q_DFS_SETINFO2 *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_q_dfs_SetInfo2"); + depth++; + return True; +} + +BOOL init_netdfs_r_dfs_SetInfo2(NETDFS_R_DFS_SETINFO2 *v, WERROR status) +{ + DEBUG(5,("init_netdfs_r_dfs_SetInfo2\n")); + + v->status = status; + + return True; +} + +BOOL netdfs_io_r_dfs_SetInfo2(const char *desc, NETDFS_R_DFS_SETINFO2 *v, prs_struct *ps, int depth) +{ + if (v == NULL) + return False; + + prs_debug(ps, depth, desc, "netdfs_io_r_dfs_SetInfo2"); + depth++; + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; +} + diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 3d28b657f3..1edc017510 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -508,8 +508,9 @@ BOOL lsa_io_q_enum_trust_dom(const char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, 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 req_num_domains, uint32 num_domains, TRUSTDOM **td) +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; @@ -523,7 +524,8 @@ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *out, uint32 en /* allocate container memory */ out->domlist = TALLOC_P( ctx, DOMAIN_LIST ); - out->domlist->domains = TALLOC_ARRAY( ctx, DOMAIN_INFO, out->count ); + out->domlist->domains = TALLOC_ARRAY( ctx, DOMAIN_INFO, + out->count ); if ( !out->domlist || !out->domlist->domains ) { out->status = NT_STATUS_NO_MEMORY; @@ -535,13 +537,21 @@ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *out, uint32 en /* initialize the list of domains and their sid */ for (i = 0; i < num_domains; i++) { - if ( !(out->domlist->domains[i].sid = TALLOC_P(ctx, DOM_SID2)) ) { + 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); - init_unistr4_w(ctx, &out->domlist->domains[i].name, (td[i])->name); + init_dom_sid2(out->domlist->domains[i].sid, + &(td[i])->sid); + if (push_ucs2_talloc(ctx, &name, (td[i])->name) < 0){ + out->status = NT_STATUS_NO_MEMORY; + return; + } + init_unistr4_w(ctx, &out->domlist->domains[i].name, + name); } } @@ -2539,8 +2549,78 @@ BOOL lsa_io_q_open_trusted_domain(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN *i } #endif + +/******************************************************************* + Inits an LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME structure. +********************************************************************/ + +void init_lsa_q_open_trusted_domain_by_name(LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME *q, + POLICY_HND *hnd, + const char *name, + uint32 desired_access) +{ + memcpy(&q->pol, hnd, sizeof(q->pol)); + + init_lsa_string(&q->name, name); + q->access_mask = desired_access; +} + +/******************************************************************* +********************************************************************/ + + +/******************************************************************* + Reads or writes an LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME structure. +********************************************************************/ + +BOOL lsa_io_q_open_trusted_domain_by_name(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME *q_o, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_q_open_trusted_domain_by_name"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("pol", &q_o->pol, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!smb_io_lsa_string("name", &q_o->name, ps, depth)) + return False; + + if(!prs_align(ps)) + 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_BY_NAME structure. +********************************************************************/ + +BOOL lsa_io_r_open_trusted_domain_by_name(const char *desc, LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME *out, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_r_open_trusted_domain_by_name"); + 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; +} + /******************************************************************* - Reads or writes an LSA_Q_OPEN_TRUSTED_DOMAIN structure. ********************************************************************/ BOOL lsa_io_q_open_trusted_domain(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN *q_o, prs_struct *ps, int depth) @@ -3111,3 +3191,130 @@ BOOL lsa_io_r_query_trusted_domain_info(const char *desc, 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_net.c b/source3/rpc_parse/parse_net.c index 3bd6977dbb..e7b1cdc767 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1396,7 +1396,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, uint32 user_flgs, uchar user_session_key[16], uchar lm_session_key[16], const char *logon_srv, const char *logon_dom, - const DOM_SID *dom_sid, const char *other_sids) + const DOM_SID *dom_sid) { /* only cope with one "other" sid, right now. */ /* need to count the number of space-delimited sids */ @@ -1454,7 +1454,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, memcpy(usr->lm_sess_key, lm_session_key, sizeof(usr->lm_sess_key)); } - num_other_sids = init_dom_sid2s(ctx, other_sids, &usr->other_sids); + 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; @@ -1488,6 +1488,47 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, init_dom_sid2(&usr->dom_sid, dom_sid); /* "other" sids are set up above */ +} + + 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 UF_NORMAL_ACCOUNT\n")); + } + if (acct_flags & ACB_PWNOEXP) { + DEBUGADD(lvl,("\taccount has UF_DONT_EXPIRE_PASSWD\n")); + } + if (acct_flags & ACB_ENC_TXT_PWD_ALLOWED) { + DEBUGADD(lvl,("\taccount has UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED\n")); + } + if (acct_flags & ACB_NOT_DELEGATED) { + DEBUGADD(lvl,("\taccount has UF_NOT_DELEGATED\n")); + } + if (acct_flags & ACB_USE_DES_KEY_ONLY) { + DEBUGADD(lvl,("\taccount has UF_USE_DES_KEY_ONLY set, sig verify wont work\n")); + } +} + + 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")); + } + + } /******************************************************************* @@ -1562,7 +1603,7 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, 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; @@ -1579,7 +1620,7 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, 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 */ diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 7c84ee800b..c4f9f512ab 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1303,6 +1303,35 @@ BOOL prs_string(const char *name, prs_struct *ps, int depth, char *str, int max_ return True; } +BOOL prs_string_alloc(const char *name, prs_struct *ps, int depth, const char **str) +{ + size_t len; + char *tmp_str; + + if (UNMARSHALLING(ps)) { + len = strlen(&ps->data_p[ps->data_offset]); + } else { + len = strlen(*str); + } + + tmp_str = PRS_ALLOC_MEM(ps, char, len+1); + + if (tmp_str == NULL) { + return False; + } + + if (MARSHALLING(ps)) { + strncpy(tmp_str, *str, len); + } + + if (!prs_string(name, ps, depth, tmp_str, len+1)) { + return False; + } + + *str = tmp_str; + return True; +} + /******************************************************************* prs_uint16 wrapper. Call this and it sets up a pointer to where the uint16 should be stored, or gets the size if reading. diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index ea4ec2c863..544d139acb 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -191,16 +191,6 @@ interface/version dce/rpc pipe identification }, 0x00 \ } -#define SYNT_UNIXINFO_V0 \ -{ \ - { \ - 0x9c54e310, 0xa955, 0x4885, \ - { 0xbd, 0x31 }, \ - { 0x78, 0x78, \ - 0x71, 0x47, 0xdf, 0xa6 } \ - }, 0x00 \ -} - #define SYNT_NTSVCS_V1 \ { \ { \ diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 6c2b4f4ea7..7cbaa4e3c9 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5031,7 +5031,7 @@ inits a SAMR_Q_QUERY_USERINFO structure. ********************************************************************/ void init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO * q_u, - POLICY_HND *hnd, uint16 switch_value) + const POLICY_HND *hnd, uint16 switch_value) { DEBUG(5, ("init_samr_q_query_userinfo\n")); @@ -6541,7 +6541,7 @@ inits a SAMR_Q_SET_USERINFO structure. ********************************************************************/ void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO * q_u, - POLICY_HND *hnd, DATA_BLOB *sess_key, + const POLICY_HND *hnd, DATA_BLOB *sess_key, uint16 switch_value, void *info) { DEBUG(5, ("init_samr_q_set_userinfo\n")); @@ -6615,7 +6615,7 @@ inits a SAMR_Q_SET_USERINFO2 structure. ********************************************************************/ void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u, - POLICY_HND *hnd, DATA_BLOB *sess_key, + const POLICY_HND *hnd, DATA_BLOB *sess_key, uint16 switch_value, SAM_USERINFO_CTR * ctr) { DEBUG(5, ("init_samr_q_set_userinfo2\n")); -- cgit From da979c9e7eb0c03ac718eb2c6c50937e52c39292 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 4 Feb 2006 21:44:57 +0000 Subject: r13350: Implement rpccli_samr_set_domain_info. Weird that it was not around :-) Implement 'net rpc shell account' -- An editor for account policies nt_time_to_unix_abs changed its argument which to me seems wrong, and I could not find a caller that depends on this. So I changed it. Applied some more const in time.c. Volker (This used to be commit fc73690a7000d5a3f0f5ad34461c1f3a87edeac5) --- source3/rpc_parse/parse_samr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 7cbaa4e3c9..87bfcebe26 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -7629,8 +7629,10 @@ BOOL samr_io_q_set_domain_info(const char *desc, SAMR_Q_SET_DOMAIN_INFO *q_u, if(!prs_align(ps)) return False; - if ((q_u->ctr = PRS_ALLOC_MEM(ps, SAM_UNK_CTR, 1)) == NULL) - 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) { -- cgit From 1b14d3b69754ddfe8a258c8accb65b01f16e880b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 8 Feb 2006 04:46:43 +0000 Subject: r13386: Fix parsing of SAMR_Q_CONNECT_ANON. Jeremy. (This used to be commit 6f8334ad31ac773f5c13335f5d8c5bed62987466) --- source3/rpc_parse/parse_samr.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 87bfcebe26..d13d3c9d4a 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6965,8 +6965,7 @@ void init_samr_q_connect_anon(SAMR_Q_CONNECT_ANON * q_u) q_u->ptr = 1; q_u->unknown_0 = 0x5c; /* server name (?!!) */ - q_u->unknown_1 = 0x01; - q_u->access_mask = 0x20; + q_u->access_mask = MAXIMUM_ALLOWED_ACCESS; } /******************************************************************* @@ -6987,9 +6986,11 @@ BOOL samr_io_q_connect_anon(const char *desc, SAMR_Q_CONNECT_ANON * q_u, if(!prs_uint32("ptr ", ps, depth, &q_u->ptr)) return False; - if(!prs_uint16("unknown_0", ps, depth, &q_u->unknown_0)) - return False; - if(!prs_uint16("unknown_1", ps, depth, &q_u->unknown_1)) + 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; -- cgit From 86358fc10bb02bd3069736bedb120f52fa3f6494 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 8 Feb 2006 22:16:03 +0000 Subject: r13396: Add in userinfo26, re-enable userinfo25 - took the knowledge from Samba4 on how to decode the 532 byte password buffers. Getting closer to passing samba4 RPC-SCHANNEL test. Jeremy. (This used to be commit 205db6968a26c43dec64c14d8053d8e66807086f) --- source3/rpc_parse/parse_samr.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index d13d3c9d4a..a0108d9eb7 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5404,13 +5404,41 @@ static BOOL sam_io_user_info24(const char *desc, SAM_USER_INFO_24 * usr, if (MARSHALLING(ps) && (usr->pw_len != 0)) { if (!prs_uint16("pw_len", ps, depth, &usr->pw_len)) return False; + } else if (UNMARSHALLING(ps)) { + if (!prs_uint16("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 @@ -6475,6 +6503,16 @@ static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, } 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; -- cgit From cf7c47aac990f67e1829a7e4b9d3550b7e93739b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 9 Feb 2006 00:23:40 +0000 Subject: r13399: Get closer to passing RPC-SCHANNEL test. Jeremy. (This used to be commit 8ae70122b79fbe682c227ec2c4e5a72bf58d76de) --- source3/rpc_parse/parse_net.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index e7b1cdc767..fd2bc3cf38 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1295,7 +1295,7 @@ static BOOL net_io_id_info_ctr(const char *desc, NET_ID_INFO_CTR **pp_ctr, prs_s { NET_ID_INFO_CTR *ctr = *pp_ctr; - prs_debug(ps, depth, desc, "smb_io_sam_info"); + prs_debug(ps, depth, desc, "smb_io_sam_info_ctr"); depth++; if (UNMARSHALLING(ps)) { @@ -1323,7 +1323,7 @@ static BOOL net_io_id_info_ctr(const char *desc, NET_ID_INFO_CTR **pp_ctr, prs_s break; default: /* PANIC! */ - DEBUG(4,("smb_io_sam_info: unknown switch_value!\n")); + DEBUG(4,("smb_io_sam_info_ctr: unknown switch_value!\n")); break; } @@ -1350,8 +1350,10 @@ static BOOL smb_io_sam_info(const char *desc, DOM_SAM_INFO *sam, prs_struct *ps, if(!prs_uint32("ptr_rtn_cred ", ps, depth, &sam->ptr_rtn_cred)) return False; - if(!smb_io_cred("", &sam->rtn_cred, ps, depth)) - 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; @@ -1700,7 +1702,7 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, if(!smb_io_dom_sid2("", &usr->dom_sid, ps, depth)) /* domain SID */ return False; - if (usr->buffer_other_sids) { + if (validation_level == 3 && usr->buffer_other_sids) { uint32 num_other_sids = usr->num_other_sids; @@ -1776,7 +1778,7 @@ BOOL net_io_q_sam_logon(const char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, if(!prs_align_uint16(ps)) return False; - + if(!prs_uint16("validation_level", ps, depth, &q_l->validation_level)) return False; -- cgit From ad8b47a2ba4e81420bc2272e8438a727cc2223ee Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 9 Feb 2006 07:03:23 +0000 Subject: r13407: Change the credentials code to be more like the Samba4 structure, makes fixes much easier to port. Fix the size of dc->sess_key to be 16 bytes, not 8 bytes - only store 8 bytes in the inter-smbd store in secrets.tdb though. Should fix some uses of the dc->sess_key where we where assuming we could read 16 bytes. Jeremy. (This used to be commit 5b3c2e63c73fee8949108abe19ac7a448a033a7f) --- source3/rpc_parse/parse_rpc.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 544d139acb..79dfc05e43 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -848,4 +848,3 @@ BOOL smb_io_rpc_auth_schannel_chk(const char *desc, int auth_len, return True; } - -- cgit From 74bc039f1e46531390ec5c817da37d25ce7d733f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 10 Feb 2006 17:55:44 +0000 Subject: r13433: Get ready to implement NET_SAM_LOGON_EX. Jeremy. (This used to be commit 666b03b4a92800ed704b7f7e4b39f4e01ca47aee) --- source3/rpc_parse/parse_net.c | 102 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index fd2bc3cf38..d336df161d 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1366,6 +1366,35 @@ static BOOL smb_io_sam_info(const char *desc, DOM_SAM_INFO *sam, prs_struct *ps, 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_info2("", &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. @@ -1831,6 +1860,79 @@ BOOL net_io_r_sam_logon(const char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, 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_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. ********************************************************************/ -- cgit From e493d329122e16a70f9f858aaa9ba51d20eba3c7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 10 Feb 2006 19:16:50 +0000 Subject: r13439: Fix NET_SAM_LOGON_EX. Jeremy. (This used to be commit 9437ffc84f4d924ab67f3e16ef507d2aeeeb5f34) --- source3/rpc_parse/parse_misc.c | 2 +- source3/rpc_parse/parse_net.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 26da87b280..b5b224c0a4 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1368,7 +1368,7 @@ static void init_clnt_srv(DOM_CLNT_SRV *logcln, const char *logon_srv, const cha Inits or writes a DOM_CLNT_SRV structure. ********************************************************************/ -static BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *logcln, prs_struct *ps, int depth) +BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *logcln, prs_struct *ps, int depth) { if (logcln == NULL) return False; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index d336df161d..3734ce26a6 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1381,7 +1381,7 @@ static BOOL smb_io_sam_info_ex(const char *desc, DOM_SAM_INFO_EX *sam, prs_struc if(!prs_align(ps)) return False; - if(!smb_io_clnt_info2("", &sam->client, ps, depth)) + if(!smb_io_clnt_srv("", &sam->client, ps, depth)) return False; if(!prs_uint16("logon_level ", ps, depth, &sam->logon_level)) -- cgit From e83c7d0141c0726a74c7be48914e94bac7167ab1 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 10 Feb 2006 23:09:00 +0000 Subject: r13442: Implement samr_chgpasswd_user3 server-side. Guenther (This used to be commit f60eddc0a4dfe623e5f115533a62c03810fd5f38) --- source3/rpc_parse/parse_samr.c | 70 +++++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 29 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a0108d9eb7..b419fbebc4 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -7299,7 +7299,7 @@ inits a SAMR_R_CHGPASSWD_USER structure. void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER * r_u, NTSTATUS status) { - DEBUG(5, ("init_r_chgpasswd_user\n")); + DEBUG(5, ("init_samr_r_chgpasswd_user\n")); r_u->status = status; } @@ -7330,14 +7330,14 @@ BOOL samr_io_r_chgpasswd_user(const char *desc, SAMR_R_CHGPASSWD_USER * r_u, inits a SAMR_Q_CHGPASSWD3 structure. ********************************************************************/ -void init_samr_q_chgpasswd3(SAMR_Q_CHGPASSWD3 * 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]) +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_chgpasswd3\n")); + 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); @@ -7361,13 +7361,13 @@ void init_samr_q_chgpasswd3(SAMR_Q_CHGPASSWD3 * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_chgpasswd3(const char *desc, SAMR_Q_CHGPASSWD3 * q_u, - prs_struct *ps, int depth) +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_chgpasswd3"); + prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user3"); depth++; if(!prs_align(ps)) @@ -7408,14 +7408,30 @@ BOOL samr_io_q_chgpasswd3(const char *desc, SAMR_Q_CHGPASSWD3 * q_u, } /******************************************************************* -inits a SAMR_R_CHGPASSWD3 structure. +inits a SAMR_R_CHGPASSWD_USER3 structure. ********************************************************************/ -void init_samr_r_chgpasswd3(SAMR_R_CHGPASSWD3 * r_u, NTSTATUS status) +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_r_chgpasswd3\n")); + 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 (NT_STATUS_EQUAL(r_u->status, NT_STATUS_PASSWORD_RESTRICTION)) { + if (info) { + r_u->info = info; + r_u->ptr_info = 1; + } + if (reject) { + r_u->reject = reject; + r_u->ptr_reject = 1; + } + } } /******************************************************************* @@ -7452,41 +7468,37 @@ BOOL samr_io_change_reject(const char *desc, SAMR_CHANGE_REJECT *reject, prs_str reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_chgpasswd3(const char *desc, SAMR_R_CHGPASSWD3 * r_u, - prs_struct *ps, int depth) +BOOL samr_io_r_chgpasswd_user3(const char *desc, SAMR_R_CHGPASSWD_USER3 *r_u, + prs_struct *ps, int depth) { - uint32 ptr_info, ptr_reject; - if (r_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_r_chgpasswd3"); + prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user3"); depth++; - if(!prs_align(ps)) + if (!prs_align(ps)) return False; - if(!prs_uint32("ptr_info", ps, depth, &ptr_info)) + if (!prs_uint32("ptr_info", ps, depth, &r_u->ptr_info)) return False; - if (ptr_info) { - + if (r_u->ptr_info && r_u->info != NULL) { /* SAM_UNK_INFO_1 */ - if(!sam_io_unk_info1("info", &r_u->info, ps, depth)) + if (!sam_io_unk_info1("info", r_u->info, ps, depth)) return False; } - if(!prs_uint32("ptr_reject", ps, depth, &ptr_reject)) + if (!prs_uint32("ptr_reject", ps, depth, &r_u->ptr_reject)) return False; - if (ptr_reject) { - + if (r_u->ptr_reject && r_u->reject != NULL) { /* SAMR_CHANGE_REJECT */ - if(!samr_io_change_reject("reject", &r_u->reject, ps, depth)) + if (!samr_io_change_reject("reject", r_u->reject, ps, depth)) return False; } - if(!prs_ntstatus("status", ps, depth, &r_u->status)) + if (!prs_ntstatus("status", ps, depth, &r_u->status)) return False; return True; -- cgit From a48f4e832f09550b84beab39a97d2568fddfe20a Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 10 Feb 2006 23:49:52 +0000 Subject: r13445: We already made the decision whether to include the dominfo and changereject. Guenther (This used to be commit 98d3c63e04e1317a0a2f100e89d9be65a98ecc7e) --- source3/rpc_parse/parse_samr.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index b419fbebc4..711876639a 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -7422,15 +7422,13 @@ void init_samr_r_chgpasswd_user3(SAMR_R_CHGPASSWD_USER3 *r_u, NTSTATUS status, r_u->reject = 0; r_u->ptr_reject = 0; - if (NT_STATUS_EQUAL(r_u->status, NT_STATUS_PASSWORD_RESTRICTION)) { - if (info) { - r_u->info = info; - r_u->ptr_info = 1; - } - if (reject) { - r_u->reject = reject; - r_u->ptr_reject = 1; - } + 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; } } -- cgit From 06cf1e18e562cf350e657c69e38a40b7f2bbf697 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 10 Feb 2006 23:52:53 +0000 Subject: r13447: Added LSA_LOOKUPSIDS2 and LSA_LOOKUPSIDS3. Jeremy. (This used to be commit a164cfab420a2439dad8fd85f8b4d652087fa6b9) --- source3/rpc_parse/parse_lsa.c | 243 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 241 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 1edc017510..ad475f192b 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -29,6 +29,7 @@ #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. @@ -69,6 +70,48 @@ static BOOL lsa_io_trans_name(const char *desc, LSA_TRANS_NAME *trn, prs_struct 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. ********************************************************************/ @@ -947,6 +990,75 @@ BOOL lsa_io_q_lookup_sids(const char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct * 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. ********************************************************************/ @@ -1004,6 +1116,64 @@ static BOOL lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, 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 (UNMARSHALLING(ps)) { + if ((trn->name = PRS_ALLOC_MEM(ps, LSA_TRANS_NAME2, trn->num_entries)) == NULL) { + return False; + } + + if ((trn->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, trn->num_entries)) == 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. ********************************************************************/ @@ -1039,6 +1209,77 @@ BOOL lsa_io_r_lookup_sids(const char *desc, LSA_R_LOOKUP_SIDS *r_s, 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. ********************************************************************/ @@ -3316,5 +3557,3 @@ BOOL lsa_io_r_query_dom_info(const char *desc, LSA_R_QUERY_DOM_INFO_POLICY *out, return True; } - - -- cgit From e22d38bddef441eaaa5b0b0c5dbc92225e20f912 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 11 Feb 2006 02:46:41 +0000 Subject: r13455: Prepare to add lookupnames2. Jeremy. (This used to be commit 2274709587bd1f27bea2eacf633182f20cd07b1e) --- source3/rpc_parse/parse_lsa.c | 126 ++++++++++++++++++++++++++++++++++++++++- source3/rpc_parse/parse_misc.c | 50 ++++++++++++---- 2 files changed, 165 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index ad475f192b..d041553e14 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1412,13 +1412,136 @@ BOOL lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *out, prs_struct } if (UNMARSHALLING(ps)) { - if ((out->dom_rid = PRS_ALLOC_MEM(ps, DOM_RID2, 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_uint32("lookup_level ", ps, depth, &q_r->lookup_level)) + 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)) { + 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; @@ -1434,6 +1557,7 @@ BOOL lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *out, prs_struct } + /******************************************************************* Inits an LSA_Q_CLOSE structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index b5b224c0a4..bc1eda8d04 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1251,23 +1251,50 @@ BOOL smb_io_account_lockout_str(const char *desc, LOCKOUT_STRING *account_lockou } /******************************************************************* - Inits a DOM_RID2 structure. + Inits a DOM_RID structure. ********************************************************************/ -void init_dom_rid2(DOM_RID2 *rid2, uint32 rid, uint8 type, uint32 idx) +void init_dom_rid(DOM_RID *prid, uint32 rid, uint8 type, uint32 idx) { - rid2->type = type; - rid2->rid = rid; - rid2->rid_idx = idx; + prid->type = type; + prid->rid = rid; + prid->rid_idx = idx; +} + +/******************************************************************* + Reads or writes a DOM_RID structure. +********************************************************************/ + +BOOL smb_io_dom_rid(const char *desc, DOM_RID *rid, prs_struct *ps, int depth) +{ + if (rid == NULL) + return False; + + prs_debug(ps, depth, desc, "smb_io_dom_rid"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint8("type ", ps, depth, &rid->type)) + return False; + if(!prs_align(ps)) + return False; + if(!prs_uint32("rid ", ps, depth, &rid->rid)) + return False; + if(!prs_uint32("rid_idx", ps, depth, &rid->rid_idx)) + return False; + + return True; } /******************************************************************* Reads or writes a DOM_RID2 structure. ********************************************************************/ -BOOL smb_io_dom_rid2(const char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth) +BOOL smb_io_dom_rid2(const char *desc, DOM_RID2 *rid, prs_struct *ps, int depth) { - if (rid2 == NULL) + if (rid == NULL) return False; prs_debug(ps, depth, desc, "smb_io_dom_rid2"); @@ -1276,18 +1303,21 @@ BOOL smb_io_dom_rid2(const char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth if(!prs_align(ps)) return False; - if(!prs_uint8("type ", ps, depth, &rid2->type)) + if(!prs_uint8("type ", ps, depth, &rid->type)) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("rid ", ps, depth, &rid2->rid)) + if(!prs_uint32("rid ", ps, depth, &rid->rid)) return False; - if(!prs_uint32("rid_idx", ps, depth, &rid2->rid_idx)) + if(!prs_uint32("rid_idx", ps, depth, &rid->rid_idx)) + return False; + if(!prs_uint32("unknown", ps, depth, &rid->unknown)) return False; return True; } + /******************************************************************* creates a DOM_RID3 structure. ********************************************************************/ -- cgit From 85160e654e5a1fc4fcb0d6cecc5187cc3b62f6d7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 11 Feb 2006 05:36:27 +0000 Subject: r13458: Add parsing functions - but stub internals for lookupnames3 and 4. Jeremy. (This used to be commit f1a362580ae37730dc8393a79f832aed5d0ea4be) --- source3/rpc_parse/parse_lsa.c | 298 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 296 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index d041553e14..86df5fcc11 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1368,7 +1368,9 @@ BOOL lsa_io_q_lookup_names(const char *desc, LSA_Q_LOOKUP_NAMES *q_r, return False; if(!prs_uint32("ptr_trans_sids ", ps, depth, &q_r->ptr_trans_sids)) return False; - if(!prs_uint32("lookup_level ", ps, depth, &q_r->lookup_level)) + 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; @@ -1487,7 +1489,9 @@ BOOL lsa_io_q_lookup_names2(const char *desc, LSA_Q_LOOKUP_NAMES2 *q_r, return False; if(!prs_uint32("ptr_trans_sids ", ps, depth, &q_r->ptr_trans_sids)) return False; - if(!prs_uint32("lookup_level ", ps, depth, &q_r->lookup_level)) + 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; @@ -1556,7 +1560,297 @@ BOOL lsa_io_r_lookup_names2(const char *desc, LSA_R_LOOKUP_NAMES2 *out, prs_stru 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)) { + 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_names3"); + 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)) { + 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; +} /******************************************************************* Inits an LSA_Q_CLOSE structure. -- cgit From 8d5ef34aa35406c32b00a75bcb3aed0c1c0979b3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 16 Feb 2006 01:06:21 +0000 Subject: r13521: Implement LOOKUPNAME3 and 4. Jeremy. (This used to be commit 6ec0e9124a1a7b19c9853b8e26075cbbb8751f10) --- source3/rpc_parse/parse_lsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 86df5fcc11..d4dd251fc5 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1731,7 +1731,7 @@ BOOL lsa_io_q_lookup_names4(const char *desc, LSA_Q_LOOKUP_NAMES4 *q_r, { unsigned int i; - prs_debug(ps, depth, desc, "lsa_io_q_lookup_names3"); + prs_debug(ps, depth, desc, "lsa_io_q_lookup_names4"); depth++; if(!prs_align(ps)) -- cgit From 6a6f2463f6a3f3a5828b9df8cbc9594e3bc5189c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 16 Feb 2006 13:18:17 +0000 Subject: r13522: Add SAMR_GET_USRDOM_PWINFO client-side. Guenther (This used to be commit 290a581b7567eab82b18fbadae9aa2ab29e95069) --- source3/rpc_parse/parse_samr.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 711876639a..53c92acb43 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -344,7 +344,7 @@ void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO *r_u, NTSTATUS statu { DEBUG(5, ("init_samr_r_get_usrdom_pwinfo\n")); - r_u->unknown_0 = 0x0000; + r_u->min_pwd_length = 0x0000; /* * used to be @@ -354,7 +354,7 @@ void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO *r_u, NTSTATUS statu r_u->unknown_1 = 0x01D1; r_u->unknown_1 = 0x0015; - r_u->unknown_2 = 0x00000000; + r_u->password_properties = 0x00000000; r_u->status = status; } @@ -375,12 +375,13 @@ BOOL samr_io_r_get_usrdom_pwinfo(const char *desc, SAMR_R_GET_USRDOM_PWINFO * r_ if(!prs_align(ps)) return False; - if(!prs_uint16("unknown_0", ps, depth, &r_u->unknown_0)) + 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("unknown_2", ps, depth, &r_u->unknown_2)) + if(!prs_uint32("password_properties", ps, depth, &r_u->password_properties)) return False; + if(!prs_ntstatus("status ", ps, depth, &r_u->status)) return False; -- cgit From fb5362c069b5b6548478b2217a0519c56d856705 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 20 Feb 2006 17:59:58 +0000 Subject: r13571: Replace all calls to talloc_free() with thye TALLOC_FREE() macro which sets the freed pointer to NULL. (This used to be commit b65be8874a2efe5a4b167448960a4fcf6bd995e2) --- source3/rpc_parse/parse_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index bc1eda8d04..5973deefd0 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -49,7 +49,7 @@ static TALLOC_CTX *main_loop_talloc = NULL; free up temporary memory - called from the main loop ********************************************************************/ -void main_loop_talloc_free(void) +void main_loop_TALLOC_FREE(void) { if (!main_loop_talloc) return; -- cgit From 2203bed32c84c63737f402accf73452efb76b483 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 20 Feb 2006 20:09:36 +0000 Subject: r13576: This is the beginnings of moving the SAM_ACCOUNT data structure to make full use of the new talloc() interface. Discussed with Volker and Jeremy. * remove the internal mem_ctx and simply use the talloc() structure as the context. * replace the internal free_fn() with a talloc_destructor() function * remove the unnecessary private nested structure * rename SAM_ACCOUNT to 'struct samu' to indicate the current an upcoming changes. Groups will most likely be replaced with a 'struct samg' in the future. Note that there are now passbd API changes. And for the most part, the wrapper functions remain the same. While this code has been tested on tdb and ldap based Samba PDC's as well as Samba member servers, there are probably still some bugs. The code also needs more testing under valgrind to ensure it's not leaking memory. But it's a start...... (This used to be commit 19b7593972480540283c5bf02c02e5ecd8d2c3f0) --- source3/rpc_parse/parse_samr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 53c92acb43..fc4d7a3ab3 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5976,7 +5976,7 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, *************************************************************************/ -NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID *domain_sid) +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, @@ -6242,7 +6242,7 @@ static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, return True; } -void init_sam_user_info20A(SAM_USER_INFO_20 *usr, SAM_ACCOUNT *pw) +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 = base64_decode_data_blob(munged_dial); -- cgit From 4ea92f30985466489a3b3faf5a1c90667175aad6 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 20 Feb 2006 23:22:56 +0000 Subject: r13581: Correctly parse a non-null terminated, little-endian UCS2 string in the PAC_LOGON_NAME structure. This was broken on big-endian machines (Solaris SPARC and ppc). Fixes Bug #3330. Jerry, this should be in 3.0.21c. Guenther (This used to be commit 9732490811f8f02ee547ddc6e2694e1122a3a518) --- source3/rpc_parse/parse_prs.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index c4f9f512ab..857a24cf0e 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1332,6 +1332,49 @@ BOOL prs_string_alloc(const char *name, prs_struct *ps, int depth, const char ** return True; } +/******************************************************************* + Stream a null-terminated string of fixed len. + ********************************************************************/ + +BOOL prs_string_len(const char *name, prs_struct *ps, int depth, char *str, int len) +{ + char *q; + int i; + BOOL charmode = True; + + q = prs_mem_get(ps, len+1); + if (q == NULL) + return False; + + for(i = 0; i < len; i++) { + if (UNMARSHALLING(ps)) + str[i] = q[i]; + else + q[i] = str[i]; + } + + /* The terminating null. */ + str[i] = '\0'; + + if (MARSHALLING(ps)) { + q[i] = '\0'; + } + + ps->data_offset += len+1; + + DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + if (charmode) { + print_asc(5, (unsigned char*)str, len); + } else { + for (i = 0; i < len; i++) + DEBUG(5,("%04x ", str[i])); + } + DEBUG(5,("\n")); + + return True; +} + + /******************************************************************* prs_uint16 wrapper. Call this and it sets up a pointer to where the uint16 should be stored, or gets the size if reading. -- cgit From 115996503ced64c478ed1cc857bd5a1528644b46 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 21 Feb 2006 03:08:42 +0000 Subject: r13585: Sorry Gunther, had to revert this. It's got a buffer overrun. Spoke to Jerry about the correct fix. Will add this after. Jeremy. (This used to be commit 33e13aabd3825c59d15dc897536e2ccf8c8f6d5e) --- source3/rpc_parse/parse_prs.c | 43 ------------------------------------------- 1 file changed, 43 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 857a24cf0e..c4f9f512ab 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1332,49 +1332,6 @@ BOOL prs_string_alloc(const char *name, prs_struct *ps, int depth, const char ** return True; } -/******************************************************************* - Stream a null-terminated string of fixed len. - ********************************************************************/ - -BOOL prs_string_len(const char *name, prs_struct *ps, int depth, char *str, int len) -{ - char *q; - int i; - BOOL charmode = True; - - q = prs_mem_get(ps, len+1); - if (q == NULL) - return False; - - for(i = 0; i < len; i++) { - if (UNMARSHALLING(ps)) - str[i] = q[i]; - else - q[i] = str[i]; - } - - /* The terminating null. */ - str[i] = '\0'; - - if (MARSHALLING(ps)) { - q[i] = '\0'; - } - - ps->data_offset += len+1; - - DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); - if (charmode) { - print_asc(5, (unsigned char*)str, len); - } else { - for (i = 0; i < len; i++) - DEBUG(5,("%04x ", str[i])); - } - DEBUG(5,("\n")); - - return True; -} - - /******************************************************************* prs_uint16 wrapper. Call this and it sets up a pointer to where the uint16 should be stored, or gets the size if reading. -- cgit From e54786b53543b4667288c64abb55478fddd95061 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 27 Feb 2006 10:32:45 +0000 Subject: r13711: * Correctly handle acb_info/acct_flags as uint32 not as uint16. * Fix a couple of related parsing issues. * in the info3 reply in a samlogon, return the ACB-flags (instead of returning zero) Guenther (This used to be commit 5b89e8bc24f0fdc8b52d5c9e849aba723df34ea7) --- source3/rpc_parse/parse_net.c | 18 +++++++++++------- source3/rpc_parse/parse_samr.c | 21 ++++++--------------- 2 files changed, 17 insertions(+), 22 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 3734ce26a6..745cf24b0f 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1424,7 +1424,8 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, uint16 logon_count, uint16 bad_pw_count, uint32 num_groups, const DOM_GID *gids, - uint32 user_flgs, uchar user_session_key[16], + 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) @@ -1466,6 +1467,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, 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)); @@ -1475,7 +1477,6 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, 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)); - memset(&usr->acct_flags, '\0', sizeof(usr->acct_flags)); for (i=0; i<7; i++) { memset(&usr->unknown[i], '\0', sizeof(usr->unknown)); @@ -1526,19 +1527,22 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, int lvl = 10; DEBUG(lvl,("dump_acct_flags\n")); if (acct_flags & ACB_NORMAL) { - DEBUGADD(lvl,("\taccount has UF_NORMAL_ACCOUNT\n")); + DEBUGADD(lvl,("\taccount has ACB_NORMAL\n")); } if (acct_flags & ACB_PWNOEXP) { - DEBUGADD(lvl,("\taccount has UF_DONT_EXPIRE_PASSWD\n")); + DEBUGADD(lvl,("\taccount has ACB_PWNOEXP\n")); } if (acct_flags & ACB_ENC_TXT_PWD_ALLOWED) { - DEBUGADD(lvl,("\taccount has UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED\n")); + DEBUGADD(lvl,("\taccount has ACB_ENC_TXT_PWD_ALLOWED\n")); } if (acct_flags & ACB_NOT_DELEGATED) { - DEBUGADD(lvl,("\taccount has UF_NOT_DELEGATED\n")); + DEBUGADD(lvl,("\taccount has ACB_NOT_DELEGATED\n")); } if (acct_flags & ACB_USE_DES_KEY_ONLY) { - DEBUGADD(lvl,("\taccount has UF_USE_DES_KEY_ONLY set, sig verify wont work\n")); + 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")); } } diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index fc4d7a3ab3..49d0fb7d72 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1004,7 +1004,7 @@ 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, - uint16 acb_info) + uint32 acb_info) { DEBUG(5, ("init_sam_entry1\n")); @@ -1040,10 +1040,7 @@ static BOOL sam_io_sam_entry1(const char *desc, SAM_ENTRY1 * sam, if(!prs_uint32("rid_user ", ps, depth, &sam->rid_user)) return False; - if(!prs_uint16("acb_info ", ps, depth, &sam->acb_info)) - return False; - - if(!prs_align(ps)) + 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)) @@ -1085,7 +1082,7 @@ 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, uint16 acb_info) + uint32 rid_user, uint32 acb_info) { DEBUG(5, ("init_sam_entry2\n")); @@ -1118,10 +1115,7 @@ static BOOL sam_io_sam_entry2(const char *desc, SAM_ENTRY2 * sam, if(!prs_uint32("rid_user ", ps, depth, &sam->rid_user)) return False; - if(!prs_uint16("acb_info ", ps, depth, &sam->acb_info)) - return False; - - if(!prs_align(ps)) + 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 */ @@ -1322,7 +1316,7 @@ 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, - uint16 acb_mask, uint16 unk_1, uint32 size) + uint32 acb_mask, uint32 size) { DEBUG(5, ("init_samr_q_enum_dom_users\n")); @@ -1330,7 +1324,6 @@ void init_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS * q_e, POLICY_HND *pol, q_e->start_idx = start_idx; /* zero indicates lots */ q_e->acb_mask = acb_mask; - q_e->unknown_1 = unk_1; q_e->max_size = size; } @@ -1355,9 +1348,7 @@ BOOL samr_io_q_enum_dom_users(const char *desc, SAMR_Q_ENUM_DOM_USERS * q_e, if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx)) return False; - if(!prs_uint16("acb_mask ", ps, depth, &q_e->acb_mask)) - return False; - if(!prs_uint16("unknown_1", ps, depth, &q_e->unknown_1)) + if(!prs_uint32("acb_mask ", ps, depth, &q_e->acb_mask)) return False; if(!prs_uint32("max_size ", ps, depth, &q_e->max_size)) -- cgit From a7552e677ed1c2df795c844987a7b7036c93bb35 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 2 Mar 2006 23:32:44 +0000 Subject: r13802: I *knew* ASU on sparc had to be good for *something* ! :-). Fix incorrect size understanding of sid name type (yes it's already correct in the Samba4 IDL :-). Jeremy. (This used to be commit 305a774d2880a57d1ebdf2ecf2d7e0b519695a33) --- source3/rpc_parse/parse_misc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 5973deefd0..f030e266df 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1254,7 +1254,7 @@ BOOL smb_io_account_lockout_str(const char *desc, LOCKOUT_STRING *account_lockou Inits a DOM_RID structure. ********************************************************************/ -void init_dom_rid(DOM_RID *prid, uint32 rid, uint8 type, uint32 idx) +void init_dom_rid(DOM_RID *prid, uint32 rid, uint16 type, uint32 idx) { prid->type = type; prid->rid = rid; @@ -1276,7 +1276,7 @@ BOOL smb_io_dom_rid(const char *desc, DOM_RID *rid, prs_struct *ps, int depth) if(!prs_align(ps)) return False; - if(!prs_uint8("type ", ps, depth, &rid->type)) + if(!prs_uint16("type ", ps, depth, &rid->type)) return False; if(!prs_align(ps)) return False; @@ -1303,7 +1303,7 @@ BOOL smb_io_dom_rid2(const char *desc, DOM_RID2 *rid, prs_struct *ps, int depth) if(!prs_align(ps)) return False; - if(!prs_uint8("type ", ps, depth, &rid->type)) + if(!prs_uint16("type ", ps, depth, &rid->type)) return False; if(!prs_align(ps)) return False; -- cgit From e33b728c7b2076917e2149191222b259e5c1d942 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 3 Mar 2006 16:44:30 +0000 Subject: r13815: "Into the blind world let us now descend," Began the poet, his face as pale as death. "I will go first, and you will follow me." --- Adding XcvDataPort() to the spoolss code for remotely add ports. The design is to allow an intuitive means of creating a new CUPS print queue from the Windows 2000/XP APW without hacks like specifying the deviceURI in the location field of the printer properties dialog. Also set 'default devmode = yes' as the new default since it causes no harm and only is executed when you have a NULL devmode anyways. (This used to be commit 123e478ce5b5f63a61d00197332b847e83722468) --- source3/rpc_parse/parse_spoolss.c | 64 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 45b683e9c6..6f3245243d 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7406,3 +7406,67 @@ BOOL make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle, return True; } + + +/******************************************************************* + ********************************************************************/ + +BOOL spoolss_io_q_xcvdataport(const char *desc, SPOOL_Q_XCVDATAPORT *q_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_q_xcvdataport"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) + return False; + + if(!smb_io_unistr2("", &q_u->dataname, True, ps, depth)) + return False; + + if (!prs_align(ps)) + return False; + + if(!prs_rpcbuffer("", ps, depth, &q_u->indata)) + return False; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("indata_len", ps, depth, &q_u->indata_len)) + return False; + if (!prs_uint32("offered", ps, depth, &q_u->offered)) + return False; + if (!prs_uint32("unknown", ps, depth, &q_u->unknown)) + return False; + + return True; +} + +/******************************************************************* + ********************************************************************/ + +BOOL spoolss_io_r_xcvdataport(const char *desc, SPOOL_R_XCVDATAPORT *r_u, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "spoolss_io_r_xcvdataport"); + depth++; + + if(!prs_align(ps)) + return False; + if(!prs_rpcbuffer("", ps, depth, &r_u->outdata)) + return False; + + if (!prs_align(ps)) + return False; + + if(!prs_pointer("unknown1", ps, depth, (void**)&r_u->unknown1, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_uint32)) + return False; + if(!prs_pointer("unknown2", ps, depth, (void**)&r_u->unknown2, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_uint32)) + return False; + if(!prs_werror("status", ps, depth, &r_u->status)) + return False; + + return True; +} + -- cgit From 889ff32b5eb6ac60bc6f490ceb85dceee77c18d9 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 3 Mar 2006 20:49:31 +0000 Subject: r13824: * add api table for Xcv TCPMON and LOCALMON calls starting with the "MonitorUI" call * Fix some parsing errors This gets us to the Add Port Wizard dialog. (This used to be commit a444aa7f0088fb71ff89df8c280209188b33ec3d) --- source3/rpc_parse/parse_spoolss.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 6f3245243d..2bb8a7bbdd 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7460,13 +7460,31 @@ BOOL spoolss_io_r_xcvdataport(const char *desc, SPOOL_R_XCVDATAPORT *r_u, prs_st if (!prs_align(ps)) return False; - if(!prs_pointer("unknown1", ps, depth, (void**)&r_u->unknown1, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_uint32)) - return False; - if(!prs_pointer("unknown2", ps, depth, (void**)&r_u->unknown2, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_uint32)) - return False; - if(!prs_werror("status", ps, depth, &r_u->status)) + if (!prs_uint32("needed", ps, depth, &r_u->needed)) + return False; + if (!prs_uint32("unknown", ps, depth, &r_u->unknown)) + return False; + + if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True; } +/******************************************************************* + ********************************************************************/ + +BOOL make_monitorui_buf( RPC_BUFFER *buf, const char *dllname ) +{ + UNISTR string; + + if ( !buf ) + return False; + + init_unistr( &string, dllname ); + + if ( !prs_unistr( "ui_dll", &buf->prs, 0, &string ) ) + return False; + + return True; +} -- cgit From 5df58c38f3c29d87c5918d1611c17e016c6f7545 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 4 Mar 2006 00:05:40 +0000 Subject: r13829: From the "It's not pretty but it works" category * Finish prototype of the "add port command" implementation Format is "addportcommand portname deviceURI" * DeviceURI is either - socket://hostname:port/ - lpr://hostname/queue depending on what the client sent in the request (This used to be commit 6d74de7a676b71e83a3c3714743e6380c04e4425) --- source3/rpc_parse/parse_spoolss.c | 100 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 2bb8a7bbdd..576d75f88c 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7488,3 +7488,103 @@ BOOL make_monitorui_buf( RPC_BUFFER *buf, const char *dllname ) return True; } + +/******************************************************************* + ********************************************************************/ + +static BOOL smb_io_port_data_1( const char *desc, RPC_BUFFER *buf, int depth, SPOOL_PORT_DATA_1 *p1 ) +{ + prs_struct *ps = &buf->prs; + uint8 *fodder; + + prs_debug(ps, depth, desc, "smb_io_port_data_1"); + depth++; + + if(!prs_align(ps)) + return False; + + if ( UNMARSHALLING(ps) ) { + p1->portname.buffer = PRS_ALLOC_MEM( ps, uint16, 64 ); + p1->hostaddress.buffer = PRS_ALLOC_MEM( ps, uint16, 49 ); + p1->snmpcommunity.buffer = PRS_ALLOC_MEM( ps, uint16, 33 ); + p1->queue.buffer = PRS_ALLOC_MEM( ps, uint16, 33 ); + p1->ipaddress.buffer = PRS_ALLOC_MEM( ps, uint16, 17 ); + fodder = PRS_ALLOC_MEM( ps, uint8, 540 ); + } + + if( !prs_uint16s(True, "portname", ps, depth, p1->portname.buffer, 64)) + return False; + + if (!prs_uint32("version", ps, depth, &p1->version)) + return False; + if (!prs_uint32("protocol", ps, depth, &p1->protocol)) + return False; + if (!prs_uint32("size", ps, depth, &p1->size)) + return False; + if (!prs_uint32("reserved", ps, depth, &p1->reserved)) + return False; + + if( !prs_uint16s(True, "hostaddress", ps, depth, p1->hostaddress.buffer, 49)) + return False; + if( !prs_uint16s(True, "snmpcommunity", ps, depth, p1->snmpcommunity.buffer, 33)) + return False; + + if (!prs_uint32("dblspool", ps, depth, &p1->dblspool)) + return False; + + if( !prs_uint16s(True, "queue", ps, depth, p1->queue.buffer, 33)) + return False; + if( !prs_uint16s(True, "ipaddress", ps, depth, p1->ipaddress.buffer, 17)) + return False; + + /* fodder according to MSDN */ + if( !prs_uint8s(False, "", ps, depth, fodder, 540)) + return False; + + if (!prs_uint32("port", ps, depth, &p1->port)) + return False; + if (!prs_uint32("snmpenabled", ps, depth, &p1->snmpenabled)) + return False; + if (!prs_uint32("snmpdevindex", ps, depth, &p1->snmpdevindex)) + return False; + + return True; +} + +/******************************************************************* + ********************************************************************/ + +BOOL convert_port_data_1( NT_PORT_DATA_1 *port1, RPC_BUFFER *buf ) +{ + SPOOL_PORT_DATA_1 spdata_1; + + ZERO_STRUCT( spdata_1 ); + + if ( !smb_io_port_data_1( "port_data_1", buf, 0, &spdata_1 ) ) + return False; + + rpcstr_pull(port1->name, spdata_1.portname.buffer, sizeof(port1->name), + -1, 0); + rpcstr_pull(port1->queue, spdata_1.queue.buffer, sizeof(port1->queue), + -1, 0); + rpcstr_pull(port1->hostaddr, spdata_1.hostaddress.buffer, + sizeof(port1->hostaddr), -1, 0); + + port1->port = spdata_1.port; + + switch ( spdata_1.protocol ) { + case 1: + port1->protocol = PORT_PROTOCOL_DIRECT; + break; + case 2: + port1->protocol = PORT_PROTOCOL_LPR; + break; + default: + DEBUG(3,("convert_port_data_1: unknown protocol [%d]!\n", + spdata_1.protocol)); + return False; + } + + return True; +} + -- cgit From a787e2d12484545633a540e6aa02e84f6fa456fa Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 5 Mar 2006 17:39:21 +0000 Subject: r13841: Fix an uninitialized variable warning. Jerry, this just fixes the warning. This routine does not seem to cope well with !UNMARSHALLING. You might want to look... Volker (This used to be commit 2c0c40dfb5da9e901e099295f43032a745e71253) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 576d75f88c..6f1ace8214 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7495,7 +7495,7 @@ BOOL make_monitorui_buf( RPC_BUFFER *buf, const char *dllname ) static BOOL smb_io_port_data_1( const char *desc, RPC_BUFFER *buf, int depth, SPOOL_PORT_DATA_1 *p1 ) { prs_struct *ps = &buf->prs; - uint8 *fodder; + uint8 *fodder = NULL; prs_debug(ps, depth, desc, "smb_io_port_data_1"); depth++; -- cgit From 9f2e29799eac96068fa033bdc4a9df5a82ec470d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 6 Mar 2006 15:22:00 +0000 Subject: r13864: Some cleanup and the samr set security object function client-side. Guenther (This used to be commit 0ae3fddf95a95ec8a2f4d52e1276c1721b33ddfd) --- source3/rpc_parse/parse_samr.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 49d0fb7d72..3147ae0028 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -918,6 +918,21 @@ BOOL samr_io_r_query_dom_info(const char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, 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. ********************************************************************/ -- cgit From 129fd6c5c641cf4c2db31eb093baebd08df63107 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 6 Mar 2006 18:40:00 +0000 Subject: r13878: move PORT_DATA_1 to use static sized UNICODE strings as per MSDN (This used to be commit c803e1b2afdfc5bd983f046c976c01adebcfa1ad) --- source3/rpc_parse/parse_spoolss.c | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 6f1ace8214..5a17860814 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7491,28 +7491,21 @@ BOOL make_monitorui_buf( RPC_BUFFER *buf, const char *dllname ) /******************************************************************* ********************************************************************/ + +#define PORT_DATA_1_PAD 540 static BOOL smb_io_port_data_1( const char *desc, RPC_BUFFER *buf, int depth, SPOOL_PORT_DATA_1 *p1 ) { prs_struct *ps = &buf->prs; - uint8 *fodder = NULL; + uint8 padding[PORT_DATA_1_PAD]; prs_debug(ps, depth, desc, "smb_io_port_data_1"); depth++; if(!prs_align(ps)) return False; - - if ( UNMARSHALLING(ps) ) { - p1->portname.buffer = PRS_ALLOC_MEM( ps, uint16, 64 ); - p1->hostaddress.buffer = PRS_ALLOC_MEM( ps, uint16, 49 ); - p1->snmpcommunity.buffer = PRS_ALLOC_MEM( ps, uint16, 33 ); - p1->queue.buffer = PRS_ALLOC_MEM( ps, uint16, 33 ); - p1->ipaddress.buffer = PRS_ALLOC_MEM( ps, uint16, 17 ); - fodder = PRS_ALLOC_MEM( ps, uint8, 540 ); - } - if( !prs_uint16s(True, "portname", ps, depth, p1->portname.buffer, 64)) + if( !prs_uint16s(True, "portname", ps, depth, p1->portname, MAX_PORTNAME)) return False; if (!prs_uint32("version", ps, depth, &p1->version)) @@ -7524,21 +7517,20 @@ static BOOL smb_io_port_data_1( const char *desc, RPC_BUFFER *buf, int depth, SP if (!prs_uint32("reserved", ps, depth, &p1->reserved)) return False; - if( !prs_uint16s(True, "hostaddress", ps, depth, p1->hostaddress.buffer, 49)) + if( !prs_uint16s(True, "hostaddress", ps, depth, p1->hostaddress, MAX_NETWORK_NAME)) return False; - if( !prs_uint16s(True, "snmpcommunity", ps, depth, p1->snmpcommunity.buffer, 33)) + if( !prs_uint16s(True, "snmpcommunity", ps, depth, p1->snmpcommunity, MAX_SNMP_COMM_NAME)) return False; if (!prs_uint32("dblspool", ps, depth, &p1->dblspool)) return False; - if( !prs_uint16s(True, "queue", ps, depth, p1->queue.buffer, 33)) + if( !prs_uint16s(True, "queue", ps, depth, p1->queue, MAX_QUEUE_NAME)) return False; - if( !prs_uint16s(True, "ipaddress", ps, depth, p1->ipaddress.buffer, 17)) + if( !prs_uint16s(True, "ipaddress", ps, depth, p1->ipaddress, MAX_IPADDR_STRING)) return False; - /* fodder according to MSDN */ - if( !prs_uint8s(False, "", ps, depth, fodder, 540)) + if( !prs_uint8s(False, "", ps, depth, padding, PORT_DATA_1_PAD)) return False; if (!prs_uint32("port", ps, depth, &p1->port)) @@ -7563,12 +7555,9 @@ BOOL convert_port_data_1( NT_PORT_DATA_1 *port1, RPC_BUFFER *buf ) if ( !smb_io_port_data_1( "port_data_1", buf, 0, &spdata_1 ) ) return False; - rpcstr_pull(port1->name, spdata_1.portname.buffer, sizeof(port1->name), - -1, 0); - rpcstr_pull(port1->queue, spdata_1.queue.buffer, sizeof(port1->queue), - -1, 0); - rpcstr_pull(port1->hostaddr, spdata_1.hostaddress.buffer, - sizeof(port1->hostaddr), -1, 0); + rpcstr_pull(port1->name, spdata_1.portname, sizeof(port1->name), -1, 0); + rpcstr_pull(port1->queue, spdata_1.queue, sizeof(port1->queue), -1, 0); + rpcstr_pull(port1->hostaddr, spdata_1.hostaddress, sizeof(port1->hostaddr), -1, 0); port1->port = spdata_1.port; -- cgit From 894358a8f3e338b339b6c37233edef794b312087 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 7 Mar 2006 06:31:04 +0000 Subject: r13915: Fixed a very interesting class of realloc() bugs found by Coverity. realloc can return NULL in one of two cases - (1) the realloc failed, (2) realloc succeeded but the new size requested was zero, in which case this is identical to a free() call. The error paths dealing with these two cases should be different, but mostly weren't. Secondly the standard idiom for dealing with realloc when you know the new size is non-zero is the following : tmp = realloc(p, size); if (!tmp) { SAFE_FREE(p); return error; } else { p = tmp; } However, there were *many* *many* places in Samba where we were using the old (broken) idiom of : p = realloc(p, size) if (!p) { return error; } which will leak the memory pointed to by p on realloc fail. This commit (hopefully) fixes all these cases by moving to a standard idiom of : p = SMB_REALLOC(p, size) if (!p) { return error; } Where if the realloc returns null due to the realloc failing or size == 0 we *guarentee* that the storage pointed to by p has been freed. This allows me to remove a lot of code that was dealing with the standard (more verbose) method that required a tmp pointer. This is almost always what you want. When a realloc fails you never usually want the old memory, you want to free it and get into your error processing asap. For the 11 remaining cases where we really do need to keep the old pointer I have invented the new macro SMB_REALLOC_KEEP_OLD_ON_ERROR, which can be used as follows : tmp = SMB_REALLOC_KEEP_OLD_ON_ERROR(p, size); if (!tmp) { SAFE_FREE(p); return error; } else { p = tmp; } SMB_REALLOC_KEEP_OLD_ON_ERROR guarentees never to free the pointer p, even on size == 0 or realloc fail. All this is done by a hidden extra argument to Realloc(), BOOL free_old_on_error which is set appropriately by the SMB_REALLOC and SMB_REALLOC_KEEP_OLD_ON_ERROR macros (and their array counterparts). It remains to be seen what this will do to our Coverity bug count :-). Jeremy. (This used to be commit 1d710d06a214f3f1740e80e0bffd6aab44aac2b0) --- source3/rpc_parse/parse_buffer.c | 9 ++------- source3/rpc_parse/parse_prs.c | 39 ++++++++++++++++++++------------------- source3/rpc_parse/parse_spoolss.c | 8 +++----- 3 files changed, 25 insertions(+), 31 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index 36d8eda847..b220809654 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -371,19 +371,14 @@ BOOL smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16 /* we're going to add two more bytes here in case this is the last string in the array and we need to add an extra NULL for termination */ - if (l_chaine > 0) - { - uint16 *tc2; - + if (l_chaine > 0) { realloc_size = (l_chaine2+l_chaine+2)*sizeof(uint16); /* Yes this should be realloc - it's freed below. JRA */ - if((tc2=(uint16 *)SMB_REALLOC(chaine2, realloc_size)) == NULL) { - SAFE_FREE(chaine2); + if((chaine2=(uint16 *)SMB_REALLOC(chaine2, realloc_size)) == NULL) { return False; } - else chaine2 = tc2; memcpy(chaine2+l_chaine2, chaine.buffer, (l_chaine+1)*sizeof(uint16)); l_chaine2+=l_chaine+1; } diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index c4f9f512ab..4683f1dbd0 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -207,16 +207,21 @@ BOOL prs_set_buffer_size(prs_struct *ps, uint32 newsize) return prs_force_grow(ps, newsize - ps->buffer_size); if (newsize < ps->buffer_size) { - char *new_data_p = SMB_REALLOC(ps->data_p, newsize); - /* if newsize is zero, Realloc acts like free() & returns NULL*/ - if (new_data_p == NULL && newsize != 0) { - DEBUG(0,("prs_set_buffer_size: Realloc failure for size %u.\n", - (unsigned int)newsize)); - DEBUG(0,("prs_set_buffer_size: Reason %s\n",strerror(errno))); - return False; - } - ps->data_p = new_data_p; ps->buffer_size = newsize; + + /* newsize == 0 acts as a free and set pointer to NULL */ + if (newsize == 0) { + SAFE_FREE(ps->data_p); + } else { + ps->data_p = SMB_REALLOC(ps->data_p, newsize); + + if (ps->data_p == NULL) { + DEBUG(0,("prs_set_buffer_size: Realloc failure for size %u.\n", + (unsigned int)newsize)); + DEBUG(0,("prs_set_buffer_size: Reason %s\n",strerror(errno))); + return False; + } + } } return True; @@ -230,7 +235,6 @@ BOOL prs_set_buffer_size(prs_struct *ps, uint32 newsize) BOOL prs_grow(prs_struct *ps, uint32 extra_space) { uint32 new_size; - char *new_data; ps->grow_size = MAX(ps->grow_size, ps->data_offset + extra_space); @@ -261,11 +265,11 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) new_size = MAX(RPC_MAX_PDU_FRAG_LEN,extra_space); - if((new_data = SMB_MALLOC(new_size)) == NULL) { + if((ps->data_p = SMB_MALLOC(new_size)) == NULL) { DEBUG(0,("prs_grow: Malloc failure for size %u.\n", (unsigned int)new_size)); return False; } - memset(new_data, '\0', (size_t)new_size ); + memset(ps->data_p, '\0', (size_t)new_size ); } else { /* * If the current buffer size is bigger than the space needed, just @@ -273,16 +277,15 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) */ new_size = MAX(ps->buffer_size*2, ps->buffer_size + extra_space); - if ((new_data = SMB_REALLOC(ps->data_p, new_size)) == NULL) { + if ((ps->data_p = SMB_REALLOC(ps->data_p, new_size)) == NULL) { DEBUG(0,("prs_grow: Realloc failure for size %u.\n", (unsigned int)new_size)); return False; } - memset(&new_data[ps->buffer_size], '\0', (size_t)(new_size - ps->buffer_size)); + memset(&ps->data_p[ps->buffer_size], '\0', (size_t)(new_size - ps->buffer_size)); } ps->buffer_size = new_size; - ps->data_p = new_data; return True; } @@ -296,7 +299,6 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) BOOL prs_force_grow(prs_struct *ps, uint32 extra_space) { uint32 new_size = ps->buffer_size + extra_space; - char *new_data; if(!UNMARSHALLING(ps) || !ps->is_dynamic) { DEBUG(0,("prs_force_grow: Buffer overflow - unable to expand buffer by %u bytes.\n", @@ -304,16 +306,15 @@ BOOL prs_force_grow(prs_struct *ps, uint32 extra_space) return False; } - if((new_data = SMB_REALLOC(ps->data_p, new_size)) == NULL) { + if((ps->data_p = SMB_REALLOC(ps->data_p, new_size)) == NULL) { DEBUG(0,("prs_force_grow: Realloc failure for size %u.\n", (unsigned int)new_size)); return False; } - memset(&new_data[ps->buffer_size], '\0', (size_t)(new_size - ps->buffer_size)); + memset(&ps->data_p[ps->buffer_size], '\0', (size_t)(new_size - ps->buffer_size)); ps->buffer_size = new_size; - ps->data_p = new_data; return True; } diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 5a17860814..5a308bc77d 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4968,7 +4968,7 @@ BOOL spool_io_printer_driver_info_level_6(const char *desc, SPOOL_PRINTER_DRIVER ********************************************************************/ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) { - fstring f, *tar; + fstring f; int n = 0; char *src; @@ -4981,11 +4981,9 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) while (src < ((char *)buf5->buffer) + buf5->buf_len*2) { rpcstr_pull(f, src, sizeof(f)-1, -1, STR_TERMINATE); src = skip_unibuf(src, 2*buf5->buf_len - PTR_DIFF(src,buf5->buffer)); - tar = SMB_REALLOC_ARRAY(*ar, fstring, n+2); - if (!tar) + *ar = SMB_REALLOC_ARRAY(*ar, fstring, n+2); + if (!*ar) return False; - else - *ar = tar; fstrcpy((*ar)[n], f); n++; } -- cgit From cd49e2546ecc3d16dc2f89c07d48b98995ec5ff9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 7 Mar 2006 20:52:43 +0000 Subject: r13989: Fix for Coverity bug #45 and associated spoolss RPC_BUFFER problems. Ensure that if the parse succeeds on UNMARSHALL we have a valid (although possibly empty) RPC_BUFFER returned. Jeremy. (This used to be commit d319cc9c08bfa865a6431a8631a9c609f589be1f) --- source3/rpc_parse/parse_buffer.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index b220809654..b8b2c2e9ea 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -108,19 +108,34 @@ BOOL prs_rpcbuffer_p(const char *desc, prs_struct *ps, int depth, RPC_BUFFER **b data_p = *buffer ? 0xf000baaa : 0; - if ( !prs_uint32("ptr", ps, depth, &data_p )) + if ( !prs_uint32("ptr", ps, depth, &data_p )) { return False; + } - /* we're done if there is no data */ - - if ( !data_p ) - return True; - + /* We must always return a valid buffer pointer even if the + client didn't send one - just leave it initialized to null. */ if ( UNMARSHALLING(ps) ) { - if ( !(*buffer = PRS_ALLOC_MEM(ps, RPC_BUFFER, 1)) ) + if ( !(*buffer = PRS_ALLOC_MEM(ps, RPC_BUFFER, 1)) ) { return False; + } } + /* we're done if there is no data */ + + if (!data_p) { + if (UNMARSHALLING(ps)) { + RPC_BUFFER *pbuffer = *buffer; + /* On unmarshalling we must return a valid, + but zero size value RPC_BUFFER. */ + pbuffer->size = 0; + pbuffer->string_at_end = 0; + if (!prs_init(&pbuffer->prs, 0, prs_get_mem_context(ps), UNMARSHALL)) { + return False; + } + } + return True; + } + return prs_rpcbuffer( desc, ps, depth, *buffer); } -- cgit From a3586ff60ccb2c2bd491dd08a67fb0cc22842f7a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 8 Mar 2006 06:16:54 +0000 Subject: r14014: Coverity paranoia. Shut it up by making the guarentee in the code explicit - but this was a false positive (CID #16). Jeremy. (This used to be commit 43a0e869f2aee9b4e22d0d7fc92051e82f7536ad) --- source3/rpc_parse/parse_buffer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index b8b2c2e9ea..52117dc44b 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -47,7 +47,7 @@ BOOL prs_rpcbuffer(const char *desc, prs_struct *ps, int depth, RPC_BUFFER *buff { prs_debug(ps, depth, desc, "prs_rpcbuffer"); depth++; - + /* reading */ if (UNMARSHALLING(ps)) { buffer->size=0; @@ -135,7 +135,12 @@ BOOL prs_rpcbuffer_p(const char *desc, prs_struct *ps, int depth, RPC_BUFFER **b } return True; } - + + /* Coverity paranoia. Buffer must be valid. */ + if (!*buffer) { + return False; + } + return prs_rpcbuffer( desc, ps, depth, *buffer); } -- cgit From 874a9d02de00d9853d77d401cf559ee69b1e90fd Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 8 Mar 2006 06:51:38 +0000 Subject: r14025: Remove unused code. When we want to export samsync, we better first port pidl... Fix Coverity # 15. Volker (This used to be commit 29b4b986cc225a98d263c883fd52e8b210099b9e) --- source3/rpc_parse/parse_net.c | 80 ------------------------------------------- 1 file changed, 80 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 745cf24b0f..9e55d320be 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -2239,86 +2239,6 @@ static BOOL net_io_sam_passwd_info(const char *desc, SAM_PWD * pwd, return True; } -/******************************************************************* -makes a SAM_ACCOUNT_INFO structure. -********************************************************************/ -BOOL make_sam_account_info(SAM_ACCOUNT_INFO * info, - const UNISTR2 *user_name, - const UNISTR2 *full_name, - uint32 user_rid, uint32 group_rid, - const UNISTR2 *home_dir, - const UNISTR2 *dir_drive, - const UNISTR2 *log_scr, - const UNISTR2 *desc, - uint32 acb_info, - const UNISTR2 *prof_path, - const UNISTR2 *wkstas, - const UNISTR2 *unk_str, const UNISTR2 *mung_dial) -{ - int len_user_name = user_name != NULL ? user_name->uni_str_len : 0; - int len_full_name = full_name != NULL ? full_name->uni_str_len : 0; - int len_home_dir = home_dir != NULL ? home_dir->uni_str_len : 0; - int len_dir_drive = dir_drive != NULL ? dir_drive->uni_str_len : 0; - int len_logon_script = log_scr != NULL ? log_scr->uni_str_len : 0; - int len_profile_path = prof_path != NULL ? prof_path->uni_str_len : 0; - int len_description = desc != NULL ? desc->uni_str_len : 0; - int len_workstations = wkstas != NULL ? wkstas->uni_str_len : 0; - int len_unknown_str = unk_str != NULL ? unk_str->uni_str_len : 0; - int len_munged_dial = mung_dial != NULL ? mung_dial->uni_str_len : 0; - - DEBUG(5, ("make_sam_account_info\n")); - - make_uni_hdr(&info->hdr_acct_name, len_user_name); - make_uni_hdr(&info->hdr_full_name, len_full_name); - make_uni_hdr(&info->hdr_home_dir, len_home_dir); - make_uni_hdr(&info->hdr_dir_drive, len_dir_drive); - make_uni_hdr(&info->hdr_logon_script, len_logon_script); - make_uni_hdr(&info->hdr_profile, len_profile_path); - make_uni_hdr(&info->hdr_acct_desc, len_description); - make_uni_hdr(&info->hdr_workstations, len_workstations); - make_uni_hdr(&info->hdr_comment, len_unknown_str); - make_uni_hdr(&info->hdr_parameters, len_munged_dial); - - /* not present */ - make_bufhdr2(&info->hdr_sec_desc, 0, 0, 0); - - info->user_rid = user_rid; - info->group_rid = group_rid; - - init_nt_time(&info->logon_time); - init_nt_time(&info->logoff_time); - init_nt_time(&info->pwd_last_set_time); - init_nt_time(&info->acct_expiry_time); - - info->logon_divs = 0xA8; - info->ptr_logon_hrs = 0; /* Don't care right now */ - - info->bad_pwd_count = 0; - info->logon_count = 0; - info->acb_info = acb_info; - info->nt_pwd_present = 0; - info->lm_pwd_present = 0; - info->pwd_expired = 0; - info->country = 0; - info->codepage = 0; - - info->unknown1 = 0x4EC; - info->unknown2 = 0; - - copy_unistr2(&info->uni_acct_name, user_name); - copy_unistr2(&info->uni_full_name, full_name); - copy_unistr2(&info->uni_home_dir, home_dir); - copy_unistr2(&info->uni_dir_drive, dir_drive); - copy_unistr2(&info->uni_logon_script, log_scr); - copy_unistr2(&info->uni_profile, prof_path); - copy_unistr2(&info->uni_acct_desc, desc); - copy_unistr2(&info->uni_workstations, wkstas); - copy_unistr2(&info->uni_comment, unk_str); - copy_unistr2(&info->uni_parameters, mung_dial); - - return True; -} - /******************************************************************* reads or writes a structure. ********************************************************************/ -- cgit From 8d1dd8bb96ea6caec651397400a2cce8f37570e3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 8 Mar 2006 17:50:44 +0000 Subject: r14043: After discussion with Jerry revert part of the Coverity null-ref patch - put prs_rpcbuffer_p back to the way it was (with an additional coverity paranoia check) - move the real test into rpcbuf_alloc_size instead. Jeremy. (This used to be commit f74993e65c01bc0ef73d3e8710bb2f840910161a) --- source3/rpc_parse/parse_buffer.c | 41 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index 52117dc44b..21dddfa3cf 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -108,37 +108,22 @@ BOOL prs_rpcbuffer_p(const char *desc, prs_struct *ps, int depth, RPC_BUFFER **b data_p = *buffer ? 0xf000baaa : 0; - if ( !prs_uint32("ptr", ps, depth, &data_p )) { + if ( !prs_uint32("ptr", ps, depth, &data_p )) return False; - } - - /* We must always return a valid buffer pointer even if the - client didn't send one - just leave it initialized to null. */ - if ( UNMARSHALLING(ps) ) { - if ( !(*buffer = PRS_ALLOC_MEM(ps, RPC_BUFFER, 1)) ) { - return False; - } - } /* we're done if there is no data */ - if (!data_p) { - if (UNMARSHALLING(ps)) { - RPC_BUFFER *pbuffer = *buffer; - /* On unmarshalling we must return a valid, - but zero size value RPC_BUFFER. */ - pbuffer->size = 0; - pbuffer->string_at_end = 0; - if (!prs_init(&pbuffer->prs, 0, prs_get_mem_context(ps), UNMARSHALL)) { - return False; - } - } + if ( !data_p ) return True; - } - /* Coverity paranoia. Buffer must be valid. */ - if (!*buffer) { - return False; + if ( UNMARSHALLING(ps) ) { + if ( !(*buffer = PRS_ALLOC_MEM(ps, RPC_BUFFER, 1)) ) + return False; + } else { + /* Marshalling case. - coverity paranoia - should already be ok if data_p != 0 */ + if (!*buffer) { + return True; + } } return prs_rpcbuffer( desc, ps, depth, *buffer); @@ -158,7 +143,11 @@ BOOL rpcbuf_alloc_size(RPC_BUFFER *buffer, uint32 buffer_size) if ( buffer_size == 0x0 ) return True; - + + if (!buffer) { + return False; + } + ps= &buffer->prs; /* damn, I'm doing the reverse operation of prs_grow() :) */ -- cgit From d8ba987bfe202a4b0676c26cfc6a37a09b897ebf Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 8 Mar 2006 20:02:50 +0000 Subject: r14045: Coverity fix #14. Ensure if len is set buf != NULL. Jeremy. (This used to be commit fb1a6073321840fecf22f3e0f7541f5ad87f5e49) --- source3/rpc_parse/parse_misc.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index f030e266df..838006ab58 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -762,6 +762,11 @@ void init_string2(STRING2 *str, const char *buf, size_t max_len, size_t str_len) /* set up string lengths. */ SMB_ASSERT(max_len >= str_len); + /* Ensure buf is valid if str_len was set. Coverity check. */ + if (str_len && !buf) { + return; + } + str->str_max_len = max_len; str->offset = 0; str->str_str_len = str_len; -- cgit From b05af765418fe6054f2443ecbb4a556c5882a8c7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 8 Mar 2006 20:07:24 +0000 Subject: r14047: Coverity fix #17. Ensure srv_name and info cannot be zero before deref. Jeremy. (This used to be commit fbf9db6624d9584a26ae302df3c76555bbd2bb1e) --- source3/rpc_parse/parse_spoolss.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 5a308bc77d..f79731fea2 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5061,6 +5061,10 @@ BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx, { DEBUG(5,("make_spoolss_q_addprinterdriver\n")); + if (!srv_name || !info) { + return False; + } + q_u->server_name_ptr = (srv_name!=NULL)?1:0; init_unistr2(&q_u->server_name, srv_name, UNI_STR_TERMINATE); -- cgit From fc5a7fe064e2c5f4747f28ee0a0ff9a7f0c6b071 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 9 Mar 2006 10:57:39 +0000 Subject: r14061: Some debugging for the new LOGON/ACB-flags. Guenther (This used to be commit 7616317f9f45dfbc453a7687e8b8b6ff57ddb0a3) --- source3/rpc_parse/parse_net.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 9e55d320be..e168f5abbd 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1544,6 +1544,9 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, 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")); + } } void dump_user_flgs(uint32 user_flags) { @@ -1562,6 +1565,12 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, 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")); + } } -- cgit From d785b61a16c6135923a5aece1536c427ba91799f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 9 Mar 2006 17:56:16 +0000 Subject: r14080: Fix Coverity bug #18. Ensure non-null before ref. Jeremy. (This used to be commit 617c5805e59dd601b8841251032e3db4d6a64621) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index f79731fea2..bb33918a44 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -937,7 +937,7 @@ BOOL make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u { DEBUG(5,("make_spoolss_q_addprinterex\n")); - if (!ctr) + if (!ctr || !ctr->printers_2) return False; ZERO_STRUCTP(q_u); -- cgit From a9d1af9d31062ce39eeab90250ea86cccd5a11b6 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 9 Mar 2006 18:01:42 +0000 Subject: r14083: Fix coverity bug #19. Don't deref possible NULL. Jeremy. (This used to be commit fc8e1e5c02dd950ed1f8656a5d7ab47fa7ec1ea7) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index bb33918a44..e4a023ac21 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3733,7 +3733,7 @@ BOOL make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, SEC_DESC *secdesc; DEVICEMODE *devmode; - if (q_u == NULL) + if (!q_u || !info) return False; memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); -- cgit From d12fd8dcb71a85d0ecd38dd6c17d213cefcdf1c0 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 9 Mar 2006 19:13:55 +0000 Subject: r14090: Fix coverity bug #21, don't deref potential null. Jeremy. (This used to be commit 76c4d5212bcb5f54472c9ceac2368078ebad7a3b) --- source3/rpc_parse/parse_samr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 3147ae0028..79dbcfe034 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5972,7 +5972,11 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, copy_unistr2(&usr->uni_munged_dial, mung_dial); init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); - memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs)); + if (hrs) { + memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs)); + } else { + ZERO_STRUCT(usr->logon_hrs); + } } /************************************************************************* -- cgit From aa3cab954e1d33bb8e5a5891e2b4f8024cfe5b70 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 9 Mar 2006 19:51:38 +0000 Subject: r14092: Fix coverity bug #22. Ensure no possible null deref. Jeremy. (This used to be commit 0026fb0b2843271c27e9dc02a32e88d580bebbc3) --- source3/rpc_parse/parse_samr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 79dbcfe034..043bafe285 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5633,7 +5633,11 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z data_blob_free(&blob); - memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs)); + if (hrs) { + memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs)); + } else { + ZERO_STRUCT(usr->logon_hrs); + } } /******************************************************************* -- cgit From b19d871a1af88d58e41af7b5ac0fd74ba8a43fc7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 9 Mar 2006 22:46:42 +0000 Subject: r14115: Fix coverity bug #23. Don't deref a potentially null ptr. Jeremy. (This used to be commit df32eb70a45150e459997c2ae92c865cd0e083f6) --- source3/rpc_parse/parse_samr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 043bafe285..2f8fe74ed3 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5541,7 +5541,11 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z copy_unistr2(&usr->uni_munged_dial, mung_dial); init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); - memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs)); + if (hrs) { + memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs)); + } else { + ZERO_STRUCT(usr->logon_hrs); + } } /************************************************************************* -- cgit From 2a7601fcb455ab626f6a5f21dfc67637181e13f1 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 10 Mar 2006 09:07:03 +0000 Subject: r14134: Fix Coverity bug # 137 (This used to be commit 62e58d939bf3abf71bb19aade57d406e07403bc8) --- source3/rpc_parse/parse_lsa.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index d4dd251fc5..d285f5d36b 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -567,10 +567,16 @@ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *out, /* allocate container memory */ out->domlist = TALLOC_P( ctx, DOMAIN_LIST ); + + if ( !out->domlist ) { + out->status = NT_STATUS_NO_MEMORY; + return; + } + out->domlist->domains = TALLOC_ARRAY( ctx, DOMAIN_INFO, out->count ); - if ( !out->domlist || !out->domlist->domains ) { + if ( !out->domlist->domains ) { out->status = NT_STATUS_NO_MEMORY; return; } -- cgit From c34e73cfcf29462de597edf9c96435f38635f7f9 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 10 Mar 2006 13:14:01 +0000 Subject: r14146: Just some typos. Guenther (This used to be commit ade86cc787e266850fee982b008a9caf2c8ed7e7) --- source3/rpc_parse/parse_prs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 4683f1dbd0..474e93cc1f 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -607,12 +607,12 @@ BOOL prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8) if (q == NULL) return False; - if (UNMARSHALLING(ps)) + if (UNMARSHALLING(ps)) *data8 = CVAL(q,0); else SCVAL(q,0,*data8); - DEBUG(5,("%s%04x %s: %02x\n", tab_depth(depth), ps->data_offset, name, *data8)); + DEBUG(5,("%s%04x %s: %02x\n", tab_depth(depth), ps->data_offset, name, *data8)); ps->data_offset += 1; -- cgit From e4c733f4ceb17c5a782bf36daf46b8c29a7442dc Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 11 Mar 2006 23:11:24 +0000 Subject: r14219: Fix coverity #135. Don't deref a ptr if it can be NULL. Jeremy. (This used to be commit 666d427c6e10aa4194348e8acc3997682f090b48) --- source3/rpc_parse/parse_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 838006ab58..8f5ca27365 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -908,7 +908,7 @@ void init_unistr4_w( TALLOC_CTX *ctx, UNISTR4 *uni4, const smb_ucs2_t *buf ) void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) { - uint32 len = strlen_w(buf); + uint32 len = buf ? strlen_w(buf) : 0; ZERO_STRUCTP(str); -- cgit From 79af0b91e0851321c28878df92559e41f4cb3651 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 12 Mar 2006 00:08:12 +0000 Subject: r14228: Fix Coverity bug # 217 (This used to be commit 680bd1b004f26b5a0449114911c85ca587038147) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index e4a023ac21..dcd5e35972 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5071,7 +5071,7 @@ BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx, q_u->level = level; q_u->info.level = level; - q_u->info.ptr = (info!=NULL)?1:0; + q_u->info.ptr = 1; /* Info is != NULL, see above */ switch (level) { /* info level 3 is supported by Windows 95/98, WinNT and Win2k */ -- cgit From f5fe12d71c02d81ce4cecfb5552cef74c62f291e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 12 Mar 2006 10:44:19 +0000 Subject: r14232: Fix Coverity Bug # 218 (This used to be commit 932d769a32748695cfff4c761422feb2ef15acbb) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index dcd5e35972..cdf6838974 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3740,7 +3740,7 @@ BOOL make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, q_u->level = level; q_u->info.level = level; - q_u->info.info_ptr = (info != NULL) ? 1 : 0; + q_u->info.info_ptr = 1; /* Info is != NULL, see above */ switch (level) { /* There's no such thing as a setprinter level 1 */ -- cgit From 659eb9b71fe7427a1362e7b922a78dbd395258c2 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 13 Mar 2006 06:44:10 +0000 Subject: r14298: The other half of Coverity # 217 (This used to be commit b9fb3fc0e3708b4721aaa1dcb7756d3774fb8db8) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index cdf6838974..cba716ab5c 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5065,7 +5065,7 @@ BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx, return False; } - q_u->server_name_ptr = (srv_name!=NULL)?1:0; + q_u->server_name_ptr = 1; /* srv_name is != NULL, see above */ init_unistr2(&q_u->server_name, srv_name, UNI_STR_TERMINATE); q_u->level = level; -- cgit From e6676a9a6928deb03c2a43a66c1245dd05d03e71 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 14 Mar 2006 17:21:30 +0000 Subject: r14387: Try and fix the coverity issues (#53, #54) with negative sink by ensuring all uses of rpcstr_push are consistent with a size_t dest size arg. Jeremy. (This used to be commit f65d7afe1977d9d85046732842f9643716c15088) --- source3/rpc_parse/parse_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 8f5ca27365..037764e138 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -597,7 +597,7 @@ void init_rpc_blob_str(RPC_DATA_BLOB *str, const char *buf, int len) /* set up string lengths. */ str->buf_len = create_rpc_blob(str, len*2); - rpcstr_push(str->buffer, buf, str->buf_len, STR_TERMINATE); + rpcstr_push(str->buffer, buf, (size_t)str->buf_len, STR_TERMINATE); } -- cgit From 1839b4be14e905428257eb999def184d73dcf08f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 22 Mar 2006 08:04:13 +0000 Subject: r14634: Many bug fixes thanks to train rides and overnight stays in airports * Finally fix parsing idmap uid/gid ranges not to break with spaces surrounding the '-' * Allow local groups to renamed by adding info level 2 to _samr_set_aliasinfo() * Fix parsing bug in _samr_del_dom_alias() reply * Prevent root from being deleted via Samba * Prevent builting groups from being renamed or deleted * Fix bug in pdb_tdb that broke renaming user accounts * Make sure winbindd is running when trying to create the Administrators and Users BUILTIN groups automatically from smbd (and not just check the winbind nexted groups parameter value). * Have the top level rid allocator verify that the RID it is about to grant is not already assigned in our own SAM (retries up to 250 times). This fixes passdb with existing SIDs assigned to users from the RID algorithm but not monotonically allocating the RIDs from passdb. (This used to be commit db1162241f79c2af8afb7d8c26e8ed1c4a4b476f) --- source3/rpc_parse/parse_samr.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 2f8fe74ed3..2a9daa0e47 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3554,6 +3554,28 @@ BOOL samr_io_alias_info3(const char *desc, ALIAS_INFO3 *al3, 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 ) @@ -3572,6 +3594,10 @@ BOOL samr_alias_info_ctr(const char *desc, prs_struct *ps, int depth, ALIAS_INFO 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; @@ -4474,6 +4500,9 @@ BOOL samr_io_r_delete_dom_alias(const char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u, 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; -- cgit From 6e17934ee614f5f129b69898be7eceb09486a48f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 22 Mar 2006 14:41:07 +0000 Subject: r14643: Merge dcerpc_errstr from Samba 4. Might need to rework prs_dcerpc_status(). Guenther (This used to be commit 38b18f428ba941f4d9a14fa2de45cb0cd793a754) --- source3/rpc_parse/parse_prs.c | 31 +++++++++++++++++++++++++++++++ source3/rpc_parse/parse_rpc.c | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 474e93cc1f..f2b002c48c 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -767,6 +767,37 @@ BOOL prs_ntstatus(const char *name, prs_struct *ps, int depth, NTSTATUS *status) return True; } +/******************************************************************* + Stream a DCE error code + ********************************************************************/ + +BOOL prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *status) +{ + char *q = prs_mem_get(ps, sizeof(uint32)); + if (q == NULL) + return False; + + if (UNMARSHALLING(ps)) { + if (ps->bigendian_data) + *status = NT_STATUS(RIVAL(q,0)); + else + *status = NT_STATUS(IVAL(q,0)); + } else { + if (ps->bigendian_data) + RSIVAL(q,0,NT_STATUS_V(*status)); + else + SIVAL(q,0,NT_STATUS_V(*status)); + } + + DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name, + dcerpc_errstr(NT_STATUS_V(*status)))); + + ps->data_offset += sizeof(uint32); + + return True; +} + + /******************************************************************* Stream a WERROR ********************************************************************/ diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 79dfc05e43..2d166c773b 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -661,7 +661,7 @@ BOOL smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, prs_debug(ps, depth, desc, "smb_io_rpc_hdr_fault"); depth++; - if(!prs_ntstatus("status ", ps, depth, &rpc->status)) + if(!prs_dcerpc_status("status ", ps, depth, &rpc->status)) return False; if(!prs_uint32("reserved", ps, depth, &rpc->reserved)) return False; -- cgit From 20204ab040247d431060b9a53ca6437024d76d6c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 22 Mar 2006 15:00:42 +0000 Subject: r14646: Adding samr querygroup infolevels 2 & 5. Guenther (This used to be commit 6c4fe819c69f281915ad0f4c3bde4dfb194aa33a) --- source3/rpc_parse/parse_samr.c | 67 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 2a9daa0e47..05c75fe98a 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2306,6 +2306,69 @@ BOOL samr_io_group_info4(const char *desc, GROUP_INFO4 * gr4, 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. ********************************************************************/ @@ -2342,6 +2405,10 @@ static BOOL samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr, 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; -- cgit From 621f91c693ba6db628087433c6899bec37c85f0a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 29 Mar 2006 22:56:05 +0000 Subject: r14770: Fix coverity bug #257. Possible null deref. Jeremy. (This used to be commit 4c126ef65dd07352ab936fff774c7435723f5395) --- source3/rpc_parse/parse_misc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 037764e138..8cd6553a03 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -884,6 +884,10 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) void init_unistr4(UNISTR4 *uni4, const char *buf, enum unistr2_term_codes flags) { uni4->string = TALLOC_P( get_talloc_ctx(), UNISTR2 ); + if (!uni4->string) { + smb_panic("init_unistr4: talloc fail\n"); + return; + } init_unistr2( uni4->string, buf, flags ); uni4->length = 2 * (uni4->string->uni_str_len); @@ -893,6 +897,10 @@ void init_unistr4(UNISTR4 *uni4, const char *buf, enum unistr2_term_codes flags) void init_unistr4_w( TALLOC_CTX *ctx, UNISTR4 *uni4, const smb_ucs2_t *buf ) { uni4->string = TALLOC_P( ctx, UNISTR2 ); + if (!uni4->string) { + smb_panic("init_unistr4_w: talloc fail\n"); + return; + } init_unistr2_w( ctx, uni4->string, buf ); uni4->length = 2 * (uni4->string->uni_str_len); @@ -919,7 +927,7 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) str->buffer = TALLOC_ZERO_ARRAY(ctx, uint16, len + 1); if (str->buffer == NULL) { - smb_panic("init_unistr2_w: malloc fail\n"); + smb_panic("init_unistr2_w: talloc fail\n"); return; } -- cgit From b98703ccaa8b5057690dc36f8df8c6f588d83e6c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 29 Mar 2006 22:59:33 +0000 Subject: r14772: Fix coverity bug #258. Seems coverity has discovered talloc :-). Jeremy. (This used to be commit 488b7725168971e6e59f3a2a7476ce82df43579b) --- source3/rpc_parse/parse_shutdown.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_shutdown.c b/source3/rpc_parse/parse_shutdown.c index de850ca4cc..da33807733 100644 --- a/source3/rpc_parse/parse_shutdown.c +++ b/source3/rpc_parse/parse_shutdown.c @@ -32,9 +32,18 @@ void init_shutdown_q_init(SHUTDOWN_Q_INIT *q_s, const char *msg, uint32 timeout, BOOL do_reboot, BOOL force) { q_s->server = TALLOC_P( get_talloc_ctx(), uint16 ); + if (!q_s->server) { + smb_panic("init_shutdown_q_init: talloc fail.\n"); + return; + } + *q_s->server = 0x1; q_s->message = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR4 ); + if (!q_s->message) { + smb_panic("init_shutdown_q_init: talloc fail.\n"); + return; + } if ( msg && *msg ) { init_unistr4( q_s->message, msg, UNI_FLAGS_NONE ); @@ -206,6 +215,11 @@ Inits a structure. void init_shutdown_q_abort(SHUTDOWN_Q_ABORT *q_s) { q_s->server = TALLOC_P( get_talloc_ctx(), uint16 ); + if (!q_s->server) { + smb_panic("init_shutdown_q_abort: talloc fail.\n"); + return; + } + *q_s->server = 0x1; } -- cgit From 4d9ad700604b093cc53f47a9f6c01006888ea2da Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 29 Mar 2006 23:03:34 +0000 Subject: r14774: Fix null deref coverity bugs #260, #261, #262. Jeremy. (This used to be commit 46e575af17cefb0ce7a1fdfacf29f90ae36fa72e) --- source3/rpc_parse/parse_lsa.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index d285f5d36b..b7c0fa3814 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -3001,6 +3001,9 @@ NTSTATUS init_r_enum_acct_rights( LSA_R_ENUM_ACCT_RIGHTS *out, PRIVILEGE_SET *pr if ( num_priv ) { out->rights = TALLOC_P( get_talloc_ctx(), 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; @@ -3069,6 +3072,10 @@ void init_q_add_acct_rights( LSA_Q_ADD_ACCT_RIGHTS *in, POLICY_HND *hnd, init_dom_sid2(&in->sid, sid); in->rights = TALLOC_P( get_talloc_ctx(), 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; @@ -3112,10 +3119,10 @@ BOOL lsa_io_r_add_acct_rights(const char *desc, LSA_R_ADD_ACCT_RIGHTS *out, prs_ 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, @@ -3133,13 +3140,17 @@ void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *in, in->count = count; in->rights = TALLOC_P( get_talloc_ctx(), 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"); -- cgit From f6a1f717197afe8e69c4f5c7bd552540b9d35267 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 29 Mar 2006 23:13:27 +0000 Subject: r14776: Fix coverity #263 - #267. No one was checking talloc returns. Doh ! Jeremy. (This used to be commit 68097e0fbb8f232573a2f7eae3da3a0c9873fbc5) --- source3/rpc_parse/parse_reg.c | 95 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 88 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 295fead103..a226bbb1d7 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -54,6 +54,10 @@ void init_reg_q_open_hive( REG_Q_OPEN_HIVE *q_o, uint32 access_desired ) { q_o->server = TALLOC_P( get_talloc_ctx(), uint16); + if (!q_o->server) { + smb_panic("init_reg_q_open_hive: talloc fail.\n"); + return; + } *q_o->server = 0x1; q_o->access = access_desired; @@ -221,6 +225,10 @@ void init_reg_q_create_key_ex(REG_Q_CREATE_KEY_EX *q_c, POLICY_HND *hnd, q_c->access = access_desired; q_c->sec_info = TALLOC_P( get_talloc_ctx(), uint32 ); + if (!q_c->sec_info) { + smb_panic("init_reg_q_create_key_ex: talloc fail\n"); + return; + } *q_c->sec_info = DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION; q_c->data = sec_buf; @@ -228,6 +236,10 @@ void init_reg_q_create_key_ex(REG_Q_CREATE_KEY_EX *q_c, POLICY_HND *hnd, init_buf_hdr(&q_c->hdr_sec, sec_buf->len, sec_buf->len); q_c->ptr3 = 1; q_c->disposition = TALLOC_P( get_talloc_ctx(), uint32 ); + if (!q_c->disposition) { + smb_panic("init_reg_q_create_key_ex: talloc fail\n"); + return; + } } /******************************************************************* @@ -997,14 +1009,23 @@ BOOL init_reg_r_query_value(uint32 include_keyval, REG_R_QUERY_VALUE *r_u, return False; r_u->type = TALLOC_P( get_talloc_ctx(), uint32 ); + if (!r_u->type) { + return False; + } *r_u->type = val->type; buf_len = reg_init_regval_buffer( &buf2, val ); r_u->buf_max_len = TALLOC_P( get_talloc_ctx(), uint32 ); + if (!r_u->buf_max_len) { + return False; + } *r_u->buf_max_len = buf_len; r_u->buf_len = TALLOC_P( get_talloc_ctx(), uint32 ); + if (!r_u->buf_len) { + return False; + } *r_u->buf_len = buf_len; /* if include_keyval is not set, don't send the key value, just @@ -1012,6 +1033,9 @@ BOOL init_reg_r_query_value(uint32 include_keyval, REG_R_QUERY_VALUE *r_u, if ( include_keyval ) { r_u->value = TALLOC_P( get_talloc_ctx(), REGVAL_BUFFER ); + if (!r_u->value) { + return False; + } /* steal the memory */ *r_u->value = buf2; } @@ -1071,18 +1095,39 @@ void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_u, POLICY_HND *pol, q_u->name.size = max_name_len*2; q_u->name.string = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR2 ); + if (!q_u->name.string) { + smb_panic("init_reg_q_enum_val: talloc fail\n"); + return; + } q_u->name.string->uni_max_len = max_name_len; q_u->type = TALLOC_P( get_talloc_ctx(), uint32 ); + if (!q_u->type) { + smb_panic("init_reg_q_enum_val: talloc fail\n"); + return; + } *q_u->type = 0x0; q_u->value = TALLOC_ZERO_P( get_talloc_ctx(), REGVAL_BUFFER ); + if (!q_u->value) { + smb_panic("init_reg_q_enum_val: talloc fail\n"); + return; + } + q_u->value->buf_max_len = max_buf_len; - q_u->buffer_len = TALLOC_P( get_talloc_ctx(), uint32 ); + q_u->buffer_len = TALLOC_P( get_talloc_ctx(), uint32 ); + if (q_u->buffer_len) { + smb_panic("init_reg_q_enum_val: talloc fail\n"); + return; + } *q_u->buffer_len = max_buf_len; - q_u->name_len = TALLOC_P( get_talloc_ctx(), uint32 ); + q_u->name_len = TALLOC_P( get_talloc_ctx(), uint32 ); + if (!q_u->name_len) { + smb_panic("init_reg_q_enum_val: talloc fail\n"); + return; + } *q_u->name_len = 0x0; } @@ -1105,18 +1150,34 @@ void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) /* type */ r_u->type = TALLOC_P( get_talloc_ctx(), uint32 ); + if (!r_u->type) { + smb_panic("init_reg_r_enum_val: talloc fail\n"); + return; + } *r_u->type = val->type; /* REG_SZ & REG_MULTI_SZ must be converted to UNICODE */ r_u->value = TALLOC_P( get_talloc_ctx(), REGVAL_BUFFER ); + if (!r_u->value) { + smb_panic("init_reg_r_enum_val: talloc fail\n"); + return; + } real_size = reg_init_regval_buffer( r_u->value, val ); /* lengths */ - r_u->buffer_len1 = TALLOC_P( get_talloc_ctx(), uint32 ); + r_u->buffer_len1 = TALLOC_P( get_talloc_ctx(), uint32 ); + if (!r_u->buffer_len1) { + smb_panic("init_reg_r_enum_val: talloc fail\n"); + return; + } *r_u->buffer_len1 = real_size; - r_u->buffer_len2 = TALLOC_P( get_talloc_ctx(), uint32 ); + r_u->buffer_len2 = TALLOC_P( get_talloc_ctx(), uint32 ); + if (!r_u->buffer_len2) { + smb_panic("init_reg_r_enum_val: talloc fail\n"); + return; + } *r_u->buffer_len2 = real_size; } @@ -1312,7 +1373,15 @@ void init_reg_r_enum_key(REG_R_ENUM_KEY *r_u, char *subkey ) init_unistr4( &r_u->keyname, subkey, UNI_STR_TERMINATE ); r_u->classname = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR4 ); - r_u->time = TALLOC_ZERO_P( get_talloc_ctx(), NTTIME ); + if (!r_u->classname) { + smb_panic("init_reg_r_enum_key: talloc fail\n"); + return; + } + r_u->time = TALLOC_ZERO_P( get_talloc_ctx(), NTTIME ); + if (!r_u->time) { + smb_panic("init_reg_r_enum_key: talloc fail\n"); + return; + } } /******************************************************************* @@ -1482,9 +1551,17 @@ void init_reg_q_shutdown(REG_Q_SHUTDOWN *q_u, const char *msg, uint32 timeout, BOOL do_reboot, BOOL force) { q_u->server = TALLOC_P( get_talloc_ctx(), uint16 ); + if (!q_u->server) { + smb_panic("init_reg_q_shutdown: talloc fail\n"); + return; + } *q_u->server = 0x1; q_u->message = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR4 ); + if (!q_u->message) { + smb_panic("init_reg_q_shutdown: talloc fail\n"); + return; + } if ( msg && *msg ) { init_unistr4( q_u->message, msg, UNI_FLAGS_NONE ); @@ -1652,20 +1729,24 @@ BOOL reg_io_r_shutdown_ex(const char *desc, REG_R_SHUTDOWN_EX *r_u, prs_struct * return True; } - - /******************************************************************* Inits a structure. ********************************************************************/ + void init_reg_q_abort_shutdown(REG_Q_ABORT_SHUTDOWN *q_u) { q_u->server = TALLOC_P( get_talloc_ctx(), uint16 ); + if (!q_u->server) { + smb_panic("init_reg_q_abort_shutdown: talloc fail\n"); + return; + } *q_u->server = 0x1; } /******************************************************************* reads or writes a structure. ********************************************************************/ + BOOL reg_io_q_abort_shutdown(const char *desc, REG_Q_ABORT_SHUTDOWN *q_u, prs_struct *ps, int depth) { -- cgit From ba49732bcf613d284646e021ddca3599ad1e7edf Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 29 Mar 2006 23:18:58 +0000 Subject: r14778: Fix coverity null deref bugs #268 - #271. Jeremy. (This used to be commit 0a1ccfefcf27c5970b82bf8a451bcdaa4fee1bd0) --- source3/rpc_parse/parse_spoolss.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index cba716ab5c..ec2d6b8430 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -899,6 +899,9 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, DEBUG(5,("make_spoolss_q_open_printer_ex\n")); q_u->printername = TALLOC_P( get_talloc_ctx(), UNISTR2 ); + if (!q_u->printername) { + return False; + } init_unistr2(q_u->printername, printername, UNI_STR_TERMINATE); q_u->printer_default.datatype_ptr = 0; @@ -912,6 +915,9 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, q_u->user_ctr.level = 1; q_u->user_ctr.user.user1 = TALLOC_P( get_talloc_ctx(), SPOOL_USER_1 ); + if (!q_u->user_ctr.user.user1) { + return False; + } q_u->user_ctr.user.user1->size = strlen(clientname) + strlen(user_name) + 10; q_u->user_ctr.user.user1->build = 1381; q_u->user_ctr.user.user1->major = 2; @@ -919,7 +925,13 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, q_u->user_ctr.user.user1->processor = 0; q_u->user_ctr.user.user1->client_name = TALLOC_P( get_talloc_ctx(), UNISTR2 ); + if (!q_u->user_ctr.user.user1->client_name) { + return False; + } q_u->user_ctr.user.user1->user_name = TALLOC_P( get_talloc_ctx(), UNISTR2 ); + if (!q_u->user_ctr.user.user1->user_name) { + return False; + } init_unistr2(q_u->user_ctr.user.user1->client_name, clientname, UNI_STR_TERMINATE); init_unistr2(q_u->user_ctr.user.user1->user_name, user_name, UNI_STR_TERMINATE); @@ -943,6 +955,9 @@ BOOL make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u ZERO_STRUCTP(q_u); q_u->server_name = TALLOC_P( mem_ctx, UNISTR2 ); + if (!q_u->server_name) { + return False; + } init_unistr2(q_u->server_name, srv_name, UNI_FLAGS_NONE); q_u->level = level; @@ -965,14 +980,22 @@ BOOL make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u q_u->user_ctr.level = 1; q_u->user_ctr.user.user1 = TALLOC_P( get_talloc_ctx(), SPOOL_USER_1 ); + if (!q_u->user_ctr.user.user1) { + return False; + } q_u->user_ctr.user.user1->build = 1381; q_u->user_ctr.user.user1->major = 2; q_u->user_ctr.user.user1->minor = 0; q_u->user_ctr.user.user1->processor = 0; q_u->user_ctr.user.user1->client_name = TALLOC_P( mem_ctx, UNISTR2 ); + if (!q_u->user_ctr.user.user1->client_name) { + return False; + } q_u->user_ctr.user.user1->user_name = TALLOC_P( mem_ctx, UNISTR2 ); - + if (!q_u->user_ctr.user.user1->user_name) { + return False; + } init_unistr2(q_u->user_ctr.user.user1->client_name, clientname, UNI_STR_TERMINATE); init_unistr2(q_u->user_ctr.user.user1->user_name, user_name, UNI_STR_TERMINATE); -- cgit From 15ebf2cd2908415491c2710caa2ee7f3e0ef47ef Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 31 Mar 2006 00:44:24 +0000 Subject: r14829: Fix reversed test in coverity fixes. Jeremy. (This used to be commit f1b4e870a52cbd7bb780b206e943987648523060) --- source3/rpc_parse/parse_reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index a226bbb1d7..fef1332e5c 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -1117,7 +1117,7 @@ void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_u, POLICY_HND *pol, q_u->value->buf_max_len = max_buf_len; q_u->buffer_len = TALLOC_P( get_talloc_ctx(), uint32 ); - if (q_u->buffer_len) { + if (!q_u->buffer_len) { smb_panic("init_reg_q_enum_val: talloc fail\n"); return; } -- cgit From 655b04e4f8585a952afe226e602995ebbc7d1600 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 11 Apr 2006 15:47:24 +0000 Subject: r15041: Adding rpc client calls to manipulate auditing policies on remote CIFS servers. Also add a new "net rpc audit" tool. The lsa query infolevels were taken from samb4 IDL, the lsa policy flags and categories are partly documented on msdn. I need to cleanup the double lsa_query_info_policy{2}{_new} calls next. Guenther (This used to be commit 0fed66926f4b72444abfc8ffb8c46cca8d0600aa) --- source3/rpc_parse/parse_lsa.c | 434 ++++++++++++++++++++++++++++++------------ 1 file changed, 317 insertions(+), 117 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index b7c0fa3814..ffc0f04332 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -673,16 +673,90 @@ BOOL lsa_io_r_enum_trust_dom(const char *desc, LSA_R_ENUM_TRUST_DOM *out, 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)) { + d_q->auditsettings = TALLOC_ZERO_ARRAY(ps->mem_ctx, uint32, d_q->count2); + } + + 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(const char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth) +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"); + prs_debug(ps, depth, desc, "lsa_io_dom_query_3"); depth++; if(!prs_align(ps)) @@ -715,79 +789,235 @@ static BOOL lsa_io_dom_query(const char *desc, DOM_QUERY *d_q, prs_struct *ps, i } /******************************************************************* -reads or writes a structure. + Reads or writes a dom query structure. ********************************************************************/ -static BOOL lsa_io_dom_query_2(const char *desc, DOM_QUERY_2 *d_q, prs_struct *ps, int depth) +static BOOL lsa_io_dom_query_5(const char *desc, DOM_QUERY_5 *d_q, prs_struct *ps, int depth) { - uint32 ptr = 1; + 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_2"); + prs_debug(ps, depth, desc, "lsa_io_dom_query_6"); depth++; - if (!prs_align(ps)) + if (!prs_uint16("server_role", ps, depth, &d_q->server_role)) return False; - if (!prs_uint32("auditing_enabled", ps, depth, &d_q->auditing_enabled)) - return False; - if (!prs_uint32("ptr ", ps, depth, &ptr)) - return False; - if (!prs_uint32("count1", ps, depth, &d_q->count1)) + 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; - if (!prs_uint32("count2", ps, depth, &d_q->count2)) + + 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; - if (UNMARSHALLING(ps)) { - d_q->auditsettings = TALLOC_ZERO_ARRAY(ps->mem_ctx, uint32, d_q->count2); - } + return True; +} + +/******************************************************************* + Reads or writes a dom query structure. +********************************************************************/ - if (d_q->auditsettings == NULL) { - DEBUG(1, ("lsa_io_dom_query_2: NULL auditsettings!\n")); +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; - } - if (!prs_uint32s(False, "auditsettings", ps, depth, d_q->auditsettings, d_q->count2)) + 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; + return True; } /******************************************************************* - Reads or writes a dom query structure. + Reads or writes an LSA_DNS_DOM_INFO structure. ********************************************************************/ -static BOOL lsa_io_dom_query_3(const char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth) +BOOL lsa_io_dom_query_12(const char *desc, DOM_QUERY_12 *info, prs_struct *ps, int depth) { - return lsa_io_dom_query("", d_q, ps, 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 dom query structure. + Inits an LSA_Q_QUERY_INFO structure. ********************************************************************/ -static BOOL lsa_io_dom_query_5(const char *desc, DOM_QUERY_5 *d_q, prs_struct *ps, int depth) +void init_q_set(LSA_Q_SET_INFO *in, POLICY_HND *hnd, uint16 info_class, LSA_INFO_CTR ctr) { - return lsa_io_dom_query("", d_q, ps, depth); + DEBUG(5,("init_q_set\n")); + + in->info_class = info_class; + + in->pol = *hnd; + + in->ctr = ctr; + in->ctr.info_class = info_class; } /******************************************************************* - Reads or writes a dom query structure. +reads or writes a structure. ********************************************************************/ -static BOOL lsa_io_dom_query_6(const char *desc, DOM_QUERY_6 *d_q, prs_struct *ps, int depth) +static BOOL lsa_io_query_info_ctr2(const char *desc, prs_struct *ps, int depth, LSA_INFO_CTR2 *ctr) { - if (d_q == NULL) + prs_debug(ps, depth, desc, "lsa_io_query_info_ctr2"); + depth++; + + if(!prs_uint16("info_class", ps, depth, &ctr->info_class)) return False; - prs_debug(ps, depth, desc, "lsa_io_dom_query_6"); + 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("server_role", ps, depth, &d_q->server_role)) + 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; + default: + DEBUG(0,("invalid info_class: %d\n", ctr->info_class)); + return False; + break; + } + return True; } @@ -797,40 +1027,20 @@ static BOOL lsa_io_dom_query_6(const char *desc, DOM_QUERY_6 *d_q, prs_struct *p 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_uint32("undoc_buffer", ps, depth, &out->undoc_buffer)) + if(!prs_align(ps)) return False; - if (out->undoc_buffer != 0) { - if(!prs_uint16("info_class", ps, depth, &out->info_class)) - return False; + if(!prs_uint32("dom_ptr", ps, depth, &out->dom_ptr)) + return False; - if(!prs_align(ps)) - return False; + if (out->dom_ptr) { - switch (out->info_class) { - case 2: - if(!lsa_io_dom_query_2("", &out->dom.id2, ps, depth)) - return False; - break; - case 3: - if(!lsa_io_dom_query_3("", &out->dom.id3, ps, depth)) - return False; - break; - case 5: - if(!lsa_io_dom_query_5("", &out->dom.id5, ps, depth)) - return False; - break; - case 6: - if(!lsa_io_dom_query_6("", &out->dom.id6, ps, depth)) - return False; - break; - default: - /* PANIC! */ - break; - } + if(!lsa_io_query_info_ctr("", ps, depth, &out->ctr)) + return False; } if(!prs_align(ps)) @@ -842,6 +1052,49 @@ BOOL lsa_io_r_query(const char *desc, LSA_R_QUERY_INFO *out, prs_struct *ps, int return True; } +/******************************************************************* + Reads or writes an LSA_Q_SET_INFO structure. +********************************************************************/ + +BOOL lsa_io_q_set(const char *desc, LSA_Q_SET_INFO *in, prs_struct *ps, + int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_q_set"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_pol_hnd("", &in->pol, ps, depth)) + return False; + + if(!prs_uint16("info_class", ps, depth, &in->info_class)) + return False; + + if(!lsa_io_query_info_ctr("", ps, depth, &in->ctr)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes an LSA_R_SET_INFO structure. +********************************************************************/ + +BOOL lsa_io_r_set(const char *desc, LSA_R_SET_INFO *out, prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "lsa_io_r_set"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_ntstatus("status", ps, depth, &out->status)) + return False; + + return True; +} + /******************************************************************* Inits a LSA_SID_ENUM structure. ********************************************************************/ @@ -2851,52 +3104,6 @@ BOOL policy_handle_is_valid(const POLICY_HND *hnd) return ((memcmp(&zero_pol, hnd, sizeof(POLICY_HND)) == 0) ? False : True ); } -/******************************************************************* - Reads or writes an LSA_DNS_DOM_INFO structure. -********************************************************************/ - -BOOL lsa_io_dns_dom_info(const char *desc, LSA_DNS_DOM_INFO *info, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_dns_dom_info"); - 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; - -} - /******************************************************************* Inits an LSA_Q_QUERY_INFO2 structure. ********************************************************************/ @@ -2944,20 +3151,13 @@ BOOL lsa_io_r_query_info2(const char *desc, LSA_R_QUERY_INFO2 *out, if(!prs_align(ps)) return False; - if(!prs_uint32("ptr", ps, depth, &out->ptr)) + if(!prs_uint32("dom_ptr", ps, depth, &out->dom_ptr)) return False; - if(!prs_uint16("info_class", ps, depth, &out->info_class)) - return False; - switch(out->info_class) { - case 0x000c: - if (!lsa_io_dns_dom_info("info12", &out->info.dns_dom_info, - ps, depth)) + + if (out->dom_ptr) { + + if(!lsa_io_query_info_ctr2("", ps, depth, &out->ctr)) return False; - break; - default: - DEBUG(0,("lsa_io_r_query_info2: unknown info class %d\n", - out->info_class)); - return False; } if(!prs_align(ps)) -- cgit From 52e778e6f85c5affbcc40e5ce629792e6f16b553 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 4 May 2006 17:28:05 +0000 Subject: r15438: Fix samrQueryDomainInfo level 5 where we returned our netbios name eversince instead of the domain name when we are a DC. Yes, there are applications relying on this call to be correct. Guenther (This used to be commit 26dd22c9af8caf3db236984e4683ba210376ca59) --- source3/rpc_parse/parse_samr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 05c75fe98a..c425b945b4 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -662,10 +662,10 @@ static BOOL sam_io_unk_info12(const char *desc, SAM_UNK_INFO_12 * u_12, inits a structure. ********************************************************************/ -void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *server) +void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *domain) { - init_unistr2(&u_5->uni_server, server, UNI_FLAGS_NONE); - init_uni_hdr(&u_5->hdr_server, &u_5->uni_server); + init_unistr2(&u_5->uni_domain, domain, UNI_FLAGS_NONE); + init_uni_hdr(&u_5->hdr_domain, &u_5->uni_domain); } /******************************************************************* @@ -681,10 +681,10 @@ static BOOL sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5, prs_debug(ps, depth, desc, "sam_io_unk_info5"); depth++; - if(!smb_io_unihdr("hdr_server", &u_5->hdr_server, ps, depth)) + if(!smb_io_unihdr("hdr_domain", &u_5->hdr_domain, ps, depth)) return False; - if(!smb_io_unistr2("uni_server", &u_5->uni_server, u_5->hdr_server.buffer, ps, depth)) + if(!smb_io_unistr2("uni_domain", &u_5->uni_domain, u_5->hdr_domain.buffer, ps, depth)) return False; return True; -- cgit From 46c35b17a32d479f5780ca6a24e4e9c3b9cc2403 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 4 May 2006 17:47:04 +0000 Subject: r15441: cleanup older unused padding. Guenther (This used to be commit 6e225e0528604c797a953eb8d3b49a873b21584f) --- source3/rpc_parse/parse_samr.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index c425b945b4..287e79f1b4 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -712,8 +712,6 @@ void init_unk_info2(SAM_UNK_INFO_2 * u_2, u_2->num_domain_grps = num_groups; u_2->num_local_grps = num_alias; - memset(u_2->padding, 0, sizeof(u_2->padding)); /* 12 bytes zeros */ - 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); -- cgit From 0fe21ac5609940be815148a2f73e1e456b7c3cce Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 4 May 2006 19:01:11 +0000 Subject: r15442: Add some more client rpc for the querydominfo calls (from samba4 idl). Also return the hostname for the level 6 call (to be consistent with the server name in level 2). Guenther (This used to be commit 41b72e77ae70c96de4659af6b4b6bd842dd67981) --- source3/rpc_parse/parse_samr.c | 125 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 118 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 287e79f1b4..370e29ccad 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -529,11 +529,10 @@ static BOOL sam_io_unk_info3(const char *desc, SAM_UNK_INFO_3 * u_3, inits a structure. ********************************************************************/ -void init_unk_info6(SAM_UNK_INFO_6 * u_6) +void init_unk_info6(SAM_UNK_INFO_6 * u_6, const char *server) { - u_6->unknown_0 = 0x00000000; - u_6->ptr_0 = 1; - memset(u_6->padding, 0, sizeof(u_6->padding)); /* 12 bytes zeros */ + init_unistr2(&u_6->uni_server, server, UNI_FLAGS_NONE); + init_uni_hdr(&u_6->hdr_server, &u_6->uni_server); } /******************************************************************* @@ -549,11 +548,42 @@ static BOOL sam_io_unk_info6(const char *desc, SAM_UNK_INFO_6 * u_6, prs_debug(ps, depth, desc, "sam_io_unk_info6"); depth++; - if(!prs_uint32("unknown_0", ps, depth, &u_6->unknown_0)) /* 0x0000 0000 */ + if(!smb_io_unihdr("hdr_server", &u_6->hdr_server, ps, depth)) return False; - if(!prs_uint32("ptr_0", ps, depth, &u_6->ptr_0)) /* pointer to unknown structure */ + + 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_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(!prs_uint8s(False, "padding", ps, depth, u_6->padding, sizeof(u_6->padding))) /* 12 bytes zeros */ + + if(!smb_io_unistr2("uni_comment", &u_4->uni_comment, u_4->hdr_comment.buffer, ps, depth)) return False; return True; @@ -620,6 +650,33 @@ static BOOL sam_io_unk_info8(const char *desc, SAM_UNK_INFO_8 * u_8, 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. @@ -694,6 +751,48 @@ static BOOL sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5, 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.low = seq_num; + u_13->seq_num.high = 0x0000; + 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 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) @@ -867,10 +966,18 @@ BOOL samr_io_r_query_dom_info(const char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, 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; @@ -887,6 +994,10 @@ BOOL samr_io_r_query_dom_info(const char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, 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; -- cgit From b857785c0e5ecb3486ba173d42124f6098e91e2a Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 4 May 2006 19:20:56 +0000 Subject: r15443: Purely cosmetic reformat, no functional changes. Guenther (This used to be commit ef40428d935831bdb19111c933d20e381647f6f8) --- source3/rpc_parse/parse_samr.c | 349 +++++++++++++++++++++-------------------- 1 file changed, 175 insertions(+), 174 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 370e29ccad..3d74cf7853 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -495,31 +495,53 @@ BOOL samr_io_q_query_dom_info(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO * q_u, return True; } - /******************************************************************* inits a structure. ********************************************************************/ -void init_unk_info3(SAM_UNK_INFO_3 *u_3, NTTIME nt_logout) +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_3->logout.low = nt_logout.low; - u_3->logout.high = nt_logout.high; + 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.high = nt_expire.high; + u_1->expire.low = nt_expire.low; + + /* can change the password now */ + u_1->min_passwordage.high = nt_min_age.high; + u_1->min_passwordage.low = nt_min_age.low; + } /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info3(const char *desc, SAM_UNK_INFO_3 * u_3, +static BOOL sam_io_unk_info1(const char *desc, SAM_UNK_INFO_1 * u_1, prs_struct *ps, int depth) { - if (u_3 == NULL) - return False; + if (u_1 == NULL) + return False; - prs_debug(ps, depth, desc, "sam_io_unk_info3"); + prs_debug(ps, depth, desc, "sam_io_unk_info1"); depth++; - if(!smb_io_time("logout", &u_3->logout, ps, 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; @@ -529,29 +551,79 @@ static BOOL sam_io_unk_info3(const char *desc, SAM_UNK_INFO_3 * u_3, inits a structure. ********************************************************************/ -void init_unk_info6(SAM_UNK_INFO_6 * u_6, const char *server) +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) { - init_unistr2(&u_6->uni_server, server, UNI_FLAGS_NONE); - init_uni_hdr(&u_6->hdr_server, &u_6->uni_server); + u_2->logout.low = nt_logout.low; + u_2->logout.high = nt_logout.high; + + u_2->seq_num.low = seq_num; + u_2->seq_num.high = 0x00000000; + + + 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_info6(const char *desc, SAM_UNK_INFO_6 * u_6, +static BOOL sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2, prs_struct *ps, int depth) { - if (u_6 == NULL) + if (u_2 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info6"); + prs_debug(ps, depth, desc, "sam_io_unk_info2"); depth++; - if(!smb_io_unihdr("hdr_server", &u_6->hdr_server, ps, 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; - if(!smb_io_unistr2("uni_server", &u_6->uni_server, u_6->hdr_server.buffer, ps, depth)) + /* 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; @@ -561,29 +633,26 @@ static BOOL sam_io_unk_info6(const char *desc, SAM_UNK_INFO_6 * u_6, inits a structure. ********************************************************************/ -void init_unk_info4(SAM_UNK_INFO_4 * u_4,const char *comment) +void init_unk_info3(SAM_UNK_INFO_3 *u_3, NTTIME nt_logout) { - init_unistr2(&u_4->uni_comment, comment, UNI_FLAGS_NONE); - init_uni_hdr(&u_4->hdr_comment, &u_4->uni_comment); + u_3->logout.low = nt_logout.low; + u_3->logout.high = nt_logout.high; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info4(const char *desc, SAM_UNK_INFO_4 * u_4, +static BOOL sam_io_unk_info3(const char *desc, SAM_UNK_INFO_3 * u_3, prs_struct *ps, int depth) { - if (u_4 == NULL) + if (u_3 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info4"); + prs_debug(ps, depth, desc, "sam_io_unk_info3"); 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)) + if(!smb_io_time("logout", &u_3->logout, ps, depth)) return False; return True; @@ -593,25 +662,29 @@ static BOOL sam_io_unk_info4(const char *desc, SAM_UNK_INFO_4 * u_4, inits a structure. ********************************************************************/ -void init_unk_info7(SAM_UNK_INFO_7 * u_7, uint32 server_role) +void init_unk_info4(SAM_UNK_INFO_4 * u_4,const char *comment) { - u_7->server_role = server_role; + 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_info7(const char *desc, SAM_UNK_INFO_7 * u_7, +static BOOL sam_io_unk_info4(const char *desc, SAM_UNK_INFO_4 * u_4, prs_struct *ps, int depth) { - if (u_7 == NULL) + if (u_4 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info7"); + prs_debug(ps, depth, desc, "sam_io_unk_info4"); depth++; - if(!prs_uint16("server_role", ps, depth, &u_7->server_role)) + 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; @@ -621,30 +694,29 @@ static BOOL sam_io_unk_info7(const char *desc, SAM_UNK_INFO_7 * u_7, inits a structure. ********************************************************************/ -void init_unk_info8(SAM_UNK_INFO_8 * u_8, uint32 seq_num) +void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *domain) { - unix_to_nt_time(&u_8->domain_create_time, 0); - u_8->seq_num.low = seq_num; - u_8->seq_num.high = 0x0000; + 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_info8(const char *desc, SAM_UNK_INFO_8 * u_8, +static BOOL sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5, prs_struct *ps, int depth) { - if (u_8 == NULL) + if (u_5 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info8"); + prs_debug(ps, depth, desc, "sam_io_unk_info5"); depth++; - if (!prs_uint64("seq_num", ps, depth, &u_8->seq_num)) + if(!smb_io_unihdr("hdr_domain", &u_5->hdr_domain, ps, depth)) return False; - if(!smb_io_time("domain_create_time", &u_8->domain_create_time, ps, depth)) + if(!smb_io_unistr2("uni_domain", &u_5->uni_domain, u_5->hdr_domain.buffer, ps, depth)) return False; return True; @@ -654,25 +726,29 @@ static BOOL sam_io_unk_info8(const char *desc, SAM_UNK_INFO_8 * u_8, inits a structure. ********************************************************************/ -void init_unk_info9(SAM_UNK_INFO_9 * u_9, uint32 unknown) +void init_unk_info6(SAM_UNK_INFO_6 * u_6, const char *server) { - u_9->unknown = unknown; + 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_info9(const char *desc, SAM_UNK_INFO_9 * u_9, +static BOOL sam_io_unk_info6(const char *desc, SAM_UNK_INFO_6 * u_6, prs_struct *ps, int depth) { - if (u_9 == NULL) + if (u_6 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info9"); + prs_debug(ps, depth, desc, "sam_io_unk_info6"); depth++; - if (!prs_uint32("unknown", ps, depth, &u_9->unknown)) + 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; @@ -682,34 +758,25 @@ static BOOL sam_io_unk_info9(const char *desc, SAM_UNK_INFO_9 * u_9, inits a structure. ********************************************************************/ -void init_unk_info12(SAM_UNK_INFO_12 * u_12, NTTIME nt_lock_duration, NTTIME nt_reset_time, uint16 lockout) +void init_unk_info7(SAM_UNK_INFO_7 * u_7, uint32 server_role) { - u_12->duration.low = nt_lock_duration.low; - u_12->duration.high = nt_lock_duration.high; - u_12->reset_count.low = nt_reset_time.low; - u_12->reset_count.high = nt_reset_time.high; - - u_12->bad_attempt_lockout = lockout; + u_7->server_role = server_role; } /******************************************************************* 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) +static BOOL sam_io_unk_info7(const char *desc, SAM_UNK_INFO_7 * u_7, + prs_struct *ps, int depth) { - if (u_12 == NULL) + if (u_7 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info12"); + prs_debug(ps, depth, desc, "sam_io_unk_info7"); 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)) + if(!prs_uint16("server_role", ps, depth, &u_7->server_role)) return False; return True; @@ -719,29 +786,30 @@ static BOOL sam_io_unk_info12(const char *desc, SAM_UNK_INFO_12 * u_12, inits a structure. ********************************************************************/ -void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *domain) +void init_unk_info8(SAM_UNK_INFO_8 * u_8, uint32 seq_num) { - init_unistr2(&u_5->uni_domain, domain, UNI_FLAGS_NONE); - init_uni_hdr(&u_5->hdr_domain, &u_5->uni_domain); + unix_to_nt_time(&u_8->domain_create_time, 0); + u_8->seq_num.low = seq_num; + u_8->seq_num.high = 0x0000; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5, +static BOOL sam_io_unk_info8(const char *desc, SAM_UNK_INFO_8 * u_8, prs_struct *ps, int depth) { - if (u_5 == NULL) + if (u_8 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info5"); + prs_debug(ps, depth, desc, "sam_io_unk_info8"); depth++; - if(!smb_io_unihdr("hdr_domain", &u_5->hdr_domain, ps, depth)) + if (!prs_uint64("seq_num", ps, depth, &u_8->seq_num)) return False; - if(!smb_io_unistr2("uni_domain", &u_5->uni_domain, u_5->hdr_domain.buffer, ps, depth)) + if(!smb_io_time("domain_create_time", &u_8->domain_create_time, ps, depth)) return False; return True; @@ -751,41 +819,27 @@ static BOOL sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5, inits a structure. ********************************************************************/ -void init_unk_info13(SAM_UNK_INFO_13 * u_13, uint32 seq_num) +void init_unk_info9(SAM_UNK_INFO_9 * u_9, uint32 unknown) { - unix_to_nt_time(&u_13->domain_create_time, 0); - u_13->seq_num.low = seq_num; - u_13->seq_num.high = 0x0000; - u_13->unknown1 = 0; - u_13->unknown2 = 0; + u_9->unknown = unknown; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info13(const char *desc, SAM_UNK_INFO_13 * u_13, +static BOOL sam_io_unk_info9(const char *desc, SAM_UNK_INFO_9 * u_9, prs_struct *ps, int depth) { - if (u_13 == NULL) + if (u_9 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info13"); + prs_debug(ps, depth, desc, "sam_io_unk_info9"); 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)) + if (!prs_uint32("unknown", ps, depth, &u_9->unknown)) return False; - - return True; } @@ -793,79 +847,34 @@ static BOOL sam_io_unk_info13(const char *desc, SAM_UNK_INFO_13 * u_13, 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) +void init_unk_info12(SAM_UNK_INFO_12 * u_12, NTTIME nt_lock_duration, NTTIME nt_reset_time, uint16 lockout) { - u_2->logout.low = nt_logout.low; - u_2->logout.high = nt_logout.high; - - u_2->seq_num.low = seq_num; - u_2->seq_num.high = 0x00000000; - - - 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; + u_12->duration.low = nt_lock_duration.low; + u_12->duration.high = nt_lock_duration.high; + u_12->reset_count.low = nt_reset_time.low; + u_12->reset_count.high = nt_reset_time.high; - 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); + u_12->bad_attempt_lockout = lockout; } /******************************************************************* 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) +static BOOL sam_io_unk_info12(const char *desc, SAM_UNK_INFO_12 * u_12, + prs_struct *ps, int depth) { - if (u_2 == NULL) + if (u_12 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info2"); + prs_debug(ps, depth, desc, "sam_io_unk_info12"); 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)) + if(!smb_io_time("duration", &u_12->duration, ps, depth)) return False; - if(!smb_io_unistr2("uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth)) + if(!smb_io_time("reset_count", &u_12->reset_count, ps, depth)) return False; - if(!smb_io_unistr2("uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth)) + if(!prs_uint16("bad_attempt_lockout", ps, depth, &u_12->bad_attempt_lockout)) return False; return True; @@ -875,45 +884,37 @@ static BOOL sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2, 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) +void init_unk_info13(SAM_UNK_INFO_13 * u_13, uint32 seq_num) { - u_1->min_length_password = min_pass_len; - u_1->password_history = pass_hist; - u_1->password_properties = password_properties; - - /* password never expire */ - u_1->expire.high = nt_expire.high; - u_1->expire.low = nt_expire.low; - - /* can change the password now */ - u_1->min_passwordage.high = nt_min_age.high; - u_1->min_passwordage.low = nt_min_age.low; - + unix_to_nt_time(&u_13->domain_create_time, 0); + u_13->seq_num.low = seq_num; + u_13->seq_num.high = 0x0000; + u_13->unknown1 = 0; + u_13->unknown2 = 0; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info1(const char *desc, SAM_UNK_INFO_1 * u_1, +static BOOL sam_io_unk_info13(const char *desc, SAM_UNK_INFO_13 * u_13, prs_struct *ps, int depth) { - if (u_1 == NULL) - return False; + if (u_13 == NULL) + return False; - prs_debug(ps, depth, desc, "sam_io_unk_info1"); + prs_debug(ps, depth, desc, "sam_io_unk_info13"); 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)) + if (!prs_uint64("seq_num", ps, depth, &u_13->seq_num)) return False; - if(!prs_uint32("password_properties", ps, depth, &u_1->password_properties)) + + if(!smb_io_time("domain_create_time", &u_13->domain_create_time, ps, depth)) return False; - if(!smb_io_time("expire", &u_1->expire, ps, depth)) + + if (!prs_uint32("unknown1", ps, depth, &u_13->unknown1)) return False; - if(!smb_io_time("min_passwordage", &u_1->min_passwordage, ps, depth)) + if (!prs_uint32("unknown2", ps, depth, &u_13->unknown2)) return False; return True; -- cgit From c5e28047622aba53c8d009df77ce4d230d4d6637 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 5 May 2006 08:04:28 +0000 Subject: r15452: Again purely cosmetic reformat of the samr query domain info calls. Guenther (This used to be commit 6ed7d7fa70e3f750f921192c0f75594d608875b7) --- source3/rpc_parse/parse_samr.c | 44 +++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 3d74cf7853..620aad7c7a 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -461,10 +461,10 @@ BOOL samr_io_q_query_sec_obj(const char *desc, SAMR_Q_QUERY_SEC_OBJ * q_u, reads or writes a structure. ********************************************************************/ -void init_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO * q_u, - POLICY_HND *domain_pol, uint16 switch_value) +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_dom_info\n")); + DEBUG(5, ("samr_init_samr_q_query_domain_info\n")); q_u->domain_pol = *domain_pol; q_u->switch_value = switch_value; @@ -474,13 +474,13 @@ void init_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_dom_info(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO * q_u, - prs_struct *ps, int depth) +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_dom_info"); + prs_debug(ps, depth, desc, "samr_io_q_query_domain_info"); depth++; if(!prs_align(ps)) @@ -924,11 +924,11 @@ static BOOL sam_io_unk_info13(const char *desc, SAM_UNK_INFO_13 * u_13, inits a SAMR_R_QUERY_DOMAIN_INFO structure. ********************************************************************/ -void init_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO * r_u, - uint16 switch_value, SAM_UNK_CTR * ctr, - NTSTATUS status) +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_dom_info\n")); + DEBUG(5, ("init_samr_r_query_domain_info\n")); r_u->ptr_0 = 0; r_u->switch_value = 0; @@ -945,13 +945,13 @@ void init_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_dom_info(const char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, - prs_struct *ps, int depth) +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_dom_info"); + prs_debug(ps, depth, desc, "samr_io_r_query_domain_info"); depth++; if(!prs_align(ps)) @@ -1012,7 +1012,7 @@ BOOL samr_io_r_query_dom_info(const char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, return False; break; default: - DEBUG(0, ("samr_io_r_query_dom_info: unknown switch level 0x%x\n", + 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; @@ -7769,11 +7769,11 @@ BOOL samr_io_q_query_domain_info2(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO2 *q inits a SAMR_R_QUERY_DOMAIN_INFO structure. ********************************************************************/ -void init_samr_r_samr_query_domain_info2(SAMR_R_QUERY_DOMAIN_INFO2 * r_u, - uint16 switch_value, SAM_UNK_CTR * ctr, - NTSTATUS status) +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_samr_query_domain_info2\n")); + DEBUG(5, ("init_samr_r_query_domain_info2\n")); r_u->ptr_0 = 0; r_u->switch_value = 0; @@ -7790,13 +7790,13 @@ void init_samr_r_samr_query_domain_info2(SAMR_R_QUERY_DOMAIN_INFO2 * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_samr_query_domain_info2(const char *desc, SAMR_R_QUERY_DOMAIN_INFO2 * r_u, - prs_struct *ps, int depth) +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_samr_query_domain_info2"); + prs_debug(ps, depth, desc, "samr_io_r_query_domain_info2"); depth++; if(!prs_align(ps)) @@ -7841,7 +7841,7 @@ BOOL samr_io_r_samr_query_domain_info2(const char *desc, SAMR_R_QUERY_DOMAIN_INF return False; break; default: - DEBUG(0, ("samr_io_r_samr_query_domain_info2: unknown switch level 0x%x\n", + 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; -- cgit From 347990dc872c5b03f45ad9070128e097f1dffe96 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 5 May 2006 08:14:19 +0000 Subject: r15453: Process all the supported info levels in the samr_query_domain_info2 call. Guenther (This used to be commit 9b0731b2a9b45153356f9f7fad384a02028a8bd3) --- source3/rpc_parse/parse_samr.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 620aad7c7a..027d5fba85 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -7812,10 +7812,22 @@ BOOL samr_io_r_query_domain_info2(const char *desc, SAMR_R_QUERY_DOMAIN_INFO2 * 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; @@ -7828,6 +7840,10 @@ BOOL samr_io_r_query_domain_info2(const char *desc, SAMR_R_QUERY_DOMAIN_INFO2 * 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; -- cgit From 9a38c05154879b2fd89da3a745bd290c97e0a9ce Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 25 May 2006 15:40:40 +0000 Subject: r15884: Fix bug #3803 from jason@ncac.gwu.edu - bad comparison. Jeremy. (This used to be commit 1d9dbe3b662ea757224ca4d8c991ae73bb92ae8d) --- source3/rpc_parse/parse_lsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index ffc0f04332..12f18d319b 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -595,7 +595,7 @@ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *out, init_dom_sid2(out->domlist->domains[i].sid, &(td[i])->sid); - if (push_ucs2_talloc(ctx, &name, (td[i])->name) < 0){ + if (push_ucs2_talloc(ctx, &name, (td[i])->name) == (size_t)-1){ out->status = NT_STATUS_NO_MEMORY; return; } -- cgit From c594a5519d459730252a9692200a849b84b4e96a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 6 Jun 2006 14:18:12 +0000 Subject: r16060: This is one of the more dirty patches I've put in lately. Parse enough of SetUserInfo level 25 to survive the join method XP uses if the user did not exist before. For good taste this contains way too much cut&paste, but for a real fix there is just not enough time. Up to 3.0.22 we completely ignored that a full level 21 is being sent together with level 25, but we got away with that because on creation we did not set the "disabled" flag on the workstation account. Now we correctly follow W2k3 in this regard, and we end up with a disabled workstation after join. Man, I hate rpc_parse/. The correct fix would be to import PIDL generated samr parsing, but this is would probably be a bit too much for .23... Thanks to Tom Bork for finding this one. Volker (This used to be commit 5a37aba10551456042266443cc0a92f28f8c3d0d) --- source3/rpc_parse/parse_samr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 027d5fba85..d661b225e0 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6041,8 +6041,10 @@ static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_str 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_uint32s(False, "unknown_6 ", ps, depth, usr->unknown_6, 6)) + if(!prs_uint32s(False, "unknown_5 ", ps, depth, usr->unknown_5, 5)) return False; if(!prs_uint8s(False, "password ", ps, depth, usr->pass, sizeof(usr->pass))) -- cgit From 3b469083befa7159b700d5465db04b1be2d4ac5f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 9 Jun 2006 17:19:59 +0000 Subject: r16126: Janitor for Volker..... This looks correct to me. Jeremy. Fix a parsing error that became apparent in 'make test': If we have no group rids in the info3 we set the array buffer pointer to "1" but fail to actually ship the array. Volker. (This used to be commit ee1b9207d3119c2b3e7c1c4e59250dbd323eae6a) --- source3/rpc_parse/parse_net.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index e168f5abbd..cecec31410 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -4,7 +4,7 @@ * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, * Copyright (C) Paul Ashton 1997. - * Copyright (C) Jean Franois Micouleau 2002. + * 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 @@ -1711,29 +1711,24 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, if(!prs_align(ps)) return False; - if (usr->num_groups > 0) { + if(!prs_uint32("num_groups2 ", ps, depth, &usr->num_groups2)) /* num groups2 */ + 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 (usr->num_groups != usr->num_groups2) { - DEBUG(3,("net_io_user_info3: num_groups mismatch! (%d != %d)\n", - usr->num_groups, usr->num_groups2)); + if (UNMARSHALLING(ps)) { + usr->gids = PRS_ALLOC_MEM(ps, DOM_GID, usr->num_groups); + if (usr->gids == NULL) return False; - } - - - if (UNMARSHALLING(ps)) { - usr->gids = PRS_ALLOC_MEM(ps, DOM_GID, usr->num_groups); - if (usr->gids == NULL) - return False; - } + } - for (i = 0; i < usr->num_groups; i++) { - if(!smb_io_gid("", &usr->gids[i], ps, depth)) /* group info */ - return False; - } - + 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 */ -- cgit From 4ba1a36d4cb469bffaad86a4620a78d67eeb29ee Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 16 Jun 2006 20:44:49 +0000 Subject: r16299: Fix another "dereferencing type-punned pointer will break strict-aliasing rules" gcc4 warning. Jeremy. (This used to be commit ee77dde9b6375423f95f31455d06cef7303400be) --- source3/rpc_parse/parse_misc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 8cd6553a03..b56f36f590 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1107,6 +1107,7 @@ BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct * BOOL prs_unistr4(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) { + void *ptr; prs_debug(ps, depth, desc, "prs_unistr4"); depth++; @@ -1115,9 +1116,13 @@ BOOL prs_unistr4(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) if ( !prs_uint16("size", ps, depth, &uni4->size )) return False; - if ( !prs_pointer( desc, ps, depth, (void**)&uni4->string, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) ) + ptr = uni4->string; + + if ( !prs_pointer( desc, ps, depth, &ptr, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) ) return False; - + + uni4->string = (UNISTR2 *)ptr; + return True; } -- cgit From a70bbb921a078b5f4ab9928168c9308e2bb05933 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 19 Jun 2006 19:56:22 +0000 Subject: r16362: That's the best way to fix a Klocwork bug: Remove the (unused...;-) code altogether. This was essentially a second implementation if string_to_sid. Klocwork ID 1038 Volker (This used to be commit e35f901067b702f5e61733a6edabc610a7dd5aab) --- source3/rpc_parse/parse_misc.c | 50 ------------------------------------------ 1 file changed, 50 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index b56f36f590..cb7c06eb45 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -226,56 +226,6 @@ BOOL smb_io_dom_sid(const char *desc, DOM_SID *sid, prs_struct *ps, int depth) return True; } -/******************************************************************* - Inits a DOM_SID structure. - - BIG NOTE: this function only does SIDS where the identauth is not >= 2^32 - identauth >= 2^32 can be detected because it will be specified in hex -********************************************************************/ - -void init_dom_sid(DOM_SID *sid, const char *str_sid) -{ - pstring domsid; - int identauth; - char *p; - - if (str_sid == NULL) { - DEBUG(4,("netlogon domain SID: none\n")); - sid->sid_rev_num = 0; - sid->num_auths = 0; - return; - } - - pstrcpy(domsid, str_sid); - - DEBUG(4,("init_dom_sid %d SID: %s\n", __LINE__, domsid)); - - /* assume, but should check, that domsid starts "S-" */ - p = strtok(domsid+2,"-"); - sid->sid_rev_num = atoi(p); - - /* identauth in decimal should be < 2^32 */ - /* identauth in hex should be >= 2^32 */ - identauth = atoi(strtok(0,"-")); - - DEBUG(4,("netlogon rev %d\n", sid->sid_rev_num)); - DEBUG(4,("netlogon %s ia %d\n", p, identauth)); - - sid->id_auth[0] = 0; - sid->id_auth[1] = 0; - sid->id_auth[2] = (identauth & 0xff000000) >> 24; - sid->id_auth[3] = (identauth & 0x00ff0000) >> 16; - sid->id_auth[4] = (identauth & 0x0000ff00) >> 8; - sid->id_auth[5] = (identauth & 0x000000ff); - - sid->num_auths = 0; - - while ((p = strtok(0, "-")) != NULL && sid->num_auths < MAXSUBAUTHS) - sid->sub_auths[sid->num_auths++] = atoi(p); - - DEBUG(4,("init_dom_sid: %d SID: %s\n", __LINE__, domsid)); -} - /******************************************************************* Inits a DOM_SID2 structure. ********************************************************************/ -- cgit From d5b6dedfdd1acb9a2340a04865308c7c3c975ffd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 19 Jun 2006 21:36:19 +0000 Subject: r16365: Fix Klocwork #895, #898, #899, #915, #932, #938 and a few other problems Klocwork missed. Jeremy. (This used to be commit fe05769a1a85f924c67be7e5dcee4871a86948d7) --- source3/rpc_parse/parse_prs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index f2b002c48c..14e190892d 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1469,11 +1469,12 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *me kbuf.dptr = keystr; kbuf.dsize = strlen(keystr)+1; + prs_init(ps, 0, mem_ctx, UNMARSHALL); + dbuf = tdb_fetch(tdb, kbuf); if (!dbuf.dptr) return -1; - prs_init(ps, 0, mem_ctx, UNMARSHALL); prs_give_memory(ps, dbuf.dptr, dbuf.dsize, True); return 0; -- cgit From 96a54e7d23070b6779134dac393406a770e6f581 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 19 Jun 2006 21:47:46 +0000 Subject: r16369: Klocwork #1035. Jeremy. (This used to be commit 6924d1cd443e4f7eb7b634c97c92effd6373ff12) --- source3/rpc_parse/parse_lsa.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 12f18d319b..ae4cff53e4 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -738,6 +738,9 @@ static BOOL lsa_io_dom_query_2(const char *desc, DOM_QUERY_2 *d_q, prs_struct *p if (UNMARSHALLING(ps)) { d_q->auditsettings = TALLOC_ZERO_ARRAY(ps->mem_ctx, uint32, d_q->count2); + if (!d_q->auditsettings) { + return False; + } } if (!prs_uint32s(False, "auditsettings", ps, depth, d_q->auditsettings, d_q->count2)) -- cgit From cc01fd242be450f4598eec50956403d2298ad5a4 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 19 Jun 2006 22:55:03 +0000 Subject: r16371: Fix Klocwork #1048. Jeremy. (This used to be commit 5057e90db32adf4395fc2a3fce26a7f64c780828) --- source3/rpc_parse/parse_ntsvcs.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_ntsvcs.c b/source3/rpc_parse/parse_ntsvcs.c index 24bf3a455b..599257e802 100644 --- a/source3/rpc_parse/parse_ntsvcs.c +++ b/source3/rpc_parse/parse_ntsvcs.c @@ -299,8 +299,12 @@ BOOL ntsvcs_io_q_get_hw_profile_info(const char *desc, NTSVCS_Q_GET_HW_PROFILE_I q_u->buffer_size = 0x000000a8; - if ( UNMARSHALLING(ps) ) + if ( UNMARSHALLING(ps) ) { q_u->buffer = TALLOC_ARRAY(get_talloc_ctx(), 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; @@ -329,8 +333,12 @@ BOOL ntsvcs_io_r_get_hw_profile_info(const char *desc, NTSVCS_R_GET_HW_PROFILE_I if ( !prs_align(ps) ) return False; - if ( UNMARSHALLING(ps) ) + if ( UNMARSHALLING(ps) ) { r_u->buffer = TALLOC_ARRAY(get_talloc_ctx(), uint8, r_u->buffer_size ); + if (!r_u->buffer) { + return False; + } + } if ( !prs_uint8s(True, "buffer", ps, depth, r_u->buffer, r_u->buffer_size) ) return False; -- cgit From 5cccafff45bc6cae63212d94b1346c8bdf0ef551 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 19 Jun 2006 22:59:03 +0000 Subject: r16373: Fix Klocwork #1071. Jeremy (This used to be commit 080464b93d965a583b2b5f248a2bb8a7fb516e6f) --- source3/rpc_parse/parse_samr.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index d661b225e0..9026d503c3 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6471,8 +6471,14 @@ static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, 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 = base64_decode_data_blob(munged_dial); - + DATA_BLOB blob; + + if (munged_dial) { + blob = base64_decode_data_blob(munged_dial); + } else { + blob = data_blob(NULL, 0); + } + init_unistr2_from_datablob(&usr->uni_munged_dial, &blob); init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); data_blob_free(&blob); -- cgit From 0f256c31c0cc906218d06eb9bdda4e937fd5587e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 19 Jun 2006 23:21:47 +0000 Subject: r16377: Klocwork #1077. Jeremy. (This used to be commit 72709a8465caf5b7d95911250234f203b0ff4675) --- source3/rpc_parse/parse_spoolss.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index ec2d6b8430..692a8c6ddf 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5005,11 +5005,16 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) rpcstr_pull(f, src, sizeof(f)-1, -1, STR_TERMINATE); src = skip_unibuf(src, 2*buf5->buf_len - PTR_DIFF(src,buf5->buffer)); *ar = SMB_REALLOC_ARRAY(*ar, fstring, n+2); - if (!*ar) + if (!*ar) { return False; + } fstrcpy((*ar)[n], f); n++; } + if (!*ar) { + return False; + } + fstrcpy((*ar)[n], ""); return True; -- cgit From 64ed606a358c6d2e465b1e32fc1e3326753f5bf1 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 20 Jun 2006 00:21:39 +0000 Subject: r16378: Klocwork #1079. Allow BUFFER5 to cope with a NULL dependentfiles pointer. Jeremy. (This used to be commit 05c50d99a4b1d2bc11a83e07902082227d7c074a) --- source3/rpc_parse/parse_spoolss.c | 72 +++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 34 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 692a8c6ddf..2884883e89 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4989,6 +4989,7 @@ BOOL spool_io_printer_driver_info_level_6(const char *desc, SPOOL_PRINTER_DRIVER dynamically allocate memory ********************************************************************/ + static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) { fstring f; @@ -4999,7 +5000,10 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) return False; src = (char *)buf5->buffer; - *ar = NULL; + *ar = SMB_MALLOC_ARRAY(fstring, 1); + if (!*ar) { + return False; + } while (src < ((char *)buf5->buffer) + buf5->buf_len*2) { rpcstr_pull(f, src, sizeof(f)-1, -1, STR_TERMINATE); @@ -5011,18 +5015,12 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) fstrcpy((*ar)[n], f); n++; } - if (!*ar) { - return False; - } fstrcpy((*ar)[n], ""); return True; } - - - /******************************************************************* read a UNICODE array with null terminated strings and null terminated array @@ -5120,9 +5118,6 @@ BOOL make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx, DRIVER_INFO_3 *info3) { uint32 len = 0; - uint16 *ptr = info3->dependentfiles; - BOOL done = False; - BOOL null_char = False; SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *inf; if (!(inf=TALLOC_ZERO_P(mem_ctx, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3))) @@ -5147,31 +5142,35 @@ BOOL make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx, init_unistr2_from_unistr(&inf->monitorname, &info3->monitorname); init_unistr2_from_unistr(&inf->defaultdatatype, &info3->defaultdatatype); - while (!done) - { - switch (*ptr) - { - case 0: - /* the null_char BOOL is used to help locate - two '\0's back to back */ - if (null_char) - done = True; - else - null_char = True; - break; + if (info3->dependentfiles) { + BOOL done = False; + BOOL null_char = False; + uint16 *ptr = info3->dependentfiles; + + while (!done) { + switch (*ptr) { + case 0: + /* the null_char BOOL is used to help locate + two '\0's back to back */ + if (null_char) { + done = True; + } else { + null_char = True; + } + break; - default: - null_char = False; - ;; - break; + default: + null_char = False; + break; + } + len++; + ptr++; } - len++; - ptr++; } + inf->dependentfiles_ptr = (info3->dependentfiles != NULL) ? 1 : 0; - inf->dependentfilessize = len; - if(!make_spoolss_buffer5(mem_ctx, &inf->dependentfiles, len, info3->dependentfiles)) - { + inf->dependentfilessize = (info3->dependentfiles != NULL) ? len : 0; + if(!make_spoolss_buffer5(mem_ctx, &inf->dependentfiles, len, info3->dependentfiles)) { SAFE_FREE(inf); return False; } @@ -5184,13 +5183,18 @@ BOOL make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx, /******************************************************************* make a BUFFER5 struct from a uint16* ******************************************************************/ + BOOL make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src) { buf5->buf_len = len; - if((buf5->buffer=(uint16*)TALLOC_MEMDUP(mem_ctx, src, sizeof(uint16)*len)) == NULL) { - DEBUG(0,("make_spoolss_buffer5: Unable to malloc memory for buffer!\n")); - return False; + if (src) { + if((buf5->buffer=(uint16*)TALLOC_MEMDUP(mem_ctx, src, sizeof(uint16)*len)) == NULL) { + DEBUG(0,("make_spoolss_buffer5: Unable to malloc memory for buffer!\n")); + return False; + } + } else { + buf5->buffer=NULL; } return True; -- cgit From 107698dd0e9b53e41003b677fef20f726a8a4ed6 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 28 Jun 2006 02:12:53 +0000 Subject: r16601: Klocwork #2038. Fix memleak on error path. Jeremy. (This used to be commit 934dddb2fa9fb60a87c0b0be81db97f2b59c7cb0) --- source3/rpc_parse/parse_eventlog.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 5e28a4aba5..4aff9734ee 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -353,18 +353,18 @@ BOOL eventlog_io_r_read_eventlog(const char *desc, /* Now pad with whitespace until the end of the response buffer */ - r_u->end_of_entries_padding = - SMB_CALLOC_ARRAY(uint8, - q_u->max_read_size - r_u->num_bytes_in_resp); + if (q_u->max_read_size - r_u->num_bytes_in_resp) { + r_u->end_of_entries_padding = SMB_CALLOC_ARRAY(uint8, q_u->max_read_size - r_u->num_bytes_in_resp); - if(!(prs_uint8s(False, "end of entries padding", ps, - depth, r_u->end_of_entries_padding, - (q_u->max_read_size - r_u->num_bytes_in_resp)))) - { - return False; - } + if(!(prs_uint8s(False, "end of entries padding", ps, + depth, r_u->end_of_entries_padding, + (q_u->max_read_size - r_u->num_bytes_in_resp)))) { + free(r_u->end_of_entries_padding); + return False; + } - free(r_u->end_of_entries_padding); + free(r_u->end_of_entries_padding); + } /* We had better be DWORD aligned here */ -- cgit From fbdcf2663b56007a438ac4f0d8d82436b1bfe688 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 11 Jul 2006 18:01:26 +0000 Subject: r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need to do the upper layer directories but this is what everyone is waiting for.... Jeremy. (This used to be commit 9dafb7f48ca3e7af956b0a7d1720c2546fc4cfb8) --- source3/rpc_parse/parse_eventlog.c | 2 +- source3/rpc_parse/parse_lsa.c | 12 +- source3/rpc_parse/parse_ntsvcs.c | 4 +- source3/rpc_parse/parse_prs.c | 32 ++- source3/rpc_parse/parse_reg.c | 44 ++-- source3/rpc_parse/parse_rpc.c | 11 + source3/rpc_parse/parse_samr.c | 50 ++-- source3/rpc_parse/parse_shutdown.c | 10 +- source3/rpc_parse/parse_spoolss.c | 2 +- source3/rpc_parse/parse_srv.c | 524 +++++++++++++++---------------------- source3/rpc_parse/parse_svcctl.c | 14 +- source3/rpc_parse/parse_unixinfo.c | 266 +++++++++++++++++++ 12 files changed, 585 insertions(+), 386 deletions(-) create mode 100644 source3/rpc_parse/parse_unixinfo.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 4aff9734ee..addf433feb 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -54,7 +54,7 @@ BOOL eventlog_io_q_open_eventlog(const char *desc, EVENTLOG_Q_OPEN_EVENTLOG *q_u 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)) + 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) ) diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index ae4cff53e4..919b7c3955 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -664,7 +664,7 @@ BOOL lsa_io_r_enum_trust_dom(const char *desc, LSA_R_ENUM_TRUST_DOM *out, 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)) + 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)) @@ -3250,7 +3250,7 @@ BOOL lsa_io_r_enum_acct_rights(const char *desc, LSA_R_ENUM_ACCT_RIGHTS *out, pr 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) ) + if ( !prs_pointer("rights", ps, depth, (void*)&out->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) return False; if(!prs_align(ps)) @@ -3302,7 +3302,7 @@ BOOL lsa_io_q_add_acct_rights(const char *desc, LSA_Q_ADD_ACCT_RIGHTS *in, prs_s 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) ) + if ( !prs_pointer("rights", ps, depth, (void*)&in->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) return False; return True; @@ -3371,7 +3371,7 @@ BOOL lsa_io_q_remove_acct_rights(const char *desc, LSA_Q_REMOVE_ACCT_RIGHTS *in, 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) ) + if ( !prs_pointer("rights", ps, depth, (void*)&in->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) return False; return True; @@ -4056,7 +4056,7 @@ BOOL lsa_io_r_query_trusted_domain_info(const char *desc, prs_debug(ps, depth, desc, "lsa_io_r_query_trusted_domain_info"); depth++; - if (!prs_pointer("trustdom", ps, depth, (void**)&r_q->info, + if (!prs_pointer("trustdom", ps, depth, (void*)&r_q->info, sizeof(LSA_TRUSTED_DOMAIN_INFO), (PRS_POINTER_CAST)lsa_io_trustdom_query) ) return False; @@ -4185,7 +4185,7 @@ BOOL lsa_io_r_query_dom_info(const char *desc, LSA_R_QUERY_DOM_INFO_POLICY *out, prs_debug(ps, depth, desc, "lsa_io_r_query_dom_info"); depth++; - if (!prs_pointer("dominfo", ps, depth, (void**)&out->info, + if (!prs_pointer("dominfo", ps, depth, (void*)&out->info, sizeof(LSA_DOM_INFO_UNION), (PRS_POINTER_CAST)lsa_io_dom_info_query) ) return False; diff --git a/source3/rpc_parse/parse_ntsvcs.c b/source3/rpc_parse/parse_ntsvcs.c index 599257e802..ab5f3f75e8 100644 --- a/source3/rpc_parse/parse_ntsvcs.c +++ b/source3/rpc_parse/parse_ntsvcs.c @@ -77,7 +77,7 @@ BOOL ntsvcs_io_q_get_device_list_size(const char *desc, NTSVCS_Q_GET_DEVICE_LIST if(!prs_align(ps)) return False; - if ( !prs_pointer("devicename", ps, depth, (void**)&q_u->devicename, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2) ) + 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; @@ -127,7 +127,7 @@ BOOL ntsvcs_io_q_get_device_list(const char *desc, NTSVCS_Q_GET_DEVICE_LIST *q_u if(!prs_align(ps)) return False; - if ( !prs_pointer("devicename", ps, depth, (void**)&q_u->devicename, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2) ) + 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; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 14e190892d..29a3e60aa9 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -624,9 +624,10 @@ BOOL prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8) ********************************************************************/ BOOL prs_pointer( const char *name, prs_struct *ps, int depth, - void **data, size_t data_size, + void *dta, size_t data_size, BOOL(*prs_fn)(const char*, prs_struct*, int, void*) ) { + void ** data = (void **)dta; uint32 data_p; /* output f000baaa to stream if the pointer is non-zero. */ @@ -1793,3 +1794,32 @@ BOOL schannel_decode(struct schannel_auth_struct *a, enum pipe_auth_level auth_l return (memcmp(digest_final, verf->packet_digest, sizeof(verf->packet_digest)) == 0); } + +/******************************************************************* +creates a new prs_struct containing a DATA_BLOB +********************************************************************/ +BOOL prs_init_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) +{ + if (!prs_init( prs, RPC_MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL )) + return False; + + + if (!prs_copy_data_in(prs, (char *)blob->data, blob->length)) + return False; + + return True; +} + +/******************************************************************* +return the contents of a prs_struct in a DATA_BLOB +********************************************************************/ +BOOL prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) +{ + blob->length = prs_offset(prs); + blob->data = talloc_zero_size(mem_ctx, blob->length); + + if (!prs_copy_all_data_out((char *)blob->data, prs)) + return False; + + return True; +} diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index fef1332e5c..1820a595ed 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -76,7 +76,7 @@ BOOL reg_io_q_open_hive(const char *desc, REG_Q_OPEN_HIVE *q_u, if(!prs_align(ps)) return False; - if(!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) + if(!prs_pointer("server", ps, depth, (void*)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; if(!prs_align(ps)) @@ -276,7 +276,7 @@ BOOL reg_io_q_create_key_ex(const char *desc, REG_Q_CREATE_KEY_EX *q_u, if(!prs_uint32("access", ps, depth, &q_u->access)) return False; - if(!prs_pointer("sec_info", ps, depth, (void**)&q_u->sec_info, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("sec_info", ps, depth, (void*)&q_u->sec_info, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; if ( q_u->sec_info ) { @@ -286,7 +286,7 @@ BOOL reg_io_q_create_key_ex(const char *desc, REG_Q_CREATE_KEY_EX *q_u, return False; } - if(!prs_pointer("disposition", ps, depth, (void**)&q_u->disposition, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("disposition", ps, depth, (void*)&q_u->disposition, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; return True; @@ -1060,17 +1060,17 @@ BOOL reg_io_r_query_value(const char *desc, REG_R_QUERY_VALUE *r_u, prs_struct * if(!prs_align(ps)) return False; - if ( !prs_pointer("type", ps, depth, (void**)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if ( !prs_pointer("type", ps, depth, (void*)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if ( !prs_pointer("value", ps, depth, (void**)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) + if ( !prs_pointer("value", ps, depth, (void*)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) return False; if(!prs_align(ps)) return False; - if ( !prs_pointer("buf_max_len", ps, depth, (void**)&r_u->buf_max_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if ( !prs_pointer("buf_max_len", ps, depth, (void*)&r_u->buf_max_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if ( !prs_pointer("buf_len", ps, depth, (void**)&r_u->buf_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if ( !prs_pointer("buf_len", ps, depth, (void*)&r_u->buf_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; if(!prs_werror("status", ps, depth, &r_u->status)) @@ -1207,17 +1207,17 @@ BOOL reg_io_q_enum_val(const char *desc, REG_Q_ENUM_VALUE *q_u, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_pointer("type", ps, depth, (void**)&q_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("type", ps, depth, (void*)&q_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if ( !prs_pointer("value", ps, depth, (void**)&q_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) + if ( !prs_pointer("value", ps, depth, (void*)&q_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) return False; if(!prs_align(ps)) return False; - if(!prs_pointer("buffer_len", ps, depth, (void**)&q_u->buffer_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("buffer_len", ps, depth, (void*)&q_u->buffer_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if(!prs_pointer("name_len", ps, depth, (void**)&q_u->name_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("name_len", ps, depth, (void*)&q_u->name_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; return True; @@ -1243,17 +1243,17 @@ BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_u, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_pointer("type", ps, depth, (void**)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("type", ps, depth, (void*)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if ( !prs_pointer("value", ps, depth, (void**)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) + if ( !prs_pointer("value", ps, depth, (void*)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) return False; if(!prs_align(ps)) return False; - if(!prs_pointer("buffer_len1", ps, depth, (void**)&r_u->buffer_len1, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("buffer_len1", ps, depth, (void*)&r_u->buffer_len1, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if(!prs_pointer("buffer_len2", ps, depth, (void**)&r_u->buffer_len2, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("buffer_len2", ps, depth, (void*)&r_u->buffer_len2, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; if(!prs_werror("status", ps, depth, &r_u->status)) @@ -1457,12 +1457,12 @@ BOOL reg_io_r_enum_key(const char *desc, REG_R_ENUM_KEY *q_u, prs_struct *ps, i if(!prs_align(ps)) return False; - if (!prs_pointer("class", ps, depth, (void**)&q_u->classname, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) + if (!prs_pointer("class", ps, depth, (void*)&q_u->classname, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; if(!prs_align(ps)) return False; - if (!prs_pointer("time", ps, depth, (void**)&q_u->time, sizeof(NTTIME), (PRS_POINTER_CAST)smb_io_nttime)) + if (!prs_pointer("time", ps, depth, (void*)&q_u->time, sizeof(NTTIME), (PRS_POINTER_CAST)smb_io_nttime)) return False; if(!prs_align(ps)) @@ -1620,12 +1620,12 @@ BOOL reg_io_q_shutdown(const char *desc, REG_Q_SHUTDOWN *q_u, prs_struct *ps, if (!prs_align(ps)) return False; - if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) + if (!prs_pointer("server", ps, depth, (void*)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; if (!prs_align(ps)) return False; - if (!prs_pointer("message", ps, depth, (void**)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) + if (!prs_pointer("message", ps, depth, (void*)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; if (!prs_align(ps)) @@ -1680,12 +1680,12 @@ BOOL reg_io_q_shutdown_ex(const char *desc, REG_Q_SHUTDOWN_EX *q_u, prs_struct * if (!prs_align(ps)) return False; - if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) + if (!prs_pointer("server", ps, depth, (void*)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; if (!prs_align(ps)) return False; - if (!prs_pointer("message", ps, depth, (void**)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) + if (!prs_pointer("message", ps, depth, (void*)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; if (!prs_align(ps)) @@ -1759,7 +1759,7 @@ BOOL reg_io_q_abort_shutdown(const char *desc, REG_Q_ABORT_SHUTDOWN *q_u, if (!prs_align(ps)) return False; - if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) + if (!prs_pointer("server", ps, depth, (void*)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; if (!prs_align(ps)) return False; diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 2d166c773b..240cac886c 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -191,6 +191,16 @@ interface/version dce/rpc pipe identification }, 0x00 \ } +#define SYNT_UNIXINFO_V0 \ +{ \ + { \ + 0x9c54e310, 0xa955, 0x4885, \ + { 0xbd, 0x31 }, \ + { 0x78, 0x78, \ + 0x71, 0x47, 0xdf, 0xa6 } \ + }, 0x00 \ +} + #define SYNT_NTSVCS_V1 \ { \ { \ @@ -222,6 +232,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_SHUTDOWN, SYNT_SHUTDOWN_V1 , PIPE_SHUTDOWN , TRANS_SYNT_V2 }, { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_EVENTLOG, SYNT_EVENTLOG_V0 , PIPE_EVENTLOG , TRANS_SYNT_V2 }, + { PIPE_UNIXINFO, SYNT_UNIXINFO_V0 , PIPE_UNIXINFO , TRANS_SYNT_V2 }, { PIPE_NTSVCS , SYNT_NTSVCS_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 9026d503c3..26da7b426d 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3854,7 +3854,7 @@ BOOL samr_io_r_query_aliasinfo(const char *desc, SAMR_R_QUERY_ALIASINFO *out, 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)) + 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; @@ -4896,7 +4896,7 @@ 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, uint32 *type, + uint32 *rid, enum SID_NAME_USE *type, NTSTATUS status) { DEBUG(5, ("init_samr_r_lookup_names\n")); @@ -5741,8 +5741,8 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z copy_unistr2(&usr->uni_workstations, wkstas); init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations); - copy_unistr2(&usr->uni_unknown_str, unk_str); - init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); + 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); @@ -5835,8 +5835,8 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z init_unistr2(&usr->uni_workstations, wkstas, UNI_FLAGS_NONE); init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations); - init_unistr2(&usr->uni_unknown_str, unk_str, UNI_FLAGS_NONE); - init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); + 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); @@ -5895,7 +5895,7 @@ static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr, 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_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */ + 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; @@ -5963,7 +5963,7 @@ static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr, 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_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */ + 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)) @@ -6025,7 +6025,7 @@ static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_str 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_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */ + 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; @@ -6076,7 +6076,7 @@ static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_str 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_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */ + 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)) @@ -6182,8 +6182,8 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, copy_unistr2(&usr->uni_workstations, wkstas); init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations); - copy_unistr2(&usr->uni_unknown_str, unk_str); - init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); + 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); @@ -6331,8 +6331,8 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, struct samu *pw, DOM_SID * init_unistr2(&usr->uni_workstations, workstations, UNI_STR_TERMINATE); init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations); - init_unistr2(&usr->uni_unknown_str, NULL, UNI_STR_TERMINATE); - init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); + 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); @@ -6398,7 +6398,7 @@ static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, 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_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */ + 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; @@ -6438,25 +6438,25 @@ static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, /* 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 */ + 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)) /* user's full name unicode string */ + 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)) /* home directory unicode string */ + 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)) /* home directory drive unicode string */ + 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)) /* logon script unicode string */ + 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)) /* profile path unicode string */ + 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)) /* user desc unicode string */ + 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)) /* worksations user can log on from */ + if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) return False; - if(!smb_io_unistr2("uni_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */ + 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)) /* worksations user can log on from */ + 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) */ diff --git a/source3/rpc_parse/parse_shutdown.c b/source3/rpc_parse/parse_shutdown.c index da33807733..8c417c05dc 100644 --- a/source3/rpc_parse/parse_shutdown.c +++ b/source3/rpc_parse/parse_shutdown.c @@ -100,12 +100,12 @@ BOOL shutdown_io_q_init(const char *desc, SHUTDOWN_Q_INIT *q_s, prs_struct *ps, if (!prs_align(ps)) return False; - if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) + if (!prs_pointer("server", ps, depth, (void*)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; if (!prs_align(ps)) return False; - if (!prs_pointer("message", ps, depth, (void**)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) + if (!prs_pointer("message", ps, depth, (void*)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; if (!prs_align(ps)) @@ -159,12 +159,12 @@ BOOL shutdown_io_q_init_ex(const char *desc, SHUTDOWN_Q_INIT_EX * q_s, prs_struc if (!prs_align(ps)) return False; - if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) + if (!prs_pointer("server", ps, depth, (void*)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; if (!prs_align(ps)) return False; - if (!prs_pointer("message", ps, depth, (void**)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) + if (!prs_pointer("message", ps, depth, (void*)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; if (!prs_align(ps)) @@ -238,7 +238,7 @@ BOOL shutdown_io_q_abort(const char *desc, SHUTDOWN_Q_ABORT *q_s, if (!prs_align(ps)) return False; - if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) + if (!prs_pointer("server", ps, depth, (void*)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; if (!prs_align(ps)) return False; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 2884883e89..8d4a757a74 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -606,7 +606,7 @@ static BOOL spool_io_user_level(const char *desc, SPOOL_USER_CTR *q_u, prs_struc switch ( q_u->level ) { case 1: - if ( !prs_pointer( "" , ps, depth, (void**)&q_u->user.user1, + if ( !prs_pointer( "" , ps, depth, (void*)&q_u->user.user1, sizeof(SPOOL_USER_1), (PRS_POINTER_CAST)spool_io_user_level_1 )) { return False; diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 7d15eda630..5123d1c2cc 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -7,6 +7,7 @@ * Copyright (C) Jeremy Allison 1999, * Copyright (C) Nigel Williams 2001, * Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2002. + * Copyright (C) Gerald (Jerry) Carter 2006. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1588,64 +1589,17 @@ BOOL srv_io_r_net_share_del(const char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_stru Inits a SESS_INFO_0_STR structure ********************************************************************/ -void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, const char *name) +void init_srv_sess_info0( SESS_INFO_0 *ss0, const char *name ) { - DEBUG(5,("init_srv_sess_info0_str\n")); + ZERO_STRUCTP( ss0 ); - init_unistr2(&ss0->uni_name, name, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_sess_info0_str(const char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth) -{ - if (ss0 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_sess_info0_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("", &ss0->uni_name, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Inits a SESS_INFO_0 structure -********************************************************************/ - -void init_srv_sess_info0(SESS_INFO_0 *ss0, const char *name) -{ - DEBUG(5,("init_srv_sess_info0: %s\n", name)); - - ss0->ptr_name = (name != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_sess_info0(const char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth) -{ - if (ss0 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_sess_info0"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_name", ps, depth, &ss0->ptr_name)) - return False; - - return True; + if ( name ) { + if ( (ss0->sharename = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) { + DEBUG(0,("init_srv_sess_info0: talloc failed!\n")); + return; + } + init_unistr2( ss0->sharename, name, UNI_STR_TERMINATE ); + } } /******************************************************************* @@ -1681,13 +1635,15 @@ static BOOL srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_s SMB_ASSERT_ARRAY(ss0->info_0, num_entries); + /* first the pointers */ for (i = 0; i < num_entries; i++) { - if(!srv_io_sess_info0("", &ss0->info_0[i], ps, depth)) + if ( !prs_io_unistr2_p("", ps, depth, &ss0->info_0[i].sharename ) ) return False; } + /* now the strings */ for (i = 0; i < num_entries; i++) { - if(!srv_io_sess_info0_str("", &ss0->info_0_str[i], ps, depth)) + if ( !prs_io_unistr2("sharename", ps, depth, ss0->info_0[i].sharename )) return False; } @@ -1698,54 +1654,33 @@ static BOOL srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_s return True; } -/******************************************************************* - Inits a SESS_INFO_1_STR structure -********************************************************************/ - -void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, const char *name, const char *user) -{ - DEBUG(5,("init_srv_sess_info1_str\n")); - - init_unistr2(&ss1->uni_name, name, UNI_STR_TERMINATE); - init_unistr2(&ss1->uni_user, user, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_sess_info1_str(const char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth) -{ - if (ss1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_sess_info1_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("", &ss1->uni_name, True, ps, depth)) - return False; - if(!smb_io_unistr2("", &(ss1->uni_user), True, ps, depth)) - return False; - - return True; -} - /******************************************************************* Inits a SESS_INFO_1 structure ********************************************************************/ -void init_srv_sess_info1(SESS_INFO_1 *ss1, - const char *name, const char *user, - uint32 num_opens, uint32 open_time, uint32 idle_time, - uint32 user_flags) +void init_srv_sess_info1( SESS_INFO_1 *ss1, const char *name, const char *user, + uint32 num_opens, uint32 open_time, uint32 idle_time, + uint32 user_flags) { DEBUG(5,("init_srv_sess_info1: %s\n", name)); - ss1->ptr_name = (name != NULL) ? 1 : 0; - ss1->ptr_user = (user != NULL) ? 1 : 0; + ZERO_STRUCTP( ss1 ); + + if ( name ) { + if ( (ss1->sharename = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) { + DEBUG(0,("init_srv_sess_info0: talloc failed!\n")); + return; + } + init_unistr2( ss1->sharename, name, UNI_STR_TERMINATE ); + } + + if ( user ) { + if ( (ss1->username = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) { + DEBUG(0,("init_srv_sess_info0: talloc failed!\n")); + return; + } + init_unistr2( ss1->username, user, UNI_STR_TERMINATE ); + } ss1->num_opens = num_opens; ss1->open_time = open_time; @@ -1753,37 +1688,6 @@ void init_srv_sess_info1(SESS_INFO_1 *ss1, ss1->user_flags = user_flags; } -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_sess_info1(const char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth) -{ - if (ss1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_sess_info1"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_name ", ps, depth, &ss1->ptr_name)) - return False; - if(!prs_uint32("ptr_user ", ps, depth, &ss1->ptr_user)) - return False; - - if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens)) - return False; - if(!prs_uint32("open_time ", ps, depth, &ss1->open_time)) - return False; - if(!prs_uint32("idle_time ", ps, depth, &ss1->idle_time)) - return False; - if(!prs_uint32("user_flags", ps, depth, &ss1->user_flags)) - return False; - - return True; -} /******************************************************************* Reads or writes a structure. @@ -1818,13 +1722,31 @@ static BOOL srv_io_srv_sess_info_1(const char *desc, SRV_SESS_INFO_1 *ss1, prs_s SMB_ASSERT_ARRAY(ss1->info_1, num_entries); + /* first the pointers and flags */ + for (i = 0; i < num_entries; i++) { - if(!srv_io_sess_info1("", &ss1->info_1[i], ps, depth)) + + if ( !prs_io_unistr2_p("", ps, depth, &ss1->info_1[i].sharename )) + return False; + if ( !prs_io_unistr2_p("", ps, depth, &ss1->info_1[i].username )) + return False; + + if(!prs_uint32("num_opens ", ps, depth, &ss1->info_1[i].num_opens)) + return False; + if(!prs_uint32("open_time ", ps, depth, &ss1->info_1[i].open_time)) + return False; + if(!prs_uint32("idle_time ", ps, depth, &ss1->info_1[i].idle_time)) + return False; + if(!prs_uint32("user_flags", ps, depth, &ss1->info_1[i].user_flags)) return False; } + /* now the strings */ + for (i = 0; i < num_entries; i++) { - if(!srv_io_sess_info1_str("", &ss1->info_1_str[i], ps, depth)) + if ( !prs_io_unistr2("", ps, depth, ss1->info_1[i].sharename )) + return False; + if ( !prs_io_unistr2("", ps, depth, ss1->info_1[i].username )) return False; } @@ -1883,37 +1805,13 @@ static BOOL srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, pr return True; } -/******************************************************************* - Inits a SRV_Q_NET_SESS_ENUM structure. -********************************************************************/ - -void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, - const char *srv_name, const char *qual_name, - const char *user_name, uint32 sess_level, - SRV_SESS_INFO_CTR *ctr, uint32 preferred_len, - ENUM_HND *hnd) -{ - q_n->ctr = ctr; - - DEBUG(5,("init_q_net_sess_enum\n")); - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name); - init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name); - - q_n->sess_level = sess_level; - q_n->preferred_len = preferred_len; - - memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); -} - /******************************************************************* Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_u, prs_struct *ps, int depth) { - if (q_n == NULL) + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum"); @@ -1922,41 +1820,36 @@ BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_stru if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + 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_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth)) + if(!prs_pointer("qualifier", ps, depth, (void*)&q_u->qualifier, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth)) + + if(!prs_pointer("username", ps, depth, (void*)&q_u->username, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("sess_level", ps, depth, &q_n->sess_level)) + if(!prs_uint32("sess_level", ps, depth, &q_u->sess_level)) return False; - if (q_n->sess_level != (uint32)-1) { - if(!srv_io_srv_sess_ctr("sess_ctr", &q_n->ctr, ps, depth)) + if (q_u->sess_level != (uint32)-1) { + if(!srv_io_srv_sess_ctr("sess_ctr", &q_u->ctr, ps, depth)) return False; } - if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) + if(!prs_uint32("preferred_len", ps, depth, &q_u->preferred_len)) return False; - if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) + if(!smb_io_enum_hnd("enum_hnd", &q_u->enum_hnd, ps, depth)) return False; return True; @@ -2433,23 +2326,11 @@ BOOL srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_str return True; } -/******************************************************************* - Inits a FILE_INFO_3_STR structure -********************************************************************/ - -void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, const char *user_name, const char *path_name) -{ - DEBUG(5,("init_srv_file_info3_str\n")); - - init_unistr2(&fi3->uni_path_name, path_name, UNI_STR_TERMINATE); - init_unistr2(&fi3->uni_user_name, user_name, UNI_STR_TERMINATE); -} - /******************************************************************* Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_file_info3_str(const char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth) +static BOOL srv_io_file_info3_str(const char *desc, FILE_INFO_3 *sh1, prs_struct *ps, int depth) { if (sh1 == NULL) return False; @@ -2460,10 +2341,15 @@ static BOOL srv_io_file_info3_str(const char *desc, FILE_INFO_3_STR *sh1, prs_st if(!prs_align(ps)) return False; - if(!smb_io_unistr2("", &sh1->uni_path_name, True, ps, depth)) - return False; - if(!smb_io_unistr2("", &sh1->uni_user_name, True, ps, depth)) - return False; + if ( sh1->path ) { + if(!smb_io_unistr2("", sh1->path, True, ps, depth)) + return False; + } + + if ( sh1->user ) { + if(!smb_io_unistr2("", sh1->user, True, ps, depth)) + return False; + } return True; } @@ -2472,18 +2358,26 @@ static BOOL srv_io_file_info3_str(const char *desc, FILE_INFO_3_STR *sh1, prs_st Inits a FILE_INFO_3 structure ********************************************************************/ -void init_srv_file_info3(FILE_INFO_3 *fl3, - uint32 id, uint32 perms, uint32 num_locks, - const char *path_name, const char *user_name) +void init_srv_file_info3( FILE_INFO_3 *fl3, uint32 id, uint32 perms, uint32 num_locks, + const char *user_name, const char *path_name ) { - DEBUG(5,("init_srv_file_info3: %s %s\n", path_name, user_name)); - fl3->id = id; fl3->perms = perms; fl3->num_locks = num_locks; - fl3->ptr_path_name = (path_name != NULL) ? 1 : 0; - fl3->ptr_user_name = (user_name != NULL) ? 1 : 0; + if ( path_name ) { + if ( (fl3->path = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) + return; + init_unistr2(fl3->path, path_name, UNI_STR_TERMINATE); + } + + if ( user_name ) { + if ( (fl3->user = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) + return; + init_unistr2(fl3->user, user_name, UNI_STR_TERMINATE); + } + + return; } /******************************************************************* @@ -2492,6 +2386,8 @@ void init_srv_file_info3(FILE_INFO_3 *fl3, static BOOL srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) { + uint32 uni_p; + if (fl3 == NULL) return False; @@ -2507,10 +2403,24 @@ static BOOL srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps return False; if(!prs_uint32("num_locks ", ps, depth, &fl3->num_locks)) return False; - if(!prs_uint32("ptr_path_name", ps, depth, &fl3->ptr_path_name)) + + uni_p = fl3->path ? 1 : 0; + if(!prs_uint32("ptr", ps, depth, &uni_p)) return False; - if(!prs_uint32("ptr_user_name", ps, depth, &fl3->ptr_user_name)) + if (UNMARSHALLING(ps)) { + if ( (fl3->path = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) { + return False; + } + } + + uni_p = fl3->user ? 1 : 0; + if(!prs_uint32("ptr", ps, depth, &uni_p)) return False; + if (UNMARSHALLING(ps)) { + if ( (fl3->user = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) { + return False; + } + } return True; } @@ -2528,55 +2438,53 @@ static BOOL srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_st depth++; if (UNMARSHALLING(ps)) { - memset(ctr, '\0', sizeof(SRV_FILE_INFO_CTR)); + ZERO_STRUCTP(ctr); } if(!prs_align(ps)) return False; - if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) + if(!prs_uint32("level", ps, depth, &ctr->level)) return False; - if (ctr->switch_value != 3) { - DEBUG(5,("%s File info %d level not supported\n", - tab_depth(depth), ctr->switch_value)); - } + if(!prs_uint32("ptr_file_info", ps, depth, &ctr->ptr_file_info)) return False; if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries)) return False; if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries)) return False; + if (ctr->ptr_entries == 0) return True; - if(!prs_uint32("num_entries2", ps, depth, - &ctr->num_entries2)) + + if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2)) return False; - switch (ctr->switch_value) { + switch (ctr->level) { case 3: { - SRV_FILE_INFO_3 *info3 = ctr->file.info3; + FILE_INFO_3 *info3 = ctr->file.info3; int num_entries = ctr->num_entries; int i; if (UNMARSHALLING(ps)) { - if (!(info3 = PRS_ALLOC_MEM(ps, SRV_FILE_INFO_3, num_entries))) + if (!(info3 = PRS_ALLOC_MEM(ps, FILE_INFO_3, num_entries))) return False; ctr->file.info3 = info3; } for (i = 0; i < num_entries; i++) { - if(!srv_io_file_info3("", &ctr->file.info3[i].info_3, ps, depth)) + if(!srv_io_file_info3("", &ctr->file.info3[i], ps, depth)) return False; } + for (i = 0; i < num_entries; i++) { - if(!srv_io_file_info3_str("", &ctr->file.info3[i].info_3_str, ps, depth)) + if(!srv_io_file_info3_str("", &ctr->file.info3[i], ps, depth)) return False; } break; } default: - DEBUG(5,("%s no file info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); + DEBUG(5,("%s no file info at switch_value %d\n", tab_depth(depth), ctr->level)); break; } @@ -2594,13 +2502,28 @@ void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, uint32 preferred_len, ENUM_HND *hnd) { - DEBUG(5,("init_q_net_file_enum\n")); + uint32 ptr; - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name); - init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name); + if ( srv_name ) { + if ( (q_n->servername = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) + return; + init_buf_unistr2(q_n->servername, &ptr, srv_name); + } + + if ( qual_name ) { + if ( (q_n->qualifier = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) + return; + init_buf_unistr2(q_n->qualifier, &ptr, qual_name); + } + + if ( user_name ) { + if ( (q_n->username = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) + return; + init_buf_unistr2(q_n->username, &ptr, user_name); + } + + q_n->level = q_n->ctr.level = file_level; - q_n->file_level = q_n->ctr.switch_value = file_level; q_n->preferred_len = preferred_len; q_n->ctr.ptr_file_info = 1; q_n->ctr.num_entries = 0; @@ -2613,9 +2536,9 @@ void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_u, prs_struct *ps, int depth) { - if (q_n == NULL) + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "srv_io_q_net_file_enum"); @@ -2624,41 +2547,33 @@ BOOL srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_stru if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + if(!prs_pointer("servername", ps, depth, (void*)&q_u->servername, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth)) + if(!prs_pointer("qualifier", ps, depth, (void*)&q_u->qualifier, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) return False; - if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth)) + if(!prs_pointer("username", ps, depth, (void*)&q_u->username, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) return False; - if(!prs_align(ps)) return False; - if(!prs_uint32("file_level", ps, depth, &q_n->file_level)) + + if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (q_n->file_level != (uint32)-1) { - if(!srv_io_srv_file_ctr("file_ctr", &q_n->ctr, ps, depth)) + if (q_u->level != (uint32)-1) { + if(!srv_io_srv_file_ctr("file_ctr", &q_u->ctr, ps, depth)) return False; } - if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) + if(!prs_uint32("preferred_len", ps, depth, &q_u->preferred_len)) return False; - if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) + if(!smb_io_enum_hnd("enum_hnd", &q_u->enum_hnd, ps, depth)) return False; return True; @@ -2679,10 +2594,10 @@ BOOL srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_stru if(!prs_align(ps)) return False; - if(!prs_uint32("file_level", ps, depth, &r_n->file_level)) + if(!prs_uint32("level", ps, depth, &r_n->level)) return False; - if (r_n->file_level != 0) { + if (r_n->level != 0) { if(!srv_io_srv_file_ctr("file_ctr", &r_n->ctr, ps, depth)) return False; } @@ -2703,62 +2618,16 @@ BOOL srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_stru void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, const char *server, uint32 file_id) { - q_n->ptr_srv_name = 1; - init_unistr2(&q_n->uni_srv_name, server, UNI_STR_TERMINATE); - q_n->file_id = file_id; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ -BOOL srv_io_q_net_file_close(const char *desc, SRV_Q_NET_FILE_CLOSE *q_n, - prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_file_close"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("file_id", ps, depth, &q_n->file_id)) - return False; + if ( server ) { + if ( (q_n->servername = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) { + return; + } + init_unistr2(q_n->servername, server, UNI_STR_TERMINATE); + } - return True; + q_n->file_id = file_id; } -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_r_net_file_close(const char *desc, SRV_R_NET_FILE_CLOSE *q_n, - prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_file_close"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &q_n->status)) - return False; - - return True; -} - /******************************************************************* Inits a SRV_INFO_100 structure. ********************************************************************/ @@ -3410,25 +3279,6 @@ BOOL srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_stru return True; } -/******************************************************************* - initialises a structure. - ********************************************************************/ - -BOOL init_srv_q_net_name_validate(SRV_Q_NET_NAME_VALIDATE *q_n, const char *srv_name, const char *share_name, int type) -{ - uint32 ptr_share_name; - - DEBUG(5,("init_srv_q_net_name_validate\n")); - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - init_buf_unistr2(&q_n->uni_name, &ptr_share_name, share_name); - - q_n->type = type; - q_n->flags = 0; - - return True; -} - /******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -3444,16 +3294,13 @@ BOOL srv_io_q_net_name_validate(const char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + if(!prs_pointer("servername", ps, depth, (void*)&q_n->servername, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) return False; if(!prs_align(ps)) return False; - if(!smb_io_unistr2("", &q_n->uni_name, True, ps, depth)) + if(!smb_io_unistr2("", &q_n->sharename, True, ps, depth)) return False; if(!prs_align(ps)) @@ -3663,3 +3510,48 @@ void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server) q_u->ptr_srv_name = 1; init_unistr2(&q_u->uni_srv_name, server, UNI_STR_TERMINATE); } + + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_file_close(const char *desc, SRV_Q_NET_FILE_CLOSE *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_file_close"); + 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_uint32("file_id", ps, depth, &q_u->file_id)) + return False; + + return True; +} + +/******************************************************************* + ********************************************************************/ + +BOOL srv_io_r_net_file_close(const char *desc, SRV_R_NET_FILE_CLOSE *r_n, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "srv_io_r_net_file_close"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index 2cb44c6319..dc4ee3e6e9 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -257,12 +257,12 @@ BOOL svcctl_io_q_open_scmanager(const char *desc, SVCCTL_Q_OPEN_SCMANAGER *q_u, if(!prs_align(ps)) return False; - if(!prs_pointer("servername", ps, depth, (void**)&q_u->servername, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) + 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)) + 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; @@ -486,7 +486,7 @@ BOOL svcctl_io_q_enum_services_status(const char *desc, SVCCTL_Q_ENUM_SERVICES_S if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size)) return False; - if(!prs_pointer("resume", ps, depth, (void**)&q_u->resume, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("resume", ps, depth, (void*)&q_u->resume, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; return True; @@ -517,7 +517,7 @@ BOOL svcctl_io_r_enum_services_status(const char *desc, SVCCTL_R_ENUM_SERVICES_S if(!prs_uint32("returned", ps, depth, &r_u->returned)) return False; - if(!prs_pointer("resume", ps, depth, (void**)&r_u->resume, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("resume", ps, depth, (void*)&r_u->resume, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; if(!prs_werror("status", ps, depth, &r_u->status)) @@ -546,7 +546,7 @@ BOOL svcctl_io_q_start_service(const char *desc, SVCCTL_Q_START_SERVICE *q_u, pr 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) ) + if ( !prs_pointer("rights", ps, depth, (void*)&q_u->parameters, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) return False; return True; @@ -821,9 +821,9 @@ BOOL svcctl_io_service_fa( const char *desc, SERVICE_FAILURE_ACTIONS *fa, RPC_BU if ( !prs_uint32("reset_period", ps, depth, &fa->reset_period) ) return False; - if ( !prs_pointer( desc, ps, depth, (void**)&fa->rebootmsg, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) ) + if ( !prs_pointer( desc, ps, depth, (void*)&fa->rebootmsg, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) ) return False; - if ( !prs_pointer( desc, ps, depth, (void**)&fa->command, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) ) + if ( !prs_pointer( desc, ps, depth, (void*)&fa->command, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) ) return False; if ( !prs_uint32("num_actions", ps, depth, &fa->num_actions) ) diff --git a/source3/rpc_parse/parse_unixinfo.c b/source3/rpc_parse/parse_unixinfo.c new file mode 100644 index 0000000000..391713ce90 --- /dev/null +++ b/source3/rpc_parse/parse_unixinfo.c @@ -0,0 +1,266 @@ +/* + * Unix SMB/CIFS implementation. + * + * RPC Pipe client / server routines + * + * Copyright (C) Volker Lendecke 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 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + +void init_q_unixinfo_sid_to_uid(UNIXINFO_Q_SID_TO_UID *q_d, const DOM_SID *sid) +{ + sid_copy(&q_d->sid, sid); +} + +BOOL unixinfo_io_q_unixinfo_sid_to_uid(const char *desc, UNIXINFO_Q_SID_TO_UID *q_d, + prs_struct *ps, int depth) +{ + return smb_io_dom_sid(desc, &q_d->sid, ps, depth); +} + +BOOL unixinfo_io_r_unixinfo_sid_to_uid(const char *desc, UNIXINFO_R_SID_TO_UID *r_d, + prs_struct *ps, int depth) +{ + if (!prs_uint64(desc, ps, depth, &r_d->uid)) + return False; + + if (!prs_ntstatus(desc, ps, depth, &r_d->status)) + return False; + + return True; +} + +void init_q_unixinfo_uid_to_sid(UNIXINFO_Q_UID_TO_SID *q_d, UINT64_S uid) +{ + q_d->uid = uid; +} + +BOOL unixinfo_io_q_unixinfo_uid_to_sid(const char *desc, UNIXINFO_Q_UID_TO_SID *q_d, + prs_struct *ps, int depth) +{ + return prs_uint64(desc, ps, depth, &q_d->uid); +} + +void init_r_unixinfo_uid_to_sid(UNIXINFO_R_UID_TO_SID *r_d, DOM_SID *sid) +{ + if (sid == NULL) { + r_d->sidptr = 0; + return; + } + r_d->sidptr = 1; + sid_copy(&r_d->sid, sid); +} + +BOOL unixinfo_io_r_unixinfo_uid_to_sid(const char *desc, UNIXINFO_R_UID_TO_SID *r_d, + prs_struct *ps, int depth) +{ + if (!prs_uint32("sidptr", ps, depth, &r_d->sidptr)) + return False; + + if (r_d->sidptr != 0) { + if (!smb_io_dom_sid(desc, &r_d->sid, ps, depth)) + return False; + } + + if (!prs_ntstatus(desc, ps, depth, &r_d->status)) + return False; + + return True; +} + +void init_q_unixinfo_sid_to_gid(UNIXINFO_Q_SID_TO_GID *q_d, const DOM_SID *sid) +{ + sid_copy(&q_d->sid, sid); +} + +BOOL unixinfo_io_q_unixinfo_sid_to_gid(const char *desc, UNIXINFO_Q_SID_TO_GID *q_d, + prs_struct *ps, int depth) +{ + return smb_io_dom_sid(desc, &q_d->sid, ps, depth); +} + +void init_r_unixinfo_sid_to_gid(UNIXINFO_R_SID_TO_GID *r_d, UINT64_S gid) +{ + r_d->gid = gid; + r_d->status = NT_STATUS_OK; +} + +BOOL unixinfo_io_r_unixinfo_sid_to_gid(const char *desc, UNIXINFO_R_SID_TO_GID *r_d, + prs_struct *ps, int depth) +{ + if (!prs_uint64(desc, ps, depth, &r_d->gid)) + return False; + + if (!prs_ntstatus(desc, ps, depth, &r_d->status)) + return False; + + return True; +} + +void init_q_unixinfo_gid_to_sid(UNIXINFO_Q_GID_TO_SID *q_d, UINT64_S gid) +{ + q_d->gid = gid; +} + +BOOL unixinfo_io_q_unixinfo_gid_to_sid(const char *desc, UNIXINFO_Q_GID_TO_SID *q_d, + prs_struct *ps, int depth) +{ + return prs_uint64(desc, ps, depth, &q_d->gid); +} + +void init_r_unixinfo_gid_to_sid(UNIXINFO_R_GID_TO_SID *r_d, DOM_SID *sid) +{ + if (sid == NULL) { + r_d->sidptr = 0; + return; + } + r_d->sidptr = 1; + sid_copy(&r_d->sid, sid); +} + +BOOL unixinfo_io_r_unixinfo_gid_to_sid(const char *desc, UNIXINFO_R_GID_TO_SID *r_d, + prs_struct *ps, int depth) +{ + if (!prs_uint32("sidptr", ps, depth, &r_d->sidptr)) + return False; + + if (r_d->sidptr != 0) { + if (!smb_io_dom_sid(desc, &r_d->sid, ps, depth)) + return False; + } + + if (!prs_ntstatus(desc, ps, depth, &r_d->status)) + return False; + + return True; +} + +void init_q_unixinfo_getpwuid(UNIXINFO_Q_GETPWUID *r_d, int count, + UINT64_S *uids) +{ + r_d->count = count; + r_d->uid = uids; +} + +BOOL unixinfo_io_q_unixinfo_getpwuid(const char *desc, + UNIXINFO_Q_GETPWUID *q_d, + prs_struct *ps, int depth) +{ + uint32 arraysize; + int i; + + if (!prs_uint32("count", ps, depth, &q_d->count)) + return False; + + arraysize = q_d->count; + + if (!prs_uint32("arraysize", ps, depth, &arraysize)) + return False; + + if (arraysize != q_d->count) { + DEBUG(10, ("count!=arraysize\n")); + return False; + } + + if (q_d->count > 1023) { + DEBUG(10, ("Range exceeded\n")); + return False; + } + + if (UNMARSHALLING(ps)) { + q_d->uid = PRS_ALLOC_MEM(ps, UINT64_S, q_d->count); + if (q_d->uid == NULL) { + return False; + } + } + + for (i=0; icount; i++) { + if (!prs_uint64(desc, ps, depth+1, &q_d->uid[i])) + return False; + } + + return True; +} + +void init_r_unixinfo_getpwuid(UNIXINFO_R_GETPWUID *r_d, uint32 count, + struct unixinfo_getpwuid *info) +{ + r_d->count = count; + r_d->info = info; +} + +BOOL unixinfo_io_r_unixinfo_getpwuid(const char *desc, + UNIXINFO_R_GETPWUID *r_d, + prs_struct *ps, int depth) +{ + uint32 arraysize; + int i; + + if (!prs_uint32("count", ps, depth, &r_d->count)) + return False; + + arraysize = r_d->count; + + if (!prs_uint32("arraysize", ps, depth, &arraysize)) + return False; + + if (arraysize != r_d->count) { + DEBUG(10, ("count!=arraysize\n")); + return False; + } + + if (r_d->count > 1023) { + DEBUG(10, ("Range exceeded\n")); + return False; + } + + if (UNMARSHALLING(ps)) { + r_d->info = PRS_ALLOC_MEM(ps, struct unixinfo_getpwuid, + r_d->count); + if (r_d->info == NULL) { + return False; + } + } + + for (i=0; icount; i++) { + if (!prs_align(ps)) + return False; + + if (!prs_ntstatus("status", ps, depth+1, &r_d->info[i].status)) + return False; + + if (!prs_string_alloc("homedir", ps, depth+1, + &r_d->info[i].homedir)) + return False; + + if (!prs_string_alloc("shell", ps, depth+1, + &r_d->info[i].shell)) + return False; + } + + if (!prs_align(ps)) + return False; + + if (!prs_ntstatus(desc, ps, depth, &r_d->status)) + return False; + + return True; +} -- cgit From 8cfb182bdbfb1c820c472f787ff7888a9d79c2a5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 19 Jul 2006 15:05:06 +0000 Subject: r17136: Fix alignment on lsaquery. This broke in particular level 6, where the client tried to figure out which role we are. Needs to go into 23a. Thanks to Karolin for insisting and setting up the test case :-) Volker (This used to be commit 3482bb1ef57e60397df8dcf1b29999161359c42a) --- source3/rpc_parse/parse_lsa.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 919b7c3955..bd83dabed7 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -986,6 +986,9 @@ static BOOL lsa_io_query_info_ctr(const char *desc, prs_struct *ps, int depth, L 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)) -- cgit From e23781b3b304d1e69ad80af5ae9c0ed8d02cf996 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 30 Jul 2006 16:36:56 +0000 Subject: r17316: More C++ warnings -- 456 left (This used to be commit 1e4ee728df7eeafc1b4d533240acb032f73b4f5c) --- source3/rpc_parse/parse_misc.c | 8 +++++--- source3/rpc_parse/parse_prs.c | 13 +++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index cb7c06eb45..532b7ccc7f 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -518,7 +518,7 @@ BOOL smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth) size_t create_rpc_blob(RPC_DATA_BLOB *str, size_t len) { - str->buffer = TALLOC_ZERO(get_talloc_ctx(), len); + str->buffer = (uint8 *)TALLOC_ZERO(get_talloc_ctx(), len); if (str->buffer == NULL) smb_panic("create_rpc_blob: talloc fail\n"); return len; @@ -617,7 +617,8 @@ void init_regval_buffer(REGVAL_BUFFER *str, const uint8 *buf, size_t len) if (buf != NULL) { SMB_ASSERT(str->buf_max_len >= str->buf_len); - str->buffer = TALLOC_ZERO(get_talloc_ctx(), str->buf_max_len); + str->buffer = (uint16 *)TALLOC_ZERO(get_talloc_ctx(), + str->buf_max_len); if (str->buffer == NULL) smb_panic("init_regval_buffer: talloc fail\n"); memcpy(str->buffer, buf, str->buf_len); @@ -723,7 +724,8 @@ void init_string2(STRING2 *str, const char *buf, size_t max_len, size_t str_len) /* store the string */ if(str_len != 0) { - str->buffer = TALLOC_ZERO(get_talloc_ctx(), str->str_max_len); + str->buffer = (uint8 *)TALLOC_ZERO(get_talloc_ctx(), + str->str_max_len); if (str->buffer == NULL) smb_panic("init_string2: malloc fail\n"); memcpy(str->buffer, buf, str_len); diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 29a3e60aa9..820565f09f 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -158,7 +158,8 @@ char *prs_alloc_mem(prs_struct *ps, size_t size, unsigned int count) if (size) { /* We can't call the type-safe version here. */ - ret = _talloc_zero_array(ps->mem_ctx, size, count, "parse_prs"); + ret = (char *)_talloc_zero_array(ps->mem_ctx, size, count, + "parse_prs"); } return ret; } @@ -213,7 +214,7 @@ BOOL prs_set_buffer_size(prs_struct *ps, uint32 newsize) if (newsize == 0) { SAFE_FREE(ps->data_p); } else { - ps->data_p = SMB_REALLOC(ps->data_p, newsize); + ps->data_p = (char *)SMB_REALLOC(ps->data_p, newsize); if (ps->data_p == NULL) { DEBUG(0,("prs_set_buffer_size: Realloc failure for size %u.\n", @@ -265,7 +266,7 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) new_size = MAX(RPC_MAX_PDU_FRAG_LEN,extra_space); - if((ps->data_p = SMB_MALLOC(new_size)) == NULL) { + if((ps->data_p = (char *)SMB_MALLOC(new_size)) == NULL) { DEBUG(0,("prs_grow: Malloc failure for size %u.\n", (unsigned int)new_size)); return False; } @@ -277,7 +278,7 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) */ new_size = MAX(ps->buffer_size*2, ps->buffer_size + extra_space); - if ((ps->data_p = SMB_REALLOC(ps->data_p, new_size)) == NULL) { + if ((ps->data_p = (char *)SMB_REALLOC(ps->data_p, new_size)) == NULL) { DEBUG(0,("prs_grow: Realloc failure for size %u.\n", (unsigned int)new_size)); return False; @@ -306,7 +307,7 @@ BOOL prs_force_grow(prs_struct *ps, uint32 extra_space) return False; } - if((ps->data_p = SMB_REALLOC(ps->data_p, new_size)) == NULL) { + if((ps->data_p = (char *)SMB_REALLOC(ps->data_p, new_size)) == NULL) { DEBUG(0,("prs_force_grow: Realloc failure for size %u.\n", (unsigned int)new_size)); return False; @@ -1816,7 +1817,7 @@ return the contents of a prs_struct in a DATA_BLOB BOOL prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) { blob->length = prs_offset(prs); - blob->data = talloc_zero_size(mem_ctx, blob->length); + blob->data = (uint8 *)talloc_zero_size(mem_ctx, blob->length); if (!prs_copy_all_data_out((char *)blob->data, prs)) return False; -- cgit From 467ec2a32bac08468855a5a28a7d6e25b26904d5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 1 Aug 2006 12:45:12 +0000 Subject: r17363: Some C++ warnings (This used to be commit fd82f185a2e0f94bfb75f4eee072556ad94bf27d) --- source3/rpc_parse/parse_buffer.c | 3 ++- source3/rpc_parse/parse_dfs.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index 21dddfa3cf..5643189afe 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -319,7 +319,8 @@ BOOL smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16 /* Yes this should be malloc not talloc. Don't change. */ - chaine.buffer = SMB_MALLOC((q-p+1)*sizeof(uint16)); + chaine.buffer = (uint16 *) + SMB_MALLOC((q-p+1)*sizeof(uint16)); if (chaine.buffer == NULL) return False; diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index f1d0705302..fb0d2fe5a7 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -325,7 +325,7 @@ BOOL netdfs_io_dfs_Info3_d(const char *desc, NETDFS_DFS_INFO3 *v, prs_struct *ps return False; if (UNMARSHALLING(ps)) { - v->stores = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->stores)*v->num_stores); + v->stores = (NETDFS_DFS_STORAGEINFO *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->stores)*v->num_stores); } for (i_stores_1=0; i_stores_1num_stores;i_stores_1++) { if (!netdfs_io_dfs_StorageInfo_p("stores", &v->stores[i_stores_1], ps, depth)) @@ -447,7 +447,7 @@ BOOL netdfs_io_dfs_Info4_d(const char *desc, NETDFS_DFS_INFO4 *v, prs_struct *ps return False; if (UNMARSHALLING(ps)) { - v->stores = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->stores)*v->num_stores); + v->stores = (NETDFS_DFS_STORAGEINFO *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->stores)*v->num_stores); } for (i_stores_1=0; i_stores_1num_stores;i_stores_1++) { if (!netdfs_io_dfs_StorageInfo_p("stores", &v->stores[i_stores_1], ps, depth)) @@ -920,7 +920,7 @@ BOOL netdfs_io_dfs_EnumArray1_d(const char *desc, NETDFS_DFS_ENUMARRAY1 *v, prs_ return False; if (UNMARSHALLING(ps)) { - v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); + v->s = (NETDFS_DFS_INFO1 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); } for (i_s_1=0; i_s_1count;i_s_1++) { if (!netdfs_io_dfs_Info1_p("s", &v->s[i_s_1], ps, depth)) @@ -986,7 +986,7 @@ BOOL netdfs_io_dfs_EnumArray2_d(const char *desc, NETDFS_DFS_ENUMARRAY2 *v, prs_ return False; if (UNMARSHALLING(ps)) { - v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); + v->s = (NETDFS_DFS_INFO2 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); } for (i_s_1=0; i_s_1count;i_s_1++) { if (!netdfs_io_dfs_Info2_p("s", &v->s[i_s_1], ps, depth)) @@ -1052,7 +1052,7 @@ BOOL netdfs_io_dfs_EnumArray3_d(const char *desc, NETDFS_DFS_ENUMARRAY3 *v, prs_ return False; if (UNMARSHALLING(ps)) { - v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); + v->s = (NETDFS_DFS_INFO3 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); } for (i_s_1=0; i_s_1count;i_s_1++) { if (!netdfs_io_dfs_Info3_p("s", &v->s[i_s_1], ps, depth)) @@ -1118,7 +1118,7 @@ BOOL netdfs_io_dfs_EnumArray4_d(const char *desc, NETDFS_DFS_ENUMARRAY4 *v, prs_ return False; if (UNMARSHALLING(ps)) { - v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); + v->s = (NETDFS_DFS_INFO4 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); } for (i_s_1=0; i_s_1count;i_s_1++) { if (!netdfs_io_dfs_Info4_p("s", &v->s[i_s_1], ps, depth)) @@ -1184,7 +1184,7 @@ BOOL netdfs_io_dfs_EnumArray200_d(const char *desc, NETDFS_DFS_ENUMARRAY200 *v, return False; if (UNMARSHALLING(ps)) { - v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); + v->s = (NETDFS_DFS_INFO200 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); } for (i_s_1=0; i_s_1count;i_s_1++) { if (!netdfs_io_dfs_Info200_p("s", &v->s[i_s_1], ps, depth)) @@ -1250,7 +1250,7 @@ BOOL netdfs_io_dfs_EnumArray300_d(const char *desc, NETDFS_DFS_ENUMARRAY300 *v, return False; if (UNMARSHALLING(ps)) { - v->s = (void *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); + v->s = (NETDFS_DFS_INFO300 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); } for (i_s_1=0; i_s_1count;i_s_1++) { if (!netdfs_io_dfs_Info300_p("s", &v->s[i_s_1], ps, depth)) -- cgit From 11673dc07a137e911de3920f0ee6717b365f2ab4 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 8 Aug 2006 11:00:16 +0000 Subject: r17453: Fix msdfs RPC management (this broke with the autogenerated dfs rpcs). * Remove "unknown" from dfs_Enum (samba4 dfs IDL updates to follow). * When encountering an unsupported infolevel the rpc server must reply with a dfs_info_0 structure and WERR_OK (observed from w2k3 when talking to nt4). Guenther (This used to be commit f9bef1f08f7d2a4c95c28329ac73e8646f033998) --- source3/rpc_parse/parse_dfs.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index fb0d2fe5a7..acf80c6dbd 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -1862,7 +1862,7 @@ BOOL netdfs_io_r_dfs_GetInfo(const char *desc, NETDFS_R_DFS_GETINFO *v, prs_stru return True; } -BOOL init_netdfs_q_dfs_Enum(NETDFS_Q_DFS_ENUM *v, uint32 level, uint32 bufsize, NETDFS_DFS_ENUMSTRUCT *info, uint32 *unknown, uint32 *total) +BOOL init_netdfs_q_dfs_Enum(NETDFS_Q_DFS_ENUM *v, uint32 level, uint32 bufsize, NETDFS_DFS_ENUMSTRUCT *info, uint32 *total) { DEBUG(5,("init_netdfs_q_dfs_Enum\n")); @@ -1877,13 +1877,6 @@ BOOL init_netdfs_q_dfs_Enum(NETDFS_Q_DFS_ENUM *v, uint32 level, uint32 bufsize, v->ptr0_info = 0; } - if (unknown) { - v->ptr0_unknown = 1; - v->unknown = *unknown; - } else { - v->ptr0_unknown = 0; - } - if (total) { v->ptr0_total = 1; v->total = *total; @@ -1917,17 +1910,6 @@ BOOL netdfs_io_q_dfs_Enum(const char *desc, NETDFS_Q_DFS_ENUM *v, prs_struct *ps return False; } - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("ptr0_unknown", ps, depth, &v->ptr0_unknown)) - return False; - - if (v->ptr0_unknown) { - if (!prs_uint32("unknown", ps, depth, &v->unknown)) - return False; - } - if (!prs_align_custom(ps, 4)) return False; -- cgit From 72c605b4fc518b498688ec032004fded0d2250d7 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 8 Aug 2006 11:45:57 +0000 Subject: r17454: Adding dfs_EnumEx for rpcclient (Samba4 IDL to follow). Guenther (This used to be commit 8c1198c1592e7c07904b448ed7a54b9b23c941df) --- source3/rpc_parse/parse_dfs.c | 90 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index acf80c6dbd..6d439632ba 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -2569,9 +2569,32 @@ BOOL netdfs_io_r_dfs_Remove2(const char *desc, NETDFS_R_DFS_REMOVE2 *v, prs_stru return True; } -BOOL init_netdfs_q_dfs_EnumEx(NETDFS_Q_DFS_ENUMEX *v) +BOOL init_netdfs_q_dfs_EnumEx(NETDFS_Q_DFS_ENUMEX *v, uint32 level, uint32 bufsize, NETDFS_DFS_ENUMSTRUCT *info, uint32 *total, const char *dfs_name) { DEBUG(5,("init_netdfs_q_dfs_EnumEx\n")); + + if (!dfs_name) + return False; + + init_unistr2(&v->dfs_name, dfs_name, UNI_FLAGS_NONE|UNI_STR_TERMINATE); + + v->level = level; + + v->bufsize = bufsize; + + if (info) { + v->ptr0_info = 1; + v->info = *info; + } else { + v->ptr0_info = 0; + } + + if (total) { + v->ptr0_total = 1; + v->total = *total; + } else { + v->ptr0_total = 0; + } return True; } @@ -2583,6 +2606,42 @@ BOOL netdfs_io_q_dfs_EnumEx(const char *desc, NETDFS_Q_DFS_ENUMEX *v, prs_struct prs_debug(ps, depth, desc, "netdfs_io_q_dfs_EnumEx"); depth++; + if (!prs_align_custom(ps, 4)) + return False; + + if (!smb_io_unistr2("dfs_name", &v->dfs_name, 1, ps, depth)) + return False; + + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("level", ps, depth, &v->level)) + return False; + + if (!prs_uint32("bufsize", ps, depth, &v->bufsize)) + return False; + + if (!prs_uint32("ptr0_info", ps, depth, &v->ptr0_info)) + return False; + + if (v->ptr0_info) { + if (!netdfs_io_dfs_EnumStruct_p("info", &v->info, ps, depth)) + return False; + if (!netdfs_io_dfs_EnumStruct_d("info", &v->info, ps, depth)) + return False; + } + + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("ptr0_total", ps, depth, &v->ptr0_total)) + return False; + + if (v->ptr0_total) { + if (!prs_uint32("total", ps, depth, &v->total)) + return False; + } + return True; } @@ -2602,6 +2661,35 @@ BOOL netdfs_io_r_dfs_EnumEx(const char *desc, NETDFS_R_DFS_ENUMEX *v, prs_struct prs_debug(ps, depth, desc, "netdfs_io_r_dfs_EnumEx"); depth++; + if (!prs_uint32("ptr0_info", ps, depth, &v->ptr0_info)) + return False; + + if (v->ptr0_info) { + if (!netdfs_io_dfs_EnumStruct_p("info", &v->info, ps, depth)) + return False; + if (!netdfs_io_dfs_EnumStruct_d("info", &v->info, ps, depth)) + return False; + } + + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_uint32("ptr0_total", ps, depth, &v->ptr0_total)) + return False; + + if (v->ptr0_total) { + if (!prs_uint32("total", ps, depth, &v->total)) + return False; + } + + if (!prs_align_custom(ps, 4)) + return False; + + if (!prs_werror("status", ps, depth, &v->status)) + return False; + + return True; + if (!prs_werror("status", ps, depth, &v->status)) return False; -- cgit From 4d6b8ac0872a98aedf0c799f90b2620377386516 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 28 Aug 2006 05:27:30 +0000 Subject: r17877: Make it explicit to the checker that we can never pass in NULL as ctr to a void returning fn. Jeremy. (This used to be commit 397ab2b1ab72093ba0572493b2e97a93dfc75478) --- source3/rpc_parse/parse_samr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 26da7b426d..f42af48456 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6895,8 +6895,7 @@ void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u, q_u->switch_value = switch_value; q_u->ctr = ctr; - if (q_u->ctr != NULL) - q_u->ctr->switch_value = switch_value; + q_u->ctr->switch_value = switch_value; switch (switch_value) { case 18: -- cgit From 6655e1e997fa96408ce257f1c96773db4551f69f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 4 Sep 2006 09:51:47 +0000 Subject: r18029: More C++ stuff (This used to be commit 089b51e28cc5e3674e4edf5464c7a15673c5ec0f) --- source3/rpc_parse/parse_prs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 820565f09f..e348ef460d 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1626,7 +1626,7 @@ void schannel_encode(struct schannel_auth_struct *a, enum pipe_auth_level auth_l uchar digest_final[16]; uchar confounder[8]; uchar seq_num[8]; - static const uchar nullbytes[8]; + static const uchar nullbytes[8] = { 0, }; static const uchar schannel_seal_sig[8] = SCHANNEL_SEAL_SIGNATURE; static const uchar schannel_sign_sig[8] = SCHANNEL_SIGN_SIGNATURE; -- cgit From f8a17bd8bdbb52b200671e7ed52ffd982419f3f6 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 4 Sep 2006 19:47:48 +0000 Subject: r18047: More C++ stuff (This used to be commit 86f4ca84f2df2aa8977eb24828e3aa840dda7201) --- source3/rpc_parse/parse_dfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c index 6d439632ba..f246e2f254 100644 --- a/source3/rpc_parse/parse_dfs.c +++ b/source3/rpc_parse/parse_dfs.c @@ -2576,7 +2576,7 @@ BOOL init_netdfs_q_dfs_EnumEx(NETDFS_Q_DFS_ENUMEX *v, uint32 level, uint32 bufsi if (!dfs_name) return False; - init_unistr2(&v->dfs_name, dfs_name, UNI_FLAGS_NONE|UNI_STR_TERMINATE); + init_unistr2(&v->dfs_name, dfs_name, UNI_STR_TERMINATE); v->level = level; -- cgit From 995205fc60f87e1a02aa1c6f309db55ae18e908a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 6 Sep 2006 18:32:20 +0000 Subject: r18188: merge 3.0-libndr branch (This used to be commit 1115745caed3093c25d6be01ffee21819fb0a675) --- source3/rpc_parse/parse_misc.c | 28 +++++++++++++++++++++++----- source3/rpc_parse/parse_net.c | 5 ++--- source3/rpc_parse/parse_samr.c | 27 +++++++++------------------ source3/rpc_parse/parse_spoolss.c | 4 +--- source3/rpc_parse/parse_unixinfo.c | 10 +++++----- 5 files changed, 40 insertions(+), 34 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 532b7ccc7f..541d2d771f 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -115,6 +115,7 @@ static BOOL smb_io_utime(const char *desc, UTIME *t, prs_struct *ps, int depth) BOOL smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth) { + uint32 low, high; if (nttime == NULL) return False; @@ -124,11 +125,13 @@ BOOL smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth) if(!prs_align(ps)) return False; - if(!prs_uint32("low ", ps, depth, &nttime->low)) /* low part */ + if(!prs_uint32("low ", ps, depth, &low)) /* low part */ return False; - if(!prs_uint32("high", ps, depth, &nttime->high)) /* high part */ + if(!prs_uint32("high", ps, depth, &high)) /* high part */ return False; + *nttime = (((uint64_t)high << 32) + low); + return True; } @@ -1762,10 +1765,25 @@ BOOL smb_io_unistr3(const char *desc, UNISTR3 *name, prs_struct *ps, int depth) /******************************************************************* Stream a uint64_struct ********************************************************************/ -BOOL prs_uint64(const char *name, prs_struct *ps, int depth, UINT64_S *data64) +BOOL prs_uint64(const char *name, prs_struct *ps, int depth, uint64 *data64) { - return prs_uint32(name, ps, depth+1, &data64->low) && - prs_uint32(name, ps, depth+1, &data64->high); + if (UNMARSHALLING(ps)) { + uint32 high, low; + + if (!prs_uint32(name, ps, depth+1, &low)) + return False; + + if (!prs_uint32(name, ps, depth+1, &high)) + return False; + + *data64 = ((uint64_t)high << 32) + low; + + return True; + } else { + uint32 high = (*data64) >> 32, low = (*data64) & 0xFFFFFFFF; + return prs_uint32(name, ps, depth+1, &low) && + prs_uint32(name, ps, depth+1, &high); + } } /******************************************************************* diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index cecec31410..5fbf9874a0 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -3104,7 +3104,7 @@ 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_S dom_mod_count) + uint32 database_id, uint64 dom_mod_count) { DEBUG(5, ("init_net_q_sam_deltas\n")); @@ -3115,8 +3115,7 @@ BOOL init_net_q_sam_deltas(NET_Q_SAM_DELTAS *q_s, const char *srv_name, memset(&q_s->ret_creds, 0, sizeof(q_s->ret_creds)); q_s->database_id = database_id; - q_s->dom_mod_count.low = dom_mod_count.low; - q_s->dom_mod_count.high = dom_mod_count.high; + q_s->dom_mod_count = dom_mod_count; q_s->max_size = 0xffff; return True; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index f42af48456..a8b153b9fa 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -511,12 +511,10 @@ void init_unk_info1(SAM_UNK_INFO_1 *u_1, uint16 min_pass_len, uint16 pass_hist, u_1->password_properties = password_properties; /* password never expire */ - u_1->expire.high = nt_expire.high; - u_1->expire.low = nt_expire.low; + u_1->expire = nt_expire; /* can change the password now */ - u_1->min_passwordage.high = nt_min_age.high; - u_1->min_passwordage.low = nt_min_age.low; + u_1->min_passwordage = nt_min_age; } @@ -555,11 +553,9 @@ 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.low = nt_logout.low; - u_2->logout.high = nt_logout.high; + u_2->logout = nt_logout; - u_2->seq_num.low = seq_num; - u_2->seq_num.high = 0x00000000; + u_2->seq_num = seq_num; u_2->unknown_4 = 0x00000001; @@ -635,8 +631,7 @@ inits a structure. void init_unk_info3(SAM_UNK_INFO_3 *u_3, NTTIME nt_logout) { - u_3->logout.low = nt_logout.low; - u_3->logout.high = nt_logout.high; + u_3->logout = nt_logout; } /******************************************************************* @@ -789,8 +784,7 @@ 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.low = seq_num; - u_8->seq_num.high = 0x0000; + u_8->seq_num = seq_num; } /******************************************************************* @@ -849,10 +843,8 @@ 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.low = nt_lock_duration.low; - u_12->duration.high = nt_lock_duration.high; - u_12->reset_count.low = nt_reset_time.low; - u_12->reset_count.high = nt_reset_time.high; + u_12->duration = nt_lock_duration; + u_12->reset_count = nt_reset_time; u_12->bad_attempt_lockout = lockout; } @@ -887,8 +879,7 @@ 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.low = seq_num; - u_13->seq_num.high = 0x0000; + u_13->seq_num = seq_num; u_13->unknown1 = 0; u_13->unknown2 = 0; } diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 8d4a757a74..ec64e10a59 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2643,9 +2643,7 @@ BOOL smb_io_printer_driver_info_6(const char *desc, RPC_BUFFER *buffer, DRIVER_I if (!smb_io_relarraystr("previousdrivernames", buffer, depth, &info->previousdrivernames)) return False; - if (!prs_uint32("date.low", ps, depth, &info->driver_date.low)) - return False; - if (!prs_uint32("date.high", ps, depth, &info->driver_date.high)) + if (!prs_uint64("date", ps, depth, &info->driver_date)) return False; if (!prs_uint32("padding", ps, depth, &info->padding)) diff --git a/source3/rpc_parse/parse_unixinfo.c b/source3/rpc_parse/parse_unixinfo.c index 391713ce90..72e0d392ec 100644 --- a/source3/rpc_parse/parse_unixinfo.c +++ b/source3/rpc_parse/parse_unixinfo.c @@ -48,7 +48,7 @@ BOOL unixinfo_io_r_unixinfo_sid_to_uid(const char *desc, UNIXINFO_R_SID_TO_UID * return True; } -void init_q_unixinfo_uid_to_sid(UNIXINFO_Q_UID_TO_SID *q_d, UINT64_S uid) +void init_q_unixinfo_uid_to_sid(UNIXINFO_Q_UID_TO_SID *q_d, uint64 uid) { q_d->uid = uid; } @@ -97,7 +97,7 @@ BOOL unixinfo_io_q_unixinfo_sid_to_gid(const char *desc, UNIXINFO_Q_SID_TO_GID * return smb_io_dom_sid(desc, &q_d->sid, ps, depth); } -void init_r_unixinfo_sid_to_gid(UNIXINFO_R_SID_TO_GID *r_d, UINT64_S gid) +void init_r_unixinfo_sid_to_gid(UNIXINFO_R_SID_TO_GID *r_d, uint64 gid) { r_d->gid = gid; r_d->status = NT_STATUS_OK; @@ -115,7 +115,7 @@ BOOL unixinfo_io_r_unixinfo_sid_to_gid(const char *desc, UNIXINFO_R_SID_TO_GID * return True; } -void init_q_unixinfo_gid_to_sid(UNIXINFO_Q_GID_TO_SID *q_d, UINT64_S gid) +void init_q_unixinfo_gid_to_sid(UNIXINFO_Q_GID_TO_SID *q_d, uint64 gid) { q_d->gid = gid; } @@ -154,7 +154,7 @@ BOOL unixinfo_io_r_unixinfo_gid_to_sid(const char *desc, UNIXINFO_R_GID_TO_SID * } void init_q_unixinfo_getpwuid(UNIXINFO_Q_GETPWUID *r_d, int count, - UINT64_S *uids) + uint64 *uids) { r_d->count = count; r_d->uid = uids; @@ -186,7 +186,7 @@ BOOL unixinfo_io_q_unixinfo_getpwuid(const char *desc, } if (UNMARSHALLING(ps)) { - q_d->uid = PRS_ALLOC_MEM(ps, UINT64_S, q_d->count); + q_d->uid = PRS_ALLOC_MEM(ps, uint64, q_d->count); if (q_d->uid == NULL) { return False; } -- cgit From 2b27c93a9a8471693d7dcb5fdbe8afe65b22ff66 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 8 Sep 2006 14:28:06 +0000 Subject: r18271: Big change: * autogenerate lsa ndr code * rename 'enum SID_NAME_USE' to 'enum lsa_SidType' * merge a log more security descriptor functions from gen_ndr/ndr_security.c in SAMBA_4_0 The most embarassing thing is the "#define strlen_m strlen" We need a real implementation in SAMBA_3_0 which I'll work on after this code is in. (This used to be commit 3da9f80c28b1e75ef6d46d38fbb81ade6b9fa951) --- source3/rpc_parse/parse_samr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a8b153b9fa..eda3c428a9 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4887,7 +4887,7 @@ 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 SID_NAME_USE *type, + uint32 *rid, enum lsa_SidType *type, NTSTATUS status) { DEBUG(5, ("init_samr_r_lookup_names\n")); -- cgit From 6d9b02df7144861765a243f03f5e87c2e3c42209 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 11 Sep 2006 07:55:51 +0000 Subject: r18369: I've got a sniff where NT4 sends just a single byte after the 516 byte password blob, it seems that pw_len is just a uint8 instead of uint16. This might also be interesting for Samba4's samr.idl. Volker (This used to be commit 68ded4ba07703a20b046e4a58e7a746a78fcedf5) --- source3/rpc_parse/parse_samr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index eda3c428a9..58ba3e8689 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5578,7 +5578,8 @@ static BOOL sam_io_user_info17(const char *desc, SAM_USER_INFO_17 * usr, init_sam_user_infoa *************************************************************************/ -void init_sam_user_info24(SAM_USER_INFO_24 * usr, char newpass[516], uint16 pw_len) +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)); @@ -5606,10 +5607,10 @@ static BOOL sam_io_user_info24(const char *desc, SAM_USER_INFO_24 * usr, return False; if (MARSHALLING(ps) && (usr->pw_len != 0)) { - if (!prs_uint16("pw_len", ps, depth, &usr->pw_len)) + if (!prs_uint8("pw_len", ps, depth, &usr->pw_len)) return False; } else if (UNMARSHALLING(ps)) { - if (!prs_uint16("pw_len", ps, depth, &usr->pw_len)) + if (!prs_uint8("pw_len", ps, depth, &usr->pw_len)) return False; } -- cgit From 8fad1d204edd6c10380bfa5d72ec7060e34ccdb9 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 11 Sep 2006 19:32:55 +0000 Subject: r18393: get the data size and not offset when initializing a data blob from a prs structure (This used to be commit 878fd68dfcb237f5332efcf48a3891abcc9ad53c) --- source3/rpc_parse/parse_prs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index e348ef460d..d97b1b0dff 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1816,8 +1816,11 @@ return the contents of a prs_struct in a DATA_BLOB ********************************************************************/ BOOL prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) { - blob->length = prs_offset(prs); + blob->length = prs_data_size(prs); blob->data = (uint8 *)talloc_zero_size(mem_ctx, blob->length); + + /* set the pointer at the end of the buffer */ + prs_set_offset( prs, prs_data_size(prs) ); if (!prs_copy_all_data_out((char *)blob->data, prs)) return False; -- cgit From 5e1146ab5845169aba57dcd216f88589276e5df8 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 11 Sep 2006 22:02:34 +0000 Subject: r18404: * swap from POLICY_HND to the struct policy_handle from ndr/misc.h * move OUR_HANDLE macro to include/rpc_misc.h (This used to be commit 2b37079af2f569df7a58878150a61980c6fe06ee) --- source3/rpc_parse/parse_misc.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 541d2d771f..ef4d0e7689 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1695,15 +1695,9 @@ BOOL smb_io_pol_hnd(const char *desc, POLICY_HND *pol, prs_struct *ps, int depth if(UNMARSHALLING(ps)) ZERO_STRUCTP(pol); - if (!prs_uint32("data1", ps, depth, &pol->data1)) + if (!prs_uint32("handle_type", ps, depth, &pol->handle_type)) return False; - if (!prs_uint32("data2", ps, depth, &pol->data2)) - return False; - if (!prs_uint16("data3", ps, depth, &pol->data3)) - return False; - if (!prs_uint16("data4", ps, depth, &pol->data4)) - return False; - if(!prs_uint8s (False, "data5", ps, depth, pol->data5, sizeof(pol->data5))) + if (!smb_io_uuid("uuid", (struct uuid*)&pol->uuid, ps, depth)) return False; return True; -- cgit From 48e2a2bfb75cdc914345b498012e82331546f0c0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 13 Sep 2006 16:28:25 +0000 Subject: r18481: Use pidl-generated server side code for dfs. (This used to be commit 3f337c104d42321595161d0283b39357df252a8e) --- source3/rpc_parse/parse_dfs.c | 2737 ----------------------------------------- 1 file changed, 2737 deletions(-) delete mode 100644 source3/rpc_parse/parse_dfs.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_dfs.c b/source3/rpc_parse/parse_dfs.c deleted file mode 100644 index f246e2f254..0000000000 --- a/source3/rpc_parse/parse_dfs.c +++ /dev/null @@ -1,2737 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * parser auto-generated by pidl. DO NOT MODIFY! - */ - -#include "includes.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_RPC_PARSE - -/* netdfs structures */ -BOOL init_netdfs_dfs_Info0(NETDFS_DFS_INFO0 *v) -{ - DEBUG(5,("init_netdfs_dfs_Info0\n")); - - return True; -} - -BOOL netdfs_io_dfs_Info0_p(const char *desc, NETDFS_DFS_INFO0 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info0_p"); - depth++; - return True; -} - -BOOL netdfs_io_dfs_Info0_d(const char *desc, NETDFS_DFS_INFO0 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info0_d"); - depth++; - return True; -} - -BOOL init_netdfs_dfs_Info1(NETDFS_DFS_INFO1 *v, const char *path) -{ - DEBUG(5,("init_netdfs_dfs_Info1\n")); - - if (path) { - v->ptr0_path = 1; - init_unistr2(&v->path, path, UNI_FLAGS_NONE); - } else { - v->ptr0_path = 0; - } - - return True; -} - -BOOL netdfs_io_dfs_Info1_p(const char *desc, NETDFS_DFS_INFO1 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info1_p"); - depth++; - if (!prs_uint32("ptr0_path", ps, depth, &v->ptr0_path)) - return False; - - - return True; -} - -BOOL netdfs_io_dfs_Info1_d(const char *desc, NETDFS_DFS_INFO1 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info1_d"); - depth++; - if (v->ptr0_path) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("path", &v->path, 1, ps, depth)) - return False; - } - - return True; -} - -BOOL init_netdfs_dfs_Info2(NETDFS_DFS_INFO2 *v, const char *path, const char *comment, uint32 state, uint32 num_stores) -{ - DEBUG(5,("init_netdfs_dfs_Info2\n")); - - if (path) { - v->ptr0_path = 1; - init_unistr2(&v->path, path, UNI_FLAGS_NONE); - } else { - v->ptr0_path = 0; - } - - if (comment) { - v->ptr0_comment = 1; - init_unistr2(&v->comment, comment, UNI_FLAGS_NONE); - } else { - v->ptr0_comment = 0; - } - - v->state = state; - - v->num_stores = num_stores; - - return True; -} - -BOOL netdfs_io_dfs_Info2_p(const char *desc, NETDFS_DFS_INFO2 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info2_p"); - depth++; - if (!prs_uint32("ptr0_path", ps, depth, &v->ptr0_path)) - return False; - - - if (!prs_uint32("ptr0_comment", ps, depth, &v->ptr0_comment)) - return False; - - - if (!prs_uint32("state", ps, depth, &v->state)) - return False; - - if (!prs_uint32("num_stores", ps, depth, &v->num_stores)) - return False; - - return True; -} - -BOOL netdfs_io_dfs_Info2_d(const char *desc, NETDFS_DFS_INFO2 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info2_d"); - depth++; - if (v->ptr0_path) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("path", &v->path, 1, ps, depth)) - return False; - } - - if (v->ptr0_comment) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("comment", &v->comment, 1, ps, depth)) - return False; - } - - - - return True; -} - -BOOL init_netdfs_dfs_StorageInfo(NETDFS_DFS_STORAGEINFO *v, uint32 state, const char *server, const char *share) -{ - DEBUG(5,("init_netdfs_dfs_StorageInfo\n")); - - v->state = state; - - if (server) { - v->ptr0_server = 1; - init_unistr2(&v->server, server, UNI_FLAGS_NONE); - } else { - v->ptr0_server = 0; - } - - if (share) { - v->ptr0_share = 1; - init_unistr2(&v->share, share, UNI_FLAGS_NONE); - } else { - v->ptr0_share = 0; - } - - return True; -} - -BOOL netdfs_io_dfs_StorageInfo_p(const char *desc, NETDFS_DFS_STORAGEINFO *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_StorageInfo_p"); - depth++; - if (!prs_uint32("state", ps, depth, &v->state)) - return False; - - if (!prs_uint32("ptr0_server", ps, depth, &v->ptr0_server)) - return False; - - - if (!prs_uint32("ptr0_share", ps, depth, &v->ptr0_share)) - return False; - - - return True; -} - -BOOL netdfs_io_dfs_StorageInfo_d(const char *desc, NETDFS_DFS_STORAGEINFO *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_StorageInfo_d"); - depth++; - - if (v->ptr0_server) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("server", &v->server, 1, ps, depth)) - return False; - } - - if (v->ptr0_share) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("share", &v->share, 1, ps, depth)) - return False; - } - - return True; -} - -BOOL init_netdfs_dfs_Info3(NETDFS_DFS_INFO3 *v, const char *path, const char *comment, uint32 state, uint32 num_stores, NETDFS_DFS_STORAGEINFO **stores) -{ - DEBUG(5,("init_netdfs_dfs_Info3\n")); - - if (path) { - v->ptr0_path = 1; - init_unistr2(&v->path, path, UNI_FLAGS_NONE); - } else { - v->ptr0_path = 0; - } - - if (comment) { - v->ptr0_comment = 1; - init_unistr2(&v->comment, comment, UNI_FLAGS_NONE); - } else { - v->ptr0_comment = 0; - } - - v->state = state; - - v->num_stores = num_stores; - - if (stores) { - v->ptr0_stores = 1; - v->stores = *stores; - } else { - v->ptr0_stores = 0; - } - - return True; -} - -BOOL netdfs_io_dfs_Info3_p(const char *desc, NETDFS_DFS_INFO3 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info3_p"); - depth++; - if (!prs_uint32("ptr0_path", ps, depth, &v->ptr0_path)) - return False; - - - if (!prs_uint32("ptr0_comment", ps, depth, &v->ptr0_comment)) - return False; - - - if (!prs_uint32("state", ps, depth, &v->state)) - return False; - - if (!prs_uint32("num_stores", ps, depth, &v->num_stores)) - return False; - - if (!prs_uint32("ptr0_stores", ps, depth, &v->ptr0_stores)) - return False; - - - return True; -} - -BOOL netdfs_io_dfs_Info3_d(const char *desc, NETDFS_DFS_INFO3 *v, prs_struct *ps, int depth) -{ - uint32 i_stores_1; - - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info3_d"); - depth++; - if (v->ptr0_path) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("path", &v->path, 1, ps, depth)) - return False; - } - - if (v->ptr0_comment) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("comment", &v->comment, 1, ps, depth)) - return False; - } - - - - if (v->ptr0_stores) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("size_stores", ps, depth, &v->size_stores)) - return False; - - if (UNMARSHALLING(ps)) { - v->stores = (NETDFS_DFS_STORAGEINFO *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->stores)*v->num_stores); - } - for (i_stores_1=0; i_stores_1num_stores;i_stores_1++) { - if (!netdfs_io_dfs_StorageInfo_p("stores", &v->stores[i_stores_1], ps, depth)) - return False; - } - for (i_stores_1=0; i_stores_1num_stores;i_stores_1++) { - if (!netdfs_io_dfs_StorageInfo_d("stores", &v->stores[i_stores_1], ps, depth)) - return False; - } - } - - return True; -} - -BOOL init_netdfs_dfs_Info4(NETDFS_DFS_INFO4 *v, const char *path, const char *comment, uint32 state, uint32 timeout, struct uuid guid, uint32 num_stores, NETDFS_DFS_STORAGEINFO **stores) -{ - DEBUG(5,("init_netdfs_dfs_Info4\n")); - - if (path) { - v->ptr0_path = 1; - init_unistr2(&v->path, path, UNI_FLAGS_NONE); - } else { - v->ptr0_path = 0; - } - - if (comment) { - v->ptr0_comment = 1; - init_unistr2(&v->comment, comment, UNI_FLAGS_NONE); - } else { - v->ptr0_comment = 0; - } - - v->state = state; - - v->timeout = timeout; - - - - v->num_stores = num_stores; - - if (stores) { - v->ptr0_stores = 1; - v->stores = *stores; - } else { - v->ptr0_stores = 0; - } - - return True; -} - -BOOL netdfs_io_dfs_Info4_p(const char *desc, NETDFS_DFS_INFO4 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info4_p"); - depth++; - if (!prs_uint32("ptr0_path", ps, depth, &v->ptr0_path)) - return False; - - - if (!prs_uint32("ptr0_comment", ps, depth, &v->ptr0_comment)) - return False; - - - if (!prs_uint32("state", ps, depth, &v->state)) - return False; - - if (!prs_uint32("timeout", ps, depth, &v->timeout)) - return False; - - if (!smb_io_uuid("guid", &v->guid, ps, depth)) - return False; - - if (!prs_uint32("num_stores", ps, depth, &v->num_stores)) - return False; - - if (!prs_uint32("ptr0_stores", ps, depth, &v->ptr0_stores)) - return False; - - - return True; -} - -BOOL netdfs_io_dfs_Info4_d(const char *desc, NETDFS_DFS_INFO4 *v, prs_struct *ps, int depth) -{ - uint32 i_stores_1; - - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info4_d"); - depth++; - if (v->ptr0_path) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("path", &v->path, 1, ps, depth)) - return False; - } - - if (v->ptr0_comment) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("comment", &v->comment, 1, ps, depth)) - return False; - } - - - - - - if (v->ptr0_stores) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("size_stores", ps, depth, &v->size_stores)) - return False; - - if (UNMARSHALLING(ps)) { - v->stores = (NETDFS_DFS_STORAGEINFO *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->stores)*v->num_stores); - } - for (i_stores_1=0; i_stores_1num_stores;i_stores_1++) { - if (!netdfs_io_dfs_StorageInfo_p("stores", &v->stores[i_stores_1], ps, depth)) - return False; - } - for (i_stores_1=0; i_stores_1num_stores;i_stores_1++) { - if (!netdfs_io_dfs_StorageInfo_d("stores", &v->stores[i_stores_1], ps, depth)) - return False; - } - } - - return True; -} - -BOOL init_netdfs_dfs_Info100(NETDFS_DFS_INFO100 *v, const char *comment) -{ - DEBUG(5,("init_netdfs_dfs_Info100\n")); - - if (comment) { - v->ptr0_comment = 1; - init_unistr2(&v->comment, comment, UNI_FLAGS_NONE); - } else { - v->ptr0_comment = 0; - } - - return True; -} - -BOOL netdfs_io_dfs_Info100_p(const char *desc, NETDFS_DFS_INFO100 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info100_p"); - depth++; - if (!prs_uint32("ptr0_comment", ps, depth, &v->ptr0_comment)) - return False; - - - return True; -} - -BOOL netdfs_io_dfs_Info100_d(const char *desc, NETDFS_DFS_INFO100 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info100_d"); - depth++; - if (v->ptr0_comment) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("comment", &v->comment, 1, ps, depth)) - return False; - } - - return True; -} - -BOOL init_netdfs_dfs_Info101(NETDFS_DFS_INFO101 *v, uint32 state) -{ - DEBUG(5,("init_netdfs_dfs_Info101\n")); - - v->state = state; - - return True; -} - -BOOL netdfs_io_dfs_Info101_p(const char *desc, NETDFS_DFS_INFO101 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info101_p"); - depth++; - if (!prs_uint32("state", ps, depth, &v->state)) - return False; - - return True; -} - -BOOL netdfs_io_dfs_Info101_d(const char *desc, NETDFS_DFS_INFO101 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info101_d"); - depth++; - - return True; -} - -BOOL init_netdfs_dfs_Info102(NETDFS_DFS_INFO102 *v, uint32 timeout) -{ - DEBUG(5,("init_netdfs_dfs_Info102\n")); - - v->timeout = timeout; - - return True; -} - -BOOL netdfs_io_dfs_Info102_p(const char *desc, NETDFS_DFS_INFO102 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info102_p"); - depth++; - if (!prs_uint32("timeout", ps, depth, &v->timeout)) - return False; - - return True; -} - -BOOL netdfs_io_dfs_Info102_d(const char *desc, NETDFS_DFS_INFO102 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info102_d"); - depth++; - - return True; -} - -BOOL init_netdfs_dfs_Info200(NETDFS_DFS_INFO200 *v, const char *dom_root) -{ - DEBUG(5,("init_netdfs_dfs_Info200\n")); - - if (dom_root) { - v->ptr0_dom_root = 1; - init_unistr2(&v->dom_root, dom_root, UNI_FLAGS_NONE); - } else { - v->ptr0_dom_root = 0; - } - - return True; -} - -BOOL netdfs_io_dfs_Info200_p(const char *desc, NETDFS_DFS_INFO200 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info200_p"); - depth++; - if (!prs_uint32("ptr0_dom_root", ps, depth, &v->ptr0_dom_root)) - return False; - - - return True; -} - -BOOL netdfs_io_dfs_Info200_d(const char *desc, NETDFS_DFS_INFO200 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info200_d"); - depth++; - if (v->ptr0_dom_root) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("dom_root", &v->dom_root, 1, ps, depth)) - return False; - } - - return True; -} - -BOOL init_netdfs_dfs_Info300(NETDFS_DFS_INFO300 *v, uint32 flags, const char *dom_root) -{ - DEBUG(5,("init_netdfs_dfs_Info300\n")); - - v->flags = flags; - - if (dom_root) { - v->ptr0_dom_root = 1; - init_unistr2(&v->dom_root, dom_root, UNI_FLAGS_NONE); - } else { - v->ptr0_dom_root = 0; - } - - return True; -} - -BOOL netdfs_io_dfs_Info300_p(const char *desc, NETDFS_DFS_INFO300 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info300_p"); - depth++; - if (!prs_uint32("flags", ps, depth, &v->flags)) - return False; - - if (!prs_uint32("ptr0_dom_root", ps, depth, &v->ptr0_dom_root)) - return False; - - - return True; -} - -BOOL netdfs_io_dfs_Info300_d(const char *desc, NETDFS_DFS_INFO300 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_Info300_d"); - depth++; - - if (v->ptr0_dom_root) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("dom_root", &v->dom_root, 1, ps, depth)) - return False; - } - - return True; -} - -BOOL netdfs_io_dfs_Info_p(const char *desc, NETDFS_DFS_INFO_CTR* v, prs_struct *ps, int depth) -{ - if (!prs_uint32("switch_value", ps, depth, &v->switch_value)) - return False; - - switch (v->switch_value) { - case 0: - depth++; - if (!prs_uint32("ptr0_info0", ps, depth, &v->ptr0)) - return False; - - depth--; - break; - - case 1: - depth++; - if (!prs_uint32("ptr0_info1", ps, depth, &v->ptr0)) - return False; - - depth--; - break; - - case 2: - depth++; - if (!prs_uint32("ptr0_info2", ps, depth, &v->ptr0)) - return False; - - depth--; - break; - - case 3: - depth++; - if (!prs_uint32("ptr0_info3", ps, depth, &v->ptr0)) - return False; - - depth--; - break; - - case 4: - depth++; - if (!prs_uint32("ptr0_info4", ps, depth, &v->ptr0)) - return False; - - depth--; - break; - - case 100: - depth++; - if (!prs_uint32("ptr0_info100", ps, depth, &v->ptr0)) - return False; - - depth--; - break; - - case 101: - depth++; - if (!prs_uint32("ptr0_info101", ps, depth, &v->ptr0)) - return False; - - depth--; - break; - - case 102: - depth++; - if (!prs_uint32("ptr0_info102", ps, depth, &v->ptr0)) - return False; - - depth--; - break; - - default: - return False; - - } - - return True; -} - -BOOL netdfs_io_dfs_Info_d(const char *desc, NETDFS_DFS_INFO_CTR* v, prs_struct *ps, int depth) -{ - switch (v->switch_value) { - case 0: - depth++; - if (v->ptr0) { - if (!prs_align_custom(ps, 1)) - return False; - - if (!netdfs_io_dfs_Info0_p("info0", &v->u.info0, ps, depth)) - return False; - if (!netdfs_io_dfs_Info0_d("info0", &v->u.info0, ps, depth)) - return False; - } - depth--; - break; - - case 1: - depth++; - if (v->ptr0) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!netdfs_io_dfs_Info1_p("info1", &v->u.info1, ps, depth)) - return False; - if (!netdfs_io_dfs_Info1_d("info1", &v->u.info1, ps, depth)) - return False; - } - depth--; - break; - - case 2: - depth++; - if (v->ptr0) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!netdfs_io_dfs_Info2_p("info2", &v->u.info2, ps, depth)) - return False; - if (!netdfs_io_dfs_Info2_d("info2", &v->u.info2, ps, depth)) - return False; - } - depth--; - break; - - case 3: - depth++; - if (v->ptr0) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!netdfs_io_dfs_Info3_p("info3", &v->u.info3, ps, depth)) - return False; - if (!netdfs_io_dfs_Info3_d("info3", &v->u.info3, ps, depth)) - return False; - } - depth--; - break; - - case 4: - depth++; - if (v->ptr0) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!netdfs_io_dfs_Info4_p("info4", &v->u.info4, ps, depth)) - return False; - if (!netdfs_io_dfs_Info4_d("info4", &v->u.info4, ps, depth)) - return False; - } - depth--; - break; - - case 100: - depth++; - if (v->ptr0) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!netdfs_io_dfs_Info100_p("info100", &v->u.info100, ps, depth)) - return False; - if (!netdfs_io_dfs_Info100_d("info100", &v->u.info100, ps, depth)) - return False; - } - depth--; - break; - - case 101: - depth++; - if (v->ptr0) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!netdfs_io_dfs_Info101_p("info101", &v->u.info101, ps, depth)) - return False; - if (!netdfs_io_dfs_Info101_d("info101", &v->u.info101, ps, depth)) - return False; - } - depth--; - break; - - case 102: - depth++; - if (v->ptr0) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!netdfs_io_dfs_Info102_p("info102", &v->u.info102, ps, depth)) - return False; - if (!netdfs_io_dfs_Info102_d("info102", &v->u.info102, ps, depth)) - return False; - } - depth--; - break; - - } - - return True; -} -BOOL init_netdfs_dfs_EnumArray1(NETDFS_DFS_ENUMARRAY1 *v, uint32 count, NETDFS_DFS_INFO1 **s) -{ - DEBUG(5,("init_netdfs_dfs_EnumArray1\n")); - - v->count = count; - - if (s) { - v->ptr0_s = 1; - v->s = *s; - } else { - v->ptr0_s = 0; - } - - return True; -} - -BOOL netdfs_io_dfs_EnumArray1_p(const char *desc, NETDFS_DFS_ENUMARRAY1 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray1_p"); - depth++; - if (!prs_uint32("count", ps, depth, &v->count)) - return False; - - if (!prs_uint32("ptr0_s", ps, depth, &v->ptr0_s)) - return False; - - - return True; -} - -BOOL netdfs_io_dfs_EnumArray1_d(const char *desc, NETDFS_DFS_ENUMARRAY1 *v, prs_struct *ps, int depth) -{ - uint32 i_s_1; - - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray1_d"); - depth++; - - if (v->ptr0_s) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("size_s", ps, depth, &v->size_s)) - return False; - - if (UNMARSHALLING(ps)) { - v->s = (NETDFS_DFS_INFO1 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); - } - for (i_s_1=0; i_s_1count;i_s_1++) { - if (!netdfs_io_dfs_Info1_p("s", &v->s[i_s_1], ps, depth)) - return False; - } - for (i_s_1=0; i_s_1count;i_s_1++) { - if (!netdfs_io_dfs_Info1_d("s", &v->s[i_s_1], ps, depth)) - return False; - } - } - - return True; -} - -BOOL init_netdfs_dfs_EnumArray2(NETDFS_DFS_ENUMARRAY2 *v, uint32 count, NETDFS_DFS_INFO2 **s) -{ - DEBUG(5,("init_netdfs_dfs_EnumArray2\n")); - - v->count = count; - - if (s) { - v->ptr0_s = 1; - v->s = *s; - } else { - v->ptr0_s = 0; - } - - return True; -} - -BOOL netdfs_io_dfs_EnumArray2_p(const char *desc, NETDFS_DFS_ENUMARRAY2 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray2_p"); - depth++; - if (!prs_uint32("count", ps, depth, &v->count)) - return False; - - if (!prs_uint32("ptr0_s", ps, depth, &v->ptr0_s)) - return False; - - - return True; -} - -BOOL netdfs_io_dfs_EnumArray2_d(const char *desc, NETDFS_DFS_ENUMARRAY2 *v, prs_struct *ps, int depth) -{ - uint32 i_s_1; - - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray2_d"); - depth++; - - if (v->ptr0_s) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("size_s", ps, depth, &v->size_s)) - return False; - - if (UNMARSHALLING(ps)) { - v->s = (NETDFS_DFS_INFO2 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); - } - for (i_s_1=0; i_s_1count;i_s_1++) { - if (!netdfs_io_dfs_Info2_p("s", &v->s[i_s_1], ps, depth)) - return False; - } - for (i_s_1=0; i_s_1count;i_s_1++) { - if (!netdfs_io_dfs_Info2_d("s", &v->s[i_s_1], ps, depth)) - return False; - } - } - - return True; -} - -BOOL init_netdfs_dfs_EnumArray3(NETDFS_DFS_ENUMARRAY3 *v, uint32 count, NETDFS_DFS_INFO3 **s) -{ - DEBUG(5,("init_netdfs_dfs_EnumArray3\n")); - - v->count = count; - - if (s) { - v->ptr0_s = 1; - v->s = *s; - } else { - v->ptr0_s = 0; - } - - return True; -} - -BOOL netdfs_io_dfs_EnumArray3_p(const char *desc, NETDFS_DFS_ENUMARRAY3 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray3_p"); - depth++; - if (!prs_uint32("count", ps, depth, &v->count)) - return False; - - if (!prs_uint32("ptr0_s", ps, depth, &v->ptr0_s)) - return False; - - - return True; -} - -BOOL netdfs_io_dfs_EnumArray3_d(const char *desc, NETDFS_DFS_ENUMARRAY3 *v, prs_struct *ps, int depth) -{ - uint32 i_s_1; - - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray3_d"); - depth++; - - if (v->ptr0_s) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("size_s", ps, depth, &v->size_s)) - return False; - - if (UNMARSHALLING(ps)) { - v->s = (NETDFS_DFS_INFO3 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); - } - for (i_s_1=0; i_s_1count;i_s_1++) { - if (!netdfs_io_dfs_Info3_p("s", &v->s[i_s_1], ps, depth)) - return False; - } - for (i_s_1=0; i_s_1count;i_s_1++) { - if (!netdfs_io_dfs_Info3_d("s", &v->s[i_s_1], ps, depth)) - return False; - } - } - - return True; -} - -BOOL init_netdfs_dfs_EnumArray4(NETDFS_DFS_ENUMARRAY4 *v, uint32 count, NETDFS_DFS_INFO4 **s) -{ - DEBUG(5,("init_netdfs_dfs_EnumArray4\n")); - - v->count = count; - - if (s) { - v->ptr0_s = 1; - v->s = *s; - } else { - v->ptr0_s = 0; - } - - return True; -} - -BOOL netdfs_io_dfs_EnumArray4_p(const char *desc, NETDFS_DFS_ENUMARRAY4 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray4_p"); - depth++; - if (!prs_uint32("count", ps, depth, &v->count)) - return False; - - if (!prs_uint32("ptr0_s", ps, depth, &v->ptr0_s)) - return False; - - - return True; -} - -BOOL netdfs_io_dfs_EnumArray4_d(const char *desc, NETDFS_DFS_ENUMARRAY4 *v, prs_struct *ps, int depth) -{ - uint32 i_s_1; - - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray4_d"); - depth++; - - if (v->ptr0_s) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("size_s", ps, depth, &v->size_s)) - return False; - - if (UNMARSHALLING(ps)) { - v->s = (NETDFS_DFS_INFO4 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); - } - for (i_s_1=0; i_s_1count;i_s_1++) { - if (!netdfs_io_dfs_Info4_p("s", &v->s[i_s_1], ps, depth)) - return False; - } - for (i_s_1=0; i_s_1count;i_s_1++) { - if (!netdfs_io_dfs_Info4_d("s", &v->s[i_s_1], ps, depth)) - return False; - } - } - - return True; -} - -BOOL init_netdfs_dfs_EnumArray200(NETDFS_DFS_ENUMARRAY200 *v, uint32 count, NETDFS_DFS_INFO200 **s) -{ - DEBUG(5,("init_netdfs_dfs_EnumArray200\n")); - - v->count = count; - - if (s) { - v->ptr0_s = 1; - v->s = *s; - } else { - v->ptr0_s = 0; - } - - return True; -} - -BOOL netdfs_io_dfs_EnumArray200_p(const char *desc, NETDFS_DFS_ENUMARRAY200 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray200_p"); - depth++; - if (!prs_uint32("count", ps, depth, &v->count)) - return False; - - if (!prs_uint32("ptr0_s", ps, depth, &v->ptr0_s)) - return False; - - - return True; -} - -BOOL netdfs_io_dfs_EnumArray200_d(const char *desc, NETDFS_DFS_ENUMARRAY200 *v, prs_struct *ps, int depth) -{ - uint32 i_s_1; - - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray200_d"); - depth++; - - if (v->ptr0_s) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("size_s", ps, depth, &v->size_s)) - return False; - - if (UNMARSHALLING(ps)) { - v->s = (NETDFS_DFS_INFO200 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); - } - for (i_s_1=0; i_s_1count;i_s_1++) { - if (!netdfs_io_dfs_Info200_p("s", &v->s[i_s_1], ps, depth)) - return False; - } - for (i_s_1=0; i_s_1count;i_s_1++) { - if (!netdfs_io_dfs_Info200_d("s", &v->s[i_s_1], ps, depth)) - return False; - } - } - - return True; -} - -BOOL init_netdfs_dfs_EnumArray300(NETDFS_DFS_ENUMARRAY300 *v, uint32 count, NETDFS_DFS_INFO300 **s) -{ - DEBUG(5,("init_netdfs_dfs_EnumArray300\n")); - - v->count = count; - - if (s) { - v->ptr0_s = 1; - v->s = *s; - } else { - v->ptr0_s = 0; - } - - return True; -} - -BOOL netdfs_io_dfs_EnumArray300_p(const char *desc, NETDFS_DFS_ENUMARRAY300 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray300_p"); - depth++; - if (!prs_uint32("count", ps, depth, &v->count)) - return False; - - if (!prs_uint32("ptr0_s", ps, depth, &v->ptr0_s)) - return False; - - - return True; -} - -BOOL netdfs_io_dfs_EnumArray300_d(const char *desc, NETDFS_DFS_ENUMARRAY300 *v, prs_struct *ps, int depth) -{ - uint32 i_s_1; - - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumArray300_d"); - depth++; - - if (v->ptr0_s) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("size_s", ps, depth, &v->size_s)) - return False; - - if (UNMARSHALLING(ps)) { - v->s = (NETDFS_DFS_INFO300 *)PRS_ALLOC_MEM_VOID(ps,sizeof(*v->s)*v->count); - } - for (i_s_1=0; i_s_1count;i_s_1++) { - if (!netdfs_io_dfs_Info300_p("s", &v->s[i_s_1], ps, depth)) - return False; - } - for (i_s_1=0; i_s_1count;i_s_1++) { - if (!netdfs_io_dfs_Info300_d("s", &v->s[i_s_1], ps, depth)) - return False; - } - } - - return True; -} - -BOOL netdfs_io_dfs_EnumInfo_p(const char *desc, NETDFS_DFS_ENUMINFO_CTR* v, prs_struct *ps, int depth) -{ - if (!prs_uint32("switch_value", ps, depth, &v->switch_value)) - return False; - - switch (v->switch_value) { - case 1: - depth++; - if (!prs_uint32("ptr0_info1", ps, depth, &v->ptr0)) - return False; - - depth--; - break; - - case 2: - depth++; - if (!prs_uint32("ptr0_info2", ps, depth, &v->ptr0)) - return False; - - depth--; - break; - - case 3: - depth++; - if (!prs_uint32("ptr0_info3", ps, depth, &v->ptr0)) - return False; - - depth--; - break; - - case 4: - depth++; - if (!prs_uint32("ptr0_info4", ps, depth, &v->ptr0)) - return False; - - depth--; - break; - - case 200: - depth++; - if (!prs_uint32("ptr0_info200", ps, depth, &v->ptr0)) - return False; - - depth--; - break; - - case 300: - depth++; - if (!prs_uint32("ptr0_info300", ps, depth, &v->ptr0)) - return False; - - depth--; - break; - - default: - return False; - - } - - return True; -} - -BOOL netdfs_io_dfs_EnumInfo_d(const char *desc, NETDFS_DFS_ENUMINFO_CTR* v, prs_struct *ps, int depth) -{ - switch (v->switch_value) { - case 1: - depth++; - if (v->ptr0) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!netdfs_io_dfs_EnumArray1_p("info1", &v->u.info1, ps, depth)) - return False; - if (!netdfs_io_dfs_EnumArray1_d("info1", &v->u.info1, ps, depth)) - return False; - } - depth--; - break; - - case 2: - depth++; - if (v->ptr0) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!netdfs_io_dfs_EnumArray2_p("info2", &v->u.info2, ps, depth)) - return False; - if (!netdfs_io_dfs_EnumArray2_d("info2", &v->u.info2, ps, depth)) - return False; - } - depth--; - break; - - case 3: - depth++; - if (v->ptr0) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!netdfs_io_dfs_EnumArray3_p("info3", &v->u.info3, ps, depth)) - return False; - if (!netdfs_io_dfs_EnumArray3_d("info3", &v->u.info3, ps, depth)) - return False; - } - depth--; - break; - - case 4: - depth++; - if (v->ptr0) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!netdfs_io_dfs_EnumArray4_p("info4", &v->u.info4, ps, depth)) - return False; - if (!netdfs_io_dfs_EnumArray4_d("info4", &v->u.info4, ps, depth)) - return False; - } - depth--; - break; - - case 200: - depth++; - if (v->ptr0) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!netdfs_io_dfs_EnumArray200_p("info200", &v->u.info200, ps, depth)) - return False; - if (!netdfs_io_dfs_EnumArray200_d("info200", &v->u.info200, ps, depth)) - return False; - } - depth--; - break; - - case 300: - depth++; - if (v->ptr0) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!netdfs_io_dfs_EnumArray300_p("info300", &v->u.info300, ps, depth)) - return False; - if (!netdfs_io_dfs_EnumArray300_d("info300", &v->u.info300, ps, depth)) - return False; - } - depth--; - break; - - } - - return True; -} -BOOL init_netdfs_dfs_EnumStruct(NETDFS_DFS_ENUMSTRUCT *v, uint32 level, NETDFS_DFS_ENUMINFO_CTR e) -{ - DEBUG(5,("init_netdfs_dfs_EnumStruct\n")); - - v->level = level; - - v->e = e; - v->e.switch_value = v->level; - - return True; -} - -BOOL netdfs_io_dfs_EnumStruct_p(const char *desc, NETDFS_DFS_ENUMSTRUCT *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumStruct_p"); - depth++; - if (!prs_uint32("level", ps, depth, &v->level)) - return False; - - if (!netdfs_io_dfs_EnumInfo_p("e", &v->e, ps, depth)) - return False; - - return True; -} - -BOOL netdfs_io_dfs_EnumStruct_d(const char *desc, NETDFS_DFS_ENUMSTRUCT *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_dfs_EnumStruct_d"); - depth++; - - if (!prs_align_custom(ps, 4)) - return False; - - if (!netdfs_io_dfs_EnumInfo_d("e", &v->e, ps, depth)) - return False; - - return True; -} - -/* netdfs functions */ -BOOL init_netdfs_q_dfs_GetManagerVersion(NETDFS_Q_DFS_GETMANAGERVERSION *v) -{ - DEBUG(5,("init_netdfs_q_dfs_GetManagerVersion\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_GetManagerVersion(const char *desc, NETDFS_Q_DFS_GETMANAGERVERSION *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_GetManagerVersion"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_GetManagerVersion(NETDFS_R_DFS_GETMANAGERVERSION *v, uint32 *exist_flag) -{ - DEBUG(5,("init_netdfs_r_dfs_GetManagerVersion\n")); - - if (!exist_flag) - return False; - - v->exist_flag = *exist_flag; - - return True; -} - -BOOL netdfs_io_r_dfs_GetManagerVersion(const char *desc, NETDFS_R_DFS_GETMANAGERVERSION *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_GetManagerVersion"); - depth++; - if (!prs_uint32("exist_flag", ps, depth, &v->exist_flag)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_Add(NETDFS_Q_DFS_ADD *v, const char *path, const char *server, const char *share, const char *comment, uint32 flags) -{ - DEBUG(5,("init_netdfs_q_dfs_Add\n")); - - if (!path) - return False; - - init_unistr2(&v->path, path, UNI_FLAGS_NONE); - - if (!server) - return False; - - init_unistr2(&v->server, server, UNI_FLAGS_NONE); - - if (share) { - v->ptr0_share = 1; - init_unistr2(&v->share, share, UNI_FLAGS_NONE); - } else { - v->ptr0_share = 0; - } - - if (comment) { - v->ptr0_comment = 1; - init_unistr2(&v->comment, comment, UNI_FLAGS_NONE); - } else { - v->ptr0_comment = 0; - } - - v->flags = flags; - - return True; -} - -BOOL netdfs_io_q_dfs_Add(const char *desc, NETDFS_Q_DFS_ADD *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_Add"); - depth++; - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("path", &v->path, 1, ps, depth)) - return False; - - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("server", &v->server, 1, ps, depth)) - return False; - - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("ptr0_share", ps, depth, &v->ptr0_share)) - return False; - - if (v->ptr0_share) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("share", &v->share, 1, ps, depth)) - return False; - } - - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("ptr0_comment", ps, depth, &v->ptr0_comment)) - return False; - - if (v->ptr0_comment) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("comment", &v->comment, 1, ps, depth)) - return False; - } - - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("flags", ps, depth, &v->flags)) - return False; - - return True; -} - -BOOL init_netdfs_r_dfs_Add(NETDFS_R_DFS_ADD *v, const char *path, const char *server, const char *share, const char *comment, uint32 flags, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_Add\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_Add(const char *desc, NETDFS_R_DFS_ADD *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_Add"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_Remove(NETDFS_Q_DFS_REMOVE *v, const char *path, const char *server, const char *share) -{ - DEBUG(5,("init_netdfs_q_dfs_Remove\n")); - - if (!path) - return False; - - init_unistr2(&v->path, path, UNI_FLAGS_NONE); - - if (server) { - v->ptr0_server = 1; - init_unistr2(&v->server, server, UNI_FLAGS_NONE); - } else { - v->ptr0_server = 0; - } - - if (share) { - v->ptr0_share = 1; - init_unistr2(&v->share, share, UNI_FLAGS_NONE); - } else { - v->ptr0_share = 0; - } - - return True; -} - -BOOL netdfs_io_q_dfs_Remove(const char *desc, NETDFS_Q_DFS_REMOVE *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_Remove"); - depth++; - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("path", &v->path, 1, ps, depth)) - return False; - - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("ptr0_server", ps, depth, &v->ptr0_server)) - return False; - - if (v->ptr0_server) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("server", &v->server, 1, ps, depth)) - return False; - } - - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("ptr0_share", ps, depth, &v->ptr0_share)) - return False; - - if (v->ptr0_share) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("share", &v->share, 1, ps, depth)) - return False; - } - - return True; -} - -BOOL init_netdfs_r_dfs_Remove(NETDFS_R_DFS_REMOVE *v, const char *path, const char *server, const char *share, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_Remove\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_Remove(const char *desc, NETDFS_R_DFS_REMOVE *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_Remove"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_SetInfo(NETDFS_Q_DFS_SETINFO *v) -{ - DEBUG(5,("init_netdfs_q_dfs_SetInfo\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_SetInfo(const char *desc, NETDFS_Q_DFS_SETINFO *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_SetInfo"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_SetInfo(NETDFS_R_DFS_SETINFO *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_SetInfo\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_SetInfo(const char *desc, NETDFS_R_DFS_SETINFO *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_SetInfo"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_GetInfo(NETDFS_Q_DFS_GETINFO *v, const char *path, const char *server, const char *share, uint32 level) -{ - DEBUG(5,("init_netdfs_q_dfs_GetInfo\n")); - - if (!path) - return False; - - init_unistr2(&v->path, path, UNI_FLAGS_NONE); - - if (server) { - v->ptr0_server = 1; - init_unistr2(&v->server, server, UNI_FLAGS_NONE); - } else { - v->ptr0_server = 0; - } - - if (share) { - v->ptr0_share = 1; - init_unistr2(&v->share, share, UNI_FLAGS_NONE); - } else { - v->ptr0_share = 0; - } - - v->level = level; - - return True; -} - -BOOL netdfs_io_q_dfs_GetInfo(const char *desc, NETDFS_Q_DFS_GETINFO *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_GetInfo"); - depth++; - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("path", &v->path, 1, ps, depth)) - return False; - - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("ptr0_server", ps, depth, &v->ptr0_server)) - return False; - - if (v->ptr0_server) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("server", &v->server, 1, ps, depth)) - return False; - } - - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("ptr0_share", ps, depth, &v->ptr0_share)) - return False; - - if (v->ptr0_share) { - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("share", &v->share, 1, ps, depth)) - return False; - } - - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("level", ps, depth, &v->level)) - return False; - - return True; -} - -BOOL init_netdfs_r_dfs_GetInfo(NETDFS_R_DFS_GETINFO *v, const char *path, const char *server, const char *share, uint32 level, NETDFS_DFS_INFO_CTR *info, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_GetInfo\n")); - - if (!info) - return False; - - v->info = *info; - v->info.switch_value = level; - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_GetInfo(const char *desc, NETDFS_R_DFS_GETINFO *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_GetInfo"); - depth++; - if (!netdfs_io_dfs_Info_p("info", &v->info, ps, depth)) - return False; - if (!netdfs_io_dfs_Info_d("info", &v->info, ps, depth)) - return False; - - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_Enum(NETDFS_Q_DFS_ENUM *v, uint32 level, uint32 bufsize, NETDFS_DFS_ENUMSTRUCT *info, uint32 *total) -{ - DEBUG(5,("init_netdfs_q_dfs_Enum\n")); - - v->level = level; - - v->bufsize = bufsize; - - if (info) { - v->ptr0_info = 1; - v->info = *info; - } else { - v->ptr0_info = 0; - } - - if (total) { - v->ptr0_total = 1; - v->total = *total; - } else { - v->ptr0_total = 0; - } - - return True; -} - -BOOL netdfs_io_q_dfs_Enum(const char *desc, NETDFS_Q_DFS_ENUM *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_Enum"); - depth++; - if (!prs_uint32("level", ps, depth, &v->level)) - return False; - - if (!prs_uint32("bufsize", ps, depth, &v->bufsize)) - return False; - - if (!prs_uint32("ptr0_info", ps, depth, &v->ptr0_info)) - return False; - - if (v->ptr0_info) { - if (!netdfs_io_dfs_EnumStruct_p("info", &v->info, ps, depth)) - return False; - if (!netdfs_io_dfs_EnumStruct_d("info", &v->info, ps, depth)) - return False; - } - - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("ptr0_total", ps, depth, &v->ptr0_total)) - return False; - - if (v->ptr0_total) { - if (!prs_uint32("total", ps, depth, &v->total)) - return False; - } - - return True; -} - -BOOL init_netdfs_r_dfs_Enum(NETDFS_R_DFS_ENUM *v, uint32 level, uint32 bufsize, NETDFS_DFS_ENUMSTRUCT *info, uint32 *unknown, uint32 *total, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_Enum\n")); - - if (info) { - v->ptr0_info = 1; - v->info = *info; - } else { - v->ptr0_info = 0; - } - - if (total) { - v->ptr0_total = 1; - v->total = *total; - } else { - v->ptr0_total = 0; - } - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_Enum(const char *desc, NETDFS_R_DFS_ENUM *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_Enum"); - depth++; - if (!prs_uint32("ptr0_info", ps, depth, &v->ptr0_info)) - return False; - - if (v->ptr0_info) { - if (!netdfs_io_dfs_EnumStruct_p("info", &v->info, ps, depth)) - return False; - if (!netdfs_io_dfs_EnumStruct_d("info", &v->info, ps, depth)) - return False; - } - - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("ptr0_total", ps, depth, &v->ptr0_total)) - return False; - - if (v->ptr0_total) { - if (!prs_uint32("total", ps, depth, &v->total)) - return False; - } - - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_Rename(NETDFS_Q_DFS_RENAME *v) -{ - DEBUG(5,("init_netdfs_q_dfs_Rename\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_Rename(const char *desc, NETDFS_Q_DFS_RENAME *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_Rename"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_Rename(NETDFS_R_DFS_RENAME *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_Rename\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_Rename(const char *desc, NETDFS_R_DFS_RENAME *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_Rename"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_Move(NETDFS_Q_DFS_MOVE *v) -{ - DEBUG(5,("init_netdfs_q_dfs_Move\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_Move(const char *desc, NETDFS_Q_DFS_MOVE *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_Move"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_Move(NETDFS_R_DFS_MOVE *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_Move\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_Move(const char *desc, NETDFS_R_DFS_MOVE *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_Move"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_ManagerGetConfigInfo(NETDFS_Q_DFS_MANAGERGETCONFIGINFO *v) -{ - DEBUG(5,("init_netdfs_q_dfs_ManagerGetConfigInfo\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_ManagerGetConfigInfo(const char *desc, NETDFS_Q_DFS_MANAGERGETCONFIGINFO *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_ManagerGetConfigInfo"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_ManagerGetConfigInfo(NETDFS_R_DFS_MANAGERGETCONFIGINFO *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_ManagerGetConfigInfo\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_ManagerGetConfigInfo(const char *desc, NETDFS_R_DFS_MANAGERGETCONFIGINFO *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_ManagerGetConfigInfo"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_ManagerSendSiteInfo(NETDFS_Q_DFS_MANAGERSENDSITEINFO *v) -{ - DEBUG(5,("init_netdfs_q_dfs_ManagerSendSiteInfo\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_ManagerSendSiteInfo(const char *desc, NETDFS_Q_DFS_MANAGERSENDSITEINFO *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_ManagerSendSiteInfo"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_ManagerSendSiteInfo(NETDFS_R_DFS_MANAGERSENDSITEINFO *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_ManagerSendSiteInfo\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_ManagerSendSiteInfo(const char *desc, NETDFS_R_DFS_MANAGERSENDSITEINFO *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_ManagerSendSiteInfo"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_AddFtRoot(NETDFS_Q_DFS_ADDFTROOT *v) -{ - DEBUG(5,("init_netdfs_q_dfs_AddFtRoot\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_AddFtRoot(const char *desc, NETDFS_Q_DFS_ADDFTROOT *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_AddFtRoot"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_AddFtRoot(NETDFS_R_DFS_ADDFTROOT *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_AddFtRoot\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_AddFtRoot(const char *desc, NETDFS_R_DFS_ADDFTROOT *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_AddFtRoot"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_RemoveFtRoot(NETDFS_Q_DFS_REMOVEFTROOT *v) -{ - DEBUG(5,("init_netdfs_q_dfs_RemoveFtRoot\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_RemoveFtRoot(const char *desc, NETDFS_Q_DFS_REMOVEFTROOT *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_RemoveFtRoot"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_RemoveFtRoot(NETDFS_R_DFS_REMOVEFTROOT *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_RemoveFtRoot\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_RemoveFtRoot(const char *desc, NETDFS_R_DFS_REMOVEFTROOT *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_RemoveFtRoot"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_AddStdRoot(NETDFS_Q_DFS_ADDSTDROOT *v) -{ - DEBUG(5,("init_netdfs_q_dfs_AddStdRoot\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_AddStdRoot(const char *desc, NETDFS_Q_DFS_ADDSTDROOT *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_AddStdRoot"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_AddStdRoot(NETDFS_R_DFS_ADDSTDROOT *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_AddStdRoot\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_AddStdRoot(const char *desc, NETDFS_R_DFS_ADDSTDROOT *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_AddStdRoot"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_RemoveStdRoot(NETDFS_Q_DFS_REMOVESTDROOT *v) -{ - DEBUG(5,("init_netdfs_q_dfs_RemoveStdRoot\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_RemoveStdRoot(const char *desc, NETDFS_Q_DFS_REMOVESTDROOT *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_RemoveStdRoot"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_RemoveStdRoot(NETDFS_R_DFS_REMOVESTDROOT *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_RemoveStdRoot\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_RemoveStdRoot(const char *desc, NETDFS_R_DFS_REMOVESTDROOT *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_RemoveStdRoot"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_ManagerInitialize(NETDFS_Q_DFS_MANAGERINITIALIZE *v) -{ - DEBUG(5,("init_netdfs_q_dfs_ManagerInitialize\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_ManagerInitialize(const char *desc, NETDFS_Q_DFS_MANAGERINITIALIZE *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_ManagerInitialize"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_ManagerInitialize(NETDFS_R_DFS_MANAGERINITIALIZE *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_ManagerInitialize\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_ManagerInitialize(const char *desc, NETDFS_R_DFS_MANAGERINITIALIZE *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_ManagerInitialize"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_AddStdRootForced(NETDFS_Q_DFS_ADDSTDROOTFORCED *v) -{ - DEBUG(5,("init_netdfs_q_dfs_AddStdRootForced\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_AddStdRootForced(const char *desc, NETDFS_Q_DFS_ADDSTDROOTFORCED *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_AddStdRootForced"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_AddStdRootForced(NETDFS_R_DFS_ADDSTDROOTFORCED *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_AddStdRootForced\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_AddStdRootForced(const char *desc, NETDFS_R_DFS_ADDSTDROOTFORCED *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_AddStdRootForced"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_GetDcAddress(NETDFS_Q_DFS_GETDCADDRESS *v) -{ - DEBUG(5,("init_netdfs_q_dfs_GetDcAddress\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_GetDcAddress(const char *desc, NETDFS_Q_DFS_GETDCADDRESS *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_GetDcAddress"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_GetDcAddress(NETDFS_R_DFS_GETDCADDRESS *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_GetDcAddress\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_GetDcAddress(const char *desc, NETDFS_R_DFS_GETDCADDRESS *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_GetDcAddress"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_SetDcAddress(NETDFS_Q_DFS_SETDCADDRESS *v) -{ - DEBUG(5,("init_netdfs_q_dfs_SetDcAddress\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_SetDcAddress(const char *desc, NETDFS_Q_DFS_SETDCADDRESS *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_SetDcAddress"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_SetDcAddress(NETDFS_R_DFS_SETDCADDRESS *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_SetDcAddress\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_SetDcAddress(const char *desc, NETDFS_R_DFS_SETDCADDRESS *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_SetDcAddress"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_FlushFtTable(NETDFS_Q_DFS_FLUSHFTTABLE *v) -{ - DEBUG(5,("init_netdfs_q_dfs_FlushFtTable\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_FlushFtTable(const char *desc, NETDFS_Q_DFS_FLUSHFTTABLE *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_FlushFtTable"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_FlushFtTable(NETDFS_R_DFS_FLUSHFTTABLE *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_FlushFtTable\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_FlushFtTable(const char *desc, NETDFS_R_DFS_FLUSHFTTABLE *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_FlushFtTable"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_Add2(NETDFS_Q_DFS_ADD2 *v) -{ - DEBUG(5,("init_netdfs_q_dfs_Add2\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_Add2(const char *desc, NETDFS_Q_DFS_ADD2 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_Add2"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_Add2(NETDFS_R_DFS_ADD2 *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_Add2\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_Add2(const char *desc, NETDFS_R_DFS_ADD2 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_Add2"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_Remove2(NETDFS_Q_DFS_REMOVE2 *v) -{ - DEBUG(5,("init_netdfs_q_dfs_Remove2\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_Remove2(const char *desc, NETDFS_Q_DFS_REMOVE2 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_Remove2"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_Remove2(NETDFS_R_DFS_REMOVE2 *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_Remove2\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_Remove2(const char *desc, NETDFS_R_DFS_REMOVE2 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_Remove2"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_EnumEx(NETDFS_Q_DFS_ENUMEX *v, uint32 level, uint32 bufsize, NETDFS_DFS_ENUMSTRUCT *info, uint32 *total, const char *dfs_name) -{ - DEBUG(5,("init_netdfs_q_dfs_EnumEx\n")); - - if (!dfs_name) - return False; - - init_unistr2(&v->dfs_name, dfs_name, UNI_STR_TERMINATE); - - v->level = level; - - v->bufsize = bufsize; - - if (info) { - v->ptr0_info = 1; - v->info = *info; - } else { - v->ptr0_info = 0; - } - - if (total) { - v->ptr0_total = 1; - v->total = *total; - } else { - v->ptr0_total = 0; - } - - return True; -} - -BOOL netdfs_io_q_dfs_EnumEx(const char *desc, NETDFS_Q_DFS_ENUMEX *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_EnumEx"); - depth++; - if (!prs_align_custom(ps, 4)) - return False; - - if (!smb_io_unistr2("dfs_name", &v->dfs_name, 1, ps, depth)) - return False; - - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("level", ps, depth, &v->level)) - return False; - - if (!prs_uint32("bufsize", ps, depth, &v->bufsize)) - return False; - - if (!prs_uint32("ptr0_info", ps, depth, &v->ptr0_info)) - return False; - - if (v->ptr0_info) { - if (!netdfs_io_dfs_EnumStruct_p("info", &v->info, ps, depth)) - return False; - if (!netdfs_io_dfs_EnumStruct_d("info", &v->info, ps, depth)) - return False; - } - - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("ptr0_total", ps, depth, &v->ptr0_total)) - return False; - - if (v->ptr0_total) { - if (!prs_uint32("total", ps, depth, &v->total)) - return False; - } - - return True; -} - -BOOL init_netdfs_r_dfs_EnumEx(NETDFS_R_DFS_ENUMEX *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_EnumEx\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_EnumEx(const char *desc, NETDFS_R_DFS_ENUMEX *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_EnumEx"); - depth++; - if (!prs_uint32("ptr0_info", ps, depth, &v->ptr0_info)) - return False; - - if (v->ptr0_info) { - if (!netdfs_io_dfs_EnumStruct_p("info", &v->info, ps, depth)) - return False; - if (!netdfs_io_dfs_EnumStruct_d("info", &v->info, ps, depth)) - return False; - } - - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_uint32("ptr0_total", ps, depth, &v->ptr0_total)) - return False; - - if (v->ptr0_total) { - if (!prs_uint32("total", ps, depth, &v->total)) - return False; - } - - if (!prs_align_custom(ps, 4)) - return False; - - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; - - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -BOOL init_netdfs_q_dfs_SetInfo2(NETDFS_Q_DFS_SETINFO2 *v) -{ - DEBUG(5,("init_netdfs_q_dfs_SetInfo2\n")); - - return True; -} - -BOOL netdfs_io_q_dfs_SetInfo2(const char *desc, NETDFS_Q_DFS_SETINFO2 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_q_dfs_SetInfo2"); - depth++; - return True; -} - -BOOL init_netdfs_r_dfs_SetInfo2(NETDFS_R_DFS_SETINFO2 *v, WERROR status) -{ - DEBUG(5,("init_netdfs_r_dfs_SetInfo2\n")); - - v->status = status; - - return True; -} - -BOOL netdfs_io_r_dfs_SetInfo2(const char *desc, NETDFS_R_DFS_SETINFO2 *v, prs_struct *ps, int depth) -{ - if (v == NULL) - return False; - - prs_debug(ps, depth, desc, "netdfs_io_r_dfs_SetInfo2"); - depth++; - if (!prs_werror("status", ps, depth, &v->status)) - return False; - - return True; -} - -- cgit From 71453ab90dbda7f335a3c7119eb8d404e85a0131 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 14 Sep 2006 14:51:16 +0000 Subject: r18526: Use generated server for unixinfo RPC interface. (This used to be commit a5c0606d7667506fdc64776e32d4b3508195a199) --- source3/rpc_parse/parse_unixinfo.c | 266 ------------------------------------- 1 file changed, 266 deletions(-) delete mode 100644 source3/rpc_parse/parse_unixinfo.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_unixinfo.c b/source3/rpc_parse/parse_unixinfo.c deleted file mode 100644 index 72e0d392ec..0000000000 --- a/source3/rpc_parse/parse_unixinfo.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * - * RPC Pipe client / server routines - * - * Copyright (C) Volker Lendecke 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 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "includes.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_RPC_PARSE - -void init_q_unixinfo_sid_to_uid(UNIXINFO_Q_SID_TO_UID *q_d, const DOM_SID *sid) -{ - sid_copy(&q_d->sid, sid); -} - -BOOL unixinfo_io_q_unixinfo_sid_to_uid(const char *desc, UNIXINFO_Q_SID_TO_UID *q_d, - prs_struct *ps, int depth) -{ - return smb_io_dom_sid(desc, &q_d->sid, ps, depth); -} - -BOOL unixinfo_io_r_unixinfo_sid_to_uid(const char *desc, UNIXINFO_R_SID_TO_UID *r_d, - prs_struct *ps, int depth) -{ - if (!prs_uint64(desc, ps, depth, &r_d->uid)) - return False; - - if (!prs_ntstatus(desc, ps, depth, &r_d->status)) - return False; - - return True; -} - -void init_q_unixinfo_uid_to_sid(UNIXINFO_Q_UID_TO_SID *q_d, uint64 uid) -{ - q_d->uid = uid; -} - -BOOL unixinfo_io_q_unixinfo_uid_to_sid(const char *desc, UNIXINFO_Q_UID_TO_SID *q_d, - prs_struct *ps, int depth) -{ - return prs_uint64(desc, ps, depth, &q_d->uid); -} - -void init_r_unixinfo_uid_to_sid(UNIXINFO_R_UID_TO_SID *r_d, DOM_SID *sid) -{ - if (sid == NULL) { - r_d->sidptr = 0; - return; - } - r_d->sidptr = 1; - sid_copy(&r_d->sid, sid); -} - -BOOL unixinfo_io_r_unixinfo_uid_to_sid(const char *desc, UNIXINFO_R_UID_TO_SID *r_d, - prs_struct *ps, int depth) -{ - if (!prs_uint32("sidptr", ps, depth, &r_d->sidptr)) - return False; - - if (r_d->sidptr != 0) { - if (!smb_io_dom_sid(desc, &r_d->sid, ps, depth)) - return False; - } - - if (!prs_ntstatus(desc, ps, depth, &r_d->status)) - return False; - - return True; -} - -void init_q_unixinfo_sid_to_gid(UNIXINFO_Q_SID_TO_GID *q_d, const DOM_SID *sid) -{ - sid_copy(&q_d->sid, sid); -} - -BOOL unixinfo_io_q_unixinfo_sid_to_gid(const char *desc, UNIXINFO_Q_SID_TO_GID *q_d, - prs_struct *ps, int depth) -{ - return smb_io_dom_sid(desc, &q_d->sid, ps, depth); -} - -void init_r_unixinfo_sid_to_gid(UNIXINFO_R_SID_TO_GID *r_d, uint64 gid) -{ - r_d->gid = gid; - r_d->status = NT_STATUS_OK; -} - -BOOL unixinfo_io_r_unixinfo_sid_to_gid(const char *desc, UNIXINFO_R_SID_TO_GID *r_d, - prs_struct *ps, int depth) -{ - if (!prs_uint64(desc, ps, depth, &r_d->gid)) - return False; - - if (!prs_ntstatus(desc, ps, depth, &r_d->status)) - return False; - - return True; -} - -void init_q_unixinfo_gid_to_sid(UNIXINFO_Q_GID_TO_SID *q_d, uint64 gid) -{ - q_d->gid = gid; -} - -BOOL unixinfo_io_q_unixinfo_gid_to_sid(const char *desc, UNIXINFO_Q_GID_TO_SID *q_d, - prs_struct *ps, int depth) -{ - return prs_uint64(desc, ps, depth, &q_d->gid); -} - -void init_r_unixinfo_gid_to_sid(UNIXINFO_R_GID_TO_SID *r_d, DOM_SID *sid) -{ - if (sid == NULL) { - r_d->sidptr = 0; - return; - } - r_d->sidptr = 1; - sid_copy(&r_d->sid, sid); -} - -BOOL unixinfo_io_r_unixinfo_gid_to_sid(const char *desc, UNIXINFO_R_GID_TO_SID *r_d, - prs_struct *ps, int depth) -{ - if (!prs_uint32("sidptr", ps, depth, &r_d->sidptr)) - return False; - - if (r_d->sidptr != 0) { - if (!smb_io_dom_sid(desc, &r_d->sid, ps, depth)) - return False; - } - - if (!prs_ntstatus(desc, ps, depth, &r_d->status)) - return False; - - return True; -} - -void init_q_unixinfo_getpwuid(UNIXINFO_Q_GETPWUID *r_d, int count, - uint64 *uids) -{ - r_d->count = count; - r_d->uid = uids; -} - -BOOL unixinfo_io_q_unixinfo_getpwuid(const char *desc, - UNIXINFO_Q_GETPWUID *q_d, - prs_struct *ps, int depth) -{ - uint32 arraysize; - int i; - - if (!prs_uint32("count", ps, depth, &q_d->count)) - return False; - - arraysize = q_d->count; - - if (!prs_uint32("arraysize", ps, depth, &arraysize)) - return False; - - if (arraysize != q_d->count) { - DEBUG(10, ("count!=arraysize\n")); - return False; - } - - if (q_d->count > 1023) { - DEBUG(10, ("Range exceeded\n")); - return False; - } - - if (UNMARSHALLING(ps)) { - q_d->uid = PRS_ALLOC_MEM(ps, uint64, q_d->count); - if (q_d->uid == NULL) { - return False; - } - } - - for (i=0; icount; i++) { - if (!prs_uint64(desc, ps, depth+1, &q_d->uid[i])) - return False; - } - - return True; -} - -void init_r_unixinfo_getpwuid(UNIXINFO_R_GETPWUID *r_d, uint32 count, - struct unixinfo_getpwuid *info) -{ - r_d->count = count; - r_d->info = info; -} - -BOOL unixinfo_io_r_unixinfo_getpwuid(const char *desc, - UNIXINFO_R_GETPWUID *r_d, - prs_struct *ps, int depth) -{ - uint32 arraysize; - int i; - - if (!prs_uint32("count", ps, depth, &r_d->count)) - return False; - - arraysize = r_d->count; - - if (!prs_uint32("arraysize", ps, depth, &arraysize)) - return False; - - if (arraysize != r_d->count) { - DEBUG(10, ("count!=arraysize\n")); - return False; - } - - if (r_d->count > 1023) { - DEBUG(10, ("Range exceeded\n")); - return False; - } - - if (UNMARSHALLING(ps)) { - r_d->info = PRS_ALLOC_MEM(ps, struct unixinfo_getpwuid, - r_d->count); - if (r_d->info == NULL) { - return False; - } - } - - for (i=0; icount; i++) { - if (!prs_align(ps)) - return False; - - if (!prs_ntstatus("status", ps, depth+1, &r_d->info[i].status)) - return False; - - if (!prs_string_alloc("homedir", ps, depth+1, - &r_d->info[i].homedir)) - return False; - - if (!prs_string_alloc("shell", ps, depth+1, - &r_d->info[i].shell)) - return False; - } - - if (!prs_align(ps)) - return False; - - if (!prs_ntstatus(desc, ps, depth, &r_d->status)) - return False; - - return True; -} -- cgit From e5db7fee0f5cb3bd7434cdefebabc7a8376aa0d4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 15 Sep 2006 22:49:27 +0000 Subject: r18572: Use the autogenerated client and server for the echo interface and implement some of the missing functions. RPC-ECHO now passes against Samba3. (This used to be commit 9e9a05366176454cc1779acc6c2b6070743f5939) --- source3/rpc_parse/parse_echo.c | 164 ----------------------------------------- 1 file changed, 164 deletions(-) delete mode 100644 source3/rpc_parse/parse_echo.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_echo.c b/source3/rpc_parse/parse_echo.c deleted file mode 100644 index 48dda7b171..0000000000 --- a/source3/rpc_parse/parse_echo.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * - * RPC Pipe client / server routines - * - * Copyright (C) Tim Potter 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 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "includes.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_RPC_PARSE - -void init_echo_q_add_one(ECHO_Q_ADD_ONE *q_d, uint32 request) -{ - q_d->request = request; -} - -BOOL echo_io_q_add_one(const char *desc, ECHO_Q_ADD_ONE *q_d, - prs_struct *ps, int depth) -{ - if (!prs_uint32("request", ps, 0, &q_d->request)) - return False; - - return True; -} - -BOOL echo_io_r_add_one(const char *desc, ECHO_R_ADD_ONE *q_d, - prs_struct *ps, int depth) -{ - if (!prs_uint32("response", ps, 0, &q_d->response)) - return False; - - return True; -} - - -void init_echo_q_echo_data(ECHO_Q_ECHO_DATA *q_d, uint32 size, char *data) -{ - q_d->size = size; - q_d->data = data; -} - -BOOL echo_io_q_echo_data(const char *desc, ECHO_Q_ECHO_DATA *q_d, - prs_struct *ps, int depth) -{ - if (!prs_uint32("size", ps, depth, &q_d->size)) - return False; - - if (!prs_uint32("size", ps, depth, &q_d->size)) - return False; - - if (UNMARSHALLING(ps)) { - q_d->data = PRS_ALLOC_MEM(ps, char, q_d->size); - - if (!q_d->data) - return False; - } - - if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size)) - return False; - - return True; -} - -BOOL echo_io_r_echo_data(const char *desc, ECHO_R_ECHO_DATA *q_d, - prs_struct *ps, int depth) -{ - if (!prs_uint32("size", ps, 0, &q_d->size)) - return False; - - if (UNMARSHALLING(ps)) { - q_d->data = PRS_ALLOC_MEM(ps, char, q_d->size); - - if (!q_d->data) - return False; - } - - if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size)) - return False; - - return True; -} - -void init_echo_q_sink_data(ECHO_Q_SINK_DATA *q_d, uint32 size, char *data) -{ - q_d->size = size; - q_d->data = data; -} - -BOOL echo_io_q_sink_data(const char *desc, ECHO_Q_SINK_DATA *q_d, - prs_struct *ps, int depth) -{ - if (!prs_uint32("size", ps, depth, &q_d->size)) - return False; - - if (!prs_uint32("size", ps, depth, &q_d->size)) - return False; - - if (UNMARSHALLING(ps)) { - q_d->data = PRS_ALLOC_MEM(ps, char, q_d->size); - - if (!q_d->data) - return False; - } - - if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size)) - return False; - - return True; -} - -BOOL echo_io_r_sink_data(const char *desc, ECHO_R_SINK_DATA *q_d, - prs_struct *ps, int depth) -{ - return True; -} - -void init_echo_q_source_data(ECHO_Q_SOURCE_DATA *q_d, uint32 size) -{ - q_d->size = size; -} - -BOOL echo_io_q_source_data(const char *desc, ECHO_Q_SOURCE_DATA *q_d, - prs_struct *ps, int depth) -{ - if (!prs_uint32("size", ps, depth, &q_d->size)) - return False; - - return True; -} - -BOOL echo_io_r_source_data(const char *desc, ECHO_R_SOURCE_DATA *q_d, - prs_struct *ps, int depth) -{ - if (!prs_uint32("size", ps, 0, &q_d->size)) - return False; - - if (UNMARSHALLING(ps)) { - q_d->data = PRS_ALLOC_MEM(ps, char, q_d->size); - - if (!q_d->data) - return False; - } - - if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size)) - return False; - - return True; -} -- cgit From b5fabe4cf89cf19be21ae6efcb877f556749b1bc Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 17 Sep 2006 20:28:46 +0000 Subject: r18598: Add marshalling support to smb_io_time. Volker (This used to be commit 2ab0ab326210a6e2b23a15c0cfc8f21ac2fcceac) --- source3/rpc_parse/parse_misc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index ef4d0e7689..cd2aabd056 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -124,13 +124,20 @@ BOOL smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth) if(!prs_align(ps)) return False; + + if (MARSHALLING(ps)) { + low = *nttime & 0xFFFFFFFF; + high = *nttime >> 32; + } if(!prs_uint32("low ", ps, depth, &low)) /* low part */ return False; if(!prs_uint32("high", ps, depth, &high)) /* high part */ return False; - *nttime = (((uint64_t)high << 32) + low); + if (UNMARSHALLING(ps)) { + *nttime = (((uint64_t)high << 32) + low); + } return True; } -- cgit From 4e7d11449ad419f4fa791e26e059a9f73d6d4042 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 19 Sep 2006 00:12:11 +0000 Subject: r18654: Rename "struct uuid" => "struct GUID" for consistency. (This used to be commit 5de76767e857e9d159ea46e2ded612ccd6d6bf19) --- source3/rpc_parse/parse_misc.c | 6 +++--- source3/rpc_parse/parse_net.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index cd2aabd056..401251286c 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -298,10 +298,10 @@ BOOL smb_io_dom_sid2(const char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) } /******************************************************************* - Reads or writes a struct uuid + Reads or writes a struct GUID ********************************************************************/ -BOOL smb_io_uuid(const char *desc, struct uuid *uuid, +BOOL smb_io_uuid(const char *desc, struct GUID *uuid, prs_struct *ps, int depth) { if (uuid == NULL) @@ -1704,7 +1704,7 @@ BOOL smb_io_pol_hnd(const char *desc, POLICY_HND *pol, prs_struct *ps, int depth if (!prs_uint32("handle_type", ps, depth, &pol->handle_type)) return False; - if (!smb_io_uuid("uuid", (struct uuid*)&pol->uuid, ps, depth)) + if (!smb_io_uuid("uuid", (struct GUID*)&pol->uuid, ps, depth)) return False; return True; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 5fbf9874a0..ac8921987a 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -3232,8 +3232,8 @@ BOOL net_io_r_sam_deltas(const char *desc, void init_net_q_dsr_getdcname(NET_Q_DSR_GETDCNAME *r_t, const char *server_unc, const char *domain_name, - struct uuid *domain_guid, - struct uuid *site_guid, + struct GUID *domain_guid, + struct GUID *site_guid, uint32_t flags) { DEBUG(5, ("init_net_q_dsr_getdcname\n")); @@ -3290,7 +3290,7 @@ BOOL net_io_q_dsr_getdcname(const char *desc, NET_Q_DSR_GETDCNAME *r_t, return False; if (UNMARSHALLING(ps) && (r_t->ptr_domain_guid)) { - r_t->domain_guid = PRS_ALLOC_MEM(ps, struct uuid, 1); + r_t->domain_guid = PRS_ALLOC_MEM(ps, struct GUID, 1); if (r_t->domain_guid == NULL) return False; } @@ -3306,7 +3306,7 @@ BOOL net_io_q_dsr_getdcname(const char *desc, NET_Q_DSR_GETDCNAME *r_t, return False; if (UNMARSHALLING(ps) && (r_t->ptr_site_guid)) { - r_t->site_guid = PRS_ALLOC_MEM(ps, struct uuid, 1); + r_t->site_guid = PRS_ALLOC_MEM(ps, struct GUID, 1); if (r_t->site_guid == NULL) return False; } @@ -3329,7 +3329,7 @@ BOOL net_io_q_dsr_getdcname(const char *desc, NET_Q_DSR_GETDCNAME *r_t, ********************************************************************/ 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 uuid domain_guid, const char *domain_name, + 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) -- cgit From 5864fb9fc52b8a8e16ff1a2389145c24b325a912 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 19 Sep 2006 15:53:44 +0000 Subject: r18677: quickly add samr_GetDisplayEnumerationIndex for debugging to rpcclient. Guenther (This used to be commit bd546edc482d42c6d783f474eeffa8a8086efd83) --- source3/rpc_parse/parse_samr.c | 70 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 58ba3e8689..dd98d62810 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2172,6 +2172,76 @@ BOOL samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u, return True; } +/******************************************************************* +inits a SAMR_Q_GET_DISPENUM_INDEX structure. +********************************************************************/ + +void init_samr_q_get_dispenum_index(SAMR_Q_GET_DISPENUM_INDEX * q_e, POLICY_HND *pol, + uint16 switch_level, const char *name) +{ + DEBUG(5, ("init_samr_q_get_dispenum_index\n")); + + q_e->domain_pol = *pol; + + q_e->switch_level = switch_level; + + init_lsa_string(&q_e->name, name); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_q_get_dispenum_index(const char *desc, SAMR_Q_GET_DISPENUM_INDEX * q_e, + prs_struct *ps, int depth) +{ + if (q_e == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_q_get_dispenum_index"); + 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 (!smb_io_lsa_string("name", &q_e->name, ps, depth)) + return False; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_r_get_dispenum_index(const char *desc, SAMR_R_GET_DISPENUM_INDEX * r_u, + prs_struct *ps, int depth) +{ + if (r_u == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_r_get_dispenum_index"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("idx", ps, depth, &r_u->idx)) + return False; + + if(!prs_ntstatus("status", ps, depth, &r_u->status)) + return False; + + return True; +} + + /******************************************************************* inits a SAMR_Q_OPEN_GROUP structure. ********************************************************************/ -- cgit From 1f3b19d5695022933eb73b77ade66beef0feda97 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 19 Sep 2006 16:15:54 +0000 Subject: r18678: Fix the build. (never commit before breakfeast). Guenther (This used to be commit e1e9b57ce24c9825a8904697918818df7e83b50b) --- source3/rpc_parse/parse_lsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index bd83dabed7..e1630f79f4 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2922,7 +2922,7 @@ BOOL lsa_io_r_setsystemaccount(const char *desc, LSA_R_SETSYSTEMACCOUNT *out, p } -static void init_lsa_string( LSA_STRING *uni, const char *string ) +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); -- cgit From a6ddf9bf5d2258a26f6cb5d1913ebc949678f216 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 20 Sep 2006 15:58:48 +0000 Subject: r18711: Replace the following hand code client routines: * rpccli_reg_abort_shutdown() * rpccli_reg_flush_key() Remove the cmd_reg.c from rpcclient since the entire file was unused (This used to be commit c4788f0c1398feb098f131aa5c4d0398d7489527) --- source3/rpc_parse/parse_reg.c | 52 ------------------------------------------- 1 file changed, 52 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 1820a595ed..06a2b19095 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -113,58 +113,6 @@ BOOL reg_io_r_open_hive(const char *desc, REG_R_OPEN_HIVE *r_u, return True; } -/******************************************************************* - Inits a structure. -********************************************************************/ - -void init_reg_q_flush_key(REG_Q_FLUSH_KEY *q_u, POLICY_HND *pol) -{ - memcpy(&q_u->pol, pol, sizeof(q_u->pol)); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_flush_key(const char *desc, REG_Q_FLUSH_KEY *q_u, prs_struct *ps, int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_flush_key"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -Unmarshalls a registry key flush response -********************************************************************/ - -BOOL reg_io_r_flush_key(const char *desc, REG_R_FLUSH_KEY *r_u, - prs_struct *ps, int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_flush_key"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - /******************************************************************* reads or writes SEC_DESC_BUF and SEC_DATA structures. ********************************************************************/ -- cgit From e04dda6a2ab35eb2e4dc18a8a0507517175a655e Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Wed, 20 Sep 2006 17:25:46 +0000 Subject: r18722: Fix up password change times. The can change and must change times are calculated based on the last change time, policies, and acb flags. Next step will be to not bother storing them. Right now I'm just trying to get them reported correctly. (This used to be commit fd5761c9e52cbf8f1f7e45e71693598b27ecbf57) --- source3/rpc_parse/parse_samr.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index dd98d62810..4173b0169b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6270,6 +6270,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, struct samu *pw, DOM_SID * 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); @@ -6294,12 +6295,16 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, struct samu *pw, DOM_SID * } /* 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 (&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)); - unix_to_nt_time (&pass_must_change_time,pdb_get_pass_must_change_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; -- cgit From 9dda6cdf4c3034620b90bb418bfaebeabb5aeca2 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 20 Sep 2006 17:56:50 +0000 Subject: r18725: Replace out one wkssvc call (wkssrv_GetInfo()) with autogenerated code. Removed first rpc_parse/*.c file. w00t! (This used to be commit bb9b7a058d72569bee5683856661ac063c281c9f) --- source3/rpc_parse/parse_wks.c | 178 ------------------------------------------ 1 file changed, 178 deletions(-) delete mode 100644 source3/rpc_parse/parse_wks.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c deleted file mode 100644 index b6de058652..0000000000 --- a/source3/rpc_parse/parse_wks.c +++ /dev/null @@ -1,178 +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. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "includes.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_RPC_PARSE - -/******************************************************************* - Init - ********************************************************************/ - -void init_wks_q_query_info(WKS_Q_QUERY_INFO *q_u, - char *server, uint16 switch_value) -{ - DEBUG(5,("init_wks_q_query_info\n")); - - init_buf_unistr2(&q_u->uni_srv_name, &q_u->ptr_srv_name, server); - q_u->switch_value = switch_value; -} - -/******************************************************************* - Reads or writes a WKS_Q_QUERY_INFO structure. -********************************************************************/ - -BOOL wks_io_q_query_info(const char *desc, WKS_Q_QUERY_INFO *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "wks_io_q_query_info"); - 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_uint16("switch_value", ps, depth, &q_u->switch_value)) - return False; - if(!prs_align(ps)) - return False; - - return True; -} - -/******************************************************************* - wks_info_100 - ********************************************************************/ - -void init_wks_info_100(WKS_INFO_100 *inf, - uint32 platform_id, uint32 ver_major, uint32 ver_minor, - char *my_name, char *domain_name) -{ - DEBUG(5,("Init WKS_INFO_100: %d\n", __LINE__)); - - inf->platform_id = platform_id; /* 0x0000 01f4 - unknown */ - inf->ver_major = ver_major; /* os major version */ - inf->ver_minor = ver_minor; /* os minor version */ - - init_buf_unistr2(&inf->uni_compname, &inf->ptr_compname, my_name ); - init_buf_unistr2(&inf->uni_lan_grp, &inf->ptr_lan_grp, domain_name); -} - -/******************************************************************* - Reads or writes a WKS_INFO_100 structure. -********************************************************************/ - -static BOOL wks_io_wks_info_100(const char *desc, WKS_INFO_100 *inf, prs_struct *ps, int depth) -{ - if (inf == NULL) - return False; - - prs_debug(ps, depth, desc, "wks_io_wks_info_100"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("platform_id ", ps, depth, &inf->platform_id)) /* 0x0000 01f4 - unknown */ - return False; - if(!prs_uint32("ptr_compname", ps, depth, &inf->ptr_compname)) /* pointer to computer name */ - return False; - if(!prs_uint32("ptr_lan_grp ", ps, depth, &inf->ptr_lan_grp)) /* pointer to LAN group name */ - return False; - if(!prs_uint32("ver_major ", ps, depth, &inf->ver_major)) /* 4 - major os version */ - return False; - if(!prs_uint32("ver_minor ", ps, depth, &inf->ver_minor)) /* 0 - minor os version */ - return False; - - if(!smb_io_unistr2("", &inf->uni_compname, inf->ptr_compname, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("", &inf->uni_lan_grp, inf->ptr_lan_grp , ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - return True; -} - -/******************************************************************* - Inits WKS_R_QUERY_INFO. - - only supports info level 100 at the moment. - - ********************************************************************/ - -void init_wks_r_query_info(WKS_R_QUERY_INFO *r_u, - uint32 switch_value, WKS_INFO_100 *wks100, - NTSTATUS status) -{ - DEBUG(5,("init_wks_r_unknown_0: %d\n", __LINE__)); - - r_u->switch_value = switch_value; /* same as in request */ - - r_u->ptr_1 = 1; /* pointer 1 */ - r_u->wks100 = wks100; - - r_u->status = status; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL wks_io_r_query_info(const char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "wks_io_r_query_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value)) /* level 100 (0x64) */ - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_1 ", ps, depth, &r_u->ptr_1)) /* pointer 1 */ - return False; - if(!wks_io_wks_info_100("inf", r_u->wks100, ps, depth)) - return False; - - if(!prs_ntstatus("status ", ps, depth, &r_u->status)) - return False; - - return True; -} -- cgit From 8711b490e2f7501ac85c577aaca3455c7f14a06d Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 20 Sep 2006 18:10:13 +0000 Subject: r18729: readd missing files (This used to be commit a2d61ca85c470be63c96a10a422a6b44e60f9b52) --- source3/rpc_parse/parse_wks.c | 178 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 source3/rpc_parse/parse_wks.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c new file mode 100644 index 0000000000..b6de058652 --- /dev/null +++ b/source3/rpc_parse/parse_wks.c @@ -0,0 +1,178 @@ +/* + * 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. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + +/******************************************************************* + Init + ********************************************************************/ + +void init_wks_q_query_info(WKS_Q_QUERY_INFO *q_u, + char *server, uint16 switch_value) +{ + DEBUG(5,("init_wks_q_query_info\n")); + + init_buf_unistr2(&q_u->uni_srv_name, &q_u->ptr_srv_name, server); + q_u->switch_value = switch_value; +} + +/******************************************************************* + Reads or writes a WKS_Q_QUERY_INFO structure. +********************************************************************/ + +BOOL wks_io_q_query_info(const char *desc, WKS_Q_QUERY_INFO *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "wks_io_q_query_info"); + 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_uint16("switch_value", ps, depth, &q_u->switch_value)) + return False; + if(!prs_align(ps)) + return False; + + return True; +} + +/******************************************************************* + wks_info_100 + ********************************************************************/ + +void init_wks_info_100(WKS_INFO_100 *inf, + uint32 platform_id, uint32 ver_major, uint32 ver_minor, + char *my_name, char *domain_name) +{ + DEBUG(5,("Init WKS_INFO_100: %d\n", __LINE__)); + + inf->platform_id = platform_id; /* 0x0000 01f4 - unknown */ + inf->ver_major = ver_major; /* os major version */ + inf->ver_minor = ver_minor; /* os minor version */ + + init_buf_unistr2(&inf->uni_compname, &inf->ptr_compname, my_name ); + init_buf_unistr2(&inf->uni_lan_grp, &inf->ptr_lan_grp, domain_name); +} + +/******************************************************************* + Reads or writes a WKS_INFO_100 structure. +********************************************************************/ + +static BOOL wks_io_wks_info_100(const char *desc, WKS_INFO_100 *inf, prs_struct *ps, int depth) +{ + if (inf == NULL) + return False; + + prs_debug(ps, depth, desc, "wks_io_wks_info_100"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("platform_id ", ps, depth, &inf->platform_id)) /* 0x0000 01f4 - unknown */ + return False; + if(!prs_uint32("ptr_compname", ps, depth, &inf->ptr_compname)) /* pointer to computer name */ + return False; + if(!prs_uint32("ptr_lan_grp ", ps, depth, &inf->ptr_lan_grp)) /* pointer to LAN group name */ + return False; + if(!prs_uint32("ver_major ", ps, depth, &inf->ver_major)) /* 4 - major os version */ + return False; + if(!prs_uint32("ver_minor ", ps, depth, &inf->ver_minor)) /* 0 - minor os version */ + return False; + + if(!smb_io_unistr2("", &inf->uni_compname, inf->ptr_compname, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + if(!smb_io_unistr2("", &inf->uni_lan_grp, inf->ptr_lan_grp , ps, depth)) + return False; + if(!prs_align(ps)) + return False; + + return True; +} + +/******************************************************************* + Inits WKS_R_QUERY_INFO. + + only supports info level 100 at the moment. + + ********************************************************************/ + +void init_wks_r_query_info(WKS_R_QUERY_INFO *r_u, + uint32 switch_value, WKS_INFO_100 *wks100, + NTSTATUS status) +{ + DEBUG(5,("init_wks_r_unknown_0: %d\n", __LINE__)); + + r_u->switch_value = switch_value; /* same as in request */ + + r_u->ptr_1 = 1; /* pointer 1 */ + r_u->wks100 = wks100; + + r_u->status = status; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL wks_io_r_query_info(const char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) + return False; + + prs_debug(ps, depth, desc, "wks_io_r_query_info"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value)) /* level 100 (0x64) */ + return False; + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_1 ", ps, depth, &r_u->ptr_1)) /* pointer 1 */ + return False; + if(!wks_io_wks_info_100("inf", r_u->wks100, ps, depth)) + return False; + + if(!prs_ntstatus("status ", ps, depth, &r_u->status)) + return False; + + return True; +} -- cgit From b7d069097bdc8d1d9a0694225dd1583cb60c7b3c Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 20 Sep 2006 19:26:21 +0000 Subject: r18739: * Get the wkssvc patch right this time. * Remove the old wkssvc server, client, & parsing code. * Update srv_wkssvc_nt.c with stubs for the remaining stubs (This used to be commit 0cb79ee13fd78b515a48b2c72d91596ed21e41a8) --- source3/rpc_parse/parse_wks.c | 178 ------------------------------------------ 1 file changed, 178 deletions(-) delete mode 100644 source3/rpc_parse/parse_wks.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_wks.c b/source3/rpc_parse/parse_wks.c deleted file mode 100644 index b6de058652..0000000000 --- a/source3/rpc_parse/parse_wks.c +++ /dev/null @@ -1,178 +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. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "includes.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_RPC_PARSE - -/******************************************************************* - Init - ********************************************************************/ - -void init_wks_q_query_info(WKS_Q_QUERY_INFO *q_u, - char *server, uint16 switch_value) -{ - DEBUG(5,("init_wks_q_query_info\n")); - - init_buf_unistr2(&q_u->uni_srv_name, &q_u->ptr_srv_name, server); - q_u->switch_value = switch_value; -} - -/******************************************************************* - Reads or writes a WKS_Q_QUERY_INFO structure. -********************************************************************/ - -BOOL wks_io_q_query_info(const char *desc, WKS_Q_QUERY_INFO *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "wks_io_q_query_info"); - 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_uint16("switch_value", ps, depth, &q_u->switch_value)) - return False; - if(!prs_align(ps)) - return False; - - return True; -} - -/******************************************************************* - wks_info_100 - ********************************************************************/ - -void init_wks_info_100(WKS_INFO_100 *inf, - uint32 platform_id, uint32 ver_major, uint32 ver_minor, - char *my_name, char *domain_name) -{ - DEBUG(5,("Init WKS_INFO_100: %d\n", __LINE__)); - - inf->platform_id = platform_id; /* 0x0000 01f4 - unknown */ - inf->ver_major = ver_major; /* os major version */ - inf->ver_minor = ver_minor; /* os minor version */ - - init_buf_unistr2(&inf->uni_compname, &inf->ptr_compname, my_name ); - init_buf_unistr2(&inf->uni_lan_grp, &inf->ptr_lan_grp, domain_name); -} - -/******************************************************************* - Reads or writes a WKS_INFO_100 structure. -********************************************************************/ - -static BOOL wks_io_wks_info_100(const char *desc, WKS_INFO_100 *inf, prs_struct *ps, int depth) -{ - if (inf == NULL) - return False; - - prs_debug(ps, depth, desc, "wks_io_wks_info_100"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("platform_id ", ps, depth, &inf->platform_id)) /* 0x0000 01f4 - unknown */ - return False; - if(!prs_uint32("ptr_compname", ps, depth, &inf->ptr_compname)) /* pointer to computer name */ - return False; - if(!prs_uint32("ptr_lan_grp ", ps, depth, &inf->ptr_lan_grp)) /* pointer to LAN group name */ - return False; - if(!prs_uint32("ver_major ", ps, depth, &inf->ver_major)) /* 4 - major os version */ - return False; - if(!prs_uint32("ver_minor ", ps, depth, &inf->ver_minor)) /* 0 - minor os version */ - return False; - - if(!smb_io_unistr2("", &inf->uni_compname, inf->ptr_compname, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("", &inf->uni_lan_grp, inf->ptr_lan_grp , ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - return True; -} - -/******************************************************************* - Inits WKS_R_QUERY_INFO. - - only supports info level 100 at the moment. - - ********************************************************************/ - -void init_wks_r_query_info(WKS_R_QUERY_INFO *r_u, - uint32 switch_value, WKS_INFO_100 *wks100, - NTSTATUS status) -{ - DEBUG(5,("init_wks_r_unknown_0: %d\n", __LINE__)); - - r_u->switch_value = switch_value; /* same as in request */ - - r_u->ptr_1 = 1; /* pointer 1 */ - r_u->wks100 = wks100; - - r_u->status = status; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL wks_io_r_query_info(const char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "wks_io_r_query_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value)) /* level 100 (0x64) */ - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_1 ", ps, depth, &r_u->ptr_1)) /* pointer 1 */ - return False; - if(!wks_io_wks_info_100("inf", r_u->wks100, ps, depth)) - return False; - - if(!prs_ntstatus("status ", ps, depth, &r_u->status)) - return False; - - return True; -} -- cgit From 4db7642caa99c1b054322a8971c4b673556487ce Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 20 Sep 2006 22:23:12 +0000 Subject: r18745: Use the Samba4 data structures for security descriptors and security descriptor buffers. Make security access masks simply a uint32 rather than a structure with a uint32 in it. (This used to be commit b41c52b9db5fc4a553b20a7a5a051a4afced9366) --- source3/rpc_parse/parse_reg.c | 8 ++-- source3/rpc_parse/parse_sec.c | 91 +++++++++++++++++++++------------------ source3/rpc_parse/parse_spoolss.c | 12 ++---- 3 files changed, 56 insertions(+), 55 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index 06a2b19095..f529ad1425 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -141,9 +141,9 @@ static BOOL reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, } if(!smb_io_hdrbuf_post("hdr_sec", hdr_sec, ps, depth, - hdr_offset, data->max_len, data->len)) + hdr_offset, data->sd_size, data->sd_size)) return False; - if(!prs_set_offset(ps, old_offset + data->len + + if(!prs_set_offset(ps, old_offset + data->sd_size + sizeof(uint32) * ((ptr3 != NULL) ? 5 : 3))) return False; @@ -181,7 +181,7 @@ void init_reg_q_create_key_ex(REG_Q_CREATE_KEY_EX *q_c, POLICY_HND *hnd, q_c->data = sec_buf; q_c->ptr2 = 1; - init_buf_hdr(&q_c->hdr_sec, sec_buf->len, sec_buf->len); + init_buf_hdr(&q_c->hdr_sec, sec_buf->sd_size, sec_buf->sd_size); q_c->ptr3 = 1; q_c->disposition = TALLOC_P( get_talloc_ctx(), uint32 ); if (!q_c->disposition) { @@ -704,7 +704,7 @@ void init_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_u, POLICY_HND *pol, q_u->sec_info = sec_info; q_u->ptr = 1; - init_buf_hdr(&q_u->hdr_sec, sec_desc_buf->len, sec_desc_buf->len); + init_buf_hdr(&q_u->hdr_sec, sec_desc_buf->sd_size, sec_desc_buf->sd_size); q_u->data = sec_desc_buf; } diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 6a752688a0..32a8a8cd32 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -39,7 +39,7 @@ BOOL sec_io_access(const char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "sec_io_access"); depth++; - if(!prs_uint32("mask", ps, depth, &t->mask)) + if(!prs_uint32("mask", ps, depth, t)) return False; return True; @@ -62,7 +62,7 @@ BOOL sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth) old_offset = prs_offset(ps); - if(!prs_uint8("type ", ps, depth, &psa->type)) + if(!prs_uint8("type ", ps, depth, (uint8*)&psa->type)) return False; if(!prs_uint8("flags", ps, depth, &psa->flags)) @@ -71,7 +71,7 @@ BOOL sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth) if(!prs_uint16_pre("size ", ps, depth, &psa->size, &offset_ace_size)) return False; - if(!sec_io_access("info ", &psa->info, ps, depth)) + if(!prs_uint32("access_mask", ps, depth, &psa->access_mask)) return False; /* check whether object access is present */ @@ -79,15 +79,15 @@ BOOL sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth) if (!smb_io_dom_sid("trustee ", &psa->trustee , ps, depth)) return False; } else { - if (!prs_uint32("obj_flags", ps, depth, &psa->obj_flags)) + if (!prs_uint32("obj_flags", ps, depth, &psa->object.object.flags)) return False; - if (psa->obj_flags & SEC_ACE_OBJECT_PRESENT) - if (!smb_io_uuid("obj_guid", &psa->obj_guid, ps,depth)) + if (psa->object.object.flags & SEC_ACE_OBJECT_PRESENT) + if (!smb_io_uuid("obj_guid", &psa->object.object.type.type, ps,depth)) return False; - if (psa->obj_flags & SEC_ACE_OBJECT_INHERITED_PRESENT) - if (!smb_io_uuid("inh_guid", &psa->inh_guid, ps,depth)) + if (psa->object.object.flags & SEC_ACE_OBJECT_INHERITED_PRESENT) + if (!smb_io_uuid("inh_guid", &psa->object.object.inherited_type.inherited_type, ps,depth)) return False; if(!smb_io_dom_sid("trustee ", &psa->trustee , ps, depth)) @@ -155,7 +155,7 @@ BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) old_offset = prs_offset(ps); - if(!prs_uint16("revision", ps, depth, &psa->revision)) + if(!prs_uint16("revision", ps, depth, (uint16 *)&psa->revision)) return False; if(!prs_uint16_pre("size ", ps, depth, &psa->size, &offset_acl_size)) @@ -170,14 +170,14 @@ BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) * between a non-present DACL (allow all access) and a DACL with no ACE's * (allow no access). */ - if((psa->ace = PRS_ALLOC_MEM(ps, SEC_ACE, psa->num_aces+1)) == NULL) + if((psa->aces = PRS_ALLOC_MEM(ps, SEC_ACE, psa->num_aces+1)) == NULL) return False; } for (i = 0; i < psa->num_aces; i++) { fstring tmp; slprintf(tmp, sizeof(tmp)-1, "ace_list[%02d]: ", i); - if(!sec_io_ace(tmp, &psa->ace[i], ps, depth)) + if(!sec_io_ace(tmp, &psa->aces[i], ps, depth)) return False; } @@ -211,6 +211,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) uint32 old_offset; uint32 max_offset = 0; /* after we're done, move offset to end */ uint32 tmp_offset = 0; + uint32 off_sacl, off_dacl, off_owner_sid, off_grp_sid; SEC_DESC *psd; @@ -236,7 +237,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) /* start of security descriptor stored for back-calc offset purposes */ old_offset = prs_offset(ps); - if(!prs_uint16("revision ", ps, depth, &psd->revision)) + if(!prs_uint16("revision ", ps, depth, (uint16*)&psd->revision)) return False; if(!prs_uint16("type ", ps, depth, &psd->type)) @@ -250,52 +251,52 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) */ if (psd->sacl != NULL) { - psd->off_sacl = offset; + off_sacl = offset; offset += psd->sacl->size; } else { - psd->off_sacl = 0; + off_sacl = 0; } if (psd->dacl != NULL) { - psd->off_dacl = offset; + off_dacl = offset; offset += psd->dacl->size; } else { - psd->off_dacl = 0; + off_dacl = 0; } if (psd->owner_sid != NULL) { - psd->off_owner_sid = offset; + off_owner_sid = offset; offset += sid_size(psd->owner_sid); } else { - psd->off_owner_sid = 0; + off_owner_sid = 0; } - if (psd->grp_sid != NULL) { - psd->off_grp_sid = offset; - offset += sid_size(psd->grp_sid); + if (psd->group_sid != NULL) { + off_grp_sid = offset; + offset += sid_size(psd->group_sid); } else { - psd->off_grp_sid = 0; + off_grp_sid = 0; } } - if(!prs_uint32("off_owner_sid", ps, depth, &psd->off_owner_sid)) + if(!prs_uint32("off_owner_sid", ps, depth, &off_owner_sid)) return False; - if(!prs_uint32("off_grp_sid ", ps, depth, &psd->off_grp_sid)) + if(!prs_uint32("off_grp_sid ", ps, depth, &off_grp_sid)) return False; - if(!prs_uint32("off_sacl ", ps, depth, &psd->off_sacl)) + if(!prs_uint32("off_sacl ", ps, depth, &off_sacl)) return False; - if(!prs_uint32("off_dacl ", ps, depth, &psd->off_dacl)) + if(!prs_uint32("off_dacl ", ps, depth, &off_dacl)) return False; max_offset = MAX(max_offset, prs_offset(ps)); - if (psd->off_owner_sid != 0) { + if (off_owner_sid != 0) { tmp_offset = prs_offset(ps); - if(!prs_set_offset(ps, old_offset + psd->off_owner_sid)) + if(!prs_set_offset(ps, old_offset + off_owner_sid)) return False; if (UNMARSHALLING(ps)) { @@ -313,19 +314,19 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) return False; } - if (psd->off_grp_sid != 0) { + if (psd->group_sid != 0) { tmp_offset = prs_offset(ps); - if(!prs_set_offset(ps, old_offset + psd->off_grp_sid)) + if(!prs_set_offset(ps, old_offset + off_grp_sid)) return False; if (UNMARSHALLING(ps)) { /* reading */ - if((psd->grp_sid = PRS_ALLOC_MEM(ps,DOM_SID,1)) == NULL) + if((psd->group_sid = PRS_ALLOC_MEM(ps,DOM_SID,1)) == NULL) return False; } - if(!smb_io_dom_sid("grp_sid", psd->grp_sid, ps, depth)) + if(!smb_io_dom_sid("grp_sid", psd->group_sid, ps, depth)) return False; max_offset = MAX(max_offset, prs_offset(ps)); @@ -334,9 +335,9 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) return False; } - if ((psd->type & SEC_DESC_SACL_PRESENT) && psd->off_sacl) { + if ((psd->type & SEC_DESC_SACL_PRESENT) && off_sacl) { tmp_offset = prs_offset(ps); - if(!prs_set_offset(ps, old_offset + psd->off_sacl)) + if(!prs_set_offset(ps, old_offset + off_sacl)) return False; if(!sec_io_acl("sacl", &psd->sacl, ps, depth)) return False; @@ -345,9 +346,9 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) return False; } - if ((psd->type & SEC_DESC_DACL_PRESENT) && psd->off_dacl != 0) { + if ((psd->type & SEC_DESC_DACL_PRESENT) && off_dacl != 0) { tmp_offset = prs_offset(ps); - if(!prs_set_offset(ps, old_offset + psd->off_dacl)) + if(!prs_set_offset(ps, old_offset + off_dacl)) return False; if(!sec_io_acl("dacl", &psd->dacl, ps, depth)) return False; @@ -372,7 +373,9 @@ BOOL sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int uint32 off_max_len; uint32 old_offset; uint32 size; + uint32 len; SEC_DESC_BUF *psdb; + uint32 ptr; if (ppsdb == NULL) return False; @@ -391,20 +394,22 @@ BOOL sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int if(!prs_align(ps)) return False; - if(!prs_uint32_pre("max_len", ps, depth, &psdb->max_len, &off_max_len)) + if(!prs_uint32_pre("max_len", ps, depth, &psdb->sd_size, &off_max_len)) return False; - if(!prs_uint32 ("ptr ", ps, depth, &psdb->ptr)) + ptr = 1; + if(!prs_uint32 ("ptr ", ps, depth, &ptr)) return False; - if(!prs_uint32_pre("len ", ps, depth, &psdb->len, &off_len)) + len = sec_desc_size(psdb->sd); + if(!prs_uint32_pre("len ", ps, depth, &len, &off_len)) return False; old_offset = prs_offset(ps); /* reading, length is non-zero; writing, descriptor is non-NULL */ - if ((UNMARSHALLING(ps) && psdb->len != 0) || (MARSHALLING(ps) && psdb->sec != NULL)) { - if(!sec_io_desc("sec ", &psdb->sec, ps, depth)) + if ((UNMARSHALLING(ps) && psdb->sd_size != 0) || (MARSHALLING(ps) && psdb->sd != NULL)) { + if(!sec_io_desc("sec ", &psdb->sd, ps, depth)) return False; } @@ -412,10 +417,10 @@ BOOL sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int return False; size = prs_offset(ps) - old_offset; - if(!prs_uint32_post("max_len", ps, depth, &psdb->max_len, off_max_len, size == 0 ? psdb->max_len : size)) + if(!prs_uint32_post("max_len", ps, depth, &psdb->sd_size, off_max_len, size == 0 ? psdb->sd_size : size)) return False; - if(!prs_uint32_post("len ", ps, depth, &psdb->len, off_len, size)) + if(!prs_uint32_post("len ", ps, depth, &len, off_len, size)) return False; return True; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index ec64e10a59..e878744a1b 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3775,10 +3775,8 @@ BOOL make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, q_u->secdesc_ctr = SMB_MALLOC_P(SEC_DESC_BUF); if (!q_u->secdesc_ctr) return False; - q_u->secdesc_ctr->ptr = (secdesc != NULL) ? 1: 0; - q_u->secdesc_ctr->max_len = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0; - q_u->secdesc_ctr->len = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0; - q_u->secdesc_ctr->sec = secdesc; + q_u->secdesc_ctr->sd = secdesc; + q_u->secdesc_ctr->sd_size = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0; q_u->devmode_ctr.devmode_ptr = (devmode != NULL) ? 1 : 0; q_u->devmode_ctr.size = (devmode != NULL) ? sizeof(DEVICEMODE) + (3*sizeof(uint32)) : 0; @@ -3799,10 +3797,8 @@ BOOL make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, q_u->secdesc_ctr = SMB_MALLOC_P(SEC_DESC_BUF); if (!q_u->secdesc_ctr) return False; - q_u->secdesc_ctr->ptr = (secdesc != NULL) ? 1: 0; - q_u->secdesc_ctr->max_len = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0; - q_u->secdesc_ctr->len = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0; - q_u->secdesc_ctr->sec = secdesc; + q_u->secdesc_ctr->sd_size = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0; + q_u->secdesc_ctr->sd = secdesc; break; case 7: -- cgit From 7ba2554d88a187ca1f4f40014363fdf9de2223a0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Sep 2006 23:57:32 +0000 Subject: r18802: Use the pidl-generated code for the srvsvc interface, both client and server code. This has had some basic testing. I'll do more during the next couple of days and hopefully also make RPC-SRVSVC from Samba4 pass against it. (This used to be commit ef10672399c4b82700dc431b4d93431ffdd42d98) --- source3/rpc_parse/parse_misc.c | 47 - source3/rpc_parse/parse_srv.c | 3557 ---------------------------------------- 2 files changed, 3604 deletions(-) delete mode 100644 source3/rpc_parse/parse_srv.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 401251286c..efc5274f45 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -151,53 +151,6 @@ BOOL smb_io_nttime(const char *desc, prs_struct *ps, int depth, NTTIME *nttime) return smb_io_time( desc, nttime, ps, depth ); } -/******************************************************************* - Gets an enumeration handle from an ENUM_HND structure. -********************************************************************/ - -uint32 get_enum_hnd(ENUM_HND *enh) -{ - return (enh && enh->ptr_hnd != 0) ? enh->handle : 0; -} - -/******************************************************************* - Inits an ENUM_HND structure. -********************************************************************/ - -void init_enum_hnd(ENUM_HND *enh, uint32 hnd) -{ - DEBUG(5,("smb_io_enum_hnd\n")); - - enh->ptr_hnd = (hnd != 0) ? 1 : 0; - enh->handle = hnd; -} - -/******************************************************************* - Reads or writes an ENUM_HND structure. -********************************************************************/ - -BOOL smb_io_enum_hnd(const char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) -{ - if (hnd == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_enum_hnd"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_hnd", ps, depth, &hnd->ptr_hnd)) /* pointer */ - return False; - - if (hnd->ptr_hnd != 0) { - if(!prs_uint32("handle ", ps, depth, &hnd->handle )) /* enum handle */ - return False; - } - - return True; -} - /******************************************************************* Reads or writes a DOM_SID structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c deleted file mode 100644 index 5123d1c2cc..0000000000 --- a/source3/rpc_parse/parse_srv.c +++ /dev/null @@ -1,3557 +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) Jeremy Allison 1999, - * Copyright (C) Nigel Williams 2001, - * Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2002. - * Copyright (C) Gerald (Jerry) Carter 2006. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "includes.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_RPC_PARSE - -/******************************************************************* - Inits a SH_INFO_0_STR structure -********************************************************************/ - -void init_srv_share_info0_str(SH_INFO_0_STR *sh0, const char *net_name) -{ - DEBUG(5,("init_srv_share_info0_str\n")); - - init_unistr2(&sh0->uni_netname, net_name, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_share_info0_str(const char *desc, SH_INFO_0_STR *sh0, prs_struct *ps, int depth) -{ - if (sh0 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info0_str"); - depth++; - - if(!prs_align(ps)) - return False; - if(sh0->ptrs->ptr_netname) - if(!smb_io_unistr2("", &sh0->uni_netname, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - makes a SH_INFO_0 structure -********************************************************************/ - -void init_srv_share_info0(SH_INFO_0 *sh0, const char *net_name) -{ - DEBUG(5,("init_srv_share_info0: %s\n", net_name)); - - sh0->ptr_netname = (net_name != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_share_info0(const char *desc, SH_INFO_0 *sh0, prs_struct *ps, int depth) -{ - if (sh0 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info0"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_netname", ps, depth, &sh0->ptr_netname)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_1_STR structure -********************************************************************/ - -void init_srv_share_info1_str(SH_INFO_1_STR *sh1, const char *net_name, const char *remark) -{ - DEBUG(5,("init_srv_share_info1_str\n")); - - init_unistr2(&sh1->uni_netname, net_name, UNI_STR_TERMINATE); - init_unistr2(&sh1->uni_remark, remark, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_share_info1_str(const char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth) -{ - if (sh1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if(sh1->ptrs->ptr_netname) - if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(sh1->ptrs->ptr_remark) - if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - makes a SH_INFO_1 structure -********************************************************************/ - -void init_srv_share_info1(SH_INFO_1 *sh1, const char *net_name, uint32 type, const char *remark) -{ - DEBUG(5,("init_srv_share_info1: %s %8x %s\n", net_name, type, remark)); - - sh1->ptr_netname = (net_name != NULL) ? 1 : 0; - sh1->type = type; - sh1->ptr_remark = (remark != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_share_info1(const char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) -{ - if (sh1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_netname", ps, depth, &sh1->ptr_netname)) - return False; - if(!prs_uint32("type ", ps, depth, &sh1->type)) - return False; - if(!prs_uint32("ptr_remark ", ps, depth, &sh1->ptr_remark)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_2_STR structure -********************************************************************/ - -void init_srv_share_info2_str(SH_INFO_2_STR *sh2, - const char *net_name, const char *remark, - const char *path, const char *passwd) -{ - DEBUG(5,("init_srv_share_info2_str\n")); - - init_unistr2(&sh2->uni_netname, net_name, UNI_STR_TERMINATE); - init_unistr2(&sh2->uni_remark, remark, UNI_STR_TERMINATE); - init_unistr2(&sh2->uni_path, path, UNI_STR_TERMINATE); - init_unistr2(&sh2->uni_passwd, passwd, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_share_info2_str(const char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) -{ - if (sh2 == NULL) - return False; - - if (UNMARSHALLING(ps)) - ZERO_STRUCTP(sh2); - - prs_debug(ps, depth, desc, "srv_io_share_info2_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if (sh->ptr_netname) - if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth)) - return False; - - if (sh->ptr_remark) - if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth)) - return False; - - if (sh->ptr_netname) - if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth)) - return False; - - if (sh->ptr_passwd) - if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_2 structure -********************************************************************/ - -void init_srv_share_info2(SH_INFO_2 *sh2, - const char *net_name, uint32 type, const char *remark, - uint32 perms, uint32 max_uses, uint32 num_uses, - const char *path, const char *passwd) -{ - DEBUG(5,("init_srv_share_info2: %s %8x %s\n", net_name, type, remark)); - - sh2->ptr_netname = (net_name != NULL) ? 1 : 0; - sh2->type = type; - sh2->ptr_remark = (remark != NULL) ? 1 : 0; - sh2->perms = perms; - sh2->max_uses = max_uses; - sh2->num_uses = num_uses; - sh2->ptr_path = (path != NULL) ? 1 : 0; - sh2->ptr_passwd = (passwd != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_share_info2(const char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) -{ - if (sh2 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_netname", ps, depth, &sh2->ptr_netname)) - return False; - if(!prs_uint32("type ", ps, depth, &sh2->type)) - return False; - if(!prs_uint32("ptr_remark ", ps, depth, &sh2->ptr_remark)) - return False; - if(!prs_uint32("perms ", ps, depth, &sh2->perms)) - return False; - if(!prs_uint32("max_uses ", ps, depth, &sh2->max_uses)) - return False; - if(!prs_uint32("num_uses ", ps, depth, &sh2->num_uses)) - return False; - if(!prs_uint32("ptr_path ", ps, depth, &sh2->ptr_path)) - return False; - if(!prs_uint32("ptr_passwd ", ps, depth, &sh2->ptr_passwd)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_501_STR structure -********************************************************************/ - -void init_srv_share_info501_str(SH_INFO_501_STR *sh501, - const char *net_name, const char *remark) -{ - DEBUG(5,("init_srv_share_info501_str\n")); - - init_unistr2(&sh501->uni_netname, net_name, UNI_STR_TERMINATE); - init_unistr2(&sh501->uni_remark, remark, UNI_STR_TERMINATE); -} - -/******************************************************************* - Inits a SH_INFO_2 structure -*******************************************************************/ - -void init_srv_share_info501(SH_INFO_501 *sh501, const char *net_name, uint32 type, const char *remark, uint32 csc_policy) -{ - DEBUG(5,("init_srv_share_info501: %s %8x %s %08x\n", net_name, type, - remark, csc_policy)); - - ZERO_STRUCTP(sh501); - - sh501->ptr_netname = (net_name != NULL) ? 1 : 0; - sh501->type = type; - sh501->ptr_remark = (remark != NULL) ? 1 : 0; - sh501->csc_policy = csc_policy; -} - -/******************************************************************* - Reads of writes a structure. -*******************************************************************/ - -static BOOL srv_io_share_info501(const char *desc, SH_INFO_501 *sh501, prs_struct *ps, int depth) -{ - if (sh501 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info501"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("ptr_netname", ps, depth, &sh501->ptr_netname)) - return False; - if (!prs_uint32("type ", ps, depth, &sh501->type)) - return False; - if (!prs_uint32("ptr_remark ", ps, depth, &sh501->ptr_remark)) - return False; - if (!prs_uint32("csc_policy ", ps, depth, &sh501->csc_policy)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_share_info501_str(const char *desc, SH_INFO_501_STR *sh501, prs_struct *ps, int depth) -{ - if (sh501 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info501_str"); - depth++; - - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("", &sh501->uni_netname, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("", &sh501->uni_remark, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_502 structure -********************************************************************/ - -void init_srv_share_info502(SH_INFO_502 *sh502, - const char *net_name, uint32 type, const char *remark, - uint32 perms, uint32 max_uses, uint32 num_uses, - const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size) -{ - DEBUG(5,("init_srv_share_info502: %s %8x %s\n", net_name, type, remark)); - - ZERO_STRUCTP(sh502); - - sh502->ptr_netname = (net_name != NULL) ? 1 : 0; - sh502->type = type; - sh502->ptr_remark = (remark != NULL) ? 1 : 0; - sh502->perms = perms; - sh502->max_uses = max_uses; - sh502->num_uses = num_uses; - sh502->ptr_path = (path != NULL) ? 1 : 0; - sh502->ptr_passwd = (passwd != NULL) ? 1 : 0; - sh502->reserved = 0; /* actual size within rpc */ - sh502->sd_size = (uint32)sd_size; - sh502->ptr_sd = (psd != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_share_info502(const char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth) -{ - if (sh502 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info502"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_netname", ps, depth, &sh502->ptr_netname)) - return False; - if(!prs_uint32("type ", ps, depth, &sh502->type)) - return False; - if(!prs_uint32("ptr_remark ", ps, depth, &sh502->ptr_remark)) - return False; - if(!prs_uint32("perms ", ps, depth, &sh502->perms)) - return False; - if(!prs_uint32("max_uses ", ps, depth, &sh502->max_uses)) - return False; - if(!prs_uint32("num_uses ", ps, depth, &sh502->num_uses)) - return False; - if(!prs_uint32("ptr_path ", ps, depth, &sh502->ptr_path)) - return False; - if(!prs_uint32("ptr_passwd ", ps, depth, &sh502->ptr_passwd)) - return False; - if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &sh502->reserved_offset)) - return False; - if(!prs_uint32("ptr_sd ", ps, depth, &sh502->ptr_sd)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_502_STR structure -********************************************************************/ - -void init_srv_share_info502_str(SH_INFO_502_STR *sh502str, - const char *net_name, const char *remark, - const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size) -{ - DEBUG(5,("init_srv_share_info502_str\n")); - - init_unistr2(&sh502str->uni_netname, net_name, UNI_STR_TERMINATE); - init_unistr2(&sh502str->uni_remark, remark, UNI_STR_TERMINATE); - init_unistr2(&sh502str->uni_path, path, UNI_STR_TERMINATE); - init_unistr2(&sh502str->uni_passwd, passwd, UNI_STR_TERMINATE); - sh502str->sd = psd; - sh502str->reserved = 0; - sh502str->sd_size = sd_size; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_share_info502_str(const char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth) -{ - if (sh502 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info502_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if(sh502->ptrs->ptr_netname) { - if(!smb_io_unistr2("", &sh502->uni_netname, True, ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - - if(sh502->ptrs->ptr_remark) { - if(!smb_io_unistr2("", &sh502->uni_remark, True, ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - - if(sh502->ptrs->ptr_path) { - if(!smb_io_unistr2("", &sh502->uni_path, True, ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - - if(sh502->ptrs->ptr_passwd) { - if(!smb_io_unistr2("", &sh502->uni_passwd, True, ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - - if(sh502->ptrs->ptr_sd) { - uint32 old_offset; - uint32 reserved_offset; - - if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &reserved_offset)) - return False; - - old_offset = prs_offset(ps); - - if (!sec_io_desc(desc, &sh502->sd, ps, depth)) - return False; - - if(UNMARSHALLING(ps)) { - - sh502->ptrs->sd_size = sh502->sd_size = sec_desc_size(sh502->sd); - - prs_set_offset(ps, old_offset + sh502->reserved); - } - - prs_align(ps); - - if(MARSHALLING(ps)) { - - sh502->ptrs->reserved = sh502->reserved = prs_offset(ps) - old_offset; - } - - if(!prs_uint32_post("reserved ", ps, depth, - &sh502->reserved, reserved_offset, sh502->reserved)) - return False; - if(!prs_uint32_post("reserved ", ps, depth, - &sh502->ptrs->reserved, sh502->ptrs->reserved_offset, sh502->ptrs->reserved)) - return False; - } - - return True; -} - -/******************************************************************* - Inits a SH_INFO_1004_STR structure -********************************************************************/ - -void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, const char *remark) -{ - DEBUG(5,("init_srv_share_info1004_str\n")); - - init_unistr2(&sh1004->uni_remark, remark, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_share_info1004_str(const char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth) -{ - if (sh1004 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1004_str"); - depth++; - - if(!prs_align(ps)) - return False; - if(sh1004->ptrs->ptr_remark) - if(!smb_io_unistr2("", &sh1004->uni_remark, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - makes a SH_INFO_1004 structure -********************************************************************/ - -void init_srv_share_info1004(SH_INFO_1004 *sh1004, const char *remark) -{ - DEBUG(5,("init_srv_share_info1004: %s\n", remark)); - - sh1004->ptr_remark = (remark != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_share_info1004(const char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth) -{ - if (sh1004 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1004"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_remark", ps, depth, &sh1004->ptr_remark)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_share_info1005(const char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth) -{ - if(sh1005 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1005"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("share_info_flags", ps, depth, - &sh1005->share_info_flags)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_share_info1006(const char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth) -{ - if(sh1006 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1006"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("max uses ", ps, depth, &sh1006->max_uses)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_1007_STR structure -********************************************************************/ - -void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate_directory_name) -{ - DEBUG(5,("init_srv_share_info1007_str\n")); - - init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_share_info1007_str(const char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth) -{ - if (sh1007 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1007_str"); - depth++; - - if(!prs_align(ps)) - return False; - if(sh1007->ptrs->ptr_AlternateDirectoryName) - if(!smb_io_unistr2("", &sh1007->uni_AlternateDirectoryName, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - makes a SH_INFO_1007 structure -********************************************************************/ - -void init_srv_share_info1007(SH_INFO_1007 *sh1007, uint32 flags, const char *alternate_directory_name) -{ - DEBUG(5,("init_srv_share_info1007: %s\n", alternate_directory_name)); - - sh1007->flags = flags; - sh1007->ptr_AlternateDirectoryName = (alternate_directory_name != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_share_info1007(const char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth) -{ - if (sh1007 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1007"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("flags ", ps, depth, &sh1007->flags)) - return False; - if(!prs_uint32("ptr_Alter..", ps, depth, &sh1007->ptr_AlternateDirectoryName)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_share_info1501(const char* desc, SRV_SHARE_INFO_1501* sh1501, - prs_struct* ps, int depth) -{ - if(sh1501 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1501"); - depth++; - - if(!prs_align(ps)) - return False; - - if (!sec_io_desc_buf(desc, &sh1501->sdb, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth) -{ - if (ctr == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_share_ctr"); - depth++; - - if (UNMARSHALLING(ps)) { - memset(ctr, '\0', sizeof(SRV_SHARE_INFO_CTR)); - } - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("info_level", ps, depth, &ctr->info_level)) - return False; - - if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) - return False; - if(!prs_uint32("ptr_share_info", ps, depth, &ctr->ptr_share_info)) - return False; - - if (ctr->ptr_share_info == 0) - return True; - - if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries)) - return False; - if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries)) - return False; - - if (ctr->ptr_entries == 0) { - if (ctr->num_entries == 0) - return True; - else - return False; - } - - if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2)) - return False; - - if (ctr->num_entries2 != ctr->num_entries) - return False; - - switch (ctr->switch_value) { - - case 0: - { - SRV_SHARE_INFO_0 *info0 = ctr->share.info0; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps)) { - if (!(info0 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_0, num_entries))) - return False; - ctr->share.info0 = info0; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info0("", &info0[i].info_0, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - info0[i].info_0_str.ptrs = &info0[i].info_0; - if(!srv_io_share_info0_str("", &info0[i].info_0_str, ps, depth)) - return False; - } - - break; - } - - case 1: - { - SRV_SHARE_INFO_1 *info1 = ctr->share.info1; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps)) { - if (!(info1 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_1, num_entries))) - return False; - ctr->share.info1 = info1; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1("", &info1[i].info_1, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - info1[i].info_1_str.ptrs = &info1[i].info_1; - if(!srv_io_share_info1_str("", &info1[i].info_1_str, ps, depth)) - return False; - } - - break; - } - - case 2: - { - SRV_SHARE_INFO_2 *info2 = ctr->share.info2; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps)) { - if (!(info2 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_2,num_entries))) - return False; - ctr->share.info2 = info2; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info2("", &info2[i].info_2, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info2_str("", &info2[i].info_2, &info2[i].info_2_str, ps, depth)) - return False; - } - - break; - } - - case 501: - { - SRV_SHARE_INFO_501 *info501 = ctr->share.info501; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps)) { - if (!(info501 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_501, num_entries))) - return False; - ctr->share.info501 = info501; - } - - for (i = 0; i < num_entries; i++) { - if (!srv_io_share_info501("", &info501[i].info_501, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - if (!srv_io_share_info501_str("", &info501[i].info_501_str, ps, depth)) - return False; - } - - break; - } - - case 502: - { - SRV_SHARE_INFO_502 *info502 = ctr->share.info502; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps)) { - if (!(info502 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_502,num_entries))) - return False; - ctr->share.info502 = info502; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info502("", &info502[i].info_502, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - info502[i].info_502_str.ptrs = &info502[i].info_502; - if(!srv_io_share_info502_str("", &info502[i].info_502_str, ps, depth)) - return False; - } - - break; - } - - case 1004: - { - SRV_SHARE_INFO_1004 *info1004 = ctr->share.info1004; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps)) { - if (!(info1004 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1004,num_entries))) - return False; - ctr->share.info1004 = info1004; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1004("", &info1004[i].info_1004, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - info1004[i].info_1004_str.ptrs = &info1004[i].info_1004; - if(!srv_io_share_info1004_str("", &info1004[i].info_1004_str, ps, depth)) - return False; - } - - break; - } - - case 1005: - { - SRV_SHARE_INFO_1005 *info1005 = ctr->share.info1005; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps)) { - if (!(info1005 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1005,num_entries))) - return False; - ctr->share.info1005 = info1005; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1005("", &info1005[i], ps, depth)) - return False; - } - - break; - } - - case 1006: - { - SRV_SHARE_INFO_1006 *info1006 = ctr->share.info1006; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps)) { - if (!(info1006 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1006,num_entries))) - return False; - ctr->share.info1006 = info1006; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1006("", &info1006[i], ps, depth)) - return False; - } - - break; - } - - case 1007: - { - SRV_SHARE_INFO_1007 *info1007 = ctr->share.info1007; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps)) { - if (!(info1007 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1007,num_entries))) - return False; - ctr->share.info1007 = info1007; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1007("", &info1007[i].info_1007, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - info1007[i].info_1007_str.ptrs = &info1007[i].info_1007; - if(!srv_io_share_info1007_str("", &info1007[i].info_1007_str, ps, depth)) - return False; - } - - break; - } - - case 1501: - { - SRV_SHARE_INFO_1501 *info1501 = ctr->share.info1501; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps)) { - if (!(info1501 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1501,num_entries))) - return False; - ctr->share.info1501 = info1501; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1501("", &info1501[i], ps, depth)) - return False; - } - - break; - } - - default: - DEBUG(5,("%s no share info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); - break; - } - - return True; -} - -/******************************************************************* - Inits a SRV_Q_NET_SHARE_ENUM structure. -********************************************************************/ - -void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, - const char *srv_name, uint32 info_level, - uint32 preferred_len, ENUM_HND *hnd) -{ - - DEBUG(5,("init_q_net_share_enum\n")); - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - - q_n->ctr.info_level = q_n->ctr.switch_value = info_level; - q_n->ctr.ptr_share_info = 1; - q_n->ctr.num_entries = 0; - q_n->ctr.ptr_entries = 0; - q_n->ctr.num_entries2 = 0; - q_n->preferred_len = preferred_len; - - memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_q_net_share_enum(const char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_share_enum"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!srv_io_srv_share_ctr("share_ctr", &q_n->ctr, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) - return False; - - if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_r_net_share_enum(const char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_share_enum"); - depth++; - - if(!srv_io_srv_share_ctr("share_ctr", &r_n->ctr, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) - return False; - - if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - initialises a structure. -********************************************************************/ - -BOOL init_srv_q_net_share_get_info(SRV_Q_NET_SHARE_GET_INFO *q_n, const char *srv_name, const char *share_name, uint32 info_level) -{ - - uint32 ptr_share_name; - - DEBUG(5,("init_srv_q_net_share_get_info\n")); - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name); - - q_n->info_level = info_level; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_q_net_share_get_info(const char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_share_get_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("info_level", ps, depth, &q_n->info_level)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_srv_share_info(const char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_share_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value )) - return False; - - if(!prs_uint32("ptr_share_ctr", ps, depth, &r_n->ptr_share_ctr)) - return False; - - if (r_n->ptr_share_ctr != 0) { - switch (r_n->switch_value) { - case 0: - if(!srv_io_share_info0("", &r_n->share.info0.info_0, ps, depth)) - return False; - - /* allow access to pointers in the str part. */ - r_n->share.info0.info_0_str.ptrs = &r_n->share.info0.info_0; - - if(!srv_io_share_info0_str("", &r_n->share.info0.info_0_str, ps, depth)) - return False; - - break; - case 1: - if(!srv_io_share_info1("", &r_n->share.info1.info_1, ps, depth)) - return False; - - /* allow access to pointers in the str part. */ - r_n->share.info1.info_1_str.ptrs = &r_n->share.info1.info_1; - - if(!srv_io_share_info1_str("", &r_n->share.info1.info_1_str, ps, depth)) - return False; - - break; - case 2: - if(!srv_io_share_info2("", &r_n->share.info2.info_2, ps, depth)) - return False; - - if(!srv_io_share_info2_str("", &r_n->share.info2.info_2, &r_n->share.info2.info_2_str, ps, depth)) - return False; - - break; - case 501: - if (!srv_io_share_info501("", &r_n->share.info501.info_501, ps, depth)) - return False; - if (!srv_io_share_info501_str("", &r_n->share.info501.info_501_str, ps, depth)) - return False; - break; - - case 502: - if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth)) - return False; - - /* allow access to pointers in the str part. */ - r_n->share.info502.info_502_str.ptrs = &r_n->share.info502.info_502; - - if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth)) - return False; - break; - case 1004: - if(!srv_io_share_info1004("", &r_n->share.info1004.info_1004, ps, depth)) - return False; - - /* allow access to pointers in the str part. */ - r_n->share.info1004.info_1004_str.ptrs = &r_n->share.info1004.info_1004; - - if(!srv_io_share_info1004_str("", &r_n->share.info1004.info_1004_str, ps, depth)) - return False; - break; - case 1005: - if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth)) - return False; - break; - case 1006: - if(!srv_io_share_info1006("", &r_n->share.info1006, ps, depth)) - return False; - break; - case 1007: - if(!srv_io_share_info1007("", &r_n->share.info1007.info_1007, ps, depth)) - return False; - - /* allow access to pointers in the str part. */ - r_n->share.info1007.info_1007_str.ptrs = &r_n->share.info1007.info_1007; - - if(!srv_io_share_info1007_str("", &r_n->share.info1007.info_1007_str, ps, depth)) - return False; - break; - case 1501: - if (!srv_io_share_info1501("", &r_n->share.info1501, ps, depth)) - return False; - default: - DEBUG(5,("%s no share info at switch_value %d\n", - tab_depth(depth), r_n->switch_value)); - break; - } - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_r_net_share_get_info(const char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_share_get_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!srv_io_srv_share_info("info ", ps, depth, &r_n->info)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - intialises a structure. -********************************************************************/ - -BOOL init_srv_q_net_share_set_info(SRV_Q_NET_SHARE_SET_INFO *q_n, - const char *srv_name, - const char *share_name, - uint32 info_level, - const SRV_SHARE_INFO *info) -{ - - uint32 ptr_share_name; - - DEBUG(5,("init_srv_q_net_share_set_info\n")); - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name); - - q_n->info_level = info_level; - - q_n->info = *info; - - q_n->ptr_parm_error = 1; - q_n->parm_error = 0; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_q_net_share_set_info(const char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_share_set_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("info_level", ps, depth, &q_n->info_level)) - return False; - - if(!prs_align(ps)) - return False; - - if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info)) - return False; - - if(!prs_align(ps)) - return False; - if(!prs_uint32("ptr_parm_error", ps, depth, &q_n->ptr_parm_error)) - return False; - if(q_n->ptr_parm_error!=0) { - if(!prs_uint32("parm_error", ps, depth, &q_n->parm_error)) - return False; - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_r_net_share_set_info(const char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_share_set_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_parm_error ", ps, depth, &r_n->ptr_parm_error)) - return False; - - if(r_n->ptr_parm_error) { - - if(!prs_uint32("parm_error ", ps, depth, &r_n->parm_error)) - return False; - } - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_q_net_share_add(const char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_share_add"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("info_level", ps, depth, &q_n->info_level)) - return False; - - if(!prs_align(ps)) - return False; - - if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_err_index", ps, depth, &q_n->ptr_err_index)) - return False; - if (q_n->ptr_err_index) - if (!prs_uint32("err_index", ps, depth, &q_n->err_index)) - return False; - - return True; -} - -void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname, - const char *netname, uint32 type, const char *remark, - uint32 perms, uint32 max_uses, uint32 num_uses, - const char *path, const char *passwd, - int level, SEC_DESC *sd) -{ - switch(level) { - case 502: { - size_t sd_size = sec_desc_size(sd); - q->ptr_srv_name = 1; - init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE); - q->info.switch_value = q->info_level = level; - q->info.ptr_share_ctr = 1; - init_srv_share_info502(&q->info.share.info502.info_502, netname, type, - remark, perms, max_uses, num_uses, path, passwd, sd, sd_size); - init_srv_share_info502_str(&q->info.share.info502.info_502_str, netname, - remark, path, passwd, sd, sd_size); - q->ptr_err_index = 1; - q->err_index = 0; - } - break; - case 2: - default: - q->ptr_srv_name = 1; - init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE); - q->info.switch_value = q->info_level = level; - q->info.ptr_share_ctr = 1; - init_srv_share_info2(&q->info.share.info2.info_2, netname, type, - remark, perms, max_uses, num_uses, path, passwd); - init_srv_share_info2_str(&q->info.share.info2.info_2_str, netname, - remark, path, passwd); - q->ptr_err_index = 1; - q->err_index = 0; - break; - } -} - - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_r_net_share_add(const char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_share_add"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_parm_error", ps, depth, &r_n->ptr_parm_error)) - return False; - - if(r_n->ptr_parm_error) { - - if(!prs_uint32("parm_error", ps, depth, &r_n->parm_error)) - return False; - } - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - initialises a structure. -********************************************************************/ - -void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname, - const char *sharename) -{ - del->ptr_srv_name = 1; - init_unistr2(&del->uni_srv_name, srvname, UNI_STR_TERMINATE); - init_unistr2(&del->uni_share_name, sharename, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_q_net_share_del(const char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_share_del"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - if(!prs_uint32("reserved", ps, depth, &q_n->reserved)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_r_net_share_del(const char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_share_del"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &q_n->status)) - return False; - - return True; -} - -/******************************************************************* - Inits a SESS_INFO_0_STR structure -********************************************************************/ - -void init_srv_sess_info0( SESS_INFO_0 *ss0, const char *name ) -{ - ZERO_STRUCTP( ss0 ); - - if ( name ) { - if ( (ss0->sharename = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) { - DEBUG(0,("init_srv_sess_info0: talloc failed!\n")); - return; - } - init_unistr2( ss0->sharename, name, UNI_STR_TERMINATE ); - } -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth) -{ - if (ss0 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read)) - return False; - if(!prs_uint32("ptr_sess_info", ps, depth, &ss0->ptr_sess_info)) - return False; - - if (ss0->ptr_sess_info != 0) { - uint32 i; - uint32 num_entries = ss0->num_entries_read; - - if (num_entries > MAX_SESS_ENTRIES) { - num_entries = MAX_SESS_ENTRIES; /* report this! */ - } - - if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2)) - return False; - - SMB_ASSERT_ARRAY(ss0->info_0, num_entries); - - /* first the pointers */ - for (i = 0; i < num_entries; i++) { - if ( !prs_io_unistr2_p("", ps, depth, &ss0->info_0[i].sharename ) ) - return False; - } - - /* now the strings */ - for (i = 0; i < num_entries; i++) { - if ( !prs_io_unistr2("sharename", ps, depth, ss0->info_0[i].sharename )) - return False; - } - - if(!prs_align(ps)) - return False; - } - - return True; -} - -/******************************************************************* - Inits a SESS_INFO_1 structure -********************************************************************/ - -void init_srv_sess_info1( SESS_INFO_1 *ss1, const char *name, const char *user, - uint32 num_opens, uint32 open_time, uint32 idle_time, - uint32 user_flags) -{ - DEBUG(5,("init_srv_sess_info1: %s\n", name)); - - ZERO_STRUCTP( ss1 ); - - if ( name ) { - if ( (ss1->sharename = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) { - DEBUG(0,("init_srv_sess_info0: talloc failed!\n")); - return; - } - init_unistr2( ss1->sharename, name, UNI_STR_TERMINATE ); - } - - if ( user ) { - if ( (ss1->username = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) { - DEBUG(0,("init_srv_sess_info0: talloc failed!\n")); - return; - } - init_unistr2( ss1->username, user, UNI_STR_TERMINATE ); - } - - ss1->num_opens = num_opens; - ss1->open_time = open_time; - ss1->idle_time = idle_time; - ss1->user_flags = user_flags; -} - - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_srv_sess_info_1(const char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth) -{ - if (ss1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read)) - return False; - if(!prs_uint32("ptr_sess_info", ps, depth, &ss1->ptr_sess_info)) - return False; - - if (ss1->ptr_sess_info != 0) { - uint32 i; - uint32 num_entries = ss1->num_entries_read; - - if (num_entries > MAX_SESS_ENTRIES) { - num_entries = MAX_SESS_ENTRIES; /* report this! */ - } - - if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2)) - return False; - - SMB_ASSERT_ARRAY(ss1->info_1, num_entries); - - /* first the pointers and flags */ - - for (i = 0; i < num_entries; i++) { - - if ( !prs_io_unistr2_p("", ps, depth, &ss1->info_1[i].sharename )) - return False; - if ( !prs_io_unistr2_p("", ps, depth, &ss1->info_1[i].username )) - return False; - - if(!prs_uint32("num_opens ", ps, depth, &ss1->info_1[i].num_opens)) - return False; - if(!prs_uint32("open_time ", ps, depth, &ss1->info_1[i].open_time)) - return False; - if(!prs_uint32("idle_time ", ps, depth, &ss1->info_1[i].idle_time)) - return False; - if(!prs_uint32("user_flags", ps, depth, &ss1->info_1[i].user_flags)) - return False; - } - - /* now the strings */ - - for (i = 0; i < num_entries; i++) { - if ( !prs_io_unistr2("", ps, depth, ss1->info_1[i].sharename )) - return False; - if ( !prs_io_unistr2("", ps, depth, ss1->info_1[i].username )) - return False; - } - - if(!prs_align(ps)) - return False; - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth) -{ - SRV_SESS_INFO_CTR *ctr = *pp_ctr; - - prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr"); - depth++; - - if(UNMARSHALLING(ps)) { - ctr = *pp_ctr = PRS_ALLOC_MEM(ps, SRV_SESS_INFO_CTR, 1); - if (ctr == NULL) - return False; - } - - if (ctr == NULL) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) - return False; - if(!prs_uint32("ptr_sess_ctr", ps, depth, &ctr->ptr_sess_ctr)) - return False; - - if (ctr->ptr_sess_ctr != 0) { - switch (ctr->switch_value) { - case 0: - if(!srv_io_srv_sess_info_0("", &ctr->sess.info0, ps, depth)) - return False; - break; - case 1: - if(!srv_io_srv_sess_info_1("", &ctr->sess.info1, ps, depth)) - return False; - break; - default: - DEBUG(5,("%s no session info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); - break; - } - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum"); - 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("qualifier", ps, depth, (void*)&q_u->qualifier, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_pointer("username", ps, depth, (void*)&q_u->username, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("sess_level", ps, depth, &q_u->sess_level)) - return False; - - if (q_u->sess_level != (uint32)-1) { - if(!srv_io_srv_sess_ctr("sess_ctr", &q_u->ctr, ps, depth)) - return False; - } - - if(!prs_uint32("preferred_len", ps, depth, &q_u->preferred_len)) - return False; - - if(!smb_io_enum_hnd("enum_hnd", &q_u->enum_hnd, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_r_net_sess_enum(const char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("sess_level", ps, depth, &r_n->sess_level)) - return False; - - if (r_n->sess_level != (uint32)-1) { - if(!srv_io_srv_sess_ctr("sess_ctr", &r_n->ctr, ps, depth)) - return False; - } - - if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) - return False; - if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) - return False; - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - Inits a SRV_Q_NET_SESS_DEL structure. -********************************************************************/ - -void init_srv_q_net_sess_del(SRV_Q_NET_SESS_DEL *q_n, const char *srv_name, - const char *cli_name, const char *user_name) -{ - DEBUG(5,("init_q_net_sess_enum\n")); - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - init_buf_unistr2(&q_n->uni_cli_name, &q_n->ptr_cli_name, cli_name); - init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_q_net_sess_del(const char *desc, SRV_Q_NET_SESS_DEL *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_sess_del"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_cli_name", ps, depth, &q_n->ptr_cli_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_cli_name, q_n->ptr_cli_name, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_r_net_sess_del(const char *desc, SRV_R_NET_SESS_DEL *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_sess_del"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - Inits a CONN_INFO_0 structure -********************************************************************/ - -void init_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id) -{ - DEBUG(5,("init_srv_conn_info0\n")); - - ss0->id = id; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_conn_info0(const char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth) -{ - if (ss0 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_conn_info0"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("id", ps, depth, &ss0->id)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_srv_conn_info_0(const char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth) -{ - if (ss0 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read)) - return False; - if(!prs_uint32("ptr_conn_info", ps, depth, &ss0->ptr_conn_info)) - return False; - - if (ss0->ptr_conn_info != 0) { - int i; - int num_entries = ss0->num_entries_read; - - if (num_entries > MAX_CONN_ENTRIES) { - num_entries = MAX_CONN_ENTRIES; /* report this! */ - } - - if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2)) - return False; - - for (i = 0; i < num_entries; i++) { - if(!srv_io_conn_info0("", &ss0->info_0[i], ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - } - - return True; -} - -/******************************************************************* - Inits a CONN_INFO_1_STR structure -********************************************************************/ - -void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, const char *usr_name, const char *net_name) -{ - DEBUG(5,("init_srv_conn_info1_str\n")); - - init_unistr2(&ss1->uni_usr_name, usr_name, UNI_STR_TERMINATE); - init_unistr2(&ss1->uni_net_name, net_name, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_conn_info1_str(const char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth) -{ - if (ss1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_conn_info1_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("", &ss1->uni_usr_name, True, ps, depth)) - return False; - if(!smb_io_unistr2("", &ss1->uni_net_name, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Inits a CONN_INFO_1 structure -********************************************************************/ - -void init_srv_conn_info1(CONN_INFO_1 *ss1, - uint32 id, uint32 type, - uint32 num_opens, uint32 num_users, uint32 open_time, - const char *usr_name, const char *net_name) -{ - DEBUG(5,("init_srv_conn_info1: %s %s\n", usr_name, net_name)); - - ss1->id = id ; - ss1->type = type ; - ss1->num_opens = num_opens ; - ss1->num_users = num_users; - ss1->open_time = open_time; - - ss1->ptr_usr_name = (usr_name != NULL) ? 1 : 0; - ss1->ptr_net_name = (net_name != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_conn_info1(const char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth) -{ - if (ss1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_conn_info1"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("id ", ps, depth, &ss1->id)) - return False; - if(!prs_uint32("type ", ps, depth, &ss1->type)) - return False; - if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens)) - return False; - if(!prs_uint32("num_users ", ps, depth, &ss1->num_users)) - return False; - if(!prs_uint32("open_time ", ps, depth, &ss1->open_time)) - return False; - - if(!prs_uint32("ptr_usr_name", ps, depth, &ss1->ptr_usr_name)) - return False; - if(!prs_uint32("ptr_net_name", ps, depth, &ss1->ptr_net_name)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_srv_conn_info_1(const char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth) -{ - if (ss1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read)) - return False; - if(!prs_uint32("ptr_conn_info", ps, depth, &ss1->ptr_conn_info)) - return False; - - if (ss1->ptr_conn_info != 0) { - int i; - int num_entries = ss1->num_entries_read; - - if (num_entries > MAX_CONN_ENTRIES) { - num_entries = MAX_CONN_ENTRIES; /* report this! */ - } - - if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2)) - return False; - - for (i = 0; i < num_entries; i++) { - if(!srv_io_conn_info1("", &ss1->info_1[i], ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_conn_info1_str("", &ss1->info_1_str[i], ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_srv_conn_ctr(const char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth) -{ - SRV_CONN_INFO_CTR *ctr = *pp_ctr; - - prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr"); - depth++; - - if (UNMARSHALLING(ps)) { - ctr = *pp_ctr = PRS_ALLOC_MEM(ps, SRV_CONN_INFO_CTR, 1); - if (ctr == NULL) - return False; - } - - if (ctr == NULL) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) - return False; - if(!prs_uint32("ptr_conn_ctr", ps, depth, &ctr->ptr_conn_ctr)) - return False; - - if (ctr->ptr_conn_ctr != 0) { - switch (ctr->switch_value) { - case 0: - if(!srv_io_srv_conn_info_0("", &ctr->conn.info0, ps, depth)) - return False; - break; - case 1: - if(!srv_io_srv_conn_info_1("", &ctr->conn.info1, ps, depth)) - return False; - break; - default: - DEBUG(5,("%s no connection info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); - break; - } - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, - const char *srv_name, const char *qual_name, - uint32 conn_level, SRV_CONN_INFO_CTR *ctr, - uint32 preferred_len, - ENUM_HND *hnd) -{ - DEBUG(5,("init_q_net_conn_enum\n")); - - q_n->ctr = ctr; - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name ); - init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name); - - q_n->conn_level = conn_level; - q_n->preferred_len = preferred_len; - - memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_q_net_conn_enum(const char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, q_n->ptr_srv_name, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("conn_level", ps, depth, &q_n->conn_level)) - return False; - - if (q_n->conn_level != (uint32)-1) { - if(!srv_io_srv_conn_ctr("conn_ctr", &q_n->ctr, ps, depth)) - return False; - } - - if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) - return False; - - if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("conn_level", ps, depth, &r_n->conn_level)) - return False; - - if (r_n->conn_level != (uint32)-1) { - if(!srv_io_srv_conn_ctr("conn_ctr", &r_n->ctr, ps, depth)) - return False; - } - - if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) - return False; - if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) - return False; - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_file_info3_str(const char *desc, FILE_INFO_3 *sh1, prs_struct *ps, int depth) -{ - if (sh1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_file_info3_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if ( sh1->path ) { - if(!smb_io_unistr2("", sh1->path, True, ps, depth)) - return False; - } - - if ( sh1->user ) { - if(!smb_io_unistr2("", sh1->user, True, ps, depth)) - return False; - } - - return True; -} - -/******************************************************************* - Inits a FILE_INFO_3 structure -********************************************************************/ - -void init_srv_file_info3( FILE_INFO_3 *fl3, uint32 id, uint32 perms, uint32 num_locks, - const char *user_name, const char *path_name ) -{ - fl3->id = id; - fl3->perms = perms; - fl3->num_locks = num_locks; - - if ( path_name ) { - if ( (fl3->path = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) - return; - init_unistr2(fl3->path, path_name, UNI_STR_TERMINATE); - } - - if ( user_name ) { - if ( (fl3->user = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) - return; - init_unistr2(fl3->user, user_name, UNI_STR_TERMINATE); - } - - return; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) -{ - uint32 uni_p; - - if (fl3 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_file_info3"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("id ", ps, depth, &fl3->id)) - return False; - if(!prs_uint32("perms ", ps, depth, &fl3->perms)) - return False; - if(!prs_uint32("num_locks ", ps, depth, &fl3->num_locks)) - return False; - - uni_p = fl3->path ? 1 : 0; - if(!prs_uint32("ptr", ps, depth, &uni_p)) - return False; - if (UNMARSHALLING(ps)) { - if ( (fl3->path = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) { - return False; - } - } - - uni_p = fl3->user ? 1 : 0; - if(!prs_uint32("ptr", ps, depth, &uni_p)) - return False; - if (UNMARSHALLING(ps)) { - if ( (fl3->user = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) { - return False; - } - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) -{ - if (ctr == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_file_ctr"); - depth++; - - if (UNMARSHALLING(ps)) { - ZERO_STRUCTP(ctr); - } - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("level", ps, depth, &ctr->level)) - return False; - - if(!prs_uint32("ptr_file_info", ps, depth, &ctr->ptr_file_info)) - return False; - if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries)) - return False; - if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries)) - return False; - - if (ctr->ptr_entries == 0) - return True; - - if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2)) - return False; - - switch (ctr->level) { - case 3: { - FILE_INFO_3 *info3 = ctr->file.info3; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps)) { - if (!(info3 = PRS_ALLOC_MEM(ps, FILE_INFO_3, num_entries))) - return False; - ctr->file.info3 = info3; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_file_info3("", &ctr->file.info3[i], ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_file_info3_str("", &ctr->file.info3[i], ps, depth)) - return False; - } - break; - } - default: - DEBUG(5,("%s no file info at switch_value %d\n", tab_depth(depth), ctr->level)); - break; - } - - return True; -} - -/******************************************************************* - Inits a SRV_Q_NET_FILE_ENUM structure. -********************************************************************/ - -void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, - const char *srv_name, const char *qual_name, - const char *user_name, - uint32 file_level, SRV_FILE_INFO_CTR *ctr, - uint32 preferred_len, - ENUM_HND *hnd) -{ - uint32 ptr; - - if ( srv_name ) { - if ( (q_n->servername = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) - return; - init_buf_unistr2(q_n->servername, &ptr, srv_name); - } - - if ( qual_name ) { - if ( (q_n->qualifier = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) - return; - init_buf_unistr2(q_n->qualifier, &ptr, qual_name); - } - - if ( user_name ) { - if ( (q_n->username = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) - return; - init_buf_unistr2(q_n->username, &ptr, user_name); - } - - q_n->level = q_n->ctr.level = file_level; - - q_n->preferred_len = preferred_len; - q_n->ctr.ptr_file_info = 1; - q_n->ctr.num_entries = 0; - q_n->ctr.num_entries2 = 0; - - memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_file_enum"); - 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("qualifier", ps, depth, (void*)&q_u->qualifier, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_pointer("username", ps, depth, (void*)&q_u->username, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("level", ps, depth, &q_u->level)) - return False; - - if (q_u->level != (uint32)-1) { - if(!srv_io_srv_file_ctr("file_ctr", &q_u->ctr, ps, depth)) - return False; - } - - if(!prs_uint32("preferred_len", ps, depth, &q_u->preferred_len)) - return False; - - if(!smb_io_enum_hnd("enum_hnd", &q_u->enum_hnd, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_file_enum"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("level", ps, depth, &r_n->level)) - return False; - - if (r_n->level != 0) { - if(!srv_io_srv_file_ctr("file_ctr", &r_n->ctr, ps, depth)) - return False; - } - - if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) - return False; - if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) - return False; - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - Initialize a net file close request -********************************************************************/ -void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, const char *server, - uint32 file_id) -{ - if ( server ) { - if ( (q_n->servername = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) { - return; - } - init_unistr2(q_n->servername, server, UNI_STR_TERMINATE); - } - - q_n->file_id = file_id; -} - -/******************************************************************* - Inits a SRV_INFO_100 structure. - ********************************************************************/ - -void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, const char *name) -{ - DEBUG(5,("init_srv_info_100\n")); - - sv100->platform_id = platform_id; - init_buf_unistr2(&sv100->uni_name, &sv100->ptr_name, name); -} - -/******************************************************************* - Reads or writes a SRV_INFO_101 structure. - ********************************************************************/ - -static BOOL srv_io_info_100(const char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth) -{ - if (sv100 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_info_100"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("platform_id ", ps, depth, &sv100->platform_id)) - return False; - if(!prs_uint32("ptr_name ", ps, depth, &sv100->ptr_name)) - return False; - - if(!smb_io_unistr2("uni_name ", &sv100->uni_name, True, ps, depth)) - return False; - - return True; -} - - -/******************************************************************* - Inits a SRV_INFO_101 structure. - ********************************************************************/ - -void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, const char *name, - uint32 ver_major, uint32 ver_minor, - uint32 srv_type, const char *comment) -{ - DEBUG(5,("init_srv_info_101\n")); - - sv101->platform_id = platform_id; - init_buf_unistr2(&sv101->uni_name, &sv101->ptr_name, name); - sv101->ver_major = ver_major; - sv101->ver_minor = ver_minor; - sv101->srv_type = srv_type; - init_buf_unistr2(&sv101->uni_comment, &sv101->ptr_comment, comment); -} - -/******************************************************************* - Reads or writes a SRV_INFO_101 structure. - ********************************************************************/ - -static BOOL srv_io_info_101(const char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth) -{ - if (sv101 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_info_101"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("platform_id ", ps, depth, &sv101->platform_id)) - return False; - if(!prs_uint32("ptr_name ", ps, depth, &sv101->ptr_name)) - return False; - if(!prs_uint32("ver_major ", ps, depth, &sv101->ver_major)) - return False; - if(!prs_uint32("ver_minor ", ps, depth, &sv101->ver_minor)) - return False; - if(!prs_uint32("srv_type ", ps, depth, &sv101->srv_type)) - return False; - if(!prs_uint32("ptr_comment ", ps, depth, &sv101->ptr_comment)) - return False; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("uni_name ", &sv101->uni_name, True, ps, depth)) - return False; - if(!smb_io_unistr2("uni_comment ", &sv101->uni_comment, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Inits a SRV_INFO_102 structure. - ********************************************************************/ - -void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, const char *name, - const char *comment, uint32 ver_major, uint32 ver_minor, - uint32 srv_type, uint32 users, uint32 disc, uint32 hidden, - uint32 announce, uint32 ann_delta, uint32 licenses, - const char *usr_path) -{ - DEBUG(5,("init_srv_info_102\n")); - - sv102->platform_id = platform_id; - init_buf_unistr2(&sv102->uni_name, &sv102->ptr_name, name); - sv102->ver_major = ver_major; - sv102->ver_minor = ver_minor; - sv102->srv_type = srv_type; - init_buf_unistr2(&sv102->uni_comment, &sv102->ptr_comment, comment); - - /* same as 101 up to here */ - - sv102->users = users; - sv102->disc = disc; - sv102->hidden = hidden; - sv102->announce = announce; - sv102->ann_delta = ann_delta; - sv102->licenses = licenses; - init_buf_unistr2(&sv102->uni_usr_path, &sv102->ptr_usr_path, usr_path); -} - - -/******************************************************************* - Reads or writes a SRV_INFO_102 structure. - ********************************************************************/ - -static BOOL srv_io_info_102(const char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth) -{ - if (sv102 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_info102"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("platform_id ", ps, depth, &sv102->platform_id)) - return False; - if(!prs_uint32("ptr_name ", ps, depth, &sv102->ptr_name)) - return False; - if(!prs_uint32("ver_major ", ps, depth, &sv102->ver_major)) - return False; - if(!prs_uint32("ver_minor ", ps, depth, &sv102->ver_minor)) - return False; - if(!prs_uint32("srv_type ", ps, depth, &sv102->srv_type)) - return False; - if(!prs_uint32("ptr_comment ", ps, depth, &sv102->ptr_comment)) - return False; - - /* same as 101 up to here */ - - if(!prs_uint32("users ", ps, depth, &sv102->users)) - return False; - if(!prs_uint32("disc ", ps, depth, &sv102->disc)) - return False; - if(!prs_uint32("hidden ", ps, depth, &sv102->hidden)) - return False; - if(!prs_uint32("announce ", ps, depth, &sv102->announce)) - return False; - if(!prs_uint32("ann_delta ", ps, depth, &sv102->ann_delta)) - return False; - if(!prs_uint32("licenses ", ps, depth, &sv102->licenses)) - return False; - if(!prs_uint32("ptr_usr_path", ps, depth, &sv102->ptr_usr_path)) - return False; - - if(!smb_io_unistr2("uni_name ", &sv102->uni_name, True, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("uni_comment ", &sv102->uni_comment, True, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("uni_usr_path", &sv102->uni_usr_path, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a SRV_INFO_102 structure. - ********************************************************************/ - -static BOOL srv_io_info_ctr(const char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) -{ - if (ctr == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_info_ctr"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) - return False; - if(!prs_uint32("ptr_srv_ctr ", ps, depth, &ctr->ptr_srv_ctr)) - return False; - - if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL) { - switch (ctr->switch_value) { - case 100: - if(!srv_io_info_100("sv100", &ctr->srv.sv100, ps, depth)) - return False; - break; - case 101: - if(!srv_io_info_101("sv101", &ctr->srv.sv101, ps, depth)) - return False; - break; - case 102: - if(!srv_io_info_102("sv102", &ctr->srv.sv102, ps, depth)) - return False; - break; - default: - DEBUG(5,("%s no server info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); - break; - } - if(!prs_align(ps)) - return False; - } - - return True; -} - -/******************************************************************* - Inits a SRV_Q_NET_SRV_GET_INFO structure. - ********************************************************************/ - -void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv, - const char *server_name, uint32 switch_value) -{ - DEBUG(5,("init_srv_q_net_srv_get_info\n")); - - init_buf_unistr2(&srv->uni_srv_name, &srv->ptr_srv_name, server_name); - - srv->switch_value = switch_value; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_q_net_srv_get_info(const char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) - return False; - - return True; -} - -/******************************************************************* - Inits a SRV_R_NET_SRV_GET_INFO structure. - ********************************************************************/ - -void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv, - uint32 switch_value, SRV_INFO_CTR *ctr, WERROR status) -{ - DEBUG(5,("init_srv_r_net_srv_get_info\n")); - - srv->ctr = ctr; - - if (W_ERROR_IS_OK(status)) { - srv->ctr->switch_value = switch_value; - srv->ctr->ptr_srv_ctr = 1; - } else { - srv->ctr->switch_value = 0; - srv->ctr->ptr_srv_ctr = 0; - } - - srv->status = status; -} - -/******************************************************************* - Inits a SRV_R_NET_SRV_SET_INFO structure. - ********************************************************************/ - -void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv, - uint32 switch_value, WERROR status) -{ - DEBUG(5,("init_srv_r_net_srv_set_info\n")); - - srv->switch_value = switch_value; - srv->status = status; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_q_net_srv_set_info(const char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) - return False; - - if (UNMARSHALLING(ps)) { - q_n->ctr = PRS_ALLOC_MEM(ps, SRV_INFO_CTR, 1); - - if (!q_n->ctr) - return False; - } - - if(!srv_io_info_ctr("ctr", q_n->ctr, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. - ********************************************************************/ - -BOOL srv_io_r_net_srv_get_info(const char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. - ********************************************************************/ - -BOOL srv_io_r_net_srv_set_info(const char *desc, SRV_R_NET_SRV_SET_INFO *r_n, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "srv_io_r_net_srv_set_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("switch value ", ps, depth, &r_n->switch_value)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. - ********************************************************************/ - -BOOL srv_io_q_net_remote_tod(const char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a TIME_OF_DAY_INFO structure. - ********************************************************************/ - -static BOOL srv_io_time_of_day_info(const char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth) -{ - if (tod == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_time_of_day_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("elapsedt ", ps, depth, &tod->elapsedt)) - return False; - if(!prs_uint32("msecs ", ps, depth, &tod->msecs)) - return False; - if(!prs_uint32("hours ", ps, depth, &tod->hours)) - return False; - if(!prs_uint32("mins ", ps, depth, &tod->mins)) - return False; - if(!prs_uint32("secs ", ps, depth, &tod->secs)) - return False; - if(!prs_uint32("hunds ", ps, depth, &tod->hunds)) - return False; - if(!prs_uint32("timezone ", ps, depth, &tod->zone)) - return False; - if(!prs_uint32("tintervals ", ps, depth, &tod->tintervals)) - return False; - if(!prs_uint32("day ", ps, depth, &tod->day)) - return False; - if(!prs_uint32("month ", ps, depth, &tod->month)) - return False; - if(!prs_uint32("year ", ps, depth, &tod->year)) - return False; - if(!prs_uint32("weekday ", ps, depth, &tod->weekday)) - return False; - - return True; -} - -/******************************************************************* - Inits a TIME_OF_DAY_INFO structure. - ********************************************************************/ - -void init_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs, - uint32 hours, uint32 mins, uint32 secs, uint32 hunds, - uint32 zone, uint32 tintervals, uint32 day, - uint32 month, uint32 year, uint32 weekday) -{ - DEBUG(5,("init_time_of_day_info\n")); - - tod->elapsedt = elapsedt; - tod->msecs = msecs; - tod->hours = hours; - tod->mins = mins; - tod->secs = secs; - tod->hunds = hunds; - tod->zone = zone; - tod->tintervals = tintervals; - tod->day = day; - tod->month = month; - tod->year = year; - tod->weekday = weekday; -} - - -/******************************************************************* - Reads or writes a structure. - ********************************************************************/ - -BOOL srv_io_r_net_remote_tod(const char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_tod ", ps, depth, &r_n->ptr_srv_tod)) - return False; - - if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - initialises a structure. - ********************************************************************/ - -BOOL init_srv_q_net_disk_enum(SRV_Q_NET_DISK_ENUM *q_n, - const char *srv_name, - uint32 preferred_len, - ENUM_HND *enum_hnd - ) -{ - - - DEBUG(5,("init_srv_q_net_srv_disk_enum\n")); - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - - q_n->disk_enum_ctr.level = 0; - q_n->disk_enum_ctr.disk_info_ptr = 0; - - q_n->preferred_len = preferred_len; - memcpy(&q_n->enum_hnd, enum_hnd, sizeof(*enum_hnd)); - - return True; -} - -/******************************************************************* - Reads or writes a structure. - ********************************************************************/ - -BOOL srv_io_q_net_disk_enum(const char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_disk_enum"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("level", ps, depth, &q_n->disk_enum_ctr.level)) - return False; - - if(!prs_uint32("entries_read", ps, depth, &q_n->disk_enum_ctr.entries_read)) - return False; - - if(!prs_uint32("buffer", ps, depth, &q_n->disk_enum_ctr.disk_info_ptr)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) - return False; - if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. - ********************************************************************/ - -BOOL srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth) -{ - - unsigned int i; - uint32 entries_read, entries_read2, entries_read3; - - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_disk_enum"); - depth++; - - entries_read = entries_read2 = entries_read3 = r_n->disk_enum_ctr.entries_read; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("entries_read", ps, depth, &entries_read)) - return False; - if(!prs_uint32("ptr_disk_info", ps, depth, &r_n->disk_enum_ctr.disk_info_ptr)) - return False; - - /*this may be max, unknown, actual?*/ - - if(!prs_uint32("max_elements", ps, depth, &entries_read2)) - return False; - if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.unknown)) - return False; - if(!prs_uint32("actual_elements", ps, depth, &entries_read3)) - return False; - - r_n->disk_enum_ctr.entries_read = entries_read3; - - if(UNMARSHALLING(ps)) { - - DISK_INFO *dinfo; - - if(!(dinfo = PRS_ALLOC_MEM(ps, DISK_INFO, entries_read3))) - return False; - r_n->disk_enum_ctr.disk_info = dinfo; - } - - for(i=0; i < r_n->disk_enum_ctr.entries_read; i++) { - - if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.disk_info[i].unknown)) - return False; - - if(!smb_io_unistr3("disk_name", &r_n->disk_enum_ctr.disk_info[i].disk_name, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - } - - if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) - return False; - - if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. - ********************************************************************/ - -BOOL srv_io_q_net_name_validate(const char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_name_validate"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_pointer("servername", ps, depth, (void*)&q_n->servername, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) - return False; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("", &q_n->sharename, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("type", ps, depth, &q_n->type)) - return False; - - if(!prs_uint32("flags", ps, depth, &q_n->flags)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. - ********************************************************************/ - -BOOL srv_io_r_net_name_validate(const char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_name_validate"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_q_net_file_query_secdesc(const char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_file_query_secdesc"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth)) - return False; - - if(!prs_uint32("unknown1", ps, depth, &q_n->unknown1)) - return False; - - if(!prs_uint32("unknown2", ps, depth, &q_n->unknown2)) - return False; - - if(!prs_uint32("unknown3", ps, depth, &q_n->unknown3)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_r_net_file_query_secdesc(const char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_file_query_secdesc"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_response", ps, depth, &r_n->ptr_response)) - return False; - - if(!prs_uint32("size_response", ps, depth, &r_n->size_response)) - return False; - - if(!prs_uint32("ptr_secdesc", ps, depth, &r_n->ptr_secdesc)) - return False; - - if(!prs_uint32("size_secdesc", ps, depth, &r_n->size_secdesc)) - return False; - - if(!sec_io_desc("sec_desc", &r_n->sec_desc, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_q_net_file_set_secdesc(const char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_file_set_secdesc"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("sec_info", ps, depth, &q_n->sec_info)) - return False; - - if(!prs_uint32("size_set", ps, depth, &q_n->size_set)) - return False; - - if(!prs_uint32("ptr_secdesc", ps, depth, &q_n->ptr_secdesc)) - return False; - - if(!prs_uint32("size_secdesc", ps, depth, &q_n->size_secdesc)) - return False; - - if(!sec_io_desc("sec_desc", &q_n->sec_desc, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_file_set_secdesc"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - Inits a structure -********************************************************************/ - -void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server) -{ - q_u->ptr_srv_name = 1; - init_unistr2(&q_u->uni_srv_name, server, UNI_STR_TERMINATE); -} - - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_q_net_file_close(const char *desc, SRV_Q_NET_FILE_CLOSE *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_file_close"); - 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_uint32("file_id", ps, depth, &q_u->file_id)) - return False; - - return True; -} - -/******************************************************************* - ********************************************************************/ - -BOOL srv_io_r_net_file_close(const char *desc, SRV_R_NET_FILE_CLOSE *r_n, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "srv_io_r_net_file_close"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} -- cgit From 35a852150198e057b7e8a6463db16443d9ff2e40 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 23 Sep 2006 17:59:52 +0000 Subject: r18845: Fix a type-punned warning that turned out to be a real bug: The secdesc revision is now an enum that might be represented as anything, in particular as an int. It's definitely not a uint16 :-) Volker (This used to be commit 7c5d66c97111389b679aadb7b8b6721f07496bda) --- source3/rpc_parse/parse_sec.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 32a8a8cd32..be789b2ef5 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -128,6 +128,7 @@ BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) uint32 old_offset; uint32 offset_acl_size; SEC_ACL *psa; + uint16 revision; /* * Note that the size is always a multiple of 4 bytes due to the @@ -155,9 +156,17 @@ BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) old_offset = prs_offset(ps); - if(!prs_uint16("revision", ps, depth, (uint16 *)&psa->revision)) + if (MARSHALLING(ps)) { + revision = (uint16)psa->revision; + } + + if(!prs_uint16("revision", ps, depth, &revision)) return False; + if (UNMARSHALLING(ps)) { + psa->revision = (enum security_acl_revision)revision; + } + if(!prs_uint16_pre("size ", ps, depth, &psa->size, &offset_acl_size)) return False; @@ -212,6 +221,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) uint32 max_offset = 0; /* after we're done, move offset to end */ uint32 tmp_offset = 0; uint32 off_sacl, off_dacl, off_owner_sid, off_grp_sid; + uint16 revision; SEC_DESC *psd; @@ -237,9 +247,17 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) /* start of security descriptor stored for back-calc offset purposes */ old_offset = prs_offset(ps); - if(!prs_uint16("revision ", ps, depth, (uint16*)&psd->revision)) + if (MARSHALLING(ps)) { + revision = (uint16)psd->revision; + } + + if(!prs_uint16("revision", ps, depth, &revision)) return False; + if (UNMARSHALLING(ps)) { + psd->revision = (enum security_acl_revision)revision; + } + if(!prs_uint16("type ", ps, depth, &psd->type)) return False; -- cgit From b9b964a360b3319a2170bf3ed8ca94190195a691 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 23 Sep 2006 18:24:03 +0000 Subject: r18846: Fix the same bug Volker noticed when marshalling/unmarshalling SEC_ACE. "type" is also an enum that may be any size. Treat as a uint8. Jeremy. (This used to be commit fd97f48ba38cb6a737302dac5cf23239ce7059cc) --- source3/rpc_parse/parse_sec.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index be789b2ef5..bc33062264 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -53,6 +53,7 @@ BOOL sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth) { uint32 old_offset; uint32 offset_ace_size; + uint8 type; if (psa == NULL) return False; @@ -62,9 +63,17 @@ BOOL sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth) old_offset = prs_offset(ps); - if(!prs_uint8("type ", ps, depth, (uint8*)&psa->type)) + if (MARSHALLING(ps)) { + type = (uint8)psa->type; + } + + if(!prs_uint8("type ", ps, depth, &type)) return False; + if (UNMARSHALLING(ps)) { + psa->type = (enum security_ace_type)type; + } + if(!prs_uint8("flags", ps, depth, &psa->flags)) return False; -- cgit From bbaa0b178d834f4962ab440dff0e1837029369df Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 26 Sep 2006 15:15:26 +0000 Subject: r18919: * Get the new rpccli_winreg_XXXX() functions into the tree There some broken functionality here that I'm still working on. * remove unneeded parsing routines (This used to be commit cbfe1a4b498593a48fc34f584754ed4a9ef72cc5) --- source3/rpc_parse/parse_reg.c | 1737 ------------------------------------ source3/rpc_parse/parse_shutdown.c | 268 ------ 2 files changed, 2005 deletions(-) delete mode 100644 source3/rpc_parse/parse_reg.c delete mode 100644 source3/rpc_parse/parse_shutdown.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c deleted file mode 100644 index f529ad1425..0000000000 --- a/source3/rpc_parse/parse_reg.c +++ /dev/null @@ -1,1737 +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) Marc Jacobsen 1999. - * Copyright (C) Simo Sorce 2000. - * Copyright (C) Jeremy Cooper 2004 - * Copyright (C) Gerald Carter 2002-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 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "includes.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_RPC_PARSE - -/******************************************************************* - Fill in a REGVAL_BUFFER for the data given a REGISTRY_VALUE - *******************************************************************/ - -uint32 reg_init_regval_buffer( REGVAL_BUFFER *buf2, REGISTRY_VALUE *val ) -{ - uint32 real_size = 0; - - if ( !buf2 || !val ) - return 0; - - real_size = regval_size(val); - init_regval_buffer( buf2, (unsigned char*)regval_data_p(val), real_size ); - - return real_size; -} - -/******************************************************************* - Inits a hive connect request structure -********************************************************************/ - -void init_reg_q_open_hive( REG_Q_OPEN_HIVE *q_o, uint32 access_desired ) -{ - - q_o->server = TALLOC_P( get_talloc_ctx(), uint16); - if (!q_o->server) { - smb_panic("init_reg_q_open_hive: talloc fail.\n"); - return; - } - *q_o->server = 0x1; - - q_o->access = access_desired; -} - -/******************************************************************* -Marshalls a hive connect request -********************************************************************/ - -BOOL reg_io_q_open_hive(const char *desc, REG_Q_OPEN_HIVE *q_u, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "reg_io_q_open_hive"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_pointer("server", ps, depth, (void*)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) - return False; - - if(!prs_align(ps)) - return False; - if(!prs_uint32("access", ps, depth, &q_u->access)) - return False; - - return True; -} - - -/******************************************************************* -Unmarshalls a hive connect response -********************************************************************/ - -BOOL reg_io_r_open_hive(const char *desc, REG_R_OPEN_HIVE *r_u, - prs_struct *ps, int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_open_hive"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &r_u->pol, ps, depth)) - return False; - - if(!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -reads or writes SEC_DESC_BUF and SEC_DATA structures. -********************************************************************/ - -static BOOL reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, - SEC_DESC_BUF *data, prs_struct *ps, int depth) -{ - if (ptr != 0) { - uint32 hdr_offset; - uint32 old_offset; - if(!smb_io_hdrbuf_pre("hdr_sec", hdr_sec, ps, depth, - &hdr_offset)) - return False; - - old_offset = prs_offset(ps); - - if (ptr3 != NULL) { - if(!prs_uint32("ptr3", ps, depth, ptr3)) - return False; - } - - if (ptr3 == NULL || *ptr3 != 0) { - /* JRA - this next line is probably wrong... */ - if(!sec_io_desc_buf("data ", &data, ps, depth)) - return False; - } - - if(!smb_io_hdrbuf_post("hdr_sec", hdr_sec, ps, depth, - hdr_offset, data->sd_size, data->sd_size)) - return False; - if(!prs_set_offset(ps, old_offset + data->sd_size + - sizeof(uint32) * ((ptr3 != NULL) ? 5 : 3))) - return False; - - if(!prs_align(ps)) - return False; - } - - return True; -} - -/******************************************************************* - Inits a registry key create request -********************************************************************/ - -void init_reg_q_create_key_ex(REG_Q_CREATE_KEY_EX *q_c, POLICY_HND *hnd, - char *name, char *key_class, uint32 access_desired, - SEC_DESC_BUF *sec_buf) -{ - ZERO_STRUCTP(q_c); - - memcpy(&q_c->handle, hnd, sizeof(q_c->handle)); - - - init_unistr4( &q_c->name, name, UNI_STR_TERMINATE ); - init_unistr4( &q_c->key_class, key_class, UNI_STR_TERMINATE ); - - q_c->access = access_desired; - - q_c->sec_info = TALLOC_P( get_talloc_ctx(), uint32 ); - if (!q_c->sec_info) { - smb_panic("init_reg_q_create_key_ex: talloc fail\n"); - return; - } - *q_c->sec_info = DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION; - - q_c->data = sec_buf; - q_c->ptr2 = 1; - init_buf_hdr(&q_c->hdr_sec, sec_buf->sd_size, sec_buf->sd_size); - q_c->ptr3 = 1; - q_c->disposition = TALLOC_P( get_talloc_ctx(), uint32 ); - if (!q_c->disposition) { - smb_panic("init_reg_q_create_key_ex: talloc fail\n"); - return; - } -} - -/******************************************************************* -Marshalls a registry key create request -********************************************************************/ - -BOOL reg_io_q_create_key_ex(const char *desc, REG_Q_CREATE_KEY_EX *q_u, - prs_struct *ps, int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_create_key_ex"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &q_u->handle, ps, depth)) - return False; - - if(!prs_unistr4 ("name", ps, depth, &q_u->name)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_unistr4 ("key_class", ps, depth, &q_u->key_class)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("options", ps, depth, &q_u->options)) - return False; - if(!prs_uint32("access", ps, depth, &q_u->access)) - return False; - - if(!prs_pointer("sec_info", ps, depth, (void*)&q_u->sec_info, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) - return False; - - if ( q_u->sec_info ) { - if(!prs_uint32("ptr2", ps, depth, &q_u->ptr2)) - return False; - if(!reg_io_hdrbuf_sec(q_u->ptr2, &q_u->ptr3, &q_u->hdr_sec, q_u->data, ps, depth)) - return False; - } - - if(!prs_pointer("disposition", ps, depth, (void*)&q_u->disposition, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) - return False; - - return True; -} - -/******************************************************************* -Unmarshalls a registry key create response -********************************************************************/ - -BOOL reg_io_r_create_key_ex(const char *desc, REG_R_CREATE_KEY_EX *r_u, - prs_struct *ps, int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_create_key_ex"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &r_u->handle, ps, depth)) - return False; - if(!prs_uint32("disposition", ps, depth, &r_u->disposition)) - return False; - - if(!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - - -/******************************************************************* - Inits a structure. -********************************************************************/ - -void init_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd, - char *name) -{ - ZERO_STRUCTP(q_c); - - memcpy(&q_c->handle, hnd, sizeof(q_c->handle)); - init_unistr4(&q_c->name, name, UNI_STR_TERMINATE); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_delete_value(const char *desc, REG_Q_DELETE_VALUE *q_u, - prs_struct *ps, int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_delete_value"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &q_u->handle, ps, depth)) - return False; - - if(!prs_unistr4("name", ps, depth, &q_u->name)) - return False; - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_r_delete_value(const char *desc, REG_R_DELETE_VALUE *r_u, - prs_struct *ps, int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_delete_value"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* - Inits a structure. -********************************************************************/ - -void init_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd, - char *name) -{ - ZERO_STRUCTP(q_c); - - memcpy(&q_c->handle, hnd, sizeof(q_c->handle)); - - init_unistr4(&q_c->name, name, UNI_STR_TERMINATE); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_delete_key(const char *desc, REG_Q_DELETE_KEY *q_u, - prs_struct *ps, int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_delete_key"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &q_u->handle, ps, depth)) - return False; - - if(!prs_unistr4("", ps, depth, &q_u->name)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_r_delete_key(const char *desc, REG_R_DELETE_KEY *r_u, prs_struct *ps, int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_delete_key"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* - Inits a structure. -********************************************************************/ - -void init_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, const char *key_class) -{ - ZERO_STRUCTP(q_o); - - memcpy(&q_o->pol, hnd, sizeof(q_o->pol)); - init_unistr4(&q_o->key_class, key_class, UNI_STR_TERMINATE); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_query_key(const char *desc, REG_Q_QUERY_KEY *q_u, prs_struct *ps, int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_query_key"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) - return False; - if(!prs_unistr4("key_class", ps, depth, &q_u->key_class)) - return False; - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_r_query_key(const char *desc, REG_R_QUERY_KEY *r_u, prs_struct *ps, int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_query_key"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_unistr4("key_class", ps, depth, &r_u->key_class)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_subkeys ", ps, depth, &r_u->num_subkeys)) - return False; - if(!prs_uint32("max_subkeylen ", ps, depth, &r_u->max_subkeylen)) - return False; - if(!prs_uint32("reserved ", ps, depth, &r_u->reserved)) - return False; - if(!prs_uint32("num_values ", ps, depth, &r_u->num_values)) - return False; - if(!prs_uint32("max_valnamelen", ps, depth, &r_u->max_valnamelen)) - return False; - if(!prs_uint32("max_valbufsize", ps, depth, &r_u->max_valbufsize)) - return False; - if(!prs_uint32("sec_desc ", ps, depth, &r_u->sec_desc)) - return False; - if(!smb_io_time("mod_time ", &r_u->mod_time, ps, depth)) - return False; - - if(!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* - Inits a structure. -********************************************************************/ - -void init_reg_q_getversion(REG_Q_GETVERSION *q_o, POLICY_HND *hnd) -{ - memcpy(&q_o->pol, hnd, sizeof(q_o->pol)); -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_getversion(const char *desc, REG_Q_GETVERSION *q_u, prs_struct *ps, int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_getversion"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_r_getversion(const char *desc, REG_R_GETVERSION *r_u, prs_struct *ps, int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_getversion"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("win_version", ps, depth, &r_u->win_version)) - return False; - if(!prs_werror("status" , ps, depth, &r_u->status)) - return False; - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_restore_key(const char *desc, REG_Q_RESTORE_KEY *q_u, prs_struct *ps, int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_restore_key"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) - return False; - - if(!prs_unistr4("filename", ps, depth, &q_u->filename)) - return False; - - if(!prs_uint32("flags", ps, depth, &q_u->flags)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_r_restore_key(const char *desc, REG_R_RESTORE_KEY *r_u, prs_struct *ps, int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_restore_key"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status" , ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -void init_q_reg_save_key( REG_Q_SAVE_KEY *q_u, POLICY_HND *handle, const char *fname ) -{ - memcpy(&q_u->pol, handle, sizeof(q_u->pol)); - init_unistr4( &q_u->filename, fname, UNI_STR_TERMINATE ); - q_u->sec_attr = NULL; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_save_key(const char *desc, REG_Q_SAVE_KEY *q_u, prs_struct *ps, int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_save_key"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) - return False; - - if(!prs_unistr4("filename", ps, depth, &q_u->filename)) - return False; - -#if 0 /* reg_io_sec_attr() */ - if(!prs_uint32("unknown", ps, depth, &q_u->unknown)) - return False; -#endif - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_r_save_key(const char *desc, REG_R_SAVE_KEY *r_u, prs_struct *ps, int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_save_key"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status" , ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* - Inits an REG_Q_CLOSE structure. -********************************************************************/ - -void init_reg_q_close(REG_Q_CLOSE *q_c, POLICY_HND *hnd) -{ - DEBUG(5,("init_reg_q_close\n")); - - memcpy(&q_c->pol, hnd, sizeof(q_c->pol)); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_close(const char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_close"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_r_close(const char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_close"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &r_u->pol, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -makes a structure. -********************************************************************/ - -void init_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_u, POLICY_HND *pol, - uint32 sec_info, SEC_DESC_BUF *sec_desc_buf) -{ - memcpy(&q_u->handle, pol, sizeof(q_u->handle)); - - q_u->sec_info = sec_info; - - q_u->ptr = 1; - init_buf_hdr(&q_u->hdr_sec, sec_desc_buf->sd_size, sec_desc_buf->sd_size); - q_u->data = sec_desc_buf; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_set_key_sec(const char *desc, REG_Q_SET_KEY_SEC *q_u, prs_struct *ps, int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_set_key_sec"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &q_u->handle, ps, depth)) - return False; - - if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info)) - return False; - if(!prs_uint32("ptr ", ps, depth, &q_u->ptr)) - return False; - - if(!reg_io_hdrbuf_sec(q_u->ptr, NULL, &q_u->hdr_sec, q_u->data, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_r_set_key_sec(const char *desc, REG_R_SET_KEY_SEC *q_u, prs_struct *ps, int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_set_key_sec"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &q_u->status)) - return False; - - return True; -} - - -/******************************************************************* -makes a structure. -********************************************************************/ - -void init_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_u, POLICY_HND *pol, - uint32 sec_info, uint32 sec_buf_size, - SEC_DESC_BUF *psdb) -{ - memcpy(&q_u->handle, pol, sizeof(q_u->handle)); - - q_u->sec_info = sec_info; - - q_u->ptr = psdb != NULL ? 1 : 0; - q_u->data = psdb; - - init_buf_hdr(&q_u->hdr_sec, sec_buf_size, 0); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_get_key_sec(const char *desc, REG_Q_GET_KEY_SEC *q_u, prs_struct *ps, int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_get_key_sec"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &q_u->handle, ps, depth)) - return False; - - if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info)) - return False; - if(!prs_uint32("ptr ", ps, depth, &q_u->ptr)) - return False; - - if(!reg_io_hdrbuf_sec(q_u->ptr, NULL, &q_u->hdr_sec, q_u->data, ps, depth)) - return False; - - return True; -} - -#if 0 -/******************************************************************* -makes a structure. -********************************************************************/ - void init_reg_r_get_key_sec(REG_R_GET_KEY_SEC *r_i, POLICY_HND *pol, - uint32 buf_len, uint8 *buf, - NTSTATUS status) -{ - r_i->ptr = 1; - init_buf_hdr(&r_i->hdr_sec, buf_len, buf_len); - init_sec_desc_buf(r_i->data, buf_len, 1); - - r_i->status = status; /* 0x0000 0000 or 0x0000 007a */ -} -#endif - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_r_get_key_sec(const char *desc, REG_R_GET_KEY_SEC *q_u, prs_struct *ps, int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_get_key_sec"); - 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_hdrbuf("", &q_u->hdr_sec, ps, depth)) - return False; - if(!sec_io_desc_buf("", &q_u->data, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - } - - if(!prs_werror("status", ps, depth, &q_u->status)) - return False; - - return True; -} - -/******************************************************************* -makes a structure. -********************************************************************/ - -BOOL init_reg_q_query_value(REG_Q_QUERY_VALUE *q_u, POLICY_HND *pol, const char *val_name, - REGVAL_BUFFER *value_output) -{ - if (q_u == NULL) - return False; - - q_u->pol = *pol; - - init_unistr4(&q_u->name, val_name, UNI_STR_TERMINATE); - - q_u->ptr_reserved = 1; - q_u->ptr_buf = 1; - - q_u->ptr_bufsize = 1; - q_u->bufsize = value_output->buf_max_len; - q_u->buf_unk = 0; - - q_u->unk1 = 0; - q_u->ptr_buflen = 1; - q_u->buflen = value_output->buf_max_len; - - q_u->ptr_buflen2 = 1; - q_u->buflen2 = 0; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_query_value(const char *desc, REG_Q_QUERY_VALUE *q_u, prs_struct *ps, int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_query_value"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) - return False; - if(!prs_unistr4("name", ps, depth, &q_u->name)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_reserved", ps, depth, &(q_u->ptr_reserved))) - return False; - - if(!prs_uint32("ptr_buf", ps, depth, &(q_u->ptr_buf))) - return False; - - if(q_u->ptr_buf) { - if(!prs_uint32("ptr_bufsize", ps, depth, &(q_u->ptr_bufsize))) - return False; - if(!prs_uint32("bufsize", ps, depth, &(q_u->bufsize))) - return False; - if(!prs_uint32("buf_unk", ps, depth, &(q_u->buf_unk))) - return False; - } - - if(!prs_uint32("unk1", ps, depth, &(q_u->unk1))) - return False; - - if(!prs_uint32("ptr_buflen", ps, depth, &(q_u->ptr_buflen))) - return False; - - if (q_u->ptr_buflen) { - if(!prs_uint32("buflen", ps, depth, &(q_u->buflen))) - return False; - if(!prs_uint32("ptr_buflen2", ps, depth, &(q_u->ptr_buflen2))) - return False; - if(!prs_uint32("buflen2", ps, depth, &(q_u->buflen2))) - return False; - } - - return True; -} - -/******************************************************************* - Inits a structure. - New version to replace older init_reg_r_query_value() -********************************************************************/ - -BOOL init_reg_r_query_value(uint32 include_keyval, REG_R_QUERY_VALUE *r_u, - REGISTRY_VALUE *val, WERROR status) -{ - uint32 buf_len = 0; - REGVAL_BUFFER buf2; - - if( !r_u || !val ) - return False; - - r_u->type = TALLOC_P( get_talloc_ctx(), uint32 ); - if (!r_u->type) { - return False; - } - *r_u->type = val->type; - - buf_len = reg_init_regval_buffer( &buf2, val ); - - r_u->buf_max_len = TALLOC_P( get_talloc_ctx(), uint32 ); - if (!r_u->buf_max_len) { - return False; - } - *r_u->buf_max_len = buf_len; - - r_u->buf_len = TALLOC_P( get_talloc_ctx(), uint32 ); - if (!r_u->buf_len) { - return False; - } - *r_u->buf_len = buf_len; - - /* if include_keyval is not set, don't send the key value, just - the buflen data. probably used by NT5 to allocate buffer space - SK */ - - if ( include_keyval ) { - r_u->value = TALLOC_P( get_talloc_ctx(), REGVAL_BUFFER ); - if (!r_u->value) { - return False; - } - /* steal the memory */ - *r_u->value = buf2; - } - - r_u->status = status; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_r_query_value(const char *desc, REG_R_QUERY_VALUE *r_u, prs_struct *ps, int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_query_value"); - depth++; - - if(!prs_align(ps)) - return False; - - if ( !prs_pointer("type", ps, depth, (void*)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) - return False; - - if ( !prs_pointer("value", ps, depth, (void*)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) - return False; - if(!prs_align(ps)) - return False; - - if ( !prs_pointer("buf_max_len", ps, depth, (void*)&r_u->buf_max_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) - return False; - if ( !prs_pointer("buf_len", ps, depth, (void*)&r_u->buf_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) - return False; - - if(!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -makes a structure. -********************************************************************/ - -void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_u, POLICY_HND *pol, - uint32 val_idx, - uint32 max_name_len, uint32 max_buf_len) -{ - ZERO_STRUCTP(q_u); - - memcpy(&q_u->pol, pol, sizeof(q_u->pol)); - - q_u->val_index = val_idx; - - q_u->name.size = max_name_len*2; - q_u->name.string = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR2 ); - if (!q_u->name.string) { - smb_panic("init_reg_q_enum_val: talloc fail\n"); - return; - } - q_u->name.string->uni_max_len = max_name_len; - - q_u->type = TALLOC_P( get_talloc_ctx(), uint32 ); - if (!q_u->type) { - smb_panic("init_reg_q_enum_val: talloc fail\n"); - return; - } - *q_u->type = 0x0; - - q_u->value = TALLOC_ZERO_P( get_talloc_ctx(), REGVAL_BUFFER ); - if (!q_u->value) { - smb_panic("init_reg_q_enum_val: talloc fail\n"); - return; - } - - q_u->value->buf_max_len = max_buf_len; - - q_u->buffer_len = TALLOC_P( get_talloc_ctx(), uint32 ); - if (!q_u->buffer_len) { - smb_panic("init_reg_q_enum_val: talloc fail\n"); - return; - } - *q_u->buffer_len = max_buf_len; - - q_u->name_len = TALLOC_P( get_talloc_ctx(), uint32 ); - if (!q_u->name_len) { - smb_panic("init_reg_q_enum_val: talloc fail\n"); - return; - } - *q_u->name_len = 0x0; -} - -/******************************************************************* -makes a structure. -********************************************************************/ - -void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val ) -{ - uint32 real_size; - - ZERO_STRUCTP(r_u); - - /* value name */ - - DEBUG(10,("init_reg_r_enum_val: Valuename => [%s]\n", val->valuename)); - - init_unistr4( &r_u->name, val->valuename, UNI_STR_TERMINATE); - - /* type */ - - r_u->type = TALLOC_P( get_talloc_ctx(), uint32 ); - if (!r_u->type) { - smb_panic("init_reg_r_enum_val: talloc fail\n"); - return; - } - *r_u->type = val->type; - - /* REG_SZ & REG_MULTI_SZ must be converted to UNICODE */ - - r_u->value = TALLOC_P( get_talloc_ctx(), REGVAL_BUFFER ); - if (!r_u->value) { - smb_panic("init_reg_r_enum_val: talloc fail\n"); - return; - } - real_size = reg_init_regval_buffer( r_u->value, val ); - - /* lengths */ - - r_u->buffer_len1 = TALLOC_P( get_talloc_ctx(), uint32 ); - if (!r_u->buffer_len1) { - smb_panic("init_reg_r_enum_val: talloc fail\n"); - return; - } - *r_u->buffer_len1 = real_size; - r_u->buffer_len2 = TALLOC_P( get_talloc_ctx(), uint32 ); - if (!r_u->buffer_len2) { - smb_panic("init_reg_r_enum_val: talloc fail\n"); - return; - } - *r_u->buffer_len2 = real_size; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_enum_val(const char *desc, REG_Q_ENUM_VALUE *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_enum_val"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) - return False; - - if(!prs_uint32("val_index", ps, depth, &q_u->val_index)) - return False; - - if(!prs_unistr4("name", ps, depth, &q_u->name )) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_pointer("type", ps, depth, (void*)&q_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) - return False; - - if ( !prs_pointer("value", ps, depth, (void*)&q_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_pointer("buffer_len", ps, depth, (void*)&q_u->buffer_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) - return False; - if(!prs_pointer("name_len", ps, depth, (void*)&q_u->name_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_u, prs_struct *ps, int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_enum_val"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_unistr4("name", ps, depth, &r_u->name )) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_pointer("type", ps, depth, (void*)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) - return False; - - if ( !prs_pointer("value", ps, depth, (void*)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_pointer("buffer_len1", ps, depth, (void*)&r_u->buffer_len1, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) - return False; - if(!prs_pointer("buffer_len2", ps, depth, (void*)&r_u->buffer_len2, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) - return False; - - if(!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -makes a structure. -********************************************************************/ - -void init_reg_q_set_val(REG_Q_SET_VALUE *q_u, POLICY_HND *pol, - char *val_name, uint32 type, - RPC_DATA_BLOB *val) -{ - ZERO_STRUCTP(q_u); - - memcpy(&q_u->handle, pol, sizeof(q_u->handle)); - - init_unistr4(&q_u->name, val_name, UNI_STR_TERMINATE); - - q_u->type = type; - q_u->value = *val; - q_u->size = val->buf_len; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_set_value(const char *desc, REG_Q_SET_VALUE *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_set_value"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &q_u->handle, ps, depth)) - return False; - - if(!prs_unistr4("name", ps, depth, &q_u->name )) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("type", ps, depth, &q_u->type)) - return False; - - if(!smb_io_rpc_blob("value", &q_u->value, ps, depth )) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("size", ps, depth, &q_u->size)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_r_set_value(const char *desc, REG_R_SET_VALUE *q_u, prs_struct *ps, int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_set_value"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &q_u->status)) - return False; - - return True; -} - -/******************************************************************* -makes a structure. -********************************************************************/ - -void init_reg_q_enum_key(REG_Q_ENUM_KEY *q_u, POLICY_HND *pol, uint32 key_idx) -{ - memcpy(&q_u->pol, pol, sizeof(q_u->pol)); - - q_u->key_index = key_idx; - q_u->key_name_len = 0; - q_u->unknown_1 = 0x0414; - - q_u->ptr1 = 1; - q_u->unknown_2 = 0x0000020A; - memset(q_u->pad1, 0, sizeof(q_u->pad1)); - - q_u->ptr2 = 1; - memset(q_u->pad2, 0, sizeof(q_u->pad2)); - - q_u->ptr3 = 1; - unix_to_nt_time(&q_u->time, 0); /* current time? */ -} - -/******************************************************************* -makes a reply structure. -********************************************************************/ - -void init_reg_r_enum_key(REG_R_ENUM_KEY *r_u, char *subkey ) -{ - if ( !r_u ) - return; - - init_unistr4( &r_u->keyname, subkey, UNI_STR_TERMINATE ); - r_u->classname = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR4 ); - if (!r_u->classname) { - smb_panic("init_reg_r_enum_key: talloc fail\n"); - return; - } - r_u->time = TALLOC_ZERO_P( get_talloc_ctx(), NTTIME ); - if (!r_u->time) { - smb_panic("init_reg_r_enum_key: talloc fail\n"); - return; - } -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_enum_key(const char *desc, REG_Q_ENUM_KEY *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_enum_key"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) - return False; - - if(!prs_uint32("key_index", ps, depth, &q_u->key_index)) - return False; - if(!prs_uint16("key_name_len", ps, depth, &q_u->key_name_len)) - return False; - if(!prs_uint16("unknown_1", ps, depth, &q_u->unknown_1)) - return False; - - if(!prs_uint32("ptr1", ps, depth, &q_u->ptr1)) - return False; - - if (q_u->ptr1 != 0) { - if(!prs_uint32("unknown_2", ps, depth, &q_u->unknown_2)) - return False; - if(!prs_uint8s(False, "pad1", ps, depth, q_u->pad1, sizeof(q_u->pad1))) - return False; - } - - if(!prs_uint32("ptr2", ps, depth, &q_u->ptr2)) - return False; - - if (q_u->ptr2 != 0) { - if(!prs_uint8s(False, "pad2", ps, depth, q_u->pad2, sizeof(q_u->pad2))) - return False; - } - - if(!prs_uint32("ptr3", ps, depth, &q_u->ptr3)) - return False; - - if (q_u->ptr3 != 0) { - if(!smb_io_time("", &q_u->time, ps, depth)) - return False; - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_r_enum_key(const char *desc, REG_R_ENUM_KEY *q_u, prs_struct *ps, int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_enum_key"); - depth++; - - if(!prs_align(ps)) - return False; - if ( !prs_unistr4( "keyname", ps, depth, &q_u->keyname ) ) - return False; - - if(!prs_align(ps)) - return False; - if (!prs_pointer("class", ps, depth, (void*)&q_u->classname, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) - return False; - - if(!prs_align(ps)) - return False; - if (!prs_pointer("time", ps, depth, (void*)&q_u->time, sizeof(NTTIME), (PRS_POINTER_CAST)smb_io_nttime)) - return False; - - if(!prs_align(ps)) - return False; - if(!prs_werror("status", ps, depth, &q_u->status)) - return False; - - return True; -} - -/******************************************************************* -makes a structure. -********************************************************************/ - -void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *q_u, POLICY_HND *pol, - char *key_name, uint32 access_desired) -{ - memcpy(&q_u->pol, pol, sizeof(q_u->pol)); - - init_unistr4(&q_u->name, key_name, UNI_STR_TERMINATE); - - q_u->unknown_0 = 0x00000000; - q_u->access = access_desired; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_open_entry(const char *desc, REG_Q_OPEN_ENTRY *q_u, prs_struct *ps, int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_open_entry"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &q_u->pol, ps, depth)) - return False; - if(!prs_unistr4("name", ps, depth, &q_u->name)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("unknown_0 ", ps, depth, &q_u->unknown_0)) - return False; - if(!prs_uint32("access", ps, depth, &q_u->access)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_u, prs_struct *ps, int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_open_entry"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("handle", &r_u->handle, ps, depth)) - return False; - - if(!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -Inits a structure. -********************************************************************/ - -void init_reg_q_shutdown(REG_Q_SHUTDOWN *q_u, const char *msg, - uint32 timeout, BOOL do_reboot, BOOL force) -{ - q_u->server = TALLOC_P( get_talloc_ctx(), uint16 ); - if (!q_u->server) { - smb_panic("init_reg_q_shutdown: talloc fail\n"); - return; - } - *q_u->server = 0x1; - - q_u->message = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR4 ); - if (!q_u->message) { - smb_panic("init_reg_q_shutdown: talloc fail\n"); - return; - } - - if ( msg && *msg ) { - init_unistr4( q_u->message, msg, UNI_FLAGS_NONE ); - - /* Win2000 is apparently very sensitive to these lengths */ - /* do a special case here */ - - q_u->message->string->uni_max_len++; - q_u->message->size += 2; - - } - - q_u->timeout = timeout; - - q_u->reboot = do_reboot ? 1 : 0; - q_u->force = force ? 1 : 0; -} - -/******************************************************************* -Inits a REG_Q_SHUTDOWN_EX structure. -********************************************************************/ - -void init_reg_q_shutdown_ex(REG_Q_SHUTDOWN_EX * q_u_ex, const char *msg, - uint32 timeout, BOOL do_reboot, BOOL force, uint32 reason) -{ - REG_Q_SHUTDOWN q_u; - - ZERO_STRUCT( q_u ); - - init_reg_q_shutdown( &q_u, msg, timeout, do_reboot, force ); - - /* steal memory */ - - q_u_ex->server = q_u.server; - q_u_ex->message = q_u.message; - - q_u_ex->reboot = q_u.reboot; - q_u_ex->force = q_u.force; - - q_u_ex->reason = reason; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_shutdown(const char *desc, REG_Q_SHUTDOWN *q_u, prs_struct *ps, - int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_shutdown"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_pointer("server", ps, depth, (void*)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) - return False; - if (!prs_align(ps)) - return False; - - if (!prs_pointer("message", ps, depth, (void*)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("timeout", ps, depth, &(q_u->timeout))) - return False; - - if (!prs_uint8("force ", ps, depth, &(q_u->force))) - return False; - if (!prs_uint8("reboot ", ps, depth, &(q_u->reboot))) - return False; - - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL reg_io_r_shutdown(const char *desc, REG_R_SHUTDOWN *r_u, prs_struct *ps, - int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_shutdown"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a REG_Q_SHUTDOWN_EX structure. -********************************************************************/ - -BOOL reg_io_q_shutdown_ex(const char *desc, REG_Q_SHUTDOWN_EX *q_u, prs_struct *ps, - int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_shutdown_ex"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_pointer("server", ps, depth, (void*)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) - return False; - if (!prs_align(ps)) - return False; - - if (!prs_pointer("message", ps, depth, (void*)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("timeout", ps, depth, &(q_u->timeout))) - return False; - - if (!prs_uint8("force ", ps, depth, &(q_u->force))) - return False; - if (!prs_uint8("reboot ", ps, depth, &(q_u->reboot))) - return False; - - if (!prs_align(ps)) - return False; - if (!prs_uint32("reason", ps, depth, &(q_u->reason))) - return False; - - - return True; -} - -/******************************************************************* -reads or writes a REG_R_SHUTDOWN_EX structure. -********************************************************************/ -BOOL reg_io_r_shutdown_ex(const char *desc, REG_R_SHUTDOWN_EX *r_u, prs_struct *ps, - int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_shutdown_ex"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -Inits a structure. -********************************************************************/ - -void init_reg_q_abort_shutdown(REG_Q_ABORT_SHUTDOWN *q_u) -{ - q_u->server = TALLOC_P( get_talloc_ctx(), uint16 ); - if (!q_u->server) { - smb_panic("init_reg_q_abort_shutdown: talloc fail\n"); - return; - } - *q_u->server = 0x1; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL reg_io_q_abort_shutdown(const char *desc, REG_Q_ABORT_SHUTDOWN *q_u, - prs_struct *ps, int depth) -{ - if ( !q_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_q_abort_shutdown"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_pointer("server", ps, depth, (void*)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) - return False; - if (!prs_align(ps)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL reg_io_r_abort_shutdown(const char *desc, REG_R_ABORT_SHUTDOWN *r_u, - prs_struct *ps, int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "reg_io_r_abort_shutdown"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} diff --git a/source3/rpc_parse/parse_shutdown.c b/source3/rpc_parse/parse_shutdown.c deleted file mode 100644 index 8c417c05dc..0000000000 --- a/source3/rpc_parse/parse_shutdown.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * RPC Pipe client / server routines - * Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003. - * Copyright (C) Gerald (Jerry) Carter 2002-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 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "includes.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_RPC_PARSE - -/******************************************************************* -Inits a structure. -********************************************************************/ - -void init_shutdown_q_init(SHUTDOWN_Q_INIT *q_s, const char *msg, - uint32 timeout, BOOL do_reboot, BOOL force) -{ - q_s->server = TALLOC_P( get_talloc_ctx(), uint16 ); - if (!q_s->server) { - smb_panic("init_shutdown_q_init: talloc fail.\n"); - return; - } - - *q_s->server = 0x1; - - q_s->message = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR4 ); - if (!q_s->message) { - smb_panic("init_shutdown_q_init: talloc fail.\n"); - return; - } - - if ( msg && *msg ) { - init_unistr4( q_s->message, msg, UNI_FLAGS_NONE ); - - /* Win2000 is apparently very sensitive to these lengths */ - /* do a special case here */ - - q_s->message->string->uni_max_len++; - q_s->message->size += 2; - } - - q_s->timeout = timeout; - - q_s->reboot = do_reboot ? 1 : 0; - q_s->force = force ? 1 : 0; -} - -/******************************************************************* -********************************************************************/ - -void init_shutdown_q_init_ex(SHUTDOWN_Q_INIT_EX * q_u_ex, const char *msg, - uint32 timeout, BOOL do_reboot, BOOL force, uint32 reason) -{ - SHUTDOWN_Q_INIT q_u; - - ZERO_STRUCT( q_u ); - - init_shutdown_q_init( &q_u, msg, timeout, do_reboot, force ); - - /* steal memory */ - - q_u_ex->server = q_u.server; - q_u_ex->message = q_u.message; - - q_u_ex->reboot = q_u.reboot; - q_u_ex->force = q_u.force; - - q_u_ex->reason = reason; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL shutdown_io_q_init(const char *desc, SHUTDOWN_Q_INIT *q_s, prs_struct *ps, - int depth) -{ - if (q_s == NULL) - return False; - - prs_debug(ps, depth, desc, "shutdown_io_q_init"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_pointer("server", ps, depth, (void*)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) - return False; - if (!prs_align(ps)) - return False; - - if (!prs_pointer("message", ps, depth, (void*)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("timeout", ps, depth, &(q_s->timeout))) - return False; - - if (!prs_uint8("force ", ps, depth, &(q_s->force))) - return False; - if (!prs_uint8("reboot ", ps, depth, &(q_s->reboot))) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL shutdown_io_r_init(const char *desc, SHUTDOWN_R_INIT* r_s, prs_struct *ps, - int depth) -{ - if (r_s == NULL) - return False; - - prs_debug(ps, depth, desc, "shutdown_io_r_init"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_s->status)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a REG_Q_SHUTDOWN_EX structure. -********************************************************************/ - -BOOL shutdown_io_q_init_ex(const char *desc, SHUTDOWN_Q_INIT_EX * q_s, prs_struct *ps, - int depth) -{ - if (q_s == NULL) - return False; - - prs_debug(ps, depth, desc, "shutdown_io_q_init_ex"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_pointer("server", ps, depth, (void*)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) - return False; - if (!prs_align(ps)) - return False; - - if (!prs_pointer("message", ps, depth, (void*)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("timeout", ps, depth, &(q_s->timeout))) - return False; - - if (!prs_uint8("force ", ps, depth, &(q_s->force))) - return False; - if (!prs_uint8("reboot ", ps, depth, &(q_s->reboot))) - return False; - - if (!prs_align(ps)) - return False; - if (!prs_uint32("reason", ps, depth, &(q_s->reason))) - return False; - - - return True; -} - -/******************************************************************* -reads or writes a REG_R_SHUTDOWN_EX structure. -********************************************************************/ -BOOL shutdown_io_r_init_ex(const char *desc, SHUTDOWN_R_INIT_EX * r_s, prs_struct *ps, - int depth) -{ - if (r_s == NULL) - return False; - - prs_debug(ps, depth, desc, "shutdown_io_r_init_ex"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_s->status)) - return False; - - return True; -} - - -/******************************************************************* -Inits a structure. -********************************************************************/ -void init_shutdown_q_abort(SHUTDOWN_Q_ABORT *q_s) -{ - q_s->server = TALLOC_P( get_talloc_ctx(), uint16 ); - if (!q_s->server) { - smb_panic("init_shutdown_q_abort: talloc fail.\n"); - return; - } - - *q_s->server = 0x1; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL shutdown_io_q_abort(const char *desc, SHUTDOWN_Q_ABORT *q_s, - prs_struct *ps, int depth) -{ - if (q_s == NULL) - return False; - - prs_debug(ps, depth, desc, "shutdown_io_q_abort"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_pointer("server", ps, depth, (void*)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) - return False; - if (!prs_align(ps)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -BOOL shutdown_io_r_abort(const char *desc, SHUTDOWN_R_ABORT *r_s, - prs_struct *ps, int depth) -{ - if (r_s == NULL) - return False; - - prs_debug(ps, depth, desc, "shutdown_io_r_abort"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_werror("status", ps, depth, &r_s->status)) - return False; - - return True; -} -- cgit From 7ced2e983d29d769a9ad1055f244ecd1e3d08918 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 2 Oct 2006 08:38:54 +0000 Subject: r19028: Implement getprinterinfo level 6 (only the status) and get rid of snum in the getprinter calls. Survives the RPC-SAMBA3-SPOOLSS test which I will activate when the Samba4 build farm has picked it up. Volker (This used to be commit d7248b6cfa4d6e639d92afdd092136d900d90e19) --- source3/rpc_parse/parse_spoolss.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index e878744a1b..1001ba2190 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2451,6 +2451,24 @@ BOOL smb_io_printer_info_5(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_5 return True; } +/******************************************************************* + Parse a PRINTER_INFO_6 structure. +********************************************************************/ + +BOOL smb_io_printer_info_6(const char *desc, RPC_BUFFER *buffer, + PRINTER_INFO_6 *info, int depth) +{ + prs_struct *ps=&buffer->prs; + + prs_debug(ps, depth, desc, "smb_io_printer_info_6"); + depth++; + + if (!prs_uint32("status", ps, depth, &info->status)) + return False; + + return True; +} + /******************************************************************* Parse a PRINTER_INFO_7 structure. ********************************************************************/ @@ -3110,6 +3128,14 @@ uint32 spoolss_size_printer_info_5(PRINTER_INFO_5 *info) return size; } +/******************************************************************* +return the size required by a struct in the stream +********************************************************************/ + +uint32 spoolss_size_printer_info_6(PRINTER_INFO_6 *info) +{ + return sizeof(uint32); +} /******************************************************************* return the size required by a struct in the stream @@ -6263,6 +6289,11 @@ void free_printer_info_5(PRINTER_INFO_5 *printer) SAFE_FREE(printer); } +void free_printer_info_6(PRINTER_INFO_6 *printer) +{ + SAFE_FREE(printer); +} + void free_printer_info_7(PRINTER_INFO_7 *printer) { SAFE_FREE(printer); -- cgit From adc299bd0863a42f699874f1933dbace3abea316 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 6 Oct 2006 16:13:10 +0000 Subject: r19143: getdcname on the NETLOGON pipe returns WERROR, not NTSTATUS. Guenther (This used to be commit 44e228ac796fca2db8509915067511ed705032bf) --- source3/rpc_parse/parse_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index ac8921987a..6f7c453edf 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -560,7 +560,7 @@ BOOL net_io_r_getdcname(const char *desc, NET_R_GETDCNAME *r_t, prs_struct *ps, if (!prs_align(ps)) return False; - if (!prs_ntstatus("status", ps, depth, &r_t->status)) + if (!prs_werror("status", ps, depth, &r_t->status)) return False; return True; -- cgit From 7b84b133fe375e69817fe5c76089f67280507809 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 7 Oct 2006 05:26:21 +0000 Subject: r19161: Add NET_GETANYDCNAME (getdcname only gives the PDC while getanydcname gives just any DC), also make sure to set timeouts in rpcclient accordingly so that we actually get the DC's reply. Guenther (This used to be commit 6091c8152a3998d2503cb0911a217ee904509633) --- source3/rpc_parse/parse_net.c | 84 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 6f7c453edf..1bd75cf8b1 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -566,6 +566,90 @@ BOOL net_io_r_getdcname(const char *desc, NET_R_GETDCNAME *r_t, prs_struct *ps, 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_r_getanydcname\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_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 (!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_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_TRUST_DOM_LIST structure. ********************************************************************/ -- cgit From f799df03d4899ce9a8e6c5b025424501ceb17c1f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 15 Oct 2006 09:16:41 +0000 Subject: r19288: tdb_prs_store is right now used to store printer and share security descriptors. Both databases are long-lived and not frequently written, so I think storing it deserves a tdb transaction. Volker (This used to be commit 2d4b5f5727104f87b8282fc0e94675b0dc4cd9d8) --- source3/rpc_parse/parse_prs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index d97b1b0dff..54bbe3adf6 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1461,7 +1461,7 @@ int tdb_prs_store(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps) kbuf.dsize = strlen(keystr)+1; dbuf.dptr = ps->data_p; dbuf.dsize = prs_offset(ps); - return tdb_store(tdb, kbuf, dbuf, TDB_REPLACE); + return tdb_trans_store(tdb, kbuf, dbuf, TDB_REPLACE); } /* useful function to fetch a structure into rpc wire format */ -- cgit From e59e787b4868acffad49b6264e319d585643d5ab Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Wed, 20 Dec 2006 01:10:04 +0000 Subject: r20269: merge -r20264:20267 from SAMBA_3_0_24 more no previous prototype warnings (This used to be commit 41be182f78762372ae13759ede5d2bd40a71d7f5) --- source3/rpc_parse/parse_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 1bd75cf8b1..0eb30ee455 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1606,7 +1606,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, /* "other" sids are set up above */ } - void dump_acct_flags(uint32 acct_flags) { +static void dump_acct_flags(uint32 acct_flags) { int lvl = 10; DEBUG(lvl,("dump_acct_flags\n")); @@ -1633,7 +1633,7 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, } } - void dump_user_flgs(uint32 user_flags) { +static void dump_user_flgs(uint32 user_flags) { int lvl = 10; DEBUG(lvl,("dump_user_flgs\n")); -- cgit From cf629dc4957b6d1d49c841c62cf68549e955bd9a Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 19 Jan 2007 14:33:36 +0000 Subject: r20904: This is a placeholder fix. Apparently Windows 2000 is sharing the IDL for the SAMR pipe with Windows 2003 but returning NT_STATUS_NOT_SUPPORTED rather than a DCE/RCE fault. We need to catch this in the general sense by looking at the returned PDU size. But this immediate change fixes password changes via pam_winbind against Windows 2000 DCs. (This used to be commit a3602cc6d4926852a21b13d4b731419f70477f5c) --- source3/rpc_parse/parse_samr.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 4173b0169b..5b276d9870 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6,7 +6,7 @@ * Copyright (C) Paul Ashton 1997-2000, * Copyright (C) Elrond 2000, * Copyright (C) Jeremy Allison 2001, - * Copyright (C) Jean Franois Micouleau 1998-2001, + * Copyright (C) Jean François Micouleau 1998-2001, * Copyright (C) Jim McDonough 2002. * * This program is free software; you can redistribute it and/or modify @@ -7780,6 +7780,14 @@ BOOL samr_io_r_chgpasswd_user3(const char *desc, SAMR_R_CHGPASSWD_USER3 *r_u, 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)) -- cgit From 68ddb42c66644efbdde3a45c86b0e4163c59af3f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 31 Jan 2007 19:25:08 +0000 Subject: r21096: Fix formatting. Jeremy (This used to be commit b35fa5168eafd536976fae29d61ac97a3752ab54) --- source3/rpc_parse/parse_spoolss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 1001ba2190..eeadcd1e29 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3930,8 +3930,8 @@ BOOL spoolss_io_q_setprinter(const char *desc, SPOOL_Q_SETPRINTER *q_u, prs_stru prs_debug(ps, depth, "", "sec_io_desc_buf"); if (!prs_uint32("size", ps, depth + 1, &dummy)) return False; - if (!prs_uint32("ptr", ps, depth + 1, &dummy)) return - False; + if (!prs_uint32("ptr", ps, depth + 1, &dummy)) + return False; } if(!prs_uint32("command", ps, depth, &q_u->command)) -- cgit From 6663fa6bdcd7098444d76b9f8413d9088588244b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 14 Feb 2007 17:17:32 +0000 Subject: r21346: FIXME ! Our parsing here is wrong I think, but for a level3 it makes no sense for ptr_sec_desc to be NULL. JRA. Based on a Vista sniff from Martin Zielinski . Jerry - part of the Vista patchset. Jeremy. (This used to be commit 60e26a9039fbe0fd632e306bf545331195fb1ce6) --- source3/rpc_parse/parse_spoolss.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index eeadcd1e29..44d35ec24b 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3913,7 +3913,16 @@ BOOL spoolss_io_q_setprinter(const char *desc, SPOOL_Q_SETPRINTER *q_u, prs_stru } case 3: { - ptr_sec_desc = q_u->info.info_3->secdesc_ptr; + /* FIXME ! Our parsing here is wrong I think, + * but for a level3 it makes no sense for + * ptr_sec_desc to be NULL. JRA. Based on + * a Vista sniff from Martin Zielinski . + */ + if (UNMARSHALLING(ps)) { + ptr_sec_desc = 1; + } else { + ptr_sec_desc = q_u->info.info_3->secdesc_ptr; + } break; } } -- cgit From 216c5c51c545229610215cf41939cab2660ae6a2 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 16 Feb 2007 16:59:28 +0000 Subject: r21393: Fix typo. Guenther (This used to be commit 7bbb3409a530a6ac9712992c87c63e056511517b) --- source3/rpc_parse/parse_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 0eb30ee455..a620781a2f 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -485,7 +485,7 @@ BOOL net_io_r_logon_ctrl(const char *desc, NET_R_LOGON_CTRL *r_l, prs_struct *ps void init_net_q_getdcname(NET_Q_GETDCNAME *r_t, const char *logon_server, const char *domainname) { - DEBUG(5,("init_r_getdcname\n")); + DEBUG(5,("init_q_getdcname\n")); r_t->ptr_logon_server = (logon_server != NULL); init_unistr2(&r_t->uni_logon_server, logon_server, UNI_STR_TERMINATE); @@ -573,7 +573,7 @@ BOOL net_io_r_getdcname(const char *desc, NET_R_GETDCNAME *r_t, prs_struct *ps, void init_net_q_getanydcname(NET_Q_GETANYDCNAME *r_t, const char *logon_server, const char *domainname) { - DEBUG(5,("init_r_getanydcname\n")); + DEBUG(5,("init_q_getanydcname\n")); init_unistr2(&r_t->uni_logon_server, logon_server, UNI_STR_TERMINATE); r_t->ptr_domainname = (domainname != NULL); -- cgit From 2b52e35770270959d5029fa84932d436652c7193 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 22 Feb 2007 20:52:27 +0000 Subject: r21507: Fix some "cannot access LDAP when no root" bugs. The two culprits were * pdb_get_account_policy() * pdb_get_group_sid() (This used to be commit 6a69caf6907fad01b13aa4358ce5c62506f98495) --- source3/rpc_parse/parse_samr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 5b276d9870..e0f5f7f294 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6331,8 +6331,10 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, struct samu *pw, DOM_SID * 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)) { fstring group_sid_string; fstring domain_sid_string; -- cgit From a806037b8713cdf0ae32f7091f53819393132a0b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 27 Mar 2007 11:15:59 +0000 Subject: r21987: split tdb_prs_*() functions in version which take a keystr and a TDB_DATA key metze (This used to be commit 724c6fa337bb535e1b97d0452c2489f58339a3bf) --- source3/rpc_parse/parse_prs.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 54bbe3adf6..ca46807932 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1454,22 +1454,24 @@ BOOL prs_uint32_post(const char *name, prs_struct *ps, int depth, uint32 *data32 } /* useful function to store a structure in rpc wire format */ -int tdb_prs_store(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps) +int tdb_prs_store(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps) { - TDB_DATA kbuf, dbuf; - kbuf.dptr = keystr; - kbuf.dsize = strlen(keystr)+1; + TDB_DATA dbuf; dbuf.dptr = ps->data_p; dbuf.dsize = prs_offset(ps); return tdb_trans_store(tdb, kbuf, dbuf, TDB_REPLACE); } +int tdb_prs_store_bystring(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps) +{ + TDB_DATA kbuf = string_term_tdb_data(keystr); + return tdb_prs_store(tdb, kbuf, ps); +} + /* useful function to fetch a structure into rpc wire format */ -int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *mem_ctx) +int tdb_prs_fetch(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps, TALLOC_CTX *mem_ctx) { - TDB_DATA kbuf, dbuf; - kbuf.dptr = keystr; - kbuf.dsize = strlen(keystr)+1; + TDB_DATA dbuf; prs_init(ps, 0, mem_ctx, UNMARSHALL); @@ -1482,6 +1484,12 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *me return 0; } +int tdb_prs_fetch_bystring(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *mem_ctx) +{ + TDB_DATA kbuf = string_term_tdb_data(keystr); + return tdb_prs_fetch(tdb, kbuf, ps, mem_ctx); +} + /******************************************************************* hash a stream. ********************************************************************/ -- cgit From 56ba44766854ed7cda265bdaf85913f2a1008282 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 28 Mar 2007 13:34:59 +0000 Subject: r22001: change prototype of dump_data(), so that it takes unsigned char * now, which matches what samba4 has. also fix all the callers to prevent compiler warnings metze (This used to be commit fa322f0cc9c26a9537ba3f0a7d4e4a25941317e7) --- source3/rpc_parse/parse_net.c | 8 ++++---- source3/rpc_parse/parse_prs.c | 16 ++++++++-------- source3/rpc_parse/parse_samr.c | 14 +++++++------- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index a620781a2f..3eb31ad55f 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1150,10 +1150,10 @@ void init_id_info1(NET_ID_INFO_1 *id, const char *domain_name, unsigned char key[16]; #ifdef DEBUG_PASSWORD DEBUG(100,("lm cypher:")); - dump_data(100, (char *)lm_cypher, 16); + dump_data(100, lm_cypher, 16); DEBUG(100,("nt cypher:")); - dump_data(100, (char *)nt_cypher, 16); + dump_data(100, nt_cypher, 16); #endif memset(key, 0, 16); @@ -1166,10 +1166,10 @@ void init_id_info1(NET_ID_INFO_1 *id, const char *domain_name, #ifdef DEBUG_PASSWORD DEBUG(100,("encrypt of lm owf password:")); - dump_data(100, (char *)lm_owf, 16); + dump_data(100, lm_owf, 16); DEBUG(100,("encrypt of nt owf password:")); - dump_data(100, (char *)nt_owf, 16); + dump_data(100, nt_owf, 16); #endif /* set up pointers to cypher blocks */ lm_cypher = lm_owf; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index ca46807932..0fb429b591 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1332,7 +1332,7 @@ BOOL prs_string(const char *name, prs_struct *ps, int depth, char *str, int max_ ps->data_offset += len+1; - dump_data(5+depth, q, len); + dump_data(5+depth, (uint8 *)q, len); return True; } @@ -1503,13 +1503,13 @@ BOOL prs_hash1(prs_struct *ps, uint32 offset, int len) #ifdef DEBUG_PASSWORD DEBUG(100, ("prs_hash1\n")); - dump_data(100, ps->sess_key, 16); - dump_data(100, q, len); + dump_data(100, (uint8 *)ps->sess_key, 16); + dump_data(100, (uint8 *)q, len); #endif SamOEMhash((uchar *) q, (const unsigned char *)ps->sess_key, len); #ifdef DEBUG_PASSWORD - dump_data(100, q, len); + dump_data(100, (uint8 *)q, len); #endif return True; @@ -1754,9 +1754,9 @@ BOOL schannel_decode(struct schannel_auth_struct *a, enum pipe_auth_level auth_l checksum after the decode, below */ DEBUG(2, ("schannel_decode: FAILED: packet sequence number:\n")); - dump_data(2, (const char*)verf->seq_num, sizeof(verf->seq_num)); + dump_data(2, (const uint8 *)verf->seq_num, sizeof(verf->seq_num)); DEBUG(2, ("should be:\n")); - dump_data(2, (const char*)seq_num, sizeof(seq_num)); + dump_data(2, (const uint8 *)seq_num, sizeof(seq_num)); return False; } @@ -1764,9 +1764,9 @@ BOOL schannel_decode(struct schannel_auth_struct *a, enum pipe_auth_level auth_l if (memcmp(verf->sig, schannel_sig, sizeof(verf->sig))) { /* Validate that the other end sent the expected header */ DEBUG(2, ("schannel_decode: FAILED: packet header:\n")); - dump_data(2, (const char*)verf->sig, sizeof(verf->sig)); + dump_data(2, (const uint8 *)verf->sig, sizeof(verf->sig)); DEBUG(2, ("should be:\n")); - dump_data(2, (const char*)schannel_sig, sizeof(schannel_sig)); + dump_data(2, (const uint8 *)schannel_sig, sizeof(schannel_sig)); return False; } diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index e0f5f7f294..18d1a66e71 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6661,13 +6661,13 @@ static void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, DATA_BLOB *sess_key, switch (switch_value) { case 0x18: SamOEMhashBlob(ctr->info.id24->pass, 516, sess_key); - dump_data(100, (char *)sess_key->data, sess_key->length); - dump_data(100, (char *)ctr->info.id24->pass, 516); + 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, (char *)sess_key->data, sess_key->length); - dump_data(100, (char *)ctr->info.id23->pass, 516); + dump_data(100, sess_key->data, sess_key->length); + dump_data(100, ctr->info.id23->pass, 516); break; case 0x07: break; @@ -6970,9 +6970,9 @@ void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u, case 18: SamOEMhashBlob(ctr->info.id18->lm_pwd, 16, sess_key); SamOEMhashBlob(ctr->info.id18->nt_pwd, 16, sess_key); - dump_data(100, (char *)sess_key->data, sess_key->length); - dump_data(100, (char *)ctr->info.id18->lm_pwd, 16); - dump_data(100, (char *)ctr->info.id18->nt_pwd, 16); + 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; } } -- cgit From bc2b6436d0f5f3e9ffdfaeb7f1b32996a83d5478 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 29 Mar 2007 09:35:51 +0000 Subject: r22009: change TDB_DATA from char * to unsigned char * and fix all compiler warnings in the users metze (This used to be commit 3a28443079c141a6ce8182c65b56ca210e34f37f) --- source3/rpc_parse/parse_prs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 0fb429b591..632a33cb9a 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1457,7 +1457,7 @@ BOOL prs_uint32_post(const char *name, prs_struct *ps, int depth, uint32 *data32 int tdb_prs_store(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps) { TDB_DATA dbuf; - dbuf.dptr = ps->data_p; + dbuf.dptr = (uint8 *)ps->data_p; dbuf.dsize = prs_offset(ps); return tdb_trans_store(tdb, kbuf, dbuf, TDB_REPLACE); } @@ -1479,7 +1479,7 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps, TALLOC_CTX *m if (!dbuf.dptr) return -1; - prs_give_memory(ps, dbuf.dptr, dbuf.dsize, True); + prs_give_memory(ps, (char *)dbuf.dptr, dbuf.dsize, True); return 0; } -- cgit From 0389cad7c492eda5aee590d0396748c7da9b44ff Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 3 Apr 2007 12:28:40 +0000 Subject: r22055: Port the endpoint mapper (and functions it requires) to Samba 3. (This used to be commit ad981261877e6a2dce0c4f4e71fd9127aa31538a) --- source3/rpc_parse/parse_rpc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 240cac886c..39156d5ef8 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -211,6 +211,16 @@ interface/version dce/rpc pipe identification }, 0x01 \ } +#define SYNT_EPMAPPER_V3 \ +{ \ + { \ + 0xe1af8308, 0x5d1f,0x11c9, \ + { 0x91,0xa4}, \ + {0x08,0x00, \ + 0x2b,0x14,0xa0,0xfa} \ + }, 0x03 \ +} + /* * IMPORTANT!! If you update this structure, make sure to * update the index #defines in smb.h. @@ -234,6 +244,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_EVENTLOG, SYNT_EVENTLOG_V0 , PIPE_EVENTLOG , TRANS_SYNT_V2 }, { PIPE_UNIXINFO, SYNT_UNIXINFO_V0 , PIPE_UNIXINFO , TRANS_SYNT_V2 }, { PIPE_NTSVCS , SYNT_NTSVCS_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, + { PIPE_EPMAPPER, SYNT_EPMAPPER_V3 , PIPE_EPMAPPER , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From 7f8d89bc5488cea1b85161dec98dc1a2dddd7b45 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 3 Apr 2007 19:47:19 +0000 Subject: r22062: Fix the parsing of info level 3. Flags is not a flags field, but an offset. Fixed 64-bit display of ACLs on printers. Jeremy. (This used to be commit 0c8949ff5d742dbe59f2af0f57a289f238e3592c) --- source3/rpc_parse/parse_spoolss.c | 43 ++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 44d35ec24b..9c180d3473 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2388,6 +2388,7 @@ BOOL smb_io_printer_info_2(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_2 BOOL smb_io_printer_info_3(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_3 *info, int depth) { + uint32 offset = 0; prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "smb_io_printer_info_3"); @@ -2395,8 +2396,41 @@ BOOL smb_io_printer_info_3(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_3 buffer->struct_start=prs_offset(ps); - if (!prs_uint32("flags", ps, depth, &info->flags)) - return False; + if (MARSHALLING(ps)) { + /* Ensure the SD is 8 byte aligned in the buffer. */ + uint start = prs_offset(ps); /* Remember the start position. */ + uint off_val = 0; + + /* Write a dummy value. */ + if (!prs_uint32("offset", ps, depth, &off_val)) + return False; + + /* 8 byte align. */ + if (!prs_align_uint64(ps)) + return False; + + /* Remember where we must seek back to write the SD. */ + offset = prs_offset(ps); + + /* Calculate the real offset for the SD. */ + + off_val = offset - start; + + /* Seek back to where we store the SD offset & store. */ + prs_set_offset(ps, start); + if (!prs_uint32("offset", ps, depth, &off_val)) + return False; + + /* Return to after the 8 byte align. */ + prs_set_offset(ps, offset); + + } else { + if (!prs_uint32("offset", ps, depth, &offset)) + return False; + /* Seek within the buffer. */ + if (!prs_set_offset(ps, offset)) + return False; + } if (!sec_io_desc("sec_desc", &info->secdesc, ps, depth)) return False; @@ -3143,9 +3177,8 @@ return the size required by a struct in the stream uint32 spoolss_size_printer_info_3(PRINTER_INFO_3 *info) { - /* The 4 is for the self relative pointer.. */ - /* JRA !!!! TESTME - WHAT ABOUT prs_align.... !!! */ - return 4 + (uint32)sec_desc_size( info->secdesc ); + /* The 8 is for the self relative pointer - 8 byte aligned.. */ + return 8 + (uint32)sec_desc_size( info->secdesc ); } /******************************************************************* -- cgit From a1e72969d571d6b12f4cfa8c6dc16d7d982daa51 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 6 Apr 2007 18:52:30 +0000 Subject: r22104: BUG 4439: Fix the object picket on x64 WIndopws XP/2003. Enable the DsRoleGetPrimaryDomainInfo() server code. Tested by Win2000/XP/2003/Vista (x86) and WinXP (x64) (This used to be commit eab9ca7e7d8d7dc3e705720f8bc5dff5c8ec5f5f) --- source3/rpc_parse/parse_ds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index c613145222..61300f8a8d 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -37,7 +37,7 @@ static BOOL ds_io_dominfobasic(const char *desc, DSROLE_PRIMARY_DOMAIN_INFO_BASI if ( !prs_uint16("machine_role", ps, depth, &p->machine_role) ) return False; - if ( !prs_uint16("unknown", ps, depth, &p->unknown) ) + if ( !prs_align(ps) ) return False; if ( !prs_uint32("flags", ps, depth, &p->flags) ) -- cgit From 62683646dc41cac4956c7df622f37c816521051c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 11 Apr 2007 05:05:33 +0000 Subject: r22163: Pure reformatting. I hate 4 space tabstops :-). Jeremy. (This used to be commit 99abe96b2b8e41e4c7536d35cc169f7e6c3eba1c) --- source3/rpc_parse/parse_prs.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 632a33cb9a..172195f823 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1456,38 +1456,38 @@ BOOL prs_uint32_post(const char *name, prs_struct *ps, int depth, uint32 *data32 /* useful function to store a structure in rpc wire format */ int tdb_prs_store(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps) { - TDB_DATA dbuf; - dbuf.dptr = (uint8 *)ps->data_p; - dbuf.dsize = prs_offset(ps); - return tdb_trans_store(tdb, kbuf, dbuf, TDB_REPLACE); + TDB_DATA dbuf; + dbuf.dptr = (uint8 *)ps->data_p; + dbuf.dsize = prs_offset(ps); + return tdb_trans_store(tdb, kbuf, dbuf, TDB_REPLACE); } int tdb_prs_store_bystring(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps) { - TDB_DATA kbuf = string_term_tdb_data(keystr); - return tdb_prs_store(tdb, kbuf, ps); + TDB_DATA kbuf = string_term_tdb_data(keystr); + return tdb_prs_store(tdb, kbuf, ps); } /* useful function to fetch a structure into rpc wire format */ int tdb_prs_fetch(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps, TALLOC_CTX *mem_ctx) { - TDB_DATA dbuf; + TDB_DATA dbuf; - prs_init(ps, 0, mem_ctx, UNMARSHALL); + prs_init(ps, 0, mem_ctx, UNMARSHALL); - dbuf = tdb_fetch(tdb, kbuf); - if (!dbuf.dptr) - return -1; + dbuf = tdb_fetch(tdb, kbuf); + if (!dbuf.dptr) + return -1; - prs_give_memory(ps, (char *)dbuf.dptr, dbuf.dsize, True); + prs_give_memory(ps, (char *)dbuf.dptr, dbuf.dsize, True); - return 0; + return 0; } int tdb_prs_fetch_bystring(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *mem_ctx) { - TDB_DATA kbuf = string_term_tdb_data(keystr); - return tdb_prs_fetch(tdb, kbuf, ps, mem_ctx); + TDB_DATA kbuf = string_term_tdb_data(keystr); + return tdb_prs_fetch(tdb, kbuf, ps, mem_ctx); } /******************************************************************* -- cgit From 12ba88574bf91bdcc4447bfc3d429b799064bfd9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 27 Apr 2007 23:18:41 +0000 Subject: r22542: Move over to using the _strict varients of the talloc calls. No functional changes. Looks bigger than it is :-). Jeremy. (This used to be commit f6fa3080fee1b20df9f1968500840a88cf0ee592) --- source3/rpc_parse/parse_buffer.c | 3 +++ source3/rpc_parse/parse_eventlog.c | 4 +++- source3/rpc_parse/parse_misc.c | 2 +- source3/rpc_parse/parse_net.c | 28 +++++++++++++++++++++++++--- source3/rpc_parse/parse_prs.c | 6 +++--- 5 files changed, 35 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index 5643189afe..b66eb9910a 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -401,6 +401,9 @@ BOOL smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16 { chaine2[l_chaine2] = '\0'; *string=(uint16 *)TALLOC_MEMDUP(prs_get_mem_context(ps),chaine2,realloc_size); + if (!*string) { + return False; + } SAFE_FREE(chaine2); } diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index addf433feb..436f35aff6 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -354,7 +354,9 @@ BOOL eventlog_io_r_read_eventlog(const char *desc, /* Now pad with whitespace until the end of the response buffer */ if (q_u->max_read_size - r_u->num_bytes_in_resp) { - r_u->end_of_entries_padding = SMB_CALLOC_ARRAY(uint8, q_u->max_read_size - r_u->num_bytes_in_resp); + if (!r_u->end_of_entries_padding) { + return False; + } if(!(prs_uint8s(False, "end of entries padding", ps, depth, r_u->end_of_entries_padding, diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index efc5274f45..a42915aa08 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -221,7 +221,7 @@ BOOL smb_io_dom_sid2_p(const char *desc, prs_struct *ps, int depth, DOM_SID2 **s if (UNMARSHALLING(ps)) { if ( !(*sid2 = PRS_ALLOC_MEM(ps, DOM_SID2, 1)) ) - return False; + return False; } return True; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 3eb31ad55f..b3331c8369 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -2995,7 +2995,16 @@ static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info, if(!prs_uint32("attribute_count", ps, depth, &info->attribute_count)) return False; - info->attributes = TALLOC_ARRAY(ps->mem_ctx, uint32, info->attribute_count); + 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; iattribute_count; i++) if(!prs_uint32("attributes", ps, depth, &info->attributes[i])) @@ -3004,8 +3013,21 @@ static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info, if(!prs_uint32("privlist_count", ps, depth, &info->privlist_count)) return False; - 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 (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; iprivlist_count; i++) if(!smb_io_unihdr("hdr_privslist", &info->hdr_privslist[i], ps, depth)) diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 172195f823..bf79c44395 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -156,9 +156,9 @@ char *prs_alloc_mem(prs_struct *ps, size_t size, unsigned int count) { char *ret = NULL; - if (size) { + if (size && count) { /* We can't call the type-safe version here. */ - ret = (char *)_talloc_zero_array(ps->mem_ctx, size, count, + ret = (char *)_talloc_zero_array_strict(ps->mem_ctx, size, count, "parse_prs"); } return ret; @@ -1825,7 +1825,7 @@ return the contents of a prs_struct in a DATA_BLOB BOOL prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) { blob->length = prs_data_size(prs); - blob->data = (uint8 *)talloc_zero_size(mem_ctx, blob->length); + blob->data = (uint8 *)TALLOC_ZERO_SIZE(mem_ctx, blob->length); /* set the pointer at the end of the buffer */ prs_set_offset( prs, prs_data_size(prs) ); -- cgit From 4ab6a8ebb70bbd5d69ad1dc6196c936f01f5aaf7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sun, 29 Apr 2007 00:09:22 +0000 Subject: r22564: Move the _strict -> _zeronull functions into lib/util.c and out of talloc at tridge's request. Jeremy. (This used to be commit da78488b86c464b6861d36398cca7524ad5906fe) --- source3/rpc_parse/parse_prs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index bf79c44395..56fffcc26e 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -158,7 +158,7 @@ char *prs_alloc_mem(prs_struct *ps, size_t size, unsigned int count) if (size && count) { /* We can't call the type-safe version here. */ - ret = (char *)_talloc_zero_array_strict(ps->mem_ctx, size, count, + ret = (char *)_talloc_zero_array_zeronull(ps->mem_ctx, size, count, "parse_prs"); } return ret; -- cgit From 571845991e137eb5f166d54c59a9e7efc1d565af Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sun, 29 Apr 2007 20:57:04 +0000 Subject: r22576: Fix marshalling bug in aliasmem. Jeremy. (This used to be commit 415c476f7242269d6feb2365531f4c8286bdc0f2) --- source3/rpc_parse/parse_samr.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 18d1a66e71..9beefbc0c0 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4834,9 +4834,15 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1)) return False; - ptr_sid = TALLOC_ARRAY(ps->mem_ctx, uint32, r_u->num_sids1); - if (!ptr_sid) { - return False; + if (UNMARSHALLING(ps)) { + 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++) { @@ -4846,7 +4852,14 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, } if (UNMARSHALLING(ps)) { - r_u->sid = TALLOC_ARRAY(ps->mem_ctx, DOM_SID2, r_u->num_sids1); + 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++) { -- cgit From 138668d5d284f7d2496f22c16a99be107cdfc872 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sun, 29 Apr 2007 21:13:13 +0000 Subject: r22577: Change all of parse/*.c to use standard form. Fix some marshalling bugs. Jeremy. (This used to be commit 3df99006f8a52af7cff0fbca1bf16157a8648254) --- source3/rpc_parse/parse_lsa.c | 15 ++-- source3/rpc_parse/parse_net.c | 166 ++++++++++++++++++++++++--------------- source3/rpc_parse/parse_ntsvcs.c | 10 ++- source3/rpc_parse/parse_svcctl.c | 12 ++- 4 files changed, 127 insertions(+), 76 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index e1630f79f4..cbbba7f3e9 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -573,14 +573,17 @@ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *out, return; } - out->domlist->domains = TALLOC_ARRAY( ctx, DOMAIN_INFO, + if (out->count) { + out->domlist->domains = TALLOC_ARRAY( ctx, DOMAIN_INFO, out->count ); - - if ( !out->domlist->domains ) { - out->status = NT_STATUS_NO_MEMORY; - return; + 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 */ diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index b3331c8369..d821cf85f0 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -2551,13 +2551,19 @@ static BOOL net_io_sam_group_mem_info(const char *desc, SAM_GROUP_MEM_INFO * inf return False; } - 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; - } + 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++) { @@ -2578,13 +2584,19 @@ static BOOL net_io_sam_group_mem_info(const char *desc, SAM_GROUP_MEM_INFO * inf return False; } - 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; - } + 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++) { @@ -2664,13 +2676,19 @@ static BOOL net_io_sam_alias_mem_info(const char *desc, SAM_ALIAS_MEM_INFO * inf return False; } - info->ptr_sids = TALLOC_ARRAY(ps->mem_ctx, uint32, info->num_sids); + 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; - } + 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++) { @@ -2679,13 +2697,19 @@ static BOOL net_io_sam_alias_mem_info(const char *desc, SAM_ALIAS_MEM_INFO * inf return False; } - 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; - } + 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++) { @@ -3157,15 +3181,19 @@ BOOL net_io_r_sam_sync(const char *desc, return False; } - if (r_s->num_deltas2 > 0) { - 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; - } - } + 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++) { @@ -3175,15 +3203,19 @@ BOOL net_io_r_sam_sync(const char *desc, return False; } - if (r_s->num_deltas2 > 0) { - 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; - } - } + 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++) { @@ -3286,15 +3318,19 @@ BOOL net_io_r_sam_deltas(const char *desc, if (r_s->ptr_deltas != 0) { - if (r_s->num_deltas > 0) { - 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; - } - } + 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++) { @@ -3302,15 +3338,19 @@ BOOL net_io_r_sam_deltas(const char *desc, ps, depth); } - if (r_s->num_deltas > 0) { - 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; - } - } + 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++) { diff --git a/source3/rpc_parse/parse_ntsvcs.c b/source3/rpc_parse/parse_ntsvcs.c index ab5f3f75e8..559a9d5ab5 100644 --- a/source3/rpc_parse/parse_ntsvcs.c +++ b/source3/rpc_parse/parse_ntsvcs.c @@ -334,9 +334,13 @@ BOOL ntsvcs_io_r_get_hw_profile_info(const char *desc, NTSVCS_R_GET_HW_PROFILE_I return False; if ( UNMARSHALLING(ps) ) { - r_u->buffer = TALLOC_ARRAY(get_talloc_ctx(), uint8, r_u->buffer_size ); - if (!r_u->buffer) { - return False; + if (r_u->buffer_size) { + r_u->buffer = TALLOC_ARRAY(get_talloc_ctx(), uint8, r_u->buffer_size ); + if (!r_u->buffer) { + return False; + } + } else { + r_u->buffer = NULL; } } diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index dc4ee3e6e9..3846812f31 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -829,10 +829,14 @@ BOOL svcctl_io_service_fa( const char *desc, SERVICE_FAILURE_ACTIONS *fa, RPC_BU if ( !prs_uint32("num_actions", ps, depth, &fa->num_actions) ) return False; - if ( UNMARSHALLING(ps) && fa->num_actions ) { - if ( !(fa->actions = TALLOC_ARRAY( get_talloc_ctx(), SC_ACTION, fa->num_actions )) ) { - DEBUG(0,("svcctl_io_service_fa: talloc() failure!\n")); - return False; + if ( UNMARSHALLING(ps)) { + if (fa->num_actions) { + if ( !(fa->actions = TALLOC_ARRAY( get_talloc_ctx(), SC_ACTION, fa->num_actions )) ) { + DEBUG(0,("svcctl_io_service_fa: talloc() failure!\n")); + return False; + } + } else { + fa->actions = NULL; } } -- cgit From 61f95f1f9759383a8b1ffaf7da6100865144156f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 30 Apr 2007 00:48:20 +0000 Subject: r22585: Get us into a consistent state with TALLOC_ZERO_ARRAY also. Jeremy. (This used to be commit c622fb8536d955952a0fbf2441a4cb45a9feb9b0) --- source3/rpc_parse/parse_lsa.c | 47 ++++++++++++--------- source3/rpc_parse/parse_misc.c | 95 ++++++++++++++++++++++++++---------------- source3/rpc_parse/parse_net.c | 20 ++++++--- source3/rpc_parse/parse_samr.c | 32 ++++++++++---- 4 files changed, 125 insertions(+), 69 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index cbbba7f3e9..ea249dc560 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -740,9 +740,13 @@ static BOOL lsa_io_dom_query_2(const char *desc, DOM_QUERY_2 *d_q, prs_struct *p return False; if (UNMARSHALLING(ps)) { - d_q->auditsettings = TALLOC_ZERO_ARRAY(ps->mem_ctx, uint32, d_q->count2); - if (!d_q->auditsettings) { - return False; + 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; } } @@ -1121,16 +1125,16 @@ static void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, /* Allocate memory for sids and sid pointers */ - if (num_entries == 0) return; - - 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 (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; + 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 */ @@ -1566,14 +1570,19 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, q_l->num_entries2 = num_names; q_l->lookup_level = 1; - 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 (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; + 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++) { diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index a42915aa08..7a07ef5e7b 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -449,11 +449,15 @@ void init_unistr(UNISTR *str, const char *buf) len = strlen(buf) + 1; - str->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, len); - if (str->buffer == NULL) - smb_panic("init_unistr: malloc fail\n"); + if (len) { + str->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, len); + if (str->buffer == NULL) + smb_panic("init_unistr: malloc fail\n"); - rpcstr_push(str->buffer, buf, len*sizeof(uint16), STR_TERMINATE); + rpcstr_push(str->buffer, buf, len*sizeof(uint16), STR_TERMINATE); + } else { + str->buffer = NULL; + } } /******************************************************************* @@ -656,15 +660,18 @@ void copy_unistr2(UNISTR2 *str, const UNISTR2 *from) (the the length of the source string) to prevent reallocation of memory. */ if (str->buffer == NULL) { - str->buffer = (uint16 *)TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, str->uni_max_len); - if ((str->buffer == NULL)) { - smb_panic("copy_unistr2: talloc fail\n"); - return; + if (str->uni_max_len) { + str->buffer = (uint16 *)TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, str->uni_max_len); + if ((str->buffer == NULL)) { + smb_panic("copy_unistr2: talloc fail\n"); + return; + } + /* copy the string */ + memcpy(str->buffer, from->buffer, str->uni_max_len*sizeof(uint16)); + } else { + str->buffer = NULL; } } - - /* copy the string */ - memcpy(str->buffer, from->buffer, str->uni_max_len*sizeof(uint16)); } /******************************************************************* @@ -752,7 +759,9 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) len = strlen(buf) + 1; if ( flags == UNI_STR_DBLTERMINATE ) len++; - } else { + } + + if (buf == NULL || len == 0) { /* no buffer -- nothing to do */ str->uni_max_len = 0; str->offset = 0; @@ -840,10 +849,14 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) str->offset = 0; str->uni_str_len = len; - str->buffer = TALLOC_ZERO_ARRAY(ctx, uint16, len + 1); - if (str->buffer == NULL) { - smb_panic("init_unistr2_w: talloc fail\n"); - return; + if (len + 1) { + str->buffer = TALLOC_ZERO_ARRAY(ctx, uint16, len + 1); + if (str->buffer == NULL) { + smb_panic("init_unistr2_w: talloc fail\n"); + return; + } + } else { + str->buffer = NULL; } /* @@ -856,7 +869,9 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) /* Yes, this is a strncpy( foo, bar, strlen(bar)) - but as long as the buffer above is talloc()ed correctly then this is the correct thing to do */ - strncpy_w(str->buffer, buf, len + 1); + if (len+1) { + strncpy_w(str->buffer, buf, len + 1); + } } /******************************************************************* @@ -890,10 +905,14 @@ void init_unistr2_from_unistr(UNISTR2 *to, const UNISTR *from) to->uni_str_len = i; /* allocate the space and copy the string buffer */ - to->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, i); - if (to->buffer == NULL) - smb_panic("init_unistr2_from_unistr: malloc fail\n"); - memcpy(to->buffer, from->buffer, i*sizeof(uint16)); + if (i) { + to->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, i); + if (to->buffer == NULL) + smb_panic("init_unistr2_from_unistr: malloc fail\n"); + memcpy(to->buffer, from->buffer, i*sizeof(uint16)); + } else { + to->buffer = NULL; + } return; } @@ -1089,12 +1108,13 @@ BOOL prs_unistr4_array(const char *desc, prs_struct *ps, int depth, UNISTR4_ARRA if(!prs_uint32("count", ps, depth, &array->count)) return False; - if ( array->count == 0 ) - return True; - if (UNMARSHALLING(ps)) { - if ( !(array->strings = TALLOC_ZERO_ARRAY( get_talloc_ctx(), UNISTR4, array->count)) ) - return False; + if (array->count) { + if ( !(array->strings = TALLOC_ZERO_ARRAY( get_talloc_ctx(), UNISTR4, array->count)) ) + return False; + } else { + array->strings = NULL; + } } /* write the headers and then the actual string buffer */ @@ -1122,13 +1142,14 @@ BOOL init_unistr4_array( UNISTR4_ARRAY *array, uint32 count, const char **string array->count = count; - if ( array->count == 0 ) - return True; - /* allocate memory for the array of UNISTR4 objects */ - if ( !(array->strings = TALLOC_ZERO_ARRAY(get_talloc_ctx(), UNISTR4, count )) ) - return False; + if (array->count) { + if ( !(array->strings = TALLOC_ZERO_ARRAY(get_talloc_ctx(), UNISTR4, count )) ) + return False; + } else { + array->strings = NULL; + } for ( i=0; istrings[i], strings[i], UNI_STR_TERMINATE ); @@ -1677,11 +1698,15 @@ void init_unistr3(UNISTR3 *str, const char *buf) str->uni_str_len = strlen(buf) + 1; - str->str.buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, str->uni_str_len); - if (str->str.buffer == NULL) - smb_panic("init_unistr3: malloc fail\n"); + if (str->uni_str_len) { + str->str.buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, str->uni_str_len); + if (str->str.buffer == NULL) + smb_panic("init_unistr3: malloc fail\n"); - rpcstr_push((char *)str->str.buffer, buf, str->uni_str_len * sizeof(uint16), STR_TERMINATE); + rpcstr_push((char *)str->str.buffer, buf, str->uni_str_len * sizeof(uint16), STR_TERMINATE); + } else { + str->str.buffer = NULL; + } } /******************************************************************* diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index d821cf85f0..4c2f676831 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1106,9 +1106,13 @@ static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsi } /* Now allocate space for them. */ - *ppsids = TALLOC_ZERO_ARRAY(ctx, DOM_SID2, count); - if (*ppsids == NULL) - return 0; + if (count) { + *ppsids = TALLOC_ZERO_ARRAY(ctx, DOM_SID2, count); + if (*ppsids == NULL) + return 0; + } else { + *ppsids = NULL; + } sids = *ppsids; @@ -1590,9 +1594,13 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, usr->num_groups2 = num_groups; - usr->gids = TALLOC_ZERO_ARRAY(ctx,DOM_GID,num_groups); - if (usr->gids == NULL && num_groups>0) - return; + 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]; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 9beefbc0c0..49a1db75c0 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4245,7 +4245,11 @@ void init_samr_q_lookup_rids(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_RIDS * q_u, q_u->flags = flags; q_u->ptr = 0; q_u->num_rids2 = num_rids; - q_u->rid = TALLOC_ZERO_ARRAY(ctx, uint32, 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; @@ -4897,11 +4901,16 @@ NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, q_u->ptr = 0; q_u->num_names2 = num_names; - if (!(q_u->hdr_name = TALLOC_ZERO_ARRAY(ctx, UNIHDR, num_names))) - return NT_STATUS_NO_MEMORY; + 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; + 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 */ @@ -4986,10 +4995,15 @@ NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, 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; + if (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; + } else { + r_u->rids = NULL; + r_u->types = NULL; + } if (!r_u->rids || !r_u->types) goto empty; -- cgit From 79de0ad9463a5cd64978beae37df79fbb4f74632 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 30 Apr 2007 01:34:28 +0000 Subject: r22588: Make all uses of TALLOC_MEMDUP consistent. Jeremy. (This used to be commit 8ad13718af0ba1fcb10a6f1631b1ed3cb8d11175) --- source3/rpc_parse/parse_spoolss.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 9c180d3473..98280ee844 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5251,9 +5251,13 @@ BOOL make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 buf5->buf_len = len; if (src) { - if((buf5->buffer=(uint16*)TALLOC_MEMDUP(mem_ctx, src, sizeof(uint16)*len)) == NULL) { - DEBUG(0,("make_spoolss_buffer5: Unable to malloc memory for buffer!\n")); - return False; + if (len) { + if((buf5->buffer=(uint16*)TALLOC_MEMDUP(mem_ctx, src, sizeof(uint16)*len)) == NULL) { + DEBUG(0,("make_spoolss_buffer5: Unable to malloc memory for buffer!\n")); + return False; + } + } else { + buf5->buffer = NULL; } } else { buf5->buffer=NULL; -- cgit From a127d5331a62c21fcf6013b3849e421af0f30924 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 1 May 2007 16:49:00 +0000 Subject: r22630: Revert svn r22576 (parse change to enum_aliasmem(). Original code was correct (This used to be commit cf11b4314987d4d429d09e073c5294d3a9977c52) --- source3/rpc_parse/parse_samr.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 49a1db75c0..296296ac5a 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4838,15 +4838,9 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1)) return False; - if (UNMARSHALLING(ps)) { - 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; - } + ptr_sid = TALLOC_ARRAY(ps->mem_ctx, uint32, r_u->num_sids1); + if (!ptr_sid) { + return False; } for (i = 0; i < r_u->num_sids1; i++) { @@ -4856,14 +4850,7 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, } 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; - } + r_u->sid = TALLOC_ARRAY(ps->mem_ctx, DOM_SID2, r_u->num_sids1); } for (i = 0; i < r_u->num_sids1; i++) { -- cgit From 32b9beb164a419b97f00811dbc7a0fb57e086690 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 May 2007 19:14:51 +0000 Subject: r22673: Fix for Jerry's reversion. We still need to check size before talloc. Jeremy. (This used to be commit 9e4c6ab7392b2dbaccfaced88d3bc7502ff073ee) --- source3/rpc_parse/parse_samr.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 296296ac5a..529ad319bb 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4838,9 +4838,14 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1)) return False; - ptr_sid = TALLOC_ARRAY(ps->mem_ctx, uint32, r_u->num_sids1); - if (!ptr_sid) { - 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++) { @@ -4850,7 +4855,14 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, } if (UNMARSHALLING(ps)) { - r_u->sid = TALLOC_ARRAY(ps->mem_ctx, DOM_SID2, r_u->num_sids1); + 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++) { -- cgit From 92999cee8de0b67d2e7c99c0b093a54b5e8681a3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 May 2007 22:15:33 +0000 Subject: r22676: Fix zero alloc with create_rpc_blob(). Jeremy. (This used to be commit c73963a60ad2d35d69d1ac4c02e24f3272efdd87) --- source3/rpc_parse/parse_misc.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 7a07ef5e7b..6838547090 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -483,12 +483,17 @@ BOOL smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth) Allocate the RPC_DATA_BLOB memory. ********************************************************************/ -size_t create_rpc_blob(RPC_DATA_BLOB *str, size_t len) +static void create_rpc_blob(RPC_DATA_BLOB *str, size_t len) { - str->buffer = (uint8 *)TALLOC_ZERO(get_talloc_ctx(), len); - if (str->buffer == NULL) - smb_panic("create_rpc_blob: talloc fail\n"); - return len; + if (len) { + str->buffer = (uint8 *)TALLOC_ZERO(get_talloc_ctx(), len); + if (str->buffer == NULL) + smb_panic("create_rpc_blob: talloc fail\n"); + str->buf_len = len; + } else { + str->buffer = NULL; + str->buf_len = 0; + } } /******************************************************************* @@ -500,7 +505,7 @@ void init_rpc_blob_uint32(RPC_DATA_BLOB *str, uint32 val) ZERO_STRUCTP(str); /* set up string lengths. */ - str->buf_len = create_rpc_blob(str, sizeof(uint32)); + create_rpc_blob(str, sizeof(uint32)); SIVAL(str->buffer, 0, val); } @@ -513,9 +518,10 @@ void init_rpc_blob_str(RPC_DATA_BLOB *str, const char *buf, int len) ZERO_STRUCTP(str); /* set up string lengths. */ - str->buf_len = create_rpc_blob(str, len*2); - rpcstr_push(str->buffer, buf, (size_t)str->buf_len, STR_TERMINATE); - + if (len) { + create_rpc_blob(str, len*2); + rpcstr_push(str->buffer, buf, (size_t)str->buf_len, STR_TERMINATE); + } } /******************************************************************* @@ -525,8 +531,10 @@ void init_rpc_blob_str(RPC_DATA_BLOB *str, const char *buf, int len) void init_rpc_blob_hex(RPC_DATA_BLOB *str, const char *buf) { ZERO_STRUCTP(str); - str->buf_len = create_rpc_blob(str, strlen(buf)); - str->buf_len = strhex_to_str((char *)str->buffer, str->buf_len, buf); + if (buf && *buf) { + create_rpc_blob(str, strlen(buf)); + str->buf_len = strhex_to_str((char *)str->buffer, str->buf_len, buf); + } } /******************************************************************* @@ -538,8 +546,8 @@ void init_rpc_blob_bytes(RPC_DATA_BLOB *str, uint8 *buf, size_t len) ZERO_STRUCTP(str); /* max buffer size (allocated size) */ - if (buf != NULL) { - len = create_rpc_blob(str, len); + if (buf != NULL && len) { + create_rpc_blob(str, len); memcpy(str->buffer, buf, len); } str->buf_len = len; -- cgit From b4a7b7a8889737e2891fc1176feabd4ce47f2737 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 14 May 2007 12:16:20 +0000 Subject: r22844: Introduce const DATA_BLOB data_blob_null = { NULL, 0, NULL }; and replace all data_blob(NULL, 0) calls. (This used to be commit 3d3d61687ef00181f4f04e001d42181d93ac931e) --- source3/rpc_parse/parse_samr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 529ad319bb..223ce86977 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6317,7 +6317,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, struct samu *pw, DOM_SID * if (munged_dial) { munged_dial_blob = base64_decode_data_blob(munged_dial); } else { - munged_dial_blob = data_blob(NULL, 0); + munged_dial_blob = data_blob_null; } /* Create NTTIME structs */ @@ -6571,7 +6571,7 @@ void init_sam_user_info20A(SAM_USER_INFO_20 *usr, struct samu *pw) if (munged_dial) { blob = base64_decode_data_blob(munged_dial); } else { - blob = data_blob(NULL, 0); + blob = data_blob_null; } init_unistr2_from_datablob(&usr->uni_munged_dial, &blob); -- cgit From d34f6bb969092166c961e328229b1b05a30f6930 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 14 May 2007 14:23:51 +0000 Subject: r22852: merge fixes for CVE-2007-2446 and CVE-2007-2447 to all branches (This used to be commit f65214be68c1a59d9598bfb9f3b19e71cc3fa07b) --- source3/rpc_parse/parse_lsa.c | 22 ++++++++++++++++------ source3/rpc_parse/parse_prs.c | 2 +- source3/rpc_parse/parse_sec.c | 13 ++++++------- source3/rpc_parse/parse_spoolss.c | 4 ++++ 4 files changed, 27 insertions(+), 14 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index ea249dc560..06ccec4ab3 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1356,12 +1356,17 @@ static BOOL lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, &trn->num_entries2)) return False; + if (trn->num_entries2 != trn->num_entries) { + /* RPC fault */ + return False; + } + if (UNMARSHALLING(ps)) { - if ((trn->name = PRS_ALLOC_MEM(ps, LSA_TRANS_NAME, trn->num_entries)) == NULL) { + 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_entries)) == NULL) { + if ((trn->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, trn->num_entries2)) == NULL) { return False; } } @@ -1413,12 +1418,17 @@ static BOOL lsa_io_trans_names2(const char *desc, LSA_TRANS_NAME_ENUM2 *trn, &trn->num_entries2)) return False; + if (trn->num_entries2 != trn->num_entries) { + /* RPC fault */ + return False; + } + if (UNMARSHALLING(ps)) { - if ((trn->name = PRS_ALLOC_MEM(ps, LSA_TRANS_NAME2, trn->num_entries)) == NULL) { + 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_entries)) == NULL) { + if ((trn->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, trn->num_entries2)) == NULL) { return False; } } @@ -2771,7 +2781,7 @@ static BOOL lsa_io_luid_attr(const char *desc, LUID_ATTR *out, prs_struct *ps, i static BOOL lsa_io_privilege_set(const char *desc, PRIVILEGE_SET *out, prs_struct *ps, int depth) { - uint32 i; + uint32 i, dummy; prs_debug(ps, depth, desc, "lsa_io_privilege_set"); depth++; @@ -2779,7 +2789,7 @@ static BOOL lsa_io_privilege_set(const char *desc, PRIVILEGE_SET *out, prs_struc if(!prs_align(ps)) return False; - if(!prs_uint32("count", ps, depth, &out->count)) + if(!prs_uint32("count", ps, depth, &dummy)) return False; if(!prs_uint32("control", ps, depth, &out->control)) return False; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 56fffcc26e..84f64a2a66 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -644,7 +644,7 @@ BOOL prs_pointer( const char *name, prs_struct *ps, int depth, return True; if (UNMARSHALLING(ps)) { - if ( !(*data = PRS_ALLOC_MEM_VOID(ps, data_size)) ) + if ( !(*data = PRS_ALLOC_MEM(ps, char, data_size)) ) return False; } diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index bc33062264..72accad1b6 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -183,13 +183,12 @@ BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) return False; if (UNMARSHALLING(ps)) { - /* - * Even if the num_aces is zero, allocate memory as there's a difference - * between a non-present DACL (allow all access) and a DACL with no ACE's - * (allow no access). - */ - if((psa->aces = PRS_ALLOC_MEM(ps, SEC_ACE, psa->num_aces+1)) == NULL) - return False; + if (psa->num_aces) { + if((psa->aces = PRS_ALLOC_MEM(ps, SEC_ACE, psa->num_aces)) == NULL) + return False; + } else { + psa->aces = NULL; + } } for (i = 0; i < psa->num_aces; i++) { diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 98280ee844..936587fdf5 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -230,6 +230,10 @@ static BOOL smb_io_notify_option_type_data(const char *desc, SPOOL_NOTIFY_OPTION if (type->count2 != type->count) DEBUG(4,("What a mess, count was %x now is %x !\n", type->count, type->count2)); + if (type->count2 > MAX_NOTIFY_TYPE_FOR_NOW) { + return False; + } + /* parse the option type data */ for(i=0;icount2;i++) if(!prs_uint16("fields",ps,depth,&type->fields[i])) -- cgit From 71ee55f98d87ff70e5feb0d2b280e9c71f7b9b6a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 22 May 2007 20:20:01 +0000 Subject: r23080: Fix bug #4637 - we hads missed some cases where we were calling PRS_ALLOC_MEM with zero count. Jeremy. (This used to be commit 9a10736e6fa276ca4b0726fbb7baf0daafbdc46d) --- source3/rpc_parse/parse_lsa.c | 20 ++++++++-------- source3/rpc_parse/parse_net.c | 23 +++++++++++++------ source3/rpc_parse/parse_prs.c | 48 +++++++++++++++++++++++++++------------ source3/rpc_parse/parse_samr.c | 22 ++++++++++-------- source3/rpc_parse/parse_spoolss.c | 34 +++++++++++++++------------ 5 files changed, 90 insertions(+), 57 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 06ccec4ab3..0add8b2bb0 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1178,7 +1178,7 @@ static BOOL lsa_io_sid_enum(const char *desc, LSA_SID_ENUM *sen, prs_struct *ps, /* Mallocate memory if we're unpacking from the wire */ - if (UNMARSHALLING(ps)) { + 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")); @@ -1361,7 +1361,7 @@ static BOOL lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, return False; } - if (UNMARSHALLING(ps)) { + if (UNMARSHALLING(ps) && trn->num_entries2) { if ((trn->name = PRS_ALLOC_MEM(ps, LSA_TRANS_NAME, trn->num_entries2)) == NULL) { return False; } @@ -1423,7 +1423,7 @@ static BOOL lsa_io_trans_names2(const char *desc, LSA_TRANS_NAME_ENUM2 *trn, return False; } - if (UNMARSHALLING(ps)) { + if (UNMARSHALLING(ps) && trn->num_entries2) { if ((trn->name = PRS_ALLOC_MEM(ps, LSA_TRANS_NAME2, trn->num_entries2)) == NULL) { return False; } @@ -1700,7 +1700,7 @@ BOOL lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *out, prs_struct return False; } - if (UNMARSHALLING(ps)) { + 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")); @@ -1825,7 +1825,7 @@ BOOL lsa_io_r_lookup_names2(const char *desc, LSA_R_LOOKUP_NAMES2 *out, prs_stru return False; } - if (UNMARSHALLING(ps)) { + 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")); @@ -1978,7 +1978,7 @@ BOOL lsa_io_r_lookup_names3(const char *desc, LSA_R_LOOKUP_NAMES3 *out, prs_stru return False; } - if (UNMARSHALLING(ps)) { + 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")); @@ -2107,7 +2107,7 @@ BOOL lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_stru return False; } - if (UNMARSHALLING(ps)) { + 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")); @@ -2346,7 +2346,7 @@ BOOL lsa_io_r_enum_privs(const char *desc, LSA_R_ENUM_PRIVS *out, prs_struct *ps if(!prs_uint32("count1", ps, depth, &out->count1)) return False; - if (UNMARSHALLING(ps)) + if (UNMARSHALLING(ps) && out->count1) if (!(out->privs = PRS_ALLOC_MEM(ps, LSA_PRIV_ENTRY, out->count1))) return False; @@ -3908,7 +3908,7 @@ static BOOL smb_io_lsa_data_buf(const char *desc, LSA_DATA_BUF *buf, prs_debug(ps, depth, desc, "smb_io_lsa_data_buf"); depth++; - if ( UNMARSHALLING(ps) ) { + if ( UNMARSHALLING(ps) && length ) { if ( !(buf->data = PRS_ALLOC_MEM( ps, uint8, length )) ) return False; } @@ -3922,7 +3922,7 @@ static BOOL smb_io_lsa_data_buf(const char *desc, LSA_DATA_BUF *buf, if (!prs_uint32("length", ps, depth, &buf->length)) return False; - if(!prs_uint8s(False, "data", ps, depth, buf->data, size)) + if(!prs_uint8s(False, "data", ps, depth, buf->data, length)) return False; return True; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 4c2f676831..6e2b2b26e7 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1813,9 +1813,13 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, } if (UNMARSHALLING(ps)) { - usr->gids = PRS_ALLOC_MEM(ps, DOM_GID, usr->num_groups); - if (usr->gids == NULL) - return False; + 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++) { @@ -1848,10 +1852,15 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, return False; if (UNMARSHALLING(ps)) { - 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); - + 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))) diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 84f64a2a66..458eee200a 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -644,8 +644,12 @@ BOOL prs_pointer( const char *name, prs_struct *ps, int depth, return True; if (UNMARSHALLING(ps)) { - if ( !(*data = PRS_ALLOC_MEM(ps, char, data_size)) ) - return False; + if (data_size) { + if ( !(*data = PRS_ALLOC_MEM(ps, char, data_size)) ) + return False; + } else { + *data = NULL; + } } return prs_fn(name, ps, depth, *data); @@ -1016,16 +1020,16 @@ BOOL prs_buffer5(BOOL charmode, const char *name, prs_struct *ps, int depth, BUF if (q == NULL) return False; + /* If the string is empty, we don't have anything to stream */ + if (str->buf_len==0) + return True; + if (UNMARSHALLING(ps)) { str->buffer = PRS_ALLOC_MEM(ps,uint16,str->buf_len); if (str->buffer == NULL) return False; } - /* If the string is empty, we don't have anything to stream */ - if (str->buf_len==0) - return True; - p = (char *)str->buffer; dbg_rw_punival(charmode, name, depth, ps, q, p, str->buf_len); @@ -1055,6 +1059,8 @@ BOOL prs_regval_buffer(BOOL charmode, const char *name, prs_struct *ps, int dept buf->buffer = PRS_ALLOC_MEM(ps, uint16, buf->buf_max_len); if ( buf->buffer == NULL ) return False; + } else { + buf->buffer = NULL; } } @@ -1082,9 +1088,13 @@ BOOL prs_string2(BOOL charmode, const char *name, prs_struct *ps, int depth, STR if (str->str_str_len > str->str_max_len) { return False; } - str->buffer = PRS_ALLOC_MEM(ps,unsigned char, str->str_max_len); - if (str->buffer == NULL) - return False; + if (str->str_max_len) { + str->buffer = PRS_ALLOC_MEM(ps,unsigned char, str->str_max_len); + if (str->buffer == NULL) + return False; + } else { + str->buffer = NULL; + } } if (UNMARSHALLING(ps)) { @@ -1129,9 +1139,13 @@ BOOL prs_unistr2(BOOL charmode, const char *name, prs_struct *ps, int depth, UNI if (str->uni_str_len > str->uni_max_len) { return False; } - str->buffer = PRS_ALLOC_MEM(ps,uint16,str->uni_max_len); - if (str->buffer == NULL) - return False; + if (str->uni_max_len) { + str->buffer = PRS_ALLOC_MEM(ps,uint16,str->uni_max_len); + if (str->buffer == NULL) + return False; + } else { + str->buffer = NULL; + } } p = (char *)str->buffer; @@ -1156,9 +1170,13 @@ BOOL prs_unistr3(BOOL charmode, const char *name, UNISTR3 *str, prs_struct *ps, return False; if (UNMARSHALLING(ps)) { - str->str.buffer = PRS_ALLOC_MEM(ps,uint16,str->uni_str_len); - if (str->str.buffer == NULL) - return False; + if (str->uni_str_len) { + str->str.buffer = PRS_ALLOC_MEM(ps,uint16,str->uni_str_len); + if (str->str.buffer == NULL) + return False; + } else { + str->str.buffer = NULL; + } } p = (char *)str->str.buffer; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 223ce86977..e7726fbb26 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3398,7 +3398,7 @@ BOOL samr_io_r_enum_domains(const char *desc, SAMR_R_ENUM_DOMAINS * r_u, if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3)) return False; - if (UNMARSHALLING(ps)) { + 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); } @@ -3537,7 +3537,7 @@ BOOL samr_io_r_enum_dom_groups(const char *desc, SAMR_R_ENUM_DOM_GROUPS * r_u, if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3)) return False; - if (UNMARSHALLING(ps)) { + 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); } @@ -5067,12 +5067,13 @@ BOOL samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u, return False; } - if (UNMARSHALLING(ps)) + 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; + 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++) { @@ -5096,12 +5097,13 @@ BOOL samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u, return False; } - if (UNMARSHALLING(ps)) + 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; + 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++) { diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 936587fdf5..4cd410d728 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -256,7 +256,7 @@ static BOOL smb_io_notify_option_type_ctr(const char *desc, SPOOL_NOTIFY_OPTION_ return False; /* reading */ - if (UNMARSHALLING(ps)) + if (UNMARSHALLING(ps) && ctr->count) if((ctr->type=PRS_ALLOC_MEM(ps,SPOOL_NOTIFY_OPTION_TYPE,ctr->count)) == NULL) return False; @@ -415,7 +415,7 @@ BOOL smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *da if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length)) return False; - if (UNMARSHALLING(ps)) { + if (UNMARSHALLING(ps) && data->notify_data.data.length) { data->notify_data.data.string = PRS_ALLOC_MEM(ps, uint16, data->notify_data.data.length); @@ -434,7 +434,7 @@ BOOL smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *da case NOTIFY_POINTER: - if (UNMARSHALLING(ps)) { + if (UNMARSHALLING(ps) && data->notify_data.data.length) { data->notify_data.data.string = PRS_ALLOC_MEM(ps, uint16, data->notify_data.data.length); @@ -494,9 +494,13 @@ BOOL smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *da /* Tallocate memory for string */ - data->notify_data.data.string = PRS_ALLOC_MEM(ps, uint16, x * 2); - if (!data->notify_data.data.string) - return False; + if (x) { + data->notify_data.data.string = PRS_ALLOC_MEM(ps, uint16, x * 2); + if (!data->notify_data.data.string) + return False; + } else { + data->notify_data.data.string = NULL; + } if(!prs_uint16uni(True,"string",ps,depth,data->notify_data.data.string,x)) return False; @@ -6001,14 +6005,14 @@ BOOL spoolss_io_q_setprinterdata(const char *desc, SPOOL_Q_SETPRINTERDATA *q_u, case REG_BINARY: case REG_DWORD: case REG_MULTI_SZ: - if (q_u->max_len) { - if (UNMARSHALLING(ps)) - q_u->data=PRS_ALLOC_MEM(ps, uint8, q_u->max_len); - if(q_u->data == NULL) - return False; - if(!prs_uint8s(False,"data", ps, depth, q_u->data, q_u->max_len)) - return False; - } + if (q_u->max_len) { + if (UNMARSHALLING(ps)) + q_u->data=PRS_ALLOC_MEM(ps, uint8, q_u->max_len); + if(q_u->data == NULL) + return False; + if(!prs_uint8s(False,"data", ps, depth, q_u->data, q_u->max_len)) + return False; + } if(!prs_align(ps)) return False; break; @@ -7031,7 +7035,7 @@ static BOOL spoolss_io_printer_enum_values_ctr(const char *desc, prs_struct *ps, /* first loop to write basic enum_value information */ - if (UNMARSHALLING(ps)) { + if (UNMARSHALLING(ps) && ctr->size_of_array) { ctr->values = PRS_ALLOC_MEM(ps, PRINTER_ENUM_VALUES, ctr->size_of_array); if (!ctr->values) return False; -- cgit From 2945490a0fb3dbcd6088a8825a3cd46d9f91ebf7 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 23 May 2007 15:17:49 +0000 Subject: r23091: Add rpccli_netlogon_sam_network_logon_ex, fix its parsing. This does not use the credential chain and only works over netlogon, but it would allow multiple outstanding auth requests for a single workstation account. (This used to be commit 123290d0947191abca4a3b3d81718c823c1bc4a0) --- source3/rpc_parse/parse_misc.c | 3 ++- source3/rpc_parse/parse_net.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 6838547090..586598db89 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1337,7 +1337,8 @@ void init_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid) Inits a DOM_CLNT_SRV structure. ********************************************************************/ -static void init_clnt_srv(DOM_CLNT_SRV *logcln, const char *logon_srv, const char *comp_name) +void init_clnt_srv(DOM_CLNT_SRV *logcln, const char *logon_srv, + const char *comp_name) { DEBUG(5,("init_clnt_srv: %d\n", __LINE__)); diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 6e2b2b26e7..01d77f4e07 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1375,6 +1375,21 @@ void init_sam_info(DOM_SAM_INFO *sam, 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. ********************************************************************/ @@ -1993,6 +2008,9 @@ BOOL net_io_q_sam_logon_ex(const char *desc, NET_Q_SAM_LOGON_EX *q_l, prs_struct 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; -- cgit From 08be930169c77221843cc8cda5b2bcdad91c71fa Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 24 May 2007 20:40:46 +0000 Subject: r23122: Fix bug #4655. We marshall the enumdataex correctly, but W2K3 doesn't follow our rules when sending data to us. Ensure we look for the data at the correct offsets when reading the data. Too late for 3.0.25a - don't merge. Jeremy. (This used to be commit a871191395eef6ed76f9e7666fd1c0fde3105984) --- source3/rpc_parse/parse_spoolss.c | 65 +++++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 4cd410d728..cd8d4174c1 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7022,10 +7022,10 @@ static BOOL spoolss_io_printer_enum_values_ctr(const char *desc, prs_struct *ps, data_offset, current_offset; const uint32 basic_unit = 20; /* size of static portion of enum_values */ - + prs_debug(ps, depth, desc, "spoolss_io_printer_enum_values_ctr"); depth++; - + /* * offset data begins at 20 bytes per structure * size_of_array. * Don't forget the uint32 at the beginning @@ -7042,10 +7042,29 @@ static BOOL spoolss_io_printer_enum_values_ctr(const char *desc, prs_struct *ps, } for (i=0; isize_of_array; i++) { + uint32 base_offset, return_offset; + + base_offset = prs_offset(ps); + valuename_offset = current_offset; if (!prs_uint32("valuename_offset", ps, depth, &valuename_offset)) return False; + /* Read or write the value. */ + + return_offset = prs_offset(ps); + + if (!prs_set_offset(ps, base_offset + valuename_offset)) { + return False; + } + + if (!prs_unistr("valuename", ps, depth, &ctr->values[i].valuename)) + return False; + + /* And go back. */ + if (!prs_set_offset(ps, return_offset)) + return False; + if (!prs_uint32("value_len", ps, depth, &ctr->values[i].value_len)) return False; @@ -7060,21 +7079,14 @@ static BOOL spoolss_io_printer_enum_values_ctr(const char *desc, prs_struct *ps, if (!prs_uint32("data_len", ps, depth, &ctr->values[i].data_len)) return False; - current_offset = data_offset + ctr->values[i].data_len - basic_unit; - /* account for 2 byte alignment */ - current_offset += (current_offset % 2); - } + /* Read or write the data. */ - /* - * loop #2 for writing the dynamically size objects; pay - * attention to 2-byte alignment here.... - */ - - for (i=0; isize_of_array; i++) { - - if (!prs_unistr("valuename", ps, depth, &ctr->values[i].valuename)) + return_offset = prs_offset(ps); + + if (!prs_set_offset(ps, base_offset + data_offset)) { return False; - + } + if ( ctr->values[i].data_len ) { if ( UNMARSHALLING(ps) ) { ctr->values[i].data = PRS_ALLOC_MEM(ps, uint8, ctr->values[i].data_len); @@ -7084,11 +7096,30 @@ static BOOL spoolss_io_printer_enum_values_ctr(const char *desc, prs_struct *ps, if (!prs_uint8s(False, "data", ps, depth, ctr->values[i].data, ctr->values[i].data_len)) return False; } - - if ( !prs_align_uint16(ps) ) + + current_offset = data_offset + ctr->values[i].data_len - basic_unit; + /* account for 2 byte alignment */ + current_offset += (current_offset % 2); + + /* Remember how far we got. */ + data_offset = prs_offset(ps); + + /* And go back. */ + if (!prs_set_offset(ps, return_offset)) return False; + } + /* Go to the last data offset we got to. */ + + if (!prs_set_offset(ps, data_offset)) + return False; + + /* And ensure we're 2 byte aligned. */ + + if ( !prs_align_uint16(ps) ) + return False; + return True; } -- cgit From 94e4a468f02bc243b72c7e1ddd5a15facf661ae5 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 24 May 2007 23:11:11 +0000 Subject: r23127: Fill in some more netlogon dsgetdcname flavours (netr_DsRGetDCNameEx, netr_DsRGetDCNameEx2) and add new ds request and reply flags, also add some more WERROR codes. Guenther (This used to be commit 37ae7f419702c563bcd0d9c27c02bde7efd34dd7) --- source3/rpc_parse/parse_net.c | 209 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 209 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 01d77f4e07..2f215dd938 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -3434,6 +3434,67 @@ void init_net_q_dsr_getdcname(NET_Q_DSR_GETDCNAME *r_t, const char *server_unc, 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. ********************************************************************/ @@ -3505,6 +3566,154 @@ BOOL net_io_q_dsr_getdcname(const char *desc, NET_Q_DSR_GETDCNAME *r_t, 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. ********************************************************************/ -- cgit From d8e454664a97385d798ad53633856044f928a491 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 29 May 2007 15:27:13 +0000 Subject: r23210: Very funny, we thought to use netr_GetDcName (e.g. in winbind) but were using netr_GetDcAnyName all the time (which is the correct thing to do). Fix the naming and opcode mixup in all branches. Guenther (This used to be commit def6464c872a5939f0028837254f2c019d2d71c8) --- source3/rpc_parse/parse_net.c | 62 +++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 2f215dd938..20e4dea23c 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -480,12 +480,12 @@ BOOL net_io_r_logon_ctrl(const char *desc, NET_R_LOGON_CTRL *r_l, prs_struct *ps } /******************************************************************* - Inits an NET_R_GETDCNAME structure. + Inits an NET_R_GETANYDCNAME structure. ********************************************************************/ -void init_net_q_getdcname(NET_Q_GETDCNAME *r_t, const char *logon_server, - const char *domainname) +void init_net_q_getanydcname(NET_Q_GETANYDCNAME *r_t, const char *logon_server, + const char *domainname) { - DEBUG(5,("init_q_getdcname\n")); + 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); @@ -494,16 +494,16 @@ void init_net_q_getdcname(NET_Q_GETDCNAME *r_t, const char *logon_server, } /******************************************************************* - Reads or writes an NET_Q_GETDCNAME structure. + Reads or writes an NET_Q_GETANYDCNAME structure. ********************************************************************/ -BOOL net_io_q_getdcname(const char *desc, NET_Q_GETDCNAME *r_t, prs_struct *ps, - int depth) +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_getdcname"); + prs_debug(ps, depth, desc, "net_io_q_getanydcname"); depth++; if (!prs_uint32("ptr_logon_server", ps, depth, &r_t->ptr_logon_server)) @@ -528,26 +528,26 @@ BOOL net_io_q_getdcname(const char *desc, NET_Q_GETDCNAME *r_t, prs_struct *ps, /******************************************************************* - Inits an NET_R_GETDCNAME structure. + Inits an NET_R_GETANYDCNAME structure. ********************************************************************/ -void init_net_r_getdcname(NET_R_GETDCNAME *r_t, const char *dcname) +void init_net_r_getanydcname(NET_R_GETANYDCNAME *r_t, const char *dcname) { - DEBUG(5,("init_r_getdcname\n")); + DEBUG(5,("init_r_getanydcname\n")); init_unistr2(&r_t->uni_dcname, dcname, UNI_STR_TERMINATE); } /******************************************************************* - Reads or writes an NET_R_GETDCNAME structure. + Reads or writes an NET_R_GETANYDCNAME structure. ********************************************************************/ -BOOL net_io_r_getdcname(const char *desc, NET_R_GETDCNAME *r_t, prs_struct *ps, - int depth) +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_getdcname"); + prs_debug(ps, depth, desc, "net_io_r_getanydcname"); depth++; if (!prs_uint32("ptr_dcname", ps, depth, &r_t->ptr_dcname)) @@ -568,12 +568,12 @@ BOOL net_io_r_getdcname(const char *desc, NET_R_GETDCNAME *r_t, prs_struct *ps, /******************************************************************* - Inits an NET_R_GETANYDCNAME structure. + Inits an NET_R_GETDCNAME structure. ********************************************************************/ -void init_net_q_getanydcname(NET_Q_GETANYDCNAME *r_t, const char *logon_server, - const char *domainname) +void init_net_q_getdcname(NET_Q_GETDCNAME *r_t, const char *logon_server, + const char *domainname) { - DEBUG(5,("init_q_getanydcname\n")); + DEBUG(5,("init_q_getdcname\n")); init_unistr2(&r_t->uni_logon_server, logon_server, UNI_STR_TERMINATE); r_t->ptr_domainname = (domainname != NULL); @@ -581,16 +581,16 @@ void init_net_q_getanydcname(NET_Q_GETANYDCNAME *r_t, const char *logon_server, } /******************************************************************* - Reads or writes an NET_Q_GETANYDCNAME structure. + Reads or writes an NET_Q_GETDCNAME structure. ********************************************************************/ -BOOL net_io_q_getanydcname(const char *desc, NET_Q_GETANYDCNAME *r_t, prs_struct *ps, - int depth) +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_getanydcname"); + prs_debug(ps, depth, desc, "net_io_q_getdcname"); depth++; if (!smb_io_unistr2("logon_server", &r_t->uni_logon_server, @@ -612,26 +612,26 @@ BOOL net_io_q_getanydcname(const char *desc, NET_Q_GETANYDCNAME *r_t, prs_struct /******************************************************************* - Inits an NET_R_GETANYDCNAME structure. + Inits an NET_R_GETDCNAME structure. ********************************************************************/ -void init_net_r_getanydcname(NET_R_GETANYDCNAME *r_t, const char *dcname) +void init_net_r_getdcname(NET_R_GETDCNAME *r_t, const char *dcname) { - DEBUG(5,("init_r_getanydcname\n")); + DEBUG(5,("init_r_getdcname\n")); init_unistr2(&r_t->uni_dcname, dcname, UNI_STR_TERMINATE); } /******************************************************************* - Reads or writes an NET_R_GETANYDCNAME structure. + Reads or writes an NET_R_GETDCNAME structure. ********************************************************************/ -BOOL net_io_r_getanydcname(const char *desc, NET_R_GETANYDCNAME *r_t, prs_struct *ps, - int depth) +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_getanydcname"); + prs_debug(ps, depth, desc, "net_io_r_getdcname"); depth++; if (!prs_uint32("ptr_dcname", ps, depth, &r_t->ptr_dcname)) @@ -644,7 +644,7 @@ BOOL net_io_r_getanydcname(const char *desc, NET_R_GETANYDCNAME *r_t, prs_struct if (!prs_align(ps)) return False; - if (!prs_werror("status", ps, depth, &r_t->status)) + if (!prs_ntstatus("status", ps, depth, &r_t->status)) return False; return True; -- cgit From d99f4f004ca46e4c0f2e60a231a14708a128f0f2 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 31 May 2007 17:24:30 +0000 Subject: r23271: merge service control pidl change for CloseServiceHandle() from SAMBA_3_0_26 (This used to be commit 0b1bc3521fac52f3164b6cc9e053abc3ceabf5e7) --- source3/rpc_parse/parse_svcctl.c | 47 ---------------------------------------- 1 file changed, 47 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index 3846812f31..8302218e34 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -196,53 +196,6 @@ uint32 svcctl_sizeof_service_config( SERVICE_CONFIG *config ) return size; } - - -/******************************************************************* -********************************************************************/ - -BOOL svcctl_io_q_close_service(const char *desc, SVCCTL_Q_CLOSE_SERVICE *q_u, prs_struct *ps, int depth) -{ - - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "svcctl_io_q_close_service"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("scm_pol", &q_u->handle, ps, depth)) - return False; - - return True; -} - - -/******************************************************************* -********************************************************************/ - -BOOL svcctl_io_r_close_service(const char *desc, SVCCTL_R_CLOSE_SERVICE *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "svcctl_io_r_close_service"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol_handle", &r_u->handle, ps, depth)) - return False; - - if(!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - /******************************************************************* ********************************************************************/ -- cgit From 97a164ba96d48a81d5e24dda6b866a4d78ea1a78 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 31 May 2007 17:59:04 +0000 Subject: r23274: merge CloseEventlog() pidl conversion from 3.0.26 && fix a few init call renames for svcctl in the previous commit (This used to be commit ebcae48ec10fefa74efcc3563cff50e3b9c2388c) --- source3/rpc_parse/parse_eventlog.c | 39 -------------------------------------- 1 file changed, 39 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 436f35aff6..2c2ce12acb 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -174,45 +174,6 @@ BOOL eventlog_io_r_get_oldest_entry(const char *desc, EVENTLOG_R_GET_OLDEST_ENTR return True; } -BOOL eventlog_io_q_close_eventlog(const char *desc, EVENTLOG_Q_CLOSE_EVENTLOG *q_u, - prs_struct *ps, int depth) -{ - if(q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "eventlog_io_q_close_eventlog"); - 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_close_eventlog(const char *desc, EVENTLOG_R_CLOSE_EVENTLOG *r_u, - prs_struct *ps, int depth) -{ - if(r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "eventlog_io_r_close_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_read_eventlog(const char *desc, EVENTLOG_Q_READ_EVENTLOG *q_u, prs_struct *ps, int depth) { -- cgit From 227ba79af9a65f21c7254c51196fe21e029931b4 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 4 Jun 2007 19:29:40 +0000 Subject: r23342: Stop Coverity from getting confused. Jeremy. (This used to be commit 34144c63ad0d776c0b01f6bd3ce378921f2d31cd) --- source3/rpc_parse/parse_prs.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 458eee200a..e21f517974 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1094,6 +1094,9 @@ BOOL prs_string2(BOOL charmode, const char *name, prs_struct *ps, int depth, STR return False; } else { str->buffer = NULL; + /* Return early to ensure Coverity isn't confused. */ + DEBUG(5,("%s%04x %s: \n", tab_depth(depth), ps->data_offset, name)); + return True; } } -- cgit From 1ea5dfae043da76183191c10bcadbd77e14d1fff Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 8 Jun 2007 10:29:46 +0000 Subject: r23380: netr_getdcname returns WERROR not NTSTATUS. Guenther (This used to be commit 5e75ea7f2b568d76c8ced5f43171741532cc97c2) --- source3/rpc_parse/parse_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 20e4dea23c..15bf2b3283 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -644,7 +644,7 @@ BOOL net_io_r_getdcname(const char *desc, NET_R_GETDCNAME *r_t, prs_struct *ps, if (!prs_align(ps)) return False; - if (!prs_ntstatus("status", ps, depth, &r_t->status)) + if (!prs_werror("status", ps, depth, &r_t->status)) return False; return True; -- cgit From 2e6deee0208aba89fb3ecc7ead62d867e4da20ea Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 9 Jun 2007 00:13:07 +0000 Subject: r23400: Fix lsa crash bug #4683. The "names" enum struct in a lookup_sidX reply isn't optional - like the lookup_sidX query it needs to be defined in the struct. All this will go away with PIDL (thank goodness....). Jerry - I think this is a showstopper to be merged for 3.0.25b. I'll be watching the build farm to see if anything broke. Jeremy. (This used to be commit 9300b92f7a51eb80fdc039d8dad23ea9ce82aa8f) --- source3/rpc_parse/parse_lsa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 0add8b2bb0..0c07e7fe22 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1476,7 +1476,7 @@ BOOL lsa_io_r_lookup_sids(const char *desc, LSA_R_LOOKUP_SIDS *r_s, 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 */ + if(!lsa_io_trans_names("names ", &r_s->names, ps, depth)) /* translated names */ return False; if(!prs_align(ps)) @@ -1511,7 +1511,7 @@ BOOL lsa_io_r_lookup_sids2(const char *desc, LSA_R_LOOKUP_SIDS2 *r_s, 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 */ + if(!lsa_io_trans_names2("names ", &r_s->names, ps, depth)) /* translated names */ return False; if(!prs_align(ps)) @@ -1547,7 +1547,7 @@ BOOL lsa_io_r_lookup_sids3(const char *desc, LSA_R_LOOKUP_SIDS3 *r_s, 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 */ + if(!lsa_io_trans_names2("names ", &r_s->names, ps, depth)) /* translated names */ return False; if(!prs_align(ps)) -- cgit From b1ce226af8b61ad7e3c37860a59c6715012e738b Mon Sep 17 00:00:00 2001 From: James Peach Date: Fri, 15 Jun 2007 21:58:49 +0000 Subject: r23510: Tidy calls to smb_panic by removing trailing newlines. Print the failed expression in SMB_ASSERT. (This used to be commit 171dc060e2a576d724eed1ca65636bdafffd7713) --- source3/rpc_parse/parse_misc.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 586598db89..848fdae5e0 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -66,7 +66,7 @@ TALLOC_CTX *main_loop_talloc_get(void) if (!main_loop_talloc) { main_loop_talloc = talloc_init("main loop talloc (mainly parse_misc)"); if (!main_loop_talloc) - smb_panic("main_loop_talloc: malloc fail\n"); + smb_panic("main_loop_talloc: malloc fail"); } return main_loop_talloc; @@ -452,7 +452,7 @@ void init_unistr(UNISTR *str, const char *buf) if (len) { str->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, len); if (str->buffer == NULL) - smb_panic("init_unistr: malloc fail\n"); + smb_panic("init_unistr: malloc fail"); rpcstr_push(str->buffer, buf, len*sizeof(uint16), STR_TERMINATE); } else { @@ -488,7 +488,7 @@ static void create_rpc_blob(RPC_DATA_BLOB *str, size_t len) if (len) { str->buffer = (uint8 *)TALLOC_ZERO(get_talloc_ctx(), len); if (str->buffer == NULL) - smb_panic("create_rpc_blob: talloc fail\n"); + smb_panic("create_rpc_blob: talloc fail"); str->buf_len = len; } else { str->buffer = NULL; @@ -595,7 +595,7 @@ void init_regval_buffer(REGVAL_BUFFER *str, const uint8 *buf, size_t len) str->buffer = (uint16 *)TALLOC_ZERO(get_talloc_ctx(), str->buf_max_len); if (str->buffer == NULL) - smb_panic("init_regval_buffer: talloc fail\n"); + smb_panic("init_regval_buffer: talloc fail"); memcpy(str->buffer, buf, str->buf_len); } } @@ -671,7 +671,7 @@ void copy_unistr2(UNISTR2 *str, const UNISTR2 *from) if (str->uni_max_len) { str->buffer = (uint16 *)TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, str->uni_max_len); if ((str->buffer == NULL)) { - smb_panic("copy_unistr2: talloc fail\n"); + smb_panic("copy_unistr2: talloc fail"); return; } /* copy the string */ @@ -705,7 +705,7 @@ void init_string2(STRING2 *str, const char *buf, size_t max_len, size_t str_len) str->buffer = (uint8 *)TALLOC_ZERO(get_talloc_ctx(), str->str_max_len); if (str->buffer == NULL) - smb_panic("init_string2: malloc fail\n"); + smb_panic("init_string2: malloc fail"); memcpy(str->buffer, buf, str_len); } } @@ -781,7 +781,7 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) str->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, len); if (str->buffer == NULL) { - smb_panic("init_unistr2: malloc fail\n"); + smb_panic("init_unistr2: malloc fail"); return; } @@ -817,7 +817,7 @@ void init_unistr4(UNISTR4 *uni4, const char *buf, enum unistr2_term_codes flags) { uni4->string = TALLOC_P( get_talloc_ctx(), UNISTR2 ); if (!uni4->string) { - smb_panic("init_unistr4: talloc fail\n"); + smb_panic("init_unistr4: talloc fail"); return; } init_unistr2( uni4->string, buf, flags ); @@ -830,7 +830,7 @@ void init_unistr4_w( TALLOC_CTX *ctx, UNISTR4 *uni4, const smb_ucs2_t *buf ) { uni4->string = TALLOC_P( ctx, UNISTR2 ); if (!uni4->string) { - smb_panic("init_unistr4_w: talloc fail\n"); + smb_panic("init_unistr4_w: talloc fail"); return; } init_unistr2_w( ctx, uni4->string, buf ); @@ -860,7 +860,7 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) if (len + 1) { str->buffer = TALLOC_ZERO_ARRAY(ctx, uint16, len + 1); if (str->buffer == NULL) { - smb_panic("init_unistr2_w: talloc fail\n"); + smb_panic("init_unistr2_w: talloc fail"); return; } } else { @@ -916,7 +916,7 @@ void init_unistr2_from_unistr(UNISTR2 *to, const UNISTR *from) if (i) { to->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, i); if (to->buffer == NULL) - smb_panic("init_unistr2_from_unistr: malloc fail\n"); + smb_panic("init_unistr2_from_unistr: malloc fail"); memcpy(to->buffer, from->buffer, i*sizeof(uint16)); } else { to->buffer = NULL; @@ -945,7 +945,7 @@ void init_unistr2_from_datablob(UNISTR2 *str, DATA_BLOB *blob) str->buffer = NULL; } if ((str->buffer == NULL) && (blob->length > 0)) { - smb_panic("init_unistr2_from_datablob: malloc fail\n"); + smb_panic("init_unistr2_from_datablob: malloc fail"); } } @@ -1710,7 +1710,7 @@ void init_unistr3(UNISTR3 *str, const char *buf) if (str->uni_str_len) { str->str.buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, str->uni_str_len); if (str->str.buffer == NULL) - smb_panic("init_unistr3: malloc fail\n"); + smb_panic("init_unistr3: malloc fail"); rpcstr_push((char *)str->str.buffer, buf, str->uni_str_len * sizeof(uint16), STR_TERMINATE); } else { -- cgit From 9c3db7adf3efb7e485ac0a7301f31a1ab6338435 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Tue, 26 Jun 2007 20:09:41 +0000 Subject: r23616: Fix bugzilla #4719: must change password is not set from usrmgr.exe. This was only affecting the newer versions of usrmgr.exe, because they use a user_info_25 struct. The password is getting set separately inside that code, so the password last set time was getting set from the password change logic. We also were not parsing a number of fields (like logon hours) from the user_info_25. That should also be fixed. (This used to be commit afabd68b6ae874aceba708dc36808ed007ad496c) --- source3/rpc_parse/parse_samr.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index e7726fbb26..1a4048e54b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6134,9 +6134,26 @@ static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_str if(!prs_uint32("fields_present ", ps, depth, &usr->fields_present)) return False; - if(!prs_uint32s(False, "unknown_5 ", ps, depth, usr->unknown_5, 5)) + 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; @@ -6172,13 +6189,11 @@ static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_str if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial, usr->hdr_munged_dial.buffer, ps, depth)) return False; -#if 0 /* JRA - unknown... */ /* 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; } -#endif return True; } -- cgit From 7eb828135bd7407851a10c32d57c404ecb030140 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 27 Jun 2007 11:42:17 +0000 Subject: r23627: Allow to pass down the lookup-level to rpccli_lsa_lookup_names(). Guenther (This used to be commit e9a7512a9f630340004913f1379452eea8a9b6ae) --- source3/rpc_parse/parse_lsa.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 0c07e7fe22..09f0f835ec 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1567,7 +1567,8 @@ 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) + POLICY_HND *hnd, int num_names, const char **names, + int level) { unsigned int i; @@ -1578,7 +1579,7 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, q_l->pol = *hnd; q_l->num_entries = num_names; q_l->num_entries2 = num_names; - q_l->lookup_level = 1; + q_l->lookup_level = level; if (num_names) { if ((q_l->uni_name = TALLOC_ZERO_ARRAY(mem_ctx, UNISTR2, num_names)) == NULL) { -- cgit From 4ed5f70eeda59d07e5d10d4cf302359d7a518987 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 30 Jun 2007 09:15:33 +0000 Subject: r23665: Remove two unneeded global variables (This used to be commit 51a3933b3d367e3693daa6842f5a286328f4fd39) --- source3/rpc_parse/parse_lsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 09f0f835ec..afa138ca1e 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -3216,7 +3216,7 @@ void init_q_enum_acct_rights(LSA_Q_ENUM_ACCT_RIGHTS *in, NTSTATUS init_r_enum_acct_rights( LSA_R_ENUM_ACCT_RIGHTS *out, PRIVILEGE_SET *privileges ) { uint32 i; - char *privname; + const char *privname; const char **privname_array = NULL; int num_priv = 0; -- cgit From d824b98f80ba186030cbb70b3a1e5daf80469ecd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Jul 2007 19:25:36 +0000 Subject: r23779: Change from v2 or later to v3 or later. Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3) --- source3/rpc_parse/parse_buffer.c | 2 +- source3/rpc_parse/parse_ds.c | 2 +- source3/rpc_parse/parse_eventlog.c | 2 +- source3/rpc_parse/parse_lsa.c | 2 +- source3/rpc_parse/parse_misc.c | 2 +- source3/rpc_parse/parse_net.c | 2 +- source3/rpc_parse/parse_ntsvcs.c | 2 +- source3/rpc_parse/parse_prs.c | 2 +- source3/rpc_parse/parse_rpc.c | 2 +- source3/rpc_parse/parse_samr.c | 2 +- source3/rpc_parse/parse_sec.c | 2 +- source3/rpc_parse/parse_spoolss.c | 2 +- source3/rpc_parse/parse_svcctl.c | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index b66eb9910a..52320e6d28 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -10,7 +10,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * 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, diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index 61300f8a8d..7b605b3741 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -6,7 +6,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * 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, diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 2c2ce12acb..bb5eb829eb 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -5,7 +5,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * 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, diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index afa138ca1e..eeece440b0 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -10,7 +10,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * 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, diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 848fdae5e0..49a53f0c40 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -8,7 +8,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * 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, diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 15bf2b3283..ec994f855f 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -8,7 +8,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * 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, diff --git a/source3/rpc_parse/parse_ntsvcs.c b/source3/rpc_parse/parse_ntsvcs.c index 559a9d5ab5..212a123bb0 100644 --- a/source3/rpc_parse/parse_ntsvcs.c +++ b/source3/rpc_parse/parse_ntsvcs.c @@ -5,7 +5,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * 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, diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index e21f517974..e0cae353eb 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + 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, diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 39156d5ef8..6fd3ef764d 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -8,7 +8,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * 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, diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 1a4048e54b..2133d2124d 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -11,7 +11,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * 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, diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 72accad1b6..7a6787867e 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -9,7 +9,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * 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, diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index cd8d4174c1..a2291e020b 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -9,7 +9,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * 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, diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index 8302218e34..99f231adae 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -5,7 +5,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * 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, -- cgit From 5e54558c6dea67b56bbfaba5698f3a434d3dffb6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 00:52:41 +0000 Subject: r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text (This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07) --- source3/rpc_parse/parse_prs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index e0cae353eb..26bd3a5cec 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -17,8 +17,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From 153cfb9c83534b09f15cc16205d7adb19b394928 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 05:23:25 +0000 Subject: r23801: The FSF has moved around a lot. This fixes their Mass Ave address. (This used to be commit 87c91e4362c51819032bfbebbb273c52e203b227) --- source3/rpc_parse/parse_buffer.c | 3 +-- source3/rpc_parse/parse_ds.c | 3 +-- source3/rpc_parse/parse_eventlog.c | 3 +-- source3/rpc_parse/parse_lsa.c | 3 +-- source3/rpc_parse/parse_misc.c | 3 +-- source3/rpc_parse/parse_net.c | 3 +-- source3/rpc_parse/parse_ntsvcs.c | 3 +-- source3/rpc_parse/parse_rpc.c | 3 +-- source3/rpc_parse/parse_samr.c | 3 +-- source3/rpc_parse/parse_sec.c | 3 +-- source3/rpc_parse/parse_spoolss.c | 3 +-- source3/rpc_parse/parse_svcctl.c | 3 +-- 12 files changed, 12 insertions(+), 24 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index 52320e6d28..b716d0cd47 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, see . */ #include "includes.h" diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index 7b605b3741..58cc136d28 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -15,8 +15,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, see . */ #include "includes.h" diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index bb5eb829eb..e92e5e24c6 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -14,8 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, see . */ #include "includes.h" diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index eeece440b0..c6727d83b5 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -19,8 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, see . */ #include "includes.h" diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 49a53f0c40..15a71a11be 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -17,8 +17,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, see . */ #include "includes.h" diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index ec994f855f..a94b20210f 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -17,8 +17,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, see . */ #include "includes.h" diff --git a/source3/rpc_parse/parse_ntsvcs.c b/source3/rpc_parse/parse_ntsvcs.c index 212a123bb0..93061deb35 100644 --- a/source3/rpc_parse/parse_ntsvcs.c +++ b/source3/rpc_parse/parse_ntsvcs.c @@ -14,8 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, see . */ #include "includes.h" diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 6fd3ef764d..6b2a9f4d38 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -17,8 +17,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, see . */ #include "includes.h" diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 2133d2124d..48844c2f53 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -20,8 +20,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, see . */ #include "includes.h" diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 7a6787867e..d9c12bf3da 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -18,8 +18,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, see . */ #include "includes.h" diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index a2291e020b..99470c476c 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -18,8 +18,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, see . */ #include "includes.h" diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index 99f231adae..b366b14e7f 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -14,8 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, see . */ #include "includes.h" -- cgit From 84058d493355927cd884d1a8848a4497a473db2a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 28 Jul 2007 18:52:28 +0000 Subject: r24067: Fix a type mismatch found by the IBM checker (This used to be commit 411a1a2037886f934c6522ddef7a04d5c4a1fa69) --- source3/rpc_parse/parse_sec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index d9c12bf3da..378d1920a4 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -262,7 +262,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) return False; if (UNMARSHALLING(ps)) { - psd->revision = (enum security_acl_revision)revision; + psd->revision = (enum security_descriptor_revision)revision; } if(!prs_uint16("type ", ps, depth, &psd->type)) -- cgit From b87c0dde7123b7598b49a236a76641846b885bf5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 9 Aug 2007 20:54:58 +0000 Subject: r24291: Fix Coverity ID 364 We've checked num_rids != 0 above. (This used to be commit dab5449f385248ab1fdd60b240ef6ad4a27ba7f2) --- source3/rpc_parse/parse_samr.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 48844c2f53..90f1a2243b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4993,18 +4993,10 @@ NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, r_u->ptr_rids = 1; r_u->num_rids2 = num_rids; - if (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; - } else { - r_u->rids = NULL; - r_u->types = NULL; - } - - if (!r_u->rids || !r_u->types) - goto empty; + 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]; @@ -5012,7 +5004,6 @@ NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, } } else { - empty: r_u->num_types1 = 0; r_u->ptr_types = 0; r_u->num_types2 = 0; -- cgit From c638a84cb1215f9d67531c72959baf10deea2700 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Tue, 14 Aug 2007 14:27:42 +0000 Subject: r24410: - I got tricked by function naming. Contrary to what seemed obvious to me, prs_mem_free() is not the function to be called to free memory allocated by prs_alloc_mem(). I've added a comment so others may not get bitten too. - Remove incorrect memory free calls added yesterday to replace SAFE_FREE. The memory is actually now on a talloc context, so gets freed by the caller when that context is freed. We don't need to free it iternally. Derrell (This used to be commit 2fde343150c17959fc970b18e1eb4efde800b4db) --- source3/rpc_parse/parse_prs.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 26bd3a5cec..c51e1dff4a 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -122,6 +122,10 @@ BOOL prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, BOOL io) /******************************************************************* Delete the memory in a parse structure - if we own it. + + NOTE: Contrary to the somewhat confusing naming, this function is not + intended for freeing memory allocated by prs_alloc_mem(). That memory + is attached to the talloc context given by ps->mem_ctx. ********************************************************************/ void prs_mem_free(prs_struct *ps) -- cgit From 7b24eb65a0c4189796fc74319a400c6bfb85fdb7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 29 Aug 2007 01:23:31 +0000 Subject: r24759: Comment out the _nonnull calls for 3.2.x, as agreed with tridge. Leaving the commented out code for now, in case I need to re-test some stuff. Jeremy (This used to be commit 343be0464342aac14a9592fd73a71b7589ba34d5) --- source3/rpc_parse/parse_prs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index c51e1dff4a..3c1b200ebc 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -161,7 +161,7 @@ char *prs_alloc_mem(prs_struct *ps, size_t size, unsigned int count) if (size && count) { /* We can't call the type-safe version here. */ - ret = (char *)_talloc_zero_array_zeronull(ps->mem_ctx, size, count, + ret = (char *)_talloc_zero_array(ps->mem_ctx, size, count, "parse_prs"); } return ret; -- cgit From a0a32cf5d520937f492d32c743011741522f2d40 Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Wed, 29 Aug 2007 11:02:04 +0000 Subject: r24771: Use infolevel 25 to set the machine account's password (just like winxp). This correctly updates pwdLastSet field on win2k3 server. rafal (This used to be commit dd6d44c1665121cff9ccc2c09580169ca4d330b9) --- source3/rpc_parse/parse_samr.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 90f1a2243b..ddbe0a6255 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5930,6 +5930,25 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z } } + +/************************************************************************* + 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. ********************************************************************/ -- cgit From 929e1d99209e20a9c2c95c8bdfc8eaa37b2c2291 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 30 Aug 2007 19:48:31 +0000 Subject: r24809: Consolidate the use of temporary talloc contexts. This adds the two functions talloc_stackframe() and talloc_tos(). * When a new talloc stackframe is allocated with talloc_stackframe(), then * the TALLOC_CTX returned with talloc_tos() is reset to that new * frame. Whenever that stack frame is TALLOC_FREE()'ed, then the reverse * happens: The previous talloc_tos() is restored. * * This API is designed to be robust in the sense that if someone forgets to * TALLOC_FREE() a stackframe, then the next outer one correctly cleans up and * resets the talloc_tos(). The original motivation for this patch was to get rid of the sid_string_static & friends buffers. Explicitly passing talloc context everywhere clutters code too much for my taste, so an implicit talloc_tos() is introduced here. Many of these static buffers are replaced by a single static pointer. The intended use would thus be that low-level functions can rather freely push stuff to talloc_tos, the upper layers clean up by freeing the stackframe. The more of these stackframes are used and correctly freed the more exact the memory cleanup happens. This patch removes the main_loop_talloc_ctx, tmp_talloc_ctx and lp_talloc_ctx (did I forget any?) So, never do a tmp_ctx = talloc_init("foo"); anymore, instead, use tmp_ctx = talloc_stackframe() :-) Volker (This used to be commit 6585ea2cb7f417e14540495b9c7380fe9c8c717b) --- source3/rpc_parse/parse_lsa.c | 8 ++-- source3/rpc_parse/parse_misc.c | 84 +++++---------------------------------- source3/rpc_parse/parse_ntsvcs.c | 4 +- source3/rpc_parse/parse_spoolss.c | 10 ++--- source3/rpc_parse/parse_svcctl.c | 2 +- 5 files changed, 23 insertions(+), 85 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index c6727d83b5..625ef5fb41 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -3222,13 +3222,13 @@ NTSTATUS init_r_enum_acct_rights( LSA_R_ENUM_ACCT_RIGHTS *out, PRIVILEGE_SET *pr for ( i=0; icount; i++ ) { privname = luid_to_privilege_name( &privileges->set[i].luid ); if ( privname ) { - if ( !add_string_to_array( get_talloc_ctx(), privname, &privname_array, &num_priv ) ) + if ( !add_string_to_array( talloc_tos(), privname, &privname_array, &num_priv ) ) return NT_STATUS_NO_MEMORY; } } if ( num_priv ) { - out->rights = TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY ); + out->rights = TALLOC_P( talloc_tos(), UNISTR4_ARRAY ); if (!out->rights) { return NT_STATUS_NO_MEMORY; } @@ -3299,7 +3299,7 @@ void init_q_add_acct_rights( LSA_Q_ADD_ACCT_RIGHTS *in, POLICY_HND *hnd, in->pol = *hnd; init_dom_sid2(&in->sid, sid); - in->rights = TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY ); + in->rights = TALLOC_P( talloc_tos(), UNISTR4_ARRAY ); if (!in->rights) { smb_panic("init_q_add_acct_rights: talloc fail\n"); return; @@ -3367,7 +3367,7 @@ void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *in, in->removeall = removeall; in->count = count; - in->rights = TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY ); + in->rights = TALLOC_P( talloc_tos(), UNISTR4_ARRAY ); if (!in->rights) { smb_panic("init_q_remove_acct_rights: talloc fail\n"); return; diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 15a71a11be..54d8ae4785 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -25,68 +25,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/**************************************************************************** - A temporary TALLOC context for things like unistrs, that is valid for - the life of a complete RPC call. -****************************************************************************/ - -static TALLOC_CTX *current_rpc_talloc = NULL; - -static TALLOC_CTX *get_current_rpc_talloc(void) -{ - return current_rpc_talloc; -} - -void set_current_rpc_talloc( TALLOC_CTX *ctx) -{ - current_rpc_talloc = ctx; -} - -static TALLOC_CTX *main_loop_talloc = NULL; - -/******************************************************************* -free up temporary memory - called from the main loop -********************************************************************/ - -void main_loop_TALLOC_FREE(void) -{ - if (!main_loop_talloc) - return; - talloc_destroy(main_loop_talloc); - main_loop_talloc = NULL; -} - -/******************************************************************* - Get a talloc context that is freed in the main loop... -********************************************************************/ - -TALLOC_CTX *main_loop_talloc_get(void) -{ - if (!main_loop_talloc) { - main_loop_talloc = talloc_init("main loop talloc (mainly parse_misc)"); - if (!main_loop_talloc) - smb_panic("main_loop_talloc: malloc fail"); - } - - return main_loop_talloc; -} - -/******************************************************************* - Try and get a talloc context. Get the rpc one if possible, else - get the main loop one. The main loop one is more dangerous as it - goes away between packets, the rpc one will stay around for as long - as a current RPC lasts. -********************************************************************/ - -TALLOC_CTX *get_talloc_ctx(void) -{ - TALLOC_CTX *tc = get_current_rpc_talloc(); - - if (tc) - return tc; - return main_loop_talloc_get(); -} - /******************************************************************* Reads or writes a UTIME type. ********************************************************************/ @@ -449,7 +387,7 @@ void init_unistr(UNISTR *str, const char *buf) len = strlen(buf) + 1; if (len) { - str->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, len); + str->buffer = TALLOC_ZERO_ARRAY(talloc_tos(), uint16, len); if (str->buffer == NULL) smb_panic("init_unistr: malloc fail"); @@ -485,7 +423,7 @@ BOOL smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth) static void create_rpc_blob(RPC_DATA_BLOB *str, size_t len) { if (len) { - str->buffer = (uint8 *)TALLOC_ZERO(get_talloc_ctx(), len); + str->buffer = (uint8 *)TALLOC_ZERO(talloc_tos(), len); if (str->buffer == NULL) smb_panic("create_rpc_blob: talloc fail"); str->buf_len = len; @@ -591,7 +529,7 @@ void init_regval_buffer(REGVAL_BUFFER *str, const uint8 *buf, size_t len) if (buf != NULL) { SMB_ASSERT(str->buf_max_len >= str->buf_len); - str->buffer = (uint16 *)TALLOC_ZERO(get_talloc_ctx(), + str->buffer = (uint16 *)TALLOC_ZERO(talloc_tos(), str->buf_max_len); if (str->buffer == NULL) smb_panic("init_regval_buffer: talloc fail"); @@ -668,7 +606,7 @@ void copy_unistr2(UNISTR2 *str, const UNISTR2 *from) reallocation of memory. */ if (str->buffer == NULL) { if (str->uni_max_len) { - str->buffer = (uint16 *)TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, str->uni_max_len); + str->buffer = (uint16 *)TALLOC_ZERO_ARRAY(talloc_tos(), uint16, str->uni_max_len); if ((str->buffer == NULL)) { smb_panic("copy_unistr2: talloc fail"); return; @@ -701,7 +639,7 @@ void init_string2(STRING2 *str, const char *buf, size_t max_len, size_t str_len) /* store the string */ if(str_len != 0) { - str->buffer = (uint8 *)TALLOC_ZERO(get_talloc_ctx(), + str->buffer = (uint8 *)TALLOC_ZERO(talloc_tos(), str->str_max_len); if (str->buffer == NULL) smb_panic("init_string2: malloc fail"); @@ -778,7 +716,7 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) } - str->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, len); + str->buffer = TALLOC_ZERO_ARRAY(talloc_tos(), uint16, len); if (str->buffer == NULL) { smb_panic("init_unistr2: malloc fail"); return; @@ -814,7 +752,7 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags) void init_unistr4(UNISTR4 *uni4, const char *buf, enum unistr2_term_codes flags) { - uni4->string = TALLOC_P( get_talloc_ctx(), UNISTR2 ); + uni4->string = TALLOC_P( talloc_tos(), UNISTR2 ); if (!uni4->string) { smb_panic("init_unistr4: talloc fail"); return; @@ -913,7 +851,7 @@ void init_unistr2_from_unistr(UNISTR2 *to, const UNISTR *from) /* allocate the space and copy the string buffer */ if (i) { - to->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, i); + to->buffer = TALLOC_ZERO_ARRAY(talloc_tos(), uint16, i); if (to->buffer == NULL) smb_panic("init_unistr2_from_unistr: malloc fail"); memcpy(to->buffer, from->buffer, i*sizeof(uint16)); @@ -1117,7 +1055,7 @@ BOOL prs_unistr4_array(const char *desc, prs_struct *ps, int depth, UNISTR4_ARRA if (UNMARSHALLING(ps)) { if (array->count) { - if ( !(array->strings = TALLOC_ZERO_ARRAY( get_talloc_ctx(), UNISTR4, array->count)) ) + if ( !(array->strings = TALLOC_ZERO_ARRAY( talloc_tos(), UNISTR4, array->count)) ) return False; } else { array->strings = NULL; @@ -1152,7 +1090,7 @@ BOOL init_unistr4_array( UNISTR4_ARRAY *array, uint32 count, const char **string /* allocate memory for the array of UNISTR4 objects */ if (array->count) { - if ( !(array->strings = TALLOC_ZERO_ARRAY(get_talloc_ctx(), UNISTR4, count )) ) + if ( !(array->strings = TALLOC_ZERO_ARRAY(talloc_tos(), UNISTR4, count )) ) return False; } else { array->strings = NULL; @@ -1707,7 +1645,7 @@ void init_unistr3(UNISTR3 *str, const char *buf) str->uni_str_len = strlen(buf) + 1; if (str->uni_str_len) { - str->str.buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, str->uni_str_len); + str->str.buffer = TALLOC_ZERO_ARRAY(talloc_tos(), uint16, str->uni_str_len); if (str->str.buffer == NULL) smb_panic("init_unistr3: malloc fail"); diff --git a/source3/rpc_parse/parse_ntsvcs.c b/source3/rpc_parse/parse_ntsvcs.c index 93061deb35..bcf3f55bd0 100644 --- a/source3/rpc_parse/parse_ntsvcs.c +++ b/source3/rpc_parse/parse_ntsvcs.c @@ -299,7 +299,7 @@ BOOL ntsvcs_io_q_get_hw_profile_info(const char *desc, NTSVCS_Q_GET_HW_PROFILE_I q_u->buffer_size = 0x000000a8; if ( UNMARSHALLING(ps) ) { - q_u->buffer = TALLOC_ARRAY(get_talloc_ctx(), uint8, q_u->buffer_size ); + q_u->buffer = TALLOC_ARRAY(talloc_tos(), uint8, q_u->buffer_size ); if (!q_u->buffer) { return False; } @@ -334,7 +334,7 @@ BOOL ntsvcs_io_r_get_hw_profile_info(const char *desc, NTSVCS_R_GET_HW_PROFILE_I if ( UNMARSHALLING(ps) ) { if (r_u->buffer_size) { - r_u->buffer = TALLOC_ARRAY(get_talloc_ctx(), uint8, r_u->buffer_size ); + r_u->buffer = TALLOC_ARRAY(talloc_tos(), uint8, r_u->buffer_size ); if (!r_u->buffer) { return False; } diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 99470c476c..a0d818bd67 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -905,7 +905,7 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, { DEBUG(5,("make_spoolss_q_open_printer_ex\n")); - q_u->printername = TALLOC_P( get_talloc_ctx(), UNISTR2 ); + q_u->printername = TALLOC_P( talloc_tos(), UNISTR2 ); if (!q_u->printername) { return False; } @@ -921,7 +921,7 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, q_u->user_switch = 1; q_u->user_ctr.level = 1; - q_u->user_ctr.user.user1 = TALLOC_P( get_talloc_ctx(), SPOOL_USER_1 ); + q_u->user_ctr.user.user1 = TALLOC_P( talloc_tos(), SPOOL_USER_1 ); if (!q_u->user_ctr.user.user1) { return False; } @@ -931,11 +931,11 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, q_u->user_ctr.user.user1->minor = 0; q_u->user_ctr.user.user1->processor = 0; - q_u->user_ctr.user.user1->client_name = TALLOC_P( get_talloc_ctx(), UNISTR2 ); + q_u->user_ctr.user.user1->client_name = TALLOC_P( talloc_tos(), UNISTR2 ); if (!q_u->user_ctr.user.user1->client_name) { return False; } - q_u->user_ctr.user.user1->user_name = TALLOC_P( get_talloc_ctx(), UNISTR2 ); + q_u->user_ctr.user.user1->user_name = TALLOC_P( talloc_tos(), UNISTR2 ); if (!q_u->user_ctr.user.user1->user_name) { return False; } @@ -986,7 +986,7 @@ BOOL make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u q_u->user_switch=1; q_u->user_ctr.level = 1; - q_u->user_ctr.user.user1 = TALLOC_P( get_talloc_ctx(), SPOOL_USER_1 ); + q_u->user_ctr.user.user1 = TALLOC_P( talloc_tos(), SPOOL_USER_1 ); if (!q_u->user_ctr.user.user1) { return False; } diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index b366b14e7f..b571034d4c 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -783,7 +783,7 @@ BOOL svcctl_io_service_fa( const char *desc, SERVICE_FAILURE_ACTIONS *fa, RPC_BU if ( UNMARSHALLING(ps)) { if (fa->num_actions) { - if ( !(fa->actions = TALLOC_ARRAY( get_talloc_ctx(), SC_ACTION, fa->num_actions )) ) { + if ( !(fa->actions = TALLOC_ARRAY( talloc_tos(), SC_ACTION, fa->num_actions )) ) { DEBUG(0,("svcctl_io_service_fa: talloc() failure!\n")); return False; } -- cgit From 8401971a872dba206d7c2ea2c0ffe1aafd891ba0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 7 Sep 2007 12:13:16 +0000 Subject: r24993: Apply some const (This used to be commit 613b9fcd18bcc29bf5313e2287b53b8de430d17e) --- source3/rpc_parse/parse_prs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 3c1b200ebc..b92433f92f 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1551,7 +1551,7 @@ static void schannel_digest(struct schannel_auth_struct *a, uchar digest_final[16]) { uchar whole_packet_digest[16]; - static uchar zeros[4]; + static const uchar zeros[4] = { 0, }; struct MD5Context ctx3; /* verfiy the signature on the packet by MD5 over various bits */ @@ -1580,7 +1580,7 @@ static void schannel_get_sealing_key(struct schannel_auth_struct *a, RPC_AUTH_SCHANNEL_CHK *verf, uchar sealing_key[16]) { - static uchar zeros[4]; + static const uchar zeros[4] = { 0, }; uchar digest2[16]; uchar sess_kf0[16]; int i; @@ -1607,7 +1607,7 @@ static void schannel_get_sealing_key(struct schannel_auth_struct *a, static void schannel_deal_with_seq_num(struct schannel_auth_struct *a, RPC_AUTH_SCHANNEL_CHK *verf) { - static uchar zeros[4]; + static const uchar zeros[4] = { 0, }; uchar sequence_key[16]; uchar digest1[16]; -- cgit From c97fe37ea3d92a631e8da17c21dafae1db15e97b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 21 Sep 2007 14:37:35 +0000 Subject: r25294: Tidy up callers of unistr2_to_ascii() to pass sizeof(target_area) to the maxeln parameter instead of sizeof(target_area) - 1 (or even sizeof(fstring) - 1 in some places. I hope these were really all there were. Michael (This used to be commit 9a28be220df622322857dfe102fa35e108f932dc) --- source3/rpc_parse/parse_spoolss.c | 54 +++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index a0d818bd67..8430460312 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -5384,14 +5384,14 @@ BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, d->cversion=uni->cversion; - unistr2_to_ascii(d->name, &uni->name, sizeof(d->name)-1); - unistr2_to_ascii(d->environment, &uni->environment, sizeof(d->environment)-1); - unistr2_to_ascii(d->driverpath, &uni->driverpath, sizeof(d->driverpath)-1); - unistr2_to_ascii(d->datafile, &uni->datafile, sizeof(d->datafile)-1); - unistr2_to_ascii(d->configfile, &uni->configfile, sizeof(d->configfile)-1); - unistr2_to_ascii(d->helpfile, &uni->helpfile, sizeof(d->helpfile)-1); - unistr2_to_ascii(d->monitorname, &uni->monitorname, sizeof(d->monitorname)-1); - unistr2_to_ascii(d->defaultdatatype, &uni->defaultdatatype, sizeof(d->defaultdatatype)-1); + unistr2_to_ascii(d->name, &uni->name, sizeof(d->name)); + unistr2_to_ascii(d->environment, &uni->environment, sizeof(d->environment)); + unistr2_to_ascii(d->driverpath, &uni->driverpath, sizeof(d->driverpath)); + unistr2_to_ascii(d->datafile, &uni->datafile, sizeof(d->datafile)); + unistr2_to_ascii(d->configfile, &uni->configfile, sizeof(d->configfile)); + unistr2_to_ascii(d->helpfile, &uni->helpfile, sizeof(d->helpfile)); + unistr2_to_ascii(d->monitorname, &uni->monitorname, sizeof(d->monitorname)); + unistr2_to_ascii(d->defaultdatatype, &uni->defaultdatatype, sizeof(d->defaultdatatype)); DEBUGADD(8,( "version: %d\n", d->cversion)); DEBUGADD(8,( "name: %s\n", d->name)); @@ -5431,14 +5431,14 @@ BOOL uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni, d->version=uni->version; - unistr2_to_ascii(d->name, &uni->name, sizeof(d->name)-1); - unistr2_to_ascii(d->environment, &uni->environment, sizeof(d->environment)-1); - unistr2_to_ascii(d->driverpath, &uni->driverpath, sizeof(d->driverpath)-1); - unistr2_to_ascii(d->datafile, &uni->datafile, sizeof(d->datafile)-1); - unistr2_to_ascii(d->configfile, &uni->configfile, sizeof(d->configfile)-1); - unistr2_to_ascii(d->helpfile, &uni->helpfile, sizeof(d->helpfile)-1); - unistr2_to_ascii(d->monitorname, &uni->monitorname, sizeof(d->monitorname)-1); - unistr2_to_ascii(d->defaultdatatype, &uni->defaultdatatype, sizeof(d->defaultdatatype)-1); + unistr2_to_ascii(d->name, &uni->name, sizeof(d->name)); + unistr2_to_ascii(d->environment, &uni->environment, sizeof(d->environment)); + unistr2_to_ascii(d->driverpath, &uni->driverpath, sizeof(d->driverpath)); + unistr2_to_ascii(d->datafile, &uni->datafile, sizeof(d->datafile)); + unistr2_to_ascii(d->configfile, &uni->configfile, sizeof(d->configfile)); + unistr2_to_ascii(d->helpfile, &uni->helpfile, sizeof(d->helpfile)); + unistr2_to_ascii(d->monitorname, &uni->monitorname, sizeof(d->monitorname)); + unistr2_to_ascii(d->defaultdatatype, &uni->defaultdatatype, sizeof(d->defaultdatatype)); DEBUGADD(8,( "version: %d\n", d->version)); DEBUGADD(8,( "name: %s\n", d->name)); @@ -5475,17 +5475,17 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, d->status=uni->status; d->cjobs=uni->cjobs; - unistr2_to_ascii(d->servername, &uni->servername, sizeof(d->servername)-1); - unistr2_to_ascii(d->printername, &uni->printername, sizeof(d->printername)-1); - unistr2_to_ascii(d->sharename, &uni->sharename, sizeof(d->sharename)-1); - unistr2_to_ascii(d->portname, &uni->portname, sizeof(d->portname)-1); - unistr2_to_ascii(d->drivername, &uni->drivername, sizeof(d->drivername)-1); - unistr2_to_ascii(d->comment, &uni->comment, sizeof(d->comment)-1); - unistr2_to_ascii(d->location, &uni->location, sizeof(d->location)-1); - unistr2_to_ascii(d->sepfile, &uni->sepfile, sizeof(d->sepfile)-1); - unistr2_to_ascii(d->printprocessor, &uni->printprocessor, sizeof(d->printprocessor)-1); - unistr2_to_ascii(d->datatype, &uni->datatype, sizeof(d->datatype)-1); - unistr2_to_ascii(d->parameters, &uni->parameters, sizeof(d->parameters)-1); + unistr2_to_ascii(d->servername, &uni->servername, sizeof(d->servername)); + unistr2_to_ascii(d->printername, &uni->printername, sizeof(d->printername)); + unistr2_to_ascii(d->sharename, &uni->sharename, sizeof(d->sharename)); + unistr2_to_ascii(d->portname, &uni->portname, sizeof(d->portname)); + unistr2_to_ascii(d->drivername, &uni->drivername, sizeof(d->drivername)); + unistr2_to_ascii(d->comment, &uni->comment, sizeof(d->comment)); + unistr2_to_ascii(d->location, &uni->location, sizeof(d->location)); + unistr2_to_ascii(d->sepfile, &uni->sepfile, sizeof(d->sepfile)); + unistr2_to_ascii(d->printprocessor, &uni->printprocessor, sizeof(d->printprocessor)); + unistr2_to_ascii(d->datatype, &uni->datatype, sizeof(d->datatype)); + unistr2_to_ascii(d->parameters, &uni->parameters, sizeof(d->parameters)); return True; } -- cgit From 470ebf8a3504474dea5c324d01282e59c034a236 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 28 Sep 2007 01:32:08 +0000 Subject: r25399: Excise uint - > uint32 (where appropriate) or unsigned int. Jeremy. (This used to be commit b4ee924000f4a21b16a70e08e58331d209c4d114) --- source3/rpc_parse/parse_spoolss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 8430460312..04e760607e 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2405,8 +2405,8 @@ BOOL smb_io_printer_info_3(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_3 if (MARSHALLING(ps)) { /* Ensure the SD is 8 byte aligned in the buffer. */ - uint start = prs_offset(ps); /* Remember the start position. */ - uint off_val = 0; + uint32 start = prs_offset(ps); /* Remember the start position. */ + uint32 off_val = 0; /* Write a dummy value. */ if (!prs_uint32("offset", ps, depth, &off_val)) -- cgit From f708132de775403f582bd3cf216f7ed76e26932e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 7 Oct 2007 12:56:43 +0000 Subject: r25561: Make use of [un]marshall_sec_desc Minor cleanup only (This used to be commit 4dc4364b68b6b68ae0951a84475e2f9ea8cb1f8c) --- source3/rpc_parse/parse_prs.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index b92433f92f..c3603fe234 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1486,12 +1486,6 @@ int tdb_prs_store(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps) return tdb_trans_store(tdb, kbuf, dbuf, TDB_REPLACE); } -int tdb_prs_store_bystring(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps) -{ - TDB_DATA kbuf = string_term_tdb_data(keystr); - return tdb_prs_store(tdb, kbuf, ps); -} - /* useful function to fetch a structure into rpc wire format */ int tdb_prs_fetch(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps, TALLOC_CTX *mem_ctx) { @@ -1508,12 +1502,6 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps, TALLOC_CTX *m return 0; } -int tdb_prs_fetch_bystring(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *mem_ctx) -{ - TDB_DATA kbuf = string_term_tdb_data(keystr); - return tdb_prs_fetch(tdb, kbuf, ps, mem_ctx); -} - /******************************************************************* hash a stream. ********************************************************************/ -- cgit From e5a951325a6cac8567af3a66de6d2df577508ae4 Mon Sep 17 00:00:00 2001 From: "Gerald (Jerry) Carter" Date: Wed, 10 Oct 2007 15:34:30 -0500 Subject: [GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch. (This used to be commit 5c6c8e1fe93f340005110a7833946191659d88ab) --- source3/rpc_parse/parse_lsa.c | 44 - source3/rpc_parse/parse_misc.c | 49 +- source3/rpc_parse/parse_prs.c | 10 +- source3/rpc_parse/parse_rpc.c | 22 - source3/rpc_parse/parse_samr.c | 74 +- source3/rpc_parse/parse_srv.c | 3503 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 3558 insertions(+), 144 deletions(-) create mode 100644 source3/rpc_parse/parse_srv.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 625ef5fb41..15d7d80c03 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2139,50 +2139,6 @@ BOOL lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_stru return True; } -/******************************************************************* - Inits an LSA_Q_CLOSE structure. -********************************************************************/ - -void init_lsa_q_close(LSA_Q_CLOSE *in, POLICY_HND *hnd) -{ - DEBUG(5, ("init_lsa_q_close\n")); - - memcpy(&in->pol, hnd, sizeof(in->pol)); -} - -/******************************************************************* - Reads or writes an LSA_Q_CLOSE structure. -********************************************************************/ - -BOOL lsa_io_q_close(const char *desc, LSA_Q_CLOSE *in, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_close"); - depth++; - - if(!smb_io_pol_hnd("", &in->pol, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes an LSA_R_CLOSE structure. -********************************************************************/ - -BOOL lsa_io_r_close(const char *desc, LSA_R_CLOSE *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_close"); - depth++; - - if(!smb_io_pol_hnd("", &out->pol, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &out->status)) - return False; - - return True; -} - /******************************************************************* Reads or writes an LSA_Q_OPEN_SECRET structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 54d8ae4785..7321e362b8 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -61,7 +61,7 @@ BOOL smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth) if(!prs_align(ps)) return False; - + if (MARSHALLING(ps)) { low = *nttime & 0xFFFFFFFF; high = *nttime >> 32; @@ -88,6 +88,53 @@ BOOL smb_io_nttime(const char *desc, prs_struct *ps, int depth, NTTIME *nttime) return smb_io_time( desc, nttime, ps, depth ); } +/******************************************************************* + Gets an enumeration handle from an ENUM_HND structure. +********************************************************************/ + +uint32 get_enum_hnd(ENUM_HND *enh) +{ + return (enh && enh->ptr_hnd != 0) ? enh->handle : 0; +} + +/******************************************************************* + Inits an ENUM_HND structure. +********************************************************************/ + +void init_enum_hnd(ENUM_HND *enh, uint32 hnd) +{ + DEBUG(5,("smb_io_enum_hnd\n")); + + enh->ptr_hnd = (hnd != 0) ? 1 : 0; + enh->handle = hnd; +} + +/******************************************************************* + Reads or writes an ENUM_HND structure. +********************************************************************/ + +BOOL smb_io_enum_hnd(const char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) +{ + if (hnd == NULL) + return False; + + prs_debug(ps, depth, desc, "smb_io_enum_hnd"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_hnd", ps, depth, &hnd->ptr_hnd)) /* pointer */ + return False; + + if (hnd->ptr_hnd != 0) { + if(!prs_uint32("handle ", ps, depth, &hnd->handle )) /* enum handle */ + return False; + } + + return True; +} + /******************************************************************* Reads or writes a DOM_SID structure. ********************************************************************/ diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index c3603fe234..b22b1faa3f 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1500,7 +1500,7 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps, TALLOC_CTX *m prs_give_memory(ps, (char *)dbuf.dptr, dbuf.dsize, True); return 0; -} +} /******************************************************************* hash a stream. @@ -1766,9 +1766,9 @@ BOOL schannel_decode(struct schannel_auth_struct *a, enum pipe_auth_level auth_l checksum after the decode, below */ DEBUG(2, ("schannel_decode: FAILED: packet sequence number:\n")); - dump_data(2, (const uint8 *)verf->seq_num, sizeof(verf->seq_num)); + dump_data(2, verf->seq_num, sizeof(verf->seq_num)); DEBUG(2, ("should be:\n")); - dump_data(2, (const uint8 *)seq_num, sizeof(seq_num)); + dump_data(2, seq_num, sizeof(seq_num)); return False; } @@ -1776,9 +1776,9 @@ BOOL schannel_decode(struct schannel_auth_struct *a, enum pipe_auth_level auth_l if (memcmp(verf->sig, schannel_sig, sizeof(verf->sig))) { /* Validate that the other end sent the expected header */ DEBUG(2, ("schannel_decode: FAILED: packet header:\n")); - dump_data(2, (const uint8 *)verf->sig, sizeof(verf->sig)); + dump_data(2, verf->sig, sizeof(verf->sig)); DEBUG(2, ("should be:\n")); - dump_data(2, (const uint8 *)schannel_sig, sizeof(schannel_sig)); + dump_data(2, schannel_sig, sizeof(schannel_sig)); return False; } diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 6b2a9f4d38..d1f7ad3e85 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -190,16 +190,6 @@ interface/version dce/rpc pipe identification }, 0x00 \ } -#define SYNT_UNIXINFO_V0 \ -{ \ - { \ - 0x9c54e310, 0xa955, 0x4885, \ - { 0xbd, 0x31 }, \ - { 0x78, 0x78, \ - 0x71, 0x47, 0xdf, 0xa6 } \ - }, 0x00 \ -} - #define SYNT_NTSVCS_V1 \ { \ { \ @@ -210,16 +200,6 @@ interface/version dce/rpc pipe identification }, 0x01 \ } -#define SYNT_EPMAPPER_V3 \ -{ \ - { \ - 0xe1af8308, 0x5d1f,0x11c9, \ - { 0x91,0xa4}, \ - {0x08,0x00, \ - 0x2b,0x14,0xa0,0xfa} \ - }, 0x03 \ -} - /* * IMPORTANT!! If you update this structure, make sure to * update the index #defines in smb.h. @@ -241,9 +221,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_SHUTDOWN, SYNT_SHUTDOWN_V1 , PIPE_SHUTDOWN , TRANS_SYNT_V2 }, { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_EVENTLOG, SYNT_EVENTLOG_V0 , PIPE_EVENTLOG , TRANS_SYNT_V2 }, - { PIPE_UNIXINFO, SYNT_UNIXINFO_V0 , PIPE_UNIXINFO , TRANS_SYNT_V2 }, { PIPE_NTSVCS , SYNT_NTSVCS_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_EPMAPPER, SYNT_EPMAPPER_V3 , PIPE_EPMAPPER , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ddbe0a6255..407aae66e3 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -556,7 +556,7 @@ void init_unk_info2(SAM_UNK_INFO_2 * u_2, u_2->seq_num = seq_num; - + u_2->unknown_4 = 0x00000001; u_2->server_role = server_role; u_2->unknown_6 = 0x00000001; @@ -2171,76 +2171,6 @@ BOOL samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u, return True; } -/******************************************************************* -inits a SAMR_Q_GET_DISPENUM_INDEX structure. -********************************************************************/ - -void init_samr_q_get_dispenum_index(SAMR_Q_GET_DISPENUM_INDEX * q_e, POLICY_HND *pol, - uint16 switch_level, const char *name) -{ - DEBUG(5, ("init_samr_q_get_dispenum_index\n")); - - q_e->domain_pol = *pol; - - q_e->switch_level = switch_level; - - init_lsa_string(&q_e->name, name); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL samr_io_q_get_dispenum_index(const char *desc, SAMR_Q_GET_DISPENUM_INDEX * q_e, - prs_struct *ps, int depth) -{ - if (q_e == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_get_dispenum_index"); - 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 (!smb_io_lsa_string("name", &q_e->name, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -BOOL samr_io_r_get_dispenum_index(const char *desc, SAMR_R_GET_DISPENUM_INDEX * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_get_dispenum_index"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("idx", ps, depth, &r_u->idx)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - - /******************************************************************* inits a SAMR_Q_OPEN_GROUP structure. ********************************************************************/ @@ -7840,7 +7770,7 @@ BOOL samr_io_r_chgpasswd_user3(const char *desc, SAMR_R_CHGPASSWD_USER3 *r_u, 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 */ diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c new file mode 100644 index 0000000000..a1437c72c0 --- /dev/null +++ b/source3/rpc_parse/parse_srv.c @@ -0,0 +1,3503 @@ +/* + * 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) Jeremy Allison 1999, + * Copyright (C) Nigel Williams 2001, + * Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2002. + * Copyright (C) Gerald (Jerry) Carter 2006. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + +/******************************************************************* + Inits a SH_INFO_0_STR structure +********************************************************************/ + +void init_srv_share_info0_str(SH_INFO_0_STR *sh0, const char *net_name) +{ + DEBUG(5,("init_srv_share_info0_str\n")); + + init_unistr2(&sh0->uni_netname, net_name, UNI_STR_TERMINATE); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info0_str(const char *desc, SH_INFO_0_STR *sh0, prs_struct *ps, int depth) +{ + if (sh0 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info0_str"); + depth++; + + if(!prs_align(ps)) + return False; + if(sh0->ptrs->ptr_netname) + if(!smb_io_unistr2("", &sh0->uni_netname, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + makes a SH_INFO_0 structure +********************************************************************/ + +void init_srv_share_info0(SH_INFO_0 *sh0, const char *net_name) +{ + DEBUG(5,("init_srv_share_info0: %s\n", net_name)); + + sh0->ptr_netname = (net_name != NULL) ? 1 : 0; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info0(const char *desc, SH_INFO_0 *sh0, prs_struct *ps, int depth) +{ + if (sh0 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info0"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_netname", ps, depth, &sh0->ptr_netname)) + return False; + + return True; +} + +/******************************************************************* + Inits a SH_INFO_1_STR structure +********************************************************************/ + +void init_srv_share_info1_str(SH_INFO_1_STR *sh1, const char *net_name, const char *remark) +{ + DEBUG(5,("init_srv_share_info1_str\n")); + + init_unistr2(&sh1->uni_netname, net_name, UNI_STR_TERMINATE); + init_unistr2(&sh1->uni_remark, remark, UNI_STR_TERMINATE); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1_str(const char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth) +{ + if (sh1 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1_str"); + depth++; + + if(!prs_align(ps)) + return False; + + if(sh1->ptrs->ptr_netname) + if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(sh1->ptrs->ptr_remark) + if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + makes a SH_INFO_1 structure +********************************************************************/ + +void init_srv_share_info1(SH_INFO_1 *sh1, const char *net_name, uint32 type, const char *remark) +{ + DEBUG(5,("init_srv_share_info1: %s %8x %s\n", net_name, type, remark)); + + sh1->ptr_netname = (net_name != NULL) ? 1 : 0; + sh1->type = type; + sh1->ptr_remark = (remark != NULL) ? 1 : 0; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1(const char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) +{ + if (sh1 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_netname", ps, depth, &sh1->ptr_netname)) + return False; + if(!prs_uint32("type ", ps, depth, &sh1->type)) + return False; + if(!prs_uint32("ptr_remark ", ps, depth, &sh1->ptr_remark)) + return False; + + return True; +} + +/******************************************************************* + Inits a SH_INFO_2_STR structure +********************************************************************/ + +void init_srv_share_info2_str(SH_INFO_2_STR *sh2, + const char *net_name, const char *remark, + const char *path, const char *passwd) +{ + DEBUG(5,("init_srv_share_info2_str\n")); + + init_unistr2(&sh2->uni_netname, net_name, UNI_STR_TERMINATE); + init_unistr2(&sh2->uni_remark, remark, UNI_STR_TERMINATE); + init_unistr2(&sh2->uni_path, path, UNI_STR_TERMINATE); + init_unistr2(&sh2->uni_passwd, passwd, UNI_STR_TERMINATE); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info2_str(const char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) +{ + if (sh2 == NULL) + return False; + + if (UNMARSHALLING(ps)) + ZERO_STRUCTP(sh2); + + prs_debug(ps, depth, desc, "srv_io_share_info2_str"); + depth++; + + if(!prs_align(ps)) + return False; + + if (sh->ptr_netname) + if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth)) + return False; + + if (sh->ptr_remark) + if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth)) + return False; + + if (sh->ptr_netname) + if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth)) + return False; + + if (sh->ptr_passwd) + if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Inits a SH_INFO_2 structure +********************************************************************/ + +void init_srv_share_info2(SH_INFO_2 *sh2, + const char *net_name, uint32 type, const char *remark, + uint32 perms, uint32 max_uses, uint32 num_uses, + const char *path, const char *passwd) +{ + DEBUG(5,("init_srv_share_info2: %s %8x %s\n", net_name, type, remark)); + + sh2->ptr_netname = (net_name != NULL) ? 1 : 0; + sh2->type = type; + sh2->ptr_remark = (remark != NULL) ? 1 : 0; + sh2->perms = perms; + sh2->max_uses = max_uses; + sh2->num_uses = num_uses; + sh2->ptr_path = (path != NULL) ? 1 : 0; + sh2->ptr_passwd = (passwd != NULL) ? 1 : 0; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info2(const char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) +{ + if (sh2 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info2"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_netname", ps, depth, &sh2->ptr_netname)) + return False; + if(!prs_uint32("type ", ps, depth, &sh2->type)) + return False; + if(!prs_uint32("ptr_remark ", ps, depth, &sh2->ptr_remark)) + return False; + if(!prs_uint32("perms ", ps, depth, &sh2->perms)) + return False; + if(!prs_uint32("max_uses ", ps, depth, &sh2->max_uses)) + return False; + if(!prs_uint32("num_uses ", ps, depth, &sh2->num_uses)) + return False; + if(!prs_uint32("ptr_path ", ps, depth, &sh2->ptr_path)) + return False; + if(!prs_uint32("ptr_passwd ", ps, depth, &sh2->ptr_passwd)) + return False; + + return True; +} + +/******************************************************************* + Inits a SH_INFO_501_STR structure +********************************************************************/ + +void init_srv_share_info501_str(SH_INFO_501_STR *sh501, + const char *net_name, const char *remark) +{ + DEBUG(5,("init_srv_share_info501_str\n")); + + init_unistr2(&sh501->uni_netname, net_name, UNI_STR_TERMINATE); + init_unistr2(&sh501->uni_remark, remark, UNI_STR_TERMINATE); +} + +/******************************************************************* + Inits a SH_INFO_2 structure +*******************************************************************/ + +void init_srv_share_info501(SH_INFO_501 *sh501, const char *net_name, uint32 type, const char *remark, uint32 csc_policy) +{ + DEBUG(5,("init_srv_share_info501: %s %8x %s %08x\n", net_name, type, + remark, csc_policy)); + + ZERO_STRUCTP(sh501); + + sh501->ptr_netname = (net_name != NULL) ? 1 : 0; + sh501->type = type; + sh501->ptr_remark = (remark != NULL) ? 1 : 0; + sh501->csc_policy = csc_policy; +} + +/******************************************************************* + Reads of writes a structure. +*******************************************************************/ + +static BOOL srv_io_share_info501(const char *desc, SH_INFO_501 *sh501, prs_struct *ps, int depth) +{ + if (sh501 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info501"); + depth++; + + if (!prs_align(ps)) + return False; + + if (!prs_uint32("ptr_netname", ps, depth, &sh501->ptr_netname)) + return False; + if (!prs_uint32("type ", ps, depth, &sh501->type)) + return False; + if (!prs_uint32("ptr_remark ", ps, depth, &sh501->ptr_remark)) + return False; + if (!prs_uint32("csc_policy ", ps, depth, &sh501->csc_policy)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info501_str(const char *desc, SH_INFO_501_STR *sh501, prs_struct *ps, int depth) +{ + if (sh501 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info501_str"); + depth++; + + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("", &sh501->uni_netname, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("", &sh501->uni_remark, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Inits a SH_INFO_502 structure +********************************************************************/ + +void init_srv_share_info502(SH_INFO_502 *sh502, + const char *net_name, uint32 type, const char *remark, + uint32 perms, uint32 max_uses, uint32 num_uses, + const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size) +{ + DEBUG(5,("init_srv_share_info502: %s %8x %s\n", net_name, type, remark)); + + ZERO_STRUCTP(sh502); + + sh502->ptr_netname = (net_name != NULL) ? 1 : 0; + sh502->type = type; + sh502->ptr_remark = (remark != NULL) ? 1 : 0; + sh502->perms = perms; + sh502->max_uses = max_uses; + sh502->num_uses = num_uses; + sh502->ptr_path = (path != NULL) ? 1 : 0; + sh502->ptr_passwd = (passwd != NULL) ? 1 : 0; + sh502->reserved = 0; /* actual size within rpc */ + sh502->sd_size = (uint32)sd_size; + sh502->ptr_sd = (psd != NULL) ? 1 : 0; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info502(const char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth) +{ + if (sh502 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info502"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_netname", ps, depth, &sh502->ptr_netname)) + return False; + if(!prs_uint32("type ", ps, depth, &sh502->type)) + return False; + if(!prs_uint32("ptr_remark ", ps, depth, &sh502->ptr_remark)) + return False; + if(!prs_uint32("perms ", ps, depth, &sh502->perms)) + return False; + if(!prs_uint32("max_uses ", ps, depth, &sh502->max_uses)) + return False; + if(!prs_uint32("num_uses ", ps, depth, &sh502->num_uses)) + return False; + if(!prs_uint32("ptr_path ", ps, depth, &sh502->ptr_path)) + return False; + if(!prs_uint32("ptr_passwd ", ps, depth, &sh502->ptr_passwd)) + return False; + if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &sh502->reserved_offset)) + return False; + if(!prs_uint32("ptr_sd ", ps, depth, &sh502->ptr_sd)) + return False; + + return True; +} + +/******************************************************************* + Inits a SH_INFO_502_STR structure +********************************************************************/ + +void init_srv_share_info502_str(SH_INFO_502_STR *sh502str, + const char *net_name, const char *remark, + const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size) +{ + DEBUG(5,("init_srv_share_info502_str\n")); + + init_unistr2(&sh502str->uni_netname, net_name, UNI_STR_TERMINATE); + init_unistr2(&sh502str->uni_remark, remark, UNI_STR_TERMINATE); + init_unistr2(&sh502str->uni_path, path, UNI_STR_TERMINATE); + init_unistr2(&sh502str->uni_passwd, passwd, UNI_STR_TERMINATE); + sh502str->sd = psd; + sh502str->reserved = 0; + sh502str->sd_size = sd_size; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info502_str(const char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth) +{ + if (sh502 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info502_str"); + depth++; + + if(!prs_align(ps)) + return False; + + if(sh502->ptrs->ptr_netname) { + if(!smb_io_unistr2("", &sh502->uni_netname, True, ps, depth)) + return False; + } + + if(!prs_align(ps)) + return False; + + if(sh502->ptrs->ptr_remark) { + if(!smb_io_unistr2("", &sh502->uni_remark, True, ps, depth)) + return False; + } + + if(!prs_align(ps)) + return False; + + if(sh502->ptrs->ptr_path) { + if(!smb_io_unistr2("", &sh502->uni_path, True, ps, depth)) + return False; + } + + if(!prs_align(ps)) + return False; + + if(sh502->ptrs->ptr_passwd) { + if(!smb_io_unistr2("", &sh502->uni_passwd, True, ps, depth)) + return False; + } + + if(!prs_align(ps)) + return False; + + if(sh502->ptrs->ptr_sd) { + uint32 old_offset; + uint32 reserved_offset; + + if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &reserved_offset)) + return False; + + old_offset = prs_offset(ps); + + if (!sec_io_desc(desc, &sh502->sd, ps, depth)) + return False; + + if(UNMARSHALLING(ps)) { + + sh502->ptrs->sd_size = sh502->sd_size = sec_desc_size(sh502->sd); + + prs_set_offset(ps, old_offset + sh502->reserved); + } + + prs_align(ps); + + if(MARSHALLING(ps)) { + + sh502->ptrs->reserved = sh502->reserved = prs_offset(ps) - old_offset; + } + + if(!prs_uint32_post("reserved ", ps, depth, + &sh502->reserved, reserved_offset, sh502->reserved)) + return False; + if(!prs_uint32_post("reserved ", ps, depth, + &sh502->ptrs->reserved, sh502->ptrs->reserved_offset, sh502->ptrs->reserved)) + return False; + } + + return True; +} + +/******************************************************************* + Inits a SH_INFO_1004_STR structure +********************************************************************/ + +void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, const char *remark) +{ + DEBUG(5,("init_srv_share_info1004_str\n")); + + init_unistr2(&sh1004->uni_remark, remark, UNI_STR_TERMINATE); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1004_str(const char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth) +{ + if (sh1004 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1004_str"); + depth++; + + if(!prs_align(ps)) + return False; + if(sh1004->ptrs->ptr_remark) + if(!smb_io_unistr2("", &sh1004->uni_remark, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + makes a SH_INFO_1004 structure +********************************************************************/ + +void init_srv_share_info1004(SH_INFO_1004 *sh1004, const char *remark) +{ + DEBUG(5,("init_srv_share_info1004: %s\n", remark)); + + sh1004->ptr_remark = (remark != NULL) ? 1 : 0; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1004(const char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth) +{ + if (sh1004 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1004"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_remark", ps, depth, &sh1004->ptr_remark)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1005(const char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth) +{ + if(sh1005 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1005"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("share_info_flags", ps, depth, + &sh1005->share_info_flags)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1006(const char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth) +{ + if(sh1006 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1006"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("max uses ", ps, depth, &sh1006->max_uses)) + return False; + + return True; +} + +/******************************************************************* + Inits a SH_INFO_1007_STR structure +********************************************************************/ + +void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate_directory_name) +{ + DEBUG(5,("init_srv_share_info1007_str\n")); + + init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, UNI_STR_TERMINATE); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1007_str(const char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth) +{ + if (sh1007 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1007_str"); + depth++; + + if(!prs_align(ps)) + return False; + if(sh1007->ptrs->ptr_AlternateDirectoryName) + if(!smb_io_unistr2("", &sh1007->uni_AlternateDirectoryName, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + makes a SH_INFO_1007 structure +********************************************************************/ + +void init_srv_share_info1007(SH_INFO_1007 *sh1007, uint32 flags, const char *alternate_directory_name) +{ + DEBUG(5,("init_srv_share_info1007: %s\n", alternate_directory_name)); + + sh1007->flags = flags; + sh1007->ptr_AlternateDirectoryName = (alternate_directory_name != NULL) ? 1 : 0; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1007(const char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth) +{ + if (sh1007 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1007"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("flags ", ps, depth, &sh1007->flags)) + return False; + if(!prs_uint32("ptr_Alter..", ps, depth, &sh1007->ptr_AlternateDirectoryName)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_share_info1501(const char* desc, SRV_SHARE_INFO_1501* sh1501, + prs_struct* ps, int depth) +{ + if(sh1501 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_share_info1501"); + depth++; + + if(!prs_align(ps)) + return False; + + if (!sec_io_desc_buf(desc, &sh1501->sdb, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth) +{ + if (ctr == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_srv_share_ctr"); + depth++; + + if (UNMARSHALLING(ps)) { + memset(ctr, '\0', sizeof(SRV_SHARE_INFO_CTR)); + } + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("info_level", ps, depth, &ctr->info_level)) + return False; + + if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) + return False; + if(!prs_uint32("ptr_share_info", ps, depth, &ctr->ptr_share_info)) + return False; + + if (ctr->ptr_share_info == 0) + return True; + + if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries)) + return False; + if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries)) + return False; + + if (ctr->ptr_entries == 0) { + if (ctr->num_entries == 0) + return True; + else + return False; + } + + if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2)) + return False; + + if (ctr->num_entries2 != ctr->num_entries) + return False; + + switch (ctr->switch_value) { + + case 0: + { + SRV_SHARE_INFO_0 *info0 = ctr->share.info0; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps) && num_entries) { + if (!(info0 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_0, num_entries))) + return False; + ctr->share.info0 = info0; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info0("", &info0[i].info_0, ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + info0[i].info_0_str.ptrs = &info0[i].info_0; + if(!srv_io_share_info0_str("", &info0[i].info_0_str, ps, depth)) + return False; + } + + break; + } + + case 1: + { + SRV_SHARE_INFO_1 *info1 = ctr->share.info1; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps) && num_entries) { + if (!(info1 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_1, num_entries))) + return False; + ctr->share.info1 = info1; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1("", &info1[i].info_1, ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + info1[i].info_1_str.ptrs = &info1[i].info_1; + if(!srv_io_share_info1_str("", &info1[i].info_1_str, ps, depth)) + return False; + } + + break; + } + + case 2: + { + SRV_SHARE_INFO_2 *info2 = ctr->share.info2; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps) && num_entries) { + if (!(info2 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_2,num_entries))) + return False; + ctr->share.info2 = info2; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info2("", &info2[i].info_2, ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info2_str("", &info2[i].info_2, &info2[i].info_2_str, ps, depth)) + return False; + } + + break; + } + + case 501: + { + SRV_SHARE_INFO_501 *info501 = ctr->share.info501; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps) && num_entries) { + if (!(info501 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_501, num_entries))) + return False; + ctr->share.info501 = info501; + } + + for (i = 0; i < num_entries; i++) { + if (!srv_io_share_info501("", &info501[i].info_501, ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + if (!srv_io_share_info501_str("", &info501[i].info_501_str, ps, depth)) + return False; + } + + break; + } + + case 502: + { + SRV_SHARE_INFO_502 *info502 = ctr->share.info502; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps) && num_entries) { + if (!(info502 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_502,num_entries))) + return False; + ctr->share.info502 = info502; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info502("", &info502[i].info_502, ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + info502[i].info_502_str.ptrs = &info502[i].info_502; + if(!srv_io_share_info502_str("", &info502[i].info_502_str, ps, depth)) + return False; + } + + break; + } + + case 1004: + { + SRV_SHARE_INFO_1004 *info1004 = ctr->share.info1004; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps) && num_entries) { + if (!(info1004 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1004,num_entries))) + return False; + ctr->share.info1004 = info1004; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1004("", &info1004[i].info_1004, ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + info1004[i].info_1004_str.ptrs = &info1004[i].info_1004; + if(!srv_io_share_info1004_str("", &info1004[i].info_1004_str, ps, depth)) + return False; + } + + break; + } + + case 1005: + { + SRV_SHARE_INFO_1005 *info1005 = ctr->share.info1005; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps) && num_entries) { + if (!(info1005 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1005,num_entries))) + return False; + ctr->share.info1005 = info1005; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1005("", &info1005[i], ps, depth)) + return False; + } + + break; + } + + case 1006: + { + SRV_SHARE_INFO_1006 *info1006 = ctr->share.info1006; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps) && num_entries) { + if (!(info1006 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1006,num_entries))) + return False; + ctr->share.info1006 = info1006; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1006("", &info1006[i], ps, depth)) + return False; + } + + break; + } + + case 1007: + { + SRV_SHARE_INFO_1007 *info1007 = ctr->share.info1007; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps) && num_entries) { + if (!(info1007 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1007,num_entries))) + return False; + ctr->share.info1007 = info1007; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1007("", &info1007[i].info_1007, ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + info1007[i].info_1007_str.ptrs = &info1007[i].info_1007; + if(!srv_io_share_info1007_str("", &info1007[i].info_1007_str, ps, depth)) + return False; + } + + break; + } + + case 1501: + { + SRV_SHARE_INFO_1501 *info1501 = ctr->share.info1501; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps) && num_entries) { + if (!(info1501 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1501,num_entries))) + return False; + ctr->share.info1501 = info1501; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_share_info1501("", &info1501[i], ps, depth)) + return False; + } + + break; + } + + default: + DEBUG(5,("%s no share info at switch_value %d\n", + tab_depth(depth), ctr->switch_value)); + break; + } + + return True; +} + +/******************************************************************* + Inits a SRV_Q_NET_SHARE_ENUM structure. +********************************************************************/ + +void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, + const char *srv_name, uint32 info_level, + uint32 preferred_len, ENUM_HND *hnd) +{ + + DEBUG(5,("init_q_net_share_enum\n")); + + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); + + q_n->ctr.info_level = q_n->ctr.switch_value = info_level; + q_n->ctr.ptr_share_info = 1; + q_n->ctr.num_entries = 0; + q_n->ctr.ptr_entries = 0; + q_n->ctr.num_entries2 = 0; + q_n->preferred_len = preferred_len; + + memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_share_enum(const char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_share_enum"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!srv_io_srv_share_ctr("share_ctr", &q_n->ctr, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) + return False; + + if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_share_enum(const char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_share_enum"); + depth++; + + if(!srv_io_srv_share_ctr("share_ctr", &r_n->ctr, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) + return False; + + if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) + return False; + + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} + +/******************************************************************* + initialises a structure. +********************************************************************/ + +BOOL init_srv_q_net_share_get_info(SRV_Q_NET_SHARE_GET_INFO *q_n, const char *srv_name, const char *share_name, uint32 info_level) +{ + + uint32 ptr_share_name; + + DEBUG(5,("init_srv_q_net_share_get_info\n")); + + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); + init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name); + + q_n->info_level = info_level; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_share_get_info(const char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_share_get_info"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("info_level", ps, depth, &q_n->info_level)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_srv_share_info(const char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_srv_share_info"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value )) + return False; + + if(!prs_uint32("ptr_share_ctr", ps, depth, &r_n->ptr_share_ctr)) + return False; + + if (r_n->ptr_share_ctr != 0) { + switch (r_n->switch_value) { + case 0: + if(!srv_io_share_info0("", &r_n->share.info0.info_0, ps, depth)) + return False; + + /* allow access to pointers in the str part. */ + r_n->share.info0.info_0_str.ptrs = &r_n->share.info0.info_0; + + if(!srv_io_share_info0_str("", &r_n->share.info0.info_0_str, ps, depth)) + return False; + + break; + case 1: + if(!srv_io_share_info1("", &r_n->share.info1.info_1, ps, depth)) + return False; + + /* allow access to pointers in the str part. */ + r_n->share.info1.info_1_str.ptrs = &r_n->share.info1.info_1; + + if(!srv_io_share_info1_str("", &r_n->share.info1.info_1_str, ps, depth)) + return False; + + break; + case 2: + if(!srv_io_share_info2("", &r_n->share.info2.info_2, ps, depth)) + return False; + + if(!srv_io_share_info2_str("", &r_n->share.info2.info_2, &r_n->share.info2.info_2_str, ps, depth)) + return False; + + break; + case 501: + if (!srv_io_share_info501("", &r_n->share.info501.info_501, ps, depth)) + return False; + if (!srv_io_share_info501_str("", &r_n->share.info501.info_501_str, ps, depth)) + return False; + break; + + case 502: + if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth)) + return False; + + /* allow access to pointers in the str part. */ + r_n->share.info502.info_502_str.ptrs = &r_n->share.info502.info_502; + + if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth)) + return False; + break; + case 1004: + if(!srv_io_share_info1004("", &r_n->share.info1004.info_1004, ps, depth)) + return False; + + /* allow access to pointers in the str part. */ + r_n->share.info1004.info_1004_str.ptrs = &r_n->share.info1004.info_1004; + + if(!srv_io_share_info1004_str("", &r_n->share.info1004.info_1004_str, ps, depth)) + return False; + break; + case 1005: + if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth)) + return False; + break; + case 1006: + if(!srv_io_share_info1006("", &r_n->share.info1006, ps, depth)) + return False; + break; + case 1007: + if(!srv_io_share_info1007("", &r_n->share.info1007.info_1007, ps, depth)) + return False; + + /* allow access to pointers in the str part. */ + r_n->share.info1007.info_1007_str.ptrs = &r_n->share.info1007.info_1007; + + if(!srv_io_share_info1007_str("", &r_n->share.info1007.info_1007_str, ps, depth)) + return False; + break; + case 1501: + if (!srv_io_share_info1501("", &r_n->share.info1501, ps, depth)) + return False; + default: + DEBUG(5,("%s no share info at switch_value %d\n", + tab_depth(depth), r_n->switch_value)); + break; + } + } + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_share_get_info(const char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_share_get_info"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!srv_io_srv_share_info("info ", ps, depth, &r_n->info)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} + +/******************************************************************* + intialises a structure. +********************************************************************/ + +BOOL init_srv_q_net_share_set_info(SRV_Q_NET_SHARE_SET_INFO *q_n, + const char *srv_name, + const char *share_name, + uint32 info_level, + const SRV_SHARE_INFO *info) +{ + + uint32 ptr_share_name; + + DEBUG(5,("init_srv_q_net_share_set_info\n")); + + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); + init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name); + + q_n->info_level = info_level; + + q_n->info = *info; + + q_n->ptr_parm_error = 1; + q_n->parm_error = 0; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_share_set_info(const char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_share_set_info"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("info_level", ps, depth, &q_n->info_level)) + return False; + + if(!prs_align(ps)) + return False; + + if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info)) + return False; + + if(!prs_align(ps)) + return False; + if(!prs_uint32("ptr_parm_error", ps, depth, &q_n->ptr_parm_error)) + return False; + if(q_n->ptr_parm_error!=0) { + if(!prs_uint32("parm_error", ps, depth, &q_n->parm_error)) + return False; + } + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_share_set_info(const char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_share_set_info"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_parm_error ", ps, depth, &r_n->ptr_parm_error)) + return False; + + if(r_n->ptr_parm_error) { + + if(!prs_uint32("parm_error ", ps, depth, &r_n->parm_error)) + return False; + } + + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} + + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_share_add(const char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_share_add"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("info_level", ps, depth, &q_n->info_level)) + return False; + + if(!prs_align(ps)) + return False; + + if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_err_index", ps, depth, &q_n->ptr_err_index)) + return False; + if (q_n->ptr_err_index) + if (!prs_uint32("err_index", ps, depth, &q_n->err_index)) + return False; + + return True; +} + +void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname, + const char *netname, uint32 type, const char *remark, + uint32 perms, uint32 max_uses, uint32 num_uses, + const char *path, const char *passwd, + int level, SEC_DESC *sd) +{ + switch(level) { + case 502: { + size_t sd_size = sec_desc_size(sd); + q->ptr_srv_name = 1; + init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE); + q->info.switch_value = q->info_level = level; + q->info.ptr_share_ctr = 1; + init_srv_share_info502(&q->info.share.info502.info_502, netname, type, + remark, perms, max_uses, num_uses, path, passwd, sd, sd_size); + init_srv_share_info502_str(&q->info.share.info502.info_502_str, netname, + remark, path, passwd, sd, sd_size); + q->ptr_err_index = 1; + q->err_index = 0; + } + break; + case 2: + default: + q->ptr_srv_name = 1; + init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE); + q->info.switch_value = q->info_level = level; + q->info.ptr_share_ctr = 1; + init_srv_share_info2(&q->info.share.info2.info_2, netname, type, + remark, perms, max_uses, num_uses, path, passwd); + init_srv_share_info2_str(&q->info.share.info2.info_2_str, netname, + remark, path, passwd); + q->ptr_err_index = 1; + q->err_index = 0; + break; + } +} + + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_share_add(const char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_share_add"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_parm_error", ps, depth, &r_n->ptr_parm_error)) + return False; + + if(r_n->ptr_parm_error) { + + if(!prs_uint32("parm_error", ps, depth, &r_n->parm_error)) + return False; + } + + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} + +/******************************************************************* + initialises a structure. +********************************************************************/ + +void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname, + const char *sharename) +{ + del->ptr_srv_name = 1; + init_unistr2(&del->uni_srv_name, srvname, UNI_STR_TERMINATE); + init_unistr2(&del->uni_share_name, sharename, UNI_STR_TERMINATE); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_share_del(const char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_share_del"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + if(!prs_uint32("reserved", ps, depth, &q_n->reserved)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_share_del(const char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_share_del"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status", ps, depth, &q_n->status)) + return False; + + return True; +} + +/******************************************************************* + Inits a SESS_INFO_0_STR structure +********************************************************************/ + +void init_srv_sess_info0( SESS_INFO_0 *ss0, const char *name ) +{ + ZERO_STRUCTP( ss0 ); + + if ( name ) { + if ( (ss0->sharename = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) { + DEBUG(0,("init_srv_sess_info0: talloc failed!\n")); + return; + } + init_unistr2( ss0->sharename, name, UNI_STR_TERMINATE ); + } +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth) +{ + if (ss0 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read)) + return False; + if(!prs_uint32("ptr_sess_info", ps, depth, &ss0->ptr_sess_info)) + return False; + + if (ss0->ptr_sess_info != 0) { + uint32 i; + uint32 num_entries = ss0->num_entries_read; + + if (num_entries > MAX_SESS_ENTRIES) { + num_entries = MAX_SESS_ENTRIES; /* report this! */ + } + + if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2)) + return False; + + SMB_ASSERT_ARRAY(ss0->info_0, num_entries); + + /* first the pointers */ + for (i = 0; i < num_entries; i++) { + if ( !prs_io_unistr2_p("", ps, depth, &ss0->info_0[i].sharename ) ) + return False; + } + + /* now the strings */ + for (i = 0; i < num_entries; i++) { + if ( !prs_io_unistr2("sharename", ps, depth, ss0->info_0[i].sharename )) + return False; + } + + if(!prs_align(ps)) + return False; + } + + return True; +} + +/******************************************************************* + Inits a SESS_INFO_1 structure +********************************************************************/ + +void init_srv_sess_info1( SESS_INFO_1 *ss1, const char *name, const char *user, + uint32 num_opens, uint32 open_time, uint32 idle_time, + uint32 user_flags) +{ + DEBUG(5,("init_srv_sess_info1: %s\n", name)); + + ZERO_STRUCTP( ss1 ); + + if ( name ) { + if ( (ss1->sharename = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) { + DEBUG(0,("init_srv_sess_info0: talloc failed!\n")); + return; + } + init_unistr2( ss1->sharename, name, UNI_STR_TERMINATE ); + } + + if ( user ) { + if ( (ss1->username = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) { + DEBUG(0,("init_srv_sess_info0: talloc failed!\n")); + return; + } + init_unistr2( ss1->username, user, UNI_STR_TERMINATE ); + } + + ss1->num_opens = num_opens; + ss1->open_time = open_time; + ss1->idle_time = idle_time; + ss1->user_flags = user_flags; +} + + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_srv_sess_info_1(const char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth) +{ + if (ss1 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read)) + return False; + if(!prs_uint32("ptr_sess_info", ps, depth, &ss1->ptr_sess_info)) + return False; + + if (ss1->ptr_sess_info != 0) { + uint32 i; + uint32 num_entries = ss1->num_entries_read; + + if (num_entries > MAX_SESS_ENTRIES) { + num_entries = MAX_SESS_ENTRIES; /* report this! */ + } + + if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2)) + return False; + + SMB_ASSERT_ARRAY(ss1->info_1, num_entries); + + /* first the pointers and flags */ + + for (i = 0; i < num_entries; i++) { + + if ( !prs_io_unistr2_p("", ps, depth, &ss1->info_1[i].sharename )) + return False; + if ( !prs_io_unistr2_p("", ps, depth, &ss1->info_1[i].username )) + return False; + + if(!prs_uint32("num_opens ", ps, depth, &ss1->info_1[i].num_opens)) + return False; + if(!prs_uint32("open_time ", ps, depth, &ss1->info_1[i].open_time)) + return False; + if(!prs_uint32("idle_time ", ps, depth, &ss1->info_1[i].idle_time)) + return False; + if(!prs_uint32("user_flags", ps, depth, &ss1->info_1[i].user_flags)) + return False; + } + + /* now the strings */ + + for (i = 0; i < num_entries; i++) { + if ( !prs_io_unistr2("", ps, depth, ss1->info_1[i].sharename )) + return False; + if ( !prs_io_unistr2("", ps, depth, ss1->info_1[i].username )) + return False; + } + + if(!prs_align(ps)) + return False; + } + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth) +{ + SRV_SESS_INFO_CTR *ctr = *pp_ctr; + + prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr"); + depth++; + + if(UNMARSHALLING(ps)) { + ctr = *pp_ctr = PRS_ALLOC_MEM(ps, SRV_SESS_INFO_CTR, 1); + if (ctr == NULL) + return False; + } + + if (ctr == NULL) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) + return False; + if(!prs_uint32("ptr_sess_ctr", ps, depth, &ctr->ptr_sess_ctr)) + return False; + + if (ctr->ptr_sess_ctr != 0) { + switch (ctr->switch_value) { + case 0: + if(!srv_io_srv_sess_info_0("", &ctr->sess.info0, ps, depth)) + return False; + break; + case 1: + if(!srv_io_srv_sess_info_1("", &ctr->sess.info1, ps, depth)) + return False; + break; + default: + DEBUG(5,("%s no session info at switch_value %d\n", + tab_depth(depth), ctr->switch_value)); + break; + } + } + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum"); + 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("qualifier", ps, depth, (void*)&q_u->qualifier, + sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_pointer("username", ps, depth, (void*)&q_u->username, + sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("sess_level", ps, depth, &q_u->sess_level)) + return False; + + if (q_u->sess_level != (uint32)-1) { + if(!srv_io_srv_sess_ctr("sess_ctr", &q_u->ctr, ps, depth)) + return False; + } + + if(!prs_uint32("preferred_len", ps, depth, &q_u->preferred_len)) + return False; + + if(!smb_io_enum_hnd("enum_hnd", &q_u->enum_hnd, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_sess_enum(const char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("sess_level", ps, depth, &r_n->sess_level)) + return False; + + if (r_n->sess_level != (uint32)-1) { + if(!srv_io_srv_sess_ctr("sess_ctr", &r_n->ctr, ps, depth)) + return False; + } + + if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) + return False; + if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) + return False; + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} + +/******************************************************************* + Inits a SRV_Q_NET_SESS_DEL structure. +********************************************************************/ + +void init_srv_q_net_sess_del(SRV_Q_NET_SESS_DEL *q_n, const char *srv_name, + const char *cli_name, const char *user_name) +{ + DEBUG(5,("init_q_net_sess_enum\n")); + + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); + init_buf_unistr2(&q_n->uni_cli_name, &q_n->ptr_cli_name, cli_name); + init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_sess_del(const char *desc, SRV_Q_NET_SESS_DEL *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_sess_del"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_cli_name", ps, depth, &q_n->ptr_cli_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_cli_name, q_n->ptr_cli_name, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_sess_del(const char *desc, SRV_R_NET_SESS_DEL *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_sess_del"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} + +/******************************************************************* + Inits a CONN_INFO_0 structure +********************************************************************/ + +void init_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id) +{ + DEBUG(5,("init_srv_conn_info0\n")); + + ss0->id = id; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_conn_info0(const char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth) +{ + if (ss0 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_conn_info0"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("id", ps, depth, &ss0->id)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_srv_conn_info_0(const char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth) +{ + if (ss0 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read)) + return False; + if(!prs_uint32("ptr_conn_info", ps, depth, &ss0->ptr_conn_info)) + return False; + + if (ss0->ptr_conn_info != 0) { + int i; + int num_entries = ss0->num_entries_read; + + if (num_entries > MAX_CONN_ENTRIES) { + num_entries = MAX_CONN_ENTRIES; /* report this! */ + } + + if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2)) + return False; + + for (i = 0; i < num_entries; i++) { + if(!srv_io_conn_info0("", &ss0->info_0[i], ps, depth)) + return False; + } + + if(!prs_align(ps)) + return False; + } + + return True; +} + +/******************************************************************* + Inits a CONN_INFO_1_STR structure +********************************************************************/ + +void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, const char *usr_name, const char *net_name) +{ + DEBUG(5,("init_srv_conn_info1_str\n")); + + init_unistr2(&ss1->uni_usr_name, usr_name, UNI_STR_TERMINATE); + init_unistr2(&ss1->uni_net_name, net_name, UNI_STR_TERMINATE); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_conn_info1_str(const char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth) +{ + if (ss1 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_conn_info1_str"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!smb_io_unistr2("", &ss1->uni_usr_name, True, ps, depth)) + return False; + if(!smb_io_unistr2("", &ss1->uni_net_name, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Inits a CONN_INFO_1 structure +********************************************************************/ + +void init_srv_conn_info1(CONN_INFO_1 *ss1, + uint32 id, uint32 type, + uint32 num_opens, uint32 num_users, uint32 open_time, + const char *usr_name, const char *net_name) +{ + DEBUG(5,("init_srv_conn_info1: %s %s\n", usr_name, net_name)); + + ss1->id = id ; + ss1->type = type ; + ss1->num_opens = num_opens ; + ss1->num_users = num_users; + ss1->open_time = open_time; + + ss1->ptr_usr_name = (usr_name != NULL) ? 1 : 0; + ss1->ptr_net_name = (net_name != NULL) ? 1 : 0; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_conn_info1(const char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth) +{ + if (ss1 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_conn_info1"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("id ", ps, depth, &ss1->id)) + return False; + if(!prs_uint32("type ", ps, depth, &ss1->type)) + return False; + if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens)) + return False; + if(!prs_uint32("num_users ", ps, depth, &ss1->num_users)) + return False; + if(!prs_uint32("open_time ", ps, depth, &ss1->open_time)) + return False; + + if(!prs_uint32("ptr_usr_name", ps, depth, &ss1->ptr_usr_name)) + return False; + if(!prs_uint32("ptr_net_name", ps, depth, &ss1->ptr_net_name)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_srv_conn_info_1(const char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth) +{ + if (ss1 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read)) + return False; + if(!prs_uint32("ptr_conn_info", ps, depth, &ss1->ptr_conn_info)) + return False; + + if (ss1->ptr_conn_info != 0) { + int i; + int num_entries = ss1->num_entries_read; + + if (num_entries > MAX_CONN_ENTRIES) { + num_entries = MAX_CONN_ENTRIES; /* report this! */ + } + + if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2)) + return False; + + for (i = 0; i < num_entries; i++) { + if(!srv_io_conn_info1("", &ss1->info_1[i], ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_conn_info1_str("", &ss1->info_1_str[i], ps, depth)) + return False; + } + + if(!prs_align(ps)) + return False; + } + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_srv_conn_ctr(const char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth) +{ + SRV_CONN_INFO_CTR *ctr = *pp_ctr; + + prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr"); + depth++; + + if (UNMARSHALLING(ps)) { + ctr = *pp_ctr = PRS_ALLOC_MEM(ps, SRV_CONN_INFO_CTR, 1); + if (ctr == NULL) + return False; + } + + if (ctr == NULL) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) + return False; + if(!prs_uint32("ptr_conn_ctr", ps, depth, &ctr->ptr_conn_ctr)) + return False; + + if (ctr->ptr_conn_ctr != 0) { + switch (ctr->switch_value) { + case 0: + if(!srv_io_srv_conn_info_0("", &ctr->conn.info0, ps, depth)) + return False; + break; + case 1: + if(!srv_io_srv_conn_info_1("", &ctr->conn.info1, ps, depth)) + return False; + break; + default: + DEBUG(5,("%s no connection info at switch_value %d\n", + tab_depth(depth), ctr->switch_value)); + break; + } + } + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, + const char *srv_name, const char *qual_name, + uint32 conn_level, SRV_CONN_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd) +{ + DEBUG(5,("init_q_net_conn_enum\n")); + + q_n->ctr = ctr; + + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name ); + init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name); + + q_n->conn_level = conn_level; + q_n->preferred_len = preferred_len; + + memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_conn_enum(const char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, q_n->ptr_srv_name, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("conn_level", ps, depth, &q_n->conn_level)) + return False; + + if (q_n->conn_level != (uint32)-1) { + if(!srv_io_srv_conn_ctr("conn_ctr", &q_n->ctr, ps, depth)) + return False; + } + + if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) + return False; + + if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("conn_level", ps, depth, &r_n->conn_level)) + return False; + + if (r_n->conn_level != (uint32)-1) { + if(!srv_io_srv_conn_ctr("conn_ctr", &r_n->ctr, ps, depth)) + return False; + } + + if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) + return False; + if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) + return False; + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_file_info3_str(const char *desc, FILE_INFO_3 *sh1, prs_struct *ps, int depth) +{ + if (sh1 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_file_info3_str"); + depth++; + + if(!prs_align(ps)) + return False; + + if ( sh1->path ) { + if(!smb_io_unistr2("", sh1->path, True, ps, depth)) + return False; + } + + if ( sh1->user ) { + if(!smb_io_unistr2("", sh1->user, True, ps, depth)) + return False; + } + + return True; +} + +/******************************************************************* + Inits a FILE_INFO_3 structure +********************************************************************/ + +void init_srv_file_info3( FILE_INFO_3 *fl3, uint32 id, uint32 perms, uint32 num_locks, + const char *user_name, const char *path_name ) +{ + fl3->id = id; + fl3->perms = perms; + fl3->num_locks = num_locks; + + if ( path_name ) { + if ( (fl3->path = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) + return; + init_unistr2(fl3->path, path_name, UNI_STR_TERMINATE); + } + + if ( user_name ) { + if ( (fl3->user = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) + return; + init_unistr2(fl3->user, user_name, UNI_STR_TERMINATE); + } + + return; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) +{ + uint32 uni_p; + + if (fl3 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_file_info3"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("id ", ps, depth, &fl3->id)) + return False; + if(!prs_uint32("perms ", ps, depth, &fl3->perms)) + return False; + if(!prs_uint32("num_locks ", ps, depth, &fl3->num_locks)) + return False; + + uni_p = fl3->path ? 1 : 0; + if(!prs_uint32("ptr", ps, depth, &uni_p)) + return False; + if (UNMARSHALLING(ps)) { + if ( (fl3->path = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) { + return False; + } + } + + uni_p = fl3->user ? 1 : 0; + if(!prs_uint32("ptr", ps, depth, &uni_p)) + return False; + if (UNMARSHALLING(ps)) { + if ( (fl3->user = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) { + return False; + } + } + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +static BOOL srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) +{ + if (ctr == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_srv_file_ctr"); + depth++; + + if (UNMARSHALLING(ps)) { + ZERO_STRUCTP(ctr); + } + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("level", ps, depth, &ctr->level)) + return False; + + if(!prs_uint32("ptr_file_info", ps, depth, &ctr->ptr_file_info)) + return False; + if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries)) + return False; + if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries)) + return False; + + if (ctr->ptr_entries == 0) + return True; + + if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2)) + return False; + + switch (ctr->level) { + case 3: { + FILE_INFO_3 *info3 = ctr->file.info3; + int num_entries = ctr->num_entries; + int i; + + if (UNMARSHALLING(ps) && num_entries) { + if (!(info3 = PRS_ALLOC_MEM(ps, FILE_INFO_3, num_entries))) + return False; + ctr->file.info3 = info3; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_file_info3("", &ctr->file.info3[i], ps, depth)) + return False; + } + + for (i = 0; i < num_entries; i++) { + if(!srv_io_file_info3_str("", &ctr->file.info3[i], ps, depth)) + return False; + } + break; + } + default: + DEBUG(5,("%s no file info at switch_value %d\n", tab_depth(depth), ctr->level)); + break; + } + + return True; +} + +/******************************************************************* + Inits a SRV_Q_NET_FILE_ENUM structure. +********************************************************************/ + +void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, + const char *srv_name, const char *qual_name, + const char *user_name, + uint32 file_level, SRV_FILE_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd) +{ + uint32 ptr; + + if ( srv_name ) { + if ( (q_n->servername = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) + return; + init_buf_unistr2(q_n->servername, &ptr, srv_name); + } + + if ( qual_name ) { + if ( (q_n->qualifier = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) + return; + init_buf_unistr2(q_n->qualifier, &ptr, qual_name); + } + + if ( user_name ) { + if ( (q_n->username = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) + return; + init_buf_unistr2(q_n->username, &ptr, user_name); + } + + q_n->level = q_n->ctr.level = file_level; + + q_n->preferred_len = preferred_len; + q_n->ctr.ptr_file_info = 1; + q_n->ctr.num_entries = 0; + q_n->ctr.num_entries2 = 0; + + memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_file_enum"); + 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("qualifier", ps, depth, (void*)&q_u->qualifier, + sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) + return False; + if(!prs_align(ps)) + return False; + + if(!prs_pointer("username", ps, depth, (void*)&q_u->username, + sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) + return False; + if(!prs_align(ps)) + return False; + + if(!prs_uint32("level", ps, depth, &q_u->level)) + return False; + + if (q_u->level != (uint32)-1) { + if(!srv_io_srv_file_ctr("file_ctr", &q_u->ctr, ps, depth)) + return False; + } + + if(!prs_uint32("preferred_len", ps, depth, &q_u->preferred_len)) + return False; + + if(!smb_io_enum_hnd("enum_hnd", &q_u->enum_hnd, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_file_enum"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("level", ps, depth, &r_n->level)) + return False; + + if (r_n->level != 0) { + if(!srv_io_srv_file_ctr("file_ctr", &r_n->ctr, ps, depth)) + return False; + } + + if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) + return False; + if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) + return False; + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} + +/******************************************************************* + Inits a SRV_INFO_100 structure. + ********************************************************************/ + +void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, const char *name) +{ + DEBUG(5,("init_srv_info_100\n")); + + sv100->platform_id = platform_id; + init_buf_unistr2(&sv100->uni_name, &sv100->ptr_name, name); +} + +/******************************************************************* + Reads or writes a SRV_INFO_101 structure. + ********************************************************************/ + +static BOOL srv_io_info_100(const char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth) +{ + if (sv100 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_info_100"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("platform_id ", ps, depth, &sv100->platform_id)) + return False; + if(!prs_uint32("ptr_name ", ps, depth, &sv100->ptr_name)) + return False; + + if(!smb_io_unistr2("uni_name ", &sv100->uni_name, True, ps, depth)) + return False; + + return True; +} + + +/******************************************************************* + Inits a SRV_INFO_101 structure. + ********************************************************************/ + +void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, const char *name, + uint32 ver_major, uint32 ver_minor, + uint32 srv_type, const char *comment) +{ + DEBUG(5,("init_srv_info_101\n")); + + sv101->platform_id = platform_id; + init_buf_unistr2(&sv101->uni_name, &sv101->ptr_name, name); + sv101->ver_major = ver_major; + sv101->ver_minor = ver_minor; + sv101->srv_type = srv_type; + init_buf_unistr2(&sv101->uni_comment, &sv101->ptr_comment, comment); +} + +/******************************************************************* + Reads or writes a SRV_INFO_101 structure. + ********************************************************************/ + +static BOOL srv_io_info_101(const char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth) +{ + if (sv101 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_info_101"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("platform_id ", ps, depth, &sv101->platform_id)) + return False; + if(!prs_uint32("ptr_name ", ps, depth, &sv101->ptr_name)) + return False; + if(!prs_uint32("ver_major ", ps, depth, &sv101->ver_major)) + return False; + if(!prs_uint32("ver_minor ", ps, depth, &sv101->ver_minor)) + return False; + if(!prs_uint32("srv_type ", ps, depth, &sv101->srv_type)) + return False; + if(!prs_uint32("ptr_comment ", ps, depth, &sv101->ptr_comment)) + return False; + + if(!prs_align(ps)) + return False; + + if(!smb_io_unistr2("uni_name ", &sv101->uni_name, True, ps, depth)) + return False; + if(!smb_io_unistr2("uni_comment ", &sv101->uni_comment, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Inits a SRV_INFO_102 structure. + ********************************************************************/ + +void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, const char *name, + const char *comment, uint32 ver_major, uint32 ver_minor, + uint32 srv_type, uint32 users, uint32 disc, uint32 hidden, + uint32 announce, uint32 ann_delta, uint32 licenses, + const char *usr_path) +{ + DEBUG(5,("init_srv_info_102\n")); + + sv102->platform_id = platform_id; + init_buf_unistr2(&sv102->uni_name, &sv102->ptr_name, name); + sv102->ver_major = ver_major; + sv102->ver_minor = ver_minor; + sv102->srv_type = srv_type; + init_buf_unistr2(&sv102->uni_comment, &sv102->ptr_comment, comment); + + /* same as 101 up to here */ + + sv102->users = users; + sv102->disc = disc; + sv102->hidden = hidden; + sv102->announce = announce; + sv102->ann_delta = ann_delta; + sv102->licenses = licenses; + init_buf_unistr2(&sv102->uni_usr_path, &sv102->ptr_usr_path, usr_path); +} + + +/******************************************************************* + Reads or writes a SRV_INFO_102 structure. + ********************************************************************/ + +static BOOL srv_io_info_102(const char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth) +{ + if (sv102 == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_info102"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("platform_id ", ps, depth, &sv102->platform_id)) + return False; + if(!prs_uint32("ptr_name ", ps, depth, &sv102->ptr_name)) + return False; + if(!prs_uint32("ver_major ", ps, depth, &sv102->ver_major)) + return False; + if(!prs_uint32("ver_minor ", ps, depth, &sv102->ver_minor)) + return False; + if(!prs_uint32("srv_type ", ps, depth, &sv102->srv_type)) + return False; + if(!prs_uint32("ptr_comment ", ps, depth, &sv102->ptr_comment)) + return False; + + /* same as 101 up to here */ + + if(!prs_uint32("users ", ps, depth, &sv102->users)) + return False; + if(!prs_uint32("disc ", ps, depth, &sv102->disc)) + return False; + if(!prs_uint32("hidden ", ps, depth, &sv102->hidden)) + return False; + if(!prs_uint32("announce ", ps, depth, &sv102->announce)) + return False; + if(!prs_uint32("ann_delta ", ps, depth, &sv102->ann_delta)) + return False; + if(!prs_uint32("licenses ", ps, depth, &sv102->licenses)) + return False; + if(!prs_uint32("ptr_usr_path", ps, depth, &sv102->ptr_usr_path)) + return False; + + if(!smb_io_unistr2("uni_name ", &sv102->uni_name, True, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("uni_comment ", &sv102->uni_comment, True, ps, depth)) + return False; + if(!prs_align(ps)) + return False; + if(!smb_io_unistr2("uni_usr_path", &sv102->uni_usr_path, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a SRV_INFO_102 structure. + ********************************************************************/ + +static BOOL srv_io_info_ctr(const char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) +{ + if (ctr == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_info_ctr"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) + return False; + if(!prs_uint32("ptr_srv_ctr ", ps, depth, &ctr->ptr_srv_ctr)) + return False; + + if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL) { + switch (ctr->switch_value) { + case 100: + if(!srv_io_info_100("sv100", &ctr->srv.sv100, ps, depth)) + return False; + break; + case 101: + if(!srv_io_info_101("sv101", &ctr->srv.sv101, ps, depth)) + return False; + break; + case 102: + if(!srv_io_info_102("sv102", &ctr->srv.sv102, ps, depth)) + return False; + break; + default: + DEBUG(5,("%s no server info at switch_value %d\n", + tab_depth(depth), ctr->switch_value)); + break; + } + if(!prs_align(ps)) + return False; + } + + return True; +} + +/******************************************************************* + Inits a SRV_Q_NET_SRV_GET_INFO structure. + ********************************************************************/ + +void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv, + const char *server_name, uint32 switch_value) +{ + DEBUG(5,("init_srv_q_net_srv_get_info\n")); + + init_buf_unistr2(&srv->uni_srv_name, &srv->ptr_srv_name, server_name); + + srv->switch_value = switch_value; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_srv_get_info(const char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) + return False; + + return True; +} + +/******************************************************************* + Inits a SRV_R_NET_SRV_GET_INFO structure. + ********************************************************************/ + +void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv, + uint32 switch_value, SRV_INFO_CTR *ctr, WERROR status) +{ + DEBUG(5,("init_srv_r_net_srv_get_info\n")); + + srv->ctr = ctr; + + if (W_ERROR_IS_OK(status)) { + srv->ctr->switch_value = switch_value; + srv->ctr->ptr_srv_ctr = 1; + } else { + srv->ctr->switch_value = 0; + srv->ctr->ptr_srv_ctr = 0; + } + + srv->status = status; +} + +/******************************************************************* + Inits a SRV_R_NET_SRV_SET_INFO structure. + ********************************************************************/ + +void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv, + uint32 switch_value, WERROR status) +{ + DEBUG(5,("init_srv_r_net_srv_set_info\n")); + + srv->switch_value = switch_value; + srv->status = status; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_srv_set_info(const char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) + return False; + + if (UNMARSHALLING(ps)) { + q_n->ctr = PRS_ALLOC_MEM(ps, SRV_INFO_CTR, 1); + + if (!q_n->ctr) + return False; + } + + if(!srv_io_info_ctr("ctr", q_n->ctr, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. + ********************************************************************/ + +BOOL srv_io_r_net_srv_get_info(const char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth)) + return False; + + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. + ********************************************************************/ + +BOOL srv_io_r_net_srv_set_info(const char *desc, SRV_R_NET_SRV_SET_INFO *r_n, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "srv_io_r_net_srv_set_info"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("switch value ", ps, depth, &r_n->switch_value)) + return False; + + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. + ********************************************************************/ + +BOOL srv_io_q_net_remote_tod(const char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a TIME_OF_DAY_INFO structure. + ********************************************************************/ + +static BOOL srv_io_time_of_day_info(const char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth) +{ + if (tod == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_time_of_day_info"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("elapsedt ", ps, depth, &tod->elapsedt)) + return False; + if(!prs_uint32("msecs ", ps, depth, &tod->msecs)) + return False; + if(!prs_uint32("hours ", ps, depth, &tod->hours)) + return False; + if(!prs_uint32("mins ", ps, depth, &tod->mins)) + return False; + if(!prs_uint32("secs ", ps, depth, &tod->secs)) + return False; + if(!prs_uint32("hunds ", ps, depth, &tod->hunds)) + return False; + if(!prs_uint32("timezone ", ps, depth, &tod->zone)) + return False; + if(!prs_uint32("tintervals ", ps, depth, &tod->tintervals)) + return False; + if(!prs_uint32("day ", ps, depth, &tod->day)) + return False; + if(!prs_uint32("month ", ps, depth, &tod->month)) + return False; + if(!prs_uint32("year ", ps, depth, &tod->year)) + return False; + if(!prs_uint32("weekday ", ps, depth, &tod->weekday)) + return False; + + return True; +} + +/******************************************************************* + Inits a TIME_OF_DAY_INFO structure. + ********************************************************************/ + +void init_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs, + uint32 hours, uint32 mins, uint32 secs, uint32 hunds, + uint32 zone, uint32 tintervals, uint32 day, + uint32 month, uint32 year, uint32 weekday) +{ + DEBUG(5,("init_time_of_day_info\n")); + + tod->elapsedt = elapsedt; + tod->msecs = msecs; + tod->hours = hours; + tod->mins = mins; + tod->secs = secs; + tod->hunds = hunds; + tod->zone = zone; + tod->tintervals = tintervals; + tod->day = day; + tod->month = month; + tod->year = year; + tod->weekday = weekday; +} + + +/******************************************************************* + Reads or writes a structure. + ********************************************************************/ + +BOOL srv_io_r_net_remote_tod(const char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_tod ", ps, depth, &r_n->ptr_srv_tod)) + return False; + + if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth)) + return False; + + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} + +/******************************************************************* + initialises a structure. + ********************************************************************/ + +BOOL init_srv_q_net_disk_enum(SRV_Q_NET_DISK_ENUM *q_n, + const char *srv_name, + uint32 preferred_len, + ENUM_HND *enum_hnd + ) +{ + + + DEBUG(5,("init_srv_q_net_srv_disk_enum\n")); + + init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); + + q_n->disk_enum_ctr.level = 0; + q_n->disk_enum_ctr.disk_info_ptr = 0; + + q_n->preferred_len = preferred_len; + memcpy(&q_n->enum_hnd, enum_hnd, sizeof(*enum_hnd)); + + return True; +} + +/******************************************************************* + Reads or writes a structure. + ********************************************************************/ + +BOOL srv_io_q_net_disk_enum(const char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_disk_enum"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("level", ps, depth, &q_n->disk_enum_ctr.level)) + return False; + + if(!prs_uint32("entries_read", ps, depth, &q_n->disk_enum_ctr.entries_read)) + return False; + + if(!prs_uint32("buffer", ps, depth, &q_n->disk_enum_ctr.disk_info_ptr)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) + return False; + if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. + ********************************************************************/ + +BOOL srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth) +{ + + unsigned int i; + uint32 entries_read, entries_read2, entries_read3; + + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_disk_enum"); + depth++; + + entries_read = entries_read2 = entries_read3 = r_n->disk_enum_ctr.entries_read; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("entries_read", ps, depth, &entries_read)) + return False; + if(!prs_uint32("ptr_disk_info", ps, depth, &r_n->disk_enum_ctr.disk_info_ptr)) + return False; + + /*this may be max, unknown, actual?*/ + + if(!prs_uint32("max_elements", ps, depth, &entries_read2)) + return False; + if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.unknown)) + return False; + if(!prs_uint32("actual_elements", ps, depth, &entries_read3)) + return False; + + r_n->disk_enum_ctr.entries_read = entries_read3; + + if(UNMARSHALLING(ps) && entries_read3) { + + DISK_INFO *dinfo; + + if(!(dinfo = PRS_ALLOC_MEM(ps, DISK_INFO, entries_read3))) + return False; + r_n->disk_enum_ctr.disk_info = dinfo; + } + + for(i=0; i < entries_read3; i++) { + + if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.disk_info[i].unknown)) + return False; + + if(!smb_io_unistr3("disk_name", &r_n->disk_enum_ctr.disk_info[i].disk_name, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + } + + if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) + return False; + + if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) + return False; + + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. + ********************************************************************/ + +BOOL srv_io_q_net_name_validate(const char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_name_validate"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_pointer("servername", ps, depth, (void*)&q_n->servername, + sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) + return False; + + if(!prs_align(ps)) + return False; + + if(!smb_io_unistr2("", &q_n->sharename, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("type", ps, depth, &q_n->type)) + return False; + + if(!prs_uint32("flags", ps, depth, &q_n->flags)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. + ********************************************************************/ + +BOOL srv_io_r_net_name_validate(const char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_name_validate"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_file_query_secdesc(const char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_file_query_secdesc"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth)) + return False; + + if(!prs_uint32("unknown1", ps, depth, &q_n->unknown1)) + return False; + + if(!prs_uint32("unknown2", ps, depth, &q_n->unknown2)) + return False; + + if(!prs_uint32("unknown3", ps, depth, &q_n->unknown3)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_file_query_secdesc(const char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_file_query_secdesc"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_response", ps, depth, &r_n->ptr_response)) + return False; + + if(!prs_uint32("size_response", ps, depth, &r_n->size_response)) + return False; + + if(!prs_uint32("ptr_secdesc", ps, depth, &r_n->ptr_secdesc)) + return False; + + if(!prs_uint32("size_secdesc", ps, depth, &r_n->size_secdesc)) + return False; + + if(!sec_io_desc("sec_desc", &r_n->sec_desc, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_file_set_secdesc(const char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_file_set_secdesc"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("sec_info", ps, depth, &q_n->sec_info)) + return False; + + if(!prs_uint32("size_set", ps, depth, &q_n->size_set)) + return False; + + if(!prs_uint32("ptr_secdesc", ps, depth, &q_n->ptr_secdesc)) + return False; + + if(!prs_uint32("size_secdesc", ps, depth, &q_n->size_secdesc)) + return False; + + if(!sec_io_desc("sec_desc", &q_n->sec_desc, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth) +{ + if (r_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_file_set_secdesc"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} + +/******************************************************************* + Inits a structure +********************************************************************/ + +void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server) +{ + q_u->ptr_srv_name = 1; + init_unistr2(&q_u->uni_srv_name, server, UNI_STR_TERMINATE); +} + -- cgit From 30191d1a5704ad2b158386b511558972d539ce47 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Oct 2007 17:40:25 -0700 Subject: RIP BOOL. Convert BOOL -> bool. I found a few interesting bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f) --- source3/rpc_parse/parse_buffer.c | 14 +- source3/rpc_parse/parse_ds.c | 16 +- source3/rpc_parse/parse_eventlog.c | 22 +- source3/rpc_parse/parse_lsa.c | 236 +++++++++---------- source3/rpc_parse/parse_misc.c | 94 ++++---- source3/rpc_parse/parse_net.c | 130 +++++------ source3/rpc_parse/parse_ntsvcs.c | 28 +-- source3/rpc_parse/parse_prs.c | 104 ++++----- source3/rpc_parse/parse_rpc.c | 34 +-- source3/rpc_parse/parse_samr.c | 304 ++++++++++++------------- source3/rpc_parse/parse_sec.c | 10 +- source3/rpc_parse/parse_spoolss.c | 450 ++++++++++++++++++------------------- source3/rpc_parse/parse_srv.c | 142 ++++++------ source3/rpc_parse/parse_svcctl.c | 76 +++---- 14 files changed, 830 insertions(+), 830 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index b716d0cd47..c30ad487dd 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -42,7 +42,7 @@ void rpcbuf_init(RPC_BUFFER *buffer, uint32 size, TALLOC_CTX *ctx) Read/write a RPC_BUFFER struct. ********************************************************************/ -BOOL prs_rpcbuffer(const char *desc, prs_struct *ps, int depth, RPC_BUFFER *buffer) +bool prs_rpcbuffer(const char *desc, prs_struct *ps, int depth, RPC_BUFFER *buffer) { prs_debug(ps, depth, desc, "prs_rpcbuffer"); depth++; @@ -77,7 +77,7 @@ BOOL prs_rpcbuffer(const char *desc, prs_struct *ps, int depth, RPC_BUFFER *buff return True; } else { - BOOL ret = False; + bool ret = False; if (!prs_uint32("size", ps, depth, &buffer->size)) goto out; @@ -99,7 +99,7 @@ BOOL prs_rpcbuffer(const char *desc, prs_struct *ps, int depth, RPC_BUFFER *buff Read/write an RPC_BUFFER* struct.(allocate memory if unmarshalling) ********************************************************************/ -BOOL prs_rpcbuffer_p(const char *desc, prs_struct *ps, int depth, RPC_BUFFER **buffer) +bool prs_rpcbuffer_p(const char *desc, prs_struct *ps, int depth, RPC_BUFFER **buffer) { uint32 data_p; @@ -132,7 +132,7 @@ BOOL prs_rpcbuffer_p(const char *desc, prs_struct *ps, int depth, RPC_BUFFER **b Allocate more memory for a RPC_BUFFER. ****************************************************************************/ -BOOL rpcbuf_alloc_size(RPC_BUFFER *buffer, uint32 buffer_size) +bool rpcbuf_alloc_size(RPC_BUFFER *buffer, uint32 buffer_size) { prs_struct *ps; uint32 extra_space; @@ -227,7 +227,7 @@ uint32 rpcbuf_get_size(RPC_BUFFER *buffer) * ********************************************************************/ -BOOL smb_io_relstr(const char *desc, RPC_BUFFER *buffer, int depth, UNISTR *string) +bool smb_io_relstr(const char *desc, RPC_BUFFER *buffer, int depth, UNISTR *string) { prs_struct *ps=&buffer->prs; @@ -289,7 +289,7 @@ BOOL smb_io_relstr(const char *desc, RPC_BUFFER *buffer, int depth, UNISTR *stri * used by 2 RPC structs ********************************************************************/ -BOOL smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16 **string) +bool smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16 **string) { UNISTR chaine; @@ -416,7 +416,7 @@ BOOL smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16 Parse a DEVMODE structure and its relative pointer. ********************************************************************/ -BOOL smb_io_relsecdesc(const char *desc, RPC_BUFFER *buffer, int depth, SEC_DESC **secdesc) +bool smb_io_relsecdesc(const char *desc, RPC_BUFFER *buffer, int depth, SEC_DESC **secdesc) { prs_struct *ps= &buffer->prs; diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index 58cc136d28..8f3ce361e7 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -23,7 +23,7 @@ /************************************************************************ ************************************************************************/ -static BOOL ds_io_dominfobasic(const char *desc, DSROLE_PRIMARY_DOMAIN_INFO_BASIC **basic, prs_struct *ps, int depth) +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; @@ -75,7 +75,7 @@ static BOOL ds_io_dominfobasic(const char *desc, DSROLE_PRIMARY_DOMAIN_INFO_BASI /************************************************************************ ************************************************************************/ -BOOL ds_io_q_getprimdominfo( const char *desc, DS_Q_GETPRIMDOMINFO *q_u, prs_struct *ps, int depth) +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++; @@ -92,7 +92,7 @@ BOOL ds_io_q_getprimdominfo( const char *desc, DS_Q_GETPRIMDOMINFO *q_u, prs_str /************************************************************************ ************************************************************************/ -BOOL ds_io_r_getprimdominfo( const char *desc, DS_R_GETPRIMDOMINFO *r_u, prs_struct *ps, int depth) +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++; @@ -135,7 +135,7 @@ BOOL ds_io_r_getprimdominfo( const char *desc, DS_R_GETPRIMDOMINFO *r_u, prs_str 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 ) +bool init_q_ds_enum_domain_trusts( DS_Q_ENUM_DOM_TRUSTS *q, const char *server, uint32 flags ) { q->flags = flags; @@ -152,7 +152,7 @@ BOOL init_q_ds_enum_domain_trusts( DS_Q_ENUM_DOM_TRUSTS *q, const char *server, /************************************************************************ ************************************************************************/ -static BOOL ds_io_domain_trusts( const char *desc, DS_DOMAIN_TRUSTS *trust, prs_struct *ps, int depth) +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++; @@ -187,7 +187,7 @@ static BOOL ds_io_domain_trusts( const char *desc, DS_DOMAIN_TRUSTS *trust, prs_ /************************************************************************ ************************************************************************/ -static BOOL ds_io_dom_trusts_ctr( const char *desc, DS_DOMAIN_TRUSTS_CTR *ctr, prs_struct *ps, int depth) +static bool ds_io_dom_trusts_ctr( const char *desc, DS_DOMAIN_TRUSTS_CTR *ctr, prs_struct *ps, int depth) { int i; @@ -247,7 +247,7 @@ static BOOL ds_io_dom_trusts_ctr( const char *desc, DS_DOMAIN_TRUSTS_CTR *ctr, p 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) +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++; @@ -273,7 +273,7 @@ BOOL ds_io_q_enum_domain_trusts( const char *desc, DS_Q_ENUM_DOM_TRUSTS *q_u, pr /************************************************************************ ************************************************************************/ -BOOL ds_io_r_enum_domain_trusts( const char *desc, DS_R_ENUM_DOM_TRUSTS *r_u, prs_struct *ps, int depth) +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++; diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index e92e5e24c6..70226bca15 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -25,7 +25,7 @@ /******************************************************************** ********************************************************************/ -BOOL prs_ev_open_unknown0( const char *desc, prs_struct *ps, int depth, EVENTLOG_OPEN_UNKNOWN0 *u ) +bool prs_ev_open_unknown0( const char *desc, prs_struct *ps, int depth, EVENTLOG_OPEN_UNKNOWN0 *u ) { if ( !u ) return False; @@ -41,7 +41,7 @@ BOOL prs_ev_open_unknown0( const char *desc, prs_struct *ps, int depth, EVENTLOG /******************************************************************** ********************************************************************/ -BOOL eventlog_io_q_open_eventlog(const char *desc, EVENTLOG_Q_OPEN_EVENTLOG *q_u, +bool eventlog_io_q_open_eventlog(const char *desc, EVENTLOG_Q_OPEN_EVENTLOG *q_u, prs_struct *ps, int depth) { if(q_u == NULL) @@ -74,7 +74,7 @@ BOOL eventlog_io_q_open_eventlog(const char *desc, EVENTLOG_Q_OPEN_EVENTLOG *q_u return True; } -BOOL eventlog_io_r_open_eventlog(const char *desc, EVENTLOG_R_OPEN_EVENTLOG *r_u, +bool eventlog_io_r_open_eventlog(const char *desc, EVENTLOG_R_OPEN_EVENTLOG *r_u, prs_struct *ps, int depth) { if(r_u == NULL) @@ -95,7 +95,7 @@ BOOL eventlog_io_r_open_eventlog(const char *desc, EVENTLOG_R_OPEN_EVENTLOG *r_u return True; } -BOOL eventlog_io_q_get_num_records(const char *desc, EVENTLOG_Q_GET_NUM_RECORDS *q_u, +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) @@ -113,7 +113,7 @@ BOOL eventlog_io_q_get_num_records(const char *desc, EVENTLOG_Q_GET_NUM_RECORDS return True; } -BOOL eventlog_io_r_get_num_records(const char *desc, EVENTLOG_R_GET_NUM_RECORDS *r_u, +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) @@ -134,7 +134,7 @@ BOOL eventlog_io_r_get_num_records(const char *desc, EVENTLOG_R_GET_NUM_RECORDS return True; } -BOOL eventlog_io_q_get_oldest_entry(const char *desc, EVENTLOG_Q_GET_OLDEST_ENTRY *q_u, +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) @@ -152,7 +152,7 @@ BOOL eventlog_io_q_get_oldest_entry(const char *desc, EVENTLOG_Q_GET_OLDEST_ENTR return True; } -BOOL eventlog_io_r_get_oldest_entry(const char *desc, EVENTLOG_R_GET_OLDEST_ENTRY *r_u, +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) @@ -173,7 +173,7 @@ BOOL eventlog_io_r_get_oldest_entry(const char *desc, EVENTLOG_R_GET_OLDEST_ENTR return True; } -BOOL eventlog_io_q_read_eventlog(const char *desc, EVENTLOG_Q_READ_EVENTLOG *q_u, +bool eventlog_io_q_read_eventlog(const char *desc, EVENTLOG_Q_READ_EVENTLOG *q_u, prs_struct *ps, int depth) { if(q_u == NULL) @@ -206,7 +206,7 @@ BOOL eventlog_io_q_read_eventlog(const char *desc, EVENTLOG_Q_READ_EVENTLOG *q_u DWORD sent_size -- sum of EVENTLOGRECORD lengths if records returned, 0 otherwise DWORD real_size -- 0 if records returned, otherwise length of next record to be returned WERROR status */ -BOOL eventlog_io_r_read_eventlog(const char *desc, +bool eventlog_io_r_read_eventlog(const char *desc, EVENTLOG_Q_READ_EVENTLOG *q_u, EVENTLOG_R_READ_EVENTLOG *r_u, prs_struct *ps, @@ -354,7 +354,7 @@ BOOL eventlog_io_r_read_eventlog(const char *desc, 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, +bool eventlog_io_q_clear_eventlog(const char *desc, EVENTLOG_Q_CLEAR_EVENTLOG *q_u, prs_struct *ps, int depth) { if(q_u == NULL) @@ -375,7 +375,7 @@ BOOL eventlog_io_q_clear_eventlog(const char *desc, EVENTLOG_Q_CLEAR_EVENTLOG *q } -BOOL eventlog_io_r_clear_eventlog(const char *desc, EVENTLOG_R_CLEAR_EVENTLOG *r_u, +bool eventlog_io_r_clear_eventlog(const char *desc, EVENTLOG_R_CLEAR_EVENTLOG *r_u, prs_struct *ps, int depth) { if(r_u == NULL) diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 15d7d80c03..59fce4a904 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -27,8 +27,8 @@ #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); +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. @@ -47,7 +47,7 @@ void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, Reads or writes a LSA_TRANS_NAME structure. ********************************************************************/ -static BOOL lsa_io_trans_name(const char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, +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"); @@ -87,7 +87,7 @@ void init_lsa_trans_name2(LSA_TRANS_NAME2 *trn, UNISTR2 *uni_name, Reads or writes a LSA_TRANS_NAME2 structure. ********************************************************************/ -static BOOL lsa_io_trans_name2(const char *desc, LSA_TRANS_NAME2 *trn, prs_struct *ps, +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"); @@ -115,7 +115,7 @@ static BOOL lsa_io_trans_name2(const char *desc, LSA_TRANS_NAME2 *trn, prs_struc 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) +static bool lsa_io_dom_r_ref(const char *desc, DOM_R_REF *dom, prs_struct *ps, int depth) { unsigned int i; @@ -193,7 +193,7 @@ void init_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 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, +static bool lsa_io_sec_qos(const char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int depth) { uint32 start; @@ -253,7 +253,7 @@ static void init_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS Reads or writes an LSA_OBJ_ATTR structure. ********************************************************************/ -static BOOL lsa_io_obj_attr(const char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, +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"); @@ -314,7 +314,7 @@ void init_q_open_pol(LSA_Q_OPEN_POL *in, uint16 system_name, 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, +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"); @@ -340,7 +340,7 @@ BOOL lsa_io_q_open_pol(const char *desc, LSA_Q_OPEN_POL *in, prs_struct *ps, 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, +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"); @@ -379,7 +379,7 @@ void init_q_open_pol2(LSA_Q_OPEN_POL2 *in, const char *server_name, 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, +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"); @@ -403,7 +403,7 @@ BOOL lsa_io_q_open_pol2(const char *desc, LSA_Q_OPEN_POL2 *in, prs_struct *ps, 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, +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"); @@ -437,7 +437,7 @@ void init_q_query_sec_obj(LSA_Q_QUERY_SEC_OBJ *in, const POLICY_HND *hnd, 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, +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"); @@ -456,7 +456,7 @@ BOOL lsa_io_q_query_sec_obj(const char *desc, LSA_Q_QUERY_SEC_OBJ *in, 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) +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++; @@ -495,7 +495,7 @@ void init_q_query(LSA_Q_QUERY_INFO *in, POLICY_HND *hnd, uint16 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, +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"); @@ -513,7 +513,7 @@ BOOL lsa_io_q_query(const char *desc, LSA_Q_QUERY_INFO *in, prs_struct *ps, /******************************************************************* makes an LSA_Q_ENUM_TRUST_DOM structure. ********************************************************************/ -BOOL init_q_enum_trust_dom(LSA_Q_ENUM_TRUST_DOM * q_e, POLICY_HND *pol, +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")); @@ -529,7 +529,7 @@ BOOL init_q_enum_trust_dom(LSA_Q_ENUM_TRUST_DOM * q_e, POLICY_HND *pol, 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, +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"); @@ -611,7 +611,7 @@ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *out, /******************************************************************* ********************************************************************/ -BOOL lsa_io_domain_list( const char *desc, prs_struct *ps, int depth, DOMAIN_LIST *domlist ) +bool lsa_io_domain_list( const char *desc, prs_struct *ps, int depth, DOMAIN_LIST *domlist ) { int i; @@ -654,7 +654,7 @@ BOOL lsa_io_domain_list( const char *desc, prs_struct *ps, int depth, DOMAIN_LIS 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, +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"); @@ -679,7 +679,7 @@ BOOL lsa_io_r_enum_trust_dom(const char *desc, LSA_R_ENUM_TRUST_DOM *out, 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) +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; @@ -712,7 +712,7 @@ static BOOL lsa_io_dom_query_1(const char *desc, DOM_QUERY_1 *d_q, prs_struct *p 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) +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; @@ -760,7 +760,7 @@ static BOOL lsa_io_dom_query_2(const char *desc, DOM_QUERY_2 *d_q, prs_struct *p 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) +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; @@ -801,7 +801,7 @@ static BOOL lsa_io_dom_query_3(const char *desc, DOM_QUERY_3 *d_q, prs_struct *p 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) +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); } @@ -810,7 +810,7 @@ static BOOL lsa_io_dom_query_5(const char *desc, DOM_QUERY_5 *d_q, prs_struct *p 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) +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; @@ -828,7 +828,7 @@ static BOOL lsa_io_dom_query_6(const char *desc, DOM_QUERY_6 *d_q, prs_struct *p 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) +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; @@ -846,7 +846,7 @@ static BOOL lsa_io_dom_query_10(const char *desc, DOM_QUERY_10 *d_q, prs_struct 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) +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; @@ -868,7 +868,7 @@ static BOOL lsa_io_dom_query_11(const char *desc, DOM_QUERY_11 *d_q, prs_struct 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) +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++; @@ -929,7 +929,7 @@ void init_q_set(LSA_Q_SET_INFO *in, POLICY_HND *hnd, uint16 info_class, LSA_INFO reads or writes a structure. ********************************************************************/ -static BOOL lsa_io_query_info_ctr2(const char *desc, prs_struct *ps, int depth, LSA_INFO_CTR2 *ctr) +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++; @@ -984,7 +984,7 @@ static BOOL lsa_io_query_info_ctr2(const char *desc, prs_struct *ps, int depth, reads or writes a structure. ********************************************************************/ -static BOOL lsa_io_query_info_ctr(const char *desc, prs_struct *ps, int depth, LSA_INFO_CTR *ctr) +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++; @@ -1037,7 +1037,7 @@ static BOOL lsa_io_query_info_ctr(const char *desc, prs_struct *ps, int depth, L 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) +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"); @@ -1068,7 +1068,7 @@ BOOL lsa_io_r_query(const char *desc, LSA_R_QUERY_INFO *out, prs_struct *ps, int Reads or writes an LSA_Q_SET_INFO structure. ********************************************************************/ -BOOL lsa_io_q_set(const char *desc, LSA_Q_SET_INFO *in, prs_struct *ps, +bool lsa_io_q_set(const char *desc, LSA_Q_SET_INFO *in, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_set"); @@ -1093,7 +1093,7 @@ BOOL lsa_io_q_set(const char *desc, LSA_Q_SET_INFO *in, prs_struct *ps, Reads or writes an LSA_R_SET_INFO structure. ********************************************************************/ -BOOL lsa_io_r_set(const char *desc, LSA_R_SET_INFO *out, prs_struct *ps, int depth) +bool lsa_io_r_set(const char *desc, LSA_R_SET_INFO *out, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_set"); depth++; @@ -1148,7 +1148,7 @@ static void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, Reads or writes a LSA_SID_ENUM structure. ********************************************************************/ -static BOOL lsa_io_sid_enum(const char *desc, LSA_SID_ENUM *sen, prs_struct *ps, +static bool lsa_io_sid_enum(const char *desc, LSA_SID_ENUM *sen, prs_struct *ps, int depth) { unsigned int i; @@ -1234,7 +1234,7 @@ void init_q_lookup_sids(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_SIDS *q_l, 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, +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"); @@ -1265,7 +1265,7 @@ BOOL lsa_io_q_lookup_sids(const char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct * 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, +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"); @@ -1300,7 +1300,7 @@ BOOL lsa_io_q_lookup_sids2(const char *desc, LSA_Q_LOOKUP_SIDS2 *q_s, prs_struct 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, +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"); @@ -1334,7 +1334,7 @@ BOOL lsa_io_q_lookup_sids3(const char *desc, LSA_Q_LOOKUP_SIDS3 *q_s, prs_struct Reads or writes a structure. ********************************************************************/ -static BOOL lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, +static bool lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth) { unsigned int i; @@ -1396,7 +1396,7 @@ static BOOL lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, Reads or writes a structure. ********************************************************************/ -static BOOL lsa_io_trans_names2(const char *desc, LSA_TRANS_NAME_ENUM2 *trn, +static bool lsa_io_trans_names2(const char *desc, LSA_TRANS_NAME_ENUM2 *trn, prs_struct *ps, int depth) { unsigned int i; @@ -1459,7 +1459,7 @@ static BOOL lsa_io_trans_names2(const char *desc, LSA_TRANS_NAME_ENUM2 *trn, Reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_lookup_sids(const char *desc, LSA_R_LOOKUP_SIDS *r_s, +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"); @@ -1494,7 +1494,7 @@ BOOL lsa_io_r_lookup_sids(const char *desc, LSA_R_LOOKUP_SIDS *r_s, Reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_lookup_sids2(const char *desc, LSA_R_LOOKUP_SIDS2 *r_s, +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"); @@ -1530,7 +1530,7 @@ BOOL lsa_io_r_lookup_sids2(const char *desc, LSA_R_LOOKUP_SIDS2 *r_s, Reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_lookup_sids3(const char *desc, LSA_R_LOOKUP_SIDS3 *r_s, +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"); @@ -1605,7 +1605,7 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, reads or writes a structure. ********************************************************************/ -BOOL lsa_io_q_lookup_names(const char *desc, LSA_Q_LOOKUP_NAMES *q_r, +bool lsa_io_q_lookup_names(const char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth) { unsigned int i; @@ -1669,7 +1669,7 @@ BOOL lsa_io_q_lookup_names(const char *desc, LSA_Q_LOOKUP_NAMES *q_r, reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *out, prs_struct *ps, int depth) +bool lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *out, prs_struct *ps, int depth) { unsigned int i; @@ -1726,7 +1726,7 @@ BOOL lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *out, prs_struct reads or writes a structure. ********************************************************************/ -BOOL lsa_io_q_lookup_names2(const char *desc, LSA_Q_LOOKUP_NAMES2 *q_r, +bool lsa_io_q_lookup_names2(const char *desc, LSA_Q_LOOKUP_NAMES2 *q_r, prs_struct *ps, int depth) { unsigned int i; @@ -1794,7 +1794,7 @@ BOOL lsa_io_q_lookup_names2(const char *desc, LSA_Q_LOOKUP_NAMES2 *q_r, reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_lookup_names2(const char *desc, LSA_R_LOOKUP_NAMES2 *out, prs_struct *ps, int depth) +bool lsa_io_r_lookup_names2(const char *desc, LSA_R_LOOKUP_NAMES2 *out, prs_struct *ps, int depth) { unsigned int i; @@ -1852,7 +1852,7 @@ BOOL lsa_io_r_lookup_names2(const char *desc, LSA_R_LOOKUP_NAMES2 *out, prs_stru Following pass must read DOM_SID2 types. ********************************************************************/ -BOOL smb_io_lsa_translated_sids3(const char *desc, LSA_TRANSLATED_SID3 *q_r, +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"); @@ -1879,7 +1879,7 @@ BOOL smb_io_lsa_translated_sids3(const char *desc, LSA_TRANSLATED_SID3 *q_r, Identical to lsa_io_q_lookup_names2. ********************************************************************/ -BOOL lsa_io_q_lookup_names3(const char *desc, LSA_Q_LOOKUP_NAMES3 *q_r, +bool lsa_io_q_lookup_names3(const char *desc, LSA_Q_LOOKUP_NAMES3 *q_r, prs_struct *ps, int depth) { unsigned int i; @@ -1947,7 +1947,7 @@ BOOL lsa_io_q_lookup_names3(const char *desc, LSA_Q_LOOKUP_NAMES3 *q_r, reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_lookup_names3(const char *desc, LSA_R_LOOKUP_NAMES3 *out, prs_struct *ps, int depth) +bool lsa_io_r_lookup_names3(const char *desc, LSA_R_LOOKUP_NAMES3 *out, prs_struct *ps, int depth) { unsigned int i; @@ -2013,7 +2013,7 @@ BOOL lsa_io_r_lookup_names3(const char *desc, LSA_R_LOOKUP_NAMES3 *out, prs_stru /******************************************************************* ********************************************************************/ -BOOL lsa_io_q_lookup_names4(const char *desc, LSA_Q_LOOKUP_NAMES4 *q_r, +bool lsa_io_q_lookup_names4(const char *desc, LSA_Q_LOOKUP_NAMES4 *q_r, prs_struct *ps, int depth) { unsigned int i; @@ -2076,7 +2076,7 @@ BOOL lsa_io_q_lookup_names4(const char *desc, LSA_Q_LOOKUP_NAMES4 *q_r, 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) +bool lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_struct *ps, int depth) { unsigned int i; @@ -2143,7 +2143,7 @@ BOOL lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_stru 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) +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++; @@ -2169,7 +2169,7 @@ BOOL lsa_io_q_open_secret(const char *desc, LSA_Q_OPEN_SECRET *in, prs_struct *p 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) +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++; @@ -2203,7 +2203,7 @@ void init_q_enum_privs(LSA_Q_ENUM_PRIVS *in, POLICY_HND *hnd, uint32 enum_contex /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_q_enum_privs(const char *desc, LSA_Q_ENUM_PRIVS *in, prs_struct *ps, int depth) +bool lsa_io_q_enum_privs(const char *desc, LSA_Q_ENUM_PRIVS *in, prs_struct *ps, int depth) { if (in == NULL) return False; @@ -2225,7 +2225,7 @@ BOOL lsa_io_q_enum_privs(const char *desc, LSA_Q_ENUM_PRIVS *in, prs_struct *ps, /******************************************************************* 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) +static bool lsa_io_priv_entries(const char *desc, LSA_PRIV_ENTRY *entries, uint32 count, prs_struct *ps, int depth) { uint32 i; @@ -2280,7 +2280,7 @@ void init_lsa_r_enum_privs(LSA_R_ENUM_PRIVS *out, uint32 enum_context, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_enum_privs(const char *desc, LSA_R_ENUM_PRIVS *out, prs_struct *ps, int depth) +bool lsa_io_r_enum_privs(const char *desc, LSA_R_ENUM_PRIVS *out, prs_struct *ps, int depth) { if (out == NULL) return False; @@ -2332,7 +2332,7 @@ void init_lsa_priv_get_dispname(LSA_Q_PRIV_GET_DISPNAME *trn, POLICY_HND *hnd, c /******************************************************************* 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) +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; @@ -2363,7 +2363,7 @@ BOOL lsa_io_q_priv_get_dispname(const char *desc, LSA_Q_PRIV_GET_DISPNAME *in, p /******************************************************************* 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) +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; @@ -2413,7 +2413,7 @@ void init_lsa_q_enum_accounts(LSA_Q_ENUM_ACCOUNTS *trn, POLICY_HND *hnd, uint32 /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_q_enum_accounts(const char *desc, LSA_Q_ENUM_ACCOUNTS *in, prs_struct *ps, int depth) +bool lsa_io_q_enum_accounts(const char *desc, LSA_Q_ENUM_ACCOUNTS *in, prs_struct *ps, int depth) { if (in == NULL) return False; @@ -2456,7 +2456,7 @@ void init_lsa_r_enum_accounts(LSA_R_ENUM_ACCOUNTS *out, uint32 enum_context) /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL lsa_io_r_enum_accounts(const char *desc, LSA_R_ENUM_ACCOUNTS *out, prs_struct *ps, int depth) +bool lsa_io_r_enum_accounts(const char *desc, LSA_R_ENUM_ACCOUNTS *out, prs_struct *ps, int depth) { if (out == NULL) return False; @@ -2487,7 +2487,7 @@ BOOL lsa_io_r_enum_accounts(const char *desc, LSA_R_ENUM_ACCOUNTS *out, prs_stru 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) +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++; @@ -2519,7 +2519,7 @@ BOOL lsa_io_q_unk_get_connuser(const char *desc, LSA_Q_UNK_GET_CONNUSER *in, prs 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) +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++; @@ -2569,7 +2569,7 @@ void init_lsa_q_create_account(LSA_Q_CREATEACCOUNT *trn, POLICY_HND *hnd, DOM_SI 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) +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++; @@ -2593,7 +2593,7 @@ BOOL lsa_io_q_create_account(const char *desc, LSA_Q_CREATEACCOUNT *out, prs_str 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) +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++; @@ -2623,7 +2623,7 @@ void init_lsa_q_open_account(LSA_Q_OPENACCOUNT *trn, POLICY_HND *hnd, DOM_SID *s 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) +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++; @@ -2647,7 +2647,7 @@ BOOL lsa_io_q_open_account(const char *desc, LSA_Q_OPENACCOUNT *out, prs_struct 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) +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++; @@ -2675,7 +2675,7 @@ void init_lsa_q_enum_privsaccount(LSA_Q_ENUMPRIVSACCOUNT *trn, POLICY_HND *hnd) 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) +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++; @@ -2693,7 +2693,7 @@ BOOL lsa_io_q_enum_privsaccount(const char *desc, LSA_Q_ENUMPRIVSACCOUNT *out, p Reads or writes an LUID structure. ********************************************************************/ -static BOOL lsa_io_luid(const char *desc, LUID *out, prs_struct *ps, int depth) +static bool lsa_io_luid(const char *desc, LUID *out, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_luid"); depth++; @@ -2714,7 +2714,7 @@ static BOOL lsa_io_luid(const char *desc, LUID *out, prs_struct *ps, int depth) Reads or writes an LUID_ATTR structure. ********************************************************************/ -static BOOL lsa_io_luid_attr(const char *desc, LUID_ATTR *out, prs_struct *ps, int depth) +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++; @@ -2735,7 +2735,7 @@ static BOOL lsa_io_luid_attr(const char *desc, LUID_ATTR *out, prs_struct *ps, i Reads or writes an PRIVILEGE_SET structure. ********************************************************************/ -static BOOL lsa_io_privilege_set(const char *desc, PRIVILEGE_SET *out, prs_struct *ps, int depth) +static bool lsa_io_privilege_set(const char *desc, PRIVILEGE_SET *out, prs_struct *ps, int depth) { uint32 i, dummy; @@ -2782,7 +2782,7 @@ NTSTATUS init_lsa_r_enum_privsaccount(TALLOC_CTX *mem_ctx, LSA_R_ENUMPRIVSACCOUN 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) +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++; @@ -2824,7 +2824,7 @@ BOOL lsa_io_r_enum_privsaccount(const char *desc, LSA_R_ENUMPRIVSACCOUNT *out, p Reads or writes an LSA_Q_GETSYSTEMACCOUNTstructure. ********************************************************************/ -BOOL lsa_io_q_getsystemaccount(const char *desc, LSA_Q_GETSYSTEMACCOUNT *out, prs_struct *ps, int depth) +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++; @@ -2842,7 +2842,7 @@ BOOL lsa_io_q_getsystemaccount(const char *desc, LSA_Q_GETSYSTEMACCOUNT *out, p Reads or writes an LSA_R_GETSYSTEMACCOUNTstructure. ********************************************************************/ -BOOL lsa_io_r_getsystemaccount(const char *desc, LSA_R_GETSYSTEMACCOUNT *out, prs_struct *ps, int depth) +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++; @@ -2864,7 +2864,7 @@ BOOL lsa_io_r_getsystemaccount(const char *desc, LSA_R_GETSYSTEMACCOUNT *out, p 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) +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++; @@ -2885,7 +2885,7 @@ BOOL lsa_io_q_setsystemaccount(const char *desc, LSA_Q_SETSYSTEMACCOUNT *out, p 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) +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++; @@ -2912,7 +2912,7 @@ void init_lsa_q_lookup_priv_value(LSA_Q_LOOKUP_PRIV_VALUE *q_u, POLICY_HND *hnd, init_lsa_string( &q_u->privname, name ); } -BOOL smb_io_lsa_string( const char *desc, LSA_STRING *string, prs_struct *ps, int depth ) +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++; @@ -2929,7 +2929,7 @@ BOOL smb_io_lsa_string( const char *desc, LSA_STRING *string, prs_struct *ps, in 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) +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++; @@ -2949,7 +2949,7 @@ BOOL lsa_io_q_lookup_priv_value(const char *desc, LSA_Q_LOOKUP_PRIV_VALUE *out, 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) +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++; @@ -2971,7 +2971,7 @@ BOOL lsa_io_r_lookup_priv_value(const char *desc, LSA_R_LOOKUP_PRIV_VALUE *out, 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) +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++; @@ -3003,7 +3003,7 @@ BOOL lsa_io_q_addprivs(const char *desc, LSA_Q_ADDPRIVS *out, prs_struct *ps, in 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) +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++; @@ -3021,7 +3021,7 @@ BOOL lsa_io_r_addprivs(const char *desc, LSA_R_ADDPRIVS *out, prs_struct *ps, in 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) +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++; @@ -3066,7 +3066,7 @@ BOOL lsa_io_q_removeprivs(const char *desc, LSA_Q_REMOVEPRIVS *out, prs_struct * 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) +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++; @@ -3080,7 +3080,7 @@ BOOL lsa_io_r_removeprivs(const char *desc, LSA_R_REMOVEPRIVS *out, prs_struct * return True; } -BOOL policy_handle_is_valid(const POLICY_HND *hnd) +bool policy_handle_is_valid(const POLICY_HND *hnd) { POLICY_HND zero_pol; @@ -3105,7 +3105,7 @@ void init_q_query2(LSA_Q_QUERY_INFO2 *in, POLICY_HND *hnd, uint16 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) +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++; @@ -3126,7 +3126,7 @@ BOOL lsa_io_q_query_info2(const char *desc, LSA_Q_QUERY_INFO2 *in, prs_struct *p Reads or writes an LSA_R_QUERY_DNSDOMINFO structure. ********************************************************************/ -BOOL lsa_io_r_query_info2(const char *desc, LSA_R_QUERY_INFO2 *out, +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"); @@ -3201,7 +3201,7 @@ NTSTATUS init_r_enum_acct_rights( LSA_R_ENUM_ACCT_RIGHTS *out, PRIVILEGE_SET *pr /******************************************************************* 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) +bool lsa_io_q_enum_acct_rights(const char *desc, LSA_Q_ENUM_ACCT_RIGHTS *in, prs_struct *ps, int depth) { if (in == NULL) @@ -3223,7 +3223,7 @@ BOOL lsa_io_q_enum_acct_rights(const char *desc, LSA_Q_ENUM_ACCT_RIGHTS *in, prs /******************************************************************* 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) +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++; @@ -3269,7 +3269,7 @@ void init_q_add_acct_rights( LSA_Q_ADD_ACCT_RIGHTS *in, POLICY_HND *hnd, /******************************************************************* 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) +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++; @@ -3292,7 +3292,7 @@ BOOL lsa_io_q_add_acct_rights(const char *desc, LSA_Q_ADD_ACCT_RIGHTS *in, prs_s /******************************************************************* 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) +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++; @@ -3335,7 +3335,7 @@ void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *in, 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) +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++; @@ -3361,7 +3361,7 @@ BOOL lsa_io_q_remove_acct_rights(const char *desc, LSA_Q_REMOVE_ACCT_RIGHTS *in, /******************************************************************* 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) +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++; @@ -3388,7 +3388,7 @@ void init_lsa_q_open_trusted_domain(LSA_Q_OPEN_TRUSTED_DOMAIN *q, POLICY_HND *hn ********************************************************************/ #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) +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++; @@ -3433,7 +3433,7 @@ void init_lsa_q_open_trusted_domain_by_name(LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME *q Reads or writes an LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME structure. ********************************************************************/ -BOOL lsa_io_q_open_trusted_domain_by_name(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME *q_o, prs_struct *ps, int depth) +bool lsa_io_q_open_trusted_domain_by_name(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME *q_o, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_q_open_trusted_domain_by_name"); depth++; @@ -3463,7 +3463,7 @@ BOOL lsa_io_q_open_trusted_domain_by_name(const char *desc, LSA_Q_OPEN_TRUSTED_D Reads or writes an LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME structure. ********************************************************************/ -BOOL lsa_io_r_open_trusted_domain_by_name(const char *desc, LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME *out, prs_struct *ps, int depth) +bool lsa_io_r_open_trusted_domain_by_name(const char *desc, LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME *out, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "lsa_io_r_open_trusted_domain_by_name"); depth++; @@ -3483,7 +3483,7 @@ BOOL lsa_io_r_open_trusted_domain_by_name(const char *desc, LSA_R_OPEN_TRUSTED_D /******************************************************************* ********************************************************************/ -BOOL lsa_io_q_open_trusted_domain(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN *q_o, prs_struct *ps, int depth) +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++; @@ -3507,7 +3507,7 @@ BOOL lsa_io_q_open_trusted_domain(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN *q 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) +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++; @@ -3527,7 +3527,7 @@ BOOL lsa_io_r_open_trusted_domain(const char *desc, LSA_R_OPEN_TRUSTED_DOMAIN *o /******************************************************************* ********************************************************************/ -BOOL lsa_io_q_create_trusted_domain(const char *desc, LSA_Q_CREATE_TRUSTED_DOMAIN *in, prs_struct *ps, int depth) +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++; @@ -3552,7 +3552,7 @@ BOOL lsa_io_q_create_trusted_domain(const char *desc, LSA_Q_CREATE_TRUSTED_DOMAI /******************************************************************* ********************************************************************/ -BOOL lsa_io_r_create_trusted_domain(const char *desc, LSA_R_CREATE_TRUSTED_DOMAIN *out, prs_struct *ps, int depth) +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++; @@ -3572,7 +3572,7 @@ BOOL lsa_io_r_create_trusted_domain(const char *desc, LSA_R_CREATE_TRUSTED_DOMAI /******************************************************************* ********************************************************************/ -BOOL lsa_io_q_create_secret(const char *desc, LSA_Q_CREATE_SECRET *in, prs_struct *ps, int depth) +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++; @@ -3597,7 +3597,7 @@ BOOL lsa_io_q_create_secret(const char *desc, LSA_Q_CREATE_SECRET *in, prs_struc /******************************************************************* ********************************************************************/ -BOOL lsa_io_r_create_secret(const char *desc, LSA_R_CREATE_SECRET *out, prs_struct *ps, int depth) +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++; @@ -3619,7 +3619,7 @@ BOOL lsa_io_r_create_secret(const char *desc, LSA_R_CREATE_SECRET *out, prs_stru /******************************************************************* ********************************************************************/ -static BOOL lsa_io_data_blob( const char *desc, prs_struct *ps, int depth, LSA_DATA_BLOB *blob ) +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++; @@ -3638,7 +3638,7 @@ static BOOL lsa_io_data_blob( const char *desc, prs_struct *ps, int depth, LSA_D /******************************************************************* ********************************************************************/ -BOOL lsa_io_q_set_secret(const char *desc, LSA_Q_SET_SECRET *in, prs_struct *ps, int depth) +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++; @@ -3664,7 +3664,7 @@ BOOL lsa_io_q_set_secret(const char *desc, LSA_Q_SET_SECRET *in, prs_struct *ps, /******************************************************************* ********************************************************************/ -BOOL lsa_io_r_set_secret(const char *desc, LSA_R_SET_SECRET *out, prs_struct *ps, int depth) +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++; @@ -3678,7 +3678,7 @@ BOOL lsa_io_r_set_secret(const char *desc, LSA_R_SET_SECRET *out, prs_struct *ps /******************************************************************* ********************************************************************/ -BOOL lsa_io_q_delete_object(const char *desc, LSA_Q_DELETE_OBJECT *in, prs_struct *ps, int depth) +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++; @@ -3695,7 +3695,7 @@ BOOL lsa_io_q_delete_object(const char *desc, LSA_Q_DELETE_OBJECT *in, prs_struc /******************************************************************* ********************************************************************/ -BOOL lsa_io_r_delete_object(const char *desc, LSA_R_DELETE_OBJECT *out, prs_struct *ps, int depth) +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++; @@ -3753,7 +3753,7 @@ void init_q_query_trusted_domain_info_by_sid(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_ Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO structure. ********************************************************************/ -BOOL lsa_io_q_query_trusted_domain_info(const char *desc, +bool lsa_io_q_query_trusted_domain_info(const char *desc, LSA_Q_QUERY_TRUSTED_DOMAIN_INFO *q_q, prs_struct *ps, int depth) { @@ -3777,7 +3777,7 @@ BOOL lsa_io_q_query_trusted_domain_info(const char *desc, Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID structure. ********************************************************************/ -BOOL lsa_io_q_query_trusted_domain_info_by_sid(const char *desc, +bool lsa_io_q_query_trusted_domain_info_by_sid(const char *desc, LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID *q_q, prs_struct *ps, int depth) { @@ -3806,7 +3806,7 @@ BOOL lsa_io_q_query_trusted_domain_info_by_sid(const char *desc, Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME structure. ********************************************************************/ -BOOL lsa_io_q_query_trusted_domain_info_by_name(const char *desc, +bool lsa_io_q_query_trusted_domain_info_by_name(const char *desc, LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME *q_q, prs_struct *ps, int depth) { @@ -3834,7 +3834,7 @@ BOOL lsa_io_q_query_trusted_domain_info_by_name(const char *desc, /******************************************************************* ********************************************************************/ -static BOOL smb_io_lsa_data_buf_hdr(const char *desc, LSA_DATA_BUF_HDR *buf_hdr, +static bool smb_io_lsa_data_buf_hdr(const char *desc, LSA_DATA_BUF_HDR *buf_hdr, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_lsa_data_buf_hdr"); @@ -3858,7 +3858,7 @@ static BOOL smb_io_lsa_data_buf_hdr(const char *desc, LSA_DATA_BUF_HDR *buf_hdr, /******************************************************************* ********************************************************************/ -static BOOL smb_io_lsa_data_buf(const char *desc, LSA_DATA_BUF *buf, +static bool smb_io_lsa_data_buf(const char *desc, LSA_DATA_BUF *buf, prs_struct *ps, int depth, int length, int size) { prs_debug(ps, depth, desc, "smb_io_lsa_data_buf"); @@ -3887,7 +3887,7 @@ static BOOL smb_io_lsa_data_buf(const char *desc, LSA_DATA_BUF *buf, /******************************************************************* ********************************************************************/ -static BOOL lsa_io_trustdom_query_1(const char *desc, TRUSTED_DOMAIN_INFO_NAME *name, +static bool lsa_io_trustdom_query_1(const char *desc, TRUSTED_DOMAIN_INFO_NAME *name, prs_struct *ps, int depth) { if (!smb_io_lsa_string("netbios_name", &name->netbios_name, ps, depth)) @@ -3899,7 +3899,7 @@ static BOOL lsa_io_trustdom_query_1(const char *desc, TRUSTED_DOMAIN_INFO_NAME * /******************************************************************* ********************************************************************/ -static BOOL lsa_io_trustdom_query_3(const char *desc, TRUSTED_DOMAIN_INFO_POSIX_OFFSET *posix, +static bool lsa_io_trustdom_query_3(const char *desc, TRUSTED_DOMAIN_INFO_POSIX_OFFSET *posix, prs_struct *ps, int depth) { if(!prs_uint32("posix_offset", ps, depth, &posix->posix_offset)) @@ -3911,7 +3911,7 @@ static BOOL lsa_io_trustdom_query_3(const char *desc, TRUSTED_DOMAIN_INFO_POSIX_ /******************************************************************* ********************************************************************/ -static BOOL lsa_io_trustdom_query_4(const char *desc, TRUSTED_DOMAIN_INFO_PASSWORD *password, +static bool lsa_io_trustdom_query_4(const char *desc, TRUSTED_DOMAIN_INFO_PASSWORD *password, prs_struct *ps, int depth) { if(!prs_align(ps)) @@ -3949,7 +3949,7 @@ static BOOL lsa_io_trustdom_query_4(const char *desc, TRUSTED_DOMAIN_INFO_PASSWO /******************************************************************* ********************************************************************/ -static BOOL lsa_io_trustdom_query_6(const char *desc, TRUSTED_DOMAIN_INFO_EX *info_ex, +static bool lsa_io_trustdom_query_6(const char *desc, TRUSTED_DOMAIN_INFO_EX *info_ex, prs_struct *ps, int depth) { uint32 dom_sid_ptr; @@ -3987,7 +3987,7 @@ static BOOL lsa_io_trustdom_query_6(const char *desc, TRUSTED_DOMAIN_INFO_EX *in /******************************************************************* ********************************************************************/ -static BOOL lsa_io_trustdom_query(const char *desc, prs_struct *ps, int depth, LSA_TRUSTED_DOMAIN_INFO *info) +static bool lsa_io_trustdom_query(const char *desc, prs_struct *ps, int depth, LSA_TRUSTED_DOMAIN_INFO *info) { prs_debug(ps, depth, desc, "lsa_io_trustdom_query"); depth++; @@ -4027,7 +4027,7 @@ static BOOL lsa_io_trustdom_query(const char *desc, prs_struct *ps, int depth, L Reads or writes an LSA_R_QUERY_TRUSTED_DOMAIN_INFO structure. ********************************************************************/ -BOOL lsa_io_r_query_trusted_domain_info(const char *desc, +bool lsa_io_r_query_trusted_domain_info(const char *desc, LSA_R_QUERY_TRUSTED_DOMAIN_INFO *r_q, prs_struct *ps, int depth) { @@ -4068,7 +4068,7 @@ void init_q_query_dom_info(LSA_Q_QUERY_DOM_INFO_POLICY *in, POLICY_HND *hnd, uin 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) +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++; @@ -4089,7 +4089,7 @@ BOOL lsa_io_q_query_dom_info(const char *desc, LSA_Q_QUERY_DOM_INFO_POLICY *in, 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, +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)) @@ -4134,7 +4134,7 @@ static BOOL lsa_io_dominfo_query_3(const char *desc, LSA_DOM_INFO_POLICY_KERBERO return True; } -static BOOL lsa_io_dom_info_query(const char *desc, prs_struct *ps, int depth, LSA_DOM_INFO_UNION *info) +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++; @@ -4160,7 +4160,7 @@ static BOOL lsa_io_dom_info_query(const char *desc, prs_struct *ps, int depth, L } -BOOL lsa_io_r_query_dom_info(const char *desc, LSA_R_QUERY_DOM_INFO_POLICY *out, +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"); diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 7321e362b8..2e85b59a4b 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -29,7 +29,7 @@ Reads or writes a UTIME type. ********************************************************************/ -static BOOL smb_io_utime(const char *desc, UTIME *t, prs_struct *ps, int depth) +static bool smb_io_utime(const char *desc, UTIME *t, prs_struct *ps, int depth) { if (t == NULL) return False; @@ -50,7 +50,7 @@ static BOOL smb_io_utime(const char *desc, UTIME *t, prs_struct *ps, int depth) Reads or writes an NTTIME structure. ********************************************************************/ -BOOL smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth) +bool smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth) { uint32 low, high; if (nttime == NULL) @@ -83,7 +83,7 @@ BOOL smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth) Reads or writes an NTTIME structure. ********************************************************************/ -BOOL smb_io_nttime(const char *desc, prs_struct *ps, int depth, NTTIME *nttime) +bool smb_io_nttime(const char *desc, prs_struct *ps, int depth, NTTIME *nttime) { return smb_io_time( desc, nttime, ps, depth ); } @@ -113,7 +113,7 @@ void init_enum_hnd(ENUM_HND *enh, uint32 hnd) Reads or writes an ENUM_HND structure. ********************************************************************/ -BOOL smb_io_enum_hnd(const char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) +bool smb_io_enum_hnd(const char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) { if (hnd == NULL) return False; @@ -139,7 +139,7 @@ BOOL smb_io_enum_hnd(const char *desc, ENUM_HND *hnd, prs_struct *ps, int depth) Reads or writes a DOM_SID structure. ********************************************************************/ -BOOL smb_io_dom_sid(const char *desc, DOM_SID *sid, prs_struct *ps, int depth) +bool smb_io_dom_sid(const char *desc, DOM_SID *sid, prs_struct *ps, int depth) { int i; @@ -187,7 +187,7 @@ void init_dom_sid2(DOM_SID2 *sid2, const DOM_SID *sid) Reads or writes a DOM_SID2 structure. ********************************************************************/ -BOOL smb_io_dom_sid2_p(const char *desc, prs_struct *ps, int depth, DOM_SID2 **sid2) +bool smb_io_dom_sid2_p(const char *desc, prs_struct *ps, int depth, DOM_SID2 **sid2) { uint32 data_p; @@ -214,7 +214,7 @@ BOOL smb_io_dom_sid2_p(const char *desc, prs_struct *ps, int depth, DOM_SID2 **s Reads or writes a DOM_SID2 structure. ********************************************************************/ -BOOL smb_io_dom_sid2(const char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) +bool smb_io_dom_sid2(const char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) { if (sid == NULL) return False; @@ -238,7 +238,7 @@ BOOL smb_io_dom_sid2(const char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) Reads or writes a struct GUID ********************************************************************/ -BOOL smb_io_uuid(const char *desc, struct GUID *uuid, +bool smb_io_uuid(const char *desc, struct GUID *uuid, prs_struct *ps, int depth) { if (uuid == NULL) @@ -277,7 +277,7 @@ void init_str_hdr(STRHDR *hdr, int max_len, int len, uint32 buffer) Reads or writes a STRHDR structure. ********************************************************************/ -BOOL smb_io_strhdr(const char *desc, STRHDR *hdr, prs_struct *ps, int depth) +bool smb_io_strhdr(const char *desc, STRHDR *hdr, prs_struct *ps, int depth) { if (hdr == NULL) return False; @@ -312,7 +312,7 @@ void init_uni_hdr(UNIHDR *hdr, UNISTR2 *str2) Reads or writes a UNIHDR structure. ********************************************************************/ -BOOL smb_io_unihdr(const char *desc, UNIHDR *hdr, prs_struct *ps, int depth) +bool smb_io_unihdr(const char *desc, UNIHDR *hdr, prs_struct *ps, int depth) { if (hdr == NULL) return False; @@ -348,7 +348,7 @@ void init_buf_hdr(BUFHDR *hdr, int max_len, int len) uint16 should be stored, or gets the size if reading. ********************************************************************/ -BOOL smb_io_hdrbuf_pre(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset) +bool smb_io_hdrbuf_pre(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset) { (*offset) = prs_offset(ps); if (ps->io) { @@ -374,7 +374,7 @@ BOOL smb_io_hdrbuf_pre(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth, Does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ -BOOL smb_io_hdrbuf_post(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth, +bool smb_io_hdrbuf_post(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 ptr_hdrbuf, uint32 max_len, uint32 len) { if (!ps->io) { @@ -399,7 +399,7 @@ BOOL smb_io_hdrbuf_post(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth Reads or writes a BUFHDR structure. ********************************************************************/ -BOOL smb_io_hdrbuf(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth) +bool smb_io_hdrbuf(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth) { if (hdr == NULL) return False; @@ -449,7 +449,7 @@ reads or writes a UNISTR structure. XXXX NOTE: UNISTR structures NEED to be null-terminated. ********************************************************************/ -BOOL smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth) +bool smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth) { if (uni == NULL) return False; @@ -541,7 +541,7 @@ void init_rpc_blob_bytes(RPC_DATA_BLOB *str, uint8 *buf, size_t len) reads or writes a BUFFER5 structure. the buf_len member tells you how large the buffer is. ********************************************************************/ -BOOL smb_io_buffer5(const char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) +bool smb_io_buffer5(const char *desc, BUFFER5 *buf5, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_buffer5"); depth++; @@ -590,7 +590,7 @@ void init_regval_buffer(REGVAL_BUFFER *str, const uint8 *buf, size_t len) the uni_str_len member tells you how much of the buffer is really used. ********************************************************************/ -BOOL smb_io_regval_buffer(const char *desc, prs_struct *ps, int depth, REGVAL_BUFFER *buf2) +bool smb_io_regval_buffer(const char *desc, prs_struct *ps, int depth, REGVAL_BUFFER *buf2) { prs_debug(ps, depth, desc, "smb_io_regval_buffer"); @@ -701,7 +701,7 @@ void init_string2(STRING2 *str, const char *buf, size_t max_len, size_t str_len) the str_max_len member tells you how large the buffer is. ********************************************************************/ -BOOL smb_io_string2(const char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth) +bool smb_io_string2(const char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth) { if (str2 == NULL) return False; @@ -940,7 +940,7 @@ void init_unistr2_from_datablob(UNISTR2 *str, DATA_BLOB *blob) See SPOOL_USER_1 in include/rpc_spoolss.h for an example. ********************************************************************/ -BOOL prs_io_unistr2_p(const char *desc, prs_struct *ps, int depth, UNISTR2 **uni2) +bool prs_io_unistr2_p(const char *desc, prs_struct *ps, int depth, UNISTR2 **uni2) { uint32 data_p; @@ -969,7 +969,7 @@ BOOL prs_io_unistr2_p(const char *desc, prs_struct *ps, int depth, UNISTR2 **uni not UNISTR2.buffer) has been allocated previously by prs_unistr2_p() ********************************************************************/ -BOOL prs_io_unistr2(const char *desc, prs_struct *ps, int depth, UNISTR2 *uni2 ) +bool prs_io_unistr2(const char *desc, prs_struct *ps, int depth, UNISTR2 *uni2 ) { /* just return true if there is no pointer to deal with. the memory must have been previously allocated on unmarshalling @@ -991,7 +991,7 @@ BOOL prs_io_unistr2(const char *desc, prs_struct *ps, int depth, UNISTR2 *uni2 ) the uni_max_len member tells you how large the buffer is. ********************************************************************/ -BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth) +bool smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth) { if (uni2 == NULL) return False; @@ -1031,7 +1031,7 @@ BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct * now read/write UNISTR4 ********************************************************************/ -BOOL prs_unistr4(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) +bool prs_unistr4(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) { void *ptr; prs_debug(ps, depth, desc, "prs_unistr4"); @@ -1056,7 +1056,7 @@ BOOL prs_unistr4(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) now read/write UNISTR4 header ********************************************************************/ -BOOL prs_unistr4_hdr(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) +bool prs_unistr4_hdr(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) { prs_debug(ps, depth, desc, "prs_unistr4_hdr"); depth++; @@ -1075,7 +1075,7 @@ BOOL prs_unistr4_hdr(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) now read/write UNISTR4 string ********************************************************************/ -BOOL prs_unistr4_str(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) +bool prs_unistr4_str(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) { prs_debug(ps, depth, desc, "prs_unistr4_str"); depth++; @@ -1090,7 +1090,7 @@ BOOL prs_unistr4_str(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4) Reads or writes a UNISTR4_ARRAY structure. ********************************************************************/ -BOOL prs_unistr4_array(const char *desc, prs_struct *ps, int depth, UNISTR4_ARRAY *array ) +bool prs_unistr4_array(const char *desc, prs_struct *ps, int depth, UNISTR4_ARRAY *array ) { unsigned int i; @@ -1128,7 +1128,7 @@ BOOL prs_unistr4_array(const char *desc, prs_struct *ps, int depth, UNISTR4_ARRA initialise a UNISTR_ARRAY from a char** ********************************************************************/ -BOOL init_unistr4_array( UNISTR4_ARRAY *array, uint32 count, const char **strings ) +bool init_unistr4_array( UNISTR4_ARRAY *array, uint32 count, const char **strings ) { unsigned int i; @@ -1149,7 +1149,7 @@ BOOL init_unistr4_array( UNISTR4_ARRAY *array, uint32 count, const char **string return True; } -BOOL smb_io_lockout_string_hdr(const char *desc, HDR_LOCKOUT_STRING *hdr_account_lockout, prs_struct *ps, int depth) +bool smb_io_lockout_string_hdr(const char *desc, HDR_LOCKOUT_STRING *hdr_account_lockout, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_lockout_string_hdr"); depth++; @@ -1167,7 +1167,7 @@ BOOL smb_io_lockout_string_hdr(const char *desc, HDR_LOCKOUT_STRING *hdr_account return True; } -BOOL smb_io_account_lockout_str(const char *desc, LOCKOUT_STRING *account_lockout, uint32 buffer, prs_struct *ps, int depth) +bool smb_io_account_lockout_str(const char *desc, LOCKOUT_STRING *account_lockout, uint32 buffer, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_account_lockout_string"); depth++; @@ -1211,7 +1211,7 @@ void init_dom_rid(DOM_RID *prid, uint32 rid, uint16 type, uint32 idx) Reads or writes a DOM_RID structure. ********************************************************************/ -BOOL smb_io_dom_rid(const char *desc, DOM_RID *rid, prs_struct *ps, int depth) +bool smb_io_dom_rid(const char *desc, DOM_RID *rid, prs_struct *ps, int depth) { if (rid == NULL) return False; @@ -1238,7 +1238,7 @@ BOOL smb_io_dom_rid(const char *desc, DOM_RID *rid, prs_struct *ps, int depth) Reads or writes a DOM_RID2 structure. ********************************************************************/ -BOOL smb_io_dom_rid2(const char *desc, DOM_RID2 *rid, prs_struct *ps, int depth) +bool smb_io_dom_rid2(const char *desc, DOM_RID2 *rid, prs_struct *ps, int depth) { if (rid == NULL) return False; @@ -1281,7 +1281,7 @@ void init_dom_rid3(DOM_RID3 *rid3, uint32 rid, uint8 type) reads or writes a DOM_RID3 structure. ********************************************************************/ -BOOL smb_io_dom_rid3(const char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) +bool smb_io_dom_rid3(const char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth) { if (rid3 == NULL) return False; @@ -1345,7 +1345,7 @@ void init_clnt_srv(DOM_CLNT_SRV *logcln, const char *logon_srv, Inits or writes a DOM_CLNT_SRV structure. ********************************************************************/ -BOOL smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *logcln, prs_struct *ps, int depth) +bool smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *logcln, prs_struct *ps, int depth) { if (logcln == NULL) return False; @@ -1401,7 +1401,7 @@ void init_log_info(DOM_LOG_INFO *loginfo, const char *logon_srv, const char *acc Reads or writes a DOM_LOG_INFO structure. ********************************************************************/ -BOOL smb_io_log_info(const char *desc, DOM_LOG_INFO *loginfo, prs_struct *ps, int depth) +bool smb_io_log_info(const char *desc, DOM_LOG_INFO *loginfo, prs_struct *ps, int depth) { if (loginfo == NULL) return False; @@ -1433,7 +1433,7 @@ BOOL smb_io_log_info(const char *desc, DOM_LOG_INFO *loginfo, prs_struct *ps, in Reads or writes a DOM_CHAL structure. ********************************************************************/ -BOOL smb_io_chal(const char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) +bool smb_io_chal(const char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) { if (chal == NULL) return False; @@ -1451,7 +1451,7 @@ BOOL smb_io_chal(const char *desc, DOM_CHAL *chal, prs_struct *ps, int depth) Reads or writes a DOM_CRED structure. ********************************************************************/ -BOOL smb_io_cred(const char *desc, DOM_CRED *cred, prs_struct *ps, int depth) +bool smb_io_cred(const char *desc, DOM_CRED *cred, prs_struct *ps, int depth) { if (cred == NULL) return False; @@ -1495,7 +1495,7 @@ void init_clnt_info2(DOM_CLNT_INFO2 *clnt, Reads or writes a DOM_CLNT_INFO2 structure. ********************************************************************/ -BOOL smb_io_clnt_info2(const char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth) +bool smb_io_clnt_info2(const char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth) { if (clnt == NULL) return False; @@ -1539,7 +1539,7 @@ void init_clnt_info(DOM_CLNT_INFO *clnt, Reads or writes a DOM_CLNT_INFO structure. ********************************************************************/ -BOOL smb_io_clnt_info(const char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int depth) +bool smb_io_clnt_info(const char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int depth) { if (clnt == NULL) return False; @@ -1574,7 +1574,7 @@ void init_logon_id(DOM_LOGON_ID *logonid, uint32 log_id_low, uint32 log_id_high) Reads or writes a DOM_LOGON_ID structure. ********************************************************************/ -BOOL smb_io_logon_id(const char *desc, DOM_LOGON_ID *logonid, prs_struct *ps, int depth) +bool smb_io_logon_id(const char *desc, DOM_LOGON_ID *logonid, prs_struct *ps, int depth) { if (logonid == NULL) return False; @@ -1611,7 +1611,7 @@ void init_owf_info(OWF_INFO *hash, const uint8 data[16]) Reads or writes an OWF_INFO structure. ********************************************************************/ -BOOL smb_io_owf_info(const char *desc, OWF_INFO *hash, prs_struct *ps, int depth) +bool smb_io_owf_info(const char *desc, OWF_INFO *hash, prs_struct *ps, int depth) { if (hash == NULL) return False; @@ -1632,7 +1632,7 @@ BOOL smb_io_owf_info(const char *desc, OWF_INFO *hash, prs_struct *ps, int depth Reads or writes a DOM_GID structure. ********************************************************************/ -BOOL smb_io_gid(const char *desc, DOM_GID *gid, prs_struct *ps, int depth) +bool smb_io_gid(const char *desc, DOM_GID *gid, prs_struct *ps, int depth) { if (gid == NULL) return False; @@ -1655,7 +1655,7 @@ BOOL smb_io_gid(const char *desc, DOM_GID *gid, prs_struct *ps, int depth) Reads or writes an POLICY_HND structure. ********************************************************************/ -BOOL smb_io_pol_hnd(const char *desc, POLICY_HND *pol, prs_struct *ps, int depth) +bool smb_io_pol_hnd(const char *desc, POLICY_HND *pol, prs_struct *ps, int depth) { if (pol == NULL) return False; @@ -1706,7 +1706,7 @@ void init_unistr3(UNISTR3 *str, const char *buf) Reads or writes a UNISTR3 structure. ********************************************************************/ -BOOL smb_io_unistr3(const char *desc, UNISTR3 *name, prs_struct *ps, int depth) +bool smb_io_unistr3(const char *desc, UNISTR3 *name, prs_struct *ps, int depth) { if (name == NULL) return False; @@ -1737,7 +1737,7 @@ BOOL smb_io_unistr3(const char *desc, UNISTR3 *name, prs_struct *ps, int depth) /******************************************************************* Stream a uint64_struct ********************************************************************/ -BOOL prs_uint64(const char *name, prs_struct *ps, int depth, uint64 *data64) +bool prs_uint64(const char *name, prs_struct *ps, int depth, uint64 *data64) { if (UNMARSHALLING(ps)) { uint32 high, low; @@ -1761,7 +1761,7 @@ BOOL prs_uint64(const char *name, prs_struct *ps, int depth, uint64 *data64) /******************************************************************* reads or writes a BUFHDR2 structure. ********************************************************************/ -BOOL smb_io_bufhdr2(const char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) +bool smb_io_bufhdr2(const char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_bufhdr2"); depth++; @@ -1777,7 +1777,7 @@ BOOL smb_io_bufhdr2(const char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) /******************************************************************* reads or writes a BUFHDR4 structure. ********************************************************************/ -BOOL smb_io_bufhdr4(const char *desc, BUFHDR4 *hdr, prs_struct *ps, int depth) +bool smb_io_bufhdr4(const char *desc, BUFHDR4 *hdr, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_bufhdr4"); depth++; @@ -1793,7 +1793,7 @@ BOOL smb_io_bufhdr4(const char *desc, BUFHDR4 *hdr, prs_struct *ps, int depth) reads or writes a RPC_DATA_BLOB structure. ********************************************************************/ -BOOL smb_io_rpc_blob(const char *desc, RPC_DATA_BLOB *blob, prs_struct *ps, int depth) +bool smb_io_rpc_blob(const char *desc, RPC_DATA_BLOB *blob, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_rpc_blob"); depth++; @@ -1822,7 +1822,7 @@ BOOL smb_io_rpc_blob(const char *desc, RPC_DATA_BLOB *blob, prs_struct *ps, int creates a UNIHDR structure. ********************************************************************/ -BOOL make_uni_hdr(UNIHDR *hdr, int len) +bool make_uni_hdr(UNIHDR *hdr, int len) { if (hdr == NULL) { @@ -1838,7 +1838,7 @@ BOOL make_uni_hdr(UNIHDR *hdr, int len) /******************************************************************* creates a BUFHDR2 structure. ********************************************************************/ -BOOL make_bufhdr2(BUFHDR2 *hdr, uint32 info_level, uint32 length, uint32 buffer) +bool make_bufhdr2(BUFHDR2 *hdr, uint32 info_level, uint32 length, uint32 buffer) { hdr->info_level = info_level; hdr->length = length; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index a94b20210f..e12d9dda0d 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -29,7 +29,7 @@ Reads or writes a structure. ********************************************************************/ -static BOOL net_io_neg_flags(const char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth) +static bool net_io_neg_flags(const char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth) { if (neg == NULL) return False; @@ -65,7 +65,7 @@ static void init_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_att 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) +static bool net_io_netinfo_3(const char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int depth) { if (info == NULL) return False; @@ -109,7 +109,7 @@ static void init_netinfo_1(NETLOGON_INFO_1 *info, uint32 flags, uint32 pdc_statu 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) +static bool net_io_netinfo_1(const char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth) { if (info == NULL) return False; @@ -150,7 +150,7 @@ static void init_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_statu 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) +static bool net_io_netinfo_2(const char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth) { if (info == NULL) return False; @@ -181,7 +181,7 @@ static BOOL net_io_netinfo_2(const char *desc, NETLOGON_INFO_2 *info, prs_struct return True; } -static BOOL net_io_ctrl_data_info_5(const char *desc, CTRL_DATA_INFO_5 *info, prs_struct *ps, int depth) +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; @@ -203,7 +203,7 @@ static BOOL net_io_ctrl_data_info_5(const char *desc, CTRL_DATA_INFO_5 *info, pr return True; } -static BOOL net_io_ctrl_data_info_6(const char *desc, CTRL_DATA_INFO_6 *info, prs_struct *ps, int depth) +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; @@ -229,7 +229,7 @@ static BOOL net_io_ctrl_data_info_6(const char *desc, CTRL_DATA_INFO_6 *info, pr 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) +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; @@ -331,7 +331,7 @@ void init_net_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level, 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) +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; @@ -375,7 +375,7 @@ BOOL net_io_r_logon_ctrl2(const char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct * 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, +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"); @@ -448,7 +448,7 @@ void init_net_r_logon_ctrl(NET_R_LOGON_CTRL *r_l, uint32 query_level, 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, +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"); @@ -496,7 +496,7 @@ void init_net_q_getanydcname(NET_Q_GETANYDCNAME *r_t, const char *logon_server, Reads or writes an NET_Q_GETANYDCNAME structure. ********************************************************************/ -BOOL net_io_q_getanydcname(const char *desc, NET_Q_GETANYDCNAME *r_t, prs_struct *ps, +bool net_io_q_getanydcname(const char *desc, NET_Q_GETANYDCNAME *r_t, prs_struct *ps, int depth) { if (r_t == NULL) @@ -540,7 +540,7 @@ void init_net_r_getanydcname(NET_R_GETANYDCNAME *r_t, const char *dcname) Reads or writes an NET_R_GETANYDCNAME structure. ********************************************************************/ -BOOL net_io_r_getanydcname(const char *desc, NET_R_GETANYDCNAME *r_t, prs_struct *ps, +bool net_io_r_getanydcname(const char *desc, NET_R_GETANYDCNAME *r_t, prs_struct *ps, int depth) { if (r_t == NULL) @@ -583,7 +583,7 @@ void init_net_q_getdcname(NET_Q_GETDCNAME *r_t, const char *logon_server, Reads or writes an NET_Q_GETDCNAME structure. ********************************************************************/ -BOOL net_io_q_getdcname(const char *desc, NET_Q_GETDCNAME *r_t, prs_struct *ps, +bool net_io_q_getdcname(const char *desc, NET_Q_GETDCNAME *r_t, prs_struct *ps, int depth) { if (r_t == NULL) @@ -624,7 +624,7 @@ void init_net_r_getdcname(NET_R_GETDCNAME *r_t, const char *dcname) Reads or writes an NET_R_GETDCNAME structure. ********************************************************************/ -BOOL net_io_r_getdcname(const char *desc, NET_R_GETDCNAME *r_t, prs_struct *ps, +bool net_io_r_getdcname(const char *desc, NET_R_GETDCNAME *r_t, prs_struct *ps, int depth) { if (r_t == NULL) @@ -683,7 +683,7 @@ void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t, 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) +bool net_io_r_trust_dom(const char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth) { uint32 value; @@ -735,7 +735,7 @@ BOOL net_io_r_trust_dom(const char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct 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) +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; @@ -775,7 +775,7 @@ void init_q_req_chal(NET_Q_REQ_CHAL *q_c, 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) +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; @@ -804,7 +804,7 @@ BOOL net_io_q_req_chal(const char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, i 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) +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; @@ -829,7 +829,7 @@ BOOL net_io_r_req_chal(const char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, in Reads or writes a structure. ********************************************************************/ -BOOL net_io_q_auth(const char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth) +bool net_io_q_auth(const char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth) { if (q_a == NULL) return False; @@ -852,7 +852,7 @@ BOOL net_io_q_auth(const char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth) Reads or writes a structure. ********************************************************************/ -BOOL net_io_r_auth(const char *desc, NET_R_AUTH *r_a, prs_struct *ps, int depth) +bool net_io_r_auth(const char *desc, NET_R_AUTH *r_a, prs_struct *ps, int depth) { if (r_a == NULL) return False; @@ -893,7 +893,7 @@ void init_q_auth_2(NET_Q_AUTH_2 *q_a, 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) +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; @@ -918,7 +918,7 @@ BOOL net_io_q_auth_2(const char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int de 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) +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; @@ -961,7 +961,7 @@ void init_q_auth_3(NET_Q_AUTH_3 *q_a, 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) +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; @@ -986,7 +986,7 @@ BOOL net_io_q_auth_3(const char *desc, NET_Q_AUTH_3 *q_a, prs_struct *ps, int de 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) +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; @@ -1036,7 +1036,7 @@ void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s, 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) +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; @@ -1059,7 +1059,7 @@ BOOL net_io_q_srv_pwset(const char *desc, NET_Q_SRV_PWSET *q_s, prs_struct *ps, 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) +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; @@ -1194,7 +1194,7 @@ void init_id_info1(NET_ID_INFO_1 *id, const char *domain_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) +static bool net_io_id_info1(const char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth) { if (id == NULL) return False; @@ -1292,7 +1292,7 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name, 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) +static bool net_io_id_info2(const char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int depth) { if (id == NULL) return False; @@ -1393,7 +1393,7 @@ void init_sam_info_ex(DOM_SAM_INFO_EX *sam, 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) +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; @@ -1436,7 +1436,7 @@ static BOOL net_io_id_info_ctr(const char *desc, NET_ID_INFO_CTR **pp_ctr, prs_s 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) +static bool smb_io_sam_info(const char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int depth) { if (sam == NULL) return False; @@ -1472,7 +1472,7 @@ static BOOL smb_io_sam_info(const char *desc, DOM_SAM_INFO *sam, prs_struct *ps, 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) +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; @@ -1689,8 +1689,8 @@ static void dump_user_flgs(uint32 user_flags) { 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) +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; @@ -1914,7 +1914,7 @@ BOOL net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, 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) +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; @@ -1941,7 +1941,7 @@ BOOL net_io_q_sam_logon(const char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, 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) +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; @@ -1987,7 +1987,7 @@ BOOL net_io_r_sam_logon(const char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, 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) +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; @@ -2020,7 +2020,7 @@ BOOL net_io_q_sam_logon_ex(const char *desc, NET_Q_SAM_LOGON_EX *q_l, prs_struct 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) +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; @@ -2063,7 +2063,7 @@ BOOL net_io_r_sam_logon_ex(const char *desc, NET_R_SAM_LOGON_EX *r_l, prs_struct 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) +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; @@ -2084,7 +2084,7 @@ BOOL net_io_q_sam_logoff(const char *desc, NET_Q_SAM_LOGOFF *q_l, prs_struct *p 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) +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; @@ -2109,7 +2109,7 @@ BOOL net_io_r_sam_logoff(const char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps /******************************************************************* makes a NET_Q_SAM_SYNC structure. ********************************************************************/ -BOOL init_net_q_sam_sync(NET_Q_SAM_SYNC * q_s, const char *srv_name, +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) @@ -2138,7 +2138,7 @@ BOOL init_net_q_sam_sync(NET_Q_SAM_SYNC * q_s, const char *srv_name, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL net_io_q_sam_sync(const char *desc, NET_Q_SAM_SYNC * q_s, prs_struct *ps, +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"); @@ -2170,7 +2170,7 @@ BOOL net_io_q_sam_sync(const char *desc, NET_Q_SAM_SYNC * q_s, prs_struct *ps, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_delta_hdr(const char *desc, SAM_DELTA_HDR * delta, +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"); @@ -2200,7 +2200,7 @@ static BOOL net_io_sam_delta_hdr(const char *desc, SAM_DELTA_HDR * delta, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_delta_mod_count(const char *desc, SAM_DELTA_MOD_COUNT *info, +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"); @@ -2224,7 +2224,7 @@ static BOOL net_io_sam_delta_mod_count(const char *desc, SAM_DELTA_MOD_COUNT *in /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_domain_info(const char *desc, SAM_DOMAIN_INFO * info, +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"); @@ -2300,7 +2300,7 @@ static BOOL net_io_sam_domain_info(const char *desc, SAM_DOMAIN_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_group_info(const char *desc, SAM_GROUP_INFO * info, +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"); @@ -2334,7 +2334,7 @@ static BOOL net_io_sam_group_info(const char *desc, SAM_GROUP_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_passwd_info(const char *desc, SAM_PWD * pwd, +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"); @@ -2364,7 +2364,7 @@ static BOOL net_io_sam_passwd_info(const char *desc, SAM_PWD * pwd, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_account_info(const char *desc, SAM_ACCOUNT_INFO *info, +static bool net_io_sam_account_info(const char *desc, SAM_ACCOUNT_INFO *info, prs_struct *ps, int depth) { BUFHDR2 hdr_priv_data; @@ -2552,7 +2552,7 @@ static BOOL net_io_sam_account_info(const char *desc, SAM_ACCOUNT_INFO *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_group_mem_info(const char *desc, SAM_GROUP_MEM_INFO * info, +static bool net_io_sam_group_mem_info(const char *desc, SAM_GROUP_MEM_INFO * info, prs_struct *ps, int depth) { uint32 i; @@ -2646,7 +2646,7 @@ static BOOL net_io_sam_group_mem_info(const char *desc, SAM_GROUP_MEM_INFO * inf /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_alias_info(const char *desc, SAM_ALIAS_INFO * info, +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"); @@ -2681,7 +2681,7 @@ static BOOL net_io_sam_alias_info(const char *desc, SAM_ALIAS_INFO * info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_alias_mem_info(const char *desc, SAM_ALIAS_MEM_INFO * info, +static bool net_io_sam_alias_mem_info(const char *desc, SAM_ALIAS_MEM_INFO * info, prs_struct *ps, int depth) { uint32 i; @@ -2764,7 +2764,7 @@ static BOOL net_io_sam_alias_mem_info(const char *desc, SAM_ALIAS_MEM_INFO * inf /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_policy_info(const char *desc, SAM_DELTA_POLICY *info, +static bool net_io_sam_policy_info(const char *desc, SAM_DELTA_POLICY *info, prs_struct *ps, int depth) { unsigned int i; @@ -2853,7 +2853,7 @@ static BOOL net_io_sam_policy_info(const char *desc, SAM_DELTA_POLICY *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_trustdoms_info(const char *desc, SAM_DELTA_TRUSTDOMS *info, +static bool net_io_sam_trustdoms_info(const char *desc, SAM_DELTA_TRUSTDOMS *info, prs_struct *ps, int depth) { int i; @@ -2907,7 +2907,7 @@ static BOOL net_io_sam_trustdoms_info(const char *desc, SAM_DELTA_TRUSTDOMS *inf /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_secret_info(const char *desc, SAM_DELTA_SECRET *info, +static bool net_io_sam_secret_info(const char *desc, SAM_DELTA_SECRET *info, prs_struct *ps, int depth) { int i; @@ -2996,7 +2996,7 @@ static BOOL net_io_sam_secret_info(const char *desc, SAM_DELTA_SECRET *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info, +static bool net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info, prs_struct *ps, int depth) { unsigned int i; @@ -3104,7 +3104,7 @@ static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info, /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL net_io_sam_delta_ctr(const char *desc, +static bool net_io_sam_delta_ctr(const char *desc, SAM_DELTA_CTR * delta, uint16 type, prs_struct *ps, int depth) { @@ -3182,7 +3182,7 @@ static BOOL net_io_sam_delta_ctr(const char *desc, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL net_io_r_sam_sync(const char *desc, +bool net_io_r_sam_sync(const char *desc, NET_R_SAM_SYNC * r_s, prs_struct *ps, int depth) { uint32 i; @@ -3274,7 +3274,7 @@ BOOL net_io_r_sam_sync(const char *desc, /******************************************************************* makes a NET_Q_SAM_DELTAS structure. ********************************************************************/ -BOOL init_net_q_sam_deltas(NET_Q_SAM_DELTAS *q_s, const char *srv_name, +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) { @@ -3296,7 +3296,7 @@ BOOL init_net_q_sam_deltas(NET_Q_SAM_DELTAS *q_s, const char *srv_name, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL net_io_q_sam_deltas(const char *desc, NET_Q_SAM_DELTAS *q_s, prs_struct *ps, +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"); @@ -3325,7 +3325,7 @@ BOOL net_io_q_sam_deltas(const char *desc, NET_Q_SAM_DELTAS *q_s, prs_struct *ps /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL net_io_r_sam_deltas(const char *desc, +bool net_io_r_sam_deltas(const char *desc, NET_R_SAM_DELTAS *r_s, prs_struct *ps, int depth) { unsigned int i; @@ -3498,7 +3498,7 @@ void init_net_q_dsr_getdcnameex2(NET_Q_DSR_GETDCNAMEEX2 *r_t, const char *server Reads or writes an NET_Q_DSR_GETDCNAME structure. ********************************************************************/ -BOOL net_io_q_dsr_getdcname(const char *desc, NET_Q_DSR_GETDCNAME *r_t, +bool net_io_q_dsr_getdcname(const char *desc, NET_Q_DSR_GETDCNAME *r_t, prs_struct *ps, int depth) { if (r_t == NULL) @@ -3569,7 +3569,7 @@ BOOL net_io_q_dsr_getdcname(const char *desc, NET_Q_DSR_GETDCNAME *r_t, Reads or writes an NET_Q_DSR_GETDCNAMEEX structure. ********************************************************************/ -BOOL net_io_q_dsr_getdcnameex(const char *desc, NET_Q_DSR_GETDCNAMEEX *r_t, +bool net_io_q_dsr_getdcnameex(const char *desc, NET_Q_DSR_GETDCNAMEEX *r_t, prs_struct *ps, int depth) { if (r_t == NULL) @@ -3634,7 +3634,7 @@ BOOL net_io_q_dsr_getdcnameex(const char *desc, NET_Q_DSR_GETDCNAMEEX *r_t, Reads or writes an NET_Q_DSR_GETDCNAMEEX2 structure. ********************************************************************/ -BOOL net_io_q_dsr_getdcnameex2(const char *desc, NET_Q_DSR_GETDCNAMEEX2 *r_t, +bool net_io_q_dsr_getdcnameex2(const char *desc, NET_Q_DSR_GETDCNAMEEX2 *r_t, prs_struct *ps, int depth) { if (r_t == NULL) @@ -3754,7 +3754,7 @@ void init_net_r_dsr_getdcname(NET_R_DSR_GETDCNAME *r_t, const char *dc_unc, Reads or writes an NET_R_DSR_GETDCNAME structure. ********************************************************************/ -BOOL net_io_r_dsr_getdcname(const char *desc, NET_R_DSR_GETDCNAME *r_t, +bool net_io_r_dsr_getdcname(const char *desc, NET_R_DSR_GETDCNAME *r_t, prs_struct *ps, int depth) { uint32 info_ptr = 1; @@ -3867,7 +3867,7 @@ void init_net_q_dsr_getsitename(NET_Q_DSR_GETSITENAME *r_t, const char *computer Reads or writes an NET_Q_DSR_GETSITENAME structure. ********************************************************************/ -BOOL net_io_q_dsr_getsitename(const char *desc, NET_Q_DSR_GETSITENAME *r_t, +bool net_io_q_dsr_getsitename(const char *desc, NET_Q_DSR_GETSITENAME *r_t, prs_struct *ps, int depth) { if (r_t == NULL) @@ -3893,7 +3893,7 @@ BOOL net_io_q_dsr_getsitename(const char *desc, NET_Q_DSR_GETSITENAME *r_t, Reads or writes an NET_R_DSR_GETSITENAME structure. ********************************************************************/ -BOOL net_io_r_dsr_getsitename(const char *desc, NET_R_DSR_GETSITENAME *r_t, +bool net_io_r_dsr_getsitename(const char *desc, NET_R_DSR_GETSITENAME *r_t, prs_struct *ps, int depth) { if (r_t == NULL) diff --git a/source3/rpc_parse/parse_ntsvcs.c b/source3/rpc_parse/parse_ntsvcs.c index bcf3f55bd0..5758517ca0 100644 --- a/source3/rpc_parse/parse_ntsvcs.c +++ b/source3/rpc_parse/parse_ntsvcs.c @@ -25,7 +25,7 @@ /******************************************************************* ********************************************************************/ -BOOL ntsvcs_io_q_get_version(const char *desc, NTSVCS_Q_GET_VERSION *q_u, prs_struct *ps, int depth) +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; @@ -42,7 +42,7 @@ BOOL ntsvcs_io_q_get_version(const char *desc, NTSVCS_Q_GET_VERSION *q_u, prs_st /******************************************************************* ********************************************************************/ -BOOL ntsvcs_io_r_get_version(const char *desc, NTSVCS_R_GET_VERSION *r_u, prs_struct *ps, int depth) +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; @@ -65,7 +65,7 @@ BOOL ntsvcs_io_r_get_version(const char *desc, NTSVCS_R_GET_VERSION *r_u, prs_st /******************************************************************* ********************************************************************/ -BOOL ntsvcs_io_q_get_device_list_size(const char *desc, NTSVCS_Q_GET_DEVICE_LIST_SIZE *q_u, prs_struct *ps, int depth) +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; @@ -91,7 +91,7 @@ BOOL ntsvcs_io_q_get_device_list_size(const char *desc, NTSVCS_Q_GET_DEVICE_LIST /******************************************************************* ********************************************************************/ -BOOL ntsvcs_io_r_get_device_list_size(const char *desc, NTSVCS_R_GET_DEVICE_LIST_SIZE *r_u, prs_struct *ps, int depth) +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; @@ -115,7 +115,7 @@ BOOL ntsvcs_io_r_get_device_list_size(const char *desc, NTSVCS_R_GET_DEVICE_LIST /******************************************************************* ********************************************************************/ -BOOL ntsvcs_io_q_get_device_list(const char *desc, NTSVCS_Q_GET_DEVICE_LIST *q_u, prs_struct *ps, int depth) +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) return False; @@ -143,7 +143,7 @@ BOOL ntsvcs_io_q_get_device_list(const char *desc, NTSVCS_Q_GET_DEVICE_LIST *q_u /******************************************************************* ********************************************************************/ -BOOL ntsvcs_io_r_get_device_list(const char *desc, NTSVCS_R_GET_DEVICE_LIST *r_u, prs_struct *ps, int depth) +bool ntsvcs_io_r_get_device_list(const char *desc, NTSVCS_R_GET_DEVICE_LIST *r_u, prs_struct *ps, int depth) { if ( !r_u ) return False; @@ -171,7 +171,7 @@ 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) +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; @@ -197,7 +197,7 @@ BOOL ntsvcs_io_q_validate_device_instance(const char *desc, NTSVCS_Q_VALIDATE_DE /******************************************************************* ********************************************************************/ -BOOL ntsvcs_io_r_validate_device_instance(const char *desc, NTSVCS_R_VALIDATE_DEVICE_INSTANCE *r_u, prs_struct *ps, int depth) +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; @@ -214,7 +214,7 @@ BOOL ntsvcs_io_r_validate_device_instance(const char *desc, NTSVCS_R_VALIDATE_DE /******************************************************************* ********************************************************************/ -BOOL ntsvcs_io_q_get_device_reg_property(const char *desc, NTSVCS_Q_GET_DEVICE_REG_PROPERTY *q_u, prs_struct *ps, int depth) +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) return False; @@ -248,7 +248,7 @@ BOOL ntsvcs_io_q_get_device_reg_property(const char *desc, NTSVCS_Q_GET_DEVICE_R /******************************************************************* ********************************************************************/ -BOOL ntsvcs_io_r_get_device_reg_property(const char *desc, NTSVCS_R_GET_DEVICE_REG_PROPERTY *r_u, prs_struct *ps, int depth) +bool ntsvcs_io_r_get_device_reg_property(const char *desc, NTSVCS_R_GET_DEVICE_REG_PROPERTY *r_u, prs_struct *ps, int depth) { if ( !r_u ) return False; @@ -282,7 +282,7 @@ BOOL ntsvcs_io_r_get_device_reg_property(const char *desc, NTSVCS_R_GET_DEVICE_R /******************************************************************* ********************************************************************/ -BOOL ntsvcs_io_q_get_hw_profile_info(const char *desc, NTSVCS_Q_GET_HW_PROFILE_INFO *q_u, prs_struct *ps, int depth) +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; @@ -321,7 +321,7 @@ BOOL ntsvcs_io_q_get_hw_profile_info(const char *desc, NTSVCS_Q_GET_HW_PROFILE_I /******************************************************************* ********************************************************************/ -BOOL ntsvcs_io_r_get_hw_profile_info(const char *desc, NTSVCS_R_GET_HW_PROFILE_INFO *r_u, prs_struct *ps, int depth) +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; @@ -355,7 +355,7 @@ BOOL ntsvcs_io_r_get_hw_profile_info(const char *desc, NTSVCS_R_GET_HW_PROFILE_I /******************************************************************* ********************************************************************/ -BOOL ntsvcs_io_q_hw_profile_flags(const char *desc, NTSVCS_Q_HW_PROFILE_FLAGS *q_u, prs_struct *ps, int depth) +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; @@ -398,7 +398,7 @@ BOOL ntsvcs_io_q_hw_profile_flags(const char *desc, NTSVCS_Q_HW_PROFILE_FLAGS *q /******************************************************************* ********************************************************************/ -BOOL ntsvcs_io_r_hw_profile_flags(const char *desc, NTSVCS_R_HW_PROFILE_FLAGS *r_u, prs_struct *ps, int depth) +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; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index b22b1faa3f..a30e96772a 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -92,7 +92,7 @@ void prs_debug(prs_struct *ps, int depth, const char *desc, const char *fn_name) * @return False if allocation fails, otherwise True. **/ -BOOL prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, BOOL io) +bool prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, bool io) { ZERO_STRUCTP(ps); ps->io = io; @@ -180,7 +180,7 @@ TALLOC_CTX *prs_get_mem_context(prs_struct *ps) Hand some already allocated memory to a prs_struct. ********************************************************************/ -void prs_give_memory(prs_struct *ps, char *buf, uint32 size, BOOL is_dynamic) +void prs_give_memory(prs_struct *ps, char *buf, uint32 size, bool is_dynamic) { ps->is_dynamic = is_dynamic; ps->data_p = buf; @@ -205,7 +205,7 @@ char *prs_take_memory(prs_struct *ps, uint32 *psize) Set a prs_struct to exactly a given size. Will grow or tuncate if neccessary. ********************************************************************/ -BOOL prs_set_buffer_size(prs_struct *ps, uint32 newsize) +bool prs_set_buffer_size(prs_struct *ps, uint32 newsize) { if (newsize > ps->buffer_size) return prs_force_grow(ps, newsize - ps->buffer_size); @@ -236,7 +236,7 @@ BOOL prs_set_buffer_size(prs_struct *ps, uint32 newsize) Also depends on the data stream mode (io). ********************************************************************/ -BOOL prs_grow(prs_struct *ps, uint32 extra_space) +bool prs_grow(prs_struct *ps, uint32 extra_space) { uint32 new_size; @@ -300,7 +300,7 @@ BOOL prs_grow(prs_struct *ps, uint32 extra_space) when reading an rpc reply, before unmarshalling it. ********************************************************************/ -BOOL prs_force_grow(prs_struct *ps, uint32 extra_space) +bool prs_force_grow(prs_struct *ps, uint32 extra_space) { uint32 new_size = ps->buffer_size + extra_space; @@ -354,7 +354,7 @@ uint32 prs_offset(prs_struct *ps) Set the current offset (external interface). ********************************************************************/ -BOOL prs_set_offset(prs_struct *ps, uint32 offset) +bool prs_set_offset(prs_struct *ps, uint32 offset) { if(offset <= ps->data_offset) { ps->data_offset = offset; @@ -372,7 +372,7 @@ BOOL prs_set_offset(prs_struct *ps, uint32 offset) Append the data from one parse_struct into another. ********************************************************************/ -BOOL prs_append_prs_data(prs_struct *dst, prs_struct *src) +bool prs_append_prs_data(prs_struct *dst, prs_struct *src) { if (prs_offset(src) == 0) return True; @@ -390,7 +390,7 @@ BOOL prs_append_prs_data(prs_struct *dst, prs_struct *src) Append some data from one parse_struct into another. ********************************************************************/ -BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uint32 len) +bool prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uint32 len) { if (len == 0) return True; @@ -408,7 +408,7 @@ BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uin Append the data from a buffer into a parse_struct. ********************************************************************/ -BOOL prs_copy_data_in(prs_struct *dst, const char *src, uint32 len) +bool prs_copy_data_in(prs_struct *dst, const char *src, uint32 len) { if (len == 0) return True; @@ -426,7 +426,7 @@ BOOL prs_copy_data_in(prs_struct *dst, const char *src, uint32 len) Copy some data from a parse_struct into a buffer. ********************************************************************/ -BOOL prs_copy_data_out(char *dst, prs_struct *src, uint32 len) +bool prs_copy_data_out(char *dst, prs_struct *src, uint32 len) { if (len == 0) return True; @@ -444,7 +444,7 @@ BOOL prs_copy_data_out(char *dst, prs_struct *src, uint32 len) Copy all the data from a parse_struct into a buffer. ********************************************************************/ -BOOL prs_copy_all_data_out(char *dst, prs_struct *src) +bool prs_copy_all_data_out(char *dst, prs_struct *src) { uint32 len = prs_offset(src); @@ -459,7 +459,7 @@ BOOL prs_copy_all_data_out(char *dst, prs_struct *src) Set the data as X-endian (external interface). ********************************************************************/ -void prs_set_endian_data(prs_struct *ps, BOOL endian) +void prs_set_endian_data(prs_struct *ps, bool endian) { ps->bigendian_data = endian; } @@ -469,7 +469,7 @@ void prs_set_endian_data(prs_struct *ps, BOOL endian) zeros. ********************************************************************/ -BOOL prs_align(prs_struct *ps) +bool prs_align(prs_struct *ps) { uint32 mod = ps->data_offset & (ps->align-1); @@ -488,9 +488,9 @@ BOOL prs_align(prs_struct *ps) Align on a 2 byte boundary *****************************************************************/ -BOOL prs_align_uint16(prs_struct *ps) +bool prs_align_uint16(prs_struct *ps) { - BOOL ret; + bool ret; uint8 old_align = ps->align; ps->align = 2; @@ -504,9 +504,9 @@ BOOL prs_align_uint16(prs_struct *ps) Align on a 8 byte boundary *****************************************************************/ -BOOL prs_align_uint64(prs_struct *ps) +bool prs_align_uint64(prs_struct *ps) { - BOOL ret; + bool ret; uint8 old_align = ps->align; ps->align = 8; @@ -520,9 +520,9 @@ BOOL prs_align_uint64(prs_struct *ps) Align on a specific byte boundary *****************************************************************/ -BOOL prs_align_custom(prs_struct *ps, uint8 boundary) +bool prs_align_custom(prs_struct *ps, uint8 boundary) { - BOOL ret; + bool ret; uint8 old_align = ps->align; ps->align = boundary; @@ -538,7 +538,7 @@ BOOL prs_align_custom(prs_struct *ps, uint8 boundary) Align only if required (for the unistr2 string mainly) ********************************************************************/ -BOOL prs_align_needed(prs_struct *ps, uint32 needed) +bool prs_align_needed(prs_struct *ps, uint32 needed) { if (needed==0) return True; @@ -577,7 +577,7 @@ char *prs_mem_get(prs_struct *ps, uint32 extra_size) Change the struct type. ********************************************************************/ -void prs_switch_type(prs_struct *ps, BOOL io) +void prs_switch_type(prs_struct *ps, bool io) { if ((ps->io ^ io) == True) ps->io=io; @@ -605,7 +605,7 @@ void prs_set_session_key(prs_struct *ps, const char sess_key[16]) Stream a uint8. ********************************************************************/ -BOOL prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8) +bool prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8) { char *q = prs_mem_get(ps, 1); if (q == NULL) @@ -627,9 +627,9 @@ BOOL prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8) Stream a uint16* (allocate memory if unmarshalling) ********************************************************************/ -BOOL prs_pointer( const char *name, prs_struct *ps, int depth, +bool prs_pointer( const char *name, prs_struct *ps, int depth, void *dta, size_t data_size, - BOOL(*prs_fn)(const char*, prs_struct*, int, void*) ) + bool (*prs_fn)(const char*, prs_struct*, int, void*) ) { void ** data = (void **)dta; uint32 data_p; @@ -663,7 +663,7 @@ BOOL prs_pointer( const char *name, prs_struct *ps, int depth, Stream a uint16. ********************************************************************/ -BOOL prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16) +bool prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16) { char *q = prs_mem_get(ps, sizeof(uint16)); if (q == NULL) @@ -692,7 +692,7 @@ BOOL prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16) Stream a uint32. ********************************************************************/ -BOOL prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32) +bool prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32) { char *q = prs_mem_get(ps, sizeof(uint32)); if (q == NULL) @@ -721,7 +721,7 @@ BOOL prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32) Stream an int32. ********************************************************************/ -BOOL prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32) +bool prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32) { char *q = prs_mem_get(ps, sizeof(int32)); if (q == NULL) @@ -750,7 +750,7 @@ BOOL prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32) Stream a NTSTATUS ********************************************************************/ -BOOL prs_ntstatus(const char *name, prs_struct *ps, int depth, NTSTATUS *status) +bool prs_ntstatus(const char *name, prs_struct *ps, int depth, NTSTATUS *status) { char *q = prs_mem_get(ps, sizeof(uint32)); if (q == NULL) @@ -780,7 +780,7 @@ BOOL prs_ntstatus(const char *name, prs_struct *ps, int depth, NTSTATUS *status) Stream a DCE error code ********************************************************************/ -BOOL prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *status) +bool prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *status) { char *q = prs_mem_get(ps, sizeof(uint32)); if (q == NULL) @@ -811,7 +811,7 @@ BOOL prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *st Stream a WERROR ********************************************************************/ -BOOL prs_werror(const char *name, prs_struct *ps, int depth, WERROR *status) +bool prs_werror(const char *name, prs_struct *ps, int depth, WERROR *status) { char *q = prs_mem_get(ps, sizeof(uint32)); if (q == NULL) @@ -842,7 +842,7 @@ BOOL prs_werror(const char *name, prs_struct *ps, int depth, WERROR *status) Stream an array of uint8s. Length is number of uint8s. ********************************************************************/ -BOOL prs_uint8s(BOOL charmode, const char *name, prs_struct *ps, int depth, uint8 *data8s, int len) +bool prs_uint8s(bool charmode, const char *name, prs_struct *ps, int depth, uint8 *data8s, int len) { int i; char *q = prs_mem_get(ps, len); @@ -875,7 +875,7 @@ BOOL prs_uint8s(BOOL charmode, const char *name, prs_struct *ps, int depth, uint Stream an array of uint16s. Length is number of uint16s. ********************************************************************/ -BOOL prs_uint16s(BOOL charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len) +bool prs_uint16s(bool charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len) { int i; char *q = prs_mem_get(ps, len * sizeof(uint16)); @@ -919,7 +919,7 @@ BOOL prs_uint16s(BOOL charmode, const char *name, prs_struct *ps, int depth, uin output must be little-endian, if marshalling, input must be little-endian. ********************************************************************/ -static void dbg_rw_punival(BOOL charmode, const char *name, int depth, prs_struct *ps, +static void dbg_rw_punival(bool charmode, const char *name, int depth, prs_struct *ps, char *in_buf, char *out_buf, int len) { int i; @@ -956,7 +956,7 @@ static void dbg_rw_punival(BOOL charmode, const char *name, int depth, prs_struc Stream a unistr. Always little endian. ********************************************************************/ -BOOL prs_uint16uni(BOOL charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len) +bool prs_uint16uni(bool charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len) { char *q = prs_mem_get(ps, len * sizeof(uint16)); if (q == NULL) @@ -972,7 +972,7 @@ BOOL prs_uint16uni(BOOL charmode, const char *name, prs_struct *ps, int depth, u Stream an array of uint32s. Length is number of uint32s. ********************************************************************/ -BOOL prs_uint32s(BOOL charmode, const char *name, prs_struct *ps, int depth, uint32 *data32s, int len) +bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, int depth, uint32 *data32s, int len) { int i; char *q = prs_mem_get(ps, len * sizeof(uint32)); @@ -1016,7 +1016,7 @@ BOOL prs_uint32s(BOOL charmode, const char *name, prs_struct *ps, int depth, uin in uint16 chars. The unicode string is already in little-endian format. ********************************************************************/ -BOOL prs_buffer5(BOOL charmode, const char *name, prs_struct *ps, int depth, BUFFER5 *str) +bool prs_buffer5(bool charmode, const char *name, prs_struct *ps, int depth, BUFFER5 *str) { char *p; char *q = prs_mem_get(ps, str->buf_len * sizeof(uint16)); @@ -1047,7 +1047,7 @@ BOOL prs_buffer5(BOOL charmode, const char *name, prs_struct *ps, int depth, BUF in byte chars. String is in little-endian format. ********************************************************************/ -BOOL prs_regval_buffer(BOOL charmode, const char *name, prs_struct *ps, int depth, REGVAL_BUFFER *buf) +bool prs_regval_buffer(bool charmode, const char *name, prs_struct *ps, int depth, REGVAL_BUFFER *buf) { char *p; char *q = prs_mem_get(ps, buf->buf_len); @@ -1080,7 +1080,7 @@ BOOL prs_regval_buffer(BOOL charmode, const char *name, prs_struct *ps, int dept in uint8 chars. ********************************************************************/ -BOOL prs_string2(BOOL charmode, const char *name, prs_struct *ps, int depth, STRING2 *str) +bool prs_string2(bool charmode, const char *name, prs_struct *ps, int depth, STRING2 *str) { unsigned int i; char *q = prs_mem_get(ps, str->str_str_len); @@ -1130,7 +1130,7 @@ BOOL prs_string2(BOOL charmode, const char *name, prs_struct *ps, int depth, STR in uint16 chars. The unicode string is already in little-endian format. ********************************************************************/ -BOOL prs_unistr2(BOOL charmode, const char *name, prs_struct *ps, int depth, UNISTR2 *str) +bool prs_unistr2(bool charmode, const char *name, prs_struct *ps, int depth, UNISTR2 *str) { char *p; char *q = prs_mem_get(ps, str->uni_str_len * sizeof(uint16)); @@ -1168,7 +1168,7 @@ BOOL prs_unistr2(BOOL charmode, const char *name, prs_struct *ps, int depth, UNI in uint16 chars. The unicode string is already in little-endian format. ********************************************************************/ -BOOL prs_unistr3(BOOL charmode, const char *name, UNISTR3 *str, prs_struct *ps, int depth) +bool prs_unistr3(bool charmode, const char *name, UNISTR3 *str, prs_struct *ps, int depth) { char *p; char *q = prs_mem_get(ps, str->uni_str_len * sizeof(uint16)); @@ -1198,7 +1198,7 @@ BOOL prs_unistr3(BOOL charmode, const char *name, UNISTR3 *str, prs_struct *ps, in little-endian format then do it as a stream of bytes. ********************************************************************/ -BOOL prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) +bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) { unsigned int len = 0; unsigned char *p = (unsigned char *)str->buffer; @@ -1323,7 +1323,7 @@ BOOL prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) not include the null-termination character. ********************************************************************/ -BOOL prs_string(const char *name, prs_struct *ps, int depth, char *str, int max_buf_size) +bool prs_string(const char *name, prs_struct *ps, int depth, char *str, int max_buf_size) { char *q; int i; @@ -1361,7 +1361,7 @@ BOOL prs_string(const char *name, prs_struct *ps, int depth, char *str, int max_ return True; } -BOOL prs_string_alloc(const char *name, prs_struct *ps, int depth, const char **str) +bool prs_string_alloc(const char *name, prs_struct *ps, int depth, const char **str) { size_t len; char *tmp_str; @@ -1395,7 +1395,7 @@ BOOL prs_string_alloc(const char *name, prs_struct *ps, int depth, const char ** uint16 should be stored, or gets the size if reading. ********************************************************************/ -BOOL prs_uint16_pre(const char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset) +bool prs_uint16_pre(const char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset) { *offset = ps->data_offset; if (UNMARSHALLING(ps)) { @@ -1415,7 +1415,7 @@ BOOL prs_uint16_pre(const char *name, prs_struct *ps, int depth, uint16 *data16, does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ -BOOL prs_uint16_post(const char *name, prs_struct *ps, int depth, uint16 *data16, +bool prs_uint16_post(const char *name, prs_struct *ps, int depth, uint16 *data16, uint32 ptr_uint16, uint32 start_offset) { if (MARSHALLING(ps)) { @@ -1442,7 +1442,7 @@ BOOL prs_uint16_post(const char *name, prs_struct *ps, int depth, uint16 *data16 uint32 should be stored, or gets the size if reading. ********************************************************************/ -BOOL prs_uint32_pre(const char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset) +bool prs_uint32_pre(const char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset) { *offset = ps->data_offset; if (UNMARSHALLING(ps) && (data32 != NULL)) { @@ -1459,7 +1459,7 @@ BOOL prs_uint32_pre(const char *name, prs_struct *ps, int depth, uint32 *data32, does nothing on reading, as that is already handled by ...._pre() ********************************************************************/ -BOOL prs_uint32_post(const char *name, prs_struct *ps, int depth, uint32 *data32, +bool prs_uint32_post(const char *name, prs_struct *ps, int depth, uint32 *data32, uint32 ptr_uint32, uint32 data_size) { if (MARSHALLING(ps)) { @@ -1506,7 +1506,7 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps, TALLOC_CTX *m hash a stream. ********************************************************************/ -BOOL prs_hash1(prs_struct *ps, uint32 offset, int len) +bool prs_hash1(prs_struct *ps, uint32 offset, int len) { char *q; @@ -1615,7 +1615,7 @@ static void schannel_deal_with_seq_num(struct schannel_auth_struct *a, creates an RPC_AUTH_SCHANNEL_CHK structure. ********************************************************************/ -static BOOL init_rpc_auth_schannel_chk(RPC_AUTH_SCHANNEL_CHK * chk, +static bool init_rpc_auth_schannel_chk(RPC_AUTH_SCHANNEL_CHK * chk, const uchar sig[8], const uchar packet_digest[8], const uchar seq_num[8], const uchar confounder[8]) @@ -1717,7 +1717,7 @@ void schannel_encode(struct schannel_auth_struct *a, enum pipe_auth_level auth_l as well as decode sealed messages ********************************************************************/ -BOOL schannel_decode(struct schannel_auth_struct *a, enum pipe_auth_level auth_level, +bool schannel_decode(struct schannel_auth_struct *a, enum pipe_auth_level auth_level, enum schannel_direction direction, RPC_AUTH_SCHANNEL_CHK * verf, char *data, size_t data_len) { @@ -1819,7 +1819,7 @@ BOOL schannel_decode(struct schannel_auth_struct *a, enum pipe_auth_level auth_l /******************************************************************* creates a new prs_struct containing a DATA_BLOB ********************************************************************/ -BOOL prs_init_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) +bool prs_init_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) { if (!prs_init( prs, RPC_MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL )) return False; @@ -1834,7 +1834,7 @@ BOOL prs_init_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) /******************************************************************* return the contents of a prs_struct in a DATA_BLOB ********************************************************************/ -BOOL prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) +bool prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) { blob->length = prs_data_size(prs); blob->data = (uint8 *)TALLOC_ZERO_SIZE(mem_ctx, blob->length); diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index d1f7ad3e85..b696080aef 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -258,7 +258,7 @@ void init_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, Reads or writes an RPC_HDR structure. ********************************************************************/ -BOOL smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) +bool smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -312,7 +312,7 @@ BOOL smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) Reads or writes an RPC_IFACE structure. ********************************************************************/ -static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) +static bool smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) { if (ifc == NULL) return False; @@ -346,7 +346,7 @@ static void init_rpc_addr_str(RPC_ADDR_STR *str, const char *name) Reads or writes an RPC_ADDR_STR structure. ********************************************************************/ -static BOOL smb_io_rpc_addr_str(const char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) +static bool smb_io_rpc_addr_str(const char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) { if (str == NULL) return False; @@ -378,7 +378,7 @@ static void init_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsiz Reads or writes an RPC_HDR_BBA structure. ********************************************************************/ -static BOOL smb_io_rpc_hdr_bba(const char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) +static bool smb_io_rpc_hdr_bba(const char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -431,7 +431,7 @@ void init_rpc_hdr_rb(RPC_HDR_RB *rpc, Reads or writes an RPC_CONTEXT structure. ********************************************************************/ -BOOL smb_io_rpc_context(const char *desc, RPC_CONTEXT *rpc_ctx, prs_struct *ps, int depth) +bool smb_io_rpc_context(const char *desc, RPC_CONTEXT *rpc_ctx, prs_struct *ps, int depth) { int i; @@ -469,7 +469,7 @@ BOOL smb_io_rpc_context(const char *desc, RPC_CONTEXT *rpc_ctx, prs_struct *ps, Reads or writes an RPC_HDR_RB structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) +bool smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) { int i; @@ -525,7 +525,7 @@ static void init_rpc_results(RPC_RESULTS *res, lkclXXXX only one reason at the moment! ********************************************************************/ -static BOOL smb_io_rpc_results(const char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) +static bool smb_io_rpc_results(const char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) { if (res == NULL) return False; @@ -574,7 +574,7 @@ void init_rpc_hdr_ba(RPC_HDR_BA *rpc, Reads or writes an RPC_HDR_BA structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_ba(const char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) +bool smb_io_rpc_hdr_ba(const char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -608,7 +608,7 @@ void init_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum) Reads or writes an RPC_HDR_REQ structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_req(const char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) +bool smb_io_rpc_hdr_req(const char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -629,7 +629,7 @@ BOOL smb_io_rpc_hdr_req(const char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int Reads or writes an RPC_HDR_RESP structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_resp(const char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) +bool smb_io_rpc_hdr_resp(const char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -652,7 +652,7 @@ BOOL smb_io_rpc_hdr_resp(const char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, in Reads or writes an RPC_HDR_FAULT structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth) +bool smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -688,7 +688,7 @@ void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, Reads or writes an RPC_HDR_AUTH structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) +bool smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) { if (rai == NULL) return False; @@ -717,7 +717,7 @@ BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, in Checks an RPC_AUTH_VERIFIER structure. ********************************************************************/ -BOOL rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav, +bool rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav, const char *signature, uint32 msg_type) { return (strequal(rav->signature, signature) && rav->msg_type == msg_type); @@ -738,7 +738,7 @@ void init_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, Reads or writes an RPC_AUTH_VERIFIER structure. ********************************************************************/ -BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +bool smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) { if (rav == NULL) return False; @@ -760,7 +760,7 @@ BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_stru This parses an RPC_AUTH_VERIFIER for schannel. I think ********************************************************************/ -BOOL smb_io_rpc_schannel_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +bool smb_io_rpc_schannel_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) { if (rav == NULL) return False; @@ -793,7 +793,7 @@ void init_rpc_auth_schannel_neg(RPC_AUTH_SCHANNEL_NEG *neg, Reads or writes an RPC_AUTH_SCHANNEL_NEG structure. ********************************************************************/ -BOOL smb_io_rpc_auth_schannel_neg(const char *desc, RPC_AUTH_SCHANNEL_NEG *neg, +bool smb_io_rpc_auth_schannel_neg(const char *desc, RPC_AUTH_SCHANNEL_NEG *neg, prs_struct *ps, int depth) { if (neg == NULL) @@ -821,7 +821,7 @@ BOOL smb_io_rpc_auth_schannel_neg(const char *desc, RPC_AUTH_SCHANNEL_NEG *neg, reads or writes an RPC_AUTH_SCHANNEL_CHK structure. ********************************************************************/ -BOOL smb_io_rpc_auth_schannel_chk(const char *desc, int auth_len, +bool smb_io_rpc_auth_schannel_chk(const char *desc, int auth_len, RPC_AUTH_SCHANNEL_CHK * chk, prs_struct *ps, int depth) { diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 407aae66e3..0085980ebf 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -43,7 +43,7 @@ void init_samr_q_close_hnd(SAMR_Q_CLOSE_HND * q_c, POLICY_HND *hnd) reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_close_hnd(const char *desc, SAMR_Q_CLOSE_HND * q_u, +bool samr_io_q_close_hnd(const char *desc, SAMR_Q_CLOSE_HND * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -62,7 +62,7 @@ BOOL samr_io_q_close_hnd(const char *desc, SAMR_Q_CLOSE_HND * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_close_hnd(const char *desc, SAMR_R_CLOSE_HND * r_u, +bool samr_io_r_close_hnd(const char *desc, SAMR_R_CLOSE_HND * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -101,7 +101,7 @@ void init_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN * q_u, /******************************************************************* reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_lookup_domain(const char *desc, SAMR_Q_LOOKUP_DOMAIN * q_u, +bool samr_io_q_lookup_domain(const char *desc, SAMR_Q_LOOKUP_DOMAIN * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -146,7 +146,7 @@ void init_samr_r_lookup_domain(SAMR_R_LOOKUP_DOMAIN * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_lookup_domain(const char *desc, SAMR_R_LOOKUP_DOMAIN * r_u, +bool samr_io_r_lookup_domain(const char *desc, SAMR_R_LOOKUP_DOMAIN * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -190,7 +190,7 @@ void init_samr_q_remove_sid_foreign_domain(SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN * q_ reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_remove_sid_foreign_domain(const char *desc, SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN * q_u, +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) @@ -218,7 +218,7 @@ BOOL samr_io_q_remove_sid_foreign_domain(const char *desc, SAMR_Q_REMOVE_SID_FOR reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_remove_sid_foreign_domain(const char *desc, SAMR_R_REMOVE_SID_FOREIGN_DOMAIN * r_u, +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) @@ -255,7 +255,7 @@ void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_open_domain(const char *desc, SAMR_Q_OPEN_DOMAIN * q_u, +bool samr_io_q_open_domain(const char *desc, SAMR_Q_OPEN_DOMAIN * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -283,7 +283,7 @@ BOOL samr_io_q_open_domain(const char *desc, SAMR_Q_OPEN_DOMAIN * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_open_domain(const char *desc, SAMR_R_OPEN_DOMAIN * r_u, +bool samr_io_r_open_domain(const char *desc, SAMR_R_OPEN_DOMAIN * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -320,7 +320,7 @@ void init_samr_q_get_usrdom_pwinfo(SAMR_Q_GET_USRDOM_PWINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_get_usrdom_pwinfo(const char *desc, SAMR_Q_GET_USRDOM_PWINFO * q_u, +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) @@ -362,7 +362,7 @@ void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO *r_u, NTSTATUS statu reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_get_usrdom_pwinfo(const char *desc, SAMR_R_GET_USRDOM_PWINFO * r_u, +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) @@ -392,7 +392,7 @@ BOOL samr_io_r_get_usrdom_pwinfo(const char *desc, SAMR_R_GET_USRDOM_PWINFO * r_ reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_sec_obj(const char *desc, SAMR_Q_SET_SEC_OBJ * q_u, +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) @@ -435,7 +435,7 @@ void init_samr_q_query_sec_obj(SAMR_Q_QUERY_SEC_OBJ * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_sec_obj(const char *desc, SAMR_Q_QUERY_SEC_OBJ * q_u, +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) @@ -473,7 +473,7 @@ void init_samr_q_query_domain_info(SAMR_Q_QUERY_DOMAIN_INFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_domain_info(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO * q_u, +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) @@ -521,7 +521,7 @@ void init_unk_info1(SAM_UNK_INFO_1 *u_1, uint16 min_pass_len, uint16 pass_hist, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info1(const char *desc, SAM_UNK_INFO_1 * u_1, +static bool sam_io_unk_info1(const char *desc, SAM_UNK_INFO_1 * u_1, prs_struct *ps, int depth) { if (u_1 == NULL) @@ -576,7 +576,7 @@ void init_unk_info2(SAM_UNK_INFO_2 * u_2, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2, +static bool sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2, prs_struct *ps, int depth) { if (u_2 == NULL) @@ -637,7 +637,7 @@ void init_unk_info3(SAM_UNK_INFO_3 *u_3, NTTIME nt_logout) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info3(const char *desc, SAM_UNK_INFO_3 * u_3, +static bool sam_io_unk_info3(const char *desc, SAM_UNK_INFO_3 * u_3, prs_struct *ps, int depth) { if (u_3 == NULL) @@ -666,7 +666,7 @@ void init_unk_info4(SAM_UNK_INFO_4 * u_4,const char *comment) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info4(const char *desc, SAM_UNK_INFO_4 * u_4, +static bool sam_io_unk_info4(const char *desc, SAM_UNK_INFO_4 * u_4, prs_struct *ps, int depth) { if (u_4 == NULL) @@ -698,7 +698,7 @@ void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *domain) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5, +static bool sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5, prs_struct *ps, int depth) { if (u_5 == NULL) @@ -730,7 +730,7 @@ void init_unk_info6(SAM_UNK_INFO_6 * u_6, const char *server) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info6(const char *desc, SAM_UNK_INFO_6 * u_6, +static bool sam_io_unk_info6(const char *desc, SAM_UNK_INFO_6 * u_6, prs_struct *ps, int depth) { if (u_6 == NULL) @@ -761,7 +761,7 @@ void init_unk_info7(SAM_UNK_INFO_7 * u_7, uint32 server_role) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info7(const char *desc, SAM_UNK_INFO_7 * u_7, +static bool sam_io_unk_info7(const char *desc, SAM_UNK_INFO_7 * u_7, prs_struct *ps, int depth) { if (u_7 == NULL) @@ -790,7 +790,7 @@ void init_unk_info8(SAM_UNK_INFO_8 * u_8, uint32 seq_num) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info8(const char *desc, SAM_UNK_INFO_8 * u_8, +static bool sam_io_unk_info8(const char *desc, SAM_UNK_INFO_8 * u_8, prs_struct *ps, int depth) { if (u_8 == NULL) @@ -821,7 +821,7 @@ void init_unk_info9(SAM_UNK_INFO_9 * u_9, uint32 unknown) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info9(const char *desc, SAM_UNK_INFO_9 * u_9, +static bool sam_io_unk_info9(const char *desc, SAM_UNK_INFO_9 * u_9, prs_struct *ps, int depth) { if (u_9 == NULL) @@ -852,7 +852,7 @@ void init_unk_info12(SAM_UNK_INFO_12 * u_12, NTTIME nt_lock_duration, NTTIME nt_ reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info12(const char *desc, SAM_UNK_INFO_12 * u_12, +static bool sam_io_unk_info12(const char *desc, SAM_UNK_INFO_12 * u_12, prs_struct *ps, int depth) { if (u_12 == NULL) @@ -887,7 +887,7 @@ void init_unk_info13(SAM_UNK_INFO_13 * u_13, uint32 seq_num) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info13(const char *desc, SAM_UNK_INFO_13 * u_13, +static bool sam_io_unk_info13(const char *desc, SAM_UNK_INFO_13 * u_13, prs_struct *ps, int depth) { if (u_13 == NULL) @@ -935,7 +935,7 @@ void init_samr_r_query_domain_info(SAMR_R_QUERY_DOMAIN_INFO * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_domain_info(const char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, +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) @@ -1037,7 +1037,7 @@ void init_samr_q_set_sec_obj(SAMR_Q_SET_SEC_OBJ * q_u, 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, +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) @@ -1059,7 +1059,7 @@ BOOL samr_io_r_set_sec_obj(const char *desc, SAMR_R_SET_SEC_OBJ * r_u, 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, +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) @@ -1088,7 +1088,7 @@ BOOL samr_io_r_query_sec_obj(const char *desc, SAMR_R_QUERY_SEC_OBJ * r_u, reads or writes a SAM_STR1 structure. ********************************************************************/ -static BOOL sam_io_sam_str1(const char *desc, SAM_STR1 * sam, uint32 acct_buf, +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) { @@ -1138,7 +1138,7 @@ static void init_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, reads or writes a SAM_ENTRY1 structure. ********************************************************************/ -static BOOL sam_io_sam_entry1(const char *desc, SAM_ENTRY1 * sam, +static bool sam_io_sam_entry1(const char *desc, SAM_ENTRY1 * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1172,7 +1172,7 @@ static BOOL sam_io_sam_entry1(const char *desc, SAM_ENTRY1 * sam, reads or writes a SAM_STR2 structure. ********************************************************************/ -static BOOL sam_io_sam_str2(const char *desc, SAM_STR2 * sam, uint32 acct_buf, +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) @@ -1213,7 +1213,7 @@ static void init_sam_entry2(SAM_ENTRY2 * sam, uint32 user_idx, reads or writes a SAM_ENTRY2 structure. ********************************************************************/ -static BOOL sam_io_sam_entry2(const char *desc, SAM_ENTRY2 * sam, +static bool sam_io_sam_entry2(const char *desc, SAM_ENTRY2 * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1245,7 +1245,7 @@ static BOOL sam_io_sam_entry2(const char *desc, SAM_ENTRY2 * sam, reads or writes a SAM_STR3 structure. ********************************************************************/ -static BOOL sam_io_sam_str3(const char *desc, SAM_STR3 * sam, uint32 acct_buf, +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) @@ -1287,7 +1287,7 @@ static void init_sam_entry3(SAM_ENTRY3 * sam, uint32 grp_idx, reads or writes a SAM_ENTRY3 structure. ********************************************************************/ -static BOOL sam_io_sam_entry3(const char *desc, SAM_ENTRY3 * sam, +static bool sam_io_sam_entry3(const char *desc, SAM_ENTRY3 * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1332,7 +1332,7 @@ static void init_sam_entry4(SAM_ENTRY4 * sam, uint32 user_idx, reads or writes a SAM_ENTRY4 structure. ********************************************************************/ -static BOOL sam_io_sam_entry4(const char *desc, SAM_ENTRY4 * sam, +static bool sam_io_sam_entry4(const char *desc, SAM_ENTRY4 * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1370,7 +1370,7 @@ static void init_sam_entry5(SAM_ENTRY5 * sam, uint32 grp_idx, reads or writes a SAM_ENTRY5 structure. ********************************************************************/ -static BOOL sam_io_sam_entry5(const char *desc, SAM_ENTRY5 * sam, +static bool sam_io_sam_entry5(const char *desc, SAM_ENTRY5 * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1406,7 +1406,7 @@ void init_sam_entry(SAM_ENTRY *sam, UNISTR2 *uni2, uint32 rid) reads or writes a SAM_ENTRY structure. ********************************************************************/ -static BOOL sam_io_sam_entry(const char *desc, SAM_ENTRY * sam, +static bool sam_io_sam_entry(const char *desc, SAM_ENTRY * sam, prs_struct *ps, int depth) { if (sam == NULL) @@ -1446,7 +1446,7 @@ void init_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS * q_e, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_enum_dom_users(const char *desc, SAMR_Q_ENUM_DOM_USERS * q_e, +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) @@ -1502,7 +1502,7 @@ void init_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_enum_dom_users(const char *desc, SAMR_R_ENUM_DOM_USERS * r_u, +bool samr_io_r_enum_dom_users(const char *desc, SAMR_R_ENUM_DOM_USERS * r_u, prs_struct *ps, int depth) { uint32 i; @@ -1587,7 +1587,7 @@ void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO * q_e, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_dispinfo(const char *desc, SAMR_Q_QUERY_DISPINFO * q_e, +bool samr_io_q_query_dispinfo(const char *desc, SAMR_Q_QUERY_DISPINFO * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -1666,7 +1666,7 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 **sam, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_1(const char *desc, SAM_DISPINFO_1 * sam, +static bool sam_io_sam_dispinfo_1(const char *desc, SAM_DISPINFO_1 * sam, uint32 num_entries, prs_struct *ps, int depth) { @@ -1753,7 +1753,7 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 **sam, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_2(const char *desc, SAM_DISPINFO_2 * sam, +static bool sam_io_sam_dispinfo_2(const char *desc, SAM_DISPINFO_2 * sam, uint32 num_entries, prs_struct *ps, int depth) { @@ -1842,7 +1842,7 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 **sam, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_3(const char *desc, SAM_DISPINFO_3 * sam, +static bool sam_io_sam_dispinfo_3(const char *desc, SAM_DISPINFO_3 * sam, uint32 num_entries, prs_struct *ps, int depth) { @@ -1932,7 +1932,7 @@ NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 **sam, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_4(const char *desc, SAM_DISPINFO_4 * sam, +static bool sam_io_sam_dispinfo_4(const char *desc, SAM_DISPINFO_4 * sam, uint32 num_entries, prs_struct *ps, int depth) { @@ -2017,7 +2017,7 @@ NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 **sam, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_sam_dispinfo_5(const char *desc, SAM_DISPINFO_5 * sam, +static bool sam_io_sam_dispinfo_5(const char *desc, SAM_DISPINFO_5 * sam, uint32 num_entries, prs_struct *ps, int depth) { @@ -2092,7 +2092,7 @@ void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u, +bool samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2190,7 +2190,7 @@ void init_samr_q_open_group(SAMR_Q_OPEN_GROUP * q_c, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_open_group(const char *desc, SAMR_Q_OPEN_GROUP * q_u, +bool samr_io_q_open_group(const char *desc, SAMR_Q_OPEN_GROUP * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -2217,7 +2217,7 @@ BOOL samr_io_q_open_group(const char *desc, SAMR_Q_OPEN_GROUP * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_open_group(const char *desc, SAMR_R_OPEN_GROUP * r_u, +bool samr_io_r_open_group(const char *desc, SAMR_R_OPEN_GROUP * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2261,7 +2261,7 @@ void init_samr_group_info1(GROUP_INFO1 * gr1, reads or writes a structure. ********************************************************************/ -BOOL samr_io_group_info1(const char *desc, GROUP_INFO1 * gr1, +bool samr_io_group_info1(const char *desc, GROUP_INFO1 * gr1, prs_struct *ps, int depth) { uint16 dummy = 1; @@ -2317,7 +2317,7 @@ void init_samr_group_info2(GROUP_INFO2 * gr2, const char *acct_name) reads or writes a structure. ********************************************************************/ -BOOL samr_io_group_info2(const char *desc, GROUP_INFO2 *gr2, prs_struct *ps, int depth) +bool samr_io_group_info2(const char *desc, GROUP_INFO2 *gr2, prs_struct *ps, int depth) { if (gr2 == NULL) return False; @@ -2352,7 +2352,7 @@ void init_samr_group_info3(GROUP_INFO3 *gr3) reads or writes a structure. ********************************************************************/ -BOOL samr_io_group_info3(const char *desc, GROUP_INFO3 *gr3, prs_struct *ps, int depth) +bool samr_io_group_info3(const char *desc, GROUP_INFO3 *gr3, prs_struct *ps, int depth) { if (gr3 == NULL) return False; @@ -2386,7 +2386,7 @@ void init_samr_group_info4(GROUP_INFO4 * gr4, const char *acct_desc) reads or writes a structure. ********************************************************************/ -BOOL samr_io_group_info4(const char *desc, GROUP_INFO4 * gr4, +bool samr_io_group_info4(const char *desc, GROUP_INFO4 * gr4, prs_struct *ps, int depth) { if (gr4 == NULL) @@ -2429,7 +2429,7 @@ void init_samr_group_info5(GROUP_INFO5 * gr5, reads or writes a structure. ********************************************************************/ -BOOL samr_io_group_info5(const char *desc, GROUP_INFO5 * gr5, +bool samr_io_group_info5(const char *desc, GROUP_INFO5 * gr5, prs_struct *ps, int depth) { uint16 dummy = 1; @@ -2473,7 +2473,7 @@ BOOL samr_io_group_info5(const char *desc, GROUP_INFO5 * gr5, reads or writes a structure. ********************************************************************/ -static BOOL samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr, +static bool samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr, prs_struct *ps, int depth) { if (UNMARSHALLING(ps)) @@ -2539,7 +2539,7 @@ void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_create_dom_group(const char *desc, SAMR_Q_CREATE_DOM_GROUP * q_e, +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) @@ -2572,7 +2572,7 @@ BOOL samr_io_q_create_dom_group(const char *desc, SAMR_Q_CREATE_DOM_GROUP * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_create_dom_group(const char *desc, SAMR_R_CREATE_DOM_GROUP * r_u, +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) @@ -2611,7 +2611,7 @@ void init_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP * q_c, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_delete_dom_group(const char *desc, SAMR_Q_DELETE_DOM_GROUP * q_u, +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) @@ -2633,7 +2633,7 @@ BOOL samr_io_q_delete_dom_group(const char *desc, SAMR_Q_DELETE_DOM_GROUP * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_delete_dom_group(const char *desc, SAMR_R_DELETE_DOM_GROUP * r_u, +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) @@ -2671,7 +2671,7 @@ void init_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_del_groupmem(const char *desc, SAMR_Q_DEL_GROUPMEM * q_e, +bool samr_io_q_del_groupmem(const char *desc, SAMR_Q_DEL_GROUPMEM * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -2708,7 +2708,7 @@ void init_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM * r_u, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_del_groupmem(const char *desc, SAMR_R_DEL_GROUPMEM * r_u, +bool samr_io_r_del_groupmem(const char *desc, SAMR_R_DEL_GROUPMEM * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2744,7 +2744,7 @@ void init_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_add_groupmem(const char *desc, SAMR_Q_ADD_GROUPMEM * q_e, +bool samr_io_q_add_groupmem(const char *desc, SAMR_Q_ADD_GROUPMEM * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -2783,7 +2783,7 @@ void init_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM * r_u, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_add_groupmem(const char *desc, SAMR_R_ADD_GROUPMEM * r_u, +bool samr_io_r_add_groupmem(const char *desc, SAMR_R_ADD_GROUPMEM * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2818,7 +2818,7 @@ void init_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_groupinfo(const char *desc, SAMR_Q_SET_GROUPINFO * q_e, +bool samr_io_q_set_groupinfo(const char *desc, SAMR_Q_SET_GROUPINFO * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -2854,7 +2854,7 @@ void init_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO * r_u, NTSTATUS status) reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_groupinfo(const char *desc, SAMR_R_SET_GROUPINFO * r_u, +bool samr_io_r_set_groupinfo(const char *desc, SAMR_R_SET_GROUPINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2890,7 +2890,7 @@ void init_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_groupinfo(const char *desc, SAMR_Q_QUERY_GROUPINFO * q_e, +bool samr_io_q_query_groupinfo(const char *desc, SAMR_Q_QUERY_GROUPINFO * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -2929,7 +2929,7 @@ void init_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_groupinfo(const char *desc, SAMR_R_QUERY_GROUPINFO * r_u, +bool samr_io_r_query_groupinfo(const char *desc, SAMR_R_QUERY_GROUPINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -2972,7 +2972,7 @@ void init_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM * q_c, POLICY_HND *hnd) reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_groupmem(const char *desc, SAMR_Q_QUERY_GROUPMEM * q_u, +bool samr_io_q_query_groupmem(const char *desc, SAMR_Q_QUERY_GROUPMEM * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -3024,7 +3024,7 @@ void init_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_groupmem(const char *desc, SAMR_R_QUERY_GROUPMEM * r_u, +bool samr_io_r_query_groupmem(const char *desc, SAMR_R_QUERY_GROUPMEM * r_u, prs_struct *ps, int depth) { uint32 i; @@ -3106,7 +3106,7 @@ void init_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_usergroups(const char *desc, SAMR_Q_QUERY_USERGROUPS * q_u, +bool samr_io_q_query_usergroups(const char *desc, SAMR_Q_QUERY_USERGROUPS * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -3155,7 +3155,7 @@ void init_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_gids(const char *desc, uint32 *num_gids, DOM_GID ** gid, +bool samr_io_gids(const char *desc, uint32 *num_gids, DOM_GID ** gid, prs_struct *ps, int depth) { uint32 i; @@ -3193,7 +3193,7 @@ BOOL samr_io_gids(const char *desc, uint32 *num_gids, DOM_GID ** gid, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_usergroups(const char *desc, SAMR_R_QUERY_USERGROUPS * r_u, +bool samr_io_r_query_usergroups(const char *desc, SAMR_R_QUERY_USERGROUPS * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -3248,7 +3248,7 @@ void init_samr_q_enum_domains(SAMR_Q_ENUM_DOMAINS * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_enum_domains(const char *desc, SAMR_Q_ENUM_DOMAINS * q_e, +bool samr_io_q_enum_domains(const char *desc, SAMR_Q_ENUM_DOMAINS * q_e, prs_struct *ps, int depth) { if (q_e == NULL) @@ -3300,7 +3300,7 @@ void init_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_enum_domains(const char *desc, SAMR_R_ENUM_DOMAINS * r_u, +bool samr_io_r_enum_domains(const char *desc, SAMR_R_ENUM_DOMAINS * r_u, prs_struct *ps, int depth) { uint32 i; @@ -3387,7 +3387,7 @@ void init_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_enum_dom_groups(const char *desc, SAMR_Q_ENUM_DOM_GROUPS * q_e, +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) @@ -3439,7 +3439,7 @@ void init_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_enum_dom_groups(const char *desc, SAMR_R_ENUM_DOM_GROUPS * r_u, +bool samr_io_r_enum_dom_groups(const char *desc, SAMR_R_ENUM_DOM_GROUPS * r_u, prs_struct *ps, int depth) { uint32 i; @@ -3522,7 +3522,7 @@ void init_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_enum_dom_aliases(const char *desc, SAMR_Q_ENUM_DOM_ALIASES * q_e, +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) @@ -3573,7 +3573,7 @@ void init_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, uint32 next_idx, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_enum_dom_aliases(const char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u, +bool samr_io_r_enum_dom_aliases(const char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u, prs_struct *ps, int depth) { uint32 i; @@ -3653,7 +3653,7 @@ void init_samr_alias_info1(ALIAS_INFO1 * al1, char *acct_name, uint32 num_member reads or writes a structure. ********************************************************************/ -BOOL samr_io_alias_info1(const char *desc, ALIAS_INFO1 * al1, +bool samr_io_alias_info1(const char *desc, ALIAS_INFO1 * al1, prs_struct *ps, int depth) { if (al1 == NULL) @@ -3699,7 +3699,7 @@ void init_samr_alias_info3(ALIAS_INFO3 * al3, const char *acct_desc) reads or writes a structure. ********************************************************************/ -BOOL samr_io_alias_info3(const char *desc, ALIAS_INFO3 *al3, +bool samr_io_alias_info3(const char *desc, ALIAS_INFO3 *al3, prs_struct *ps, int depth) { if (al3 == NULL) @@ -3721,7 +3721,7 @@ BOOL samr_io_alias_info3(const char *desc, ALIAS_INFO3 *al3, reads or writes a structure. ********************************************************************/ -BOOL samr_io_alias_info2(const char *desc, ALIAS_INFO2 *al2, +bool samr_io_alias_info2(const char *desc, ALIAS_INFO2 *al2, prs_struct *ps, int depth) { if (al2 == NULL) @@ -3743,7 +3743,7 @@ BOOL samr_io_alias_info2(const char *desc, ALIAS_INFO2 *al2, reads or writes a structure. ********************************************************************/ -BOOL samr_alias_info_ctr(const char *desc, prs_struct *ps, int depth, ALIAS_INFO_CTR * ctr) +bool samr_alias_info_ctr(const char *desc, prs_struct *ps, int depth, ALIAS_INFO_CTR * ctr) { if ( !ctr ) return False; @@ -3794,7 +3794,7 @@ void init_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO * q_e, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_aliasinfo(const char *desc, SAMR_Q_QUERY_ALIASINFO *in, +bool samr_io_q_query_aliasinfo(const char *desc, SAMR_Q_QUERY_ALIASINFO *in, prs_struct *ps, int depth) { if ( !in ) @@ -3832,7 +3832,7 @@ void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *out, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_aliasinfo(const char *desc, SAMR_R_QUERY_ALIASINFO *out, +bool samr_io_r_query_aliasinfo(const char *desc, SAMR_R_QUERY_ALIASINFO *out, prs_struct *ps, int depth) { if ( !out ) @@ -3872,7 +3872,7 @@ void init_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_aliasinfo(const char *desc, SAMR_Q_SET_ALIASINFO * q_u, +bool samr_io_q_set_aliasinfo(const char *desc, SAMR_Q_SET_ALIASINFO * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -3896,7 +3896,7 @@ BOOL samr_io_q_set_aliasinfo(const char *desc, SAMR_Q_SET_ALIASINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_aliasinfo(const char *desc, SAMR_R_SET_ALIASINFO * r_u, +bool samr_io_r_set_aliasinfo(const char *desc, SAMR_R_SET_ALIASINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -3938,7 +3938,7 @@ void init_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES * q_u, reads or writes a SAMR_Q_QUERY_USERALIASES structure. ********************************************************************/ -BOOL samr_io_q_query_useraliases(const char *desc, SAMR_Q_QUERY_USERALIASES * q_u, +bool samr_io_q_query_useraliases(const char *desc, SAMR_Q_QUERY_USERALIASES * q_u, prs_struct *ps, int depth) { fstring tmp; @@ -4023,7 +4023,7 @@ void init_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_rids(const char *desc, uint32 *num_rids, uint32 **rid, +bool samr_io_rids(const char *desc, uint32 *num_rids, uint32 **rid, prs_struct *ps, int depth) { fstring tmp; @@ -4062,7 +4062,7 @@ BOOL samr_io_rids(const char *desc, uint32 *num_rids, uint32 **rid, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_useraliases(const char *desc, SAMR_R_QUERY_USERALIASES * r_u, +bool samr_io_r_query_useraliases(const char *desc, SAMR_R_QUERY_USERALIASES * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -4110,7 +4110,7 @@ void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS * q_u, POLICY_HND *pol, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_open_alias(const char *desc, SAMR_Q_OPEN_ALIAS * q_u, +bool samr_io_q_open_alias(const char *desc, SAMR_Q_OPEN_ALIAS * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -4137,7 +4137,7 @@ BOOL samr_io_q_open_alias(const char *desc, SAMR_Q_OPEN_ALIAS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_open_alias(const char *desc, SAMR_R_OPEN_ALIAS * r_u, +bool samr_io_r_open_alias(const char *desc, SAMR_R_OPEN_ALIAS * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -4191,7 +4191,7 @@ void init_samr_q_lookup_rids(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_RIDS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_lookup_rids(const char *desc, SAMR_Q_LOOKUP_RIDS * q_u, +bool samr_io_q_lookup_rids(const char *desc, SAMR_Q_LOOKUP_RIDS * q_u, prs_struct *ps, int depth) { uint32 i; @@ -4277,7 +4277,7 @@ void init_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u, +bool samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u, prs_struct *ps, int depth) { uint32 i; @@ -4371,7 +4371,7 @@ void init_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS * q_u, POLICY_HND *hnd) reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_delete_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u, +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) @@ -4393,7 +4393,7 @@ BOOL samr_io_q_delete_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_delete_alias(const char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u, +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) @@ -4434,7 +4434,7 @@ void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_create_dom_alias(const char *desc, SAMR_Q_CREATE_DOM_ALIAS * q_u, +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) @@ -4467,7 +4467,7 @@ BOOL samr_io_q_create_dom_alias(const char *desc, SAMR_Q_CREATE_DOM_ALIAS * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_create_dom_alias(const char *desc, SAMR_R_CREATE_DOM_ALIAS * r_u, +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) @@ -4508,7 +4508,7 @@ void init_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM * q_u, POLICY_HND *hnd, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_add_aliasmem(const char *desc, SAMR_Q_ADD_ALIASMEM * q_u, +bool samr_io_q_add_aliasmem(const char *desc, SAMR_Q_ADD_ALIASMEM * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -4532,7 +4532,7 @@ BOOL samr_io_q_add_aliasmem(const char *desc, SAMR_Q_ADD_ALIASMEM * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_add_aliasmem(const char *desc, SAMR_R_ADD_ALIASMEM * r_u, +bool samr_io_r_add_aliasmem(const char *desc, SAMR_R_ADD_ALIASMEM * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -4567,7 +4567,7 @@ void init_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM * q_u, POLICY_HND *hnd, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_del_aliasmem(const char *desc, SAMR_Q_DEL_ALIASMEM * q_u, +bool samr_io_q_del_aliasmem(const char *desc, SAMR_Q_DEL_ALIASMEM * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -4591,7 +4591,7 @@ BOOL samr_io_q_del_aliasmem(const char *desc, SAMR_Q_DEL_ALIASMEM * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_del_aliasmem(const char *desc, SAMR_R_DEL_ALIASMEM * r_u, +bool samr_io_r_del_aliasmem(const char *desc, SAMR_R_DEL_ALIASMEM * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -4625,7 +4625,7 @@ void init_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS * q_c, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_delete_dom_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u, +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) @@ -4659,7 +4659,7 @@ void init_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_delete_dom_alias(const char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u, +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) @@ -4696,7 +4696,7 @@ void init_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM * q_c, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_aliasmem(const char *desc, SAMR_Q_QUERY_ALIASMEM * q_u, +bool samr_io_q_query_aliasmem(const char *desc, SAMR_Q_QUERY_ALIASMEM * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -4742,7 +4742,7 @@ void init_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, +bool samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, prs_struct *ps, int depth) { uint32 i; @@ -4852,7 +4852,7 @@ NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_lookup_names(const char *desc, SAMR_Q_LOOKUP_NAMES * q_u, +bool samr_io_q_lookup_names(const char *desc, SAMR_Q_LOOKUP_NAMES * q_u, prs_struct *ps, int depth) { uint32 i; @@ -4955,7 +4955,7 @@ NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u, +bool samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u, prs_struct *ps, int depth) { uint32 i; @@ -5055,7 +5055,7 @@ void init_samr_q_delete_dom_user(SAMR_Q_DELETE_DOM_USER * q_c, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_delete_dom_user(const char *desc, SAMR_Q_DELETE_DOM_USER * q_u, +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) @@ -5077,7 +5077,7 @@ BOOL samr_io_q_delete_dom_user(const char *desc, SAMR_Q_DELETE_DOM_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_delete_dom_user(const char *desc, SAMR_R_DELETE_DOM_USER * r_u, +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) @@ -5116,7 +5116,7 @@ void init_samr_q_open_user(SAMR_Q_OPEN_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_open_user(const char *desc, SAMR_Q_OPEN_USER * q_u, +bool samr_io_q_open_user(const char *desc, SAMR_Q_OPEN_USER * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -5143,7 +5143,7 @@ BOOL samr_io_q_open_user(const char *desc, SAMR_Q_OPEN_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_open_user(const char *desc, SAMR_R_OPEN_USER * r_u, +bool samr_io_r_open_user(const char *desc, SAMR_R_OPEN_USER * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -5189,7 +5189,7 @@ void init_samr_q_create_user(SAMR_Q_CREATE_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_create_user(const char *desc, SAMR_Q_CREATE_USER * q_u, +bool samr_io_q_create_user(const char *desc, SAMR_Q_CREATE_USER * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -5223,7 +5223,7 @@ BOOL samr_io_q_create_user(const char *desc, SAMR_Q_CREATE_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_create_user(const char *desc, SAMR_R_CREATE_USER * r_u, +bool samr_io_r_create_user(const char *desc, SAMR_R_CREATE_USER * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -5265,7 +5265,7 @@ void init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_userinfo(const char *desc, SAMR_Q_QUERY_USERINFO * q_u, +bool samr_io_q_query_userinfo(const char *desc, SAMR_Q_QUERY_USERINFO * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -5290,7 +5290,7 @@ BOOL samr_io_q_query_userinfo(const char *desc, SAMR_Q_QUERY_USERINFO * q_u, reads or writes a LOGON_HRS structure. ********************************************************************/ -static BOOL sam_io_logon_hrs(const char *desc, LOGON_HRS * hrs, +static bool sam_io_logon_hrs(const char *desc, LOGON_HRS * hrs, prs_struct *ps, int depth) { if (hrs == NULL) @@ -5341,7 +5341,7 @@ void init_sam_user_info18(SAM_USER_INFO_18 * usr, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info18(const char *desc, SAM_USER_INFO_18 * u, +static bool sam_io_user_info18(const char *desc, SAM_USER_INFO_18 * u, prs_struct *ps, int depth) { if (u == NULL) @@ -5383,7 +5383,7 @@ void init_sam_user_info7(SAM_USER_INFO_7 * usr, const char *name) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info7(const char *desc, SAM_USER_INFO_7 * usr, +static bool sam_io_user_info7(const char *desc, SAM_USER_INFO_7 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -5419,7 +5419,7 @@ void init_sam_user_info9(SAM_USER_INFO_9 * usr, uint32 rid_group) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info9(const char *desc, SAM_USER_INFO_9 * usr, +static bool sam_io_user_info9(const char *desc, SAM_USER_INFO_9 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -5452,7 +5452,7 @@ void init_sam_user_info16(SAM_USER_INFO_16 * usr, uint32 acb_info) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info16(const char *desc, SAM_USER_INFO_16 * usr, +static bool sam_io_user_info16(const char *desc, SAM_USER_INFO_16 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -5516,7 +5516,7 @@ void init_sam_user_info17(SAM_USER_INFO_17 * usr, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info17(const char *desc, SAM_USER_INFO_17 * usr, +static bool sam_io_user_info17(const char *desc, SAM_USER_INFO_17 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -5608,7 +5608,7 @@ void init_sam_user_info24(SAM_USER_INFO_24 * usr, char newpass[516], reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info24(const char *desc, SAM_USER_INFO_24 * usr, +static bool sam_io_user_info24(const char *desc, SAM_USER_INFO_24 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -5639,7 +5639,7 @@ static BOOL sam_io_user_info24(const char *desc, SAM_USER_INFO_24 * usr, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info26(const char *desc, SAM_USER_INFO_26 * usr, +static bool sam_io_user_info26(const char *desc, SAM_USER_INFO_26 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -5883,7 +5883,7 @@ void init_sam_user_info25P(SAM_USER_INFO_25 * usr, reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr, +static bool sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -6014,7 +6014,7 @@ static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr, 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) +static bool sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_struct *ps, int depth) { if (usr == NULL) return False; @@ -6408,7 +6408,7 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, struct samu *pw, DOM_SID * reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, +static bool sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -6539,7 +6539,7 @@ void init_sam_user_info20A(SAM_USER_INFO_20 *usr, struct samu *pw) reads or writes a structure. ********************************************************************/ -static BOOL sam_io_user_info20(const char *desc, SAM_USER_INFO_20 *usr, +static bool sam_io_user_info20(const char *desc, SAM_USER_INFO_20 *usr, prs_struct *ps, int depth) { if (usr == NULL) @@ -6662,10 +6662,10 @@ static void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, DATA_BLOB *sess_key, reads or writes a structure. ********************************************************************/ -static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, +static bool samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, prs_struct *ps, int depth) { - BOOL ret; + bool ret; SAM_USERINFO_CTR *ctr; prs_debug(ps, depth, desc, "samr_io_userinfo_ctr"); @@ -6830,7 +6830,7 @@ void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_userinfo(const char *desc, SAMR_R_QUERY_USERINFO * r_u, +bool samr_io_r_query_userinfo(const char *desc, SAMR_R_QUERY_USERINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -6877,7 +6877,7 @@ void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_userinfo(const char *desc, SAMR_Q_SET_USERINFO * q_u, +bool samr_io_q_set_userinfo(const char *desc, SAMR_Q_SET_USERINFO * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -6914,7 +6914,7 @@ void init_samr_r_set_userinfo(SAMR_R_SET_USERINFO * r_u, NTSTATUS status) reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_userinfo(const char *desc, SAMR_R_SET_USERINFO * r_u, +bool samr_io_r_set_userinfo(const char *desc, SAMR_R_SET_USERINFO * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -6963,7 +6963,7 @@ void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_userinfo2(const char *desc, SAMR_Q_SET_USERINFO2 * q_u, +bool samr_io_q_set_userinfo2(const char *desc, SAMR_Q_SET_USERINFO2 * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -7001,7 +7001,7 @@ void init_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2 * r_u, NTSTATUS status) reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_userinfo2(const char *desc, SAMR_R_SET_USERINFO2 * r_u, +bool samr_io_r_set_userinfo2(const char *desc, SAMR_R_SET_USERINFO2 * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -7040,7 +7040,7 @@ void init_samr_q_connect(SAMR_Q_CONNECT * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_connect(const char *desc, SAMR_Q_CONNECT * q_u, +bool samr_io_q_connect(const char *desc, SAMR_Q_CONNECT * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -7069,7 +7069,7 @@ BOOL samr_io_q_connect(const char *desc, SAMR_Q_CONNECT * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_connect(const char *desc, SAMR_R_CONNECT * r_u, +bool samr_io_r_connect(const char *desc, SAMR_R_CONNECT * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -7114,7 +7114,7 @@ void init_samr_q_connect4(SAMR_Q_CONNECT4 * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_connect4(const char *desc, SAMR_Q_CONNECT4 * q_u, +bool samr_io_q_connect4(const char *desc, SAMR_Q_CONNECT4 * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -7145,7 +7145,7 @@ BOOL samr_io_q_connect4(const char *desc, SAMR_Q_CONNECT4 * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_connect4(const char *desc, SAMR_R_CONNECT4 * r_u, +bool samr_io_r_connect4(const char *desc, SAMR_R_CONNECT4 * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -7207,7 +7207,7 @@ void init_samr_r_connect5(SAMR_R_CONNECT5 * r_u, POLICY_HND *pol, NTSTATUS statu reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_connect5(const char *desc, SAMR_Q_CONNECT5 * q_u, +bool samr_io_q_connect5(const char *desc, SAMR_Q_CONNECT5 * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -7246,7 +7246,7 @@ BOOL samr_io_q_connect5(const char *desc, SAMR_Q_CONNECT5 * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_connect5(const char *desc, SAMR_R_CONNECT5 * r_u, +bool samr_io_r_connect5(const char *desc, SAMR_R_CONNECT5 * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -7293,7 +7293,7 @@ void init_samr_q_connect_anon(SAMR_Q_CONNECT_ANON * q_u) reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_connect_anon(const char *desc, SAMR_Q_CONNECT_ANON * q_u, +bool samr_io_q_connect_anon(const char *desc, SAMR_Q_CONNECT_ANON * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -7323,7 +7323,7 @@ BOOL samr_io_q_connect_anon(const char *desc, SAMR_Q_CONNECT_ANON * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_connect_anon(const char *desc, SAMR_R_CONNECT_ANON * r_u, +bool samr_io_r_connect_anon(const char *desc, SAMR_R_CONNECT_ANON * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -7362,7 +7362,7 @@ void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_get_dom_pwinfo(const char *desc, SAMR_Q_GET_DOM_PWINFO * q_u, +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) @@ -7390,7 +7390,7 @@ BOOL samr_io_q_get_dom_pwinfo(const char *desc, SAMR_Q_GET_DOM_PWINFO * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_get_dom_pwinfo(const char *desc, SAMR_R_GET_DOM_PWINFO * r_u, +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) @@ -7435,7 +7435,7 @@ void init_enc_passwd(SAMR_ENC_PASSWD * pwd, const char pass[512]) reads or writes a SAMR_ENC_PASSWD structure. ********************************************************************/ -BOOL samr_io_enc_passwd(const char *desc, SAMR_ENC_PASSWD * pwd, +bool samr_io_enc_passwd(const char *desc, SAMR_ENC_PASSWD * pwd, prs_struct *ps, int depth) { if (pwd == NULL) @@ -7478,7 +7478,7 @@ void init_enc_hash(SAMR_ENC_HASH * hsh, const uchar hash[16]) reads or writes a SAMR_ENC_HASH structure. ********************************************************************/ -BOOL samr_io_enc_hash(const char *desc, SAMR_ENC_HASH * hsh, +bool samr_io_enc_hash(const char *desc, SAMR_ENC_HASH * hsh, prs_struct *ps, int depth) { if (hsh == NULL) @@ -7533,7 +7533,7 @@ void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_chgpasswd_user(const char *desc, SAMR_Q_CHGPASSWD_USER * q_u, +bool samr_io_q_chgpasswd_user(const char *desc, SAMR_Q_CHGPASSWD_USER * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -7591,7 +7591,7 @@ void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER * r_u, NTSTATUS status) reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_chgpasswd_user(const char *desc, SAMR_R_CHGPASSWD_USER * r_u, +bool samr_io_r_chgpasswd_user(const char *desc, SAMR_R_CHGPASSWD_USER * r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -7644,7 +7644,7 @@ void init_samr_q_chgpasswd_user3(SAMR_Q_CHGPASSWD_USER3 * q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_chgpasswd_user3(const char *desc, SAMR_Q_CHGPASSWD_USER3 * q_u, +bool samr_io_q_chgpasswd_user3(const char *desc, SAMR_Q_CHGPASSWD_USER3 * q_u, prs_struct *ps, int depth) { if (q_u == NULL) @@ -7719,7 +7719,7 @@ void init_samr_r_chgpasswd_user3(SAMR_R_CHGPASSWD_USER3 *r_u, NTSTATUS status, 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) +bool samr_io_change_reject(const char *desc, SAMR_CHANGE_REJECT *reject, prs_struct *ps, int depth) { if (reject == NULL) return False; @@ -7749,7 +7749,7 @@ BOOL samr_io_change_reject(const char *desc, SAMR_CHANGE_REJECT *reject, prs_str reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_chgpasswd_user3(const char *desc, SAMR_R_CHGPASSWD_USER3 *r_u, +bool samr_io_r_chgpasswd_user3(const char *desc, SAMR_R_CHGPASSWD_USER3 *r_u, prs_struct *ps, int depth) { if (r_u == NULL) @@ -7810,7 +7810,7 @@ void init_samr_q_query_domain_info2(SAMR_Q_QUERY_DOMAIN_INFO2 *q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_query_domain_info2(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO2 *q_u, +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) @@ -7856,7 +7856,7 @@ void init_samr_r_query_domain_info2(SAMR_R_QUERY_DOMAIN_INFO2 * r_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_query_domain_info2(const char *desc, SAMR_R_QUERY_DOMAIN_INFO2 * r_u, +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) @@ -7961,7 +7961,7 @@ void init_samr_q_set_domain_info(SAMR_Q_SET_DOMAIN_INFO *q_u, reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_set_domain_info(const char *desc, SAMR_Q_SET_DOMAIN_INFO *q_u, +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) @@ -8044,7 +8044,7 @@ void init_samr_r_set_domain_info(SAMR_R_SET_DOMAIN_INFO * r_u, NTSTATUS status) reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_set_domain_info(const char *desc, SAMR_R_SET_DOMAIN_INFO * r_u, +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) diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 378d1920a4..6198a78de0 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -30,7 +30,7 @@ Reads or writes a SEC_ACCESS structure. ********************************************************************/ -BOOL sec_io_access(const char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) +bool sec_io_access(const char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) { if (t == NULL) return False; @@ -48,7 +48,7 @@ BOOL sec_io_access(const char *desc, SEC_ACCESS *t, prs_struct *ps, int depth) Reads or writes a SEC_ACE structure. ********************************************************************/ -BOOL sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth) +bool sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth) { uint32 old_offset; uint32 offset_ace_size; @@ -130,7 +130,7 @@ 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) +bool sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) { unsigned int i; uint32 old_offset; @@ -222,7 +222,7 @@ BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) If reading and the *ppsd = NULL, allocates the structure. ********************************************************************/ -BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) +bool sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) { uint32 old_offset; uint32 max_offset = 0; /* after we're done, move offset to end */ @@ -392,7 +392,7 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) Reads or writes a SEC_DESC_BUF structure. ********************************************************************/ -BOOL sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth) +bool sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth) { uint32 off_len; uint32 off_max_len; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 04e760607e..3030ff1cf0 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -31,7 +31,7 @@ This should be moved in a more generic lib. ********************************************************************/ -BOOL spoolss_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) +bool spoolss_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime) { if(!prs_uint16("year", ps, depth, &systime->year)) return False; @@ -56,7 +56,7 @@ BOOL spoolss_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMT /******************************************************************* ********************************************************************/ -BOOL make_systemtime(SYSTEMTIME *systime, struct tm *unixtime) +bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime) { systime->year=unixtime->tm_year+1900; systime->month=unixtime->tm_mon+1; @@ -74,7 +74,7 @@ BOOL make_systemtime(SYSTEMTIME *systime, struct tm *unixtime) reads or writes an DOC_INFO structure. ********************************************************************/ -static BOOL smb_io_doc_info_1(const char *desc, DOC_INFO_1 *info_1, prs_struct *ps, int depth) +static bool smb_io_doc_info_1(const char *desc, DOC_INFO_1 *info_1, prs_struct *ps, int depth) { if (info_1 == NULL) return False; @@ -105,7 +105,7 @@ static BOOL smb_io_doc_info_1(const char *desc, DOC_INFO_1 *info_1, prs_struct * reads or writes an DOC_INFO structure. ********************************************************************/ -static BOOL smb_io_doc_info(const char *desc, DOC_INFO *info, prs_struct *ps, int depth) +static bool smb_io_doc_info(const char *desc, DOC_INFO *info, prs_struct *ps, int depth) { uint32 useless_ptr=0; @@ -154,7 +154,7 @@ static BOOL smb_io_doc_info(const char *desc, DOC_INFO *info, prs_struct *ps, in reads or writes an DOC_INFO_CONTAINER structure. ********************************************************************/ -static BOOL smb_io_doc_info_container(const char *desc, DOC_INFO_CONTAINER *cont, prs_struct *ps, int depth) +static bool smb_io_doc_info_container(const char *desc, DOC_INFO_CONTAINER *cont, prs_struct *ps, int depth) { if (cont == NULL) return False; @@ -181,7 +181,7 @@ reads or writes an NOTIFY OPTION TYPE structure. structure. The _TYPE structure is really the deferred referrants (i.e the notify fields array) of the _TYPE structure. -tpot */ -static BOOL smb_io_notify_option_type(const char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) +static bool smb_io_notify_option_type(const char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_notify_option_type"); depth++; @@ -209,7 +209,7 @@ static BOOL smb_io_notify_option_type(const char *desc, SPOOL_NOTIFY_OPTION_TYPE reads or writes an NOTIFY OPTION TYPE DATA. ********************************************************************/ -static BOOL smb_io_notify_option_type_data(const char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) +static bool smb_io_notify_option_type_data(const char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) { int i; @@ -244,7 +244,7 @@ static BOOL smb_io_notify_option_type_data(const char *desc, SPOOL_NOTIFY_OPTION reads or writes an NOTIFY OPTION structure. ********************************************************************/ -static BOOL smb_io_notify_option_type_ctr(const char *desc, SPOOL_NOTIFY_OPTION_TYPE_CTR *ctr , prs_struct *ps, int depth) +static bool smb_io_notify_option_type_ctr(const char *desc, SPOOL_NOTIFY_OPTION_TYPE_CTR *ctr , prs_struct *ps, int depth) { int i; @@ -276,7 +276,7 @@ static BOOL smb_io_notify_option_type_ctr(const char *desc, SPOOL_NOTIFY_OPTION_ reads or writes an NOTIFY OPTION structure. ********************************************************************/ -static BOOL smb_io_notify_option(const char *desc, SPOOL_NOTIFY_OPTION *option, prs_struct *ps, int depth) +static bool smb_io_notify_option(const char *desc, SPOOL_NOTIFY_OPTION *option, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_notify_option"); depth++; @@ -307,7 +307,7 @@ static BOOL smb_io_notify_option(const char *desc, SPOOL_NOTIFY_OPTION *option, reads or writes an NOTIFY INFO DATA structure. ********************************************************************/ -static BOOL smb_io_notify_info_data(const char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) +static bool smb_io_notify_info_data(const char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) { uint32 useless_ptr=0x0FF0ADDE; @@ -386,7 +386,7 @@ static BOOL smb_io_notify_info_data(const char *desc,SPOOL_NOTIFY_INFO_DATA *dat reads or writes an NOTIFY INFO DATA structure. ********************************************************************/ -BOOL smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *data, +bool smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "smb_io_notify_info_data_strings"); @@ -521,7 +521,7 @@ BOOL smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *da reads or writes an NOTIFY INFO structure. ********************************************************************/ -static BOOL smb_io_notify_info(const char *desc, SPOOL_NOTIFY_INFO *info, prs_struct *ps, int depth) +static bool smb_io_notify_info(const char *desc, SPOOL_NOTIFY_INFO *info, prs_struct *ps, int depth) { int i; @@ -557,7 +557,7 @@ static BOOL smb_io_notify_info(const char *desc, SPOOL_NOTIFY_INFO *info, prs_st /******************************************************************* ********************************************************************/ -BOOL spool_io_user_level_1( const char *desc, prs_struct *ps, int depth, SPOOL_USER_1 *q_u ) +bool spool_io_user_level_1( const char *desc, prs_struct *ps, int depth, SPOOL_USER_1 *q_u ) { prs_debug(ps, depth, desc, ""); depth++; @@ -596,7 +596,7 @@ BOOL spool_io_user_level_1( const char *desc, prs_struct *ps, int depth, SPOOL_U /******************************************************************* ********************************************************************/ -static BOOL spool_io_user_level(const char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, int depth) +static bool spool_io_user_level(const char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, int depth) { if (q_u==NULL) return False; @@ -633,7 +633,7 @@ static BOOL spool_io_user_level(const char *desc, SPOOL_USER_CTR *q_u, prs_struc #define DM_NUM_OPTIONAL_FIELDS 8 -BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) +bool spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode) { int available_space; /* size of the device mode left to parse */ /* only important on unmarshalling */ @@ -818,7 +818,7 @@ BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE Read or write a DEVICEMODE container ********************************************************************/ -static BOOL spoolss_io_devmode_cont(const char *desc, DEVMODE_CTR *dm_c, prs_struct *ps, int depth) +static bool spoolss_io_devmode_cont(const char *desc, DEVMODE_CTR *dm_c, prs_struct *ps, int depth) { if (dm_c==NULL) return False; @@ -863,7 +863,7 @@ static BOOL spoolss_io_devmode_cont(const char *desc, DEVMODE_CTR *dm_c, prs_str /******************************************************************* ********************************************************************/ -static BOOL spoolss_io_printer_default(const char *desc, PRINTER_DEFAULT *pd, prs_struct *ps, int depth) +static bool spoolss_io_printer_default(const char *desc, PRINTER_DEFAULT *pd, prs_struct *ps, int depth) { if (pd==NULL) return False; @@ -896,7 +896,7 @@ static BOOL spoolss_io_printer_default(const char *desc, PRINTER_DEFAULT *pd, pr * init a structure. ********************************************************************/ -BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, +bool make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, const fstring printername, const fstring datatype, uint32 access_required, @@ -950,7 +950,7 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u, +bool make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u, const char *srv_name, const char* clientname, const char* user_name, uint32 level, PRINTER_INFO_CTR *ctr) { @@ -1016,7 +1016,7 @@ BOOL make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u create a SPOOL_PRINTER_INFO_2 stuct from a PRINTER_INFO_2 struct *******************************************************************/ -BOOL make_spoolss_printer_info_2(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2, +bool make_spoolss_printer_info_2(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2, PRINTER_INFO_2 *info) { @@ -1070,7 +1070,7 @@ BOOL make_spoolss_printer_info_2(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_2 create a SPOOL_PRINTER_INFO_3 struct from a PRINTER_INFO_3 struct *******************************************************************/ -BOOL make_spoolss_printer_info_3(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_3 **spool_info3, +bool make_spoolss_printer_info_3(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_3 **spool_info3, PRINTER_INFO_3 *info) { @@ -1093,7 +1093,7 @@ BOOL make_spoolss_printer_info_3(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_3 create a SPOOL_PRINTER_INFO_7 struct from a PRINTER_INFO_7 struct *******************************************************************/ -BOOL make_spoolss_printer_info_7(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_7 **spool_info7, +bool make_spoolss_printer_info_7(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_7 **spool_info7, PRINTER_INFO_7 *info) { @@ -1120,7 +1120,7 @@ BOOL make_spoolss_printer_info_7(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_7 * called from spoolss_q_open_printer_ex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_open_printer(const char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_open_printer(const char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1151,7 +1151,7 @@ BOOL spoolss_io_q_open_printer(const char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_ * called from spoolss_open_printer_ex (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_open_printer(const char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_open_printer(const char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -1176,7 +1176,7 @@ BOOL spoolss_io_r_open_printer(const char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_ * called from spoolss_q_open_printer_ex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_open_printer_ex(const char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_open_printer_ex(const char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1212,7 +1212,7 @@ BOOL spoolss_io_q_open_printer_ex(const char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u * called from spoolss_open_printer_ex (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_open_printer_ex(const char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_open_printer_ex(const char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -1234,7 +1234,7 @@ BOOL spoolss_io_r_open_printer_ex(const char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u /******************************************************************* * init a structure. ********************************************************************/ -BOOL make_spoolss_q_deleteprinterdriverex( TALLOC_CTX *mem_ctx, +bool make_spoolss_q_deleteprinterdriverex( TALLOC_CTX *mem_ctx, SPOOL_Q_DELETEPRINTERDRIVEREX *q_u, const char *server, const char* arch, @@ -1264,7 +1264,7 @@ BOOL make_spoolss_q_deleteprinterdriverex( TALLOC_CTX *mem_ctx, /******************************************************************* * init a structure. ********************************************************************/ -BOOL make_spoolss_q_deleteprinterdriver( +bool make_spoolss_q_deleteprinterdriver( TALLOC_CTX *mem_ctx, SPOOL_Q_DELETEPRINTERDRIVER *q_u, const char *server, @@ -1289,7 +1289,7 @@ BOOL make_spoolss_q_deleteprinterdriver( * make a structure. ********************************************************************/ -BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, +bool make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, const POLICY_HND *handle, const char *valuename, uint32 size) { @@ -1308,7 +1308,7 @@ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, * make a structure. ********************************************************************/ -BOOL make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX *q_u, +bool make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX *q_u, const POLICY_HND *handle, const char *keyname, const char *valuename, uint32 size) @@ -1330,7 +1330,7 @@ BOOL make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX *q_u, * called from spoolss_q_getprinterdata (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_getprinterdata(const char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_getprinterdata(const char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1359,7 +1359,7 @@ BOOL spoolss_io_q_getprinterdata(const char *desc, SPOOL_Q_GETPRINTERDATA *q_u, * called from spoolss_q_deleteprinterdata (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_deleteprinterdata(const char *desc, SPOOL_Q_DELETEPRINTERDATA *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_deleteprinterdata(const char *desc, SPOOL_Q_DELETEPRINTERDATA *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1384,7 +1384,7 @@ BOOL spoolss_io_q_deleteprinterdata(const char *desc, SPOOL_Q_DELETEPRINTERDATA * called from spoolss_r_deleteprinterdata (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_deleteprinterdata(const char *desc, SPOOL_R_DELETEPRINTERDATA *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_deleteprinterdata(const char *desc, SPOOL_R_DELETEPRINTERDATA *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterdata"); depth++; @@ -1399,7 +1399,7 @@ BOOL spoolss_io_r_deleteprinterdata(const char *desc, SPOOL_R_DELETEPRINTERDATA * called from spoolss_q_deleteprinterdataex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_deleteprinterdataex(const char *desc, SPOOL_Q_DELETEPRINTERDATAEX *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_deleteprinterdataex(const char *desc, SPOOL_Q_DELETEPRINTERDATAEX *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1425,7 +1425,7 @@ BOOL spoolss_io_q_deleteprinterdataex(const char *desc, SPOOL_Q_DELETEPRINTERDAT * called from spoolss_r_deleteprinterdataex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_deleteprinterdataex(const char *desc, SPOOL_R_DELETEPRINTERDATAEX *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_deleteprinterdataex(const char *desc, SPOOL_R_DELETEPRINTERDATAEX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterdataex"); depth++; @@ -1441,7 +1441,7 @@ BOOL spoolss_io_r_deleteprinterdataex(const char *desc, SPOOL_R_DELETEPRINTERDAT * called from spoolss_r_getprinterdata (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -1480,7 +1480,7 @@ BOOL spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, * make a structure. ********************************************************************/ -BOOL make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER *q_u, POLICY_HND *hnd) +bool make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER *q_u, POLICY_HND *hnd) { if (q_u == NULL) return False; @@ -1497,7 +1497,7 @@ BOOL make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER *q_u, POLICY_HND *hnd) * called from spoolss_abortprinter (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_abortprinter(const char *desc, SPOOL_Q_ABORTPRINTER *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_abortprinter(const char *desc, SPOOL_Q_ABORTPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1518,7 +1518,7 @@ BOOL spoolss_io_q_abortprinter(const char *desc, SPOOL_Q_ABORTPRINTER *q_u, prs_ * called from spoolss_r_abortprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_abortprinter(const char *desc, SPOOL_R_ABORTPRINTER *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_abortprinter(const char *desc, SPOOL_R_ABORTPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_abortprinter"); depth++; @@ -1534,7 +1534,7 @@ BOOL spoolss_io_r_abortprinter(const char *desc, SPOOL_R_ABORTPRINTER *r_u, prs_ * called from spoolss_deleteprinter (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_deleteprinter(const char *desc, SPOOL_Q_DELETEPRINTER *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_deleteprinter(const char *desc, SPOOL_Q_DELETEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1556,7 +1556,7 @@ BOOL spoolss_io_q_deleteprinter(const char *desc, SPOOL_Q_DELETEPRINTER *q_u, pr * called from spoolss_deleteprinter (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_deleteprinter(const char *desc, SPOOL_R_DELETEPRINTER *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_deleteprinter(const char *desc, SPOOL_R_DELETEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinter"); depth++; @@ -1579,7 +1579,7 @@ BOOL spoolss_io_r_deleteprinter(const char *desc, SPOOL_R_DELETEPRINTER *r_u, pr * called from spoolss_deleteprinterdriver (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_deleteprinterdriver(const char *desc, SPOOL_Q_DELETEPRINTERDRIVER *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_deleteprinterdriver(const char *desc, SPOOL_Q_DELETEPRINTERDRIVER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1606,7 +1606,7 @@ BOOL spoolss_io_q_deleteprinterdriver(const char *desc, SPOOL_Q_DELETEPRINTERDRI /******************************************************************* * write a structure. ********************************************************************/ -BOOL spoolss_io_r_deleteprinterdriver(const char *desc, SPOOL_R_DELETEPRINTERDRIVER *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_deleteprinterdriver(const char *desc, SPOOL_R_DELETEPRINTERDRIVER *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -1629,7 +1629,7 @@ BOOL spoolss_io_r_deleteprinterdriver(const char *desc, SPOOL_R_DELETEPRINTERDRI * called from spoolss_deleteprinterdriver (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_deleteprinterdriverex(const char *desc, SPOOL_Q_DELETEPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_deleteprinterdriverex(const char *desc, SPOOL_Q_DELETEPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1664,7 +1664,7 @@ BOOL spoolss_io_q_deleteprinterdriverex(const char *desc, SPOOL_Q_DELETEPRINTERD /******************************************************************* * write a structure. ********************************************************************/ -BOOL spoolss_io_r_deleteprinterdriverex(const char *desc, SPOOL_R_DELETEPRINTERDRIVEREX *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_deleteprinterdriverex(const char *desc, SPOOL_R_DELETEPRINTERDRIVEREX *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -1688,7 +1688,7 @@ BOOL spoolss_io_r_deleteprinterdriverex(const char *desc, SPOOL_R_DELETEPRINTERD * called from spoolss_closeprinter (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_closeprinter(const char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_closeprinter(const char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1710,7 +1710,7 @@ BOOL spoolss_io_q_closeprinter(const char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_ * called from spoolss_closeprinter (cli_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_closeprinter(const char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_closeprinter(const char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_closeprinter"); depth++; @@ -1731,7 +1731,7 @@ BOOL spoolss_io_r_closeprinter(const char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_ * called from spoolss_q_startdocprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_startdocprinter(const char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_startdocprinter(const char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1755,7 +1755,7 @@ BOOL spoolss_io_q_startdocprinter(const char *desc, SPOOL_Q_STARTDOCPRINTER *q_u * called from spoolss_r_startdocprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_startdocprinter(const char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_startdocprinter(const char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_startdocprinter"); depth++; @@ -1772,7 +1772,7 @@ BOOL spoolss_io_r_startdocprinter(const char *desc, SPOOL_R_STARTDOCPRINTER *r_u * called from spoolss_q_enddocprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_enddocprinter(const char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_enddocprinter(const char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1793,7 +1793,7 @@ BOOL spoolss_io_q_enddocprinter(const char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, pr * called from spoolss_r_enddocprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_enddocprinter(const char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_enddocprinter(const char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enddocprinter"); depth++; @@ -1808,7 +1808,7 @@ BOOL spoolss_io_r_enddocprinter(const char *desc, SPOOL_R_ENDDOCPRINTER *r_u, pr * called from spoolss_q_startpageprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_startpageprinter(const char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_startpageprinter(const char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1829,7 +1829,7 @@ BOOL spoolss_io_q_startpageprinter(const char *desc, SPOOL_Q_STARTPAGEPRINTER *q * called from spoolss_r_startpageprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_startpageprinter(const char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_startpageprinter(const char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_startpageprinter"); depth++; @@ -1844,7 +1844,7 @@ BOOL spoolss_io_r_startpageprinter(const char *desc, SPOOL_R_STARTPAGEPRINTER *r * called from spoolss_q_endpageprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_endpageprinter(const char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_endpageprinter(const char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1865,7 +1865,7 @@ BOOL spoolss_io_q_endpageprinter(const char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, * called from spoolss_r_endpageprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_endpageprinter(const char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_endpageprinter(const char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_endpageprinter"); depth++; @@ -1880,7 +1880,7 @@ BOOL spoolss_io_r_endpageprinter(const char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, * called from spoolss_q_writeprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_writeprinter(const char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_writeprinter(const char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1917,7 +1917,7 @@ BOOL spoolss_io_q_writeprinter(const char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_ * called from spoolss_r_writeprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_writeprinter(const char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_writeprinter(const char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_writeprinter"); depth++; @@ -1934,7 +1934,7 @@ BOOL spoolss_io_r_writeprinter(const char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_ * called from spoolss_q_rffpcnex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_rffpcnex(const char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_rffpcnex(const char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_rffpcnex"); depth++; @@ -1980,7 +1980,7 @@ BOOL spoolss_io_q_rffpcnex(const char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct * * called from spoolss_r_rffpcnex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_rffpcnex(const char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_rffpcnex(const char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_rffpcnex"); depth++; @@ -1996,7 +1996,7 @@ BOOL spoolss_io_r_rffpcnex(const char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct * * called from spoolss_q_rfnpcnex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_rfnpcnex(const char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_rfnpcnex(const char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_rfnpcnex"); depth++; @@ -2031,7 +2031,7 @@ BOOL spoolss_io_q_rfnpcnex(const char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct * * called from spoolss_r_rfnpcnex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_rfnpcnex(const char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_rfnpcnex(const char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_rfnpcnex"); depth++; @@ -2108,7 +2108,7 @@ static uint32 size_of_systemtime(SYSTEMTIME *systime) Parse a DEVMODE structure and its relative pointer. ********************************************************************/ -static BOOL smb_io_reldevmode(const char *desc, RPC_BUFFER *buffer, int depth, DEVICEMODE **devmode) +static bool smb_io_reldevmode(const char *desc, RPC_BUFFER *buffer, int depth, DEVICEMODE **devmode) { prs_struct *ps=&buffer->prs; @@ -2176,7 +2176,7 @@ static BOOL smb_io_reldevmode(const char *desc, RPC_BUFFER *buffer, int depth, D Parse a PRINTER_INFO_0 structure. ********************************************************************/ -BOOL smb_io_printer_info_0(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_0 *info, int depth) +bool smb_io_printer_info_0(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_0 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2277,7 +2277,7 @@ BOOL smb_io_printer_info_0(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_0 Parse a PRINTER_INFO_1 structure. ********************************************************************/ -BOOL smb_io_printer_info_1(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_1 *info, int depth) +bool smb_io_printer_info_1(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2302,7 +2302,7 @@ BOOL smb_io_printer_info_1(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_1 Parse a PRINTER_INFO_2 structure. ********************************************************************/ -BOOL smb_io_printer_info_2(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) +bool smb_io_printer_info_2(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; uint32 dm_offset, sd_offset, current_offset; @@ -2393,7 +2393,7 @@ BOOL smb_io_printer_info_2(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_2 Parse a PRINTER_INFO_3 structure. ********************************************************************/ -BOOL smb_io_printer_info_3(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_3 *info, int depth) +bool smb_io_printer_info_3(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_3 *info, int depth) { uint32 offset = 0; prs_struct *ps=&buffer->prs; @@ -2448,7 +2448,7 @@ BOOL smb_io_printer_info_3(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_3 Parse a PRINTER_INFO_4 structure. ********************************************************************/ -BOOL smb_io_printer_info_4(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_4 *info, int depth) +bool smb_io_printer_info_4(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_4 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2470,7 +2470,7 @@ BOOL smb_io_printer_info_4(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_4 Parse a PRINTER_INFO_5 structure. ********************************************************************/ -BOOL smb_io_printer_info_5(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_5 *info, int depth) +bool smb_io_printer_info_5(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_5 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2496,7 +2496,7 @@ BOOL smb_io_printer_info_5(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_5 Parse a PRINTER_INFO_6 structure. ********************************************************************/ -BOOL smb_io_printer_info_6(const char *desc, RPC_BUFFER *buffer, +bool smb_io_printer_info_6(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_6 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2514,7 +2514,7 @@ BOOL smb_io_printer_info_6(const char *desc, RPC_BUFFER *buffer, Parse a PRINTER_INFO_7 structure. ********************************************************************/ -BOOL smb_io_printer_info_7(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_7 *info, int depth) +bool smb_io_printer_info_7(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_7 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2534,7 +2534,7 @@ BOOL smb_io_printer_info_7(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_7 Parse a PORT_INFO_1 structure. ********************************************************************/ -BOOL smb_io_port_info_1(const char *desc, RPC_BUFFER *buffer, PORT_INFO_1 *info, int depth) +bool smb_io_port_info_1(const char *desc, RPC_BUFFER *buffer, PORT_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2553,7 +2553,7 @@ BOOL smb_io_port_info_1(const char *desc, RPC_BUFFER *buffer, PORT_INFO_1 *info, Parse a PORT_INFO_2 structure. ********************************************************************/ -BOOL smb_io_port_info_2(const char *desc, RPC_BUFFER *buffer, PORT_INFO_2 *info, int depth) +bool smb_io_port_info_2(const char *desc, RPC_BUFFER *buffer, PORT_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2580,7 +2580,7 @@ BOOL smb_io_port_info_2(const char *desc, RPC_BUFFER *buffer, PORT_INFO_2 *info, Parse a DRIVER_INFO_1 structure. ********************************************************************/ -BOOL smb_io_printer_driver_info_1(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_1 *info, int depth) +bool smb_io_printer_driver_info_1(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2599,7 +2599,7 @@ BOOL smb_io_printer_driver_info_1(const char *desc, RPC_BUFFER *buffer, DRIVER_I Parse a DRIVER_INFO_2 structure. ********************************************************************/ -BOOL smb_io_printer_driver_info_2(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) +bool smb_io_printer_driver_info_2(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2628,7 +2628,7 @@ BOOL smb_io_printer_driver_info_2(const char *desc, RPC_BUFFER *buffer, DRIVER_I Parse a DRIVER_INFO_3 structure. ********************************************************************/ -BOOL smb_io_printer_driver_info_3(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_3 *info, int depth) +bool smb_io_printer_driver_info_3(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_3 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2667,7 +2667,7 @@ BOOL smb_io_printer_driver_info_3(const char *desc, RPC_BUFFER *buffer, DRIVER_I Parse a DRIVER_INFO_6 structure. ********************************************************************/ -BOOL smb_io_printer_driver_info_6(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_6 *info, int depth) +bool smb_io_printer_driver_info_6(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_6 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2730,7 +2730,7 @@ BOOL smb_io_printer_driver_info_6(const char *desc, RPC_BUFFER *buffer, DRIVER_I Parse a JOB_INFO_1 structure. ********************************************************************/ -BOOL smb_io_job_info_1(const char *desc, RPC_BUFFER *buffer, JOB_INFO_1 *info, int depth) +bool smb_io_job_info_1(const char *desc, RPC_BUFFER *buffer, JOB_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2773,7 +2773,7 @@ BOOL smb_io_job_info_1(const char *desc, RPC_BUFFER *buffer, JOB_INFO_1 *info, i Parse a JOB_INFO_2 structure. ********************************************************************/ -BOOL smb_io_job_info_2(const char *desc, RPC_BUFFER *buffer, JOB_INFO_2 *info, int depth) +bool smb_io_job_info_2(const char *desc, RPC_BUFFER *buffer, JOB_INFO_2 *info, int depth) { uint32 pipo=0; prs_struct *ps=&buffer->prs; @@ -2840,7 +2840,7 @@ BOOL smb_io_job_info_2(const char *desc, RPC_BUFFER *buffer, JOB_INFO_2 *info, i /******************************************************************* ********************************************************************/ -BOOL smb_io_form_1(const char *desc, RPC_BUFFER *buffer, FORM_1 *info, int depth) +bool smb_io_form_1(const char *desc, RPC_BUFFER *buffer, FORM_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2877,7 +2877,7 @@ BOOL smb_io_form_1(const char *desc, RPC_BUFFER *buffer, FORM_1 *info, int depth Parse a DRIVER_DIRECTORY_1 structure. ********************************************************************/ -BOOL smb_io_driverdir_1(const char *desc, RPC_BUFFER *buffer, DRIVER_DIRECTORY_1 *info, int depth) +bool smb_io_driverdir_1(const char *desc, RPC_BUFFER *buffer, DRIVER_DIRECTORY_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2896,7 +2896,7 @@ BOOL smb_io_driverdir_1(const char *desc, RPC_BUFFER *buffer, DRIVER_DIRECTORY_1 Parse a PORT_INFO_1 structure. ********************************************************************/ -BOOL smb_io_port_1(const char *desc, RPC_BUFFER *buffer, PORT_INFO_1 *info, int depth) +bool smb_io_port_1(const char *desc, RPC_BUFFER *buffer, PORT_INFO_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2915,7 +2915,7 @@ BOOL smb_io_port_1(const char *desc, RPC_BUFFER *buffer, PORT_INFO_1 *info, int Parse a PORT_INFO_2 structure. ********************************************************************/ -BOOL smb_io_port_2(const char *desc, RPC_BUFFER *buffer, PORT_INFO_2 *info, int depth) +bool smb_io_port_2(const char *desc, RPC_BUFFER *buffer, PORT_INFO_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2941,7 +2941,7 @@ BOOL smb_io_port_2(const char *desc, RPC_BUFFER *buffer, PORT_INFO_2 *info, int /******************************************************************* ********************************************************************/ -BOOL smb_io_printprocessor_info_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCESSOR_1 *info, int depth) +bool smb_io_printprocessor_info_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCESSOR_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2959,7 +2959,7 @@ BOOL smb_io_printprocessor_info_1(const char *desc, RPC_BUFFER *buffer, PRINTPRO /******************************************************************* ********************************************************************/ -BOOL smb_io_printprocdatatype_info_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCDATATYPE_1 *info, int depth) +bool smb_io_printprocdatatype_info_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCDATATYPE_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2977,7 +2977,7 @@ BOOL smb_io_printprocdatatype_info_1(const char *desc, RPC_BUFFER *buffer, PRINT /******************************************************************* ********************************************************************/ -BOOL smb_io_printmonitor_info_1(const char *desc, RPC_BUFFER *buffer, PRINTMONITOR_1 *info, int depth) +bool smb_io_printmonitor_info_1(const char *desc, RPC_BUFFER *buffer, PRINTMONITOR_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -2995,7 +2995,7 @@ BOOL smb_io_printmonitor_info_1(const char *desc, RPC_BUFFER *buffer, PRINTMONIT /******************************************************************* ********************************************************************/ -BOOL smb_io_printmonitor_info_2(const char *desc, RPC_BUFFER *buffer, PRINTMONITOR_2 *info, int depth) +bool smb_io_printmonitor_info_2(const char *desc, RPC_BUFFER *buffer, PRINTMONITOR_2 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -3521,7 +3521,7 @@ uint32 spoolss_size_printmonitor_info_2(PRINTMONITOR_2 *info) * init a structure. ********************************************************************/ -BOOL make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u, +bool make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u, const POLICY_HND *hnd, const fstring architecture, uint32 level, uint32 clientmajor, uint32 clientminor, @@ -3549,7 +3549,7 @@ BOOL make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u, * called from spoolss_getprinterdriver2 (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_getprinterdriver2(const char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_getprinterdriver2(const char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdriver2"); depth++; @@ -3591,7 +3591,7 @@ BOOL spoolss_io_q_getprinterdriver2(const char *desc, SPOOL_Q_GETPRINTERDRIVER2 * called from spoolss_getprinterdriver2 (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_getprinterdriver2(const char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_getprinterdriver2(const char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriver2"); depth++; @@ -3620,7 +3620,7 @@ BOOL spoolss_io_r_getprinterdriver2(const char *desc, SPOOL_R_GETPRINTERDRIVER2 * init a structure. ********************************************************************/ -BOOL make_spoolss_q_enumprinters( +bool make_spoolss_q_enumprinters( SPOOL_Q_ENUMPRINTERS *q_u, uint32 flags, char *servername, @@ -3645,7 +3645,7 @@ BOOL make_spoolss_q_enumprinters( * init a structure. ********************************************************************/ -BOOL make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS *q_u, +bool make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS *q_u, fstring servername, uint32 level, RPC_BUFFER *buffer, uint32 offered) { @@ -3664,7 +3664,7 @@ BOOL make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS *q_u, * called from spoolss_enumprinters (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_enumprinters(const char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_enumprinters(const char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinters"); depth++; @@ -3700,7 +3700,7 @@ BOOL spoolss_io_q_enumprinters(const char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_ Parse a SPOOL_R_ENUMPRINTERS structure. ********************************************************************/ -BOOL spoolss_io_r_enumprinters(const char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_enumprinters(const char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprinters"); depth++; @@ -3732,7 +3732,7 @@ BOOL spoolss_io_r_enumprinters(const char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_ * ********************************************************************/ -BOOL spoolss_io_r_getprinter(const char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_getprinter(const char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getprinter"); depth++; @@ -3760,7 +3760,7 @@ BOOL spoolss_io_r_getprinter(const char *desc, SPOOL_R_GETPRINTER *r_u, prs_stru * called from spoolss_getprinter (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_getprinter(const char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_getprinter(const char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_getprinter"); depth++; @@ -3788,7 +3788,7 @@ BOOL spoolss_io_q_getprinter(const char *desc, SPOOL_Q_GETPRINTER *q_u, prs_stru * init a structure. ********************************************************************/ -BOOL make_spoolss_q_getprinter( +bool make_spoolss_q_getprinter( TALLOC_CTX *mem_ctx, SPOOL_Q_GETPRINTER *q_u, const POLICY_HND *hnd, @@ -3813,7 +3813,7 @@ BOOL make_spoolss_q_getprinter( /******************************************************************* * init a structure. ********************************************************************/ -BOOL make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, +bool make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, const POLICY_HND *hnd, uint32 level, PRINTER_INFO_CTR *info, uint32 command) { @@ -3886,7 +3886,7 @@ BOOL make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_setprinter(const char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_setprinter(const char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setprinter"); depth++; @@ -3904,7 +3904,7 @@ BOOL spoolss_io_r_setprinter(const char *desc, SPOOL_R_SETPRINTER *r_u, prs_stru Marshall/unmarshall a SPOOL_Q_SETPRINTER struct. ********************************************************************/ -BOOL spoolss_io_q_setprinter(const char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_setprinter(const char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth) { uint32 ptr_sec_desc = 0; @@ -3992,7 +3992,7 @@ BOOL spoolss_io_q_setprinter(const char *desc, SPOOL_Q_SETPRINTER *q_u, prs_stru /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_fcpn(const char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_fcpn(const char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_fcpn"); depth++; @@ -4009,7 +4009,7 @@ BOOL spoolss_io_r_fcpn(const char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_fcpn(const char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_fcpn(const char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_fcpn"); @@ -4028,7 +4028,7 @@ BOOL spoolss_io_q_fcpn(const char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addjob(const char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_addjob(const char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); depth++; @@ -4054,7 +4054,7 @@ BOOL spoolss_io_r_addjob(const char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_addjob(const char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_addjob(const char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); depth++; @@ -4082,7 +4082,7 @@ BOOL spoolss_io_q_addjob(const char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumjobs(const char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_enumjobs(const char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumjobs"); depth++; @@ -4111,7 +4111,7 @@ BOOL spoolss_io_r_enumjobs(const char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct * /******************************************************************* ********************************************************************/ -BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd, +bool make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd, uint32 firstjob, uint32 numofjobs, uint32 level, @@ -4134,7 +4134,7 @@ BOOL make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumjobs(const char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_enumjobs(const char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumjobs"); depth++; @@ -4167,7 +4167,7 @@ BOOL spoolss_io_q_enumjobs(const char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct * /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_schedulejob(const char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_schedulejob(const char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_schedulejob"); depth++; @@ -4184,7 +4184,7 @@ BOOL spoolss_io_r_schedulejob(const char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_st /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_schedulejob(const char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_schedulejob(const char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_schedulejob"); depth++; @@ -4203,7 +4203,7 @@ BOOL spoolss_io_q_schedulejob(const char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_st /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_setjob(const char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_setjob(const char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setjob"); depth++; @@ -4220,7 +4220,7 @@ BOOL spoolss_io_r_setjob(const char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_setjob(const char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_setjob(const char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_setjob"); depth++; @@ -4248,7 +4248,7 @@ BOOL spoolss_io_q_setjob(const char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, Parse a SPOOL_R_ENUMPRINTERDRIVERS structure. ********************************************************************/ -BOOL spoolss_io_r_enumprinterdrivers(const char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_enumprinterdrivers(const char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdrivers"); depth++; @@ -4278,7 +4278,7 @@ BOOL spoolss_io_r_enumprinterdrivers(const char *desc, SPOOL_R_ENUMPRINTERDRIVER * init a structure. ********************************************************************/ -BOOL make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, +bool make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, const char *name, const char *environment, uint32 level, @@ -4298,7 +4298,7 @@ BOOL make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, Parse a SPOOL_Q_ENUMPRINTERDRIVERS structure. ********************************************************************/ -BOOL spoolss_io_q_enumprinterdrivers(const char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_enumprinterdrivers(const char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdrivers"); @@ -4339,7 +4339,7 @@ BOOL spoolss_io_q_enumprinterdrivers(const char *desc, SPOOL_Q_ENUMPRINTERDRIVER /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumforms(const char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_enumforms(const char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumforms"); @@ -4366,7 +4366,7 @@ BOOL spoolss_io_q_enumforms(const char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumforms(const char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_enumforms(const char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumforms"); depth++; @@ -4395,7 +4395,7 @@ BOOL spoolss_io_r_enumforms(const char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_getform(const char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_getform(const char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_getform"); @@ -4428,7 +4428,7 @@ BOOL spoolss_io_q_getform(const char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_getform(const char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_getform(const char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getform"); depth++; @@ -4455,7 +4455,7 @@ BOOL spoolss_io_r_getform(const char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps Parse a SPOOL_R_ENUMPORTS structure. ********************************************************************/ -BOOL spoolss_io_r_enumports(const char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_enumports(const char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumports"); depth++; @@ -4484,7 +4484,7 @@ BOOL spoolss_io_r_enumports(const char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumports(const char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_enumports(const char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); depth++; @@ -4517,7 +4517,7 @@ BOOL spoolss_io_q_enumports(const char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct Parse a SPOOL_PRINTER_INFO_LEVEL_1 structure. ********************************************************************/ -BOOL spool_io_printer_info_level_1(const char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, prs_struct *ps, int depth) +bool spool_io_printer_info_level_1(const char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level_1"); depth++; @@ -4548,7 +4548,7 @@ BOOL spool_io_printer_info_level_1(const char *desc, SPOOL_PRINTER_INFO_LEVEL_1 Parse a SPOOL_PRINTER_INFO_LEVEL_3 structure. ********************************************************************/ -BOOL spool_io_printer_info_level_3(const char *desc, SPOOL_PRINTER_INFO_LEVEL_3 *il, prs_struct *ps, int depth) +bool spool_io_printer_info_level_3(const char *desc, SPOOL_PRINTER_INFO_LEVEL_3 *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level_3"); depth++; @@ -4566,7 +4566,7 @@ BOOL spool_io_printer_info_level_3(const char *desc, SPOOL_PRINTER_INFO_LEVEL_3 Parse a SPOOL_PRINTER_INFO_LEVEL_2 structure. ********************************************************************/ -BOOL spool_io_printer_info_level_2(const char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, prs_struct *ps, int depth) +bool spool_io_printer_info_level_2(const char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level_2"); depth++; @@ -4645,7 +4645,7 @@ BOOL spool_io_printer_info_level_2(const char *desc, SPOOL_PRINTER_INFO_LEVEL_2 return True; } -BOOL spool_io_printer_info_level_7(const char *desc, SPOOL_PRINTER_INFO_LEVEL_7 *il, prs_struct *ps, int depth) +bool spool_io_printer_info_level_7(const char *desc, SPOOL_PRINTER_INFO_LEVEL_7 *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level_7"); depth++; @@ -4666,7 +4666,7 @@ BOOL spool_io_printer_info_level_7(const char *desc, SPOOL_PRINTER_INFO_LEVEL_7 /******************************************************************* ********************************************************************/ -BOOL spool_io_printer_info_level(const char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth) +bool spool_io_printer_info_level(const char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_info_level"); depth++; @@ -4743,7 +4743,7 @@ BOOL spool_io_printer_info_level(const char *desc, SPOOL_PRINTER_INFO_LEVEL *il, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_addprinterex(const char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_addprinterex(const char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth) { uint32 ptr_sec_desc = 0; @@ -4808,7 +4808,7 @@ BOOL spoolss_io_q_addprinterex(const char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_ /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addprinterex(const char *desc, SPOOL_R_ADDPRINTEREX *r_u, +bool spoolss_io_r_addprinterex(const char *desc, SPOOL_R_ADDPRINTEREX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addprinterex"); @@ -4826,7 +4826,7 @@ BOOL spoolss_io_r_addprinterex(const char *desc, SPOOL_R_ADDPRINTEREX *r_u, /******************************************************************* ********************************************************************/ -BOOL spool_io_printer_driver_info_level_3(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, +bool spool_io_printer_driver_info_level_3(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, prs_struct *ps, int depth) { SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *il; @@ -4904,7 +4904,7 @@ BOOL spool_io_printer_driver_info_level_3(const char *desc, SPOOL_PRINTER_DRIVER parse a SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure ********************************************************************/ -BOOL spool_io_printer_driver_info_level_6(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u, +bool spool_io_printer_driver_info_level_6(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u, prs_struct *ps, int depth) { SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *il; @@ -5059,7 +5059,7 @@ BOOL spool_io_printer_driver_info_level_6(const char *desc, SPOOL_PRINTER_DRIVER ********************************************************************/ -static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) +static bool uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) { fstring f; int n = 0; @@ -5096,7 +5096,7 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) and size of array at beginning ********************************************************************/ -BOOL smb_io_unibuffer(const char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) +bool smb_io_unibuffer(const char *desc, UNISTR2 *buffer, prs_struct *ps, int depth) { if (buffer==NULL) return False; @@ -5115,7 +5115,7 @@ BOOL smb_io_unibuffer(const char *desc, UNISTR2 *buffer, prs_struct *ps, int dep /******************************************************************* ********************************************************************/ -BOOL spool_io_printer_driver_info_level(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth) +bool spool_io_printer_driver_info_level(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level"); depth++; @@ -5150,7 +5150,7 @@ BOOL spool_io_printer_driver_info_level(const char *desc, SPOOL_PRINTER_DRIVER_I init a SPOOL_Q_ADDPRINTERDRIVER struct ******************************************************************/ -BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx, +bool make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTERDRIVER *q_u, const char* srv_name, uint32 level, PRINTER_DRIVER_CTR *info) { @@ -5182,7 +5182,7 @@ BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx, return True; } -BOOL make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx, +bool make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **spool_drv_info, DRIVER_INFO_3 *info3) { @@ -5212,14 +5212,14 @@ BOOL make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx, init_unistr2_from_unistr(&inf->defaultdatatype, &info3->defaultdatatype); if (info3->dependentfiles) { - BOOL done = False; - BOOL null_char = False; + bool done = False; + bool null_char = False; uint16 *ptr = info3->dependentfiles; while (!done) { switch (*ptr) { case 0: - /* the null_char BOOL is used to help locate + /* the null_char bool is used to help locate two '\0's back to back */ if (null_char) { done = True; @@ -5253,7 +5253,7 @@ BOOL make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx, make a BUFFER5 struct from a uint16* ******************************************************************/ -BOOL make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src) +bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src) { buf5->buf_len = len; @@ -5277,7 +5277,7 @@ BOOL make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 fill in the prs_struct for a ADDPRINTERDRIVER request PDU ********************************************************************/ -BOOL spoolss_io_q_addprinterdriver(const char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_addprinterdriver(const char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_addprinterdriver"); depth++; @@ -5304,7 +5304,7 @@ BOOL spoolss_io_q_addprinterdriver(const char *desc, SPOOL_Q_ADDPRINTERDRIVER *q /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addprinterdriver(const char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) +bool spoolss_io_r_addprinterdriver(const char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addprinterdriver"); depth++; @@ -5319,7 +5319,7 @@ BOOL spoolss_io_r_addprinterdriver(const char *desc, SPOOL_R_ADDPRINTERDRIVER *q fill in the prs_struct for a ADDPRINTERDRIVER request PDU ********************************************************************/ -BOOL spoolss_io_q_addprinterdriverex(const char *desc, SPOOL_Q_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_addprinterdriverex(const char *desc, SPOOL_Q_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_addprinterdriverex"); depth++; @@ -5351,7 +5351,7 @@ BOOL spoolss_io_q_addprinterdriverex(const char *desc, SPOOL_Q_ADDPRINTERDRIVERE /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addprinterdriverex(const char *desc, SPOOL_R_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) +bool spoolss_io_r_addprinterdriverex(const char *desc, SPOOL_R_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addprinterdriverex"); depth++; @@ -5365,7 +5365,7 @@ BOOL spoolss_io_r_addprinterdriverex(const char *desc, SPOOL_R_ADDPRINTERDRIVERE /******************************************************************* ********************************************************************/ -BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, +bool uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, NT_PRINTER_DRIVER_INFO_LEVEL_3 **asc) { NT_PRINTER_DRIVER_INFO_LEVEL_3 *d; @@ -5412,7 +5412,7 @@ BOOL uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, /******************************************************************* ********************************************************************/ -BOOL uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni, +bool uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni, NT_PRINTER_DRIVER_INFO_LEVEL_6 **asc) { NT_PRINTER_DRIVER_INFO_LEVEL_6 *d; @@ -5462,7 +5462,7 @@ error: return False; } -BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, +bool uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, NT_PRINTER_INFO_LEVEL_2 *d) { DEBUG(7,("Converting from UNICODE to ASCII\n")); @@ -5494,7 +5494,7 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR *q_u, +bool make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR *q_u, fstring servername, fstring env_name, uint32 level, RPC_BUFFER *buffer, uint32 offered) { @@ -5512,7 +5512,7 @@ BOOL make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR *q_u, Parse a SPOOL_Q_GETPRINTERDRIVERDIR structure. ********************************************************************/ -BOOL spoolss_io_q_getprinterdriverdir(const char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_getprinterdriverdir(const char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdriverdir"); depth++; @@ -5554,7 +5554,7 @@ BOOL spoolss_io_q_getprinterdriverdir(const char *desc, SPOOL_Q_GETPRINTERDRIVER Parse a SPOOL_R_GETPRINTERDRIVERDIR structure. ********************************************************************/ -BOOL spoolss_io_r_getprinterdriverdir(const char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_getprinterdriverdir(const char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriverdir"); depth++; @@ -5580,7 +5580,7 @@ BOOL spoolss_io_r_getprinterdriverdir(const char *desc, SPOOL_R_GETPRINTERDRIVER /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumprintprocessors(const char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_enumprintprocessors(const char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocessors"); depth++; @@ -5609,7 +5609,7 @@ BOOL spoolss_io_r_enumprintprocessors(const char *desc, SPOOL_R_ENUMPRINTPROCESS /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumprintprocessors(const char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_enumprintprocessors(const char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprintprocessors"); depth++; @@ -5651,7 +5651,7 @@ BOOL spoolss_io_q_enumprintprocessors(const char *desc, SPOOL_Q_ENUMPRINTPROCESS /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_addprintprocessor(const char *desc, SPOOL_Q_ADDPRINTPROCESSOR *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_addprintprocessor(const char *desc, SPOOL_Q_ADDPRINTPROCESSOR *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_addprintprocessor"); depth++; @@ -5685,7 +5685,7 @@ BOOL spoolss_io_q_addprintprocessor(const char *desc, SPOOL_Q_ADDPRINTPROCESSOR /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addprintprocessor(const char *desc, SPOOL_R_ADDPRINTPROCESSOR *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_addprintprocessor(const char *desc, SPOOL_R_ADDPRINTPROCESSOR *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addprintproicessor"); depth++; @@ -5702,7 +5702,7 @@ BOOL spoolss_io_r_addprintprocessor(const char *desc, SPOOL_R_ADDPRINTPROCESSOR /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumprintprocdatatypes(const char *desc, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_enumprintprocdatatypes(const char *desc, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprintprocdatatypes"); depth++; @@ -5731,7 +5731,7 @@ BOOL spoolss_io_r_enumprintprocdatatypes(const char *desc, SPOOL_R_ENUMPRINTPROC /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumprintprocdatatypes(const char *desc, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_enumprintprocdatatypes(const char *desc, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprintprocdatatypes"); depth++; @@ -5774,7 +5774,7 @@ BOOL spoolss_io_q_enumprintprocdatatypes(const char *desc, SPOOL_Q_ENUMPRINTPROC Parse a SPOOL_Q_ENUMPRINTMONITORS structure. ********************************************************************/ -BOOL spoolss_io_q_enumprintmonitors(const char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_enumprintmonitors(const char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprintmonitors"); depth++; @@ -5808,7 +5808,7 @@ BOOL spoolss_io_q_enumprintmonitors(const char *desc, SPOOL_Q_ENUMPRINTMONITORS /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumprintmonitors(const char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_enumprintmonitors(const char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprintmonitors"); depth++; @@ -5837,7 +5837,7 @@ BOOL spoolss_io_r_enumprintmonitors(const char *desc, SPOOL_R_ENUMPRINTMONITORS /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_enumprinterdata(const char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_enumprinterdata(const char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdata"); depth++; @@ -5894,7 +5894,7 @@ BOOL spoolss_io_r_enumprinterdata(const char *desc, SPOOL_R_ENUMPRINTERDATA *r_u /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_enumprinterdata(const char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_enumprinterdata(const char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdata"); depth++; @@ -5916,7 +5916,7 @@ BOOL spoolss_io_q_enumprinterdata(const char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u /******************************************************************* ********************************************************************/ -BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, +bool make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, const POLICY_HND *hnd, uint32 idx, uint32 valuelen, uint32 datalen) { @@ -5931,7 +5931,7 @@ BOOL make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, /******************************************************************* ********************************************************************/ -BOOL make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u, +bool make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u, const POLICY_HND *hnd, const char *key, uint32 size) { @@ -5944,7 +5944,7 @@ BOOL make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u, /******************************************************************* ********************************************************************/ -BOOL make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND *hnd, +bool make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND *hnd, char* value, uint32 data_type, char* data, uint32 data_size) { memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); @@ -5959,7 +5959,7 @@ BOOL make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND /******************************************************************* ********************************************************************/ -BOOL make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX *q_u, const POLICY_HND *hnd, +bool make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX *q_u, const POLICY_HND *hnd, char *key, char* value, uint32 data_type, char* data, uint32 data_size) { @@ -5977,7 +5977,7 @@ BOOL make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX *q_u, const POLICY /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_setprinterdata(const char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_setprinterdata(const char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_setprinterdata"); depth++; @@ -6026,7 +6026,7 @@ BOOL spoolss_io_q_setprinterdata(const char *desc, SPOOL_Q_SETPRINTERDATA *q_u, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_setprinterdata(const char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_setprinterdata(const char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setprinterdata"); depth++; @@ -6041,7 +6041,7 @@ BOOL spoolss_io_r_setprinterdata(const char *desc, SPOOL_R_SETPRINTERDATA *r_u, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_resetprinter(const char *desc, SPOOL_Q_RESETPRINTER *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_resetprinter(const char *desc, SPOOL_Q_RESETPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_resetprinter"); depth++; @@ -6068,7 +6068,7 @@ BOOL spoolss_io_q_resetprinter(const char *desc, SPOOL_Q_RESETPRINTER *q_u, prs_ /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_resetprinter(const char *desc, SPOOL_R_RESETPRINTER *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_resetprinter(const char *desc, SPOOL_R_RESETPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_resetprinter"); depth++; @@ -6084,7 +6084,7 @@ BOOL spoolss_io_r_resetprinter(const char *desc, SPOOL_R_RESETPRINTER *r_u, prs_ /******************************************************************* ********************************************************************/ -static BOOL spoolss_io_addform(const char *desc, FORM *f, uint32 ptr, prs_struct *ps, int depth) +static bool spoolss_io_addform(const char *desc, FORM *f, uint32 ptr, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_addform"); depth++; @@ -6120,7 +6120,7 @@ static BOOL spoolss_io_addform(const char *desc, FORM *f, uint32 ptr, prs_struct /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_deleteform(const char *desc, SPOOL_Q_DELETEFORM *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_deleteform(const char *desc, SPOOL_Q_DELETEFORM *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_deleteform"); depth++; @@ -6138,7 +6138,7 @@ BOOL spoolss_io_q_deleteform(const char *desc, SPOOL_Q_DELETEFORM *q_u, prs_stru /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_deleteform(const char *desc, SPOOL_R_DELETEFORM *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_deleteform(const char *desc, SPOOL_R_DELETEFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteform"); depth++; @@ -6154,7 +6154,7 @@ BOOL spoolss_io_r_deleteform(const char *desc, SPOOL_R_DELETEFORM *r_u, prs_stru /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_addform(const char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_addform(const char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth) { uint32 useless_ptr=1; prs_debug(ps, depth, desc, "spoolss_io_q_addform"); @@ -6183,7 +6183,7 @@ BOOL spoolss_io_q_addform(const char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_addform(const char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_addform(const char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_addform"); depth++; @@ -6199,7 +6199,7 @@ BOOL spoolss_io_r_addform(const char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_setform(const char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_setform(const char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth) { uint32 useless_ptr=1; prs_debug(ps, depth, desc, "spoolss_io_q_setform"); @@ -6234,7 +6234,7 @@ BOOL spoolss_io_q_setform(const char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_setform(const char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_setform(const char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setform"); depth++; @@ -6251,7 +6251,7 @@ BOOL spoolss_io_r_setform(const char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps Parse a SPOOL_R_GETJOB structure. ********************************************************************/ -BOOL spoolss_io_r_getjob(const char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_getjob(const char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getjob"); depth++; @@ -6278,7 +6278,7 @@ BOOL spoolss_io_r_getjob(const char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, Parse a SPOOL_Q_GETJOB structure. ********************************************************************/ -BOOL spoolss_io_q_getjob(const char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_getjob(const char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, ""); depth++; @@ -6362,7 +6362,7 @@ void free_job_info_2(JOB_INFO_2 *job) * init a structure. ********************************************************************/ -BOOL make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER *q_u, +bool make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER *q_u, const fstring string, uint32 printer, uint32 type) { if (q_u == NULL) @@ -6383,7 +6383,7 @@ BOOL make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER *q_u, Parse a SPOOL_Q_REPLYOPENPRINTER structure. ********************************************************************/ -BOOL spoolss_io_q_replyopenprinter(const char *desc, SPOOL_Q_REPLYOPENPRINTER *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_replyopenprinter(const char *desc, SPOOL_Q_REPLYOPENPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_replyopenprinter"); depth++; @@ -6414,7 +6414,7 @@ BOOL spoolss_io_q_replyopenprinter(const char *desc, SPOOL_Q_REPLYOPENPRINTER *q Parse a SPOOL_R_REPLYOPENPRINTER structure. ********************************************************************/ -BOOL spoolss_io_r_replyopenprinter(const char *desc, SPOOL_R_REPLYOPENPRINTER *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_replyopenprinter(const char *desc, SPOOL_R_REPLYOPENPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_replyopenprinter"); depth++; @@ -6434,7 +6434,7 @@ BOOL spoolss_io_r_replyopenprinter(const char *desc, SPOOL_R_REPLYOPENPRINTER *r /******************************************************************* * init a structure. ********************************************************************/ -BOOL make_spoolss_q_routerreplyprinter(SPOOL_Q_ROUTERREPLYPRINTER *q_u, POLICY_HND *hnd, +bool make_spoolss_q_routerreplyprinter(SPOOL_Q_ROUTERREPLYPRINTER *q_u, POLICY_HND *hnd, uint32 condition, uint32 change_id) { @@ -6454,7 +6454,7 @@ BOOL make_spoolss_q_routerreplyprinter(SPOOL_Q_ROUTERREPLYPRINTER *q_u, POLICY_H /******************************************************************* Parse a SPOOL_Q_ROUTERREPLYPRINTER structure. ********************************************************************/ -BOOL spoolss_io_q_routerreplyprinter (const char *desc, SPOOL_Q_ROUTERREPLYPRINTER *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_routerreplyprinter (const char *desc, SPOOL_Q_ROUTERREPLYPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_routerreplyprinter"); @@ -6484,7 +6484,7 @@ BOOL spoolss_io_q_routerreplyprinter (const char *desc, SPOOL_Q_ROUTERREPLYPRINT /******************************************************************* Parse a SPOOL_R_ROUTERREPLYPRINTER structure. ********************************************************************/ -BOOL spoolss_io_r_routerreplyprinter (const char *desc, SPOOL_R_ROUTERREPLYPRINTER *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_routerreplyprinter (const char *desc, SPOOL_R_ROUTERREPLYPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_routerreplyprinter"); depth++; @@ -6502,7 +6502,7 @@ BOOL spoolss_io_r_routerreplyprinter (const char *desc, SPOOL_R_ROUTERREPLYPRINT * init a structure. ********************************************************************/ -BOOL make_spoolss_q_reply_closeprinter(SPOOL_Q_REPLYCLOSEPRINTER *q_u, POLICY_HND *hnd) +bool make_spoolss_q_reply_closeprinter(SPOOL_Q_REPLYCLOSEPRINTER *q_u, POLICY_HND *hnd) { if (q_u == NULL) return False; @@ -6516,7 +6516,7 @@ BOOL make_spoolss_q_reply_closeprinter(SPOOL_Q_REPLYCLOSEPRINTER *q_u, POLICY_HN Parse a SPOOL_Q_REPLYCLOSEPRINTER structure. ********************************************************************/ -BOOL spoolss_io_q_replycloseprinter(const char *desc, SPOOL_Q_REPLYCLOSEPRINTER *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_replycloseprinter(const char *desc, SPOOL_Q_REPLYCLOSEPRINTER *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_replycloseprinter"); depth++; @@ -6534,7 +6534,7 @@ BOOL spoolss_io_q_replycloseprinter(const char *desc, SPOOL_Q_REPLYCLOSEPRINTER Parse a SPOOL_R_REPLYCLOSEPRINTER structure. ********************************************************************/ -BOOL spoolss_io_r_replycloseprinter(const char *desc, SPOOL_R_REPLYCLOSEPRINTER *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_replycloseprinter(const char *desc, SPOOL_R_REPLYCLOSEPRINTER *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_replycloseprinter"); depth++; @@ -6556,7 +6556,7 @@ BOOL spoolss_io_r_replycloseprinter(const char *desc, SPOOL_R_REPLYCLOSEPRINTER /******************************************************************* Deep copy a SPOOL_NOTIFY_INFO_DATA structure ******************************************************************/ -static BOOL copy_spool_notify_info_data(SPOOL_NOTIFY_INFO_DATA *dst, +static bool copy_spool_notify_info_data(SPOOL_NOTIFY_INFO_DATA *dst, SPOOL_NOTIFY_INFO_DATA *src, int n) { int i; @@ -6586,7 +6586,7 @@ static BOOL copy_spool_notify_info_data(SPOOL_NOTIFY_INFO_DATA *dst, /******************************************************************* Deep copy a SPOOL_NOTIFY_INFO structure ******************************************************************/ -static BOOL copy_spool_notify_info(SPOOL_NOTIFY_INFO *dst, SPOOL_NOTIFY_INFO *src) +static bool copy_spool_notify_info(SPOOL_NOTIFY_INFO *dst, SPOOL_NOTIFY_INFO *src) { if (!dst) { DEBUG(0,("copy_spool_notify_info: NULL destination pointer!\n")); @@ -6621,7 +6621,7 @@ static BOOL copy_spool_notify_info(SPOOL_NOTIFY_INFO *dst, SPOOL_NOTIFY_INFO *sr * init a structure. ********************************************************************/ -BOOL make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd, +bool make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd, uint32 change_low, uint32 change_high, SPOOL_NOTIFY_INFO *info) { @@ -6661,7 +6661,7 @@ BOOL make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd, Parse a SPOOL_Q_REPLY_RRPCN structure. ********************************************************************/ -BOOL spoolss_io_q_reply_rrpcn(const char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_reply_rrpcn(const char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_reply_rrpcn"); depth++; @@ -6698,7 +6698,7 @@ BOOL spoolss_io_q_reply_rrpcn(const char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_st Parse a SPOOL_R_REPLY_RRPCN structure. ********************************************************************/ -BOOL spoolss_io_r_reply_rrpcn(const char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_reply_rrpcn(const char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_reply_rrpcn"); depth++; @@ -6720,7 +6720,7 @@ BOOL spoolss_io_r_reply_rrpcn(const char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_st * called from spoolss_q_getprinterdataex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_q_getprinterdataex(const char *desc, SPOOL_Q_GETPRINTERDATAEX *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_getprinterdataex(const char *desc, SPOOL_Q_GETPRINTERDATAEX *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -6753,7 +6753,7 @@ BOOL spoolss_io_q_getprinterdataex(const char *desc, SPOOL_Q_GETPRINTERDATAEX *q * called from spoolss_r_getprinterdataex (srv_spoolss.c) ********************************************************************/ -BOOL spoolss_io_r_getprinterdataex(const char *desc, SPOOL_R_GETPRINTERDATAEX *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_getprinterdataex(const char *desc, SPOOL_R_GETPRINTERDATAEX *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -6792,7 +6792,7 @@ BOOL spoolss_io_r_getprinterdataex(const char *desc, SPOOL_R_GETPRINTERDATAEX *r * read a structure. ********************************************************************/ -BOOL spoolss_io_q_setprinterdataex(const char *desc, SPOOL_Q_SETPRINTERDATAEX *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_setprinterdataex(const char *desc, SPOOL_Q_SETPRINTERDATAEX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_setprinterdataex"); depth++; @@ -6848,7 +6848,7 @@ BOOL spoolss_io_q_setprinterdataex(const char *desc, SPOOL_Q_SETPRINTERDATAEX *q * write a structure. ********************************************************************/ -BOOL spoolss_io_r_setprinterdataex(const char *desc, SPOOL_R_SETPRINTERDATAEX *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_setprinterdataex(const char *desc, SPOOL_R_SETPRINTERDATAEX *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_setprinterdataex"); depth++; @@ -6864,7 +6864,7 @@ BOOL spoolss_io_r_setprinterdataex(const char *desc, SPOOL_R_SETPRINTERDATAEX *r /******************************************************************* * read a structure. ********************************************************************/ -BOOL make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u, +bool make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u, POLICY_HND *hnd, const char *key, uint32 size) { @@ -6881,7 +6881,7 @@ BOOL make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u, * read a structure. ********************************************************************/ -BOOL spoolss_io_q_enumprinterkey(const char *desc, SPOOL_Q_ENUMPRINTERKEY *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_enumprinterkey(const char *desc, SPOOL_Q_ENUMPRINTERKEY *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterkey"); depth++; @@ -6907,7 +6907,7 @@ BOOL spoolss_io_q_enumprinterkey(const char *desc, SPOOL_Q_ENUMPRINTERKEY *q_u, * write a structure. ********************************************************************/ -BOOL spoolss_io_r_enumprinterkey(const char *desc, SPOOL_R_ENUMPRINTERKEY *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_enumprinterkey(const char *desc, SPOOL_R_ENUMPRINTERKEY *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterkey"); depth++; @@ -6934,7 +6934,7 @@ BOOL spoolss_io_r_enumprinterkey(const char *desc, SPOOL_R_ENUMPRINTERKEY *r_u, * read a structure. ********************************************************************/ -BOOL make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY *q_u, +bool make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY *q_u, POLICY_HND *hnd, char *keyname) { DEBUG(5,("make_spoolss_q_deleteprinterkey\n")); @@ -6949,7 +6949,7 @@ BOOL make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY *q_u, * read a structure. ********************************************************************/ -BOOL spoolss_io_q_deleteprinterkey(const char *desc, SPOOL_Q_DELETEPRINTERKEY *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_deleteprinterkey(const char *desc, SPOOL_Q_DELETEPRINTERKEY *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_deleteprinterkey"); depth++; @@ -6969,7 +6969,7 @@ BOOL spoolss_io_q_deleteprinterkey(const char *desc, SPOOL_Q_DELETEPRINTERKEY *q * write a structure. ********************************************************************/ -BOOL spoolss_io_r_deleteprinterkey(const char *desc, SPOOL_R_DELETEPRINTERKEY *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_deleteprinterkey(const char *desc, SPOOL_R_DELETEPRINTERKEY *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_deleteprinterkey"); depth++; @@ -6988,7 +6988,7 @@ BOOL spoolss_io_r_deleteprinterkey(const char *desc, SPOOL_R_DELETEPRINTERKEY *r * read a structure. ********************************************************************/ -BOOL spoolss_io_q_enumprinterdataex(const char *desc, SPOOL_Q_ENUMPRINTERDATAEX *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_enumprinterdataex(const char *desc, SPOOL_Q_ENUMPRINTERDATAEX *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdataex"); depth++; @@ -7013,7 +7013,7 @@ BOOL spoolss_io_q_enumprinterdataex(const char *desc, SPOOL_Q_ENUMPRINTERDATAEX /******************************************************************* ********************************************************************/ -static BOOL spoolss_io_printer_enum_values_ctr(const char *desc, prs_struct *ps, +static bool spoolss_io_printer_enum_values_ctr(const char *desc, prs_struct *ps, PRINTER_ENUM_VALUES_CTR *ctr, int depth) { int i; @@ -7126,7 +7126,7 @@ static BOOL spoolss_io_printer_enum_values_ctr(const char *desc, prs_struct *ps, * write a structure. ********************************************************************/ -BOOL spoolss_io_r_enumprinterdataex(const char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_enumprinterdataex(const char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, prs_struct *ps, int depth) { uint32 data_offset, end_offset; prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdataex"); @@ -7188,7 +7188,7 @@ BOOL spoolss_io_r_enumprinterdataex(const char *desc, SPOOL_R_ENUMPRINTERDATAEX */ -BOOL make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, const char *name, char *environment, int level, RPC_BUFFER *buffer, uint32 offered) +bool make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, const char *name, char *environment, int level, RPC_BUFFER *buffer, uint32 offered) { DEBUG(5,("make_spoolss_q_getprintprocessordirectory\n")); @@ -7203,7 +7203,7 @@ BOOL make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTOR return True; } -BOOL spoolss_io_q_getprintprocessordirectory(const char *desc, SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_getprintprocessordirectory(const char *desc, SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, prs_struct *ps, int depth) { uint32 ptr; @@ -7255,7 +7255,7 @@ BOOL spoolss_io_q_getprintprocessordirectory(const char *desc, SPOOL_Q_GETPRINTP * write a structure. ********************************************************************/ -BOOL spoolss_io_r_getprintprocessordirectory(const char *desc, SPOOL_R_GETPRINTPROCESSORDIRECTORY *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_getprintprocessordirectory(const char *desc, SPOOL_R_GETPRINTPROCESSORDIRECTORY *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_getprintprocessordirectory"); depth++; @@ -7278,7 +7278,7 @@ BOOL spoolss_io_r_getprintprocessordirectory(const char *desc, SPOOL_R_GETPRINTP return True; } -BOOL smb_io_printprocessordirectory_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCESSOR_DIRECTORY_1 *info, int depth) +bool smb_io_printprocessordirectory_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCESSOR_DIRECTORY_1 *info, int depth) { prs_struct *ps=&buffer->prs; @@ -7297,7 +7297,7 @@ BOOL smb_io_printprocessordirectory_1(const char *desc, RPC_BUFFER *buffer, PRIN * init a structure. ********************************************************************/ -BOOL make_spoolss_q_addform(SPOOL_Q_ADDFORM *q_u, POLICY_HND *handle, +bool make_spoolss_q_addform(SPOOL_Q_ADDFORM *q_u, POLICY_HND *handle, int level, FORM *form) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); @@ -7312,7 +7312,7 @@ BOOL make_spoolss_q_addform(SPOOL_Q_ADDFORM *q_u, POLICY_HND *handle, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle, +bool make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle, int level, const char *form_name, FORM *form) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); @@ -7328,7 +7328,7 @@ BOOL make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, +bool make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, const char *form) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); @@ -7340,7 +7340,7 @@ BOOL make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_getform(SPOOL_Q_GETFORM *q_u, POLICY_HND *handle, +bool make_spoolss_q_getform(SPOOL_Q_GETFORM *q_u, POLICY_HND *handle, const char *formname, uint32 level, RPC_BUFFER *buffer, uint32 offered) { @@ -7357,7 +7357,7 @@ BOOL make_spoolss_q_getform(SPOOL_Q_GETFORM *q_u, POLICY_HND *handle, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_enumforms(SPOOL_Q_ENUMFORMS *q_u, POLICY_HND *handle, +bool make_spoolss_q_enumforms(SPOOL_Q_ENUMFORMS *q_u, POLICY_HND *handle, uint32 level, RPC_BUFFER *buffer, uint32 offered) { @@ -7373,7 +7373,7 @@ BOOL make_spoolss_q_enumforms(SPOOL_Q_ENUMFORMS *q_u, POLICY_HND *handle, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_setjob(SPOOL_Q_SETJOB *q_u, POLICY_HND *handle, +bool make_spoolss_q_setjob(SPOOL_Q_SETJOB *q_u, POLICY_HND *handle, uint32 jobid, uint32 level, uint32 command) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); @@ -7392,7 +7392,7 @@ BOOL make_spoolss_q_setjob(SPOOL_Q_SETJOB *q_u, POLICY_HND *handle, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_getjob(SPOOL_Q_GETJOB *q_u, POLICY_HND *handle, +bool make_spoolss_q_getjob(SPOOL_Q_GETJOB *q_u, POLICY_HND *handle, uint32 jobid, uint32 level, RPC_BUFFER *buffer, uint32 offered) { @@ -7409,7 +7409,7 @@ BOOL make_spoolss_q_getjob(SPOOL_Q_GETJOB *q_u, POLICY_HND *handle, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_startpageprinter(SPOOL_Q_STARTPAGEPRINTER *q_u, +bool make_spoolss_q_startpageprinter(SPOOL_Q_STARTPAGEPRINTER *q_u, POLICY_HND *handle) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); @@ -7421,7 +7421,7 @@ BOOL make_spoolss_q_startpageprinter(SPOOL_Q_STARTPAGEPRINTER *q_u, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_endpageprinter(SPOOL_Q_ENDPAGEPRINTER *q_u, +bool make_spoolss_q_endpageprinter(SPOOL_Q_ENDPAGEPRINTER *q_u, POLICY_HND *handle) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); @@ -7433,7 +7433,7 @@ BOOL make_spoolss_q_endpageprinter(SPOOL_Q_ENDPAGEPRINTER *q_u, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_startdocprinter(SPOOL_Q_STARTDOCPRINTER *q_u, +bool make_spoolss_q_startdocprinter(SPOOL_Q_STARTDOCPRINTER *q_u, POLICY_HND *handle, uint32 level, char *docname, char *outputfile, char *datatype) @@ -7473,7 +7473,7 @@ BOOL make_spoolss_q_startdocprinter(SPOOL_Q_STARTDOCPRINTER *q_u, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_enddocprinter(SPOOL_Q_ENDDOCPRINTER *q_u, +bool make_spoolss_q_enddocprinter(SPOOL_Q_ENDDOCPRINTER *q_u, POLICY_HND *handle) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); @@ -7485,7 +7485,7 @@ BOOL make_spoolss_q_enddocprinter(SPOOL_Q_ENDDOCPRINTER *q_u, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_writeprinter(SPOOL_Q_WRITEPRINTER *q_u, +bool make_spoolss_q_writeprinter(SPOOL_Q_WRITEPRINTER *q_u, POLICY_HND *handle, uint32 data_size, char *data) { @@ -7499,7 +7499,7 @@ BOOL make_spoolss_q_writeprinter(SPOOL_Q_WRITEPRINTER *q_u, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA *q_u, +bool make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA *q_u, POLICY_HND *handle, char *valuename) { memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); @@ -7512,7 +7512,7 @@ BOOL make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA *q_u, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX *q_u, +bool make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX *q_u, POLICY_HND *handle, char *key, char *value) { @@ -7527,7 +7527,7 @@ BOOL make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX *q_u, * init a structure. ********************************************************************/ -BOOL make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle, +bool make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle, uint32 flags, uint32 options, const char *localmachine, uint32 printerlocal, SPOOL_NOTIFY_OPTION *option) { @@ -7554,7 +7554,7 @@ BOOL make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle, /******************************************************************* ********************************************************************/ -BOOL spoolss_io_q_xcvdataport(const char *desc, SPOOL_Q_XCVDATAPORT *q_u, prs_struct *ps, int depth) +bool spoolss_io_q_xcvdataport(const char *desc, SPOOL_Q_XCVDATAPORT *q_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_q_xcvdataport"); depth++; @@ -7590,7 +7590,7 @@ BOOL spoolss_io_q_xcvdataport(const char *desc, SPOOL_Q_XCVDATAPORT *q_u, prs_st /******************************************************************* ********************************************************************/ -BOOL spoolss_io_r_xcvdataport(const char *desc, SPOOL_R_XCVDATAPORT *r_u, prs_struct *ps, int depth) +bool spoolss_io_r_xcvdataport(const char *desc, SPOOL_R_XCVDATAPORT *r_u, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "spoolss_io_r_xcvdataport"); depth++; @@ -7617,7 +7617,7 @@ BOOL spoolss_io_r_xcvdataport(const char *desc, SPOOL_R_XCVDATAPORT *r_u, prs_st /******************************************************************* ********************************************************************/ -BOOL make_monitorui_buf( RPC_BUFFER *buf, const char *dllname ) +bool make_monitorui_buf( RPC_BUFFER *buf, const char *dllname ) { UNISTR string; @@ -7637,7 +7637,7 @@ BOOL make_monitorui_buf( RPC_BUFFER *buf, const char *dllname ) #define PORT_DATA_1_PAD 540 -static BOOL smb_io_port_data_1( const char *desc, RPC_BUFFER *buf, int depth, SPOOL_PORT_DATA_1 *p1 ) +static bool smb_io_port_data_1( const char *desc, RPC_BUFFER *buf, int depth, SPOOL_PORT_DATA_1 *p1 ) { prs_struct *ps = &buf->prs; uint8 padding[PORT_DATA_1_PAD]; @@ -7689,7 +7689,7 @@ static BOOL smb_io_port_data_1( const char *desc, RPC_BUFFER *buf, int depth, SP /******************************************************************* ********************************************************************/ -BOOL convert_port_data_1( NT_PORT_DATA_1 *port1, RPC_BUFFER *buf ) +bool convert_port_data_1( NT_PORT_DATA_1 *port1, RPC_BUFFER *buf ) { SPOOL_PORT_DATA_1 spdata_1; diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index a1437c72c0..e7a73183f5 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -43,7 +43,7 @@ void init_srv_share_info0_str(SH_INFO_0_STR *sh0, const char *net_name) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info0_str(const char *desc, SH_INFO_0_STR *sh0, prs_struct *ps, int depth) +static bool srv_io_share_info0_str(const char *desc, SH_INFO_0_STR *sh0, prs_struct *ps, int depth) { if (sh0 == NULL) return False; @@ -75,7 +75,7 @@ void init_srv_share_info0(SH_INFO_0 *sh0, const char *net_name) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info0(const char *desc, SH_INFO_0 *sh0, prs_struct *ps, int depth) +static bool srv_io_share_info0(const char *desc, SH_INFO_0 *sh0, prs_struct *ps, int depth) { if (sh0 == NULL) return False; @@ -108,7 +108,7 @@ void init_srv_share_info1_str(SH_INFO_1_STR *sh1, const char *net_name, const ch Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1_str(const char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth) +static bool srv_io_share_info1_str(const char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth) { if (sh1 == NULL) return False; @@ -150,7 +150,7 @@ void init_srv_share_info1(SH_INFO_1 *sh1, const char *net_name, uint32 type, con Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1(const char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) +static bool srv_io_share_info1(const char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) { if (sh1 == NULL) return False; @@ -191,7 +191,7 @@ void init_srv_share_info2_str(SH_INFO_2_STR *sh2, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info2_str(const char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) +static bool srv_io_share_info2_str(const char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) { if (sh2 == NULL) return False; @@ -249,7 +249,7 @@ void init_srv_share_info2(SH_INFO_2 *sh2, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info2(const char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) +static bool srv_io_share_info2(const char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) { if (sh2 == NULL) return False; @@ -314,7 +314,7 @@ void init_srv_share_info501(SH_INFO_501 *sh501, const char *net_name, uint32 typ Reads of writes a structure. *******************************************************************/ -static BOOL srv_io_share_info501(const char *desc, SH_INFO_501 *sh501, prs_struct *ps, int depth) +static bool srv_io_share_info501(const char *desc, SH_INFO_501 *sh501, prs_struct *ps, int depth) { if (sh501 == NULL) return False; @@ -341,7 +341,7 @@ static BOOL srv_io_share_info501(const char *desc, SH_INFO_501 *sh501, prs_struc Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info501_str(const char *desc, SH_INFO_501_STR *sh501, prs_struct *ps, int depth) +static bool srv_io_share_info501_str(const char *desc, SH_INFO_501_STR *sh501, prs_struct *ps, int depth) { if (sh501 == NULL) return False; @@ -392,7 +392,7 @@ void init_srv_share_info502(SH_INFO_502 *sh502, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info502(const char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth) +static bool srv_io_share_info502(const char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth) { if (sh502 == NULL) return False; @@ -450,7 +450,7 @@ void init_srv_share_info502_str(SH_INFO_502_STR *sh502str, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info502_str(const char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth) +static bool srv_io_share_info502_str(const char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth) { if (sh502 == NULL) return False; @@ -545,7 +545,7 @@ void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, const char *remark) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1004_str(const char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth) +static bool srv_io_share_info1004_str(const char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth) { if (sh1004 == NULL) return False; @@ -577,7 +577,7 @@ void init_srv_share_info1004(SH_INFO_1004 *sh1004, const char *remark) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1004(const char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth) +static bool srv_io_share_info1004(const char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth) { if (sh1004 == NULL) return False; @@ -598,7 +598,7 @@ static BOOL srv_io_share_info1004(const char *desc, SH_INFO_1004 *sh1004, prs_st Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1005(const char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth) +static bool srv_io_share_info1005(const char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth) { if(sh1005 == NULL) return False; @@ -620,7 +620,7 @@ static BOOL srv_io_share_info1005(const char* desc, SRV_SHARE_INFO_1005* sh1005, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1006(const char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth) +static bool srv_io_share_info1006(const char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth) { if(sh1006 == NULL) return False; @@ -652,7 +652,7 @@ void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1007_str(const char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth) +static bool srv_io_share_info1007_str(const char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth) { if (sh1007 == NULL) return False; @@ -685,7 +685,7 @@ void init_srv_share_info1007(SH_INFO_1007 *sh1007, uint32 flags, const char *alt Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1007(const char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth) +static bool srv_io_share_info1007(const char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth) { if (sh1007 == NULL) return False; @@ -708,7 +708,7 @@ static BOOL srv_io_share_info1007(const char *desc, SH_INFO_1007 *sh1007, prs_st Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_share_info1501(const char* desc, SRV_SHARE_INFO_1501* sh1501, +static bool srv_io_share_info1501(const char* desc, SRV_SHARE_INFO_1501* sh1501, prs_struct* ps, int depth) { if(sh1501 == NULL) @@ -730,7 +730,7 @@ static BOOL srv_io_share_info1501(const char* desc, SRV_SHARE_INFO_1501* sh1501, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth) +static bool srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return False; @@ -1052,7 +1052,7 @@ void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_share_enum(const char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth) +bool srv_io_q_net_share_enum(const char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1087,7 +1087,7 @@ BOOL srv_io_q_net_share_enum(const char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_st Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_enum(const char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth) +bool srv_io_r_net_share_enum(const char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -1117,7 +1117,7 @@ BOOL srv_io_r_net_share_enum(const char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_st initialises a structure. ********************************************************************/ -BOOL init_srv_q_net_share_get_info(SRV_Q_NET_SHARE_GET_INFO *q_n, const char *srv_name, const char *share_name, uint32 info_level) +bool init_srv_q_net_share_get_info(SRV_Q_NET_SHARE_GET_INFO *q_n, const char *srv_name, const char *share_name, uint32 info_level) { uint32 ptr_share_name; @@ -1136,7 +1136,7 @@ BOOL init_srv_q_net_share_get_info(SRV_Q_NET_SHARE_GET_INFO *q_n, const char *sr Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_share_get_info(const char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth) +bool srv_io_q_net_share_get_info(const char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1168,7 +1168,7 @@ BOOL srv_io_q_net_share_get_info(const char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_share_info(const char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n) +static bool srv_io_srv_share_info(const char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n) { if (r_n == NULL) return False; @@ -1279,7 +1279,7 @@ static BOOL srv_io_srv_share_info(const char *desc, prs_struct *ps, int depth, S Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_get_info(const char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth) +bool srv_io_r_net_share_get_info(const char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -1306,7 +1306,7 @@ BOOL srv_io_r_net_share_get_info(const char *desc, SRV_R_NET_SHARE_GET_INFO *r_n intialises a structure. ********************************************************************/ -BOOL init_srv_q_net_share_set_info(SRV_Q_NET_SHARE_SET_INFO *q_n, +bool init_srv_q_net_share_set_info(SRV_Q_NET_SHARE_SET_INFO *q_n, const char *srv_name, const char *share_name, uint32 info_level, @@ -1334,7 +1334,7 @@ BOOL init_srv_q_net_share_set_info(SRV_Q_NET_SHARE_SET_INFO *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_share_set_info(const char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth) +bool srv_io_q_net_share_set_info(const char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1381,7 +1381,7 @@ BOOL srv_io_q_net_share_set_info(const char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_set_info(const char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth) +bool srv_io_r_net_share_set_info(const char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -1412,7 +1412,7 @@ BOOL srv_io_r_net_share_set_info(const char *desc, SRV_R_NET_SHARE_SET_INFO *r_n Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_share_add(const char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth) +bool srv_io_q_net_share_add(const char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1494,7 +1494,7 @@ void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_add(const char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth) +bool srv_io_r_net_share_add(const char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -1536,7 +1536,7 @@ void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_share_del(const char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) +bool srv_io_q_net_share_del(const char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1567,7 +1567,7 @@ BOOL srv_io_q_net_share_del(const char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_stru Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_share_del(const char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) +bool srv_io_r_net_share_del(const char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1605,7 +1605,7 @@ void init_srv_sess_info0( SESS_INFO_0 *ss0, const char *name ) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth) +static bool srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return False; @@ -1692,7 +1692,7 @@ void init_srv_sess_info1( SESS_INFO_1 *ss1, const char *name, const char *user, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_sess_info_1(const char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth) +static bool srv_io_srv_sess_info_1(const char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -1760,7 +1760,7 @@ static BOOL srv_io_srv_sess_info_1(const char *desc, SRV_SESS_INFO_1 *ss1, prs_s Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth) +static bool srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth) { SRV_SESS_INFO_CTR *ctr = *pp_ctr; @@ -1808,7 +1808,7 @@ static BOOL srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, pr Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_u, prs_struct *ps, int depth) +bool srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -1861,7 +1861,7 @@ BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_u, prs_stru Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_sess_enum(const char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth) +bool srv_io_r_net_sess_enum(const char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -1908,7 +1908,7 @@ void init_srv_q_net_sess_del(SRV_Q_NET_SESS_DEL *q_n, const char *srv_name, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_sess_del(const char *desc, SRV_Q_NET_SESS_DEL *q_n, prs_struct *ps, int depth) +bool srv_io_q_net_sess_del(const char *desc, SRV_Q_NET_SESS_DEL *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -1946,7 +1946,7 @@ BOOL srv_io_q_net_sess_del(const char *desc, SRV_Q_NET_SESS_DEL *q_n, prs_struct Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_sess_del(const char *desc, SRV_R_NET_SESS_DEL *r_n, prs_struct *ps, int depth) +bool srv_io_r_net_sess_del(const char *desc, SRV_R_NET_SESS_DEL *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -1978,7 +1978,7 @@ void init_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id) Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_conn_info0(const char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth) +static bool srv_io_conn_info0(const char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return False; @@ -1999,7 +1999,7 @@ static BOOL srv_io_conn_info0(const char *desc, CONN_INFO_0 *ss0, prs_struct *ps Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_conn_info_0(const char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth) +static bool srv_io_srv_conn_info_0(const char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth) { if (ss0 == NULL) return False; @@ -2054,7 +2054,7 @@ void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, const char *usr_name, const c Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_conn_info1_str(const char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth) +static bool srv_io_conn_info1_str(const char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -2098,7 +2098,7 @@ void init_srv_conn_info1(CONN_INFO_1 *ss1, Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_conn_info1(const char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth) +static bool srv_io_conn_info1(const char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -2132,7 +2132,7 @@ static BOOL srv_io_conn_info1(const char *desc, CONN_INFO_1 *ss1, prs_struct *ps Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_conn_info_1(const char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth) +static bool srv_io_srv_conn_info_1(const char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth) { if (ss1 == NULL) return False; @@ -2180,7 +2180,7 @@ static BOOL srv_io_srv_conn_info_1(const char *desc, SRV_CONN_INFO_1 *ss1, prs_s Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_conn_ctr(const char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth) +static bool srv_io_srv_conn_ctr(const char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth) { SRV_CONN_INFO_CTR *ctr = *pp_ctr; @@ -2251,7 +2251,7 @@ void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_conn_enum(const char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth) +bool srv_io_q_net_conn_enum(const char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -2299,7 +2299,7 @@ BOOL srv_io_q_net_conn_enum(const char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_stru Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth) +bool srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -2332,7 +2332,7 @@ BOOL srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_str Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_file_info3_str(const char *desc, FILE_INFO_3 *sh1, prs_struct *ps, int depth) +static bool srv_io_file_info3_str(const char *desc, FILE_INFO_3 *sh1, prs_struct *ps, int depth) { if (sh1 == NULL) return False; @@ -2386,7 +2386,7 @@ void init_srv_file_info3( FILE_INFO_3 *fl3, uint32 id, uint32 perms, uint32 num_ Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) +static bool srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) { uint32 uni_p; @@ -2431,7 +2431,7 @@ static BOOL srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) +static bool srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return False; @@ -2538,7 +2538,7 @@ void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_u, prs_struct *ps, int depth) +bool srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -2588,7 +2588,7 @@ BOOL srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_u, prs_stru Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth) +bool srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -2633,7 +2633,7 @@ void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, const char *name Reads or writes a SRV_INFO_101 structure. ********************************************************************/ -static BOOL srv_io_info_100(const char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth) +static bool srv_io_info_100(const char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth) { if (sv100 == NULL) return False; @@ -2678,7 +2678,7 @@ void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, const char *name Reads or writes a SRV_INFO_101 structure. ********************************************************************/ -static BOOL srv_io_info_101(const char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth) +static bool srv_io_info_101(const char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth) { if (sv101 == NULL) return False; @@ -2748,7 +2748,7 @@ void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, const char *name Reads or writes a SRV_INFO_102 structure. ********************************************************************/ -static BOOL srv_io_info_102(const char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth) +static bool srv_io_info_102(const char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth) { if (sv102 == NULL) return False; @@ -2807,7 +2807,7 @@ static BOOL srv_io_info_102(const char *desc, SRV_INFO_102 *sv102, prs_struct *p Reads or writes a SRV_INFO_102 structure. ********************************************************************/ -static BOOL srv_io_info_ctr(const char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) +static bool srv_io_info_ctr(const char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) { if (ctr == NULL) return False; @@ -2867,7 +2867,7 @@ void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_srv_get_info(const char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth) +bool srv_io_q_net_srv_get_info(const char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -2931,7 +2931,7 @@ void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_srv_set_info(const char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, +bool srv_io_q_net_srv_set_info(const char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info"); @@ -2968,7 +2968,7 @@ BOOL srv_io_q_net_srv_set_info(const char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_srv_get_info(const char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth) +bool srv_io_r_net_srv_get_info(const char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -2992,7 +2992,7 @@ BOOL srv_io_r_net_srv_get_info(const char *desc, SRV_R_NET_SRV_GET_INFO *r_n, pr Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_srv_set_info(const char *desc, SRV_R_NET_SRV_SET_INFO *r_n, +bool srv_io_r_net_srv_set_info(const char *desc, SRV_R_NET_SRV_SET_INFO *r_n, prs_struct *ps, int depth) { prs_debug(ps, depth, desc, "srv_io_r_net_srv_set_info"); @@ -3014,7 +3014,7 @@ BOOL srv_io_r_net_srv_set_info(const char *desc, SRV_R_NET_SRV_SET_INFO *r_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_remote_tod(const char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth) +bool srv_io_q_net_remote_tod(const char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -3037,7 +3037,7 @@ BOOL srv_io_q_net_remote_tod(const char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_st Reads or writes a TIME_OF_DAY_INFO structure. ********************************************************************/ -static BOOL srv_io_time_of_day_info(const char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth) +static bool srv_io_time_of_day_info(const char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth) { if (tod == NULL) return False; @@ -3106,7 +3106,7 @@ void init_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_remote_tod(const char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth) +bool srv_io_r_net_remote_tod(const char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -3133,7 +3133,7 @@ BOOL srv_io_r_net_remote_tod(const char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_st initialises a structure. ********************************************************************/ -BOOL init_srv_q_net_disk_enum(SRV_Q_NET_DISK_ENUM *q_n, +bool init_srv_q_net_disk_enum(SRV_Q_NET_DISK_ENUM *q_n, const char *srv_name, uint32 preferred_len, ENUM_HND *enum_hnd @@ -3158,7 +3158,7 @@ BOOL init_srv_q_net_disk_enum(SRV_Q_NET_DISK_ENUM *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_disk_enum(const char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth) +bool srv_io_q_net_disk_enum(const char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -3202,7 +3202,7 @@ BOOL srv_io_q_net_disk_enum(const char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_stru Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth) +bool srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth) { unsigned int i; @@ -3272,7 +3272,7 @@ BOOL srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_stru Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_name_validate(const char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth) +bool srv_io_q_net_name_validate(const char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -3309,7 +3309,7 @@ BOOL srv_io_q_net_name_validate(const char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_name_validate(const char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth) +bool srv_io_r_net_name_validate(const char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -3330,7 +3330,7 @@ BOOL srv_io_r_net_name_validate(const char *desc, SRV_R_NET_NAME_VALIDATE *r_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_file_query_secdesc(const char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth) +bool srv_io_q_net_file_query_secdesc(const char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -3378,7 +3378,7 @@ BOOL srv_io_q_net_file_query_secdesc(const char *desc, SRV_Q_NET_FILE_QUERY_SECD Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_file_query_secdesc(const char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth) +bool srv_io_r_net_file_query_secdesc(const char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; @@ -3417,7 +3417,7 @@ BOOL srv_io_r_net_file_query_secdesc(const char *desc, SRV_R_NET_FILE_QUERY_SECD Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_file_set_secdesc(const char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth) +bool srv_io_q_net_file_set_secdesc(const char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth) { if (q_n == NULL) return False; @@ -3474,7 +3474,7 @@ BOOL srv_io_q_net_file_set_secdesc(const char *desc, SRV_Q_NET_FILE_SET_SECDESC Reads or writes a structure. ********************************************************************/ -BOOL srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth) +bool srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth) { if (r_n == NULL) return False; diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index b571034d4c..18e12ef0a6 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -25,7 +25,7 @@ /******************************************************************* ********************************************************************/ -static BOOL svcctl_io_service_status( const char *desc, SERVICE_STATUS *status, prs_struct *ps, int depth ) +static bool svcctl_io_service_status( const char *desc, SERVICE_STATUS *status, prs_struct *ps, int depth ) { prs_debug(ps, depth, desc, "svcctl_io_service_status"); @@ -58,7 +58,7 @@ static BOOL svcctl_io_service_status( const char *desc, SERVICE_STATUS *status, /******************************************************************* ********************************************************************/ -static BOOL svcctl_io_service_config( const char *desc, SERVICE_CONFIG *config, prs_struct *ps, int depth ) +static bool svcctl_io_service_config( const char *desc, SERVICE_CONFIG *config, prs_struct *ps, int depth ) { prs_debug(ps, depth, desc, "svcctl_io_service_config"); @@ -103,7 +103,7 @@ static BOOL svcctl_io_service_config( const char *desc, SERVICE_CONFIG *config, /******************************************************************* ********************************************************************/ -BOOL svcctl_io_enum_services_status( const char *desc, ENUM_SERVICES_STATUS *enum_status, RPC_BUFFER *buffer, int depth ) +bool svcctl_io_enum_services_status( const char *desc, ENUM_SERVICES_STATUS *enum_status, RPC_BUFFER *buffer, int depth ) { prs_struct *ps=&buffer->prs; @@ -124,7 +124,7 @@ BOOL svcctl_io_enum_services_status( const char *desc, ENUM_SERVICES_STATUS *enu /******************************************************************* ********************************************************************/ -BOOL svcctl_io_service_status_process( const char *desc, SERVICE_STATUS_PROCESS *status, RPC_BUFFER *buffer, int depth ) +bool svcctl_io_service_status_process( const char *desc, SERVICE_STATUS_PROCESS *status, RPC_BUFFER *buffer, int depth ) { prs_struct *ps=&buffer->prs; @@ -198,7 +198,7 @@ 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) +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; @@ -228,7 +228,7 @@ BOOL svcctl_io_q_open_scmanager(const char *desc, SVCCTL_Q_OPEN_SCMANAGER *q_u, /******************************************************************* ********************************************************************/ -BOOL svcctl_io_r_open_scmanager(const char *desc, SVCCTL_R_OPEN_SCMANAGER *r_u, prs_struct *ps, int depth) +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; @@ -251,7 +251,7 @@ BOOL svcctl_io_r_open_scmanager(const char *desc, SVCCTL_R_OPEN_SCMANAGER *r_u, /******************************************************************* ********************************************************************/ -BOOL svcctl_io_q_get_display_name(const char *desc, SVCCTL_Q_GET_DISPLAY_NAME *q_u, prs_struct *ps, int depth) +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; @@ -280,7 +280,7 @@ BOOL svcctl_io_q_get_display_name(const char *desc, SVCCTL_Q_GET_DISPLAY_NAME *q /******************************************************************* ********************************************************************/ -BOOL init_svcctl_r_get_display_name( SVCCTL_R_GET_DISPLAY_NAME *r_u, const char *displayname ) +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 ); @@ -291,7 +291,7 @@ BOOL init_svcctl_r_get_display_name( SVCCTL_R_GET_DISPLAY_NAME *r_u, const char /******************************************************************* ********************************************************************/ -BOOL svcctl_io_r_get_display_name(const char *desc, SVCCTL_R_GET_DISPLAY_NAME *r_u, prs_struct *ps, int depth) +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; @@ -322,7 +322,7 @@ BOOL svcctl_io_r_get_display_name(const char *desc, SVCCTL_R_GET_DISPLAY_NAME *r /******************************************************************* ********************************************************************/ -BOOL svcctl_io_q_open_service(const char *desc, SVCCTL_Q_OPEN_SERVICE *q_u, prs_struct *ps, int depth) +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; @@ -351,7 +351,7 @@ BOOL svcctl_io_q_open_service(const char *desc, SVCCTL_Q_OPEN_SERVICE *q_u, prs_ /******************************************************************* ********************************************************************/ -BOOL svcctl_io_r_open_service(const char *desc, SVCCTL_R_OPEN_SERVICE *r_u, prs_struct *ps, int depth) +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; @@ -374,7 +374,7 @@ BOOL svcctl_io_r_open_service(const char *desc, SVCCTL_R_OPEN_SERVICE *r_u, prs_ /******************************************************************* ********************************************************************/ -BOOL svcctl_io_q_query_status(const char *desc, SVCCTL_Q_QUERY_STATUS *q_u, prs_struct *ps, int depth) +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; @@ -394,7 +394,7 @@ BOOL svcctl_io_q_query_status(const char *desc, SVCCTL_Q_QUERY_STATUS *q_u, prs_ /******************************************************************* ********************************************************************/ -BOOL svcctl_io_r_query_status(const char *desc, SVCCTL_R_QUERY_STATUS *r_u, prs_struct *ps, int depth) +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; @@ -417,7 +417,7 @@ BOOL svcctl_io_r_query_status(const char *desc, SVCCTL_R_QUERY_STATUS *r_u, prs_ /******************************************************************* ********************************************************************/ -BOOL svcctl_io_q_enum_services_status(const char *desc, SVCCTL_Q_ENUM_SERVICES_STATUS *q_u, prs_struct *ps, int depth) +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) return False; @@ -447,7 +447,7 @@ BOOL svcctl_io_q_enum_services_status(const char *desc, SVCCTL_Q_ENUM_SERVICES_S /******************************************************************* ********************************************************************/ -BOOL svcctl_io_r_enum_services_status(const char *desc, SVCCTL_R_ENUM_SERVICES_STATUS *r_u, prs_struct *ps, int depth) +bool svcctl_io_r_enum_services_status(const char *desc, SVCCTL_R_ENUM_SERVICES_STATUS *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -481,7 +481,7 @@ 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) +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; @@ -507,7 +507,7 @@ BOOL svcctl_io_q_start_service(const char *desc, SVCCTL_Q_START_SERVICE *q_u, pr /******************************************************************* ********************************************************************/ -BOOL svcctl_io_r_start_service(const char *desc, SVCCTL_R_START_SERVICE *r_u, prs_struct *ps, int depth) +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; @@ -525,7 +525,7 @@ BOOL svcctl_io_r_start_service(const char *desc, SVCCTL_R_START_SERVICE *r_u, pr /******************************************************************* ********************************************************************/ -BOOL svcctl_io_q_enum_dependent_services(const char *desc, SVCCTL_Q_ENUM_DEPENDENT_SERVICES *q_u, prs_struct *ps, int depth) +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) return False; @@ -550,7 +550,7 @@ BOOL svcctl_io_q_enum_dependent_services(const char *desc, SVCCTL_Q_ENUM_DEPENDE /******************************************************************* ********************************************************************/ -BOOL svcctl_io_r_enum_dependent_services(const char *desc, SVCCTL_R_ENUM_DEPENDENT_SERVICES *r_u, prs_struct *ps, int depth) +bool svcctl_io_r_enum_dependent_services(const char *desc, SVCCTL_R_ENUM_DEPENDENT_SERVICES *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -581,7 +581,7 @@ 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) +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; @@ -604,7 +604,7 @@ BOOL svcctl_io_q_control_service(const char *desc, SVCCTL_Q_CONTROL_SERVICE *q_u /******************************************************************* ********************************************************************/ -BOOL svcctl_io_r_control_service(const char *desc, SVCCTL_R_CONTROL_SERVICE *r_u, prs_struct *ps, int depth) +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; @@ -628,7 +628,7 @@ BOOL svcctl_io_r_control_service(const char *desc, SVCCTL_R_CONTROL_SERVICE *r_u /******************************************************************* ********************************************************************/ -BOOL svcctl_io_q_query_service_config(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, int depth) +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) return False; @@ -651,7 +651,7 @@ BOOL svcctl_io_q_query_service_config(const char *desc, SVCCTL_Q_QUERY_SERVICE_C /******************************************************************* ********************************************************************/ -BOOL svcctl_io_r_query_service_config(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG *r_u, prs_struct *ps, int depth) +bool svcctl_io_r_query_service_config(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; @@ -679,7 +679,7 @@ BOOL svcctl_io_r_query_service_config(const char *desc, SVCCTL_R_QUERY_SERVICE_C /******************************************************************* ********************************************************************/ -BOOL svcctl_io_q_query_service_config2(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, prs_struct *ps, int depth) +bool svcctl_io_q_query_service_config2(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -715,7 +715,7 @@ void init_service_description_buffer(SERVICE_DESCRIPTION *desc, const char *serv /******************************************************************* ********************************************************************/ -BOOL svcctl_io_service_description( const char *desc, SERVICE_DESCRIPTION *description, RPC_BUFFER *buffer, int depth ) +bool svcctl_io_service_description( const char *desc, SERVICE_DESCRIPTION *description, RPC_BUFFER *buffer, int depth ) { prs_struct *ps = &buffer->prs; @@ -745,7 +745,7 @@ uint32 svcctl_sizeof_service_description( SERVICE_DESCRIPTION *desc ) /******************************************************************* ********************************************************************/ -static BOOL svcctl_io_action( const char *desc, SC_ACTION *action, prs_struct *ps, int depth ) +static bool svcctl_io_action( const char *desc, SC_ACTION *action, prs_struct *ps, int depth ) { prs_debug(ps, depth, desc, "svcctl_io_action"); @@ -762,7 +762,7 @@ static BOOL svcctl_io_action( const char *desc, SC_ACTION *action, prs_struct *p /******************************************************************* ********************************************************************/ -BOOL svcctl_io_service_fa( const char *desc, SERVICE_FAILURE_ACTIONS *fa, RPC_BUFFER *buffer, int depth ) +bool svcctl_io_service_fa( const char *desc, SERVICE_FAILURE_ACTIONS *fa, RPC_BUFFER *buffer, int depth ) { prs_struct *ps = &buffer->prs; int i; @@ -821,7 +821,7 @@ uint32 svcctl_sizeof_service_fa( SERVICE_FAILURE_ACTIONS *fa) /******************************************************************* ********************************************************************/ -BOOL svcctl_io_r_query_service_config2(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u, prs_struct *ps, int depth) +bool svcctl_io_r_query_service_config2(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u, prs_struct *ps, int depth) { if ( !r_u ) return False; @@ -850,7 +850,7 @@ BOOL svcctl_io_r_query_service_config2(const char *desc, SVCCTL_R_QUERY_SERVICE_ /******************************************************************* ********************************************************************/ -BOOL svcctl_io_q_query_service_status_ex(const char *desc, SVCCTL_Q_QUERY_SERVICE_STATUSEX *q_u, prs_struct *ps, int depth) +bool svcctl_io_q_query_service_status_ex(const char *desc, SVCCTL_Q_QUERY_SERVICE_STATUSEX *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; @@ -877,7 +877,7 @@ BOOL svcctl_io_q_query_service_status_ex(const char *desc, SVCCTL_Q_QUERY_SERVIC /******************************************************************* ********************************************************************/ -BOOL svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVICE_STATUSEX *r_u, prs_struct *ps, int depth) +bool svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVICE_STATUSEX *r_u, prs_struct *ps, int depth) { if ( !r_u ) return False; @@ -903,7 +903,7 @@ BOOL svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVIC /******************************************************************* ********************************************************************/ -BOOL svcctl_io_q_lock_service_db(const char *desc, SVCCTL_Q_LOCK_SERVICE_DB *q_u, prs_struct *ps, int depth) +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; @@ -924,7 +924,7 @@ BOOL svcctl_io_q_lock_service_db(const char *desc, SVCCTL_Q_LOCK_SERVICE_DB *q_u /******************************************************************* ********************************************************************/ -BOOL svcctl_io_r_lock_service_db(const char *desc, SVCCTL_R_LOCK_SERVICE_DB *r_u, prs_struct *ps, int depth) +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; @@ -947,7 +947,7 @@ BOOL svcctl_io_r_lock_service_db(const char *desc, SVCCTL_R_LOCK_SERVICE_DB *r_u /******************************************************************* ********************************************************************/ -BOOL svcctl_io_q_unlock_service_db(const char *desc, SVCCTL_Q_UNLOCK_SERVICE_DB *q_u, prs_struct *ps, int depth) +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; @@ -968,7 +968,7 @@ BOOL svcctl_io_q_unlock_service_db(const char *desc, SVCCTL_Q_UNLOCK_SERVICE_DB /******************************************************************* ********************************************************************/ -BOOL svcctl_io_r_unlock_service_db(const char *desc, SVCCTL_R_UNLOCK_SERVICE_DB *r_u, prs_struct *ps, int depth) +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; @@ -988,7 +988,7 @@ BOOL svcctl_io_r_unlock_service_db(const char *desc, SVCCTL_R_UNLOCK_SERVICE_DB /******************************************************************* ********************************************************************/ -BOOL svcctl_io_q_query_service_sec(const char *desc, SVCCTL_Q_QUERY_SERVICE_SEC *q_u, prs_struct *ps, int depth) +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; @@ -1013,7 +1013,7 @@ BOOL svcctl_io_q_query_service_sec(const char *desc, SVCCTL_Q_QUERY_SERVICE_SEC /******************************************************************* ********************************************************************/ -BOOL svcctl_io_r_query_service_sec(const char *desc, SVCCTL_R_QUERY_SERVICE_SEC *r_u, prs_struct *ps, int depth) +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; @@ -1039,7 +1039,7 @@ BOOL svcctl_io_r_query_service_sec(const char *desc, SVCCTL_R_QUERY_SERVICE_SEC /******************************************************************* ********************************************************************/ -BOOL svcctl_io_q_set_service_sec(const char *desc, SVCCTL_Q_SET_SERVICE_SEC *q_u, prs_struct *ps, int depth) +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; @@ -1071,7 +1071,7 @@ BOOL svcctl_io_q_set_service_sec(const char *desc, SVCCTL_Q_SET_SERVICE_SEC *q_u /******************************************************************* ********************************************************************/ -BOOL svcctl_io_r_set_service_sec(const char *desc, SVCCTL_R_SET_SERVICE_SEC *r_u, prs_struct *ps, int depth) +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; -- cgit From c049b8157d0bb4b5cd57b66740a26813be4f9eba Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 20 Nov 2007 15:31:37 -0800 Subject: More trivial pstring removal. Jeremy. (This used to be commit bac3bb2f6e9e15b3a9a6a6511c484f8509918ca1) --- source3/rpc_parse/parse_net.c | 2 +- source3/rpc_parse/parse_prs.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index e12d9dda0d..df11c6d75a 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1086,7 +1086,7 @@ bool net_io_r_srv_pwset(const char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsids) { const char *ptr; - pstring s2; + fstring s2; int count = 0; DEBUG(4,("init_dom_sid2s: %s\n", sids_str ? sids_str:"")); diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index a30e96772a..137e0dabac 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -48,14 +48,18 @@ void prs_dump_region(char *name, int v, prs_struct *ps, int from_off, int to_off) { int fd, i; - pstring fname; + char *fname = NULL; ssize_t sz; if (DEBUGLEVEL < 50) return; for (i=1;i<100;i++) { if (v != -1) { - slprintf(fname,sizeof(fname)-1, "/tmp/%s_%d.%d.prs", name, v, i); + if (asprintf(&fname,"/tmp/%s_%d.%d.prs", name, v, i) < 0) { + return; + } } else { - slprintf(fname,sizeof(fname)-1, "/tmp/%s.%d.prs", name, i); + if (asprintf(&fname,"/tmp/%s.%d.prs", name, i) < 0) { + return; + } } fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0644); if (fd != -1 || errno != EEXIST) break; @@ -69,6 +73,7 @@ void prs_dump_region(char *name, int v, prs_struct *ps, DEBUG(0,("created %s\n", fname)); } } + SAFE_FREE(fname); } /******************************************************************* -- cgit From 66298d808034bb606478ff66aa156bda4e7e3f2a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 20 Nov 2007 17:18:16 -0800 Subject: More pstring elimination. Jeremy. (This used to be commit 15074de938539e7a9c527d9a6d81792adc2ac3d0) --- source3/rpc_parse/parse_prs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 137e0dabac..4abf63e71d 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -28,7 +28,7 @@ /** * Dump a prs to a file: from the current location through to the end. **/ -void prs_dump(char *name, int v, prs_struct *ps) +void prs_dump(const char *name, int v, prs_struct *ps) { prs_dump_region(name, v, ps, ps->data_offset, ps->buffer_size); } @@ -36,7 +36,7 @@ void prs_dump(char *name, int v, prs_struct *ps) /** * Dump from the start of the prs to the current location. **/ -void prs_dump_before(char *name, int v, prs_struct *ps) +void prs_dump_before(const char *name, int v, prs_struct *ps) { prs_dump_region(name, v, ps, 0, ps->data_offset); } @@ -44,7 +44,7 @@ void prs_dump_before(char *name, int v, prs_struct *ps) /** * Dump everything from the start of the prs up to the current location. **/ -void prs_dump_region(char *name, int v, prs_struct *ps, +void prs_dump_region(const char *name, int v, prs_struct *ps, int from_off, int to_off) { int fd, i; -- cgit From cef494d90366fbff638c72efd5a41a22a834ae20 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 27 Nov 2007 17:48:44 -0800 Subject: Make init_unistr2_from_unistr take an explicit talloc context. Make init_unistr() re-use rpcstr_push_talloc(). Jeremy. (This used to be commit 04aecde5cfdb00d5aa32f9675c797266aba83c0f) --- source3/rpc_parse/parse_misc.c | 17 ++++-------- source3/rpc_parse/parse_spoolss.c | 56 +++++++++++++++++++-------------------- 2 files changed, 33 insertions(+), 40 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 2e85b59a4b..783c7fb7b3 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -430,16 +430,9 @@ void init_unistr(UNISTR *str, const char *buf) str->buffer = NULL; return; } - - len = strlen(buf) + 1; - if (len) { - str->buffer = TALLOC_ZERO_ARRAY(talloc_tos(), uint16, len); - if (str->buffer == NULL) - smb_panic("init_unistr: malloc fail"); - - rpcstr_push(str->buffer, buf, len*sizeof(uint16), STR_TERMINATE); - } else { + len = rpcstr_push_talloc(talloc_tos(), &str->buffer, buf); + if (len == (size_t)-1) { str->buffer = NULL; } } @@ -870,7 +863,7 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf) Inits a UNISTR2 structure from a UNISTR ********************************************************************/ -void init_unistr2_from_unistr(UNISTR2 *to, const UNISTR *from) +void init_unistr2_from_unistr(TALLOC_CTX *ctx, UNISTR2 *to, const UNISTR *from) { uint32 i; @@ -898,9 +891,9 @@ void init_unistr2_from_unistr(UNISTR2 *to, const UNISTR *from) /* allocate the space and copy the string buffer */ if (i) { - to->buffer = TALLOC_ZERO_ARRAY(talloc_tos(), uint16, i); + to->buffer = TALLOC_ZERO_ARRAY(ctx, uint16, i); if (to->buffer == NULL) - smb_panic("init_unistr2_from_unistr: malloc fail"); + smb_panic("init_unistr2_from_unistr: talloc fail"); memcpy(to->buffer, from->buffer, i*sizeof(uint16)); } else { to->buffer = NULL; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 3030ff1cf0..ea76c57045 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1016,18 +1016,18 @@ bool make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u create a SPOOL_PRINTER_INFO_2 stuct from a PRINTER_INFO_2 struct *******************************************************************/ -bool make_spoolss_printer_info_2(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2, +bool make_spoolss_printer_info_2(TALLOC_CTX *ctx, SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2, PRINTER_INFO_2 *info) { SPOOL_PRINTER_INFO_LEVEL_2 *inf; /* allocate the necessary memory */ - if (!(inf=TALLOC_P(mem_ctx, SPOOL_PRINTER_INFO_LEVEL_2))) { + if (!(inf=TALLOC_P(ctx, SPOOL_PRINTER_INFO_LEVEL_2))) { DEBUG(0,("make_spoolss_printer_info_2: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_2 sruct!\n")); return False; } - + inf->servername_ptr = (info->servername.buffer!=NULL)?1:0; inf->printername_ptr = (info->printername.buffer!=NULL)?1:0; inf->sharename_ptr = (info->sharename.buffer!=NULL)?1:0; @@ -1048,18 +1048,18 @@ bool make_spoolss_printer_info_2(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_2 inf->untiltime = info->untiltime; inf->cjobs = info->cjobs; inf->averageppm = info->averageppm; - init_unistr2_from_unistr(&inf->servername, &info->servername); - init_unistr2_from_unistr(&inf->printername, &info->printername); - init_unistr2_from_unistr(&inf->sharename, &info->sharename); - init_unistr2_from_unistr(&inf->portname, &info->portname); - init_unistr2_from_unistr(&inf->drivername, &info->drivername); - init_unistr2_from_unistr(&inf->comment, &info->comment); - init_unistr2_from_unistr(&inf->location, &info->location); - init_unistr2_from_unistr(&inf->sepfile, &info->sepfile); - init_unistr2_from_unistr(&inf->printprocessor, &info->printprocessor); - init_unistr2_from_unistr(&inf->datatype, &info->datatype); - init_unistr2_from_unistr(&inf->parameters, &info->parameters); - init_unistr2_from_unistr(&inf->datatype, &info->datatype); + init_unistr2_from_unistr(inf, &inf->servername, &info->servername); + init_unistr2_from_unistr(inf, &inf->printername, &info->printername); + init_unistr2_from_unistr(inf, &inf->sharename, &info->sharename); + init_unistr2_from_unistr(inf, &inf->portname, &info->portname); + init_unistr2_from_unistr(inf, &inf->drivername, &info->drivername); + init_unistr2_from_unistr(inf, &inf->comment, &info->comment); + init_unistr2_from_unistr(inf, &inf->location, &info->location); + init_unistr2_from_unistr(inf, &inf->sepfile, &info->sepfile); + init_unistr2_from_unistr(inf, &inf->printprocessor, &info->printprocessor); + init_unistr2_from_unistr(inf, &inf->datatype, &info->datatype); + init_unistr2_from_unistr(inf, &inf->parameters, &info->parameters); + init_unistr2_from_unistr(inf, &inf->datatype, &info->datatype); *spool_info2 = inf; @@ -1105,9 +1105,9 @@ bool make_spoolss_printer_info_7(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_7 return False; } - inf->guid_ptr = (info->guid.buffer!=NULL)?1:0; - inf->action = info->action; - init_unistr2_from_unistr(&inf->guid, &info->guid); + inf->guid_ptr = (info->guid.buffer!=NULL)?1:0; + inf->action = info->action; + init_unistr2_from_unistr(inf, &inf->guid, &info->guid); *spool_info7 = inf; @@ -5182,7 +5182,7 @@ bool make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx, return True; } -bool make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx, +bool make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **spool_drv_info, DRIVER_INFO_3 *info3) { @@ -5191,7 +5191,7 @@ bool make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx, if (!(inf=TALLOC_ZERO_P(mem_ctx, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3))) return False; - + inf->cversion = info3->version; inf->name_ptr = (info3->name.buffer!=NULL)?1:0; inf->environment_ptr = (info3->architecture.buffer!=NULL)?1:0; @@ -5202,14 +5202,14 @@ bool make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx, inf->monitorname_ptr = (info3->monitorname.buffer!=NULL)?1:0; inf->defaultdatatype_ptr = (info3->defaultdatatype.buffer!=NULL)?1:0; - init_unistr2_from_unistr(&inf->name, &info3->name); - init_unistr2_from_unistr(&inf->environment, &info3->architecture); - init_unistr2_from_unistr(&inf->driverpath, &info3->driverpath); - init_unistr2_from_unistr(&inf->datafile, &info3->datafile); - init_unistr2_from_unistr(&inf->configfile, &info3->configfile); - init_unistr2_from_unistr(&inf->helpfile, &info3->helpfile); - init_unistr2_from_unistr(&inf->monitorname, &info3->monitorname); - init_unistr2_from_unistr(&inf->defaultdatatype, &info3->defaultdatatype); + init_unistr2_from_unistr(inf, &inf->name, &info3->name); + init_unistr2_from_unistr(inf, &inf->environment, &info3->architecture); + init_unistr2_from_unistr(inf, &inf->driverpath, &info3->driverpath); + init_unistr2_from_unistr(inf, &inf->datafile, &info3->datafile); + init_unistr2_from_unistr(inf, &inf->configfile, &info3->configfile); + init_unistr2_from_unistr(inf, &inf->helpfile, &info3->helpfile); + init_unistr2_from_unistr(inf, &inf->monitorname, &info3->monitorname); + init_unistr2_from_unistr(inf, &inf->defaultdatatype, &info3->defaultdatatype); if (info3->dependentfiles) { bool done = False; -- cgit From 6f46f75dfc2c80b99a6a5fb277bab456a5fd247b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 3 Dec 2007 17:17:05 -0800 Subject: Make strhex_to_str clear on string limits. Remove pstring from web/*.c Jeremy. (This used to be commit f9c8d62389f8cb47837e5360209936176537df13) --- source3/rpc_parse/parse_misc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 783c7fb7b3..9e1937ea32 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -509,8 +509,10 @@ void init_rpc_blob_hex(RPC_DATA_BLOB *str, const char *buf) { ZERO_STRUCTP(str); if (buf && *buf) { - create_rpc_blob(str, strlen(buf)); - str->buf_len = strhex_to_str((char *)str->buffer, str->buf_len, buf); + size_t len = strlen(buf); + create_rpc_blob(str, len); + str->buf_len = strhex_to_str((char *)str->buffer, str->buf_len, + buf, len); } } -- cgit From 42cfffae80480eae4381902fff3f7c61f858a933 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 7 Dec 2007 17:32:32 -0800 Subject: Remove next_token - all uses must now be next_token_talloc. No more temptations to use static length strings. Jeremy. (This used to be commit ec003f39369910dee852b7cafb883ddaa321c2de) --- source3/rpc_parse/parse_net.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index df11c6d75a..65607a4ac8 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1086,7 +1086,7 @@ bool net_io_r_srv_pwset(const char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsids) { const char *ptr; - fstring s2; + char *s2; int count = 0; DEBUG(4,("init_dom_sid2s: %s\n", sids_str ? sids_str:"")); @@ -1096,9 +1096,11 @@ static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsi 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(&ptr, s2, NULL, sizeof(s2)); ) { + for (count = 0, ptr = sids_str; + next_token_talloc(frame,&ptr, &s2, NULL); ) { DOM_SID tmpsid; if (string_to_sid(&tmpsid, s2)) count++; @@ -1107,15 +1109,18 @@ static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsi /* Now allocate space for them. */ if (count) { *ppsids = TALLOC_ZERO_ARRAY(ctx, DOM_SID2, count); - if (*ppsids == NULL) + if (*ppsids == NULL) { + TALLOC_FREE(frame); return 0; + } } else { *ppsids = NULL; } sids = *ppsids; - for (number = 0, ptr = sids_str; next_token(&ptr, s2, NULL, sizeof(s2)); ) { + 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 */ @@ -1123,6 +1128,7 @@ static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsi number++; } } + TALLOC_FREE(frame); } return count; -- cgit From 900288a2b86abd247f9eb4cd15dc5617a17cfef1 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 15 Dec 2007 21:11:36 +0100 Subject: Replace sid_string_static by sid_string_dbg in DEBUGs (This used to be commit bb35e794ec129805e874ceba882bcc1e84791a09) --- source3/rpc_parse/parse_samr.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 0085980ebf..614a80dd6f 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6302,13 +6302,10 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, struct samu *pw, DOM_SID * user_sid = pdb_get_user_sid(pw); if (!sid_peek_check_rid(domain_sid, user_sid, &user_rid)) { - fstring user_sid_string; - fstring domain_sid_string; 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_to_string(user_sid_string, user_sid), - sid_to_string(domain_sid_string, domain_sid))); + user_name, sid_string_dbg(user_sid), + sid_string_dbg(domain_sid))); data_blob_free(&munged_dial_blob); return NT_STATUS_UNSUCCESSFUL; } @@ -6318,13 +6315,10 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, struct samu *pw, DOM_SID * unbecome_root(); if (!sid_peek_check_rid(domain_sid, group_sid, &group_rid)) { - fstring group_sid_string; - fstring domain_sid_string; 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_to_string(group_sid_string, group_sid), - sid_to_string(domain_sid_string, domain_sid))); + user_name, sid_string_dbg(group_sid), + sid_string_dbg(domain_sid))); data_blob_free(&munged_dial_blob); return NT_STATUS_UNSUCCESSFUL; } -- cgit From c8071c3522abefb651596e2335e724ae50cb8a90 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 17 Dec 2007 16:20:44 -0800 Subject: Use the %*s feature of snprintf to remove anothe static fstring. Jeremy. (This used to be commit 4ae4b2358688bf289305a2db0ed01b653ac073b2) --- source3/rpc_parse/parse_prs.c | 32 ++++++++++++++++---------------- source3/rpc_parse/parse_srv.c | 12 ++++++------ 2 files changed, 22 insertions(+), 22 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 4abf63e71d..23dae9f3a1 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -85,7 +85,7 @@ void prs_dump_region(const char *name, int v, prs_struct *ps, void prs_debug(prs_struct *ps, int depth, const char *desc, const char *fn_name) { - DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(depth), ps->data_offset, fn_name, desc)); + DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(5+depth,depth), ps->data_offset, fn_name, desc)); } /** @@ -621,7 +621,7 @@ bool prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8) else SCVAL(q,0,*data8); - DEBUG(5,("%s%04x %s: %02x\n", tab_depth(depth), ps->data_offset, name, *data8)); + DEBUG(5,("%s%04x %s: %02x\n", tab_depth(5,depth), ps->data_offset, name, *data8)); ps->data_offset += 1; @@ -686,7 +686,7 @@ bool prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16) SSVAL(q,0,*data16); } - DEBUG(5,("%s%04x %s: %04x\n", tab_depth(depth), ps->data_offset, name, *data16)); + DEBUG(5,("%s%04x %s: %04x\n", tab_depth(5,depth), ps->data_offset, name, *data16)); ps->data_offset += sizeof(uint16); @@ -715,7 +715,7 @@ bool prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32) SIVAL(q,0,*data32); } - DEBUG(5,("%s%04x %s: %08x\n", tab_depth(depth), ps->data_offset, name, *data32)); + DEBUG(5,("%s%04x %s: %08x\n", tab_depth(5,depth), ps->data_offset, name, *data32)); ps->data_offset += sizeof(uint32); @@ -744,7 +744,7 @@ bool prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32) SIVALS(q,0,*data32); } - DEBUG(5,("%s%04x %s: %08x\n", tab_depth(depth), ps->data_offset, name, *data32)); + DEBUG(5,("%s%04x %s: %08x\n", tab_depth(5,depth), ps->data_offset, name, *data32)); ps->data_offset += sizeof(int32); @@ -773,7 +773,7 @@ bool prs_ntstatus(const char *name, prs_struct *ps, int depth, NTSTATUS *status) SIVAL(q,0,NT_STATUS_V(*status)); } - DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name, + DEBUG(5,("%s%04x %s: %s\n", tab_depth(5,depth), ps->data_offset, name, nt_errstr(*status))); ps->data_offset += sizeof(uint32); @@ -803,7 +803,7 @@ bool prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *st SIVAL(q,0,NT_STATUS_V(*status)); } - DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name, + DEBUG(5,("%s%04x %s: %s\n", tab_depth(5,depth), ps->data_offset, name, dcerpc_errstr(NT_STATUS_V(*status)))); ps->data_offset += sizeof(uint32); @@ -834,7 +834,7 @@ bool prs_werror(const char *name, prs_struct *ps, int depth, WERROR *status) SIVAL(q,0,W_ERROR_V(*status)); } - DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name, + DEBUG(5,("%s%04x %s: %s\n", tab_depth(5,depth), ps->data_offset, name, dos_errstr(*status))); ps->data_offset += sizeof(uint32); @@ -862,7 +862,7 @@ bool prs_uint8s(bool charmode, const char *name, prs_struct *ps, int depth, uint SCVAL(q, i, data8s[i]); } - DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset ,name)); + DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset ,name)); if (charmode) print_asc(5, (unsigned char*)data8s, len); else { @@ -905,7 +905,7 @@ bool prs_uint16s(bool charmode, const char *name, prs_struct *ps, int depth, uin } } - DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name)); if (charmode) print_asc(5, (unsigned char*)data16s, 2*len); else { @@ -947,7 +947,7 @@ static void dbg_rw_punival(bool charmode, const char *name, int depth, prs_struc } } - DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name)); if (charmode) print_asc(5, (unsigned char*)out_buf, 2*len); else { @@ -1002,7 +1002,7 @@ bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, int depth, uin } } - DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name)); if (charmode) print_asc(5, (unsigned char*)data32s, 4*len); else { @@ -1103,7 +1103,7 @@ bool prs_string2(bool charmode, const char *name, prs_struct *ps, int depth, STR } else { str->buffer = NULL; /* Return early to ensure Coverity isn't confused. */ - DEBUG(5,("%s%04x %s: \n", tab_depth(depth), ps->data_offset, name)); + DEBUG(5,("%s%04x %s: \n", tab_depth(5,depth), ps->data_offset, name)); return True; } } @@ -1116,7 +1116,7 @@ bool prs_string2(bool charmode, const char *name, prs_struct *ps, int depth, STR SCVAL(q, i, str->buffer[i]); } - DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name)); if (charmode) print_asc(5, (unsigned char*)str->buffer, str->str_str_len); else { @@ -1252,7 +1252,7 @@ bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) len++; - DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name)); print_asc(5, (unsigned char*)start, 2*len); DEBUG(5, ("\n")); } @@ -1309,7 +1309,7 @@ bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) str->buffer[len++] = '\0'; } - DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name)); print_asc(5, (unsigned char*)str->buffer, 2*len); DEBUG(5, ("\n")); } diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index e7a73183f5..6337c53fc1 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1018,7 +1018,7 @@ static bool srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_ default: DEBUG(5,("%s no share info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); + tab_depth(5,depth), ctr->switch_value)); break; } @@ -1267,7 +1267,7 @@ static bool srv_io_srv_share_info(const char *desc, prs_struct *ps, int depth, S return False; default: DEBUG(5,("%s no share info at switch_value %d\n", - tab_depth(depth), r_n->switch_value)); + tab_depth(5,depth), r_n->switch_value)); break; } } @@ -1796,7 +1796,7 @@ static bool srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, pr break; default: DEBUG(5,("%s no session info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); + tab_depth(5,depth), ctr->switch_value)); break; } } @@ -2216,7 +2216,7 @@ static bool srv_io_srv_conn_ctr(const char *desc, SRV_CONN_INFO_CTR **pp_ctr, pr break; default: DEBUG(5,("%s no connection info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); + tab_depth(5,depth), ctr->switch_value)); break; } } @@ -2486,7 +2486,7 @@ static bool srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_st break; } default: - DEBUG(5,("%s no file info at switch_value %d\n", tab_depth(depth), ctr->level)); + DEBUG(5,("%s no file info at switch_value %d\n", tab_depth(5,depth), ctr->level)); break; } @@ -2839,7 +2839,7 @@ static bool srv_io_info_ctr(const char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, break; default: DEBUG(5,("%s no server info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); + tab_depth(5,depth), ctr->switch_value)); break; } if(!prs_align(ps)) -- cgit From 533d6f617efc4dfe1e145785cb9736df07671bdf Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 28 Dec 2007 17:02:34 +0100 Subject: Remove static zeros (This used to be commit dbcc213710a9af31b6094d4741a6f68f573dcdad) --- source3/rpc_parse/parse_prs.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 23dae9f3a1..638d71a73e 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1544,9 +1544,11 @@ static void schannel_digest(struct schannel_auth_struct *a, uchar digest_final[16]) { uchar whole_packet_digest[16]; - static const uchar zeros[4] = { 0, }; + uchar zeros[4]; struct MD5Context ctx3; - + + ZERO_STRUCT(zeros); + /* verfiy the signature on the packet by MD5 over various bits */ MD5Init(&ctx3); /* use our sequence number, which ensures the packet is not @@ -1573,11 +1575,13 @@ static void schannel_get_sealing_key(struct schannel_auth_struct *a, RPC_AUTH_SCHANNEL_CHK *verf, uchar sealing_key[16]) { - static const uchar zeros[4] = { 0, }; + uchar zeros[4]; uchar digest2[16]; uchar sess_kf0[16]; int i; + ZERO_STRUCT(zeros); + for (i = 0; i < sizeof(sess_kf0); i++) { sess_kf0[i] = a->sess_key[i] ^ 0xf0; } @@ -1600,10 +1604,12 @@ static void schannel_get_sealing_key(struct schannel_auth_struct *a, static void schannel_deal_with_seq_num(struct schannel_auth_struct *a, RPC_AUTH_SCHANNEL_CHK *verf) { - static const uchar zeros[4] = { 0, }; + uchar zeros[4]; uchar sequence_key[16]; uchar digest1[16]; + ZERO_STRUCT(zeros); + hmac_md5(a->sess_key, zeros, sizeof(zeros), digest1); dump_data_pw("(sequence key) digest1:\n", digest1, sizeof(digest1)); -- cgit From a59280792cab616f5b269960ab68bc44ccc1fd38 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 29 Dec 2007 22:16:31 +0100 Subject: Remove tiny code duplication sid_size did the same as ndr_size_dom_sid (This used to be commit 8aec5d09ba023413bd8ecbdfbc7d23904df94389) --- source3/rpc_parse/parse_sec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 6198a78de0..36bd5825bd 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -291,14 +291,14 @@ bool sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if (psd->owner_sid != NULL) { off_owner_sid = offset; - offset += sid_size(psd->owner_sid); + offset += ndr_size_dom_sid(psd->owner_sid, 0); } else { off_owner_sid = 0; } if (psd->group_sid != NULL) { off_grp_sid = offset; - offset += sid_size(psd->group_sid); + offset += ndr_size_dom_sid(psd->group_sid, 0); } else { off_grp_sid = 0; } -- cgit From 7cbdb48475b0340154fad60cb4b7cc53dc2bbcfd Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 29 Dec 2007 23:00:49 +0100 Subject: Remove tiny code duplication ndr_size_security_descriptor does the same as sec_desc_size (This used to be commit bc3bd7a8e7c6e9e27acb195c86abb92c0f53112f) --- source3/rpc_parse/parse_buffer.c | 2 +- source3/rpc_parse/parse_sec.c | 2 +- source3/rpc_parse/parse_spoolss.c | 4 ++-- source3/rpc_parse/parse_srv.c | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index c30ad487dd..e98822d46e 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -435,7 +435,7 @@ bool smb_io_relsecdesc(const char *desc, RPC_BUFFER *buffer, int depth, SEC_DESC } if (*secdesc != NULL) { - buffer->string_at_end -= sec_desc_size(*secdesc); + buffer->string_at_end -= ndr_size_security_descriptor(*secdesc, 0); if(!prs_set_offset(ps, buffer->string_at_end)) return False; diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 36bd5825bd..6ea128d3a4 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -426,7 +426,7 @@ bool sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int if(!prs_uint32 ("ptr ", ps, depth, &ptr)) return False; - len = sec_desc_size(psdb->sd); + len = ndr_size_security_descriptor(psdb->sd, 0); if(!prs_uint32_pre("len ", ps, depth, &len, &off_len)) return False; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index ea76c57045..3bf8ef27c1 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3098,7 +3098,7 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) size += 4; - size += sec_desc_size( info->secdesc ); + size += ndr_size_security_descriptor( info->secdesc, 0 ); size+=size_of_device_mode( info->devmode ); @@ -3185,7 +3185,7 @@ return the size required by a struct in the stream uint32 spoolss_size_printer_info_3(PRINTER_INFO_3 *info) { /* The 8 is for the self relative pointer - 8 byte aligned.. */ - return 8 + (uint32)sec_desc_size( info->secdesc ); + return 8 + (uint32)ndr_size_security_descriptor( info->secdesc, 0 ); } /******************************************************************* diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 6337c53fc1..954aa80600 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -507,7 +507,8 @@ static bool srv_io_share_info502_str(const char *desc, SH_INFO_502_STR *sh502, p if(UNMARSHALLING(ps)) { - sh502->ptrs->sd_size = sh502->sd_size = sec_desc_size(sh502->sd); + sh502->ptrs->sd_size = sh502->sd_size = + ndr_size_security_descriptor(sh502->sd, 0); prs_set_offset(ps, old_offset + sh502->reserved); } @@ -1460,7 +1461,7 @@ void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname, { switch(level) { case 502: { - size_t sd_size = sec_desc_size(sd); + size_t sd_size = ndr_size_security_descriptor(sd, 0); q->ptr_srv_name = 1; init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE); q->info.switch_value = q->info_level = level; -- cgit From c9394414114d4b0a7f2cbf586eb6f30ed9ed9fca Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 15:19:30 +0100 Subject: Start removing hand-written lsa marshalling code (namely rpccli_lsa_open_trusted_domain_by_name, rpccli_lsa_query_trusted_domain_info_by_sid and rpccli_lsa_query_trusted_domain_info_by_name). Guenther (This used to be commit f2fb3473455f20e7314a9d33f5a1c923d3057d97) --- source3/rpc_parse/parse_lsa.c | 158 ------------------------------------------ 1 file changed, 158 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 59fce4a904..4b087b7ca1 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -3410,76 +3410,6 @@ bool lsa_io_q_open_trusted_domain(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN *i #endif -/******************************************************************* - Inits an LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME structure. -********************************************************************/ - -void init_lsa_q_open_trusted_domain_by_name(LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME *q, - POLICY_HND *hnd, - const char *name, - uint32 desired_access) -{ - memcpy(&q->pol, hnd, sizeof(q->pol)); - - init_lsa_string(&q->name, name); - q->access_mask = desired_access; -} - -/******************************************************************* -********************************************************************/ - - -/******************************************************************* - Reads or writes an LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME structure. -********************************************************************/ - -bool lsa_io_q_open_trusted_domain_by_name(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME *q_o, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_open_trusted_domain_by_name"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &q_o->pol, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!smb_io_lsa_string("name", &q_o->name, ps, depth)) - return False; - - if(!prs_align(ps)) - 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_BY_NAME structure. -********************************************************************/ - -bool lsa_io_r_open_trusted_domain_by_name(const char *desc, LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_open_trusted_domain_by_name"); - 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; -} - /******************************************************************* ********************************************************************/ @@ -3719,36 +3649,6 @@ void init_q_query_trusted_domain_info(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO *q, q->info_class = info_class; } -/******************************************************************* - Inits an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME structure. -********************************************************************/ - -void init_q_query_trusted_domain_info_by_name(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME *q, - POLICY_HND *hnd, uint16 info_class, - const char *dom_name) -{ - DEBUG(5, ("init_q_query_trusted_domain_info_by_name\n")); - - q->pol = *hnd; - init_lsa_string(&q->domain_name, dom_name ); - q->info_class = info_class; -} - -/******************************************************************* - Inits an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID structure. -********************************************************************/ - -void init_q_query_trusted_domain_info_by_sid(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID *q, - POLICY_HND *hnd, uint16 info_class, - DOM_SID *dom_sid) -{ - DEBUG(5, ("init_q_query_trusted_domain_info_by_sid\n")); - - q->pol = *hnd; - init_dom_sid2(&q->dom_sid, dom_sid); - q->info_class = info_class; -} - /******************************************************************* Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO structure. ********************************************************************/ @@ -3773,64 +3673,6 @@ bool lsa_io_q_query_trusted_domain_info(const char *desc, } -/******************************************************************* - Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID structure. -********************************************************************/ - -bool lsa_io_q_query_trusted_domain_info_by_sid(const char *desc, - LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID *q_q, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_query_trusted_domain_info_by_sid"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &q_q->pol, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!smb_io_dom_sid2("dom_sid", &q_q->dom_sid, ps, depth)) - return False; - - if(!prs_uint16("info_class", ps, depth, &q_q->info_class)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME structure. -********************************************************************/ - -bool lsa_io_q_query_trusted_domain_info_by_name(const char *desc, - LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME *q_q, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_query_trusted_domain_info_by_name"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &q_q->pol, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!smb_io_lsa_string("domain_name", &q_q->domain_name, ps, depth)) - return False; - - if(!prs_uint16("info_class", ps, depth, &q_q->info_class)) - return False; - - return True; -} - /******************************************************************* ********************************************************************/ -- cgit From 351377a90e44d8011a697779d2e9e225427e5cbb Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 15:47:42 +0100 Subject: Remove more redundant lsa parsing functions. Guenther (This used to be commit 99dd28da84c270f46535bd2ffa6bfef96d2e2eed) --- source3/rpc_parse/parse_lsa.c | 257 ------------------------------------------ 1 file changed, 257 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 4b087b7ca1..e4d5d15112 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -3636,263 +3636,6 @@ bool lsa_io_r_delete_object(const char *desc, LSA_R_DELETE_OBJECT *out, prs_stru return True; } -/******************************************************************* - Inits an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO structure. -********************************************************************/ - -void init_q_query_trusted_domain_info(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO *q, - POLICY_HND *hnd, uint16 info_class) -{ - DEBUG(5, ("init_q_query_trusted_domain_info\n")); - - q->pol = *hnd; - q->info_class = info_class; -} - -/******************************************************************* - Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO structure. -********************************************************************/ - -bool lsa_io_q_query_trusted_domain_info(const char *desc, - LSA_Q_QUERY_TRUSTED_DOMAIN_INFO *q_q, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_query_trusted_domain_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &q_q->pol, ps, depth)) - return False; - - if(!prs_uint16("info_class", ps, depth, &q_q->info_class)) - return False; - - return True; -} - - -/******************************************************************* -********************************************************************/ - -static bool smb_io_lsa_data_buf_hdr(const char *desc, LSA_DATA_BUF_HDR *buf_hdr, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "smb_io_lsa_data_buf_hdr"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("length", ps, depth, &buf_hdr->length)) - return False; - - if(!prs_uint32("size", ps, depth, &buf_hdr->size)) - return False; - - if (!prs_uint32("data_ptr", ps, depth, &buf_hdr->data_ptr)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool smb_io_lsa_data_buf(const char *desc, LSA_DATA_BUF *buf, - prs_struct *ps, int depth, int length, int size) -{ - prs_debug(ps, depth, desc, "smb_io_lsa_data_buf"); - depth++; - - if ( UNMARSHALLING(ps) && length ) { - if ( !(buf->data = PRS_ALLOC_MEM( ps, uint8, length )) ) - return False; - } - - if (!prs_uint32("size", ps, depth, &buf->size)) - return False; - - if (!prs_uint32("offset", ps, depth, &buf->offset)) - return False; - - if (!prs_uint32("length", ps, depth, &buf->length)) - return False; - - if(!prs_uint8s(False, "data", ps, depth, buf->data, length)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool lsa_io_trustdom_query_1(const char *desc, TRUSTED_DOMAIN_INFO_NAME *name, - prs_struct *ps, int depth) -{ - if (!smb_io_lsa_string("netbios_name", &name->netbios_name, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool lsa_io_trustdom_query_3(const char *desc, TRUSTED_DOMAIN_INFO_POSIX_OFFSET *posix, - prs_struct *ps, int depth) -{ - if(!prs_uint32("posix_offset", ps, depth, &posix->posix_offset)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool lsa_io_trustdom_query_4(const char *desc, TRUSTED_DOMAIN_INFO_PASSWORD *password, - prs_struct *ps, int depth) -{ - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_password", ps, depth, &password->ptr_password)) - return False; - - if(!prs_uint32("ptr_old_password", ps, depth, &password->ptr_old_password)) - return False; - - if (&password->ptr_password) { - - if (!smb_io_lsa_data_buf_hdr("password_hdr", &password->password_hdr, ps, depth)) - return False; - - if (!smb_io_lsa_data_buf("password", &password->password, ps, depth, - password->password_hdr.length, password->password_hdr.size)) - return False; - } - - if (&password->ptr_old_password) { - - if (!smb_io_lsa_data_buf_hdr("old_password_hdr", &password->old_password_hdr, ps, depth)) - return False; - - if (!smb_io_lsa_data_buf("old_password", &password->old_password, ps, depth, - password->old_password_hdr.length, password->old_password_hdr.size)) - return False; - } - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool lsa_io_trustdom_query_6(const char *desc, TRUSTED_DOMAIN_INFO_EX *info_ex, - prs_struct *ps, int depth) -{ - uint32 dom_sid_ptr; - - if (!smb_io_unihdr("domain_name_hdr", &info_ex->domain_name.hdr, ps, depth)) - return False; - - if (!smb_io_unihdr("netbios_name_hdr", &info_ex->netbios_name.hdr, ps, depth)) - return False; - - if (!prs_uint32("dom_sid_ptr", ps, depth, &dom_sid_ptr)) - return False; - - if (!prs_uint32("trust_direction", ps, depth, &info_ex->trust_direction)) - return False; - - if (!prs_uint32("trust_type", ps, depth, &info_ex->trust_type)) - return False; - - if (!prs_uint32("trust_attributes", ps, depth, &info_ex->trust_attributes)) - return False; - - if (!smb_io_unistr2("domain_name_unistring", &info_ex->domain_name.unistring, info_ex->domain_name.hdr.buffer, ps, depth)) - return False; - - if (!smb_io_unistr2("netbios_name_unistring", &info_ex->netbios_name.unistring, info_ex->netbios_name.hdr.buffer, ps, depth)) - return False; - - if (!smb_io_dom_sid2("sid", &info_ex->sid, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool lsa_io_trustdom_query(const char *desc, prs_struct *ps, int depth, LSA_TRUSTED_DOMAIN_INFO *info) -{ - prs_debug(ps, depth, desc, "lsa_io_trustdom_query"); - depth++; - - if(!prs_uint16("info_class", ps, depth, &info->info_class)) - return False; - - if(!prs_align(ps)) - return False; - - switch (info->info_class) { - case 1: - if(!lsa_io_trustdom_query_1("name", &info->name, ps, depth)) - return False; - break; - case 3: - if(!lsa_io_trustdom_query_3("posix_offset", &info->posix_offset, ps, depth)) - return False; - break; - case 4: - if(!lsa_io_trustdom_query_4("password", &info->password, ps, depth)) - return False; - break; - case 6: - if(!lsa_io_trustdom_query_6("info_ex", &info->info_ex, ps, depth)) - return False; - break; - default: - DEBUG(0,("unsupported info-level: %d\n", info->info_class)); - return False; - } - - return True; -} - -/******************************************************************* - Reads or writes an LSA_R_QUERY_TRUSTED_DOMAIN_INFO structure. -********************************************************************/ - -bool lsa_io_r_query_trusted_domain_info(const char *desc, - LSA_R_QUERY_TRUSTED_DOMAIN_INFO *r_q, - prs_struct *ps, int depth) -{ - if (r_q == NULL) - return False; - - prs_debug(ps, depth, desc, "lsa_io_r_query_trusted_domain_info"); - depth++; - - if (!prs_pointer("trustdom", ps, depth, (void*)&r_q->info, - sizeof(LSA_TRUSTED_DOMAIN_INFO), - (PRS_POINTER_CAST)lsa_io_trustdom_query) ) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_q->status)) - return False; - - return True; -} - /******************************************************************* Inits an LSA_Q_QUERY_DOM_INFO_POLICY structure. ********************************************************************/ -- cgit From 862e1685b8b4f0ec76b5f715d39781e0fd8fa4f0 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 17:16:06 +0100 Subject: Remove old lsa set info policy call. Guenther (This used to be commit b37b2b77edec72fc3f53b3461aa1c210e4366c1b) --- source3/rpc_parse/parse_lsa.c | 58 ------------------------------------------- 1 file changed, 58 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index e4d5d15112..98c4283347 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -909,21 +909,6 @@ bool lsa_io_dom_query_12(const char *desc, DOM_QUERY_12 *info, prs_struct *ps, i } -/******************************************************************* - Inits an LSA_Q_QUERY_INFO structure. -********************************************************************/ - -void init_q_set(LSA_Q_SET_INFO *in, POLICY_HND *hnd, uint16 info_class, LSA_INFO_CTR ctr) -{ - DEBUG(5,("init_q_set\n")); - - in->info_class = info_class; - - in->pol = *hnd; - - in->ctr = ctr; - in->ctr.info_class = info_class; -} /******************************************************************* reads or writes a structure. @@ -1064,49 +1049,6 @@ bool lsa_io_r_query(const char *desc, LSA_R_QUERY_INFO *out, prs_struct *ps, int return True; } -/******************************************************************* - Reads or writes an LSA_Q_SET_INFO structure. -********************************************************************/ - -bool lsa_io_q_set(const char *desc, LSA_Q_SET_INFO *in, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_set"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &in->pol, ps, depth)) - return False; - - if(!prs_uint16("info_class", ps, depth, &in->info_class)) - return False; - - if(!lsa_io_query_info_ctr("", ps, depth, &in->ctr)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes an LSA_R_SET_INFO structure. -********************************************************************/ - -bool lsa_io_r_set(const char *desc, LSA_R_SET_INFO *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_set"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_ntstatus("status", ps, depth, &out->status)) - return False; - - return True; -} - /******************************************************************* Inits a LSA_SID_ENUM structure. ********************************************************************/ -- cgit From a92eb76688600efbf4a4056c2543f348e2fee8aa Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 17 Jan 2008 10:24:34 +0100 Subject: Finally enable pidl generated SAMR & NETLOGON headers and clients. Guenther (This used to be commit f7100156a7df7ac3ae84e45a47153b38d9375215) --- source3/rpc_parse/parse_net.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 65607a4ac8..b8c6479fb8 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1656,8 +1656,8 @@ static void dump_acct_flags(uint32 acct_flags) { 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")); + if (acct_flags & ACB_PW_EXPIRED) { + DEBUGADD(lvl,("\taccount has ACB_PW_EXPIRED set\n")); } } @@ -1665,23 +1665,23 @@ 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 & NETLOGON_EXTRA_SIDS) { + DEBUGADD(lvl,("\taccount has NETLOGON_EXTRA_SIDS\n")); } - if (user_flags & LOGON_RESOURCE_GROUPS) { - DEBUGADD(lvl,("\taccount has LOGON_RESOURCE_GROUPS\n")); + if (user_flags & NETLOGON_RESOURCE_GROUPS) { + DEBUGADD(lvl,("\taccount has NETLOGON_RESOURCE_GROUPS\n")); } - if (user_flags & LOGON_NTLMV2_ENABLED) { - DEBUGADD(lvl,("\taccount has LOGON_NTLMV2_ENABLED\n")); + if (user_flags & NETLOGON_NTLMV2_ENABLED) { + DEBUGADD(lvl,("\taccount has NETLOGON_NTLMV2_ENABLED\n")); } - if (user_flags & LOGON_CACHED_ACCOUNT) { - DEBUGADD(lvl,("\taccount has LOGON_CACHED_ACCOUNT\n")); + if (user_flags & NETLOGON_CACHED_ACCOUNT) { + DEBUGADD(lvl,("\taccount has NETLOGON_CACHED_ACCOUNT\n")); } - if (user_flags & LOGON_PROFILE_PATH_RETURNED) { - DEBUGADD(lvl,("\taccount has LOGON_PROFILE_PATH_RETURNED\n")); + if (user_flags & NETLOGON_PROFILE_PATH_RETURNED) { + DEBUGADD(lvl,("\taccount has NETLOGON_PROFILE_PATH_RETURNED\n")); } - if (user_flags & LOGON_SERVER_TRUST_ACCOUNT) { - DEBUGADD(lvl,("\taccount has LOGON_SERVER_TRUST_ACCOUNT\n")); + if (user_flags & NETLOGON_SERVER_TRUST_ACCOUNT) { + DEBUGADD(lvl,("\taccount has NETLOGON_SERVER_TRUST_ACCOUNT\n")); } @@ -1859,8 +1859,8 @@ bool net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, 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")); + if (!(usr->user_flgs & NETLOGON_EXTRA_SIDS)) { + DEBUG(10,("net_io_user_info3: user_flgs attribute does not have NETLOGON_EXTRA_SIDS\n")); /* return False; */ } -- cgit From a0186fb78d05aa997b114eee6afabaf138540ab8 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 23 Jan 2008 13:54:02 -0800 Subject: Forward ported version of Matt Geddes patch for adding acct_flags to rpccli_samr_create_dom_user(). Jerry please test. Jeremy. (This used to be commit 7d94f97947b7edfcf3ec52f0125e4593d6d54c05) --- source3/rpc_parse/parse_samr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 614a80dd6f..23add3dffd 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5172,7 +5172,7 @@ 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) + uint32 acb_info, uint32 acct_flags) { DEBUG(5, ("samr_init_samr_q_create_user\n")); @@ -5182,7 +5182,7 @@ void init_samr_q_create_user(SAMR_Q_CREATE_USER * q_u, init_uni_hdr(&q_u->hdr_name, &q_u->uni_name); q_u->acb_info = acb_info; - q_u->access_mask = access_mask; + q_u->acct_flags = acct_flags; } /******************************************************************* @@ -5213,7 +5213,7 @@ bool samr_io_q_create_user(const char *desc, SAMR_Q_CREATE_USER * q_u, 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)) + if(!prs_uint32("acct_flags", ps, depth, &q_u->acct_flags)) return False; return True; -- cgit From 05ff7fd46e19d9c1aab8524495c9b926290927c7 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 25 Jan 2008 13:26:10 +0100 Subject: Use generated DSSETUP client & server rpc functions and remove the hand-written ones. Guenther (This used to be commit d5ebfccebb1f1b56b45673a506fcdb414103c43b) --- source3/rpc_parse/parse_ds.c | 111 ------------------------------------------- 1 file changed, 111 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index 8f3ce361e7..3cf4156278 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -20,117 +20,6 @@ #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 ************************************************************************/ -- cgit From 7bcf0b0262cea95238beb6c0c8d469d47a4bc825 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 25 Jan 2008 16:57:55 +0100 Subject: Remove more unused LSA marshalling functions. Guenther (This used to be commit 95e0fb452bda4c81b26e3dec4953bbba37940467) --- source3/rpc_parse/parse_lsa.c | 406 ------------------------------------------ 1 file changed, 406 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 98c4283347..1bddfba28e 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2081,53 +2081,6 @@ bool lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_stru 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. ********************************************************************/ @@ -3314,239 +3267,6 @@ bool lsa_io_r_remove_acct_rights(const char *desc, LSA_R_REMOVE_ACCT_RIGHTS *out 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; -} - /******************************************************************* ********************************************************************/ @@ -3577,129 +3297,3 @@ bool lsa_io_r_delete_object(const char *desc, LSA_R_DELETE_OBJECT *out, prs_stru 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; -} -- cgit From a6ce6c56492a22b5d6b9ddecd3ae229d5b03c8c2 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 25 Jan 2008 21:19:39 +0100 Subject: Remove hand-written rpccli_netlogon_dsr_getdcnameex[2]. Guenther (This used to be commit 3ded8b9b7eee18a3f903e264adfb7fea6a3c0c5f) --- source3/rpc_parse/parse_net.c | 209 ------------------------------------------ 1 file changed, 209 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index b8c6479fb8..d6a99b8731 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -3439,67 +3439,6 @@ void init_net_q_dsr_getdcname(NET_Q_DSR_GETDCNAME *r_t, const char *server_unc, 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. ********************************************************************/ @@ -3571,154 +3510,6 @@ bool net_io_q_dsr_getdcname(const char *desc, NET_Q_DSR_GETDCNAME *r_t, 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. ********************************************************************/ -- cgit From 1a7583dd0b34d5276ee36b69fe7b8d37a701c408 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 29 Jan 2008 15:51:19 +0100 Subject: Remove unused rpc_ds marshalling code that is unused now. Guenther (This used to be commit 153253e14f82fc7078e9cc6f12409e6eda7ee7cb) --- source3/rpc_parse/parse_ds.c | 188 ------------------------------------------- 1 file changed, 188 deletions(-) delete mode 100644 source3/rpc_parse/parse_ds.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c deleted file mode 100644 index 3cf4156278..0000000000 --- a/source3/rpc_parse/parse_ds.c +++ /dev/null @@ -1,188 +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 . - */ - -#include "includes.h" - -/************************************************************************ - 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; imax_count;i++ ) { - if ( !ds_io_domain_trusts("domain_trusts", &ctr->trusts[i], ps, depth) ) - return False; - } - - for ( i=0; imax_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; -} -- cgit From d1f545062535b67a62c69ccb4440ecad069cfe93 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 30 Jan 2008 12:54:11 +0100 Subject: Remove unused samr_close marshalling. Guenther (This used to be commit 93d2ad944772513520de22aecffda15f38907b4e) --- source3/rpc_parse/parse_samr.c | 55 ------------------------------------------ 1 file changed, 55 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 23add3dffd..0e01da59ec 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -28,61 +28,6 @@ #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. ********************************************************************/ -- cgit From 8953619787e9e0ca2101f54b0807c9e1d9991104 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 30 Jan 2008 21:56:00 +0100 Subject: Remove old, unused marshalling code for SAMR_GET_DOM_PWINFO. Guenther (This used to be commit d74ab657df051b7bad616dbe7fe7732a653ffe6d) --- source3/rpc_parse/parse_samr.c | 71 ------------------------------------------ 1 file changed, 71 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 0e01da59ec..37f9ba05d6 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -7283,77 +7283,6 @@ bool samr_io_r_connect_anon(const char *desc, SAMR_R_CONNECT_ANON * r_u, 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. ********************************************************************/ -- cgit From bd9d6a885a9f3eaff50fc127788934f6e798935d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 1 Feb 2008 01:43:46 +0100 Subject: Remove unused marshalling for SAMR_DELETE_DOM_GROUP. Guenther (This used to be commit 20503717be5287c003ca63d74419f785d59f83e0) --- source3/rpc_parse/parse_samr.c | 59 ------------------------------------------ 1 file changed, 59 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 37f9ba05d6..21e6102a1e 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2540,65 +2540,6 @@ bool samr_io_r_create_dom_group(const char *desc, SAMR_R_CREATE_DOM_GROUP * r_u, 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. ********************************************************************/ -- cgit From e6fd6b4941e401ff56e3194511c2f1ed356baf08 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 1 Feb 2008 01:34:59 +0100 Subject: Remove unused marshalling for SAMR_DELETE_DOM_ALIAS. Guenther (This used to be commit 445887d805c26beea33b6e5b08717e2841abe7b2) --- source3/rpc_parse/parse_samr.c | 128 ----------------------------------------- 1 file changed, 128 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 21e6102a1e..1ae056e2d2 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4242,63 +4242,6 @@ bool samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u, 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. ********************************************************************/ @@ -4495,77 +4438,6 @@ bool samr_io_r_del_aliasmem(const char *desc, SAMR_R_DEL_ALIASMEM * r_u, 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. ********************************************************************/ -- cgit From 68900ea10170cbb0692276294f921c6aff7118b0 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 1 Feb 2008 01:44:20 +0100 Subject: Remove unused marshalling for SAMR_DELETE_DOM_USER. Guenther (This used to be commit 905b3898e0ac7a1f9cca4575246df419b0a1c7f1) --- source3/rpc_parse/parse_samr.c | 58 ------------------------------------------ 1 file changed, 58 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 1ae056e2d2..08a552ee41 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4797,64 +4797,6 @@ bool samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u, 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. ********************************************************************/ -- cgit From 481a7f957252e3639b87cd2a6cd6025f23d8fd05 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 1 Feb 2008 11:14:49 +0100 Subject: Remove unused marshalling for SAMR_OPEN_DOMAIN. Guenther (This used to be commit ebf9caa004899281d0fb44cac2e2494d322810bd) --- source3/rpc_parse/parse_samr.c | 68 ------------------------------------------ 1 file changed, 68 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 08a552ee41..f52794ea50 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -185,74 +185,6 @@ bool samr_io_r_remove_sid_foreign_domain(const char *desc, SAMR_R_REMOVE_SID_FOR 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) { -- cgit From 331c1ad49b02a00541cc73cb6b6ccc6fc6a9c7d2 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 1 Feb 2008 12:21:15 +0100 Subject: Remove unused marshalling for SAMR_OPEN_GROUP. Guenther (This used to be commit 9660a341b6b32609b28770130e974d674ab31215) --- source3/rpc_parse/parse_samr.c | 67 ------------------------------------------ 1 file changed, 67 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index f52794ea50..4927feb682 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2048,73 +2048,6 @@ bool samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u, 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. ********************************************************************/ -- cgit From e8c794fabee9aa19183447a915ea9a0d2cc9fda8 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 1 Feb 2008 11:39:49 +0100 Subject: Remove unused marshalling for SAMR_OPEN_ALIAS. Guenther (This used to be commit c00d629d4e557e5efd7c339904e228ca76504e7a) --- source3/rpc_parse/parse_samr.c | 66 ------------------------------------------ 1 file changed, 66 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 4927feb682..3acea823a0 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3843,72 +3843,6 @@ bool samr_io_r_query_useraliases(const char *desc, SAMR_R_QUERY_USERALIASES * r_ 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. ********************************************************************/ -- cgit From a3b00a3244d4c0368838312968e4875567ea6025 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 1 Feb 2008 12:03:00 +0100 Subject: Remove unused marshalling for SAMR_OPEN_USER. Guenther (This used to be commit f34c0e7ada8ce625ee20e3d776e41dabbad71ce5) --- source3/rpc_parse/parse_samr.c | 68 ------------------------------------------ 1 file changed, 68 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 3acea823a0..c0679143d4 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4596,74 +4596,6 @@ bool samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u, 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. ********************************************************************/ -- cgit From d3b25867f5259575072e8f1245c54c6eaee081c4 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 1 Feb 2008 14:52:59 +0100 Subject: Remove unused marshalling for SAMR_CREATE_DOM_ALIAS. Guenther (This used to be commit 2e56289889b705d003a170fafa69163ce5841f3b) --- source3/rpc_parse/parse_samr.c | 78 ------------------------------------------ 1 file changed, 78 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index c0679143d4..e120143b44 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4041,84 +4041,6 @@ bool samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u, 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. ********************************************************************/ -- cgit From 42f61160f90183a5cf805480307a375b55c62c31 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 1 Feb 2008 14:52:05 +0100 Subject: Remove unused marshalling for SAMR_CREATE_DOM_GROUP. Guenther (This used to be commit 2882d48dfed2cd9783833d010d126d7b3cfb4899) --- source3/rpc_parse/parse_samr.c | 78 ------------------------------------------ 1 file changed, 78 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index e120143b44..8600d879b4 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2327,84 +2327,6 @@ static bool samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr, 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_DEL_GROUPMEM structure. ********************************************************************/ -- cgit From b708005a7106db26d7df689b887b419c9f2ea41c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 1 Feb 2008 14:53:58 +0100 Subject: Remove unused marshalling for SAMR_CREATE_USER. Guenther (This used to be commit 69e8a83093149201c36ffc2b7fadfa469aabf7bd) --- source3/rpc_parse/parse_samr.c | 83 ------------------------------------------ 1 file changed, 83 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 8600d879b4..9924a164a1 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4440,89 +4440,6 @@ bool samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u, 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 acct_flags) -{ - 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->acct_flags = acct_flags; -} - -/******************************************************************* -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("acct_flags", ps, depth, &q_u->acct_flags)) - 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. ********************************************************************/ -- cgit From 33d5becfad717bda199ceea0eab0784303a348b1 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 1 Feb 2008 17:21:35 +0100 Subject: Remove unused marshalling for SAMR_QUERY_SEC_OBJ. Guenther (This used to be commit b15512f8ccbc6c645b8be95827862a58a1a7fab2) --- source3/rpc_parse/parse_samr.c | 68 ------------------------------------------ 1 file changed, 68 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 9924a164a1..a58b621eab 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -294,45 +294,6 @@ bool samr_io_q_set_sec_obj(const char *desc, SAMR_Q_SET_SEC_OBJ * q_u, } -/******************************************************************* -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. ********************************************************************/ @@ -932,35 +893,6 @@ bool samr_io_r_set_sec_obj(const char *desc, SAMR_R_SET_SEC_OBJ * r_u, 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. ********************************************************************/ -- cgit From 00073422d5b61e1e2182475d9aa44290d466fb0f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 1 Feb 2008 17:25:09 +0100 Subject: Remove unused marshalling for SAMR_SET_SEC_OBJ. Guenther (This used to be commit 90982cf43ab549a19b4d45860504bb7db57c7c8a) --- source3/rpc_parse/parse_samr.c | 67 ------------------------------------------ 1 file changed, 67 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a58b621eab..56a97b187a 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -264,36 +264,6 @@ bool samr_io_r_get_usrdom_pwinfo(const char *desc, SAMR_R_GET_USRDOM_PWINFO * r_ 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. ********************************************************************/ @@ -856,43 +826,6 @@ bool samr_io_r_query_domain_info(const char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_ 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 SAM_STR1 structure. ********************************************************************/ -- cgit From bea5ea5cad90e8a10ea5aadebf62f917faa60cf1 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 4 Feb 2008 10:12:08 +0100 Subject: Remove unused marshalling for EVENTLOG_GET_NUM_RECORDS. Guenther (This used to be commit 0c8e0916d7a7a403255c814536f1ebde3c5c9905) --- source3/rpc_parse/parse_eventlog.c | 39 -------------------------------------- 1 file changed, 39 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 70226bca15..37fd5b17e0 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -95,45 +95,6 @@ bool eventlog_io_r_open_eventlog(const char *desc, EVENTLOG_R_OPEN_EVENTLOG *r_u 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) { -- cgit From 2432628b141607c6edc66974cfec178a4d842989 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 4 Feb 2008 10:45:50 +0100 Subject: Remove unused marshalling for EVENTLOG_GET_OLDEST_ENTRY. Guenther (This used to be commit f837fff80ef369133761f7a33a616fd4721c5a68) --- source3/rpc_parse/parse_eventlog.c | 39 -------------------------------------- 1 file changed, 39 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 37fd5b17e0..4586abe23e 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -95,45 +95,6 @@ bool eventlog_io_r_open_eventlog(const char *desc, EVENTLOG_R_OPEN_EVENTLOG *r_u 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) { -- cgit From 221a2a9a5f974fd428e83753af1b70f37332e184 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 4 Feb 2008 10:55:14 +0100 Subject: Copy inline comment for _eventlog_ClearEventLogW() from rpc_parse to rpc_server. Guenther (This used to be commit 26eadadbf628f4d3aa4cd0ab4b55d47dc79c80ba) --- source3/rpc_parse/parse_eventlog.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 4586abe23e..3e7af74cbb 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -262,20 +262,6 @@ 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) { -- cgit From 2fd872fea7576497a24c1d981f3253dc3f042a04 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 4 Feb 2008 10:56:16 +0100 Subject: Remove unused marshalling for EVENTLOG_CLEAR_EVENTLOG. Guenther (This used to be commit badbdf1b88b270d298d44ed6fddb0c31fbcb3717) --- source3/rpc_parse/parse_eventlog.c | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 3e7af74cbb..0a4bf93048 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -261,41 +261,3 @@ bool eventlog_io_r_read_eventlog(const char *desc, return True; } - -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; -} -- cgit From 639c7fc8becfedba1198d1f4325ab2482ea2ee9d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 4 Feb 2008 11:10:53 +0100 Subject: Remove unused marshalling for EVENTLOG_OPEN_EVENTLOG. Guenther (This used to be commit 15d22925def45f1f8cd2d356a7f580fb4bfd05ef) --- source3/rpc_parse/parse_eventlog.c | 70 -------------------------------------- 1 file changed, 70 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 0a4bf93048..2ff217eb9e 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -25,76 +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_read_eventlog(const char *desc, EVENTLOG_Q_READ_EVENTLOG *q_u, prs_struct *ps, int depth) { -- cgit From c132cbbd357dc2e5241b96dd9705e078fcb95d7d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 4 Feb 2008 16:20:25 +0100 Subject: Remove unused marshalling for SAMR_CONNECT_ANON. Guenther (This used to be commit e1cae5517f3a9a8fb8a79c440363243592565363) --- source3/rpc_parse/parse_samr.c | 68 ------------------------------------------ 1 file changed, 68 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 56a97b187a..e51bae3b6d 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6327,74 +6327,6 @@ bool samr_io_r_connect5(const char *desc, SAMR_R_CONNECT5 * r_u, 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; -} - /******************************************************************* make a SAMR_ENC_PASSWD structure. ********************************************************************/ -- cgit From f527fca984291e693f1ef758b208e02f14bf6733 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 4 Feb 2008 17:14:57 +0100 Subject: Remove unused marshalling for SAMR_CONNECT5. Guenther (This used to be commit d2d91dd4968dbd1349bdb973e2679f68c608c2ed) --- source3/rpc_parse/parse_samr.c | 110 ----------------------------------------- 1 file changed, 110 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index e51bae3b6d..73b3086ad7 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -6217,116 +6217,6 @@ bool samr_io_r_connect4(const char *desc, SAMR_R_CONNECT4 * r_u, 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; -} - /******************************************************************* make a SAMR_ENC_PASSWD structure. ********************************************************************/ -- cgit From c01a62c4d637adedd4e0e41b5f36e2e3ac6f5357 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 4 Feb 2008 18:16:30 +0100 Subject: Remove unused marshalling for SAMR_DEL_GROUPMEM. Guenther (This used to be commit a65c89c80627280247e25b695eec081386cc4fb6) --- source3/rpc_parse/parse_samr.c | 72 ------------------------------------------ 1 file changed, 72 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 73b3086ad7..a1b6b54e96 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2192,78 +2192,6 @@ static bool samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr, 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. ********************************************************************/ -- cgit From 944f11af5b2e90cb98a1a4f9681c893af644cff6 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 4 Feb 2008 18:26:18 +0100 Subject: Remove unused marshalling for SAMR_ADD_GROUPMEM. Guenther (This used to be commit 83d1b7429ea902742c9c1f42fca57fb1757fc2b4) --- source3/rpc_parse/parse_samr.c | 75 ------------------------------------------ 1 file changed, 75 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a1b6b54e96..97f70f662d 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2192,81 +2192,6 @@ static bool samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr, 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. ********************************************************************/ -- cgit From d93631f96f4aa1d3e551d511e4058f0a9f731fc2 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 4 Feb 2008 19:17:41 +0100 Subject: Remove unused marshalling for SAMR_CONNECT_4. Guenther (This used to be commit 86d00328aead337026a1550ee888ee3f646f62b2) --- source3/rpc_parse/parse_samr.c | 76 ------------------------------------------ 1 file changed, 76 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 97f70f662d..cb9ec5e6f8 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5994,82 +5994,6 @@ bool samr_io_r_connect(const char *desc, SAMR_R_CONNECT * r_u, 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; -} - /******************************************************************* make a SAMR_ENC_PASSWD structure. ********************************************************************/ -- cgit From a1c2242f3f3b63e354fb377223883047bd883957 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 4 Feb 2008 22:02:22 +0100 Subject: Remove unused marshalling for LSA_QUERY_SEC_OBJ. Guenther (This used to be commit 9b2aeeb36903591ea55cfdfe22f32d69703daaf1) --- source3/rpc_parse/parse_lsa.c | 60 ------------------------------------------- 1 file changed, 60 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 1bddfba28e..035aee971b 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -418,66 +418,6 @@ bool lsa_io_r_open_pol2(const char *desc, LSA_R_OPEN_POL2 *out, prs_struct *ps, 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. ********************************************************************/ -- cgit From 97ccb4f8a31cc74cce3566ec30aaad57de0bc894 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 4 Feb 2008 22:06:27 +0100 Subject: Remove unused marshalling for LSA_DELETE_OBJECT. Guenther (This used to be commit 3a32082ef5bb0152545b391ce4cb8ca3a28939da) --- source3/rpc_parse/parse_lsa.c | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 035aee971b..daf4806392 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -3206,34 +3206,3 @@ bool lsa_io_r_remove_acct_rights(const char *desc, LSA_R_REMOVE_ACCT_RIGHTS *out 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; -} -- cgit From 0bffd59a4c6dc158a7f6efafaf189bf7f2f7397b Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 4 Feb 2008 22:16:21 +0100 Subject: Remove unused marshalling for SAMR_CONNECT. Guenther (This used to be commit 2b1bc8ab68a0ed8fb77030d421618cf4a664f5e3) --- source3/rpc_parse/parse_samr.c | 71 ------------------------------------------ 1 file changed, 71 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index cb9ec5e6f8..a1e7f63ba2 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5923,77 +5923,6 @@ bool samr_io_r_set_userinfo2(const char *desc, SAMR_R_SET_USERINFO2 * r_u, 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; -} - /******************************************************************* make a SAMR_ENC_PASSWD structure. ********************************************************************/ -- cgit From e5f049887d49910c0e88920d8e70ed6ab420a21d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 4 Feb 2008 23:09:15 +0100 Subject: Remove unused marshalling for SAMR_GET_USRDOM_PWINFO. Guenther (This used to be commit e1c79397fc5e1ffee80618150f7e4052e01323e8) --- source3/rpc_parse/parse_samr.c | 83 ------------------------------------------ 1 file changed, 83 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a1e7f63ba2..4e41d2986b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -185,89 +185,6 @@ bool samr_io_r_remove_sid_foreign_domain(const char *desc, SAMR_R_REMOVE_SID_FOR 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. -********************************************************************/ - void init_samr_q_query_domain_info(SAMR_Q_QUERY_DOMAIN_INFO * q_u, POLICY_HND *domain_pol, uint16 switch_value) { -- cgit From 6a0897b3638413fb2980de6a6189521f2c734909 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 4 Feb 2008 23:31:08 +0100 Subject: Remove unused marshalling for SAMR_DEL_ALIASMEM. Guenther (This used to be commit 99d80ada6d72bea427cece3e759206eb067bc206) --- source3/rpc_parse/parse_samr.c | 59 ------------------------------------------ 1 file changed, 59 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 4e41d2986b..aafb49e2ec 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3657,65 +3657,6 @@ bool samr_io_r_add_aliasmem(const char *desc, SAMR_R_ADD_ALIASMEM * r_u, 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_QUERY_ALIASMEM structure. ********************************************************************/ -- cgit From 30857dbf26d06ff3d38114b70e6f594f8ba51554 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 4 Feb 2008 23:44:11 +0100 Subject: Remove unused marshalling for SAMR_ADD_ALIASMEM. Guenther (This used to be commit 27e0b6a1aa94294588b2c18ed7929edb0289e746) --- source3/rpc_parse/parse_samr.c | 59 ------------------------------------------ 1 file changed, 59 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index aafb49e2ec..fb3994a1d2 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3598,65 +3598,6 @@ bool samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u, 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_QUERY_ALIASMEM structure. ********************************************************************/ -- cgit From 8a88a14267c305b1e7975cc3af8e271b294af31f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 5 Feb 2008 01:22:10 +0100 Subject: Remove unused marshalling for SAMR_QUERY_ALIASMEM. Guenther (This used to be commit 1b1f9ee2e931a9c2608e4fd4bc37b877c52b1dcb) --- source3/rpc_parse/parse_samr.c | 130 ----------------------------------------- 1 file changed, 130 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index fb3994a1d2..1dc1ff0859 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3598,136 +3598,6 @@ bool samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u, 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. ********************************************************************/ -- cgit From 636229cc09cb809cd8a27de4fc2c385148c06e34 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 5 Feb 2008 01:36:19 +0100 Subject: Remove marshalling for SAMR_LOOKUP_DOMAIN. Guenther (This used to be commit e03fd629171b625a42f02bdd6660b2ba75d27a4b) --- source3/rpc_parse/parse_samr.c | 91 ------------------------------------------ 1 file changed, 91 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 1dc1ff0859..c75d77a502 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -28,97 +28,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/******************************************************************* -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. ********************************************************************/ -- cgit From 23f76ed91fd976d91575259da692c1faa81c49fd Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 5 Feb 2008 11:00:56 +0100 Subject: Remove unused marshalling for SAMR_QUERY_GROUPMEM. Guenther (This used to be commit 48e74f77529ca8d75d99b1f415b9417ff0cf0679) --- source3/rpc_parse/parse_samr.c | 133 ----------------------------------------- 1 file changed, 133 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index c75d77a502..821fee7d4c 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2174,139 +2174,6 @@ bool samr_io_r_query_groupinfo(const char *desc, SAMR_R_QUERY_GROUPINFO * r_u, 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. ********************************************************************/ -- cgit From 6e36f72ce67e38272fc75cf8cbb764252359770b Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 5 Feb 2008 11:17:45 +0100 Subject: Remove unused marshalling for SAMR_QUERY_USERALIASES. Guenther (This used to be commit fc55433aeecac40af780d61b23c0b80c38190cab) --- source3/rpc_parse/parse_samr.c | 179 ----------------------------------------- 1 file changed, 179 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 821fee7d4c..1022189f4c 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2997,185 +2997,6 @@ bool samr_io_r_set_aliasinfo(const char *desc, SAMR_R_SET_ALIASINFO * r_u, 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_LOOKUP_RIDS structure. ********************************************************************/ -- cgit From a9333427d0e783f1de95f31b0f3a99c871816f07 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 5 Feb 2008 11:23:04 +0100 Subject: Remove unused marshalling for SAMR_REMOVE_SID_FOREIGN_DOMAIN. Guenther (This used to be commit 2e2b80bd03133dcf7a9c8a54f60eba7d07b7038a) --- source3/rpc_parse/parse_samr.c | 62 ------------------------------------------ 1 file changed, 62 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 1022189f4c..ed12927c6f 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -32,68 +32,6 @@ 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_query_domain_info(SAMR_Q_QUERY_DOMAIN_INFO * q_u, POLICY_HND *domain_pol, uint16 switch_value) { -- cgit From 1beccd34d7ad123c7c10156f6c3cf644282d0636 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 5 Feb 2008 14:56:28 +0100 Subject: Add some helper init routines for samr_DomInfo structures. They will probably move to another place later. Guenther (This used to be commit 0e1386f74824878f01146a1fe219c3cd1ed555b5) --- source3/rpc_parse/parse_samr.c | 143 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ed12927c6f..da7f04a4ff 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -66,6 +66,149 @@ bool samr_io_q_query_domain_info(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO * q_ return True; } +/******************************************************************* + inits a structure. +********************************************************************/ + +static void init_lsa_String(struct lsa_String *name, const char *s) +{ + name->string = s; +} + +/******************************************************************* + inits a structure. +********************************************************************/ + +void init_samr_DomInfo1(struct samr_DomInfo1 *r, + uint16_t min_password_length, + uint16_t password_history_length, + uint32_t password_properties, + int64_t max_password_age, + int64_t min_password_age) +{ + r->min_password_length = min_password_length; + r->password_history_length = password_history_length; + r->password_properties = password_properties; + r->max_password_age = max_password_age; + r->min_password_age = min_password_age; +} + +/******************************************************************* + inits a structure. +********************************************************************/ + +void init_samr_DomInfo2(struct samr_DomInfo2 *r, + NTTIME force_logoff_time, + const char *comment, + const char *domain_name, + const char *primary, + uint64_t sequence_num, + uint32_t unknown2, + enum samr_Role role, + uint32_t unknown3, + uint32_t num_users, + uint32_t num_groups, + uint32_t num_aliases) +{ + r->force_logoff_time = force_logoff_time; + init_lsa_String(&r->comment, comment); + init_lsa_String(&r->domain_name, domain_name); + init_lsa_String(&r->primary, primary); + r->sequence_num = sequence_num; + r->unknown2 = unknown2; + r->role = role; + r->unknown3 = unknown3; + r->num_users = num_users; + r->num_groups = num_groups; + r->num_aliases = num_aliases; +} + +/******************************************************************* + inits a structure. +********************************************************************/ + +void init_samr_DomInfo3(struct samr_DomInfo3 *r, + NTTIME force_logoff_time) +{ + r->force_logoff_time = force_logoff_time; +} + +/******************************************************************* + inits a structure. +********************************************************************/ + +void init_samr_DomInfo4(struct samr_DomInfo4 *r, + const char *comment) +{ + init_lsa_String(&r->comment, comment); +} + +/******************************************************************* + inits a structure. +********************************************************************/ + +void init_samr_DomInfo5(struct samr_DomInfo5 *r, + const char *domain_name) +{ + init_lsa_String(&r->domain_name, domain_name); +} + +/******************************************************************* + inits a structure. +********************************************************************/ + +void init_samr_DomInfo6(struct samr_DomInfo6 *r, + const char *primary) +{ + init_lsa_String(&r->primary, primary); +} + +/******************************************************************* + inits a structure. +********************************************************************/ + +void init_samr_DomInfo7(struct samr_DomInfo7 *r, + enum samr_Role role) +{ + r->role = role; +} + +/******************************************************************* + inits a structure. +********************************************************************/ + +void init_samr_DomInfo8(struct samr_DomInfo8 *r, + uint64_t sequence_num, + NTTIME domain_create_time) +{ + r->sequence_num = sequence_num; + r->domain_create_time = domain_create_time; +} + +/******************************************************************* + inits a structure. +********************************************************************/ + +void init_samr_DomInfo9(struct samr_DomInfo9 *r, + uint32_t unknown) +{ + r->unknown = unknown; +} + +/******************************************************************* + inits a structure. +********************************************************************/ + +void init_samr_DomInfo12(struct samr_DomInfo12 *r, + uint64_t lockout_duration, + uint64_t lockout_window, + uint16_t lockout_threshold) +{ + r->lockout_duration = lockout_duration; + r->lockout_window = lockout_window; + r->lockout_threshold = lockout_threshold; +} + /******************************************************************* inits a structure. ********************************************************************/ -- cgit From 80d1590cbba12b4ce6edcd7551c03a462476d321 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 5 Feb 2008 15:06:46 +0100 Subject: Remove unused marshalling for SAMR_QUERY_DOMAIN_INFO2. Guenther (This used to be commit d4dc2781add71712705f4f244e8896683b701e77) --- source3/rpc_parse/parse_samr.c | 147 ----------------------------------------- 1 file changed, 147 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index da7f04a4ff..9947f58736 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5648,153 +5648,6 @@ bool samr_io_r_chgpasswd_user3(const char *desc, SAMR_R_CHGPASSWD_USER3 *r_u, 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. ********************************************************************/ -- cgit From 149fe79ad7ba57fbf9e09bf13ba358e7437931ae Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 5 Feb 2008 17:35:11 +0100 Subject: Remove unused marshalling for SAMR_QUERY_DOMAIN_INFO. Guenther (This used to be commit 28ef04437c1e575944e392d83f014d77998ec3ff) --- source3/rpc_parse/parse_samr.c | 147 ----------------------------------------- 1 file changed, 147 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 9947f58736..39de1a82f6 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -28,44 +28,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/******************************************************************* -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. ********************************************************************/ @@ -624,115 +586,6 @@ static bool sam_io_unk_info13(const char *desc, SAM_UNK_INFO_13 * u_13, 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 SAM_STR1 structure. ********************************************************************/ -- cgit From 1430ab2dd33ab1bea9a4f0d89862b6a3d3efba68 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 5 Feb 2008 17:42:15 +0100 Subject: Remove unused marshalling for SAMR_SET_DOMAIN_INFO. Guenther (This used to be commit c67581e1e49f7049d2ff25efe310593d19b1a0fb) --- source3/rpc_parse/parse_samr.c | 122 ----------------------------------------- 1 file changed, 122 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 39de1a82f6..fc6b493f0d 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5500,125 +5500,3 @@ bool samr_io_r_chgpasswd_user3(const char *desc, SAMR_R_CHGPASSWD_USER3 *r_u, 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; -} -- cgit From d3311c5c506af7092ba222cdae7834d7e56ec942 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 5 Feb 2008 17:46:46 +0100 Subject: Remove most of SAM_UNK_INFO marshalling. Guenther (This used to be commit a1145770d1c3bfcddb687a08e3e57a566c80fb73) --- source3/rpc_parse/parse_samr.c | 365 ----------------------------------------- 1 file changed, 365 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index fc6b493f0d..1c2cf57b89 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -221,371 +221,6 @@ static bool sam_io_unk_info1(const char *desc, SAM_UNK_INFO_1 * u_1, 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; -} /******************************************************************* reads or writes a SAM_STR1 structure. ********************************************************************/ -- cgit From 38e5cf8f9580c77377e7adeeb867c7f8970ed121 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 5 Feb 2008 20:17:13 +0100 Subject: Remove marshalling for SAMR_CHGPASSWD3. Guenther (This used to be commit 41fc592f3a7745e7e34f0e0e4c92c66033547f16) --- source3/rpc_parse/parse_samr.c | 184 ----------------------------------------- 1 file changed, 184 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 1c2cf57b89..5de69feadb 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4951,187 +4951,3 @@ bool samr_io_r_chgpasswd_user(const char *desc, SAMR_R_CHGPASSWD_USER * r_u, 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; -} -- cgit From 04152f475f8589729b703999856ea52c36f9dc6d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 5 Feb 2008 20:18:09 +0100 Subject: Remove last SAM_UNK struct defines. Guenther (This used to be commit 2f877d730be786cd6e3840ea3ef5746d1fc745da) --- source3/rpc_parse/parse_samr.c | 50 ------------------------------------------ 1 file changed, 50 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 5de69feadb..5971924478 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -171,56 +171,6 @@ void init_samr_DomInfo12(struct samr_DomInfo12 *r, r->lockout_threshold = lockout_threshold; } -/******************************************************************* -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; -} - /******************************************************************* reads or writes a SAM_STR1 structure. ********************************************************************/ -- cgit From 3e731a49366df8a1fda6cc6b7fb14fc68dbb5d36 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 6 Feb 2008 01:53:29 +0100 Subject: Remove unused marshalling for SAMR_CHGPASSWD_USER. Guenther (This used to be commit ac8db3d29bf3f99a492b8265a64430538c8c1cc4) --- source3/rpc_parse/parse_samr.c | 194 ----------------------------------------- 1 file changed, 194 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 5971924478..751c8d76d9 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4707,197 +4707,3 @@ bool samr_io_r_set_userinfo2(const char *desc, SAMR_R_SET_USERINFO2 * r_u, 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; -} -- cgit From f79051fe19a6f435b1ca51904dfa084031ede49f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 7 Feb 2008 10:28:56 +0100 Subject: Remove unused marshalling for NET_GETANYDCNAME and NET_GETANYDCNAME. Guenther (This used to be commit a495e0e7c1eb91dd700a7d0fe9832fd0811cb2bb) --- source3/rpc_parse/parse_net.c | 171 ------------------------------------------ 1 file changed, 171 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index d6a99b8731..8eeefb678f 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -478,177 +478,6 @@ bool net_io_r_logon_ctrl(const char *desc, NET_R_LOGON_CTRL *r_l, prs_struct *ps 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. ********************************************************************/ -- cgit From 44f1485f0b10fdbb1f9adf833e0255affd56360c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 7 Feb 2008 10:41:04 +0100 Subject: Remove unused marshalling for NET_DSR_GESITENAME. Guenther (This used to be commit c2682273fdbe35dce0a9caffb829c8693e3cd845) --- source3/rpc_parse/parse_net.c | 72 ------------------------------------------- 1 file changed, 72 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 8eeefb678f..c68d9300b9 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -3476,75 +3476,3 @@ bool net_io_r_dsr_getdcname(const char *desc, NET_R_DSR_GETDCNAME *r_t, 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; -} - - -- cgit From 009d09dcaef63ee131a5b00489b779e7e59c970c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 6 Feb 2008 13:17:50 +0100 Subject: Remove unused marshalling for SAMR_SET_ALIASINFO. Guenther (This used to be commit f56b5f976ae8a6511cbd9b73d0ec9d428da1f04d) --- source3/rpc_parse/parse_samr.c | 58 ------------------------------------------ 1 file changed, 58 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 751c8d76d9..26b5b1c545 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2458,64 +2458,6 @@ bool samr_io_r_query_aliasinfo(const char *desc, SAMR_R_QUERY_ALIASINFO *out, 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_LOOKUP_RIDS structure. ********************************************************************/ -- cgit From bffbee263f0be03af2a076f32b2a17edd2443eca Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 6 Feb 2008 13:08:32 +0100 Subject: Remove unused marshalling for SAMR_SET_GROUPINFO. Guenther (This used to be commit 2bcc01fd134ceff1a45311dec73a5db9397033f9) --- source3/rpc_parse/parse_samr.c | 71 ------------------------------------------ 1 file changed, 71 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 26b5b1c545..dad35ec0e1 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1537,77 +1537,6 @@ static bool samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr, 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. ********************************************************************/ -- cgit From f7ad51084c87e5063e231c9bf024a354349d6a21 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 7 Feb 2008 13:14:40 +0100 Subject: Use pidl for _samr_QueryAliasInfo(). Guenther (This used to be commit 62dacea87ad2323870e5356a348d1d192b3fa888) --- source3/rpc_parse/parse_samr.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index dad35ec0e1..23fe7d0fc0 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2169,16 +2169,19 @@ bool samr_io_r_enum_dom_aliases(const char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u, } /******************************************************************* -inits a ALIAS_INFO1 structure. + inits a samr_AliasInfoAll structure. ********************************************************************/ -void init_samr_alias_info1(ALIAS_INFO1 * al1, char *acct_name, uint32 num_member, char *acct_desc) +void init_samr_alias_info1(struct samr_AliasInfoAll *r, + const char *name, + uint32_t num_members, + const char *description) { 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); + init_lsa_String(&r->name, name); + r->num_members = num_members; + init_lsa_String(&r->description, description); } /******************************************************************* @@ -2216,15 +2219,17 @@ bool samr_io_alias_info1(const char *desc, ALIAS_INFO1 * al1, return True; } + /******************************************************************* -inits a ALIAS_INFO3 structure. +inits a lsa_String structure. ********************************************************************/ -void init_samr_alias_info3(ALIAS_INFO3 * al3, const char *acct_desc) +void init_samr_alias_info3(struct lsa_String *r, + const char *description) { DEBUG(5, ("init_samr_alias_info3\n")); - init_unistr4(&al3->description, acct_desc, UNI_FLAGS_NONE); + init_lsa_String(r, description); } /******************************************************************* -- cgit From de3aec702698a32257613864691923538368a86d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 7 Feb 2008 13:22:18 +0100 Subject: Remove unused marshalling for SAMR_QUERY_ALIAS_INFO. Guenther (This used to be commit 03dff0194b917099d0fab78f94075d29b553f3ad) --- source3/rpc_parse/parse_samr.c | 196 ----------------------------------------- 1 file changed, 196 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 23fe7d0fc0..436e284fd5 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2184,42 +2184,6 @@ void init_samr_alias_info1(struct samr_AliasInfoAll *r, init_lsa_String(&r->description, description); } -/******************************************************************* -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 lsa_String structure. ********************************************************************/ @@ -2232,166 +2196,6 @@ void init_samr_alias_info3(struct lsa_String *r, init_lsa_String(r, description); } -/******************************************************************* -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_LOOKUP_RIDS structure. ********************************************************************/ -- cgit From 28124ad6670df42b5312d99838250191295f40d2 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 7 Feb 2008 13:58:53 +0100 Subject: Use pidl for _samr_QueryGroupInfo(). Guenther (This used to be commit e80852426972fbf9996561aabdde7ed7b2c78b39) --- source3/rpc_parse/parse_samr.c | 66 ++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 35 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 436e284fd5..468fe4af51 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1259,22 +1259,21 @@ bool samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u, } /******************************************************************* -inits a GROUP_INFO1 structure. + inits a samr_GroupInfoAll structure. ********************************************************************/ -void init_samr_group_info1(GROUP_INFO1 * gr1, - char *acct_name, char *acct_desc, - uint32 num_members) +void init_samr_group_info1(struct samr_GroupInfoAll *r, + const char *name, + uint32_t attributes, + uint32_t num_members, + const char *description) { 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); + init_lsa_String(&r->name, name); + r->attributes = attributes; + r->num_members = num_members; + init_lsa_String(&r->description, description); } /******************************************************************* @@ -1321,16 +1320,14 @@ bool samr_io_group_info1(const char *desc, GROUP_INFO1 * gr1, } /******************************************************************* -inits a GROUP_INFO2 structure. + inits a lsa_String structure ********************************************************************/ -void init_samr_group_info2(GROUP_INFO2 * gr2, const char *acct_name) +void init_samr_group_info2(struct lsa_String *r, const char *group_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); + init_lsa_String(r, group_name); } /******************************************************************* @@ -1358,14 +1355,15 @@ bool samr_io_group_info2(const char *desc, GROUP_INFO2 *gr2, prs_struct *ps, int } /******************************************************************* -inits a GROUP_INFO3 structure. + inits a samr_GroupInfoAttributes structure. ********************************************************************/ -void init_samr_group_info3(GROUP_INFO3 *gr3) +void init_samr_group_info3(struct samr_GroupInfoAttributes *r, + uint32_t attributes) { DEBUG(5, ("init_samr_group_info3\n")); - gr3->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT); /* why not | SE_GROUP_ENABLED ? */ + r->attributes = attributes; } /******************************************************************* @@ -1390,16 +1388,14 @@ bool samr_io_group_info3(const char *desc, GROUP_INFO3 *gr3, prs_struct *ps, int } /******************************************************************* -inits a GROUP_INFO4 structure. + inits a lsa_String structure ********************************************************************/ -void init_samr_group_info4(GROUP_INFO4 * gr4, const char *acct_desc) +void init_samr_group_info4(struct lsa_String *r, const char *description) { 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); + init_lsa_String(r, description); } /******************************************************************* @@ -1426,23 +1422,23 @@ bool samr_io_group_info4(const char *desc, GROUP_INFO4 * gr4, return True; } + /******************************************************************* -inits a GROUP_INFO5 structure. + inits a samr_GroupInfoAll structure. ********************************************************************/ -void init_samr_group_info5(GROUP_INFO5 * gr5, - char *acct_name, char *acct_desc, - uint32 num_members) +void init_samr_group_info5(struct samr_GroupInfoAll *r, + const char *name, + uint32_t attributes, + uint32_t num_members, + const char *description) { 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); + init_lsa_String(&r->name, name); + r->attributes = attributes; + r->num_members = num_members; + init_lsa_String(&r->description, description); } /******************************************************************* -- cgit From 815ab1ac949a6d71f062f8dd1d7ffe45196780db Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 7 Feb 2008 14:01:58 +0100 Subject: Remove unused marshalling for SAMR_QUERY_GROUPINFO. Guenther (This used to be commit 680dbd3ef6b1e42db2fbf5b11308b02d961a7688) --- source3/rpc_parse/parse_samr.c | 290 ----------------------------------------- 1 file changed, 290 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 468fe4af51..329b75451f 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1276,49 +1276,6 @@ void init_samr_group_info1(struct samr_GroupInfoAll *r, init_lsa_String(&r->description, description); } -/******************************************************************* -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 lsa_String structure ********************************************************************/ @@ -1330,30 +1287,6 @@ void init_samr_group_info2(struct lsa_String *r, const char *group_name) init_lsa_String(r, group_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 samr_GroupInfoAttributes structure. ********************************************************************/ @@ -1366,27 +1299,6 @@ void init_samr_group_info3(struct samr_GroupInfoAttributes *r, r->attributes = attributes; } -/******************************************************************* -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 lsa_String structure ********************************************************************/ @@ -1398,31 +1310,6 @@ void init_samr_group_info4(struct lsa_String *r, const char *description) init_lsa_String(r, description); } -/******************************************************************* -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 samr_GroupInfoAll structure. ********************************************************************/ @@ -1441,183 +1328,6 @@ void init_samr_group_info5(struct samr_GroupInfoAll *r, init_lsa_String(&r->description, description); } -/******************************************************************* -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_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_USERGROUPS structure. ********************************************************************/ -- cgit From f564a5476b47f5ca92f1d36a395c439f425ae612 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 6 Feb 2008 16:22:48 +0100 Subject: Remove unused marshalling for SAMR_QUERY_USERGROUPS. Guenther (This used to be commit 232a505535de04121a631b3bb24a2700df07ee1e) --- source3/rpc_parse/parse_samr.c | 138 ----------------------------------------- 1 file changed, 138 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 329b75451f..3c1fb9be3c 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1328,144 +1328,6 @@ void init_samr_group_info5(struct samr_GroupInfoAll *r, init_lsa_String(&r->description, description); } -/******************************************************************* -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. ********************************************************************/ -- cgit From f27a5561aa95051ef4ccffd661601c242281e450 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 7 Feb 2008 17:57:20 +0100 Subject: Use pidl for _samr_QueryDisplayInfo(). Guenther (This used to be commit b6d1283121359091683ea4d5e834a7139d891930) --- source3/rpc_parse/parse_samr.c | 216 ++++++++++++++++++++--------------------- 1 file changed, 106 insertions(+), 110 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 3c1fb9be3c..5b4d981412 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -41,6 +41,15 @@ static void init_lsa_String(struct lsa_String *name, const char *s) inits a structure. ********************************************************************/ +static void init_lsa_AsciiString(struct lsa_AsciiString *name, const char *s) +{ + name->string = s; +} + +/******************************************************************* + inits a structure. +********************************************************************/ + void init_samr_DomInfo1(struct samr_DomInfo1 *r, uint16_t min_password_length, uint16_t password_history_length, @@ -705,45 +714,44 @@ bool samr_io_q_query_dispinfo(const char *desc, SAMR_Q_QUERY_DISPINFO * q_e, } /******************************************************************* -inits a SAM_DISPINFO_1 structure. + inits a samr_DispInfoGeneral structure. ********************************************************************/ -NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 **sam, - uint32 num_entries, uint32 start_idx, +NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, + struct samr_DispInfoGeneral *r, + uint32_t num_entries, + uint32_t start_idx, struct samr_displayentry *entries) { uint32 i; DEBUG(10, ("init_sam_dispinfo_1: num_entries: %d\n", num_entries)); - if (num_entries==0) + 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; + r->count = num_entries; - (*sam)->str=TALLOC_ARRAY(ctx, SAM_STR1, num_entries); - if ((*sam)->str == NULL) + r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryGeneral, num_entries); + if (!r->entries) { 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); + init_lsa_String(&r->entries[i].account_name, + entries[i].account_name); + + init_lsa_String(&r->entries[i].description, + entries[i].description); + + init_lsa_String(&r->entries[i].full_name, + entries[i].fullname); + + r->entries[i].rid = entries[i].rid; + r->entries[i].acct_flags = entries[i].acct_flags; + r->entries[i].idx = start_idx+i+1; } return NT_STATUS_OK; @@ -795,42 +803,41 @@ static bool sam_io_sam_dispinfo_1(const char *desc, SAM_DISPINFO_1 * sam, } /******************************************************************* -inits a SAM_DISPINFO_2 structure. + inits a samr_DispInfoFull structure. ********************************************************************/ -NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 **sam, - uint32 num_entries, uint32 start_idx, +NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, + struct samr_DispInfoFull *r, + uint32_t num_entries, + uint32_t start_idx, struct samr_displayentry *entries) { - uint32 i; + uint32_t i; DEBUG(10, ("init_sam_dispinfo_2: num_entries: %d\n", num_entries)); - if (num_entries==0) + 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; + r->count = num_entries; - (*sam)->sam = TALLOC_ARRAY(ctx, SAM_ENTRY2, num_entries); - if ((*sam)->sam == NULL) + r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryFull, num_entries); + if (!r->entries) { 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++) { - 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_lsa_String(&r->entries[i].account_name, + entries[i].account_name); + + init_lsa_String(&r->entries[i].description, + entries[i].description); - 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); + r->entries[i].rid = entries[i].rid; + r->entries[i].acct_flags = entries[i].acct_flags; + r->entries[i].idx = start_idx+i+1; } return NT_STATUS_OK; @@ -884,42 +891,41 @@ static bool sam_io_sam_dispinfo_2(const char *desc, SAM_DISPINFO_2 * sam, } /******************************************************************* -inits a SAM_DISPINFO_3 structure. + inits a samr_DispInfoFullGroups structure. ********************************************************************/ -NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 **sam, - uint32 num_entries, uint32 start_idx, +NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, + struct samr_DispInfoFullGroups *r, + uint32_t num_entries, + uint32_t start_idx, struct samr_displayentry *entries) { - uint32 i; + uint32_t i; DEBUG(5, ("init_sam_dispinfo_3: num_entries: %d\n", num_entries)); - if (num_entries==0) + 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; + r->count = num_entries; - if (!((*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY3, num_entries))) + r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryFullGroup, num_entries); + if (!r->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++) { - for (i = 0; i < num_entries; i++) { - DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i)); + init_lsa_String(&r->entries[i].account_name, + entries[i].account_name); - 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_lsa_String(&r->entries[i].description, + entries[i].description); - 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); + r->entries[i].rid = entries[i].rid; + r->entries[i].acct_flags = entries[i].acct_flags; + r->entries[i].idx = start_idx+i+1; } return NT_STATUS_OK; @@ -973,45 +979,38 @@ static bool sam_io_sam_dispinfo_3(const char *desc, SAM_DISPINFO_3 * sam, } /******************************************************************* -inits a SAM_DISPINFO_4 structure. + inits a samr_DispInfoAscii structure. ********************************************************************/ -NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 **sam, - uint32 num_entries, uint32 start_idx, +NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, + struct samr_DispInfoAscii *r, + uint32_t num_entries, + uint32_t start_idx, struct samr_displayentry *entries) { - uint32 i; + uint32_t i; DEBUG(5, ("init_sam_dispinfo_4: num_entries: %d\n", num_entries)); - if (num_entries==0) + 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; + r->count = num_entries; - (*sam)->str=TALLOC_ARRAY(ctx, SAM_STR4, num_entries); - if ((*sam)->str == NULL) + r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryAscii, num_entries); + if (!r->entries) { return NT_STATUS_NO_MEMORY; + } - for (i = 0; i < num_entries; i++) { - size_t len_sam_name = strlen(entries[i].account_name); + for (i = 0; i < num_entries ; i++) { - DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i)); - - init_sam_entry4(&(*sam)->sam[i], start_idx + i + 1, - len_sam_name); + init_lsa_AsciiString(&r->entries[i].account_name, + entries[i].account_name); - init_string2(&(*sam)->str[i].acct_name, - entries[i].account_name, len_sam_name+1, - len_sam_name); + r->entries[i].idx = start_idx+i+1; } - + return NT_STATUS_OK; } @@ -1062,39 +1061,36 @@ static bool sam_io_sam_dispinfo_4(const char *desc, SAM_DISPINFO_4 * sam, } /******************************************************************* -inits a SAM_DISPINFO_5 structure. + inits a samr_DispInfoAscii structure. ********************************************************************/ -NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 **sam, - uint32 num_entries, uint32 start_idx, +NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, + struct samr_DispInfoAscii *r, + uint32_t num_entries, + uint32_t start_idx, struct samr_displayentry *entries) { - uint32 len_sam_name; - uint32 i; + uint32_t i; DEBUG(5, ("init_sam_dispinfo_5: num_entries: %d\n", num_entries)); - if (num_entries==0) + 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; + r->count = num_entries; - if (!((*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY5, num_entries))) + r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryAscii, num_entries); + if (!r->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++) { - for (i = 0; i < num_entries; i++) { - DEBUG(11, ("init_sam_dispinfo_5: entry: %d\n",i)); + init_lsa_AsciiString(&r->entries[i].account_name, + entries[i].account_name); - 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); + r->entries[i].idx = start_idx+i+1; } return NT_STATUS_OK; -- cgit From e1af5066d528895e65eae95403b029b65cc6febc Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 7 Feb 2008 20:47:21 +0100 Subject: Remove unused marshalling for SAMR_QUERY_DISPINFO. Guenther (This used to be commit c09e619a58e8a8a5317627acbf05d8b08ffdf9f4) --- source3/rpc_parse/parse_samr.c | 702 ----------------------------------------- 1 file changed, 702 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 5b4d981412..09804f1466 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -180,312 +180,6 @@ void init_samr_DomInfo12(struct samr_DomInfo12 *r, r->lockout_threshold = lockout_threshold; } -/******************************************************************* -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. ********************************************************************/ @@ -660,59 +354,6 @@ bool samr_io_r_enum_dom_users(const char *desc, SAMR_R_ENUM_DOM_USERS * r_u, 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 samr_DispInfoGeneral structure. ********************************************************************/ @@ -757,51 +398,6 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, 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 samr_DispInfoFull structure. ********************************************************************/ @@ -843,53 +439,6 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, 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 samr_DispInfoFullGroups structure. ********************************************************************/ @@ -931,53 +480,6 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, 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 samr_DispInfoAscii structure. ********************************************************************/ @@ -1014,52 +516,6 @@ NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, 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 samr_DispInfoAscii structure. ********************************************************************/ @@ -1096,164 +552,6 @@ NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, 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_GroupInfoAll structure. ********************************************************************/ -- cgit From b13277ed4e59c64f1c3c15109c85a8967c6260fe Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 8 Feb 2008 01:56:09 +0100 Subject: Remove unused marshalling for LSA_QUERY_INFO2. Guenther (This used to be commit 0fac016d9d0018c983576d5cc8c3e06f40360b73) --- source3/rpc_parse/parse_lsa.c | 119 ------------------------------------------ 1 file changed, 119 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index daf4806392..3e7905847f 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -850,61 +850,6 @@ bool lsa_io_dom_query_12(const char *desc, DOM_QUERY_12 *info, prs_struct *ps, i } -/******************************************************************* -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. ********************************************************************/ @@ -2923,70 +2868,6 @@ bool policy_handle_is_valid(const POLICY_HND *hnd) 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. ********************************************************************/ -- cgit From 99a134a74e1625f82eead6cb5649780aec787bef Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 8 Feb 2008 02:25:54 +0100 Subject: Remove unused marshalling for LSA_QUERY_INFO. Guenther (This used to be commit f193d7d944e89f94b968a369d6566d13a4fbef5c) --- source3/rpc_parse/parse_lsa.c | 351 ------------------------------------------ 1 file changed, 351 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 3e7905847f..1574df5438 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -418,38 +418,6 @@ bool lsa_io_r_open_pol2(const char *desc, LSA_R_OPEN_POL2 *out, prs_struct *ps, 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. ********************************************************************/ @@ -615,325 +583,6 @@ bool lsa_io_r_enum_trust_dom(const char *desc, LSA_R_ENUM_TRUST_DOM *out, 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_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. ********************************************************************/ -- cgit From 400ac70117ad48d729f33931e9baaee40e46bf38 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 8 Feb 2008 14:52:10 +0100 Subject: Remove unused marshalling for SAMR_LOOKUP_NAMES. Guenther (This used to be commit 593768c3e98d1ac34e6f9a8b3969662e9be3b707) --- source3/rpc_parse/parse_samr.c | 229 ----------------------------------------- 1 file changed, 229 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 09804f1466..80f9498872 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1256,235 +1256,6 @@ bool samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u, 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_QUERY_USERINFO structure. ********************************************************************/ -- cgit From ef01ceff897555729f16ad6cc0c8bd0d504b4319 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 6 Feb 2008 19:07:01 +0100 Subject: Remove unused marshalling for LSA_CREATEACCOUNT. Guenther (This used to be commit c9a8baf5077a4e93cca241a5ec73f6ade97af607) --- source3/rpc_parse/parse_lsa.c | 55 ------------------------------------------- 1 file changed, 55 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 1574df5438..ef54b4a30d 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1985,61 +1985,6 @@ bool lsa_io_r_unk_get_connuser(const char *desc, LSA_R_UNK_GET_CONNUSER *out, pr 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)); -- cgit From 5c23f7d73cfe96147c6b0d2069241b946843d5ec Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 6 Feb 2008 19:34:40 +0100 Subject: Remove unused marshalling for LSA_OPENACCOUNT. Guenther (This used to be commit bb8e77eb74c9d178a6c77f2f9c69eb1778fb5e10) --- source3/rpc_parse/parse_lsa.c | 54 ------------------------------------------- 1 file changed, 54 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index ef54b4a30d..4c13c58125 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1985,60 +1985,6 @@ bool lsa_io_r_unk_get_connuser(const char *desc, LSA_R_UNK_GET_CONNUSER *out, pr 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)); -- cgit From 5120373cc8d22a26502d0d74cea9f9b473080129 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 8 Feb 2008 18:33:41 +0100 Subject: Remove unused marshalling for LSA_SETSYSTEMACCOUNT. Guenther (This used to be commit ddefdc5bd70620dcb94660ba5d55520e136d8d0f) --- source3/rpc_parse/parse_lsa.c | 40 ---------------------------------------- 1 file changed, 40 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 4c13c58125..0e4cc9fb2e 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2180,46 +2180,6 @@ bool lsa_io_r_getsystemaccount(const char *desc, LSA_R_GETSYSTEMACCOUNT *out, p } -/******************************************************************* - 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); -- cgit From 7a425d69dd0953620a6fe289d52ba4ad673a6d97 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 8 Feb 2008 18:54:38 +0100 Subject: Remove unused marshalling for LSA_GETSYSTEMACCOUNT. Guenther (This used to be commit cf3a76bf19bfeb35800e0fc31e90dc4ea5c0ff85) --- source3/rpc_parse/parse_lsa.c | 42 ------------------------------------------ 1 file changed, 42 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 0e4cc9fb2e..5f22a28082 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -2138,48 +2138,6 @@ bool lsa_io_r_enum_privsaccount(const char *desc, LSA_R_ENUMPRIVSACCOUNT *out, p 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; -} - - void init_lsa_string( LSA_STRING *uni, const char *string ) { init_unistr2(&uni->unistring, string, UNI_FLAGS_NONE); -- cgit From 5da927716a857ce686f3b75476671d32f047d2c0 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 8 Feb 2008 23:33:52 +0100 Subject: Remove unused marshalling for NET_DSR_GETDCNAME. Guenther (This used to be commit 65c2aa344e45064cbfddd87715862d60f7ac2a8a) --- source3/rpc_parse/parse_net.c | 236 ------------------------------------------ 1 file changed, 236 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index c68d9300b9..55af8211cf 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -3240,239 +3240,3 @@ bool net_io_r_sam_deltas(const char *desc, 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; -} - -/******************************************************************* - 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; -} - -/******************************************************************* - 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; -} -- cgit From ebec5010b48f3de6eaf98ce2395e512a2e0258d5 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 9 Feb 2008 02:00:25 +0100 Subject: Remove unused marshalling for SAMR_ENUM_DOMAINS. Guenther (This used to be commit 31132f33e2c7ee9664e3094eec1b5be45a69c6b2) --- source3/rpc_parse/parse_samr.c | 139 ----------------------------------------- 1 file changed, 139 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 80f9498872..3ab3dd5c58 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -622,145 +622,6 @@ void init_samr_group_info5(struct samr_GroupInfoAll *r, init_lsa_String(&r->description, description); } -/******************************************************************* -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. ********************************************************************/ -- cgit From 1042b0ce370669a0f2a08fcda45572f39cebb89f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 11 Feb 2008 10:38:06 +0100 Subject: Remove unused marshalling for LSA_ENUM_PRIVS. Guenther (This used to be commit 793e5a608b1a40174088db6fbfcfc8cc6263a0da) --- source3/rpc_parse/parse_lsa.c | 133 ------------------------------------------ 1 file changed, 133 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 5f22a28082..7e9f8b4393 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1615,139 +1615,6 @@ bool lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_stru 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)); -- cgit From 0e4088e62630e6d0d75025db16ff97f5744194a0 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 11 Feb 2008 17:50:18 +0100 Subject: Let rpccli_lsa_open_policy[2] be convenience wrappers around their pidl equivalents. Guenther (This used to be commit 4ca3b1c02ee44ddcab8d1b100497939de62558e6) --- source3/rpc_parse/parse_lsa.c | 253 +++++------------------------------------- 1 file changed, 25 insertions(+), 228 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 7e9f8b4393..5f9fb12ab2 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -176,246 +176,43 @@ static bool lsa_io_dom_r_ref(const char *desc, DOM_R_REF *dom, prs_struct *ps, i } /******************************************************************* - Inits an LSA_SEC_QOS structure. + Inits an lsa_QosInfo structure. ********************************************************************/ -void init_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff) +void init_lsa_sec_qos(struct lsa_QosInfo *r, + uint32_t len, + uint16_t impersonation_level, + uint8_t context_mode, + uint8_t effective_only) { 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; + r->len = len; + r->impersonation_level = impersonation_level; + r->context_mode = context_mode; + r->effective_only = effective_only; } /******************************************************************* - Reads or writes an LSA_SEC_QOS structure. + Inits an lsa_ObjectAttribute structure. ********************************************************************/ -static bool lsa_io_sec_qos(const char *desc, LSA_SEC_QOS *qos, prs_struct *ps, - int depth) +void init_lsa_obj_attr(struct lsa_ObjectAttribute *r, + uint32_t len, + uint8_t *root_dir, + const char *object_name, + uint32_t attributes, + struct security_descriptor *sec_desc, + struct lsa_QosInfo *sec_qos) { - uint32 start; + DEBUG(5,("init_lsa_obj_attr\n")); - 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; + r->len = len; + r->root_dir = root_dir; + r->object_name = object_name; + r->attributes = attributes; + r->sec_desc = sec_desc; + r->sec_qos = sec_qos; } /******************************************************************* -- cgit From 76f654e21ce07ced6440caa71d58119b19716b34 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 11 Feb 2008 18:11:11 +0100 Subject: Remove unused marshalling for LSA_PRIV_GET_DISPNAME. Guenther (This used to be commit d853f4f2634a3273c193cc52e7aaa4e7234a827c) --- source3/rpc_parse/parse_lsa.c | 80 ------------------------------------------- 1 file changed, 80 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 5f9fb12ab2..ded4b7a3a7 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1412,86 +1412,6 @@ bool lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_stru 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 */ -- cgit From a473d10915002b586a4c0bce928a3fbf78523b09 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 11 Feb 2008 20:31:34 +0100 Subject: Remove unused marshalling for LSA_UNK_GET_CONNUSER. Guenther (This used to be commit 5550c5c387ad66ffe8532e669b6155a28c6e54d1) --- source3/rpc_parse/parse_lsa.c | 73 ------------------------------------------- 1 file changed, 73 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index ded4b7a3a7..12dd6e126b 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1496,79 +1496,6 @@ bool lsa_io_r_enum_accounts(const char *desc, LSA_R_ENUM_ACCOUNTS *out, prs_stru } -/******************************************************************* - 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_enum_privsaccount(LSA_Q_ENUMPRIVSACCOUNT *trn, POLICY_HND *hnd) { memcpy(&trn->pol, hnd, sizeof(trn->pol)); -- cgit From 90631dd2c27db6480ddfaec5746c84579ec684be Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 12 Feb 2008 00:07:41 +0100 Subject: Removing unused ACCT_-flags. Guenther (This used to be commit d1e5a5a7f9dfb5756398e99cf09a4712d2b42682) --- source3/rpc_parse/parse_samr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 3ab3dd5c58..5a76be70ac 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1732,7 +1732,7 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z /************************************************************************* init_samr_user_info25P - fields_present = ACCT_NT_PWD_SET | ACCT_LM_PWD_SET | ACCT_FLAGS + fields_present = ACCT_NT_PWD_SET | ACCT_LM_PWD_SET | SAMR_FIELD_ACCT_FLAGS *************************************************************************/ void init_sam_user_info25P(SAM_USER_INFO_25 * usr, -- cgit From c3f68ad29fa482df95be92d76071cff8bf9f384a Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 12 Feb 2008 11:38:31 +0100 Subject: Remove unused marshalling for SAMR_ENUM_DOM_USERS. Guenther (This used to be commit 4521f31a727550aae2b5eb6304c8d25e68326147) --- source3/rpc_parse/parse_samr.c | 139 ----------------------------------------- 1 file changed, 139 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 5a76be70ac..5225bcb5ca 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -215,145 +215,6 @@ static bool sam_io_sam_entry(const char *desc, SAM_ENTRY * sam, 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_DispInfoGeneral structure. ********************************************************************/ -- cgit From 6aa84ad8c5a535fc45cc9014fdc36867b6c76be9 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 12 Feb 2008 12:16:02 +0100 Subject: Move some samr init functions around (to allow easier identification of new calls). Guenther (This used to be commit c51c126049bd251a04dfae7ca6c3d0d3f823a503) --- source3/rpc_parse/parse_samr.c | 448 ----------------------------------------- 1 file changed, 448 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 5225bcb5ca..a991037a6f 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -28,158 +28,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/******************************************************************* - inits a structure. -********************************************************************/ - -static void init_lsa_String(struct lsa_String *name, const char *s) -{ - name->string = s; -} - -/******************************************************************* - inits a structure. -********************************************************************/ - -static void init_lsa_AsciiString(struct lsa_AsciiString *name, const char *s) -{ - name->string = s; -} - -/******************************************************************* - inits a structure. -********************************************************************/ - -void init_samr_DomInfo1(struct samr_DomInfo1 *r, - uint16_t min_password_length, - uint16_t password_history_length, - uint32_t password_properties, - int64_t max_password_age, - int64_t min_password_age) -{ - r->min_password_length = min_password_length; - r->password_history_length = password_history_length; - r->password_properties = password_properties; - r->max_password_age = max_password_age; - r->min_password_age = min_password_age; -} - -/******************************************************************* - inits a structure. -********************************************************************/ - -void init_samr_DomInfo2(struct samr_DomInfo2 *r, - NTTIME force_logoff_time, - const char *comment, - const char *domain_name, - const char *primary, - uint64_t sequence_num, - uint32_t unknown2, - enum samr_Role role, - uint32_t unknown3, - uint32_t num_users, - uint32_t num_groups, - uint32_t num_aliases) -{ - r->force_logoff_time = force_logoff_time; - init_lsa_String(&r->comment, comment); - init_lsa_String(&r->domain_name, domain_name); - init_lsa_String(&r->primary, primary); - r->sequence_num = sequence_num; - r->unknown2 = unknown2; - r->role = role; - r->unknown3 = unknown3; - r->num_users = num_users; - r->num_groups = num_groups; - r->num_aliases = num_aliases; -} - -/******************************************************************* - inits a structure. -********************************************************************/ - -void init_samr_DomInfo3(struct samr_DomInfo3 *r, - NTTIME force_logoff_time) -{ - r->force_logoff_time = force_logoff_time; -} - -/******************************************************************* - inits a structure. -********************************************************************/ - -void init_samr_DomInfo4(struct samr_DomInfo4 *r, - const char *comment) -{ - init_lsa_String(&r->comment, comment); -} - -/******************************************************************* - inits a structure. -********************************************************************/ - -void init_samr_DomInfo5(struct samr_DomInfo5 *r, - const char *domain_name) -{ - init_lsa_String(&r->domain_name, domain_name); -} - -/******************************************************************* - inits a structure. -********************************************************************/ - -void init_samr_DomInfo6(struct samr_DomInfo6 *r, - const char *primary) -{ - init_lsa_String(&r->primary, primary); -} - -/******************************************************************* - inits a structure. -********************************************************************/ - -void init_samr_DomInfo7(struct samr_DomInfo7 *r, - enum samr_Role role) -{ - r->role = role; -} - -/******************************************************************* - inits a structure. -********************************************************************/ - -void init_samr_DomInfo8(struct samr_DomInfo8 *r, - uint64_t sequence_num, - NTTIME domain_create_time) -{ - r->sequence_num = sequence_num; - r->domain_create_time = domain_create_time; -} - -/******************************************************************* - inits a structure. -********************************************************************/ - -void init_samr_DomInfo9(struct samr_DomInfo9 *r, - uint32_t unknown) -{ - r->unknown = unknown; -} - -/******************************************************************* - inits a structure. -********************************************************************/ - -void init_samr_DomInfo12(struct samr_DomInfo12 *r, - uint64_t lockout_duration, - uint64_t lockout_window, - uint16_t lockout_threshold) -{ - r->lockout_duration = lockout_duration; - r->lockout_window = lockout_window; - r->lockout_threshold = lockout_threshold; -} - /******************************************************************* inits a SAM_ENTRY structure. ********************************************************************/ @@ -215,274 +63,6 @@ static bool sam_io_sam_entry(const char *desc, SAM_ENTRY * sam, return True; } -/******************************************************************* - inits a samr_DispInfoGeneral structure. -********************************************************************/ - -NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, - struct samr_DispInfoGeneral *r, - uint32_t num_entries, - uint32_t 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; - } - - r->count = num_entries; - - r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryGeneral, num_entries); - if (!r->entries) { - return NT_STATUS_NO_MEMORY; - } - - for (i = 0; i < num_entries ; i++) { - - init_lsa_String(&r->entries[i].account_name, - entries[i].account_name); - - init_lsa_String(&r->entries[i].description, - entries[i].description); - - init_lsa_String(&r->entries[i].full_name, - entries[i].fullname); - - r->entries[i].rid = entries[i].rid; - r->entries[i].acct_flags = entries[i].acct_flags; - r->entries[i].idx = start_idx+i+1; - } - - return NT_STATUS_OK; -} - -/******************************************************************* - inits a samr_DispInfoFull structure. -********************************************************************/ - -NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, - struct samr_DispInfoFull *r, - uint32_t num_entries, - uint32_t start_idx, - struct samr_displayentry *entries) -{ - uint32_t i; - - DEBUG(10, ("init_sam_dispinfo_2: num_entries: %d\n", num_entries)); - - if (num_entries == 0) { - return NT_STATUS_OK; - } - - r->count = num_entries; - - r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryFull, num_entries); - if (!r->entries) { - return NT_STATUS_NO_MEMORY; - } - - for (i = 0; i < num_entries ; i++) { - - init_lsa_String(&r->entries[i].account_name, - entries[i].account_name); - - init_lsa_String(&r->entries[i].description, - entries[i].description); - - r->entries[i].rid = entries[i].rid; - r->entries[i].acct_flags = entries[i].acct_flags; - r->entries[i].idx = start_idx+i+1; - } - - return NT_STATUS_OK; -} - -/******************************************************************* - inits a samr_DispInfoFullGroups structure. -********************************************************************/ - -NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, - struct samr_DispInfoFullGroups *r, - uint32_t num_entries, - uint32_t start_idx, - struct samr_displayentry *entries) -{ - uint32_t i; - - DEBUG(5, ("init_sam_dispinfo_3: num_entries: %d\n", num_entries)); - - if (num_entries == 0) { - return NT_STATUS_OK; - } - - r->count = num_entries; - - r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryFullGroup, num_entries); - if (!r->entries) { - return NT_STATUS_NO_MEMORY; - } - - for (i = 0; i < num_entries ; i++) { - - init_lsa_String(&r->entries[i].account_name, - entries[i].account_name); - - init_lsa_String(&r->entries[i].description, - entries[i].description); - - r->entries[i].rid = entries[i].rid; - r->entries[i].acct_flags = entries[i].acct_flags; - r->entries[i].idx = start_idx+i+1; - } - - return NT_STATUS_OK; -} - -/******************************************************************* - inits a samr_DispInfoAscii structure. -********************************************************************/ - -NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, - struct samr_DispInfoAscii *r, - uint32_t num_entries, - uint32_t start_idx, - struct samr_displayentry *entries) -{ - uint32_t i; - - DEBUG(5, ("init_sam_dispinfo_4: num_entries: %d\n", num_entries)); - - if (num_entries == 0) { - return NT_STATUS_OK; - } - - r->count = num_entries; - - r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryAscii, num_entries); - if (!r->entries) { - return NT_STATUS_NO_MEMORY; - } - - for (i = 0; i < num_entries ; i++) { - - init_lsa_AsciiString(&r->entries[i].account_name, - entries[i].account_name); - - r->entries[i].idx = start_idx+i+1; - } - - return NT_STATUS_OK; -} - -/******************************************************************* - inits a samr_DispInfoAscii structure. -********************************************************************/ - -NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, - struct samr_DispInfoAscii *r, - uint32_t num_entries, - uint32_t start_idx, - struct samr_displayentry *entries) -{ - uint32_t i; - - DEBUG(5, ("init_sam_dispinfo_5: num_entries: %d\n", num_entries)); - - if (num_entries == 0) { - return NT_STATUS_OK; - } - - r->count = num_entries; - - r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryAscii, num_entries); - if (!r->entries) { - return NT_STATUS_NO_MEMORY; - } - - for (i = 0; i < num_entries ; i++) { - - init_lsa_AsciiString(&r->entries[i].account_name, - entries[i].account_name); - - r->entries[i].idx = start_idx+i+1; - } - - return NT_STATUS_OK; -} - -/******************************************************************* - inits a samr_GroupInfoAll structure. -********************************************************************/ - -void init_samr_group_info1(struct samr_GroupInfoAll *r, - const char *name, - uint32_t attributes, - uint32_t num_members, - const char *description) -{ - DEBUG(5, ("init_samr_group_info1\n")); - - init_lsa_String(&r->name, name); - r->attributes = attributes; - r->num_members = num_members; - init_lsa_String(&r->description, description); -} - -/******************************************************************* - inits a lsa_String structure -********************************************************************/ - -void init_samr_group_info2(struct lsa_String *r, const char *group_name) -{ - DEBUG(5, ("init_samr_group_info2\n")); - - init_lsa_String(r, group_name); -} - -/******************************************************************* - inits a samr_GroupInfoAttributes structure. -********************************************************************/ - -void init_samr_group_info3(struct samr_GroupInfoAttributes *r, - uint32_t attributes) -{ - DEBUG(5, ("init_samr_group_info3\n")); - - r->attributes = attributes; -} - -/******************************************************************* - inits a lsa_String structure -********************************************************************/ - -void init_samr_group_info4(struct lsa_String *r, const char *description) -{ - DEBUG(5, ("init_samr_group_info4\n")); - - init_lsa_String(r, description); -} - -/******************************************************************* - inits a samr_GroupInfoAll structure. -********************************************************************/ - -void init_samr_group_info5(struct samr_GroupInfoAll *r, - const char *name, - uint32_t attributes, - uint32_t num_members, - const char *description) -{ - DEBUG(5, ("init_samr_group_info5\n")); - - init_lsa_String(&r->name, name); - r->attributes = attributes; - r->num_members = num_members; - init_lsa_String(&r->description, description); -} - /******************************************************************* inits a SAMR_Q_ENUM_DOM_GROUPS structure. ********************************************************************/ @@ -752,34 +332,6 @@ bool samr_io_r_enum_dom_aliases(const char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u, return True; } -/******************************************************************* - inits a samr_AliasInfoAll structure. -********************************************************************/ - -void init_samr_alias_info1(struct samr_AliasInfoAll *r, - const char *name, - uint32_t num_members, - const char *description) -{ - DEBUG(5, ("init_samr_alias_info1\n")); - - init_lsa_String(&r->name, name); - r->num_members = num_members; - init_lsa_String(&r->description, description); -} - -/******************************************************************* -inits a lsa_String structure. -********************************************************************/ - -void init_samr_alias_info3(struct lsa_String *r, - const char *description) -{ - DEBUG(5, ("init_samr_alias_info3\n")); - - init_lsa_String(r, description); -} - /******************************************************************* inits a SAMR_Q_LOOKUP_RIDS structure. ********************************************************************/ -- cgit From 6f2a384b33f33a4340e7bd4d1b1be4ab70f0c2c8 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 12 Feb 2008 18:27:57 +0100 Subject: Remove unused marshalling for SAMR_QUERY_USERINFO. Guenther (This used to be commit daec00fd62999d4f8d74dc4cdd2fba686433ad01) --- source3/rpc_parse/parse_samr.c | 90 ------------------------------------------ 1 file changed, 90 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a991037a6f..954a60d443 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -530,44 +530,6 @@ bool samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u, 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. ********************************************************************/ @@ -2082,58 +2044,6 @@ static bool samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr, 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. ********************************************************************/ -- cgit From b69a590f6bec4219879beb87dc375417153983a2 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 12 Feb 2008 01:31:32 +0100 Subject: Remove unused marshalling for SAMR_SET_USERINFO2. Guenther (This used to be commit d493f98cd1da5e8a5995e3adea2f28b434baae99) --- source3/rpc_parse/parse_samr.c | 87 ------------------------------------------ 1 file changed, 87 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 954a60d443..5cfd1edfee 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2117,90 +2117,3 @@ bool samr_io_r_set_userinfo(const char *desc, SAMR_R_SET_USERINFO * r_u, 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; -} -- cgit From a9cf5a0e9c1bea7d75adb99fed81f4bbb0fa2814 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 12 Feb 2008 21:11:03 +0100 Subject: The final SAM_USER_INFO massacre. I compared those very thoroughly with the idl ones but couldn't find any bits that were missing (except for the very obscure (and totally unused) SAM_USER_INFO_17 structure which I think was totally wrong). Guenther (This used to be commit e7192818f79725060d2b12d44186ba8c5bae2fb8) --- source3/rpc_parse/parse_samr.c | 1588 ---------------------------------------- 1 file changed, 1588 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 5cfd1edfee..298ad69932 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -529,1591 +529,3 @@ bool samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u, 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 | SAMR_FIELD_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_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; -} -- cgit From 2600cb6b9b29230112924e306433cac2e5ba0ecc Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 13 Feb 2008 00:37:19 +0100 Subject: Remove unused marshalling for LSA_ENUM_TRUST_DOM. Guenther (This used to be commit 90b07714ddb16ef87865cdf4f9c64c0372200e42) --- source3/rpc_parse/parse_lsa.c | 165 ------------------------------------------ 1 file changed, 165 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 12dd6e126b..c4a7c057a6 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -215,171 +215,6 @@ void init_lsa_obj_attr(struct lsa_ObjectAttribute *r, r->sec_qos = sec_qos; } -/******************************************************************* -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; icount; 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; icount; 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; -} - /******************************************************************* Inits a LSA_SID_ENUM structure. ********************************************************************/ -- cgit From 111ea7682ef39ea02b044e7f1ef27c5865ebdc01 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 13 Feb 2008 10:27:15 +0100 Subject: Remove unused marshalling for NET_TRUST_DOM_LIST. Guenther (This used to be commit 9312755955eac9897c8117773f8cd7d1652b2bca) --- source3/rpc_parse/parse_net.c | 102 ------------------------------------------ 1 file changed, 102 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 55af8211cf..257f461d7c 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -478,108 +478,6 @@ bool net_io_r_logon_ctrl(const char *desc, NET_R_LOGON_CTRL *r_l, prs_struct *ps 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. ********************************************************************/ -- cgit From af161cf49c3ef829efe6c005c6f57b89fcf153a3 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 13 Feb 2008 10:54:16 +0100 Subject: Remove unused init_sam_entry routine. Guenther (This used to be commit c19847a02486414117425930367dcd210e911715) --- source3/rpc_parse/parse_samr.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 298ad69932..3ec1c40d47 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -28,18 +28,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/******************************************************************* -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. ********************************************************************/ -- cgit From 7c0796a494aff5836f14817c4919f0290a752472 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 13 Feb 2008 10:54:56 +0100 Subject: Remove unused marshalling for SAMR_LOOKUP_RIDS. Guenther (This used to be commit c6db963dacb04a9b2ee12705d8cfb29b843c0ea2) --- source3/rpc_parse/parse_samr.c | 198 ----------------------------------------- 1 file changed, 198 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 3ec1c40d47..14b6e2a433 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -319,201 +319,3 @@ bool samr_io_r_enum_dom_aliases(const char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u, 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; -} -- cgit From 4843df31de6f52b1e790bbd603ff1ac999176ca3 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 13 Feb 2008 11:11:34 +0100 Subject: Remove unused marshalling for SAMR_ENUM_DOM_GROUPS. Guenther (This used to be commit 6f269ec8c0ad18bd0c04d5fc459fa80ab72dba63) --- source3/rpc_parse/parse_samr.c | 134 ----------------------------------------- 1 file changed, 134 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 14b6e2a433..bb98cd1ea6 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -51,140 +51,6 @@ static bool sam_io_sam_entry(const char *desc, SAM_ENTRY * sam, 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. ********************************************************************/ -- cgit From c60460a54982b2e3b6b7aff457eba39d638897ea Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 13 Feb 2008 11:17:40 +0100 Subject: Remove unused marshalling for SAMR_ENUM_DOM_ALIASES. Guenther (This used to be commit 7e1f33436adb0625662969f52b501c57d4a4bc87) --- source3/rpc_parse/parse_samr.c | 158 ----------------------------------------- 1 file changed, 158 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index bb98cd1ea6..ad55e48394 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -27,161 +27,3 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE - -/******************************************************************* -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_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; -} -- cgit From be4ca67316af5541311fd42c254f96d1dc14cc8d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 13 Feb 2008 11:36:17 +0100 Subject: Goodbye parse_samr.c, rest in peace - but never come back! Guenther (This used to be commit 8a8c5826e7a55742169e60d2145a7fe4d5786a23) --- source3/rpc_parse/parse_samr.c | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 source3/rpc_parse/parse_samr.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c deleted file mode 100644 index ad55e48394..0000000000 --- a/source3/rpc_parse/parse_samr.c +++ /dev/null @@ -1,29 +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 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 . - */ - -#include "includes.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_RPC_PARSE -- cgit From 834fa856dae7c2a7d802fce55621055417946f16 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 13 Feb 2008 17:57:57 +0100 Subject: Move some lsa init routines around. Guenther (This used to be commit 8d3e7e8bb067b9e0aab79bc460647e8a6176102e) --- source3/rpc_parse/parse_lsa.c | 40 ---------------------------------------- 1 file changed, 40 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index c4a7c057a6..b8a0b03273 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -175,46 +175,6 @@ static bool lsa_io_dom_r_ref(const char *desc, DOM_R_REF *dom, prs_struct *ps, i return True; } -/******************************************************************* - Inits an lsa_QosInfo structure. -********************************************************************/ - -void init_lsa_sec_qos(struct lsa_QosInfo *r, - uint32_t len, - uint16_t impersonation_level, - uint8_t context_mode, - uint8_t effective_only) -{ - DEBUG(5, ("init_lsa_sec_qos\n")); - - r->len = len; - r->impersonation_level = impersonation_level; - r->context_mode = context_mode; - r->effective_only = effective_only; -} - -/******************************************************************* - Inits an lsa_ObjectAttribute structure. -********************************************************************/ - -void init_lsa_obj_attr(struct lsa_ObjectAttribute *r, - uint32_t len, - uint8_t *root_dir, - const char *object_name, - uint32_t attributes, - struct security_descriptor *sec_desc, - struct lsa_QosInfo *sec_qos) -{ - DEBUG(5,("init_lsa_obj_attr\n")); - - r->len = len; - r->root_dir = root_dir; - r->object_name = object_name; - r->attributes = attributes; - r->sec_desc = sec_desc; - r->sec_qos = sec_qos; -} - /******************************************************************* Inits a LSA_SID_ENUM structure. ********************************************************************/ -- cgit From d134bd3c27ba3317e323a2c37d43f80c0ec58cbc Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 13 Feb 2008 23:12:42 +0100 Subject: Remove unused marshalling for NET_LOGON_CTRL and NET_LOGON_CTRL2. Guenther (This used to be commit c94538e742e469e4afc6e30d9d99951fda6dd219) --- source3/rpc_parse/parse_net.c | 432 ------------------------------------------ 1 file changed, 432 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 257f461d7c..8105ac5470 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -46,438 +46,6 @@ static bool net_io_neg_flags(const char *desc, NEG_FLAGS *neg, prs_struct *ps, i 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_Q_REQ_CHAL structure. ********************************************************************/ -- cgit From 8f7cc004ffefbd9da3d34a3a7dfc3839bdaafd3c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 14 Feb 2008 01:34:34 +0100 Subject: Remove unused marshalling for LSA_ENUM_ACCOUNTS. Guenther (This used to be commit 8c476ad51622f76bf8f03f6255369b8e19f24a72) --- source3/rpc_parse/parse_lsa.c | 84 ------------------------------------------- 1 file changed, 84 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index b8a0b03273..6a80bb28a8 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1207,90 +1207,6 @@ bool lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_stru 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; -} - - void init_lsa_q_enum_privsaccount(LSA_Q_ENUMPRIVSACCOUNT *trn, POLICY_HND *hnd) { memcpy(&trn->pol, hnd, sizeof(trn->pol)); -- cgit From 341e5ea3eb5068d5b742deb6d14d58500330d27c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 14 Feb 2008 12:15:17 +0100 Subject: Remove unused marshalling for LSA_ENUMPRIVSACCOUNT. Guenther (This used to be commit 004598bc1322b6e2deb62115713768682fee988e) --- source3/rpc_parse/parse_lsa.c | 84 ------------------------------------------- 1 file changed, 84 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 6a80bb28a8..2230c9147f 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1207,30 +1207,6 @@ bool lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_stru 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. ********************************************************************/ @@ -1300,66 +1276,6 @@ static bool lsa_io_privilege_set(const char *desc, PRIVILEGE_SET *out, prs_struc 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; -} - void init_lsa_string( LSA_STRING *uni, const char *string ) { init_unistr2(&uni->unistring, string, UNI_FLAGS_NONE); -- cgit From c6cd8ec909269be0f6800c7d59db94090b3c647b Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 14 Feb 2008 13:31:55 +0100 Subject: Remove unused marshalling for LSA_LOOKUP_PRIV_VALUE. Guenther (This used to be commit 8125d8557fb4b27873f8eabc6ad1019491d18cce) --- source3/rpc_parse/parse_lsa.c | 67 ------------------------------------------- 1 file changed, 67 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 2230c9147f..602021146f 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1276,73 +1276,6 @@ static bool lsa_io_privilege_set(const char *desc, PRIVILEGE_SET *out, prs_struc 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. ********************************************************************/ -- cgit From ff85aec1937692c9aa62855bdc2f35df0db6d890 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 14 Feb 2008 14:01:49 +0100 Subject: Remove unused marshalling for LSA_ADDPRIVS and LSA_REMOVEPRIVS. Guenther (This used to be commit 5b700aba1a2e1559c17fec9d82e87312e8a5b15d) --- source3/rpc_parse/parse_lsa.c | 178 ------------------------------------------ 1 file changed, 178 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 602021146f..d4d32531a0 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1207,188 +1207,10 @@ bool lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_stru 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; icount; i++) { - if (!lsa_io_luid_attr(desc, &out->set[i], ps, depth)) - 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; -- cgit From 25bc71f117776024bd2d1f024b44af57c6b33f74 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 14 Feb 2008 14:35:27 +0100 Subject: Remove unused marshalling for LSA_ADD_ACCT_RIGHTS. Guenther (This used to be commit 15b97d1aafd6c8ad936944b611188154b191167f) --- source3/rpc_parse/parse_lsa.c | 59 ------------------------------------------- 1 file changed, 59 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index d4d32531a0..05841e59a7 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1311,65 +1311,6 @@ bool lsa_io_r_enum_acct_rights(const char *desc, LSA_R_ENUM_ACCT_RIGHTS *out, pr } -/******************************************************************* - 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. ********************************************************************/ -- cgit From d64ae7328ad3fdf587ec939f02189ff9439acea8 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 14 Feb 2008 15:11:35 +0100 Subject: Remove unused marshalling for LSA_ENUM_ACCT_RIGHTS. Guenther (This used to be commit 34c0e64026b7f5f223c7d7f1d7e162b5659f3bd3) --- source3/rpc_parse/parse_lsa.c | 92 ------------------------------------------- 1 file changed, 92 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 05841e59a7..1a5c5e8a3e 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1219,98 +1219,6 @@ bool policy_handle_is_valid(const POLICY_HND *hnd) return ((memcmp(&zero_pol, hnd, sizeof(POLICY_HND)) == 0) ? False : 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; icount; 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_REMOVE_ACCT_RIGHTS structure. ********************************************************************/ -- cgit From ad5794ad5ce3554140a39eeb395a6b1d064c3852 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 14 Feb 2008 15:29:51 +0100 Subject: Remove unused marshalling for LSA_REMOVE_ACCT_RIGHTS. Guenther (This used to be commit 80e39330bf15cc57f2780a5b900d8a2b14d92fa9) --- source3/rpc_parse/parse_lsa.c | 69 ------------------------------------------- 1 file changed, 69 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 1a5c5e8a3e..80e90a8265 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1218,72 +1218,3 @@ bool policy_handle_is_valid(const POLICY_HND *hnd) ZERO_STRUCT(zero_pol); return ((memcmp(&zero_pol, hnd, sizeof(POLICY_HND)) == 0) ? False : 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; -} -- cgit From 99f1806af994dad5923c9e94b4a83ca094f991a4 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 15 Feb 2008 02:59:48 +0100 Subject: Remove unused marshalling for NET_SAM_DELTAS. Guenther (This used to be commit 2dd01f07411744f1f8fec0bff7af554db08ab960) --- source3/rpc_parse/parse_net.c | 135 ------------------------------------------ 1 file changed, 135 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 8105ac5470..b4ed470cce 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -2571,138 +2571,3 @@ bool net_io_r_sam_sync(const char *desc, 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; -} -- cgit From 34df32446df1167cddea2dd9a3fb3240e817f731 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 15 Feb 2008 14:24:31 +0100 Subject: Remove unused marshalling for NET_SAM_SYNC. Guenther (This used to be commit a94d93725a649c7a0ac1fcd61ea07579f65596da) --- source3/rpc_parse/parse_net.c | 1165 ----------------------------------------- 1 file changed, 1165 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index b4ed470cce..8677924d6a 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1406,1168 +1406,3 @@ bool net_io_r_sam_logoff(const char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps 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; inum_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; iattribute_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; iprivlist_count; i++) - if(!smb_io_unihdr("hdr_privslist", &info->hdr_privslist[i], ps, depth)) - return False; - - for (i=0; iprivlist_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; -} -- cgit From e3a975b7f3d6ceaf32bdc70963fd0af87e2ef1ff Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 15 Feb 2008 22:38:29 +0100 Subject: Remove unused marshalling for NET_SAM_LOGOFF. Guenther (This used to be commit b419e7fa32ce34ee1ddde562223fe08f5d07a012) --- source3/rpc_parse/parse_net.c | 48 ------------------------------------------- 1 file changed, 48 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 8677924d6a..b3a0997c7a 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1358,51 +1358,3 @@ bool net_io_r_sam_logon_ex(const char *desc, NET_R_SAM_LOGON_EX *r_l, prs_struct 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; -} -- cgit From 26106d2e39bd09e85aab81735bd901b2c438f155 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 16 Feb 2008 00:05:45 +0100 Subject: Remove unused marshalling for NET_REQ_CHAL and NET_AUTH2. Guenther (This used to be commit 2123aff75c8db431cb37d132058902287e740a85) --- source3/rpc_parse/parse_net.c | 142 ------------------------------------------ 1 file changed, 142 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index b3a0997c7a..1de6c9d163 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -46,80 +46,6 @@ static bool net_io_neg_flags(const char *desc, NEG_FLAGS *neg, prs_struct *ps, i 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. ********************************************************************/ @@ -167,74 +93,6 @@ bool net_io_r_auth(const char *desc, NET_R_AUTH *r_a, prs_struct *ps, int depth) 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. ********************************************************************/ -- cgit From 697f8904e7ec90aa5817c7903bf266e8d04c96b0 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 16 Feb 2008 16:06:55 +0100 Subject: Remove unused marshalling for NET_SRV_PWSET. Guenther (This used to be commit e48737f04d2324b604f3290904ec6163a6242ae5) --- source3/rpc_parse/parse_net.c | 68 ------------------------------------------- 1 file changed, 68 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 1de6c9d163..eab8e9b00d 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -164,74 +164,6 @@ bool net_io_r_auth_3(const char *desc, NET_R_AUTH_3 *r_a, prs_struct *ps, int de } -/******************************************************************* - 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 *************************************************************************/ -- cgit From 44bf22911a785c8d28caa26f40bd35ae84cef3f4 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 16 Feb 2008 20:29:49 +0100 Subject: Remove unused code, make fns static (This used to be commit 5c762c6d57dce1016ebe2613a75b492eeac84c3d) --- source3/rpc_parse/parse_sec.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'source3/rpc_parse') 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 @@ -26,29 +26,12 @@ #undef DBGC_CLASS #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; -- cgit From 966333e744f02cd1d3347d087686255d3ac9489f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sun, 17 Feb 2008 02:25:33 +0100 Subject: Remove unused marshalling for NET_SAM_LOGON. Guenther (This used to be commit eefc6bb86fb9196818da9d5c6384c85355794981) --- source3/rpc_parse/parse_net.c | 322 ------------------------------------------ 1 file changed, 322 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index eab8e9b00d..70dc505c78 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -163,62 +163,6 @@ bool net_io_r_auth_3(const char *desc, NET_R_AUTH_3 *r_a, prs_struct *ps, int de 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. ********************************************************************/ @@ -439,32 +383,6 @@ static bool net_io_id_info2(const char *desc, NET_ID_INFO_2 *id, prs_struct *ps 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. ********************************************************************/ @@ -523,42 +441,6 @@ static bool net_io_id_info_ctr(const char *desc, NET_ID_INFO_CTR **pp_ctr, prs_s 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. ********************************************************************/ @@ -588,137 +470,6 @@ static bool smb_io_sam_info_ex(const char *desc, DOM_SAM_INFO_EX *sam, prs_struc 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; @@ -1005,79 +756,6 @@ bool net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, 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) -- cgit From 41e93135cf23e86660ec64430b8765c405505c08 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sun, 17 Feb 2008 02:39:36 +0100 Subject: Remove unused marshalling for NET_AUTH. This must have been forgotten. Guenther (This used to be commit 7bbd64c16f8dda85275ddca0fd00849f890c6e4f) --- source3/rpc_parse/parse_net.c | 47 ------------------------------------------- 1 file changed, 47 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 70dc505c78..38ea7846b7 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -46,53 +46,6 @@ static bool net_io_neg_flags(const char *desc, NEG_FLAGS *neg, prs_struct *ps, i 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_3 struct. ********************************************************************/ -- cgit From 95b6f33da6277e3a3a8114f31cbe150524c4a7a8 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sun, 17 Feb 2008 02:50:11 +0100 Subject: Remove unused marshalling for NET_SAM_LOGON_EX and finally NET_USER_INFO_3. Guenther (This used to be commit ead1f11dd21b1df9a595295b3513c5f6088397c9) --- source3/rpc_parse/parse_net.c | 664 ------------------------------------------ 1 file changed, 664 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 38ea7846b7..c8f4862fc7 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -115,667 +115,3 @@ bool net_io_r_auth_3(const char *desc, NET_R_AUTH_3 *r_a, prs_struct *ps, int de return True; } - -/******************************************************************* - 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_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_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; -} - -static void dump_acct_flags(uint32 acct_flags) { - - int lvl = 10; - DEBUG(lvl,("dump_acct_flags\n")); - if (acct_flags & ACB_NORMAL) { - DEBUGADD(lvl,("\taccount has ACB_NORMAL\n")); - } - if (acct_flags & ACB_PWNOEXP) { - DEBUGADD(lvl,("\taccount has ACB_PWNOEXP\n")); - } - if (acct_flags & ACB_ENC_TXT_PWD_ALLOWED) { - DEBUGADD(lvl,("\taccount has ACB_ENC_TXT_PWD_ALLOWED\n")); - } - if (acct_flags & ACB_NOT_DELEGATED) { - DEBUGADD(lvl,("\taccount has ACB_NOT_DELEGATED\n")); - } - if (acct_flags & ACB_USE_DES_KEY_ONLY) { - DEBUGADD(lvl,("\taccount has ACB_USE_DES_KEY_ONLY set, sig verify wont work\n")); - } - if (acct_flags & ACB_NO_AUTH_DATA_REQD) { - DEBUGADD(lvl,("\taccount has ACB_NO_AUTH_DATA_REQD set\n")); - } - if (acct_flags & ACB_PW_EXPIRED) { - DEBUGADD(lvl,("\taccount has ACB_PW_EXPIRED set\n")); - } -} - -static void dump_user_flgs(uint32 user_flags) { - - int lvl = 10; - DEBUG(lvl,("dump_user_flgs\n")); - if (user_flags & NETLOGON_EXTRA_SIDS) { - DEBUGADD(lvl,("\taccount has NETLOGON_EXTRA_SIDS\n")); - } - if (user_flags & NETLOGON_RESOURCE_GROUPS) { - DEBUGADD(lvl,("\taccount has NETLOGON_RESOURCE_GROUPS\n")); - } - if (user_flags & NETLOGON_NTLMV2_ENABLED) { - DEBUGADD(lvl,("\taccount has NETLOGON_NTLMV2_ENABLED\n")); - } - if (user_flags & NETLOGON_CACHED_ACCOUNT) { - DEBUGADD(lvl,("\taccount has NETLOGON_CACHED_ACCOUNT\n")); - } - if (user_flags & NETLOGON_PROFILE_PATH_RETURNED) { - DEBUGADD(lvl,("\taccount has NETLOGON_PROFILE_PATH_RETURNED\n")); - } - if (user_flags & NETLOGON_SERVER_TRUST_ACCOUNT) { - DEBUGADD(lvl,("\taccount has NETLOGON_SERVER_TRUST_ACCOUNT\n")); - } - - -} - -/******************************************************************* - This code has been modified to cope with a NET_USER_INFO_2 - which is - exactly the same as a NET_USER_INFO_3, minus the other sids parameters. - We use validation level to determine if we're marshalling a info 2 or - INFO_3 - be we always return an INFO_3. Based on code donated by Marc - Jacobsen at HP. JRA. -********************************************************************/ - -bool net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, - int depth, uint16 validation_level, bool kerb_validation_level) -{ - unsigned int i; - - if (usr == NULL) - return False; - - prs_debug(ps, depth, desc, "net_io_user_info3"); - depth++; - - if (UNMARSHALLING(ps)) - ZERO_STRUCTP(usr); - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_user_info ", ps, depth, &usr->ptr_user_info)) - return False; - - if (usr->ptr_user_info == 0) - return True; - - if(!smb_io_time("logon time", &usr->logon_time, ps, depth)) /* logon time */ - return False; - if(!smb_io_time("logoff time", &usr->logoff_time, ps, depth)) /* logoff time */ - return False; - if(!smb_io_time("kickoff time", &usr->kickoff_time, ps, depth)) /* kickoff time */ - return False; - if(!smb_io_time("last set time", &usr->pass_last_set_time, ps, depth)) /* password last set time */ - return False; - if(!smb_io_time("can change time", &usr->pass_can_change_time , ps, depth)) /* password can change time */ - return False; - if(!smb_io_time("must change time", &usr->pass_must_change_time, ps, depth)) /* password must change time */ - return False; - - if(!smb_io_unihdr("hdr_user_name", &usr->hdr_user_name, ps, depth)) /* username unicode string header */ - return False; - if(!smb_io_unihdr("hdr_full_name", &usr->hdr_full_name, ps, depth)) /* user's full name unicode string header */ - return False; - if(!smb_io_unihdr("hdr_logon_script", &usr->hdr_logon_script, ps, depth)) /* logon script unicode string header */ - return False; - if(!smb_io_unihdr("hdr_profile_path", &usr->hdr_profile_path, ps, depth)) /* profile path unicode string header */ - return False; - if(!smb_io_unihdr("hdr_home_dir", &usr->hdr_home_dir, ps, depth)) /* home directory unicode string header */ - return False; - if(!smb_io_unihdr("hdr_dir_drive", &usr->hdr_dir_drive, ps, depth)) /* home directory drive unicode string header */ - return False; - - if(!prs_uint16("logon_count ", ps, depth, &usr->logon_count)) /* logon count */ - return False; - if(!prs_uint16("bad_pw_count ", ps, depth, &usr->bad_pw_count)) /* bad password count */ - return False; - - if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid)) /* User RID */ - return False; - if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid)) /* Group RID */ - return False; - if(!prs_uint32("num_groups ", ps, depth, &usr->num_groups)) /* num groups */ - return False; - if(!prs_uint32("buffer_groups ", ps, depth, &usr->buffer_groups)) /* undocumented buffer pointer to groups. */ - return False; - if(!prs_uint32("user_flgs ", ps, depth, &usr->user_flgs)) /* user flags */ - return False; - dump_user_flgs(usr->user_flgs); - if(!prs_uint8s(False, "user_sess_key", ps, depth, usr->user_sess_key, 16)) /* user session key */ - return False; - - if(!smb_io_unihdr("hdr_logon_srv", &usr->hdr_logon_srv, ps, depth)) /* logon server unicode string header */ - return False; - if(!smb_io_unihdr("hdr_logon_dom", &usr->hdr_logon_dom, ps, depth)) /* logon domain unicode string header */ - return False; - - if(!prs_uint32("buffer_dom_id ", ps, depth, &usr->buffer_dom_id)) /* undocumented logon domain id pointer */ - return False; - - if(!prs_uint8s(False, "lm_sess_key", ps, depth, usr->lm_sess_key, 8)) /* lm session key */ - return False; - - if(!prs_uint32("acct_flags ", ps, depth, &usr->acct_flags)) /* Account flags */ - return False; - dump_acct_flags(usr->acct_flags); - for (i = 0; i < 7; i++) - { - if (!prs_uint32("unkown", ps, depth, &usr->unknown[i])) /* unknown */ - return False; - } - - if (validation_level == 3) { - if(!prs_uint32("num_other_sids", ps, depth, &usr->num_other_sids)) /* 0 - num_sids */ - return False; - if(!prs_uint32("buffer_other_sids", ps, depth, &usr->buffer_other_sids)) /* NULL - undocumented pointer to SIDs. */ - return False; - } else { - if (UNMARSHALLING(ps)) { - usr->num_other_sids = 0; - usr->buffer_other_sids = 0; - } - } - - /* get kerb validation info (not really part of user_info_3) - Guenther */ - - if (kerb_validation_level) { - - if(!prs_uint32("ptr_res_group_dom_sid", ps, depth, &usr->ptr_res_group_dom_sid)) - return False; - if(!prs_uint32("res_group_count", ps, depth, &usr->res_group_count)) - return False; - if(!prs_uint32("ptr_res_groups", ps, depth, &usr->ptr_res_groups)) - return False; - } - - if(!smb_io_unistr2("uni_user_name", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */ - return False; - if(!smb_io_unistr2("uni_full_name", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth)) /* user's full name unicode string */ - return False; - if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */ - return False; - if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */ - return False; - if(!smb_io_unistr2("uni_home_dir", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth)) /* home directory unicode string */ - return False; - if(!smb_io_unistr2("uni_dir_drive", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth)) /* home directory drive unicode string */ - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_groups2 ", ps, depth, &usr->num_groups2)) /* num groups2 */ - return False; - - if (usr->num_groups != usr->num_groups2) { - DEBUG(3,("net_io_user_info3: num_groups mismatch! (%d != %d)\n", - usr->num_groups, usr->num_groups2)); - return False; - } - - if (UNMARSHALLING(ps)) { - if (usr->num_groups) { - usr->gids = PRS_ALLOC_MEM(ps, DOM_GID, usr->num_groups); - if (usr->gids == NULL) - return False; - } else { - usr->gids = NULL; - } - } - - for (i = 0; i < usr->num_groups; i++) { - if(!smb_io_gid("", &usr->gids[i], ps, depth)) /* group info */ - return False; - } - - if(!smb_io_unistr2("uni_logon_srv", &usr->uni_logon_srv, usr->hdr_logon_srv.buffer, ps, depth)) /* logon server unicode string */ - return False; - if(!smb_io_unistr2("uni_logon_dom", &usr->uni_logon_dom, usr->hdr_logon_dom.buffer, ps, depth)) /* logon domain unicode string */ - return False; - - if(!smb_io_dom_sid2("", &usr->dom_sid, ps, depth)) /* domain SID */ - return False; - - if (validation_level == 3 && usr->buffer_other_sids) { - - uint32 num_other_sids = usr->num_other_sids; - - if (!(usr->user_flgs & NETLOGON_EXTRA_SIDS)) { - DEBUG(10,("net_io_user_info3: user_flgs attribute does not have NETLOGON_EXTRA_SIDS\n")); - /* return False; */ - } - - if (!prs_uint32("num_other_sids", ps, depth, - &num_other_sids)) - return False; - - if (num_other_sids != usr->num_other_sids) - return False; - - if (UNMARSHALLING(ps)) { - if (usr->num_other_sids) { - usr->other_sids = PRS_ALLOC_MEM(ps, DOM_SID2, usr->num_other_sids); - usr->other_sids_attrib = - PRS_ALLOC_MEM(ps, uint32, usr->num_other_sids); - } else { - usr->other_sids = NULL; - usr->other_sids_attrib = NULL; - } - - if ((num_other_sids != 0) && - ((usr->other_sids == NULL) || - (usr->other_sids_attrib == NULL))) - return False; - } - - /* First the pointers to the SIDS and attributes */ - - depth++; - - for (i=0; inum_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_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; -} -- cgit From 95cd28299ec3764cc12c7ffb29b764d1a7cc4bee Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sun, 17 Feb 2008 02:53:23 +0100 Subject: Remove unused marshalling for NET_AUTH3. Guenther (This used to be commit ccf3ba0f5ce30d45a3d644552d1245391bf01754) --- source3/rpc_parse/parse_net.c | 91 ------------------------------------------- 1 file changed, 91 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index c8f4862fc7..5dcaccf1c3 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -24,94 +24,3 @@ #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 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; -} -- cgit From f68ddb1a1aa4209b5c79b81489b6f6fe9f319c25 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sun, 17 Feb 2008 02:57:16 +0100 Subject: Remove rpc_parse/parse_net.c and some last unused netlogon headers. Guenther (This used to be commit b9cc5cfaf9a87d342c23fa0f68f29050947b5102) --- source3/rpc_parse/parse_net.c | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 source3/rpc_parse/parse_net.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c deleted file mode 100644 index 5dcaccf1c3..0000000000 --- a/source3/rpc_parse/parse_net.c +++ /dev/null @@ -1,26 +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 . - */ - -#include "includes.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_RPC_PARSE -- cgit From 10c3957d040235b66be1de611aa66aed75e8bef3 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sun, 17 Feb 2008 03:10:21 +0100 Subject: Move policy_handle_is_valid out of parse_lsa.c Guenther (This used to be commit c396f45e7ddc8d6ce0efa0cda2996ca513ecbdb7) --- source3/rpc_parse/parse_lsa.c | 12 ------------ source3/rpc_parse/parse_misc.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 80e90a8265..3d65b9ca3b 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1206,15 +1206,3 @@ bool lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_stru return True; } - -/******************************************************************* - Reads or writes an LUID_ATTR structure. -********************************************************************/ - -bool policy_handle_is_valid(const POLICY_HND *hnd) -{ - POLICY_HND zero_pol; - - ZERO_STRUCT(zero_pol); - return ((memcmp(&zero_pol, hnd, sizeof(POLICY_HND)) == 0) ? False : True ); -} diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 9e1937ea32..418f857df8 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1859,4 +1859,14 @@ uint32 str_len_uni(UNISTR *source) return i; } +/******************************************************************* + Verifies policy handle +********************************************************************/ +bool policy_handle_is_valid(const POLICY_HND *hnd) +{ + POLICY_HND zero_pol; + + ZERO_STRUCT(zero_pol); + return ((memcmp(&zero_pol, hnd, sizeof(POLICY_HND)) == 0) ? false : true ); +} -- cgit From dbcd8b76a63f99e746c4f238e021a7692c29fa48 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sun, 17 Feb 2008 23:37:45 +0100 Subject: Remove unused marshalling for NTSVCS_GET_VERSION. Guenther (This used to be commit 58970cc6a8761c30bc4b772b28bb25a112cb684f) --- source3/rpc_parse/parse_ntsvcs.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_ntsvcs.c b/source3/rpc_parse/parse_ntsvcs.c index 5758517ca0..89ba2030fb 100644 --- a/source3/rpc_parse/parse_ntsvcs.c +++ b/source3/rpc_parse/parse_ntsvcs.c @@ -25,43 +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; -} - /******************************************************************* ********************************************************************/ -- cgit From 342d7fd099eb23a5fa8e416197f8f08e121ae86b Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sun, 17 Feb 2008 23:42:52 +0100 Subject: Remove unused marshalling for NTSVCS_VALIDATE_DEVICE_INSTANCE. Guenther (This used to be commit 8971afaf744e5124d4b82cad76e368ccd05be394) --- source3/rpc_parse/parse_ntsvcs.c | 43 ---------------------------------------- 1 file changed, 43 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_ntsvcs.c b/source3/rpc_parse/parse_ntsvcs.c index 89ba2030fb..86e8d9d952 100644 --- a/source3/rpc_parse/parse_ntsvcs.c +++ b/source3/rpc_parse/parse_ntsvcs.c @@ -134,49 +134,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) -- cgit From 9501a920c3b9c680bd0e16b941e084206afb1361 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 18 Feb 2008 00:24:57 +0100 Subject: Remove unused marshalling for NTSVCS_GET_DEVICE_LIST_SIZE. Guenther (This used to be commit bc1df536fa04e004ccf177e0f3ba56f3c47709aa) --- source3/rpc_parse/parse_ntsvcs.c | 53 ---------------------------------------- 1 file changed, 53 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_ntsvcs.c b/source3/rpc_parse/parse_ntsvcs.c index 86e8d9d952..faa7f8ddd3 100644 --- a/source3/rpc_parse/parse_ntsvcs.c +++ b/source3/rpc_parse/parse_ntsvcs.c @@ -22,59 +22,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/******************************************************************* -********************************************************************/ - -/******************************************************************* -********************************************************************/ - -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; -} - - /******************************************************************* ********************************************************************/ -- cgit From 7b5d9af374b432e52765dd23bb0b8e6a9696cf86 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 18 Feb 2008 01:10:37 +0100 Subject: Remove unused marshalling for NTSVCS_HW_PROFILE_FLAGS. Guenther (This used to be commit ddb3838be1ab5080add4db060432dfd007b1fd73) --- source3/rpc_parse/parse_ntsvcs.c | 73 ---------------------------------------- 1 file changed, 73 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_ntsvcs.c b/source3/rpc_parse/parse_ntsvcs.c index faa7f8ddd3..012b8fa0ef 100644 --- a/source3/rpc_parse/parse_ntsvcs.c +++ b/source3/rpc_parse/parse_ntsvcs.c @@ -218,76 +218,3 @@ bool ntsvcs_io_r_get_hw_profile_info(const char *desc, NTSVCS_R_GET_HW_PROFILE_I 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; -} - - - - -- cgit From f155008ca021d8f80eedbf4395a454d63193c524 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 18 Feb 2008 01:34:13 +0100 Subject: Remove unused marshalling for NTSVCS_GET_HW_PROFILE_INFO. Guenther (This used to be commit 2ec2eefc703df882599b6eac9147350c4df33006) --- source3/rpc_parse/parse_ntsvcs.c | 73 ---------------------------------------- 1 file changed, 73 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_ntsvcs.c b/source3/rpc_parse/parse_ntsvcs.c index 012b8fa0ef..2b15a45506 100644 --- a/source3/rpc_parse/parse_ntsvcs.c +++ b/source3/rpc_parse/parse_ntsvcs.c @@ -145,76 +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; -} -- cgit From 330fe0a62a29ff994e1520dae209eb4980a7259c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 18 Feb 2008 12:12:43 +0100 Subject: Remove unused marshalling for SVCCTL_OPEN_SCMANAGER. Guenther (This used to be commit 1162b8a02d365b79f5a3e86c936bae80092f1869) --- source3/rpc_parse/parse_svcctl.c | 53 ---------------------------------------- 1 file changed, 53 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index 18e12ef0a6..488f060e6e 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -198,59 +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) -- cgit From 6d95d7d9b9277e3aba6b43869a31fd3226ac697c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 18 Feb 2008 12:48:43 +0100 Subject: Remove unused marshalling for SVCCTL_OPEN_SERVICE. Guenther (This used to be commit e0a8818af0e3e82e9b70ff6c485090986b435fed) --- source3/rpc_parse/parse_svcctl.c | 52 ---------------------------------------- 1 file changed, 52 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index 488f060e6e..7fd13e8f21 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -266,58 +266,6 @@ bool svcctl_io_r_get_display_name(const char *desc, SVCCTL_R_GET_DISPLAY_NAME *r } -/******************************************************************* -********************************************************************/ - -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; -} - /******************************************************************* ********************************************************************/ -- cgit From 4673706e1d130555231b409baa270d7000267117 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 18 Feb 2008 13:45:36 +0100 Subject: Remove unused marshalling for SVCCTL_GET_DISPLAY_NAME. Guenther (This used to be commit 144f41e7c3c97afede71ed771acd130f9018f0df) --- source3/rpc_parse/parse_svcctl.c | 71 ---------------------------------------- 1 file changed, 71 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index 7fd13e8f21..f3ed8d1bf5 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -195,77 +195,6 @@ uint32 svcctl_sizeof_service_config( SERVICE_CONFIG *config ) return size; } -/******************************************************************* -********************************************************************/ - -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; -} - - /******************************************************************* ********************************************************************/ -- cgit From 196d84ad6814ca2d4ffd9a51a5ac0bcd608c7445 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 18 Feb 2008 17:04:50 +0100 Subject: Remove unused marshalling for LSA_LOOKUP_NAMES/2/3/4 Guenther (This used to be commit 6458ef3977b60f24b87eb88cf870a9f23929ca85) --- source3/rpc_parse/parse_lsa.c | 578 ------------------------------------------ 1 file changed, 578 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 3d65b9ca3b..81b6fc9e13 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -628,581 +628,3 @@ bool lsa_io_r_lookup_sids3(const char *desc, LSA_R_LOOKUP_SIDS3 *r_s, 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; -} -- cgit From d48f36819fe825de58f1e4feaab14a811ad53421 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 19 Feb 2008 01:19:44 +0100 Subject: Remove unused marshalling for LSA_LOOKUP_SIDS/2/3. This also removes parse_lsa.c entirely. Guenther (This used to be commit f802ba035c95e63c5a6ff9f2fb484d62341cd1a7) --- source3/rpc_parse/parse_lsa.c | 630 ------------------------------------------ 1 file changed, 630 deletions(-) delete mode 100644 source3/rpc_parse/parse_lsa.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c deleted file mode 100644 index 81b6fc9e13..0000000000 --- a/source3/rpc_parse/parse_lsa.c +++ /dev/null @@ -1,630 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1997, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, - * Copyright (C) Paul Ashton 1997, - * Copyright (C) Andrew Bartlett 2002, - * Copyright (C) Jim McDonough 2002. - * Copyright (C) Gerald )Jerry) Carter 2005 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#include "includes.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_RPC_PARSE - -static bool lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth); -static bool lsa_io_trans_names2(const char *desc, LSA_TRANS_NAME_ENUM2 *trn, prs_struct *ps, int depth); - -/******************************************************************* - Inits a LSA_TRANS_NAME structure. -********************************************************************/ - -void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, - uint16 sid_name_use, const char *name, uint32 idx) -{ - trn->sid_name_use = sid_name_use; - init_unistr2(uni_name, name, UNI_FLAGS_NONE); - init_uni_hdr(&trn->hdr_name, uni_name); - trn->domain_idx = idx; -} - -/******************************************************************* - Reads or writes a LSA_TRANS_NAME structure. -********************************************************************/ - -static bool lsa_io_trans_name(const char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_trans_name"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint16("sid_name_use", ps, depth, &trn->sid_name_use)) - return False; - if(!prs_align(ps)) - return False; - - if(!smb_io_unihdr ("hdr_name", &trn->hdr_name, ps, depth)) - return False; - if(!prs_uint32("domain_idx ", ps, depth, &trn->domain_idx)) - return False; - - return True; -} - -/******************************************************************* - Inits a LSA_TRANS_NAME2 structure. -********************************************************************/ - -void init_lsa_trans_name2(LSA_TRANS_NAME2 *trn, UNISTR2 *uni_name, - uint16 sid_name_use, const char *name, uint32 idx) -{ - trn->sid_name_use = sid_name_use; - init_unistr2(uni_name, name, UNI_FLAGS_NONE); - init_uni_hdr(&trn->hdr_name, uni_name); - trn->domain_idx = idx; - trn->unknown = 0; -} - -/******************************************************************* - Reads or writes a LSA_TRANS_NAME2 structure. -********************************************************************/ - -static bool lsa_io_trans_name2(const char *desc, LSA_TRANS_NAME2 *trn, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_trans_name2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint16("sid_name_use", ps, depth, &trn->sid_name_use)) - return False; - if(!prs_align(ps)) - return False; - - if(!smb_io_unihdr ("hdr_name", &trn->hdr_name, ps, depth)) - return False; - if(!prs_uint32("domain_idx ", ps, depth, &trn->domain_idx)) - return False; - if(!prs_uint32("unknown ", ps, depth, &trn->unknown)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a DOM_R_REF structure. -********************************************************************/ - -static bool lsa_io_dom_r_ref(const char *desc, DOM_R_REF *dom, prs_struct *ps, int depth) -{ - unsigned int i; - - prs_debug(ps, depth, desc, "lsa_io_dom_r_ref"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_ref_doms_1", ps, depth, &dom->num_ref_doms_1)) /* num referenced domains? */ - return False; - if(!prs_uint32("ptr_ref_dom ", ps, depth, &dom->ptr_ref_dom)) /* undocumented buffer pointer. */ - return False; - if(!prs_uint32("max_entries ", ps, depth, &dom->max_entries)) /* 32 - max number of entries */ - return False; - - SMB_ASSERT_ARRAY(dom->hdr_ref_dom, dom->num_ref_doms_1); - - if (dom->ptr_ref_dom != 0) { - - if(!prs_uint32("num_ref_doms_2", ps, depth, &dom->num_ref_doms_2)) /* 4 - num referenced domains? */ - return False; - - SMB_ASSERT_ARRAY(dom->ref_dom, dom->num_ref_doms_2); - - for (i = 0; i < dom->num_ref_doms_1; i++) { - fstring t; - - slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i); - if(!smb_io_unihdr(t, &dom->hdr_ref_dom[i].hdr_dom_name, ps, depth)) - return False; - - slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i); - if(!prs_uint32(t, ps, depth, &dom->hdr_ref_dom[i].ptr_dom_sid)) - return False; - } - - for (i = 0; i < dom->num_ref_doms_2; i++) { - fstring t; - - if (dom->hdr_ref_dom[i].hdr_dom_name.buffer != 0) { - slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i); - if(!smb_io_unistr2(t, &dom->ref_dom[i].uni_dom_name, True, ps, depth)) /* domain name unicode string */ - return False; - if(!prs_align(ps)) - return False; - } - - if (dom->hdr_ref_dom[i].ptr_dom_sid != 0) { - slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i); - if(!smb_io_dom_sid2(t, &dom->ref_dom[i].ref_dom, ps, depth)) /* referenced domain SIDs */ - return False; - } - } - } - - return True; -} - -/******************************************************************* - Inits a LSA_SID_ENUM structure. -********************************************************************/ - -static void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, - int num_entries, const DOM_SID *sids) -{ - int i; - - DEBUG(5, ("init_lsa_sid_enum\n")); - - sen->num_entries = num_entries; - sen->ptr_sid_enum = (num_entries != 0); - sen->num_entries2 = num_entries; - - /* Allocate memory for sids and sid pointers */ - - if (num_entries) { - if ((sen->ptr_sid = TALLOC_ZERO_ARRAY(mem_ctx, uint32, num_entries )) == NULL) { - DEBUG(3, ("init_lsa_sid_enum(): out of memory for ptr_sid\n")); - return; - } - - if ((sen->sid = TALLOC_ZERO_ARRAY(mem_ctx, DOM_SID2, num_entries)) == NULL) { - DEBUG(3, ("init_lsa_sid_enum(): out of memory for sids\n")); - return; - } - } - - /* Copy across SIDs and SID pointers */ - - for (i = 0; i < num_entries; i++) { - sen->ptr_sid[i] = 1; - init_dom_sid2(&sen->sid[i], &sids[i]); - } -} - -/******************************************************************* - Reads or writes a LSA_SID_ENUM structure. -********************************************************************/ - -static bool lsa_io_sid_enum(const char *desc, LSA_SID_ENUM *sen, prs_struct *ps, - int depth) -{ - unsigned int i; - - prs_debug(ps, depth, desc, "lsa_io_sid_enum"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_entries ", ps, depth, &sen->num_entries)) - return False; - if(!prs_uint32("ptr_sid_enum", ps, depth, &sen->ptr_sid_enum)) - return False; - - /* - if the ptr is NULL, leave here. checked from a real w2k trace. - JFM, 11/23/2001 - */ - - if (sen->ptr_sid_enum==0) - return True; - - if(!prs_uint32("num_entries2", ps, depth, &sen->num_entries2)) - return False; - - /* Mallocate memory if we're unpacking from the wire */ - - if (UNMARSHALLING(ps) && sen->num_entries) { - if ((sen->ptr_sid = PRS_ALLOC_MEM( ps, uint32, sen->num_entries)) == NULL) { - DEBUG(3, ("init_lsa_sid_enum(): out of memory for " - "ptr_sid\n")); - return False; - } - - if ((sen->sid = PRS_ALLOC_MEM( ps, DOM_SID2, sen->num_entries)) == NULL) { - DEBUG(3, ("init_lsa_sid_enum(): out of memory for " - "sids\n")); - return False; - } - } - - for (i = 0; i < sen->num_entries; i++) { - fstring temp; - - slprintf(temp, sizeof(temp) - 1, "ptr_sid[%d]", i); - if(!prs_uint32(temp, ps, depth, &sen->ptr_sid[i])) { - return False; - } - } - - for (i = 0; i < sen->num_entries; i++) { - fstring temp; - - slprintf(temp, sizeof(temp) - 1, "sid[%d]", i); - if(!smb_io_dom_sid2(temp, &sen->sid[i], ps, depth)) { - return False; - } - } - - return True; -} - -/******************************************************************* - Inits an LSA_R_ENUM_TRUST_DOM structure. -********************************************************************/ - -void init_q_lookup_sids(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_SIDS *q_l, - POLICY_HND *hnd, int num_sids, const DOM_SID *sids, - uint16 level) -{ - DEBUG(5, ("init_q_lookup_sids\n")); - - ZERO_STRUCTP(q_l); - - memcpy(&q_l->pol, hnd, sizeof(q_l->pol)); - init_lsa_sid_enum(mem_ctx, &q_l->sids, num_sids, sids); - - q_l->level = level; -} - -/******************************************************************* - Reads or writes a LSA_Q_LOOKUP_SIDS structure. -********************************************************************/ - -bool lsa_io_q_lookup_sids(const char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol_hnd", &q_s->pol, ps, depth)) /* policy handle */ - return False; - if(!lsa_io_sid_enum("sids ", &q_s->sids, ps, depth)) /* sids to be looked up */ - return False; - if(!lsa_io_trans_names("names ", &q_s->names, ps, depth)) /* translated names */ - return False; - - if(!prs_uint16("level", ps, depth, &q_s->level)) /* lookup level */ - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("mapped_count", ps, depth, &q_s->mapped_count)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a LSA_Q_LOOKUP_SIDS2 structure. -********************************************************************/ - -bool lsa_io_q_lookup_sids2(const char *desc, LSA_Q_LOOKUP_SIDS2 *q_s, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol_hnd", &q_s->pol, ps, depth)) /* policy handle */ - return False; - if(!lsa_io_sid_enum("sids ", &q_s->sids, ps, depth)) /* sids to be looked up */ - return False; - if(!lsa_io_trans_names2("names ", &q_s->names, ps, depth)) /* translated names */ - return False; - - if(!prs_uint16("level", ps, depth, &q_s->level)) /* lookup level */ - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("mapped_count", ps, depth, &q_s->mapped_count)) - return False; - if(!prs_uint32("unknown1", ps, depth, &q_s->unknown1)) - return False; - if(!prs_uint32("unknown2", ps, depth, &q_s->unknown2)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a LSA_Q_LOOKUP_SIDS3 structure. -********************************************************************/ - -bool lsa_io_q_lookup_sids3(const char *desc, LSA_Q_LOOKUP_SIDS3 *q_s, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids3"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!lsa_io_sid_enum("sids ", &q_s->sids, ps, depth)) /* sids to be looked up */ - return False; - if(!lsa_io_trans_names2("names ", &q_s->names, ps, depth)) /* translated names */ - return False; - - if(!prs_uint16("level", ps, depth, &q_s->level)) /* lookup level */ - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("mapped_count", ps, depth, &q_s->mapped_count)) - return False; - if(!prs_uint32("unknown1", ps, depth, &q_s->unknown1)) - return False; - if(!prs_uint32("unknown2", ps, depth, &q_s->unknown2)) - return False; - - return True; -} - - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, - prs_struct *ps, int depth) -{ - unsigned int i; - - prs_debug(ps, depth, desc, "lsa_io_trans_names"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_entries ", ps, depth, &trn->num_entries)) - return False; - if(!prs_uint32("ptr_trans_names", ps, depth, &trn->ptr_trans_names)) - return False; - - if (trn->ptr_trans_names != 0) { - if(!prs_uint32("num_entries2 ", ps, depth, - &trn->num_entries2)) - return False; - - if (trn->num_entries2 != trn->num_entries) { - /* RPC fault */ - return False; - } - - if (UNMARSHALLING(ps) && trn->num_entries2) { - if ((trn->name = PRS_ALLOC_MEM(ps, LSA_TRANS_NAME, trn->num_entries2)) == NULL) { - return False; - } - - if ((trn->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, trn->num_entries2)) == NULL) { - return False; - } - } - - for (i = 0; i < trn->num_entries2; i++) { - fstring t; - slprintf(t, sizeof(t) - 1, "name[%d] ", i); - - if(!lsa_io_trans_name(t, &trn->name[i], ps, depth)) /* translated name */ - return False; - } - - for (i = 0; i < trn->num_entries2; i++) { - fstring t; - slprintf(t, sizeof(t) - 1, "name[%d] ", i); - - if(!smb_io_unistr2(t, &trn->uni_name[i], trn->name[i].hdr_name.buffer, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - } - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool lsa_io_trans_names2(const char *desc, LSA_TRANS_NAME_ENUM2 *trn, - prs_struct *ps, int depth) -{ - unsigned int i; - - prs_debug(ps, depth, desc, "lsa_io_trans_names2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_entries ", ps, depth, &trn->num_entries)) - return False; - if(!prs_uint32("ptr_trans_names", ps, depth, &trn->ptr_trans_names)) - return False; - - if (trn->ptr_trans_names != 0) { - if(!prs_uint32("num_entries2 ", ps, depth, - &trn->num_entries2)) - return False; - - if (trn->num_entries2 != trn->num_entries) { - /* RPC fault */ - return False; - } - - if (UNMARSHALLING(ps) && trn->num_entries2) { - if ((trn->name = PRS_ALLOC_MEM(ps, LSA_TRANS_NAME2, trn->num_entries2)) == NULL) { - return False; - } - - if ((trn->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, trn->num_entries2)) == NULL) { - return False; - } - } - - for (i = 0; i < trn->num_entries2; i++) { - fstring t; - slprintf(t, sizeof(t) - 1, "name[%d] ", i); - - if(!lsa_io_trans_name2(t, &trn->name[i], ps, depth)) /* translated name */ - return False; - } - - for (i = 0; i < trn->num_entries2; i++) { - fstring t; - slprintf(t, sizeof(t) - 1, "name[%d] ", i); - - if(!smb_io_unistr2(t, &trn->uni_name[i], trn->name[i].hdr_name.buffer, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - } - } - - return True; -} - - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool lsa_io_r_lookup_sids(const char *desc, LSA_R_LOOKUP_SIDS *r_s, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_lookup_sids"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_dom_ref", ps, depth, &r_s->ptr_dom_ref)) - return False; - - if (r_s->ptr_dom_ref != 0) - if(!lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth)) /* domain reference info */ - return False; - - if(!lsa_io_trans_names("names ", &r_s->names, ps, depth)) /* translated names */ - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("mapped_count", ps, depth, &r_s->mapped_count)) - return False; - - if(!prs_ntstatus("status ", ps, depth, &r_s->status)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool lsa_io_r_lookup_sids2(const char *desc, LSA_R_LOOKUP_SIDS2 *r_s, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_lookup_sids2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_dom_ref", ps, depth, &r_s->ptr_dom_ref)) - return False; - - if (r_s->ptr_dom_ref != 0) - if(!lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth)) /* domain reference info */ - return False; - - if(!lsa_io_trans_names2("names ", &r_s->names, ps, depth)) /* translated names */ - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("mapped_count", ps, depth, &r_s->mapped_count)) - return False; - - if(!prs_ntstatus("status ", ps, depth, &r_s->status)) - return False; - - return True; -} - - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool lsa_io_r_lookup_sids3(const char *desc, LSA_R_LOOKUP_SIDS3 *r_s, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_lookup_sids3"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_dom_ref", ps, depth, &r_s->ptr_dom_ref)) - return False; - - if (r_s->ptr_dom_ref != 0) - if(!lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth)) /* domain reference info */ - return False; - - if(!lsa_io_trans_names2("names ", &r_s->names, ps, depth)) /* translated names */ - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("mapped_count", ps, depth, &r_s->mapped_count)) - return False; - - if(!prs_ntstatus("status ", ps, depth, &r_s->status)) - return False; - - return True; -} -- cgit From a750bbf1b8d0d2b48af6be40f8d505b5e0edd899 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 19 Feb 2008 02:30:53 +0100 Subject: Remove unused marshalling for SVCCTL_START_SERVICE. Guenther (This used to be commit 57e03a7fd56062bbff19c88c3b6928e8a0481794) --- source3/rpc_parse/parse_svcctl.c | 44 ---------------------------------------- 1 file changed, 44 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index f3ed8d1bf5..075d619331 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -302,50 +302,6 @@ bool svcctl_io_r_enum_services_status(const char *desc, SVCCTL_R_ENUM_SERVICES_S return True; } -/******************************************************************* -********************************************************************/ - -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; -} - - /******************************************************************* ********************************************************************/ -- cgit From 35e48a4b1dfa3d63476fca105766da1ec980b446 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 19 Feb 2008 02:37:32 +0100 Subject: Remove unused marshalling for SVCCTL_CONTROL_SERVICE. Guenther (This used to be commit 84112a24f5292b8d2e4d446e39462e0402453b4a) --- source3/rpc_parse/parse_svcctl.c | 47 ---------------------------------------- 1 file changed, 47 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index 075d619331..0f39de0746 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -358,53 +358,6 @@ bool svcctl_io_r_enum_dependent_services(const char *desc, SVCCTL_R_ENUM_DEPENDE return True; } -/******************************************************************* -********************************************************************/ - -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; -} - - /******************************************************************* ********************************************************************/ -- cgit From c147f2fd6b5d8f319b2cf6903da093211f46e575 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 19 Feb 2008 02:43:56 +0100 Subject: Remove unused marshalling for SVCCTL_QUERY_STATUS. Guenther (This used to be commit 8a621f517fe38ce91f10e12fccc2963af6afc33d) --- source3/rpc_parse/parse_svcctl.c | 43 ---------------------------------------- 1 file changed, 43 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index 0f39de0746..ef9f03705d 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -198,49 +198,6 @@ uint32 svcctl_sizeof_service_config( SERVICE_CONFIG *config ) /******************************************************************* ********************************************************************/ -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) -- cgit From 35a30ac841583326e81c27a18e93e53de9bdfc4f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 19 Feb 2008 02:48:08 +0100 Subject: Remove unused marshalling for SVCCTL_LOCK_SERVICE_DB. Guenther (This used to be commit 23d37a9aed145d38e2bd98b170b65096ab69b0d9) --- source3/rpc_parse/parse_svcctl.c | 44 ---------------------------------------- 1 file changed, 44 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index ef9f03705d..d5b1466535 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -593,50 +593,6 @@ bool svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVIC /******************************************************************* ********************************************************************/ -bool svcctl_io_q_lock_service_db(const char *desc, SVCCTL_Q_LOCK_SERVICE_DB *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "svcctl_io_q_lock_service_db"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("scm_handle", &q_u->handle, ps, depth)) - return False; - - return True; - -} - -/******************************************************************* -********************************************************************/ - -bool svcctl_io_r_lock_service_db(const char *desc, SVCCTL_R_LOCK_SERVICE_DB *r_u, prs_struct *ps, int depth) -{ - if ( !r_u ) - return False; - - prs_debug(ps, depth, desc, "svcctl_io_r_lock_service_db"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("lock_handle", &r_u->h_lock, ps, depth)) - return False; - - if(!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - bool svcctl_io_q_unlock_service_db(const char *desc, SVCCTL_Q_UNLOCK_SERVICE_DB *q_u, prs_struct *ps, int depth) { if (q_u == NULL) -- cgit From 1c9990fcfe7ac36050351f7c2b99d1e3e044a01a Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 19 Feb 2008 02:50:54 +0100 Subject: Remove unused marshalling for SVCCTL_UNLOCK_SERVICE_DB. Guenther (This used to be commit eeb598a19a3d09f2175032e013857fe743da3eec) --- source3/rpc_parse/parse_svcctl.c | 41 ---------------------------------------- 1 file changed, 41 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index d5b1466535..ececf1b5ed 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -593,47 +593,6 @@ bool svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVIC /******************************************************************* ********************************************************************/ -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) -- cgit From 8a1249817e8642de20095527db0c37ee3c4bd077 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 28 Feb 2008 00:16:46 +0100 Subject: Remove unused marshalling for SVCCTL_QUERY_SERVICE_SEC. Guenther (This used to be commit a69c6422bb7b1ab64236cbab193d54fd90c106f0) --- source3/rpc_parse/parse_svcctl.c | 51 ---------------------------------------- 1 file changed, 51 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index ececf1b5ed..cd08dbef1f 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -593,57 +593,6 @@ bool svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVIC /******************************************************************* ********************************************************************/ -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) -- cgit From edacb74344961d366828087e6f95c19a698e6e0e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 28 Feb 2008 00:34:45 +0100 Subject: Remove unused marshalling for SVCCTL_SET_SERVICE_SEC. Guenther (This used to be commit 9ac2606d5214f1bf4a8ec2ac46bcaeba62e56992) --- source3/rpc_parse/parse_svcctl.c | 56 ---------------------------------------- 1 file changed, 56 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index cd08dbef1f..62c1e21927 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -589,59 +589,3 @@ bool svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVIC 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; -} - - - - -- cgit From 986005db133c6f0449b28251b7a765e22d667933 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 4 Mar 2008 23:26:27 +0100 Subject: Remove unused marshalling for SRV_NET_SRV_GET_INFO. Guenther (This used to be commit 53a7e9b07d07d3e9d21360dee35fee27b46929b3) --- source3/rpc_parse/parse_srv.c | 155 ------------------------------------------ 1 file changed, 155 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 954aa80600..8561e16428 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -2618,18 +2618,6 @@ bool srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_stru return True; } -/******************************************************************* - Inits a SRV_INFO_100 structure. - ********************************************************************/ - -void init_srv_info_100(SRV_INFO_100 *sv100, uint32 platform_id, const char *name) -{ - DEBUG(5,("init_srv_info_100\n")); - - sv100->platform_id = platform_id; - init_buf_unistr2(&sv100->uni_name, &sv100->ptr_name, name); -} - /******************************************************************* Reads or writes a SRV_INFO_101 structure. ********************************************************************/ @@ -2656,25 +2644,6 @@ static bool srv_io_info_100(const char *desc, SRV_INFO_100 *sv100, prs_struct *p return True; } - -/******************************************************************* - Inits a SRV_INFO_101 structure. - ********************************************************************/ - -void init_srv_info_101(SRV_INFO_101 *sv101, uint32 platform_id, const char *name, - uint32 ver_major, uint32 ver_minor, - uint32 srv_type, const char *comment) -{ - DEBUG(5,("init_srv_info_101\n")); - - sv101->platform_id = platform_id; - init_buf_unistr2(&sv101->uni_name, &sv101->ptr_name, name); - sv101->ver_major = ver_major; - sv101->ver_minor = ver_minor; - sv101->srv_type = srv_type; - init_buf_unistr2(&sv101->uni_comment, &sv101->ptr_comment, comment); -} - /******************************************************************* Reads or writes a SRV_INFO_101 structure. ********************************************************************/ @@ -2714,41 +2683,6 @@ static bool srv_io_info_101(const char *desc, SRV_INFO_101 *sv101, prs_struct *p return True; } -/******************************************************************* - Inits a SRV_INFO_102 structure. - ********************************************************************/ - -void init_srv_info_102(SRV_INFO_102 *sv102, uint32 platform_id, const char *name, - const char *comment, uint32 ver_major, uint32 ver_minor, - uint32 srv_type, uint32 users, uint32 disc, uint32 hidden, - uint32 announce, uint32 ann_delta, uint32 licenses, - const char *usr_path) -{ - DEBUG(5,("init_srv_info_102\n")); - - sv102->platform_id = platform_id; - init_buf_unistr2(&sv102->uni_name, &sv102->ptr_name, name); - sv102->ver_major = ver_major; - sv102->ver_minor = ver_minor; - sv102->srv_type = srv_type; - init_buf_unistr2(&sv102->uni_comment, &sv102->ptr_comment, comment); - - /* same as 101 up to here */ - - sv102->users = users; - sv102->disc = disc; - sv102->hidden = hidden; - sv102->announce = announce; - sv102->ann_delta = ann_delta; - sv102->licenses = licenses; - init_buf_unistr2(&sv102->uni_usr_path, &sv102->ptr_usr_path, usr_path); -} - - -/******************************************************************* - Reads or writes a SRV_INFO_102 structure. - ********************************************************************/ - static bool srv_io_info_102(const char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth) { if (sv102 == NULL) @@ -2850,71 +2784,6 @@ static bool srv_io_info_ctr(const char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, return True; } -/******************************************************************* - Inits a SRV_Q_NET_SRV_GET_INFO structure. - ********************************************************************/ - -void init_srv_q_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *srv, - const char *server_name, uint32 switch_value) -{ - DEBUG(5,("init_srv_q_net_srv_get_info\n")); - - init_buf_unistr2(&srv->uni_srv_name, &srv->ptr_srv_name, server_name); - - srv->switch_value = switch_value; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_srv_get_info(const char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_srv_get_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) - return False; - - return True; -} - -/******************************************************************* - Inits a SRV_R_NET_SRV_GET_INFO structure. - ********************************************************************/ - -void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv, - uint32 switch_value, SRV_INFO_CTR *ctr, WERROR status) -{ - DEBUG(5,("init_srv_r_net_srv_get_info\n")); - - srv->ctr = ctr; - - if (W_ERROR_IS_OK(status)) { - srv->ctr->switch_value = switch_value; - srv->ctr->ptr_srv_ctr = 1; - } else { - srv->ctr->switch_value = 0; - srv->ctr->ptr_srv_ctr = 0; - } - - srv->status = status; -} - /******************************************************************* Inits a SRV_R_NET_SRV_SET_INFO structure. ********************************************************************/ @@ -2965,30 +2834,6 @@ bool srv_io_q_net_srv_set_info(const char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, return True; } -/******************************************************************* - Reads or writes a structure. - ********************************************************************/ - -bool srv_io_r_net_srv_get_info(const char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_srv_get_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - /******************************************************************* Reads or writes a structure. ********************************************************************/ -- cgit From 2b5d47a093f0329159fe3f16316fd55e3b49e1a5 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 4 Mar 2008 23:40:53 +0100 Subject: Remove unused marshalling for SRV_NET_SRV_SET_INFO. Guenther (This used to be commit a7aef18797407b1f451191647d4b0225ac838817) --- source3/rpc_parse/parse_srv.c | 238 ------------------------------------------ 1 file changed, 238 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 8561e16428..136aed5f16 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -2618,244 +2618,6 @@ bool srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_stru return True; } -/******************************************************************* - Reads or writes a SRV_INFO_101 structure. - ********************************************************************/ - -static bool srv_io_info_100(const char *desc, SRV_INFO_100 *sv100, prs_struct *ps, int depth) -{ - if (sv100 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_info_100"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("platform_id ", ps, depth, &sv100->platform_id)) - return False; - if(!prs_uint32("ptr_name ", ps, depth, &sv100->ptr_name)) - return False; - - if(!smb_io_unistr2("uni_name ", &sv100->uni_name, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a SRV_INFO_101 structure. - ********************************************************************/ - -static bool srv_io_info_101(const char *desc, SRV_INFO_101 *sv101, prs_struct *ps, int depth) -{ - if (sv101 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_info_101"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("platform_id ", ps, depth, &sv101->platform_id)) - return False; - if(!prs_uint32("ptr_name ", ps, depth, &sv101->ptr_name)) - return False; - if(!prs_uint32("ver_major ", ps, depth, &sv101->ver_major)) - return False; - if(!prs_uint32("ver_minor ", ps, depth, &sv101->ver_minor)) - return False; - if(!prs_uint32("srv_type ", ps, depth, &sv101->srv_type)) - return False; - if(!prs_uint32("ptr_comment ", ps, depth, &sv101->ptr_comment)) - return False; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("uni_name ", &sv101->uni_name, True, ps, depth)) - return False; - if(!smb_io_unistr2("uni_comment ", &sv101->uni_comment, True, ps, depth)) - return False; - - return True; -} - -static bool srv_io_info_102(const char *desc, SRV_INFO_102 *sv102, prs_struct *ps, int depth) -{ - if (sv102 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_info102"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("platform_id ", ps, depth, &sv102->platform_id)) - return False; - if(!prs_uint32("ptr_name ", ps, depth, &sv102->ptr_name)) - return False; - if(!prs_uint32("ver_major ", ps, depth, &sv102->ver_major)) - return False; - if(!prs_uint32("ver_minor ", ps, depth, &sv102->ver_minor)) - return False; - if(!prs_uint32("srv_type ", ps, depth, &sv102->srv_type)) - return False; - if(!prs_uint32("ptr_comment ", ps, depth, &sv102->ptr_comment)) - return False; - - /* same as 101 up to here */ - - if(!prs_uint32("users ", ps, depth, &sv102->users)) - return False; - if(!prs_uint32("disc ", ps, depth, &sv102->disc)) - return False; - if(!prs_uint32("hidden ", ps, depth, &sv102->hidden)) - return False; - if(!prs_uint32("announce ", ps, depth, &sv102->announce)) - return False; - if(!prs_uint32("ann_delta ", ps, depth, &sv102->ann_delta)) - return False; - if(!prs_uint32("licenses ", ps, depth, &sv102->licenses)) - return False; - if(!prs_uint32("ptr_usr_path", ps, depth, &sv102->ptr_usr_path)) - return False; - - if(!smb_io_unistr2("uni_name ", &sv102->uni_name, True, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("uni_comment ", &sv102->uni_comment, True, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("uni_usr_path", &sv102->uni_usr_path, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a SRV_INFO_102 structure. - ********************************************************************/ - -static bool srv_io_info_ctr(const char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, int depth) -{ - if (ctr == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_info_ctr"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) - return False; - if(!prs_uint32("ptr_srv_ctr ", ps, depth, &ctr->ptr_srv_ctr)) - return False; - - if (ctr->ptr_srv_ctr != 0 && ctr->switch_value != 0 && ctr != NULL) { - switch (ctr->switch_value) { - case 100: - if(!srv_io_info_100("sv100", &ctr->srv.sv100, ps, depth)) - return False; - break; - case 101: - if(!srv_io_info_101("sv101", &ctr->srv.sv101, ps, depth)) - return False; - break; - case 102: - if(!srv_io_info_102("sv102", &ctr->srv.sv102, ps, depth)) - return False; - break; - default: - DEBUG(5,("%s no server info at switch_value %d\n", - tab_depth(5,depth), ctr->switch_value)); - break; - } - if(!prs_align(ps)) - return False; - } - - return True; -} - -/******************************************************************* - Inits a SRV_R_NET_SRV_SET_INFO structure. - ********************************************************************/ - -void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv, - uint32 switch_value, WERROR status) -{ - DEBUG(5,("init_srv_r_net_srv_set_info\n")); - - srv->switch_value = switch_value; - srv->status = status; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_srv_set_info(const char *desc, SRV_Q_NET_SRV_SET_INFO *q_n, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "srv_io_q_net_srv_set_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) - return False; - - if (UNMARSHALLING(ps)) { - q_n->ctr = PRS_ALLOC_MEM(ps, SRV_INFO_CTR, 1); - - if (!q_n->ctr) - return False; - } - - if(!srv_io_info_ctr("ctr", q_n->ctr, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. - ********************************************************************/ - -bool srv_io_r_net_srv_set_info(const char *desc, SRV_R_NET_SRV_SET_INFO *r_n, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "srv_io_r_net_srv_set_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("switch value ", ps, depth, &r_n->switch_value)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - /******************************************************************* Reads or writes a structure. ********************************************************************/ -- cgit From 1bdce8e5b5bffaa05f3741f22ab4dec3a7038094 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 5 Mar 2008 10:40:52 +0100 Subject: Remove unused marshalling for SRV_NET_REMOTE_TOD. Guenther (This used to be commit 9f0ea1d727046fef4c23bcf1e71d10f33c93b00f) --- source3/rpc_parse/parse_srv.c | 130 ------------------------------------------ 1 file changed, 130 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 136aed5f16..a09e704bed 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -2618,125 +2618,6 @@ bool srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_stru return True; } -/******************************************************************* - Reads or writes a structure. - ********************************************************************/ - -bool srv_io_q_net_remote_tod(const char *desc, SRV_Q_NET_REMOTE_TOD *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_remote_tod"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a TIME_OF_DAY_INFO structure. - ********************************************************************/ - -static bool srv_io_time_of_day_info(const char *desc, TIME_OF_DAY_INFO *tod, prs_struct *ps, int depth) -{ - if (tod == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_time_of_day_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("elapsedt ", ps, depth, &tod->elapsedt)) - return False; - if(!prs_uint32("msecs ", ps, depth, &tod->msecs)) - return False; - if(!prs_uint32("hours ", ps, depth, &tod->hours)) - return False; - if(!prs_uint32("mins ", ps, depth, &tod->mins)) - return False; - if(!prs_uint32("secs ", ps, depth, &tod->secs)) - return False; - if(!prs_uint32("hunds ", ps, depth, &tod->hunds)) - return False; - if(!prs_uint32("timezone ", ps, depth, &tod->zone)) - return False; - if(!prs_uint32("tintervals ", ps, depth, &tod->tintervals)) - return False; - if(!prs_uint32("day ", ps, depth, &tod->day)) - return False; - if(!prs_uint32("month ", ps, depth, &tod->month)) - return False; - if(!prs_uint32("year ", ps, depth, &tod->year)) - return False; - if(!prs_uint32("weekday ", ps, depth, &tod->weekday)) - return False; - - return True; -} - -/******************************************************************* - Inits a TIME_OF_DAY_INFO structure. - ********************************************************************/ - -void init_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs, - uint32 hours, uint32 mins, uint32 secs, uint32 hunds, - uint32 zone, uint32 tintervals, uint32 day, - uint32 month, uint32 year, uint32 weekday) -{ - DEBUG(5,("init_time_of_day_info\n")); - - tod->elapsedt = elapsedt; - tod->msecs = msecs; - tod->hours = hours; - tod->mins = mins; - tod->secs = secs; - tod->hunds = hunds; - tod->zone = zone; - tod->tintervals = tintervals; - tod->day = day; - tod->month = month; - tod->year = year; - tod->weekday = weekday; -} - - -/******************************************************************* - Reads or writes a structure. - ********************************************************************/ - -bool srv_io_r_net_remote_tod(const char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_remote_tod"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_tod ", ps, depth, &r_n->ptr_srv_tod)) - return False; - - if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - /******************************************************************* initialises a structure. ********************************************************************/ @@ -3098,14 +2979,3 @@ bool srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC return True; } - -/******************************************************************* - Inits a structure -********************************************************************/ - -void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server) -{ - q_u->ptr_srv_name = 1; - init_unistr2(&q_u->uni_srv_name, server, UNI_STR_TERMINATE); -} - -- cgit From e931f28db76bd38de0ba3087e1faabc9f698db8b Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 7 Mar 2008 23:47:40 +0100 Subject: Remove unused marshalling for SRV_NET_SHARE_DEL. Guenther (This used to be commit 2afae94936d4fbd3b1e804111bff1960c2b852bd) --- source3/rpc_parse/parse_srv.c | 64 ------------------------------------------- 1 file changed, 64 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index a09e704bed..44777db8af 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1521,70 +1521,6 @@ bool srv_io_r_net_share_add(const char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_stru return True; } -/******************************************************************* - initialises a structure. -********************************************************************/ - -void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname, - const char *sharename) -{ - del->ptr_srv_name = 1; - init_unistr2(&del->uni_srv_name, srvname, UNI_STR_TERMINATE); - init_unistr2(&del->uni_share_name, sharename, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_share_del(const char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_share_del"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - if(!prs_uint32("reserved", ps, depth, &q_n->reserved)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_r_net_share_del(const char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_share_del"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &q_n->status)) - return False; - - return True; -} - /******************************************************************* Inits a SESS_INFO_0_STR structure ********************************************************************/ -- cgit From 91710a5f853d639bbfb97bd7677c8dcc15a028e4 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 7 Mar 2008 23:50:00 +0100 Subject: Remove unused marshalling for SRV_NET_NAME_VALIDATE. Guenther (This used to be commit 6ffd6c814fafe4112fe72a96a0893d5be06f4380) --- source3/rpc_parse/parse_srv.c | 58 ------------------------------------------- 1 file changed, 58 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 44777db8af..b4cc08748b 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -2693,64 +2693,6 @@ bool srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_stru return True; } -/******************************************************************* - Reads or writes a structure. - ********************************************************************/ - -bool srv_io_q_net_name_validate(const char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_name_validate"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_pointer("servername", ps, depth, (void*)&q_n->servername, - sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) - return False; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("", &q_n->sharename, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("type", ps, depth, &q_n->type)) - return False; - - if(!prs_uint32("flags", ps, depth, &q_n->flags)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. - ********************************************************************/ - -bool srv_io_r_net_name_validate(const char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_name_validate"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - /******************************************************************* Reads or writes a structure. ********************************************************************/ -- cgit From 7192e40deedaa6d73d612491235e8c4ee4345adf Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 8 Mar 2008 01:02:54 +0100 Subject: Remove unused marshalling for SRV_NET_FILE_SET_SECDESC and SRV_R_NET_FILE_GET_SECDESC. Guenther (This used to be commit 776e21075b31db605e45f91b6ccefd11412d7773) --- source3/rpc_parse/parse_srv.c | 165 ------------------------------------------ 1 file changed, 165 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index b4cc08748b..9e42ef6158 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -2692,168 +2692,3 @@ bool srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_stru return True; } - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_file_query_secdesc(const char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_file_query_secdesc"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth)) - return False; - - if(!prs_uint32("unknown1", ps, depth, &q_n->unknown1)) - return False; - - if(!prs_uint32("unknown2", ps, depth, &q_n->unknown2)) - return False; - - if(!prs_uint32("unknown3", ps, depth, &q_n->unknown3)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_r_net_file_query_secdesc(const char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_file_query_secdesc"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_response", ps, depth, &r_n->ptr_response)) - return False; - - if(!prs_uint32("size_response", ps, depth, &r_n->size_response)) - return False; - - if(!prs_uint32("ptr_secdesc", ps, depth, &r_n->ptr_secdesc)) - return False; - - if(!prs_uint32("size_secdesc", ps, depth, &r_n->size_secdesc)) - return False; - - if(!sec_io_desc("sec_desc", &r_n->sec_desc, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_file_set_secdesc(const char *desc, SRV_Q_NET_FILE_SET_SECDESC *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_file_set_secdesc"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_qual_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_file_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("sec_info", ps, depth, &q_n->sec_info)) - return False; - - if(!prs_uint32("size_set", ps, depth, &q_n->size_set)) - return False; - - if(!prs_uint32("ptr_secdesc", ps, depth, &q_n->ptr_secdesc)) - return False; - - if(!prs_uint32("size_secdesc", ps, depth, &q_n->size_secdesc)) - return False; - - if(!sec_io_desc("sec_desc", &q_n->sec_desc, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_r_net_file_set_secdesc(const char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_file_set_secdesc"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} -- cgit From 11e4e58f17aa94c088b09310421fe02ab7375730 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 10 Mar 2008 16:26:56 +0100 Subject: Remove unused marshalling for SRV_NET_SHARE_{ENUM,ADD,SETINFO,GETINFO} Guenther (This used to be commit e13b9325d251777cd9030f34fa98e22766c0bcfe) --- source3/rpc_parse/parse_srv.c | 1493 ----------------------------------------- 1 file changed, 1493 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 9e42ef6158..30b3539395 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -28,1499 +28,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/******************************************************************* - Inits a SH_INFO_0_STR structure -********************************************************************/ - -void init_srv_share_info0_str(SH_INFO_0_STR *sh0, const char *net_name) -{ - DEBUG(5,("init_srv_share_info0_str\n")); - - init_unistr2(&sh0->uni_netname, net_name, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info0_str(const char *desc, SH_INFO_0_STR *sh0, prs_struct *ps, int depth) -{ - if (sh0 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info0_str"); - depth++; - - if(!prs_align(ps)) - return False; - if(sh0->ptrs->ptr_netname) - if(!smb_io_unistr2("", &sh0->uni_netname, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - makes a SH_INFO_0 structure -********************************************************************/ - -void init_srv_share_info0(SH_INFO_0 *sh0, const char *net_name) -{ - DEBUG(5,("init_srv_share_info0: %s\n", net_name)); - - sh0->ptr_netname = (net_name != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info0(const char *desc, SH_INFO_0 *sh0, prs_struct *ps, int depth) -{ - if (sh0 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info0"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_netname", ps, depth, &sh0->ptr_netname)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_1_STR structure -********************************************************************/ - -void init_srv_share_info1_str(SH_INFO_1_STR *sh1, const char *net_name, const char *remark) -{ - DEBUG(5,("init_srv_share_info1_str\n")); - - init_unistr2(&sh1->uni_netname, net_name, UNI_STR_TERMINATE); - init_unistr2(&sh1->uni_remark, remark, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1_str(const char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth) -{ - if (sh1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if(sh1->ptrs->ptr_netname) - if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(sh1->ptrs->ptr_remark) - if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - makes a SH_INFO_1 structure -********************************************************************/ - -void init_srv_share_info1(SH_INFO_1 *sh1, const char *net_name, uint32 type, const char *remark) -{ - DEBUG(5,("init_srv_share_info1: %s %8x %s\n", net_name, type, remark)); - - sh1->ptr_netname = (net_name != NULL) ? 1 : 0; - sh1->type = type; - sh1->ptr_remark = (remark != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1(const char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) -{ - if (sh1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_netname", ps, depth, &sh1->ptr_netname)) - return False; - if(!prs_uint32("type ", ps, depth, &sh1->type)) - return False; - if(!prs_uint32("ptr_remark ", ps, depth, &sh1->ptr_remark)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_2_STR structure -********************************************************************/ - -void init_srv_share_info2_str(SH_INFO_2_STR *sh2, - const char *net_name, const char *remark, - const char *path, const char *passwd) -{ - DEBUG(5,("init_srv_share_info2_str\n")); - - init_unistr2(&sh2->uni_netname, net_name, UNI_STR_TERMINATE); - init_unistr2(&sh2->uni_remark, remark, UNI_STR_TERMINATE); - init_unistr2(&sh2->uni_path, path, UNI_STR_TERMINATE); - init_unistr2(&sh2->uni_passwd, passwd, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info2_str(const char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) -{ - if (sh2 == NULL) - return False; - - if (UNMARSHALLING(ps)) - ZERO_STRUCTP(sh2); - - prs_debug(ps, depth, desc, "srv_io_share_info2_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if (sh->ptr_netname) - if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth)) - return False; - - if (sh->ptr_remark) - if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth)) - return False; - - if (sh->ptr_netname) - if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth)) - return False; - - if (sh->ptr_passwd) - if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_2 structure -********************************************************************/ - -void init_srv_share_info2(SH_INFO_2 *sh2, - const char *net_name, uint32 type, const char *remark, - uint32 perms, uint32 max_uses, uint32 num_uses, - const char *path, const char *passwd) -{ - DEBUG(5,("init_srv_share_info2: %s %8x %s\n", net_name, type, remark)); - - sh2->ptr_netname = (net_name != NULL) ? 1 : 0; - sh2->type = type; - sh2->ptr_remark = (remark != NULL) ? 1 : 0; - sh2->perms = perms; - sh2->max_uses = max_uses; - sh2->num_uses = num_uses; - sh2->ptr_path = (path != NULL) ? 1 : 0; - sh2->ptr_passwd = (passwd != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info2(const char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) -{ - if (sh2 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_netname", ps, depth, &sh2->ptr_netname)) - return False; - if(!prs_uint32("type ", ps, depth, &sh2->type)) - return False; - if(!prs_uint32("ptr_remark ", ps, depth, &sh2->ptr_remark)) - return False; - if(!prs_uint32("perms ", ps, depth, &sh2->perms)) - return False; - if(!prs_uint32("max_uses ", ps, depth, &sh2->max_uses)) - return False; - if(!prs_uint32("num_uses ", ps, depth, &sh2->num_uses)) - return False; - if(!prs_uint32("ptr_path ", ps, depth, &sh2->ptr_path)) - return False; - if(!prs_uint32("ptr_passwd ", ps, depth, &sh2->ptr_passwd)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_501_STR structure -********************************************************************/ - -void init_srv_share_info501_str(SH_INFO_501_STR *sh501, - const char *net_name, const char *remark) -{ - DEBUG(5,("init_srv_share_info501_str\n")); - - init_unistr2(&sh501->uni_netname, net_name, UNI_STR_TERMINATE); - init_unistr2(&sh501->uni_remark, remark, UNI_STR_TERMINATE); -} - -/******************************************************************* - Inits a SH_INFO_2 structure -*******************************************************************/ - -void init_srv_share_info501(SH_INFO_501 *sh501, const char *net_name, uint32 type, const char *remark, uint32 csc_policy) -{ - DEBUG(5,("init_srv_share_info501: %s %8x %s %08x\n", net_name, type, - remark, csc_policy)); - - ZERO_STRUCTP(sh501); - - sh501->ptr_netname = (net_name != NULL) ? 1 : 0; - sh501->type = type; - sh501->ptr_remark = (remark != NULL) ? 1 : 0; - sh501->csc_policy = csc_policy; -} - -/******************************************************************* - Reads of writes a structure. -*******************************************************************/ - -static bool srv_io_share_info501(const char *desc, SH_INFO_501 *sh501, prs_struct *ps, int depth) -{ - if (sh501 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info501"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("ptr_netname", ps, depth, &sh501->ptr_netname)) - return False; - if (!prs_uint32("type ", ps, depth, &sh501->type)) - return False; - if (!prs_uint32("ptr_remark ", ps, depth, &sh501->ptr_remark)) - return False; - if (!prs_uint32("csc_policy ", ps, depth, &sh501->csc_policy)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info501_str(const char *desc, SH_INFO_501_STR *sh501, prs_struct *ps, int depth) -{ - if (sh501 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info501_str"); - depth++; - - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("", &sh501->uni_netname, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("", &sh501->uni_remark, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_502 structure -********************************************************************/ - -void init_srv_share_info502(SH_INFO_502 *sh502, - const char *net_name, uint32 type, const char *remark, - uint32 perms, uint32 max_uses, uint32 num_uses, - const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size) -{ - DEBUG(5,("init_srv_share_info502: %s %8x %s\n", net_name, type, remark)); - - ZERO_STRUCTP(sh502); - - sh502->ptr_netname = (net_name != NULL) ? 1 : 0; - sh502->type = type; - sh502->ptr_remark = (remark != NULL) ? 1 : 0; - sh502->perms = perms; - sh502->max_uses = max_uses; - sh502->num_uses = num_uses; - sh502->ptr_path = (path != NULL) ? 1 : 0; - sh502->ptr_passwd = (passwd != NULL) ? 1 : 0; - sh502->reserved = 0; /* actual size within rpc */ - sh502->sd_size = (uint32)sd_size; - sh502->ptr_sd = (psd != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info502(const char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth) -{ - if (sh502 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info502"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_netname", ps, depth, &sh502->ptr_netname)) - return False; - if(!prs_uint32("type ", ps, depth, &sh502->type)) - return False; - if(!prs_uint32("ptr_remark ", ps, depth, &sh502->ptr_remark)) - return False; - if(!prs_uint32("perms ", ps, depth, &sh502->perms)) - return False; - if(!prs_uint32("max_uses ", ps, depth, &sh502->max_uses)) - return False; - if(!prs_uint32("num_uses ", ps, depth, &sh502->num_uses)) - return False; - if(!prs_uint32("ptr_path ", ps, depth, &sh502->ptr_path)) - return False; - if(!prs_uint32("ptr_passwd ", ps, depth, &sh502->ptr_passwd)) - return False; - if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &sh502->reserved_offset)) - return False; - if(!prs_uint32("ptr_sd ", ps, depth, &sh502->ptr_sd)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_502_STR structure -********************************************************************/ - -void init_srv_share_info502_str(SH_INFO_502_STR *sh502str, - const char *net_name, const char *remark, - const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size) -{ - DEBUG(5,("init_srv_share_info502_str\n")); - - init_unistr2(&sh502str->uni_netname, net_name, UNI_STR_TERMINATE); - init_unistr2(&sh502str->uni_remark, remark, UNI_STR_TERMINATE); - init_unistr2(&sh502str->uni_path, path, UNI_STR_TERMINATE); - init_unistr2(&sh502str->uni_passwd, passwd, UNI_STR_TERMINATE); - sh502str->sd = psd; - sh502str->reserved = 0; - sh502str->sd_size = sd_size; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info502_str(const char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth) -{ - if (sh502 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info502_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if(sh502->ptrs->ptr_netname) { - if(!smb_io_unistr2("", &sh502->uni_netname, True, ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - - if(sh502->ptrs->ptr_remark) { - if(!smb_io_unistr2("", &sh502->uni_remark, True, ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - - if(sh502->ptrs->ptr_path) { - if(!smb_io_unistr2("", &sh502->uni_path, True, ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - - if(sh502->ptrs->ptr_passwd) { - if(!smb_io_unistr2("", &sh502->uni_passwd, True, ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - - if(sh502->ptrs->ptr_sd) { - uint32 old_offset; - uint32 reserved_offset; - - if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &reserved_offset)) - return False; - - old_offset = prs_offset(ps); - - if (!sec_io_desc(desc, &sh502->sd, ps, depth)) - return False; - - if(UNMARSHALLING(ps)) { - - sh502->ptrs->sd_size = sh502->sd_size = - ndr_size_security_descriptor(sh502->sd, 0); - - prs_set_offset(ps, old_offset + sh502->reserved); - } - - prs_align(ps); - - if(MARSHALLING(ps)) { - - sh502->ptrs->reserved = sh502->reserved = prs_offset(ps) - old_offset; - } - - if(!prs_uint32_post("reserved ", ps, depth, - &sh502->reserved, reserved_offset, sh502->reserved)) - return False; - if(!prs_uint32_post("reserved ", ps, depth, - &sh502->ptrs->reserved, sh502->ptrs->reserved_offset, sh502->ptrs->reserved)) - return False; - } - - return True; -} - -/******************************************************************* - Inits a SH_INFO_1004_STR structure -********************************************************************/ - -void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, const char *remark) -{ - DEBUG(5,("init_srv_share_info1004_str\n")); - - init_unistr2(&sh1004->uni_remark, remark, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1004_str(const char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth) -{ - if (sh1004 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1004_str"); - depth++; - - if(!prs_align(ps)) - return False; - if(sh1004->ptrs->ptr_remark) - if(!smb_io_unistr2("", &sh1004->uni_remark, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - makes a SH_INFO_1004 structure -********************************************************************/ - -void init_srv_share_info1004(SH_INFO_1004 *sh1004, const char *remark) -{ - DEBUG(5,("init_srv_share_info1004: %s\n", remark)); - - sh1004->ptr_remark = (remark != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1004(const char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth) -{ - if (sh1004 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1004"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_remark", ps, depth, &sh1004->ptr_remark)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1005(const char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth) -{ - if(sh1005 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1005"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("share_info_flags", ps, depth, - &sh1005->share_info_flags)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1006(const char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth) -{ - if(sh1006 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1006"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("max uses ", ps, depth, &sh1006->max_uses)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_1007_STR structure -********************************************************************/ - -void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate_directory_name) -{ - DEBUG(5,("init_srv_share_info1007_str\n")); - - init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1007_str(const char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth) -{ - if (sh1007 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1007_str"); - depth++; - - if(!prs_align(ps)) - return False; - if(sh1007->ptrs->ptr_AlternateDirectoryName) - if(!smb_io_unistr2("", &sh1007->uni_AlternateDirectoryName, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - makes a SH_INFO_1007 structure -********************************************************************/ - -void init_srv_share_info1007(SH_INFO_1007 *sh1007, uint32 flags, const char *alternate_directory_name) -{ - DEBUG(5,("init_srv_share_info1007: %s\n", alternate_directory_name)); - - sh1007->flags = flags; - sh1007->ptr_AlternateDirectoryName = (alternate_directory_name != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1007(const char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth) -{ - if (sh1007 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1007"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("flags ", ps, depth, &sh1007->flags)) - return False; - if(!prs_uint32("ptr_Alter..", ps, depth, &sh1007->ptr_AlternateDirectoryName)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1501(const char* desc, SRV_SHARE_INFO_1501* sh1501, - prs_struct* ps, int depth) -{ - if(sh1501 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1501"); - depth++; - - if(!prs_align(ps)) - return False; - - if (!sec_io_desc_buf(desc, &sh1501->sdb, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth) -{ - if (ctr == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_share_ctr"); - depth++; - - if (UNMARSHALLING(ps)) { - memset(ctr, '\0', sizeof(SRV_SHARE_INFO_CTR)); - } - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("info_level", ps, depth, &ctr->info_level)) - return False; - - if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) - return False; - if(!prs_uint32("ptr_share_info", ps, depth, &ctr->ptr_share_info)) - return False; - - if (ctr->ptr_share_info == 0) - return True; - - if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries)) - return False; - if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries)) - return False; - - if (ctr->ptr_entries == 0) { - if (ctr->num_entries == 0) - return True; - else - return False; - } - - if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2)) - return False; - - if (ctr->num_entries2 != ctr->num_entries) - return False; - - switch (ctr->switch_value) { - - case 0: - { - SRV_SHARE_INFO_0 *info0 = ctr->share.info0; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info0 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_0, num_entries))) - return False; - ctr->share.info0 = info0; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info0("", &info0[i].info_0, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - info0[i].info_0_str.ptrs = &info0[i].info_0; - if(!srv_io_share_info0_str("", &info0[i].info_0_str, ps, depth)) - return False; - } - - break; - } - - case 1: - { - SRV_SHARE_INFO_1 *info1 = ctr->share.info1; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info1 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_1, num_entries))) - return False; - ctr->share.info1 = info1; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1("", &info1[i].info_1, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - info1[i].info_1_str.ptrs = &info1[i].info_1; - if(!srv_io_share_info1_str("", &info1[i].info_1_str, ps, depth)) - return False; - } - - break; - } - - case 2: - { - SRV_SHARE_INFO_2 *info2 = ctr->share.info2; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info2 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_2,num_entries))) - return False; - ctr->share.info2 = info2; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info2("", &info2[i].info_2, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info2_str("", &info2[i].info_2, &info2[i].info_2_str, ps, depth)) - return False; - } - - break; - } - - case 501: - { - SRV_SHARE_INFO_501 *info501 = ctr->share.info501; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info501 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_501, num_entries))) - return False; - ctr->share.info501 = info501; - } - - for (i = 0; i < num_entries; i++) { - if (!srv_io_share_info501("", &info501[i].info_501, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - if (!srv_io_share_info501_str("", &info501[i].info_501_str, ps, depth)) - return False; - } - - break; - } - - case 502: - { - SRV_SHARE_INFO_502 *info502 = ctr->share.info502; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info502 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_502,num_entries))) - return False; - ctr->share.info502 = info502; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info502("", &info502[i].info_502, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - info502[i].info_502_str.ptrs = &info502[i].info_502; - if(!srv_io_share_info502_str("", &info502[i].info_502_str, ps, depth)) - return False; - } - - break; - } - - case 1004: - { - SRV_SHARE_INFO_1004 *info1004 = ctr->share.info1004; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info1004 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1004,num_entries))) - return False; - ctr->share.info1004 = info1004; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1004("", &info1004[i].info_1004, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - info1004[i].info_1004_str.ptrs = &info1004[i].info_1004; - if(!srv_io_share_info1004_str("", &info1004[i].info_1004_str, ps, depth)) - return False; - } - - break; - } - - case 1005: - { - SRV_SHARE_INFO_1005 *info1005 = ctr->share.info1005; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info1005 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1005,num_entries))) - return False; - ctr->share.info1005 = info1005; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1005("", &info1005[i], ps, depth)) - return False; - } - - break; - } - - case 1006: - { - SRV_SHARE_INFO_1006 *info1006 = ctr->share.info1006; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info1006 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1006,num_entries))) - return False; - ctr->share.info1006 = info1006; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1006("", &info1006[i], ps, depth)) - return False; - } - - break; - } - - case 1007: - { - SRV_SHARE_INFO_1007 *info1007 = ctr->share.info1007; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info1007 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1007,num_entries))) - return False; - ctr->share.info1007 = info1007; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1007("", &info1007[i].info_1007, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - info1007[i].info_1007_str.ptrs = &info1007[i].info_1007; - if(!srv_io_share_info1007_str("", &info1007[i].info_1007_str, ps, depth)) - return False; - } - - break; - } - - case 1501: - { - SRV_SHARE_INFO_1501 *info1501 = ctr->share.info1501; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info1501 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1501,num_entries))) - return False; - ctr->share.info1501 = info1501; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1501("", &info1501[i], ps, depth)) - return False; - } - - break; - } - - default: - DEBUG(5,("%s no share info at switch_value %d\n", - tab_depth(5,depth), ctr->switch_value)); - break; - } - - return True; -} - -/******************************************************************* - Inits a SRV_Q_NET_SHARE_ENUM structure. -********************************************************************/ - -void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, - const char *srv_name, uint32 info_level, - uint32 preferred_len, ENUM_HND *hnd) -{ - - DEBUG(5,("init_q_net_share_enum\n")); - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - - q_n->ctr.info_level = q_n->ctr.switch_value = info_level; - q_n->ctr.ptr_share_info = 1; - q_n->ctr.num_entries = 0; - q_n->ctr.ptr_entries = 0; - q_n->ctr.num_entries2 = 0; - q_n->preferred_len = preferred_len; - - memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_share_enum(const char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_share_enum"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!srv_io_srv_share_ctr("share_ctr", &q_n->ctr, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) - return False; - - if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_r_net_share_enum(const char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_share_enum"); - depth++; - - if(!srv_io_srv_share_ctr("share_ctr", &r_n->ctr, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) - return False; - - if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - initialises a structure. -********************************************************************/ - -bool init_srv_q_net_share_get_info(SRV_Q_NET_SHARE_GET_INFO *q_n, const char *srv_name, const char *share_name, uint32 info_level) -{ - - uint32 ptr_share_name; - - DEBUG(5,("init_srv_q_net_share_get_info\n")); - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name); - - q_n->info_level = info_level; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_share_get_info(const char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_share_get_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("info_level", ps, depth, &q_n->info_level)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_srv_share_info(const char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_share_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value )) - return False; - - if(!prs_uint32("ptr_share_ctr", ps, depth, &r_n->ptr_share_ctr)) - return False; - - if (r_n->ptr_share_ctr != 0) { - switch (r_n->switch_value) { - case 0: - if(!srv_io_share_info0("", &r_n->share.info0.info_0, ps, depth)) - return False; - - /* allow access to pointers in the str part. */ - r_n->share.info0.info_0_str.ptrs = &r_n->share.info0.info_0; - - if(!srv_io_share_info0_str("", &r_n->share.info0.info_0_str, ps, depth)) - return False; - - break; - case 1: - if(!srv_io_share_info1("", &r_n->share.info1.info_1, ps, depth)) - return False; - - /* allow access to pointers in the str part. */ - r_n->share.info1.info_1_str.ptrs = &r_n->share.info1.info_1; - - if(!srv_io_share_info1_str("", &r_n->share.info1.info_1_str, ps, depth)) - return False; - - break; - case 2: - if(!srv_io_share_info2("", &r_n->share.info2.info_2, ps, depth)) - return False; - - if(!srv_io_share_info2_str("", &r_n->share.info2.info_2, &r_n->share.info2.info_2_str, ps, depth)) - return False; - - break; - case 501: - if (!srv_io_share_info501("", &r_n->share.info501.info_501, ps, depth)) - return False; - if (!srv_io_share_info501_str("", &r_n->share.info501.info_501_str, ps, depth)) - return False; - break; - - case 502: - if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth)) - return False; - - /* allow access to pointers in the str part. */ - r_n->share.info502.info_502_str.ptrs = &r_n->share.info502.info_502; - - if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth)) - return False; - break; - case 1004: - if(!srv_io_share_info1004("", &r_n->share.info1004.info_1004, ps, depth)) - return False; - - /* allow access to pointers in the str part. */ - r_n->share.info1004.info_1004_str.ptrs = &r_n->share.info1004.info_1004; - - if(!srv_io_share_info1004_str("", &r_n->share.info1004.info_1004_str, ps, depth)) - return False; - break; - case 1005: - if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth)) - return False; - break; - case 1006: - if(!srv_io_share_info1006("", &r_n->share.info1006, ps, depth)) - return False; - break; - case 1007: - if(!srv_io_share_info1007("", &r_n->share.info1007.info_1007, ps, depth)) - return False; - - /* allow access to pointers in the str part. */ - r_n->share.info1007.info_1007_str.ptrs = &r_n->share.info1007.info_1007; - - if(!srv_io_share_info1007_str("", &r_n->share.info1007.info_1007_str, ps, depth)) - return False; - break; - case 1501: - if (!srv_io_share_info1501("", &r_n->share.info1501, ps, depth)) - return False; - default: - DEBUG(5,("%s no share info at switch_value %d\n", - tab_depth(5,depth), r_n->switch_value)); - break; - } - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_r_net_share_get_info(const char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_share_get_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!srv_io_srv_share_info("info ", ps, depth, &r_n->info)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - intialises a structure. -********************************************************************/ - -bool init_srv_q_net_share_set_info(SRV_Q_NET_SHARE_SET_INFO *q_n, - const char *srv_name, - const char *share_name, - uint32 info_level, - const SRV_SHARE_INFO *info) -{ - - uint32 ptr_share_name; - - DEBUG(5,("init_srv_q_net_share_set_info\n")); - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name); - - q_n->info_level = info_level; - - q_n->info = *info; - - q_n->ptr_parm_error = 1; - q_n->parm_error = 0; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_share_set_info(const char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_share_set_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("info_level", ps, depth, &q_n->info_level)) - return False; - - if(!prs_align(ps)) - return False; - - if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info)) - return False; - - if(!prs_align(ps)) - return False; - if(!prs_uint32("ptr_parm_error", ps, depth, &q_n->ptr_parm_error)) - return False; - if(q_n->ptr_parm_error!=0) { - if(!prs_uint32("parm_error", ps, depth, &q_n->parm_error)) - return False; - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_r_net_share_set_info(const char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_share_set_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_parm_error ", ps, depth, &r_n->ptr_parm_error)) - return False; - - if(r_n->ptr_parm_error) { - - if(!prs_uint32("parm_error ", ps, depth, &r_n->parm_error)) - return False; - } - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_share_add(const char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_share_add"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("info_level", ps, depth, &q_n->info_level)) - return False; - - if(!prs_align(ps)) - return False; - - if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_err_index", ps, depth, &q_n->ptr_err_index)) - return False; - if (q_n->ptr_err_index) - if (!prs_uint32("err_index", ps, depth, &q_n->err_index)) - return False; - - return True; -} - -void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname, - const char *netname, uint32 type, const char *remark, - uint32 perms, uint32 max_uses, uint32 num_uses, - const char *path, const char *passwd, - int level, SEC_DESC *sd) -{ - switch(level) { - case 502: { - size_t sd_size = ndr_size_security_descriptor(sd, 0); - q->ptr_srv_name = 1; - init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE); - q->info.switch_value = q->info_level = level; - q->info.ptr_share_ctr = 1; - init_srv_share_info502(&q->info.share.info502.info_502, netname, type, - remark, perms, max_uses, num_uses, path, passwd, sd, sd_size); - init_srv_share_info502_str(&q->info.share.info502.info_502_str, netname, - remark, path, passwd, sd, sd_size); - q->ptr_err_index = 1; - q->err_index = 0; - } - break; - case 2: - default: - q->ptr_srv_name = 1; - init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE); - q->info.switch_value = q->info_level = level; - q->info.ptr_share_ctr = 1; - init_srv_share_info2(&q->info.share.info2.info_2, netname, type, - remark, perms, max_uses, num_uses, path, passwd); - init_srv_share_info2_str(&q->info.share.info2.info_2_str, netname, - remark, path, passwd); - q->ptr_err_index = 1; - q->err_index = 0; - break; - } -} - - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_r_net_share_add(const char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_share_add"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_parm_error", ps, depth, &r_n->ptr_parm_error)) - return False; - - if(r_n->ptr_parm_error) { - - if(!prs_uint32("parm_error", ps, depth, &r_n->parm_error)) - return False; - } - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - /******************************************************************* Inits a SESS_INFO_0_STR structure ********************************************************************/ -- cgit From 663d147aca21fbf1f9d1890073de2a6f4d005435 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 10 Mar 2008 16:50:27 +0100 Subject: Remove unused marshalling for SRV_NET_SESS_DEL. Guenther (This used to be commit 3bb9ec441ae9702007a5442c52bb9476f928810f) --- source3/rpc_parse/parse_srv.c | 73 ------------------------------------------- 1 file changed, 73 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 30b3539395..ec214d31f6 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -334,79 +334,6 @@ bool srv_io_r_net_sess_enum(const char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_stru return True; } -/******************************************************************* - Inits a SRV_Q_NET_SESS_DEL structure. -********************************************************************/ - -void init_srv_q_net_sess_del(SRV_Q_NET_SESS_DEL *q_n, const char *srv_name, - const char *cli_name, const char *user_name) -{ - DEBUG(5,("init_q_net_sess_enum\n")); - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - init_buf_unistr2(&q_n->uni_cli_name, &q_n->ptr_cli_name, cli_name); - init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_sess_del(const char *desc, SRV_Q_NET_SESS_DEL *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_sess_del"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_cli_name", ps, depth, &q_n->ptr_cli_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_cli_name, q_n->ptr_cli_name, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_r_net_sess_del(const char *desc, SRV_R_NET_SESS_DEL *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_sess_del"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - /******************************************************************* Inits a CONN_INFO_0 structure ********************************************************************/ -- cgit From 08188dc72e4e962e58145b51f52ae880ce1ff8c4 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 12 Mar 2008 16:18:54 +0100 Subject: Remove unused marshalling for SRV_NET_DISK_ENUM. Guenther (This used to be commit 4928f1efceb8cb0b0fda813e6f43f668084caa79) --- source3/rpc_parse/parse_srv.c | 139 ------------------------------------------ 1 file changed, 139 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index ec214d31f6..b18484893c 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -987,142 +987,3 @@ bool srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_stru return True; } - -/******************************************************************* - initialises a structure. - ********************************************************************/ - -bool init_srv_q_net_disk_enum(SRV_Q_NET_DISK_ENUM *q_n, - const char *srv_name, - uint32 preferred_len, - ENUM_HND *enum_hnd - ) -{ - - - DEBUG(5,("init_srv_q_net_srv_disk_enum\n")); - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - - q_n->disk_enum_ctr.level = 0; - q_n->disk_enum_ctr.disk_info_ptr = 0; - - q_n->preferred_len = preferred_len; - memcpy(&q_n->enum_hnd, enum_hnd, sizeof(*enum_hnd)); - - return True; -} - -/******************************************************************* - Reads or writes a structure. - ********************************************************************/ - -bool srv_io_q_net_disk_enum(const char *desc, SRV_Q_NET_DISK_ENUM *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_disk_enum"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("level", ps, depth, &q_n->disk_enum_ctr.level)) - return False; - - if(!prs_uint32("entries_read", ps, depth, &q_n->disk_enum_ctr.entries_read)) - return False; - - if(!prs_uint32("buffer", ps, depth, &q_n->disk_enum_ctr.disk_info_ptr)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) - return False; - if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. - ********************************************************************/ - -bool srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps, int depth) -{ - - unsigned int i; - uint32 entries_read, entries_read2, entries_read3; - - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_disk_enum"); - depth++; - - entries_read = entries_read2 = entries_read3 = r_n->disk_enum_ctr.entries_read; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("entries_read", ps, depth, &entries_read)) - return False; - if(!prs_uint32("ptr_disk_info", ps, depth, &r_n->disk_enum_ctr.disk_info_ptr)) - return False; - - /*this may be max, unknown, actual?*/ - - if(!prs_uint32("max_elements", ps, depth, &entries_read2)) - return False; - if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.unknown)) - return False; - if(!prs_uint32("actual_elements", ps, depth, &entries_read3)) - return False; - - r_n->disk_enum_ctr.entries_read = entries_read3; - - if(UNMARSHALLING(ps) && entries_read3) { - - DISK_INFO *dinfo; - - if(!(dinfo = PRS_ALLOC_MEM(ps, DISK_INFO, entries_read3))) - return False; - r_n->disk_enum_ctr.disk_info = dinfo; - } - - for(i=0; i < entries_read3; i++) { - - if(!prs_uint32("unknown", ps, depth, &r_n->disk_enum_ctr.disk_info[i].unknown)) - return False; - - if(!smb_io_unistr3("disk_name", &r_n->disk_enum_ctr.disk_info[i].disk_name, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - } - - if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) - return False; - - if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} -- cgit From e06aa46b9fab1e107fea8f6453fb13deffa91e96 Mon Sep 17 00:00:00 2001 From: Marc VanHeyningen Date: Fri, 14 Mar 2008 14:26:28 -0800 Subject: Coverity fixes (This used to be commit 3fc85d22590550f0539215d020e4411bf5b14363) --- source3/rpc_parse/parse_buffer.c | 6 ++++-- source3/rpc_parse/parse_misc.c | 27 ++++++++++++++++++--------- source3/rpc_parse/parse_prs.c | 2 +- 3 files changed, 23 insertions(+), 12 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index e98822d46e..9a68e547a0 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -34,8 +34,10 @@ void rpcbuf_init(RPC_BUFFER *buffer, uint32 size, TALLOC_CTX *ctx) { buffer->size = size; buffer->string_at_end = size; - prs_init(&buffer->prs, size, ctx, MARSHALL); - buffer->struct_start = prs_offset(&buffer->prs); + if (prs_init(&buffer->prs, size, ctx, MARSHALL)) + buffer->struct_start = prs_offset(&buffer->prs); + else + buffer->struct_start = NULL; } /******************************************************************* diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 418f857df8..3850c440af 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -285,7 +285,8 @@ bool smb_io_strhdr(const char *desc, STRHDR *hdr, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "smb_io_strhdr"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; if(!prs_uint16("str_str_len", ps, depth, &hdr->str_str_len)) return False; @@ -1761,10 +1762,14 @@ bool smb_io_bufhdr2(const char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "smb_io_bufhdr2"); depth++; - prs_align(ps); - prs_uint32("info_level", ps, depth, &(hdr->info_level)); - prs_uint32("length ", ps, depth, &(hdr->length )); - prs_uint32("buffer ", ps, depth, &(hdr->buffer )); + if (!prs_align(ps)) + return False; + if (!prs_uint32("info_level", ps, depth, &(hdr->info_level))) + return False; + if (!prs_uint32("length ", ps, depth, &(hdr->length ))) + return False; + if (!prs_uint32("buffer ", ps, depth, &(hdr->buffer ))) + return False; return True; } @@ -1777,9 +1782,12 @@ bool smb_io_bufhdr4(const char *desc, BUFHDR4 *hdr, prs_struct *ps, int depth) prs_debug(ps, depth, desc, "smb_io_bufhdr4"); depth++; - prs_align(ps); - prs_uint32("size", ps, depth, &hdr->size); - prs_uint32("buffer", ps, depth, &hdr->buffer); + if (!prs_align(ps)) + return False; + if (!prs_uint32("size", ps, depth, &hdr->size)) + return False; + if (!prs_uint32("buffer", ps, depth, &hdr->buffer)) + return False; return True; } @@ -1793,7 +1801,8 @@ bool smb_io_rpc_blob(const char *desc, RPC_DATA_BLOB *blob, prs_struct *ps, int prs_debug(ps, depth, desc, "smb_io_rpc_blob"); depth++; - prs_align(ps); + if (!prs_align(ps)) + return False; if ( !prs_uint32("buf_len", ps, depth, &blob->buf_len) ) return False; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 638d71a73e..072132f5ac 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1496,7 +1496,7 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps, TALLOC_CTX *m { TDB_DATA dbuf; - prs_init(ps, 0, mem_ctx, UNMARSHALL); + prs_init_empty(ps, mem_ctx, UNMARSHALL); dbuf = tdb_fetch(tdb, kbuf); if (!dbuf.dptr) -- cgit From a307107c3cb26ef1825db963e701f22ad08b18c6 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 19 Mar 2008 01:31:09 +0100 Subject: Remove unused marshalling for SRV_NET_FILE_ENUM. Guenther (This used to be commit fcdc09674571b8e81233acc9e8dc8651b66cd21d) --- source3/rpc_parse/parse_srv.c | 289 ------------------------------------------ 1 file changed, 289 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index b18484893c..975525430e 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -698,292 +698,3 @@ bool srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_str return True; } - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_file_info3_str(const char *desc, FILE_INFO_3 *sh1, prs_struct *ps, int depth) -{ - if (sh1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_file_info3_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if ( sh1->path ) { - if(!smb_io_unistr2("", sh1->path, True, ps, depth)) - return False; - } - - if ( sh1->user ) { - if(!smb_io_unistr2("", sh1->user, True, ps, depth)) - return False; - } - - return True; -} - -/******************************************************************* - Inits a FILE_INFO_3 structure -********************************************************************/ - -void init_srv_file_info3( FILE_INFO_3 *fl3, uint32 id, uint32 perms, uint32 num_locks, - const char *user_name, const char *path_name ) -{ - fl3->id = id; - fl3->perms = perms; - fl3->num_locks = num_locks; - - if ( path_name ) { - if ( (fl3->path = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) - return; - init_unistr2(fl3->path, path_name, UNI_STR_TERMINATE); - } - - if ( user_name ) { - if ( (fl3->user = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) - return; - init_unistr2(fl3->user, user_name, UNI_STR_TERMINATE); - } - - return; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) -{ - uint32 uni_p; - - if (fl3 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_file_info3"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("id ", ps, depth, &fl3->id)) - return False; - if(!prs_uint32("perms ", ps, depth, &fl3->perms)) - return False; - if(!prs_uint32("num_locks ", ps, depth, &fl3->num_locks)) - return False; - - uni_p = fl3->path ? 1 : 0; - if(!prs_uint32("ptr", ps, depth, &uni_p)) - return False; - if (UNMARSHALLING(ps)) { - if ( (fl3->path = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) { - return False; - } - } - - uni_p = fl3->user ? 1 : 0; - if(!prs_uint32("ptr", ps, depth, &uni_p)) - return False; - if (UNMARSHALLING(ps)) { - if ( (fl3->user = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) { - return False; - } - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct *ps, int depth) -{ - if (ctr == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_file_ctr"); - depth++; - - if (UNMARSHALLING(ps)) { - ZERO_STRUCTP(ctr); - } - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("level", ps, depth, &ctr->level)) - return False; - - if(!prs_uint32("ptr_file_info", ps, depth, &ctr->ptr_file_info)) - return False; - if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries)) - return False; - if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries)) - return False; - - if (ctr->ptr_entries == 0) - return True; - - if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2)) - return False; - - switch (ctr->level) { - case 3: { - FILE_INFO_3 *info3 = ctr->file.info3; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info3 = PRS_ALLOC_MEM(ps, FILE_INFO_3, num_entries))) - return False; - ctr->file.info3 = info3; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_file_info3("", &ctr->file.info3[i], ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_file_info3_str("", &ctr->file.info3[i], ps, depth)) - return False; - } - break; - } - default: - DEBUG(5,("%s no file info at switch_value %d\n", tab_depth(5,depth), ctr->level)); - break; - } - - return True; -} - -/******************************************************************* - Inits a SRV_Q_NET_FILE_ENUM structure. -********************************************************************/ - -void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, - const char *srv_name, const char *qual_name, - const char *user_name, - uint32 file_level, SRV_FILE_INFO_CTR *ctr, - uint32 preferred_len, - ENUM_HND *hnd) -{ - uint32 ptr; - - if ( srv_name ) { - if ( (q_n->servername = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) - return; - init_buf_unistr2(q_n->servername, &ptr, srv_name); - } - - if ( qual_name ) { - if ( (q_n->qualifier = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) - return; - init_buf_unistr2(q_n->qualifier, &ptr, qual_name); - } - - if ( user_name ) { - if ( (q_n->username = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) - return; - init_buf_unistr2(q_n->username, &ptr, user_name); - } - - q_n->level = q_n->ctr.level = file_level; - - q_n->preferred_len = preferred_len; - q_n->ctr.ptr_file_info = 1; - q_n->ctr.num_entries = 0; - q_n->ctr.num_entries2 = 0; - - memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_file_enum"); - 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("qualifier", ps, depth, (void*)&q_u->qualifier, - sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_pointer("username", ps, depth, (void*)&q_u->username, - sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("level", ps, depth, &q_u->level)) - return False; - - if (q_u->level != (uint32)-1) { - if(!srv_io_srv_file_ctr("file_ctr", &q_u->ctr, ps, depth)) - return False; - } - - if(!prs_uint32("preferred_len", ps, depth, &q_u->preferred_len)) - return False; - - if(!smb_io_enum_hnd("enum_hnd", &q_u->enum_hnd, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_file_enum"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("level", ps, depth, &r_n->level)) - return False; - - if (r_n->level != 0) { - if(!srv_io_srv_file_ctr("file_ctr", &r_n->ctr, ps, depth)) - return False; - } - - if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) - return False; - if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) - return False; - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} -- cgit From 31c83b750553d46792102e8afc889da7d99be859 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 19 Mar 2008 17:04:50 +0100 Subject: Fix a warning (This used to be commit c40648ea4d7897c401a5a94703e586acfdaec13b) --- source3/rpc_parse/parse_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index 9a68e547a0..bb39a58c07 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -37,7 +37,7 @@ void rpcbuf_init(RPC_BUFFER *buffer, uint32 size, TALLOC_CTX *ctx) if (prs_init(&buffer->prs, size, ctx, MARSHALL)) buffer->struct_start = prs_offset(&buffer->prs); else - buffer->struct_start = NULL; + buffer->struct_start = 0; } /******************************************************************* -- cgit From 8ca8dad7a1f9f1df2ee18d8944489c58e9feb070 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 20 Mar 2008 01:40:04 +0100 Subject: Remove unused marshalling for SVCCTL_ENUM_DEPENDENT_SERVICES. Guenther (This used to be commit 5838d81346a51ef1e996bab938533ae2097f7e47) --- source3/rpc_parse/parse_svcctl.c | 56 ---------------------------------------- 1 file changed, 56 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index 62c1e21927..c5d93864ba 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -262,62 +262,6 @@ bool svcctl_io_r_enum_services_status(const char *desc, SVCCTL_R_ENUM_SERVICES_S /******************************************************************* ********************************************************************/ -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) - return False; - - prs_debug(ps, depth, desc, "svcctl_io_q_enum_dependent_services"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth)) - return False; - - if(!prs_uint32("state", ps, depth, &q_u->state)) - return False; - if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -bool svcctl_io_r_enum_dependent_services(const char *desc, SVCCTL_R_ENUM_DEPENDENT_SERVICES *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "svcctl_io_r_enum_dependent_services"); - depth++; - - if(!prs_align(ps)) - return False; - - if (!prs_rpcbuffer("", ps, depth, &r_u->buffer)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("needed", ps, depth, &r_u->needed)) - return False; - if(!prs_uint32("returned", ps, depth, &r_u->returned)) - 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) -- cgit From 10f40399e0ee510ff8d1b4dcad249b3aa44e9720 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 21 Mar 2008 02:01:58 +0100 Subject: Remove unused marshalling for SRV_NET_CONN_ENUM. Guenther (This used to be commit 51467443f70a53c3290f26f94cdaf8a64f58c2af) --- source3/rpc_parse/parse_srv.c | 365 ------------------------------------------ 1 file changed, 365 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 975525430e..afaf592d42 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -333,368 +333,3 @@ bool srv_io_r_net_sess_enum(const char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_stru return True; } - -/******************************************************************* - Inits a CONN_INFO_0 structure -********************************************************************/ - -void init_srv_conn_info0(CONN_INFO_0 *ss0, uint32 id) -{ - DEBUG(5,("init_srv_conn_info0\n")); - - ss0->id = id; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_conn_info0(const char *desc, CONN_INFO_0 *ss0, prs_struct *ps, int depth) -{ - if (ss0 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_conn_info0"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("id", ps, depth, &ss0->id)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_srv_conn_info_0(const char *desc, SRV_CONN_INFO_0 *ss0, prs_struct *ps, int depth) -{ - if (ss0 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_conn_info_0"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read)) - return False; - if(!prs_uint32("ptr_conn_info", ps, depth, &ss0->ptr_conn_info)) - return False; - - if (ss0->ptr_conn_info != 0) { - int i; - int num_entries = ss0->num_entries_read; - - if (num_entries > MAX_CONN_ENTRIES) { - num_entries = MAX_CONN_ENTRIES; /* report this! */ - } - - if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2)) - return False; - - for (i = 0; i < num_entries; i++) { - if(!srv_io_conn_info0("", &ss0->info_0[i], ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - } - - return True; -} - -/******************************************************************* - Inits a CONN_INFO_1_STR structure -********************************************************************/ - -void init_srv_conn_info1_str(CONN_INFO_1_STR *ss1, const char *usr_name, const char *net_name) -{ - DEBUG(5,("init_srv_conn_info1_str\n")); - - init_unistr2(&ss1->uni_usr_name, usr_name, UNI_STR_TERMINATE); - init_unistr2(&ss1->uni_net_name, net_name, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_conn_info1_str(const char *desc, CONN_INFO_1_STR *ss1, prs_struct *ps, int depth) -{ - if (ss1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_conn_info1_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("", &ss1->uni_usr_name, True, ps, depth)) - return False; - if(!smb_io_unistr2("", &ss1->uni_net_name, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Inits a CONN_INFO_1 structure -********************************************************************/ - -void init_srv_conn_info1(CONN_INFO_1 *ss1, - uint32 id, uint32 type, - uint32 num_opens, uint32 num_users, uint32 open_time, - const char *usr_name, const char *net_name) -{ - DEBUG(5,("init_srv_conn_info1: %s %s\n", usr_name, net_name)); - - ss1->id = id ; - ss1->type = type ; - ss1->num_opens = num_opens ; - ss1->num_users = num_users; - ss1->open_time = open_time; - - ss1->ptr_usr_name = (usr_name != NULL) ? 1 : 0; - ss1->ptr_net_name = (net_name != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_conn_info1(const char *desc, CONN_INFO_1 *ss1, prs_struct *ps, int depth) -{ - if (ss1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_conn_info1"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("id ", ps, depth, &ss1->id)) - return False; - if(!prs_uint32("type ", ps, depth, &ss1->type)) - return False; - if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens)) - return False; - if(!prs_uint32("num_users ", ps, depth, &ss1->num_users)) - return False; - if(!prs_uint32("open_time ", ps, depth, &ss1->open_time)) - return False; - - if(!prs_uint32("ptr_usr_name", ps, depth, &ss1->ptr_usr_name)) - return False; - if(!prs_uint32("ptr_net_name", ps, depth, &ss1->ptr_net_name)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_srv_conn_info_1(const char *desc, SRV_CONN_INFO_1 *ss1, prs_struct *ps, int depth) -{ - if (ss1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_conn_info_1"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read)) - return False; - if(!prs_uint32("ptr_conn_info", ps, depth, &ss1->ptr_conn_info)) - return False; - - if (ss1->ptr_conn_info != 0) { - int i; - int num_entries = ss1->num_entries_read; - - if (num_entries > MAX_CONN_ENTRIES) { - num_entries = MAX_CONN_ENTRIES; /* report this! */ - } - - if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2)) - return False; - - for (i = 0; i < num_entries; i++) { - if(!srv_io_conn_info1("", &ss1->info_1[i], ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_conn_info1_str("", &ss1->info_1_str[i], ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_srv_conn_ctr(const char *desc, SRV_CONN_INFO_CTR **pp_ctr, prs_struct *ps, int depth) -{ - SRV_CONN_INFO_CTR *ctr = *pp_ctr; - - prs_debug(ps, depth, desc, "srv_io_srv_conn_ctr"); - depth++; - - if (UNMARSHALLING(ps)) { - ctr = *pp_ctr = PRS_ALLOC_MEM(ps, SRV_CONN_INFO_CTR, 1); - if (ctr == NULL) - return False; - } - - if (ctr == NULL) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) - return False; - if(!prs_uint32("ptr_conn_ctr", ps, depth, &ctr->ptr_conn_ctr)) - return False; - - if (ctr->ptr_conn_ctr != 0) { - switch (ctr->switch_value) { - case 0: - if(!srv_io_srv_conn_info_0("", &ctr->conn.info0, ps, depth)) - return False; - break; - case 1: - if(!srv_io_srv_conn_info_1("", &ctr->conn.info1, ps, depth)) - return False; - break; - default: - DEBUG(5,("%s no connection info at switch_value %d\n", - tab_depth(5,depth), ctr->switch_value)); - break; - } - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -void init_srv_q_net_conn_enum(SRV_Q_NET_CONN_ENUM *q_n, - const char *srv_name, const char *qual_name, - uint32 conn_level, SRV_CONN_INFO_CTR *ctr, - uint32 preferred_len, - ENUM_HND *hnd) -{ - DEBUG(5,("init_q_net_conn_enum\n")); - - q_n->ctr = ctr; - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name ); - init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name); - - q_n->conn_level = conn_level; - q_n->preferred_len = preferred_len; - - memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_conn_enum(const char *desc, SRV_Q_NET_CONN_ENUM *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_conn_enum"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name ", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, q_n->ptr_srv_name, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("conn_level", ps, depth, &q_n->conn_level)) - return False; - - if (q_n->conn_level != (uint32)-1) { - if(!srv_io_srv_conn_ctr("conn_ctr", &q_n->ctr, ps, depth)) - return False; - } - - if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) - return False; - - if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_conn_enum"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("conn_level", ps, depth, &r_n->conn_level)) - return False; - - if (r_n->conn_level != (uint32)-1) { - if(!srv_io_srv_conn_ctr("conn_ctr", &r_n->ctr, ps, depth)) - return False; - } - - if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) - return False; - if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) - return False; - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} -- cgit From 286a6282e2151a0cbe995bd7046c5054db9c2d7f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 21 Mar 2008 03:53:18 +0100 Subject: Remove unused marshalling for SRV_NET_SESS_ENUM. Guenther (This used to be commit 54554683d63575cfdfa24f89952737ccf7ae5bc0) --- source3/rpc_parse/parse_srv.c | 304 ------------------------------------------ 1 file changed, 304 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index afaf592d42..2dce494b69 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -28,308 +28,4 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/******************************************************************* - Inits a SESS_INFO_0_STR structure -********************************************************************/ -void init_srv_sess_info0( SESS_INFO_0 *ss0, const char *name ) -{ - ZERO_STRUCTP( ss0 ); - - if ( name ) { - if ( (ss0->sharename = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) { - DEBUG(0,("init_srv_sess_info0: talloc failed!\n")); - return; - } - init_unistr2( ss0->sharename, name, UNI_STR_TERMINATE ); - } -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_struct *ps, int depth) -{ - if (ss0 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_sess_info_0"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_entries_read", ps, depth, &ss0->num_entries_read)) - return False; - if(!prs_uint32("ptr_sess_info", ps, depth, &ss0->ptr_sess_info)) - return False; - - if (ss0->ptr_sess_info != 0) { - uint32 i; - uint32 num_entries = ss0->num_entries_read; - - if (num_entries > MAX_SESS_ENTRIES) { - num_entries = MAX_SESS_ENTRIES; /* report this! */ - } - - if(!prs_uint32("num_entries_read2", ps, depth, &ss0->num_entries_read2)) - return False; - - SMB_ASSERT_ARRAY(ss0->info_0, num_entries); - - /* first the pointers */ - for (i = 0; i < num_entries; i++) { - if ( !prs_io_unistr2_p("", ps, depth, &ss0->info_0[i].sharename ) ) - return False; - } - - /* now the strings */ - for (i = 0; i < num_entries; i++) { - if ( !prs_io_unistr2("sharename", ps, depth, ss0->info_0[i].sharename )) - return False; - } - - if(!prs_align(ps)) - return False; - } - - return True; -} - -/******************************************************************* - Inits a SESS_INFO_1 structure -********************************************************************/ - -void init_srv_sess_info1( SESS_INFO_1 *ss1, const char *name, const char *user, - uint32 num_opens, uint32 open_time, uint32 idle_time, - uint32 user_flags) -{ - DEBUG(5,("init_srv_sess_info1: %s\n", name)); - - ZERO_STRUCTP( ss1 ); - - if ( name ) { - if ( (ss1->sharename = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) { - DEBUG(0,("init_srv_sess_info0: talloc failed!\n")); - return; - } - init_unistr2( ss1->sharename, name, UNI_STR_TERMINATE ); - } - - if ( user ) { - if ( (ss1->username = TALLOC_P( talloc_tos(), UNISTR2 )) == NULL ) { - DEBUG(0,("init_srv_sess_info0: talloc failed!\n")); - return; - } - init_unistr2( ss1->username, user, UNI_STR_TERMINATE ); - } - - ss1->num_opens = num_opens; - ss1->open_time = open_time; - ss1->idle_time = idle_time; - ss1->user_flags = user_flags; -} - - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_srv_sess_info_1(const char *desc, SRV_SESS_INFO_1 *ss1, prs_struct *ps, int depth) -{ - if (ss1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_sess_info_1"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_entries_read", ps, depth, &ss1->num_entries_read)) - return False; - if(!prs_uint32("ptr_sess_info", ps, depth, &ss1->ptr_sess_info)) - return False; - - if (ss1->ptr_sess_info != 0) { - uint32 i; - uint32 num_entries = ss1->num_entries_read; - - if (num_entries > MAX_SESS_ENTRIES) { - num_entries = MAX_SESS_ENTRIES; /* report this! */ - } - - if(!prs_uint32("num_entries_read2", ps, depth, &ss1->num_entries_read2)) - return False; - - SMB_ASSERT_ARRAY(ss1->info_1, num_entries); - - /* first the pointers and flags */ - - for (i = 0; i < num_entries; i++) { - - if ( !prs_io_unistr2_p("", ps, depth, &ss1->info_1[i].sharename )) - return False; - if ( !prs_io_unistr2_p("", ps, depth, &ss1->info_1[i].username )) - return False; - - if(!prs_uint32("num_opens ", ps, depth, &ss1->info_1[i].num_opens)) - return False; - if(!prs_uint32("open_time ", ps, depth, &ss1->info_1[i].open_time)) - return False; - if(!prs_uint32("idle_time ", ps, depth, &ss1->info_1[i].idle_time)) - return False; - if(!prs_uint32("user_flags", ps, depth, &ss1->info_1[i].user_flags)) - return False; - } - - /* now the strings */ - - for (i = 0; i < num_entries; i++) { - if ( !prs_io_unistr2("", ps, depth, ss1->info_1[i].sharename )) - return False; - if ( !prs_io_unistr2("", ps, depth, ss1->info_1[i].username )) - return False; - } - - if(!prs_align(ps)) - return False; - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, prs_struct *ps, int depth) -{ - SRV_SESS_INFO_CTR *ctr = *pp_ctr; - - prs_debug(ps, depth, desc, "srv_io_srv_sess_ctr"); - depth++; - - if(UNMARSHALLING(ps)) { - ctr = *pp_ctr = PRS_ALLOC_MEM(ps, SRV_SESS_INFO_CTR, 1); - if (ctr == NULL) - return False; - } - - if (ctr == NULL) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) - return False; - if(!prs_uint32("ptr_sess_ctr", ps, depth, &ctr->ptr_sess_ctr)) - return False; - - if (ctr->ptr_sess_ctr != 0) { - switch (ctr->switch_value) { - case 0: - if(!srv_io_srv_sess_info_0("", &ctr->sess.info0, ps, depth)) - return False; - break; - case 1: - if(!srv_io_srv_sess_info_1("", &ctr->sess.info1, ps, depth)) - return False; - break; - default: - DEBUG(5,("%s no session info at switch_value %d\n", - tab_depth(5,depth), ctr->switch_value)); - break; - } - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum"); - 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("qualifier", ps, depth, (void*)&q_u->qualifier, - sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_pointer("username", ps, depth, (void*)&q_u->username, - sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("sess_level", ps, depth, &q_u->sess_level)) - return False; - - if (q_u->sess_level != (uint32)-1) { - if(!srv_io_srv_sess_ctr("sess_ctr", &q_u->ctr, ps, depth)) - return False; - } - - if(!prs_uint32("preferred_len", ps, depth, &q_u->preferred_len)) - return False; - - if(!smb_io_enum_hnd("enum_hnd", &q_u->enum_hnd, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_r_net_sess_enum(const char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_sess_enum"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("sess_level", ps, depth, &r_n->sess_level)) - return False; - - if (r_n->sess_level != (uint32)-1) { - if(!srv_io_srv_sess_ctr("sess_ctr", &r_n->ctr, ps, depth)) - return False; - } - - if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) - return False; - if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) - return False; - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} -- cgit From 5fdf4b8f4ae41bc44cdbfa6ac82d857c3dd955c1 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 21 Mar 2008 04:12:52 +0100 Subject: Remove remaining old srvsvc client and server rpc code entirely. Guenther (This used to be commit a5f0186f70abe8dba650265219e69ce5ca2fb642) --- source3/rpc_parse/parse_srv.c | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 source3/rpc_parse/parse_srv.c (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c deleted file mode 100644 index 2dce494b69..0000000000 --- a/source3/rpc_parse/parse_srv.c +++ /dev/null @@ -1,31 +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) Jeremy Allison 1999, - * Copyright (C) Nigel Williams 2001, - * Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2002. - * Copyright (C) Gerald (Jerry) Carter 2006. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#include "includes.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_RPC_PARSE - - -- cgit From 43554ded6de6cc8e70b6146f245e6a421823f203 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 23 Mar 2008 17:32:46 +0100 Subject: Fix Coverity ID 462 (This used to be commit 9cf1e16a9c3cade9cd905f719de07578b3a91b1e) --- source3/rpc_parse/parse_buffer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index bb39a58c07..63a73c4b7c 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -374,8 +374,10 @@ bool smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16 return False; do { - if (!smb_io_unistr(desc, &chaine, ps, depth)) + if (!smb_io_unistr(desc, &chaine, ps, depth)) { + SAFE_FREE(chaine2); return False; + } l_chaine=str_len_uni(&chaine); @@ -402,10 +404,10 @@ bool smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16 { chaine2[l_chaine2] = '\0'; *string=(uint16 *)TALLOC_MEMDUP(prs_get_mem_context(ps),chaine2,realloc_size); + SAFE_FREE(chaine2); if (!*string) { return False; } - SAFE_FREE(chaine2); } if(!prs_set_offset(ps, old_offset)) -- cgit From bf5bccd67e1d14f6d6cd9ed0a39e3ffcc4d0efa6 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 23 Mar 2008 19:38:02 +0100 Subject: Fix Coverity ID 503 (This used to be commit 5c43c38271bae7d96d0cfbdaba7bff838a684b40) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 3bf8ef27c1..d762cb2ca7 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4785,7 +4785,7 @@ bool spoolss_io_q_addprinterex(const char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_ if (!sec_io_desc_buf(desc, &q_u->secdesc_ctr, ps, depth)) return False; } else { - uint32 dummy; + uint32 dummy = 0; /* Parse a NULL security descriptor. This should really happen inside the sec_io_desc_buf() function. */ -- cgit From dc014a0b103cf3fcefe72daace142acef16b9f4c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 23 Mar 2008 19:38:50 +0100 Subject: Fix Coverity ID 504 (This used to be commit 4e6f8a19a6861c332ee6e9b49551e12440eefdc2) --- source3/rpc_parse/parse_spoolss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index d762cb2ca7..bf7166b2ad 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7205,7 +7205,7 @@ bool make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTOR bool spoolss_io_q_getprintprocessordirectory(const char *desc, SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, prs_struct *ps, int depth) { - uint32 ptr; + uint32 ptr = 0; prs_debug(ps, depth, desc, "spoolss_io_q_getprintprocessordirectory"); depth++; -- cgit From de34a7d30347772a32813775a6aead07462eaa96 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 27 Mar 2008 21:58:11 +0100 Subject: Remove unused marshalling for Netlogon Lockout String. Guenther (This used to be commit d87133d0516294e7d5f123e3bb2e93c179c72677) --- source3/rpc_parse/parse_misc.c | 47 ------------------------------------------ 1 file changed, 47 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 3850c440af..cf989c8b5e 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -1145,53 +1145,6 @@ bool init_unistr4_array( UNISTR4_ARRAY *array, uint32 count, const char **string return True; } -bool smb_io_lockout_string_hdr(const char *desc, HDR_LOCKOUT_STRING *hdr_account_lockout, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "smb_io_lockout_string_hdr"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint16("size", ps, depth, &hdr_account_lockout->size)) - return False; - if(!prs_uint16("length", ps, depth, &hdr_account_lockout->length)) - return False; - if(!prs_uint32("buffer", ps, depth, &hdr_account_lockout->buffer)) - return False; - - return True; -} - -bool smb_io_account_lockout_str(const char *desc, LOCKOUT_STRING *account_lockout, uint32 buffer, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "smb_io_account_lockout_string"); - depth++; - - if(!prs_uint32("array_size", ps, depth, &account_lockout->array_size)) - return False; - - if(!prs_uint32("offset", ps, depth, &account_lockout->offset)) - return False; - if(!prs_uint32("length", ps, depth, &account_lockout->length)) - return False; - - if (!prs_uint64("lockout_duration", ps, depth, &account_lockout->lockout_duration)) - return False; - if (!prs_uint64("reset_count", ps, depth, &account_lockout->reset_count)) - return False; - if (!prs_uint32("bad_attempt_lockout", ps, depth, &account_lockout->bad_attempt_lockout)) - return False; - if (!prs_uint32("dummy", ps, depth, &account_lockout->dummy)) - return False; -#if 0 - if(!prs_uint16s (False, "bindata", ps, depth, &account_lockout->bindata, length)) - return False; -#endif - - return True; -} - /******************************************************************* Inits a DOM_RID structure. ********************************************************************/ -- cgit From 28fd4f6fcb101fc0274c43611a59d22072fb7891 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 20:26:52 +0200 Subject: Reconcile ndr_syntax_id used by pidl-generated code and Samba3's RFC_IFACE. (This used to be commit 7bea00dca1ee08ef731dfa73110ef9c190a29919) --- source3/rpc_parse/parse_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index b696080aef..268bee7e51 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -326,7 +326,7 @@ static bool smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, i if (!smb_io_uuid( "uuid", &ifc->uuid, ps, depth)) return False; - if(!prs_uint32 ("version", ps, depth, &ifc->version)) + if(!prs_uint32 ("version", ps, depth, &ifc->if_version)) return False; return True; -- cgit From e3246e8720c74bb62a2b86b21f6147ea6f050054 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 18:24:11 +0200 Subject: Actually connect to RPC. (This used to be commit 3082534454ff936ac0b78b5a2c72c9b060e21244) --- source3/rpc_parse/parse_rpc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 268bee7e51..9eeae176c7 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -234,6 +234,21 @@ const char *cli_get_pipe_name(int pipe_idx) return &pipe_names[pipe_idx].client_pipe[5]; } +/**************************************************************************** + Return the pipe idx from the syntax. + ****************************************************************************/ +int cli_get_pipe_idx(const RPC_IFACE *syntax) +{ + int i; + for (i = 0; pipe_names[i].client_pipe; i++) { + if (GUID_equal(&pipe_names[i].abstr_syntax.uuid, &syntax->uuid) && + pipe_names[i].abstr_syntax.version == syntax->version) + return i; + } + + return -1; +} + /******************************************************************* Inits an RPC_HDR structure. ********************************************************************/ -- cgit From f303547e1f34de0b12f1341c6e234112aa37b9f0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 13:46:13 +0200 Subject: Remove copying of interface syntax id. (This used to be commit 0012dfbe1fcf17486a24366b939054b5637646e3) --- source3/rpc_parse/parse_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 9eeae176c7..7de6998c9d 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -242,7 +242,7 @@ int cli_get_pipe_idx(const RPC_IFACE *syntax) int i; for (i = 0; pipe_names[i].client_pipe; i++) { if (GUID_equal(&pipe_names[i].abstr_syntax.uuid, &syntax->uuid) && - pipe_names[i].abstr_syntax.version == syntax->version) + pipe_names[i].abstr_syntax.if_version == syntax->if_version) return i; } -- cgit From a4c60b2696962c7f83e033e00d97e4b1dacc05c9 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 17:44:40 +0200 Subject: rpc_parse: Use UUIDs from librpc/gen_ndr/ when possible to reduce duplication. (This used to be commit 428654b473ba44b2f5340eefef0d4fcd51aff558) --- source3/rpc_parse/parse_rpc.c | 213 +++++------------------------------------- 1 file changed, 25 insertions(+), 188 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 7de6998c9d..6b6e1424e0 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -29,176 +29,14 @@ interface/version dce/rpc pipe identification ********************************************************************/ -#define TRANS_SYNT_V2 \ -{ \ - { \ - 0x8a885d04, 0x1ceb, 0x11c9, \ - { 0x9f, 0xe8 }, \ - { 0x08, 0x00, \ - 0x2b, 0x10, 0x48, 0x60 } \ - }, 0x02 \ -} - -#define SYNT_NETLOGON_V2 \ -{ \ - { \ - 0x8a885d04, 0x1ceb, 0x11c9, \ - { 0x9f, 0xe8 }, \ - { 0x08, 0x00, \ - 0x2b, 0x10, 0x48, 0x60 } \ - }, 0x02 \ -} - -#define SYNT_WKSSVC_V1 \ -{ \ - { \ - 0x6bffd098, 0xa112, 0x3610, \ - { 0x98, 0x33 }, \ - { 0x46, 0xc3, \ - 0xf8, 0x7e, 0x34, 0x5a } \ - }, 0x01 \ -} - -#define SYNT_SRVSVC_V3 \ -{ \ - { \ - 0x4b324fc8, 0x1670, 0x01d3, \ - { 0x12, 0x78 }, \ - { 0x5a, 0x47, \ - 0xbf, 0x6e, 0xe1, 0x88 } \ - }, 0x03 \ -} - -#define SYNT_LSARPC_V0 \ -{ \ - { \ - 0x12345778, 0x1234, 0xabcd, \ - { 0xef, 0x00 }, \ - { 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xab } \ - }, 0x00 \ -} - -#define SYNT_LSARPC_V0_DS \ -{ \ - { \ - 0x3919286a, 0xb10c, 0x11d0, \ - { 0x9b, 0xa8 }, \ - { 0x00, 0xc0, \ - 0x4f, 0xd9, 0x2e, 0xf5 } \ - }, 0x00 \ -} - -#define SYNT_SAMR_V1 \ -{ \ - { \ - 0x12345778, 0x1234, 0xabcd, \ - { 0xef, 0x00 }, \ - { 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xac } \ - }, 0x01 \ -} - -#define SYNT_NETLOGON_V1 \ -{ \ - { \ - 0x12345678, 0x1234, 0xabcd, \ - { 0xef, 0x00 }, \ - { 0x01, 0x23, \ - 0x45, 0x67, 0xcf, 0xfb } \ - }, 0x01 \ -} - -#define SYNT_WINREG_V1 \ -{ \ - { \ - 0x338cd001, 0x2244, 0x31f1, \ - { 0xaa, 0xaa }, \ - { 0x90, 0x00, \ - 0x38, 0x00, 0x10, 0x03 } \ - }, 0x01 \ -} - -#define SYNT_SPOOLSS_V1 \ -{ \ - { \ - 0x12345678, 0x1234, 0xabcd, \ - { 0xef, 0x00 }, \ - { 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xab } \ - }, 0x01 \ -} - -#define SYNT_NONE_V0 \ -{ \ - { \ - 0x0, 0x0, 0x0, \ - { 0x00, 0x00 }, \ - { 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00 } \ - }, 0x00 \ -} - -#define SYNT_NETDFS_V3 \ -{ \ - { \ - 0x4fc742e0, 0x4a10, 0x11cf, \ - { 0x82, 0x73 }, \ - { 0x00, 0xaa, \ - 0x00, 0x4a, 0xe6, 0x73 } \ - }, 0x03 \ -} - -#define SYNT_ECHO_V1 \ -{ \ - { \ - 0x60a15ec5, 0x4de8, 0x11d7, \ - { 0xa6, 0x37 }, \ - { 0x00, 0x50, \ - 0x56, 0xa2, 0x01, 0x82 } \ - }, 0x01 \ -} - -#define SYNT_SHUTDOWN_V1 \ -{ \ - { \ - 0x894de0c0, 0x0d55, 0x11d3, \ - { 0xa3, 0x22 }, \ - { 0x00, 0xc0, \ - 0x4f, 0xa3, 0x21, 0xa1 } \ - }, 0x01 \ -} - -#define SYNT_SVCCTL_V2 \ -{ \ - { \ - 0x367abb81, 0x9844, 0x35f1, \ - { 0xad, 0x32 }, \ - { 0x98, 0xf0, \ - 0x38, 0x00, 0x10, 0x03 } \ - }, 0x02 \ -} - - -#define SYNT_EVENTLOG_V0 \ -{ \ - { \ - 0x82273fdc, 0xe32a, 0x18c3, \ - { 0x3f, 0x78 }, \ - { 0x82, 0x79, \ - 0x29, 0xdc, 0x23, 0xea } \ - }, 0x00 \ -} - -#define SYNT_NTSVCS_V1 \ -{ \ - { \ - 0x8d9f4e40, 0xa03d, 0x11ce, \ - { 0x8f, 0x69}, \ - { 0x08, 0x00, \ - 0x3e, 0x30, 0x05, 0x1b } \ - }, 0x01 \ -} +const struct ndr_syntax_id syntax_spoolss = { + { + 0x12345678, 0x1234, 0xabcd, + { 0xef, 0x00 }, + { 0x01, 0x23, + 0x45, 0x67, 0x89, 0xab } + }, 0x01 +}; /* * IMPORTANT!! If you update this structure, make sure to @@ -207,22 +45,21 @@ interface/version dce/rpc pipe identification const struct pipe_id_info pipe_names [] = { - /* client pipe , abstract syntax , server pipe , transfer syntax */ - { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_LSARPC , SYNT_LSARPC_V0_DS , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_NETLOGON, SYNT_NETLOGON_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, - { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, - { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, - { PIPE_ECHO , SYNT_ECHO_V1 , PIPE_ECHO , TRANS_SYNT_V2 }, - { PIPE_SHUTDOWN, SYNT_SHUTDOWN_V1 , PIPE_SHUTDOWN , TRANS_SYNT_V2 }, - { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_EVENTLOG, SYNT_EVENTLOG_V0 , PIPE_EVENTLOG , TRANS_SYNT_V2 }, - { PIPE_NTSVCS , SYNT_NTSVCS_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } + { PIPE_LSARPC , &ndr_table_lsarpc.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, + { PIPE_LSARPC , &ndr_table_dssetup.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, + { PIPE_SAMR , &ndr_table_samr.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, + { PIPE_NETLOGON, &ndr_table_netlogon.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, + { PIPE_SRVSVC , &ndr_table_srvsvc.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, + { PIPE_WKSSVC , &ndr_table_wkssvc.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, + { PIPE_WINREG , &ndr_table_winreg.syntax_id, PIPE_WINREG , &ndr_transfer_syntax }, + { PIPE_SPOOLSS , &syntax_spoolss , PIPE_SPOOLSS , &ndr_transfer_syntax }, + { PIPE_NETDFS , &ndr_table_netdfs.syntax_id, PIPE_NETDFS , &ndr_transfer_syntax }, + { PIPE_ECHO , &ndr_table_rpcecho.syntax_id, PIPE_ECHO , &ndr_transfer_syntax }, + { PIPE_SHUTDOWN, &ndr_table_initshutdown.syntax_id, PIPE_SHUTDOWN , &ndr_transfer_syntax }, + { PIPE_SVCCTL , &ndr_table_svcctl.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, + { PIPE_EVENTLOG, &ndr_table_eventlog.syntax_id, PIPE_EVENTLOG , &ndr_transfer_syntax }, + { PIPE_NTSVCS , &ndr_table_ntsvcs.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, + { NULL , NULL , NULL , NULL } }; /**************************************************************************** @@ -241,8 +78,8 @@ int cli_get_pipe_idx(const RPC_IFACE *syntax) { int i; for (i = 0; pipe_names[i].client_pipe; i++) { - if (GUID_equal(&pipe_names[i].abstr_syntax.uuid, &syntax->uuid) && - pipe_names[i].abstr_syntax.if_version == syntax->if_version) + if (GUID_equal(&pipe_names[i].abstr_syntax->uuid, &syntax->uuid) && + pipe_names[i].abstr_syntax->if_version == syntax->if_version) return i; } -- cgit From f56eedb95c64593ceff0ef91b99729c5071aa7ac Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Apr 2008 11:45:41 +0200 Subject: Remove the pipe_idx variable from rpc_pipe_client (This used to be commit 4840febcd481563c3d9b2fabc1fe1b2ae5a76cf6) --- source3/rpc_parse/parse_rpc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 6b6e1424e0..893eb57808 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -252,7 +252,8 @@ static bool smb_io_rpc_hdr_bba(const char *desc, RPC_HDR_BBA *rpc, prs_struct * Note the transfer pointer must remain valid until this is marshalled. ********************************************************************/ -void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id, RPC_IFACE *abstract, RPC_IFACE *transfer) +void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id, + const RPC_IFACE *abstract, const RPC_IFACE *transfer) { rpc_ctx->context_id = context_id ; /* presentation context identifier (0x0) */ rpc_ctx->num_transfer_syntaxes = 1 ; /* the number of syntaxes (has always been 1?)(0x1) */ -- cgit From 166efed281599ba331c379e474120ce5b46271f0 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 20 Apr 2008 22:06:37 +0200 Subject: rpc_parse: fix "assignment discards qualifier" warning by using CONST_DISCARD. Michael (This used to be commit 0de001a5446545b928eb88e1916b4fe674017424) --- source3/rpc_parse/parse_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 893eb57808..d0be83bd4e 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -262,7 +262,7 @@ void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id, rpc_ctx->abstract = *abstract; /* vers. of interface to use for replies */ - rpc_ctx->transfer = transfer; + rpc_ctx->transfer = CONST_DISCARD(RPC_IFACE *, transfer); } /******************************************************************* -- cgit From 189eb93b73c4ff0737b702a0682727f5a22bcc38 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 24 Apr 2008 14:04:47 -0700 Subject: The first of Martin Zielinski Vista printing patches. Jerry will test and should get into 3.2 final (and the next 3.0.x release). Jeremy. (This used to be commit 3fc1ab210b8772ee9f867499c0b1a7bb4bcdd285) --- source3/rpc_parse/parse_spoolss.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index bf7166b2ad..ec6d44293d 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -2129,7 +2129,12 @@ static bool smb_io_reldevmode(const char *desc, RPC_BUFFER *buffer, int depth, D } buffer->string_at_end -= ((*devmode)->size + (*devmode)->driverextra); - + + /* mz: we have to align the device mode for VISTA */ + if (buffer->string_at_end % 4) { + buffer->string_at_end += 4 - (buffer->string_at_end % 4); + } + if(!prs_set_offset(ps, buffer->string_at_end)) return False; -- cgit From 44fbd895e83cb92b462782b73954b4294d46428b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 24 Apr 2008 22:45:28 +0200 Subject: Compile endpoint mapper pidl output (This used to be commit fe8f9e427af3eb42d63fde96c4fe20a255facb95) --- source3/rpc_parse/parse_rpc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index d0be83bd4e..81719512ae 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -59,6 +59,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_SVCCTL , &ndr_table_svcctl.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, { PIPE_EVENTLOG, &ndr_table_eventlog.syntax_id, PIPE_EVENTLOG , &ndr_transfer_syntax }, { PIPE_NTSVCS , &ndr_table_ntsvcs.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, + { PIPE_EPMAPPER , &ndr_table_epmapper.syntax_id, PIPE_EPMAPPER , &ndr_transfer_syntax }, { NULL , NULL , NULL , NULL } }; -- cgit From 6b3bcb3724eed0ddff26dd7af638b606502081ad Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 23 May 2008 23:56:21 +0200 Subject: drsuapi: add all code required for our drsuapi rpc client. Guenther (This used to be commit 7c93190843e77764be4d0f6d4f0b93061c192c98) --- source3/rpc_parse/parse_rpc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 81719512ae..fbdc3ed483 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -60,6 +60,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_EVENTLOG, &ndr_table_eventlog.syntax_id, PIPE_EVENTLOG , &ndr_transfer_syntax }, { PIPE_NTSVCS , &ndr_table_ntsvcs.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, { PIPE_EPMAPPER , &ndr_table_epmapper.syntax_id, PIPE_EPMAPPER , &ndr_transfer_syntax }, + { PIPE_DRSUAPI , &ndr_table_drsuapi.syntax_id, PIPE_DRSUAPI , &ndr_transfer_syntax }, { NULL , NULL , NULL , NULL } }; -- cgit From 6fd4fedb3f81dbc256da57a0e943018d3a489d83 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jul 2008 19:53:01 +0200 Subject: Make use of ndr_syntax_id_equal (This used to be commit 3ab3f2610500107c9cff677746365bba143ca9de) --- source3/rpc_parse/parse_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index fbdc3ed483..ac5483dfd1 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -80,9 +80,9 @@ int cli_get_pipe_idx(const RPC_IFACE *syntax) { int i; for (i = 0; pipe_names[i].client_pipe; i++) { - if (GUID_equal(&pipe_names[i].abstr_syntax->uuid, &syntax->uuid) && - pipe_names[i].abstr_syntax->if_version == syntax->if_version) + if (ndr_syntax_id_equal(pipe_names[i].abstr_syntax, syntax)) { return i; + } } return -1; -- cgit From bf6c11fea3e28532bd8ebc503e9d4d8dfb68e0e0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jul 2008 20:40:27 +0200 Subject: Make the pipe_names[] array static to cli_pipe.c (This used to be commit ab7ab350591bf16717744a0c252d3a9d185bcb77) --- source3/rpc_parse/parse_rpc.c | 63 ------------------------------------------- 1 file changed, 63 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index ac5483dfd1..14a4effbf0 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -25,69 +25,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/******************************************************************* -interface/version dce/rpc pipe identification -********************************************************************/ - -const struct ndr_syntax_id syntax_spoolss = { - { - 0x12345678, 0x1234, 0xabcd, - { 0xef, 0x00 }, - { 0x01, 0x23, - 0x45, 0x67, 0x89, 0xab } - }, 0x01 -}; - -/* - * IMPORTANT!! If you update this structure, make sure to - * update the index #defines in smb.h. - */ - -const struct pipe_id_info pipe_names [] = -{ - { PIPE_LSARPC , &ndr_table_lsarpc.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, - { PIPE_LSARPC , &ndr_table_dssetup.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, - { PIPE_SAMR , &ndr_table_samr.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, - { PIPE_NETLOGON, &ndr_table_netlogon.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, - { PIPE_SRVSVC , &ndr_table_srvsvc.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, - { PIPE_WKSSVC , &ndr_table_wkssvc.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, - { PIPE_WINREG , &ndr_table_winreg.syntax_id, PIPE_WINREG , &ndr_transfer_syntax }, - { PIPE_SPOOLSS , &syntax_spoolss , PIPE_SPOOLSS , &ndr_transfer_syntax }, - { PIPE_NETDFS , &ndr_table_netdfs.syntax_id, PIPE_NETDFS , &ndr_transfer_syntax }, - { PIPE_ECHO , &ndr_table_rpcecho.syntax_id, PIPE_ECHO , &ndr_transfer_syntax }, - { PIPE_SHUTDOWN, &ndr_table_initshutdown.syntax_id, PIPE_SHUTDOWN , &ndr_transfer_syntax }, - { PIPE_SVCCTL , &ndr_table_svcctl.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, - { PIPE_EVENTLOG, &ndr_table_eventlog.syntax_id, PIPE_EVENTLOG , &ndr_transfer_syntax }, - { PIPE_NTSVCS , &ndr_table_ntsvcs.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, - { PIPE_EPMAPPER , &ndr_table_epmapper.syntax_id, PIPE_EPMAPPER , &ndr_transfer_syntax }, - { PIPE_DRSUAPI , &ndr_table_drsuapi.syntax_id, PIPE_DRSUAPI , &ndr_transfer_syntax }, - { NULL , NULL , NULL , NULL } -}; - -/**************************************************************************** - Return the pipe name from the index. - ****************************************************************************/ - -const char *cli_get_pipe_name(int pipe_idx) -{ - return &pipe_names[pipe_idx].client_pipe[5]; -} - -/**************************************************************************** - Return the pipe idx from the syntax. - ****************************************************************************/ -int cli_get_pipe_idx(const RPC_IFACE *syntax) -{ - int i; - for (i = 0; pipe_names[i].client_pipe; i++) { - if (ndr_syntax_id_equal(pipe_names[i].abstr_syntax, syntax)) { - return i; - } - } - - return -1; -} - /******************************************************************* Inits an RPC_HDR structure. ********************************************************************/ -- cgit From 1335da2a7cc639310e5d389e8e8dbe67c4e7ca25 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jul 2008 11:04:31 +0200 Subject: Refactoring: Change calling conventions for cli_rpc_pipe_open_noauth Pass in ndr_syntax_id instead of pipe_idx, return NTSTATUS (This used to be commit 9abc9dc4dc13bd3e42f98eff64eacf24b51f5779) --- source3/rpc_parse/parse_rpc.c | 10 ++++++++++ source3/rpc_parse/parse_spoolss.c | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 14a4effbf0..1477a4c81e 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -639,3 +639,13 @@ bool smb_io_rpc_auth_schannel_chk(const char *desc, int auth_len, return True; } + +const struct ndr_syntax_id syntax_spoolss = { + { + 0x12345678, 0x1234, 0xabcd, + { 0xef, 0x00 }, + { 0x01, 0x23, + 0x45, 0x67, 0x89, 0xab } + }, 0x01 +}; + diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index ec6d44293d..f2d3b53772 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -7724,4 +7724,3 @@ bool convert_port_data_1( NT_PORT_DATA_1 *port1, RPC_BUFFER *buf ) return True; } - -- cgit From 7014c97aab8d252fce6c0e6a9be06e5181ec8f0e Mon Sep 17 00:00:00 2001 From: Karolin Seeger Date: Tue, 22 Jul 2008 21:43:43 +0200 Subject: rpc_parse: Unify spoolss debug messages. Karolin (This used to be commit 5ab391d466ce9ddea31f6f6bf467aa6c5f3a7efb) --- source3/rpc_parse/parse_spoolss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index f2d3b53772..78a80a019b 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1164,7 +1164,7 @@ bool spoolss_io_r_open_printer(const char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_ if (!smb_io_pol_hnd("printer handle",&(r_u->handle),ps,depth)) return False; - if (!prs_werror("status code", ps, depth, &(r_u->status))) + if (!prs_werror("status", ps, depth, &(r_u->status))) return False; return True; @@ -1225,7 +1225,7 @@ bool spoolss_io_r_open_printer_ex(const char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u if (!smb_io_pol_hnd("printer handle",&(r_u->handle),ps,depth)) return False; - if (!prs_werror("status code", ps, depth, &(r_u->status))) + if (!prs_werror("status", ps, depth, &(r_u->status))) return False; return True; -- cgit From 84fca380f2040c53d20fff41972d2f4102183766 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 3 Sep 2008 14:22:48 +0200 Subject: factor prs_append_some_data out of prs_append_some_prs_data (This used to be commit 32cb45c962c822bd79a7d0f666f2f6037060b324) --- source3/rpc_parse/parse_prs.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 072132f5ac..b3deb80c5d 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -395,18 +395,26 @@ bool prs_append_prs_data(prs_struct *dst, prs_struct *src) Append some data from one parse_struct into another. ********************************************************************/ -bool prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uint32 len) -{ - if (len == 0) - return True; +bool prs_append_some_data(prs_struct *dst, void *src_base, uint32_t start, + uint32_t len) +{ + if (len == 0) { + return true; + } - if(!prs_grow(dst, len)) - return False; - - memcpy(&dst->data_p[dst->data_offset], src->data_p + start, (size_t)len); + if(!prs_grow(dst, len)) { + return false; + } + + memcpy(&dst->data_p[dst->data_offset], src_base + start, (size_t)len); dst->data_offset += len; + return true; +} - return True; +bool prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, + uint32 len) +{ + return prs_append_some_data(dst, src->data_p, start, len); } /******************************************************************* -- cgit From beb19da53fc59bd3c09e9967dd243fd963b43382 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 5 Sep 2008 15:20:59 -0700 Subject: Fix "warning: pointer of type 'void *' used in arithmetic". Jeremy. (This used to be commit 2d95ea38a2f1ead37121fcc036c21a7f20ff41f9) --- source3/rpc_parse/parse_prs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index b3deb80c5d..5eb6c31ee6 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -406,7 +406,7 @@ bool prs_append_some_data(prs_struct *dst, void *src_base, uint32_t start, return false; } - memcpy(&dst->data_p[dst->data_offset], src_base + start, (size_t)len); + memcpy(&dst->data_p[dst->data_offset], ((char *)src_base) + start, (size_t)len); dst->data_offset += len; return true; } -- cgit